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AgICAgICAgICBydW5EdW1wSGVhcCgpOwogICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiVW5rbm93biBjb21tYW5kOiAiICsgb3ApOwogICAgICAgICB9CkBAIC0xNDAsNiArMTQyLDExIEBACiAgICAgICAgICAgICAgICAgU3RyaW5nIHZhbHVlID0gbmV4dEFyZ1JlcXVpcmVkKCk7CiAgICAgICAgICAgICAgICAgaW50ZW50LnB1dEV4dHJhKGtleSwgSW50ZWdlci52YWx1ZU9mKHZhbHVlKSk7CiAgICAgICAgICAgICAgICAgaGFzSW50ZW50SW5mbyA9IHRydWU7CisgICAgICAgICAgICB9IGVsc2UgaWYgKG9wdC5lcXVhbHMoIi0tZWwiKSkgeworICAgICAgICAgICAgICAgIFN0cmluZyBrZXkgPSBuZXh0QXJnUmVxdWlyZWQoKTsKKyAgICAgICAgICAgICAgICBTdHJpbmcgdmFsdWUgPSBuZXh0QXJnUmVxdWlyZWQoKTsKKyAgICAgICAgICAgICAgICBpbnRlbnQucHV0RXh0cmEoa2V5LCBMb25nLnZhbHVlT2YodmFsdWUpKTsKKyAgICAgICAgICAgICAgICBoYXNJbnRlbnRJbmZvID0gdHJ1ZTsKICAgICAgICAgICAgIH0gZWxzZSBpZiAob3B0LmVxdWFscygiLS1leiIpKSB7CiAgICAgICAgICAgICAgICAgU3RyaW5nIGtleSA9IG5leHRBcmdSZXF1aXJlZCgpOwogICAgICAgICAgICAgICAgIFN0cmluZyB2YWx1ZSA9IG5leHRBcmdSZXF1aXJlZCgpOwpAQCAtNDI0LDYgKzQzMSwyOCBAQAogICAgICAgICB9CiAgICAgfQogCisgICAgcHJpdmF0ZSB2b2lkIHJ1bkR1bXBIZWFwKCkgdGhyb3dzIEV4Y2VwdGlvbiB7CisgICAgICAgIGJvb2xlYW4gbWFuYWdlZCA9ICEiLW4iLmVxdWFscyhuZXh0T3B0aW9uKCkpOworICAgICAgICBTdHJ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yAgICAgICAgICAgICAgICAiICAgICAgICAtbjogZHVtcCBuYXRpdmUgaGVhcCBpbnN0ZWFkIG9mIG1hbmFnZWQgaGVhcFxuIiArCiAgICAgICAgICAgICAgICAgIlxuIiArCiAgICAgICAgICAgICAgICAgIiAgICA8SU5URU5UPiBzcGVjaWZpY2F0aW9ucyBpbmNsdWRlIHRoZXNlIGZsYWdzOlxuIiArCiAgICAgICAgICAgICAgICAgIiAgICAgICAgWy1hIDxBQ1RJT04+XSBbLWQgPERBVEFfVVJJPl0gWy10IDxNSU1FX1RZUEU+XVxuIiArCkBAIC02MDAsNyArNjM2LDggQEAKICAgICAgICAgICAgICAgICAiICAgICAgICBbLWV8LS1lcyA8RVhUUkFfS0VZPiA8RVhUUkFfU1RSSU5HX1ZBTFVFPiAuLi5dXG4iICsKICAgICAgICAgICAgICAgICAiICAgICAgICBbLS1lc24gPEVYVFJBX0tFWT4gLi4uXVxuIiArCiAgICAgICAgICAgICAgICAgIiAgICAgICAgWy0tZXogPEVYVFJBX0tFWT4gPEVYVFJBX0JPT0xFQU5fVkFMVUU+IC4uLl1cbiIgKwotICAgICAgICAgICAgICAgICIgICAgICAgIFstZXwtLWVpIDxFWFRSQV9LRVk+IDxFWFRSQV9JTlRfVkFMVUU+IC4uLl1cbiIgKworICAgICAgICAgICAgICAgICIgICAgICAgIFstLWVpIDxFWFRSQV9LRVk+IDxFWFRSQV9JTlRfVkFMVUU+IC4uLl1cbiIgKworICAgICAgICAgICAgICAgICIgICAgICAgIFstLWVsIDxFWFRSQV9LRVk+IDxFWFRSQV9MT05HX1ZBTFVFPiAuLi5dXG4iICsKICAgICAgICAgICAgICAgICAiICAgICAgICBbLW4gPENPTVBPTkVOVD5dIFstZiA8RkxBR1M+XVxuIiArCiAgICAgICAgICAgICAgICAgIiAgICAgICAgWy0tZ3JhbnQtcmVhZC11cmktcGVybWlzc2lvbl0gWy0tZ3JhbnQtd3JpdGUtdXJpLXBlcm1pc3Npb25dXG4iICsKICAgICAgICA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X2ZiID0gMDsKIAogICAgIExPR0koImJlZ2luXG4iKTsKIApAQCAtMTkxLDEzICsyMTEsMTYgQEAKICAgICBkdW1wX3RyYWNlc19wYXRoID0gZHVtcF92bV90cmFjZXMoKTsKIAogICAgIGludCBjOwotICAgIHdoaWxlICgoYyA9IGdldG9wdChhcmdjLCBhcmd2LCAiZGhvOnN2eiIpKSAhPSAtMSkgeworICAgIHdoaWxlICgoYyA9IGdldG9wdChhcmdjLCBhcmd2LCAiYjpkZTpobzpzdnpwIikpICE9IC0xKSB7CiAgICAgICAgIHN3aXRjaCAoYykgeworICAgICAgICAgICAgY2FzZSAnYic6IGJlZ2luX3NvdW5kID0gb3B0YXJnOyAgYnJlYWs7CiAgICAgICAgICAgICBjYXNlICdkJzogZG9fYWRkX2RhdGUgPSAxOyAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgJ2UnOiBlbmRfc291bmQgPSBvcHRhcmc7ICAgIGJyZWFrOwogICAgICAgICAgICAgY2FzZSAnbyc6IHVzZV9vdXRmaWxlID0gb3B0YXJnOyAgYnJlYWs7CiAgICAgICAgICAgICBjYXNlICdzJzogdXNlX3NvY2tldCA9IDE7ICAgICAgICBicmVhazsKICAgICAgICAgICAgIGNhc2UgJ3YnOiBicmVhazsgIC8vIGNvbXBhdGliaWxpdHkgbm8tb3AKICAgICAgICAgICAgIGNhc2UgJ3onOiBkb19jb21wcmVzcyA9IDY7ICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSAncCc6IGRvX2ZiID0gMTsgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICBjYXNlICc/JzogcHJpbnRmKCJcbiIpOwogICAgICAgICAgICAgY2FzZSAnaCc6CiAgICAgICAgICAgICAgICAgdXNhZ2UoKTsKQEAgLTI0NCw2ICsyNjcsMTAgQEAKICAgICAgICAgICAgIHN0cmZ0aW1lKGRhdGUsIHNpemVvZihkYXRlKSwgIi0lWS0lbS0lZC0lSC0lTS0lUyIsIGxvY2FsdGltZSgmbm93KSk7CiAgICAgICAgICAgICBzdHJsY2F0KHBhdGgsIGRhdGUsIHNpemVvZihwYXRoKSk7CiAgICAgICAgIH0KKyAgICAgICAgaWYgKGRvX2ZiKSB7CisgICAgICAgICAgICBzdHJsY3B5KHNjcmVlbnNob3RfcGF0aCwgcGF0aCwgc2l6ZW9mKHNjcmVlbnNob3RfcGF0aCkpOworICAgICAgICAgICAgc3RybGNhdChzY3JlZW5zaG90X3BhdGgsICIucG5nIiwgc2l6ZW9mKHNjcmVlbnNob3RfcGF0aCkpOworICAgICAgICB9CiAgICAgICAgIHN0cmxjYXQocGF0aCwgIi50eHQiLCBzaXplb2YocGF0aCkpOwogICAgICAgICBpZiAoZG9fY29tcHJlc3MpIHN0cmxjYXQocGF0aCwgIi5neiIsIHNpemVvZihwYXRoKSk7CiAgICAgICAgIHN0cmxjcHkodG1wX3BhdGgsIHBhdGgsIHNpemVvZih0bXBfcGF0aCkpOwpAQCAtMjUxLDE2ICsyNzgsMTggQEAKICAgICAgICAgZ3ppcF9waWQgPSByZWRpcmVjdF90b19maWxlKHN0ZG91dCwgdG1wX3BhdGgsIGRvX2NvbXByZXNzKTsKICAgICB9CiAKLSAgICAvKiBienp6enp6ICovCi0gICAgaWYgKHZpYnJhdG9yKSB7CisgICAgaWYgKGJlZ2luX3NvdW5kKSB7CisgICAgICAgIHBsYXlfc291bmQoYmVnaW5fc291bmQpOworICAgIH0gZWxzZSBpZiAodmlicmF0b3IpIHsKICAgICAgICAgZnB1dHMoIjE1MCIsIHZpYnJhdG9yKTsKICAgICAgICAgZmZsdXNoKHZpYnJhdG9yKTsKICAgICB9CiAKICAgICBkdW1wc3RhdGUoKTsKIAotICAgIC8qIGJ6enogYnp6eiBienp6ICovCi0gICAgaWYgKHZpYnJhdG9yKSB7CisgICAgaWYgKGVuZF9zb3VuZCkgeworICAgICAgICBwbGF5X3NvdW5kKGVuZF9zb3VuZCk7CisgICAgfSBlbHNlIGlmICh2aWJyYXRvcikgewogICAg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HsKKyAgICAgICAgTE9HRSgiZmFpbGVkIHRvIG9wZW4gZnJhbWVidWZmZXJcbiIpOworICAgICAgICByZXR1cm47CisgICAgfQorICAgIGZiX2luID0gZmRvcGVuKGZiLCAiciIpOworCisgICAgaWYoaW9jdGwoZmIsIEZCSU9HRVRfVlNDUkVFTklORk8sICZ2aW5mbykgPCAwKSB7CisgICAgICAgIExPR0UoImZhaWxlZCB0byBnZXQgZnJhbWVidWZmZXIgaW5mb1xuIik7CisgICAgICAgIHJldHVybjsKKyAgICB9CisgICAgZmNudGwoZmIsIEZfU0VURkQsIEZEX0NMT0VYRUMpOworCisgICAgcG5nID0gcG5nX2NyZWF0ZV93cml0ZV9zdHJ1Y3QoUE5HX0xJQlBOR19WRVJfU1RSSU5HLCBOVUxMLCBOVUxMLCBOVUxMKTsKKyAgICBpZiAocG5nID09IE5VTEwpIHsKKyAgICAgICAgTE9HRSgiZmFpbGVkIHBuZ19jcmVhdGVfd3JpdGVfc3RydWN0XG4iKTsKKyAgICAgICAgZmNsb3NlKGZiX2luKTsKKyAgICAgICAgcmV0dXJuOworICAgIH0KKworICAgIHBuZ19pbml0X2lvKHBuZywgZmJfb3V0KTsKKyAgICBpbmZvID0gcG5nX2NyZWF0ZV9pbmZvX3N0cnVjdChwbmcpOworICAgIGlmIChpbmZvID09IE5VTEwpIHsKKyAgICAgICAgTE9HRSgiZmFpbGVkIHBuZ19jcmVhdGVfaW5mb19zdHJ1Y3RcbiIpOworICAgICAgICBwbmdfZGVzdHJveV93cml0ZV9zdHJ1Y3QoJnBuZywgTlVMTCk7CisgICAgICAgIGZjbG9zZShmYl9pbik7CisgICAgICAgIHJldHVybjsKKyAgICB9CisgICAgaWYgKHNldGptcChwbmdfam1wYnVmKHBuZykpKSB7CisgICAgICAgIExPR0UoImZhaWxlZCBwbmcgc2V0am1wXG4iKTsKKyAgICAgICAgcG5nX2Rlc3Ryb3lfd3JpdGVfc3RydWN0KCZwbmcsIE5VTEwpOworICAgICAgICBmY2xvc2UoZmJfaW4pOworICAgICAgICByZXR1cm47CisgICAgfQorCisgICAgYnl0ZXNwcCA9IHZpbmZvLmJpdHNfcGVyX3BpeGVsIC8gODsKKyAgICBwbmdfc2V0X0lIRFIocG5nLCBpbmZvLAorICAgICAgICB2aW5mby54cmVzLCB2aW5mby55cmVzLCB2aW5mby5iaXRzX3Blcl9waXhlbCAvIDQsIAorICAgICAgICBQTkdfQ09MT1JfVFlQRV9SR0JfQUxQSEEsIFBOR19JTlRFUkxBQ0VfTk9ORSwKKyAgICAgICAgUE5HX0NPTVBSRVNTSU9OX1RZUEVfQkFTRSwgUE5HX0ZJTFRFUl9UWVBFX0JBU0UpOworICAgIHBuZ193cml0ZV9pbmZvKHBuZywgaW5mbyk7CisKKyAgICByb3dsZW49dmluZm8ueHJlcyAqIGJ5dGVzcHA7CisgICAgaWYgKHJvd2xlbiA+IHNpemVvZihpbWdidWYpKSB7CisgICAgICAgIExPR0UoImNyYXp5IHJvd2xlbjogJWRcbiIsIHJvd2xlbik7CisgICAgICAgIHBuZ19kZXN0cm95X3dyaXRlX3N0cnVjdCgmcG5nLCBOVUxMKTsKKyAgICAgICAgZmNsb3NlKGZiX2luKTsKKyAgICAgICAgcmV0dXJuOworICAgIH0KKworICAgIG9mZnNldCA9IHZpbmZvLnhvZmZzZXQgKiBieXRlc3BwICsgdmluZm8ueHJlcyAqIHZpbmZvLnlvZmZzZXQgKiBieXRlc3BwOworICAgIGZzZWVrKGZiX2luLCBvZmZzZXQsIFNFRUtfU0VUKTsKKworICAgIGZvcihyPTA7IHI8dmluZm8ueXJlczsgcisrKSB7CisgICAgICAgIGludCBsZW4gPSBmcmVhZChpbWdidWYsIDEsIHJvd2xlbiwgZmJfaW4pOworICAgICAgICBpZiAobGVuIDw9IDApIGJyZWFrOworICAgICAgICBwbmdfd3JpdGVfcm93KHBuZywgKHBuZ19ieXRlcClpbWdidWYpOworICAgIH0KKworICAgIHBuZ193cml0ZV9lbmQocG5nLCBpbmZvKTsKKyAg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A9IDE7IGJyZWFrOworICAgICAgICAgICAgY2FzZSAnPyc6CisgICAgICAgICAgICBjYXNlICdoJzoKKyAgICAgICAgICAgICAgICB1c2FnZSgpOyBleGl0KDEpOworICAgICAgICB9CisgICAgfQorICAgIGFyZ2MgLT0gb3B0aW5kOworICAgIGFyZ3YgKz0gb3B0aW5kOworCisgICAgaWYgKGFyZ2MgPCAxKSB7CisgICAgICAgIHVzYWdlKCk7IGV4aXQoMSk7CisgICAgfQorCisgICAgc3RybGNweShvdXRmaWxlLCBhcmd2WzBdLCBQQVRIX01BWCk7CisgICAgaWYgKGRvX2luY3JlbWVudCkgeworICAgICAgICBzdHJ1Y3Qgc3RhdCBzdDsKKyAgICAgICAgY2hhciBiYXNlW1BBVEhfTUFYXSA9ICIiOworICAgICAgICBpbnQgaSA9IDA7CisgICAgICAgIHdoaWxlIChzdGF0KG91dGZpbGUsICZzdCkgPT0gMCkgeworICAgICAgICAgICAgaWYgKCFiYXNlWzBdKSB7CisgICAgICAgICAgICAgICAgY2hhciAqcCA9IHN0cnJjaHIob3V0ZmlsZSwgJy4nKTsKKyAgICAgICAgICAgICAgICBpZiAocCkgKnAgPSAnXDAnOworICAgICAgICAgICAgICAgIHN0cmNweShiYXNlLCBvdXRmaWxlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHNucHJpbnRmKG91dGZpbGUsIFBBVEhfTUFYLCAiJXMtJWQucG5nIiwgYmFzZSwgKytpKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIGZiX2luID0gZm9wZW4oIi9kZXYvZ3JhcGhpY3MvZmIwIiwgInIiKTsKKyAgICBpZiAoIWZiX2luKSB7CisgICAgICAgIGZwcmludGYoc3RkZXJyLCAiZXJyb3I6IGNvdWxkIG5vdCByZWFkIGZyYW1lYnVmZmVyXG4iKTsKKyAgICAgICAgZXhpdCgxKTsKKyAgICB9CisKKyAgICAvKiBzd2l0Y2ggdG8gbm9uLXJvb3QgdXNlciBhbmQgZ3JvdXAgKi8K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FlQRSkpIHsKLSAgICAgICAgICAgICAgICAvLyBMb29rIGZvciB0aGUgJ25vYnJvYWRjYXN0JyBmbGFnIGFuZCByZW1vdmUgaXQgc2luY2Ugd2UgZG9uJ3Qgd2FudCBpdCB0byBwZXJzaXN0Ci0gICAgICAgICAgICAgICAgLy8gaW4gdGhlIGRiLgotICAgICAgICAgICAgICAgIG5vQnJvYWRjYXN0ID0gZXh0cmFzLmdldEJvb2xlYW4oTk9fQlJPQURDQVNUX0ZMQUcsIGZhbHNlKTsKLSAgICAgICAgICAgICAgICBleHRyYXMucmVtb3ZlKE5PX0JST0FEQ0FTVF9GTEFHKTsKLSAgICAgICAgICAgIH0KLQogICAgICAgICAgICAgbG9uZyBudW1NYXRjaGVzID0gRGF0YWJhc2VVdGlscy5sb25nRm9yUXVlcnkoZGIsCiAgICAgICAgICAgICAgICAgICAgICJzZWxlY3QgY291bnQoKikgZnJvbSAiICsgVEFCTEVfQUNDT1VOVFMKICAgICAgICAgICAgICAgICAgICAgICAgICAgICArICIgV0hFUkUgIiArIEFDQ09VTlRTX05BTUUgKyAiPT8gQU5EICIgKyBBQ0NPVU5UU19UWVBFKyAiPT8iLApAQCAtNDM2LDEzICs0MzYsMTMgQEAKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBkYi5zZXRUcmFuc2FjdGlvblN1Y2Nlc3NmdWwoKTsKLSAgICAgICAgICAgIGlmICghbm9Ccm9hZGNhc3QpIHsKLSAgICAgICAgICAgICAgICBzZW5kQWNjb3VudHNDaGFuZ2VkQnJvYWRjYXN0KCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgIGRiLmVuZFRyYW5zYWN0aW9uKCk7CiAgICAgICAgIH0KKyAgICAgICAgaWYgKCFub0Jyb2FkY2FzdCkgeworICAgICAgICAgICAgc2VuZEFjY291bnRzQ2hhbmdlZEJyb2FkY2FzdCgpOworICAgICAgICB9CisgICAgICAgIHJldHVybiB0cnVlOwogICAgIH0KIAogICAgIHByaXZhdGUgbG9uZyBpbnNlcnRFeHRyYShTUUxpdGVEYXRhYmFzZSBkYiwgbG9uZyBhY2NvdW50SWQsIFN0cmluZyBrZXksIFN0cmluZyB2YWx1ZSkgewpAQCAtMTY1Nyw3ICsxNjU3LDcgQEAKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgYm9vbGVhbiBuZWVkc1Byb3Zpc2lvbmluZzsKICAgICAgICAgICAgICAgICB0cnkgewotICAgICAgICAgICAgICAgICAgICBuZWVkc1Byb3Zpc2lvbmluZyA9IHRlbGVwaG9ueS5nZXRDZG1hTmVlZHNQcm92aXNpb25pbmcoKTsKKyAgICAgICAgICAgICAgICAgICAgbmVlZHNQcm92aXNpb25pbmcgPSB0ZWxlcGhvbnkubmVlZHNPdGFTZXJ2aWNlUHJvdmlzaW9uaW5nKCk7CiAgICAgICAgICAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKICAgICAgICAgICAgICAgICAgICAgTG9nLncoVEFHLCAiZXhjZXB0aW9uIHdoaWxlIGNoZWNraW5nIHByb3Zpc2lvbmluZyIsIGUpOwogICAgICAgICAgICAgICAgICAgICAvLyBkZWZhdWx0IHRvIE5PVCB3aXBpbmcgb3V0IHRoZSBwYXNzd29yZHMKQEAgLTE2ODEsMTEgKzE2ODEsMTEgQEAKICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICBkYi5leGVjU1FMKCJERUxFVEUgZnJvbSAiICsgVEFCTEVfQVVUSFRPS0VOUyk7CiAgICAgICAgICAgICAgICAgICAgIGRiLmV4ZWNTUUwoIlVQREFURSAiICsgVEFCTEVfQUNDT1VOVFMgKyAiIFNFVCAiICsgQUNDT1VOVFNfUEFTU1dPUkQgKyAiID0gJyciKTsKLSAgICAgICAgICAgICAgICAgICAgc2VuZEFjY291bnRzQ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2NvZGU+IGZvbGxvd2VkIGJ5IGNhbGxpbmcgPGNvZGU+Y2xlYXIoKTwvY29kZT4gb24gdGhlCisgICAgICogcmV0dXJuZWQgbGlzdCBvZiBsaXN0ZW5lcnMuCisgICAgICovCisgICAgcHVibGljIHZvaWQgcmVtb3ZlQWxsTGlzdGVuZXJzKCkgeworICAgICAgICBpZiAobUxpc3RlbmVycyAhPSBudWxsKSB7CisgICAgICAgICAgICBtTGlzdGVuZXJzLmNsZWFyKCk7CisgICAgICAgICAgICBtTGlzdGVuZXJzID0gbnVsbDsKKyAgICAgICAgfQorICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyBBbmltYXRhYmxlIGNsb25lKCkgeworICAgICAgICB0cnkgeworICAgICAgICAgICAgZmluYWwgQW5pbWF0YWJsZSBhbmltID0gKEFuaW1hdGFibGUpIHN1cGVyLmNsb25lKCk7CisgICAgICAgICAgICBpZiAobUxpc3RlbmVycyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgQXJyYXlMaXN0PEFuaW1hdGFibGVMaXN0ZW5lcj4gb2xkTGlzdGVuZXJzID0gbUxpc3RlbmVyczsKKyAgICAgICAgICAgICAgICBhbmltLm1MaXN0ZW5lcnMgPSBuZXcgQXJyYXlMaXN0PEFuaW1hdGFibGVMaXN0ZW5lcj4oKTsKKyAgICAgICAgICAgICAgICBpbnQgbnVtTGlzdGVuZXJzID0gb2xkTGlzdGVuZXJzLnNpemUoKTsKKyAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IG51bUxpc3RlbmVyczsgKytpKSB7CisgICAgICAgICAgICAgICAgICAgIGFuaW0ubUxpc3RlbmVycy5hZGQob2xkTGlzdGVuZXJzLmdldChpKSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIGFuaW07CisgICAgICAgIH0gY2F0Y2ggKENsb25lTm90U3VwcG9ydGVkRXhjZXB0aW9uIGUpIHsKKyAgICA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GFzc2VzCisgICAgICogdGhhdCBkbyBoYW5kbGUgdGFyZ2V0cy4KKyAgICAgKgorICAgICAqIEBwYXJhbSB0YXJnZXQgVGhlIG9iamVjdCBiZWluZyBhbmltYXRlZAorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNldFRhcmdldChPYmplY3QgdGFyZ2V0KSB7CisgICAgfQorCisgICAgLyoqCisgICAgICogPHA+QW4gYW5pbWF0aW9uIGxpc3RlbmVyIHJlY2VpdmVzIG5vdGlmaWNhdGlvbnMgZnJvbSBhbiBhbmltYXRpb24uCisgICAgICogTm90aWZpY2F0aW9ucyBpbmRpY2F0ZSBhbmltYXRpb24gcmVsYXRlZCBldmVudHMsIHN1Y2ggYXMgdGhlIGVuZCBvciB0aGUKKyAgICAgKiByZXBldGl0aW9uIG9mIHRoZSBhbmltYXRpb24uPC9wPgorICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgaW50ZXJmYWNlIEFuaW1hdGFibGVMaXN0ZW5lciB7CisgICAgICAgIC8qKgorICAgICAgICAgKiA8cD5Ob3RpZmllcyB0aGUgc3RhcnQgb2YgdGhlIGFuaW1hdGlvbi48L3A+CisgICAgICAgICAqCisgICAgICAgICAqIEBwYXJhbSBhbmltYXRpb24gVGhlIHN0YXJ0ZWQgYW5pbWF0aW9uLgorICAgICAgICAgKi8KKyAgICAgICAgdm9pZCBvbkFuaW1hdGlvblN0YXJ0KEFuaW1hdGFibGUgYW5pbWF0aW9uKTsKKworICAgICAgICAvKioKKyAgICAgICAgICogPHA+Tm90aWZpZXMgdGhlIGVuZCBvZiB0aGUgYW5pbWF0aW9uLiBUaGlzIGNhbGxiYWNrIGlzIG5vdCBpbnZva2VkCisgICAgICAgICAqIGZvciBhbmltYXRpb25zIHdpdGggcmVwZWF0IGNvdW50IHNldCB0byBJTkZJTklURS48L3A+CisgICAgICAgICAqCisgICAgICAgICAqIEBwYXJhbSBhbmltYXRpb24gVGhlIGFuaW1hdGlvbiB3aGljaCByZWFjaGVkIGl0cyBlbmQuCisgICAgICAgICAqLworICAgICAgICB2b2lkIG9uQW5pbWF0aW9uRW5kKEFuaW1hdGFibGUgYW5pbWF0aW9uKTsKKworICAgICAgICAvKioKKyAgICAgICAgICogPHA+Tm90aWZpZXMgdGhlIGNhbmNlbGxhdGlvbiBvZiB0aGUgYW5pbWF0aW9uLiBUaGlzIGNhbGxiYWNrIGlzIG5vdCBpbnZva2VkCisgICAgICAgICAqIGZvciBhbmltYXRpb25zIHdpdGggcmVwZWF0IGNvdW50IHNldCB0byBJTkZJTklURS48L3A+CisgICAgICAgICAqCisgICAgICAgICAqIEBwYXJhbSBhbmltYXRpb24gVGhlIGFuaW1hdGlvbiB3aGljaCB3YXMgY2FuY2VsZWQuCisgICAgICAgICAqLworICAgICAgICB2b2lkIG9uQW5pbWF0aW9uQ2FuY2VsKEFuaW1hdGFibGUgYW5pbWF0aW9uKTsKKworICAgICAgICAvKioKKyAgICAgICAgICogPHA+Tm90aWZpZXMgdGhlIHJlcGV0aXRpb24gb2YgdGhlIGFuaW1hdGlvbi48L3A+CisgICAgICAgICAqCisgICAgICAgICAqIEBwYXJhbSBhbmltYXRpb24gVGhlIGFuaW1hdGlvbiB3aGljaCB3YXMgcmVwZWF0ZWQuCisgICAgICAgICAqLworICAgICAgICB2b2lkIG9uQW5pbWF0aW9uUmVwZWF0KEFuaW1hdGFibGUgYW5pbWF0aW9uKTsKKyAgICB9Cit9CmRpZmYgLS1naXQgYS9jb3JlL2phdmEvYW5kcm9pZC9hbmltYXRpb24vQW5pbWF0YWJsZUluZmxhdGVyLmphdmEgYi9jb3JlL2phdmEvYW5kcm9pZC9hbmltYXRpb24vQW5pbWF0YWJsZUluZmxhdGVyLmphdmEKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uODhmYTc3ZQotLS0gL2Rldi9udWxsCisrKyBiL2NvcmUvamF2YS9hbmRyb2lkL2FuaW1hdGlvbi9BbmltYXRhYmxlSW5mbGF0ZXIuamF2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ZSBzcGVjaWZpZWQgaWQKKyAgICAgKiBAdGhyb3dzIGFuZHJvaWQuY29udGVudC5yZXMuUmVzb3VyY2VzLk5vdEZvdW5kRXhjZXB0aW9uIHdoZW4gdGhlIGFuaW1hdGlvbiBjYW5ub3QgYmUgbG9hZGVkCisgICAgICovCisgICAgcHVibGljIHN0YXRpYyBBbmltYXRhYmxlIGxvYWRBbmltYXRhYmxlKENvbnRleHQgY29udGV4dCwgaW50IGlkKQorICAgICAgICAgICAgdGhyb3dzIE5vdEZvdW5kRXhjZXB0aW9uIHsKKworICAgICAgICBYbWxSZXNvdXJjZVBhcnNlciBwYXJzZXIgPSBudWxsOworICAgICAgICB0cnkgeworICAgICAgICAgICAgcGFyc2VyID0gY29udGV4dC5nZXRSZXNvdXJjZXMoKS5nZXRBbmltYXRpb24oaWQpOworICAgICAgICAgICAgcmV0dXJuIGNyZWF0ZUFuaW1hdGFibGVGcm9tWG1sKGNvbnRleHQsIHBhcnNlcik7CisgICAgICAgIH0gY2F0Y2ggKFhtbFB1bGxQYXJzZXJFeGNlcHRpb24gZXgpIHsKKyAgICAgICAgICAgIFJlc291cmNlcy5Ob3RGb3VuZEV4Y2VwdGlvbiBybmYgPQorICAgICAgICAgICAgICAgICAgICBuZXcgUmVzb3VyY2VzLk5vdEZvdW5kRXhjZXB0aW9uKCJDYW4ndCBsb2FkIGFuaW1hdGlvbiByZXNvdXJjZSBJRCAjMHgiICsKKyAgICAgICAgICAgICAgICAgICAgSW50ZWdlci50b0hleFN0cmluZyhpZCkpOworICAgICAgICAgICAgcm5mLmluaXRDYXVzZShleCk7CisgICAgICAgICAgICB0aHJvdyBybmY7CisgICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGV4KSB7CisgICAgICAgICAgICBSZXNvdXJjZXMuTm90Rm91bmRFeGNlcHRpb24gcm5mID0KKyAgICAgICAgICAgICAgICAgICAgbmV3IFJlc291cmNlcy5Ob3RGb3VuZEV4Y2VwdGlvbigiQ2FuJ3QgbG9hZCBhbmltYXRpb24gcmVzb3VyY2UgSUQgIzB4IiArCisgICAgICAgICAgICAgICAgICAgIEludGVnZXIudG9IZXhTdHJpbmcoaWQpKTsKKyAgICAgICAgICAgIHJuZi5pbml0Q2F1c2UoZXgpOworICAgICAgICAgICAgdGhyb3cgcm5mOworICAgICAgICB9IGZpbmFsbHkgeworICAgICAgICAgICAgaWYgKHBhcnNlciAhPSBudWxsKSBwYXJzZXIuY2xvc2UoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgc3RhdGljIEFuaW1hdGFibGUgY3JlYXRlQW5pbWF0YWJsZUZyb21YbWwoQ29udGV4dCBjLCBYbWxQdWxsUGFyc2VyIHBhcnNlcikKKyAgICAgICAgICAgIHRocm93cyBYbWxQdWxsUGFyc2VyRXhjZXB0aW9uLCBJT0V4Y2VwdGlvbiB7CisKKyAgICAgICAgcmV0dXJuIGNyZWF0ZUFuaW1hdGFibGVGcm9tWG1sKGMsIHBhcnNlciwgWG1sLmFzQXR0cmlidXRlU2V0KHBhcnNlciksIG51bGwsIDApOworICAgIH0KKworICAgIHByaXZhdGUgc3RhdGljIEFuaW1hdGFibGUgY3JlYXRlQW5pbWF0YWJsZUZyb21YbWwoQ29udGV4dCBjLCBYbWxQdWxsUGFyc2VyIHBhcnNlciwKKyAgICAgICAgICAgIEF0dHJpYnV0ZVNldCBhdHRycywgU2VxdWVuY2VyIHBhcmVudCwgaW50IHNlcXVlbmNlT3JkZXJpbmcpCisgICAgICAgICAgICB0aHJvd3MgWG1sUHVsbFBhcnNlckV4Y2VwdGlvbiwgSU9FeGNlcHRpb24geworCisgICAgICAgIEFuaW1hdGFibGUgYW5pbSA9IG51bGw7CisgICAgICAgIEFycmF5TGlzdDxBbmltYXRhYmxlPiBjaGlsZEFuaW1zID0gbnVsbDsKKworICAgICAgICAvLyBNYWtlIHN1cmUgd2UgYXJlIG9uIGEgc3RhcnQgdGFnLgorICAgICAgICBpbnQgdHlwZTsKKyAgICAgICAgaW50IGRlcHRoID0gcGFyc2VyLmdldERlcHRoKCk7CisKKyAgICAgICAgd2hpbGUgKCgodHlwZT1wYXJzZXIubmV4dCgpKSAhPSBYbWxQdWxsUGFyc2VyLkVORF9UQUcgfHwgcGFyc2VyLmdldERlcHRoKCkgPiBkZXB0aCkKKyAgICAgICAgICAgICAgICYmIHR5cGUgIT0gWG1sUHVsbFBhcnNlci5FTkRfRE9DVU1FTlQpIHsKKworICAgICAgICAgICAgaWYgKHR5cGUgIT0gWG1sUHVsbFBhcnNlci5TVEFSVF9UQUcpIHsKKyAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgU3RyaW5nICBuYW1lID0gcGFyc2VyLmdldE5hbWUoKTsKKworICAgICAgICAgICAgaWYgKG5hbWUuZXF1YWxzKCJwcm9wZXJ0eSIpKSB7CisgICAgICAgICAgICAgICAgYW5pbSA9IGxvYWRQcm9wZXJ0eUFuaW1hdG9yKGMsIGF0dHJzKTsKKyAgICAgICAgICAgIH0gZWxzZSBpZiAobmFtZS5lcXVhbHMoImFuaW1hdG9yIikpIHsKKyAgICAgICAgICAgICAgICBhbmltID0gbG9hZEFuaW1hdG9yKGMsIGF0dHJzLCBudWxsKTsKKyAgICAgICAgICAgIH0gZWxzZSBpZiAobmFtZS5lcXVhbHMoInNlcXVlbmNlciIpKSB7CisgICAgICAgICAgICAgICAgYW5pbSA9IG5ldyBTZXF1ZW5jZXIoKTsKKyAgICAgICAgICAgICAgICBUeXBlZEFycmF5IGEgPSBjLm9idGFpblN0eWxlZEF0dHJpYnV0ZXMoYXR0cnMsCisgICAgICAgICAgICAgICAgICAgICAgICBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5TZXF1ZW5jZXIpOworICAgICAgICAgICAgICAgIGludCBvcmRlcmluZyA9IGEuZ2V0SW50KGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLlNlcXVlbmNlcl9vcmRlcmluZywKKyAgICAgICAgICAgICAgICAgICAgICAgIFRPR0VUSEVSKTsKKyAgICAgICAgICAgICAgICBjcmVhdGVBbmltYXRhYmxlRnJvbVhtbChjLCBwYXJzZXIsIGF0dHJzLCAoU2VxdWVuY2VyKSBhbmltLCAgb3JkZXJpbmcpOworICAgICAgICAgICAgICAgIGEucmVjeWNsZSgpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgUnVudGltZUV4Y2VwdGlvbigiVW5rbm93biBhbmltYXRvciBuYW1lOiAiICsgcGFyc2VyLmdldE5hbWUoKSk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmIChwYXJlbnQgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGlmIChjaGlsZEFuaW1zID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgY2hpbGRBbmltcyA9IG5ldyBBcnJheUxpc3Q8QW5pbWF0YWJsZT4oKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgY2hpbGRBbmltcy5hZGQoYW5pbSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgaWYgKHBhcmVudCAhPSBudWxsICYmIGNoaWxkQW5pbXMgIT0gbnVsbCkgeworICAgICAgICAgICAgQW5pbWF0YWJsZVtdIGFuaW1zQXJyYXkgPSBuZXcgQW5pbWF0YWJsZVtjaGlsZEFuaW1zLnNpemUoKV07CisgICAgICAgICAgICBpbnQgaW5kZXggPSAwOworICAgICAgICAgICAgZm9yIChBbmltYXRhYmxlIGEgOiBjaGlsZEFuaW1zKSB7CisgICAgICAgICAgICAgICAgYW5pbXNBcnJheVtpbmRleCsrXSA9IGE7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoc2VxdWVuY2VPcmRlcmluZyA9PSBUT0dFVEhFUikgeworICAgICAgICAgICAgICAgIHBhcmVudC5wbGF5VG9nZXRoZXIoYW5pbXNBcnJheSk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHBhcmVudC5wbGF5U2VxdWVudGlhbGx5KGFuaW1zQXJyYXkpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcmV0dXJuIGFuaW07CisKKyAgICB9CisKKyAgICBwcml2YXRlIHN0YXRpYyBQcm9wZXJ0eUFuaW1hdG9yIGxvYWRQcm9wZXJ0eUFuaW1hdG9yKENvbnRleHQgY29udGV4dCwgQXR0cmlidXRlU2V0IGF0dHJzKQorICAgICAgICAgICAgdGhyb3dzIE5vdEZvdW5kRXhjZXB0aW9uIHsKKworICAgICAgICBQcm9wZXJ0eUFuaW1hdG9yIGFuaW0gPSBuZXcgUHJvcGVydHlBbmltYXRvcigpOworCisgICAgICAgIGxvYWRBbmltYXRvcihjb250ZXh0LCBhdHRycywgYW5pbSk7CisKKyAgICAgICAgVHlwZWRBcnJheSBhID0KKyAgICAgICAgICAgICAgICBjb250ZXh0Lm9idGFpblN0eWxlZEF0dHJpYnV0ZXMoYXR0cnMsIGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLlByb3BlcnR5QW5pbWF0b3IpOworCisgICAgICAgIFN0cmluZyBwcm9wZXJ0eU5hbWUgPSBhLmdldFN0cmluZyhjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5Qcm9wZXJ0eUFuaW1hdG9yX3Byb3BlcnR5TmFtZSk7CisKKyAgICAgICAgYW5pbS5zZXRQcm9wZXJ0eU5hbWUocHJvcGVydHlOYW1lKTsKKworICAgICAgICBhLnJlY3ljbGUoKTsKKworICAgICAgICByZXR1cm4gYW5pbTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBDcmVhdGVzIGEgbmV3IGFuaW1hdGlvbiB3aG9zZSBwYXJhbWV0ZXJzIGNvbWUgZnJvbSB0aGUgc3BlY2lmaWVkIGNvbnRleHQgYW5kCisgICAgICogYXR0cmlidXRlcyBzZXQuCisgICAgICoKKyA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lKSB7CisgICAgICAgICAgICBjYXNlIFZBTFVFX1RZUEVfRkxPQVQ6CisgICAgICAgICAgICAgICAgaWYgKGEuaGFzVmFsdWUoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuQW5pbWF0b3JfdmFsdWVGcm9tKSkgeworICAgICAgICAgICAgICAgICAgICB2YWx1ZUZyb20gPSBhLmdldEZsb2F0KGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLkFuaW1hdG9yX3ZhbHVlRnJvbSwgMGYpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBpZiAoYS5oYXNWYWx1ZShjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5BbmltYXRvcl92YWx1ZVRvKSkgeworICAgICAgICAgICAgICAgICAgICB2YWx1ZVRvID0gYS5nZXRGbG9hdChjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5BbmltYXRvcl92YWx1ZVRvLCAwZik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBWQUxVRV9UWVBFX0NPTE9SOgorICAgICAgICAgICAgICAgIGV2YWx1YXRvciA9IG5ldyBSR0JFdmFsdWF0b3IoKTsKKyAgICAgICAgICAgICAgICAvLyBmYWxsIHRocm91Z2ggdG8gcGljayB1cCB2YWx1ZXMKKyAgICAgICAgICAgIGNhc2UgVkFMVUVfVFlQRV9JTlQ6CisgICAgICAgICAgICAgICAgaWYgKGEuaGFzVmFsdWUoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuQW5pbWF0b3JfdmFsdWVGcm9tKSkgeworICAgICAgICAgICAgICAgICAgICB2YWx1ZUZyb20gPSBhLmdldEludGVnZXIoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuQW5pbWF0b3JfdmFsdWVGcm9tLCAwKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKGEuaGFzVmFsdWUoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuQW5pbWF0b3JfdmFsdWVUbykpIHsKKyAgICAgICAgICAgICAgICAgICAgdmFsdWVUbyA9IGEuZ2V0SW50ZWdlcihjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5BbmltYXRvcl92YWx1ZVRvLCAwKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIFZBTFVFX1RZUEVfRE9VQkxFOgorICAgICAgICAgICAgICAgIGlmIChhLmhhc1ZhbHVlKGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLkFuaW1hdG9yX3ZhbHVlRnJvbSkpIHsKKyAgICAgICAgICAgICAgICAgICAgdmFsdWVGcm9tID0gKERvdWJsZSkoKEZsb2F0KShhLmdldEZsb2F0KGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLkFuaW1hdG9yX3ZhbHVlRnJvbSwgMGYpKSkuZG91YmxlVmFsdWUoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKGEuaGFzVmFsdWUoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuQW5pbWF0b3JfdmFsdWVUbykpIHsKKyAgICAgICAgICAgICAgICAgICAgdmFsdWVUbyA9IChEb3VibGUpKChGbG9hdClhLmdldEZsb2F0KGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLkFuaW1hdG9yX3ZhbHVlVG8sIDBmKSkuZG91YmxlVmFsdWUoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIFZBTFVFX1RZUEVfQ1VTVE9NOgorICAgICAgICAgICAgICAgIC8vIFRPRE86IEhvdyB0byBnZXQgYW4gJ09iamVjdCcgdmFsdWU/CisgICAgICAgICAgICAgICAgaWYgKGEuaGFzVmFsdWUoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuQW5pbWF0b3JfdmFsdWVGcm9tKSkgeworICAgICAgICAgICAgICAgICAgICB2YWx1ZUZyb20gPSBhLmdldEZsb2F0KGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLkFuaW1hdG9yX3ZhbHVlRnJvbSwgMGYpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBpZiAoYS5oYXNWYWx1ZShjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5BbmltYXRvcl92YWx1ZVRvKSkgeworICAgICAgICAgICAgICAgICAgICB2YWx1ZVRvID0gYS5nZXRGbG9hdChjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5BbmltYXRvcl92YWx1ZVRvLCAwZik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisKKyAgICAgICAgaWYgKGFuaW0gPT0gbnVsbCkgeworICAgICAgICAgICAgYW5pbSA9IG5ldyBBbmltYXRvcihkdXJhdGlvbiwgdmFsdWVGcm9tLCB2YWx1ZVRvKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGFuaW0uc2V0RHVyYXRpb24oZHVyYXRpb24pOworICAgICAgICAgICAgYW5pbS5zZXRWYWx1ZXModmFsdWVGcm9tLCB2YWx1ZVRvKTsKKyAgICAgICAgfQorCisgICAgICAgIGFuaW0uc2V0U3RhcnREZWxheShzdGFydERlbGF5KTsKKworICAgICAgICBpZiAoYS5oYXNWYWx1ZShjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5BbmltYXRvcl9yZXBlYXRDb3VudCkpIHsKKyAgICAgICAgICAgIGFuaW0uc2V0UmVwZWF0Q291bnQoCisgICAgICAgICAgICAgICAgICAgIGEuZ2V0SW50KGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLkFuaW1hdG9yX3JlcGVhdENvdW50LCAwKSk7CisgICAgICAgIH0KKyAgICAgICAgaWYgKGEuaGFzVmFsdWUoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuQW5pbWF0b3JfcmVwZWF0TW9kZSkpIHsKKyAgICAgICAgICAgIGFuaW0uc2V0UmVwZWF0TW9kZSgKKyAgICAgICAgICAgICAgICAgICAgYS5nZXRJbnQoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuQW5pbWF0b3JfcmVwZWF0TW9kZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBBbmltYXRvci5SRVNUQVJUKSk7CisgICAgICAgIH0KKyAgICAgICAgaWYgKGV2YWx1YXRvciAhPSBudWxsKSB7CisgICAgICAgICAgICBhbmltLnNldEV2YWx1YXRvcihldmFsdWF0b3IpOworICAgICAgICB9CisKKyAgICAgICAgZmluYWwgaW50IHJlc0lEID0KKyAgICAgICAgICAgICAgICBhLmdldFJlc291cmNlSWQoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuQW5pbWF0b3JfaW50ZXJwb2xhdG9yLCAwKTsKKyAgICAgICAgaWYgKHJlc0lEID4gMCkgeworICAgICAgICAgICAgYW5pbS5zZXRJbnRlcnBvbGF0b3IoQW5pbWF0aW9uVXRpbHMubG9hZEludGVycG9sYXRvcihjb250ZXh0LCByZXNJRCkpOworICAgICAgICB9CisgICAgICAgIGEucmVjeWNsZSgpOworCisgICAgICAgIHJldHVybiBhbmltOworICAgIH0KK30KZGlmZiAtLWdpdCBhL2NvcmUvamF2YS9hbmRyb2lkL2FuaW1hdGlvbi9BbmltYXRhYmxlTGlzdGVuZXJBZGFwdGVyLmphdmEgYi9jb3JlL2phdmEvYW5kcm9pZC9hbmltYXRpb24vQW5pbWF0YWJsZUxpc3RlbmVyQWRhcHRl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NhZ2UgbXNnKSB7CisgICAgICAgICAgICBib29sZWFuIGNhbGxBZ2FpbiA9IHRydWU7CisgICAgICAgICAgICBzd2l0Y2ggKG1zZy53aGF0KSB7CisgICAgICAgICAgICAgICAgLy8gVE9ETzogc2hvdWxkIHdlIGF2b2lkIHNlbmRpbmcgZnJhbWUgbWVzc2FnZSB3aGVuIHN0YXJ0aW5nIGlmIHdlCisgICAgICAgICAgICAgICAgLy8gd2VyZSBhbHJlYWR5IHJ1bm5pbmc/CisgICAgICAgICAgICAgICAgY2FzZSBBTklNQVRJT05fU1RBUlQ6CisgICAgICAgICAgICAgICAgICAgIGlmIChzQW5pbWF0aW9ucy5zaXplKCkgPiAwIHx8IHNEZWxheWVkQW5pbXMuc2l6ZSgpID4gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgY2FsbEFnYWluID0gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgLy8gcGVuZGluZ0FuaW1zIGhvbGRzIGFueSBhbmltYXRpb25zIHRoYXQgaGF2ZSByZXF1ZXN0ZWQgdG8gYmUgc3RhcnRlZAorICAgICAgICAgICAgICAgICAgICAvLyBXZSdyZSBnb2luZyB0byBjbGVhciBzUGVuZGluZ0FuaW1hdGlvbnMsIGJ1dCBzdGFydGluZyBhbmltYXRpb24gbWF5CisgICAgICAgICAgICAgICAgICAgIC8vIGNhdXNlIG1vcmUgdG8gYmUgYWRkZWQgdG8gdGhlIHBlbmRpbmcgbGlzdCAoZm9yIGV4YW1wbGUsIGlmIG9uZSBhbmltYXRpb24KKyAgICAgICAgICAgICAgICAgICAgLy8gc3RhcnRpbmcgdHJpZ2dlcnMgYW5vdGhlciBzdGFydGluZykuIFNvIHdlIGxvb3AgdW50aWwgc1BlbmRpbmdBbmltYXRpb25zCisgICAgICAgICAgICAgICAgICAgIC8vIGlzIGVtcHR5LgorICAgICAgICAgICAgICAgICAgICB3aGlsZSAoc1BlbmRpbmdBbmltYXRpb25zLnNpemUoKSA+IDApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIEFycmF5TGlzdDxBbmltYXRvcj4gcGVuZGluZ0NvcHkgPQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoQXJyYXlMaXN0PEFuaW1hdG9yPikgc1BlbmRpbmdBbmltYXRpb25zLmNsb25lKCk7CisgICAgICAgICAgICAgICAgICAgICAgICBzUGVuZGluZ0FuaW1hdGlvbnMuY2xlYXIoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGludCBjb3VudCA9IHBlbmRpbmdDb3B5LnNpemUoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgY291bnQ7ICsraSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFuaW1hdG9yIGFuaW0gPSBwZW5kaW5nQ29weS5nZXQoaSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gSWYgdGhlIGFuaW1hdGlvbiBoYXMgYSBzdGFydERlbGF5LCBwbGFjZSBpdCBvbiB0aGUgZGVsYXllZCBsaXN0CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGFuaW0ubVN0YXJ0RGVsYXkgPT0gMCB8fCBhbmltLm1QbGF5aW5nU3RhdGUgPT0gRU5ERUQgfHwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFuaW0ubVBsYXlpbmdTdGF0ZSA9PSBDQU5DRUxFRCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbmltLnN0YXJ0QW5pbWF0aW9uKCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc0RlbGF5ZWRBbmltcy5hZGQoYW5pbSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIC8vIGZhbGwgdGhyb3VnaCB0byBwcm9jZXNzIGZpcnN0IGZyYW1lIG9mIG5ldyBhbmltYXRpb25zCisgICAgICAgICAgICAgICAgY2FzZSBBTklNQVRJT05fRlJBTUU6CisgICAgICAgICAgICAgICAgICAgIC8vIGN1cnJlbnRUaW1lIGhvbGRzIHRoZSBjb21tb24gdGltZSBmb3IgYWxsIGFuaW1hdGlvbnMgcHJvY2Vzc2VkCisgICAgICAgICAgICAgICAgICAgIC8vIGR1cmluZyB0aGlzIGZyYW1lCisgICAgICAgICAgICAgICAgICAgIGxvbmcgY3VycmVudFRpbWUgPSBBbmltYXRpb25VdGlscy5jdXJyZW50QW5pbWF0aW9uVGltZU1pbGxpcygpOworCisgICAgICAgICAgICAgICAgICAgIC8vIEZpcnN0LCBwcm9jZXNzIGFuaW1hdGlvbnMgY3VycmVudGx5IHNpdHRpbmcgb24gdGhlIGRlbGF5ZWQgcXVldWUsIGFkZGluZworICAgICAgICAgICAgICAgICAgICAvLyB0aGVtIHRvIHRoZSBhY3RpdmUgYW5pbWF0aW9ucyBpZiB0aGV5IGFyZSByZWFkeQorICAgICAgICAgICAgICAgICAgICBpbnQgbnVtRGVsYXllZEFuaW1zID0gc0RlbGF5ZWRBbmltcy5zaXplKCk7CisgICAgICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbnVtRGVsYXllZEFuaW1zOyArK2kpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIEFuaW1hdG9yIGFuaW0gPSBzRGVsYXllZEFuaW1zLmdldChpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhbmltLmRlbGF5ZWRBbmltYXRpb25GcmFtZShjdXJyZW50VGltZSkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzUmVhZHlBbmltcy5hZGQoYW5pbSk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgaW50IG51bVJlYWR5QW5pbXMgPSBzUmVhZHlBbmltcy5zaXplKCk7CisgICAgICAgICAgICAgICAgICAgIGlmIChudW1SZWFkeUFuaW1zID4gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBudW1SZWFkeUFuaW1zOyArK2kpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBBbmltYXRvciBhbmltID0gc1JlYWR5QW5pbXMuZ2V0KGkpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFuaW0uc3RhcnRBbmltYXRpb24oKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzRGVsYXllZEFuaW1zLnJlbW92ZShhbmltKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIHNSZWFkeUFuaW1zLmNsZWFyKCk7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICAvLyBOb3cgcHJvY2VzcyBhbGwgYWN0aXZlIGFuaW1hdGlvbnMuIFRoZSByZXR1cm4gdmFsdWUgZnJvbSBhbmltYXRpb25GcmFtZSgpCisgICAgICAgICAgICAgICAgICAgIC8vIHRlbGxzIHRoZSBoYW5kbGVyIHdoZXRoZXIgaXQgc2hvdWxkIG5vdyBiZSBlbmRlZAorICAgICAgICAgICAgICAgICAgICBpbnQgbnVtQW5pbXMgPSBzQW5pbWF0aW9ucy5zaXplKCk7CisgICAgICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbnVtQW5pbXM7ICsraSkgeworICAgICAgICAgICAgICAgICAgICAgICAgQW5pbWF0b3IgYW5pbSA9IHNBbmltYXRpb25zLmdldChpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhbmltLmFuaW1hdGlvbkZyYW1lKGN1cnJlbnRUaW1lKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNFbmRpbmdBbmltcy5hZGQoYW5pbSk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgaWYgKHNFbmRpbmdBbmltcy5zaXplKCkgPiAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IHNFbmRpbmdBbmltcy5zaXplKCk7ICsraSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNFbmRpbmdBbmltcy5nZXQoaSkuZW5kQW5pbWF0aW9uKCk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBzRW5kaW5nQW5pbXMuY2xlYXIoKTsKKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIC8vIElmIHRoZXJlIGFyZSBzdGlsbCBhY3RpdmUgb3IgZGVsYXllZCBhbmltYXRpb25zLCBjYWxsIHRoZSBoYW5kbGVyIGFnYWluCisgICAgICAgICAgICAgICAgICAgIC8vIGFmdGVyIHRoZSBmcmFtZURlbGF5CisgICAgICAgICAgICAgICAgICAgIGlmIChjYWxsQWdhaW4gJiYgKCFzQW5pbWF0aW9ucy5pc0VtcHR5KCkgfHwgIXNEZWxheWVkQW5pbXMuaXNFbXB0eSgpKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgc2VuZEVtcHR5TWVzc2FnZURlbGF5ZWQoQU5JTUFUSU9OX0ZSQU1FLCBzRnJhbWVEZWxheSk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBUaGUgYW1vdW50IG9mIHRpbWUsIGluIG1pbGxpc2Vjb25kcywgdG8gZGVsYXkgc3RhcnRpbmcgdGhlIGFuaW1hdGlvbiBhZnRlcgorICAgICAqIHtAbGluayAjc3RhcnQoKX0gaXMgY2FsbGVkLgorICAgICAqCisgICAgICogQH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JlcGVhdENvdW50KGludCB2YWx1ZSkgeworICAgICAgICBtUmVwZWF0Q291bnQgPSB2YWx1ZTsKKyAgICB9CisgICAgLyoqCisgICAgICogRGVmaW5lcyBob3cgbWFueSB0aW1lcyB0aGUgYW5pbWF0aW9uIHNob3VsZCByZXBlYXQuIFRoZSBkZWZhdWx0IHZhbHVlCisgICAgICogaXMgMC4KKyAgICAgKgorICAgICAqIEByZXR1cm4gdGhlIG51bWJlciBvZiB0aW1lcyB0aGUgYW5pbWF0aW9uIHNob3VsZCByZXBlYXQsIG9yIHtAbGluayAjSU5GSU5JVEV9CisgICAgICovCisgICAgcHVibGljIGludCBnZXRSZXBlYXRDb3VudCgpIHsKKyAgICAgICAgcmV0dXJuIG1SZXBlYXRDb3VudDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBEZWZpbmVzIHdoYXQgdGhpcyBhbmltYXRpb24gc2hvdWxkIGRvIHdoZW4gaXQgcmVhY2hlcyB0aGUgZW5kLiBUaGlzCisgICAgICogc2V0dGluZyBpcyBhcHBsaWVkIG9ubHkgd2hlbiB0aGUgcmVwZWF0IGNvdW50IGlzIGVpdGhlciBncmVhdGVyIHRoYW4KKyAgICAgKiAwIG9yIHtAbGluayAjSU5GSU5JVEV9LiBEZWZhdWx0cyB0byB7QGxpbmsgI1JFU1RBUlR9LgorICAgICAqCisgICAgICogQHBhcmFtIHZhbHVlIHtAbGluayAjUkVTVEFSVH0gb3Ige0BsaW5rICNSRVZFUlNFfQorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNldFJlcGVhdE1vZGUoaW50IHZhbHVlKSB7CisgICAgICAgIG1SZXBlYXRNb2RlID0gdmFsdWU7CisgICAgfQorCisgICAgLyoqCisgICAgICogRGVmaW5lcyB3aGF0IHRoaXMgYW5pbWF0aW9uIHNob3VsZCBkbyB3aGVuIGl0IHJlYWNoZXMgdGhlIGVuZC4KKyAgICAgKgorICAgICAqIEByZXR1cm4gZWl0aGVyIG9uZSBvZiB7QGxpbm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B0byBlbmQgdGhlIG5leHQgdGltZSBhIGZyYW1lCisgICAgICAgIC8vIGlzIHByb2Nlc3NlZC4KKyAgICAgICAgbVBsYXlpbmdTdGF0ZSA9IENBTkNFTEVEOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIGVuZCgpIHsKKyAgICAgICAgaWYgKCFzQW5pbWF0aW9ucy5jb250YWlucyh0aGlzKSAmJiAhc1BlbmRpbmdBbmltYXRpb25zLmNvbnRhaW5zKHRoaXMpKSB7CisgICAgICAgICAgICAvLyBTcGVjaWFsIGNhc2UgaWYgdGhlIGFuaW1hdGlvbiBoYXMgbm90IHlldCBzdGFydGVkOyBnZXQgaXQgcmVhZHkgZm9yIGVuZGluZworICAgICAgICAgICAgbVN0YXJ0ZWREZWxheSA9IGZhbHNlOworICAgICAgICAgICAgc1BlbmRpbmdBbmltYXRpb25zLmFkZCh0aGlzKTsKKyAgICAgICAgICAgIGlmIChzQW5pbWF0aW9uSGFuZGxlciA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgc0FuaW1hdGlvbkhhbmRsZXIgPSBuZXcgQW5pbWF0aW9uSGFuZGxlcigpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgc0FuaW1hdGlvbkhhbmRsZXIuc2VuZEVtcHR5TWVzc2FnZShBTklNQVRJT05fU1RBUlQpOworICAgICAgICB9CisgICAgICAgIC8vIEp1c3Qgc2V0IHRoZSBFTkRFRCBmbGFnIC0gdGhpcyBjYXVzZXMgdGhlIGFuaW1hdGlvbiB0byBlbmQgdGhlIG5leHQgdGltZSBhIGZyYW1lCisgICAgICAgIC8vIGlzIHByb2Nlc3NlZC4KKyAgICAgICAgbVBsYXlpbmdTdGF0ZSA9IEVOREVEOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyBib29sZWFuIGlzUnVubmluZygpIHsKKyAgICAgICAgLy8gRU5ERUQgb3IgQ0FOQ0VMRUQgaW5kaWNhdGUgdGhhdCBpd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F5VGltZSA9IGN1cnJlbnRUaW1lIC0gbVN0YXJ0VGltZTsKKyAgICAgICAgICAgIGxvbmcgdGltZUxlZnQgPSBtRHVyYXRpb24gLSBjdXJyZW50UGxheVRpbWU7CisgICAgICAgICAgICBtU3RhcnRUaW1lID0gY3VycmVudFRpbWUgLSB0aW1lTGVmdDsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIHN0YXJ0KHRydWUpOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogQ2FsbGVkIGludGVybmFsbHkgdG8gZW5kIGFuIGFuaW1hdGlvbiBieSByZW1vdmluZyBpdCBmcm9tIHRoZSBhbmltYXRpb25zIGxpc3QuIE11c3QgYmUKKyAgICAgKiBjYWxsZWQgb24gdGhlIFVJIHRocmVhZC4KKyAgICAgKi8KKyAgICBwcml2YXRlIHZvaWQgZW5kQW5pbWF0aW9uKCkgeworICAgICAgICBzQW5pbWF0aW9ucy5yZW1vdmUodGhpcyk7CisgICAgICAgIG1QbGF5aW5nU3RhdGUgPSBTVE9QUEVEOworICAgICAgICBpZiAobUxpc3RlbmVycyAhPSBudWxsKSB7CisgICAgICAgICAgICBBcnJheUxpc3Q8QW5pbWF0YWJsZUxpc3RlbmVyPiB0bXBMaXN0ZW5lcnMgPQorICAgICAgICAgICAgICAgICAgICAoQXJyYXlMaXN0PEFuaW1hdGFibGVMaXN0ZW5lcj4pIG1MaXN0ZW5lcnMuY2xvbmUoKTsKKyAgICAgICAgICAgIGZvciAoQW5pbWF0YWJsZUxpc3RlbmVyIGxpc3RlbmVyIDogdG1wTGlzdGVuZXJzKSB7CisgICAgICAgICAgICAgICAgbGlzdGVuZXIub25BbmltYXRpb25FbmQodGhpcyk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBDYWxsZWQgaW50ZXJuYWxseSB0byBzdGFydCBhbiBhbmltYXRpb24gYnkgYWRkaW5nIGl0IHRvIHRoZSBhY3Rpd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vbiwgaW5jbHVkaW5nIGFueSByZXBldGl0aW9ucyBkdWUgdG8KKyAgICAgKiA8Y29kZT5yZXBlYXRDb3VudDwvY29kZT4gaGFzIGJlZW4gZXhjZWVkZWQgYW5kIHRoZSBhbmltYXRpb24gc2hvdWxkIGJlIGVuZGVkLgorICAgICAqLworICAgIHByaXZhdGUgYm9vbGVhbiBhbmltYXRpb25GcmFtZShsb25nIGN1cnJlbnRUaW1lKSB7CisgICAgICAgIGJvb2xlYW4gZG9uZSA9IGZhbHNlOworCisgICAgICAgIGlmIChtUGxheWluZ1N0YXRlID09IFNUT1BQRUQpIHsKKyAgICAgICAgICAgIG1QbGF5aW5nU3RhdGUgPSBSVU5OSU5HOworICAgICAgICAgICAgaWYgKG1TZWVrVGltZSA8IDApIHsKKyAgICAgICAgICAgICAgICBtU3RhcnRUaW1lID0gY3VycmVudFRpbWU7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIG1TdGFydFRpbWUgPSBjdXJyZW50VGltZSAtIG1TZWVrVGltZTsKKyAgICAgICAgICAgICAgICAvLyBOb3cgdGhhdCB3ZSdyZSBwbGF5aW5nLCByZXNldCB0aGUgc2VlayB0aW1lCisgICAgICAgICAgICAgICAgbVNlZWtUaW1lID0gLTE7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgc3dpdGNoIChtUGxheWluZ1N0YXRlKSB7CisgICAgICAgIGNhc2UgUlVOTklORzoKKyAgICAgICAgY2FzZSBTRUVLRUQ6CisgICAgICAgICAgICBmbG9hdCBmcmFjdGlvbiA9IChmbG9hdCkoY3VycmVudFRpbWUgLSBtU3RhcnRUaW1lKSAvIG1EdXJhdGlvbjsKKyAgICAgICAgICAgIGlmIChmcmFjdGlvbiA+PSAxZikgeworICAgICAgICAgICAgICAgIGlmIChtQ3VycmVudEl0ZXJhdGlvbiA8IG1SZXBlYXRDb3VudCB8fCBtUmVwZWF0Q291bnQgPT0gSU5GSU5JVEUpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gVGltZSB0byByZXBlYXQKKyAgICAgICAgICAgICAgICAgICAgaWYgKG1MaXN0ZW5lcnMgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChBbmltYXRhYmxlTGlzdGVuZXIgbGlzdGVuZXIgOiBtTGlzdGVuZXJzKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlzdGVuZXIub25BbmltYXRpb25SZXBlYXQodGhpcyk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgKyttQ3VycmVudEl0ZXJhdGlvbjsKKyAgICAgICAgICAgICAgICAgICAgaWYgKG1SZXBlYXRNb2RlID09IFJFVkVSU0UpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1QbGF5aW5nQmFja3dhcmRzID0gbVBsYXlpbmdCYWNrd2FyZHMgPyBmYWxzZSA6IHRydWU7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgLy8gVE9ETzogZG9lc24ndCBhY2NvdW50IGZvciBmcmFjdGlvbiBnb2luZyBXYXl5eXl5IG92ZXIgMSwgbGlrZSAyKworICAgICAgICAgICAgICAgICAgICBmcmFjdGlvbiA9IGZyYWN0aW9uIC0gMWY7CisgICAgICAgICAgICAgICAgICAgIG1TdGFydFRpbWUgKz0gbUR1cmF0aW9uOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIGRvbmUgPSB0cnVlOworICAgICAgICAgICAgICAgICAgICBmcmFjdGlvbiA9IE1hdGgubWluKGZyYWN0aW9uLCAxLjBmKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAobVBsYXlpbmdCYWNrd2FyZHMpIHsKKyAgICAgICAgICAgICAgICBmcmFjdGlvbiA9IDFmIC0gZnJhY3Rpb247CisgICAgICAgICAgICB9CisgICA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ZXlmcmFtZSBwcmV2S2V5ZnJhbWUgPSBtS2V5ZnJhbWVzLmdldCgwKTsKKyAgICAgICAgZm9yIChpbnQgaSA9IDE7IGkgPCBtTnVtS2V5ZnJhbWVzOyArK2kpIHsKKyAgICAgICAgICAgIEtleWZyYW1lIG5leHRLZXlmcmFtZSA9IG1LZXlmcmFtZXMuZ2V0KGkpOworICAgICAgICAgICAgaWYgKGZyYWN0aW9uIDwgbmV4dEtleWZyYW1lLmdldEZyYWN0aW9uKCkpIHsKKyAgICAgICAgICAgICAgICBmaW5hbCBJbnRlcnBvbGF0b3IgaW50ZXJwb2xhdG9yID0gbmV4dEtleWZyYW1lLmdldEludGVycG9sYXRvcigpOworICAgICAgICAgICAgICAgIGlmIChpbnRlcnBvbGF0b3IgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBmcmFjdGlvbiA9IGludGVycG9sYXRvci5nZXRJbnRlcnBvbGF0aW9uKGZyYWN0aW9uKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZmxvYXQgaW50ZXJ2YWxGcmFjdGlvbiA9IChmcmFjdGlvbiAtIHByZXZLZXlmcmFtZS5nZXRGcmFjdGlvbigpKSAvCisgICAgICAgICAgICAgICAgICAgIChuZXh0S2V5ZnJhbWUuZ2V0RnJhY3Rpb24oKSAtIHByZXZLZXlmcmFtZS5nZXRGcmFjdGlvbigpKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gZXZhbHVhdG9yLmV2YWx1YXRlKGludGVydmFsRnJhY3Rpb24sIHByZXZLZXlmcmFtZS5nZXRWYWx1ZSgpLAorICAgICAgICAgICAgICAgICAgICAgICAgbmV4dEtleWZyYW1lLmdldFZhbHVlKCkpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcHJldktleWZyYW1lID0gbmV4dEtleWZyYW1lOworICAgICAgICB9CisgICAgICAgIC8vIHNob3VsZG4ndCBnZXQgaGVyZQorICAgICAgICByZXR1cm4gbUtleWZyYW1lcy5nZXQ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ge0BsaW5rICNDSEFOR0VfQVBQRUFSSU5HfSwge0BsaW5rICNDSEFOR0VfRElTQVBQRUFSSU5HfSwKKyAgICAgKiB7QGxpbmsgI0FQUEVBUklOR30sIG9yIHtAbGluayAjRElTQVBQRUFSSU5HfSwgd2hpY2ggZGV0ZXJtaW5lcyB0aGUgYW5pbWF0aW9uIHdob3NlIHN0YXJ0CisgICAgICogZGVsYXkgaXMgYmVpbmcgc2V0LgorICAgICAqIEBwYXJhbSBkZWxheSBUaGUgbGVuZ3RoIG9mIHRpbWUsIGluIG1pbGxpc2Vjb25kcywgdG8gZGVsYXkgYmVmb3JlIHN0YXJ0aW5nIHRoZSBhbmltYXRpb24uCisgICAgICogQHNlZSBhbmRyb2lkLmFuaW1hdGlvbi5BbmltYXRhYmxlI3NldFN0YXJ0RGVsYXkobG9uZykKKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBzZXRTdGFydERlbGF5KGludCB0cmFuc2l0aW9uVHlwZSwgbG9uZyBkZWxheSkgeworICAgICAgICBzd2l0Y2ggKHRyYW5zaXRpb25UeXBlKSB7CisgICAgICAgICAgICBjYXNlIENIQU5HRV9BUFBFQVJJTkc6CisgICAgICAgICAgICAgICAgbUNoYW5naW5nQXBwZWFyaW5nRGVsYXkgPSBkZWxheTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgQ0hBTkdFX0RJU0FQUEVBUklORzoKKyAgICAgICAgICAgICAgICBtQ2hhbmdpbmdEaXNhcHBlYXJpbmdEZWxheSA9IGRlbGF5OworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBBUFBFQVJJTkc6CisgICAgICAgICAgICAgICAgbUFwcGVhcmluZ0RlbGF5ID0gZGVsYXk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIERJU0FQUEVBUklORzoKKyAgICAgICAgICAgICAgICBtRGlzYXBwZWFyaW5nRGVsYXkgPSBkZWxheTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIEdldHMgdGhlIHN0YXJ0IGRlbGF5IG9uIG9uZSBvZiB0aGUgYW5pbWF0aW9uIG9iamVjdHMgdXNlZCBieSB0aGlzIHRyYW5zaXRpb24uIFRoZQorICAgICAqIDxjb2RlPnRyYW5zaXRpb25UeXBlPC9jb2RlPiBwYXJhbWV0ZXIgZGV0ZXJtaW5lcyB0aGUgYW5pbWF0aW9uIHdob3NlIHN0YXJ0IGRlbGF5CisgICAgICogaXMgcmV0dXJuZWQuCisgICAgICoKKyAgICAgKiBAcGFyYW0gdHJhbnNpdGlvblR5cGUgb25lIG9mIHtAbGluayAjQ0hBTkdFX0FQUEVBUklOR30sIHtAbGluayAjQ0hBTkdFX0RJU0FQUEVBUklOR30sCisgICAgICoge0BsaW5rICNBUFBFQVJJTkd9LCBvciB7QGxpbmsgI0RJU0FQUEVBUklOR30sIHdoaWNoIGRldGVybWluZXMgdGhlIGFuaW1hdGlvbiB3aG9zZSBzdGFydAorICAgICAqIGRlbGF5IGlzIHJldHVybmVkLgorICAgICAqIEByZXR1cm4gbG9uZyBUaGUgc3RhcnQgZGVsYXkgb2YgdGhlIHNwZWNpZmllZCBhbmltYXRpb24uCisgICAgICogQHNlZSBhbmRyb2lkLmFuaW1hdGlvbi5BbmltYXRhYmxlI2dldFN0YXJ0RGVsYXkoKQorICAgICAqLworICAgIHB1YmxpYyBsb25nIGdldFN0YXJ0RGVsYXkoaW50IHRyYW5zaXRpb25UeXBlKSB7CisgICAgICAgIHN3aXRjaCAodHJhbnNpdGlvblR5cGUpIHsKKyAgICAgICAgICAgIGNhc2UgQ0hBTkdFX0FQUEVBUklORzoKKyAgICAgICAgICAgICAgICByZXR1cm4gbUNoYW5naW5nQXBwZWFyaW5nRHVyYXRpb247CisgICAgICAgICAgICBjYXNlIENIQU5HRV9ESVNBUFBFQVJJTkc6CisgICAgICAgICAgICAgICAgcmV0d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yYXRpb24obG9uZykKKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBzZXREdXJhdGlvbihpbnQgdHJhbnNpdGlvblR5cGUsIGxvbmcgZHVyYXRpb24pIHsKKyAgICAgICAgc3dpdGNoICh0cmFuc2l0aW9uVHlwZSkgeworICAgICAgICAgICAgY2FzZSBDSEFOR0VfQVBQRUFSSU5HOgorICAgICAgICAgICAgICAgIG1DaGFuZ2luZ0FwcGVhcmluZ0R1cmF0aW9uID0gZHVyYXRpb247CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIENIQU5HRV9ESVNBUFBFQVJJTkc6CisgICAgICAgICAgICAgICAgbUNoYW5naW5nRGlzYXBwZWFyaW5nRHVyYXRpb24gPSBkdXJhdGlvbjsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgQVBQRUFSSU5HOgorICAgICAgICAgICAgICAgIG1BcHBlYXJpbmdEdXJhdGlvbiA9IGR1cmF0aW9uOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBESVNBUFBFQVJJTkc6CisgICAgICAgICAgICAgICAgbURpc2FwcGVhcmluZ0R1cmF0aW9uID0gZHVyYXRpb247CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBHZXRzIHRoZSBkdXJhdGlvbiBvbiBvbmUgb2YgdGhlIGFuaW1hdGlvbiBvYmplY3RzIHVzZWQgYnkgdGhpcyB0cmFuc2l0aW9uLiBUaGUKKyAgICAgKiA8Y29kZT50cmFuc2l0aW9uVHlwZTwvY29kZT4gcGFyYW1ldGVyIGRldGVybWluZXMgdGhlIGFuaW1hdGlvbiB3aG9zZSBkdXJhdGlvbgorICAgICAqIGlzIHJldHVybmVkLgorICAgICAqCisgICAgICogQHBhcmFtIHRyYW5zaXRpb25UeXBlIG9uZSBvZiB7QGxpbmsgI0NIQU5HRV9BUFBFQVJ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R30sIHtAbGluayAjQ0hBTkdFX0RJU0FQUEVBUklOR30sCisgICAgICoge0BsaW5rICNBUFBFQVJJTkd9LCBvciB7QGxpbmsgI0RJU0FQUEVBUklOR30sIHdoaWNoIGRldGVybWluZXMgdGhlIGFuaW1hdGlvbiB3aG9zZQorICAgICAqIGR1cmF0aW9uIGlzIGJlaW5nIHNldC4KKyAgICAgKiBAcGFyYW0gaW50ZXJwb2xhdG9yIFRoZSBpbnRlcnBvbGF0b3IgdGhhdCB0aGUgc3BlY2lmaWVkIGFuaW1hdGlvbiBzaG91bGQgdXNlLgorICAgICAqIEBzZWUgYW5kcm9pZC5hbmltYXRpb24uQW5pbWF0YWJsZSNzZXRJbnRlcnBvbGF0b3IoYW5kcm9pZC52aWV3LmFuaW1hdGlvbi5JbnRlcnBvbGF0b3IpCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0SW50ZXJwb2xhdG9yKGludCB0cmFuc2l0aW9uVHlwZSwgSW50ZXJwb2xhdG9yIGludGVycG9sYXRvcikgeworICAgICAgICBzd2l0Y2ggKHRyYW5zaXRpb25UeXBlKSB7CisgICAgICAgICAgICBjYXNlIENIQU5HRV9BUFBFQVJJTkc6CisgICAgICAgICAgICAgICAgbUNoYW5naW5nQXBwZWFyaW5nSW50ZXJwb2xhdG9yID0gaW50ZXJwb2xhdG9yOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBDSEFOR0VfRElTQVBQRUFSSU5HOgorICAgICAgICAgICAgICAgIG1DaGFuZ2luZ0Rpc2FwcGVhcmluZ0ludGVycG9sYXRvciA9IGludGVycG9sYXRvcjsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgQVBQRUFSSU5HOgorICAgICAgICAgICAgICAgIG1BcHBlYXJpbmdJbnRlcnBvbGF0b3IgPSBpbnRlcnBvbGF0b3I7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIERJU0FQUEVBUklORzoKKyAgICAgICAgICAgICAgICBtRGlzYXBwZWFyaW5nSW50ZXJwb2xhdG9yID0gaW50ZXJwb2xhdG9yOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogR2V0cyB0aGUgaW50ZXJwb2xhdG9yIG9uIG9uZSBvZiB0aGUgYW5pbWF0aW9uIG9iamVjdHMgdXNlZCBieSB0aGlzIHRyYW5zaXRpb24uIFRoZQorICAgICAqIDxjb2RlPnRyYW5zaXRpb25UeXBlPC9jb2RlPiBwYXJhbWV0ZXIgZGV0ZXJtaW5lcyB0aGUgYW5pbWF0aW9uIHdob3NlIGludGVycG9sYXRvcgorICAgICAqIGlzIHJldHVybmVkLgorICAgICAqCisgICAgICogQHBhcmFtIHRyYW5zaXRpb25UeXBlIG9uZSBvZiB7QGxpbmsgI0NIQU5HRV9BUFBFQVJJTkd9LCB7QGxpbmsgI0NIQU5HRV9ESVNBUFBFQVJJTkd9LAorICAgICAqIHtAbGluayAjQVBQRUFSSU5HfSwgb3Ige0BsaW5rICNESVNBUFBFQVJJTkd9LCB3aGljaCBkZXRlcm1pbmVzIHRoZSBhbmltYXRpb24gd2hvc2UKKyAgICAgKiBkdXJhdGlvbiBpcyBiZWluZyBzZXQuCisgICAgICogQHJldHVybiBJbnRlcnBvbGF0b3IgVGhlIGludGVycG9sYXRvciB0aGF0IHRoZSBzcGVjaWZpZWQgYW5pbWF0aW9uIHVzZXMuCisgICAgICogQHNlZSBhbmRyb2lkLmFuaW1hdGlvbi5BbmltYXRhYmxlI3NldEludGVycG9sYXRvcihhbmRyb2lkLnZpZXcuYW5pbWF0aW9uLkludGVycG9sYXRvcikKKyAgICAgKi8KKyAgICBwdWJsaWMgSW50ZXJwb2xhdG9yIGdldEludGVycG9sYXRvcihpbnQgdHJhbnNpdGlvblR5cGUpIHsKKyAgICAgICAgc3dpdGNoICh0cmFuc2l0aW9uVHlwZSkgeworICAgICAgICAgICAgY2FzZSBD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HB1YmxpYyB2b2lkIHNldEFuaW1hdGFibGUoaW50IHRyYW5zaXRpb25UeXBlLCBBbmltYXRhYmxlIGFuaW1hdGFibGUpIHsKKyAgICAgICAgc3dpdGNoICh0cmFuc2l0aW9uVHlwZSkgeworICAgICAgICAgICAgY2FzZSBDSEFOR0VfQVBQRUFSSU5HOgorICAgICAgICAgICAgICAgIG1DaGFuZ2luZ0FwcGVhcmluZ0FuaW0gPSAoYW5pbWF0YWJsZSAhPSBudWxsKSA/IGFuaW1hdGFibGUgOiBkZWZhdWx0Q2hhbmdlSW47CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIENIQU5HRV9ESVNBUFBFQVJJTkc6CisgICAgICAgICAgICAgICAgbUNoYW5naW5nRGlzYXBwZWFyaW5nQW5pbSA9IChhbmltYXRhYmxlICE9IG51bGwpID8gYW5pbWF0YWJsZSA6IGRlZmF1bHRDaGFuZ2VPdXQ7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIEFQUEVBUklORzoKKyAgICAgICAgICAgICAgICBtQXBwZWFyaW5nQW5pbSA9IChhbmltYXRhYmxlICE9IG51bGwpID8gYW5pbWF0YWJsZSA6IGRlZmF1bHRGYWRlSW47CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIERJU0FQUEVBUklORzoKKyAgICAgICAgICAgICAgICBtRGlzYXBwZWFyaW5nQW5pbSA9IChhbmltYXRhYmxlICE9IG51bGwpID8gYW5pbWF0YWJsZSA6IGRlZmF1bHRGYWRlT3V0OworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogR2V0cyB0aGUgYW5pbWF0aW9uIHVzZWQgZHVyaW5nIG9uZSBvZiB0aGUgdHJhbnNpdGlvbiB0eXBlcyB0aGF0IG1heSBydW4uCisgICAgICoKKyAgICAgKiBAcGFyYW0gdHJhbnNpdGlvblR5cGUgb25lIG9mIHtAbGluayAjQ0hBTkdFX0FQUEVBUklOR30sIHtAbGluayAjQ0hBTkdFX0RJU0FQUEVBUklOR30sCisgICAgICoge0BsaW5rICNBUFBFQVJJTkd9LCBvciB7QGxpbmsgI0RJU0FQUEVBUklOR30sIHdoaWNoIGRldGVybWluZXMgdGhlIGFuaW1hdGlvbiB3aG9zZQorICAgICAqIGR1cmF0aW9uIGlzIGJlaW5nIHNldC4KKyAgICAgKiBAcmV0dXJuIEFuaW1hdGFibGUgVGhlIGFuaW1hdGlvbiBiZWluZyB1c2VkIGZvciB0aGUgZ2l2ZW4gdHJhbnNpdGlvbiB0eXBlLgorICAgICAqIEBzZWUgI3NldEFuaW1hdGFibGUoaW50LCBBbmltYXRhYmxlKQorICAgICAqLworICAgIHB1YmxpYyBBbmltYXRhYmxlIGdldEFuaW1hdGFibGUoaW50IHRyYW5zaXRpb25UeXBlKSB7CisgICAgICAgIHN3aXRjaCAodHJhbnNpdGlvblR5cGUpIHsKKyAgICAgICAgICAgIGNhc2UgQ0hBTkdFX0FQUEVBUklORzoKKyAgICAgICAgICAgICAgICByZXR1cm4gbUNoYW5naW5nQXBwZWFyaW5nQW5pbTsKKyAgICAgICAgICAgIGNhc2UgQ0hBTkdFX0RJU0FQUEVBUklORzoKKyAgICAgICAgICAgICAgICByZXR1cm4gbUNoYW5naW5nRGlzYXBwZWFyaW5nQW5pbTsKKyAgICAgICAgICAgIGNhc2UgQVBQRUFSSU5HOgorICAgICAgICAgICAgICAgIHJldHVybiBtQXBwZWFyaW5nQW5pbTsKKyAgICAgICAgICAgIGNhc2UgRElTQVBQRUFSSU5HOgorICAgICAgICAgICAgICAgIHJldHVybiBtRGlzYXBwZWFyaW5nQW5pbTsKKyAgICAgICAgfQorICAgICAgICAvLyBzaG91bGRuJ3QgcmVhY2ggaGVyZQorICAgICAgICByZXR1cm4gbnVsbDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBUaGlzIGZ1bmN0aW9uIHNldHMgdXAgcnVucy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udEFuaW1hdGlvbi5jYW5jZWwoKTsKKyAgICAgICAgICAgICAgICAgICAgY3VycmVudEFuaW1hdGlvbnMucmVtb3ZlKGNoaWxkKTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAvLyBNYWtlIGEgY29weSBvZiB0aGUgYXBwcm9wcmlhdGUgYW5pbWF0aW9uCisgICAgICAgICAgICAgICAgZmluYWwgQW5pbWF0YWJsZSBhbmltID0gKGNoYW5nZVJlYXNvbiA9PSBBUFBFQVJJTkcpID8KKyAgICAgICAgICAgICAgICAgICAgICAgIG1DaGFuZ2luZ0FwcGVhcmluZ0FuaW0uY2xvbmUoKSA6CisgICAgICAgICAgICAgICAgICAgICAgICBtQ2hhbmdpbmdEaXNhcHBlYXJpbmdBbmltLmNsb25lKCk7CisKKyAgICAgICAgICAgICAgICAvLyBTZXQgdGhlIHRhcmdldCBvYmplY3QgZm9yIHRoZSBhbmltYXRpb24KKyAgICAgICAgICAgICAgICBhbmltLnNldFRhcmdldChjaGlsZCk7CisKKyAgICAgICAgICAgICAgICAvLyBBIFByb3BlcnR5QW5pbWF0b3IgKG9yIFNlcXVlbmNlciBvZiB0aGVtKSBjYW4gZXh0cmFjdCBzdGFydCB2YWx1ZXMgZnJvbQorICAgICAgICAgICAgICAgIC8vIGl0cyB0YXJnZXQgb2JqZWN0CisgICAgICAgICAgICAgICAgYW5pbS5zZXR1cFN0YXJ0VmFsdWVzKCk7CisKKyAgICAgICAgICAgICAgICAvLyBBZGQgYSBsaXN0ZW5lciB0byB0cmFjayBsYXlvdXQgY2hhbmdlcyBvbiB0aGlzIHZpZXcuIElmIHdlIGRvbid0IGdldCBhIGNhbGxiYWNrLAorICAgICAgICAgICAgICAgIC8vIHRoZW4gdGhlcmUncyBub3RoaW5nIHRvIGFuaW1hdGUuCisgICAgICAgICAgICAgICAgVmlldy5PbkxheW91dENoYW5nZUxpc3RlbmVyIGxpc3RlbmVyID0gbmV3IFZpZXcuT25MYXlvdXRDaGFuZ2VMaXN0ZW5lcigpIHsKKyAgICAgICAgICAgICAgICAgICAgcHVibGljIHZvaWQgb25MYXlvdXRDaGFuZ2UoVmlldyB2LCBpbnQgbGVmdCwgaW50IHRvcCwgaW50IHJpZ2h0LCBpbnQgYm90dG9tLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBvbGRMZWZ0LCBpbnQgb2xkVG9wLCBpbnQgb2xkUmlnaHQsIGludCBvbGRCb3R0b20pIHsKKworICAgICAgICAgICAgICAgICAgICAgICAgLy8gQ2FjaGUgdGhlIGFuaW1hdGlvbiBpbiBjYXNlIHdlIG5lZWQgdG8gY2FuY2VsIGl0IGxhdGVyCisgICAgICAgICAgICAgICAgICAgICAgICBjdXJyZW50QW5pbWF0aW9ucy5wdXQoY2hpbGQsIGFuaW0pOworCisgICAgICAgICAgICAgICAgICAgICAgICAvLyBUZWxsIHRoZSBhbmltYXRpb24gdG8gZXh0cmFjdCBlbmQgdmFsdWVzIGZyb20gdGhlIGNoYW5nZWQgb2JqZWN0CisgICAgICAgICAgICAgICAgICAgICAgICBhbmltLnNldHVwRW5kVmFsdWVzKCk7CisKKyAgICAgICAgICAgICAgICAgICAgICAgIGxvbmcgc3RhcnREZWxheTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGxvbmcgZHVyYXRpb247CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY2hhbmdlUmVhc29uID09IEFQUEVBUklORykgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0RGVsYXkgPSBtQ2hhbmdpbmdBcHBlYXJpbmdEZWxheSArIHN0YWdnZXJEZWxheTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGFnZ2VyRGVsYXkgKz0gbUNoYW5naW5nQXBwZWFyaW5nU3RhZ2dlcjsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBkdXJhdGlvbiA9IG1DaGFuZ2luZ0FwcGVhcmluZ0R1cmF0aW9uOworICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGFydERlbGF5ID0gbUNoYW5naW5nRGlzYXBwZWFyaW5nRGVsYXkgKyBzdGFnZ2VyRGVsYXk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhZ2dlckRlbGF5ICs9IG1DaGFuZ2luZ0Rpc2FwcGVhcmluZ1N0YWdnZXI7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZHVyYXRpb24gPSBtQ2hhbmdpbmdEaXNhcHBlYXJpbmdEdXJhdGlvbjsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGFuaW0uc2V0U3RhcnREZWxheShzdGFydERlbGF5KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGFuaW0uc2V0RHVyYXRpb24oZHVyYXRpb24pOworCisgICAgICAgICAgICAgICAgICAgICAgICAvLyBSZW1vdmUgdGhlIGFuaW1hdGlvbiBmcm9tIHRoZSBjYWNoZSB3aGVuIGl0IGVuZHMKKyAgICAgICAgICAgICAgICAgICAgICAgIGFuaW0uYWRkTGlzdGVuZXIobmV3IEFuaW1hdGFibGVMaXN0ZW5lckFkYXB0ZXIoKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJpdmF0ZSBib29sZWFuIGNhbmNlbGVkID0gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHVibGljIHZvaWQgb25BbmltYXRpb25DYW5jZWwoQW5pbWF0YWJsZSBhbmltYXRhYmxlKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHdlIHJlbW92ZSBjYW5jZWxlZCBhbmltYXRpb25zIGltbWVkaWF0ZWx5LCBub3QgaGVyZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYW5jZWxlZCA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIG9uQW5pbWF0aW9uRW5kKEFuaW1hdGFibGUgYW5pbWF0YWJsZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWNhbmNlbGVkKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXJyZW50QW5pbWF0aW9ucy5yZW1vdmUoY2hpbGQpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgfSk7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYW5pbSBpbnN0YW5jZW9mIFByb3BlcnR5QW5pbWF0b3IpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAoKFByb3BlcnR5QW5pbWF0b3IpIGFuaW0pLnNldEN1cnJlbnRQbGF5VGltZSgwKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGFuaW0uc3RhcnQoKTsKKworICAgICAgICAgICAgICAgICAgICAgICAgLy8gdGhpcyBvbmx5IHJlbW92ZXMgbGlzdGVuZXJzIHdob3NlIHZpZXdzIGNoYW5nZWQgLSBtdXN0IGNsZWFyIHRoZQorICAgICAgICAgICAgICAgICAgICAgICAgLy8gb3RoZXIgbGlzdGVuZXJzIGxhdGVyCisgICAgICAgICAgICAgICAgICAgICAgICBjaGlsZC5yZW1vdmVPbkxheW91dENoYW5nZUxpc3RlbmVyKHRoaXMpOworICAgICAgICAgICAgICAgICAgICAgICAgbGF5b3V0Q2hhbmdlTGlzdGVuZXJNYXAucmVtb3ZlKGNoaWxkKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH07CisgICAgICAgICAgICAgICAgY2hpbGQuYWRkT25MYXlvdXRDaGFuZ2VMaXN0ZW5lcihsaXN0ZW5lcik7CisgICAgICAgICAgICAgICAgLy8gY2FjaGUgdGhlIGxpc3RlbmVyIGZvciBsYXRlciByZW1vdmFsCisgICAgICAgICAgICAgICAgbGF5b3V0Q2hhbmdlTGlzdGVuZXJNYXAucHV0KGNoaWxkLCBsaXN0ZW5lcik7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgLy8gVGhpcyBpcyB0aGUgY2xlYW51cCBzdGVwLiBXaGVuIHdlIGdldCB0aGlzIHJlbmRlcmluZyBldmVudCwgd2Uga25vdyB0aGF0IGFsbCBvZgorICAgICAgICAvLyB0aGUgYXBwcm9wcmlhdGUgYW5pbWF0aW9ucyBoYXZlIGJlZW4gc2V0IHVwIGFuZCBydW4uIE5vdyB3ZSBjYW4gY2xlYXIgb3V0IHRoZQorICAgICAgICAvLyBsYXlvdXQgbGlzdGVuZXJzLgorICAgICAgICBvYnNlcnZlci5hZGRPblByZURyYXdMaXN0ZW5lcihuZXcgVmlld1RyZWVPYnNlcnZlci5PblByZURyYXdMaXN0ZW5lcigpIHsKKyAgICAgICAgICAgIHB1YmxpYyBib29sZWFuIG9uUHJlRHJhdygpIHsKKyAgICAgICAgICAgICAgICBvYnNlcnZlci5yZW1vdmVPblByZURyYXdMaXN0ZW5lcih0aGlzKTsKKyAgICAgICAgICAgICAgICBpbnQgbnVtQ2hpbGRyZW4gPSBwYXJlbnQuZ2V0Q2hpbGRDb3VudCgpOworICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbnVtQ2hpbGRyZW47ICsraSkgeworICAgICAgICAgICAgICAgICAgICBmaW5hbCBWaWV3IGNoaWxkID0gcGFyZW50LmdldENoaWxkQXQoaSk7CisgICAgICAgICAgICAgICAgICAgIGNoaWxkLnJlbW92ZU9uTGF5b3V0Q2hhbmdlTGlzdGVuZXIobGF5b3V0Q2hhbmdlTGlzdGVuZXJNYXAuZ2V0KGNoaWxkKSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGxheW91dENoYW5nZUxpc3RlbmVyTWFwLmNsZWFyKCk7CisgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICB9CisgICAgICAgIH0pOworICAgIH0KKworICAgIC8qKgorICAgICAqIFRoaXMgbWV0aG9kIHJ1bnMgdGhlIGFuaW1hdGlvbiB0aGF0IG1ha2VzIGFuIGFkZGVkIGl0ZW0gYXBwZWFyLgorICAgICAqCisgICAgICogQHBhcmFtIHBhcmVudCBUaGUgVmlld0dyb3VwIHRvIHdoaWNoIHRoZSBWaWV3IGlzIGJlaW5nIGFkZGVkLgorICAgICAqIEBwYXJhbSBjaGlsZCBUaGUgVmlldyBiZWluZyBhZGRlZCB0byB0aGUgVmlld0dyb3VwLgorICAgICAqLworICAgIHByaXZhdGUgdm9pZCBydW5BcHBlYXJpbmdUcmFuc2l0aW9uKGZpbmFsIFZpZXdHcm91cCBwYXJlbnQsIGZpbmFsIFZpZXcgY2hpbGQpIHsKKyAgICAgICAgQW5pbWF0YWJsZSBhbmltID0gbUFwcGVhcmluZ0FuaW0uY2xvbmUoKTsKKyAgICAgICAgYW5pbS5zZXRUYXJnZXQoY2hpbGQpOworICAgICAgICBhbmltLnNldFN0YXJ0RGVsYXkobUFwcGVhcmluZ0RlbGF5KTsKKyAgICAgICAgYW5pbS5zZXREdXJhdGlvbihtQXBwZWFyaW5nRHVyYXRpb24pOworICAgICAgICBpZiAoYW5pbSBpbnN0YW5jZW9mIFByb3BlcnR5QW5pbWF0b3IpIHsKKyAgICAgICAgICAgICgoUHJvcGVydHlBbmltYXRvcikgYW5pbSkuc2V0Q3VycmVudFBsYXlUaW1lKDApOworICAgICAgICB9CisgICAgICAgIGlmIChtTGlzdGVuZXJzICE9IG51bGwpIHsKKyAgICAgICAgICAgIGFuaW0uYWRkTGlzdGVuZXIobmV3IEFuaW1hdGFibGVMaXN0ZW5lckFkYXB0ZXIoKSB7CisgICAgICAgICAgICAgICAgcHVibGljIHZvaWQgb25BbmltYXRpb25FbmQoKSB7CisgICAgICAgICAgICAgICAgICAgIGZvciAoVHJhbnNpdGlvbkxpc3RlbmVyIGxpc3RlbmVyIDogbUxpc3RlbmVycykgeworICAgICAgICAgICAgICAgICAgICAgICAgbGlzdGVuZXIuZW5kVHJhbnNpdGlvbihMYXlvdXRUcmFuc2l0aW9uLnRoaXMsIHBhcmVudCwgY2hpbGQsIEFQUEVBUklORyk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9KTsKKyAgICAgICAgfQorICAgICAgICBhbmltLnN0YXJ0KCk7CisgICAgfQorCisgICAgLyoqCisgICAgICogVGhpcyBtZXRob2QgcnVucyB0aGUgYW5pbWF0aW9uIHRoYXQgbWFrZXMgYSByZW1vdmVkIGl0ZW0gZGlzYXBwZWFyLgorICAgICAqCisgICAgICogQHBhcmFtIHBhcmVudCBUaGUgVmlld0dyb3VwIGZyb20gd2hpY2ggdGhlIFZpZXcgaXMgYmVpbmcgcmVtb3ZlZC4KKyAgICAgKiBAcGFyYW0gY2hpbGQgVGhlIFZpZXcgYmVpbmcgcmVtb3ZlZCBmcm9tIHRoZSBWaWV3R3JvdXAuCisgICAgICovCisgICAgcHJpdmF0ZSB2b2lkIHJ1bkRpc2FwcGVhcmluZ1RyYW5zaXRpb24oZmluYWwgVmlld0dyb3VwIHBhcmVudCwgZmluYWwgVmlldyBjaGlsZCkgeworICAgICAgICBBbmltYXRhYmxlIGFuaW0gPSBtRGlzYXBwZWFyaW5nQW5pbS5jbG9uZSgpOworICAgICAgICBhbmltLnNldFN0YXJ0RGVsYXkobURpc2FwcGVhcmluZ0RlbGF5KTsKKyAgICAgICAgYW5pbS5zZXREdXJhdGlvbihtRGlzYXBwZWFyaW5nRHVyYXRpb24pOworICAgICAgICBhbmltLnNldFRhcmdldChjaGlsZCk7CisgICAgICAgIGlmIChtTGlzdGVuZXJzICE9IG51bGwpIHsKKyAgICAgICAgICAgIGFuaW0uYWRkTGlzdGVuZXIobmV3IEFuaW1hdGFibGVMaXN0ZW5lckFkYXB0ZXIoKSB7CisgICAgICAgICAgICAgICAgcHVibGljIHZvaWQgb25BbmltYXRpb25FbmQoKSB7CisgICAgICAgICAgICAgICAgICAgIGZvciAoVHJhbnNpdGlvbkxpc3RlbmVyIGxpc3RlbmVyIDogbUxpc3RlbmVycykgeworICAgICAgICAgICAgICAgICAgICAgICAgbGlzdGVuZXIuZW5kVHJhbnNpdGlvbihMYXlvdXRUcmFuc2l0aW9uLnRoaXMsIHBhcmVudCwgY2hpbGQsIERJU0FQUEVBUklORyk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9KTsKKyAgICAgICAgfQorICAgICAgICBpZiAoYW5pbSBpbnN0YW5jZW9mIFByb3BlcnR5QW5pbWF0b3IpIHsKKyAgICAgICAgICAgICgoUHJvcGVydHlBbmltYXRvcikgYW5pbSkuc2V0Q3VycmVudFBsYXlUaW1lKDApOworICAgICAgICB9CisgICAgICAgIGFuaW0uc3RhcnQoKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBUaGlzIG1ldGhvZCBpcyBjYWxsZWQgYnkgVmlld0dyb3VwIHdoZW4gYSBjaGlsZCB2aWV3IGlzIGFib3V0IHRvIGJlIGFkZGVkIHRvIHRoZQorICAgICAqIGNvbnRhaW5lci4gVGhpcyBjYWxsYmFjayBzdGFydHMgdGhlIHByb2Nlc3Mgb2YgYSB0cmFuc2l0aW9uOyB3ZSBncmFiIHRoZSBzdGFydGluZworICAgICAqIHZhbHVlcywgbGlzdGVuIGZvciBjaGFuZ2VzIHRvIGFsbCBvZiB0aGUgY2hpbGRyZW4gb2YgdGhlIGNvbnRhaW5lciwgYW5kIHN0YXJ0IGFwcHJvcHJpYXRlCisgICAgICogYW5pbWF0aW9ucy4KKyAgICAgKgorICAgICAqIEBwYXJhbSBwYXJlbnQgVGhlIFZpZXdHcm91cCB0byB3aGljaCB0aGUgVmlldyBpcyBiZWluZyBhZGRlZC4KKyAgICAgKiBAcGFyYW0gY2hpbGQgVGhlI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4oKTsKKyAgICAgICAgfQorICAgICAgICBtTGlzdGVuZXJzLmFkZChsaXN0ZW5lcik7CisgICAgfQorCisgICAgLyoqCisgICAgICogUmVtb3ZlIGEgbGlzdGVuZXIgZm9yIGxheW91dCBjaGFuZ2VzLgorICAgICAqCisgICAgICogQHBhcmFtIGxpc3RlbmVyIFRoZSBsaXN0ZW5lciBmb3IgbGF5b3V0IGJvdW5kcyBjaGFuZ2UuCisgICAgICovCisgICAgcHVibGljIHZvaWQgcmVtb3ZlVHJhbnNpdGlvbkxpc3RlbmVyKFRyYW5zaXRpb25MaXN0ZW5lciBsaXN0ZW5lcikgeworICAgICAgICBpZiAobUxpc3RlbmVycyA9PSBudWxsKSB7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKyAgICAgICAgbUxpc3RlbmVycy5yZW1vdmUobGlzdGVuZXIpOworICAgIH0KKworICAgIC8qKgorICAgICAqIEdldHMgdGhlIGN1cnJlbnQgbGlzdCBvZiBsaXN0ZW5lcnMgZm9yIGxheW91dCBjaGFuZ2VzLgorICAgICAqIEByZXR1cm4KKyAgICAgKi8KKyAgICBwdWJsaWMgTGlzdDxUcmFuc2l0aW9uTGlzdGVuZXI+IGdldFRyYW5zaXRpb25MaXN0ZW5lcnMoKSB7CisgICAgICAgIHJldHVybiBtTGlzdGVuZXJzOworICAgIH0KKworICAgIC8qKgorICAgICAqIFRoaXMgaW50ZXJmYWNlIGlzIHVzZWQgZm9yIGxpc3RlbmluZyB0byBzdGFydGluZyBhbmQgZW5kaW5nIGV2ZW50cyBmb3IgdHJhbnNpdGlvbnMuCisgICAgICovCisgICAgcHVibGljIGludGVyZmFjZSBUcmFuc2l0aW9uTGlzdGVuZXIgeworCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGlzIGV2ZW50IGlzIHNlbnQgdG8gbGlzdGVuZXJzIHdoZW4gYW4gQVBQRUFSSU5HIG9yIERJU0FQUEVBUklORyB0cmFuc2l0aW9uCisgICAgICAgICAqIGJlZ2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lOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIGlmICh0aGlzVmFsdWVUeXBlICE9IG1WYWx1ZVR5cGUpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtVmFsdWVUeXBlID09IEludGVnZXIuY2xhc3MgJiYKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHRoaXNWYWx1ZVR5cGUgPT0gRmxvYXQuY2xhc3MgfHwgdGhpc1ZhbHVlVHlwZSA9PSBEb3VibGUuY2xhc3MpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVZhbHVlVHlwZSA9IHRoaXNWYWx1ZVR5cGU7CisgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKG1WYWx1ZVR5cGUgPT0gRmxvYXQuY2xhc3MgJiYgdGhpc1ZhbHVlVHlwZSA9PSBEb3VibGUuY2xhc3MpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtVmFsdWVUeXBlID0gdGhpc1ZhbHVlVHlwZTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBLZXlmcmFtZSBrZXlmcmFtZXNbXSA9IG5ldyBLZXlmcmFtZVtNYXRoLm1heChudW1LZXlmcmFtZXMsMildOworICAgICAgICBpZiAobVZhbHVlVHlwZS5lcXVhbHMoS2V5ZnJhbWUuY2xhc3MpKSB7CisgICAgICAgICAgICBtVmFsdWVUeXBlID0gKChLZXlmcmFtZSl2YWx1ZXNbMF0pLmdldFR5cGUoKTsKKyAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbnVtS2V5ZnJhbWVzOyArK2kpIHsKKyAgICAgICAgICAgICAgICBrZXlmcmFtZXNbaV0gPSAoS2V5ZnJhbWUpdmFsdWVzW2ldOworICAgICAgICAgICAgfQorICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgaWYgKG51bUtleWZyYW1lcyA9PSAxKSB7CisgICAgICAgICAgICAgICAga2V5ZnJhbWVzWzBdID0gbmV3IEtleWZyYW1lKDBmLCAoT2JqZWN0KSBudWxsKTsKKyAgICAgICAgICAgICAgICBrZXlmcmFtZXNbMV0gPSBuZXcgS2V5ZnJhbWUoMWYsIHZhbHVlc1swXSk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGtleWZyYW1lc1swXSA9IG5ldyBLZXlmcmFtZSgwZiwgdmFsdWVzWzBdKTsKKyAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMTsgaSA8IG51bUtleWZyYW1lczsgKytpKSB7CisgICAgICAgICAgICAgICAgICAgIGlmICh2YWx1ZXNbaV0gIT0gbnVsbCAmJiAodmFsdWVzW2ldLmdldENsYXNzKCkgIT0gbVZhbHVlVHlwZSkpIHsKKworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGtleWZyYW1lc1tpXSA9IG5ldyBLZXlmcmFtZSgoZmxvYXQpIGkgLyAobnVtS2V5ZnJhbWVzIC0gMSksIHZhbHVlc1tpXSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIG1LZXlmcmFtZVNldCA9IG5ldyBLZXlmcmFtZVNldChrZXlmcmFtZXMpOworICAgIH0KKworCisKKyAgICAvKioKKyAgICAgKiBEZXRlcm1pbmUgdGhlIHNldHRlciBvciBnZXR0ZXIgZnVuY3Rpb24gdXNpbmcgdGhlIEphdmFCZWFucyBjb252ZW50aW9uIG9mIHNldEZvbyBvcgorICAgICAqIGdldEZvbyBmb3IgYSBwcm9wZXJ0eSBuYW1lZCAnZm9vJy4gVGhpcyBmdW5jdGlvbiBmaWd1cmVzIG91dCB3aGF0IHRoZSBuYW1lIG9mIHRoZQorICAgICAqIGZ1bmN0aW9uIHNob3VsZCBiZSBhbmQgdXNlcyByZW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LyBUT0RPOiBmYXN0ZXIgaW1wbGVtZW50YXRpb24uLi4KKyAgICAgICAgTWV0aG9kIHJldHVyblZhbCA9IG51bGw7CisgICAgICAgIFN0cmluZyBmaXJzdExldHRlciA9IG1Qcm9wZXJ0eU5hbWUuc3Vic3RyaW5nKDAsIDEpOworICAgICAgICBTdHJpbmcgdGhlUmVzdCA9IG1Qcm9wZXJ0eU5hbWUuc3Vic3RyaW5nKDEpOworICAgICAgICBmaXJzdExldHRlciA9IGZpcnN0TGV0dGVyLnRvVXBwZXJDYXNlKCk7CisgICAgICAgIFN0cmluZyBtZXRob2ROYW1lID0gcHJlZml4ICsgZmlyc3RMZXR0ZXIgKyB0aGVSZXN0OworICAgICAgICBDbGFzcyBhcmdzW10gPSBudWxsOworICAgICAgICBpZiAodmFsdWVUeXBlID09IG51bGwpIHsKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgcmV0dXJuVmFsID0gdGFyZ2V0Q2xhc3MuZ2V0TWV0aG9kKG1ldGhvZE5hbWUsIGFyZ3MpOworICAgICAgICAgICAgfSBjYXRjaCAoTm9TdWNoTWV0aG9kRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICBMb2cuZSgiUHJvcGVydHlWYWx1ZXNIb2xkZXIiLAorICAgICAgICAgICAgICAgICAgICAgICAgIkNvdWxkbid0IGZpbmQgbm8tYXJnIG1ldGhvZCBmb3IgcHJvcGVydHkgIiArIG1Qcm9wZXJ0eU5hbWUgKyAiOiAiICsgZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBhcmdzID0gbmV3IENsYXNzWzFdOworICAgICAgICAgICAgQ2xhc3MgdHlwZVZhcmlhbnRzW107CisgICAgICAgICAgICBpZiAobVZhbHVlVHlwZS5lcXVhbHMoRmxvYXQuY2xhc3MpKSB7CisgICAgICAgICAgICAgICAgdHlwZVZhcmlhbnRzID0gRkxPQVRfVkFSSUFOVFM7CisgICAgICAgICAgICB9IGVsc2UgaWYgKG1WYWx1ZVR5cGUuZXF1YWxzKEludGVnZXIuY2xhc3MpKSB7CisgICAgICAgICAgICAgICAgdHlwZVZhcmlhbnRzID0gSU5URUdFUl9WQVJJQU5UUzsKKyAgICAgICAgICAgIH0gZWxzZSBpZiAobVZhbHVlVHlwZS5lcXVhbHMoRG91YmxlLmNsYXNzKSkgeworICAgICAgICAgICAgICAgIHR5cGVWYXJpYW50cyA9IERPVUJMRV9WQVJJQU5UUzsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgdHlwZVZhcmlhbnRzID0gbmV3IENsYXNzWzFdOworICAgICAgICAgICAgICAgIHR5cGVWYXJpYW50c1swXSA9IG1WYWx1ZVR5cGU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBmb3IgKENsYXNzIHR5cGVWYXJpYW50IDogdHlwZVZhcmlhbnRzKSB7CisgICAgICAgICAgICAgICAgYXJnc1swXSA9IHR5cGVWYXJpYW50OworICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgIHJldHVyblZhbCA9IHRhcmdldENsYXNzLmdldE1ldGhvZChtZXRob2ROYW1lLCBhcmdzKTsKKyAgICAgICAgICAgICAgICAgICAgLy8gY2hhbmdlIHRoZSB2YWx1ZSB0eXBlIHRvIHN1aXQKKyAgICAgICAgICAgICAgICAgICAgbVZhbHVlVHlwZSA9IHR5cGVWYXJpYW50OworICAgICAgICAgICAgICAgICAgICByZXR1cm4gcmV0dXJuVmFsOworICAgICAgICAgICAgICAgIH0gY2F0Y2ggKE5vU3VjaE1ldGhvZEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgICAgIC8vIFN3YWxsb3cgdGhlIGVycm9yIGFuZCBrZWVwIHRyeWluZyBvdGhlciB2YXJpYW50cworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIC8vIElmIHdlIGdvdCBoZXJlLCB0aGVuIG5vIGFw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2V0KG1Qcm9wZXJ0eU5hbWUpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKHNldHRlck9yR2V0dGVyID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICBzZXR0ZXJPckdldHRlciA9IGdldFByb3BlcnR5RnVuY3Rpb24odGFyZ2V0Q2xhc3MsIHByZWZpeCwgdmFsdWVUeXBlKTsKKyAgICAgICAgICAgICAgICBpZiAocHJvcGVydHlNYXAgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBwcm9wZXJ0eU1hcCA9IG5ldyBIYXNoTWFwPFN0cmluZywgTWV0aG9kPigpOworICAgICAgICAgICAgICAgICAgICBwcm9wZXJ0eU1hcE1hcC5wdXQodGFyZ2V0Q2xhc3MsIHByb3BlcnR5TWFwKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcHJvcGVydHlNYXAucHV0KG1Qcm9wZXJ0eU5hbWUsIHNldHRlck9yR2V0dGVyKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBmaW5hbGx5IHsKKyAgICAgICAgICAgIHByb3BlcnR5TWFwTG9jay53cml0ZUxvY2soKS51bmxvY2soKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gc2V0dGVyT3JHZXR0ZXI7CisgICAgfQorCisgICAgLyoqCisgICAgICogVXRpbGl0eSBmdW5jdGlvbiB0byBnZXQgdGhlIHNldHRlciBmcm9tIHRhcmdldENsYXNzCisgICAgICogQHBhcmFtIHRhcmdldENsYXNzIFRoZSBDbGFzcyBvbiB3aGljaCB0aGUgcmVxdWVzdGVkIG1ldGhvZCBzaG91bGQgZXhpc3QuCisgICAgICovCisgICAgcHJpdmF0ZSB2b2lkIHNldHVwU2V0dGVyKENsYXNzIHRhcmdldENsYXNzKSB7CisgICAgICAgIG1TZXR0ZXIgPSBzZXR1cFNldHRlck9yR2V0dGVyKHRhcmdldENsYXNzLCBzU2V0dGVyUHJvcGVydHlNYXAsICJzZXQiLCBtVmFsdW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gICAgKiBvbiB0aGUgdGFyZ2V0IG9iamVjdC4KKyAgICAgKiBAcGFyYW0gdGFyZ2V0IFRoZSBvYmplY3Qgb24gd2hpY2ggdGhlIHNldHRlciAoYW5kIHBvc3NpYmx5IGdldHRlcikgZXhpc3QuCisgICAgICovCisgICAgdm9pZCBzZXR1cFNldHRlckFuZEdldHRlcihPYmplY3QgdGFyZ2V0KSB7CisgICAgICAgIENsYXNzIHRhcmdldENsYXNzID0gdGFyZ2V0LmdldENsYXNzKCk7CisgICAgICAgIGlmIChtU2V0dGVyID09IG51bGwpIHsKKyAgICAgICAgICAgIHNldHVwU2V0dGVyKHRhcmdldENsYXNzKTsKKyAgICAgICAgfQorICAgICAgICBmb3IgKEtleWZyYW1lIGtmIDogbUtleWZyYW1lU2V0Lm1LZXlmcmFtZXMpIHsKKyAgICAgICAgICAgIGlmIChrZi5nZXRWYWx1ZSgpID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICBpZiAobUdldHRlciA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIHNldHVwR2V0dGVyKHRhcmdldENsYXNzKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAgICAga2Yuc2V0VmFsdWUoKFQpIG1HZXR0ZXIuaW52b2tlKHRhcmdldCkpOworICAgICAgICAgICAgICAgIH0gY2F0Y2ggKEludm9jYXRpb25UYXJnZXRFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICBMb2cuZSgiUHJvcGVydHlWYWx1ZXNIb2xkZXIiLCBlLnRvU3RyaW5nKCkpOworICAgICAgICAgICAgICAgIH0gY2F0Y2ggKElsbGVnYWxBY2Nlc3NFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICBMb2cuZSgiUHJvcGVydHlWYWx1ZXNIb2xkZXIiLCBlLnRvU3RyaW5nKCkpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAg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ldHVybiBjaGlsZExpc3Q7CisgICAgfQorCisgICAgLyoqCisgICAgICogU2V0cyB0aGUgdGFyZ2V0IG9iamVjdCBmb3IgYWxsIGN1cnJlbnQge0BsaW5rICNnZXRDaGlsZEFuaW1hdGlvbnMoKSBjaGlsZCBhbmltYXRpb25zfQorICAgICAqIG9mIHRoaXMgU2VxdWVuY2VyIHRoYXQgdGFrZSB0YXJnZXRzICh7QGxpbmsgYW5kcm9pZC5hbmltYXRpb24uUHJvcGVydHlBbmltYXRvcn0gYW5kCisgICAgICogU2VxdWVuY2VyKS4KKyAgICAgKgorICAgICAqIEBwYXJhbSB0YXJnZXQgVGhlIG9iamVjdCBiZWluZyBhbmltYXRlZAorICAgICAqLworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIHNldFRhcmdldChPYmplY3QgdGFyZ2V0KSB7CisgICAgICAgIGZvciAoTm9kZSBub2RlIDogbU5vZGVzKSB7CisgICAgICAgICAgICBBbmltYXRhYmxlIGFuaW1hdGlvbiA9IG5vZGUuYW5pbWF0aW9uOworICAgICAgICAgICAgaWYgKGFuaW1hdGlvbiBpbnN0YW5jZW9mIFNlcXVlbmNlcikgeworICAgICAgICAgICAgICAgICgoU2VxdWVuY2VyKWFuaW1hdGlvbikuc2V0VGFyZ2V0KHRhcmdldCk7CisgICAgICAgICAgICB9IGVsc2UgaWYgKGFuaW1hdGlvbiBpbnN0YW5jZW9mIFByb3BlcnR5QW5pbWF0b3IpIHsKKyAgICAgICAgICAgICAgICAoKFByb3BlcnR5QW5pbWF0b3IpYW5pbWF0aW9uKS5zZXRUYXJnZXQodGFyZ2V0KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIFNldHMgdGhlIEludGVycG9sYXRvciBmb3IgYWxsIGN1cnJlbnQge0BsaW5rICNnZXRDaGlsZEFuaW1hdGlvbnMoKSBjaGlsZCBhbmltYXRpb25zfQorICAgICAqIG9mIHRoaXMgU2VxdW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hcm5pbmdzKCJ1bmNoZWNrZWQiKQorICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIGNhbmNlbCgpIHsKKyAgICAgICAgbUNhbmNlbGVkID0gdHJ1ZTsKKyAgICAgICAgaWYgKG1MaXN0ZW5lcnMgIT0gbnVsbCkgeworICAgICAgICAgICAgQXJyYXlMaXN0PEFuaW1hdGFibGVMaXN0ZW5lcj4gdG1wTGlzdGVuZXJzID0KKyAgICAgICAgICAgICAgICAgICAgKEFycmF5TGlzdDxBbmltYXRhYmxlTGlzdGVuZXI+KSBtTGlzdGVuZXJzLmNsb25lKCk7CisgICAgICAgICAgICBmb3IgKEFuaW1hdGFibGVMaXN0ZW5lciBsaXN0ZW5lciA6IHRtcExpc3RlbmVycykgeworICAgICAgICAgICAgICAgIGxpc3RlbmVyLm9uQW5pbWF0aW9uQ2FuY2VsKHRoaXMpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGlmIChtU29ydGVkTm9kZXMuc2l6ZSgpID4gMCkgeworICAgICAgICAgICAgZm9yIChOb2RlIG5vZGUgOiBtU29ydGVkTm9kZXMpIHsKKyAgICAgICAgICAgICAgICBub2RlLmFuaW1hdGlvbi5jYW5jZWwoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIHtAaW5oZXJpdERvY30KKyAgICAgKgorICAgICAqIDxwPk5vdGUgdGhhdCBlbmRpbmcgYSA8Y29kZT5TZXF1ZW5jZXI8L2NvZGU+IGFsc28gZW5kcyBhbGwgb2YgdGhlIGFuaW1hdGlvbnMgdGhhdCBpdCBpcworICAgICAqIHJlc3BvbnNpYmxlIGZvci48L3A+CisgICAgICovCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgZW5kKCkgeworICAgICAgICBtQ2FuY2VsZWQgPSB0cnVlOworICAgICAgICBpZiAobVNvcnRlZE5vZGVzLnNpemUoKSAhPSBtTm9kZXMuc2l6ZSgpKSB7CisgICAgICAgICAgICAvLyBoYXNuJ3QgYmVlbiBzdGFydGVkIHlldCAtIHNvcnQgdGhlIG5vZGVzIG5vdywgdGhlbiBlbmQgdGhlbQorICAgICAgICAgICAgc29ydE5vZGVzKCk7CisgICAgICAgICAgICBmb3IgKE5vZGUgbm9kZSA6IG1Tb3J0ZWROb2RlcykgeworICAgICAgICAgICAgICAgIGlmIChtU2VxdWVuY2VMaXN0ZW5lciA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIG1TZXF1ZW5jZUxpc3RlbmVyID0gbmV3IFNlcXVlbmNlckFuaW1hdGFibGVMaXN0ZW5lcih0aGlzKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgbm9kZS5hbmltYXRpb24uYWRkTGlzdGVuZXIobVNlcXVlbmNlTGlzdGVuZXIpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGlmIChtU29ydGVkTm9kZXMuc2l6ZSgpID4gMCkgeworICAgICAgICAgICAgZm9yIChOb2RlIG5vZGUgOiBtU29ydGVkTm9kZXMpIHsKKyAgICAgICAgICAgICAgICBub2RlLmFuaW1hdGlvbi5lbmQoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIFJldHVybnMgdHJ1ZSBpZiBhbnkgb2YgdGhlIGNoaWxkIGFuaW1hdGlvbnMgb2YgdGhpcyBTZXF1ZW5jZXIgaGF2ZSBiZWVuIHN0YXJ0ZWQgYW5kIGhhdmUgbm90CisgICAgICogeWV0IGVuZGVkLgorICAgICAqIEByZXR1cm4gV2hldGhlciB0aGlzIFNlcXVlbmNlciBoYXMgYmVlbiBzdGFydGVkIGFuZCBoYXMgbm90IHlldCBlbmRlZC4KKyAgICAgKi8KKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgYm9vbGVhbiBpc1J1bm5pbmcoKSB7CisgICAgICAgIGZvciAoTm9kZSBub2RlIDogbU5vZGVzKSB7CisgICAgICAgICAgICBpZiAobm9kZS5hbmltYXRpb24uaXNSdW5uaW5nKCkpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgLyoqCisgICAgICogVGhlIGFtb3VudCBvZiB0aW1lLCBpbiBtaWxsaXNlY29uZHMsIHRvIGRlbGF5IHN0YXJ0aW5nIHRoZSBhbmltYXRpb24gYWZ0ZXIKKyAgICAgKiB7QGxpbmsgI3N0YXJ0KCl9IGlzIGNhbGxlZC4KKyAgICAgKgorICAgICAqIEByZXR1cm4gdGhlIG51bWJlciBvZiBtaWxsaXNlY29uZHMgdG8gZGVsYXkgcnVubmluZyB0aGUgYW5pbWF0aW9uCisgICAgICovCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIGxvbmcgZ2V0U3RhcnREZWxheSgpIHsKKyAgICAgICAgcmV0dXJuIG1TdGFydERlbGF5OworICAgIH0KKworICAgIC8qKgorICAgICAqIFRoZSBhbW91bnQgb2YgdGltZSwgaW4gbWlsbGlzZWNvbmRzLCB0byBkZWxheSBzdGFydGluZyB0aGUgYW5pbWF0aW9uIGFmdGVyCisgICAgICoge0BsaW5rICNzdGFydCgpfSBpcyBjYWxsZWQuCisKKyAgICAgKiBAcGFyYW0gc3RhcnREZWxheSBUaGUgYW1vdW50IG9mIHRoZSBkZWxheSwgaW4gbWlsbGlzZWNvbmRzCisgICAgICovCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgc2V0U3RhcnREZWxheShsb25nIHN0YXJ0RGVsYXkpIHsKKyAgICAgICAgbVN0YXJ0RGVsYXkgPSBzdGFydERlbGF5OworICAgIH0KKworICAgIC8qKgorICAgICAqIEdldHMgdGhlIGxlbmd0aCBvZiBlYWNoIG9mIHRoZSBjaGlsZCBhbmltYXRpb25zIG9mIHRoaXMgU2VxdWVuY2VyLiBUaGlzIHZhbHVlI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AgICAgICAgaWYgKG5vZGUuZGVwZW5kZW5jaWVzID09IG51bGwgfHwgbm9kZS5kZXBlbmRlbmNpZXMuc2l6ZSgpID09IDApIHsKKyAgICAgICAgICAgICAgICBub2Rlc1RvU3RhcnQuYWRkKG5vZGUpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBmb3IgKERlcGVuZGVuY3kgZGVwZW5kZW5jeSA6IG5vZGUuZGVwZW5kZW5jaWVzKSB7CisgICAgICAgICAgICAgICAgICAgIGRlcGVuZGVuY3kubm9kZS5hbmltYXRpb24uYWRkTGlzdGVuZXIoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3IERlcGVuZGVuY3lMaXN0ZW5lcih0aGlzLCBub2RlLCBkZXBlbmRlbmN5LnJ1bGUpKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgbm9kZS50bXBEZXBlbmRlbmNpZXMgPSAoQXJyYXlMaXN0PERlcGVuZGVuY3k+KSBub2RlLmRlcGVuZGVuY2llcy5jbG9uZSgpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbm9kZS5hbmltYXRpb24uYWRkTGlzdGVuZXIobVNlcXVlbmNlTGlzdGVuZXIpOworICAgICAgICB9CisgICAgICAgIC8vIE5vdyB0aGF0IGFsbCBkZXBlbmRlbmNpZXMgYXJlIHNldCB1cCwgc3RhcnQgdGhlIGFuaW1hdGlvbnMgdGhhdCBzaG91bGQgYmUgc3RhcnRlZC4KKyAgICAgICAgaWYgKG1TdGFydERlbGF5IDw9IDApIHsKKyAgICAgICAgICAgIGZvciAoTm9kZSBub2RlIDogbm9kZXNUb1N0YXJ0KSB7CisgICAgICAgICAgICAgICAgbm9kZS5hbmltYXRpb24uc3RhcnQoKTsKKyAgICAgICAgICAgICAgICBtUGxheWluZ1NldC5hZGQobm9kZS5hbmltYXRpb24pOworICAgICAgICAgICAgfQorICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgLy8gVE9ETzogTmVlZCB0byBjYW5jZWwgb3V0IG9mIHRoZSBkZWxheSBhcHByb3ByaWF0ZWx5CisgICAgICAgICAgICBBbmltYXRvciBkZWxheUFuaW0gPSBuZXcgQW5pbWF0b3IobVN0YXJ0RGVsYXksIDBmLCAxZik7CisgICAgICAgICAgICBkZWxheUFuaW0uYWRkTGlzdGVuZXIobmV3IEFuaW1hdGFibGVMaXN0ZW5lckFkYXB0ZXIoKSB7CisgICAgICAgICAgICAgICAgcHVibGljIHZvaWQgb25BbmltYXRpb25FbmQoQW5pbWF0YWJsZSBhbmltKSB7CisgICAgICAgICAgICAgICAgICAgIGZvciAoTm9kZSBub2RlIDogbm9kZXNUb1N0YXJ0KSB7CisgICAgICAgICAgICAgICAgICAgICAgICBub2RlLmFuaW1hdGlvbi5zdGFydCgpOworICAgICAgICAgICAgICAgICAgICAgICAgbVBsYXlpbmdTZXQuYWRkKG5vZGUuYW5pbWF0aW9uKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0pOworICAgICAgICB9CisgICAgICAgIGlmIChtTGlzdGVuZXJzICE9IG51bGwpIHsKKyAgICAgICAgICAgIEFycmF5TGlzdDxBbmltYXRhYmxlTGlzdGVuZXI+IHRtcExpc3RlbmVycyA9CisgICAgICAgICAgICAgICAgICAgIChBcnJheUxpc3Q8QW5pbWF0YWJsZUxpc3RlbmVyPikgbUxpc3RlbmVycy5jbG9uZSgpOworICAgICAgICAgICAgZm9yIChBbmltYXRhYmxlTGlzdGVuZXIgbGlzdGVuZXIgOiB0bXBMaXN0ZW5lcnMpIHsKKyAgICAgICAgICAgICAgICBsaXN0ZW5lci5vbkFuaW1hdGlvblN0YXJ0KHRoaXMpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIFNlcXVlbmNlciBjbG9uZSgpIHsKKyAgICAgICAgZmluYWwgU2VxdWVuY2VyIGFuaW0gPSAoU2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jaWVzID0gbnVsbDsKKyAgICAgICAgICAgIG5vZGVDbG9uZS5ub2RlRGVwZW5kZW50cyA9IG51bGw7CisgICAgICAgICAgICBub2RlQ2xvbmUubm9kZURlcGVuZGVuY2llcyA9IG51bGw7CisgICAgICAgICAgICAvLyBjbGVhciBvdXQgYW55IGxpc3RlbmVycyB0aGF0IHdlcmUgc2V0IHVwIGJ5IHRoZSBzZXF1ZW5jZXI7IHRoZXNlIHdpbGwKKyAgICAgICAgICAgIC8vIGJlIHNldCB1cCB3aGVuIHRoZSBjbG9uZSdzIG5vZGVzIGFyZSBzb3J0ZWQKKyAgICAgICAgICAgIEFycmF5TGlzdDxBbmltYXRhYmxlTGlzdGVuZXI+IGNsb25lTGlzdGVuZXJzID0gbm9kZUNsb25lLmFuaW1hdGlvbi5nZXRMaXN0ZW5lcnMoKTsKKyAgICAgICAgICAgIGlmIChjbG9uZUxpc3RlbmVycyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgQXJyYXlMaXN0PEFuaW1hdGFibGVMaXN0ZW5lcj4gbGlzdGVuZXJzVG9SZW1vdmUgPSBudWxsOworICAgICAgICAgICAgICAgIGZvciAoQW5pbWF0YWJsZUxpc3RlbmVyIGxpc3RlbmVyIDogY2xvbmVMaXN0ZW5lcnMpIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGxpc3RlbmVyIGluc3RhbmNlb2YgU2VxdWVuY2VyQW5pbWF0YWJsZUxpc3RlbmVyKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAobGlzdGVuZXJzVG9SZW1vdmUgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpc3RlbmVyc1RvUmVtb3ZlID0gbmV3IEFycmF5TGlzdDxBbmltYXRhYmxlTGlzdGVuZXI+KCk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBsaXN0ZW5lcnNUb1JlbW92ZS5hZGQobGlzdGVuZXIpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGlmIChsaXN0ZW5lcnNUb1JlbW92ZSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIGZvciAoQW5pbWF0YWJsZUxpc3RlbmVyIGxpc3RlbmVyIDogbGlzdGVuZXJzVG9SZW1vdmUpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNsb25lTGlzdGVuZXJzLnJlbW92ZShsaXN0ZW5lcik7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgLy8gTm93IHRoYXQgd2UndmUgY2xvbmVkIGFsbCBvZiB0aGUgbm9kZXMsIHdlJ3JlIHJlYWR5IHRvIHdhbGsgdGhyb3VnaCB0aGVpcgorICAgICAgICAvLyBkZXBlbmRlbmNpZXMsIG1hcHBpbmcgdGhlIG9sZCBkZXBlbmRlbmNpZXMgdG8gdGhlIG5ldyBub2RlcworICAgICAgICBmb3IgKE5vZGUgbm9kZSA6IG1Ob2RlcykgeworICAgICAgICAgICAgTm9kZSBub2RlQ2xvbmUgPSBub2RlQ2xvbmVNYXAuZ2V0KG5vZGUpOworICAgICAgICAgICAgaWYgKG5vZGUuZGVwZW5kZW5jaWVzICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBmb3IgKERlcGVuZGVuY3kgZGVwZW5kZW5jeSA6IG5vZGUuZGVwZW5kZW5jaWVzKSB7CisgICAgICAgICAgICAgICAgICAgIE5vZGUgY2xvbmVkRGVwZW5kZW5jeU5vZGUgPSBub2RlQ2xvbmVNYXAuZ2V0KGRlcGVuZGVuY3kubm9kZSk7CisgICAgICAgICAgICAgICAgICAgIERlcGVuZGVuY3kgY2xvbmVEZXBlbmRlbmN5ID0gbmV3IERlcGVuZGVuY3koY2xvbmVkRGVwZW5kZW5jeU5vZGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVwZW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BpbnQgcnVsZSkgeworICAgICAgICAgICAgdGhpcy5tU2VxdWVuY2VyID0gc2VxdWVuY2VyOworICAgICAgICAgICAgdGhpcy5tTm9kZSA9IG5vZGU7CisgICAgICAgICAgICB0aGlzLm1SdWxlID0gcnVsZTsKKyAgICAgICAgfQorCisgICAgICAgIC8qKgorICAgICAgICAgKiBJZ25vcmUgY2FuY2VsIGV2ZW50cyBmb3Igbm93LiBXZSBtYXkgd2FudCB0byBoYW5kbGUgdGhpcyBldmVudHVhbGx5LAorICAgICAgICAgKiB0byBwcmV2ZW50IGZvbGxvdy1vbiBhbmltYXRpb25zIGZyb20gcnVubmluZyB3aGVuIHNvbWUgZGVwZW5kZW5jeQorICAgICAgICAgKiBhbmltYXRpb24gaXMgY2FuY2VsZWQuCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgdm9pZCBvbkFuaW1hdGlvbkNhbmNlbChBbmltYXRhYmxlIGFuaW1hdGlvbikgeworICAgICAgICB9CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIEFuIGVuZCBldmVudCBpcyByZWNlaXZlZCAtIHNlZSBpZiB0aGlzIGlzIGFuIGV2ZW50IHdlIGFyZSBsaXN0ZW5pbmcgZm9yCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgdm9pZCBvbkFuaW1hdGlvbkVuZChBbmltYXRhYmxlIGFuaW1hdGlvbikgeworICAgICAgICAgICAgaWYgKG1SdWxlID09IERlcGVuZGVuY3kuQUZURVIpIHsKKyAgICAgICAgICAgICAgICBzdGFydElmUmVhZHkoYW5pbWF0aW9uKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIC8qKgorICAgICAgICAgKiBJZ25vcmUgcmVwZWF0IGV2ZW50cyBmb3Igbm93CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgdm9pZCBvbkFuaW1hdGlvblJlcGVhdChBbmltYXRhYmxlIGFuaW1hdGlvbikgeworICAgICAgICB9CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIEEgc3RhcnQgZXZlbnQgaXMgcmVjZWl2ZWQgLSBzZWUgaWYgdGhpcyBpcyBhbiBldmVudCB3ZSBhcmUgbGlzdGVuaW5nIGZvcgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHZvaWQgb25BbmltYXRpb25TdGFydChBbmltYXRhYmxlIGFuaW1hdGlvbikgeworICAgICAgICAgICAgaWYgKG1SdWxlID09IERlcGVuZGVuY3kuV0lUSCkgeworICAgICAgICAgICAgICAgIHN0YXJ0SWZSZWFkeShhbmltYXRpb24pOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIENoZWNrIHdoZXRoZXIgdGhlIGV2ZW50IHJlY2VpdmVkIGlzIG9uZSB0aGF0IHRoZSBub2RlIHdhcyB3YWl0aW5nIGZvci4KKyAgICAgICAgICogSWYgc28sIG1hcmsgaXQgYXMgY29tcGxldGUgYW5kIHNlZSB3aGV0aGVyIGl0J3MgdGltZSB0byBzdGFydAorICAgICAgICAgKiB0aGUgYW5pbWF0aW9uLgorICAgICAgICAgKiBAcGFyYW0gZGVwZW5kZW5jeUFuaW1hdGlvbiB0aGUgYW5pbWF0aW9uIHRoYXQgc2VudCB0aGUgZXZlbnQuCisgICAgICAgICAqLworICAgICAgICBwcml2YXRlIHZvaWQgc3RhcnRJZlJlYWR5KEFuaW1hdGFibGUgZGVwZW5kZW5jeUFuaW1hdGlvbikgeworICAgICAgICAgICAgaWYgKG1TZXF1ZW5jZXIubUNhbmNlbGVkKSB7CisgICAgICAgICAgICAgICAgLy8gaWYgdGhlIHBhcmVudCBTZXF1ZW5jZXIgd2FzIGNhbmNlbGVkLCB0aGVuIGRvbid0IHN0YXJ0IGFueSBkZXBlbmRlbnQgYW5pbXMKKyAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICB9CisgICAgICAgICAgICBEZXBlbmRlbmN5IGRlcGVuZGVuY3lUb1JlbW92ZSA9IG51bGw7CisgICAgICAgICAgICBmb3IgKERlcGVuZGVuY3kgZGVwZW5kZW5jeSA6IG1Ob2RlLnRtcERlcGVuZGVuY2llcykgeworICAgICAgICAgICAgICAgIGlmIChkZXBlbmRlbmN5LnJ1bGUgPT0gbVJ1bGUgJiYKKyAgICAgICAgICAgICAgICAgICAgICAgIGRlcGVuZGVuY3kubm9kZS5hbmltYXRpb24gPT0gZGVwZW5kZW5jeUFuaW1hdGlvbikgeworICAgICAgICAgICAgICAgICAgICAvLyBydWxlIGZpcmVkIC0gcmVtb3ZlIHRoZSBkZXBlbmRlbmN5IGFuZCBsaXN0ZW5lciBhbmQgY2hlY2sgdG8KKyAgICAgICAgICAgICAgICAgICAgLy8gc2VlIHdoZXRoZXIgaXQncyB0aW1lIHRvIHN0YXJ0IHRoZSBhbmltYXRpb24KKyAgICAgICAgICAgICAgICAgICAgZGVwZW5kZW5jeVRvUmVtb3ZlID0gZGVwZW5kZW5jeTsKKyAgICAgICAgICAgICAgICAgICAgZGVwZW5kZW5jeUFuaW1hdGlvbi5yZW1vdmVMaXN0ZW5lcih0aGlzKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgbU5vZGUudG1wRGVwZW5kZW5jaWVzLnJlbW92ZShkZXBlbmRlbmN5VG9SZW1vdmUpOworICAgICAgICAgICAgaWYgKG1Ob2RlLnRtcERlcGVuZGVuY2llcy5zaXplKCkgPT0gMCkgeworICAgICAgICAgICAgICAgIC8vIGFsbCBkZXBlbmRlbmNpZXMgc2F0aXNmaWVkOiBzdGFydCB0aGUgYW5pbWF0aW9uCisgICAgICAgICAgICAgICAgbU5vZGUuYW5pbWF0aW9uLnN0YXJ0KCk7CisgICAgICAgICAgICAgICAgbVNlcXVlbmNlci5tUGxheWluZ1NldC5hZGQobU5vZGUuYW5pbWF0aW9uKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgfQorCisgICAgcHJpdmF0ZSBjbGFzcyBTZXF1ZW5jZXJBbmltYXRhYmxlTGlzdGVuZXIgaW1wbGVtZW50cyBBbmltYXRhYmxlTGlzdGVuZXIgeworCisgICAgICAgIHByaXZhdGUgU2VxdWVuY2VyIG1TZXF1ZW5jZXI7CisKKyAgICAgICAgU2VxdWVuY2VyQW5pbWF0YWJsZUxpc3RlbmVyKFNlcXVlbmNlciBzZXF1ZW5jZXIpIHsKKyAgICAgICAgICAgIG1TZXF1ZW5jZXIgPSBzZXF1ZW5jZXI7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBvbkFuaW1hdGlvbkNhbmNlbChBbmltYXRhYmxlIGFuaW1hdGlvbikgeworICAgICAgICAgICAgaWYgKG1QbGF5aW5nU2V0LnNpemUoKSA9PSAwKSB7CisgICAgICAgICAgICAgICAgaWYgKG1MaXN0ZW5lcnMgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBmb3IgKEFuaW1hdGFibGVMaXN0ZW5lciBsaXN0ZW5lciA6IG1MaXN0ZW5lcnMpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGxpc3RlbmVyLm9uQW5pbWF0aW9uQ2FuY2VsKG1TZXF1ZW5jZXIpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgQFN1cHByZXNzV2FybmluZ3MoInVuY2hlY2tlZCIpCisgICAgICAgIHB1YmxpYyB2b2lkIG9uQW5pbWF0aW9uRW5kKEFuaW1hdGFibGUgYW5pbWF0aW9uKSB7CisgICAgICAgICAgICBhbmltYXRpb24ucmVtb3ZlTGlzdGVuZXIodGhpcyk7CisgICAgICAgICAgICBtUGxheWluZ1NldC5yZW1vdmUoYW5pbWF0aW9uKTsKKyAgICAgICAgICAgIE5vZGUgYW5pbU5vZGUgPSBtU2VxdWVuY2VyLm1Ob2RlTWFwLmdldChhbmltYXRpb24pOworICAgICAgICAgICAgYW5pbU5vZGUuZG9uZSA9IHRydWU7CisgICAgICAgICAgICBBcnJheUxpc3Q8Tm9kZT4gc29ydGVkTm9kZXMgPSBtU2VxdWVuY2VyLm1Tb3J0ZWROb2RlczsKKyAgICAgICAgICAgIGJvb2xlYW4gYWxsRG9uZSA9IHRydWU7CisgICAgICAgICAgICBmb3IgKE5vZGUgbm9kZSA6IHNvcnRlZE5vZGVzKSB7CisgICAgICAgICAgICAgICAgaWYgKCFub2RlLmRvbmUpIHsKKyAgICAgICAgICAgICAgICAgICAgYWxsRG9uZSA9IGZhbHNlOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoYWxsRG9uZSkgeworICAgICAgICAgICAgICAgIC8vIElmIHRoaXMgd2FzIHRoZSBsYXN0IGNoaWxkIGFuaW1hdGlvbiB0byBlbmQsIHRoZW4gbm90aWZ5IGxpc3RlbmVycyB0aGF0IHRoaXMKKyAgICAgICAgICAgICAgICAvLyBzZXF1ZW5jZXIgaGFzIGVuZGVkCisgICAgICAgICAgICAgICAgaWYgKG1MaXN0ZW5lcnMgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBBcnJheUxpc3Q8QW5pbWF0YWJsZUxpc3RlbmVyPiB0bXBMaXN0ZW5lcnMgPQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIChBcnJheUxpc3Q8QW5pbWF0YWJsZUxpc3RlbmVyPikgbUxpc3RlbmVycy5jbG9uZSgpOworICAgICAgICAgICAgICAgICAgICBmb3IgKEFuaW1hdGFibGVMaXN0ZW5lciBsaXN0ZW5lciA6IHRtcExpc3RlbmVycykgeworICAgICAgICAgICAgICAgICAgICAgICAgbGlzdGVuZXIub25BbmltYXRpb25FbmQobVNlcXVlbmNlcik7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICAvLyBOb3RoaW5nIHRvIGRvCisgICAgICAgIHB1YmxpYyB2b2lkIG9uQW5pbWF0aW9uUmVwZWF0KEFuaW1hdGFibGUgYW5pbWF0aW9uKSB7CisgICAgICAgIH0KKworICAgICAgICAvLyBOb3RoaW5nIHRvIGRvCisgICAgICAgIHB1YmxpYyB2b2lkIG9uQW5pbWF0aW9uU3RhcnQoQW5pbWF0YWJsZSBhbmltYXRpb24pIHsKKyAgICAgICAgfQorCisgICAgfQorCisgICAgLyoqCisgICAgICogVGhpcyBtZXRob2Qgc29ydHMgdGhlIGN1cnJlbnQgc2V0IG9mIG5vZGVzLCBpZiBuZWVkZWQuIFRoZSBzb3J0IGlzIGEgc2ltcGxlCisgICAgICogRGVwZW5kZW5jeUdyYXBoIHNvcnQsIHdoaWNoIGdvZXMgbGlrZSB0aGlzOgorICAgICAqIC0gQWxsIG5vZGVzIHdpdGhvdXQgZGVwZW5kZW5jaWVzIGJlY29tZSAncm9vdHMnCisgICAgICogLSB3aGlsZSByb290cyBsaXN0IGlzIG5vdCBudWxsCisgICAgICogLSAgIGZvciBlYWNoIHJvb3QgcgorICAgICAqIC0gICAgIGFkZCByIHRvIHNvcnRlZCBsaXN0CisgICAgICogLSAgICAgcmVtb3ZlIHIgYXMgYSBkZXBlbmRlbmN5IGZyb20gYW55IG90aGVyIG5vZGUKKyAgICAgKiAtICAgYW55IG5vZGVzIHdpdGggbm8gZGVwZW5kZW5jaWVzIGFyZSBhZGRlZCB0byB0aGUgcm9vdHMgbGlzdAorICAgICAqLworICAgIHByaXZhdGUgdm9pZCBzb3J0Tm9kZXMoKSB7CisgICAgICAgIGlmIChtTmVlZHNTb3J0KSB7CisgICAgICAgICAgICBtU29ydGVkTm9kZXMuY2xlYXIoKTsKKyAgICAgICAgICAgIEFycmF5TGlzdDxOb2RlPiByb290cyA9IG5ldyBBcnJheUxpc3Q8Tm9kZT4oKTsKKyAgICAgICAgICAgIGZvciAoTm9kZSBub2RlIDogbU5vZGVzKSB7CisgICAgICAgICAgICAgICAgaWYgKG5vZGUuZGVwZW5kZW5jaWVzID09IG51bGwgfHwgbm9kZS5kZXBlbmRlbmNpZXMuc2l6ZSgpID09IDApIHsKKyAgICAgICAgICAgICAgICAgICAgcm9vdHMuYWRkKG5vZGUpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIEFycmF5TGlzdDxOb2RlPiB0bXBSb290cyA9IG5ldyBBcnJheUxpc3Q8Tm9kZT4oKTsKKyAgICAgICAgICAgIHdoaWxlIChyb290cy5zaXplKCkgPiAwKSB7CisgICAgICAgICAgICAgICAgZm9yIChOb2RlIHJvb3QgOiByb290cykgeworICAgICAgICAgICAgICAgICAgICBtU29ydGVkTm9kZXMuYWRkKHJvb3QpOworICAgICAgICAgICAgICAgICAgICBpZiAocm9vdC5ub2RlRGVwZW5kZW50cyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKE5vZGUgbm9kZSA6IHJvb3Qubm9kZURlcGVuZGVudHMpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBub2RlLm5vZGVEZXBlbmRlbmNpZXMucmVtb3ZlKHJvb3QpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChub2RlLm5vZGVEZXBlbmRlbmNpZXMuc2l6ZSgpID09IDApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG1wUm9vdHMuYWRkKG5vZGUpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICByb290cy5jbGVhcigpOworICAgICAgICAgICAgICAgIHJvb3RzLmFkZEFsbCh0bXBSb290cyk7CisgICAgICAgICAgICAgICAgdG1wUm9vdHMuY2xlYXIoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1OZWVkc1NvcnQgPSBmYWxzZTsKKyAgICAgICAgICAgIGlmIChtU29ydGVkTm9kZXMuc2l6ZSgpICE9IG1Ob2Rlcy5zaXplKCkpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJDaXJjdWxhciBkZXBlbmRlbmNpZXMgY2Fubm90IGV4aXN0IgorICAgICAgICAgICAgICAgICAgICAgICAgKyAiIGluIFNlcXVlbmNlciIpOworICAgICAgICAgICAgfQorICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgLy8gRG9lc24ndCBuZWVkIHNvcnRpbmcsIGJ1dCBzdGlsbCBuZWVkIHRvIGFkZCBpbiB0aGUgbm9kZURlcGVuZGVuY2llcyBsaXN0CisgICAgICAgICAgICAvLyBiZWNhdXNlIHRoZXNlIGdldCByZW1vdmVkIGFzIHRoZSBldmVudCBsaXN0ZW5lcnMgZmlyZSBhbmQgdGhlIGRlcGVuZGVuY2llcworICAgICAgICAgICAgLy8gYXJlIHNhdGlzZmllZAorICAgICAgICAgICAgZm9yIChOb2RlIG5vZGUgOiBtTm9kZXMpIHsKKyAgICAgICAgICAgICAgICBpZiAobm9kZS5kZXBlbmRlbmNpZXMgIT0gbnVsbCAmJiBub2RlLmRlcGVuZGVuY2llcy5zaXplKCkgPiAwKSB7CisgICAgICAgICAgICAgICAgICAgIGZvciAoRGVwZW5kZW5jeSBkZXBlbmRlbmN5IDogbm9kZS5kZXBlbmRlbmNpZXMpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChub2RlLm5vZGVEZXBlbmRlbmNpZXMgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5vZGUubm9kZURlcGVuZGVuY2llcyA9IG5ldyBBcnJheUxpc3Q8Tm9kZT4oKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbm9kZS5ub2RlRGVwZW5kZW5jaWVzLmNvbnRhaW5zKGRlcGVuZGVuY3kubm9kZSkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBub2RlLm5vZGVEZXBlbmRlbmNpZXMuYWRkKGRlcGVuZGVuY3kubm9kZSk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgbm9kZS5kb25lID0gZmFsc2U7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBEZXBlbmRlbmN5IGhvbGRzIGluZm9ybWF0aW9uIGFib3V0IHRoZSBub2RlIHRoYXQgc29tZSBvdGhlciBub2RlIGlzCisgICAgICogZGVwZW5kZW50IHVwb24gYW5kIHRoZSBuYXR1cmUgb2YgdGhhdCBkZXBlbmRlbmN5LgorICAgICAqCisgICAgICovCisgICAgcHJpdmF0ZSBzdGF0aWMgY2xhc3MgRGVwZW5kZW5jeSB7CisgICAgICAgIHN0YXRpYyBmaW5hbCBpbnQgV0lUSCA9IDA7IC8vIGRlcGVuZGVudCBub2RlIG11c3Qgc3RhcnQgd2l0aCB0aGlzIGRlcGVuZGVuY3kgbm9kZQorICAgICAgICBzdGF0aWMgZmluYWwgaW50IEFGVEVSID0gMTsgLy8gZGVwZW5kZW50IG5vZGUgbXVzdCBzdGFydCB3aGVuIHRoaXMgZGVwZW5kZW5jeSBub2RlIGZpbmlzaGVzCisKKyAgICAgICAgLy8gVGhlIG5vZGUgdGhhdCB0aGUgb3RoZXIgbm9kZSB3aXRoIHRoaXMgRGVwZW5kZW5jeSBpcyBkZXBlbmRlbnQgdXBvbgorICAgICAgICBwdWJsaWMgTm9kZSBub2RlOworCisgICAgICAgIC8vIFRoZSBuYXR1cmUgb2YgdGhlIGRlcGVuZGVuY3kgKFdJVEggb3IgQUZURVIpCisgICAgICAgIHB1YmxpYyBpbnQgcnVsZTsKKworICAgICAgICBwdWJsaWMgRGVwZW5kZW5jeShOb2RlIG5vZGUsIGludCByd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ycmF5TGlzdDxOb2RlPigpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZGVwZW5kZW5jaWVzLmFkZChkZXBlbmRlbmN5KTsKKyAgICAgICAgICAgIGlmICghbm9kZURlcGVuZGVuY2llcy5jb250YWlucyhkZXBlbmRlbmN5Lm5vZGUpKSB7CisgICAgICAgICAgICAgICAgbm9kZURlcGVuZGVuY2llcy5hZGQoZGVwZW5kZW5jeS5ub2RlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIE5vZGUgZGVwZW5kZW5jeU5vZGUgPSBkZXBlbmRlbmN5Lm5vZGU7CisgICAgICAgICAgICBpZiAoZGVwZW5kZW5jeU5vZGUubm9kZURlcGVuZGVudHMgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGRlcGVuZGVuY3lOb2RlLm5vZGVEZXBlbmRlbnRzID0gbmV3IEFycmF5TGlzdDxOb2RlPigpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZGVwZW5kZW5jeU5vZGUubm9kZURlcGVuZGVudHMuYWRkKHRoaXMpOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBOb2RlIGNsb25lKCkgeworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICBOb2RlIG5vZGUgPSAoTm9kZSkgc3VwZXIuY2xvbmUoKTsKKyAgICAgICAgICAgICAgICBub2RlLmFuaW1hdGlvbiA9IChBbmltYXRhYmxlKSBhbmltYXRpb24uY2xvbmUoKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gbm9kZTsKKyAgICAgICAgICAgIH0gY2F0Y2ggKENsb25lTm90U3VwcG9ydGVkRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgIHRocm93IG5ldyBBc3NlcnRpb25FcnJvcigpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogVGhlIDxjb2RlPkJ1aWxkZXI8L2NvZGU+IG9iamVjd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vIHRoZSBjb25zdHJ1Y3RvciBvZiBCdWlsZGVyLgorICAgICAgICAgKi8KKyAgICAgICAgcHJpdmF0ZSBOb2RlIG1DdXJyZW50Tm9kZTsKKworICAgICAgICAvKioKKyAgICAgICAgICogcGFja2FnZS1wcml2YXRlIGNvbnN0cnVjdG9yLiBCdWlsZGVycyBhcmUgb25seSBjb25zdHJ1Y3RlZCBieSBTZXF1ZW5jZXIsIHdoZW4gdGhlCisgICAgICAgICAqIHBsYXkoKSBtZXRob2QgaXMgY2FsbGVkLgorICAgICAgICAgKgorICAgICAgICAgKiBAcGFyYW0gYW5pbSBUaGUgYW5pbWF0aW9uIHRoYXQgaXMgdGhlIGRlcGVuZGVuY3kgZm9yIHRoZSBvdGhlciBhbmltYXRpb25zIHBhc3NlZCBpbnRvCisgICAgICAgICAqIHRoZSBvdGhlciBtZXRob2RzIG9mIHRoaXMgQnVpbGRlciBvYmplY3QuCisgICAgICAgICAqLworICAgICAgICBCdWlsZGVyKEFuaW1hdGFibGUgYW5pbSkgeworICAgICAgICAgICAgbUN1cnJlbnROb2RlID0gbU5vZGVNYXAuZ2V0KGFuaW0pOworICAgICAgICAgICAgaWYgKG1DdXJyZW50Tm9kZSA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgbUN1cnJlbnROb2RlID0gbmV3IE5vZGUoYW5pbSk7CisgICAgICAgICAgICAgICAgbU5vZGVNYXAucHV0KGFuaW0sIG1DdXJyZW50Tm9kZSk7CisgICAgICAgICAgICAgICAgbU5vZGVzLmFkZChtQ3VycmVudE5vZGUpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFNldHMgdXAgdGhlIGdpdmVuIGFuaW1hdGlvbiB0byBwbGF5IGF0IHRoZSBzYW1lIHRpbWUgYXMgdGhlIGFuaW1hdGlvbiBzdXBwbGllZCBpbiB0aGUKKyAgICAgICAgICoge0BsaW5rIFNlcXVlbmNlciNwbGF5KEFuaW1hdGFibGUpfSBjYWxsIHRoYXQgY3JlYXRlZCB0aGlzIDxjb2RlPkJ1aWxkZXI8L2NvZGU+IG9iamVjdC4KKyAgICAgICAgICoKKyAgICAgICAgICogQHBhcmFtIGFuaW0gVGhlIGFuaW1hdGlvbiB0aGF0IHdpbGwgcGxheSB3aGVuIHRoZSBhbmltYXRpb24gc3VwcGxpZWQgdG8gdGhlCisgICAgICAgICAqIHtAbGluayBTZXF1ZW5jZXIjcGxheShBbmltYXRhYmxlKX0gbWV0aG9kIHN0YXJ0cy4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyB2b2lkIHdpdGgoQW5pbWF0YWJsZSBhbmltKSB7CisgICAgICAgICAgICBOb2RlIG5vZGUgPSBtTm9kZU1hcC5nZXQoYW5pbSk7CisgICAgICAgICAgICBpZiAobm9kZSA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgbm9kZSA9IG5ldyBOb2RlKGFuaW0pOworICAgICAgICAgICAgICAgIG1Ob2RlTWFwLnB1dChhbmltLCBub2RlKTsKKyAgICAgICAgICAgICAgICBtTm9kZXMuYWRkKG5vZGUpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgRGVwZW5kZW5jeSBkZXBlbmRlbmN5ID0gbmV3IERlcGVuZGVuY3kobUN1cnJlbnROb2RlLCBEZXBlbmRlbmN5LldJVEgpOworICAgICAgICAgICAgbm9kZS5hZGREZXBlbmRlbmN5KGRlcGVuZGVuY3kpOworICAgICAgICB9CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFNldHMgdXAgdGhlIGdpdmVuIGFuaW1hdGlvbiB0byBwbGF5IHdoZW4gdGhlIGFuaW1hdGlvbiBzdXBwbGllZCBpbiB0aGUKKyAgICAgICAgICoge0BsaW5rIFNlcXVlbmNlciNwbGF5KEFuaW1hdGFibGUpfSBjYWxsIHRoYXQgY3JlYXRlZCB0aGlzIDxjb2RlPkJ1aWxkZXI8L2NvZGU+IG9iamVjdAorICAgICAgICAgKiBlbmRzLgorICAgICAgICAgKgorICAgICAgICAgKiBAcGFyYW0gYW5pbSBUaGUgYW5pbWF0aW9uIHRoYXQgd2lsbCBwbGF5IHdoZW4gdGhlIGFuaW1hdGlvbiBzdXBwbGllZCB0byB0aGUKKyAgICAgICAgICoge0BsaW5rIFNlcXVlbmNlciNwbGF5KEFuaW1hdGFibGUpfSBtZXRob2QgZW5kcy4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyB2b2lkIGJlZm9yZShBbmltYXRhYmxlIGFuaW0pIHsKKyAgICAgICAgICAgIE5vZGUgbm9kZSA9IG1Ob2RlTWFwLmdldChhbmltKTsKKyAgICAgICAgICAgIGlmIChub2RlID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICBub2RlID0gbmV3IE5vZGUoYW5pbSk7CisgICAgICAgICAgICAgICAgbU5vZGVNYXAucHV0KGFuaW0sIG5vZGUpOworICAgICAgICAgICAgICAgIG1Ob2Rlcy5hZGQobm9kZSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBEZXBlbmRlbmN5IGRlcGVuZGVuY3kgPSBuZXcgRGVwZW5kZW5jeShtQ3VycmVudE5vZGUsIERlcGVuZGVuY3kuQUZURVIpOworICAgICAgICAgICAgbm9kZS5hZGREZXBlbmRlbmN5KGRlcGVuZGVuY3kpOworICAgICAgICB9CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFNldHMgdXAgdGhlIGdpdmVuIGFuaW1hdGlvbiB0byBwbGF5IHdoZW4gdGhlIGFuaW1hdGlvbiBzdXBwbGllZCBpbiB0aGUKKyAgICAgICAgICoge0BsaW5rIFNlcXVlbmNlciNwbGF5KEFuaW1hdGFibGUpfSBjYWxsIHRoYXQgY3JlYXRlZCB0aGlzIDxjb2RlPkJ1aWxkZXI8L2NvZGU+IG9iamVjdAorICAgICAgICAgKiB0byBzdGFydCB3aGVuIHRoZSBhbmltYXRpb24gc3VwcGxpZWQgaW4gdGhpcyBtZXRob2QgY2FsbCBlbmRzLgorICAgICAgICAgKgorICAgICAgICAgKiBAcGFyYW0gYW5pbSBUaGUgYW5pbWF0aW9uIHdob3NlIGVuZCB3aWxsIGNhdXNlIHRoZSBhbmltYXRpb24gc3VwcGxpZWQgdG8gdGhlCisgICAgICAgICAqIHtAbGluayBTZXF1ZW5jZXIjcGxheShBbmltYXRhYmxlKX0gbWV0aG9kIHRvIHBsYXkuCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgdm9pZCBhZnRlcihBbmltYXRhYmxlIGFuaW0pIHsKKyAgICAgICAgICAgIE5vZGUgbm9kZSA9IG1Ob2RlTWFwLmdldChhbmltKTsKKyAgICAgICAgICAgIGlmIChub2RlID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICBub2RlID0gbmV3IE5vZGUoYW5pbSk7CisgICAgICAgICAgICAgICAgbU5vZGVNYXAucHV0KGFuaW0sIG5vZGUpOworICAgICAgICAgICAgICAgIG1Ob2Rlcy5hZGQobm9kZSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBEZXBlbmRlbmN5IGRlcGVuZGVuY3kgPSBuZXcgRGVwZW5kZW5jeShub2RlLCBEZXBlbmRlbmN5LkFGVEVSKTsKKyAgICAgICAgICAgIG1DdXJyZW50Tm9kZS5hZGREZXBlbmRlbmN5KGRlcGVuZGVuY3kpOworICAgICAgICB9CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFNldHMgdXAgdGhlIGFuaW1hdGlvbiBzdXBwbGllZCBpbiB0aGUKKyAgICAgICAgICoge0BsaW5rIFNlcXVlbmNlciNwbGF5KEFuaW1hdGFibGUpfSBjYWxsIHRoYXQgY3JlYXRlZCB0aGlzIDxjb2RlPkJ1aWxkZXI8L2NvZGU+IG9iamVjdAorICAgICAgICAgKiB0byBwbGF5IHdoZW4gdGhlIGdpdmVuIGFtb3VudCBvZiB0aW1lIGVsYXBzZXMuCisgICAgICAgICAqCisgICAgICAgICAqIEBwYXJhbSBkZWxheSBUaGUgbnVtYmVyIG9mIG1pbGxpc2Vjb25kcyB0aGF0IHNob3Vs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aXNwbGF5IG9wdGlvbiBiaXRzIGF0IG9uY2UsIHNlZSB7QGxpbmsgI3NldERpc3BsYXlPcHRpb25zKGludCl9LgorICAgICAqIAorICAgICAqIDxwPkV4YW1wbGU6IHNldERpc3BsYXlPcHRpb25zKDAsIERJU1BMQVlfSElERV9IT01FKSB3aWxsIGRpc2FibGUgdGhlCisgICAgICoge0BsaW5rICNESVNQTEFZX0hJREVfSE9NRX0gb3B0aW9uLgorICAgICAqIHNldERpc3BsYXlPcHRpb25zKERJU1BMQVlfSElERV9IT01FLCBESVNQTEFZX0hJREVfSE9NRSB8IERJU1BMQVlfVVNFX0xPR08pCisgICAgICogd2lsbCBlbmFibGUge0BsaW5rICNESVNQTEFZX0hJREVfSE9NRX0gYW5kIGRpc2FibGUge0BsaW5rICNESVNQTEFZX1VTRV9MT0dPfS4KKyAgICAgKiAKKyAgICAgKiBAcGFyYW0gb3B0aW9ucyBBIGNvbWJpbmF0aW9uIG9mIHRoZSBiaXRzIGRlZmluZWQgYnkgdGhlIERJU1BMQVlfIGNvbnN0YW50cworICAgICAqICAgICAgICAgICAgICAgIGRlZmluZWQgaW4gQWN0aW9uQmFyLgorICAgICAqIEBwYXJhbSBtYXNrIEEgYml0IG1hc2sgZGVjbGFyaW5nIHdoaWNoIGRpc3BsYXkgb3B0aW9ucyBzaG91bGQgYmUgY2hhbmdlZC4KKyAgICAgKi8KKyAgICBwdWJsaWMgYWJzdHJhY3Qgdm9pZCBzZXREaXNwbGF5T3B0aW9ucyhpbnQgb3B0aW9ucywgaW50IG1hc2spOworICAgIAorICAgIC8qKgorICAgICAqIFNldCB0aGUgQWN0aW9uQmFyJ3MgYmFja2dyb3VuZC4KKyAgICAgKiAKKyAgICAgKiBAcGFyYW0gZCBCYWNrZ3JvdW5kIGRyYXdhYmxlCisgICAgICovCisgICAgcHVibGljIGFic3RyYWN0IHZvaWQgc2V0QmFja2dyb3VuZERyYXdhYmxlKERyYXdhYmxlIGQpOworICAgIAorICAgIC8qKgorICA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iKFRhYikKKyAgICAgKiBAc2VlICNpbnNlcnRUYWIoVGFiLCBpbnQpCisgICAgICogQHNlZSAjcmVtb3ZlVGFiKFRhYikKKyAgICAgKiBAc2VlICNyZW1vdmVUYWJBdChpbnQpCisgICAgICovCisgICAgcHVibGljIGFic3RyYWN0IHZvaWQgc2V0VGFiTmF2aWdhdGlvbk1vZGUoKTsKKworICAgIC8qKgorICAgICAqIFNldCB0aGUgYWN0aW9uIGJhciBpbnRvIHRhYmJlZCBuYXZpZ2F0aW9uIG1vZGUuCisgICAgICoKKyAgICAgKiBAcGFyYW0gY29udGFpbmVyVmlld0lkIElkIG9mIHRoZSBjb250YWluZXIgdmlldyB3aGVyZSB0YWIgY29udGVudCBmcmFnbWVudHMgc2hvdWxkIGFwcGVhci4KKyAgICAgKgorICAgICAqIEBzZWUgI2FkZFRhYihUYWIpCisgICAgICogQHNlZSAjaW5zZXJ0VGFiKFRhYiwgaW50KQorICAgICAqIEBzZWUgI3JlbW92ZVRhYihUYWIpCisgICAgICogQHNlZSAjcmVtb3ZlVGFiQXQoaW50KQorICAgICAqLworICAgIHB1YmxpYyBhYnN0cmFjdCB2b2lkIHNldFRhYk5hdmlnYXRpb25Nb2RlKGludCBjb250YWluZXJWaWV3SWQpOworCisgICAgLyoqCisgICAgICogQ3JlYXRlIGFuZCByZXR1cm4gYSBuZXcge0BsaW5rIFRhYn0uCisgICAgICogVGhpcyB0YWIgd2lsbCBub3QgYmUgaW5jbHVkZWQgaW4gdGhlIGFjdGlvbiBiYXIgdW50aWwgaXQgaXMgYWRkZWQuCisgICAgICoKKyAgICAgKiBAcmV0dXJuIEEgbmV3IFRhYgorICAgICAqCisgICAgICogQHNlZSAjYWRkVGFiKFRhYikKKyAgICAgKiBAc2VlICNpbnNlcnRUYWIoVGFiLCBpbnQpCisgICAgICovCisgICAgcHVibGljIGFic3RyYWN0IFRhYiBuZXdUYWIoKTsKKworICAgIC8qKgorICAgICAqIEFkZCBhIHRhYiBmb3IgdXNlIGlu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9uCisgICAgICogY29udGVudCB0byBmaXQgdGhlIG5ldyBzcGFjZSBhdmFpbGFibGUuCisgICAgICovCisgICAgcHVibGljIGFic3RyYWN0IHZvaWQgaGlkZSgpOworCisgICAgLyoqCisgICAgICogQHJldHVybiA8Y29kZT50cnVlPC9jb2RlPiBpZiB0aGUgQWN0aW9uQmFyIGlzIHNob3dpbmcsIDxjb2RlPmZhbHNlPC9jb2RlPiBvdGhlcndpc2UuCisgICAgICovCisgICAgcHVibGljIGFic3RyYWN0IGJvb2xlYW4gaXNTaG93aW5nKCk7CisKKyAgICAvKioKKyAgICAgKiBDYWxsYmFjayBpbnRlcmZhY2UgZm9yIEFjdGlvbkJhciBuYXZpZ2F0aW9uIGV2ZW50cy4gCisgICAgICovCisgICAgcHVibGljIGludGVyZmFjZSBOYXZpZ2F0aW9uQ2FsbGJhY2sgeworICAgICAgICAvKioKKyAgICAgICAgICogVGhpcyBtZXRob2QgaXMgY2FsbGVkIHdoZW5ldmVyIGEgbmF2aWdhdGlvbiBpdGVtIGluIHlvdXIgYWN0aW9uIGJhcgorICAgICAgICAgKiBpcyBzZWxlY3RlZC4KKyAgICAgICAgICogICAgCisgICAgICAgICAqIEBwYXJhbSBpdGVtUG9zaXRpb24gUG9zaXRpb24gb2YgdGhlIGl0ZW0gY2xpY2tlZC4KKyAgICAgICAgICogQHBhcmFtIGl0ZW1JZCBJRCBvZiB0aGUgaXRlbSBjbGlja2VkLgorICAgICAgICAgKiBAcmV0dXJuIFRydWUgaWYgdGhlIGV2ZW50IHdhcyBoYW5kbGVkLCBmYWxzZSBvdGhlcndpc2UuCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgYm9vbGVhbiBvbk5hdmlnYXRpb25JdGVtU2VsZWN0ZWQoaW50IGl0ZW1Qb3NpdGlvbiwgbG9uZyBpdGVtSWQpOworICAgIH0KKworICAgIC8qKgorICAgICAqIEEgdGFiIGluIHRoZSBhY3Rpb24gYmFyLgorICAgICAqCisgICAgICogPHA+VGFicyBtYW5hZ2UgdGhlIGhpZGluZyBhbmQgc2hvd2luZyBvZiB7QGxpbmsgRnJhZ21lbnR9cy4KKyAgICAgKi8KKyAgICBwdWJsaWMgc3RhdGljIGFic3RyYWN0IGNsYXNzIFRhYiB7CisgICAgICAgIC8qKgorICAgICAgICAgKiBBbiBpbnZhbGlkIHBvc2l0aW9uIGZvciBhIHRhYi4KKyAgICAgICAgICoKKyAgICAgICAgICogQHNlZSAjZ2V0UG9zaXRpb24oKQorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBpbnQgSU5WQUxJRF9QT1NJVElPTiA9IC0xOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBSZXR1cm4gdGhlIGN1cnJlbnQgcG9zaXRpb24gb2YgdGhpcyB0YWIgaW4gdGhlIGFjdGlvbiBiYXIuCisgICAgICAgICAqCisgICAgICAgICAqIEByZXR1cm4gQ3VycmVudCBwb3NpdGlvbiwgb3Ige0BsaW5rICNJTlZBTElEX1BPU0lUSU9OfSBpZiB0aGlzIHRhYiBpcyBub3QgY3VycmVudGx5IGluCisgICAgICAgICAqICAgICAgICAgdGhlIGFjdGlvbiBiYXIuCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgYWJzdHJhY3QgaW50IGdldFBvc2l0aW9uKCk7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFJldHVybiB0aGUgaWNvbiBhc3NvY2lhdGVkIHdpdGggdGhpcyB0YWIuCisgICAgICAgICAqCisgICAgICAgICAqIEByZXR1cm4gVGhlIHRhYidzIGljb24KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBhYnN0cmFjdCBEcmF3YWJsZSBnZXRJY29uKCk7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFJldHVybiB0aGUgdGV4dCBvZiB0aGlzIHRhYi4KKyAgICAgICAgICoKKyAgICAgICAgICogQHJldHVybiBUaGUgdGFiJ3MgdGV4dAorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIGFic3RyYWN0IENoYXJTZXF1ZW5jZSBnZXRUZXh0KCk7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFNldCB0aGUgaWNvbiBkaXNwbGF5ZWQgb24gdGhpcyB0YWIuCisgICAgICAgICAqCisgICAgICAgICAqIEBwYXJhbSBpY29uIFRoZSBkcmF3YWJsZSB0byB1c2UgYXMgYW4gaWNvbgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIGFic3RyYWN0IHZvaWQgc2V0SWNvbihEcmF3YWJsZSBpY29uKTsKKworICAgICAgICAvKioKKyAgICAgICAgICogU2V0IHRoZSB0ZXh0IGRpc3BsYXllZCBvbiB0aGlzIHRhYi4gVGV4dCBtYXkgYmUgdHJ1bmNhdGVkIGlmIHRoZXJlIGlzIG5vdAorICAgICAgICAgKiByb29tIHRvIGRpc3BsYXkgdGhlIGVudGlyZSBzdHJpbmcuCisgICAgICAgICAqCisgICAgICAgICAqIEBwYXJhbSB0ZXh0IFRoZSB0ZXh0IHRvIGRpc3BsYXkKKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBhYnN0cmFjdCB2b2lkIHNldFRleHQoQ2hhclNlcXVlbmNlIHRleHQpOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBSZXR1cm5zIHRoZSBmcmFnbWVudCB0aGF0IHdpbGwgYmUgc2hvd24gd2hlbiB0aGlzIHRhYiBpcyBzZWxlY3RlZC4KKyAgICAgICAgICoKKyAgICAgICAgICogQHJldHVybiBGcmFnbWVudCBhc3NvY2lhdGVkIHdpdGggdGhpcyB0YWIKKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBhYnN0cmFjdCBGcmFnbWVudCBnZXRGcmFnbWVudCgpOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBTZXQgdGhlIGZyYWdtZW50IHRoYXQgd2lsbCBiZSBzaG93biB3aGVuIHRoaXMgdGFiIGlzIHNlbGVjdGVkLgorICAgICAgICAgKgorICAgICAgICAgKiBAcGFyYW0gZnJ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gICAgIGlmIChtQWxsTG9hZGVyTWFuYWdlcnMgIT0gbnVsbCkgeworICAgICAgICAgICAgLy8gcHJ1bmUgb3V0IGFueSBsb2FkZXIgbWFuYWdlcnMgdGhhdCB3ZXJlIGFscmVhZHkgc3RvcHBlZCBhbmQgc28KKyAgICAgICAgICAgIC8vIGhhdmUgbm90aGluZyB1c2VmdWwgdG8gcmV0YWluLgorICAgICAgICAgICAgZm9yIChpbnQgaT1tQWxsTG9hZGVyTWFuYWdlcnMuc2l6ZSgpLTE7IGk+PTA7IGktLSkgeworICAgICAgICAgICAgICAgIExvYWRlck1hbmFnZXJJbXBsIGxtID0gbUFsbExvYWRlck1hbmFnZXJzLnZhbHVlQXQoaSk7CisgICAgICAgICAgICAgICAgaWYgKGxtLm1SZXRhaW5pbmcpIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0YWluTG9hZGVycyA9IHRydWU7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgbG0uZG9EZXN0cm95KCk7CisgICAgICAgICAgICAgICAgICAgIG1BbGxMb2FkZXJNYW5hZ2Vycy5yZW1vdmVBdChpKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgaWYgKGFjdGl2aXR5ID09IG51bGwgJiYgY2hpbGRyZW4gPT0gbnVsbCAmJiBmcmFnbWVudHMgPT0gbnVsbCAmJiAhcmV0YWluTG9hZGVycykgeworICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIE5vbkNvbmZpZ3VyYXRpb25JbnN0YW5jZXMgbmNpID0gbmV3IE5vbkNvbmZpZ3VyYXRpb25JbnN0YW5jZXMoKTsKKyAgICAgICAgbmNpLmFjdGl2aXR5ID0gYWN0aXZpdHk7CisgICAgICAgIG5jaS5jaGlsZHJlbiA9IGNoaWxkcmVuOworICAgICAgICBuY2kuZnJhZ21lbnRzID0gZnJhZ21lbnRzOworICAgICAgICBuY2kubG9hZGVycyA9IG1BbGxMb2FkZXJNYW5hZ2VyczsKKyAgICAgICAgcmV0dXJuIG5jaTsKKyAgICB9CisgICAgCiAgICAgcHVibGljIHZvaWQgb25Mb3dNZW1vcnkoKSB7CiAgICAgICAgIG1DYWxsZWQgPSB0cnVlOwogICAgIH0KICAgICAKICAgICAvKioKKyAgICAgKiBSZXR1cm4gdGhlIEZyYWdtZW50TWFuYWdlciBmb3IgaW50ZXJhY3Rpbmcgd2l0aCBmcmFnbWVudHMgYXNzb2NpYXRlZAorICAgICAqIHdpdGggdGhpcyBhY3Rpdml0eS4KKyAgICAgKi8KKyAgICBwdWJsaWMgRnJhZ21lbnRNYW5hZ2VyIGdldEZyYWdtZW50TWFuYWdlcigpIHsKKyAgICAgICAgcmV0dXJuIG1GcmFnbWVudHM7CisgICAgfQorCisgICAgLyoqCisgICAgICogU3RhcnQgYSBzZXJpZXMgb2YgZWRpdCBvcGVyYXRpb25zIG9uIHRoZSBGcmFnbWVudHMgYXNzb2NpYXRlZCB3aXRoCisgICAgICogdGhpcyBhY3Rpdml0eS4KKyAgICAgKiBAZGVwcmVjYXRlZCB1c2Uge0BsaW5rICNnZXRGcmFnbWVudE1hbmFnZXJ9LgorICAgICAqLworICAgIEBEZXByZWNhdGVkCisgICAgcHVibGljIEZyYWdtZW50VHJhbnNhY3Rpb24gb3BlbkZyYWdtZW50VHJhbnNhY3Rpb24oKSB7CisgICAgICAgIHJldHVybiBtRnJhZ21lbnRzLm9wZW5UcmFuc2FjdGlvbigpOworICAgIH0KKyAgICAKKyAgICB2b2lkIGludmFsaWRhdGVGcmFnbWVudEluZGV4KGludCBpbmRleCkgeworICAgICAgICAvL0xvZy52KFRBRywgImludmFsaWRhdGVGcmFnbWVudEluZGV4OiBpbmRleD0iICsgaW5kZXgpOworICAgICAgICBpZiAobUFsbExvYWRlck1hbmFnZXJzICE9IG51bGwpIHsKKyAgICAgICAgICAgIExvYWRlck1hbmFnZXJJbXBsIGxtID0gbUFsbExvYWRlck1hbmFnZXJzLmdldChpbmRleCk7CisgICAgICAgICAgICBpZiAobG0gIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGxtLmRvRGVzdHJveSgpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbUFsbExvYWRlck1hbmFnZXJzLnJlbW92ZShpbmRleCk7CisgICAgICAgIH0KKyAgICB9CisgICAgCisgICAgLyoqCisgICAgICogQ2FsbGVkIHdoZW4gYSBGcmFnbWVudCBpcyBiZWluZyBhdHRhY2hlZCB0byB0aGlzIGFjdGl2aXR5LCBpbW1lZGlhdGVseQorICAgICAqIGFmdGVyIHRoZSBjYWxsIHRvIGl0cyB7QGxpbmsgRnJhZ21lbnQjb25BdHRhY2ggRnJhZ21lbnQub25BdHRhY2goKX0KKyAgICAgKiBtZXRob2QgYW5kIGJlZm9yZSB7QGxpbmsgRnJhZ21lbnQjb25DcmVhdGUgRnJhZ21lbnQub25DcmVhdGUoKX0uCisgICAgICovCisgICAgcHVibGljIHZvaWQgb25BdHRhY2hGcmFnbWVudChGcmFnbWVudCBmcmFnbWVudCkgeworICAgIH0KKyAgICAKKyAgICAvKioKICAgICAgKiBXcmFwcGVyIGFyb3VuZAogICAgICAqIHtAbGluayBDb250ZW50UmVzb2x2ZXIjcXVlcnkoYW5kcm9pZC5uZXQuVXJpICwgU3RyaW5nW10sIFN0cmluZywgU3RyaW5nW10sIFN0cmluZyl9CiAgICAgICogdGhhdCBnaXZlcyB0aGUgcmVzdWx0aW5nIHtAbGluayBDdXJzb3J9IHRvIGNhbGwKICAgICAgKiB7QGxpbmsgI3N0YXJ0TWFuYWdpbmdDdXJzb3J9IHNvIHRoYXQgdGhlIGFjdGl2aXR5IHdpbGwgbWFuYWdlIGl0cwogICAgICAqIGxpZmVjeWNsZSBmb3IgeW91LgogICAgICAqIAorICAgICAqIDxlbT5JZiB5b3UgYXJlIHRhcmdldGluZyB7QGxpbmsgYW5kcm9pZC5vcy5CdWlsZC5WRVJ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dLCBTdHJpbmcsIFN0cmluZ1tdLCBTdHJpbmcpCiAgICAgICogQHNlZSAjc3RhcnRNYW5hZ2luZ0N1cnNvcgorICAgICAqCisgICAgICogQGRlcHJlY2F0ZWQgVXNlIHtAbGluayBDdXJzb3JMb2FkZXJ9IGluc3RlYWQuCiAgICAgICovCi0gICAgcHVibGljIGZpbmFsIEN1cnNvciBtYW5hZ2VkUXVlcnkoVXJpIHVyaSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTdHJpbmdbXSBwcm9qZWN0aW9uLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFN0cmluZyBzZWxlY3Rpb24sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU3RyaW5nW10gc2VsZWN0aW9uQXJncywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTdHJpbmcgc29ydE9yZGVyKQotICAgIHsKKyAgICBARGVwcmVjYXRlZAorICAgIHB1YmxpYyBmaW5hbCBDdXJzb3IgbWFuYWdlZFF1ZXJ5KFVyaSB1cmksIFN0cmluZ1tdIHByb2plY3Rpb24sIFN0cmluZyBzZWxlY3Rpb24sCisgICAgICAgICAgICBTdHJpbmdbXSBzZWxlY3Rpb25BcmdzLCBTdHJpbmcgc29ydE9yZGVyKSB7CiAgICAgICAgIEN1cnNvciBjID0gZ2V0Q29udGVudFJlc29sdmVyKCkucXVlcnkodXJpLCBwcm9qZWN0aW9uLCBzZWxlY3Rpb24sIHNlbGVjdGlvbkFyZ3MsIHNvcnRPcmRlcik7CiAgICAgICAgIGlmIChjICE9IG51bGwpIHsKICAgICAgICAgICAgIHN0YXJ0TWFuYWdpbmdDdXJzb3IoYyk7CkBAIC0xNTQ1LDQwICsxNjgxLDYgQEAKICAgICB9CiAKICAgICAvKioKLSAgICAgKiBXcmFwcGVyIGFyb3VuZCB7QGxpbmsgQ3Vyc29yI2NvbW1pdFVwZGF0ZXMoKX0gdGhhdCB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QgYXJlIGN1cnJlbnRseSBhZGRlZCB0byB0aGUgYWN0aXZpdHkncyBjb250ZW50LgorICAgICAqIEByZXR1cm4gVGhlIGZyYWdtZW50IGlmIGZvdW5kIG9yIG51bGwgb3RoZXJ3aXNlLgorICAgICAqIEBkZXByZWNhdGVkIHVzZSB7QGxpbmsgI2dldEZyYWdtZW50TWFuYWdlcn0uCisgICAgICovCisgICAgQERlcHJlY2F0ZWQKKyAgICBwdWJsaWMgRnJhZ21lbnQgZmluZEZyYWdtZW50QnlUYWcoU3RyaW5nIHRhZykgeworICAgICAgICByZXR1cm4gbUZyYWdtZW50cy5maW5kRnJhZ21lbnRCeVRhZyh0YWcpOworICAgIH0KKyAgICAKICAgICAvKioKICAgICAgKiBTZXQgdGhlIGFjdGl2aXR5IGNvbnRlbnQgZnJvbSBhIGxheW91dCByZXNvdXJjZS4gIFRoZSByZXNvdXJjZSB3aWxsIGJlCiAgICAgICogaW5mbGF0ZWQsIGFkZGluZyBhbGwgdG9wLWxldmVsIHZpZXdzIHRvIHRoZSBhY3Rpdml0eS4KQEAgLTE2NjksNiArMTgyOCw3IEBACiAgICAgICovCiAgICAgcHVibGljIHZvaWQgc2V0Q29udGVudFZpZXcoaW50IGxheW91dFJlc0lEKSB7CiAgICAgICAgIGdldFdpbmRvdygpLnNldENvbnRlbnRWaWV3KGxheW91dFJlc0lEKTsKKyAgICAgICAgaW5pdEFjdGlvbkJhcigpOwogICAgIH0KIAogICAgIC8qKgpAQCAtMTY4MCw2ICsxODQwLDcgQEAKICAgICAgKi8KICAgICBwdWJsaWMgdm9pZCBzZXRDb250ZW50VmlldyhWaWV3IHZpZXcpIHsKICAgICAgICAgZ2V0V2luZG93KCkuc2V0Q29udGVudFZpZXcodmlldyk7CisgICAgICAgIGluaXRBY3Rpb25CYXIoKTsKICAgICB9CiAKICAgICAvKioKQEAgLTE2OTIsNiArMTg1Myw3IEBACiAgICAgICovCiAgICAgcHVibGljIHZvaWQgc2V0Q29udGVudFZpZXcoV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vdzsKICAgICAgICAgfQogICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgfQpAQCAtMjE4Niw2ICsyNDA0LDcgQEAKICAgICBwdWJsaWMgYm9vbGVhbiBvblByZXBhcmVQYW5lbChpbnQgZmVhdHVyZUlkLCBWaWV3IHZpZXcsIE1lbnUgbWVudSkgewogICAgICAgICBpZiAoZmVhdHVyZUlkID09IFdpbmRvdy5GRUFUVVJFX09QVElPTlNfUEFORUwgJiYgbWVudSAhPSBudWxsKSB7CiAgICAgICAgICAgICBib29sZWFuIGdvZm9yaXQgPSBvblByZXBhcmVPcHRpb25zTWVudShtZW51KTsKKyAgICAgICAgICAgIGdvZm9yaXQgfD0gbUZyYWdtZW50cy5kaXNwYXRjaFByZXBhcmVPcHRpb25zTWVudShtZW51KTsKICAgICAgICAgICAgIHJldHVybiBnb2Zvcml0ICYmIG1lbnUuaGFzVmlzaWJsZUl0ZW1zKCk7CiAgICAgICAgIH0KICAgICAgICAgcmV0dXJuIHRydWU7CkBAIC0yMjE2LDExICsyNDM1LDE3IEBACiAgICAgICAgICAgICAgICAgLy8gZG9lc24ndCBjYWxsIHRocm91Z2ggdG8gc3VwZXJjbGFzcydzIGltcGxtZWVudGF0aW9uIG9mIGVhY2gKICAgICAgICAgICAgICAgICAvLyBvZiB0aGVzZSBtZXRob2RzIGJlbG93CiAgICAgICAgICAgICAgICAgRXZlbnRMb2cud3JpdGVFdmVudCg1MDAwMCwgMCwgaXRlbS5nZXRUaXRsZUNvbmRlbnNlZCgpKTsKLSAgICAgICAgICAgICAgICByZXR1cm4gb25PcHRpb25zSXRlbVNlbGVjdGVkKGl0ZW0pOworICAgICAgICAgICAgICAgIGlmIChvbk9wdGlvbnNJdGVtU2VsZWN0ZWQoaXRlbSkpIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHJldHVybiBtRnJhZ21lbnRzLmRpc3BhdGNoT3B0aW9uc0l0ZW1TZWxlY3RlZChpdGVtKTsKICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgIGNhc2UgV2luZG93LkZFQVRVUkVfQ09OVEVYVF9NRU5VOgogICAgICAgICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoNTAwMDAsIDEsIGl0ZW0uZ2V0VGl0bGVDb25kZW5zZWQoKSk7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIG9uQ29udGV4dEl0ZW1TZWxlY3RlZChpdGVtKTsKKyAgICAgICAgICAgICAgICBpZiAob25Db250ZXh0SXRlbVNlbGVjdGVkKGl0ZW0pKSB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICByZXR1cm4gbUZyYWdtZW50cy5kaXNwYXRjaENvbnRleHRJdGVtU2VsZWN0ZWQoaXRlbSk7CiAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKQEAgLTIyMzksNiArMjQ2NCw3IEBACiAgICAgcHVibGljIHZvaWQgb25QYW5lbENsb3NlZChpbnQgZmVhdHVyZUlkLCBNZW51IG1lbnUpIHsKICAgICAgICAgc3dpdGNoIChmZWF0dXJlSWQpIHsKICAgICAgICAgICAgIGNhc2UgV2luZG93LkZFQVRVUkVfT1BUSU9OU19QQU5FTDoKKyAgICAgICAgICAgICAgICBtRnJhZ21lbnRzLmRpc3BhdGNoT3B0aW9uc01lbnVDbG9zZWQobWVudSk7CiAgICAgICAgICAgICAgICAgb25PcHRpb25zTWVudUNsb3NlZChtZW51KTsKICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAKQEAgLTIyNDksNiArMjQ3NSwxNSBAQAogICAgIH0KIAogICAgIC8qKgorICAgICAqIERlY2xhcmUgdGhhdCB0aGUgb3B0aW9ucyBtZW51IGhhcyBjaGFuZ2VkLCBzbyBzaG91bGQgYm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blRocmVhZCgpLCBtVG9rZW4sIGZyYWdtZW50LAorICAgICAgICAgICAgICAgIGludGVudCwgcmVxdWVzdENvZGUpOworICAgICAgICBpZiAoYXIgIT0gbnVsbCkgeworICAgICAgICAgICAgbU1haW5UaHJlYWQuc2VuZEFjdGl2aXR5UmVzdWx0KAorICAgICAgICAgICAgICAgIG1Ub2tlbiwgZnJhZ21lbnQubVdobywgcmVxdWVzdENvZGUsCisgICAgICAgICAgICAgICAgYXIuZ2V0UmVzdWx0Q29kZSgpLCBhci5nZXRSZXN1bHREYXRhKCkpOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCiAgICAgICogTGlrZSB7QGxpbmsgI3N0YXJ0QWN0aXZpdHlGcm9tQ2hpbGQoQWN0aXZpdHksIEludGVudCwgaW50KX0sIGJ1dAogICAgICAqIHRha2luZyBhIEludGVudFNlbmRlcjsgc2VlCiAgICAgICoge0BsaW5rICNzdGFydEludGVudFNlbmRlckZvclJlc3VsdChJbnRlbnRTZW5kZXIsIGludCwgSW50ZW50LCBpbnQsIGludCwgaW50KX0KQEAgLTMyNDgsNiArMzUxOSwxOSBAQAogICAgIH0KIAogICAgIC8qKgorICAgICAqIENoZWNrIHRvIHNlZSB3aGV0aGVyIHRoaXMgYWN0aXZpdHkgaXMgaW4gdGhlIHByb2Nlc3Mgb2YgYmVpbmcgZGVzdHJveWVkIGluIG9yZGVyIHRvIGJlCisgICAgICogcmVjcmVhdGVkIHdpdGggYSBuZXcgY29uZmlndXJhdGlvbi4gVGhpcyBpcyBvZnRlbiB1c2VkIGluCisgICAgICoge0BsaW5rICNvblN0b3B9IHRvIGRldGVybWluZSB3aGV0aGVyIHRoZSBzdGF0ZSBuZWVkcyB0byBiZSBjbGVhbmVkIHVwIG9yIHdpbGwgYmUgcGFzc2VkCisgICAgICogb24gdG8gdGhlIG5leHQgaW5zdGFuY2Ugb2YgdGhlIGFjdGl2aXR5IHZpYSB7QGxpbmsgI29uUmV0YWluTm9uQ29uZmlndXJhdGlv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3IG9uZS4KKyAgICAgICAgRnJhZ21lbnQgZnJhZ21lbnQgPSBtRnJhZ21lbnRzLmZpbmRGcmFnbWVudEJ5SWQoaWQpOworICAgICAgICBpZiAoRnJhZ21lbnRNYW5hZ2VySW1wbC5ERUJVRykgTG9nLnYoVEFHLCAib25DcmVhdGVWaWV3OiBpZD0weCIKKyAgICAgICAgICAgICAgICArIEludGVnZXIudG9IZXhTdHJpbmcoaWQpICsgIiBmbmFtZT0iICsgZm5hbWUKKyAgICAgICAgICAgICAgICArICIgZXhpc3Rpbmc9IiArIGZyYWdtZW50KTsKKyAgICAgICAgaWYgKGZyYWdtZW50ID09IG51bGwpIHsKKyAgICAgICAgICAgIGZyYWdtZW50ID0gRnJhZ21lbnQuaW5zdGFudGlhdGUodGhpcywgZm5hbWUpOworICAgICAgICAgICAgZnJhZ21lbnQubUZyb21MYXlvdXQgPSB0cnVlOworICAgICAgICAgICAgZnJhZ21lbnQubUZyYWdtZW50SWQgPSBpZDsKKyAgICAgICAgICAgIGZyYWdtZW50Lm1UYWcgPSB0YWc7CisgICAgICAgICAgICBmcmFnbWVudC5tSW1tZWRpYXRlQWN0aXZpdHkgPSB0aGlzOworICAgICAgICAgICAgLy8gSWYgdGhpcyBmcmFnbWVudCBpcyBuZXdseSBpbnN0YW50aWF0ZWQgKGVpdGhlciByaWdodCBub3csIG9yCisgICAgICAgICAgICAvLyBmcm9tIGxhc3Qgc2F2ZWQgc3RhdGUpLCB0aGVuIGdpdmUgaXQgdGhlIGF0dHJpYnV0ZXMgdG8KKyAgICAgICAgICAgIC8vIGluaXRpYWxpemUgaXRzZWxmLgorICAgICAgICAgICAgaWYgKCFmcmFnbWVudC5tUmV0YWluaW5nKSB7CisgICAgICAgICAgICAgICAgZnJhZ21lbnQub25JbmZsYXRlKGF0dHJzLCBmcmFnbWVudC5tU2F2ZWRGcmFnbWVudFN0YXRlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1GcmFnbWVudHMuYWRkRnJhZ21lbnQoZnJhZ21lbnQsIHRydWUpOworICAgICAgICB9CisgICAgICAgIGlmIChmcmFnbWVudC5tVmlldyA9PSBudWxsKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJGcmFnbWVudCAiICsgZm5hbWUKKyAgICAgICAgICAgICAgICAgICAgKyAiIGRpZCBub3QgY3JlYXRlIGEgdmlldy4iKTsKKyAgICAgICAgfQorICAgICAgICBmcmFnbWVudC5tVmlldy5zZXRJZChpZCk7CisgICAgICAgIGlmIChmcmFnbWVudC5tVmlldy5nZXRUYWcoKSA9PSBudWxsKSB7CisgICAgICAgICAgICBmcmFnbWVudC5tVmlldy5zZXRUYWcodGFnKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gZnJhZ21lbnQubVZpZXc7CisgICAgfQorCisgICAgLyoqCisgICAgICogQml0IGluZGljYXRpbmcgdGhhdCB0aGlzIGFjdGl2aXR5IGlzICJpbW1lcnNpdmUiIGFuZCBzaG91bGQgbm90IGJlCisgICAgICogaW50ZXJydXB0ZWQgYnkgbm90aWZpY2F0aW9ucyBpZiBwb3NzaWJsZS4KKyAgICAgKgorICAgICAqIFRoaXMgdmFsdWUgaXMgaW5pdGlhbGx5IHNldCBieSB0aGUgbWFuaWZlc3QgcHJvcGVydHkKKyAgICAgKiA8Y29kZT5hbmRyb2lkOmltbWVyc2l2ZTwvY29kZT4gYnV0IG1heSBiZSBjaGFuZ2VkIGF0IHJ1bnRpbWUgYnkKKyAgICAgKiB7QGxpbmsgI3NldEltbWVyc2l2ZX0uCisgICAgICoKKyAgICAgKiBAc2VlIGFuZHJvaWQuY29udGVudC5wbS5BY3Rpdml0eUluZm8jRkxBR19JTU1FUlNJVkUKKyAgICAgKiBAaGlkZQorICAgICAqLworICAgIHB1YmxpYyBib29sZWFuIGlzSW1tZXJzaXZlKCkgeworICAgICAgICB0cnkgeworICAgICAgICAgICAgcmV0dXJuIEFjdGl2aXR5TWFuYWdl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VlbmNlIHRpdGxlLCBBY3Rpdml0eSBwYXJlbnQsIFN0cmluZyBpZCwKLSAgICAgICAgICAgIE9iamVjdCBsYXN0Tm9uQ29uZmlndXJhdGlvbkluc3RhbmNlLAotICAgICAgICAgICAgSGFzaE1hcDxTdHJpbmcsT2JqZWN0PiBsYXN0Tm9uQ29uZmlndXJhdGlvbkNoaWxkSW5zdGFuY2VzLAorICAgICAgICAgICAgTm9uQ29uZmlndXJhdGlvbkluc3RhbmNlcyBsYXN0Tm9uQ29uZmlndXJhdGlvbkluc3RhbmNlcywKICAgICAgICAgICAgIENvbmZpZ3VyYXRpb24gY29uZmlnKSB7CiAgICAgICAgIGF0dGFjaEJhc2VDb250ZXh0KGNvbnRleHQpOwogCisgICAgICAgIG1GcmFnbWVudHMuYXR0YWNoQWN0aXZpdHkodGhpcyk7CisgICAgICAgIAogICAgICAgICBtV2luZG93ID0gUG9saWN5TWFuYWdlci5tYWtlTmV3V2luZG93KHRoaXMpOwogICAgICAgICBtV2luZG93LnNldENhbGxiYWNrKHRoaXMpOworICAgICAgICBtV2luZG93LmdldExheW91dEluZmxhdGVyKCkuc2V0RmFjdG9yeSh0aGlzKTsKICAgICAgICAgaWYgKGluZm8uc29mdElucHV0TW9kZSAhPSBXaW5kb3dNYW5hZ2VyLkxheW91dFBhcmFtcy5TT0ZUX0lOUFVUX1NUQVRFX1VOU1BFQ0lGSUVEKSB7CiAgICAgICAgICAgICBtV2luZG93LnNldFNvZnRJbnB1dE1vZGUoaW5mby5zb2Z0SW5wdXRNb2RlKTsKICAgICAgICAgfQogICAgICAgICBtVWlUaHJlYWQgPSBUaHJlYWQuY3VycmVudFRocmVhZCgpOwotCisgICAgICAgIAogICAgICAgICBtTWFpblRocmVhZCA9IGFUaHJlYWQ7CiAgICAgICAgIG1JbnN0cnVtZW50YXRpb24gPSBpbnN0cjsKICAgICAgICAgbVRva2VuID0gdG9rZW47CkBAIC0zNzg1LDEwICs0MTgyLDEwIEBACiAgICAgICAgIG1Ua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BhdGNoQWN0aXZpdHlDcmVhdGVkKCk7CisgICAgfQorICAgIAogICAgIGZpbmFsIHZvaWQgcGVyZm9ybVN0YXJ0KCkgewogICAgICAgICBtQ2FsbGVkID0gZmFsc2U7CisgICAgICAgIG1GcmFnbWVudHMuZXhlY1BlbmRpbmdBY3Rpb25zKCk7CiAgICAgICAgIG1JbnN0cnVtZW50YXRpb24uY2FsbEFjdGl2aXR5T25TdGFydCh0aGlzKTsKICAgICAgICAgaWYgKCFtQ2FsbGVkKSB7CiAgICAgICAgICAgICB0aHJvdyBuZXcgU3VwZXJOb3RDYWxsZWRFeGNlcHRpb24oCiAgICAgICAgICAgICAgICAgIkFjdGl2aXR5ICIgKyBtQ29tcG9uZW50LnRvU2hvcnRTdHJpbmcoKSArCiAgICAgICAgICAgICAgICAgIiBkaWQgbm90IGNhbGwgdGhyb3VnaCB0byBzdXBlci5vblN0YXJ0KCkiKTsKICAgICAgICAgfQorICAgICAgICBtRnJhZ21lbnRzLmRpc3BhdGNoU3RhcnQoKTsKKyAgICAgICAgaWYgKG1BbGxMb2FkZXJNYW5hZ2VycyAhPSBudWxsKSB7CisgICAgICAgICAgICBmb3IgKGludCBpPW1BbGxMb2FkZXJNYW5hZ2Vycy5zaXplKCktMTsgaT49MDsgaS0tKSB7CisgICAgICAgICAgICAgICAgbUFsbExvYWRlck1hbmFnZXJzLnZhbHVlQXQoaSkuZmluaXNoUmV0YWluKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KICAgICB9CiAgICAgCiAgICAgZmluYWwgdm9pZCBwZXJmb3JtUmVzdGFydCgpIHsKQEAgLTM4MTYsNyArNDIyNSwxMCBAQAogICAgICAgICAgICAgZm9yIChpbnQgaT0wOyBpPE47IGkrKykgewogICAgICAgICAgICAgICAgIE1hbmFnZWRDdXJzb3IgbWMgPSBtTWFuYWdlZEN1cnNvcnMuZ2V0KGkpOwogICAgICAgICAgICAgICAgIGlmIChtYy5tUmVsZWFzZWQgfHwgbWMubVVwZGF0ZWQpIHsKLSAgICAgICAgICAgICAgICAgICAgbWMubUN1cnNvci5yZXF1ZXJ5KCk7CisgICAgICAgICAgICAgICAgICAgIGlmICghbWMubUN1cnNvci5yZXF1ZXJ5KCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ0cnlpbmcgdG8gcmVxdWVyeSBhbiBhbHJlYWR5IGNsb3NlZCBjdXJzb3IiKTsKKyAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICBtYy5tUmVsZWFzZWQgPSBmYWxzZTsKICAgICAgICAgICAgICAgICAgICAgbWMubVVwZGF0ZWQgPSBmYWxzZTsKICAgICAgICAgICAgICAgICB9CkBAIC0zODM5LDcgKzQyNTEsOSBAQAogICAgIGZpbmFsIHZvaWQgcGVyZm9ybVJlc3VtZSgpIHsKICAgICAgICAgcGVyZm9ybVJlc3RhcnQoKTsKICAgICAgICAgCi0gICAgICAgIG1MYXN0Tm9uQ29uZmlndXJhdGlvbkluc3RhbmNlID0gbnVsbDsKKyAgICAgICAgbUZyYWdtZW50cy5leGVjUGVuZGluZ0FjdGlvbnMoKTsKKyAgICAgICAgCisgICAgICAgIG1MYXN0Tm9uQ29uZmlndXJhdGlvbkluc3RhbmNlcyA9IG51bGw7CiAgICAgICAgIAogICAgICAgICAvLyBGaXJzdCBjYWxsIG9uUmVzdW1lKCkgLWJlZm9yZS0gc2V0dGluZyBtUmVzdW1lZCwgc28gd2UgZG9uJ3QKICAgICAgICAgLy8gc2VuZCBvdXQgYW55IHN0YXR1cyBiYXIgLyBtZW51IG5vdGlmaWNhdGlvbnMgdGhlIGNsaWVudCBtYWtlcy4KQEAgLTM4NTQsNiArNDI2OCwxMCBAQAogICAgICAgICAvLyBOb3cgcmVhbGx5IHJlc3VtZSwgYW5kIGluc3RhbGwgdGhlIGN1cnJlbnQgc3RhdHVzIGJhciBhbmQgbWVudS4KICAgICAgICAgbVJlc3VtZWQgPSB0cnVlOwogICAgICAgICBtQ2FsbGVkID0gZmFsc2U7CisgICAgICAgIAorICAgICAgICBtRnJhZ21lbnRzLmRpc3BhdGNoUmVzdW1lKCk7CisgICAgICAgIG1GcmFnbWVudHMuZXhlY1BlbmRpbmdBY3Rpb25zKCk7CisgICAgICAgIAogICAgICAgICBvblBvc3RSZXN1bWUoKTsKICAgICAgICAgaWYgKCFtQ2FsbGVkKSB7CiAgICAgICAgICAgICB0aHJvdyBuZXcgU3VwZXJOb3RDYWxsZWRFeGNlcHRpb24oCkBAIC0zODYzLDYgKzQyODEsNyBAQAogICAgIH0KIAogICAgIGZpbmFsIHZvaWQgcGVyZm9ybVBhdXNlKCkgeworICAgICAgICBtRnJhZ21lbnRzLmRpc3BhdGNoUGF1c2UoKTsKICAgICAgICAgbUNhbGxlZCA9IGZhbHNlOwogICAgICAgICBvblBhdXNlKCk7CiAgICAgICAgIGlmICghbUNhbGxlZCAmJiBnZXRBcHBsaWNhdGlvbkluZm8oKS50YXJnZXRTZGtWZXJzaW9uCkBAIC0zODc5LDExICs0Mjk4LDI0IEBACiAgICAgfQogICAgIAogICAgIGZpbmFsIHZvaWQgcGVyZm9ybVN0b3AoKSB7CisgICAgICAgIGlmIChtU3RhcnRlZCkgeworICAgICAgICAgICAgbVN0YXJ0ZWQgPSBmYWxzZTsKKyAgICAgICAgICAgIGlmIChtTG9hZGVyTWFuYWdlciAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgaWYgKCFtQ2hhbmdpbmdDb25maWd1cmF0aW9ucykgeworICAgICAgICAgICAgICAgICAgICBtTG9hZGVyTWFuYWdlci5kb1N0b3AoKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICBtTG9hZGVyTWFuYWdlci5kb1JldGFpbigpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICAKICAgICAgICAgaWYgKCFtU3RvcHBlZCkgewogICAgICAgICAgICAgaWYgKG1XaW5kb3cgIT0gbnVsbCkgewogICAgICAgICAgICAgICAgIG1XaW5kb3cuY2xvc2VBbGxQYW5lbHMoKTsKICAgICAgICAgICAgIH0KIAorICAgICAgICAgICAgbUZyYWdtZW50cy5kaXNwYXRjaFN0b3AoKTsKKyAgICAgICAgICAgIAogICAgICAgICAgICAgbUNhbGxlZCA9IGZhbHNlOwogICAgICAgICAgICAgbUluc3RydW1lbnRhdGlvbi5jYWxsQWN0aXZpdHlPblN0b3AodGhpcyk7CiAgICAgICAgICAgICBpZiAoIW1DYWxsZWQpIHsKQEAgLTM5MDgsNiArNDM0MCwxNSBAQAogICAgICAgICBtUmVzdW1lZCA9IGZhbHNlOwogICAgIH0KIAorICAgIGZpbmFsIHZvaWQgcGVyZm9ybURlc3Ryb3koKSB7CisgICAgICAgIG1XaW5kb3cuZGVzdHJveSgpOworICAgICAgICBtRnJhZ21lbnRzLmRpc3BhdGNoRGVzdHJveSgpOworICAgICAgICBvbkRlc3Ryb3koKTsKKyAgICAgICAgaWYgKG1Mb2FkZXJNYW5hZ2VyICE9IG51bGwpIHsKKyAgICAgICAgICAgIG1Mb2FkZXJNYW5hZ2VyLmRvRGVzdHJveSgpOworICAgICAgICB9CisgICAgfQorICAgIAogICAgIGZpbmFsIGJvb2xlYW4gaXNSZXN1bWVkKCkgewogICAgICAgICByZXR1cm4gbVJlc3VtZWQ7CiAgICAgfQpAQCAtMzkxOSw2ICs0MzYwLDExIEBACiAgICAgICAgICAgICArICIsIHJlc0NvZGU9IiArIHJlc3VsdENvZGUgKyAiLCBkYXRhPSIgKyBkYXRhKTsKICAgICAgICAgaWYgKHdobyA9PSBudWxsKSB7CiAgICAgICAgICAgICBvbkFjdGl2aXR5UmVzdWx0KHJlcXVlc3RDb2RlLCByZXN1bHRDb2RlLCBkYXRhKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIEZyYWdtZW50IG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ZSBTRVRfSU1NRVJTSVZFX1RSQU5TQUNUSU9OOiB7CisgICAgICAgICAgICBkYXRhLmVuZm9yY2VJbnRlcmZhY2UoSUFjdGl2aXR5TWFuYWdlci5kZXNjcmlwdG9yKTsKKyAgICAgICAgICAgIElCaW5kZXIgdG9rZW4gPSBkYXRhLnJlYWRTdHJvbmdCaW5kZXIoKTsKKyAgICAgICAgICAgIGJvb2xlYW4gaW1tID0gZGF0YS5yZWFkSW50KCkgPT0gMTsKKyAgICAgICAgICAgIHNldEltbWVyc2l2ZSh0b2tlbiwgaW1tKTsKKyAgICAgICAgICAgIHJlcGx5LndyaXRlTm9FeGNlcHRpb24oKTsKKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICBjYXNlIElTX1RPUF9BQ1RJVklUWV9JTU1FUlNJVkVfVFJBTlNBQ1RJT046IHsKKyAgICAgICAgICAgIGRhdGEuZW5mb3JjZUludGVyZmFjZShJQWN0aXZpdHlNYW5hZ2VyLmRlc2NyaXB0b3IpOworICAgICAgICAgICAgYm9vbGVhbiBpc2l0ID0gaXNUb3BBY3Rpdml0eUltbWVyc2l2ZSgpOworICAgICAgICAgICAgcmVwbHkud3JpdGVOb0V4Y2VwdGlvbigpOworICAgICAgICAgICAgcmVwbHkud3JpdGVJbnQoaXNpdCA/IDEgOiAwKTsKKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9CisKICAgICAgICAgY2FzZSBDUkFTSF9BUFBMSUNBVElPTl9UUkFOU0FDVElPTjogewogICAgICAgICAgICAgZGF0YS5lbmZvcmNlSW50ZXJmYWNlKElBY3Rpdml0eU1hbmFnZXIuZGVzY3JpcHRvcik7CiAgICAgICAgICAgICBpbnQgdWlkID0gZGF0YS5yZWFkSW50KCk7CkBAIC0xMjcxLDcgKzEyOTcsNyBAQAogICAgICAgICAgICAgcmVwbHkud3JpdGVOb0V4Y2VwdGlvbigpOwogICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgIH0KLQorICAgICAgICAKICAgICAgICAgY2FzZSBORVdfVVJJX1BFUk1JU1NJT05fT1dORVJfVFJBTlNBQ1RJT046IHsKICAgICAgICAgICAgIGRhdGEuZW5mb3JjZUludGVyZmFjZShJQWN0aXZpdHlNYW5hZ2VyLmRlc2NyaXB0b3IpOwogICAgICAgICAgICAgU3RyaW5nIG5hbWUgPSBkYXRhLnJlYWRTdHJpbmcoKTsKQEAgLTEzMDYsNiArMTMzMiwxOSBAQAogICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgIH0KIAorICAgICAgICBjYXNlIERVTVBfSEVBUF9UUkFOU0FDVElPTjogeworICAgICAgICAgICAgZGF0YS5lbmZvcmNlSW50ZXJmYWNlKElBY3Rpdml0eU1hbmFnZXIuZGVzY3JpcHRvcik7CisgICAgICAgICAgICBTdHJpbmcgcHJvY2VzcyA9IGRhdGEucmVhZFN0cmluZygpOworICAgICAgICAgICAgYm9vbGVhbiBtYW5hZ2VkID0gZGF0YS5yZWFkSW50KCkgIT0gMDsKKyAgICAgICAgICAgIFN0cmluZyBwYXRoID0gZGF0YS5yZWFkU3RyaW5nKCk7CisgICAgICAgICAgICBQYXJjZWxGaWxlRGVzY3JpcHRvciBmZCA9IGRhdGEucmVhZEludCgpICE9IDAKKyAgICAgICAgICAgICAgICAgICAgPyBkYXRhLnJlYWRGaWxlRGVzY3JpcHRvcigpIDogbnVsbDsKKyAgICAgICAgICAgIGJvb2xlYW4gcmVzID0gZHVtcEhlYXAocHJvY2VzcywgbWFuYWdlZCwgcGF0aCwgZmQpOworICAgICAgICAgICAgcmVwbHkud3JpdGVOb0V4Y2VwdGlvbigpOworICAgICAgICAgICAgcmVwbHkud3JpdGVJbnQocmVzID8gMSA6IDApOworICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgIH0KKwogICAgICAgICB9CiAgICAgICAgIAogICAgICAgICByZXR1cm4gc3VwZXIub25UcmFuc2FjdChjb2RlLCBkYXRhLCByZXBseSwgZmxhZ3MpOwpAQCAtMjgzMiw2ICsyODcxLDQ2IEBACiAgICAgICAgIHJlcGx5LnJlY3ljbGUoKTsKICAgICB9CiAgICAgCisgICAgcHVibGljIHZvaWQgc2V0SW1tZXJzaXZlKElCaW5kZXIgdG9rZW4sIGJvb2xlYW4gaW1tZXJzaXZlKQorICAgICAgICAgICAgdGhyb3dzIFJlbW90ZUV4Y2VwdGlvbiB7CisgICAgICAgIFBhcmNlbCBkYXRhID0gUGFyY2VsLm9idGFpbigpOworICAgICAgICBQYXJjZWwgcmVwbHkgPSBQYXJjZWwub2J0YWluKCk7CisgICAgICAgIGRhdGEud3JpdGVJbnRlcmZhY2VUb2tlbihJQWN0aXZpdHlNYW5hZ2VyLmRlc2NyaXB0b3IpOworICAgICAgICBkYXRhLndyaXRlU3Ryb25nQmluZGVyKHRva2VuKTsKKyAgICAgICAgZGF0YS53cml0ZUludChpbW1lcnNpdmUgPyAxIDogMCk7CisgICAgICAgIG1SZW1vdGUudHJhbnNhY3QoU0VUX0lNTUVSU0lWRV9UUkFOU0FDVElPTiwgZGF0YSwgcmVwbHksIDApOworICAgICAgICByZXBseS5yZWFkRXhjZXB0aW9uKCk7CisgICAgICAgIGRhdGEucmVjeWNsZSgpOworICAgICAgICByZXBseS5yZWN5Y2xlKCk7CisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gaXNJbW1lcnNpdmUoSUJpbmRlciB0b2tlbikKKyAgICAgICAgICAgIHRocm93cyBSZW1vdGVFeGNlcHRpb24geworICAgICAgICBQYXJjZWwgZGF0YSA9IFBhcmNlbC5vYnRhaW4oKTsKKyAgICAgICAgUGFyY2VsIHJlcGx5ID0gUGFyY2VsLm9idGFpbigpOworICAgICAgICBkYXRhLndyaXRlSW50ZXJmYWNlVG9rZW4oSUFjdGl2aXR5TWFuYWdlci5kZXNjcmlwdG9yKTsKKyAgICAgICAgZGF0YS53cml0ZVN0cm9uZ0JpbmRlcih0b2tlbik7CisgICAgICA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SW5zdGFuY2VDb3VudCA9IFZNRGVidWcuY291bnRJbnN0YW5jZXNPZkNsYXNzKENvbnRleHRJbXBsLmNsYXNzKTsKKyAgICAgICAgICAgIGxvbmcgYWN0aXZpdHlJbnN0YW5jZUNvdW50ID0gVk1EZWJ1Zy5jb3VudEluc3RhbmNlc09mQ2xhc3MoQWN0aXZpdHkuY2xhc3MpOwogICAgICAgICAgICAgaW50IGdsb2JhbEFzc2V0Q291bnQgPSBBc3NldE1hbmFnZXIuZ2V0R2xvYmFsQXNzZXRDb3VudCgpOwogICAgICAgICAgICAgaW50IGdsb2JhbEFzc2V0TWFuYWdlckNvdW50ID0gQXNzZXRNYW5hZ2VyLmdldEdsb2JhbEFzc2V0TWFuYWdlckNvdW50KCk7CiAgICAgICAgICAgICBpbnQgYmluZGVyTG9jYWxPYmplY3RDb3VudCA9IERlYnVnLmdldEJpbmRlckxvY2FsT2JqZWN0Q291bnQoKTsKQEAgLTc2Myw3ICs3NzcsNyBAQAogICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgc3RhdHMuZGJTdGF0cy5zaXplKCk7IGkrKykgewogICAgICAgICAgICAgICAgICAgICBEYlN0YXRzIGRiU3RhdHMgPSBzdGF0cy5kYlN0YXRzLmdldChpKTsKICAgICAgICAgICAgICAgICAgICAgcHJpbnRSb3cocHcsIERCX0lORk9fRk9STUFULCBkYlN0YXRzLnBhZ2VTaXplLCBkYlN0YXRzLmRiU2l6ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYlN0YXRzLmxvb2thc2lkZSwgZGJTdGF0cy5kYk5hbWUpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRiU3RhdHMubG9va2FzaWRlLCBkYlN0YXRzLmNhY2hlLCBkYlN0YXRzLmRiTmFtZSk7CiAgICAgICAgICAgICAgICAgICAgIHB3LnByaW50KCcsJyk7CiAgICAgICAgICAgICAgICAgfQogCkBAIC04MTQsMTEgKzgyOCwxMiBAQAogICAgICAgICAgICAgaW50IE4gPSBzdGF0cy5kYlN0YXRzLnNpemUoKTsKICAgICAgICAgICAgIGlmIChOID4gMCkgewogICAgICAgICAgICAgICAgIHB3LnByaW50bG4oIiBEQVRBQkFTRVMiKTsKLSAgICAgICAgICAgICAgICBwcmludFJvdyhwdywgIiAgJThzICU4cyAlMTBzICAlcyIsICJQYWdlc2l6ZSIsICJEYnNpemUiLCAiTG9va2FzaWRlIiwgIkRibmFtZSIpOworICAgICAgICAgICAgICAgIHByaW50Um93KHB3LCAiICAlNHMgJTZzICU4cyAlMTRzICAlcyIsICJwZ3N6IiwgImRic3oiLCAibGthc2lkZSIsICJjYWNoZSIsCisgICAgICAgICAgICAgICAgICAgICJEYm5hbWUiKTsKICAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IE47IGkrKykgewogICAgICAgICAgICAgICAgICAgICBEYlN0YXRzIGRiU3RhdHMgPSBzdGF0cy5kYlN0YXRzLmdldChpKTsKICAgICAgICAgICAgICAgICAgICAgcHJpbnRSb3cocHcsIERCX0lORk9fRk9STUFULCBkYlN0YXRzLnBhZ2VTaXplLCBkYlN0YXRzLmRiU2l6ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYlN0YXRzLmxvb2thc2lkZSwgZGJTdGF0cy5kYk5hbWUpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRiU3RhdHMubG9va2FzaWRlLCBkYlN0YXRzLmNhY2hlLCBkYlN0YXRzLmRiTmFtZSk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogCkBAIC04NzIsNiArODg3LDcgQEAKICAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBpbnQgRU5BQkxFX0pJVCAgICAgICAgICAgICAgPSAxMzI7CiAgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IERJU1BBVENIX1BBQ0tBR0VfQlJPQURDQVNUID0gMTMzOwogICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBTQ0hFRFVMRV9DUkFTSCAgICAgICAgICA9IDEzNDsKKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBpbnQgRFVNUF9IRUFQICAgICAgICAgICAgICAgPSAxMzU7CiAgICAgICAgIFN0cmluZyBjb2RlVG9TdHJpbmcoaW50IGNvZGUpIHsKICAgICAgICAgICAgIGlmIChsb2NhbExPR1YpIHsKICAgICAgICAgICAgICAgICBzd2l0Y2ggKGNvZGUpIHsKQEAgLTkxMCw2ICs5MjYsNyBAQAogICAgICAgICAgICAgICAgICAgICBjYXNlIEVOQUJMRV9KSVQ6IHJldHVybiAiRU5BQkxFX0pJVCI7CiAgICAgICAgICAgICAgICAgICAgIGNhc2UgRElTUEFUQ0hfUEFDS0FHRV9CUk9BRENBU1Q6IHJldHVybiAiRElTUEFUQ0hfUEFDS0FHRV9CUk9BRENBU1QiOwogICAgICAgICAgICAgICAgICAgICBjYXNlIFNDSEVEVUxFX0NSQVNIOiByZXR1cm4gIlNDSEVEVUxFX0NSQVNIIjsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBEVU1QX0hFQVA6IHJldHVybiAiRFVNUF9IRUFQIjsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICByZXR1cm4gIih1bmtub3duKSI7CkBAIC0xMDM1LDEzICsxMDUyLDM1IEBACiAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgIGNhc2UgU0NIRURVTEVfQ1JBU0g6CiAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBSZW1vdGVTZXJ2aWNlRXhjZXB0aW9uKChTdHJpbmcpbXNnLm9iaik7CisgICAgICAgICAgICAgICAgY2FzZSBEVU1QX0hFQVA6CisgICAgICAgICAgICAgICAgICAgIGhhbmRsZUR1bXBIZWFwKG1zZy5hcmcxICE9IDAsIChEdW1wSGVhcERhdGEpbXNnLm9iaik7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgfQogICAgICAgICB9CiAKICAgICAgICAgdm9pZCBtYXliZVNuYXBzaG90KCkgewogICAgICAgICAgICAgaWYgKG1Cb3VuZEFwcGxpY2F0aW9uICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICBTYW1wbGluZ1Byb2ZpbGVySW50ZWdyYXRpb24ud3JpdGVTbmFwc2hvdCgKLSAgICAgICAgICAgICAgICAgICAgICAgIG1Cb3VuZEFwcGxpY2F0aW9uLnByb2Nlc3NOYW1lKTsKKyAgICAgICAgICAgICAgICAvLyBjb252ZXJ0IHRoZSAqcHJpdmF0ZSogQWN0aXZpdHlUaHJlYWQuUGFja2FnZUluZm8gdG8gKnB1YmxpYyoga25vd24KKyAgICAgICAgICAgICAgICAvLyBhbmRyb2lkLmNvbnRlbnQucG0uUGFja2FnZUluZm8KKyAgICAgICAgICAgICAgICBTdHJpbmcgcGFja2FnZU5hbWUgPSBtQm91bmRBcHBsaWNhdGlvbi5pbmZvLm1QYWNrYWdlTmFtZTsKKyAgICAgICAgICAgICAgICBhbmRyb2lkLmNvbnRlbnQucG0uUGFja2FnZUluZm8gcGFja2FnZUluZm8gPSBudWxsOworICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgIENvbnRleHQgY29udGV4dCA9IGdldFN5c3RlbUNvbnRleHQoKTsKKyAgICAgICAgICAgICAgICAgICAgaWYoY29udGV4dCA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBMb2cuZShUQUcsICJjYW5ub3QgZ2V0IGEgdmFsaWQgY29udGV4dCIpOworICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIFBhY2thZ2VNYW5hZ2VyIHBtID0gY29udGV4dC5nZXRQYWNrYWdlTWFuYWdlcigpOworICAgICAgICAgICAgICAgICAgICBpZihwbSA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBMb2cuZSh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lY29yZCByID0gbmV3IEFjdGl2aXR5Q2xpZW50UmVjb3JkKCk7CiAgICAgICAgICAgICByLnRva2VuID0gdG9rZW47CiAgICAgICAgICAgICByLmlkZW50ID0gMDsKQEAgLTE0NDEsNyArMTQ4MCw3IEBACiAgICAgICAgICAgICByLnBhcmVudCA9IHBhcmVudDsKICAgICAgICAgICAgIHIuZW1iZWRkZWRJRCA9IGlkOwogICAgICAgICAgICAgci5hY3Rpdml0eUluZm8gPSBhY3Rpdml0eUluZm87Ci0gICAgICAgICAgICByLmxhc3ROb25Db25maWd1cmF0aW9uSW5zdGFuY2UgPSBsYXN0Tm9uQ29uZmlndXJhdGlvbkluc3RhbmNlOworICAgICAgICAgICAgci5sYXN0Tm9uQ29uZmlndXJhdGlvbkluc3RhbmNlcyA9IGxhc3ROb25Db25maWd1cmF0aW9uSW5zdGFuY2VzOwogICAgICAgICBpZiAobG9jYWxMT0dWKSB7CiAgICAgICAgICAgICBDb21wb25lbnROYW1lIGNvbXBuYW1lID0gaW50ZW50LmdldENvbXBvbmVudCgpOwogICAgICAgICAgICAgU3RyaW5nIG5hbWU7CkBAIC0xNTYzLDE0ICsxNjAyLDEyIEBACiAgICAgICAgICAgICAgICAgICAgICAgICArIHIuYWN0aXZpdHlJbmZvLm5hbWUgKyAiIHdpdGggY29uZmlnICIgKyBjb25maWcpOwogICAgICAgICAgICAgICAgIGFjdGl2aXR5LmF0dGFjaChhcHBDb250ZXh0LCB0aGlzLCBnZXRJbnN0cnVtZW50YXRpb24oKSwgci50b2tlbiwKICAgICAgICAgICAgICAgICAgICAgICAgIHIuaWRlbnQsIGFwcCwgci5pbnRlbnQsIHIuYWN0aXZpdHlJbmZvLCB0aXRsZSwgci5wYXJlbnQsCi0gICAgICAgICAgICAgICAgICAgICAgICByLmVtYmVkZGVkSUQsIHIubGFzdE5vbkNvbmZpZ3VyYXRpb25JbnN0YW5jZSwKLSAgICAgICAgICAgICAgICAgICAgICAgIHIubGFzdE5vbkNvbmZpZ3VyYXRpb25DaGlsZEluc3RhbmNlcywgY29uZmlnKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHIuZW1iZWRkZWRJRCwgci5sYXN0Tm9uQ29uZmlndXJhdGlvbkluc3RhbmNlcywgY29uZmlnKTsKIAogICAgICAgICAgICAgICAgIGlmIChjdXN0b21JbnRlbnQgIT0gbnVsbCkgewogICAgICAgICAgICAgICAgICAgICBhY3Rpdml0eS5tSW50ZW50ID0gY3VzdG9tSW50ZW50OwogICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICByLmxhc3ROb25Db25maWd1cmF0aW9uSW5zdGFuY2UgPSBudWxsOwotICAgICAgICAgICAgICAgIHIubGFzdE5vbkNvbmZpZ3VyYXRpb25DaGlsZEluc3RhbmNlcyA9IG51bGw7CisgICAgICAgICAgICAgICAgci5sYXN0Tm9uQ29uZmlndXJhdGlvbkluc3RhbmNlcyA9IG51bGw7CiAgICAgICAgICAgICAgICAgYWN0aXZpdHkubVN0YXJ0ZWRBY3Rpdml0eSA9IGZhbHNlOwogICAgICAgICAgICAgICAgIGludCB0aGVtZSA9IHIuYWN0aXZpdHlJbmZvLmdldFRoZW1lUmVzb3VyY2UoKTsKICAgICAgICAgICAgICAgICBpZiAodGhlbWUgIT0gMCkgewpAQCAtMjU0Nyw2ICsyNTg0LDkgQEAKICAgICAgICAgICAgIGlmIChmaW5pc2hpbmcpIHsKICAgICAgICAgICAgICAgICByLmFjdGl2aXR5Lm1GaW5pc2hlZCA9IHRydWU7CiAgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoZ2V0Tm9uQ29uZmlnSW5zdGFuY2UpIHsKKyAgICAgICAgICAgICAgICByLmFjdGl2aXR5Lm1DaGFuZ2luZ0NvbmZpZ3VyYXRpb25zID0gdHJ1ZTsKKyAgICAgICAgICAgIH0KICAgICAgICAgICAgIGlmICghci5wYXVzZWQpIHsKICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICByLmFjdGl2aXR5Lm1DYWxsZWQgPSBmYWxzZTsKQEAgLTI1ODcsOCArMjYyNyw4IEBACiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBpZiAoZ2V0Tm9uQ29uZmlnSW5zdGFuY2UpIHsKICAgICAgICAgICAgICAgICB0cnkgewotICAgICAgICAgICAgICAgICAgICByLmxhc3ROb25Db25maWd1cmF0aW9uSW5zdGFuY2UKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICA9IHIuYWN0aXZpdHkub25SZXRhaW5Ob25Db25maWd1cmF0aW9uSW5zdGFuY2UoKTsKKyAgICAgICAgICAgICAgICAgICAgci5sYXN0Tm9uQ29uZmlndXJhdGlvbkluc3RhbmNlcworICAgICAgICAgICAgICAgICAgICAgICAgICAgID0gci5hY3Rpdml0eS5yZXRhaW5Ob25Db25maWd1cmF0aW9uSW5zdGFuY2VzKCk7CiAgICAgICAgICAgICAgICAgfSBjYXRjaCAoRXhjZXB0aW9uIGUpIHsKICAgICAgICAgICAgICAgICAgICAgaWYgKCFtSW5zdHJ1bWVudGF0aW9uLm9uRXhjZXB0aW9uKHIuYWN0aXZpdHksIGUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgUnVudGltZUV4Y2VwdGlvbigKQEAgLTI1OTcsMjIgKzI2MzcsMTAgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiOiAiICsgZS50b1N0cmluZygpLCBlKTsKICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB0cnkgewotICAgICAgICAgICAgICAgICAgICByLmxhc3ROb25Db25maWd1cmF0aW9uQ2hpbGRJbnN0YW5jZXMKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICA9IHIuYWN0aXZpdHkub25SZXRhaW5Ob25Db25maWd1cmF0aW9uQ2hpbGRJbnN0YW5jZXMoKTsKLSAgICAgICAgICAgICAgICB9IGNhdGNoIChFeGNlcHRpb24gZSkgewotICAgICAgICAgICAgICAgICAgICBpZiAoIW1JbnN0cnVtZW50YXRpb24ub25FeGNlcHRpb24oci5hY3Rpdml0eSwgZSkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBSdW50aW1lRXhjZXB0aW9uKAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiVW5hYmxlIHRvIHJldGFpbiBjaGlsZCBhY3Rpdml0aWVzICIKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyBzYWZlVG9Db21wb25lbnRTaG9ydFN0cmluZyhyLmludGVudCkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiOiAiICsgZS50b1N0cmluZygpLCBlKTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KLQogICAgICAgICAgICAgfQogICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICByLmFjdGl2aXR5Lm1DYWxsZWQgPSBmYWxzZTsKLSAgICAgICAgICAgICAgICByLmFjdGl2aXR5Lm9uRGVzdHJveSgpOworICAgICAgICAgICAgICAgIG1JbnN0cnVtZW50YXRpb24uY2FsbEFjdGl2aXR5T25EZXN0cm95KHIuYWN0aXZpdHkpOwogICAgICAgICAgICAgICAgIGlmICghci5hY3Rpdml0eS5tQ2FsbGVkKSB7CiAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBTdXBlck5vdENhbGxlZEV4Y2VwdGlvbigKICAgICAgICAgICAgICAgICAgICAgICAgICJBY3Rpdml0eSAiICsgc2FmZVRvQ29tcG9uZW50U2hvcnRTdHJpbmcoci5pbnRlbnQpICsKQEAgLTMwMjQsNiArMzA1MiwyNSBAQAogICAgICAgICB9CiAgICAgfQogCisgICAgZmluYWwgdm9pZCBoYW5kbGVEdW1wSGVhcChib29sZWFuIG1hbmFnZWQsIER1bXBIZWFwRGF0YSBkaGQpIHsKKyAgICAgICAgaWYgKG1hbmFnZWQpIHsKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgRGVidWcuZHVtcEhwcm9mRGF0YShkaGQucGF0aCwgZGhkLmZkLmdldEZpbGVEZXNjcmlwdG9yKCkpOworICAgICAgICAgICAgfSBjYXRjaCAoSU9FeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgIFNsb2cudyhUQUcsICJNYW5hZ2VkIGhlYXAgZHVtcCBmYWlsZWQgb24gcGF0aCAiICsgZGhkLnBhdGgKKyAgICAgICAgICAgICAgICAgICAgICAgICsgIiAtLSBjYW4gdGhlIHByb2Nlc3MgYWNjZXNzIHRoaXMgcGF0aD8iKTsKKyAgICAgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAgICAgZGhkLmZkLmNsb3NlKCk7CisgICAgICAgICAgICAgICAgfSBjYXRjaCAoSU9FeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICBTbG9nLncoVEFHLCAiRmFpbHVyZSBjbG9zaW5nIHByb2ZpbGUgZmQiLCBlKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBEZWJ1Zy5kdW1wTmF0aXZlSGVhcChkaGQuZmQuZ2V0RmlsZURlc2NyaXB0b3IoKSk7CisgICAgICAgIH0KKyAgICB9CisKICAgICBmaW5hbCB2b2lkIGhhbmRsZURpc3BhdGNoUGFja2FnZUJyb2FkY2FzdChpbnQgY21kLCBTdHJpbmdbXSBwYWNrYWdlcykgewogICAgICAgICBib29sZWFuIGhhc1BrZ0luZm8gPSBmYWxzZTsKICAgICAgICAgaWYgKHBhY2thZ2VzICE9IG51bGwpIHsKQEAgLTM1ODcsNiArMzYzNCw3IEBACiAgICAgfQogCiAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBBY3Rpdml0eVRocmVhZCBzeXN0ZW1NYWluKCkgeworICAgICAgICBIYXJkd2FyZVJlbmRlcmVyLmRpc2FibGUoKT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ltcG9ydCBhbmRyb2lkLm9zLlBhcmNlbDsKK2ltcG9ydCBhbmRyb2lkLm9zLlBhcmNlbGFibGU7CitpbXBvcnQgYW5kcm9pZC51dGlsLkxvZzsKKworaW1wb3J0IGphdmEudXRpbC5BcnJheUxpc3Q7CisKK2ZpbmFsIGNsYXNzIEJhY2tTdGFja1N0YXRlIGltcGxlbWVudHMgUGFyY2VsYWJsZSB7CisgICAgZmluYWwgaW50W10gbU9wczsKKyAgICBmaW5hbCBpbnQgbVRyYW5zaXRpb247CisgICAgZmluYWwgaW50IG1UcmFuc2l0aW9uU3R5bGU7CisgICAgZmluYWwgU3RyaW5nIG1OYW1lOworICAgIGZpbmFsIGludCBtSW5kZXg7CisgICAgCisgICAgcHVibGljIEJhY2tTdGFja1N0YXRlKEZyYWdtZW50TWFuYWdlckltcGwgZm0sIEJhY2tTdGFja0VudHJ5IGJzZSkgeworICAgICAgICBpbnQgbnVtUmVtb3ZlZCA9IDA7CisgICAgICAgIEJhY2tTdGFja0VudHJ5Lk9wIG9wID0gYnNlLm1IZWFkOworICAgICAgICB3aGlsZSAob3AgIT0gbnVsbCkgeworICAgICAgICAgICAgaWYgKG9wLnJlbW92ZWQgIT0gbnVsbCkgbnVtUmVtb3ZlZCArPSBvcC5yZW1vdmVkLnNpemUoKTsKKyAgICAgICAgICAgIG9wID0gb3AubmV4dDsKKyAgICAgICAgfQorICAgICAgICBtT3BzID0gbmV3IGludFtic2UubU51bU9wKjUgKyBudW1SZW1vdmVkXTsKKyAgICAgICAgCisgICAgICAgIGlmICghYnNlLm1BZGRUb0JhY2tTdGFjaykgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiTm90IG9uIGJhY2sgc3RhY2siKTsKKyAgICAgICAgfQorCisgICAgICAgIG9wID0gYnNlLm1IZWFkOworICAgICAgICBpbnQgcG9zID0gMDsKKyAgICAgICAgd2hpbGUgKG9wICE9IG51bGwpIHsKKyAgICAgICAgICAgIG1PcHNbcG9zKytdID0gb3AuY21kOworICAgICAgICAgICAgbU9wc1twb3MrK10gPSBvcC5mcmFnbWVudC5tSW5kZXg7CisgICAgICAgICAgICBtT3BzW3BvcysrXSA9IG9wLmVudGVyQW5pbTsKKyAgICAgICAgICAgIG1PcHNbcG9zKytdID0gb3AuZXhpdEFuaW07CisgICAgICAgICAgICBpZiAob3AucmVtb3ZlZCAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgZmluYWwgaW50IE4gPSBvcC5yZW1vdmVkLnNpemUoKTsKKyAgICAgICAgICAgICAgICBtT3BzW3BvcysrXSA9IE47CisgICAgICAgICAgICAgICAgZm9yIChpbnQgaT0wOyBpPE47IGkrKykgeworICAgICAgICAgICAgICAgICAgICBtT3BzW3BvcysrXSA9IG9wLnJlbW92ZWQuZ2V0KGkpLm1JbmRleDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIG1PcHNbcG9zKytdID0gMDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG9wID0gb3AubmV4dDsKKyAgICAgICAgfQorICAgICAgICBtVHJhbnNpdGlvbiA9IGJzZS5tVHJhbnNpdGlvbjsKKyAgICAgICAgbVRyYW5zaXRpb25TdHlsZSA9IGJzZS5tVHJhbnNpdGlvblN0eWxlOworICAgICAgICBtTmFtZSA9IGJzZS5tTmFtZTsKKyAgICAgICAgbUluZGV4ID0gYnNlLm1JbmRleDsKKyAgICB9CisgICAgCisgICAgcHVibGljIEJhY2tTdGFja1N0YXRlKFBhcmNlbCBpbikgeworICAgICAgICBtT3BzID0gaW4uY3JlYXRlSW50QXJyYXkoKTsKKyAgICAgICAgbVRyYW5zaXRpb24gPSBpbi5yZWFkSW50KCk7CisgICAgICAgIG1UcmFuc2l0aW9uU3R5bGUgPSBpbi5yZWFkSW50KCk7CisgICAgICAgIG1OYW1lID0gaW4ucmVhZFN0cmluZygpOworICAgICAgICBtSW5kZXggPSBpbi5yZWFkSW50KCk7CisgICAgfQorICAgIAorICAgIHB1YmxpYyBCYWNrU3RhY2tFbnRyeSBpbnN0YW50aWF0ZShGcmFnbWVudE1hbmFnZXJJbXBsIGZtKSB7CisgICAgICAgIEJhY2tTdGFja0VudHJ5IGJzZSA9IG5ldyBCYWNrU3RhY2tFbnRyeShmbSk7CisgICAgICAgIGludCBwb3MgPSAwOworICAgICAgICB3aGlsZSAocG9zIDwgbU9wcy5sZW5ndGgpIHsKKyAgICAgICAgICAgIEJhY2tTdGFja0VudHJ5Lk9wIG9wID0gbmV3IEJhY2tTdGFja0VudHJ5Lk9wKCk7CisgICAgICAgICAgICBvcC5jbWQgPSBtT3BzW3BvcysrXTsKKyAgICAgICAgICAgIGlmIChGcmFnbWVudE1hbmFnZXJJbXBsLkRFQlVHKSBMb2cudihGcmFnbWVudE1hbmFnZXJJbXBsLlRBRywKKyAgICAgICAgICAgICAgICAgICAgIkJTRSAiICsgYnNlICsgIiBzZXQgYmFzZSBmcmFnbWVudCAjIiArIG1PcHNbcG9zXSk7CisgICAgICAgICAgICBGcmFnbWVudCBmID0gZm0ubUFjdGl2ZS5nZXQobU9wc1twb3MrK10pOworICAgICAgICAgICAgb3AuZnJhZ21lbnQgPSBmOworICAgICAgICAgICAgb3AuZW50ZXJBbmltID0gbU9wc1twb3MrK107CisgICAgICAgICAgICBvcC5leGl0QW5pbSA9IG1PcHNbcG9zKytdOworICAgICAgICAgICAgZmluYWwgaW50IE4gPSBtT3BzW3BvcysrXTsKKyAgICAgICAgICAgIGlmIChOID4gMCkgeworICAgICAgICAgICAgICAgIG9wLnJlbW92ZWQgPSBuZXcgQXJyYXlMaXN0PEZyYWdtZW50PihOKTsKKyAgICAgICAgICAgICAgICBmb3IgKGludCBpPTA7IGk8TjsgaSsrKSB7CisgICAgICAgICAgICAgICAgICAgIGlmIChGcmFnbWVudE1hbmFnZXJJbXBsLkRFQlVHKSBMb2cudihGcmFnbWVudE1hbmFnZXJJbXBsLlRBRywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAiQlNFICIgKyBic2UgKyAiIHNldCByZW1vdmUgZnJhZ21lbnQgIyIgKyBtT3BzW3Bvc10pOworICAgICAgICAgICAgICAgICAgICBGcmFnbWVudCByID0gZm0ubUFjdGl2ZS5nZXQobU9wc1twb3MrK10pOworICAgICAgICAgICAgICAgICAgICBvcC5yZW1vdmVkLmFkZChyKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBic2UuYWRkT3Aob3ApOworICAgICAgICB9CisgICAgICAgIGJzZS5tVHJhbnNpdGlvbiA9IG1UcmFuc2l0aW9uOworICAgICAgICBic2UubVRyYW5zaXRpb25TdHlsZSA9IG1UcmFuc2l0aW9uU3R5bGU7CisgICAgICAgIGJzZS5tTmFtZSA9IG1OYW1lOworICAgICAgICBic2UubUluZGV4ID0gbUluZGV4OworICAgICAgICBic2UubUFkZFRvQmFja1N0YWNrID0gdHJ1ZTsKKyAgICAgICAgYnNlLmJ1bXBCYWNrU3RhY2tOZXN0aW5nKDEpOworICAgICAgICByZXR1cm4gYnNlOworICAgIH0KKyAgICAKKyAgICBwdWJsaWMgaW50IGRlc2NyaWJlQ29udGVudHMoKSB7CisgICAgICAgIHJldHVybiAwOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHdyaXRlVG9QYXJjZWwoUGFyY2VsIGRlc3QsIGludCBmbGFncykgeworICAgICAgICBkZXN0LndyaXRlSW50QXJyYXkobU9wcyk7CisgICAgICAgIGRlc3Qud3JpdGVJbnQobVRyYW5zaXRpb24pOworICAgICAgICBkZXN0LndyaXRlSW50KG1UcmFuc2l0aW9uU3R5bGUpOworICAgICAgICBkZXN0LndyaXRlU3RyaW5nKG1OYW1lKTsKKyAgICAgICAgZGVzdC53cml0ZUludChtSW5kZXgpOworICAgIH0KKyAgICAKKyAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFBhcmNlbGFibGUuQ3JlYXRvcjxCYWNrU3RhY2tTdGF0ZT4gQ1JFQVRPUgorICAgICAgICAgICAgPSBuZXcgUGFyY2VsYWJsZS5DcmVhdG9yPEJhY2tTdGFja1N0YXRlPigpIHsKKyAgICAgICAgcHVibGljIEJhY2tTdGFja1N0YXRlIGNyZWF0ZUZyb21QYXJjZWwoUGFyY2VsIGluKSB7CisgICAgICAgICAgICByZXR1cm4gbmV3IEJhY2tTdGFja1N0YXRlKGluKTsKKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgcHVibGljIEJhY2tTdGFja1N0YXRlW10gbmV3QXJyYXkoaW50IHNpemUpIHsKKyAgICAgICAgICAgIHJldHVybiBuZXcgQmFja1N0YWNrU3RhdGVbc2l6ZV07CisgICAgICAgIH0KKyAgICB9OworfQorCisvKioKKyAqIEBoaWRlIEVudHJ5IG9mIGFuIG9wZXJhdGlvbiBvbiB0aGUgZnJhZ21lbnQgYmFjayBzdGFjay4KKyAqLworZmluYWwgY2xhc3MgQmFja1N0YWNrRW50cnkgaW1wbGVtZW50cyBGcmFnbWVudFRyYW5zYWN0aW9uLCBSdW5uYWJsZSB7CisgICAgc3RhdGljIGZpbmFsIFN0cmluZyBUQUcgPSAiQmFja1N0YWNrRW50cnkiOworICAgIAorICAgIGZpbmFsIEZyYWdtZW50TWFuYWdlckltcGwgbU1hbmFnZXI7CisgICAgCisgICAgc3RhdGljIGZpbmFsIGludCBPUF9OVUxMID0gMDsKKyAgICBzdGF0aWMgZmluYWwgaW50IE9QX0FERCA9IDE7CisgICAgc3RhdGljIGZpbmFsIGludCBPUF9SRVBMQUNFID0gMjsKKyAgICBzdGF0aWMgZmluYWwgaW50IE9QX1JFTU9WRSA9IDM7CisgICAgc3RhdGljIGZpbmFsIGludCBPUF9ISURFID0gNDsKKyAgICBzdGF0aWMgZmluYWwgaW50IE9QX1NIT1cgPSA1OworICAgIAorICAgIHN0YXRpYyBmaW5hbCBjbGFzcyBPcCB7CisgICAgICAgIE9wIG5leHQ7CisgICAgICAgIE9wIHByZXY7CisgICAgICAgIGludCBjbWQ7CisgICAgICAgIEZyYWdtZW50IGZyYWdtZW50OworICAgICAgICBpbnQgZW50ZXJBbmltOworICAgICAgICBpbnQgZXhpdEFuaW07CisgICAgICAgIEFycmF5TGlzdDxGcmFnbWVudD4gcmVtb3ZlZDsKKyAgICB9CisgICAgCisgICAgT3AgbUhlYWQ7CisgICAgT3AgbVRhaWw7CisgICAgaW50IG1OdW1PcDsKKyAgICBpbnQgbUVudGVyQW5pbTsKKyAgICBpbnQgbUV4aXRBbmltOworICAgIGludCBtVHJhbnNpdGlvbjsKKyAgICBpbnQgbVRyYW5zaXRpb25TdHlsZTsKKyAgICBib29sZWFuIG1BZGRUb0JhY2tTdGFjazsKKyAgICBTdHJpbmcgbU5hbWU7CisgICAgYm9vbGVhbiBtQ29tbWl0dGVkOworICAgIGludCBtSW5kZXg7CisgICAgCisgICAgcHVibGljIEJhY2tTdGFja0VudHJ5KEZyYWdtZW50TWFuYWdlckltcGwgbWFuYWdlcikgeworICAgICAgICBtTWFuYWdlciA9IG1hbmFnZXI7CisgICAgfQorICAgIAorICAgIHZvaWQgYWRkT3AoT3Agb3ApIHsKKyAgICAgICAgaWYgKG1IZWFkID09IG51bGwpIHsKKyAgICAgICAgICAgIG1IZWFkID0gbVRhaWwgPSBvcDsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIG9wLnByZXYgPSBtVGFpbDsKKyAgICAgICAgICAgIG1UYWlsLm5leHQgPSBvcDsKKyAgICAgICAgICAgIG1UYWlsID0gb3A7CisgICAgICAgIH0KKyAgICAgICAgb3AuZW50ZXJBbmltID0gbUVudGVyQW5pbTsKKyAgICAgICAgb3AuZXhpdEFuaW0gPSBtRXhpdEFuaW07CisgICAgICAgIG1OdW1PcCsrOworICAgIH0KKyAgICAgICAgCisgICAgcHVibGljIEZyYWdtZW50VHJhbnNhY3Rpb24gYWRkKEZyYWdtZW50IGZyYWdtZW50LCBTdHJpbmcgdGFnKSB7CisgICAgICAgIGRvQWRkT3AoMCwgZnJhZ21lbnQsIHRhZywgT1BfQUREKTsKKyAgICAgICAgcmV0dXJuIHRoaXM7CisgICAgfQorCisgICAgcHVibGljIEZyYWdtZW50VHJhbnNhY3Rpb24gYWRkKGludCBjb250YWluZXJWaWV3SWQsIEZyYWdtZW50IGZyYWdtZW50KSB7CisgICAgICAgIGRvQWRkT3AoY29udGFpbmVyVmlld0lkLCBmcmFnbWVudCwgbnVsbCwgT1BfQUREKTsKKyAgICAgICAgcmV0dXJuIHRoaXM7CisgICAgfQorCisgICAgcHVibGljIEZyYWdtZW50VHJhbnNhY3Rpb24gYWRkKGludCBjb250YWluZXJWaWV3SWQsIEZyYWdtZW50IGZyYWdtZW50LCBTdHJpbmcgdGFnKSB7CisgICAgICAgIGRvQWRkT3AoY29udGFpbmVyVmlld0lkLCBmcmFnbWVudCwgdGFnLCBPUF9BREQpOworICAgICAgICByZXR1cm4gdGhpczsKKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgZG9BZGRPcChpbnQgY29udGFpbmVyVmlld0lkLCBGcmFnbWVudCBmcmFnbWVudCwgU3RyaW5nIHRhZywgaW50IG9wY21kKSB7CisgICAgICAgIGlmIChmcmFnbWVudC5tSW1tZWRpYXRlQWN0aXZpdHkgIT0gbnVsbCkgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiRnJhZ21lbnQgYWxyZWFkeSBhZGRlZDogIiArIGZyYWdtZW50KTsKKyAgICAgICAgfQorICAgICAgICBmcmFnbWVudC5tSW1tZWRpYXRlQWN0aXZpdHkgPSBtTWFuYWdlci5tQWN0aXZpdHk7CisgICAgICAgIAorICAgICAgICBpZiAodGFnICE9IG51bGwpIHsKKyAgICAgICAgICAgIGlmIChmcmFnbWVudC5tVGFnICE9IG51bGwgJiYgIXRhZy5lcXVhbHMoZnJhZ21lbnQubVRhZykpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJDYW4ndCBjaGFuZ2UgdGFnIG9mIGZyYWdtZW50ICIKKyAgICAgICAgICAgICAgICAgICAgICAgICsgZnJhZ21lbnQgKyAiOiB3YXMgIiArIGZyYWdtZW50Lm1UYWcKKyAgICAgICAgICAgICAgICAgICAgICAgICsgIiBub3cgIiArIHRhZyk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBmcmFnbWVudC5tVGFnID0gdGFnOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICBpZiAoY29udGFpbmVyVmlld0lkICE9IDApIHsKKyAgICAgICAgICAgIGlmIChmcmFnbWVudC5tRnJhZ21lbnRJZCAhPSAwICYmIGZyYWdtZW50Lm1GcmFnbWVudElkICE9IGNvbnRhaW5lclZpZXdJZCkgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oIkNhbid0IGNoYW5nZSBjb250YWluZXIgSUQgb2YgZnJhZ21lbnQgIgorICAgICAgICAgICAgICAgICAgICAgICAgKyBmcmFnbWVudCArICI6IHdhcyAiICsgZnJhZ21lbnQubUZyYWdtZW50SWQKKyAgICAgICAgICAgICAgICAgICAgICAgICsgIiBub3cgIiArIGNvbnRhaW5lclZpZXdJZCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBmcmFnbWVudC5tQ29udGFpbmVySWQgPSBmcmFnbWVudC5tRnJhZ21lbnRJZCA9IGNvbnRhaW5lclZpZXdJZDsKKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgT3Agb3AgPSBuZXcgT3AoKTsKKyAgICAgICAgb3AuY21kID0gb3BjbWQ7CisgICAgICAgIG9wLmZyYWdtZW50ID0gZnJhZ21lbnQ7CisgICAgICAgIGFkZE9wKG9wKTsKKyAgICB9CisKKyAgICBwdWJsaWMgRnJhZ21lbnRUcmFuc2FjdGlvbiByZXBsYWNlKGludCBjb250YWluZXJWaWV3SWQsIEZyYWdtZW50IGZyYWdtZW50KSB7CisgICAgICAgIHJldHVybiByZXBsYWNlKGNvbnRhaW5lclZpZXdJZCwgZnJhZ21lbnQsIG51bGwpOworICAgIH0KKyAgICAKKyAgICBwdWJsaWMgRnJhZ21lbnRUcmFuc2FjdGlvbiByZXBsYWNlKGludCBjb250YWluZXJWaWV3SWQsIEZyYWdtZW50IGZyYWdtZW50LCBTdHJpbmcgdGFnKSB7CisgICAgICAgIGlmIChjb250YWluZXJWaWV3SWQgPT0gMCkgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiTXVzdCB1c2Ugbm9uLXplcm8gY29udGFpbmVyVmlld0lkIik7CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIGRvQWRkT3AoY29udGFpbmVyVmlld0lkLCBmcmFnbWVudCwgdGFnLCBPUF9SRVBMQUNFKTsKKyAgICAgICAgcmV0dXJuIHRoaXM7CisgICAgfQorICAgIAorICAgIHB1YmxpYyBGcmFnbWVudFRyYW5zYWN0aW9uIHJlbW92ZShGcmFnbWVudCBmcmFnbWVudCkgeworICAgICAgICBpZiAoZnJhZ21lbnQubUltbWVkaWF0ZUFjdGl2aXR5ID09IG51bGwpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oIkZyYWdtZW50IG5vdCBhZGRlZDogIiArIGZyYWdtZW50KTsKKyAgICAgICAgfQorICAgICAgICBmcmFnbWVudC5tSW1tZWRpYXRlQWN0aXZpdHkgPSBudWxsOworICAgICAgICAKKyAgICAgICAgT3Agb3AgPSBuZXcgT3AoKTsKKyAgICAgICAgb3AuY21kID0gT1BfUkVNT1ZFOworICAgICAgICBvcC5mcmFnbWVudCA9IGZyYWdtZW50OworICAgICAgICBhZGRPcChvcCk7CisgICAgICAgIAorICAgICAgICByZXR1cm4gdGhpczsKKyAgICB9CisKKyAgICBwdWJsaWMgRnJhZ21lbnRUcmFuc2FjdGlvbiBoaWRlKEZyYWdtZW50IGZyYWdtZW50KSB7CisgICAgICAgIGlmIChmcmFnbWVudC5tSW1tZWRpYXRlQWN0aXZpdHkgPT0gbnVsbCkgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiRnJhZ21lbnQgbm90IGFkZGVkOiAiICsgZnJhZ21lbnQpOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICBPcCBvcCA9IG5ldyBPcCgpOworICAgICAgICBvcC5jbWQgPSBPUF9ISURFOworICAgICAgICBvcC5mcmFnbWVudCA9IGZyYWdtZW50OworICAgICAgICBhZGRPcChvcCk7CisgICAgICAgIAorICAgICAgICByZXR1cm4gdGhpczsKKyAgICB9CisgICAgCisgICAgcHVibGljIEZyYWdtZW50VHJhbnNhY3Rpb24gc2hvdyhGcmFnbWVudCBmcmFnbWVudCkgeworICAgICAgICBpZiAoZnJhZ21lbnQubUltbWVkaWF0ZUFjdGl2aXR5ID09IG51bGwpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oIkZyYWdtZW50IG5vdCBhZGRlZDogIiArIGZyYWdtZW50KTsKKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgT3Agb3AgPSBuZXcgT3AoKTsKKyAgICAgICAgb3AuY21kID0gT1BfU0hPVzsKKyAgICAgICAgb3AuZnJhZ21lbnQgPSBmcmFnbWVudDsKKyAgICAgICAgYWRkT3Aob3ApOworICAgICAgICAKKyAgICAgICAgcmV0dXJuIHRoaXM7CisgICAgfQorICAgIAorICAgIHB1YmxpYyBGcmFnbWVudFRyYW5zYWN0aW9uIHNldEN1c3RvbUFuaW1hdGlvbnMoaW50IGVudGVyLCBpbnQgZXhpdCkgeworICAgICAgICBtRW50ZXJBbmltID0gZW50ZXI7CisgICAgICAgIG1FeGl0QW5pbSA9IGV4aXQ7CisgICAgICAgIHJldHVybiB0aGlzOworICAgIH0KKyAgICAKKyAgICBwdWJsaWMgRnJhZ21lbnRUcmFuc2FjdGlvbiBzZXRUcmFuc2l0aW9uKGludCB0cmFuc2l0aW9uKSB7CisgICAgICAgIG1UcmFuc2l0aW9uID0gdHJhbnNpdGlvbjsKKyAgICAgICAgcmV0dXJuIHRoaXM7CisgICAgfQorICAgIAorICAgIHB1YmxpYyBGcmFnbWVudFRyYW5zYWN0aW9uIHNldFRyYW5zaXRpb25TdHlsZShpbnQgc3R5bGVSZXMpIHsKKyAgICAgICAgbVRyYW5zaXRpb25TdHlsZSA9IHN0eWxlUmVzOworICAgICAgICByZXR1cm4gdGhpczsKKyAgICB9CisgICAgCisgICAgcHVibGljIEZyYWdtZW50VHJhbnNhY3Rpb24gYWRkVG9CYWNrU3RhY2soU3RyaW5nIG5hbWUpIHsKKyAgICAgICAgbUFkZFRvQmFja1N0YWNrID0gdHJ1ZTsKKyAgICAgICAgbU5hbWUgPSBuYW1lOworICAgICAgICByZXR1cm4gdGhpczsKKyAgICB9CisKKyAgICB2b2lkIGJ1bXBCYWNrU3RhY2tOZXN0aW5nKGludCBhbXQpIHsKKyAgICAgICAgaWYgKCFtQWRkVG9CYWNrU3RhY2spIHsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorICAgICAgICBpZiAoRnJhZ21lbnRNYW5hZ2VySW1wbC5ERUJVRykgTG9nLnYoVEFHLCAiQnVtcCBuZXN0aW5nIGluICIgKyB0aGlzCisgICAgICAgICAgICAgICAgKyAiIGJ5ICIgKyBhbXQpOworICAgICAgICBPcCBvcCA9IG1IZWFkOworICAgICAgICB3aGlsZSAob3AgIT0gbnVsbCkgeworICAgICAgICAgICAgb3AuZnJhZ21lbnQubUJhY2tTdGFja05lc3RpbmcgKz0gYW10OworICAgICAgICAgICAgaWYgKEZyYWdtZW50TWFuYWdlckltcGwuREVCVUcpIExvZy52KFRBRywgIkJ1bXAgbmVzdGluZyBvZiAiCisgICAgICAgICAgICAgICAgICAgICsgb3AuZnJhZ21lbnQgKyAiIHRvICIgKyBvcC5mcmFnbWVudC5tQmFja1N0YWNrTmVzdGluZyk7CisgICAgICAgICAgICBpZiAob3AucmVtb3ZlZCAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgZm9yIChpbnQgaT1vcC5yZW1vdmVkLnNpemUoKS0xOyBpPj0wOyBpLS0pIHsKKyAgICAgICAgICAgICAgICAgICAgRnJhZ21lbnQgciA9IG9wLnJlbW92ZWQuZ2V0KGkpOworICAgICAgICAgICAgICAgICAgICByLm1CYWNrU3RhY2tOZXN0aW5nICs9IGFtdDsKKyAgICAgICAgICAgICAgICAgICAgaWYgKEZyYWdtZW50TWFuYWdlckltcGwuREVCVUcpIExvZy52KFRBRywgIkJ1bXAgbmVzdGluZyBvZiAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyByICsgIiB0byAiICsgci5tQmFja1N0YWNrTmVzdGluZyk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgb3AgPSBvcC5uZXh0OworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIGludCBjb21taXQoKSB7CisgICAgICAgIGlmIChtQ29tbWl0dGVkKSB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJjb21taXQgYWxyZWFkeSBjYWxsZWQiKTsKKyAgICAgICAgaWYgKEZyYWdtZW50TWFuYWdlckltcGwuREVCVUcpIExvZy52KFRBRywgIkNvbW1pdDogIiArIHRoaXMpOworICAgICAgICBtQ29tbWl0dGVkID0gdHJ1ZTsKKyAgICAgICAgaWYgKG1BZGRUb0JhY2tTdGFjaykgeworICAgICAgICAgICAgbUluZGV4ID0gbU1hbmFnZXIuYWxsb2NCYWNrU3RhY2tJbmRleCh0aGlzKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIG1JbmRleCA9IC0xOworICAgICAgICB9CisgICAgICAgIG1NYW5hZ2VyLmVucXVldWVBY3Rpb24odGhpcyk7CisgICAgICAgIHJldHVybiBtSW5kZXg7CisgICAgfQorICAgIAorICAgIHB1YmxpYyB2b2lkIHJ1bigpIHsKKyAgICAgICAgaWYgKEZyYWdtZW50TWFuYWdlckltcGwuREVCVUcpIExvZy52KFRBRywgIlJ1bjogIiArIHRoaXMpOworICAgICAgICAKKyAgICAgICAgaWYgKG1BZGRUb0JhY2tTdGFjaykgeworICAgICAgICAgICAgaWYgKG1JbmRleCA8IDApIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJhZGRUb0JhY2tTdGFjaygpIGNhbGxlZCBhZnRlciBjb21taXQoKSIpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgYnVtcEJhY2tTdGFja05lc3RpbmcoMSk7CisKKyAgICAgICAgT3Agb3AgPSBtSGVhZDsKKyAgICAgICAgd2hpbGUgKG9wICE9IG51bGwpIHsKKyAgICAgICAgICAgIHN3aXRjaCAob3AuY21kKSB7CisgICAgICAgICAgICAgICAgY2FzZSBPUF9BREQ6IHsKKyAgICAgICAgICAgICAgICAgICAgRnJhZ21lbnQgZiA9IG9wLmZyYWdtZW50OworICAgICAgICAgICAgICAgICAgICBmLm1OZXh0QW5pbSA9IG9wLmVudGVyQW5pbTsKKyAgICAgICAgICAgICAgICAgICAgbU1hbmFnZXIuYWRkRnJhZ21lbnQoZiwgZmFsc2UpOworICAgICAgICAgICAgICAgIH0gYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBPUF9SRVBMQUNFOiB7CisgICAgICAgICAgICAgICAgICAgIEZyYWdtZW50IGYgPSBvcC5mcmFnbWVudDsKKyAgICAgICAgICAgICAgICAgICAgaWYgKG1NYW5hZ2VyLm1BZGRlZCAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGludCBpPTA7IGk8bU1hbmFnZXIubUFkZGVkLnNpemUoKTsgaSsrKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgRnJhZ21lbnQgb2xkID0gbU1hbmFnZXIubUFkZGVkLmdldChpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoRnJhZ21lbnRNYW5hZ2VySW1wbC5ERUJVRykgTG9nLnYoVEFHLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIk9QX1JFUExBQ0U6IGFkZGluZz0iICsgZiArICIgb2xkPSIgKyBvbGQpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvbGQubUNvbnRhaW5lcklkID09IGYubUNvbnRhaW5lcklkKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvcC5yZW1vdmVkID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wLnJlbW92ZWQgPSBuZXcgQXJyYXlMaXN0PEZyYWdtZW50PigpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9wLnJlbW92ZWQuYWRkKG9sZCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9sZC5tTmV4dEFuaW0gPSBvcC5leGl0QW5pbTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1BZGRUb0JhY2tTdGFjaykgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb2xkLm1CYWNrU3RhY2tOZXN0aW5nICs9IDE7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoRnJhZ21lbnRNYW5hZ2VySW1wbC5ERUJVRykgTG9nLnYoVEFHLCAiQnVtcCBuZXN0aW5nIG9mICIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyBvbGQgKyAiIHRvICIgKyBvbGQubUJhY2tTdGFja05lc3RpbmcpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1NYW5hZ2VyLnJlbW92ZUZyYWdtZW50KG9sZCwgbVRyYW5zaXRpb24sIG1UcmFuc2l0aW9uU3R5bGUpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBmLm1OZXh0QW5pbSA9IG9wLmVudGVyQW5pbTsKKyAgICAgICAgICAgICAgICAgICAgbU1hbmFnZXIuYWRkRnJhZ21lbnQoZiwgZmFsc2UpOworICAgICAgICAgICAgICAgIH0gYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBPUF9SRU1PVkU6IHsKKyAgICAgICAgICAgICAgICAgICAgRnJhZ21lbnQgZiA9IG9wLmZyYWdtZW50OworICAgICAgICAgICAgICAgICAgICBmLm1OZXh0QW5pbSA9IG9wLmV4aXRBbmltOworICAgICAgICAgICAgICAgICAgICBtTWFuYWdlci5yZW1vdmVGcmFnbWVudChmLCBtVHJhbnNpdGlvbiwgbVRyYW5zaXRpb25TdHlsZSk7CisgICAgICAgICAgICAgICAgfSBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIE9QX0hJREU6IHsKKyAgICAgICAgICAgICAgICAgICAgRnJhZ21lbnQgZiA9IG9wLmZyYWdtZW50OworICAgICAgICAgICAgICAgICAgICBmLm1OZXh0QW5pbSA9IG9wLmV4aXRBbmltOworICAgICAgICAgICAgICAgICAgICBtTWFuYWdlci5oaWRlRnJhZ21lbnQoZiwgbVRyYW5zaXRpb24sIG1UcmFuc2l0aW9uU3R5bGUpOworICAgICAgICAgICAgICAgIH0gYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBPUF9TSE9XOiB7CisgICAgICAgICAgICAgICAgICAgIEZyYWdtZW50IGYgPSBvcC5mcmFnbWVudDsKKyAgICAgICAgICAgICAgICAgICAgZi5tTmV4dEFuaW0gPSBvcC5lbnRlckFuaW07CisgICAgICAgICAgICAgICAgICAgIG1NYW5hZ2VyLnNob3dGcmFnbWVudChmLCBtVHJhbnNpdGlvbiwgbVRyYW5zaXRpb25TdHlsZSk7CisgICAgICAgICAgICAgICAgfSBicmVhazsKKyAgICAgICAgICAgICAgICBkZWZhdWx0OiB7CisgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oIlVua25vd24gY21kOiAiICsgb3AuY21kKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICAKKyAgICAgICAgICAgIG9wID0gb3AubmV4dDsKKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgbU1hbmFnZXIubW92ZVRvU3RhdGUobU1hbmFnZXIubUN1clN0YXRlLCBtVHJhbnNpdGlvbiwKKyAgICAgICAgICAgICAgICBtVHJhbnNpdGlvblN0eWxlLCB0cnVlKTsKKyAgICAgICAgCisgICAgICAgIGlmIChtQWRkVG9CYWNrU3RhY2spIHsKKyAgICAgICAgICAgIG1NYW5hZ2VyLmFkZEJhY2tTdGFja1N0YXRlKHRoaXMpOworICAgICAgICB9CisgICAgfQorICAgIAorICAgIHB1YmxpYyB2b2lkIHBvcEZyb21CYWNrU3RhY2soYm9vbGVhbiBkb1N0YXRlTW92ZSkgeworICAgICAgICBpZiAoRnJhZ21lbnRNYW5hZ2VySW1wbC5ERUJVRykgTG9nLnYoVEFHLCAicG9wRnJvbUJhY2tTdGFjazogIiArIHRoaXMpOworCisgICAgICAgIGJ1bXBCYWNrU3RhY2tOZXN0aW5nKC0xKTsKKyAgICAgICAgCisgICAgICAgIE9wIG9wID0gbVRhaWw7CisgICAgICAgIHdoaWxlIChvcCAhPSBudWxsKSB7CisgICAgICAgICAgICBzd2l0Y2ggKG9wLmNtZCkgeworICAgICAgICAgICAgICAgIGNhc2UgT1BfQUREOiB7CisgICAgICAgICAgICAgICAgICAgIEZyYWdtZW50IGYgPSBvcC5mcmFnbWVudDsKKyAgICAgICAgICAgICAgICAgICAgZi5tSW1tZWRpYXRlQWN0aXZpdHkgPSBudWxsOworICAgICAgICAgICAgICAgICAgICBtTWFuYWdlci5yZW1vdmVGcmFnbWVudChmLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZyYWdtZW50TWFuYWdlckltcGwucmV2ZXJzZVRyYW5zaXQobVRyYW5zaXRpb24pLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1UcmFuc2l0aW9uU3R5bGUpOworICAgICAgICAgICAgICAgIH0gYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBPUF9SRVBMQUNFOiB7CisgICAgICAgICAgICAgICAgICAgIEZyYWdtZW50IGYgPSBvcC5mcmFnbWVudDsKKyAgICAgICAgICAgICAgICAgICAgZi5tSW1tZWRpYXRlQWN0aXZpdHkgPSBudWxsOworICAgICAgICAgICAgICAgICAgICBtTWFuYWdlci5yZW1vdmVGcmFnbWVudChmLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZyYWdtZW50TWFuYWdlckltcGwucmV2ZXJzZVRyYW5zaXQobVRyYW5zaXRpb24pLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1UcmFuc2l0aW9uU3R5bGUpOworICAgICAgICAgICAgICAgICAgICBpZiAob3AucmVtb3ZlZCAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGludCBpPTA7IGk8b3AucmVtb3ZlZC5zaXplKCk7IGkrKykgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZyYWdtZW50IG9sZCA9IG9wLnJlbW92ZWQuZ2V0KGkpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYubUltbWVkaWF0ZUFjdGl2aXR5ID0gbU1hbmFnZXIubUFjdGl2aXR5OworICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1NYW5hZ2VyLmFkZEZyYWdtZW50KG9sZCwgZmFsc2UpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfSBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIE9QX1JFTU9WRTogeworICAgICAgICAgICAgICAgICAgICBGcmFnbWVudCBmID0gb3AuZnJhZ21lbnQ7CisgICAgICAgICAgICAgICAgICAgIGYubUltbWVkaWF0ZUFjdGl2aXR5ID0gbU1hbmFnZXIubUFjdGl2aXR5OworICAgICAgICAgICAgICAgICAgICBtTWFuYWdlci5hZGRGcmFnbWVudChmLCBmYWxzZSk7CisgICAgICAgICAgICAgICAgfSBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIE9QX0hJREU6IHsKKyAgICAgICAgICAgICAgICAgICAgRnJhZ21lbnQgZiA9IG9wLmZyYWdtZW50OworICAgICAgICAgICAgICAgICAgICBtTWFuYWdlci5zaG93RnJhZ21lbnQoZiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBGcmFnbWVudE1hbmFnZXJJbXBsLnJldmVyc2VUcmFuc2l0KG1UcmFuc2l0aW9uKSwgbVRyYW5zaXRpb25TdHlsZSk7CisgICAgICAgICAgICAgICAgfSBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIE9QX1NIT1c6IHsKKyAgICAgICAgICAgICAgICAgICAgRnJhZ21lbnQgZiA9IG9wLmZyYWdtZW50OworICAgICAgICAgICAgICAgICAgICBtTWFuYWdlci5oaWRlRnJhZ21lbnQoZiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBGcmFnbWVudE1hbmFnZXJJbXBsLnJldmVyc2VUcmFuc2l0KG1UcmFuc2l0aW9uKSwgbVRyYW5zaXRpb25TdHlsZSk7CisgICAgICAgICAgICAgICAgfSBicmVhazsKKyAgICAgICAgICAgICAgICBkZWZhdWx0OiB7CisgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oIlVua25vd24gY21kOiAiICsgb3AuY21kKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICAKKyAgICAgICAgICAgIG9wID0gb3AucHJldjsKKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgaWYgKGRvU3RhdGVNb3ZlKSB7CisgICAgICAgICAgICBtTWFuYWdlci5tb3ZlVG9TdGF0ZShtTWFuYWdlci5tQ3VyU3RhdGUsCisgICAgICAgICAgICAgICAgICAgIEZyYWdtZW50TWFuYWdlckltcGwucmV2ZXJzZVRyYW5zaXQobVRyYW5zaXRpb24pLCBtVHJhbnNpdGlvblN0eWxlLCB0cnVlKTsKKyAgICAgICAgfQorCisgICAgICAgIGlmIChtSW5kZXggPj0gMCkgeworICAgICAgICAgICAgbU1hbmFnZXIuZnJlZUJhY2tTdGFja0luZGV4KG1JbmRleCk7CisgICAgICAgICAgICBtSW5kZXggPSAtMTsKKyAgICAgICAgfQorICAgIH0KKyAgICAKKyAgICBwdWJsaWMgU3RyaW5nIGdldE5hbWUoKSB7CisgICAgICAgIHJldHVybiBtTmFtZTsKKyAgICB9CisgICAgCisgICAgcHVibGljIGludCBnZXRUcmFuc2l0aW9uKCkgeworICAgICAgICByZXR1cm4gbVRyYW5zaXRpb247CisgICAgfQorICAgIAorICAgIHB1YmxpYyBpbnQgZ2V0VHJhbnNpdGlvblN0eWxlKCkgeworICAgICAgICByZXR1cm4gbVRyYW5zaXRpb25TdHlsZTsKKyAgICB9Cit9CmRpZmYgLS1naXQgYS9jb3JlL2phdmEvYW5kcm9pZC9hcHAvQ29udGV4dEltcGwuamF2YSBiL2NvcmUvamF2YS9hbmRyb2lkL2FwcC9Db250ZXh0SW1wbC5qYXZhCmluZGV4IDc1MTM3MzYuLjY4ODZhYmEgMTAwNjQ0Ci0tLSBhL2NvcmUvamF2YS9hbmRyb2lkL2FwcC9Db250ZXh0SW1wbC5qYXZhCisrKyBiL2NvcmUvamF2YS9hbmRyb2lkL2FwcC9Db250ZXh0SW1wbC5qYXZhCkBAIC01NiwxMSArNTYsMTQgQEAKIGltcG9ydCBhbmRyb2lkLmNvbnRlbnQucmVzLkFzc2V0TWFuYWdlcjsKIGltcG9ydCBhbmRyb2lk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Q291bnRyeURldGVjdG9yKCkgeworICAgICAgICBzeW5jaHJvbml6ZWQgKHNTeW5jKSB7CisgICAgICAgICAgICBpZiAoc0NvdW50cnlEZXRlY3RvciA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgSUJpbmRlciBiID0gU2VydmljZU1hbmFnZXIuZ2V0U2VydmljZShDT1VOVFJZX0RFVEVDVE9SKTsKKyAgICAgICAgICAgICAgICBJQ291bnRyeURldGVjdG9yIHNlcnZpY2UgPSBJQ291bnRyeURldGVjdG9yLlN0dWIuYXNJbnRlcmZhY2UoYik7CisgICAgICAgICAgICAgICAgc0NvdW50cnlEZXRlY3RvciA9IG5ldyBDb3VudHJ5RGV0ZWN0b3Ioc2VydmljZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHNDb3VudHJ5RGV0ZWN0b3I7CisgICAgfQorCiAgICAgcHJpdmF0ZSBTZWFyY2hNYW5hZ2VyIGdldFNlYXJjaE1hbmFnZXIoKSB7CiAgICAgICAgIHN5bmNocm9uaXplZCAobVN5bmMpIHsKICAgICAgICAgICAgIGlmIChtU2VhcmNoTWFuYWdlciA9PSBudWxsKSB7CkBAIC0xNDgzLDggKzE0OTUsNiBAQAogICAgIH0KIAogICAgIENvbnRleHRJbXBsKCkgewotICAgICAgICAvLyBGb3IgZGVidWcgb25seQotICAgICAgICAvLysrc0luc3RhbmNlQ291bnQ7CiAgICAgICAgIG1PdXRlckNvbnRleHQgPSB0aGlzOwogICAgIH0KIApAQCAtMTQ5NSw3ICsxNTA1LDYgQEAKICAgICAgKiBAcGFyYW0gY29udGV4dCBFeGlzdGluZyBhcHBsaWNhdGlvbiBjb250ZXh0LgogICAgICAqLwogICAgIHB1YmxpYyBDb250ZXh0SW1wbChDb250ZXh0SW1wbCBjb250ZXh0KSB7Ci0gICAgICAgICsrc0luc3RhbmNlQ291bnQ7CiAgICAgICAgIG1QYWNrYWdlSW5mbyA9IGNvbnRleHQubVBhY2thZ2VJbmZvOwogICAgICAgICBtUmVzb3VyY2VzID0gY29udGV4dC5tUmVzb3VyY2VzOwogICAgICAgICBtTWFpblRocmVhZCA9IGNvbnRleHQubU1haW5UaHJlYWQ7CkBAIC0yNzc3LDYgKzI3ODYsMTMgQEAKICAgICAgICAgICAgICAgICByZXR1cm4gdiAhPSBudWxsID8gdiA6IGRlZlZhbHVlOwogICAgICAgICAgICAgfQogICAgICAgICB9CisgICAgICAgIAorICAgICAgICBwdWJsaWMgU2V0PFN0cmluZz4gZ2V0U3RyaW5nU2V0KFN0cmluZyBrZXksIFNldDxTdHJpbmc+IGRlZlZhbHVlcykgeworICAgICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CisgICAgICAgICAgICAgICAgU2V0PFN0cmluZz4gdiA9IChTZXQ8U3RyaW5nPikgbU1hcC5nZXQoa2V5KTsKKyAgICAgICAgICAgICAgICByZXR1cm4gdiAhPSBudWxsID8gdiA6IGRlZlZhbHVlczsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQogCiAgICAgICAgIHB1YmxpYyBpbnQgZ2V0SW50KFN0cmluZyBrZXksIGludCBkZWZWYWx1ZSkgewogICAgICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CkBAIC0yODM4LDYgKzI4NTQsMTIgQEAKICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQorICAgICAgICAgICAgcHVibGljIEVkaXRvciBwdXRTdHJpbmdTZXQoU3RyaW5nIGtleSwgU2V0PFN0cmluZz4gdmFsdWVzKSB7CisgICAgICAgICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CisgICAgICAgICAgICAgICAgICAgIG1Nb2RpZmllZC5wdXQoa2V5LCB2YWx1ZXMpOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpczsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CiAgICAgICAgICAgICBwdWJsaWMgRWRpdG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udWxsKSB7CisgICAgICAgICAgICAgICAgaWYgKG1XaW5kb3cuaGFzRmVhdHVyZShXaW5kb3cuRkVBVFVSRV9BQ1RJT05fQkFSKSkgeworICAgICAgICAgICAgICAgICAgICBtV2luZG93LmludmFsaWRhdGVQYW5lbE1lbnUoV2luZG93LkZFQVRVUkVfQUNUSU9OX0JBUik7CisgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIG1EZWNvci5zZXRWaXNpYmlsaXR5KFZpZXcuVklTSUJMRSk7CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICByZXR1cm47CkBAIC0yMjcsNiArMjQyLDExIEBACiAKICAgICAgICAgb25TdGFydCgpOwogICAgICAgICBtRGVjb3IgPSBtV2luZG93LmdldERlY29yVmlldygpOworCisgICAgICAgIGlmIChtQWN0aW9uQmFyID09IG51bGwgJiYgbVdpbmRvdy5oYXNGZWF0dXJlKFdpbmRvdy5GRUFUVVJFX0FDVElPTl9CQVIpKSB7CisgICAgICAgICAgICBtQWN0aW9uQmFyID0gbmV3IEFjdGlvbkJhckltcGwodGhpcyk7CisgICAgICAgIH0KKwogICAgICAgICBXaW5kb3dNYW5hZ2VyLkxheW91dFBhcmFtcyBsID0gbVdpbmRvdy5nZXRBdHRyaWJ1dGVzKCk7CiAgICAgICAgIGlmICgobC5zb2Z0SW5wdXRNb2RlCiAgICAgICAgICAgICAgICAgJiBXaW5kb3dNYW5hZ2VyLkxheW91dFBhcmFtcy5TT0ZUX0lOUFVUX0lTX0ZPUldBUkRfTkFWSUdBVElPTikgPT0gMCkgewpAQCAtMzEwLDcgKzMzMCw3IEBACiAgICAgfQogCiAgICAgLyoqCi0gICAgICogU2ltaWxhciB0byB7QGxpbmsgQWN0aXZpdHkjb25DcmVhdGV9LCB5b3Ugc2hvdWxkIGluaXRpYWxpemVkIHlvdXIgZGlhbG9nCisgICAgICogU2ltaWxhciB0byB7QGxpbmsgQWN0aXZpdHkjb25DcmVhdGV9LCB5b3Ugc2hvdWxkIGluaX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aGUgZnJhZ21lbnQuCisgICAgICovCisgICAgcHVibGljIHZvaWQgZGlzbWlzcygpIHsKKyAgICAgICAgaWYgKG1EaWFsb2cgIT0gbnVsbCkgeworICAgICAgICAgICAgbURpYWxvZy5kaXNtaXNzKCk7CisgICAgICAgICAgICBtRGlhbG9nID0gbnVsbDsKKyAgICAgICAgfQorICAgICAgICBtUmVtb3ZlZCA9IHRydWU7CisgICAgICAgIGlmIChtQmFja1N0YWNrSWQgPj0gMCkgeworICAgICAgICAgICAgZ2V0RnJhZ21lbnRNYW5hZ2VyKCkucG9wQmFja1N0YWNrKG1CYWNrU3RhY2tJZCwKKyAgICAgICAgICAgICAgICAgICAgRnJhZ21lbnRNYW5hZ2VyLlBPUF9CQUNLX1NUQUNLX0lOQ0xVU0lWRSk7CisgICAgICAgICAgICBtQmFja1N0YWNrSWQgPSAtMTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIEZyYWdtZW50VHJhbnNhY3Rpb24gZnQgPSBnZXRGcmFnbWVudE1hbmFnZXIoKS5vcGVuVHJhbnNhY3Rpb24oKTsKKyAgICAgICAgICAgIGZ0LnJlbW92ZSh0aGlzKTsKKyAgICAgICAgICAgIGZ0LmNvbW1pdCgpOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIERpYWxvZyBnZXREaWFsb2coKSB7CisgICAgICAgIHJldHVybiBtRGlhbG9nOworICAgIH0KKworICAgIHB1YmxpYyBpbnQgZ2V0VGhlbWUoKSB7CisgICAgICAgIHJldHVybiBtVGhlbWU7CisgICAgfQorCisgICAgLyoqCisgICAgICogQ29udHJvbCB3aGV0aGVyIHRoZSBzaG93biBEaWFsb2cgaXMgY2FuY2VsYWJsZS4gIFVzZSB0aGlzIGluc3RlYWQgb2YKKyAgICAgKiBkaXJlY3RseSBjYWxsaW5nIHtAbGluayBEaWFsb2cjc2V0Q2FuY2VsYWJsZShib29sZWFuKQorICAgICAqIERpYWxvZy5zZXRDYW5jZWxhYmxlKGJvb2x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gZGlhbG9nKSB7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgb25EaXNtaXNzKERpYWxvZ0ludGVyZmFjZSBkaWFsb2cpIHsKKyAgICAgICAgaWYgKCFtUmVtb3ZlZCkgeworICAgICAgICAgICAgZGlzbWlzcygpOworICAgICAgICB9CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgb25BY3Rpdml0eUNyZWF0ZWQoQnVuZGxlIHNhdmVkSW5zdGFuY2VTdGF0ZSkgeworICAgICAgICBzdXBlci5vbkFjdGl2aXR5Q3JlYXRlZChzYXZlZEluc3RhbmNlU3RhdGUpOworCisgICAgICAgIGlmICghbVNob3dzRGlhbG9nKSB7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKworICAgICAgICBtRGlhbG9nID0gb25DcmVhdGVEaWFsb2coc2F2ZWRJbnN0YW5jZVN0YXRlKTsKKyAgICAgICAgbURlc3Ryb3llZCA9IGZhbHNlOworICAgICAgICBzd2l0Y2ggKG1TdHlsZSkgeworICAgICAgICAgICAgY2FzZSBTVFlMRV9OT19JTlBVVDoKKyAgICAgICAgICAgICAgICBtRGlhbG9nLmdldFdpbmRvdygpLmFkZEZsYWdzKAorICAgICAgICAgICAgICAgICAgICAgICAgV2luZG93TWFuYWdlci5MYXlvdXRQYXJhbXMuRkxBR19OT1RfRk9DVVNBQkxFIHwKKyAgICAgICAgICAgICAgICAgICAgICAgIFdpbmRvd01hbmFnZXIuTGF5b3V0UGFyYW1zLkZMQUdfTk9UX1RPVUNIQUJMRSk7CisgICAgICAgICAgICAgICAgLy8gZmFsbCB0aHJvdWdoLi4uCisgICAgICAgICAgICBjYXNlIFNUWUxFX05PX0ZSQU1FOgorICAgICAgICAgICAgY2FzZSBTVFlMRV9OT19USVRMRToKKyAgICAgICAgICAgICAgICBtRGlhbG9nLnJlcXVlc3RXaW5kb3dGZWF0dXJlKFdpbmRvdy5GRUFUVVJFX05PX1RJVExFKTsKKyAgICAgICAgfQorICAgICAgICBWaWV3IHZpZXcgPSBnZXRWaWV3KCk7CisgICAgICAgIGlmICh2aWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgIGlmICh2aWV3LmdldFBhcmVudCgpICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJEaWFsb2dGcmFnbWVudCBjYW4gbm90IGJlIGF0dGFjaGVkIHRvIGEgY29udGFpbmVyIHZpZXciKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1EaWFsb2cuc2V0Q29udGVudFZpZXcodmlldyk7CisgICAgICAgIH0KKyAgICAgICAgbURpYWxvZy5zZXRPd25lckFjdGl2aXR5KGdldEFjdGl2aXR5KCkpOworICAgICAgICBtRGlhbG9nLnNldENhbmNlbGFibGUobUNhbmNlbGFibGUpOworICAgICAgICBtRGlhbG9nLnNldE9uQ2FuY2VsTGlzdGVuZXIodGhpcyk7CisgICAgICAgIG1EaWFsb2cuc2V0T25EaXNtaXNzTGlzdGVuZXIodGhpcyk7CisgICAgICAgIGlmIChzYXZlZEluc3RhbmNlU3RhdGUgIT0gbnVsbCkgeworICAgICAgICAgICAgQnVuZGxlIGRpYWxvZ1N0YXRlID0gc2F2ZWRJbnN0YW5jZVN0YXRlLmdldEJ1bmRsZShTQVZFRF9ESUFMT0dfU1RBVEVfVEFHKTsKKyAgICAgICAgICAgIGlmIChkaWFsb2dTdGF0ZSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgbURpYWxvZy5vblJlc3RvcmVJbnN0YW5jZVN0YXRlKGRpYWxvZ1N0YXRlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIG9uU3RhcnQoKSB7CisgICAgICAgIHN1cGVyLm9uU3RhcnQoKTsKKyAgICAgICAgaWYgKG1EaWFsb2cgIT0gbnVsbCkgeworICAgICAgICAgICAgbVJlbW92ZWQgPSBmYWxzZTsKKyAgICAgICAgICAgIG1EaWFsb2cuc2hvdygpOworICAgICAgICB9CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgb25TYXZlSW5zdGFuY2VTdGF0ZShCdW5kbGUgb3V0U3RhdGUpIHsKKyAgICAgICAgc3VwZXIub25TYXZlSW5zdGFuY2VTdGF0ZShvdXRTdGF0ZSk7CisgICAgICAgIGlmIChtRGlhbG9nICE9IG51bGwpIHsKKyAgICAgICAgICAgIEJ1bmRsZSBkaWFsb2dTdGF0ZSA9IG1EaWFsb2cub25TYXZlSW5zdGFuY2VTdGF0ZSgpOworICAgICAgICAgICAgaWYgKGRpYWxvZ1N0YXRlICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBvdXRTdGF0ZS5wdXRCdW5kbGUoU0FWRURfRElBTE9HX1NUQVRFX1RBRywgZGlhbG9nU3RhdGUpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGlmIChtU3R5bGUgIT0gU1RZTEVfTk9STUFMKSB7CisgICAgICAgICAgICBvdXRTdGF0ZS5wdXRJbnQoU0FWRURfU1RZTEUsIG1TdHlsZSk7CisgICAgICAgIH0KKyAgICAgICAgaWYgKG1UaGVtZSAhPSAwKSB7CisgICAgICAgICAgICBvdXRTdGF0ZS5wdXRJbnQoU0FWRURfVEhFTUUsIG1UaGVtZSk7CisgICAgICAgIH0KKyAgICAgICAgaWYgKCFtQ2FuY2VsYWJsZSkgeworICAgICAgICAgICAgb3V0U3RhdGUucHV0Qm9vbGVhbihTQVZFRF9DQU5DRUxBQkxFLCBtQ2FuY2VsYWJsZSk7CisgICAgICAgIH0KKyAgICAgICAgaWYgKCFtU2hvd3NEaWFsb2cpIHsKKyAgICAgICAgICAgIG91dFN0YXRlLnB1dEJvb2xlYW4oU0FWRURfU0hPV1NfRElBTE9HLCBtU2hvd3NEaWFsb2cpOworICAgICAgICB9CisgICAgICAgIGlmIChtQmFja1N0YWNrSWQgIT0gLTEpIHsKKyAgICAgICAgICAgIG91dFN0YXRlLnB1dEludChTQVZFRF9CQUNLX1NUQUNLX0lELCBtQmFja1N0YWNrSWQpOworICAgICAgICB9CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgb25TdG9wKCkgeworICAgICAgICBzdXBlci5vblN0b3AoKTsKKyAgICAgICAgaWYgKG1EaWFsb2cgIT0gbnVsbCkgeworICAgICAgICAgICAgbURpYWxvZy5oaWRlKCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZW1vdmUgZGlhbG9nLgorICAgICAqLworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIG9uRGVzdHJveVZpZXcoKSB7CisgICAgICAgIHN1cGVyLm9uRGVzdHJveVZpZXcoKTsKKyAgICAgICAgbURlc3Ryb3llZCA9IHRydWU7CisgICAgICAgIGlmIChtRGlhbG9nICE9IG51bGwpIHsKKyAgICAgICAgICAgIC8vIFNldCByZW1vdmVkIGhlcmUgYmVjYXVzZSB0aGlzIGRpc21pc3NhbCBpcyBqdXN0IHRvIGhpZGUKKyAgICAgICAgICAgIC8vIHRoZSBkaWFsb2cgLS0gd2UgZG9uJ3Qgd2FudCB0aGlzIHRvIGNhdXNlIHRoZSBmcmFnbWVudCB0bworICAgICAgICAgICAgLy8gYWN0dWFsbHkgYmUgcmVtb3ZlZC4KKyAgICAgICAgICAgIG1SZW1vdmVkID0gdHJ1ZTsKKyAgICAgICAgICAgIG1EaWFsb2cuZGlzbWlzcygpOworICAgICAgICAgICAgbURpYWxvZyA9IG51bGw7CisgICAgICAgIH0KKyAgICB9Cit9CmRpZmYgLS1naXQgYS9jb3JlL2phdmEvYW5kcm9pZC9hcHAvRnJhZ21lbnQuamF2YSBiL2NvcmUvamF2YS9hbmRyb2lkL2FwcC9GcmFnbWVudC5qYXZhCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLjU2Y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mFsIGludCBtSW5kZXg7CisgICAgZmluYWwgYm9vbGVhbiBtRnJvbUxheW91dDsKKyAgICBmaW5hbCBpbnQgbUZyYWdtZW50SWQ7CisgICAgZmluYWwgaW50IG1Db250YWluZXJJZDsKKyAgICBmaW5hbCBTdHJpbmcgbVRhZzsKKyAgICBmaW5hbCBib29sZWFuIG1SZXRhaW5JbnN0YW5jZTsKKyAgICBmaW5hbCBCdW5kbGUgbUFyZ3VtZW50czsKKyAgICAKKyAgICBCdW5kbGUgbVNhdmVkRnJhZ21lbnRTdGF0ZTsKKyAgICAKKyAgICBGcmFnbWVudCBtSW5zdGFuY2U7CisgICAgCisgICAgcHVibGljIEZyYWdtZW50U3RhdGUoRnJhZ21lbnQgZnJhZykgeworICAgICAgICBtQ2xhc3NOYW1lID0gZnJhZy5nZXRDbGFzcygpLmdldE5hbWUoKTsKKyAgICAgICAgbUluZGV4ID0gZnJhZy5tSW5kZXg7CisgICAgICAgIG1Gcm9tTGF5b3V0ID0gZnJhZy5tRnJvbUxheW91dDsKKyAgICAgICAgbUZyYWdtZW50SWQgPSBmcmFnLm1GcmFnbWVudElkOworICAgICAgICBtQ29udGFpbmVySWQgPSBmcmFnLm1Db250YWluZXJJZDsKKyAgICAgICAgbVRhZyA9IGZyYWcubVRhZzsKKyAgICAgICAgbVJldGFpbkluc3RhbmNlID0gZnJhZy5tUmV0YWluSW5zdGFuY2U7CisgICAgICAgIG1Bcmd1bWVudHMgPSBmcmFnLm1Bcmd1bWVudHM7CisgICAgfQorICAgIAorICAgIHB1YmxpYyBGcmFnbWVudFN0YXRlKFBhcmNlbCBpbikgeworICAgICAgICBtQ2xhc3NOYW1lID0gaW4ucmVhZFN0cmluZygpOworICAgICAgICBtSW5kZXggPSBpbi5yZWFkSW50KCk7CisgICAgICAgIG1Gcm9tTGF5b3V0ID0gaW4ucmVhZEludCgpICE9IDA7CisgICAgICAgIG1GcmFnbWVudElkID0gaW4ucmVhZEludCgpOworICAgICAgICBtQ29udGFpbmVySWQgPSBpbi5yZWFkSW50KCk7CisgICAgICAgIG1UYWcgPSBpbi5yZWFkU3RyaW5nKCk7CisgICAgICAgIG1SZXRhaW5JbnN0YW5jZSA9IGluLnJlYWRJbnQoKSAhPSAwOworICAgICAgICBtQXJndW1lbnRzID0gaW4ucmVhZEJ1bmRsZSgpOworICAgICAgICBtU2F2ZWRGcmFnbWVudFN0YXRlID0gaW4ucmVhZEJ1bmRsZSgpOworICAgIH0KKyAgICAKKyAgICBwdWJsaWMgRnJhZ21lbnQgaW5zdGFudGlhdGUoQWN0aXZpdHkgYWN0aXZpdHkpIHsKKyAgICAgICAgaWYgKG1JbnN0YW5jZSAhPSBudWxsKSB7CisgICAgICAgICAgICByZXR1cm4gbUluc3RhbmNlOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICBtSW5zdGFuY2UgPSBGcmFnbWVudC5pbnN0YW50aWF0ZShhY3Rpdml0eSwgbUNsYXNzTmFtZSwgbUFyZ3VtZW50cyk7CisgICAgICAgIAorICAgICAgICBpZiAobVNhdmVkRnJhZ21lbnRTdGF0ZSAhPSBudWxsKSB7CisgICAgICAgICAgICBtU2F2ZWRGcmFnbWVudFN0YXRlLnNldENsYXNzTG9hZGVyKGFjdGl2aXR5LmdldENsYXNzTG9hZGVyKCkpOworICAgICAgICAgICAgbUluc3RhbmNlLm1TYXZlZEZyYWdtZW50U3RhdGUgPSBtU2F2ZWRGcmFnbWVudFN0YXRlOworICAgICAgICB9CisgICAgICAgIG1JbnN0YW5jZS5zZXRJbmRleChtSW5kZXgpOworICAgICAgICBtSW5zdGFuY2UubUZyb21MYXlvdXQgPSBtRnJvbUxheW91dDsKKyAgICAgICAgbUluc3RhbmNlLm1GcmFnbWVudElkID0gbUZyYWdtZW50SWQ7CisgICAgICAgIG1JbnN0YW5jZS5tQ29udGFpbmVySWQgPSBtQ29udGFpbmVySWQ7CisgICAgICAgIG1JbnN0YW5jZS5tVGFnID0gbVRhZzsKKyAgICAgICAgbUluc3RhbmNlLm1SZXRhaW5JbnN0YW5jZSA9IG1SZXRhaW5JbnN0YW5jZTsKKyAgICAgICAgCisgICAgICAgIHJldHVybiBtSW5zdGFuY2U7CisgICAgfQorICAgIAorICAgIHB1YmxpYyBpbnQgZGVzY3JpYmVDb250ZW50cygpIHsKKyAgICAgICAgcmV0dXJuIDA7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgd3JpdGVUb1BhcmNlbChQYXJjZWwgZGVzdCwgaW50IGZsYWdzKSB7CisgICAgICAgIGRlc3Qud3JpdGVTdHJpbmcobUNsYXNzTmFtZSk7CisgICAgICAgIGRlc3Qud3JpdGVJbnQobUluZGV4KTsKKyAgICAgICAgZGVzdC53cml0ZUludChtRnJvbUxheW91dCA/IDEgOiAwKTsKKyAgICAgICAgZGVzdC53cml0ZUludChtRnJhZ21lbnRJZCk7CisgICAgICAgIGRlc3Qud3JpdGVJbnQobUNvbnRhaW5lcklkKTsKKyAgICAgICAgZGVzdC53cml0ZVN0cmluZyhtVGFnKTsKKyAgICAgICAgZGVzdC53cml0ZUludChtUmV0YWluSW5zdGFuY2UgPyAxIDogMCk7CisgICAgICAgIGRlc3Qud3JpdGVCdW5kbGUobUFyZ3VtZW50cyk7CisgICAgICAgIGRlc3Qud3JpdGVCdW5kbGUobVNhdmVkRnJhZ21lbnRTdGF0ZSk7CisgICAgfQorICAgIAorICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgUGFyY2VsYWJsZS5DcmVhdG9yPEZyYWdtZW50U3RhdGU+IENSRUFUT1IKKyAgICAgICAgICAgID0gbmV3IFBhcmNlbGFibGUuQ3JlYXRvcjxGcmFnbWVudFN0YXRlPigpIHsKKyAgICAgICAgcHVibGljIEZyYWdtZW50U3RhdGUgY3JlYXRlRnJvbVBhcmNlbChQYXJjZWwgaW4pIHsKKyAgICAgICAgICAgIHJldHVybiBuZXcgRnJhZ21lbnRTdGF0ZShpbik7CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIHB1YmxpYyBGcmFnbWVudFN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dHJ5IHRvIGFkZCBpdAorICAgICAgICAgICAgICAgIGNsYXp6ID0gY29udGV4dC5nZXRDbGFzc0xvYWRlcigpLmxvYWRDbGFzcyhmbmFtZSk7CisgICAgICAgICAgICAgICAgc0NsYXNzTWFwLnB1dChmbmFtZSwgY2xhenopOworICAgICAgICAgICAgfQorICAgICAgICAgICAgRnJhZ21lbnQgZiA9IChGcmFnbWVudCljbGF6ei5uZXdJbnN0YW5jZSgpOworICAgICAgICAgICAgaWYgKGFyZ3MgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGFyZ3Muc2V0Q2xhc3NMb2FkZXIoZi5nZXRDbGFzcygpLmdldENsYXNzTG9hZGVyKCkpOworICAgICAgICAgICAgICAgIGYubUFyZ3VtZW50cyA9IGFyZ3M7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gZjsKKyAgICAgICAgfSBjYXRjaCAoQ2xhc3NOb3RGb3VuZEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgSW5zdGFudGlhdGlvbkV4Y2VwdGlvbigiVW5hYmxlIHRvIGluc3RhbnRpYXRlIGZyYWdtZW50ICIgKyBmbmFtZQorICAgICAgICAgICAgICAgICAgICArICI6IG1ha2Ugc3VyZSBjbGFzcyBuYW1lIGV4aXN0cywgaXMgcHVibGljLCBhbmQgaGFzIGFuIgorICAgICAgICAgICAgICAgICAgICArICIgZW1wdHkgY29uc3RydWN0b3IgdGhhdCBpcyBwdWJsaWMiLCBlKTsKKyAgICAgICAgfSBjYXRjaCAoamF2YS5sYW5nLkluc3RhbnRpYXRpb25FeGNlcHRpb24gZSkgeworICAgICAgICAgICAgdGhyb3cgbmV3IEluc3RhbnRpYXRpb25FeGNlcHRpb24oIlVuYWJsZSB0byBpbnN0YW50aWF0ZSBmcmFnbWVudCAiICsgZm5hbWUKKyAgICAgICAgICAgICAgICAgICAgKyAiOiBtYWtlIHN1cmUgY2xhc3MgbmFtZSBleGlzdHMsIGlzIHB1YmxpYywgYW5kIGhhcyBhbiIKKyAgICAgICAgICAgICAgICAgICAgKyAiIGVtcHR5IGNvbnN0cnVjdG9yIHRoYXQgaXMgcHVibGljIiwgZSk7CisgICAgICAgIH0gY2F0Y2ggKElsbGVnYWxBY2Nlc3NFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgdGhyb3cgbmV3IEluc3RhbnRpYXRpb25FeGNlcHRpb24oIlVuYWJsZSB0byBpbnN0YW50aWF0ZSBmcmFnbWVudCAiICsgZm5hbWUKKyAgICAgICAgICAgICAgICAgICAgKyAiOiBtYWtlIHN1cmUgY2xhc3MgbmFtZSBleGlzdHMsIGlzIHB1YmxpYywgYW5kIGhhcyBhbiIKKyAgICAgICAgICAgICAgICAgICAgKyAiIGVtcHR5IGNvbnN0cnVjdG9yIHRoYXQgaXMgcHVibGljIiwgZSk7CisgICAgICAgIH0KKyAgICB9CisgICAgCisgICAgdm9pZCByZXN0b3JlVmlld1N0YXRlKCkgeworICAgICAgICBpZiAobVNhdmVkVmlld1N0YXRlICE9IG51bGwpIHsKKyAgICAgICAgICAgIG1WaWV3LnJlc3RvcmVIaWVyYXJjaHlTdGF0ZShtU2F2ZWRWaWV3U3RhdGUpOworICAgICAgICAgICAgbVNhdmVkVmlld1N0YXRlID0gbnVsbDsKKyAgICAgICAgfQorICAgIH0KKyAgICAKKyAgICB2b2lkIHNldEluZGV4KGludCBpbmRleCkgeworICAgICAgICBtSW5kZXggPSBpbmRleDsKKyAgICAgICAgbVdobyA9ICJhbmRyb2lkOmZyYWdtZW50OiIgKyBtSW5kZXg7CisgICB9CisgICAgCisgICAgdm9pZCBjbGVhckluZGV4KCkgeworICAgICAgICBtSW5kZXggPSAtMTsKKyAgICAgICAgbVdobyA9IG51bGw7CisgICAgfQorICAgIAorICAgIC8qKgorICAgICAqIFN1YmNsYXNzZXMgY2FuIG5vdCBvdmVycmlkZSBlcXVhbHMoKS4KKyAgICAgKi8KKyAgICBAT3ZlcnJpZGUgZmluYWwgcHVibGljIGJvb2xlYW4gZXF1YWxzKE9iamVjdCBvKSB7CisgICAgICAgIHJldHVybiBzdXBlci5lcXVhbHMobyk7CisgICAgfQorCisgICAgLyoqCisgICAgICogU3ViY2xhc3NlcyBjYW4gbm90IG92ZXJyaWRlIGhhc2hDb2RlKCkuCisgICAgICovCisgICAgQE92ZXJyaWRlIGZpbmFsIHB1YmxpYyBpbnQgaGFzaENvZGUoKSB7CisgICAgICAgIHJldHVybiBzdXBlci5oYXNoQ29kZSgpOworICAgIH0KKyAgICAKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgU3RyaW5nIHRvU3RyaW5nKCkgeworICAgICAgICBTdHJpbmdCdWlsZGVyIHNiID0gbmV3IFN0cmluZ0J1aWxkZXIoMTI4KTsKKyAgICAgICAgc2IuYXBwZW5kKCJGcmFnbWVudHsiKTsKKyAgICAgICAgc2IuYXBwZW5kKEludGVnZXIudG9IZXhTdHJpbmcoU3lzdGVtLmlkZW50aXR5SGFzaENvZGUodGhpcykpKTsKKyAgICAgICAgaWYgKG1JbmRleCA+PSAwKSB7CisgICAgICAgICAgICBzYi5hcHBlbmQoIiAjIik7CisgICAgICAgICAgICBzYi5hcHBlbmQobUluZGV4KTsKKyAgICAgICAgfQorICAgICAgICBpZiAobUZyYWdtZW50SWQgIT0gMCkgeworICAgICAgICAgICAgc2IuYXBwZW5kKCIgaWQ9MHgiKTsKKyAgICAgICAgICAgIHNiLmFwcGVuZChJbnRlZ2VyLnRvSGV4U3RyaW5nKG1GcmFnbWVudElkKSk7CisgICAgICAgIH0KKyAgICAgICAgaWYgKG1UYWcgIT0gbnVsbCkgeworICAgICAgICAgICAgc2IuYXBwZW5kKCIgIik7CisgICAgICAgICAgICBzYi5hcHBlbmQobVRhZyk7CisgICAgICAgIH0KKyAgICAgICAgc2IuYXBwZW5kKCd9Jyk7CisgICAgICAgIHJldHVybiBzYi50b1N0cmluZygpOworICAgIH0KKyAgICAKKyAgICAvKioKKyAgICAgKiBSZXR1cm4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uQWN0aXZpdHlSZXN1bHQoaW50LCBpbnQsIEludGVudCl9LgorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNldFRhcmdldEZyYWdtZW50KEZyYWdtZW50IGZyYWdtZW50LCBpbnQgcmVxdWVzdENvZGUpIHsKKyAgICAgICAgbVRhcmdldCA9IGZyYWdtZW50OworICAgICAgICBtVGFyZ2V0UmVxdWVzdENvZGUgPSByZXF1ZXN0Q29kZTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZXR1cm4gdGhlIHRhcmdldCBmcmFnbWVudCBzZXQgYnkge0BsaW5rICNzZXRUYXJnZXRGcmFnbWVudH0uCisgICAgICovCisgICAgZmluYWwgcHVibGljIEZyYWdtZW50IGdldFRhcmdldEZyYWdtZW50KCkgeworICAgICAgICByZXR1cm4gbVRhcmdldDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZXR1cm4gdGhlIHRhcmdldCByZXF1ZXN0IGNvZGUgc2V0IGJ5IHtAbGluayAjc2V0VGFyZ2V0RnJhZ21lbnR9LgorICAgICAqLworICAgIGZpbmFsIHB1YmxpYyBpbnQgZ2V0VGFyZ2V0UmVxdWVzdENvZGUoKSB7CisgICAgICAgIHJldHVybiBtVGFyZ2V0UmVxdWVzdENvZGU7CisgICAgfQorCisgICAgLyoqCisgICAgICogUmV0dXJuIHRoZSBBY3Rpdml0eSB0aGlzIGZyYWdtZW50IGlzIGN1cnJlbnRseSBhc3NvY2lhdGVkIHdpdGguCisgICAgICovCisgICAgZmluYWwgcHVibGljIEFjdGl2aXR5IGdldEFjdGl2aXR5KCkgeworICAgICAgICByZXR1cm4gbUFjdGl2aXR5OworICAgIH0KKyAgICAKKyAgICAvKioKKyAgICAgKiBSZXR1cm4gdGhlIEZyYWdtZW50TWFuYWdlciBmb3IgaW50ZXJhY3Rpbmcgd2l0aCBmcmFnbWVudHMgYXNzb2NpYXRlZAorICAgICAqIHdpdGggdGhpcyBmcmFnbWVudCdzIGFjdGl2aXR5LgorIC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0ZWQoQnVuZGxlKX0gPGI+d2lsbDwvYj4KKyAgICAgKiBzdGlsbCBiZSBjYWxsZWQuCisgICAgICogPC91bD4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBzZXRSZXRhaW5JbnN0YW5jZShib29sZWFuIHJldGFpbikgeworICAgICAgICBtUmV0YWluSW5zdGFuY2UgPSByZXRhaW47CisgICAgfQorICAgIAorICAgIGZpbmFsIHB1YmxpYyBib29sZWFuIGdldFJldGFpbkluc3RhbmNlKCkgeworICAgICAgICByZXR1cm4gbVJldGFpbkluc3RhbmNlOworICAgIH0KKyAgICAKKyAgICAvKioKKyAgICAgKiBSZXBvcnQgdGhhdCB0aGlzIGZyYWdtZW50IHdvdWxkIGxpa2UgdG8gcGFydGljaXBhdGUgaW4gcG9wdWxhdGluZworICAgICAqIHRoZSBvcHRpb25zIG1lbnUgYnkgcmVjZWl2aW5nIGEgY2FsbCB0byB7QGxpbmsgI29uQ3JlYXRlT3B0aW9uc01lbnV9CisgICAgICogYW5kIHJlbGF0ZWQgbWV0aG9kcy4KKyAgICAgKiAKKyAgICAgKiBAcGFyYW0gaGFzTWVudSBJZiB0cnVlLCB0aGUgZnJhZ21lbnQgaGFzIG1lbnUgaXRlbXMgdG8gY29udHJpYnV0ZS4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBzZXRIYXNPcHRpb25zTWVudShib29sZWFuIGhhc01lbnUpIHsKKyAgICAgICAgaWYgKG1IYXNNZW51ICE9IGhhc01lbnUpIHsKKyAgICAgICAgICAgIG1IYXNNZW51ID0gaGFzTWVudTsKKyAgICAgICAgICAgIGlmIChpc0FkZGVkKCkgJiYgIWlzSGlkZGVuKCkpIHsKKyAgICAgICAgICAgICAgICBtQWN0aXZpdHkuaW52YWxpZGF0ZU9wdGlvbnNNZW51KCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisgICAgCisgICAgLyoqCisgICAgICogUmV0dXJuIHRoZSBMb2FkZXJNYW5hZ2VyIGZvciB0aGlzIGZyYWdtZW50LCBjcmVhdGluZyBpdCBpZiBuZWVkZWQuCisgICAgICovCisgICAgcHVibGljIExvYWRlck1hbmFnZXIgZ2V0TG9hZGVyTWFuYWdlcigpIHsKKyAgICAgICAgaWYgKG1Mb2FkZXJNYW5hZ2VyICE9IG51bGwpIHsKKyAgICAgICAgICAgIHJldHVybiBtTG9hZGVyTWFuYWdlcjsKKyAgICAgICAgfQorICAgICAgICBtQ2hlY2tlZEZvckxvYWRlck1hbmFnZXIgPSB0cnVlOworICAgICAgICBtTG9hZGVyTWFuYWdlciA9IG1BY3Rpdml0eS5nZXRMb2FkZXJNYW5hZ2VyKG1JbmRleCwgbVN0YXJ0ZWQsIHRydWUpOworICAgICAgICByZXR1cm4gbUxvYWRlck1hbmFnZXI7CisgICAgfQorICAgIAorICAgIC8qKgorICAgICAqIENhbGwge0BsaW5rIEFjdGl2aXR5I3N0YXJ0QWN0aXZpdHkoSW50ZW50KX0gb24gdGhlIGZyYWdtZW50J3MKKyAgICAgKiBjb250YWluaW5nIEFjdGl2aXR5LgorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHN0YXJ0QWN0aXZpdHkoSW50ZW50IGludGVudCkgeworICAgICAgICBtQWN0aXZpdHkuc3RhcnRBY3Rpdml0eUZyb21GcmFnbWVudCh0aGlzLCBpbnRlbnQsIC0xKTsKKyAgICB9CisgICAgCisgICAgLyoqCisgICAgICogQ2FsbCB7QGxpbmsgQWN0aXZpdHkjc3RhcnRBY3Rpdml0eUZvclJlc3VsdChJbnRlbnQsIGludCl9IG9uIHRoZSBmcmFnbWVudCdzCisgICAgICogY29udGFpbmluZyBBY3Rpdml0eS4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBzdGFydEFjdGl2aXR5Rm9yUmVzdWx0KEludGVudCBpbnRlbnQsIGludCByZXF1ZXN0Q29kZSkgeworICAgICAgICBtQWN0aXZpdHkuc3RhcnRBY3Rpdml0eUZyb21GcmFnbWVudCh0aGlzLCBpbnRlbnQsIHJlcXVlc3RDb2RlKTsKKyAgICB9CisgICAgCisgICAgLyoqCisgICAgICogUmVjZWl2ZSB0aGUgcmVzdWx0IGZyb20gYSBwcmV2aW91cyBjYWxsIHRvCisgICAgICoge0BsaW5rICNzdGFydEFjdGl2aXR5Rm9yUmVzdWx0KEludGVudCwgaW50KX0uICBUaGlzIGZvbGxvd3MgdGhlCisgICAgICogcmVsYXRlZCBBY3Rpdml0eSBBUEkgYXMgZGVzY3JpYmVkIHRoZXJlIGluCisgICAgICoge0BsaW5rIEFjdGl2aXR5I29uQWN0aXZpdHlSZXN1bHQoaW50LCBpbnQsIEludGVudCl9LgorICAgICAqIAorICAgICAqIEBwYXJhbSByZXF1ZXN0Q29kZSBUaGUgaW50ZWdlciByZXF1ZXN0IGNvZGUgb3JpZ2luYWxseSBzdXBwbGllZCB0bworICAgICAqICAgICAgICAgICAgICAgICAgICBzdGFydEFjdGl2aXR5Rm9yUmVzdWx0KCksIGFsbG93aW5nIHlvdSB0byBpZGVudGlmeSB3aG8gdGhpcworICAgICAqICAgICAgICAgICAgICAgICAgICByZXN1bHQgY2FtZSBmcm9tLgorICAgICAqIEBwYXJhbSByZXN1bHRDb2RlIFRoZSBpbnRlZ2VyIHJlc3VsdCBjb2RlIHJldHVybmVkIGJ5IHRoZSBjaGlsZCBhY3Rpdml0eQorICAgICAqICAgICAgICAgICAgICAgICAgIHRocm91Z2ggaXRzIHNldFJlc3VsdCgpLgorICAgICAqIEBwYXJhbSBkYXRhIEFuIEludGVudCwgd2hpY2ggY2FuIHJldHVybiByZXN1bHQgZGF0YSB0byB0aGUgY2FsbGVyCisgICAgICogICAgICAgICAgICAgICAodmFyaW91cyBkYXRhIGNhbiBiZSBhdHRhY2hlZCB0byBJbnRlbnQgImV4dHJhcyIpLgorICAgICAqLworICAgIHB1YmxpYyB2b2lkIG9uQWN0aXZpdHlSZXN1bHQoaW50IHJlcXVlc3RDb2RlLCBpbnQgcmVzdWx0Q29kZSwgSW50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ICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiRnJhZ21lbnQgIiArIGZyYWdtZW50CisgICAgICAgICAgICAgICAgICAgICsgIiBpcyBub3QgY3VycmVudGx5IGluIHRoZSBGcmFnbWVudE1hbmFnZXIiKTsKKyAgICAgICAgfQorICAgICAgICBidW5kbGUucHV0SW50KGtleSwgZnJhZ21lbnQubUluZGV4KTsKKyAgICB9CisKKyAgICBwdWJsaWMgRnJhZ21lbnQgZ2V0RnJhZ21lbnQoQnVuZGxlIGJ1bmRsZSwgU3RyaW5nIGtleSkgeworICAgICAgICBpbnQgaW5kZXggPSBidW5kbGUuZ2V0SW50KGtleSwgLTEpOworICAgICAgICBpZiAoaW5kZXggPT0gLTEpIHsKKyAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICB9CisgICAgICAgIGlmIChpbmRleCA+PSBtQWN0aXZlLnNpemUoKSkgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiRnJhZ2VtZW50IG5vIGxvbmdlciBleGlzdHMgZm9yIGtleSAiCisgICAgICAgICAgICAgICAgICAgICsga2V5ICsgIjogaW5kZXggIiArIGluZGV4KTsKKyAgICAgICAgfQorICAgICAgICBGcmFnbWVudCBmID0gbUFjdGl2ZS5nZXQoaW5kZXgpOworICAgICAgICBpZiAoZiA9PSBudWxsKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJGcmFnZW1lbnQgbm8gbG9uZ2VyIGV4aXN0cyBmb3Iga2V5ICIKKyAgICAgICAgICAgICAgICAgICAgKyBrZXkgKyAiOiBpbmRleCAiICsgaW5kZXgpOworICAgICAgICB9CisgICAgICAgIHJldHVybiBmOworICAgIH0KKworICAgIEFuaW1hdGFibGUgbG9hZEFuaW1hdGFibGUoRnJhZ21lbnQgZnJhZ21lbnQsIGludCB0cmFuc2l0LCBib29sZWFuIGVudGVyLAorICAgICAgICAgICAgaW50IHRyYW5zaXRpb25TdHlsZSkgeworICAgICAgICBBbmltYXRhYmxlIGFuaW1PYmogPSBmcmFnbWVudC5vbkNyZWF0ZUFuaW1hdGFibGUodHJhbnNpdCwgZW50ZXIsCisgICAgICAgICAgICAgICAgZnJhZ21lbnQubU5leHRBbmltKTsKKyAgICAgICAgaWYgKGFuaW1PYmogIT0gbnVsbCkgeworICAgICAgICAgICAgcmV0dXJuIGFuaW1PYmo7CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIGlmIChmcmFnbWVudC5tTmV4dEFuaW0gIT0gMCkgeworICAgICAgICAgICAgQW5pbWF0YWJsZSBhbmltID0gQW5pbWF0YWJsZUluZmxhdGVyLmxvYWRBbmltYXRhYmxlKG1BY3Rpdml0eSwgZnJhZ21lbnQubU5leHRBbmltKTsKKyAgICAgICAgICAgIGlmIChhbmltICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gYW5pbTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgaWYgKHRyYW5zaXQgPT0gMCkgeworICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIGludCBzdHlsZUluZGV4ID0gdHJhbnNpdFRvU3R5bGVJbmRleCh0cmFuc2l0LCBlbnRlcik7CisgICAgICAgIGlmIChzdHlsZUluZGV4IDwgMCkgeworICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIGlmICh0cmFuc2l0aW9uU3R5bGUgPT0gMCAmJiBtQWN0aXZpdHkuZ2V0V2luZG93KCkgIT0gbnVsbCkgeworICAgICAgICAgICAgdHJhbnNpdGlvblN0eWxlID0gbUFjdGl2aXR5LmdldFdpbmRvdygpLmdldEF0dHJpYnV0ZXMoKS53aW5kb3dBbmltYXRpb25zOworICAgICAgICB9CisgICAgICAgIGlmICh0cmFuc2l0aW9uU3R5bGUgPT0gMCkgeworICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIFR5cGVkQXJyYXkgYXR0cnMgPSBtQWN0aXZpdHkub2J0YWluU3R5bGVkQXR0cmlidXRlcyh0cmFuc2l0aW9uU3R5bGUsCisgICAgICAgICAgICAgICAgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuRnJhZ21lbnRBbmltYXRpb24pOworICAgICAgICBpbnQgYW5pbSA9IGF0dHJzLmdldFJlc291cmNlSWQoc3R5bGVJbmRleCwgMCk7CisgICAgICAgIGF0dHJzLnJlY3ljbGUoKTsKKyAgICAgICAgCisgICAgICAgIGlmIChhbmltID09IDApIHsKKyAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICByZXR1cm4gQW5pbWF0YWJsZUluZmxhdGVyLmxvYWRBbmltYXRhYmxlKG1BY3Rpdml0eSwgYW5pbSk7CisgICAgfQorICAgIAorICAgIHZvaWQgbW92ZVRvU3RhdGUoRnJhZ21lbnQgZiwgaW50IG5ld1N0YXRlLCBpbnQgdHJhbnNpdCwgaW50IHRyYW5zaXRpb25TdHlsZSkgeworICAgICAgICAvLyBGcmFnbWVudHMgdGhhdCBhcmUgbm90IGN1cnJlbnRseSBhZGRlZCB3aWxsIHNpdCBpbiB0aGUgb25DcmVhdGUoKSBzdGF0ZS4KKyAgICAgICAgaWYgKCFmLm1BZGRlZCAmJiBuZXdTdGF0ZSA+IEZyYWdtZW50LkNSRUFURUQpIHsKKyAgICAgICAgICAgIG5ld1N0YXRlID0gRnJhZ21lbnQuQ1JFQVRFRDsKKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgaWYgKGYubVN0YXRlIDwgbmV3U3RhdGUpIHsKKyAgICAgICAgICAgIHN3aXRjaCAoZi5tU3RhdGUpIHsKKyAgICAgICAgICAgICAgICBjYXNlIEZyYWdtZW50LklOSVRJQUxJWklORzoKKyAgICAgICAgICAgICAgICAgICAgaWYgKERFQlVHKSBMb2cudihUQUcsICJtb3ZldG8gQ1JFQVRFRDogIiArIGYpOworICAgICAgICAgICAgICAgICAgICBpZiAoZi5tU2F2ZWRGcmFnbWVudFN0YXRlICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGYubVNhdmVkVmlld1N0YXRlID0gZi5tU2F2ZWRGcmFnbWVudFN0YXRlLmdldFNwYXJzZVBhcmNlbGFibGVBcnJheSgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRnJhZ21lbnRNYW5hZ2VySW1wbC5WSUVXX1NUQVRFX1RBRyk7CisgICAgICAgICAgICAgICAgICAgICAgICBmLm1UYXJnZXQgPSBnZXRGcmFnbWVudChmLm1TYXZlZEZyYWdtZW50U3RhdGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZyYWdtZW50TWFuYWdlckltcGwuVEFSR0VUX1NUQVRFX1RBRyk7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZi5tVGFyZ2V0ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBmLm1UYXJnZXRSZXF1ZXN0Q29kZSA9IGYubVNhdmVkRnJhZ21lbnRTdGF0ZS5nZXRJbnQoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBGcmFnbWVudE1hbmFnZXJJbXBsLlRBUkdFVF9SRVFVRVNUX0NPREVfU1RBVEVfVEFHLCAwKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBmLm1BY3Rpdml0eSA9IG1BY3Rpdml0eTsKKyAgICAgICAgICAgICAgICAgICAgZi5tQ2FsbGVkID0gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgIGYub25BdHRhY2gobUFjdGl2aXR5KTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKCFmLm1DYWxsZWQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBTdXBlck5vdENhbGxlZEV4Y2VwdGlvbigiRnJhZ21lbnQgIiArIGYKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiIGRpZCBub3QgY2FsbCB0aHJvdWdoIHRvIHN1cGVyLm9uQXR0YWNoKCkiKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBtQWN0aXZpdHkub25BdHRhY2hGcmFnbWVudChmKTsKKyAgICAgICAgICAgICAgICAgICAgCisgICAgICAgICAgICAgICAgICAgIGlmICghZi5tUmV0YWluaW5nKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBmLm1DYWxsZWQgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGYub25DcmVhdGUoZi5tU2F2ZWRGcmFnbWVudFN0YXRlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZi5tQ2FsbGVkKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFN1cGVyTm90Q2FsbGVkRXhjZXB0aW9uKCJGcmFnbWVudCAiICsgZgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiIGRpZCBub3QgY2FsbCB0aHJvdWdoIHRvIHN1cGVyLm9uQ3JlYXRlKCkiKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBmLm1SZXRhaW5pbmcgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGYubUZyb21MYXlvdXQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIEZvciBmcmFnbWVudHMgdGhhdCBhcmUgcGFydCBvZiB0aGUgY29udGVudCB2aWV3CisgICAgICAgICAgICAgICAgICAgICAgICAvLyBsYXlvdXQsIHdlIG5lZWQgdG8gaW5zdGFudGlhdGUgdGhlIHZpZXcgaW1tZWRpYXRlbHkKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIGFuZCB0aGUgaW5mbGF0ZXIgd2lsbCB0YWtlIGNhcmUgb2YgYWRkaW5nIGl0LgorICAgICAgICAgICAgICAgICAgICAgICAgZi5tVmlldyA9IGYub25DcmVhdGVWaWV3KG1BY3Rpdml0eS5nZXRMYXlvdXRJbmZsYXRlcigpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLCBmLm1TYXZlZEZyYWdtZW50U3RhdGUpOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGYubVZpZXcgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYubVZpZXcuc2V0U2F2ZUZyb21QYXJlbnRFbmFibGVkKGZhbHNlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBmLnJlc3RvcmVWaWV3U3RhdGUoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZi5tSGlkZGVuKSBmLm1WaWV3LnNldFZpc2liaWxpdHkoVmlldy5HT05FKTsgCisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBjYXNlIEZyYWdtZW50LkNSRUFURUQ6CisgICAgICAgICAgICAgICAgICAgIGlmIChuZXdTdGF0ZSA+IEZyYWdtZW50LkNSRUFURUQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChERUJVRykgTG9nLnYoVEFHLCAibW92ZXRvIENPTlRFTlQ6ICIgKyBmKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZi5tRnJvbUxheW91dCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIFZpZXdHcm91cCBjb250YWluZXIgPSBudWxsOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmLm1Db250YWluZXJJZCAhPSAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRhaW5lciA9IChWaWV3R3JvdXApbUFjdGl2aXR5LmZpbmRWaWV3QnlJZChmLm1Db250YWluZXJJZCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjb250YWluZXIgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiTmV3IHZpZXcgZm91bmQgZm9yIGlkIDB4IgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIEludGVnZXIudG9IZXhTdHJpbmcoZi5tQ29udGFpbmVySWQpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgIiBmb3IgZnJhZ21lbnQgIiArIGYpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYubUNvbnRhaW5lciA9IGNvbnRhaW5lcjsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBmLm1WaWV3ID0gZi5vbkNyZWF0ZVZpZXcobUFjdGl2aXR5LmdldExheW91dEluZmxhdGVyKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250YWluZXIsIGYubVNhdmVkRnJhZ21lbnRTdGF0ZSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGYubVZpZXcgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmLm1WaWV3LnNldFNhdmVGcm9tUGFyZW50RW5hYmxlZChmYWxzZSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjb250YWluZXIgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQW5pbWF0YWJsZSBhbmltID0gbG9hZEFuaW1hdGFibGUoZiwgdHJhbnNpdCwgdHJ1ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhbnNpdGlvblN0eWxlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhbmltICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYW5pbSBpbnN0YW5jZW9mIFNlcXVlbmNlcikgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoKFNlcXVlbmNlcilhbmltKS5zZXRUYXJnZXQoZi5tVmlldyk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChhbmltIGluc3RhbmNlb2YgUHJvcGVydHlBbmltYXRvcikgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoKFByb3BlcnR5QW5pbWF0b3IpYW5pbSkuc2V0VGFyZ2V0KGYubVZpZXcpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbmltLnN0YXJ0KCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250YWluZXIuYWRkVmlldyhmLm1WaWV3KTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYucmVzdG9yZVZpZXdTdGF0ZSgpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmLm1IaWRkZW4pIGYubVZpZXcuc2V0VmlzaWJpbGl0eShWaWV3LkdPTkUpOyAKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAKKyAgICAgICAgICAgICAgICAgICAgICAgIGYubUNhbGxlZCA9IGZhbHNlOworICAgICAgICAgICAgICAgICAgICAgICAgZi5vbkFjdGl2aXR5Q3JlYXRlZChmLm1TYXZlZEZyYWdtZW50U3RhdGUpOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFmLm1DYWxsZWQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgU3VwZXJOb3RDYWxsZWRFeGNlcHRpb24oIkZyYWdtZW50ICIgKyBmCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArICIgZGlkIG5vdCBjYWxsIHRocm91Z2ggdG8gc3VwZXIub25SZWFkeSgpIik7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBmLm1TYXZlZEZyYWdtZW50U3RhdGUgPSBudWxsOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgY2FzZSBGcmFnbWVudC5BQ1RJVklUWV9DUkVBVEVEOgorICAgICAgICAgICAgICAgICAgICBpZiAobmV3U3RhdGUgPiBGcmFnbWVudC5BQ1RJVklUWV9DUkVBVEVEKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoREVCVUcpIExvZy52KFRBRywgIm1vdmV0byBTVEFSVEVEOiAiICsgZik7CisgICAgICAgICAgICAgICAgICAgICAgICBmLm1DYWxsZWQgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGYub25TdGFydCgpOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFmLm1DYWxsZWQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgU3VwZXJOb3RDYWxsZWRFeGNlcHRpb24oIkZyYWdtZW50ICIgKyBmCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArICIgZGlkIG5vdCBjYWxsIHRocm91Z2ggdG8gc3VwZXIub25TdGFydCgpIik7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBjYXNlIEZyYWdtZW50LlNUQVJURUQ6CisgICAgICAgICAgICAgICAgICAgIGlmIChuZXdTdGF0ZSA+IEZyYWdtZW50LlNUQVJURUQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChERUJVRykgTG9nLnYoVEFHLCAibW92ZXRvIFJFU1VNRUQ6ICIgKyBmKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGYubUNhbGxlZCA9IGZhbHNlOworICAgICAgICAgICAgICAgICAgICAgICAgZi5tUmVzdW1lZCA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgICAgICBmLm9uUmVzdW1lKCk7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWYubUNhbGxlZCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBTdXBlck5vdENhbGxlZEV4Y2VwdGlvbigiRnJhZ21lbnQgIiArIGYKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgIiBkaWQgbm90IGNhbGwgdGhyb3VnaCB0byBzdXBlci5vblJlc3VtZSgpIik7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBlbHNlIGlmIChmLm1TdGF0ZSA+IG5ld1N0YXRlKSB7CisgICAgICAgICAgICBzd2l0Y2ggKGYubVN0YXRlKSB7CisgICAgICAgICAgICAgICAgY2FzZSBGcmFnbWVudC5SRVNVTUVEOgorICAgICAgICAgICAgICAgICAgICBpZiAobmV3U3RhdGUgPCBGcmFnbWVudC5SRVNVTUVEKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoREVCVUcpIExvZy52KFRBRywgIm1vdmVmcm9tIFJFU1VNRUQ6ICIgKyBmKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGYubUNhbGxlZCA9IGZhbHNlOworICAgICAgICAgICAgICAgICAgICAgICAgZi5vblBhdXNlKCk7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWYubUNhbGxlZCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBTdXBlck5vdENhbGxlZEV4Y2VwdGlvbigiRnJhZ21lbnQgIiArIGYKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgIiBkaWQgbm90IGNhbGwgdGhyb3VnaCB0byBzdXBlci5vblBhdXNlKCkiKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGYubVJlc3VtZWQgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGNhc2UgRnJhZ21lbnQuU1RBUlRFRDoKKyAgICAgICAgICAgICAgICAgICAgaWYgKG5ld1N0YXRlIDwgRnJhZ21lbnQuU1RBUlRFRCkgeworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKERFQlVHKSBMb2cudihUQUcsICJtb3ZlZnJvbSBTVEFSVEVEOiAiICsgZik7CisgICAgICAgICAgICAgICAgICAgICAgICBmLm1DYWxsZWQgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGYucGVyZm9ybVN0b3AoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZi5tQ2FsbGVkKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFN1cGVyTm90Q2FsbGVkRXhjZXB0aW9uKCJGcmFnbWVudCAiICsgZgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiIGRpZCBub3QgY2FsbCB0aHJvdWdoIHRvIHN1cGVyLm9uU3RvcCgpIik7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBjYXNlIEZyYWdtZW50LkFDVElWSVRZX0NSRUFURUQ6CisgICAgICAgICAgICAgICAgICAgIGlmIChuZXdTdGF0ZSA8IEZyYWdtZW50LkFDVElWSVRZX0NSRUFURUQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChERUJVRykgTG9nLnYoVEFHLCAibW92ZWZyb20gQ09OVEVOVDogIiArIGYpOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGYubVZpZXcgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIE5lZWQgdG8gc2F2ZSB0aGUgY3VycmVudCB2aWV3IHN0YXRlIGlmIG5vdAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGRvbmUgYWxyZWFkeS4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIW1BY3Rpdml0eS5pc0ZpbmlzaGluZygpICYmIGYubVNhdmVkRnJhZ21lbnRTdGF0ZSA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNhdmVGcmFnbWVudFZpZXdTdGF0ZShmKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBmLm1DYWxsZWQgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGYub25EZXN0cm95VmlldygpOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFmLm1DYWxsZWQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgU3VwZXJOb3RDYWxsZWRFeGNlcHRpb24oIkZyYWdtZW50ICIgKyBmCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArICIgZGlkIG5vdCBjYWxsIHRocm91Z2ggdG8gc3VwZXIub25EZXN0cm95ZWRWaWV3KCkiKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmLm1WaWV3ICE9IG51bGwgJiYgZi5tQ29udGFpbmVyICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobUN1clN0YXRlID4gRnJhZ21lbnQuSU5JVElBTElaSU5HKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFuaW1hdGFibGUgYW5pbSA9IGxvYWRBbmltYXRhYmxlKGYsIHRyYW5zaXQsIHRydWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhbnNpdGlvblN0eWxlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGFuaW0gIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGFuaW0gaW5zdGFuY2VvZiBTZXF1ZW5jZXIpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoKFNlcXVlbmNlcilhbmltKS5zZXRUYXJnZXQoZi5tVmlldyk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGFuaW0gaW5zdGFuY2VvZiBQcm9wZXJ0eUFuaW1hdG9yKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKChQcm9wZXJ0eUFuaW1hdG9yKWFuaW0pLnNldFRhcmdldChmLm1WaWV3KTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFuaW0uc3RhcnQoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBmLm1Db250YWluZXIucmVtb3ZlVmlldyhmLm1WaWV3KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGYubUNvbnRhaW5lciA9IG51bGw7CisgICAgICAgICAgICAgICAgICAgICAgICBmLm1WaWV3ID0gbnVsbDsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGNhc2UgRnJhZ21lbnQuQ1JFQVRFRDoKKyAgICAgICAgICAgICAgICAgICAgaWYgKG5ld1N0YXRlIDwgRnJhZ21lbnQuQ1JFQVRFRCkgeworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKERFQlVHKSBMb2cudihUQUcsICJtb3ZlZnJvbSBDUkVBVEVEOiAiICsgZik7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWYubVJldGFpbmluZykgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYubUNhbGxlZCA9IGZhbHNlOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGYub25EZXN0cm95KCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFmLm1DYWxsZWQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFN1cGVyTm90Q2FsbGVkRXhjZXB0aW9uKCJGcmFnbWVudCAiICsgZgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgIiBkaWQgbm90IGNhbGwgdGhyb3VnaCB0byBzdXBlci5vbkRlc3Ryb3koKSIpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIAorICAgICAgICAgICAgICAgICAgICAgICAgZi5tQ2FsbGVkID0gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgICAgICBmLm9uRGV0YWNoKCk7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWYubUNhbGxlZCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBTdXBlck5vdENhbGxlZEV4Y2VwdGlvbigiRnJhZ21lbnQgIiArIGYKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgIiBkaWQgbm90IGNhbGwgdGhyb3VnaCB0byBzdXBlci5vbkRldGFjaCgpIik7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBmLm1BY3Rpdml0eSA9IG51bGw7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgZi5tU3RhdGUgPSBuZXdTdGF0ZTsKKyAgICB9CisgICAgCisgICAgdm9pZCBtb3ZlVG9TdGF0ZShpbnQgbmV3U3RhdGUsIGJvb2xlYW4gYWx3YXlzKSB7CisgICAgICAgIG1vdmVUb1N0YXRlKG5ld1N0YXRlLCAwLCAwLCBhbHdheXMpOworICAgIH0KKyAgICAKKyAgICB2b2lkIG1vdmVUb1N0YXRlKGludCBuZXdTdGF0ZSwgaW50IHRyYW5zaXQsIGludCB0cmFuc2l0U3R5bGUsIGJvb2xlYW4gYWx3YXlzKSB7CisgICAgICAgIGlmIChtQWN0aXZpdHkgPT0gbnVsbCAmJiBuZXdTdGF0ZSAhPSBGcmFnbWVudC5JTklUSUFMSVpJTkcpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oIk5vIGFjdGl2aXR5Iik7CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIGlmICghYWx3YXlzICYmIG1DdXJTdGF0ZSA9PSBuZXdTdGF0ZSkgeworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICBtQ3VyU3RhdGUgPSBuZXdTdGF0ZTsKKyAgICAgICAgaWYgKG1BY3RpdmUgIT0gbnVsbCkgeworICAgICAgICAgICAgZm9yIChpbnQgaT0wOyBpPG1BY3RpdmUuc2l6ZSgpOyBpKyspIHsKKyAgICAgICAgICAgICAgICBGcmFnbWVudCBmID0gbUFjdGl2ZS5nZXQoaSk7CisgICAgICAgICAgICAgICAgaWYgKGYgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBtb3ZlVG9TdGF0ZShmLCBuZXdTdGF0ZSwgdHJhbnNpdCwgdHJhbnNpdFN0eWxlKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmIChtTmVlZE1lbnVJbnZhbGlkYXRlICYmIG1BY3Rpdml0eSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgbUFjdGl2aXR5LmludmFsaWRhdGVPcHRpb25zTWVudSgpOworICAgICAgICAgICAgICAgIG1OZWVkTWVudUludmFsaWRhdGUgPSBmYWxzZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKyAgICAKKyAgICB2b2lkIG1ha2VBY3RpdmUoRnJhZ21lbnQgZikgeworICAgICAgICBpZiAoZi5tSW5kZXggPj0gMCkgeworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICBpZiAobUF2YWlsSW5kaWNlcyA9PSBudWxsIHx8IG1BdmFpbEluZGljZXMuc2l6ZSgpIDw9IDApIHsKKyAgICAgICAgICAgIGlmIChtQWN0aXZlID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICBtQWN0aXZlID0gbmV3IEFycmF5TGlzdDxGcmFnbWVudD4oKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGYuc2V0SW5kZXgobUFjdGl2ZS5zaXplKCkpOworICAgICAgICAgICAgbUFjdGl2ZS5hZGQoZik7CisgICAgICAgICAgICAKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGYuc2V0SW5kZXgobUF2YWlsSW5kaWNlcy5yZW1vdmUobUF2YWlsSW5kaWNlcy5zaXplKCktMSkpOworICAgICAgICAgICAgbUFjdGl2ZS5zZXQoZi5tSW5kZXgsIGYpOworICAgICAgICB9CisgICAgfQorICAgIAorICAgIHZvaWQgbWFrZUluYWN0aXZlKEZyYWdtZW50IGYpIHsKKyAgICAgICAgaWYgKGYubUluZGV4IDwgMCkgeworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICBpZiAoREVCVUcpIExvZy52KFRBRywgIkZyZWVpbmcgZnJhZ21lbnQgaW5kZXggIiArIGYubUluZGV4KTsKKyAgICAgICAgbUFjdGl2ZS5zZXQoZi5tSW5kZXgsIG51bGwpOworICAgICAgICBpZiAobUF2YWlsSW5kaWNlcyA9PSBudWxsKSB7CisgICAgICAgICAgICBtQXZhaWxJbmRpY2VzID0gbmV3IEFycmF5TGlzdDxJbnRlZ2VyPigpOworICAgICAgICB9CisgICAgICAgIG1BdmFpbEluZGljZXMuYWRkKGYubUluZGV4KTsKKyAgICAgICAgbUFjdGl2aXR5LmludmFsaWRhdGVGcmFnbWVudEluZGV4KGYubUluZGV4KTsKKyAgICAgICAgZi5jbGVhckluZGV4KCk7CisgICAgfQorICAgIAorICAgIHB1YmxpYyB2b2lkIGFkZEZyYWdtZW50KEZyYWdtZW50IGZyYWdtZW50LCBib29sZWFuIG1vdmVUb1N0YXRlTm93KSB7CisgICAgICAgIGlmIChtQWRkZWQgPT0gbnVsbCkgeworICAgICAgICAgICAgbUFkZGVkID0gbmV3IEFycmF5TGlzdDxGcmFnbWVudD4oKTsKKyAgICAgICAgfQorICAgICAgICBtQWRkZWQuYWRkKGZyYWdtZW50KTsKKyAgICAgICAgbWFrZUFjdGl2ZShmcmFnbWVudCk7CisgICAgICAgIGlmIChERUJVRykgTG9nLnYoVEFHLCAiYWRkOiAiICsgZnJhZ21lbnQpOworICAgICAgICBmcmFnbWVudC5tQWRkZWQgPSB0cnVlOworICAgICAgICBpZiAoZnJhZ21lbnQubUhhc01lbnUpIHsKKyAgICAgICAgICAgIG1OZWVkTWVudUludmFsaWRhdGUgPSB0cnVlOworICAgICAgICB9CisgICAgICAgIGlmIChtb3ZlVG9TdGF0ZU5vdykgeworICAgICAgICAgICAgbW92ZVRvU3RhdGUoZnJhZ21lbnQsIG1DdXJTdGF0ZSwgMCwgMCk7CisgICAgICAgIH0KKyAgICB9CisgICAgCisgICAgcHVib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gIGlmIChmcmFnbWVudC5tVmlldyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgQW5pbWF0YWJsZSBhbmltID0gbG9hZEFuaW1hdGFibGUoZnJhZ21lbnQsIHRyYW5zaXRpb24sIHRydWUsCisgICAgICAgICAgICAgICAgICAgICAgICB0cmFuc2l0aW9uU3R5bGUpOworICAgICAgICAgICAgICAgIGlmIChhbmltICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGFuaW0gaW5zdGFuY2VvZiBTZXF1ZW5jZXIpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICgoU2VxdWVuY2VyKWFuaW0pLnNldFRhcmdldChmcmFnbWVudC5tVmlldyk7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoYW5pbSBpbnN0YW5jZW9mIFByb3BlcnR5QW5pbWF0b3IpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICgoUHJvcGVydHlBbmltYXRvcilhbmltKS5zZXRUYXJnZXQoZnJhZ21lbnQubVZpZXcpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGFuaW0uc3RhcnQoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZnJhZ21lbnQubVZpZXcuc2V0VmlzaWJpbGl0eShWaWV3LkdPTkUpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKGZyYWdtZW50Lm1BZGRlZCAmJiBmcmFnbWVudC5tSGFzTWVudSkgeworICAgICAgICAgICAgICAgIG1OZWVkTWVudUludmFsaWRhdGUgPSB0cnVlOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZnJhZ21lbnQub25IaWRkZW5DaGFuZ2VkKHRydWUpOworICAgICAgICB9CisgICAgfQorICAgIAorICAgIHB1YmxpYyB2b2lkIHNob3dGcmFnbWVudChGcmFnbWVudCBmcmFnbWVudCwgaW50IHRyYW5zaXRpb24sIGludCB0cmFuc2l0aW9uU3R5bGUpIHsKKyAgICAgICAgaWYgKERFQlVHKSBMb2cudihUQUcsICJzaG93OiAiICsgZnJhZ21lbnQpOworICAgICAgICBpZiAoZnJhZ21lbnQubUhpZGRlbikgeworICAgICAgICAgICAgZnJhZ21lbnQubUhpZGRlbiA9IGZhbHNlOworICAgICAgICAgICAgaWYgKGZyYWdtZW50Lm1WaWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBBbmltYXRhYmxlIGFuaW0gPSBsb2FkQW5pbWF0YWJsZShmcmFnbWVudCwgdHJhbnNpdGlvbiwgdHJ1ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgIHRyYW5zaXRpb25TdHlsZSk7CisgICAgICAgICAgICAgICAgaWYgKGFuaW0gIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBpZiAoYW5pbSBpbnN0YW5jZW9mIFNlcXVlbmNlcikgeworICAgICAgICAgICAgICAgICAgICAgICAgKChTZXF1ZW5jZXIpYW5pbSkuc2V0VGFyZ2V0KGZyYWdtZW50Lm1WaWV3KTsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChhbmltIGluc3RhbmNlb2YgUHJvcGVydHlBbmltYXRvcikgeworICAgICAgICAgICAgICAgICAgICAgICAgKChQcm9wZXJ0eUFuaW1hdG9yKWFuaW0pLnNldFRhcmdldChmcmFnbWVudC5tVmlldyk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgYW5pbS5zdGFydCgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBmcmFnbWVudC5tVmlldy5zZXRWaXNpYmlsaXR5KFZpZXcuVklTSUJMRSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoZnJhZ21lbnQubUFkZGVkICYmIGZyYWdtZW50Lm1IYXNNZW51KSB7CisgICAgICAgICAgICAgICAgbU5lZWRNZW51SW52YWxpZGF0ZSA9IHRydWU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBmcmFnbWVudC5vbkhpZGRlbkNoYW5nZWQoZmFsc2UpOworICAgICAgICB9CisgICAgfQorICAgIAorICAgIHB1YmxpYyBGcmFnbWVudCBmaW5kRnJhZ21lbnRCeUlkKGludCBpZCkgeworICAgICAgICBpZiAobUFjdGl2ZSAhPSBudWxsKSB7CisgICAgICAgICAgICAvLyBGaXJzdCBsb29rIHRocm91Z2ggYWRkZWQgZnJhZ21lbnRzLgorICAgICAgICAgICAgZm9yIChpbnQgaT1tQWRkZWQuc2l6ZSgpLTE7IGk+PTA7IGktLSkgeworICAgICAgICAgICAgICAgIEZyYWdtZW50IGYgPSBtQWRkZWQuZ2V0KGkpOworICAgICAgICAgICAgICAgIGlmIChmICE9IG51bGwgJiYgZi5tRnJhZ21lbnRJZCA9PSBpZCkgeworICAgICAgICAgICAgICAgICAgICByZXR1cm4gZjsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICAvLyBOb3cgZm9yIGFueSBrbm93biBmcmFnbWVudC4KKyAgICAgICAgICAgIGZvciAoaW50IGk9bUFjdGl2ZS5zaXplKCktMTsgaT49MDsgaS0tKSB7CisgICAgICAgICAgICAgICAgRnJhZ21lbnQgZiA9IG1BY3RpdmUuZ2V0KGkpOworICAgICAgICAgICAgICAgIGlmIChmICE9IG51bGwgJiYgZi5tRnJhZ21lbnRJZCA9PSBpZCkgeworICAgICAgICAgICAgICAgICAgICByZXR1cm4gZjsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIG51bGw7CisgICAgfQorICAgIAorICAgIHB1YmxpYyBGcmFnbWVudCBmaW5kRnJhZ21lbnRCeVRhZyhTdHJpbmcgdGFnKSB7CisgICAgICAgIGlmIChtQWN0aXZlICE9IG51bGwgJiYgdGFnICE9IG51bGwpIHsKKyAgICAgICAgICAgIC8vIEZpcnN0IGxvb2sgdGhyb3VnaCBhZGRlZCBmcmFnbWVudHMuCisgICAgICAgICAgICBmb3IgKGludCBpPW1BZGRlZC5zaXplKCktMTsgaT49MDsgaS0tKSB7CisgICAgICAgICAgICAgICAgRnJhZ21lbnQgZiA9IG1BZGRlZC5nZXQoaSk7CisgICAgICAgICAgICAgICAgaWYgKGYgIT0gbnVsbCAmJiB0YWcuZXF1YWxzKGYubVRhZykpIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGY7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgLy8gTm93IGZvciBhbnkga25vd24gZnJhZ21lbnQuCisgICAgICAgICAgICBmb3IgKGludCBpPW1BY3RpdmUuc2l6ZSgpLTE7IGk+PTA7IGktLSkgeworICAgICAgICAgICAgICAgIEZyYWdtZW50IGYgPSBtQWN0aXZlLmdldChpKTsKKyAgICAgICAgICAgICAgICBpZiAoZiAhPSBudWxsICYmIHRhZy5lcXVhbHMoZi5tVGFnKSkgeworICAgICAgICAgICAgICAgICAgICByZXR1cm4gZjsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIG51bGw7CisgICAgfQorICAgIAorICAgIHB1YmxpYyBGcmFnbWVudCBmaW5kRnJhZ21lbnRCeVdobyhTdHJpbmcgd2hvKSB7CisgICAgICAgIGlmIChtQWN0aXZlICE9IG51bGwgJiYgd2hvICE9IG51bGwpIHsKKyAgICAgICAgICAgIGZvciAoaW50IGk9bUFjdGl2ZS5zaXplKCktMTsgaT49MDsgaS0tKSB7CisgICAgICAgICAgICAgICAgRnJhZ21lbnQgZiA9IG1BY3RpdmUuZ2V0KGkpOworICAgICAgICAgICAgICAgIGlmIChmICE9IG51bGwgJiYgd2hvLmVxdWFscyhmLm1XaG8pKSB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBmOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbnVsbDsKKyAgICB9CisgICAgCisgICAgcHVibGljIHZvaWQgZW5xdWV1ZUFjdGlvbihSdW5uYWJsZSBhY3Rpb24pIHsKKyAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CisgICAgICAgICAgICBpZiAobVBlbmRpbmdBY3Rpb25zID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICBtUGVuZGluZ0FjdGlvbnMgPSBuZXcgQXJyYXlMaXN0PFJ1bm5hYmxlPigpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbVBlbmRpbmdBY3Rpb25zLmFkZChhY3Rpb24pOworICAgICAgICAgICAgaWYgKG1QZW5kaW5nQWN0aW9ucy5zaXplKCkgPT0gMSkgeworICAgICAgICAgICAgICAgIG1BY3Rpdml0eS5tSGFuZGxlci5yZW1vdmVDYWxsYmFja3MobUV4ZWNDb21taXQpOworICAgICAgICAgICAgICAgIG1BY3Rpdml0eS5tSGFuZGxlci5wb3N0KG1FeGVjQ29tbWl0KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKyAgICAKKyAgICBwdWJsaWMgaW50IGFsbG9jQmFja1N0YWNrSW5kZXgoQmFja1N0YWNrRW50cnkgYnNlKSB7CisgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgeworICAgICAgICAgICAgaWYgKG1BdmFpbEJhY2tTdGFja0luZGljZXMgPT0gbnVsbCB8fCBtQXZhaWxCYWNrU3RhY2tJbmRpY2VzLnNpemUoKSA8PSAwKSB7CisgICAgICAgICAgICAgICAgaWYgKG1CYWNrU3RhY2tJbmRpY2VzID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgbUJhY2tTdGFja0luZGljZXMgPSBuZXcgQXJyYXlMaXN0PEJhY2tTdGFja0VudHJ5PigpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBpbnQgaW5kZXggPSBtQmFja1N0YWNrSW5kaWNlcy5zaXplKCk7CisgICAgICAgICAgICAgICAgaWYgKERFQlVHKSBMb2cudihUQUcsICJTZXR0aW5nIGJhY2sgc3RhY2sgaW5kZXggIiArIGluZGV4ICsgIiB0byAiICsgYnNlKTsKKyAgICAgICAgICAgICAgICBtQmFja1N0YWNrSW5kaWNlcy5hZGQoYnNlKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gaW5kZXg7CisKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgaW50IGluZGV4ID0gbUF2YWlsQmFja1N0YWNrSW5kaWNlcy5yZW1vdmUobUF2YWlsQmFja1N0YWNrSW5kaWNlcy5zaXplKCktMSk7CisgICAgICAgICAgICAgICAgaWYgKERFQlVHKSBMb2cudihUQUcsICJBZGRpbmcgYmFjayBzdGFjayBpbmRleCAiICsgaW5kZXggKyAiIHdpdGggIiArIGJzZSk7CisgICAgICAgICAgICAgICAgbUJhY2tTdGFja0luZGljZXMuc2V0KGluZGV4LCBic2UpOworICAgICAgICAgICAgICAgIHJldHVybiBpbmRleDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHNldEJhY2tTdGFja0luZGV4KGludCBpbmRleCwgQmFja1N0YWNrRW50cnkgYnNlKSB7CisgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgeworICAgICAgICAgICAgaWYgKG1CYWNrU3RhY2tJbmRpY2VzID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICBtQmFja1N0YWNrSW5kaWNlcyA9IG5ldyBBcnJheUxpc3Q8QmFja1N0YWNrRW50cnk+KCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpbnQgTiA9IG1CYWNrU3RhY2tJbmRpY2VzLnNpemUoKTsKKyAgICAgICAgICAgIGlmIChpbmRleCA8IE4pIHsKKyAgICAgICAgICAgICAgICBpZiAoREVCVUcpIExvZy52KFRBRywgIlNldHRpbmcgYmFjayBzdGFjayBpbmRleCAiICsgaW5kZXggKyAiIHRvICIgKyBic2UpOworICAgICAgICAgICAgICAgIG1CYWNrU3RhY2tJbmRpY2VzLnNldChpbmRleCwgYnNlKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgd2hpbGUgKE4gPCBpbmRleCkgeworICAgICAgICAgICAgICAgICAgICBtQmFja1N0YWNrSW5kaWNlcy5hZGQobnVsbCk7CisgICAgICAgICAgICAgICAgICAgIGlmIChtQXZhaWxCYWNrU3RhY2tJbmRpY2VzID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1BdmFpbEJhY2tTdGFja0luZGljZXMgPSBuZXcgQXJyYXlMaXN0PEludGVnZXI+KCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgaWYgKERFQlVHKSBMb2cudihUQUcsICJBZGRpbmcgYXZhaWxhYmxlIGJhY2sgc3RhY2sgaW5kZXggIiArIE4pOworICAgICAgICAgICAgICAgICAgICBtQXZhaWxCYWNrU3RhY2tJbmRpY2VzLmFkZChOKTsKKyAgICAgICAgICAgICAgICAgICAgTisrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBpZiAoREVCVUcpIExvZy52KFRBRywgIkFkZGluZyBiYWNrIHN0YWNrIGluZGV4ICIgKyBpbmRleCArICIgd2l0aCAiICsgYnNlKTsKKyAgICAgICAgICAgICAgICBtQmFja1N0YWNrSW5kaWNlcy5hZGQoYnNlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGZyZWVCYWNrU3RhY2tJbmRleChpbnQgaW5kZXgpIHsKKyAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CisgICAgICAgICAgICBtQmFja1N0YWNrSW5kaWNlcy5zZXQoaW5kZXgsIG51bGwpOworICAgICAgICAgICAgaWYgKG1BdmFpbEJhY2tTdGFja0luZGljZXMgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIG1BdmFpbEJhY2tTdGFja0luZGljZXMgPSBuZXcgQXJyYXlMaXN0PEludGVnZXI+KCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoREVCVUcpIExvZy52KFRBRywgIkZyZWVpbmcgYmFjayBzdGFjayBpbmRleCAiICsgaW5kZXgpOworICAgICAgICAgICAgbUF2YWlsQmFja1N0YWNrSW5kaWNlcy5hZGQoaW5kZXgpOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogT25seSBjYWxsIGZyb20gbWFpbiB0aHJlYWQhCisgICAgICovCisgICAgcHVibGljIHZvaWQgZXhlY1BlbmRpbmdBY3Rpb25zKCkgeworICAgICAgICBpZiAobUV4ZWN1dGluZ0FjdGlvbnMpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oIlJlY3Vyc2l2ZSBlbnRyeSB0byBleGVjUGVuZGluZ0FjdGlvbnMiKTsKKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgd2hpbGUgKHRydWUpIHsKKyAgICAgICAgICAgIGludCBudW1BY3Rpb25zOworICAgICAgICAgICAgCisgICAgICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKKyAgICAgICAgICAgICAgICBpZiAobVBlbmRpbmdBY3Rpb25zID09IG51bGwgfHwgbVBlbmRpbmdBY3Rpb25zLnNpemUoKSA9PSAwKSB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgCisgICAgICAgICAgICAgICAgbnVtQWN0aW9ucyA9IG1QZW5kaW5nQWN0aW9ucy5zaXplKCk7CisgICAgICAgICAgICAgICAgaWYgKG1UbXBBY3Rpb25zID09IG51bGwgfHwgbVRtcEFjdGlvbnMubGVuZ3RoIDwgbnVtQWN0aW9ucykgeworICAgICAgICAgICAgICAgICAgICBtVG1wQWN0aW9ucyA9IG5ldyBSdW5uYWJsZVtudW1BY3Rpb25zXTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgbVBlbmRpbmdBY3Rpb25zLnRvQXJyYXkobVRtcEFjdGlvbnMpOworICAgICAgICAgICAgICAgIG1QZW5kaW5nQWN0aW9ucy5jbGVhcigpOworICAgICAgICAgICAgICAgIG1BY3Rpdml0eS5tSGFuZGxlci5yZW1vdmVDYWxsYmFja3MobUV4ZWNDb21taXQpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgCisgICAgICAgICAgICBtRXhlY3V0aW5nQWN0aW9ucyA9IHRydWU7CisgICAgICAgICAgICBmb3IgKGludCBpPTA7IGk8bnVtQWN0aW9uczsgaSsrKSB7CisgICAgICAgICAgICAgICAgbVRtcEFjdGlvbnNbaV0ucnVuKCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBtRXhlY3V0aW5nQWN0aW9ucyA9IGZhbHNlOworICAgICAgICB9CisgICAgfQorICAgIAorICAgIHB1YmxpYyB2b2lkIGFkZEJhY2tTdGFja1N0YXRlKEJhY2tTdGFja0VudHJ5IHN0YXRlKSB7CisgICAgICAgIGlmIChtQmFja1N0YWNrID09IG51bGwpIHsKKyAgICAgICAgICAgIG1CYWNrU3RhY2sgPSBuZXcgQXJyYXlMaXN0PEJhY2tTdGFja0VudHJ5PigpOworICAgICAgICB9CisgICAgICAgIG1CYWNrU3RhY2suYWRkKHN0YXRlKTsKKyAgICB9CisgICAgCisgICAgYm9vbGVhbiBwb3BCYWNrU3RhY2tTdGF0ZShIYW5kbGVyIGhhbmRsZXIsIFN0cmluZyBuYW1lLCBpbnQgaWQsIGludCBmbGFncykgeworICAgICAgICBpZiAobUJhY2tTdGFjayA9PSBudWxsKSB7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKyAgICAgICAgaWYgKG5hbWUgPT0gbnVsbCAmJiBpZCA8IDAgJiYgKGZsYWdzJkFjdGl2aXR5LlBPUF9CQUNLX1NUQUNLX0lOQ0xVU0lWRSkgPT0gMCkgeworICAgICAgICAgICAgaW50IGxhc3QgPSBtQmFja1N0YWNrLnNpemUoKS0xOworICAgICAgICAgICAgaWYgKGxhc3QgPCAwKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZmluYWwgQmFja1N0YWNrRW50cnkgYnNzID0gbUJhY2tTdGFjay5yZW1vdmUobGFzdCk7CisgICAgICAgICAgICBlbnF1ZXVlQWN0aW9uKG5ldyBSdW5uYWJsZSgpIHsKKyAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgICAgICAgICAgICAgIGlmIChERUJVRykgTG9nLnYoVEFHLCAiUG9wcGluZyBiYWNrIHN0YWNrIHN0YXRlOiAiICsgYnNzKTsKKyAgICAgICAgICAgICAgICAgICAgYnNzLnBvcEZyb21CYWNrU3RhY2sodHJ1ZSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBpbnQgaW5kZXggPSAtMTsKKyAgICAgICAgICAgIGlmIChuYW1lICE9IG51bGwgfHwgaWQgPj0gMCkgeworICAgICAgICAgICAgICAgIC8vIElmIGEgbmFtZSBvciBJRCBpcyBzcGVjaWZpZWQsIGxvb2sgZm9yIHRoYXQgcGxhY2UgaW4KKyAgICAgICAgICAgICAgICAvLyB0aGUgc3RhY2suCisgICAgICAgICAgICAgICAgaW5kZXggPSBtQmFja1N0YWNrLnNpemUoKS0xOworICAgICAgICAgICAgICAgIHdoaWxlIChpbmRleCA+PSAwKSB7CisgICAgICAgICAgICAgICAgICAgIEJhY2tTdGFja0VudHJ5IGJzcyA9IG1CYWNrU3RhY2suZ2V0KGluZGV4KTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKG5hbWUgIT0gbnVsbCAmJiBuYW1lLmVxdWFscyhic3MuZ2V0TmFtZSgpKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgaWYgKGlkID49IDAgJiYgaWQgPT0gYnNzLm1JbmRleCkgeworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgaW5kZXgtLTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKGluZGV4IDwgMCkgeworICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGlmICgoZmxhZ3MmQWN0aXZpdHkuUE9QX0JBQ0tfU1RBQ0tfSU5DTFVTSVZFKSAhPSAwKSB7CisgICAgICAgICAgICAgICAgICAgIGluZGV4LS07CisgICAgICAgICAgICAgICAgICAgIC8vIENvbnN1bWUgYWxsIGZvbGxvd2luZyBlbnRyaWVzIHRoYXQgbWF0Y2guCisgICAgICAgICAgICAgICAgICAgIHdoaWxlIChpbmRleCA+PSAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBCYWNrU3RhY2tFbnRyeSBic3MgPSBtQmFja1N0YWNrLmdldChpbmRleCk7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoKG5hbWUgIT0gbnVsbCAmJiBuYW1lLmVxdWFscyhic3MuZ2V0TmFtZSgpKSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfHwgKGlkID49IDAgJiYgaWQgPT0gYnNzLm1JbmRleCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbmRleC0tOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoaW5kZXggPT0gbUJhY2tTdGFjay5zaXplKCktMSkgeworICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGZpbmFsIEFycmF5TGlzdDxCYWNrU3RhY2tFbnRyeT4gc3RhdGVzCisgICAgICAgICAgICAgICAgICAgID0gbmV3IEFycmF5TGlzdDxCYWNrU3RhY2tFbnRyeT4oKTsKKyAgICAgICAgICAgIGZvciAoaW50IGk9bUJhY2tTdGFjay5zaXplKCktMTsgaT5pbmRleDsgaS0tKSB7CisgICAgICAgICAgICAgICAgc3RhdGVzLmFkZChtQmFja1N0YWNrLnJlbW92ZShpKSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbnF1ZXVlQWN0aW9uKG5ldyBSdW5uYWJsZSgpIHsKKyAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgICAgICAgICAgICAgIGZpbmFsIGludCBMQVNUID0gc3RhdGVzLnNpemUoKS0xOworICAgICAgICAgICAgICAgICAgICBmb3IgKGludCBpPTA7IGk8PUxBU1Q7IGkrKykgeworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKERFQlVHKSBMb2cudihUQUcsICJQb3BwaW5nIGJhY2sgc3RhY2sgc3RhdGU6ICIgKyBzdGF0ZXMuZ2V0KGkpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlcy5nZXQoaSkucG9wRnJvbUJhY2tTdGFjayhpID09IExBU1QpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSk7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHRydWU7CisgICAgfQorICAgIAorICAgIEFycmF5TGlzdDxGcmFnbWVudD4gcmV0YWluTm9uQ29uZmlnKCkgeworICAgICAgICBBcnJheUxpc3Q8RnJhZ21lbnQ+IGZyYWdtZW50cyA9IG51bGw7CisgICAgICAgIGlmIChtQWN0aXZlICE9IG51bGwpIHsKKyAgICAgICAgICAgIGZvciAoaW50IGk9MDsgaTxtQWN0aXZlLnNpemUoKTsgaSsrKSB7CisgICAgICAgICAgICAgICAgRnJhZ21lbnQgZiA9IG1BY3RpdmUuZ2V0KGkpOworICAgICAgICAgICAgICAgIGlmIChmICE9IG51bGwgJiYgZi5tUmV0YWluSW5zdGFuY2UpIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGZyYWdtZW50cyA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBmcmFnbWVudHMgPSBuZXcgQXJyYXlMaXN0PEZyYWdtZW50PigpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGZyYWdtZW50cy5hZGQoZik7CisgICAgICAgICAgICAgICAgICAgIGYubVJldGFpbmluZyA9IHRydWU7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiBmcmFnbWVudHM7CisgICAgfQorICAgIAorICAgIHZvaWQgc2F2ZUZyYWdtZW50Vmlld1N0YXRlKEZyYWdtZW50IGYpIHsKKyAgICAgICAgaWYgKGYubVZpZXcgPT0gbnVsbCkgeworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisgICAgICAgIGlmIChtU3RhdGVBcnJheSA9PSBudWxsKSB7CisgICAgICAgICAgICBtU3RhdGVBcnJheSA9IG5ldyBTcGFyc2VBcnJheTxQYXJjZWxhYmxlPigpOworICAgICAgICB9CisgICAgICAgIGYubVZpZXcuc2F2ZUhpZXJhcmNoeVN0YXRlKG1TdGF0ZUFycmF5KTsKKyAgICAgICAgaWYgKG1TdGF0ZUFycmF5LnNpemUoKSA+IDApIHsKKyAgICAgICAgICAgIGYubVNhdmVkVmlld1N0YXRlID0gbVN0YXRlQXJyYXk7CisgICAgICAgICAgICBtU3RhdGVBcnJheSA9IG51bGw7CisgICAgICAgIH0KKyAgICB9CisgICAgCisgICAgUGFyY2VsYWJsZSBzYXZlQWxsU3RhdGUoKSB7CisgICAgICAgIGlmIChtQWN0aXZlID09IG51bGwgfHwgbUFjdGl2ZS5zaXplKCkgPD0gMCkgeworICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIC8vIEZpcnN0IGNvbGxlY3QgYWxsIGFjdGl2ZSBmcmFnbWVudHMuCisgICAgICAgIGludCBOID0gbUFjdGl2ZS5zaXplKCk7CisgICAgICAgIEZyYWdtZW50U3RhdGVbXSBhY3RpdmUgPSBuZXcgRnJhZ21lbnRTdGF0ZVtOXTsKKyAgICAgICAgYm9vbGVhbiBoYXZlRnJhZ21lbnRzID0gZmFsc2U7CisgICAgICAgIGZvciAoaW50IGk9MDsgaTxOOyBpKyspIHsKKyAgICAgICAgICAgIEZyYWdtZW50IGYgPSBtQWN0aXZlLmdldChpKTsKKyAgICAgICAgICAgIGlmIChmICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBoYXZlRnJhZ21lbnRzID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAKKyAgICAgICAgICAgICAgICBGcmFnbWVudFN0YXRlIGZzID0gbmV3IEZyYWdtZW50U3RhdGUoZik7CisgICAgICAgICAgICAgICAgYWN0aXZlW2ldID0gZnM7CisgICAgICAgICAgICAgICAgCisgICAgICAgICAgICAgICAgaWYgKG1TdGF0ZUJ1bmRsZSA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIG1TdGF0ZUJ1bmRsZSA9IG5ldyBCdW5kbGUoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZi5vblNhdmVJbnN0YW5jZVN0YXRlKG1TdGF0ZUJ1bmRsZSk7CisgICAgICAgICAgICAgICAgaWYgKCFtU3RhdGVCdW5kbGUuaXNFbXB0eSgpKSB7CisgICAgICAgICAgICAgICAgICAgIGZzLm1TYXZlZEZyYWdtZW50U3RhdGUgPSBtU3RhdGVCdW5kbGU7CisgICAgICAgICAgICAgICAgICAgIG1TdGF0ZUJ1bmRsZSA9IG51bGw7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIAorICAgICAgICAgICAgICAgIGlmIChmLm1WaWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgc2F2ZUZyYWdtZW50Vmlld1N0YXRlKGYpOworICAgICAgICAgICAgICAgICAgICBpZiAoZi5tU2F2ZWRWaWV3U3RhdGUgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGZzLm1TYXZlZEZyYWdtZW50U3RhdGUgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZzLm1TYXZlZEZyYWdtZW50U3RhdGUgPSBuZXcgQnVuZGxlKCk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBmcy5tU2F2ZWRGcmFnbWVudFN0YXRlLnB1dFNwYXJzZVBhcmNlbGFibGVBcnJheSgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRnJhZ21lbnRNYW5hZ2VySW1wbC5WSUVXX1NUQVRFX1RBRywgZi5tU2F2ZWRWaWV3U3RhdGUpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgaWYgKGYubVRhcmdldCAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIGlmIChmcy5tU2F2ZWRGcmFnbWVudFN0YXRlID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZzLm1TYXZlZEZyYWdtZW50U3RhdGUgPSBuZXcgQnVuZGxlKCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgcHV0RnJhZ21lbnQoZnMubVNhdmVkRnJhZ21lbnRTdGF0ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBGcmFnbWVudE1hbmFnZXJJbXBsLlRBUkdFVF9TVEFURV9UQUcsIGYubVRhcmdldCk7CisgICAgICAgICAgICAgICAgICAgIGlmIChmLm1UYXJnZXRSZXF1ZXN0Q29kZSAhPSAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBmcy5tU2F2ZWRGcmFnbWVudFN0YXRlLnB1dEludCgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRnJhZ21lbnRNYW5hZ2VySW1wbC5UQVJHRVRfUkVRVUVTVF9DT0RFX1NUQVRFX1RBRywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZi5tVGFyZ2V0UmVxdWVzdENvZGUpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIAorICAgICAgICAgICAgICAgIGlmIChERUJVRykgTG9nLnYoVEFHLCAiU2F2ZWQgc3RhdGUgb2YgIiArIGYgKyAiOiAiCisgICAgICAgICAgICAgICAgICAgICAgICArIGZzLm1TYXZlZEZyYWdtZW50U3RhdGUpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIAorICAgICAgICBpZiAoIWhhdmVGcmFnbWVudHMpIHsKKyAgICAgICAgICAgIGlmIChERUJVRykgTG9nLnYoVEFHLCAic2F2ZUFsbFN0YXRlOiBubyBmcmFnbWVudHMhIik7CisgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgaW50W10gYWRkZWQgPSBudWxsOworICAgICAgICBCYWNrU3RhY2tTdGF0ZVtdIGJhY2tTdGFjayA9IG51bGw7CisgICAgICAgIAorICAgICAgICAvLyBCdWlsZCBsaXN0IG9mIGN1cnJlbnRseSBhZGRlZCBmcmFnbWVudHMuCisgICAgICAgIE4gPSBtQWRkZWQuc2l6ZSgpOworICAgICAgICBpZiAoTiA+IDApIHsKKyAgICAgICAgICAgIGFkZGVkID0gbmV3IGludFtOXTsKKyAgICAgICAgICAgIGZvciAoaW50IGk9MDsgaTxOOyBpKyspIHsKKyAgICAgICAgICAgICAgICBhZGRlZFtpXSA9IG1BZGRlZC5nZXQoaSkubUluZGV4OworICAgICAgICAgICAgICAgIGlmIChERUJVRykgTG9nLnYoVEFHLCAic2F2ZUFsbFN0YXRlOiBhZGRpbmcgZnJhZ21lbnQgIyIgKyBpCisgICAgICAgICAgICAgICAgICAgICAgICArICI6ICIgKyBtQWRkZWQuZ2V0KGkpKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgLy8gTm93IHNhdmUgYmFjayBzdGFjay4KKyAgICAgICAgaWYgKG1CYWNrU3RhY2sgIT0gbnVsbCkgeworICAgICAgICAgICAgTiA9IG1CYWNrU3RhY2suc2l6ZSgpOworICAgICAgICAgICAgaWYgKE4gPiAwKSB7CisgICAgICAgICAgICAgICAgYmFja1N0YWNrID0gbmV3IEJhY2tTdGFja1N0YXRlW05dOworICAgICAgICAgICAgICAgIGZvciAoaW50IGk9MDsgaTxOOyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgYmFja1N0YWNrW2ldID0gbmV3IEJhY2tTdGFja1N0YXRlKHRoaXMsIG1CYWNrU3RhY2suZ2V0KGkpKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKERFQlVHKSBMb2cudihUQUcsICJzYXZlQWxsU3RhdGU6IGFkZGluZyBiYWNrIHN0YWNrICMiICsgaQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgIjogIiArIG1CYWNrU3RhY2suZ2V0KGkpKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIEZyYWdtZW50TWFuYWdlclN0YXRlIGZtcyA9IG5ldyBGcmFnbWVudE1hbmFnZXJTdGF0ZSgpOworICAgICAgICBmbXMubUFjdGl2ZSA9IGFjdGl2ZTsKKyAgICAgICAgZm1zLm1BZGRlZCA9IGFkZGVkOworICAgICAgICBmbXMubUJhY2tTdGFjayA9IGJhY2tTdGFjazsKKyAgICAgICAgcmV0dXJuIGZtczsKKyAgICB9CisgICAgCisgICAgdm9pZCByZXN0b3JlQWxsU3RhdGUoUGFyY2VsYWJsZSBzdGF0ZSwgQXJyYXlMa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m1CYWNrU3RhY2tOZXN0aW5nID0gMDsKKyAgICAgICAgICAgICAgICBmLm1BZGRlZCA9IGZhbHNlOworICAgICAgICAgICAgICAgIGlmIChmcy5tU2F2ZWRGcmFnbWVudFN0YXRlICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgZi5tU2F2ZWRWaWV3U3RhdGUgPSBmcy5tU2F2ZWRGcmFnbWVudFN0YXRlLmdldFNwYXJzZVBhcmNlbGFibGVBcnJheSgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBGcmFnbWVudE1hbmFnZXJJbXBsLlZJRVdfU1RBVEVfVEFHKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIC8vIEJ1aWxkIHRoZSBmdWxsIGxpc3Qgb2YgYWN0aXZlIGZyYWdtZW50cywgaW5zdGFudGlhdGluZyB0aGVtIGZyb20KKyAgICAgICAgLy8gdGhlaXIgc2F2ZWQgc3RhdGUuCisgICAgICAgIG1BY3RpdmUgPSBuZXcgQXJyYXlMaXN0PEZyYWdtZW50PihmbXMubUFjdGl2ZS5sZW5ndGgpOworICAgICAgICBpZiAobUF2YWlsSW5kaWNlcyAhPSBudWxsKSB7CisgICAgICAgICAgICBtQXZhaWxJbmRpY2VzLmNsZWFyKCk7CisgICAgICAgIH0KKyAgICAgICAgZm9yIChpbnQgaT0wOyBpPGZtcy5tQWN0aXZlLmxlbmd0aDsgaSsrKSB7CisgICAgICAgICAgICBGcmFnbWVudFN0YXRlIGZzID0gZm1zLm1BY3RpdmVbaV07CisgICAgICAgICAgICBpZiAoZnMgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIEZyYWdtZW50IGYgPSBmcy5pbnN0YW50aWF0ZShtQWN0aXZpdHkpOworICAgICAgICAgICAgICAgIGlmIChERUJVRykgTG9nLnYoVEFHLCAicmVzdG9yZUFsbFN0YXRlOiBhZGRpbmcgIyIgKyBpICsgIjogIiArIGYpOworICAgICAgICAgICAgICAgIG1BY3RpdmUuYWRkKGYpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBpZiAoREVCVUcpIExvZy52KFRBRywgInJlc3RvcmVBbGxTdGF0ZTogYWRkaW5nICMiICsgaSArICI6IChudWxsKSIpOworICAgICAgICAgICAgICAgIG1BY3RpdmUuYWRkKG51bGwpOworICAgICAgICAgICAgICAgIGlmIChtQXZhaWxJbmRpY2VzID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgbUF2YWlsSW5kaWNlcyA9IG5ldyBBcnJheUxpc3Q8SW50ZWdlcj4oKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKERFQlVHKSBMb2cudihUQUcsICJyZXN0b3JlQWxsU3RhdGU6IGFkZGluZyBhdmFpbCAjIiArIGkpOworICAgICAgICAgICAgICAgIG1BdmFpbEluZGljZXMuYWRkKGkpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIAorICAgICAgICAvLyBCdWlsZCB0aGUgbGlzdCBvZiBjdXJyZW50bHkgYWRkZWQgZnJhZ21lbnRzLgorICAgICAgICBpZiAoZm1zLm1BZGRlZCAhPSBudWxsKSB7CisgICAgICAgICAgICBtQWRkZWQgPSBuZXcgQXJyYXlMaXN0PEZyYWdtZW50PihmbXMubUFkZGVkLmxlbmd0aCk7CisgICAgICAgICAgICBmb3IgKGludCBpPTA7IGk8Zm1zLm1BZGRlZC5sZW5ndGg7IGkrKykgeworICAgICAgICAgICAgICAgIEZyYWdtZW50IGYgPSBtQWN0aXZlLmdldChmbXMubUFkZGVkW2ldKTsKKyAgICAgICAgICAgICAgICBpZiAoZiA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIk5vIGluc3RhbnRpYXRlZCBmcmFnbWVudCBmb3IgaW5kZXggIyIgKyBmbXMubUFkZGVkW2ldKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZi5tQWRkZWQgPSB0cnVlOworICAgICAgICAgICAgICAgIGYubUltbWVkaWF0ZUFjdGl2aXR5ID0gbUFjdGl2aXR5OworICAgICAgICAgICAgICAgIGlmIChERUJVRykgTG9nLnYoVEFHLCAicmVzdG9yZUFsbFN0YXRlOiBtYWtpbmcgYWRkZWQgIyIgKyBpICsgIjogIiArIGYpOworICAgICAgICAgICAgICAgIG1BZGRlZC5hZGQoZik7CisgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBtQWRkZWQgPSBudWxsOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICAvLyBCdWlsZCB0aGUgYmFjayBzdGFjay4KKyAgICAgICAgaWYgKGZtcy5tQmFja1N0YWNrICE9IG51bGwpIHsKKyAgICAgICAgICAgIG1CYWNrU3RhY2sgPSBuZXcgQXJyYXlMaXN0PEJhY2tTdGFja0VudHJ5PihmbXMubUJhY2tTdGFjay5sZW5ndGgpOworICAgICAgICAgICAgZm9yIChpbnQgaT0wOyBpPGZtcy5tQmFja1N0YWNrLmxlbmd0aDsgaSsrKSB7CisgICAgICAgICAgICAgICAgQmFja1N0YWNrRW50cnkgYnNlID0gZm1zLm1CYWNrU3RhY2tbaV0uaW5zdGFudGlhdGUodGhpcyk7CisgICAgICAgICAgICAgICAgaWYgKERFQlVHKSBMb2cudihUQUcsICJyZXN0b3JlQWxsU3RhdGU6IGFkZGluZyBic2UgIyIgKyBpCisgICAgICAgICAgICAgICAgICAgICAgICArICIgKGluZGV4ICIgKyBic2UubUluZGV4ICsgIik6ICIgKyBic2UpOworICAgICAgICAgICAgICAgIG1CYWNrU3RhY2suYWRkKGJzZSk7CisgICAgICAgICAgICAgICAgaWYgKGJzZS5tSW5kZXggPj0gMCkgeworICAgICAgICAgICAgICAgICAgICBzZXRCYWNrU3RhY2tJbmRleChic2UubUluZGV4LCBic2UpO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ZJVFlfQ1JFQVRFRCwgZmFsc2UpOworICAgIH0KKyAgICAKKyAgICBwdWJsaWMgdm9pZCBkaXNwYXRjaERlc3Ryb3koKSB7CisgICAgICAgIG1vdmVUb1N0YXRlKEZyYWdtZW50LklOSVRJQUxJWklORywgZmFsc2UpOworICAgICAgICBtQWN0aXZpdHkgPSBudWxsOworICAgIH0KKyAgICAKKyAgICBwdWJsaWMgYm9vbGVhbiBkaXNwYXRjaENyZWF0ZU9wdGlvbnNNZW51KE1lbnUgbWVudSwgTWVudUluZmxhdGVyIGluZmxhdGVyKSB7CisgICAgICAgIGJvb2xlYW4gc2hvdyA9IGZhbHNlOworICAgICAgICBpZiAobUFjdGl2ZSAhPSBudWxsKSB7CisgICAgICAgICAgICBmb3IgKGludCBpPTA7IGk8bUFkZGVkLnNpemUoKTsgaSsrKSB7CisgICAgICAgICAgICAgICAgRnJhZ21lbnQgZiA9IG1BZGRlZC5nZXQoaSk7CisgICAgICAgICAgICAgICAgaWYgKGYgIT0gbnVsbCAmJiAhZi5tSGlkZGVuICYmIGYubUhhc01lbnUpIHsKKyAgICAgICAgICAgICAgICAgICAgc2hvdyA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgIGYub25DcmVhdGVPcHRpb25zTWVudShtZW51LCBpbmZsYXRlcik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiBzaG93OworICAgIH0KKyAgICAKKyAgICBwdWJsaWMgYm9vbGVhbiBkaXNwYXRjaFByZXBhcmVPcHRpb25zTWVudShNZW51IG1lbnUpIHsKKyAgICAgICAgYm9vbGVhbiBzaG93ID0gZmFsc2U7CisgICAgICAgIGlmIChtQWN0aXZlICE9IG51bGwpIHsKKyAgICAgICAgICAgIGZvciAoaW50IGk9MDsgaTxtQWRkZWQuc2l6ZSgpOyBpKyspIHsKKyAgICAgICAgICAgICAgICBGcmFnbWVudCBmID0gbUFkZGVkLmdldChpKTsKKyAgICAgICAgICAgICAgICBpZiAoZiAhPSBudWxsICYmICFmLm1IaWRkZW4gJiYgZi5tSGFzTWVudSkgeworICAgICAgICAgICAgICAgICAgICBzaG93ID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgZi5vblByZXBhcmVPcHRpb25zTWVudShtZW51KTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHNob3c7CisgICAgfQorICAgIAorICAgIHB1YmxpYyBib29sZWFuIGRpc3BhdGNoT3B0aW9uc0l0ZW1TZWxlY3RlZChNZW51SXRlbSBpdGVtKSB7CisgICAgICAgIGlmIChtQWN0aXZlICE9IG51bGwpIHsKKyAgICAgICAgICAgIGZvciAoaW50IGk9MDsgaTxtQWRkZWQuc2l6ZSgpOyBpKyspIHsKKyAgICAgICAgICAgICAgICBGcmFnbWVudCBmID0gbUFkZGVkLmdldChpKTsKKyAgICAgICAgICAgICAgICBpZiAoZiAhPSBudWxsICYmICFmLm1IaWRkZW4gJiYgZi5tSGFzTWVudSkgeworICAgICAgICAgICAgICAgICAgICBpZiAoZi5vbk9wdGlvbnNJdGVtU2VsZWN0ZWQoaXRlbSkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisgICAgCisgICAgcHVibGljIGJvb2xlYW4gZGlzcGF0Y2hDb250ZXh0SXRlbVNlbGVjdGVkKE1lbnVJdGVtIGl0ZW0pIHsKKyAgICAgICAgaWYgKG1BY3RpdmUgIT0gbnVsbCkgeworICAgICAgICAgICAgZm9yIChpbnQgaT0wOyBpPG1BZGRlZC5zaXplKCk7IGkrKykgeworICAgICAgICAgICAgICAgIEZyYWdtZW50IGYgPSBtQWRkZWQuZ2V0KGkpOworICAgICAgICAgICAgICAgIGlmIChmICE9IG51bGwgJiYgIWYubUhpZGRlbikgeworICAgICAgICAgICAgICAgICAgICBpZiAoZi5vbkNvbnRleHRJdGVtU2VsZWN0ZWQoaXRlbSkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisgICAgCisgICAgcHVibGljIHZvaWQgZGlzcGF0Y2hPcHRpb25zTWVudUNsb3NlZChNZW51IG1lbnUpIHsKKyAgICAgICAgaWYgKG1BY3RpdmUgIT0gbnVsbCkgeworICAgICAgICAgICAgZm9yIChpbnQgaT0wOyBpPG1BZGRlZC5zaXplKCk7IGkrKykgeworICAgICAgICAgICAgICAgIEZyYWdtZW50IGYgPSBtQWRkZWQuZ2V0KGkpOworICAgICAgICAgICAgICAgIGlmIChmICE9IG51bGwgJiYgIWYubUhpZGRlbiAmJiBmLm1IYXNNZW51KSB7CisgICAgICAgICAgICAgICAgICAgIGYub25PcHRpb25zTWVudUNsb3NlZChtZW51KTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisgICAgCisgICAgcHVibGljIHN0YXRpYyBpbnQgcmV2ZXJzZVRyYW5zaXQoaW50IHRyYW5zaXQpIHsKKyAgICAgICAgaW50IHJldiA9IDA7CisgICAgICAgIHN3aXRjaCAodHJhbnNpdCkgeworICAgICAgICAgICAgY2FzZSBGcmFnbWVudFRyYW5zYWN0aW9uLlRSQU5TSVRfRlJBR01FTlRfT1BFTjoKKyAgICAgICAgICAgICAgICByZXYgPSBGcmFnbWVudFRyYW5zYWN0aW9uLlRSQU5TSVRfRlJBR01FTlRfQ0xPU0U7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIEZyYWdtZW50VHJhbnNhY3Rpb24uVFJBTlNJVF9GUkFHTUVOVF9DTE9TRToKKyAgICAgICAgICAgICAgICByZXYgPSBGcmFnbWVudFRyYW5zYWN0aW9uLlRSQU5TSVRfRlJBR01FTlRfT1BFTjsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gcmV2OworICAgICAgICAKKyAgICB9CisgICAgCisgICAgcHVibGljIHN0YXRpYyBpbnQgdHJhbnNpdFRvU3R5bGVJbmRleChpbnQgdHJhbnNpdCwgYm9vbGVhbiBlbnRlcikgeworICAgICAgICBpbnQgYW5pbUF0dHIgPSAtMTsKKyAgICAgICAgc3dpdGNoICh0cmFuc2l0KSB7CisgICAgICAgICAgICBjYXNlIEZyYWdtZW50VHJhbnNhY3Rpb24uVFJBTlNJVF9GUkFHTUVOVF9PUEVOOgorICAgICAgICAgICAgICAgIGFuaW1BdHRyID0gZW50ZXIKKyAgICAgICAgICAgICAgICAgICAgPyBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5GcmFnbWVudEFuaW1hdGlvbl9mcmFnbWVudE9wZW5FbnRlckFuaW1hdGlvbgorICAgICAgICAgICAgICAgICAgICA6IGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLkZyYWdtZW50QW5pbWF0aW9uX2ZyYWdtZW50T3BlbkV4aXRBbmltYXRpb247CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIEZyYWdtZW50VHJhbnNhY3Rpb24uVFJBTlNJVF9GUkFHTUVOVF9DTE9TRToKKyAgICAgICAgICAgICAgICBhbmltQXR0ciA9IGVudGVyCisgICAgICAgICAgICAgICAgICAgID8gY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuRnJhZ21lbnRBbmltYXRpb25fZnJhZ21lbnRDbG9zZUVudGVyQW5pbWF0aW9uCisgICAgICAgICAgICAgICAgICAgIDogY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuRnJhZ21lb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CwgbGFzdE5vbkNvbmZpZ3VyYXRpb25JbnN0YW5jZSwgbmV3IENvbmZpZ3VyYXRpb24oKSk7CisgICAgICAgIGFjdGl2aXR5LmF0dGFjaChjb250ZXh0LCBhVGhyZWFkLCB0aGlzLCB0b2tlbiwgYXBwbGljYXRpb24sIGludGVudCwKKyAgICAgICAgICAgICAgICBpbmZvLCB0aXRsZSwgcGFyZW50LCBpZCwKKyAgICAgICAgICAgICAgICAoQWN0aXZpdHkuTm9uQ29uZmlndXJhdGlvbkluc3RhbmNlcylsYXN0Tm9uQ29uZmlndXJhdGlvbkluc3RhbmNlLAorICAgICAgICAgICAgICAgIG5ldyBDb25maWd1cmF0aW9uKCkpOwogICAgICAgICByZXR1cm4gYWN0aXZpdHk7CiAgICAgfQogCkBAIC0xMDU4LDIxICsxMDYwLDIzIEBACiAgICAgfQogICAgIAogICAgIHB1YmxpYyB2b2lkIGNhbGxBY3Rpdml0eU9uRGVzdHJveShBY3Rpdml0eSBhY3Rpdml0eSkgewotICAgICAgaWYgKG1XYWl0aW5nQWN0aXZpdGllcyAhPSBudWxsKSB7Ci0gICAgICAgICAgc3luY2hyb25pemVkIChtU3luYykgewotICAgICAgICAgICAgICBmaW5hbCBpbnQgTiA9IG1XYWl0aW5nQWN0aXZpdGllcy5zaXplKCk7Ci0gICAgICAgICAgICAgIGZvciAoaW50IGk9MDsgaTxOOyBpKyspIHsKLSAgICAgICAgICAgICAgICAgIGZpbmFsIEFjdGl2aXR5V2FpdGVyIGF3ID0gbVdhaXRpbmdBY3Rpdml0aWVzLmdldChpKTsKLSAgICAgICAgICAgICAgICAgIGZpbmFsIEludGVudCBpbnRlbnQgPSBhdy5pbnRlbnQ7Ci0gICAgICAgICAgICAgICAgICBpZiAoaW50ZW50LmZpbHRlckVxdWFscyhhY3Rpdml0eS5nZXRJbnRlbnQoKSkpIHsKLSAgICAgICAgICAgICAgICAgICAgICBhdy5hY3Rpdml0eSA9IGFjdGl2aXR5OwotICAgICAgICAgICAgICAgICAgICAgIG1NZXNzYWdlUXVldWUuYWRkSWRsZUhhbmRsZXIobmV3IEFjdGl2aXR5R29pbmcoYXcpKTsKLSAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgfQotICAgICAgICAgIH0KLSAgICAgIH0KKyAgICAgIC8vIFRPRE86IHRoZSBmb2xsb3dpbmcgYmxvY2sgY2F1c2VzIGludGVybWl0dGVudCBoYW5ncyB3aGVuIHVzaW5nIHN0YXJ0QWN0aXZpdHkKKyAgICAgIC8vIHRlbXBvcmFyaWx5IGNvbW1lbnQgb3V0IHVudGlsIHJvb3QgY2F1c2UgaXMgZml4ZWQgKGJ1ZyAyNjMwNjgzKQorLy8gICAgICBpZiAobVdhaXRpbmdBY3Rpdml0aWVzICE9IG51bGwpIHsKKy8vICAgICAgICAgIHN5bmNocm9uaXplZCAobVN5bmMpIHsKKy8vICAgICAgICAgICAgICBmaW5hbCBpbnQgTiA9IG1XYWl0aW5nQWN0aXZpdGllcy5zaXplKCk7CisvLyAgICAgICAgICAgICAgZm9yIChpbnQgaT0wOyBpPE47IGkrKykgeworLy8gICAgICAgICAgICAgICAgICBmaW5hbCBBY3Rpdml0eVdhaXRlciBhdyA9IG1XYWl0aW5nQWN0aXZpdGllcy5nZXQoaSk7CisvLyAgICAgICAgICAgICAgICAgIGZpbmFsIEludGVudCBpbnRlbnQgPSBhdy5pbnRlbnQ7CisvLyAgICAgICAgICAgICAgICAgIGlmIChpbnRlbnQuZmlsdGVyRXF1YWxzKGFjdGl2aXR5LmdldEludGVudCgpKSkgeworLy8gICAgICAgICAgICAgICAgICAgICAgYXcuYWN0aXZpdHkgPSBhY3Rpdml0eTsKKy8vICAgICAgICAgICAgICAgICAgICAgIG1NZXNzYWdlUXVldWUuYWRkSWRsZUhhbmRsZXIobmV3IEFjdGl2aXR5R29pbmcoYXcpKTsKKy8vICAgICAgICAgICAgICAgICAgfQorLy8gICAgICAgICAgICAgIH0KKy8vICAgICAgICAgIH0KKy8vICAgICAgfQogICAgICAgCi0gICAgICBhY3Rpdml0eS5vbkRlc3Ryb3koKTsKKyAgICAgIGFjdGl2aXR5LnBlcmZvcm1EZXN0cm95KCk7CiAgICAgICAKICAgICAgIGlmIChtQWN0aXZpdHlNb25pdG9ycyAhPSBudWxsKSB7CiAgICAgICAgICAgc3luY2hyb25pemVkIChtU3luYykgewpAQCAtMTMzMSw3ICsxMzM1LDcgQEAKICAgICAgKiAgICAgICAgICAgICAgICAgICAgICBpcyBiZWluZyBzdGFydGVkLgogICAgICAqIEBwYXJhbSB0b2tlbiBJbnRlcm5hbCB0b2tlbiBpZGVudGlmeWluZyB0byB0aGUgc3lzdGVtIHdobyBpcyBzdGFydGluZyAKICAgICAgKiAgICAgICAgICAgICAgdGhlIGFjdGl2aXR5OyBtYXkgYmUgbnVsbC4KLSAgICAgKiBAcGFyYW0gdGFyZ2V0IFdoaWNoIGFjdGl2aXR5IGlzIHBlcmZvcm0gdGhlIHN0YXJ0IChhbmQgdGh1cyByZWNlaXZpbmcgCisgICAgICogQHBhcmFtIHRhcmdldCBXaGljaCBhY3Rpdml0eSBpcyBwZXJmb3JtaW5nIHRoZSBzdGFydCAoYW5kIHRodXMgcmVjZWl2aW5nIAogICAgICAqICAgICAgICAgICAgICAgYW55IHJlc3VsdCk7IG1heSBiZSBudWxsIGlmIHRoaXMgY2FsbCBpcyBub3QgYmVpbmcgbWFkZQogICAgICAqICAgICAgICAgICAgICAgZnJvbSBhbiBhY3Rpdml0eS4KICAgICAgKiBAcGFyYW0gaW50ZW50IFRoZSBhY3R1YWwgSW50ZW50IHRvIHN0YXJ0LgpAQCAtMTM4MSw2ICsxMzg1LDY0IEBACiAgICAgICAgIHJldHVybiBudWxsOwogICAgIH0KIAorICAgIC8qKgorICAgICAqIExpa2Uge0BsaW5rICNleGVjU3RhcnRBY3Rpdml0eShDb250ZXh0LCBJQmluZGVyLCBJQmluZGVyLCBBY3Rpdml0eSwgSW50ZW50LCBpbnQpfSwKKyAgICAgKiBidXQgZm9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Vyd2lzZQorICAgICAqICAgICAgICAgcmV0dXJuIG51bGwuICBUaGUgZGVmYXVsdCBpbXBsZW1lbnRhdGlvbiBhbHdheXMgcmV0dXJucyBudWxsLgorICAgICAqICAKKyAgICAgKiBAdGhyb3dzIGFuZHJvaWQuY29udGVudC5BY3Rpdml0eU5vdEZvdW5kRXhjZXB0aW9uCisgICAgICogCisgICAgICogQHNlZSBBY3Rpdml0eSNzdGFydEFjdGl2aXR5KEludGVudCkKKyAgICAgKiBAc2VlIEFjdGl2aXR5I3N0YXJ0QWN0aXZpdHlGb3JSZXN1bHQoSW50ZW50LCBpbnQpCisgICAgICogQHNlZSBBY3Rpdml0eSNzdGFydEFjdGl2aXR5RnJvbUNoaWxkCisgICAgICogCisgICAgICoge0BoaWRlfQorICAgICAqLworICAgIHB1YmxpYyBBY3Rpdml0eVJlc3VsdCBleGVjU3RhcnRBY3Rpdml0eSgKKyAgICAgICAgQ29udGV4dCB3aG8sIElCaW5kZXIgY29udGV4dFRocmVhZCwgSUJpbmRlciB0b2tlbiwgRnJhZ21lbnQgdGFyZ2V0LAorICAgICAgICBJbnRlbnQgaW50ZW50LCBpbnQgcmVxdWVzdENvZGUpIHsKKyAgICAgICAgSUFwcGxpY2F0aW9uVGhyZWFkIHdob1RocmVhZCA9IChJQXBwbGljYXRpb25UaHJlYWQpIGNvbnRleHRUaHJlYWQ7CisgICAgICAgIGlmIChtQWN0aXZpdHlNb25pdG9ycyAhPSBudWxsKSB7CisgICAgICAgICAgICBzeW5jaHJvbml6ZWQgKG1TeW5jKSB7CisgICAgICAgICAgICAgICAgZmluYWwgaW50IE4gPSBtQWN0aXZpdHlNb25pdG9ycy5zaXplKCk7CisgICAgICAgICAgICAgICAgZm9yIChpbnQgaT0wOyBpPE47IGkrKykgeworICAgICAgICAgICAgICAgICAgICBmaW5hbCBBY3Rpdml0eU1vbml0b3IgYW0gPSBtQWN0aXZpdHlNb25pdG9ycy5nZXQoaSk7CisgICAgICAgICAgICAgICAgICAgIGlmIChhbS5tYXRjaCh3aG8sIG51bGwsIGludGVudCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGFtLm1IaXRzKys7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYW0uaXNCbG9ja2luZygpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJlcXVlc3RDb2RlID49IDAgPyBhbS5nZXRSZXN1bHQoKSA6IG51bGw7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICB0cnkgeworICAgICAgICAgICAgaW50IHJlc3VsdCA9IEFjdGl2aXR5TWFuYWdlck5hdGl2ZS5nZXREZWZhdWx0KCkKKyAgICAgICAgICAgICAgICAuc3RhcnRBY3Rpdml0eSh3aG9UaHJlYWQsIGludGVudCwKKyAgICAgICAgICAgICAgICAgICAgICAgIGludGVudC5yZXNvbHZlVHlwZUlmTmVlZGVkKHdoby5nZXRDb250ZW50UmVzb2x2ZXIoKSksCisgICAgICAgICAgICAgICAgICAgICAgICBudWxsLCAwLCB0b2tlbiwgdGFyZ2V0ICE9IG51bGwgPyB0YXJnZXQubVdobyA6IG51bGwsCisgICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0Q29kZSwgZmFsc2UsIGZhbHNlKTsKKyAgICAgICAgICAgIGNoZWNrU3RhcnRBY3Rpdml0eVJlc3VsdChyZXN1bHQsIGludGVudCk7CisgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIG51bGw7CisgICAgfQorCiAgICAgLypwYWNrYWdlKi8gZmluYWwgdm9pZCBpbml0KEFjdGl2aXR5VGhyZWFkIHRocmVhZCwKICAgICAgICAgICAgIENvbnRleHQgaW5zdHJDb250ZXh0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AgbUxpc3RTaG93biA9IHNob3duOworICAgICAgICBpZiAoc2hvd24pIHsKKyAgICAgICAgICAgIGlmIChhbmltYXRlKSB7CisgICAgICAgICAgICAgICAgbVByb2dyZXNzQ29udGFpbmVyLnN0YXJ0QW5pbWF0aW9uKEFuaW1hdGlvblV0aWxzLmxvYWRBbmltYXRpb24oCisgICAgICAgICAgICAgICAgICAgICAgICBnZXRBY3Rpdml0eSgpLCBhbmRyb2lkLlIuYW5pbS5mYWRlX291dCkpOworICAgICAgICAgICAgICAgIG1MaXN0Q29udGFpbmVyLnN0YXJ0QW5pbWF0aW9uKEFuaW1hdGlvblV0aWxzLmxvYWRBbmltYXRpb24oCisgICAgICAgICAgICAgICAgICAgICAgICBnZXRBY3Rpdml0eSgpLCBhbmRyb2lkLlIuYW5pbS5mYWRlX2luKSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBtUHJvZ3Jlc3NDb250YWluZXIuc2V0VmlzaWJpbGl0eShWaWV3LkdPTkUpOworICAgICAgICAgICAgbUxpc3RDb250YWluZXIuc2V0VmlzaWJpbGl0eShWaWV3LlZJU0lCTEUpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgaWYgKGFuaW1hdGUpIHsKKyAgICAgICAgICAgICAgICBtUHJvZ3Jlc3NDb250YWluZXIuc3RhcnRBbmltYXRpb24oQW5pbWF0aW9uVXRpbHMubG9hZEFuaW1hdGlvbigKKyAgICAgICAgICAgICAgICAgICAgICAgIGdldEFjdGl2aXR5KCksIGFuZHJvaWQuUi5hbmltLmZhZGVfaW4pKTsKKyAgICAgICAgICAgICAgICBtTGlzdENvbnRhaW5lci5zdGFydEFuaW1hdGlvbihBbmltYXRpb25VdGlscy5sb2FkQW5pbWF0aW9uKAorICAgICAgICAgICAgICAgICAgICAgICAgZ2V0QWN0aXZpdHkoKSwgYW5kcm9pZC5SLmFuaW0uZmFkZV9vdXQpKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1Qcm9ncmVzc0NvbnRhaW5lci5zZXRWaXNpYmlsaXR5KFZpZXcuVklTSUJMRSk7CisgICAgICAgICAgICBtTGlzdENvbnRhaW5lci5zZXRWaXNpYmlsaXR5KFZpZXcuR09ORSk7CisgICAgICAgIH0KKyAgICB9CisgICAgCisgICAgLyoqCisgICAgICogR2V0IHRoZSBMaXN0QWRhcHRlciBhc3NvY2lhdGVkIHdpdGggdGhpcyBhY3Rpdml0eSdzIExpc3RWaWV3LgorICAgICAqLworICAgIHB1YmxpYyBMaXN0QWRhcHRlciBnZXRMaXN0QWRhcHRlcigpIHsKKyAgICAgICAgcmV0dXJuIG1BZGFwdGVyOworICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBlbnN1cmVMaXN0KCkgeworICAgICAgICBpZiAobUxpc3QgIT0gbnVsbCkgeworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisgICAgICAgIFZpZXcgcm9vdCA9IGdldFZpZXcoKTsKKyAgICAgICAgaWYgKHJvb3QgPT0gbnVsbCkgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiQ29udGVudCB2aWV3IG5vdCB5ZXQgY3JlYXRlZCIpOworICAgICAgICB9CisgICAgICAgIGlmIChyb290IGluc3RhbmNlb2YgTGlzdFZpZXcpIHsKKyAgICAgICAgICAgIG1MaXN0ID0gKExpc3RWaWV3KXJvb3Q7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBtU3RhbmRhcmRFbXB0eVZpZXcgPSAoVGV4dFZpZXcpcm9vdC5maW5kVmlld0J5SWQoCisgICAgICAgICAgICAgICAgICAgIGNvbS5hbmRyb2lkLmludGVybmFsLlIuaWQuaW50ZXJuYWxFbXB0eSk7CisgICAgICAgICAgICBpZiAobVN0YW5kYXJkRW1wdHlWaWV3ID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICBtRW1wdHlWaWV3ID0gcm9vdC5maW5kVmlld0J5SWQoYW5kcm9pZC5SLmlkLmVtcHR5KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1Qcm9ncmVzc0NvbnRhaW5lciA9IHJvb3QuZmluZFZpZXdCeUlkKGNvbS5hbmRyb2lkLmludGVybmFsLlIuaWQucHJvZ3Jlc3NDb250YWluZXIpOworICAgICAgICAgICAgbUxpc3RDb250YWluZXIgPSByb290LmZpbmRWaWV3QnlJZChjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmlkLmxpc3RDb250YWluZXIpOworICAgICAgICAgICAgVmlldyByYXdMaXN0VmlldyA9IHJvb3QuZmluZFZpZXdCeUlkKGFuZHJvaWQuUi5pZC5saXN0KTsKKyAgICAgICAgICAgIGlmICghKHJhd0xpc3RWaWV3IGluc3RhbmNlb2YgTGlzdFZpZXcpKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFJ1bnRpbWVFeGNlcHRpb24oCisgICAgICAgICAgICAgICAgICAgICAgICAiQ29udGVudCBoYXMgdmlldyB3aXRoIGlkIGF0dHJpYnV0ZSAnYW5kcm9pZC5SLmlkLmxpc3QnICIKKyAgICAgICAgICAgICAgICAgICAgICAgICsgInRoYXQgaXMgbm90IGEgTGlzdFZpZXcgY2xhc3MiKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1MaXN0ID0gKExpc3RWaWV3KXJhd0xpc3RWaWV3OworICAgICAgICAgICAgaWYgKG1MaXN0ID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgUnVudGltZUV4Y2VwdGlvbigKKyAgICAgICAgICAgICAgICAgICAgICAgICJZb3VyIGNvbnRlbnQgbXVzdCBoYXZlIGEgTGlzdFZpZXcgd2hvc2UgaWQgYXR0cmlidXRlIGlzICIgKworICAgICAgICAgICAgICAgICAgICAgICAgIidhbmRyb2lkLlIuaWQubGlzdCciKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChtRW1wdHlWaWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBtTG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0YXJ0ZWQpIHsKKyAgICAgICAgICAgICAgICAvLyBPdXIgb3duZXIgaXMgc3RhcnRlZCwgYnV0IHdlIHdlcmUgYmVpbmcgcmV0YWluZWQgZnJvbSBhCisgICAgICAgICAgICAgICAgLy8gcHJldmlvdXMgaW5zdGFuY2UgaW4gdGhlIHN0YXJ0ZWQgc3RhdGUuLi4gIHNvIHRoZXJlIGlzIHJlYWxseQorICAgICAgICAgICAgICAgIC8vIG5vdGhpbmcgdG8gZG8gaGVyZSwgc2luY2UgdGhlIGxvYWRlcnMgYXJlIHN0aWxsIHN0YXJ0ZWQuCisgICAgICAgICAgICAgICAgbVN0YXJ0ZWQgPSB0cnVlOworICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKG1TdGFydGVkKSB7CisgICAgICAgICAgICAgICAgLy8gSWYgbG9hZGVyIGFscmVhZHkgc3RhcnRlZCwgZG9uJ3QgcmVzdGFydC4KKyAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmIChERUJVRykgTG9nLnYoVEFHLCAiICBTdGFydGluZzogIiArIHRoaXMpOworICAgICAgICAgICAgaWYgKG1Mb2FkZXIgPT0gbnVsbCAmJiBtQ2FsbGJhY2tzICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgIG1Mb2FkZXIgPSBtQ2FsbGJhY2tzLm9uQ3JlYXRlTG9hZGVyKG1JZCwgbUFyZ3MpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKG1Mb2FkZXIgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGlmICghbUxpc3RlbmVyUmVnaXN0ZXJlZCkgeworICAgICAgICAgICAgICAgICAgICBtTG9hZGVyLnJlZ2lzdGVyTGlzdGVuZXIobUlkLCB0aGlzKTsKKyAgICAgICAgICAgICAgICAgICAgbUxpc3RlbmVyUmVnaXN0ZXJlZCA9IHRydWU7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIG1Mb2FkZXIuc3RhcnRMb2FkaW5nKCk7CisgICAgICAgICAgICAgICAgbVN0YXJ0ZWQgPSB0cnVlOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIAorICAgICAgICB2b2lkIHJldGFpbigpIHsKKyAgICAgICAgICAgIGlmIChERUJVRykgTG9nLnYoVEFHLCAiICBSZXRhaW5pbmc6ICIgKyB0aGlzKTsKKyAgICAgICAgICAgIG1SZXRhaW5pbmcgPSB0cnVlOworICAgICAgICAgICAgbVJldGFpbmluZ1N0YXJ0ZWQgPSBtU3RhcnRlZDsKKyAgICAgICAgICAgIG1TdGFydGVkID0gZmFsc2U7CisgICAgICAgICAgICBtQ2FsbGJhY2tzID0gbnVsbDsKKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgdm9pZCBmaW5pc2hSZXRhaW4oKSB7CisgICAgICAgICAgICBpZiAobVJldGFpbmluZykgeworICAgICAgICAgICAgICAgIGlmIChERUJVRykgTG9nLnYoVEFHLCAiICBGaW5pc2hlZCBSZXRhaW5pbmc6ICIgKyB0aGlzKTsKKyAgICAgICAgICAgICAgICBtUmV0YWluaW5nID0gZmFsc2U7CisgICAgICAgICAgICAgICAgaWYgKG1TdGFydGVkICE9IG1SZXRhaW5pbmdTdGFydGVkKSB7CisgICAgICAgICAgICAgICAgICAgIGlmICghbVN0YXJ0ZWQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIFRoaXMgbG9hZGVyIHdhcyByZXRhaW5lZCBpbiBhIHN0YXJ0ZWQgc3RhdGUsIGJ1dAorICAgICAgICAgICAgICAgICAgICAgICAgLy8gYXQgdGhlIGVuZCBvZiByZXRhaW5pbmcgZXZlcnl0aGluZyBvdXIgb3duZXIgaXMKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIG5vIGxvbmdlciBzdGFydGVkLi4uICBzbyBtYWtlIGl0IHN0b3AuCisgICAgICAgICAgICAgICAgICAgICAgICBzdG9wKCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKG1TdGFydGVkICYmIG1EYXRhICE9IG51bGwgJiYgbUNhbGxiYWNrcyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIC8vIFRoaXMgbG9hZGVyIHdhcyByZXRhaW5lZCwgYW5kIG5vdyBhdCB0aGUgcG9pbnQgb2YKKyAgICAgICAgICAgICAgICAgICAgLy8gZmluaXNoaW5nIHRoZSByZXRhaW4gd2UgZmluZCB3ZSByZW1haW4gc3RhcnRlZCwgaGF2ZQorICAgICAgICAgICAgICAgICAgICAvLyBvdXIgZGF0YSwgYW5kIHRoZSBvd25lciBoYXMgYSBuZXcgY2FsbGJhY2suLi4gIHNvCisgICAgICAgICAgICAgICAgICAgIC8vIGxldCdzIGRlbGl2ZXIgdGhlIGRhdGEgbm93LgorICAgICAgICAgICAgICAgICAgICBtQ2FsbGJhY2tzLm9uTG9hZEZpbmlzaGVkKG1Mb2FkZXIsIG1EYXRhKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIHZvaWQgc3RvcCgpIHsKKyAgICAgICAgICAgIGlmIChERUJVRykgTG9nLnYoVEFHLCAiICBTdG9wcGluZzogIiArIHRoaXMpOworICAgICAgICAgICAgbVN0YXJ0ZWQgPSBmYWxzZTsKKyAgICAgICAgICAgIGlmICghbVJldGFpbmluZykgeworICAgICAgICAgICAgICAgIGlmIChtTG9hZGVyICE9IG51bGwgJiYgbUxpc3RlbmVyUmVnaXN0ZXJlZCkgeworICAgICAgICAgICAgICAgICAgICAvLyBMZXQgdGhlIGxvYWRlciBrbm93IHdlJ3JlIGRvbmUgd2l0aCBpdAorICAgICAgICAgICAgICAgICAgICBtTGlzdGVuZXJSZWdpc3RlcmVkID0gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgIG1Mb2FkZXIudW5yZWdpc3Rlckxpc3RlbmVyKHRoaXMpOworICAgICAgICAgICAgICAgICAgICBtTG9hZGVyLnN0b3BMb2FkaW5nKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIG1EYXRhID0gbnVsbDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgdm9pZCBkZXN0cm95KCkgeworICAgICAgICAgICAgaWYgKERFQlVHKSBMb2cudihUQUcsICIgIERlc3Ryb3lpbmc6ICIgKyB0aGlzKTsKKyAgICAgICAgICAgIG1EZXN0cm95ZWQgPSB0cnVlOworICAgICAgICAgICAgbUNhbGxiYWNrcyA9IG51bGw7CisgICAgICAgICAgICBpZiAobUxvYWRlciAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgaWYgKG1MaXN0ZW5lclJlZ2lzdGVyZWQpIHsKKyAgICAgICAgICAgICAgICAgICAgbUxpc3RlbmVyUmVnaXN0ZXJlZCA9IGZhbHNlOworICAgICAgICAgICAgICAgICAgICBtTG9hZGVyLnVucmVnaXN0ZXJMaXN0ZW5lcih0aGlzKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgbUxvYWRlci5kZXN0cm95KCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIEBPdmVycmlkZSBwdWJsaWMgdm9pZCBvbkxvYWRDb21wbGV0ZShMb2FkZXI8T2JqZWN0PiBsb2FkZXIsIE9iamVjdCBkYXRhKSB7CisgICAgICAgICAgICBpZiAoREVCVUcpIExvZy52KFRBRywgIm9uTG9hZENvbXBsZXRlOiAiICsgdGhpcyArICIgbURlc3Ryb3llZD0iICsgbURlc3Ryb3llZCk7CisKKyAgICAgICAgICAgIGlmIChtRGVzdHJveWVkKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorICAgICAgICAgICAgCisgICAgICAgICAgICAvLyBOb3RpZnkgb2YgdGhlIG5ldyBkYXRhIHNvIHRoZSBhcHAgY2FuIHN3aXRjaCBvdXQgdGhlIG9sZCBkYXRhIGJlZm9yZQorICAgICAgICAgICAgLy8gd2UgdHJ5IHRvIGRlc3Ryb3kgaXQuCisgICAgICAgICAgICBtRGF0YSA9IGRhdGE7CisgICAgICAgICAgICBpZiAobUNhbGxiYWNrcyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgbUNhbGxiYWNrcy5vbkxvYWRGaW5pc2hlZChsb2FkZXIsIGRhdGEpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAoREVCVUcpIExvZy52KFRBRywgIm9uTG9hZEZpbmlzaGVkIHJldHVybmVkOiAiICsgdGhpcyk7CisKKyAgICAgICAgICAgIC8vIFdlIGhhdmUgbm93IGdpdmVuIHRoZSBhcHBsaWNhdGlvbiB0aGUgbmV3IGxvYWRlciB3aXRoIGl0cworICAgICAgICAgICAgLy8gbG9hZGVkIGRhdGEsIHNvIGl0IHNob3VsZCBoYXZlIHN0b3BwZWQgdXNpbmcgdGhlIHByZXZpb3VzCisgICAgICAgICAgICAvLyBsb2FkZXIuICBJZiB0aGVyZSBpcyBhIHByZXZpb3VzIGxvYWRlciBvbiB0aGUgaW5hY3RpdmUgbGlzdCwKKyAgICAgICAgICAgIC8vIGNsZWFuIGl0IHVwLgorICAgICAgICAgICAgTG9hZGVySW5mbyBpbmZvID0gbUluYWN0aXZlTG9hZGVycy5nZXQobUlkKTsKKyAgICAgICAgICAgIGlmIChpbmZvICE9IG51bGwgJiYgaW5mbyAhPSB0aGlzKSB7CisgICAgICAgICAgICAgICAgaW5mby5kZXN0cm95KCk7CisgICAgICAgICAgICAgICAgbUluYWN0aXZlTG9hZGVycy5yZW1vdmUobUlkKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgU3RyaW5nIHRvU3RyaW5nKCkgeworICAgICAgICAgICAgU3RyaW5nQnVpbGRlciBzYiA9IG5ldyBTdHJpbmdCdWlsZGVyKDY0KTsKKyAgICAgICAgICAgIHNiLmFwcGVuZCgiTG9hZGVySW5mb3siKTsKKyAgICAgICAgICAgIHNiLmFwcGVuZChJbnRlZ2VyLnRvSGV4U3RyaW5nKFN5c3RlbS5pZGVudGl0eUhhc2hDb2RlKHRoaXMpKSk7CisgICAgICAgICAgICBzYi5hcHBlbmQoIiAjIik7CisgICAgICAgICAgICBzYi5hcHBlbmQobUlkKTsKKyAgICAgICAgICAgIGlmIChtQXJncyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgc2IuYXBwZW5kKCIgIik7CisgICAgICAgICAgICAgICAgc2IuYXBwZW5kKG1BcmdzLnRvU3RyaW5nKCkpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgc2IuYXBwZW5kKCJ9Iik7CisgICAgICAgICAgICByZXR1cm4gc2IudG9TdHJpbmcoKTsKKyAgICAgICAgfQorICAgIH0KKyAgICAKKyAgICBMb2FkZXJNYW5hZ2VySW1wbChib29sZWFuIHN0YXJ0ZWQpIHsKKyAgICAgICAgbVN0YXJ0ZWQgPSBzdGFydGVkOworICAgIH0KKyAgICAKKyAgICBwcml2YXRlIExvYWRlckluZm8gY3JlYXRlTG9hZGVyKGludCBpZCwgQnVuZGxlIGFyZ3MsCisgICAgICAgICAgICBMb2FkZXJNYW5hZ2VyLkxvYWRlckNhbGxiYWNrczxPYmplY3Q+IGNhbGxiYWNrKSB7CisgICAgICAgIExvYWRlckluZm8gaW5mbyA9IG5ldyBMb2FkZXJJbmZvKGlkLCBhcmdzLCAgKExvYWRlck1hbmFnZXIuTG9hZGVyQ2FsbGJhY2tzPE9iamVjdD4pY2FsbGJhY2spOworICAgICAgICBtTG9hZGVycy5wdXQoaWQsIGluZm8pOworICAgICAgICBMb2FkZXI8T2JqZWN0PiBsb2FkZXIgPSBjYWxsYmFjay5vbkNyZWF0ZUxvYWRlcihpZCwgYXJncyk7CisgICAgICAgIGluZm8ubUxvYWRlciA9IChMb2FkZXI8T2JqZWN0P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KWNhbGxiYWNrOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICBpZiAoaW5mby5tRGF0YSAhPSBudWxsICYmIG1TdGFydGVkKSB7CisgICAgICAgICAgICAvLyBJZiB0aGUgbG9hZGVyIGhhcyBhbHJlYWR5IGdlbmVyYXRlZCBpdHMgZGF0YSwgcmVwb3J0IGl0IG5vdy4KKyAgICAgICAgICAgIGluZm8ubUNhbGxiYWNrcy5vbkxvYWRGaW5pc2hlZChpbmZvLm1Mb2FkZXIsIGluZm8ubURhdGEpOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICByZXR1cm4gKExvYWRlcjxEPilpbmZvLm1Mb2FkZXI7CisgICAgfQorICAgIAorICAgIEBTdXBwcmVzc1dhcm5pbmdzKCJ1bmNoZWNrZWQiKQorICAgIHB1YmxpYyA8RD4gTG9hZGVyPEQ+IHJlc3RhcnRMb2FkZXIoaW50IGlkLCBCdW5kbGUgYXJncywgTG9hZGVyTWFuYWdlci5Mb2FkZXJDYWxsYmFja3M8RD4gY2FsbGJhY2spIHsKKyAgICAgICAgTG9hZGVySW5mbyBpbmZvID0gbUxvYWRlcnMuZ2V0KGlkKTsKKyAgICAgICAgaWYgKERFQlVHKSBMb2cudihUQUcsICJyZXN0YXJ0TG9hZGVyIGluICIgKyB0aGlzICsgIjogY3VyPSIgKyBpbmZvKTsKKyAgICAgICAgaWYgKGluZm8gIT0gbnVsbCkgeworICAgICAgICAgICAgTG9hZGVySW5mbyBpbmFjdGl2ZSA9IG1JbmFjdGl2ZUxvYWRlcnMuZ2V0KGlkKTsKKyAgICAgICAgICAgIGlmIChpbmFjdGl2ZSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgaWYgKGluZm8ubURhdGEgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAvLyBUaGlzIGxvYWRlciBub3cgaGFzIGRhdGEuLi4gIHdlIGFyZSBwcm9iYWJseSBiZWluZworICAgICAgICAgICAgICAgICAgICAvLyBjYWxsZWQgZnJvbSB3aXRoaW4gb25Mb2FkQ29tcGxldGUsIHdoZXJlIHdlIGhhdmVuJ3QKKyAgICAgICAgICAgICAgICAgICAgLy8geWV0IGRlc3Ryb3llZCB0aGUgbGFzdCBpbmFjdGl2ZSBsb2FkZXIuICBTbyBqdXN0IGRvCisgICAgICAgICAgICAgICAgICAgIC8vIHRoYXQgbm93LgorICAgICAgICAgICAgICAgICAgICBpZiAoREVCVUcpIExvZy52KFRBRywgIiAgUmVtb3ZpbmcgbGFzdCBpbmFjdGl2ZSBsb2FkZXIgaW4gIiArIHRoaXMpOworICAgICAgICAgICAgICAgICAgICBpbmFjdGl2ZS5kZXN0cm95KCk7CisgICAgICAgICAgICAgICAgICAgIG1JbmFjdGl2ZUxvYWRlcnMucHV0KGlkLCBpbmZvKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAvLyBXZSBhbHJlYWR5IGhhdmUgYW4gaW5hY3RpdmUgbG9hZGVyIGZvciB0aGlzIElEIHRoYXQgd2UgYXJlCisgICAgICAgICAgICAgICAgICAgIC8vIHdhaXRpbmcgZm9yISAgTm93IHdlIGhhdmUgdGhyZWUgYWN0aXZlIGxvYWRlcnMuLi4gbGV0J3MganVzdAorICAgICAgICAgICAgICAgICAgICAvLyBkcm9wIHRoZSBvbmUgaW4gdGhlIG1pZGRsZSwgc2luY2Ugd2UgYXJlIHN0aWxsIHdhaXRpbmcgZm9yCisgICAgICAgICAgICAgICAgICAgIC8vIGl0cyByZXN1bHQgYnV0IHRoYXQgcmVzdWx0IGlzIGFscmVhZHkgb3V0IG9mIGRhdGUuCisgICAgICAgICAgICAgICAgICAgIGlmIChERUJVRykgTG9nLnYoVEFHLCAiICBSZW1vdmluZyBpbnRlcm1lZGlhdGUgbG9hZGVyIGluICIgKyB0aGlzKTsKKyAgICAgICAgICAgICAgICAgICAgaW5mby5kZXN0cm95KCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAvLyBLZWVwIHRyYWNrIG9mIHRoZSBwcmV2aW91cyBpbnN0YW5jZSBvZiB0aGlzIGxvYWRlciBzbyB3ZSBjYW4gZGVzdHJveQorICAgICAgICAgICAgICAgIC8vIGl0IHdoZW4gdGhlIG5ldyBvbmUgY29tcGxldGVzLgorICAgICAgICAgICAgICAgIGlmIChERUJVRykgTG9nLnYoVEFHLCAiICBNYWtpbmcgaW5hY3RpdmU6ICIgKyBpbmZvKTsKKyAgICAgICAgICAgICAgICBtSW5hY3RpdmVMb2FkZXJzLnB1dChpZCwgaW5mbyk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIGluZm8gPSBjcmVhdGVMb2FkZXIoaWQsIGFyZ3MsICAoTG9hZGVyTWFuYWdlci5Mb2FkZXJDYWxsYmFja3M8T2JqZWN0PiljYWxsYmFjayk7CisgICAgICAgIHJldHVybiAoTG9hZGVyPEQ+KWluZm8ubUxvYWRlcjsKKyAgICB9CisgICAgCisgICAgcHVibGljIHZvaWQgc3RvcExvYWRlcihpbnQgaWQpIHsKKyAgICAgICAgaWYgKERFQlVHKSBMb2cudihUQUcsICJzdG9wTG9hZGVyIGluICIgKyB0aGlzICsgIiBvZiAiICsgaWQpOworICAgICAgICBpbnQgaWR4ID0gbUxvYWRlcnMuaW5kZXhPZktleShpZCk7CisgICAgICAgIGlmIChpZHggPj0gMCkgeworICAgICAgICAgICAgTG9hZGVySW5mbyBpbmZvID0gbUxvYWRlcnMudmFsdWVBdChpZHgpOworICAgICAgICAgICAgbUxvYWRlcnMucmVtb3ZlQXQoaWR4KTsKKyAgICAgICAgICAgIGluZm8uZGVzdHJveSgpOworICAgICAgICB9CisgICAgfQorCisgICAgQFN1cHByZXNzV2FybmluZ3MoInVuY2hlY2tlZCIpCisgICAgcHVibGljIDxEPiBMb2FkZXI8RD4gZ2V0TG9hZGVyKGludCBpZCkgeworICAgICAgICBMb2FkZXJJbmZvIGxvYWRlckluZm8gPSBtTG9hZGVycy5nZXQoaWQpOworICAgICAgICBpZiAobG9hZGVySW5mbyAhPSBudWxsKSB7CisgICAgICAgICAgICByZXR1cm4gKExvYWRlcjxEPiltTG9hZGVycy5nZXQoaWQpLm1Mb2FkZXI7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIG51bGw7CisgICAgfQorIAorICAgIHZvaWQgZG9TdGFydCgpIHsKKyAgICAgICAgaWYgKERFQlVHKSBMb2cudihUQUcsICJTdGFydGluZzogIiArIHRoaXMpOworCisgICAgICAgIC8vIENhbGwgb3V0IHRvIHN1YiBjbGFzc2VzIHNvIHRoZXkgY2FuIHN0YXJ0IHRoZWlyIGxvYWRlcnMKKyAgICAgICAgLy8gTGV0IHRoZSBleGlzdGluZyBsb2FkZXJzIGtub3cgdGhhdCB3ZSB3YW50IHRvIGJlIG5vdGlmaWVkIHdoZW4gYSBsb2FkIGlzIGNvbXBsZXRlCisgICAgICAgIGZvciAoaW50IGkgPSBtTG9hZGVycy5zaXplKCktMTsgaSA+PSAwOyBpLS0pIHsKKyAgICAgICAgICAgIG1Mb2FkZXJzLnZhbHVlQXQoaSkuc3RhcnQoKTsKKyAgICAgICAgfQorICAgICAgICBtU3RhcnRlZCA9IHRydWU7CisgICAgfQorICAgIAorICAgIHZvaWQgZG9TdG9wKCkgeworICAgICAgICBpZiAoREVCVUcpIExvZy52KFRBRywgIlN0b3BwaW5nOiAiICsgdGhpcyk7CisKKyAgICAgICAgZm9yIChpbnQgaSA9IG1Mb2FkZXJzLnNpemUoKS0xOyBpID49IDA7IGktLSkgeworICAgICAgICAgICAgbUxvYWRlcnMudmFsdWVBdChpKS5zdG9wKCk7CisgICAgICAgIH0KKyAgICAgICAgbVN0YXJ0ZWQgPSBmYWxzZTsKKyAgICB9CisgICAgCisgICAgdm9pZCBkb1JldGFpbigpIHsKKyAgICAgICAgaWYgKERFQlVHKSBMb2cudihUQUcsICJSZXRhaW5pbmc6ICIgKyB0aGlzKTsKKworICAgICAgICBtUmV0YWluaW5nID0gdHJ1ZTsKKyAgICAgICAgbVN0YXJ0ZWQgPSBmYWxzZTsKKyAgICAgICAgZm9yIChpbnQgaSA9IG1Mb2FkZXJzLnNpemUoKS0xOyBpID49IDA7IGktLSkgeworICAgICAgICAgICAgbUxvYWRlcnMudmFsdWVBdChpKS5yZXRhaW4oKTsKKyAgICAgICAgfQorICAgIH0KKyAgICAKKyAgICB2b2lkIGZpbmlzaFJldGFpbigpIHsKKyAgICAgICAgaWYgKERFQlVHKSBMb2cudihUQUcsICJGaW5pc2hlZCBSZXRhaW5pbmc6ICIgKyB0aGlzKTsKKworICAgICAgICBtUmV0YWluaW5nID0gZmFsc2U7CisgICAgICAgIGZvciAoaW50IGkgPSBtTG9hZGVycy5zaXplKCktMTsgaSA+PSAwOyBpLS0pIHsKKyAgICAgICAgICAgIG1Mb2FkZXJzLnZhbHVlQXQoaSkuZmluaXNoUmV0YWluKCk7CisgICAgICAgIH0KKyAgICB9CisgICAgCisgICAgdm9pZCBkb0Rlc3Ryb3koKSB7CisgICAgICAgIGlmICghbVJldGFpbmluZykgeworICAgICAgICAgICAgaWYgKERFQlVHKSBMb2cudihUQUcsICJEZXN0cm95aW5nIEFjdGl2ZTogIiArIHRoaXMpOworICAgICAgICAgICAgZm9yIChpbnQgaSA9IG1Mb2FkZXJzLnNpemUoKS0xOyBpID49IDA7IGktLSkgeworICAgICAgICAgICAgICAgIG1Mb2FkZXJzLnZhbHVlQXQoaSkuZGVzdHJveSgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIAorICAgICAgICBpZiAoREVCVUcpIExvZy52KFRBRywgIkRlc3Ryb3lpbmcgSW5hY3RpdmU6ICIgKyB0aGlzKTsKKyAgICAgICAgZm9yIChpbnQgaSA9IG1JbmFjdGl2ZUxvYWRlcnMuc2l6ZSgpLTE7IGkgPj0gMDsgaS0tKSB7CisgICAgICAgICAgICBtSW5hY3RpdmVMb2FkZXJzLnZhbHVlQXQoaSkuZGVzdHJveSg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pOworCisgICAgICAgIC8vIExvb2sgZm9yIGFuIGluYWN0aXZlIGxvYWRlciBhbmQgZGVzdHJveSBpdCBpZiBmb3VuZAorICAgICAgICBpbnQgaWQgPSBsb2FkZXIuZ2V0SWQoKTsKKyAgICAgICAgTG9hZGVySW5mbzxEPiBpbmZvID0gbUluYWN0aXZlTG9hZGVycy5nZXQoaWQpOworICAgICAgICBpZiAoaW5mbyAhPSBudWxsKSB7CisgICAgICAgICAgICBMb2FkZXI8RD4gb2xkTG9hZGVyID0gaW5mby5sb2FkZXI7CisgICAgICAgICAgICBpZiAob2xkTG9hZGVyICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBvbGRMb2FkZXIuZGVzdHJveSgpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbUluYWN0aXZlTG9hZGVycy5yZW1vdmUoaWQpOworICAgICAgICB9CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgb25DcmVhdGUoQnVuZGxlIHNhdmVkU3RhdGUpIHsKKyAgICAgICAgc3VwZXIub25DcmVhdGUoc2F2ZWRTdGF0ZSk7CisKKyAgICAgICAgaWYgKG1Mb2FkZXJzID09IG51bGwpIHsKKyAgICAgICAgICAgIC8vIExvb2sgZm9yIGEgcGFzc2VkIGFsb25nIGxvYWRlciBhbmQgY3JlYXRlIGEgbmV3IG9uZSBpZiBpdCdzIG5vdCB0aGVyZQorLy8gVE9ETzogdW5jb21tZW50IG9uY2UgZ2V0TGFzdE5vbkNvbmZpZ3VyYXRpb25JbnN0YW5jZSBtZXRob2QgaXMgYXZhaWxhYmxlCisvLyAgICAgICAgICAgIG1Mb2FkZXJzID0gKEhhc2hNYXA8SW50ZWdlciwgTG9hZGVySW5mbz4pIGdldExhc3ROb25Db25maWd1cmF0aW9uSW5zdGFuY2UoKTsKKyAgICAgICAgICAgIGlmIChtTG9hZGVycyA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgbUxvYWRlcnMgPSBuZXcgSGFzaE1hcDxJbnRlZ2VyLCBMb2FkZXJJbmZvPEQ+PigpOworICAgICAgICAgICAgICAgIG9uSW5pdGlhbGl6ZUxvYWRlcnMoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBpZiAobUluYWN0aXZlTG9hZGVycyA9PSBudWxsKSB7CisgICAgICAgICAgICBtSW5hY3RpdmVMb2FkZXJzID0gbmV3IEhhc2hNYXA8SW50ZWdlciwgTG9hZGVySW5mbzxEPj4oKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIG9uU3RhcnQoKSB7CisgICAgICAgIHN1cGVyLm9uU3RhcnQoKTsKKworICAgICAgICAvLyBDYWxsIG91dCB0byBzdWIgY2xhc3NlcyBzbyB0aGV5IGNhbiBzdGFydCB0aGVpciBsb2FkZXJzCisgICAgICAgIC8vIExldCB0aGUgZXhpc3RpbmcgbG9hZGVycyBrbm93IHRoYXQgd2Ugd2FudCB0byBiZSBub3RpZmllZCB3aGVuIGEgbG9hZCBpcyBjb21wbGV0ZQorICAgICAgICBmb3IgKEhhc2hNYXAuRW50cnk8SW50ZWdlciwgTG9hZGVySW5mbzxEPj4gZW50cnkgOiBtTG9hZGVycy5lbnRyeVNldCgpKSB7CisgICAgICAgICAgICBMb2FkZXJJbmZvPEQ+IGluZm8gPSBlbnRyeS5nZXRWYWx1ZSgpOworICAgICAgICAgICAgTG9hZGVyPEQ+IGxvYWRlciA9IGluZm8ubG9hZGVyOworICAgICAgICAgICAgaW50IGlkID0gZW50cnkuZ2V0S2V5KCk7CisgICAgICAgICAgICBpZiAobG9hZGVyID09IG51bGwpIHsKKyAgICAgICAgICAgICAgIGxvYWRlciA9IG9uQ3JlYXRlTG9hZGVyKGlkLCBpbmZvLmFyZ3MpOworICAgICAgICAgICAgICAgaW5mby5sb2FkZXIgPSBsb2FkZXI7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBsb2FkZXIucmVnaXN0ZXJMaXN0ZW5lcihpZCwgdGhpcyk7CisgICAgICAgICAgICBsb2FkZXIuc3RhcnRMb2FkaW5nKCk7CisgICAgICAgIH0KKworICAgICAgICBtU3RhcnRlZCA9IHRydWU7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgb25TdG9wKCkgeworICAgICAgICBzdXBlci5vblN0b3AoKTsKKworICAgICAgICBmb3IgKEhhc2hNYXAuRW50cnk8SW50ZWdlciwgTG9hZGVySW5mbzxEPj4gZW50cnkgOiBtTG9hZGVycy5lbnRyeVNldCgpKSB7CisgICAgICAgICAgICBMb2FkZXJJbmZvPEQ+IGluZm8gPSBlbnRyeS5nZXRWYWx1ZSgpOworICAgICAgICAgICAgTG9hZGVyPEQ+IGxvYWRlciA9IGluZm8ubG9hZGVyOworICAgICAgICAgICAgaWYgKGxvYWRlciA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIExldCB0aGUgbG9hZGVyIGtub3cgd2UncmUgZG9uZSB3aXRoIGl0CisgICAgICAgICAgICBsb2FkZXIudW5yZWdpc3Rlckxpc3RlbmVyKHRoaXMpOworCisgICAgICAgICAgICAvLyBUaGUgbG9hZGVyIGlzbid0IGdldHRpbmcgcGFzc2VkIGFsb25nIHRvIHRoZSBuZXh0IGluc3RhbmNlIHNvIGFzayBpdCB0byBzdG9wIGxvYWRpbmcKKyAgICAgICAgICAgIGlmICghZ2V0QWN0aXZpdHkoKS5pc0NoYW5naW5nQ29uZmlndXJhdGlvbnMoKSkgeworICAgICAgICAgICAgICAgIGxvYWRlci5zdG9wTG9hZGluZygpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgbVN0YXJ0ZWQgPSBmYWxzZTsKKyAgICB9CisKKyAgICAvKiogVE8gRE86IFRoaXMgbmVlZHMgdG8gYmUgdHVybmVkIGludG8gYSByZXRhaW5lZCBmcmFnbWVudC4KKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgT2JqZWN0IG9uUmV0YWluTm9uQ29uZmlndXJhdGlvbkluc3RhbmNlKCkgeworICAgICAgICAvLyBQYXNzIHRoZSBsb2FkZXIgYWxvbmcgdG8gdGhlIG5leHQgZ3V5CisgICAgICAgIE9iamVjdCByZXN1bHQgPSBtTG9hZGVyczsKKyAgICAgICAgbUxvYWRlcnMgPSBudWxsOworICAgICAgICByZXR1cm4gcmVzdWx0OworICAgIH0KKyAgICAqKi8KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIG9uRGVzdHJveSgpIHsKKyAgICAgICAgc3VwZXIub25EZXN0cm95KCk7CisKKyAgICAgICAgaWYgKG1Mb2FkZXJzICE9IG51bGwpIHsKKyAgICAgICAgICAgIGZvciAoSGFzaE1hcC5FbnRyeTxJbnRlZ2VyLCBMb2FkZXJJbmZvPEQ+PiBlbnRyeSA6IG1Mb2FkZXJzLmVudHJ5U2V0KCkpIHsKKyAgICAgICAgICAgICAgICBMb2FkZXJJbmZvPEQ+IGluZm8gPSBlbnRyeS5nZXRWYWx1ZSgpOworICAgICAgICAgICAgICAgIExvYWRlcjxEPiBsb2FkZXIgPSBpbmZvLmxvYWRlcjsKKyAgICAgICAgICAgICAgICBpZiAobG9hZGVyID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGxvYWRlci5kZXN0cm95KCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBTdG9wcyBhbmQgcmVtb3ZlcyB0aGUgbG9hZGVyIHdpdGggdGhlIGdpdmVuIElELgorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHN0b3BMb2FkaW5nKGludCBpZCkgeworICAgICAgICBpZiAobUxvYWRlcnMgIT0gbnVsbCkgeworICAgICAgICAgICAgTG9hZGVySW5mbzxEPiBpbmZvID0gbUxvYWRlcnMucmVtb3ZlKGlkKTsKKyAgICAgICAgICAgIGlmIChpbmZvICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBMb2FkZXI8RD4gbG9hZGVyID0gaW5mby5sb2FkZXI7CisgICAgICAgICAgICAgICAgaWYgKGxvYWRlciAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIGxvYWRlci51bnJlZ2lzdGVyTGlzdGVuZXIodGhpcyk7CisgICAgICAgICAgICAgICAgICAgIGxvYWRlci5kZXN0cm95KCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogQHJldHVybiB0aGUgTG9hZGVyIHdpdGggdGhlIGdpdmVuIGlkIG9yIG51bGwgaWYgbm8gbWF0Y2hpbmcgTG9hZGVyCisgICAgICogaXMgZm91bmQuCisgICAgICovCisgICAgcHVibGljIExvYWRlcjxEPiBnZXRMb2FkZXIoaW50IGlkKSB7CisgICAgICAgIExvYWRlckluZm88RD4gbG9hZGVySW5mbyA9IG1Mb2FkZXJzLmdldChpZCk7CisgICAgICAgIGlmIChsb2FkZXJJbmZvICE9IG51bGwpIHsKKyAgICAgICAgICAgIHJldHVybiBtTG9hZGVycy5nZXQoaWQpLmxvYWRlcjsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbnVsbDsKKyAgICB9Cit9CmRpZmYgLS1naXQgYS9jb3JlL2phdmEvYW5kcm9pZC9hcHAvTG9jYWxBY3Rpdml0eU1hbmFnZXIuamF2YSBiL2NvcmUvamF2YS9hbmRyb2lkL2FwcC9Mb2NhbEFjdGl2aXR5TWFuYWdlci5qYXZhCmluZGV4IGEyNGZjYWUuLjUyNGRlNmYgMTAwNjQ0Ci0tLSBhL2NvcmUvamF2YS9hbmRyb2lkL2FwcC9Mb2NhbEFjdGl2aXR5TWFuYWdlci5qYXZhCisrKyBiL2NvcmUvamF2YS9hbmRyb2lkL2FwcC9Mb2NhbEFjdGl2aXR5TWFuYWdlci5q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25Db25maWd1cmF0aW9uSW5zdGFuY2UgZm9yIHRoZSBhY3Rpdml0eQotICAgICAgICAgICAgSGFzaE1hcDxTdHJpbmcsT2JqZWN0PiBsYXN0Tm9uQ29uZmlndXJhdGlvbkluc3RhbmNlcyA9Ci0gICAgICAgICAgICAgICAgbVBhcmVudC5nZXRMYXN0Tm9uQ29uZmlndXJhdGlvbkNoaWxkSW5zdGFuY2VzKCk7Ci0gICAgICAgICAgICBPYmplY3QgaW5zdGFuY2UgPSBudWxsOworICAgICAgICAgICAgSGFzaE1hcDxTdHJpbmcsIE9iamVjdD4gbGFzdE5vbkNvbmZpZ3VyYXRpb25JbnN0YW5jZXMgPQorICAgICAgICAgICAgICAgICAgICBtUGFyZW50LmdldExhc3ROb25Db25maWd1cmF0aW9uQ2hpbGRJbnN0YW5jZXMoKTsKKyAgICAgICAgICAgIE9iamVjdCBpbnN0YW5jZU9iaiA9IG51bGw7CiAgICAgICAgICAgICBpZiAobGFzdE5vbkNvbmZpZ3VyYXRpb25JbnN0YW5jZXMgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIGluc3RhbmNlID0gbGFzdE5vbkNvbmZpZ3VyYXRpb25JbnN0YW5jZXMuZ2V0KHIuaWQpOworICAgICAgICAgICAgICAgIGluc3RhbmNlT2JqID0gbGFzdE5vbkNvbmZpZ3VyYXRpb25JbnN0YW5jZXMuZ2V0KHIuaWQpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgQWN0aXZpdHkuTm9uQ29uZmlndXJhdGlvbkluc3RhbmNlcyBpbnN0YW5jZSA9IG51bGw7CisgICAgICAgICAgICBpZiAoaW5zdGFuY2VPYmogIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGluc3RhbmNlID0gbmV3IEFjdGl2aXR5Lk5vbkNvbmZpZ3VyYXRpb25JbnN0YW5jZXMoKTsKKyAgICAgICAgICAgICAgICBpbnN0YW5jZS5hY3Rpdml0eSA9IGluc3RhbmNlT2JqOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgCiAgICAgICAgICAgICAvLyBXZSBuZWVkIHRvIGhhdmUgYWx3YXlzIGNyZWF0ZWQgdGhlIGFjdGl2aXR5LgpAQCAtMzQ2LDcgKzM0OSw3IEBACiAgICAgfQogCiAgICAgcHJpdmF0ZSBXaW5kb3cgcGVyZm9ybURlc3Ryb3koTG9jYWxBY3Rpdml0eVJlY29yZCByLCBib29sZWFuIGZpbmlzaCkgewotICAgICAgICBXaW5kb3cgd2luID0gbnVsbDsKKyAgICAgICAgV2luZG93IHdpbjsKICAgICAgICAgd2luID0gci53aW5kb3c7CiAgICAgICAgIGlmIChyLmN1clN0YXRlID09IFJFU1VNRUQgJiYgIWZpbmlzaCkgewogICAgICAgICAgICAgcGVyZm9ybVBhdXNlKHIsIGZpbmlzaCk7CkBAIC0zODAsNyArMzgzLDggQEAKICAgICAgICAgaWYgKHIgIT0gbnVsbCkgewogICAgICAgICAgICAgd2luID0gcGVyZm9ybURlc3Ryb3kociwgZmluaXNoKTsKICAgICAgICAgICAgIGlmIChmaW5pc2gpIHsKLSAgICAgICAgICAgICAgICBtQWN0aXZpdGllcy5yZW1vdmUocik7CisgICAgICAgICAgICAgICAgbUFjdGl2aXRpZXMucmVtb3ZlKGlkKTsKKyAgICAgICAgICAgICAgICBtQWN0aXZpdHlBcnJheS5yZW1vdmUocik7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICAgICAgcmV0dXJuIHdpbjsKQEAgLTQ0MSwxMCArNDQ1LDggQEAKICAgICAgKi8KICAgICBwdWJsaWMgdm9pZCBkaXNwYXRjaENyZWF0ZShCdW5kbGUgc3RhdGUpIHsKICAgICAgICAgaWYgKHN0YXRlICE9IG51bGwpIHsKLSAgICAgICAgICAgIGZpbmFsIEl0ZXJhdG9yPFN0cmluZz4gaSA9IHN0YXRlLmtleVNldCgpLml0ZXJhdG9yKCk7Ci0gICAgICAgICAgICB3aGlsZSAoaS5oYXNOZXh0KCkpIHsKKyAgICAgICAgICAgIGZvciAoU3RyaW5nIGlkIDogc3RhdGUua2V5U2V0KCkpIHsKICAgICAgICAgICAgICAgICB0cnkgewotICAgICAgICAgICAgICAgICAgICBmaW5hbCBTdHJpbmcgaWQgPSBpLm5leHQoKTsKICAgICAgICAgICAgICAgICAgICAgZmluYWwgQnVuZGxlIGFzdGF0ZSA9IHN0YXRlLmdldEJ1bmRsZShpZCk7CiAgICAgICAgICAgICAgICAgICAgIExvY2FsQWN0aXZpdHlSZWNvcmQgciA9IG1BY3Rpdml0aWVzLmdldChpZCk7CiAgICAgICAgICAgICAgICAgICAgIGlmIChyICE9IG51bGwpIHsKQEAgLTQ1Nyw5ICs0NTksNyBAQAogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfSBjYXRjaCAoRXhjZXB0aW9uIGUpIHsKICAgICAgICAgICAgICAgICAgICAgLy8gUmVjb3ZlciBmcm9tIC1hbGwtIGFwcCBlcnJvcnMuCi0gICAgICAgICAgICAgICAgICAgIExvZy5lKFRBRywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgIkV4Y2VwdGlvbiB0aHJvd24gd2hlbiByZXN0b3JpbmcgTG9jYWxBY3Rpdml0eU1hbmFnZXIgc3RhdGUiLAotICAgICAgICAgICAgICAgICAgICAgICAgICBlKTsKKyAgICAgICAgICAgICAgICAgICAgTG9nLmUoVEFHLCAiRXhjZXB0aW9uIHRocm93biB3aGVuIHJlc3RvcmluZyBMb2NhbEFjdGl2aXR5TWFuYWdlciBzdGF0ZSIsIGUpOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgfQpkaWZmIC0tZ2l0IGEvY29yZS9qYXZhL2FuZHJvaWQvYXBwL05vdGlmaWNhdGlvbi5qYXZhIGIvY29yZS9qYXZhL2FuZHJvaWQvYXBwL05vdGlmaWNhdGlvbi5qYXZhCmluZGV4IDYzYWQ5MmEuLjlmN2JlZjQgMTAwNjQ0Ci0tLSBhL2NvcmUvamF2YS9hbmRyb2lkL2Fwc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iBjb25zdHJhaW50cy4gVXBvbiBiZWluZyByZXN1bWVkIGZyb20gdGhpcyBhY3Rpdml0eSwgeW91IGNhbiBjaGVjayB0aGUgbmV3CisgICAgICogcGFzc3dvcmQgY2hhcmFjdGVyaXN0aWNzIHRvIHNlZSBpZiB0aGV5IGFyZSBzdWZmaWNpZW50LgogICAgICAqLwogICAgIEBTZGtDb25zdGFudChTZGtDb25zdGFudFR5cGUuQUNUSVZJVFlfSU5URU5UX0FDVElPTikKICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBBQ1RJT05fU0VUX05FV19QQVNTV09SRAogICAgICAgICAgICAgPSAiYW5kcm9pZC5hcHAuYWN0aW9uLlNFVF9ORVdfUEFTU1dPUkQiOwotICAgIAorCiAgICAgLyoqCiAgICAgICogUmV0dXJuIHRydWUgaWYgdGhlIGdpdmVuIGFkbWluaXN0cmF0b3IgY29tcG9uZW50IGlzIGN1cnJlbnRseQogICAgICAqIGFjdGl2ZSAoZW5hYmxlZCkgaW4gdGhlIHN5c3RlbS4KQEAgLTEzMCw3ICsxMzEsNyBAQAogICAgICAgICB9CiAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICB9Ci0gICAgCisKICAgICAvKioKICAgICAgKiBSZXR1cm4gYSBsaXN0IG9mIGFsbCBjdXJyZW50bHkgYWN0aXZlIGRldmljZSBhZG1pbmlzdHJhdG9yJ3MgY29tcG9uZW50CiAgICAgICogbmFtZXMuICBOb3RlIHRoYXQgaWYgdGhlcmUgYXJlIG5vIGFkbWluaXN0cmF0b3JzIHRoYW4gbnVsbCBtYXkgYmUKQEAgLTE0Niw3ICsxNDcsNyBAQAogICAgICAgICB9CiAgICAgICAgIHJldHVybiBudWxsOwogICAgIH0KLSAgICAKKwogICAgIC8qKgogICAgICAqIEBoaWRlCiAgICAgICovCkBAIC0xNjAsNyArMTYxLDcgQEAKICAgICAgICAgfQogICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgfQotICAgIAorCiAgICAgLyo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ZXF1ZXN0IGlzIGFzc29jaWF0ZWQKKyAgICAgKiAgICAgICAgICAgIHdpdGguCisgICAgICogQHBhcmFtIGxlbmd0aCBUaGUgbmV3IGRlc2lyZWQgbWluaW11bSBudW1iZXIgb2YgdXBwZXIgY2FzZSBsZXR0ZXJzCisgICAgICogICAgICAgICAgICByZXF1aXJlZCBpbiB0aGUgcGFzc3dvcmQuIEEgdmFsdWUgb2YgMCBtZWFucyB0aGVyZSBpcyBubworICAgICAqICAgICAgICAgICAgcmVzdHJpY3Rpb24uCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0UGFzc3dvcmRNaW5pbXVtVXBwZXJDYXNlKENvbXBvbmVudE5hbWUgYWRtaW4sIGludCBsZW5ndGgpIHsKKyAgICAgICAgaWYgKG1TZXJ2aWNlICE9IG51bGwpIHsKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgbVNlcnZpY2Uuc2V0UGFzc3dvcmRNaW5pbXVtVXBwZXJDYXNlKGFkbWluLCBsZW5ndGgpOworICAgICAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICBMb2cudyhUQUcsICJGYWlsZWQgdGFsa2luZyB3aXRoIGRldmljZSBwb2xpY3kgc2VydmljZSIsIGUpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogUmV0cmlldmUgdGhlIGN1cnJlbnQgbnVtYmVyIG9mIHVwcGVyIGNhc2UgbGV0dGVycyByZXF1aXJlZCBpbiB0aGUKKyAgICAgKiBwYXNzd29yZCBmb3IgYWxsIGFkbWlucyBvciBhIHBhcnRpY3VsYXIgb25lLiBUaGlzIGlzIHRoZSBzYW1lIHZhbHVlIGFzCisgICAgICogc2V0IGJ5IHsjbGluayB7QGxpbmsgI3NldFBhc3N3b3JkTWluaW11bVVwcGVyQ2FzZShDb21wb25lbnROYW1lLCBpbnQpfQorICAgICAqIGFuZCBvbmx5IGFwcGxpZXMgd2hlbiB0aGUgcGFzc3dvcmQgcXVhbGl0eSBpcworICAgICAqIHtAbGluayAjUEFTU1dPUkRfUVVBTElUWV9DT01QTEVYfS4KKyAgICAgKgorICAgICAqIEBwYXJhbSBhZG1pbiBUaGUgbmFtZSBvZiB0aGUgYWRtaW4gY29tcG9uZW50IHRvIGNoZWNrLCBvciBudWxsIHRvCisgICAgICogICAgICAgICAgICBhZ2dyZWdhdGUgYWxsIGFkbWlucy4KKyAgICAgKiBAcmV0dXJuIFRoZSBtaW5pbXVtIG51bWJlciBvZiB1cHBlciBjYXNlIGxldHRlcnMgcmVxdWlyZWQgaW4gdGhlCisgICAgICogICAgICAgICBwYXNzd29yZC4KKyAgICAgKi8KKyAgICBwdWJsaWMgaW50IGdldFBhc3N3b3JkTWluaW11bVVwcGVyQ2FzZShDb21wb25lbnROYW1lIGFkbWluKSB7CisgICAgICAgIGlmIChtU2VydmljZSAhPSBudWxsKSB7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIHJldHVybiBtU2VydmljZS5nZXRQYXNzd29yZE1pbmltdW1VcHBlckNhc2UoYWRtaW4pOworICAgICAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICBMb2cudyhUQUcsICJGYWlsZWQgdGFsa2luZyB3aXRoIGRldmljZSBwb2xpY3kgc2VydmljZSIsIGUpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiAwOworICAgIH0KKworICAgIC8qKgorICAgICAqIENhbGxlZCBieSBhbiBhcHBsaWNhdGlvbiB0aGF0IGlzIGFkbWluaXN0ZXJpbmcgdGhlIGRldmljZSB0byBzZXQgdGhlCisgICAgICogbWluaW11bSBudW1iZXIgb2YgbG93ZXIgY2FzZSBsZXR0ZXJzIHJlcXVpcmVkIGluIHRoZSBwYXNzd29yZC4gQWZ0ZXIKKyAgICAgKiBzZXR0aW5nIHRoaXMsIHRoZSB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RGV2aWNlQWRtaW5SZWNlaXZlcn0gdGhpcyByZXF1ZXN0IGlzIGFzc29jaWF0ZWQKKyAgICAgKiAgICAgICAgICAgIHdpdGguCisgICAgICogQHBhcmFtIGxlbmd0aCBUaGUgbmV3IGRlc2lyZWQgbWluaW11bSBudW1iZXIgb2YgbG93ZXIgY2FzZSBsZXR0ZXJzCisgICAgICogICAgICAgICAgICByZXF1aXJlZCBpbiB0aGUgcGFzc3dvcmQuIEEgdmFsdWUgb2YgMCBtZWFucyB0aGVyZSBpcyBubworICAgICAqICAgICAgICAgICAgcmVzdHJpY3Rpb24uCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0UGFzc3dvcmRNaW5pbXVtTG93ZXJDYXNlKENvbXBvbmVudE5hbWUgYWRtaW4sIGludCBsZW5ndGgpIHsKKyAgICAgICAgaWYgKG1TZXJ2aWNlICE9IG51bGwpIHsKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgbVNlcnZpY2Uuc2V0UGFzc3dvcmRNaW5pbXVtTG93ZXJDYXNlKGFkbWluLCBsZW5ndGgpOworICAgICAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICBMb2cudyhUQUcsICJGYWlsZWQgdGFsa2luZyB3aXRoIGRldmljZSBwb2xpY3kgc2VydmljZSIsIGUpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogUmV0cmlldmUgdGhlIGN1cnJlbnQgbnVtYmVyIG9mIGxvd2VyIGNhc2UgbGV0dGVycyByZXF1aXJlZCBpbiB0aGUKKyAgICAgKiBwYXNzd29yZCBmb3IgYWxsIGFkbWlucyBvciBhIHBhcnRpY3VsYXIgb25lLiBUaGlzIGlzIHRoZSBzYW1lIHZhbHVlIGFzCisgICAgICogc2V0IGJ5IHsjbGluayB7QGxpbmsgI3NldFBhc3N3b3JkTWluaW11bUxvd2VyQ2FzZShDb21wb25lbnROYW1lLCBpbnQpfQorICAgICAqIGFuZCBvbmx5IGFwcGxpZXMgd2hlbiB0aGUgcGFzc3dvcmQgcXVhbGl0eSBpcworICAgICAqIHtAbGluayAjUEFTU1dPUkRfUVVBTElUWV9DT01QTEVYfS4KKyAgICAgKgorICAgICAqIEBwYXJhbSBhZG1pbiBUaGUgbmFtZSBvZiB0aGUgYWRtaW4gY29tcG9uZW50IHRvIGNoZWNrLCBvciBudWxsIHRvCisgICAgICogICAgICAgICAgICBhZ2dyZWdhdGUgYWxsIGFkbWlucy4KKyAgICAgKiBAcmV0dXJuIFRoZSBtaW5pbXVtIG51bWJlciBvZiBsb3dlciBjYXNlIGxldHRlcnMgcmVxdWlyZWQgaW4gdGhlCisgICAgICogICAgICAgICBwYXNzd29yZC4KKyAgICAgKi8KKyAgICBwdWJsaWMgaW50IGdldFBhc3N3b3JkTWluaW11bUxvd2VyQ2FzZShDb21wb25lbnROYW1lIGFkbWluKSB7CisgICAgICAgIGlmIChtU2VydmljZSAhPSBudWxsKSB7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIHJldHVybiBtU2VydmljZS5nZXRQYXNzd29yZE1pbmltdW1Mb3dlckNhc2UoYWRtaW4pOworICAgICAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICBMb2cudyhUQUcsICJGYWlsZWQgdGFsa2luZyB3aXRoIGRldmljZSBwb2xpY3kgc2VydmljZSIsIGUpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiAwOworICAgIH0KKworICAgIC8qKgorICAgICAqIENhbGxlZCBieSBhbiBhcHBsaWNhdGlvbiB0aGF0IGlzIGFkbWluaXN0ZXJpbmcgdGhlIGRldmljZSB0byBzZXQgdGhlCisgICAgICogbWluaW11bSBudW1iZXIgb2YgbGV0dGVycyByZXF1aXJlZCBpbiB0aGUgcGFzc3dvcmQuIEFmdGVyIHNldHRpbmcgdGhpcyw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ldmljZUFkbWluUmVjZWl2ZXJ9IHRoaXMgcmVxdWVzdCBpcyBhc3NvY2lhdGVkCisgICAgICogICAgICAgICAgICB3aXRoLgorICAgICAqIEBwYXJhbSBsZW5ndGggVGhlIG5ldyBkZXNpcmVkIG1pbmltdW0gbnVtYmVyIG9mIGxldHRlcnMgcmVxdWlyZWQgaW4gdGhlCisgICAgICogICAgICAgICAgICBwYXNzd29yZC4gQSB2YWx1ZSBvZiAwIG1lYW5zIHRoZXJlIGlzIG5vIHJlc3RyaWN0aW9uLgorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNldFBhc3N3b3JkTWluaW11bUxldHRlcnMoQ29tcG9uZW50TmFtZSBhZG1pbiwgaW50IGxlbmd0aCkgeworICAgICAgICBpZiAobVNlcnZpY2UgIT0gbnVsbCkgeworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICBtU2VydmljZS5zZXRQYXNzd29yZE1pbmltdW1MZXR0ZXJzKGFkbWluLCBsZW5ndGgpOworICAgICAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICBMb2cudyhUQUcsICJGYWlsZWQgdGFsa2luZyB3aXRoIGRldmljZSBwb2xpY3kgc2VydmljZSIsIGUpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogUmV0cmlldmUgdGhlIGN1cnJlbnQgbnVtYmVyIG9mIGxldHRlcnMgcmVxdWlyZWQgaW4gdGhlIHBhc3N3b3JkIGZvciBhbGwKKyAgICAgKiBhZG1pbnMgb3IgYSBwYXJ0aWN1bGFyIG9uZS4gVGhpcyBpcyB0aGUgc2FtZSB2YWx1ZSBhcworICAgICAqIHNldCBieSB7I2xpbmsge0BsaW5rICNzZXRQYXNzd29yZE1pbmltdW1MZXR0ZXJzKENvbXBvbmVudE5hbWUsIGludCl9CisgICAgICogYW5kIG9ubHkgYXBwbGllcyB3aGVuIHRoZSBwYXN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cworICAgICAqIHtAbGluayAjUEFTU1dPUkRfUVVBTElUWV9DT01QTEVYfS4KKyAgICAgKgorICAgICAqIEBwYXJhbSBhZG1pbiBUaGUgbmFtZSBvZiB0aGUgYWRtaW4gY29tcG9uZW50IHRvIGNoZWNrLCBvciBudWxsIHRvCisgICAgICogICAgICAgICAgICBhZ2dyZWdhdGUgYWxsIGFkbWlucy4KKyAgICAgKiBAcmV0dXJuIFRoZSBtaW5pbXVtIG51bWJlciBvZiBudW1lcmljYWwgZGlnaXRzIHJlcXVpcmVkIGluIHRoZSBwYXNzd29yZC4KKyAgICAgKi8KKyAgICBwdWJsaWMgaW50IGdldFBhc3N3b3JkTWluaW11bU51bWVyaWMoQ29tcG9uZW50TmFtZSBhZG1pbikgeworICAgICAgICBpZiAobVNlcnZpY2UgIT0gbnVsbCkgeworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICByZXR1cm4gbVNlcnZpY2UuZ2V0UGFzc3dvcmRNaW5pbXVtTnVtZXJpYyhhZG1pbik7CisgICAgICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgIExvZy53KFRBRywgIkZhaWxlZCB0YWxraW5nIHdpdGggZGV2aWNlIHBvbGljeSBzZXJ2aWNlIiwgZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIDA7CisgICAgfQorCisgICAgLyoqCisgICAgICogQ2FsbGVkIGJ5IGFuIGFwcGxpY2F0aW9uIHRoYXQgaXMgYWRtaW5pc3RlcmluZyB0aGUgZGV2aWNlIHRvIHNldCB0aGUKKyAgICAgKiBtaW5pbXVtIG51bWJlciBvZiBzeW1ib2xzIHJlcXVpcmVkIGluIHRoZSBwYXNzd29yZC4gQWZ0ZXIgc2V0dGluZyB0aGlzLAorICAgICAqIHRoZSB1c2VyIHdpbGwgbm90IGJlIGFibGUgdG8gZW50ZXIgYSBuZXcgcGFzc3dvcmQgdGhhdCBp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QKKyAgICAgKiAgICAgICAgICAgIHdpdGguCisgICAgICogQHBhcmFtIGxlbmd0aCBUaGUgbmV3IGRlc2lyZWQgbWluaW11bSBudW1iZXIgb2Ygc3ltYm9scyByZXF1aXJlZCBpbiB0aGUKKyAgICAgKiAgICAgICAgICAgIHBhc3N3b3JkLiBBIHZhbHVlIG9mIDAgbWVhbnMgdGhlcmUgaXMgbm8gcmVzdHJpY3Rpb24uCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0UGFzc3dvcmRNaW5pbXVtU3ltYm9scyhDb21wb25lbnROYW1lIGFkbWluLCBpbnQgbGVuZ3RoKSB7CisgICAgICAgIGlmIChtU2VydmljZSAhPSBudWxsKSB7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIG1TZXJ2aWNlLnNldFBhc3N3b3JkTWluaW11bVN5bWJvbHMoYWRtaW4sIGxlbmd0aCk7CisgICAgICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgIExvZy53KFRBRywgIkZhaWxlZCB0YWxraW5nIHdpdGggZGV2aWNlIHBvbGljeSBzZXJ2aWNlIiwgZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZXRyaWV2ZSB0aGUgY3VycmVudCBudW1iZXIgb2Ygc3ltYm9scyByZXF1aXJlZCBpbiB0aGUgcGFzc3dvcmQgZm9yIGFsbAorICAgICAqIGFkbWlucyBvciBhIHBhcnRpY3VsYXIgb25lLiBUaGlzIGlzIHRoZSBzYW1lIHZhbHVlIGFzCisgICAgICogc2V0IGJ5IHsjbGluayB7QGxpbmsgI3NldFBhc3N3b3JkTWluaW11bVN5bWJvbHMoQ29tcG9uZW50TmFtZSwgaW50KX0KKyAgICAgKiBhbmQgb25seSBhcHBsaWVzIHdoZW4gdGhlIHBhc3N3b3JkIHF1YWxpdHkgaXMKKyAgICAgKiB7QGxpbmsgI1BBU1NXT1JEX1FVQUxJVFlfQ09NUExFWH0uCisgICAgICoKKyAgICAgKiBAcGFyYW0gYWRtaW4gVGhlIG5hbWUgb2YgdGhlIGFkbWluIGNvbXBvbmVudCB0byBjaGVjaywgb3IgbnVsbCB0bworICAgICAqICAgICAgICAgICAgYWdncmVnYXRlIGFsbCBhZG1pbnMuCisgICAgICogQHJldHVybiBUaGUgbWluaW11bSBudW1iZXIgb2Ygc3ltYm9scyByZXF1aXJlZCBpbiB0aGUgcGFzc3dvcmQuCisgICAgICovCisgICAgcHVibGljIGludCBnZXRQYXNzd29yZE1pbmltdW1TeW1ib2xzKENvbXBvbmVudE5hbWUgYWRtaW4pIHsKKyAgICAgICAgaWYgKG1TZXJ2aWNlICE9IG51bGwpIHsKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIG1TZXJ2aWNlLmdldFBhc3N3b3JkTWluaW11bVN5bWJvbHMoYWRtaW4pOworICAgICAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICBMb2cudyhUQUcsICJGYWlsZWQgdGFsa2luZyB3aXRoIGRldmljZSBwb2xpY3kgc2VydmljZSIsIGUpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiAwOworICAgIH0KKworICAgIC8qKgorICAgICAqIENhbGxlZCBieSBhbiBhcHBsaWNhdGlvbiB0aGF0IGlzIGFkbWluaXN0ZXJpbmcgdGhlIGRldmljZSB0byBzZXQgdGhlCisgICAgICogbWluaW11bSBudW1iZXIgb2Ygbm9uLWxldHRlciBjaGFyYWN0ZXJzIChudW1lcmljYWwgZGlnaXRzIG9yIHN5bWJvbHMpCisgICAgICogcmVxdWlyZWQgaW4gdGhlIHBhc3N3b3JkLiBBZnRlciBzZXR0aW5nIHRoaXMsIHRoZSB1c2VyIHdpbGwgbm90IGJlIGFibGUKKyAgICAgKiB0byBlbnRlciBhIG5ldyBwYXNzd29yZCB0aGF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gICAgICAgICAgIHdpdGguCisgICAgICogQHBhcmFtIGxlbmd0aCBUaGUgbmV3IGRlc2lyZWQgbWluaW11bSBudW1iZXIgb2YgbGV0dGVycyByZXF1aXJlZCBpbiB0aGUKKyAgICAgKiAgICAgICAgICAgIHBhc3N3b3JkLiBBIHZhbHVlIG9mIDAgbWVhbnMgdGhlcmUgaXMgbm8gcmVzdHJpY3Rpb24uCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0UGFzc3dvcmRNaW5pbXVtTm9uTGV0dGVyKENvbXBvbmVudE5hbWUgYWRtaW4sIGludCBsZW5ndGgpIHsKKyAgICAgICAgaWYgKG1TZXJ2aWNlICE9IG51bGwpIHsKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgbVNlcnZpY2Uuc2V0UGFzc3dvcmRNaW5pbXVtTm9uTGV0dGVyKGFkbWluLCBsZW5ndGgpOworICAgICAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICBMb2cudyhUQUcsICJGYWlsZWQgdGFsa2luZyB3aXRoIGRldmljZSBwb2xpY3kgc2VydmljZSIsIGUpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogUmV0cmlldmUgdGhlIGN1cnJlbnQgbnVtYmVyIG9mIG5vbi1sZXR0ZXIgY2hhcmFjdGVycyByZXF1aXJlZCBpbiB0aGUKKyAgICAgKiBwYXNzd29yZCBmb3IgYWxsIGFkbWlucyBvciBhIHBhcnRpY3VsYXIgb25lLiBUaGlzIGlzIHRoZSBzYW1lIHZhbHVlIGFzCisgICAgICogc2V0IGJ5IHsjbGluayB7QGxpbmsgI3NldFBhc3N3b3JkTWluaW11bU5vbkxldHRlcihDb21wb25lbnROYW1lLCBpbnQpfQorICAgICAqIGFuZCBvbmx5IGFwcGxpZXMgd2hlbiB0aGUgcGFzc3dvcmQgcXVhbGl0eSBpcworICAgICAqIHtAbGluayAjUEFTU1dPUkRfUVVBTElUWV9DT01QTEVYfS4KKyAgICAgKgorICAgICAqIEBwYXJhbSBhZG1pbiBUaGUgbmFtZSBvZiB0aGUgYWRtaW4gY29tcG9uZW50IHRvIGNoZWNrLCBvciBudWxsIHRvCisgICAgICogICAgICAgICAgICBhZ2dyZWdhdGUgYWxsIGFkbWlucy4KKyAgICAgKiBAcmV0dXJuIFRoZSBtaW5pbXVtIG51bWJlciBvZiBsZXR0ZXJzIHJlcXVpcmVkIGluIHRoZSBwYXNzd29yZC4KKyAgICAgKi8KKyAgICBwdWJsaWMgaW50IGdldFBhc3N3b3JkTWluaW11bU5vbkxldHRlcihDb21wb25lbnROYW1lIGFkbWluKSB7CisgICAgICAgIGlmIChtU2VydmljZSAhPSBudWxsKSB7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIHJldHVybiBtU2VydmljZS5nZXRQYXNzd29yZE1pbmltdW1Ob25MZXR0ZXIoYWRtaW4pOworICAgICAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICBMb2cudyhUQUcsICJGYWlsZWQgdGFsa2luZyB3aXRoIGRldmljZSBwb2xpY3kgc2VydmljZSIsIGUpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiAwOworICAgIH0KKworICAvKioKKyAgICogQ2FsbGVkIGJ5IGFuIGFwcGxpY2F0aW9uIHRoYXQgaXMgYWRtaW5pc3RlcmluZyB0aGUgZGV2aWNlIHRvIHNldCB0aGUgbGVuZ3RoCisgICAqIG9mIHRoZSBwYXNzd29yZCBoaXN0b3J5LiBBZnRlciBzZXR0aW5nIHRoaXMsIHRoZSB1c2VyIHdpbGwgbm90IGJlIGFibGUgdG8KKyAgICogZW50ZXIgYSBuZXcgcGFzc3dvcmQgdGhhdCBpcyB0aGUgc2FtZSBhcyBhbnkgcGFzc3dvcmQgaW4gdGhlIGhpc3RvcnkuIE5vdGUKKyAgIC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veHkgZGVzaXJlZC4gTXVzdCBiZSBhbiBIVFRQIFByb3h5LgorICAgICAqICAgICAgICAgICAgUGFzcyBQcm94eS5OT19QUk9YWSB0byByZXNldCB0aGUgcHJveHkuCisgICAgICogQHBhcmFtIGV4Y2x1c2lvbkxpc3QgYSBsaXN0IG9mIGRvbWFpbnMgdG8gYmUgZXhjbHVkZWQgZnJvbSB0aGUgZ2xvYmFsIHByb3h5LgorICAgICAqIEByZXR1cm4gcmV0dXJucyBudWxsIGlmIHRoZSBwcm94eSB3YXMgc3VjY2Vzc2Z1bGx5IHNldCwgb3IgYSB7QGxpbmsgQ29tcG9uZW50TmFtZX0KKyAgICAgKiAgICAgICAgICAgIG9mIHRoZSBkZXZpY2UgYWRtaW4gdGhhdCBzZXRzIHRoZXcgcHJveHkgb3RoZXJ3aXNlLgorICAgICAqLworICAgIHB1YmxpYyBDb21wb25lbnROYW1lIHNldEdsb2JhbFByb3h5KENvbXBvbmVudE5hbWUgYWRtaW4sIFByb3h5IHByb3h5U3BlYywKKyAgICAgICAgICAgIExpc3Q8U3RyaW5nPiBleGNsdXNpb25MaXN0ICkgeworICAgICAgICBpZiAocHJveHlTcGVjID09IG51bGwpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBOdWxsUG9pbnRlckV4Y2VwdGlvbigpOworICAgICAgICB9CisgICAgICAgIGlmIChtU2VydmljZSAhPSBudWxsKSB7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIFN0cmluZyBob3N0U3BlYzsKKyAgICAgICAgICAgICAgICBTdHJpbmcgZXhjbFNwZWM7CisgICAgICAgICAgICAgICAgaWYgKHByb3h5U3BlYy5lcXVhbHMoUHJveHkuTk9fUFJPWFkpKSB7CisgICAgICAgICAgICAgICAgICAgIGhvc3RTcGVjID0gbnVsbDsKKyAgICAgICAgICAgICAgICAgICAgZXhjbFNwZWMgPSBudWxsOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIGlmICghcHJveHlTcGVjLnR5cGUoKS5lcXVhbHMoUHJveHkuVHlwZS5IVFRQKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIEluZXRTb2NrZXRBZGRyZXNzIHNhID0gKEluZXRTb2NrZXRBZGRyZXNzKXByb3h5U3BlYy5hZGRyZXNzKCk7CisgICAgICAgICAgICAgICAgICAgIFN0cmluZyBob3N0TmFtZSA9IHNhLmdldEhvc3ROYW1lKCk7CisgICAgICAgICAgICAgICAgICAgIGludCBwb3J0ID0gc2EuZ2V0UG9ydCgpOworICAgICAgICAgICAgICAgICAgICBTdHJpbmdCdWlsZGVyIGhvc3RCdWlsZGVyID0gbmV3IFN0cmluZ0J1aWxkZXIoKTsKKyAgICAgICAgICAgICAgICAgICAgaG9zdFNwZWMgPSBob3N0QnVpbGRlci5hcHBlbmQoaG9zdE5hbWUpCisgICAgICAgICAgICAgICAgICAgICAgICAuYXBwZW5kKCI6IikuYXBwZW5kKEludGVnZXIudG9TdHJpbmcocG9ydCkpLnRvU3RyaW5nKCk7CisgICAgICAgICAgICAgICAgICAgIGlmIChleGNsdXNpb25MaXN0ID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGV4Y2xTcGVjID0gIiI7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICBTdHJpbmdCdWlsZGVyIGxpc3RCdWlsZGVyID0gbmV3IFN0cmluZ0J1aWxkZXIoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJvb2xlYW4gZmlyc3REb21haW4gPSB0cnVlOworICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChTdHJpbmcgZXhjbERvbWFpbiA6IGV4Y2x1c2lvbkxpc3QpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWZpcnN0RG9tYWluKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpc3RCdWlsZGVyID0gbGlzdEJ1aWxkZXIuYXBwZW5kKCIsIik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmlyc3REb21haW4gPSBmYWxzZTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlzdEJ1aWxkZXIgPSBsaXN0QnVpbGRlci5hcHBlbmQoZXhjbERvbWFpbi50cmltKCkpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgZXhjbFNwZWMgPSBsaXN0QnVpbGRlci50b1N0cmluZygpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGFuZHJvaWQubmV0LlByb3h5LnZhbGlkYXRlKGhvc3ROYW1lLCBJbnRlZ2VyLnRvU3RyaW5nKHBvcnQpLCBleGNsU3BlYyk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHJldHVybiBtU2VydmljZS5zZXRHbG9iYWxQcm94eShhZG1pbiwgaG9zdFNwZWMsIGV4Y2xTcGVjKTsKKyAgICAgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgTG9nLncoVEFHLCAiRmFpbGVkIHRhbGtpbmcgd2l0aCBkZXZpY2UgcG9saWN5IHNlcnZpY2UiLCBlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbnVsbDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZXR1cm5zIHRoZSBjb21wb25lbnQgbmFtZSBzZXR0aW5nIHRoZSBnbG9iYWwgcHJveHkuCisgICAgICogQHJldHVybiBDb21wb25lbnROYW1lIG9iamVjdCBvZiB0aGUgZGV2aWNlIGFkbWluIHRoYXQgc2V0IHRoZSBnbG9iYWwgcHJveHksIG9yCisgICAgICogICAgICAgICAgICBudWxsIGlmIG5vIGFkbWluIGhhcyBzZXQgdGhlIHByb3h5LgorICAgICAqLworICAgIHB1YmxpYyBDb21wb25lbnROYW1lIGdldEdsb2JhbFByb3h5QWRtaW4oKSB7CisgICAgICAgIGlmIChtU2VydmljZSAhPSBudWxsKSB7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIHJldHVybiBtU2VydmljZS5nZXRHbG9iYWxQcm94eUFkbWluKCk7CisgICAgICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgIExvZy53KFRBRywgIkZhaWxlZCB0YWxraW5nIHdpdGggZGV2aWNlIHBvbGljeSBzZXJ2aWNlIiwgZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIG51bGw7CisgICAgfQorCiAgICAgLyoqCiAgICAgICogQGhpZGUKICAgICAgKi8KQEAgLTU0Myw3ICsxMDEzLDcgQEAKICAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgIH0KLSAgICAKKwogICAgIC8qKgogICAgICAqIEBoaWRlCiAgICAgICovCkBAIC01NTYsMTAgKzEwMjYsMTAgQEAKICAgICAgICAgICAgIExvZy53KFRBRywgIlVuYWJsZSB0byByZXRyaWV2ZSBkZXZpY2UgcG9saWN5ICIgKyBjbiwgZSk7CiAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgfQotICAgICAgICAKKwogICAgICAgICBSZXNvbHZlSW5mbyByaSA9IG5ldyBSZXNvbHZlSW5mbygpOwogICAgICAgICByaS5hY3Rpdml0eUluZm8gPSBhaTsKLSAgICAgICAgCisKICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgIHJldHVybiBuZXcgRGV2aWNlQWRtaW5JbmZvKG1Db250ZXh0LCByaSk7CiAgICAgICAgIH0gY2F0Y2ggKFhtbFB1bGxQYXJzZXJFeGNlcHRpb24gZSkgewpAQCAtNTcwLDcgKzEwNDAsNyBAQAogICAgICAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgICAgIH0KICAgICB9Ci0gICAgCisKICAgICAvKioKICAgICAgKiBAaGlkZQogICAgICAqLwpAQCAtNTg3LDE2ICsxMDU3LDE4IEBACiAgICAgLyoqCiAgICAgICogQGhpZGUKICAgICAgKi8KLSAgICBwdWJsaWMgdm9pZCBzZXRBY3RpdmVQYXNzd29yZFN0YXRlKGludCBxdWFsaXR5LCBpbnQgbGVuZ3RoKSB7CisgICAgcHVibGljIHZvaWQgc2V0QWN0aXZlUGFzc3dvcmRTdGF0ZShpbnQgcXVhbGl0eSwgaW50IGxlbmd0aCwgaW50IGxldHRlcnMsIGludCB1cHBlcmNhc2UsCisgICAgICAgICAgICBpbnQgbG93ZXJjYXNlLCBpbnQgbnVtYmVycywgaW50IHN5bWJvbHMsIGludCBub25sZXR0ZXIpIHsKICAgICAgICAgaWYgKG1TZXJ2aWNlICE9IG51bGwpIHsKICAgICAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICAgICAgbVNlcnZpY2Uuc2V0QWN0aXZlUGFzc3dvcmRTdGF0ZShxdWFsaXR5LCBsZW5ndGgpOworICAgICAgICAgICAgICAgIG1TZXJ2aWNlLnNldEFjdGl2ZVBhc3N3b3JkU3RhdGUocXVhbGl0eSwgbGVuZ3RoLCBsZXR0ZXJzLCB1cHBlcmNhc2UsIGxvd2VyY2FzZSwKKyAgICAgICAgICAgICAgICAgICAgICAgIG51bWJlcnMsIHN5bWJvbHMsIG5vbmxldHRlcik7CiAgICAgICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZSkgewogICAgICAgICAgICAgICAgIExvZy53KFRBRywgIkZhaWxlZCB0YWxraW5nIHdpdGggZGV2aWNlIHBvbGljeSBzZXJ2aWNlIiwgZSk7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICB9Ci0gICAgCisKICAgICAvKioKICAgICAgKiBAaGlkZQogICAgICAqLwpAQCAtNjA5LDcgKzEwODEsNyBAQAogICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgfQotICAgIAorCiAgICAgLyoqCiAgICAgICogQGhpZGUKICAgICAgKi8KQEAgLTYyMiw0ICsxMDk0LDUgQEAKICAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgIH0KKwogfQpkaWZmIC0tZ2l0IGEvY29yZS9qYXZhL2FuZHJvaWQvYXBwL2FkbWluL0lEZXZpY2VQb2xpY3lNYW5hZ2VyLmFpZGwgYi9jb3JlL2phdmEvYW5kcm9pZC9hcHAvYWRtaW4vSURldmljZVBvbGljeU1hbmFnZXIuYWlkbAppbmRleCA2ZmM0ZGM1Li4zZmNkNmZjIDEwMDY0NAotLS0gYS9jb3JlL2phdmEvYW5kcm9pZC9hcHAvYWRtaW4vSURldmljZVBvbGljeU1hbmFnZXIuYWlkbAorKysgYi9jb3JlL2phdmEvYW5kcm9pZC9hcHAvYWRtaW4vSURldmljZVBvbGljeU1hbmFnZXIuYWlkbApAQCAtMjcsMTAgKzI3LDMxIEBACiBpbnRlcmZhY2UgSURldmljZVBvbGljeU1hbmFnZXIgewogICAgIHZvaWQgc2V0UGFzc3dvcmRRdWFsaXR5KGluIENvbXBvbmVudE5hbWUgd2hvLCBpbnQgcXVhbGl0eSk7CiAgICAgaW50IGdldFBhc3N3b3JkUXVhbGl0eShpbiBDb21wb25lbnROYW1lIHdobyk7Ci0gICAgCisKICAgICB2b2lkIHNldFBhc3N3b3JkTWluaW11bUxlbmd0aChpbiBDb21wb25lbnROYW1lIHdobywgaW50IGxlbmd0aCk7CiAgICAgaW50IGdldFBhc3N3b3JkTWluaW11bUxlbmd0aChpbiBDb21wb25lbnROYW1lIHdobyk7CisKKyAgICB2b2lkIHNldFBhc3N3b3JkTWluaW11bVVwcGVyQ2FzZShpbiBDb21wb25lbnROYW1lIHdobywgaW50IGxlbmd0aCk7CisgICAgaW50IGdldFBhc3N3b3JkTWluaW11bVVwcGVyQ2FzZShpbiBDb21wb25lbnROYW1lIHdobyk7CisKKyAgICB2b2lkIHNldFBhc3N3b3JkTWluaW11bUxvd2VyQ2FzZShpbiBDb21wb25lbnROYW1lIHdobywgaW50IGxlbmd0aCk7CisgICAgaW50IGdldFBhc3N3b3JkTWluaW11bUxvd2VyQ2FzZShpbiBDb21wb25lbnROYW1lIHdobyk7CisKKyAgICB2b2lkIHNldFBhc3N3b3JkTWluaW11bUxldHRlcnMoaW4gQ29tcG9uZW50TmFtZSB3aG8sIGludCBsZW5ndGgpOworICAgIGludCBnZXRQYXNzd29yZE1pbmltdW1MZXR0ZXJzKGluIENvbXBvbmVudE5hbWUgd2hvKTsKKworICAgIHZvaWQgc2V0UGFzc3dvcmRNaW5pbXVtTnVtZXJpYyhpbiBDb21wb25lbnROYW1lIHdobywgaW50IGxlbmd0aCk7CisgICAgaW50IGdldFBhc3N3b3JkTWluaW11bU51bWVyaWMoaW4gQ29tcG9uZW50TmFtZSB3aG8pOworCisgICAgdm9pZCBzZXRQYXNzd29yZE1pbmltdW1TeW1ib2xzKGluIENvbXBvbmVudE5hbWUgd2hvLCBpbnQgbGVuZ3RoKTsKKyAgICBpbnQgZ2V0UGFzc3dvcmRNaW5pbXVtU3ltYm9scyhpbiBDb21wb25lbnROYW1lIHdobyk7CisKKyAgICB2b2lkIHNldFBhc3N3b3JkTWluaW11bU5vbkxldHRlcihpbiBDb21wb25lbnROYW1lIHdobywgaW50IGxlbmd0aCk7CisgICAgaW50IGdldFBhc3N3b3JkTWluaW11bU5vbkxldHRlcihpbiBDb21wb25lbnROYW1lIHdobyk7CiAgICAgCisgICAgdm9pZCBzZXRQYXNzd29yZEhpc3RvcnlMZW5ndGgoaW4gQ29tcG9uZW50TmFtZSB3aG8sIGludCBsZW5ndGgpOworICAgIGludCBnZXRQYXNzd29yZEhpc3RvcnlMZW5ndGgoaW4gQ29tcG9uZW50TmFtZSB3aG8pOworCiAgICAgYm9vbGVh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gICAgICAgICBtc2cuYXJnMSA9IGFwcFdpZGdldElkOworICAgICAgICAgICAgbXNnLmFyZzIgPSB2aWV3SWQ7CisgICAgICAgICAgICBtc2cuc2VuZFRvVGFyZ2V0KCk7CisgICAgICAgIH0KICAgICB9CiAKICAgICBjbGFzcyBVcGRhdGVIYW5kbGVyIGV4dGVuZHMgSGFuZGxlciB7CkBAIC03Nyw2ICs4NSwxMCBAQAogICAgICAgICAgICAgICAgICAgICBvblByb3ZpZGVyQ2hhbmdlZChtc2cuYXJnMSwgKEFwcFdpZGdldFByb3ZpZGVySW5mbyltc2cub2JqKTsKICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGNhc2UgSEFORExFX1ZJRVdfREFUQV9DSEFOR0VEOiB7CisgICAgICAgICAgICAgICAgICAgIHZpZXdEYXRhQ2hhbmdlZChtc2cuYXJnMSwgbXNnLmFyZzIpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICB9CkBAIC0yNTAsNiArMjYyLDE2IEBACiAgICAgICAgICAgICB2LnVwZGF0ZUFwcFdpZGdldCh2aWV3cyk7CiAgICAgICAgIH0KICAgICB9CisKKyAgICB2b2lkIHZpZXdEYXRhQ2hhbmdlZChpbnQgYXBwV2lkZ2V0SWQsIGludCB2aWV3SWQpIHsKKyAgICAgICAgQXBwV2lkZ2V0SG9zdFZpZXcgdjsKKyAgICAgICAgc3luY2hyb25pemVkIChtVmlld3MpIHsKKyAgICAgICAgICAgIHYgPSBtVmlld3MuZ2V0KGFwcFdpZGdldElkKTsKKyAgICAgICAgfQorICAgICAgICBpZiAodiAhPSBudWxsKSB7CisgICAgICAgICAgICB2LnZpZXdEYXRhQ2hhbmdlZCh2aWV3SWQpOworICAgICAgICB9CisgICAgfQogfQogCiAKZGlmZiAtLWdpdCBhL2NvcmUvamF2YS9hbmRyb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AKICAgICAgICAgICAgICAgICAgICAgbmV3U3RhdGUgPT0gQmx1ZXRvb3RoQTJkcC5TVEFURV9ESVNDT05ORUNURUQpIHsKICAgICAgICAgICAgICAgICAgICAgc2VuZE1lc3NhZ2UoVFJBTlNJVElPTl9UT19TVEFCTEUpOwogICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gZWxzZSBpZiAoYWN0aW9uLmVxdWFscyhCbHVldG9vdGhJbnB1dERldmljZS5BQ1RJT05fSU5QVVRfREVWSUNFX1NUQVRFX0NIQU5HRUQpKSB7CisgICAgICAgICAgICAgICAgaW50IG5ld1N0YXRlID0gaW50ZW50LmdldEludEV4dHJhKEJsdWV0b290aElucHV0RGV2aWNlLkVYVFJBX0lOUFVUX0RFVklDRV9TVEFURSwgMCk7CisgICAgICAgICAgICAgICAgaW50IG9sZFN0YXRlID0KKyAgICAgICAgICAgICAgICAgICAgaW50ZW50LmdldEludEV4dHJhKEJsdWV0b290aElucHV0RGV2aWNlLkVYVFJBX1BSRVZJT1VTX0lOUFVUX0RFVklDRV9TVEFURSwgMCk7CisgICAgICAgICAgICAgICAgbUhpZFN0YXRlID0gbmV3U3RhdGU7CisgICAgICAgICAgICAgICAgaWYgKG9sZFN0YXRlID09IEJsdWV0b290aElucHV0RGV2aWNlLlNUQVRFX0NPTk5FQ1RFRCAmJgorICAgICAgICAgICAgICAgICAgICBuZXdTdGF0ZSA9PSBCbHVldG9vdGhJbnB1dERldmljZS5TVEFURV9ESVNDT05ORUNURUQpIHsKKyAgICAgICAgICAgICAgICAgICAgc2VuZE1lc3NhZ2UoRElTQ09OTkVDVF9ISURfSU5DT01JTkcpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBpZiAobmV3U3RhdGUgPT0gQmx1ZXRvb3RoSW5wdXREZXZpY2UuU1RBVEVfQ09OTkVDVEVEIHx8CisgICAgICAgICAgICAgICAgICAgIG5ld1N0YXRlID09IEJsdWV0b290aElucHV0RGV2aWNlLlNUQVRFX0RJU0NPTk5FQ1RFRCkgeworICAgICAgICAgICAgICAgICAgICBzZW5kTWVzc2FnZShUUkFOU0lUSU9OX1RPX1NUQUJMRSk7CisgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfSBlbHNlIGlmIChhY3Rpb24uZXF1YWxzKEJsdWV0b290aERldmljZS5BQ1RJT05fQUNMX0NPTk5FQ1RFRCkpIHsKICAgICAgICAgICAgICAgICBpZiAoIWdldEN1cnJlbnRTdGF0ZSgpLmVxdWFscyhtQm9uZGVkRGV2aWNlKSkgewogICAgICAgICAgICAgICAgICAgICBMb2cuZShUQUcsICJTdGF0ZSBpczogIiArIGdldEN1cnJlbnRTdGF0ZSgpKTsKQEAgLTE2NSw2ICsxODYsOCBAQAogICAgICAgICBhZGRTdGF0ZShtSW5jb21pbmdIYW5kc2ZyZWUpOwogICAgICAgICBhZGRTdGF0ZShtSW5jb21pbmdBMmRwKTsKICAgICAgICAgYWRkU3RhdGUobU91dGdvaW5nQTJkcCk7CisgICAgICAgIGFkZFN0YXRlKG1PdXRnb2luZ0hpZCk7CisgICAgICAgIGFkZFN0YXRlKG1JbmNvbWluZ0hpZCk7CiAgICAgICAgIHNldEluaXRpYWxTdGF0ZShtQm9uZGVkRGV2aWNlKTsKIAogICAgICAgICBJbnRlbnRGaWx0ZXIgZmlsdGVyID0gbmV3IEludGVudEZpbHRlcigpOwpAQCAtMTcyLDYgKzE5NSw3IEBACiAgICAgICAgIGZpbHRlci5hZGRBY3Rpb24oQmx1ZXRvb3RoQTJkcC5BQ1RJT05fU0lOS19TVEFURV9DSEFOR0VEKTsKICAgICAgICAgZmlsdGVyLmFkZEFjdGlvbihCbHVldG9vdGhIZWFkc2V0LkFDVElPTl9TVEFURV9DSEFOR0VEKTsKICAgICAgICAgZmlsdGVyLmFkZEFjdGlvbihCbHVldG9vdGhEZXZpY2UuQUNUSU9OX0FDTF9DT05ORUNURUQpOworICAgICAgICBmaWx0ZXIuYWRkQWN0aW9uKEJsdWV0b290aElucHV0RGV2aWNlLkFDVElPTl9JTlBVVF9ERVZJQ0VfU1RBVEVfQ0hBTkdFRCk7CiAKICAgICAgICAgbUNvbnRleHQucmVnaXN0ZXJSZWNlaXZlcihtQnJvYWRjYXN0UmVjZWl2ZXIsIGZpbHRlcik7CiAKQEAgLTIyNCw2ICsyNDgsMTQgQEAKICAgICAgICAgICAgICAgICBjYXNlIERJU0NPTk5FQ1RfQTJEUF9JTkNPTUlORzoKICAgICAgICAgICAgICAgICAgICAgdHJhbnNpdGlvblRvKG1JbmNvbWluZ0EyZHApOwogICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENPTk5FQ1RfSElEX09VVEdPSU5HOgorICAgICAgICAgICAgICAgIGNhc2UgRElTQ09OTkVDVF9ISURfT1VUR09JTkc6CisgICAgICAgICAgICAgICAgICAgIHRyYW5zaXRpb25UbyhtT3V0Z29pbmdIaWQpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENPTk5FQ1RfSElEX0lOQ09NSU5HOgorICAgICAgICAgICAgICAgIGNhc2UgRElTQ09OTkVDVF9ISURfSU5DT01JTkc6CisgICAgICAgICAgICAgICAgICAgIHRyYW5zaXRpb25UbyhtSW5jb21pbmdIaWQpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICBjYXNlIFVOUEFJUjoKICAgICAgICAgICAgICAgICAgICAgaWYgKG1IZWFkc2V0U3RhdGUgIT0gQmx1ZXRvb3RoSGVhZHNldC5TVEFURV9ESVNDT05ORUNURUQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgIHNlbmRNZXNzYWdlKERJU0NPTk5FQ1RfSEZQX09VVEdPSU5HKTsKQEAgLTIzMyw2ICsyNjUsMTAgQEAKICAgICAgICAgICAgICAgICAgICAgICAgIHNlbmRNZXNzYWdlKERJU0NPTk5FQ1RfQTJEUF9PVVRHT0lORyk7CiAgICAgICAgICAgICAgICAgICAgICAgICBkZWZlck1lc3NhZ2UobWVzc2FnZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChtSGlkU3RhdGUgIT0gQmx1ZXRvb3RoSW5wdXREZXZpY2UuU1RBVEVfRElTQ09OTkVDVEVEKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBzZW5kTWVzc2FnZShESVNDT05ORUNUX0hJRF9PVVRHT0lORyk7CisgICAgICAgICAgICAgICAgICAgICAgICBkZWZlck1lc3NhZ2UobWVzc2FnZSk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICBwcm9jZXNzQ29tbWFuZChVTlBBSVIpOwogICAgICAgICAgICAgICAgICAgICBicmVhazsKQEAgLTI1NCw2ICsyOTAsMTAgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1BMmRwU2VydmljZS5nZXRDb25uZWN0ZWRTaW5rcygpLmxlbmd0aCA9PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUEyZHBTZXJ2aWNlLmNvbm5lY3RTaW5rKG1EZXZpY2UpOwogICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1TZXJ2aWNlLmdldElucHV0RGV2aWNlUHJpb3JpdHkobURldmljZSkgPT0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEJsdWV0b290aElucHV0RGV2aWNlLlBSSU9SSVRZX0FVVE9fQ09OTkVDVCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1TZXJ2aWNlLmNvbm5lY3RJbnB1dERldmljZShtRGV2aWNlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICBjYXNlIFRSQU5TSVRJT05fVE9fU1RBQkxFOgpAQCAtMzQyLDYgKzM4MiwyMyBAQAogICAgICAgICAgICAgICAgICAgICAgICBkZWZlck1lc3NhZ2UoZGVmZXJNc2cpOwogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgQ09OTkVDVF9ISURfT1VUR09JTkc6CisgICAgICAgICAgICAgICAgY2FzZSBESVNDT05ORUNUX0hJRF9PVVRHT0lORzoKKyAgICAgICAgICAgICAgICAgICAgZGVmZXJNZXNzYWdlKG1lc3NhZ2UpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENPTk5FQ1RfSElEX0lOQ09NSU5HOgorICAgICAgICAgICAgICAgICAgICB0cmFuc2l0aW9uVG8obUluY29taW5nSGlkKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKG1TdGF0dXMpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGRlZmVyTXNnLndoYXQgPSBtQ29tbWFuZDsKKyAgICAgICAgICAgICAgICAgICAgICAgIGRlZmVyTWVzc2FnZShkZWZlck1zZyk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBESVNDT05ORUNUX0hJRF9JTkNPTUlORzoKKyAgICAgICAgICAgICAgICAgICAgaWYgKG1TdGF0dXMpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGRlZmVyTXNnLndoYXQgPSBtQ29tbWFuZDsKKyAgICAgICAgICAgICAgICAgICAgICAgIGRlZmVyTWVzc2FnZShkZWZlck1zZyk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7IC8vIGlnbm9yZQogICAgICAgICAgICAgICAgIGNhc2UgVU5QQUlSOgogICAgICAgICAgICAgICAgIGNhc2UgQVVUT19DT05ORUNUX1BST0ZJTEVTOgogICAgICAgICAgICAgICAgICAgICBkZWZlck1lc3NhZ2UobWVzc2FnZSk7CkBAIC00MDksNiArNDY2LDEzIEBACiAgICAgICAgICAgICAgICAgICAgIC8vIElmIHRoaXMgY2F1c2VzIGluY29taW5nIEhGUCB0byBmYWlsLCBpdCBpcyBtb3JlIG9mIGEgaGVhZHNldCBwcm9ibGVtCiAgICAgICAgICAgICAgICAgICAgIC8vIHNpbmNlIGJvdGggY29ubmVjdGlvbnMgYXJlIGluY29taW5nIG9uZXMuCiAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgQ09OTkVDVF9ISURfT1VUR09JTkc6CisgICAgICAgICAgICAgICAgY2FzZSBESVNDT05ORUNUX0hJRF9PVVRHT0lORzoKKyAgICAgICAgICAgICAgICAgICAgZGVmZXJNZXNzYWdlKG1lc3NhZ2UpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENPTk5FQ1RfSElEX0lOQ09NSU5HOgorICAgICAgICAgICAgICAgIGNhc2UgRElTQ09OTkVDVF9ISURfSU5DT01JTkc6CisgICAgICAgICAgICAgICAgICAgICBicmVhazsgLy8gaWdub3JlCiAgICAgICAgICAgICAgICAgY2FzZSBVTlBBSVI6CiAgICAgICAgICAgICAgICAgY2FzZSBBVVRPX0NPTk5FQ1RfUFJPRklMRVM6CiAgICAgICAgICAgICAgICAgICAgIGRlZmVyTWVzc2FnZShtZXNzYWdlKTsKQEAgLTQ5Niw2ICs1NjAsMjMgQEAKICAgICAgICAgICAgICAgICBjYXNlIERJU0NPTk5FQ1RfQTJEUF9JTkNPTUlORzoKICAgICAgICAgICAgICAgICAgICAgLy8gSWdub3JlLCB3aWxsIGJlIGhhbmRsZWQgYnkgQmx1ZXoKICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBDT05ORUNUX0hJRF9PVVRHT0lORzoKKyAgICAgICAgICAgICAgICBjYXNlIERJU0NPTk5FQ1RfSElEX09VVEdPSU5HOgorICAgICAgICAgICAgICAgICAgICBkZWZlck1lc3NhZ2UobWVzc2FnZSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgQ09OTkVDVF9ISURfSU5DT01JTkc6CisgICAgICAgICAgICAgICAgICAgIHRyYW5zaXRpb25UbyhtSW5jb21pbmdIaWQpOworICAgICAgICAgICAgICAgICAgICBpZiAobVN0YXR1cykgeworICAgICAgICAgICAgICAgICAgICAgICAgZGVmZXJNc2cud2hhdCA9IG1Db21tYW5kOworICAgICAgICAgICAgICAgICAgICAgICAgZGVmZXJNZXNzYWdlKGRlZmVyTXNnKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIERJU0NPTk5FQ1RfSElEX0lOQ09NSU5HOgorICAgICAgICAgICAgICAgICAgICBpZiAobVN0YXR1cykgeworICAgICAgICAgICAgICAgICAgICAgICAgZGVmZXJNc2cud2hhdCA9IG1Db21tYW5kOworICAgICAgICAgICAgICAgICAgICAgICAgZGVmZXJNZXNzYWdlKGRlZmVyTXNnKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBicmVhazsgLy8gaWdub3JlCiAgICAgICAgICAgICAgICAgY2FzZSBVTlBBSVI6CiAgICAgICAgICAgICAgICAgY2FzZSBBVVRPX0NPTk5FQ1RfUFJPRklMRVM6CiAgICAgICAgICAgICAgICAgICAgIGRlZmVyTWVzc2FnZShtZXNzYWdlKTsKQEAgLTU2MSw2ICs2NDIsMTMgQEAKICAgICAgICAgICAgICAgICBjYXNlIERJU0NPTk5FQ1RfQTJEUF9JTkNPTUlORzoKICAgICAgICAgICAgICAgICAgICAgLy8gSWdub3JlLCB3aWxsIGJlIGhhbmRsZWQgYnkgQmx1ZXoKICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBDT05ORUNUX0hJRF9PVVRHT0lORzoKKyAgICAgICAgICAgICAgICBjYXNlIERJU0NPTk5FQ1RfSElEX09VVEdPSU5HOgorICAgICAgICAgICAgICAgICAgICBkZWZlck1lc3NhZ2UobWVzc2FnZSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgQ09OTkVDVF9ISURfSU5DT01JTkc6CisgICAgICAgICAgICAgICAgY2FzZSBESVNDT05ORUNUX0hJRF9JTkNPTUlORzoKKyAgICAgICAgICAgICAgICAgICAgIGJyZWFrOyAvLyBpZ25vcmUKICAgICAgICAgICAgICAgICBjYXNlIFVOUEFJUjoKICAgICAgICAgICAgICAgICBjYXNlIEFVVE9fQ09OTkVDVF9QUk9GSUxFUzoKICAgICAgICAgICAgICAgICAgICAgZGVmZXJNZXNzYWdlKG1lc3NhZ2UpOwpAQCAtNTc2LDYgKzY2NCwxNDMgQEAKICAgICB9CiAKIAorICAgIHByaXZhdGUgY2xhc3MgT3V0Z29pbmdIaWQgZXh0ZW5kcyBIaWVyYXJjaGljYWxTdGF0ZSB7CisgICAgICAgIHByaXZhdGUgYm9vbGVhbiBtU3RhdHVzID0gZmFsc2U7CisgICAgICAgIHByaXZhdGUgaW50IG1Db21tYW5kOworCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwcm90ZWN0ZWQgdm9pZCBlbnRlcigpIHsKKyAgICAgICAgICAgIGxvZygiRW50ZXJpbmcgT3V0Z29pbmdIaWQgc3RhdGUgd2l0aDogIiArIGdldEN1cnJlbnRNZXNzYWdlKCkud2hhdCk7CisgICAgICAgICAgICBtQ29tbWFuZCA9IGdldEN1cnJlbnRNZXNzYWdlKCkud2hhdDsKKyAgICAgICAgICAgIGlmIChtQ29tbWFuZCAhPSBDT05ORUNUX0hJRF9PVVRHT0lORyAmJgorICAgICAgICAgICAgICAgIG1Db21tYW5kICE9IERJU0NPTk5FQ1RfSElEX09VVEdPSU5HKSB7CisgICAgICAgICAgICAgICAgTG9nLmUoVEFHLCAiRXJyb3I6IE91dGdvaW5nSGlkIHN0YXRlIHdpdGggY29tbWFuZDoiICsgbUNvbW1hbmQpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbVN0YXR1cyA9IHByb2Nlc3NDb21tYW5kKG1Db21tYW5kKTsKKyAgICAgICAgICAgIGlmICghbVN0YXR1cykgc2VuZE1lc3NhZ2UoVFJBTlNJVElPTl9UT19TVEFCTEUpOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHByb3RlY3RlZCBib29sZWFuIHByb2Nlc3NNZXNzYWdlKE1lc3NhZ2UgbWVzc2FnZSkgeworICAgICAgICAgICAgbG9nKCJPdXRnb2luZ0hpZCBTdGF0ZS0+UHJvY2Vzc2luZyBNZXNzYWdlOiAiICsgbWVzc2FnZS53aGF0KTsKKyAgICAgICAgICAgIE1lc3NhZ2UgZGVmZXJNc2cgPSBuZXcgTWVzc2FnZSgpOworICAgICAgICAgICAgc3dpdGNoKG1lc3NhZ2Uud2hhdCkgeworICAgICAgICAgICAgICAgIC8vIGRlZmVyIGFsbCBvdXRnb2luZyBtZXNzYWdlcworICAgICAgICAgICAgICAgIGNhc2UgQ09OTkVDVF9IRlBfT1VUR09JTkc6CisgICAgICAgICAgICAgICAgY2FzZSBDT05ORUNUX0EyRFBfT1VUR09JTkc6CisgICAgICAgICAgICAgICAgY2FzZSBDT05ORUNUX0hJRF9PVVRHT0lORzoKKyAgICAgICAgICAgICAgICBjYXNlIERJU0NPTk5FQ1RfSEZQX09VVEdPSU5HOgorICAgICAgICAgICAgICAgIGNhc2UgRElTQ09OTkVDVF9BMkRQX09VVEdPSU5HOgorICAgICAgICAgICAgICAgIGNhc2UgRElTQ09OTkVDVF9ISURfT1VUR09JTkc6CisgICAgICAgICAgICAgICAgICAgIGRlZmVyTWVzc2FnZShtZXNzYWdlKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICBjYXNlIENPTk5FQ1RfSEZQX0lOQ09NSU5HOgorICAgICAgICAgICAgICAgICAgICB0cmFuc2l0aW9uVG8obUluY29taW5nSGFuZHNmcmVlKTsKKyAgICAgICAgICAgICAgICBjYXNlIENPTk5FQ1RfQTJEUF9JTkNPTUlORzoKKyAgICAgICAgICAgICAgICAgICAgdHJhbnNpdGlvblRvKG1JbmNvbWluZ0EyZHApOworCisgICAgICAgICAgICAgICAgICAgIC8vIERvbid0IGNhbmNlbCBISUQgb3V0Z29pbmcgYXMgdGhlcmUgaXMgbm8gZ3VhcmFudGVlIGl0CisgICAgICAgICAgICAgICAgICAgIC8vIHdpbGwgZ2V0IGNhbmNlbGVkLgorICAgICAgICAgICAgICAgICAgICAvLyBJdCBtaWdodCBhbHJlYWR5IGJlIGNvbm5lY3RlZCBidXQgd2UgbWlnaHQgbm90IGhhdmUgZ290IHRoZQorICAgICAgICAgICAgICAgICAgICAvLyBJTlBVVF9ERVZJQ0VfU1RBVEVfQ0hBTkdFLiBIZW5jZSwgbm8gcG9pbnQgZGlzY29ubmVjdGluZyBoZXJlLgorICAgICAgICAgICAgICAgICAgICAvLyBUaGUgd29yc3QgY2FzZSwgdGhlIGNvbm5lY3Rpb24gd2lsbCBmYWlsLCByZXRyeS4KKyAgICAgICAgICAgICAgICAgICAgaWYgKG1TdGF0dXMpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGRlZmVyTXNnLndoYXQgPSBtQ29tbWFuZDsKKyAgICAgICAgICAgICAgICAgICAgICAgIGRlZmVyTWVzc2FnZShkZWZlck1zZyk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBDT05ORUNUX0hJRF9JTkNPTUlORzoKKyAgICAgICAgICAgICAgICAgIC8vIEJsdWV6IHdpbGwgdGFrZSBjYXJlIG9mIHRoZSBjb25mbGljdHMKKyAgICAgICAgICAgICAgICAgICAgdHJhbnNpdGlvblRvKG1JbmNvbWluZ0hpZCk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgY2FzZSBESVNDT05ORUNUX0hGUF9JTkNPTUlORzoKKyAgICAgICAgICAgICAgICBjYXNlIERJU0NPTk5FQ1RfQTJEUF9JTkNPTUlORzoKKyAgICAgICAgICAgICAgICAgICAgLy8gQXQgdGhpcyBwb2ludCwgd2UgYXJlIGFscmVhZHkgZGlzY29ubmVjdGVkCisgICAgICAgICAgICAgICAgICAgIC8vIHdpdGggSEZQLiBTb21ldGltZXMgSElEIGNvbm5lY3Rpb24gY2FuCisgICAgICAgICAgICAgICAgICAgIC8vIGZhaWwgZHVlIHRvIHRoZSBkaXNjb25uZWN0aW9uIG9mIEhGUC4gU28gYWRkIGEgcmV0cnkKKyAgICAgICAgICAgICAgICAgICAgLy8gZm9yIHRoZSBISUQuCisgICAgICAgICAgICAgICAgICAgIGlmIChtU3RhdHVzKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBkZWZlck1zZy53aGF0ID0gbUNvbW1hbmQ7CisgICAgICAgICAgICAgICAgICAgICAgICBkZWZlck1lc3NhZ2UoZGVmZXJNc2cpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgRElTQ09OTkVDVF9ISURfSU5DT01JTkc6CisgICAgICAgICAgICAgICAgICAgIC8vIElnbm9yZSwgd2lsbCBiZSBoYW5kbGVkIGJ5IEJsdWV6CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgY2FzZSBVTlBBSVI6CisgICAgICAgICAgICAgICAgY2FzZSBBVVRPX0NPTk5FQ1RfUFJPRklMRVM6CisgICAgICAgICAgICAgICAgICAgIGRlZmVyTWVzc2FnZShtZXNzYWdlKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBUUkFOU0lUSU9OX1RPX1NUQUJMRToKKyAgICAgICAgICAgICAgICAgICAgdHJhbnNpdGlvblRvKG1Cb25kZWREZXZpY2UpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgICAgICByZXR1cm4gTk9UX0hBTkRMRUQ7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gSEFORExFRDsKKyAgICAgICAgfQorICAgIH0KKworICBwcml2YXRlIGNsYXNzIEluY29taW5nSGlkIGV4dGVuZHMgSGllcmFyY2hpY2FsU3RhdGUgeworICAgICAgcHJpdmF0ZSBib29sZWFuIG1TdGF0dXMgPSBmYWxzZTsKKyAgICAgIHByaXZhdGUgaW50IG1Db21tYW5kOworCisgICAgICBAT3ZlcnJpZGUKKyAgICAgIHByb3RlY3RlZCB2b2lkIGVudGVyKCkgeworICAgICAgICAgIGxvZygiRW50ZXJpbmcgSW5jb21pbmdIaWQgc3RhdGUgd2l0aDogIiArIGdldEN1cnJlbnRNZXNzYWdlKCkud2hhdCk7CisgICAgICAgICAgbUNvbW1hbmQgPSBnZXRDdXJyZW50TWVzc2FnZSgpLndoYXQ7CisgICAgICAgICAgaWYgKG1Db21tYW5kICE9IENPTk5FQ1RfSElEX0lOQ09NSU5HICYmCisgICAgICAgICAgICAgIG1Db21tYW5kICE9IERJU0NPTk5FQ1RfSElEX0lOQ09NSU5HKSB7CisgICAgICAgICAgICAgIExvZy5lKFRBRywgIkVycm9yOiBJbmNvbWluZ0hpZCBzdGF0ZSB3aXRoIGNvbW1hbmQ6IiArIG1Db21tYW5kKTsKKyAgICAgICAgICB9CisgICAgICAgICAgbVN0YXR1cyA9IHByb2Nlc3NDb21tYW5kKG1Db21tYW5kKTsKKyAgICAgICAgICBpZiAoIW1TdGF0dXMpIHNlbmRNZXNzYWdlKFRSQU5TSVRJT05fVE9fU1RBQkxFKTsKKyAgICAgIH0KKworICAgICAgQE92ZXJyaWRlCisgICAgICBwcm90ZWN0ZWQgYm9vbGVhbiBwcm9jZXNzTWVzc2FnZShNZXNzYWdlIG1lc3NhZ2UpIHsKKyAgICAgICAgICBsb2coIkluY29taW5nSGlkIFN0YXRlLT5Qcm9jZXNzaW5nIE1lc3NhZ2U6ICIgKyBtZXNzYWdlLndoYXQpOworICAgICAgICAgIE1lc3NhZ2UgZGVmZXJNc2cgPSBuZXcgTWVzc2FnZSgpOworICAgICAgICAgIHN3aXRjaChtZXNzYWdlLndoYXQpIHsKKyAgICAgICAgICAgICAgY2FzZSBDT05ORUNUX0hGUF9PVVRHT0lORzoKKyAgICAgICAgICAgICAgY2FzZSBDT05ORUNUX0hGUF9JTkNPTUlORzoKKyAgICAgICAgICAgICAgY2FzZSBESVNDT05ORUNUX0hGUF9PVVRHT0lORzoKKyAgICAgICAgICAgICAgY2FzZSBDT05ORUNUX0EyRFBfSU5DT01JTkc6CisgICAgICAgICAgICAgIGNhc2UgQ09OTkVDVF9BMkRQX09VVEdPSU5HOgorICAgICAgICAgICAgICBjYXNlIERJU0NPTk5FQ1RfQTJEUF9PVVRHT0lORzoKKyAgICAgICAgICAgICAgY2FzZSBDT05ORUNUX0hJRF9PVVRHT0lORzoKKyAgICAgICAgICAgICAgY2FzZSBDT05ORUNUX0hJRF9JTkNPTUlORzoKKyAgICAgICAgICAgICAgY2FzZSBESVNDT05ORUNUX0hJRF9PVVRHT0lORzoKKyAgICAgICAgICAgICAgICAgIGRlZmVyTWVzc2FnZShtZXNzYWdlKTsKKyAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICBjYXNlIERJU0NPTk5FQ1RfSEZQX0lOQ09NSU5HOgorICAgICAgICAgICAgICAgICAgLy8gU2hvdWxkbid0IGhhcHBlbiBidXQgaWYgZG9lcywgd2UgY2FuIGhhbmRsZSBpdC4KKyAgICAgICAgICAgICAgICAgIC8vIERlcGVuZHMgaWYgdGhlIGhlYWRzZXQgY2FuIGhhbmRsZSBpdC4KKyAgICAgICAgICAgICAgICAgIC8vIEluY29taW5nIEhJRCB3aWxsIGJlIGhhbmRsZWQgYnkgQmx1ZXosIERpc2Nvbm5lY3QgSEZQCisgICAgICAgICAgICAgICAgICAvLyB0aGUgc29ja2V0IHdvdWxkIGhhdmUgYWxyZWFkeSBiZWVuIGNsb3NlZC4KKyAgICAgICAgICAgICAgICAgIC8vIGlnbm9yZQorICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgIGNhc2UgRElTQ09OTkVDVF9ISURfSU5DT01JTkc6CisgICAgICAgICAgICAgIGNhc2UgRElTQ09OTkVDVF9BMkRQX0lOQ09NSU5HOgorICAgICAgICAgICAgICAgICAgLy8gSWdub3JlLCB3aWxsIGJlIGhhbmRsZWQgYnkgQmx1ZXoKKyAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICBjYXNlIFVOUEFJUjoKKyAgICAgICAgICAgICAgY2FzZSBBVVRPX0NPTk5FQ1RfUFJPRklMRVM6CisgICAgICAgICAgICAgICAgICBkZWZlck1lc3NhZ2UobWVzc2FnZSk7CisgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgY2FzZSBUUkFOU0lUSU9OX1RPX1NUQUJMRToKKyAgICAgICAgICAgICAgICAgIHRyYW5zaXRpb25UbyhtQm9uZGVkRGV2aWNlKTsKKyAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgICAgcmV0dXJuIE5PVF9IQU5ETEVEOworICAgICAgICAgIH0KKyAgICAgICAgICByZXR1cm4gSEFORExFRDsKKyAgICAgIH0KKyAgfQorCiAKICAgICBzeW5jaHJvbml6ZWQgdm9pZCBjYW5jZWxDb21tYW5kKGludCBjb21tYW5kKSB7CiAgICAgICAgIGlmIChjb21tYW5kID09IENPTk5FQ1RfSEZQX09VVEdPSU5HICkgewpAQCAtNjE5LDYgKzg0NCwxMCBAQAogICAgICAgICAgICAgY2FzZSBDT05ORUNUX0EyRFBfSU5DT01JTkc6CiAgICAgICAgICAgICAgICAgLy8gaWdub3JlLCBCbHVleiB0YWtlcyBjYXJlCiAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICBjYXNlIENPTk5FQ1RfSElEX09VVEdPSU5HOgorICAgICAgICAgICAgICAgIHJldHVybiBtU2VydmljZS5jb25uZWN0SW5wdXREZXZpY2VJbnRlcm5hbChtRGV2aWNlKTsKKyAgICAgICAgICAgIGNhc2UgQ09OTkVDVF9ISURfSU5DT01JTkc6CisgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgICBjYXNlIERJU0NPTk5FQ1RfSEZQX09VVEdPSU5HOgogICAgICAgICAgICAgICAgIGlmICghbUhlYWRzZXRTZXJ2aWNlQ29ubmVjdGVkKSB7CiAgICAgICAgICAgICAgICAgICAgIGRlZmVySGVhZHNldE1lc3NhZ2UoY29tbWFuZCk7CkBAIC02NDUsNiArODc0LDE1IEBACiAgICAgICAgICAgICAgICAgICAgIHJldHVybiBtQTJkcFNlcnZpY2UuZGlzY29ubmVjdFNpbmtJbnRlcm5hbChtRGV2aWNlKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIERJU0NPTk5FQ1RfSElEX0lOQ09NSU5HOgorICAgICAgICAgICAgICAgIC8vIGlnbm9yZQorICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgY2FzZSBESVNDT05ORUNUX0hJRF9PVVRHT0lORzoKKyAgICAgICAgICAgICAgICBpZiAobVNlcnZpY2UuZ2V0SW5wdXREZXZpY2VQcmlvcml0eShtRGV2aWNlKSA9PQorICAgICAgICAgICAgICAgICAgICBCbHVldG9vdGhJbnB1dERldmljZS5QUklPUklUWV9BVVRPX0NPTk5FQ1QpIHsKKyAgICAgICAgICAgICAgICAgICAgbVNlcnZpY2Uuc2V0SW5wdXREZXZpY2VQcmlvcml0eShtRGV2aWNlLCBCbHVldG9vdGhJbnB1dERldmljZS5QUklPUklUWV9PTik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHJldHVybiBtU2VydmljZS5kaXNjb25uZWN0SW5wdXREZXZpY2VJbnRlcm5hbChtRGV2aWNlKTsKICAgICAgICAgICAgIGNhc2UgVU5QQUlSOgogICAgICAgICAgICAgICAgIHJldHVybiBtU2VydmljZS5yZW1vdmVCb25kSW50ZXJuYWwobURldmljZS5nZXRBZGRyZXNzKCkpOwogICAgICAgICAgICAgZGVmYXVsdDoKQEAgLTY1Myw2ICs4OTEsNyBAQAogICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgfQogCisKICAgICAvKnBhY2thZ2UqLyBCbHVldG9vdGhEZXZpY2UgZ2V0RGV2aWNlKCkgewogICAgICAgICByZXR1cm4gbURldmljZTsKICAgICB9CmRpZmYgLS1naXQgYS9jb3JlL2phdmEvYW5kcm9pZC9ibHVldG9vdGgvQmx1ZXRvb3RoSGVhZHNldC5qYXZhIGIvY29yZS9qYXZhL2FuZHJvaWQvYmx1ZXRvb3RoL0JsdWV0b290aEhlYWRzZXQuamF2YQppbmRleCA1M2Q2YTM3Li5iZTIxZDQ2IDEwMDY0NAotLS0gYS9jb3JlL2phdmEvYW5kcm9pZC9ibHVldG9vdGgvQmx1ZXRvb3RoSGVhZHNldC5qYXZhCisrKyBiL2NvcmUvamF2YS9hbmRyb2lkL2JsdWV0b290aC9CbHVldG9vdGhIZWFkc2V0LmphdmEKQEAgLTkwLDYgKzkwLDcgQEAKICAgICAgKiB7QGxpbmsgI0VYVFJBX1ZFTkRPUl9TUEVDSUZJQ19IRUFEU0VUX0VWRU5UX0NNRH0sIGFuZAogICAgICAqIHtAbGluayAjRVhUUkFfVkVORE9SX1NQRUNJRklDX0hFQURTRVRfRVZFTlRfQVJHU30uCiAgICAgICogPHA+UmVxdWlyZXMge0BsaW5rIGFuZHJvaWQuTWFuaWZlc3QucGV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5HRUQgPQorICAgICAgICAiYW5kcm9pZC5ibHVldG9vdGguaW5wdXRkZXZpY2UuYWN0aW9uLklOUFVUX0RFVklDRV9TVEFURV9DSEFOR0VEIjsKKworICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IFNUQVRFX0RJU0NPTk5FQ1RFRCA9IDA7CisgICAgcHVibGljIHN0YXRpYyBmaW5hbCBpbnQgU1RBVEVfQ09OTkVDVElORyAgID0gMTsKKyAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBTVEFURV9DT05ORUNURUQgICAgPSAyOworICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IFNUQVRFX0RJU0NPTk5FQ1RJTkcgPSAzOworCisgICAgLyoqCisgICAgICogQXV0byBjb25uZWN0aW9uLCBpbmNvbWluZyBhbmQgb3V0Z29pbmcgY29ubmVjdGlvbiBhcmUgYWxsb3dlZCBhdCB0aGlzCisgICAgICogcHJpb3JpdHkgbGV2ZWwuCisgICAgICovCisgICAgcHVibGljIHN0YXRpYyBmaW5hbCBpbnQgUFJJT1JJVFlfQVVUT19DT05ORUNUID0gMTAwMDsKKyAgICAvKioKKyAgICAgKiBJbmNvbWluZyBhbmQgb3V0Z29pbmcgY29ubmVjdGlvbiBhcmUgYWxsb3dlZCBhdCB0aGlzIHByaW9yaXR5IGxldmVsCisgICAgICovCisgICAgcHVibGljIHN0YXRpYyBmaW5hbCBpbnQgUFJJT1JJVFlfT04gPSAxMDA7CisgICAgLyoqCisgICAgICogQ29ubmVjdGlvbnMgdG8gdGhlIGRldmljZSBhcmUgbm90IGFsbG93ZWQgYXQgdGhpcyBwcmlvcml0eSBsZXZlbC4KKyAgICAgKi8KKyAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBQUklPUklUWV9PRkYgPSAwOworICAgIC8qKgorICAgICAqIERlZmF1bHQgcHJpb3JpdHkgbGV2ZWwgd2hlbiB0aGUgZGV2aWNlIGlzIHVucGFpcmVkLgorICAgICAqLworICAgIHB1Ym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DsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKiBJbml0aWF0ZSBhIGNvbm5lY3Rpb24gdG8gYW4gSW5wdXQgZGV2aWNlLgorICAgICAqCisgICAgICogIFRoaXMgZnVuY3Rpb24gcmV0dXJucyBmYWxzZSBvbiBlcnJvciBhbmQgdHJ1ZSBpZiB0aGUgY29ubmVjdGlvbgorICAgICAqICBhdHRlbXB0IGlzIGJlaW5nIG1hZGUuCisgICAgICoKKyAgICAgKiAgTGlzdGVuIGZvciBJTlBVVF9ERVZJQ0VfU1RBVEVfQ0hBTkdFRF9BQ1RJT04gdG8gZmluZCBvdXQgd2hlbiB0aGUKKyAgICAgKiAgY29ubmVjdGlvbiBpcyBjb21wbGV0ZWQuCisgICAgICogIEBwYXJhbSBkZXZpY2UgUmVtb3RlIEJUIGRldmljZS4KKyAgICAgKiAgQHJldHVybiBmYWxzZSBvbiBpbW1lZGlhdGUgZXJyb3IsIHRydWUgb3RoZXJ3aXNlCisgICAgICogIEBoaWRlCisgICAgICovCisgICAgcHVibGljIGJvb2xlYW4gY29ubmVjdElucHV0RGV2aWNlKEJsdWV0b290aERldmljZSBkZXZpY2UpIHsKKyAgICAgICAgaWYgKERCRykgbG9nKCJjb25uZWN0SW5wdXREZXZpY2UoIiArIGRldmljZSArICIpIik7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICByZXR1cm4gbVNlcnZpY2UuY29ubmVjdElucHV0RGV2aWNlKGRldmljZSk7CisgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICBMb2cuZShUQUcsICIiLCBlKTsKKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKiBJbml0aWF0ZSBkaXNjb25uZWN0IGZyb20gYW4gSW5wdXQgRGV2aWNlLgorICAgICAqICBUaGlzIGZ1bmN0aW9uIHJldHVybiBmYWxzZSBvbiBlcnJvciBhbmQgdHJ1ZSBpZiB0aGUgZGlzY29ubmVjdGlvbgorICAgICAqICBhdHRlbXB0IGlzIGJlaW5nIG1hZGUuCisgICAgICoKKyAgICAgKiAgTGlzdGVuIGZvciBJTlBVVF9ERVZJQ0VfU1RBVEVfQ0hBTkdFRF9BQ1RJT04gdG8gZmluZCBvdXQgd2hlbgorICAgICAqICBkaXNjb25uZWN0IGlzIGNvbXBsZXRlZC4KKyAgICAgKgorICAgICAqICBAcGFyYW0gZGV2aWNlIFJlbW90ZSBCVCBkZXZpY2UuCisgICAgICogIEByZXR1cm4gZmFsc2Ugb24gaW1tZWRpYXRlIGVycm9yLCB0cnVlIG90aGVyd2lzZQorICAgICAqICBAaGlkZQorICAgICAqLworICAgIHB1YmxpYyBib29sZWFuIGRpc2Nvbm5lY3RJbnB1dERldmljZShCbHVldG9vdGhEZXZpY2UgZGV2aWNlKSB7CisgICAgICAgIGlmIChEQkcpIGxvZygiZGlzY29ubmVjdElucHV0RGV2aWNlKCIgKyBkZXZpY2UgKyAiKSIpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgcmV0dXJuIG1TZXJ2aWNlLmRpc2Nvbm5lY3RJbnB1dERldmljZShkZXZpY2UpOworICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgTG9nLmUoVEFHLCAiIiwgZSk7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKiogQ2hlY2sgaWYgYSBzcGVjaWZpZWQgSW5wdXREZXZpY2UgaXMgY29ubmVjdGVkLgorICAgICAqCisgICAgICogIEBwYXJhbSBkZXZpY2UgUmVtb3RlIEJUIGRldmljZS4KKyAgICAgKiAgQHJldHVybiBUcnVlIGlmIGNvbm5lY3RlZCAsIGZhbHNlIG90aGVyd2lzZSBhbmQgb24gZXJyb3IuCisgICAgICogIEBoaWRlCisgICAgICovCisgICAgcHVibGljIGJvb2xlYW4gaXNJbnB1dERldmljZUNvbm5lY3RlZChCbHVldG9vdGhEZXZpY2UgZGV2aWNlKSB7CisgICAgICAgIGlmIChEQkcpIGxvZygiaXNJbnB1dERldmljZUNvbm5lY3RlZCgiICsgZGV2aWNlICsgIikiKTsKKyAgICAgICAgaW50IHN0YXRlID0gZ2V0SW5wdXREZXZpY2VTdGF0ZShkZXZpY2UpOworICAgICAgICBpZiAoc3RhdGUgPT0gU1RBVEVfQ09OTkVDVEVEKSByZXR1cm4gdHJ1ZTsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIC8qKiBDaGVjayBpZiBhbnkgSW5wdXQgRGV2aWNlIGlzIGNvbm5lY3RlZC4KKyAgICAgKgorICAgICAqIEByZXR1cm4gYSB1bm1vZGlmaWFibGUgc2V0IG9mIGNvbm5lY3RlZCBJbnB1dCBEZXZpY2VzLCBvciBudWxsIG9uIGVycm9yLgorICAgICAqIEBoaWRlCisgICAgICovCisgICAgcHVibGljIFNldDxCbHVldG9vdGhEZXZpY2U+IGdldENvbm5lY3RlZElucHV0RGV2aWNlcygpIHsKKyAgICAgICAgaWYgKERCRykgbG9nKCJnZXRDb25uZWN0ZWRJbnB1dERldmljZXMoKSIpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgcmV0dXJuIENvbGxlY3Rpb25zLnVubW9kaWZpYWJsZVNldCgKKyAgICAgICAgICAgICAgICAgICAgbmV3IEhhc2hTZXQ8Qmx1ZXRvb3RoRGV2aWNlPigKKyAgICAgICAgICAgICAgICAgICAgICAgIEFycmF5cy5hc0xpc3QobVNlcnZpY2UuZ2V0Q29ubmVjdGVkSW5wdXREZXZpY2VzKCkpKSk7CisgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICBMb2cuZShUQUcsICIiLCBlKTsKKyAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqIEdldCB0aGUgc3RhdGUgb2YgYW4gSW5wdXQgRGV2aWNlLgorICAgICAqCisgICAgICogIEBwYXJhbSBkZXZpY2UgUmVtb3RlIEJUIGRldmljZS4KKyAgICAgKiAgQHJldHVybiBUaGUgY3VycmVudCBzdGF0ZSBvZiB0aGUgSW5wdXQgRGV2aWNlCisgICAgICogIEBoaWRlCisgICAgICovCisgICAgcHVibGljIGludCBnZXRJbnB1dERldmljZVN0YXRlKEJsdWV0b290aERldmljZSBkZXZpY2UpIHsKKyAgICAgICAgaWYgKERCRykgbG9nKCJnZXRJbnB1dERldmljZVN0YXRlKCIgKyBkZXZpY2UgKyAiKSIpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgcmV0dXJuIG1TZXJ2aWNlLmdldElucHV0RGV2aWNlU3RhdGUoZGV2aWNlKTsKKyAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIExvZy5lKFRBRywgIiIsIGUpOworICAgICAgICAgICAgcmV0dXJuIFNUQVRFX0RJU0NPTk5FQ1RFRDsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIFNldCBwcmlvcml0eSBvZiBhbiBpbnB1dCBkZXZpY2UuCisgICAgICoKKyAgICAgKiBQcmlvcml0eSBpcyBhIG5vbi1uZWdhdGl2ZSBpbnRlZ2VyLiBQcmlvcml0eSBjYW4gdGFrZSB0aGUgZm9sbG93aW5nCisgICAgICogdmFsdWVzOgorICAgICAqIHtAbGluayBQUklPUklUWV9PTn0sIHtAbGluayBQUklPUklUWV9PRkZ9LCB7QGxpbmsgUFJJT1JJVFlfQVVUT19DT05ORUNUfQorICAgICAqCisgICAgICogQHBhcmFtIGRldmljZSBQYWlyZWQgZGV2aWNlLgorICAgICAqIEBwYXJhbSBwcmlvcml0eSBJbnRlZ2VyIHByaW9yaXR5CisgICAgICogQHJldHVybiB0cnVlIGlmIHByaW9yaXR5IGlzIHNldCwgZmFsc2Ugb24gZXJyb3IKKyAgICAgKi8KKyAgICBwdWJsaWMgYm9vbGVhbiBzZXRJbnB1dERldmljZVByaW9yaXR5KEJsdWV0b290aERldmljZSBkZXZpY2UsIGludCBwcmlvcml0eSkgeworICAgICAgICBpZiAoREJHKSBsb2coInNldElucHV0RGV2aWNlUHJpb3JpdHkoIiArIGRldmljZSArICIsICIgKyBwcmlvcml0eSArICIpIik7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICByZXR1cm4gbVNlcnZpY2Uuc2V0SW5wdXREZXZpY2VQcmlvcml0eShkZXZpY2UsIHByaW9yaXR5KTsKKyAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIExvZy5lKFRBRywgIiIsIGUpOworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogR2V0IHRoZSBwcmlvcml0eSBhc3NvY2lhdGVkIHdpdGggYW4gSW5wdXQgRGV2aWNlLgorICAgICAqCisgICAgICogQHBhcmFtIGRldmljZSBJbnB1dCBEZXZpY2UKKyAgICAgKiBAcmV0dXJuIG5vbi1uZWdhdGl2ZSBwcmlvcml0eSwgb3IgbmVnYXRpdmUgZXJyb3IgY29kZSBvbiBlcnJvci4KKyAgICAgKi8KKyAgICBwdWJsaWMgaW50IGdldElucHV0RGV2aWNlUHJpb3JpdHkoQmx1ZXRvb3RoRGV2aWNlIGRldmljZSkgeworICAgICAgICBpZiAoREJHKSBsb2coImdldElucHV0RGV2aWNlUHJpb3JpdHkoIiArIGRldmljZSArICIpIik7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICByZXR1cm4gbVNlcnZpY2UuZ2V0SW5wdXREZXZpY2VQcmlvcml0eShkZXZpY2UpOworICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgTG9nLmUoVEFHLCAiIiwgZSk7CisgICAgICAgICAgICByZXR1cm4gUFJJT1JJVFlfT0ZGOworICAgICAgICB9CisgICAgfQorCisgICAgcH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AgICAgICBtU2VydmljZSA9IG51bGw7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBJbml0aWF0ZSBhIFBBTiBjb25uZWN0aW9uLgorICAgICAqCisgICAgICogVGhpcyBmdW5jdGlvbiByZXR1cm5zIGZhbHNlIG9uIGVycm9yIGFuZCB0cnVlIGlmIHRoZSBjb25uZWN0aW9uCisgICAgICogYXR0ZW1wdCBpcyBiZWluZyBtYWRlLgorICAgICAqCisgICAgICogTGlzdGVuIGZvciB7QGxpbmsgI0FDVElPTl9QQU5fU1RBVEVfQ0hBTkdFRH0gdG8gZmluZCBvdXQgd2hlbiB0aGUKKyAgICAgKiBjb25uZWN0aW9uIGlzIGNvbXBsZXRlZC4KKyAgICAgKgorICAgICAqIEBwYXJhbSBkZXZpY2UgUmVtb3RlIEJUIGRldmljZS4KKyAgICAgKiBAcmV0dXJuIGZhbHNlIG9uIGltbWVkaWF0ZSBlcnJvciwgdHJ1ZSBvdGhlcndpc2UKKyAgICAgKiBAaGlkZQorICAgICAqLworICAgIHB1YmxpYyBib29sZWFuIGNvbm5lY3QoQmx1ZXRvb3RoRGV2aWNlIGRldmljZSkgeworICAgICAgICBpZiAoREJHKSBsb2coImNvbm5lY3QoIiArIGRldmljZSArICIpIik7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICByZXR1cm4gbVNlcnZpY2UuY29ubmVjdFBhbkRldmljZShkZXZpY2UpOworICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgTG9nLmUoVEFHLCAiIiwgZSk7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBJbml0aWF0ZSBkaXNjb25uZWN0IGZyb20gUEFOLgorICAgICAqCisgICAgICogVGhpcyBmdW5jdGlvbiByZXR1cm4gZmFsc2Ugb24gZXJyb3IgYW5kIHRydWUgaWYgdGhlIGRpc2Nvbm5lY3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FBhbkRldmljZVN0YXRlKEJsdWV0b290aERldmljZSBkZXZpY2UpIHsKKyAgICAgICBpZiAoREJHKSBsb2coImdldFBhbkRldmljZVN0YXRlKCIgKyBkZXZpY2UgKyAiKSIpOworICAgICAgIHRyeSB7CisgICAgICAgICAgIHJldHVybiBtU2VydmljZS5nZXRQYW5EZXZpY2VTdGF0ZShkZXZpY2UpOworICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgIExvZy5lKFRBRywgIiIsIGUpOworICAgICAgICAgICByZXR1cm4gU1RBVEVfRElTQ09OTkVDVEVEOworICAgICAgIH0KKyAgIH0KKworICAgLyoqIFJldHVybnMgYSBzZXQgb2YgYWxsIHRoZSBjb25uZWN0ZWQgUEFOIERldmljZXMKKyAgICoKKyAgICogRG9lcyBub3QgaW5jbHVkZSBkZXZpY2VzIHRoYXQgYXJlIGN1cnJlbnRseSBjb25uZWN0aW5nIG9yIGRpc2Nvbm5lY3RpbmcKKyAgICoKKyAgICogQHJldHVybiBhIHVubW9kaWZpYWJsZSBzZXQgb2YgY29ubmVjdGVkIFBBTiBEZXZpY2VzLCBvciBudWxsIG9uIGVycm9yLgorICAgKiBAaGlkZQorICAgKi8KKyAgIHB1YmxpYyBTZXQ8Qmx1ZXRvb3RoRGV2aWNlPiBnZXRDb25uZWN0ZWREZXZpY2VzKCkgeworICAgICAgaWYgKERCRykgbG9nKCJnZXRDb25uZWN0ZWREZXZpY2VzIik7CisgICAgICB0cnkgeworICAgICAgICAgIHJldHVybiBDb2xsZWN0aW9ucy51bm1vZGlmaWFibGVTZXQoCisgICAgICAgICAgICAgICAgICBuZXcgSGFzaFNldDxCbHVldG9vdGhEZXZpY2U+KAorICAgICAgICAgICAgICAgICAgICAgIEFycmF5cy5hc0xpc3QobVNlcnZpY2UuZ2V0Q29ubmVjdGVkUGFuRGV2aWNlcygpKSkpOworICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICBMb2cuZShUQUcsICIiLCBlKTsKKyAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgIH0KKyAgIH0KKworICAgIHByaXZhdGUgc3RhdGljIHZvaWQgbG9nKFN0cmluZyBtc2cpIHsKKyAgICAgICAgTG9nLmQoVEFHLCBtc2cpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHNldEJsdWV0b290aFRldGhlcmluZyhib29sZWFuIHZhbHVlKSB7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBtU2VydmljZS5zZXRCbHVldG9vdGhUZXRoZXJpbmcodmFsdWUpOworICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgTG9nLmUoVEFHLCAiIiwgZSk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgYm9vbGVhbiBpc1RldGhlcmluZ09uKCkgeworICAgICAgICB0cnkgeworICAgICAgICAgICAgcmV0dXJuIG1TZXJ2aWNlLmlzVGV0aGVyaW5nT24oKTsKKyAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIExvZy5lKFRBRywgIiIsIGUpOworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgfQorfQpkaWZmIC0tZ2l0IGEvY29yZS9qYXZhL2FuZHJvaWQvYmx1ZXRvb3RoL0JsdWV0b290aFByb2ZpbGVTdGF0ZS5qYXZhIGIvY29yZS9qYXZhL2FuZHJvaWQvYmx1ZXRvb3RoL0JsdWV0b290aFByb2ZpbGVTdGF0ZS5qYXZhCmluZGV4IDk0NmRjYWEuLmFkNzBkMGQgMTAwNjQ0Ci0tLSBhL2NvcmUvamF2YS9hbmRyb2lkL2JsdWV0b290aC9CbHVldG9vdGhQcm9maWxlU3RhdGUuamF2YQorKysgYi9jb3JlL2phdmEvYW5kcm9pZC9ibHVldG9vdGgvQmx1ZXRvb3RoUHJvZ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bGV0ZWQgbm9ybWFsbHksIG9yCisgICAgICogICAgICAgICBiZWNhdXNlIHtAbGluayAjc3RhcnRMb2FkaW5nKCl9IGhhc24ndCBiZWVuIGNhbGxlZCwgYW5kCisgICAgICogICAgICAgICA8dHQ+dHJ1ZTwvdHQ+IG90aGVyd2lzZQorICAgICAqLworICAgIHB1YmxpYyBib29sZWFuIGNhbmNlbExvYWQoKSB7CisgICAgICAgIGlmIChtVGFzayAhPSBudWxsKSB7CisgICAgICAgICAgICBib29sZWFuIGNhbmNlbGxlZCA9IG1UYXNrLmNhbmNlbChmYWxzZSk7CisgICAgICAgICAgICBtVGFzayA9IG51bGw7CisgICAgICAgICAgICByZXR1cm4gY2FuY2VsbGVkOworICAgICAgICB9CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBDYWxsZWQgaWYgdGhlIHRhc2sgd2FzIGNhbmNlbGVkIGJlZm9yZSBpdCB3YXMgY29tcGxldGVkLiAgR2l2ZXMgdGhlIGNsYXNzIGEgY2hhbmNlCisgICAgICogdG8gcHJvcGVybHkgZGlzcG9zZSBvZiB0aGUgcmVzdWx0LgorICAgICAqLworICAgIHB1YmxpYyB2b2lkIG9uQ2FuY2VsbGVkKEQgZGF0YSkgeworICAgIH0KKworICAgIHZvaWQgZGlzcGF0Y2hPbkxvYWRDb21wbGV0ZShEIGRhdGEpIHsKKyAgICAgICAgbVRhc2sgPSBudWxsOworICAgICAgICBkZWxpdmVyUmVzdWx0KGRhdGEpOworICAgIH0KKworICAgIC8qKgorICAgICAqIENhbGxlZCBvbiBhIHdvcmtlciB0aHJlYWQgdG8gcGVyZm9ybSB0aGUgYWN0dWFsIGxvYWQuIEltcGxlbWVudGF0aW9ucyBzaG91bGQgbm90IGRlbGl2ZXIgdGhlCisgICAgICogcmVzdWx0cyBkaXJlY3RseSwgYnV0IHNob3VsZCByZXR1cm4gdGhlbSBmcm9tIHRoaXMgbWV0aG9kLCB3aGljaCB3aWxs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bmNlIHRleHQpIHsKKyAgICAgICAgICAgIG1UZXh0ID0gdGV4dDsKKyAgICAgICAgICAgIG1JbnRlbnQgPSBudWxsOworICAgICAgICAgICAgbVVyaSA9IG51bGw7CisgICAgICAgIH0KKworICAgICAgICAvKioKKyAgICAgICAgICogQ3JlYXRlIGFuIEl0ZW0gY29uc2lzdGluZyBvZiBhbiBhcmJpdHJhcnkgSW50ZW50LgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIEl0ZW0oSW50ZW50IGludGVudCkgeworICAgICAgICAgICAgbVRleHQgPSBudWxsOworICAgICAgICAgICAgbUludGVudCA9IGludGVudDsKKyAgICAgICAgICAgIG1VcmkgPSBudWxsOworICAgICAgICB9CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIENyZWF0ZSBhbiBJdGVtIGNvbnNpc3Rpbmcgb2YgYW4gYXJiaXRyYXJ5IFVSSS4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBJdGVtKFVyaSB1cmkpIHsKKyAgICAgICAgICAgIG1UZXh0ID0gbnVsbDsKKyAgICAgICAgICAgIG1JbnRlbnQgPSBudWxsOworICAgICAgICAgICAgbVVyaSA9IHVyaTsKKyAgICAgICAgfQorCisgICAgICAgIC8qKgorICAgICAgICAgKiBDcmVhdGUgYSBjb21wbGV4IEl0ZW0sIGNvbnRhaW5pbmcgbXVsdGlwbGUgcmVwcmVzZW50YXRpb25zIG9mCisgICAgICAgICAqIHRleHQsIGludGVudCwgYW5kL29yIFVSSS4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBJdGVtKENoYXJTZXF1ZW5jZSB0ZXh0LCBJbnRlbnQgaW50ZW50LCBVcmkgdXJpKSB7CisgICAgICAgICAgICBtVGV4dCA9IHRleHQ7CisgICAgICAgICAgICBtSW50ZW50ID0gaW50ZW50OworICAgICAgICAgICAgbVVyaSA9IHVyaTsKKyAgICAgICAgfQorCisgICAgICAgIC8qKgorICAgICAgICAgKiBSZXRyaWV2ZSB0aGUgcmF3IHRleHQgY29udGFpbmVkIGluIHRoaXMgSXRlbS4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBDaGFyU2VxdWVuY2UgZ2V0VGV4dCgpIHsKKyAgICAgICAgICAgIHJldHVybiBtVGV4dDsKKyAgICAgICAgfQorCisgICAgICAgIC8qKgorICAgICAgICAgKiBSZXRyaWV2ZSB0aGUgcmF3IEludGVudCBjb250YWluZWQgaW4gdGhpcyBJdGVtLgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIEludGVudCBnZXRJbnRlbnQoKSB7CisgICAgICAgICAgICByZXR1cm4gbUludGVudDsKKyAgICAgICAgfQorCisgICAgICAgIC8qKgorICAgICAgICAgKiBSZXRyaWV2ZSB0aGUgcmF3IFVSSSBjb250YWluZWQgaW4gdGhpcyBJdGVtLgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIFVyaSBnZXRVcmkoKSB7CisgICAgICAgICAgICByZXR1cm4gbVVyaTsKKyAgICAgICAgfQorCisgICAgICAgIC8qKgorICAgICAgICAgKiBUdXJuIHRoaXMgaXRlbSBpbnRvIHRleHQsIHJlZ2FyZGxlc3Mgb2YgdGhlIHR5cGUgb2YgZGF0YSBpdAorICAgICAgICAgKiBhY3R1YWxseSBjb250YWlucy4KKyAgICAgICAgICoKKyAgICAgICAgICogPHA+VGhlIGFsZ29yaXRobSBmb3IgZGVjaWRpbmcgd2hhdCB0ZXh0IHRvIHJldHVybiBpczoKKyAgICAgICAgICogPHVsPgorICAgICAgICAgKiA8bGk+IElmIHtAbGluayAjZ2V0VGV4dH0gaXMgbm9uLW51bGwsIHJldHVybiB0aGF0LgorICAgICAgICAgKiA8bGk+IElmIHtAbGluayAjZ2V0VXJpfSBpcyBub24tbnVsbCwgdHJ5IHRvIHJldHJpZXZlIGl0cyBkYXRhCisgICAgICAgICAqIGFzIGEgdGV4dCBzdHJlYW0gZnJvbSBpdHMgY29udGVudCBwcm92aWRlci4gIElmIHRoaXMgc3VjY2VlZHMsIGNvcHkKKyAgICAgICAgICogdGhlIHRleHQgaW50byBhIFN0cmluZyBhbmQgcmV0dXJuIGl0LiAgSWYgaXQgaXMgbm90IGEgY29udGVudDogVVJJIG9yCisgICAgICAgICAqIHRoZSBjb250ZW50IHByb3ZpZGVyIGRvZXMgbm90IHN1cHBseSBhIHRleHQgcmVwcmVzZW50YXRpb24sIHJldHVybgorICAgICAgICAgKiB0aGUgcmF3IFVSSSBhcyBhIHN0cmluZy4KKyAgICAgICAgICogPGxpPiBJZiB7QGxpbmsgI2dldEludGVudH0gaXMgbm9uLW51bGwsIGNvbnZlcnQgdGhhdCB0byBhbiBpbnRlbnQ6CisgICAgICAgICAqIFVSSSBhbmQgcmV0dXJuaXQuCisgICAgICAgICAqIDxsaT4gT3RoZXJ3aXNlLCByZXR1cm4gYW4gZW1wdHkgc3RyaW5nLgorICAgICAgICAgKiA8L3VsPgorICAgICAgICAgKgorICAgICAgICAgKiBAcGFyYW0gY29udGV4dCBUaGUgY2FsbGVyJ3MgQ29udGV4dCwgZnJvbSB3aGljaCBpdHMgQ29udGVudFJlc29sdmVyCisgICAgICAgICAqIGFuZCBvdGhlciB0aGluZ3MgY2FuIGJlIHJldHJpZXZlZC4KKyAgICAgICAgICogQHJldHVybiBSZXR1cm5zIHRoZSBpdGVtJ3MgdGV4dHVhbCByZXByZXNlbnRhdGlvbi4KKyAgICAgICAgICovCisvL0JFR0lOX0lOQ0xVREUoY29lcmNlVG9UZXh0KQorICAgICAgICBwdWJsaWMgQ2hhclNlcXVlbmNlIGNvZXJjZVRvVGV4dChDb250ZXh0IGNvbnRleHQpIHsKKyAgICAgICAgICAgIC8vIElmIHRoaXMgSXRlbSBoYXMgYW4gZXhwbGljaXQgdGV4dHVhbCB2YWx1ZSwgc2ltcGx5IHJldHVybiB0aGF0LgorICAgICAgICAgICAgaWYgKG1UZXh0ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gbVRleHQ7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIElmIHRoaXMgSXRlbSBoYXMgYSBVUkkgdmFsdWUsIHRyeSB1c2luZyB0aGF0LgorICAgICAgICAgICAgaWYgKG1VcmkgIT0gbnVsbCkgeworCisgICAgICAgICAgICAgICAgLy8gRmlyc3Qgc2VlIGlmIHRoZSBVUkkgY2FuIGJlIG9wZW5lZCBhcyBhIHBsYWluIHRleHQgc3RyZWFtCisgICAgICAgICAgICAgICAgLy8gKG9mIGFueSBzdWItdHlwZSkuICBJZiBzbywgdGhpcyBpcyB0aGUgYmVzdCB0ZXh0dWFsCisgICAgICAgICAgICAgICAgLy8gcmVwcmVzZW50YXRpb24gZm9yIGl0LgorICAgICAgICAgICAgICAgIEZpbGVJbnB1dFN0cmVhbSBzdHJlYW0gPSBudWxsOworICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgIC8vIEFzayBmb3IgYSBzdHJlYW0gb2YgdGhlIGRlc2lyZWQgdHlwZS4KKyAgICAgICAgICAgICAgICAgICAgQXNzZXRGaWxlRGVzY3JpcHRvciBkZXNjciA9IGNvbnRleHQuZ2V0Q29udGVudFJlc29sdmVyKCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAub3BlblR5cGVkQXNzZXRGaWxlRGVzY3JpcHRvcihtVXJpLCAidGV4dC8qIiwgbnVsbCk7CisgICAgICAgICAgICAgICAgICAgIHN0cmVhbSA9IGRlc2NyLmNyZWF0ZUlucHV0U3RyZWFtKCk7CisgICAgICAgICAgICAgICAgICAgIElucHV0U3RyZWFtUmVhZGVyIHJlYWRlciA9IG5ldyBJbnB1dFN0cmVhbVJlYWRlcihzdHJlYW0sICJVVEYtOCIpOworCisgICAgICAgICAgICAgICAgICAgIC8vIEdvdCBpdC4uLiAgY29weSB0aGUgc3RyZWFtIGludG8gYSBsb2NhbCBzdHJpbmcgYW5kIHJldHVybiBpdC4KKyAgICAgICAgICAgICAgICAgICAgU3RyaW5nQnVpbGRlciBidWlsZGVyID0gbmV3IFN0cmluZ0J1aWxkZXIoMTI4KTsKKyAgICAgICAgICAgICAgICAgICAgY2hhcltdIGJ1ZmZlciA9IG5ldyBjaGFyWzgxOTJdOworICAgICAgICAgICAgICAgICAgICBpbnQgbGVuOworICAgICAgICAgICAgICAgICAgICB3aGlsZSAoKGxlbj1yZWFkZXIucmVhZChidWZmZXIpKSA+IDApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kKGJ1ZmZlciwgMCwgbGVuKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICByZXR1cm4gYnVpbGRlci50b1N0cmluZygpOworCisgICAgICAgICAgICAgICAgfSBjYXRjaCAoRmlsZU5vdEZvdW5kRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gVW5hYmxlIHRvIG9wZW4gY29udGVudCBVUkkgYXMgdGV4dC4uLiAgbm90IHJlYWxseSBhbgorICAgICAgICAgICAgICAgICAgICAvLyBlcnJvciwganVzdCBzb21ldGhpbmcgdG8gaWdub3JlLgorCisgICAgICAgICAgICAgICAgfSBjYXRjaCAoSU9FeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICAvLyBTb21ldGhpbmcgYmFkIGhhcyBoYXBwZW5lZC4KKyAgICAgICAgICAgICAgICAgICAgTG9nLncoIkNsaXBwZWREYXRhIiwgIkZhaWx1cmUgbG9hZGluZyB0ZXh0IiwgZSk7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBlLnRvU3RyaW5nKCk7CisKKyAgICAgICAgICAgICAgICB9IGZpbmFsbHkgeworICAgICAgICAgICAgICAgICAgICBpZiAoc3RyZWFtICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyZWFtLmNsb3NlKCk7CisgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChJT0V4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAvLyBJZiB3ZSBjb3VsZG4ndCBvcGVuIHRoZSBVUkkgYXMgYSBzdHJlYW0sIHRoZW4gdGhlIFVSSSBpdHNlbGYKKyAgICAgICAgICAgICAgICAvLyBwcm9iYWJseSBzZXJ2ZXMgZmFpcmx5IHdlbGwgYXMgYSB0ZXh0dWFsIHJlcHJlc2VudGF0aW9uLgorICAgICAgICAgICAgICAgIHJldHVybiBtVXJpLnRvU3RyaW5nKCk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIEZpbmFsbHksIGlmIGFsbCB3ZSBoYXZlIGlzIGFuIEludGVudCwgdGhlbiB3ZSBjYW4ganVzdCB0dXJuIHRoYXQKKyAgICAgICAgICAgIC8vIGludG8gdGV4dC4gIE5vdCB0aGUgbW9zdCB1c2VyLWZyaWVuZGx5IHRoaW5nLCBidXQgaXQncyBzb21ldGhpbmcuCisgICAgICAgICAgICBpZiAobUludGVudCAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIG1JbnRlbnQudG9VcmkoSW50ZW50LlVSSV9JTlRFTlRfU0NIRU1FKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLy8gU2hvdWxkbid0IGdldCBoZXJlLCBidXQganVzdCBpbiBjYXNlLi4uCisgICAgICAgICAgICByZXR1cm4gIiI7CisgICAgICAgIH0KKy8vRU5EX0lOQ0xVREUoY29lcmNlVG9UZXh0KQorICAgIH0KKworICAgIC8qKgorICAgICAqIENyZWF0ZSBhIG5ldyBjbGlwLgorICAgICAqCisgICAgICogQHBhcmFtIGxhYmVsIExhYmVsIHRvIHNob3cgdG8gdGhlIHVzZXIgZGVzY3JpYmluZyB0aGlzIGNsaXAuCisgICAgICogQHBhcmFtIG1pbWVUeXBlcyBBbiBhcnJheSBvZiBNSU1FIHR5cGVzIHRoa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0VHlwZSh1cmkpOworICAgICAgICAgICAgbWltZVR5cGVzID0gcmVzb2x2ZXIuZ2V0U3RyZWFtVHlwZXModXJpLCAiKi8qIik7CisgICAgICAgICAgICBpZiAobWltZVR5cGVzID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICBpZiAocmVhbFR5cGUgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBtaW1lVHlwZXMgPSBuZXcgU3RyaW5nW10geyByZWFsVHlwZSwgTUlNRVRZUEVfVEVYVF9VUklMSVNUIH07CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBTdHJpbmdbXSB0bXAgPSBuZXcgU3RyaW5nW21pbWVUeXBlcy5sZW5ndGggKyAocmVhbFR5cGUgIT0gbnVsbCA/IDIgOiAxKV07CisgICAgICAgICAgICAgICAgaW50IGkgPSAwOworICAgICAgICAgICAgICAgIGlmIChyZWFsVHlwZSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIHRtcFswXSA9IHJlYWxUeXBlOworICAgICAgICAgICAgICAgICAgICBpKys7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIFN5c3RlbS5hcnJheWNvcHkobWltZVR5cGVzLCAwLCB0bXAsIGksIG1pbWVUeXBlcy5sZW5ndGgpOworICAgICAgICAgICAgICAgIHRtcFtpICsgbWltZVR5cGVzLmxlbmd0aF0gPSBNSU1FVFlQRV9URVhUX1VSSUxJU1Q7CisgICAgICAgICAgICAgICAgbWltZVR5cGVzID0gdG1wOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGlmIChtaW1lVHlwZXMgPT0gbnVsbCkgeworICAgICAgICAgICAgbWltZVR5cGVzID0gTUlNRVRZUEVTX1RFWFRfVVJJTElTVDsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbmV3IENsaXBEYXRhKGxhYmVsLCBtaW1lVHlwZXMsIGljb24sIGl0ZW0pOworICAgIH0KKworICA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iAoaXRlbSA9PSBudWxsKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgTnVsbFBvaW50ZXJFeGNlcHRpb24oIml0ZW0gaXMgbnVsbCIpOworICAgICAgICB9CisgICAgICAgIG1JdGVtcy5hZGQoaXRlbSk7CisgICAgfQorCisgICAgcHVibGljIEJpdG1hcCBnZXRJY29uKCkgeworICAgICAgICByZXR1cm4gbUljb247CisgICAgfQorCisgICAgcHVibGljIGludCBnZXRJdGVtQ291bnQoKSB7CisgICAgICAgIHJldHVybiBtSXRlbXMuc2l6ZSgpOworICAgIH0KKworICAgIHB1YmxpYyBJdGVtIGdldEl0ZW0oaW50IGluZGV4KSB7CisgICAgICAgIHJldHVybiBtSXRlbXMuZ2V0KGluZGV4KTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgaW50IGRlc2NyaWJlQ29udGVudHMoKSB7CisgICAgICAgIHJldHVybiAwOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIHdyaXRlVG9QYXJjZWwoUGFyY2VsIGRlc3QsIGludCBmbGFncykgeworICAgICAgICBzdXBlci53cml0ZVRvUGFyY2VsKGRlc3QsIGZsYWdzKTsKKyAgICAgICAgaWYgKG1JY29uICE9IG51bGwpIHsKKyAgICAgICAgICAgIGRlc3Qud3JpdGVJbnQoMSk7CisgICAgICAgICAgICBtSWNvbi53cml0ZVRvUGFyY2VsKGRlc3QsIGZsYWdzKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGRlc3Qud3JpdGVJbnQoMCk7CisgICAgICAgIH0KKyAgICAgICAgZmluYWwgaW50IE4gPSBtSXRlbXMuc2l6ZSgpOworICAgICAgICBkZXN0LndyaXRlSW50KE4pOworICAgICAgICBmb3IgKGludCBpPTA7IGk8TjsgaSsrKSB7CisgICAgICAgICAgICBJdGVtIGl0ZW0gPSBtSXRlbXMuZ2V0KGkpOworICAgICAgICAgICAgVGV4dFV0aWxzLndyaXRlVG9QYXJjZWwoaXRlbS5tVGV4dCwgZGVzdCwgZmxhZ3MpOworICAgICAgICAgICAgaWYgKGl0ZW0ubUludGVudCAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgZGVzdC53cml0ZUludCgxKTsKKyAgICAgICAgICAgICAgICBpdGVtLm1JbnRlbnQud3JpdGVUb1BhcmNlbChkZXN0LCBmbGFncyk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGRlc3Qud3JpdGVJbnQoMCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoaXRlbS5tVXJpICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBkZXN0LndyaXRlSW50KDEpOworICAgICAgICAgICAgICAgIGl0ZW0ubVVyaS53cml0ZVRvUGFyY2VsKGRlc3QsIGZsYWdzKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgZGVzdC53cml0ZUludCgwKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIENsaXBEYXRhKFBhcmNlbCBpbikgeworICAgICAgICBzdXBlcihpbik7CisgICAgICAgIGlmIChpbi5yZWFkSW50KCkgIT0gMCkgeworICAgICAgICAgICAgbUljb24gPSBCaXRtYXAuQ1JFQVRPUi5jcmVhdGVGcm9tUGFyY2VsKGluKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIG1JY29uID0gbnVsbDsKKyAgICAgICAgfQorICAgICAgICBmaW5hbCBpbnQgTiA9IGluLnJlYWRJbnQoKTsKKyAgICAgICAgZm9yIChpbnQgaT0wOyBpPE47IGkrKykgeworICAgICAgICAgICAgQ2hhclNlcXVlbmNlIHRleHQgPSBUZXh0VXRpbHMuQ0hBUl9TRVFVRU5DRV9DUkVBVE9SLmNyZWF0ZUZyb21QYXJjZWwoaW4pOworICAgICAgICAgICAgSW50ZW50IGludGVudCA9IGluLnJlYWRJbnQoKSAhPSAwID8gSW50ZW50LkNSRUFUT1IuY3JlYXRlRnJvbVBhcmNlbChpbikgOiBudWxsOworICAgICAgICAgICAgVXJpIHVyaSA9IGluLnJlYWRJbnQoKSAhPSAwID8gVXJpLkNSRUFUT1IuY3JlYXRlRnJvbVBhcmNlbChpbikgOiBudWxsOworICAgICAgICAgICAgbUl0ZW1zLmFkZChuZXcgSXRlbSh0ZXh0LCBpbnRlbnQsIHVyaSkpOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHN0YXRpYyBmaW5hbCBQYXJjZWxhYmxlLkNyZWF0b3I8Q2xpcERhdGE+IENSRUFUT1IgPQorICAgICAgICBuZXcgUGFyY2VsYWJsZS5DcmVhdG9yPENsaXBEYXRhPigpIHsKKworICAgICAgICAgICAgcHVibGljIENsaXBEYXRhIGNyZWF0ZUZyb21QYXJjZWwoUGFyY2VsIHNvdXJjZSkgeworICAgICAgICAgICAgICAgIHJldHVybiBuZXcgQ2xpcERhdGEoc291cmNlKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcHVibGljIENsaXBEYXRhW10gbmV3QXJyYXkoaW50IHNpemUpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gbmV3IENsaXBEYXRhW3NpemVdOworICAgICAgICAgICAgfQorICAgICAgICB9OworfQpkaWZmIC0tZ2l0IGEvY29yZS9qYXZhL2FuZHJvaWQvY29udGVudC9DbGlwRGVzY3JpcHRpb24uYWlkbCBiL2NvcmUvamF2YS9hbmRyb2lkL2NvbnRlbnQvQ2xpcERlc2NyaXB0aW9uLmFpZGwKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uMzkxZmQ1YQotLS0gL2Rldi9udWxsCisrKyBiL2NvcmUvamF2YS9hbmRyb2lkL2NvbnRlbnQvQ2xpcERlc2NyaXB0aW9uLmFpZGwKQEAgLTAsMCArMSwxOSBAQAorLyoqCisgKiBDb3B5cmlnaHQgKGMpIDIwMTAsIFRoZSBBbmRyb2lkIE9wZW4gU291cmNlIFByb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XR1cm4gdHJ1ZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGVsc2UgaWYgKGRlc2lyZWRUeXBlLmVxdWFscyhjb25jcmV0ZVR5cGUpKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgLyoqCisgICAgICogUmV0dXJuIHRoZSBsYWJlbCBmb3IgdGhpcyBjbGlwLgorICAgICAqLworICAgIHB1YmxpYyBDaGFyU2VxdWVuY2UgZ2V0TGFiZWwoKSB7CisgICAgICAgIHJldHVybiBtTGFiZWw7CisgICAgfQorCisgICAgLyoqCisgICAgICogQ2hlY2sgd2hldGhlciB0aGUgY2xpcCBkZXNjcmlwdGlvbiBjb250YWlucyB0aGUgZ2l2ZW4gTUlNRSB0eXBlLgorICAgICAqCisgICAgICogQHBhcmFtIG1pbWVUeXBlIFRoZSBkZXNpcmVkIE1JTUUgdHlwZS4gIE1heSBiZSBhIHBhdHRlcm4uCisgICAgICogQHJldHVybiBSZXR1cm5zIHRydWUgaWYgb25lIG9mIHRoZSBNSU1FIHR5cGVzIGluIHRoZSBjbGlwIGRlc2NyaXB0aW9uCisgICAgICogbWF0Y2hlcyB0aGUgZGVzaXJlZCBNSU1FIHR5cGUsIGVsc2UgZmFsc2UuCisgICAgICovCisgICAgcHVibGljIGJvb2xlYW4gaGFzTWltZVR5cGUoU3RyaW5nIG1pbWVUeXBlKSB7CisgICAgICAgIGZvciAoaW50IGk9MDsgaTxtTWltZVR5cGVzLmxlbmd0aDsgaSsrKSB7CisgICAgICAgICAgICBpZiAoY29tcGFyZU1pbWVUeXBlcyhtTWltZVR5cGVzW2ldLCBtaW1lVHlwZSkpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgIC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YXkgPSBuZXcgU3RyaW5nW2FycmF5LnNpemUoKV07CisgICAgICAgIGFycmF5LnRvQXJyYXkocmF3QXJyYXkpOworICAgICAgICByZXR1cm4gcmF3QXJyYXk7CisgICAgfQorCisgICAgLyoqCisgICAgICogUmV0dXJuIHRoZSBudW1iZXIgb2YgTUlNRSB0eXBlcyB0aGUgY2xpcCBpcyBhdmFpbGFibGUgaW4uCisgICAgICovCisgICAgcHVibGljIGludCBnZXRNaW1lVHlwZUNvdW50KCkgeworICAgICAgICByZXR1cm4gbU1pbWVUeXBlcy5sZW5ndGg7CisgICAgfQorCisgICAgLyoqCisgICAgICogUmV0dXJuIG9uZSBvZiB0aGUgcG9zc2libGUgY2xpcCBNSU1FIHR5cGVzLgorICAgICAqLworICAgIHB1YmxpYyBTdHJpbmcgZ2V0TWltZVR5cGUoaW50IGluZGV4KSB7CisgICAgICAgIHJldHVybiBtTWltZVR5cGVzW2luZGV4XTsKKyAgICB9CisKKyAgICAvKiogQGhpZGUgKi8KKyAgICBwdWJsaWMgdm9pZCB2YWxpZGF0ZSgpIHsKKyAgICAgICAgaWYgKG1NaW1lVHlwZXMgPT0gbnVsbCkgeworICAgICAgICAgICAgdGhyb3cgbmV3IE51bGxQb2ludGVyRXhjZXB0aW9uKCJudWxsIG1pbWUgdHlwZXMiKTsKKyAgICAgICAgfQorICAgICAgICBpZiAobU1pbWVUeXBlcy5sZW5ndGggPD0gMCkgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigibXVzdCBoYXZlIGF0IGxlYXN0IDEgbWltZSB0eXBlIik7CisgICAgICAgIH0KKyAgICAgICAgZm9yIChpbnQgaT0wOyBpPG1NaW1lVHlwZXMubGVuZ3RoOyBpKyspIHsKKyAgICAgICAgICAgIGlmIChtTWltZVR5cGVzW2ldID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgTnVsbFBvaW50ZXJFeGNlcHRpb24oIm1pbWUgdHlwZSBhdCAiICsgaSArICIgaXMgbnVsbCIpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIGludCBkZXNjcmliZUNvbnRlbnRzKCkgeworICAgICAgICByZXR1cm4gMDsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCB3cml0ZVRvUGFyY2VsKFBhcmNlbCBkZXN0LCBpbnQgZmxhZ3MpIHsKKyAgICAgICAgVGV4dFV0aWxzLndyaXRlVG9QYXJjZWwobUxhYmVsLCBkZXN0LCBmbGFncyk7CisgICAgICAgIGRlc3Qud3JpdGVTdHJpbmdBcnJheShtTWltZVR5cGVzKTsKKyAgICB9CisKKyAgICBDbGlwRGVzY3JpcHRpb24oUGFyY2VsIGluKSB7CisgICAgICAgIG1MYWJlbCA9IFRleHRVdGlscy5DSEFSX1NFUVVFTkNFX0NSRUFUT1IuY3JlYXRlRnJvbVBhcmNlbChpbik7CisgICAgICAgIG1NaW1lVHlwZXMgPSBpbi5jcmVhdGVTdHJpbmdBcnJheSgpOworICAgIH0KKworICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgUGFyY2VsYWJsZS5DcmVhdG9yPENsaXBEZXNjcmlwdGlvbj4gQ1JFQVRPUiA9CisgICAgICAgIG5ldyBQYXJjZWxhYmxlLkNyZWF0b3I8Q2xpcERlc2NyaXB0aW9uPigpIHsKKworICAgICAgICAgICAgcHVibGljIENsaXBEZXNjcmlwdGlvbiBjcmVhdGVGcm9tUGFyY2VsKFBhcmNlbCBzb3VyY2UpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gbmV3IENsaXBEZXNjcmlwdGlvbihzb3VyY2UpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBwdWJsaWMgQ2xpcERlc2NyaXB0aW9uW10gbmV3QXJyYXkoaW50IHNpemUpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gbmV3IENsaXBEZXNjcmlwd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gICAgc3RhdGljIGZpbmFsIGludCBNU0dfUkVQT1JUX1BSSU1BUllfQ0xJUF9DSEFOR0VEID0gMTsKKworICAgIHByaXZhdGUgZmluYWwgSGFuZGxlciBtSGFuZGxlciA9IG5ldyBIYW5kbGVyKCkgeworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgaGFuZGxlTWVzc2FnZShNZXNzYWdlIG1zZykgeworICAgICAgICAgICAgc3dpdGNoIChtc2cud2hhdCkgeworICAgICAgICAgICAgICAgIGNhc2UgTVNHX1JFUE9SVF9QUklNQVJZX0NMSVBfQ0hBTkdFRDoKKyAgICAgICAgICAgICAgICAgICAgcmVwb3J0UHJpbWFyeUNsaXBDaGFuZ2VkKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9OworCisgICAgcHVibGljIGludGVyZmFjZSBPblByaW1hcnlDbGlwQ2hhbmdlZExpc3RlbmVyIHsKKyAgICAgICAgdm9pZCBvblByaW1hcnlDbGlwQ2hhbmdlZCgpOworICAgIH0KKworICAgIHN0YXRpYyBwcml2YXRlIElDbGlwYm9hcmQgZ2V0U2VydmljZSgpIHsKKyAgICAgICAgc3luY2hyb25pemVkIChzU3RhdGljTG9jaykgeworICAgICAgICAgICAgaWYgKHNTZXJ2aWNlICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gc1NlcnZpY2U7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBJQmluZGVyIGIgPSBTZXJ2aWNlTWFuYWdlci5nZXRTZXJ2aWNlKCJjbGlwYm9hcmQiKTsKKyAgICAgICAgICAgIHNTZXJ2aWNlID0gSUNsaXBib2FyZC5TdHViLmFzSW50ZXJmYWNlKGIpOworICAgICAgICAgICAgcmV0dXJuIHNTZXJ2aWNlOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqIHtAaGlkZX0gKi8KKyAgICBwdWJsaWMgQ2xpcGJvYXJkTWFuYWdlcihDb250ZXh0IGNvbnRleHQsIEhhbmRsZXIgaGFuZGxlcikgeworICAgICAgICBtQ29udGV4dCA9IGNvbnRleHQ7CisgICAgfQorCisgICAgLyoqCisgICAgICogU2V0cyB0aGUgY3VycmVudCBwcmltYXJ5IGNsaXAgb24gdGhlIGNsaXBib2FyZC4gIFRoaXMgaXMgdGhlIGNsaXAgdGhhdAorICAgICAqIGlzIGludm9sdmVkIGluIG5vcm1hbCBjdXQgYW5kIHBhc3RlIG9wZXJhdGlvbnMuCisgICAgICoKKyAgICAgKiBAcGFyYW0gY2xpcCBUaGUgY2xpcHBlZCBkYXRhIGl0ZW0gdG8gc2V0LgorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNldFByaW1hcnlDbGlwKENsaXBEYXRhIGNsaXApIHsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIGdldFNlcnZpY2UoKS5zZXRQcmltYXJ5Q2xpcChjbGlwKTsKKyAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIFJldHVybnMgdGhlIGN1cnJlbnQgcHJpbWFyeSBjbGlwIG9uIHRoZSBjbGlwYm9hcmQuCisgICAgICovCisgICAgcHVibGljIENsaXBEYXRhIGdldFByaW1hcnlDbGlwKCkgeworICAgICAgICB0cnkgeworICAgICAgICAgICAgcmV0dXJuIGdldFNlcnZpY2UoKS5nZXRQcmltYXJ5Q2xpcCgpOworICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZXR1cm5zIGEgZGVzY3JpcHRpb24gb2YgdGhlIGN1cnJlbnQgcHJpbWFyeSBjbGlwIG9uIHRoZSBjbGlwYm9hcmQKKyAgICAgKiBidXQgbm90IGEgY29weSBvZiBpdHMgZGF0YS4KKyAgICAgKi8KKyAgICBwdWJsaWMgQ2xpcERlc2NyaXB0aW9uIGdldFByaW1hcnlDbGlwRGVzY3JpcHRpb24oKSB7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICByZXR1cm4gZ2V0U2VydmljZSgpLmdldFByaW1hcnlDbGlwRGVzY3JpcHRpb24oKTsKKyAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogUmV0dXJucyB0cnVlIGlmIHRoZXJlIGlzIGN1cnJlbnRseSBhIHByaW1hcnkgY2xpcCBvbiB0aGUgY2xpcGJvYXJkLgorICAgICAqLworICAgIHB1YmxpYyBib29sZWFuIGhhc1ByaW1hcnlDbGlwKCkgeworICAgICAgICB0cnkgeworICAgICAgICAgICAgcmV0dXJuIGdldFNlcnZpY2UoKS5oYXNQcmltYXJ5Q2xpcCgpOworICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgYWRkUHJpbWFyeUNsaXBDaGFuZ2VkTGlzdGVuZXIoT25QcmltYXJ5Q2xpcENoYW5nZWRMaXN0ZW5lciB3aGF0KSB7CisgICAgICAgIHN5bmNocm9uaXplZCAobVByaW1hcnlDbGlwQ2hhbmdlZExpc3RlbmVycykgeworICAgICAgICAgICAgaWYgKG1QcmltYXJ5Q2xpcENoYW5nZWRMaXN0ZW5lcnMuc2l6ZSgpID09IDApIHsKKyAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICBnZXRTZXJ2aWNlKCkuYWRkUHJpbWFyeUNsaXBDaGFuZ2VkTGlzdGVuZXIoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVByaW1hcnlDbGlwQ2hhbmdlZFNlcnZpY2VMaXN0ZW5lcik7CisgICAgICAgICAgICAgICAgfSBjY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MsIGFyZ3MpOworICAgICAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICAgICAgZmRzWzFdLmNsb3NlKCk7CisgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIExvZy53KFRBRywgIkZhaWx1cmUgY2xvc2luZyBwaXBlIiwgZSk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfTsKKyAgICAgICAgICAgIHRhc2suZXhlY3V0ZSgoT2JqZWN0W10pbnVsbCk7CisKKyAgICAgICAgICAgIHJldHVybiBmZHNbMF07CisgICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBGaWxlTm90Rm91bmRFeGNlcHRpb24oImZhaWx1cmUgbWFraW5nIHBpcGUiKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgogICAgICAqIFJldHVybnMgdHJ1ZSBpZiB0aGlzIGluc3RhbmNlIGlzIGEgdGVtcG9yYXJ5IGNvbnRlbnQgcHJvdmlkZXIuCiAgICAgICogQHJldHVybiB0cnVlIGlmIHRoaXMgaW5zdGFuY2UgaXMgYSB0ZW1wb3JhcnkgY29udGVudCBwcm92aWRlcgogICAgICAqLwpAQCAtNzc1LDYgKzkzMCwxMSBAQAogICAgICAqIEBwYXJhbSBpbmZvIFJlZ2lzdGVyZWQgaW5mb3JtYXRpb24gYWJvdXQgdGhpcyBjb250ZW50IHByb3ZpZGVyCiAgICAgICovCiAgICAgcHVibGljIHZvaWQgYXR0YWNoSW5mbyhDb250ZXh0IGNvbnRleHQsIFByb3ZpZGVySW5mbyBpbmZvKSB7CisgICAgICAgIC8qCisgICAgICAgICAqIFdlIG1heSBiZSB1c2luZyBBc3luY1Rhc2sgZnJvbSBiaW5kZX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AgICogCisgICAgICogPHA+CisgICAgICogQW5kcm9pZCBub3JtYWxseSBoYW5kbGVzIENvbnRlbnRQcm92aWRlciBzdGFydHVwIGFuZCBzaHV0ZG93bgorICAgICAqIGF1dG9tYXRpY2FsbHkuIFlvdSBkbyBub3QgbmVlZCB0byBzdGFydCB1cCBvciBzaHV0IGRvd24gYQorICAgICAqIENvbnRlbnRQcm92aWRlci4gV2hlbiB5b3UgaW52b2tlIGEgdGVzdCBtZXRob2Qgb24gYSBDb250ZW50UHJvdmlkZXIsCisgICAgICogaG93ZXZlciwgYSBDb250ZW50UHJvdmlkZXIgaW5zdGFuY2UgaXMgc3RhcnRlZCBhbmQga2VlcHMgcnVubmluZyBhZnRlcgorICAgICAqIHRoZSB0ZXN0IGZpbmlzaGVzLCBldmVuIGlmIGEgc3VjY2VlZGluZyB0ZXN0IGluc3RhbnRpYXRlcyBhbm90aGVyCisgICAgICogQ29udGVudFByb3ZpZGVyLiBBIGNvbmZsaWN0IGRldmVsb3BzIGJlY2F1c2UgdGhlIHR3byBpbnN0YW5jZXMgYXJlCisgICAgICogdXN1YWxseSBydW5uaW5nIGFnYWluc3QgdGhlIHNhbWUgdW5kZXJseWluZyBkYXRhIHNvdXJjZSAoZm9yIGV4YW1wbGUsIGFuCisgICAgICogc3FsaXRlIGRhdGFiYXNlKS4KKyAgICAgKiA8L3A+CisgICAgICogPHA+CisgICAgICogSW1wbGVtZW50aW5nIHNodXREb3duKCkgYXZvaWRzIHRoaXMgY29uZmxpY3QgYnkgcHJvdmlkaW5nIGEgd2F5IHRvCisgICAgICogdGVybWluYXRlIHRoZSBDb250ZW50UHJvdmlkZXIuIFRoaXMgbWV0aG9kIGNhbiBhbHNvIHByZXZlbnQgbWVtb3J5IGxlYWtzCisgICAgICogZnJvbSBtdWx0aXBsZSBpbnN0YW50aWF0aW9ucyBvZiB0aGUgQ29udGVudFByb3ZpZGVyLCBhbmQgaXQgY2FuIGVuc3VyZQorICAgICAqIHVuaXQgdGVzdCBpc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aW5kZXggZmRiM2QyMC4uZDFhYjhkNSAxMDA2NDQKLS0tIGEvY29yZS9qYXZhL2FuZHJvaWQvY29udGVudC9Db250ZW50UHJvdmlkZXJOYXRpdmUuamF2YQorKysgYi9jb3JlL2phdmEvYW5kcm9pZC9jb250ZW50L0NvbnRlbnRQcm92aWRlck5hdGl2ZS5qYXZhCkBAIC0yNTcsNiArMjU3LDM4IEBACiAgICAgICAgICAgICAgICAgICAgIHJlcGx5LndyaXRlQnVuZGxlKHJlc3BvbnNlQnVuZGxlKTsKICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgY2FzZSBHRVRfU1RSRUFNX1RZUEVTX1RSQU5TQUNUSU9OOgorICAgICAgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgICAgZGF0YS5lbmZvcmNlSW50ZXJmYWNlKElDb250ZW50UHJvdmlkZXIuZGVzY3JpcHRvcik7CisgICAgICAgICAgICAgICAgICAgIFVyaSB1cmwgPSBVcmkuQ1JFQVRPUi5jcmVhdGVGcm9tUGFyY2VsKGRhdGEpOworICAgICAgICAgICAgICAgICAgICBTdHJpbmcgbWltZVR5cGVGaWx0ZXIgPSBkYXRhLnJlYWRTdHJpbmcoKTsKKyAgICAgICAgICAgICAgICAgICAgU3RyaW5nW10gdHlwZXMgPSBnZXRTdHJlYW1UeXBlcyh1cmwsIG1pbWVUeXBlRmlsdGVyKTsKKyAgICAgICAgICAgICAgICAgICAgcmVwbHkud3JpdGVOb0V4Y2VwdGlvbigpOworICAgICAgICAgICAgICAgICAgICByZXBseS53cml0ZVN0cmluZ0FycmF5KHR5cGVzKTsKKworICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBjYXNlIE9QRU5fVFlQRURfQVNTRVRfRklMRV9UUkFOU0FDVElPTjoKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGRhdGEuZW5mb3JjZUludGVyZmFjZShJQ29udGVudFByb3ZpZGVyLmRlc2NyaXB0b3IpOworICAgICAgICAgICAgICAgICAgICBVcmkgdXJsID0gVXJpLkNSRUFUT1IuY3JlYXRlRnJvbVBhcmNlbChkYXRhKTsKKyAgICAgICAgICAgICAgICAgICAgU3RyaW5nIG1pbWVUeXBlID0gZGF0YS5yZWFkU3RyaW5nKCk7CisgICAgICAgICAgICAgICAgICAgIEJ1bmRsZSBvcHRzID0gZGF0YS5yZWFkQnVuZGxlKCk7CisKKyAgICAgICAgICAgICAgICAgICAgQXNzZXRGaWxlRGVzY3JpcHRvciBmZDsKKyAgICAgICAgICAgICAgICAgICAgZmQgPSBvcGVuVHlwZWRBc3NldEZpbGUodXJsLCBtaW1lVHlwZSwgb3B0cyk7CisgICAgICAgICAgICAgICAgICAgIHJlcGx5LndyaXRlTm9FeGNlcHRpb24oKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGZkICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJlcGx5LndyaXRlSW50KDEpOworICAgICAgICAgICAgICAgICAgICAgICAgZmQud3JpdGVUb1BhcmNlbChyZXBseSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUGFyY2VsYWJsZS5QQVJDRUxBQkxFX1dSSVRFX1JFVFVSTl9WQUxVRSk7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICByZXBseS53cml0ZUludCgwKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAgICAgICAgIH0gY2F0Y2ggKEV4Y2VwdGlvbiBlKSB7CiAgICAgICAgICAgICBEYXRhYmFzZVV0aWxzLndyaXRlRXhjZXB0aW9uVG9QYXJjZWwocmVwbHksIGUpOwpAQCAt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GVyLmdldFN0cmVhbVR5cGVzKHVybCwgbWltZVR5cGVGaWx0ZXIpOworICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgIH0gY2F0Y2ggKGphdmEubGFuZy5FeGNlcHRpb24gZSkgeworICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICByZWxlYXNlUHJvdmlkZXIocHJvdmlkZXIpOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCiAgICAgICogPHA+CiAgICAgICogUXVlcnkgdGhlIGdpdmVuIFVSSSwgcmV0dXJuaW5nIGEge0BsaW5rIEN1cnNvcn0gb3ZlciB0aGUgcmVzdWx0IHNldC4KICAgICAgKiA8L3A+CkBAIC0zNDksNyArMzgxLDcgQEAKICAgICB9CiAKICAgICAvKioKLSAgICAgKiBPcGVuIGEgcmF3IGZpbGUgZGVzY3JpcHRvciB0byBhY2Nlc3MgZGF0YSB1bmRlciBhICJjb250ZW50OiIgVVJJLiAgVGhpcworICAgICAqIE9wZW4gYSByYXcgZmlsZSBkZXNjcmlwdG9yIHRvIGFjY2VzcyBkYXRhIHVuZGVyIGEgVVJJLiAgVGhpcwogICAgICAqIGlzIGxpa2Uge0BsaW5rICNvcGVuQXNzZXRGaWxlRGVzY3JpcHRvcihVcmksIFN0cmluZyl9LCBidXQgdXNlcyB0aGUKICAgICAgKiB1bmRlcmx5aW5nIHtAbGluayBDb250ZW50UHJvdmlkZXIjb3BlbkZpbGV9CiAgICAgICogQ29udGVudFByb3ZpZGVyLm9wZW5GaWxlKCl9IG1ldGhvZCwgc28gd2lsbCA8ZW0+bm90PC9lbT4gd29yayB3aXRoCkBAIC0zOTksMTAgKzQzMSw5IEBACiAgICAgfQogCiAgICAgLyoqCi0gICAgICogT3BlbiBhIHJhdyBmaWxlIGRlc2NyaXB0b3IgdG8gYWNjZXNzIGRhdGEgdW5kZ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lcnNpb24gdGhhdCBhIHByb3ZpZGVyIGltcGxlbWVudHMuCisgICAgICoKICAgICAgKiBAcGFyYW0gdXJpIFRoZSBkZXNpcmVkIFVSSSB0byBvcGVuLgogICAgICAqIEBwYXJhbSBtb2RlIFRoZSBmaWxlIG1vZGUgdG8gdXNlLCBhcyBwZXIge0BsaW5rIENvbnRlbnRQcm92aWRlciNvcGVuQXNzZXRGaWxlCiAgICAgICogQ29udGVudFByb3ZpZGVyLm9wZW5Bc3NldEZpbGV9LgpAQCAtNDYwLDI5ICs0OTYsOTcgQEAKICAgICAgICAgICAgICAgICAgICAgbmV3IEZpbGUodXJpLmdldFBhdGgoKSksIG1vZGVUb01vZGUodXJpLCBtb2RlKSk7CiAgICAgICAgICAgICByZXR1cm4gbmV3IEFzc2V0RmlsZURlc2NyaXB0b3IocGZkLCAwLCAtMSk7CiAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICBJQ29udGVudFByb3ZpZGVyIHByb3ZpZGVyID0gYWNxdWlyZVByb3ZpZGVyKHVyaSk7Ci0gICAgICAgICAgICBpZiAocHJvdmlkZXIgPT0gbnVsbCkgewotICAgICAgICAgICAgICAgIHRocm93IG5ldyBGaWxlTm90Rm91bmRFeGNlcHRpb24oIk5vIGNvbnRlbnQgcHJvdmlkZXI6ICIgKyB1cmkpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgICBBc3NldEZpbGVEZXNjcmlwdG9yIGZkID0gcHJvdmlkZXIub3BlbkFzc2V0RmlsZSh1cmksIG1vZGUpOwotICAgICAgICAgICAgICAgIGlmKGZkID09IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgcmVsZWFzZVByb3ZpZGVyKHByb3ZpZGVyKTsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgICAgICBpZiAoInIiLmVxdWFscyhtb2RlKSkgeworICAgICAgICAgICAgICAgIHJldHVybiBvcGVuVHlwZWRBc3NldEZpbGVEZXNjcmlwdG9yKHVyaSwgIiovKiIsIG51bGwpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBJQ29udGVudFByb3ZpZGVyIHByb3ZpZGVyID0gYWNxdWlyZVByb3ZpZGVyKHVyaSk7CisgICAgICAgICAgICAgICAgaWYgKHByb3ZpZGVyID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEZpbGVOb3RGb3VuZEV4Y2VwdGlvbigiTm8gY29udGVudCBwcm92aWRlcjogIiArIHVyaSk7CiAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIFBhcmNlbEZpbGVEZXNjcmlwdG9yIHBmZCA9IG5ldyBQYXJjZWxGaWxlRGVzY3JpcHRvcklubmVyKAotICAgICAgICAgICAgICAgICAgICAgICAgZmQuZ2V0UGFyY2VsRmlsZURlc2NyaXB0b3IoKSwgcHJvdmlkZXIpOwotICAgICAgICAgICAgICAgIHJldHVybiBuZXcgQXNzZXRGaWxlRGVzY3JpcHRvcihwZmQsIGZkLmdldFN0YXJ0T2Zmc2V0KCksCi0gICAgICAgICAgICAgICAgICAgICAgICBmZC5nZXREZWNsYXJlZExlbmd0aCgpKTsKLSAgICAgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAgICAgQXNzZXRGaWxlRGVzY3JpcHRvciBmZCA9IHByb3ZpZGVyLm9wZW5Bc3NldEZpbGUodXJpLCBtb2RlKTsKKyAgICAgICAgICAgICAgICAgICAgaWYoZmQgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgcmVsZWFzZVByb3ZpZGVyKHByb3ZpZGVyKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIFBhcmNlbEZpbGVEZXNjcmlwdG9yIHBmZCA9IG5ldyBQYXJjZWxGaWxlRGVzY3JpcHRvcklubmVyKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZkLmdldFBhcmNlbEZpbGVEZXNjcmlwdG9yKCksIHByb3ZpZGVyKTsKKworICAgICAgICAgICAgICAgICAgICAvLyBTdWNjZXNzISAgRG9uJ3QgcmVsZWFzZSB0aGUgcHJvdmlkZXIgd2hlbiBleGl0aW5nLCBsZXQKKyAgICAgICAgICAgICAgICAgICAgLy8gUGFyY2VsRmlsZURlc2NyaXB0b3JJbm5lciBkbyB0aGF0IHdoZW4gaXQgaXMgY2xvc2VkLgorICAgICAgICAgICAgICAgICAgICBwcm92aWRlciA9IG51bGw7CisKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBBc3NldEZpbGVEZXNjcmlwdG9yKHBmZCwgZmQuZ2V0U3RhcnRPZmZzZXQoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBmZC5nZXREZWNsYXJlZExlbmd0aCgpKTsKKyAgICAgICAgICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRmlsZU5vdEZvdW5kRXhjZXB0aW9uKCJEZWFkIGNvbnRlbnQgcHJvdmlkZXI6ICIgKyB1cmkpOworICAgICAgICAgICAgICAgIH0gY2F0Y2ggKEZpbGVOb3RGb3VuZEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgICAgIHRocm93IGU7CisgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKHByb3ZpZGVyICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJlbGVhc2VQcm92aWRlcihwcm92aWRlcik7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICAv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JpLAorICAgICAgICAgICAgU3RyaW5nIG1pbWVUeXBlLCBCdW5kbGUgb3B0cykgdGhyb3dzIEZpbGVOb3RGb3VuZEV4Y2VwdGlvbiB7CisgICAgICAgIElDb250ZW50UHJvdmlkZXIgcHJvdmlkZXIgPSBhY3F1aXJlUHJvdmlkZXIodXJpKTsKKyAgICAgICAgaWYgKHByb3ZpZGVyID09IG51bGwpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBGaWxlTm90Rm91bmRFeGNlcHRpb24oIk5vIGNvbnRlbnQgcHJvdmlkZXI6ICIgKyB1cmkpOworICAgICAgICB9CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBBc3NldEZpbGVEZXNjcmlwdG9yIGZkID0gcHJvdmlkZXIub3BlblR5cGVkQXNzZXRGaWxlKHVyaSwgbWltZVR5cGUsIG9wdHMpOworICAgICAgICAgICAgaWYgKGZkID09IG51bGwpIHsKICAgICAgICAgICAgICAgICByZWxlYXNlUHJvdmlkZXIocHJvdmlkZXIpOwotICAgICAgICAgICAgICAgIHRocm93IG5ldyBGaWxlTm90Rm91bmRFeGNlcHRpb24oIkRlYWQgY29udGVudCBwcm92aWRlcjogIiArIHVyaSk7Ci0gICAgICAgICAgICB9IGNhdGNoIChGaWxlTm90Rm91bmRFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICAgICAgfQorICAgICAgICAgICAgUGFyY2VsRmlsZURlc2NyaXB0b3IgcGZkID0gbmV3IFBhcmNlbEZpbGVEZXNjcmlwdG9ySW5uZXIoCisgICAgICAgICAgICAgICAgICAgIGZkLmdldFBhcmNlbEZpbGVEZXNjcmlwdG9yKCksIHByb3ZpZGVyKTsKKworICAgICAgICAgICAgLy8gU3VjY2VzcyEgIERvbid0IHJlbGVhc2UgdGhlIHByb3ZpZGVyIHdoZW4gZXhpdGluZywgbGV0CisgICAgICAgICAgICAvLyBQYXJjZWxGaWxlRGVzY3JpcHRvcklubmVyIGRvIHRoYXQgd2hlbiBpdCBpcyBjbG9zZWQuCisgICAgICAgICAgICBwcm92aWRlciA9IG51bGw7CisKKyAgICAgICAgICAgIHJldHVybiBuZXcgQXNzZXRGaWxlRGVzY3JpcHRvcihwZmQsIGZkLmdldFN0YXJ0T2Zmc2V0KCksCisgICAgICAgICAgICAgICAgICAgIGZkLmdldERlY2xhcmVkTGVuZ3RoKCkpOworICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgdGhyb3cgbmV3IEZpbGVOb3RGb3VuZEV4Y2VwdGlvbigiRGVhZCBjb250ZW50IHByb3ZpZGVyOiAiICsgdXJpKTsKKyAgICAgICAgfSBjYXRjaCAoRmlsZU5vdEZvdW5kRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIHRocm93IGU7CisgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICBpZiAocHJvdmlkZXIgIT0gbnVsbCkgewogICAgICAgICAgICAgICAgIHJlbGVhc2VQcm92aWRlcihwcm92aWRlcik7Ci0gICAgICAgICAgICAgICAgdGhyb3cgZTsKLSAgICAgICAgICAgIH0gY2F0Y2ggKFJ1bnRpbWVFeGNlcHRpb24gZSkgewotICAgICAgICAgICAgICAgIHJlbGVhc2VQcm92aWRlcihwcm92aWRlcik7Ci0gICAgICAgICAgICAgICAgdGhyb3cgZTsKICAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgIH0KQEAgLTEzNDIsNyArMTQ0Niw3IEBACiAgICAgfQogCiAgICAgcHJpdmF0ZSBmaW5hbCBjbGFzcyBDdXJzb3JXcmFwcGVySW5uZXIgZXh0ZW5kcyBDdXJzb3JXcmFwcGVyIHsKLSAgICAgICAgcHJpdmF0ZSBJQ29udGVudFByb3ZpZGVyIG1Db250ZW50UHJvdmlkZXI7CisgICAgICAgIHByaXZhdGUgZmluYWwgSUNvbnRlbnRQcm92aWRlciBtQ29udGVudFByb3ZpZGVyOwogICAgICAgICBwdWJsaWMgc3R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7CisgICAgVXJpIG1Vcmk7CisgICAgU3RyaW5nW10gbVByb2plY3Rpb247CisgICAgU3RyaW5nIG1TZWxlY3Rpb247CisgICAgU3RyaW5nW10gbVNlbGVjdGlvbkFyZ3M7CisgICAgU3RyaW5nIG1Tb3J0T3JkZXI7CisKKyAgICAvKiBSdW5zIG9uIGEgd29ya2VyIHRocmVhZCAqLworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyBDdXJzb3IgbG9hZEluQmFja2dyb3VuZCgpIHsKKyAgICAgICAgQ3Vyc29yIGN1cnNvciA9IGdldENvbnRleHQoKS5nZXRDb250ZW50UmVzb2x2ZXIoKS5xdWVyeShtVXJpLCBtUHJvamVjdGlvbiwgbVNlbGVjdGlvbiwKKyAgICAgICAgICAgICAgICBtU2VsZWN0aW9uQXJncywgbVNvcnRPcmRlcik7CisgICAgICAgIC8vIEVuc3VyZSB0aGUgY3Vyc29yIHdpbmRvdyBpcyBmaWxsZWQKKyAgICAgICAgaWYgKGN1cnNvciAhPSBudWxsKSB7CisgICAgICAgICAgICBjdXJzb3IuZ2V0Q291bnQoKTsKKyAgICAgICAgICAgIGN1cnNvci5yZWdpc3RlckNvbnRlbnRPYnNlcnZlcihtT2JzZXJ2ZXIpOworICAgICAgICB9CisgICAgICAgIHJldHVybiBjdXJzb3I7CisgICAgfQorCisgICAgLyogUnVucyBvbiB0aGUgVUkgdGhyZWFkICovCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgZGVsaXZlclJlc3VsdChDdXJzb3IgY3Vyc29yKSB7CisgICAgICAgIGlmIChtU3RvcHBlZCkgeworICAgICAgICAgICAgLy8gQW4gYXN5bmMgcXVlcnkgY2FtZSBpbiB3aGlsZSB0aGUgbG9hZGVyIGlzIHN0b3BwZWQKKyAgICAgICAgICAgIGlmIChjdXJzb3IgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGN1cnNvci5jbG9zZSgpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJu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nNvciAhPSBudWxsICYmICFjdXJzb3IuaXNDbG9zZWQoKSkgeworICAgICAgICAgICAgY3Vyc29yLmNsb3NlKCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCBkZXN0cm95KCkgeworICAgICAgICAvLyBFbnN1cmUgdGhlIGxvYWRlciBpcyBzdG9wcGVkCisgICAgICAgIHN0b3BMb2FkaW5nKCk7CisgICAgfQorCisgICAgcHVibGljIFVyaSBnZXRVcmkoKSB7CisgICAgICAgIHJldHVybiBtVXJpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHNldFVyaShVcmkgdXJpKSB7CisgICAgICAgIG1VcmkgPSB1cmk7CisgICAgfQorCisgICAgcHVibGljIFN0cmluZ1tdIGdldFByb2plY3Rpb24oKSB7CisgICAgICAgIHJldHVybiBtUHJvamVjdGlvbjsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBzZXRQcm9qZWN0aW9uKFN0cmluZ1tdIHByb2plY3Rpb24pIHsKKyAgICAgICAgbVByb2plY3Rpb24gPSBwcm9qZWN0aW9uOworICAgIH0KKworICAgIHB1YmxpYyBTdHJpbmcgZ2V0U2VsZWN0aW9uKCkgeworICAgICAgICByZXR1cm4gbVNlbGVjdGlvbjsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBzZXRTZWxlY3Rpb24oU3RyaW5nIHNlbGVjdGlvbikgeworICAgICAgICBtU2VsZWN0aW9uID0gc2VsZWN0aW9uOworICAgIH0KKworICAgIHB1YmxpYyBTdHJpbmdbXSBnZXRTZWxlY3Rpb25BcmdzKCkgeworICAgICAgICByZXR1cm4gbVNlbGVjdGlvbkFyZ3M7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc2V0U2VsZWN0aW9uQXJncyhTdHJpbmdbXSBzZWxlY3Rpb25BcmdzKSB7CisgICAgICAgIG1TZWxlY3Rpb25BcmdzID0gc2VsZWN0aW9uQXJnczsKKyAgICB9C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WJzdHJhY3QgY2xhc3MgTG9hZGVyPEQ+IHsKKyAgICBpbnQgbUlkOworICAgIE9uTG9hZENvbXBsZXRlTGlzdGVuZXI8RD4gbUxpc3RlbmVyOworICAgIENvbnRleHQgbUNvbnRleHQ7CisKKyAgICBwdWJsaWMgZmluYWwgY2xhc3MgRm9yY2VMb2FkQ29udGVudE9ic2VydmVyIGV4dGVuZHMgQ29udGVudE9ic2VydmVyIHsKKyAgICAgICAgcHVibGljIEZvcmNlTG9hZENvbnRlbnRPYnNlcnZlcigpIHsKKyAgICAgICAgICAgIHN1cGVyKG5ldyBIYW5kbGVyKCkpOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBib29sZWFuIGRlbGl2ZXJTZWxmTm90aWZpY2F0aW9ucygpIHsKKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIG9uQ2hhbmdlKGJvb2xlYW4gc2VsZkNoYW5nZSkgeworICAgICAgICAgICAgb25Db250ZW50Q2hhbmdlZCgpOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIGludGVyZmFjZSBPbkxvYWRDb21wbGV0ZUxpc3RlbmVyPEQ+IHsKKyAgICAgICAgLyoqCisgICAgICAgICAqIENhbGxlZCBvbiB0aGUgdGhyZWFkIHRoYXQgY3JlYXRlZCB0aGUgTG9hZGVyIHdoZW4gdGhlIGxvYWQgaXMgY29tcGxldGUuCisgICAgICAgICAqCisgICAgICAgICAqIEBwYXJhbSBsb2FkZXIgdGhlIGxvYWRlciB0aGF0IGNvbXBsZXRlZCB0aGUgbG9hZAorICAgICAgICAgKiBAcGFyYW0gZGF0YSB0aGUgcmVzdWx0IG9mIHRoZSBsb2FkCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgdm9pZCBvbkxvYWRDb21wbGV0ZShMb2FkZXI8RD4gbG9hZGVyLCBEIGRhdG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lIFVJIHRocmVhZAorICAgICAqLworICAgIHB1YmxpYyBhYnN0cmFjdCB2b2lkIHN0YXJ0TG9hZGluZygpOworCisgICAgLyoqCisgICAgICogRm9yY2UgYW4gYXN5bmNocm9ub3VzIGxvYWQuIFVubGlrZSB7QGxpbmsgI3N0YXJ0TG9hZGluZygpfSB0aGlzIHdpbGwgaWdub3JlIGEgcHJldmlvdXNseQorICAgICAqIGxvYWRlZCBkYXRhIHNldCBhbmQgbG9hZCBhIG5ldyBvbmUuCisgICAgICovCisgICAgcHVibGljIGFic3RyYWN0IHZvaWQgZm9yY2VMb2FkKCk7CisKKyAgICAvKioKKyAgICAgKiBTdG9wcyBkZWxpdmVyeSBvZiB1cGRhdGVzIHVudGlsIHRoZSBuZXh0IHRpbWUge0BsaW5rICNzdGFydExvYWRpbmcoKX0gaXMgY2FsbGVkCisgICAgICoKKyAgICAgKiBNdXN0IGJlIGNhbGxlZCBmcm9tIHRoZSBVSSB0aHJlYWQKKyAgICAgKi8KKyAgICBwdWJsaWMgYWJzdHJhY3Qgdm9pZCBzdG9wTG9hZGluZygpOworCisgICAgLyoqCisgICAgICogRGVzdHJveXMgdGhlIGxvYWRlciBhbmQgZnJlZXMgaXRzIHJlc291cmNlcywgbWFraW5nIGl0IHVudXNhYmxlLgorICAgICAqCisgICAgICogTXVzdCBiZSBjYWxsZWQgZnJvbSB0aGUgVUkgdGhyZWFkCisgICAgICovCisgICAgcHVibGljIGFic3RyYWN0IHZvaWQgZGVzdHJveSgpOworCisgICAgLyoqCisgICAgICogQ2FsbGVkIHdoZW4ge0BsaW5rIEZvcmNlTG9hZENvbnRlbnRPYnNlcnZlcn0gZGV0ZWN0cyBhIGNoYW5nZS4gIENhbGxzIHtAbGluayAjZm9yY2VMb2FkKCl9CisgICAgICogYnkgZGVmYXVsdC4KKyAgICAgKgorICAgICAqIE11c3QgYmUgY2FsbGVkIGZyb20gdGhlIFVJIHRocmVhZAorICAgICAqLworICAgIHB1YmxpYyB2b2lkIG9uQ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ZhbHNlKTsKKyAgICAgICAgICAgICAgICBtV2FrZUxvY2tzLnB1dCh3YWtlTG9ja0tleSwgd2FrZUxvY2spOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIHdha2VMb2NrOworICAgICAgICB9CisKICAgICAgICAgcHJpdmF0ZSB2b2lkIHdhaXRVbnRpbFJlYWR5VG9SdW4oKSB7CiAgICAgICAgICAgICBDb3VudERvd25MYXRjaCBsYXRjaCA9IG1SZWFkeVRvUnVuTGF0Y2g7CiAgICAgICAgICAgICBpZiAobGF0Y2ggIT0gbnVsbCkgewpAQCAtMTQ3Nyw4ICsxNDk0LDkgQEAKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgIGZpbmFsIGJvb2xlYW4gaXNTeW5jSW5Qcm9ncmVzcyA9IG1BY3RpdmVTeW5jQ29udGV4dCAhPSBudWxsOwotICAgICAgICAgICAgICAgIGlmICghaXNTeW5jSW5Qcm9ncmVzcykgeworICAgICAgICAgICAgICAgIGlmICghaXNTeW5jSW5Qcm9ncmVzcyAmJiBtU3luY1dha2VMb2NrICE9IG51bGwpIHsKICAgICAgICAgICAgICAgICAgICAgbVN5bmNXYWtlTG9jay5yZWxlYXNlKCk7CisgICAgICAgICAgICAgICAgICAgIG1TeW5jV2FrZUxvY2sgPSBudWxsOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBtYW5hZ2VTeW5jTm90aWZpY2F0aW9uKCk7CiAgICAgICAgICAgICAgICAgbWFuYWdlRXJyb3JOb3RpZmljYXRpb24oKTsKQEAgLTE3MDQsNyArMTcyMiwyNiBAQAogICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgbVN5bmNXYWtlTG9jay5hY3F1aXJlKCk7CisgICAgICAgICAgICAvLyBGaW5kIHRoZSB3YWtlbG9jayBmb3IgdGhpcyBhY2NvdW50IGFuZCBhdXRob3JpdH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ZXIgaW4KKyAgICAgKiB0aGUgWE1MIGRvY3VtZW50LiBUaGlzIHBhcmFtZXRlciBpcyBpZ25vcmVkLgorICAgICAqIEByZXR1cm4gQSBDdXJzb3Igb3IgbnVsbCBpbiBjYXNlIG9mIGVycm9yLgorICAgICAqLworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyBDdXJzb3IgcXVlcnkoVXJpIHVyaSwgU3RyaW5nW10gcHJvamVjdGlvbiwgU3RyaW5nIHNlbGVjdGlvbiwgU3RyaW5nW10gc2VsZWN0aW9uQXJncywKKyAgICAgICAgICAgIFN0cmluZyBzb3J0T3JkZXIpIHsKKworICAgICAgICBYbWxQdWxsUGFyc2VyIHBhcnNlciA9IG51bGw7CisgICAgICAgIG1IdHRwQ2xpZW50ID0gbnVsbDsKKworICAgICAgICBmaW5hbCBTdHJpbmcgdXJsID0gdXJpLmdldFF1ZXJ5UGFyYW1ldGVyKCJ1cmwiKTsKKyAgICAgICAgaWYgKHVybCAhPSBudWxsKSB7CisgICAgICAgICAgICBwYXJzZXIgPSBnZXRVcmlYbWxQdWxsUGFyc2VyKHVybCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBmaW5hbCBTdHJpbmcgcmVzb3VyY2UgPSB1cmkuZ2V0UXVlcnlQYXJhbWV0ZXIoInJlc291cmNlIik7CisgICAgICAgICAgICBpZiAocmVzb3VyY2UgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIFVyaSByZXNvdXJjZVVyaSA9IFVyaS5wYXJzZShDb250ZW50UmVzb2x2ZXIuU0NIRU1FX0FORFJPSURfUkVTT1VSQ0UgKyAiOi8vIiArCisgICAgICAgICAgICAgICAgICAgICAgICBnZXRDb250ZXh0KCkuZ2V0UGFja2FnZU5hbWUoKSArICIvIiArIHJlc291cmNlKTsKKyAgICAgICAgICAgICAgICBwYXJzZXIgPSBnZXRSZXNvdXJjZVhtbFB1bGxQYXJzZXIocmVzb3VyY2VVcmkpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgaWYgKHBhcnNlciAhPSBudWxsKSB7CisgICAgICAgICAgICBYTUxDdXJzb3IgeG1sQ3Vyc29yID0gbmV3IFhNTEN1cnNvcihzZWxlY3Rpb24sIHByb2plY3Rpb24pOworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICB4bWxDdXJzb3IucGFyc2VXaXRoKHBhcnNlcik7CisgICAgICAgICAgICAgICAgcmV0dXJuIHhtbEN1cnNvcjsKKyAgICAgICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICBMb2cudyhMT0dfVEFHLCAiSS9PIGVycm9yIHdoaWxlIHBhcnNpbmcgWE1MICIgKyB1cmksIGUpOworICAgICAgICAgICAgfSBjYXRjaCAoWG1sUHVsbFBhcnNlckV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgTG9nLncoTE9HX1RBRywgIkVycm9yIHdoaWxlIHBhcnNpbmcgWE1MICIgKyB1cmksIGUpOworICAgICAgICAgICAgfSBmaW5hbGx5IHsKKyAgICAgICAgICAgICAgICBpZiAobUh0dHBDbGllbnQgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBtSHR0cENsaWVudC5jbG9zZSgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiBudWxsOworICAgIH0KKworICAgIC8qKgorICAgICAqIENyZWF0ZXMgYW4gWG1sUHVsbFBhcnNlciBmb3IgdGhlIHByb3ZpZGVkIFVSTC4gQ2FuIGJlIG92ZXJsb2FkZWQgdG8gcHJvdmlkZSB5b3VyIG93biBwYXJzZXIuCisgICAgICogQHBhcmFtIHVybCBUaGUgVVJMIG9mIHRoZSBYTUwgZG9jdW1lbnQgdGhhdCBpcyB0byBiZSBwYXJzZWQuCisgICAgICogQHJldHVybiBBbiBYbWxQdWxsUGFyc2VyIG9uIHRoaXMgZG9jdW1lbnQuCisgICAgICovCisgICAgcHJvdGVjdGVkIFhtbFB1bGxQYXJzZXIgZ2V0VXJpWG1sUHVsbFBhcnNlcihTdHJpbmcgdXJsKSB7CisgICAgICAgIFhtbFB1bGxQYXJzZXIgcGFyc2VyID0gbnVsbDsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIFhtbFB1bGxQYXJzZXJGYWN0b3J5IGZhY3RvcnkgPSBYbWxQdWxsUGFyc2VyRmFjdG9yeS5uZXdJbnN0YW5jZSgpOworICAgICAgICAgICAgZmFjdG9yeS5zZXROYW1lc3BhY2VBd2FyZSh0cnVlKTsKKyAgICAgICAgICAgIHBhcnNlciA9IGZhY3RvcnkubmV3UHVsbFBhcnNlcigpOworICAgICAgICB9IGNhdGNoIChYbWxQdWxsUGFyc2VyRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIExvZy5lKExPR19UQUcsICJVbmFibGUgdG8gY3JlYXRlIFhtbFB1bGxQYXJzZXIiLCBlKTsKKyAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICB9CisKKyAgICAgICAgSW5wdXRTdHJlYW0gaW5wdXRTdHJlYW0gPSBudWxsOworICAgICAgICB0cnkgeworICAgICAgICAgICAgZmluYWwgSHR0cEdldCBnZXQgPSBuZXcgSHR0cEdldCh1cmwpOworICAgICAgICAgICAgbUh0dHBDbGllbnQgPSBBbmRyb2lkSHR0cENsaWVudC5uZXdJbnN0YW5jZSgiQW5kcm9pZCIpOworICAgICAgICAgICAgSHR0cFJlc3BvbnNlIHJlc3BvbnNlID0gbUh0dHBDbGllbnQuZXhlY3V0ZShnZXQpOworICAgICAgICAgICAgaWYgKHJlc3BvbnNlLmdldFN0YXR1c0xpbmUoKS5nZXRTdGF0dXNDb2RlKCkgPT0gSHR0cFN0YXR1cy5TQ19PSykgeworICAgICAgICAgICAgICAgIGZpbmFsIEh0dHBFbnRpdHkgZW50aXR5ID0gcmVzcG9uc2UuZ2V0RW50aXR5KCk7CisgICAgICAgICAgICAgICAgaWYgKGVudGl0eSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIGlucHV0U3RyZWFtID0gZW50aXR5LmdldENvbnRlbnQoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIExvZy53KExPR19UQUcsICJFcnJvciB3aGlsZSByZXRyaWV2aW5nIFhNTCBmaWxlICIgKyB1cmwsIGUpOworICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgIH0KKworICAgICAgICB0cnkgeworICAgICAgICAgICAgcGFyc2VyLnNldElucHV0KGlucHV0U3RyZWFtLCBudWxsKTsKKyAgICAgICAgfSBjYXRjaCAoWG1sUHVsbFBhcnNlckV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICBMb2cudyhMT0dfVEFHLCAiRXJyb3Igd2hpbGUgcmVhZGluZyBYTUwgZmlsZSBmcm9tICIgKyB1cmwsIGUpOworICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gcGFyc2VyOworICAgIH0KKworICAgIC8qKgorICAgICAqIENyZWF0ZXMgYW4gWG1sUHVsbFBhcnNlciBmb3IgdGhlIHByb3ZpZGVkIGxvY2FsIHJlc291cmNlLiBDYW4gYmUgb3ZlcmxvYWRlZCB0byBwcm92aWRlIHlvdXIKKyAgICAgKiBvd24gcGFyc2VyLgorICAgICAqIEBwYXJhbSByZXNvdXJjZVVyaSBBIGZ1bGx5IHF1YWxpZmllZCByZXNvdXJjZSBuYW1lIHJlZmVyZW5jaW5nIGEgbG9jYWwgWE1MIHJlc291cmNlLgorICAgICAqIEByZXR1cm4gQW4gWG1sUHVsbFBhcnNlciBvbiB0aGlzIHJlc291cmNlLgorICAgICAqLworICAgIHByb3RlY3RlZCBYbWxQdWxsUGFyc2VyIGdldFJlc291cmNlWG1sUHVsbFBhcnNlcihVcmkgcmVzb3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ByaXZhdGUgZmluYWwgaW50IG1OdW1iZXJPZlByb2plY3Rpb25zOworCisgICAgICAgIHB1YmxpYyBYTUxDdXJzb3IoU3RyaW5nIHNlbGVjdGlvbiwgU3RyaW5nW10gcHJvamVjdGlvbnMpIHsKKyAgICAgICAgICAgIHN1cGVyKHByb2plY3Rpb25zKTsKKyAgICAgICAgICAgIC8vIFRoZSBmaXJzdCBjb2x1bW4gaW4gcHJvamVjdGlvbnMgaXMgdXNlZCBmb3IgdGhlIF9JRAorICAgICAgICAgICAgbU51bWJlck9mUHJvamVjdGlvbnMgPSBwcm9qZWN0aW9ucy5sZW5ndGggLSAxOworICAgICAgICAgICAgbVNlbGVjdGlvblBhdHRlcm4gPSBjcmVhdGVQYXR0ZXJuKHNlbGVjdGlvbik7CisgICAgICAgICAgICBjcmVhdGVQcm9qZWN0aW9uUGF0dGVybihwcm9qZWN0aW9ucyk7CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIFBhdHRlcm4gY3JlYXRlUGF0dGVybihTdHJpbmcgaW5wdXQpIHsKKyAgICAgICAgICAgIFN0cmluZyBwYXR0ZXJuID0gaW5wdXQucmVwbGFjZUFsbCgiLy8iLCAiLyguKi98KSIpLnJlcGxhY2VBbGwoIl4vIiwgIl4vIikgKyAiJCI7CisgICAgICAgICAgICByZXR1cm4gUGF0dGVybi5jb21waWxlKHBhdHRlcm4pOworICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSB2b2lkIGNyZWF0ZVByb2plY3Rpb25QYXR0ZXJuKFN0cmluZ1tdIHByb2plY3Rpb25zKSB7CisgICAgICAgICAgICBtUHJvamVjdGlvblBhdHRlcm5zID0gbmV3IFBhdHRlcm5bbU51bWJlck9mUHJvamVjdGlvbnNdOworICAgICAgICAgICAgbUF0dHJpYnV0ZU5hbWVzID0gbmV3IFN0cmluZ1ttTnVtYmVyT2ZQcm9qZWN0aW9uc107CisgICAgICAgICAgICBtQWN0aXZlVGV4dERlcHRoTWFzayA9IG5ldyBCaXRTZXRbbU51bWJlck9mUHJvamVjdGlvbnNdOworICAgICAgICAgICAgLy8gQWRkIGEgY29sdW1uIHRvIHN0b3JlIF9JRAorICAgICAgICAgICAgbUN1cnJlbnRWYWx1ZXMgPSBuZXcgU3RyaW5nW21OdW1iZXJPZlByb2plY3Rpb25zICsgMV07CisKKyAgICAgICAgICAgIGZvciAoaW50IGk9MDsgaTxtTnVtYmVyT2ZQcm9qZWN0aW9uczsgaSsrKSB7CisgICAgICAgICAgICAgICAgbUFjdGl2ZVRleHREZXB0aE1hc2tbaV0gPSBuZXcgQml0U2V0KCk7CisgICAgICAgICAgICAgICAgU3RyaW5nIHByb2plY3Rpb24gPSBwcm9qZWN0aW9uc1tpICsgMV07IC8vICsxIHRvIHNraXAgdGhlIF9JRCBjb2x1bW4KKyAgICAgICAgICAgICAgICBpbnQgYXRJbmRleCA9IHByb2plY3Rpb24ubGFzdEluZGV4T2YoJ0AnLCBwcm9qZWN0aW9uLmxlbmd0aCgpKTsKKyAgICAgICAgICAgICAgICBpZiAoYXRJbmRleCA+PSAwKSB7CisgICAgICAgICAgICAgICAgICAgIG1BdHRyaWJ1dGVOYW1lc1tpXSA9IHByb2plY3Rpb24uc3Vic3RyaW5nKGF0SW5kZXgrMSk7CisgICAgICAgICAgICAgICAgICAgIHByb2plY3Rpb24gPSBwcm9qZWN0aW9uLnN1YnN0cmluZygwLCBhdEluZGV4KTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICBtQXR0cmlidXRlTmFtZXNbaV0gPSBudWxsOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIC8vIENvbmZvcm1zIHRvIFhQYXRoIHN0YW5kYXJkOiByZWZlcmVuY2UgdG8gbG9jYWwgY29udGV4dCBzdGFydHMgd2l0aCBhIC4KKyAgICAgICAgICAgICAgICBpZiAocHJvamVjdGlvbi5jaGFyQXQoMCkgPT0gJy4nKSB7CisgICAgICAgICAgICAgICAgICAgIHByb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ZSBwYXRoIHN0YXJ0cyBmcm9tIGluIHBhdGgKKyAgICAgICAgICAgIGludCBjdXJyZW50Tm9kZVBhdGhTdGFydEluZGV4ID0gMDsKKworICAgICAgICAgICAgaW50IGV2ZW50VHlwZSA9IHBhcnNlci5nZXRFdmVudFR5cGUoKTsKKyAgICAgICAgICAgIHdoaWxlIChldmVudFR5cGUgIT0gWG1sUHVsbFBhcnNlci5FTkRfRE9DVU1FTlQpIHsKKworICAgICAgICAgICAgICAgIGlmIChldmVudFR5cGUgPT0gWG1sUHVsbFBhcnNlci5TVEFSVF9UQUcpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gVXBkYXRlIHBhdGgKKyAgICAgICAgICAgICAgICAgICAgcGF0aExlbmd0aFN0YWNrLnB1c2gocGF0aC5sZW5ndGgoKSk7CisgICAgICAgICAgICAgICAgICAgIHBhdGguYXBwZW5kKCcvJyk7CisgICAgICAgICAgICAgICAgICAgIFN0cmluZyBwcmVmaXggPSBudWxsOworICAgICAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICAgICAgLy8gZ2V0UHJlZml4IGlzIG5vdCBzdXBwb3J0ZWQgYnkgbG9jYWwgWG1sIHJlc291cmNlIHBhcnNlcgorICAgICAgICAgICAgICAgICAgICAgICAgcHJlZml4ID0gcGFyc2VyLmdldFByZWZpeCgpOworICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChSdW50aW1lRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHByZWZpeCA9IG51bGw7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgaWYgKHByZWZpeCAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBwYXRoLmFwcGVuZChwcmVmaXgpOworICAgICAgICAgICAgICAgICAgICAgICAgcGF0aC5hcHBlbmQoJzonKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBwYXRoLmFwcGVuZChwYXJzZXIuZ2V0TmFtZSgpKTsKKworICAgICAgICAgICAgICAgICAgICBpZiAoY3VycmVudE5vZGVEZXB0aCA+PSAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBjdXJyZW50Tm9kZURlcHRoKys7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAvLyBBIG5vZGUgbWF0Y2hpbmcgc2VsZWN0aW9uIGlzIGZvdW5kOiBpbml0aWFsaXplIGNoaWxkIHBhcnNpbmcgbW9kZQorICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1TZWxlY3Rpb25QYXR0ZXJuLm1hdGNoZXIocGF0aC50b1N0cmluZygpKS5tYXRjaGVzKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXJyZW50Tm9kZURlcHRoID0gMDsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXJyZW50Tm9kZVBhdGhTdGFydEluZGV4ID0gcGF0aC5sZW5ndGgoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtQ3VycmVudFZhbHVlc1swXSA9IEludGVnZXIudG9TdHJpbmcoZ2V0Q291bnQoKSk7IC8vIF9JRAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbU51bWJlck9mUHJvamVjdGlvbnM7IGkrKykgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBSZXNldCB2YWx1ZXMgdG8gZGVmYXVsdCAoZW1wdHkgc3RyaW5nKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtQ3VycmVudFZhbHVlc1tpICsgMV0gPSAiIjsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUFjdGl2ZVRleHREZXB0aE1hc2tbaV0uY2xlYXIoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICAvLyBUaGlzIHRlc3QgaGFzIHRvIGJlIHNlcGFyYXRlZCBmcm9tIHRoZSBwcmV2aW91cyBvbmUgYXMgY3VycmVudE5vZGVEZXB0aCBjYW4KKyAgICAgICAgICAgICAgICAgICAgLy8gYmUgbW9kaWZpZWQgYWJvdmUgKHdoZW4gYSBub2RlIG1hdGNoaW5nIHNlbGVjdGlvbiBpcyBmb3VuZCkuCisgICAgICAgICAgICAgICAgICAgIGlmIChjdXJyZW50Tm9kZURlcHRoID49IDApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZpbmFsIFN0cmluZyBsb2NhbE5vZGVQYXRoID0gcGF0aC5zdWJzdHJpbmcoY3VycmVudE5vZGVQYXRoU3RhcnRJbmRleCk7CisgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IG1OdW1iZXJPZlByb2plY3Rpb25zOyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobVByb2plY3Rpb25QYXR0ZXJuc1tpXS5tYXRjaGVyKGxvY2FsTm9kZVBhdGgpLm1hdGNoZXMoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTdHJpbmcgYXR0cmlidXRlID0gbUF0dHJpYnV0ZU5hbWVzW2ldOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYXR0cmlidXRlICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1DdXJyZW50VmFsdWVzW2kgKyAxXSA9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyc2VyLmdldEF0dHJpYnV0ZVZhbHVlKG51bGwsIGF0dHJpYnV0ZSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtQWN0aXZlVGV4dERlcHRoTWFza1tpXS5zZXQoY3VycmVudE5vZGVEZXB0aCwgdHJ1ZSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoZXZlbnRUeXBlID09IFhtbFB1bGxQYXJzZXIuRU5EX1RBRykgeworICAgICAgICAgICAgICAgICAgICAvLyBQb3AgbGFzdCBub2RlIGZyb20gcGF0aAorICAgICAgICAgICAgICAgICAgICBmaW5hbCBpbnQgbGVuZ3RoID0gcGF0aExlbmd0aFN0YWNrLnBvcCgpOworICAgICAgICAgICAgICAgICAgICBwYXRoLnNldExlbmd0aChsZW5ndGgpOworCisgICAgICAgICAgICAgICAgICAgIGlmIChjdXJyZW50Tm9kZURlcHRoID49IDApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjdXJyZW50Tm9kZURlcHRoID09IDApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBMZWF2aW5nIGEgc2VsZWN0aW9uIG1hdGNoaW5nIG5vZGU6IGFkZCBhIG5ldyByb3cgd2l0aCByZXN1bHRzCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRkUm93KG1DdXJyZW50VmFsdWVzKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBtTnVtYmVyT2ZQcm9qZWN0aW9uczsgaSsrKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1BY3RpdmVUZXh0RGVwdGhNYXNrW2ldLnNldChjdXJyZW50Tm9kZURlcHRoLCBmYWxzZSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgY3VycmVudE5vZGVEZXB0aC0tOworICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKChldmVudFR5cGUgPT0gWG1sUHVsbFBhcnNlci5URVhUKSAmJiAoIXBhcnNlci5pc1doaXRlc3BhY2UoKSkpIHsKKyAgICAgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBtTnVtYmVyT2ZQcm9qZWN0aW9uczsgaSsrKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoKGN1cnJlbnROb2RlRGVwdGggPj0gMCkgJiYKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAobUFjdGl2ZVRleHREZXB0aE1hc2tbaV0uZ2V0KGN1cnJlbnROb2RlRGVwdGgpKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1DdXJyZW50VmFsdWVzW2kgKyAxXSArPSBwYXJzZXIuZ2V0VGV4dCgpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgZXZlbnRUeXBlID0gcGFyc2VyLm5leHQoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KK30KZGlmZiAtLWdpdCBhL2NvcmUvamF2YS9hbmRyb2lkL2NvbnRlbnQvcG0vQWN0aXZpdHlJbmZvLmphdmEgYi9jb3JlL2phdmEvYW5kcm9pZC9jb250ZW50L3BtL0FjdGl2aXR5SW5mby5qYXZhCmluZGV4IDM5NWMzOTIuLmUyMWNiOTcgMTAwNjQ0Ci0tLSBhL2NvcmUvamF2YS9hbmRyb2lkL2NvbnRlbnQvcG0vQWN0aXZpdHlJbmZvLmphdmEKKysrIGIvY29yZS9qYXZhL2FuZHJvaWQvY29udGVudC9wbS9BY3Rpdml0eUluZm8uamF2YQpAQCAtMTQ5LDYgKzE0OSwyNyBAQAogICAgICAqIHtAbGluayBhbmRyb2lkLlIuYXR0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ICAgICBib29sZWFuIGhhcmR3YXJlQWNjZWxlcmF0ZWQgPSBzYS5nZXRCb29sZWFuKAorICAgICAgICAgICAgICAgIGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLkFuZHJvaWRNYW5pZmVzdEFwcGxpY2F0aW9uX2hhcmR3YXJlQWNjZWxlcmF0ZWQsCisgICAgICAgICAgICAgICAgZmFsc2UpOworCiAgICAgICAgIGlmIChzYS5nZXRCb29sZWFuKAogICAgICAgICAgICAgICAgIGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLkFuZHJvaWRNYW5pZmVzdEFwcGxpY2F0aW9uX2hhc0NvZGUsCiAgICAgICAgICAgICAgICAgdHJ1ZSkpIHsKQEAgLTE2MzQsNyArMTY0MCw4IEBACiAKICAgICAgICAgICAgIFN0cmluZyB0YWdOYW1lID0gcGFyc2VyLmdldE5hbWUoKTsKICAgICAgICAgICAgIGlmICh0YWdOYW1lLmVxdWFscygiYWN0aXZpdHkiKSkgewotICAgICAgICAgICAgICAgIEFjdGl2aXR5IGEgPSBwYXJzZUFjdGl2aXR5KG93bmVyLCByZXMsIHBhcnNlciwgYXR0cnMsIGZsYWdzLCBvdXRFcnJvciwgZmFsc2UpOworICAgICAgICAgICAgICAgIEFjdGl2aXR5IGEgPSBwYXJzZUFjdGl2aXR5KG93bmVyLCByZXMsIHBhcnNlciwgYXR0cnMsIGZsYWdzLCBvdXRFcnJvciwgZmFsc2UsCisgICAgICAgICAgICAgICAgICAgICAgICBoYXJkd2FyZUFjY2VsZXJhdGVkKTsKICAgICAgICAgICAgICAgICBpZiAoYSA9PSBudWxsKSB7CiAgICAgICAgICAgICAgICAgICAgIG1QYXJzZUVycm9yID0gUGFja2FnZU1hbmFnZXIuSU5TVEFMTF9QQVJTRV9GQUlMRURfTUFOSUZFU1RfTUFMRk9STUVEOwogICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CkBAIC0xNjQzLDcgKzE2NTAsNy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IFR5cGVkQXJyYXkgc2EgPSByZXMub2J0YWluQXR0cmlidXRlcyhhdHRycywKICAgICAgICAgICAgICAgICBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5BbmRyb2lkTWFuaWZlc3RBY3Rpdml0eSk7CiAKQEAgLTE4ODMsNyArMTg5MSwxOSBAQAogICAgICAgICAgICAgYS5pbmZvLmZsYWdzIHw9IEFjdGl2aXR5SW5mby5GTEFHX0ZJTklTSF9PTl9DTE9TRV9TWVNURU1fRElBTE9HUzsKICAgICAgICAgfQogCisgICAgICAgIGlmIChzYS5nZXRCb29sZWFuKAorICAgICAgICAgICAgICAgIGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLkFuZHJvaWRNYW5pZmVzdEFjdGl2aXR5X2ltbWVyc2l2ZSwKKyAgICAgICAgICAgICAgICBmYWxzZSkpIHsKKyAgICAgICAgICAgIGEuaW5mby5mbGFncyB8PSBBY3Rpdml0eUluZm8uRkxBR19JTU1FUlNJVkU7CisgICAgICAgIH0KKyAgICAgICAgCiAgICAgICAgIGlmICghcmVjZWl2ZXIpIHsKKyAgICAgICAgICAgIGlmIChzYS5nZXRCb29sZWFuKAorICAgICAgICAgICAgICAgICAgICBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5BbmRyb2lkTWFuaWZlc3RBY3Rpdml0eV9oYXJkd2FyZUFjY2VsZXJhdGVkLAorICAgICAgICAgICAgICAgICAgICBoYXJkd2FyZUFjY2VsZXJhdGVkKSkgeworICAgICAgICAgICAgICAgIGEuaW5mby5mbGFncyB8PSBBY3Rpdml0eUluZm8uRkxBR19IQVJEV0FSRV9BQ0NFTEVSQVRFRDsKKyAgICAgICAgICAgIH0KKwogICAgICAgICAgICAgYS5pbmZvLmxhdW5jaE1vZGUgPSBzYS5nZXRJbnQoCiAgICAgICAgICAgICAgICAgICAgIGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLkFu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BsaW5rICNTQ1JFRU5MQVlPVVRfTE9OR19NQVNLfSBkZWZpbmVzIHdoZXRoZXIgdGhlIHNjcmVlbgogICAgICAqIGlzIHdpZGVyL3RhbGxlciB0aGFuIG5vcm1hbC4gIFRoZXkgbWF5IGJlIG9uZSBvZgpAQCAtMjY3LDExICsyNjYsMTggQEAKICAgICAgICAgc2IuYXBwZW5kKCIvIik7CiAgICAgICAgIHNiLmFwcGVuZChuYXZpZ2F0aW9uSGlkZGVuKTsKICAgICAgICAgc2IuYXBwZW5kKCIgb3JpZW49Iik7Ci0gICAgICAgIHNiLmFwcGVuZChvcmllbnRhdGlvbik7Ci0gICAgICAgIHNiLmFwcGVuZCgiIGxheW91dD0iKTsKLSAgICAgICAgc2IuYXBwZW5kKHNjcmVlbkxheW91dCk7Ci0gICAgICAgIHNiLmFwcGVuZCgiIHVpTW9kZT0iKTsKLSAgICAgICAgc2IuYXBwZW5kKHVpTW9kZSk7CisgICAgICAgIHN3aXRjaChvcmllbnRhdGlvbikgeworICAgICAgICAgICAgY2FzZSBPUklFTlRBVElPTl9MQU5EU0NBUEU6CisgICAgICAgICAgICAgICAgc2IuYXBwZW5kKCJMIik7IGJyZWFrOworICAgICAgICAgICAgY2FzZSBPUklFTlRBVElPTl9QT1JUUkFJVDoKKyAgICAgICAgICAgICAgICBzYi5hcHBlbmQoIlAiKTsgYnJlYWs7CisgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgIHNiLmFwcGVuZChvcmllbnRhdGlvbik7CisgICAgICAgIH0KKyAgICAgICAgc2IuYXBwZW5kKCIgbGF5b3V0PTB4Iik7CisgICAgICAgIHNiLmFwcGVuZChqYXZhLmxhbmcuSW50ZWdlci50b0hleFN0cmluZyhzY3JlZW5MYXlvdXQpKTsKKyAgICAgICAgc2IuYXBwZW5kKCIgdWlNb2RlPTB4Iik7CisgICAgICAgIHNiLmFwcGVuZChqYXZhLmxhbmcuSW50ZWdlci50b0hleFN0cmluZyh1aU1vZGUpK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ik7Ci0KLSAgICBmaW5hbCBpbnQgYXR0ckZvck51bWJlcihpbnQgbikgewotICAgICAgICByZXR1cm4gUGx1cmFsUnVsZXMuYXR0ckZvclF1YW50aXR5KHF1YW50aXR5Rm9yTnVtYmVyKG4pKTsKLSAgICB9Ci0KLSAgICBzdGF0aWMgZmluYWwgaW50IGF0dHJGb3JRdWFudGl0eShpbnQgcXVhbnRpdHkpIHsKLSAgICAgICAgLy8gc2VlIGluY2x1ZGUvdXRpbHMvUmVzb3VyY2VUeXBlcy5oCi0gICAgICAgIHN3aXRjaCAocXVhbnRpdHkpIHsKLSAgICAgICAgICAgIGNhc2UgUVVBTlRJVFlfWkVSTzogcmV0dXJuIDB4MDEwMDAwMDU7Ci0gICAgICAgICAgICBjYXNlIFFVQU5USVRZX09ORTogIHJldHVybiAweDAxMDAwMDA2OwotICAgICAgICAgICAgY2FzZSBRVUFOVElUWV9UV086ICByZXR1cm4gMHgwMTAwMDAwNzsKLSAgICAgICAgICAgIGNhc2UgUVVBTlRJVFlfRkVXOiAgcmV0dXJuIDB4MDEwMDAwMDg7Ci0gICAgICAgICAgICBjYXNlIFFVQU5USVRZX01BTlk6IHJldHVybiAweDAxMDAwMDA5OwotICAgICAgICAgICAgZGVmYXVsdDogICAgICAgICAgICByZXR1cm4gSURfT1RIRVI7Ci0gICAgICAgIH0KLSAgICB9Ci0KLSAgICBzdGF0aWMgZmluYWwgU3RyaW5nIHN0cmluZ0ZvclF1YW50aXR5KGludCBxdWFudGl0eSkgewotICAgICAgICBzd2l0Y2ggKHF1YW50aXR5KSB7Ci0gICAgICAgICAgICBjYXNlIFFVQU5USVRZX1pFUk86Ci0gICAgICAgICAgICAgICAgcmV0dXJuICJ6ZXJvIjsKLSAgICAgICAgICAgIGNhc2UgUVVBTlRJVFlfT05FOgotICAgICAgICAgICAgICAgIHJldHVybiAib25lIjsKLSAgICAgICAgICAgIGNhc2UgUVVBTlRJVFlfVFdPOgotICAgICAgICAgICAgICAgIHJldHVybiAidHdvIjsKLSAgICAgICAgICAgIGNhc2UgUVVBTlRJVFlfRkVXOgotICAgICAgICAgICAgICAgIHJldHVybiAiZmV3IjsKLSAgICAgICAgICAgIGNhc2UgUVVBTlRJVFlfTUFOWToKLSAgICAgICAgICAgICAgICByZXR1cm4gIm1hbnkiOwotICAgICAgICAgICAgZGVmYXVsdDoKLSAgICAgICAgICAgICAgICByZXR1cm4gIm90aGVyIjsKLSAgICAgICAgfQotICAgIH0KLQotICAgIHN0YXRpYyBmaW5hbCBQbHVyYWxSdWxlcyBydWxlRm9yTG9jYWxlKExvY2FsZSBsb2NhbGUpIHsKLSAgICAgICAgU3RyaW5nIGxhbmcgPSBsb2NhbGUuZ2V0TGFuZ3VhZ2UoKTsKLSAgICAgICAgaWYgKCJjcyIuZXF1YWxzKGxhbmcpKSB7Ci0gICAgICAgICAgICBpZiAoY3MgPT0gbnVsbCkgY3MgPSBuZXcgY3MoKTsKLSAgICAgICAgICAgIHJldHVybiBjczsKLSAgICAgICAgfQotICAgICAgICBlbHNlIHsKLSAgICAgICAgICAgIGlmIChlbiA9PSBudWxsKSBlbiA9IG5ldyBlbigpOwotICAgICAgICAgICAgcmV0dXJuIGVuOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgcHJpdmF0ZSBzdGF0aWMgUGx1cmFsUnVsZXMgY3M7Ci0gICAgcHJpdmF0ZSBzdGF0aWMgY2xhc3MgY3MgZXh0ZW5kcyBQbHVyYWxSdWxlcyB7Ci0gICAgICAgIGludCBxdWFudGl0eUZvck51bWJlcihpbnQgbikgewotICAgICAgICAgICAgaWYgKG4gPT0gMSkgewotICAgICAgICAgICAgICAgIHJldHVybiBRVUFOVElUWV9PTkU7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBlbHNlIGlmIChuID49IDIgJiYgbiA8PSA0KSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIFFVQU5USVRZX0ZFVzsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGVsc2UgewotICAg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UnVsZXMuWkVSTzogcmV0dXJuIDB4MDEwMDAwMDU7CisgICAgICAgICAgICBjYXNlIE5hdGl2ZVBsdXJhbFJ1bGVzLk9ORTogIHJldHVybiAweDAxMDAwMDA2OworICAgICAgICAgICAgY2FzZSBOYXRpdmVQbHVyYWxSdWxlcy5UV086ICByZXR1cm4gMHgwMTAwMDAwNzsKKyAgICAgICAgICAgIGNhc2UgTmF0aXZlUGx1cmFsUnVsZXMuRkVXOiAgcmV0dXJuIDB4MDEwMDAwMDg7CisgICAgICAgICAgICBjYXNlIE5hdGl2ZVBsdXJhbFJ1bGVzLk1BTlk6IHJldHVybiAweDAxMDAwMDA5OworICAgICAgICAgICAgZGVmYXVsdDogICAgICAgICAgICAgICAgICAgICByZXR1cm4gSURfT1RIRVI7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIHN0YXRpYyBTdHJpbmcgc3RyaW5nRm9yUXVhbnRpdHlDb2RlKGludCBxdWFudGl0eUNvZGUpIHsKKyAgICAgICAgc3dpdGNoIChxdWFudGl0eUNvZGUpIHsKKyAgICAgICAgICAgIGNhc2UgTmF0aXZlUGx1cmFsUnVsZXMuWkVSTzogcmV0dXJuICJ6ZXJvIjsKKyAgICAgICAgICAgIGNhc2UgTmF0aXZlUGx1cmFsUnVsZXMuT05FOiAgcmV0dXJuICJvbmUiOworICAgICAgICAgICAgY2FzZSBOYXRpdmVQbHVyYWxSdWxlcy5UV086ICByZXR1cm4gInR3byI7CisgICAgICAgICAgICBjYXNlIE5hdGl2ZVBsdXJhbFJ1bGVzLkZFVzogIHJldHVybiAiZmV3IjsKKyAgICAgICAgICAgIGNhc2UgTmF0aXZlUGx1cmFsUnVsZXMuTUFOWTogcmV0dXJuICJtYW55IjsKKyAgICAgICAgICAgIGRlZmF1bHQ6ICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICJvdGhlciI7CisgICAgICAgIH0KKyAgICB9CisKICAgICAvKioKICAgICAgKiBSZXR1cm4gdGhlIHN0cmlu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pemVkKG1VcGRhdGVkUm93cykgewotICAgICAgICAgICAgaWYgKGlzRmllbGRVcGRhdGVkKGNvbHVtbkluZGV4KSkgewotICAgICAgICAgICAgICAgIHJldHVybiAoYnl0ZVtdKWdldFVwZGF0ZWRGaWVsZChjb2x1bW5JbmRleCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQogICAgICAgICByZXR1cm4gbVdpbmRvdy5nZXRCbG9iKG1Qb3MsIGNvbHVtbkluZGV4KTsKICAgICB9CiAKICAgICBAT3ZlcnJpZGUKLSAgICBwdWJsaWMgU3RyaW5nIGdldFN0cmluZyhpbnQgY29sdW1uSW5kZXgpCi0gICAgeworICAgIHB1YmxpYyBTdHJpbmcgZ2V0U3RyaW5nKGludCBjb2x1bW5JbmRleCkgewogICAgICAgICBjaGVja1Bvc2l0aW9uKCk7Ci0KLSAgICAgICAgc3luY2hyb25pemVkKG1VcGRhdGVkUm93cykgewotICAgICAgICAgICAgaWYgKGlzRmllbGRVcGRhdGVkKGNvbHVtbkluZGV4KSkgewotICAgICAgICAgICAgICAgIHJldHVybiAoU3RyaW5nKWdldFVwZGF0ZWRGaWVsZChjb2x1bW5JbmRleCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQogICAgICAgICByZXR1cm4gbVdpbmRvdy5nZXRTdHJpbmcobVBvcywgY29sdW1uSW5kZXgpOwogICAgIH0KLSAgICAKKwogICAgIEBPdmVycmlkZQotICAgIHB1YmxpYyB2b2lkIGNvcHlTdHJpbmdUb0J1ZmZlcihpbnQgY29sdW1uSW5kZXgsIENoYXJBcnJheUJ1ZmZlciBidWZmZXIpCi0gICAgeworICAgIHB1YmxpYyB2b2lkIGNvcHlTdHJpbmdUb0J1ZmZlcihpbnQgY29sdW1uSW5kZXgsIENoYXJBcnJheUJ1ZmZlciBidWZmZXIpIHsKICAgICAgICAgY2hlY2tQb3NpdGlvbigpOwotICAgICAgICAKLSAgICAgICAgc3luY2hyb25pemVkKG1VcGRhdGVkUm93cykgewotICAgICAgICAgICAgaWYgKGlzRmllbGRVcGRhdGVkKGNvbHVtbkluZGV4KSkgewotICAgICAgICAgICAgICAgIHN1cGVyLmNvcHlTdHJpbmdUb0J1ZmZlcihjb2x1bW5JbmRleCwgYnVmZmVyKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgICAgICAKICAgICAgICAgbVdpbmRvdy5jb3B5U3RyaW5nVG9CdWZmZXIobVBvcywgY29sdW1uSW5kZXgsIGJ1ZmZlcik7CiAgICAgfQogCiAgICAgQE92ZXJyaWRlCi0gICAgcHVibGljIHNob3J0IGdldFNob3J0KGludCBjb2x1bW5JbmRleCkKLSAgICB7CisgICAgcHVibGljIHNob3J0IGdldFNob3J0KGludCBjb2x1bW5JbmRleCkgewogICAgICAgICBjaGVja1Bvc2l0aW9uKCk7Ci0KLSAgICAgICAgc3luY2hyb25pemVkKG1VcGRhdGVkUm93cykgewotICAgICAgICAgICAgaWYgKGlzRmllbGRVcGRhdGVkKGNvbHVtbkluZGV4KSkgewotICAgICAgICAgICAgICAgIE51bWJlciB2YWx1ZSA9IChOdW1iZXIpZ2V0VXBkYXRlZEZpZWxkKGNvbHVtbkluZGV4KTsKLSAgICAgICAgICAgICAgICByZXR1cm4gdmFsdWUuc2hvcnRWYWx1ZSgpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KICAgICAgICAgcmV0dXJuIG1XaW5kb3cuZ2V0U2hvcnQobVBvcywgY29sdW1uSW5kZXgpOwogICAgIH0KIAogICAgIEBPdmVycmlkZQotICAgIHB1YmxpYyBpbnQgZ2V0SW50KGludCBjb2x1bW5JbmRleCkKLSAgICB7CisgICAgcHVibGljIGludCBnZXRJbnQoaW50IGNvbHVtbkluZGV4KSB7CiAgICAgICAgIGNoZWNrUG9zaXRpb24oKTsKLQotICAgICAgICBzeW5jaHJvbml6ZWQobVVwZGF0ZWRSb3dzKSB7Ci0gICAgICAgICAgICBpZiAoaXNGaWVsZFVwZGF0ZWQoY29sdW1uSW5kZXgpKSB7Ci0gICAgICAgICAgICAgICAgTnVtYmVyIHZhbHVlID0gKE51bWJlcilnZXRVcGRhdGVkRmllbGQoY29sdW1uSW5kZXgpOwotICAgICAgICAgICAgICAgIHJldHVybiB2YWx1ZS5pbnRWYWx1ZSgpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KICAgICAgICAgcmV0dXJuIG1XaW5kb3cuZ2V0SW50KG1Qb3MsIGNvbHVtbkluZGV4KTsKICAgICB9CiAKICAgICBAT3ZlcnJpZGUKLSAgICBwdWJsaWMgbG9uZyBnZXRMb25nKGludCBjb2x1bW5JbmRleCkKLSAgICB7CisgICAgcHVibGljIGxvbmcgZ2V0TG9uZyhpbnQgY29sdW1uSW5kZXgpIHsKICAgICAgICAgY2hlY2tQb3NpdGlvbigpOwotCi0gICAgICAgIHN5bmNocm9uaXplZChtVXBkYXRlZFJvd3MpIHsKLSAgICAgICAgICAgIGlmIChpc0ZpZWxkVXBkYXRlZChjb2x1bW5JbmRleCkpIHsKLSAgICAgICAgICAgICAgICBOdW1iZXIgdmFsdWUgPSAoTnVtYmVyKWdldFVwZGF0ZWRGaWVsZChjb2x1bW5JbmRleCk7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIHZhbHVlLmxvbmdWYWx1ZSgpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KICAgICAgICAgcmV0dXJuIG1XaW5kb3cuZ2V0TG9uZyhtUG9zLCBjb2x1bW5JbmRleCk7CiAgICAgfQogCiAgICAgQE92ZXJyaWRlCi0gICAgcHVibGljIGZsb2F0IGdldEZsb2F0KGludCBjb2x1bW5JbmRleCkKLSAgICB7CisgICAgcHVibGljIGZsb2F0IGdldEZsb2F0KGludCBjb2x1bW5JbmRleCkgewogICAgICAgICBjaGVja1Bvc2l0aW9uKCk7Ci0KLSAgICAgICAgc3luY2hyb25pemVkKG1VcGRhdGVkUm93cykgewotICAgICAgICAgICAgaWYgKGlzRmllbGRVcGRhdGVkKGNvbHVtbkluZGV4KSkgewotICAgICAgICAgICAgICAgIE51bWJlciB2YWx1ZSA9IChOdW1iZXIpZ2V0VXBkYXRlZEZpZWxkKGNvbHVtbkluZGV4KTsKLSAgICAgICAgICAgICAgICByZXR1cm4gdmFsdWUuZmxvYXRWYWx1ZSgpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KICAgICAgICAgcmV0dXJuIG1XaW5kb3cuZ2V0RmxvYXQobVBvcywgY29sdW1uSW5kZXgpOwogICAgIH0KIAogICAgIEBPdmVycmlkZQotICAgIHB1YmxpYyBkb3VibGUgZ2V0RG91YmxlKGludCBjb2x1bW5JbmRleCkKLSAgICB7CisgICAgcHVibGljIGRvdWJsZSBnZXREb3VibGUoaW50IGNvbHVtbkluZGV4KSB7CiAgICAgICAgIGNoZWNrUG9zaXRpb24oKTsKLQotICAgICAgICBzeW5jaHJvbml6ZWQobVVwZGF0ZWRSb3dzKSB7Ci0gICAgICAgICAgICBpZiAoaXNGaWVsZFVwZGF0ZWQoY29sdW1uSW5kZXgpKSB7Ci0gICAgICAgICAgICAgICAgTnVtYmVyIHZhbHVlID0gKE51bWJlcilnZXRVcGRhdGVkRmllbGQoY29sdW1uSW5kZXgpOwotICAgICAgICAgICAgICAgIHJldHVybiB2YWx1ZS5kb3VibGVWYWx1ZSgpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KICAgICAgICAgcmV0dXJuIG1XaW5kb3cuZ2V0RG91YmxlKG1Qb3MsIGNvbHVtbkluZGV4KTsKICAgICB9CiAKICAgICBAT3ZlcnJpZGUKLSAgICBwdWJsaWMgYm9vbGVhbiBpc051bGwoaW50IGNvbHVtbkluZGV4KQotICAgIHsKKyAgICBwdWJsaWMgYm9vbGVhbiBpc051bGwoaW50IGNvbHVtbkluZGV4KSB7CiAgICAgICAgIGNoZWNrUG9zaXRpb24oKTsKLQotICAgICAgICBzeW5jaHJvbml6ZWQobVVwZGF0ZWRSb3dzKSB7Ci0gICAgICAgICAgICBpZiAoaXNGaWVsZFVwZGF0ZWQoY29sdW1uSW5kZXgpKSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIGdldFVwZGF0ZWRGaWVsZChjb2x1bW5JbmRleCkgPT0gbnVsbDsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIHJldHVybiBtV2luZG93LmlzTnVsbChtUG9zLCBjb2x1bW5JbmRleCk7CisgICAgICAgIHJldHVybiBtV2luZG93LmdldFR5cGUobVBvcywgY29sdW1uSW5kZXgpID09IEN1cnNvci5GSUVMRF9UWVBFX05VTEw7CiAgICAgfQogCi0gICAgcHVibGljIGJvb2xlYW4gaXNCbG9iKGludCBjb2x1bW5JbmRleCkKLSAgICB7Ci0gICAgICAgIGNoZWNrUG9zaXRpb24oKTsKLQotICAgICAgICBzeW5jaHJvbml6ZWQobVVwZGF0ZWRSb3dzKSB7Ci0gICAgICAgICAgICBpZiAoaXNGaWVsZFVwZGF0ZWQoY29sdW1uSW5kZXgpKSB7Ci0gICAgICAgICAgICAgICAgT2JqZWN0IG9iamVjdCA9IGdldFVwZGF0ZWRGaWVsZChjb2x1bW5JbmRleCk7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIG9iamVjdCA9PSBudWxsIHx8IG9iamVjdCBpbnN0YW5jZW9mIGJ5dGVbXTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIHJldHVybiBtV2luZG93LmlzQmxvYihtUG9zLCBjb2x1bW5JbmRleCk7CisgICAgLyoqCisgICAgICogQGRlcHJlY2F0ZWQgVXNlIHtAbGluayAjZ2V0VHlwZX0KKyAgICAgKi8KKyAgICBARGVwcmVjYXRlZAorICAgIHB1YmxpYyBib29sZWFuIGlzQmxvYihpbnQgY29sdW1uSW5kZXgpIHsKKyAgICAgICAgcmV0dXJuIGdldFR5cGUoY29sdW1uSW5kZXgpID09IEN1cnNvci5GSUVMRF9UWVBFX0JMT0I7CiAgICAgfQogCi0gICAgcHVibGljIGJvb2xlYW4gaXNTdHJpbmcoaW50IGNvbHVtbkluZGV4KQotICAgIHsKLSAgICAgICAgY2hlY2tQb3NpdGlvbigpOwotCi0gICAgICAgIHN5bmNocm9uaXplZChtVXBkYXRlZFJvd3MpIHsKLSAgICAgICAgICAgIGlmIChpc0ZpZWxkVXBkYXRlZChjb2x1bW5JbmRleCkpIHsKLSAgICAgICAgICAgICAgICBPYmplY3Qgb2JqZWN0ID0gZ2V0VXBkYXRlZEZpZWxkKGNvbHVtbkluZGV4KTsKLSAgICAgICAgICAgICAgICByZXR1cm4gb2JqZWN0ID09IG51bGwgfHwgb2JqZWN0IGluc3RhbmNlb2YgU3RyaW5nOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgcmV0dXJuIG1XaW5kb3cuaXNTdHJpbmcobVBvcywgY29sdW1uSW5kZXgpOworICAgIC8qKgorICAgICAqIEBkZXByZWNhdGVkIFVzZSB7QGxpbmsgI2dldFR5cGV9CisgICAgICovCisgICAgQERlcHJlY2F0ZWQKKyAgICBwdWJsaWMgYm9vbGVhbiBpc1N0cmluZyhpbnQgY29sdW1uSW5kZXgpIHsKKyAgICAgICAgcmV0dXJuIGdldFR5cGUoY29sdW1uSW5kZXgpID09IEN1cnNvci5GSUVMRF9UWVBFX1NUUklORzsKICAgICB9CiAKLSAgICBwdWJsaWMgYm9vbGVhbiBpc0xvbmcoaW50IGNvbHVtbkluZGV4KQotICAgIHsKLSAgICAgICAgY2hlY2tQb3NpdGlvbigpOwotCi0gICAgICAgIHN5bmNocm9uaXplZChtVXBkYXRlZFJvd3MpIHsKLSAgICAgICAgICAgIGlmIChpc0ZpZWxkVXBkYXRlZChjb2x1bW5JbmRleCkpIHsKLSAgICAgICAgICAgICAgICBPYmplY3Qgb2JqZWN0ID0gZ2V0VXBkYXRlZEZpZWxkKGNvbHVtbkluZGV4KTsKLSAgICAgICAgICAgICAgICByZXR1cm4gb2JqZWN0ICE9IG51bGwgJiYgKG9iamVjdCBpbnN0YW5jZW9mIEludGVnZXIgfHwgb2JqZWN0IGluc3RhbmNlb2YgTG9uZyk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICByZXR1cm4gbVdpbmRvdy5pc0xvbmcobVBvcywgY29sdW1uSW5kZXgpOworICAgIC8qKgorICAgICAqIEBkZXByZWNhdGVkIFVzZSB7QGxpbmsgI2dldFR5cGV9CisgICAgICovCisgICAgQERlcHJlY2F0ZWQKKyAgICBwdWJsaWMgYm9vbGVhbiBpc0xvbmcoaW50IGNvbHVtbkluZGV4KSB7CisgICAgICAgIHJldHVybiBnZXRUeXBlKGNvbHVtbkluZGV4KSA9PSBDdXJzb3IuRklFTERfVFlQRV9JTlRFR0VSOwogICAgIH0KIAotICAgIHB1YmxpYyBib29sZWFuIGlzRmxvYXQoaW50IGNvbHVtbkluZGV4KQotICAgIHsKLSAgICAgICAgY2hlY2tQb3NpdGlvbigpOwotCi0gICAgICAgIHN5bmNocm9uaXplZChtVXBkYXRlZFJvd3MpIHsKLSAgICAgICAgICAgIGlmIChpc0ZpZWxkVXBkYXRlZChjb2x1bW5JbmRleCkpIHsKLSAgICAgICAgICAgICAgICBPYmplY3Qgb2JqZWN0ID0gZ2V0VXBkYXRlZEZpZWxkKGNvbHVtbkluZGV4KTsKLSAgICAgICAgICAgICAgICByZXR1cm4gb2JqZWN0ICE9IG51bGwgJiYgKG9iamVjdCBpbnN0YW5jZW9mIEZsb2F0IHx8IG9iamVjdCBpbnN0YW5jZW9mIERvdWJsZSk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICByZXR1cm4gbVdpbmRvdy5pc0Zsb2F0KG1Qb3MsIGNvbHVtbkluZGV4KTsKKyAgICAvKioKKyAgICAgKiBAZGVwcmVjYXRlZCBVc2Uge0BsaW5rICNnZXRUeXBlfQorICAgICAqLworICAgIEBEZXByZWNhdGVkCisgICAgcHVibGljIGJvb2xlYW4gaXNGbG9hdChpbnQgY29sdW1uSW5kZXgpIHsKKyAgICAgICAgcmV0d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HVwZGF0ZVJvd3ModmFsdWVzKTsKLSAgICAgICAgICAgICAgICAgICAgcmVwbHkud3JpdGVOb0V4Y2VwdGlvbigpOwotICAgICAgICAgICAgICAgICAgICByZXBseS53cml0ZUludCgocmVzdWx0ID09IHRydWUgPyAxIDogMCkpOwotICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBjYXNlIERFTEVURV9ST1dfVFJBTlNBQ1RJT046IHsKLSAgICAgICAgICAgICAgICAgICAgZGF0YS5lbmZvcmNlSW50ZXJmYWNlKElCdWxrQ3Vyc29yLmRlc2NyaXB0b3IpOwotICAgICAgICAgICAgICAgICAgICBpbnQgcG9zaXRpb24gPSBkYXRhLnJlYWRJbnQoKTsKLSAgICAgICAgICAgICAgICAgICAgYm9vbGVhbiByZXN1bHQgPSBkZWxldGVSb3cocG9zaXRpb24pOwotICAgICAgICAgICAgICAgICAgICByZXBseS53cml0ZU5vRXhjZXB0aW9uKCk7Ci0gICAgICAgICAgICAgICAgICAgIHJlcGx5LndyaXRlSW50KChyZXN1bHQgPT0gdHJ1ZSA/IDEgOiAwKSk7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICAgICAgICAgIH0KLQogICAgICAgICAgICAgICAgIGNhc2UgT05fTU9WRV9UUkFOU0FDVElPTjogewogICAgICAgICAgICAgICAgICAgICBkYXRhLmVuZm9yY2VJbnRlcmZhY2UoSUJ1bGtDdXJzb3IuZGVzY3JpcHRvcik7CiAgICAgICAgICAgICAgICAgICAgIGludCBwb3NpdGlvbiA9IGRhdGEucmVhZEludCgpOwpAQCAtMzQzLDQ4ICszMjAsNiBAQAogICAgICAgICByZXR1cm4gY291bnQ7CiAgICAgfQogCi0gICAgcHVibGljIGJvb2xlYW4gdXBkYXRlUm93cyhNYXAgdmFsdWVzKSB0aHJvd3MgUmVtb3RlRXhjZXB0aW9uCi0gICAgewotICAgICAgIC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KLQogLyoqCiAgKiBBZGFwdHMgYW4ge0BsaW5rIElCdWxrQ3Vyc29yfSB0byBhIHtAbGluayBDdXJzb3J9IGZvciB1c2UgaW4gdGhlIGxvY2FsCiAgKiBwcm9jZXNzLgpAQCAtMTc0LDM4ICsxNzIsNiBAQAogICAgICAgICB9CiAgICAgfQogCi0gICAgLyoqCi0gICAgICogQGhpZGUKLSAgICAgKiBAZGVwcmVjYXRlZAotICAgICAqLwotICAgIEBPdmVycmlkZQotICAgIHB1YmxpYyBib29sZWFuIGRlbGV0ZVJvdygpIHsKLSAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgIGJvb2xlYW4gcmVzdWx0ID0gbUJ1bGtDdXJzb3IuZGVsZXRlUm93KG1Qb3MpOwotICAgICAgICAgICAgaWYgKHJlc3VsdCAhPSBmYWxzZSkgewotICAgICAgICAgICAgICAgIC8vIFRoZSB3aW5kb3cgY29udGFpbnMgdGhlIG9sZCB2YWx1ZSwgZGlzY2FyZCBpdAotICAgICAgICAgICAgICAgIG1XaW5kb3cgPSBudWxsOwotICAgIAotICAgICAgICAgICAgICAgIC8vIEZpeCB1cCB0aGUgcG9zaXRpb24KLSAgICAgICAgICAgICAgICBtQ291bnQgPSBtQnVsa0N1cnNvci5jb3VudCgpOwotICAgICAgICAgICAgICAgIGlmIChtUG9zIDwgbUNvdW50KSB7Ci0gICAgICAgICAgICAgICAgICAgIGludCBvbGRQb3MgPSBtUG9zOwotICAgICAgICAgICAgICAgICAgICBtUG9zID0gLTE7Ci0gICAgICAgICAgICAgICAgICAgIG1vdmVUb1Bvc2l0aW9uKG9sZFBvcyk7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgbVBvcyA9IG1Db3VudDsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAvLyBTZW5kIHRoZSBjaGFuZ2Ugbm90aWZpY2F0aW9uCi0gICAgICAgICAgICAgICAgb25DaGFuZ2UodHJ1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3dzLnB1dEFsbChhZGRpdGlvbmFsVmFsdWVzKTsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgaWYgKG1VcGRhdGVkUm93cy5zaXplKCkgPD0gMCkgewotICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgICBib29sZWFuIHJlc3VsdCA9IG1CdWxrQ3Vyc29yLnVwZGF0ZVJvd3MobVVwZGF0ZWRSb3dzKTsKLSAgICAKLSAgICAgICAgICAgICAgICBpZiAocmVzdWx0ID09IHRydWUpIHsKLSAgICAgICAgICAgICAgICAgICAgbVVwZGF0ZWRSb3dzLmNsZWFyKCk7Ci0KLSAgICAgICAgICAgICAgICAgICAgLy8gU2VuZCB0aGUgY2hhbmdlIG5vdGlmaWNhdGlvbgotICAgICAgICAgICAgICAgICAgICBvbkNoYW5nZSh0cnVlKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgcmV0dXJuIHJlc3VsdDsKLSAgICAgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBleCkgewotICAgICAgICAgICAgICAgIExvZy5lKFRBRywgIlVuYWJsZSB0byBjb21taXQgdXBkYXRlcyBiZWNhdXNlIHRoZSByZW1vdGUgcHJvY2VzcyBpcyBkZWFkIik7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgfQotCiAgICAgQE92ZXJyaWRlCiAgICAgcHVibGljIEJ1bmRsZSBnZXRFeHRyYXMoKSB7CiAgICAgICAgIHRyeSB7CmRpZmYgLS1naXQgYS9jb3JlL2phdmEvYW5kcm9pZC9kYXRhYmFzZS9DdXJzb3IuamF2YSBiL2NvcmUvamF2YS9hbmRyb2lkL2RhdGFiYXNlL0N1cnNvci5qYXZhCmluZGV4IDY1MzkxNTYuLmMwM2M1ODYgMTAwNjQ0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ZVtdIGdldEJsb2JfbmF0aXZlKGludCByb3csIGludCBjb2wpOwogCiAgICAgLyoqCisgICAgICogUmV0dXJucyBkYXRhIHR5cGUgb2YgdGhlIGdpdmVuIGNvbHVtbidzIHZhbHVlLgorICAgICAqPHA+CisgICAgICogUmV0dXJuZWQgY29sdW1uIHR5cGVzIGFyZQorICAgICAqIDx1bD4KKyAgICAgKiAgIDxsaT57QGxpbmsgQ3Vyc29yI0ZJRUxEX1RZUEVfTlVMTH08L2xpPgorICAgICAqICAgPGxpPntAbGluayBDdXJzb3IjRklFTERfVFlQRV9JTlRFR0VSfTwvbGk+CisgICAgICogICA8bGk+e0BsaW5rIEN1cnNvciNGSUVMRF9UWVBFX0ZMT0FUfTwvbGk+CisgICAgICogICA8bGk+e0BsaW5rIEN1cnNvciNGSUVMRF9UWVBFX1NUUklOR308L2xpPgorICAgICAqICAgPGxpPntAbGluayBDdXJzb3IjRklFTERfVFlQRV9CTE9CfTwvbGk+CisgICAgICo8L3VsPgorICAgICAqPC9wPgorICAgICAqCisgICAgICogQHBhcmFtIHJvdyB0aGUgcm93IHRvIHJlYWQgZnJvbSwgcm93IC0gZ2V0U3RhcnRQb3NpdGlvbigpIGJlaW5nIHRoZSBhY3R1YWwgcm93IGluIHRoZSB3aW5kb3cKKyAgICAgKiBAcGFyYW0gY29sIHRoZSBjb2x1bW4gdG8gcmVhZCBmcm9tCisgICAgICogQHJldHVybiB0aGUgdmFsdWUgdHlwZQorICAgICAqLworICAgIHB1YmxpYyBpbnQgZ2V0VHlwZShpbnQgcm93LCBpbnQgY29sKSB7CisgICAgICAgIGFjcXVpcmVSZWZlcmVuY2UoKTsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIHJldHVybiBnZXRUeXBlX25hdGl2ZShyb3cgLSBtU3RhcnRQb3MsIGNvbCk7CisgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICByZWxlYXNlUmVmZXJlbmNlKCk7CisgICAgICAgIH0KKyAgICB9CisKKy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ludCByb3csIGludCBjb2wpIHsKLSAgICAgICAgYWNxdWlyZVJlZmVyZW5jZSgpOwotICAgICAgICB0cnkgewotICAgICAgICAgICAgcmV0dXJuIGlzRmxvYXRfbmF0aXZlKHJvdyAtIG1TdGFydFBvcywgY29sKTsKLSAgICAgICAgfSBmaW5hbGx5IHsKLSAgICAgICAgICAgIHJlbGVhc2VSZWZlcmVuY2UoKTsKLSAgICAgICAgfQorICAgICAgICByZXR1cm4gZ2V0VHlwZShyb3csIGNvbCkgPT0gQ3Vyc29yLkZJRUxEX1RZUEVfRkxPQVQ7CiAgICAgfQogCiAgICAgLyoqCkBAIC0zMDEsMjAgKzMxNCwxNSBAQAogICAgICAqIEBwYXJhbSByb3cgdGhlIHJvdyB0byByZWFkIGZyb20sIHJvdyAtIGdldFN0YXJ0UG9zaXRpb24oKSBiZWluZyB0aGUgYWN0dWFsIHJvdyBpbiB0aGUgd2luZG93CiAgICAgICogQHBhcmFtIGNvbCB0aGUgY29sdW1uIHRvIHJlYWQgZnJvbQogICAgICAqIEByZXR1cm4ge0Bjb2RlIHRydWV9IGlmIGdpdmVuIGZpZWxkIGlzIHtAY29kZSBOVUxMfSBvciBhIFN0cmluZworICAgICAqIEBkZXByZWNhdGVkIHVzZSB7QGxpbmsgI2dldFR5cGUoaW50LCBpbnQpfSBpbnN0ZWFkCiAgICAgICovCisgICAgQERlcHJlY2F0ZWQKICAgICBwdWJsaWMgYm9vbGVhbiBpc1N0cmluZyhpbnQgcm93LCBpbnQgY29sKSB7Ci0gICAgICAgIGFjcXVpcmVSZWZlcmVuY2UoKTsKLSAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgIHJldHVybiBpc1N0cmluZ19uYXRpdmUocm93IC0gbVN0YXJ0UG9zLCBjb2wpOwotICAgICAgICB9IGZpbmFsbHkgewotICAgICAgICAgICAgcmVsZWFzZVJlZmVyZW5jZSgpOwotICAgICAgICB9CisgICAgICAgIGludCB0eXBlID0gZ2V0VHlwZShyb3csIGNvbCk7C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JldHVybiBtQ3Vyc29yLmlzQ2xvc2VkKCk7CiAgICAgfQogCi0gICAgLyoqCi0gICAgICogQGhpZGUKLSAgICAgKiBAZGVwcmVjYXRlZAotICAgICAqLwotICAgIHB1YmxpYyBib29sZWFuIGNvbW1pdFVwZGF0ZXMoKSB7Ci0gICAgICAgIHJldHVybiBtQ3Vyc29yLmNvbW1pdFVwZGF0ZXMoKTsKLSAgICB9Ci0KLSAgICAvKioKLSAgICAgKiBAaGlkZQotICAgICAqIEBkZXByZWNhdGVkCi0gICAgICovCi0gICAgcHVibGljIGJvb2xlYW4gY29tbWl0VXBkYXRlcygKLSAgICAgICAgICAgIE1hcDw/IGV4dGVuZHMgTG9uZywgPyBleHRlbmRzIE1hcDxTdHJpbmcsIE9iamVjdD4+IHZhbHVlcykgewotICAgICAgICByZXR1cm4gbUN1cnNvci5jb21taXRVcGRhdGVzKHZhbHVlcyk7Ci0gICAgfQotCiAgICAgcHVibGljIGludCBnZXRDb3VudCgpIHsKICAgICAgICAgcmV0dXJuIG1DdXJzb3IuZ2V0Q291bnQoKTsKICAgICB9CkBAIC03NCwxNCArNTUsNiBAQAogICAgICAgICBtQ3Vyc29yLmRlYWN0aXZhdGUoKTsKICAgICB9CiAKLSAgICAvKioKLSAgICAgKiBAaGlkZQotICAgICAqIEBkZXByZWNhdGVkCi0gICAgICovCi0gICAgcHVibGljIGJvb2xlYW4gZGVsZXRlUm93KCkgewotICAgICAgICByZXR1cm4gbUN1cnNvci5kZWxldGVSb3coKTsKLSAgICB9Ci0KICAgICBwdWJsaWMgYm9vbGVhbiBtb3ZlVG9GaXJzdCgpIHsKICAgICAgICAgcmV0dXJuIG1DdXJzb3IubW92ZVRvRmlyc3QoKTsKICAgICB9CkBAIC0xNDcsMTQgKzEyMCw2IEBACiAgICAgICAgIHJldHVybiBtQ3Vyc29yLmdldFdhbnRzQWxsT25Nb3ZlQ2FsbHMoKTsKICAgICB9CiAKLSAgICAvKioKLSAgICAgKiBAaGlkZQotICAgICAqIEBkZXByZWNhdGVkCi0gICAgICovCi0gICAgcHVibGljIGJvb2xlYW4gaGFzVXBkYXRlcygpIHsKLSAgICAgICAgcmV0dXJuIG1DdXJzb3IuaGFzVXBkYXRlcygpOwotICAgIH0KLQogICAgIHB1YmxpYyBib29sZWFuIGlzQWZ0ZXJMYXN0KCkgewogICAgICAgICByZXR1cm4gbUN1cnNvci5pc0FmdGVyTGFzdCgpOwogICAgIH0KQEAgLTE3MSw2ICsxMzYsMTAgQEAKICAgICAgICAgcmV0dXJuIG1DdXJzb3IuaXNMYXN0KCk7CiAgICAgfQogCisgICAgcHVibGljIGludCBnZXRUeXBlKGludCBjb2x1bW5JbmRleCkgeworICAgICAgICByZXR1cm4gbUN1cnNvci5nZXRUeXBlKGNvbHVtbkluZGV4KTsKKyAgICB9CisKICAgICBwdWJsaWMgYm9vbGVhbiBpc051bGwoaW50IGNvbHVtbkluZGV4KSB7CiAgICAgICAgIHJldHVybiBtQ3Vyc29yLmlzTnVsbChjb2x1bW5JbmRleCk7CiAgICAgfQpAQCAtMjE5LDE0ICsxODgsNiBAQAogICAgICAgICBtQ3Vyc29yLnNldE5vdGlmaWNhdGlvblVyaShjciwgdXJpKTsgICAgICAgIAogICAgIH0KIAotICAgIC8qKgotICAgICAqIEBoaWRlCi0gICAgICogQGRlcHJlY2F0ZWQKLSAgICAgKi8KLSAgICBwdWJsaWMgYm9vbGVhbiBzdXBwb3J0c1VwZGF0ZXMoKSB7Ci0gICAgICAgIHJldHVybiBtQ3Vyc29yLnN1cHBvcnRzVXBkYXRlcygpOwotICAgIH0KLQogICAgIHB1YmxpYyB2b2lkIHVucmVnaXN0ZXJDb250ZW50T2JzZXJ2ZXIoQ29udGVudE9ic2VydmVyIG9ic2VydmVyKSB7CiAgICAgICAgIG1DdXJzb3IudW5yZWdpc3RlckNvbnRlbnRPYnNlcnZlcihvYnNlcnZlcik7ICAgICAgICAKICAgICB9CkBAIC0yMzQsNzIgKzE5NSw1IEBACiAgICAgcHVibGlj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IHsKICAgICAgICAgICAgIHZhbHVlcy5wdXQoY29sdW1uLCBjdXJzb3IuZ2V0U3RyaW5nKGluZGV4KSk7CiAgICAgICAgIH0KICAgICB9CkBAIC03MjAsOCArNzg1LDggQEAKICAgICAgKi8KICAgICBwdWJsaWMgc3RhdGljIHZvaWQgY3Vyc29yTG9uZ1RvQ29udGVudFZhbHVlc0lmUHJlc2VudChDdXJzb3IgY3Vyc29yLCBDb250ZW50VmFsdWVzIHZhbHVlcywKICAgICAgICAgICAgIFN0cmluZyBjb2x1bW4pIHsKLSAgICAgICAgZmluYWwgaW50IGluZGV4ID0gY3Vyc29yLmdldENvbHVtbkluZGV4T3JUaHJvdyhjb2x1bW4pOwotICAgICAgICBpZiAoIWN1cnNvci5pc051bGwoaW5kZXgpKSB7CisgICAgICAgIGZpbmFsIGludCBpbmRleCA9IGN1cnNvci5nZXRDb2x1bW5JbmRleChjb2x1bW4pOworICAgICAgICBpZiAoaW5kZXggIT0gLTEgJiYgIWN1cnNvci5pc051bGwoaW5kZXgpKSB7CiAgICAgICAgICAgICB2YWx1ZXMucHV0KGNvbHVtbiwgY3Vyc29yLmdldExvbmcoaW5kZXgpKTsKICAgICAgICAgfQogICAgIH0KQEAgLTczNiw4ICs4MDEsOCBAQAogICAgICAqLwogICAgIHB1YmxpYyBzdGF0aWMgdm9pZCBjdXJzb3JTaG9ydFRvQ29udGVudFZhbHVlc0lmUHJlc2VudChDdXJzb3IgY3Vyc29yLCBDb250ZW50VmFsdWVzIHZhbHVlcywKICAgICAgICAgICAgIFN0cmluZyBjb2x1bW4pIHsKLSAgICAgICAgZmluYWwgaW50IGluZGV4ID0gY3Vyc29yLmdldENvbHVtbkluZGV4T3JUaHJvdyhjb2x1bW4pOwotICAgICAgICBpZiAoIWN1cnNvci5pc051bGwoaW5kZXgpKSB7CisgICAgICAgIGZpbmFsIGludCBpbmRleCA9IGN1cnNvci5nZXRDb2x1bW5JbmRleChjb2x1bW4pOworICAgICAgICBpZiAoaW5kZXggIT0gLTEgJiYgIWN1cnNvci5pc051bGwoaW5kZXgpKSB7CiAgICAgICAgICAgICB2YWx1ZXMucHV0KGNvbHVtbiwgY3Vyc29yLmdldFNob3J0KGluZGV4KSk7CiAgICAgICAgIH0KICAgICB9CkBAIC03NTIsOCArODE3LDggQEAKICAgICAgKi8KICAgICBwdWJsaWMgc3RhdGljIHZvaWQgY3Vyc29ySW50VG9Db250ZW50VmFsdWVzSWZQcmVzZW50KEN1cnNvciBjdXJzb3IsIENvbnRlbnRWYWx1ZXMgdmFsdWVzLAogICAgICAgICAgICAgU3RyaW5nIGNvbHVtbikgewotICAgICAgICBmaW5hbCBpbnQgaW5kZXggPSBjdXJzb3IuZ2V0Q29sdW1uSW5kZXhPclRocm93KGNvbHVtbik7Ci0gICAgICAgIGlmICghY3Vyc29yLmlzTnVsbChpbmRleCkpIHsKKyAgICAgICAgZmluYWwgaW50IGluZGV4ID0gY3Vyc29yLmdldENvbHVtbkluZGV4KGNvbHVtbik7CisgICAgICAgIGlmIChpbmRleCAhPSAtMSAmJiAhY3Vyc29yLmlzTnVsbChpbmRleCkpIHsKICAgICAgICAgICAgIHZhbHVlcy5wdXQoY29sdW1uLCBjdXJzb3IuZ2V0SW50KGluZGV4KSk7CiAgICAgICAgIH0KICAgICB9CkBAIC03NjgsOCArODMzLDggQEAKICAgICAgKi8KICAgICBwdWJsaWMgc3RhdGljIHZvaWQgY3Vyc29yRmxvYXRUb0NvbnRlbnRWYWx1ZXNJZlByZXNlbnQoQ3Vyc29yIGN1cnNvciwgQ29udGVudFZhbHVlcyB2YWx1ZXMsCiAgICAgICAgICAgICBTdHJpbmcgY29sdW1uKSB7Ci0gICAgICAgIGZpbmFsIGludCBpbmRleCA9IGN1cnNvci5nZXRDb2x1bW5JbmRleE9yVGhyb3coY29sdW1uKTsKLSAgICAgICAgaWYgKCFjdXJzb3IuaXNOdWxsKGluZGV4KSkgeworICAgICAgICBmaW5hbCBpbnQgaW5kZXggPSBjdXJzb3IuZ2V0Q29sdW1uSW5kZXgoY29sdW1uKTsKKyAgICAgICAgaWYgKGluZGV4ICE9IC0xICYmICFjdXJzb3IuaXNOdWxsKGluZGV4KSkgewogICAgICAgICAgICAgdmFsdWVzLnB1dChjb2x1bW4sIGN1cnNvci5nZXRGbG9hdChpbmRleCkpOwogICAgICAgICB9CiAgICAgfQpAQCAtNzg0LDggKzg0OSw4IEBACiAgICAgICovCiAgICAgcHVibGljIHN0YXRpYyB2b2lkIGN1cnNvckRvdWJsZVRvQ29udGVudFZhbHVlc0lmUHJlc2VudChDdXJzb3IgY3Vyc29yLCBDb250ZW50VmFsdWVzIHZhbHVlcywKICAgICAgICAgICAgIFN0cmluZyBjb2x1bW4pIHsKLSAgICAgICAgZmluYWwgaW50IGluZGV4ID0gY3Vyc29yLmdldENvbHVtbkluZGV4T3JUaHJvdyhjb2x1bW4pOwotICAgICAgICBpZiAoIWN1cnNvci5pc051bGwoaW5kZXgpKSB7CisgICAgICAgIGZpbmFsIGludCBpbmRleCA9IGN1cnNvci5nZXRDb2x1bW5JbmRleChjb2x1bW4pOworICAgICAgICBpZiAoaW5kZXggIT0gLTEgJiYgIWN1cnNvci5pc051bGwoaW5kZXgpKSB7CiAgICAgICAgICAgICB2YWx1ZXMucHV0KGNvbHVtbiwgY3Vyc29yLmdldERvdWJsZShpbmRleCkpOwogICAgICAgICB9CiAgICAgfQpAQCAtMTE1Miw0ICsxMjE3LDU5IEBACiAgICAgICAgIGRiLnNldFZlcnNpb24oZGJWZXJzaW9uKTsKICAgICAgICAgZGIuY2xvc2UoKTsKICAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZXR1cm5zIG9uZSBvZiB0aGUgZm9sbG93aW5nIHdoaWNoIHJlcHJlc2VudCB0aGUgdHlwZSBvZiB0aGUgZ2l2ZW4gU1FMIHN0YXRlbWVudC4KKyAgICAgKiA8b2w+CisgICAgICogICA8bGk+e0BsaW5rICNTVEFURU1FTlRfU0VMRUNUfTwvbGk+CisgICAgICogICA8bGk+e0BsaW5rICNTVEFURU1FTlRfVVBEQVRFfTwvbGk+CisgICAgICogICA8bGk+e0BsaW5rICNTVEFURU1FTlRfQVRUQUNIfTwvbGk+CisgICAgICogICA8bGk+e0BsaW5rICNTVEFURU1FTlRfQkVHSU59PC9saT4KKyAgICAgKiAgIDxsaT57QGxpbmsgI1NUQVRFTUVOVF9DT01NSVR9PC9saT4KKyAgICAgKiAgIDxsaT57QGxpbmsgI1NUQVRFTUVOVF9BQk9SVH08L2xpPgorICAgICAqICAgPGxpPntAbGluayAjU1RBVEVNRU5UX09USEVSfTwvbGk+CisgICAgICogPC9vbD4KKyAgICAgKiBAcGFyYW0gc3FsIHRoZSBTUUwgc3RhdGVtZW50IHdob3NlIHR5cGUgaXMgcmV0dXJuZWQgYnkgdGhpcyBtZXRob2QKKyAgICAgKiBAcmV0dXJuIG9uZSBvZiB0aGUgdmFsdWVzIGxpc3RlZCBhYm92ZQorICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgaW50IGdldFNxbFN0YXRlbWVudFR5cGUoU3RyaW5nIHNxbCkgeworICAgICAgICBzcWwgPSBzcWwudHJpbSgpOworICAgICAgICBpZiAoc3FsLmxlbmd0aCgpIDwgMykgeworICAgICAgICAgICAgcmV0dXJuIFNUQVRFTUVOVF9PVEhFUjsKKyAgICAgICAgfQorICAgICAgICBTdHJpbmcgcHJlZml4U3FsID0gc3FsLnN1YnN0cmluZygwLCAzKS50b1VwcGVyQ2FzZSgpOworICAgICAgICBpZiAocHJlZml4U3FsLmVxdWFscygiU0VMIikpIHsKKyAgICAgICAgICAgIHJldHVybiBTVEFURU1FTlRfU0VMRUNUOworICAgICAgICB9IGVsc2UgaWYgKHByZWZpeFNxbC5lcXVhbHMoIklOUyIpIHx8CisgICAgICAgICAgICAgICAgcHJlZml4U3FsLmVxdWFscygiVVBEIikgfHwKKyAgICAgICAgICAgICAgICBwcmVmaXhTcWwuZXF1YWxzKCJSRVAiKSB8fAorICAgICAgICAgICAgICAgIHByZWZpeFNxbC5lcXVhbHMoIkRFTCIpKSB7CisgICAgICAgICAgICByZXR1cm4gU1RBVEVNRU5UX1VQREFURTsKKyAgICAgICAgfSBlbHNlIGlmIChwcmVmaXhTcWwuZXF1YWxzKCJBVFQiKSkgeworICAgICAgICAgICAgcmV0dXJuIFNUQVRFTUVOVF9BVFRBQ0g7CisgICAgICAgIH0gZWxzZSBpZiAocHJlZml4U3FsLmVxdWFscygiQ09NIikpIHsKKyAgICAgICAgICAgIHJldHVybiBTVEFURU1FTlRfQ09NTUlUOworICAgICAgICB9IGVsc2UgaWYgKHByZWZpeFNxbC5lcXVhbHMoIkVORCIpKSB7CisgICAgICAgICAgICByZXR1cm4gU1RBVEVNRU5UX0NPTU1JVDsKKyAgICAgICAgfSBlbHNlIGlmIChwcmVmaXhTcWwuZXF1YWxzKCJST0wiKSkgeworICAgICAgICAgICAgcmV0dXJuIFNUQVRFTUVOVF9BQk9SVDsKKyAgICAgICAgfSBlbHNlIGlmIChwcmVmaXhTcWwuZXF1YWxzKCJCRUciKSkgeworICAgICAgICAgICAgcmV0dXJuIFNUQVRFTUVOVF9CRUdJTjsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gU1RBVEVNRU5UX09USEVSOworICAgIH0KKworICAgIC8qKgorICAgICAqIEFwcGVuZHMgb25lIHNldCBvZiBzZWxlY3Rpb24gYXJncyB0byBhbm90aGVyLiBUaGlzIGlzIHVzZWZ1bCB3aGVuIGFkZGluZyBhIHNlbGVjdGlvbgorICAgICAqIGFyZ3VtZW50IHRvIGEgdXNlciBwcm92aWRlZCBzZXQuCisgICAgICovCisgICAgcHVibGljIHN0YXRpYyBTdHJpbmdbXSBhcHBlbmRTZWxlY3Rpb25BcmdzKFN0cmluZ1tdIG9yaWdpbmFsVmFsdWVzLCBTdHJpbmdbXSBuZXdWYWx1ZXMpIHsKKyAgICAgICAgaWYgKG9yaWdpbmFsVmFsdWVzID09IG51bGwgfHwgb3JpZ2luYWxWYWx1ZXMubGVuZ3RoID09IDAp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gICAgICB9CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIGRiT2JqLmNsb3NlKCk7CisgICAgICAgICAgICB9IGNhdGNoIChTUUxpdGVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgIC8qIGlnbm9yZSAqLworICAgICAgICAgICAgfQorICAgICAgICB9IGZpbmFsbHkgeworICAgICAgICAgICAgLy8gRGVsZXRlIGFsbCBmaWxlcyBvZiB0aGlzIGNvcnJ1cHQgZGF0YWJhc2UgYW5kL29yIGF0dGFjaGVkIGRhdGFiYXNlcworICAgICAgICAgICAgaWYgKGF0dGFjaGVkRGJzICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBmb3IgKFBhaXI8U3RyaW5nLCBTdHJpbmc+IHAgOiBhdHRhY2hlZERicykgeworICAgICAgICAgICAgICAgICAgICBkZWxldGVEYXRhYmFzZUZpbGUocC5zZWNvbmQpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgLy8gYXR0YWNoZWREYnMgPSBudWxsIGlzIHBvc3NpYmxlIHdoZW4gdGhlIGRhdGFiYXNlIGlzIHNvIGNvcnJ1cHQgdGhhdCBldmVuCisgICAgICAgICAgICAgICAgLy8gIlBSQUdNQSBkYXRhYmFzZV9saXN0OyIgYWxzbyBmYWlscy4gZGVsZXRlIHRoZSBtYWluIGRhdGFiYXNlIGZpbGUKKyAgICAgICAgICAgICAgICBkZWxldGVEYXRhYmFzZUZpbGUoZGJPYmouZ2V0UGF0aCgpKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBkZWxldGVEYXRhYmFzZUZpbGUoU3RyaW5nIGZpbGVOYW1lKSB7CisgICAgICAgIGlmIChmaWxlTmFtZS5lcXVhbHNJZ25vcmVDYXNlKCI6bWVtb3J5OiIpIHx8IGZpbGVOYW1lLnRyaW0oKS5sZW5ndGgoKSA9PSAwKSB7Cisg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tYmVyIGdlbmVyYXRvciB1c2VkIHRvIHBpY2sgYSBmcmVlIGNvbm5lY3Rpb24gb3V0IG9mIHRoZSBwb29sICovCisgICAgcHJpdmF0ZSBSYW5kb20gcmFuZDsgLy8gbGF6aWx5IGluaXRpYWxpemVkCisKKyAgICAvKiBwYWNrYWdlICovIERhdGFiYXNlQ29ubmVjdGlvblBvb2woU1FMaXRlRGF0YWJhc2UgZGIpIHsKKyAgICAgICAgdGhpcy5tUGFyZW50RGJPYmogPSBkYjsKKyAgICAgICAgaWYgKExvZy5pc0xvZ2dhYmxlKFRBRywgTG9nLkRFQlVHKSkgeworICAgICAgICAgICAgTG9nLmQoVEFHLCAiTWF4IFBvb2wgU2l6ZTogIiArIG1NYXhQb29sU2l6ZSk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBjbG9zZSBhbGwgZGF0YWJhc2UgY29ubmVjdGlvbnMgaW4gdGhlIHBvb2wgLSBldmVuIGlmIHRoZXkgYXJlIGluIHVzZSEKKyAgICAgKi8KKyAgICAvKiBwYWNrYWdlICovIHZvaWQgY2xvc2UoKSB7CisgICAgICAgIHN5bmNocm9uaXplZChtUGFyZW50RGJPYmopIHsKKyAgICAgICAgICAgIGlmIChMb2cuaXNMb2dnYWJsZShUQUcsIExvZy5ERUJVRykpIHsKKyAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJDbG9zaW5nIHRoZSBjb25uZWN0aW9uIHBvb2wgb24gIiArIG1QYXJlbnREYk9iai5nZXRQYXRoKCkgKyB0b1N0cmluZygpKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGZvciAoaW50IGkgPSBtUG9vbC5zaXplKCkgLSAxOyBpID49IDA7IGktLSkgeworICAgICAgICAgICAgICAgIG1Qb29sLmdldChpKS5tRGIuY2xvc2UoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1Qb29sLmNsZWFyKCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBnZXQgYSBmcmVlIGNvbm5lY3Rpb24gZnJvbSB0aGUgcG9vbAorICAgICAqCisgICAgICogQHBhcmFtIHNxbCBpZiBub3QgbnVsbCwgdHJ5IHRvIGZpbmQgYSBjb25uZWN0aW9uIGludGhlIHBvb2wgd2hpY2ggYWxyZWFkeSBoYXMgY2FjaGVkCisgICAgICogdGhlIGNvbXBpbGVkIHN0YXRlbWVudCBmb3IgdGhpcyBzcWwuCisgICAgICogQHJldHVybiB0aGUgRGF0YWJhc2UgY29ubmVjdGlvbiB0aGF0IHRoZSBjYWxsZXIgY2FuIHVzZQorICAgICAqLworICAgIC8qIHBhY2thZ2UgKi8gU1FMaXRlRGF0YWJhc2UgZ2V0KFN0cmluZyBzcWwpIHsKKyAgICAgICAgU1FMaXRlRGF0YWJhc2UgZGIgPSBudWxsOworICAgICAgICBQb29sT2JqIHBvb2xPYmogPSBudWxsOworICAgICAgICBzeW5jaHJvbml6ZWQobVBhcmVudERiT2JqKSB7CisgICAgICAgICAgICBpbnQgcG9vbFNpemUgPSBtUG9vbC5zaXplKCk7CisgICAgICAgICAgICBpZiAoTG9nLmlzTG9nZ2FibGUoVEFHLCBMb2cuREVCVUcpKSB7CisgICAgICAgICAgICAgICAgYXNzZXJ0IHNxbCAhPSBudWxsOworICAgICAgICAgICAgICAgIGRvQXNzZXJ0cygpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKGdldEZyZWVQb29sU2l6ZSgpID09IDApIHsKKyAgICAgICAgICAgICAgICAvLyBubyBmcmVlICggPSBhdmFpbGFibGUpIGNvbm5lY3Rpb25zCisgICAgICAgICAgICAgICAgaWYgKG1NYXhQb29sU2l6ZSA9PSBwb29sU2l6ZSkgeworICAgICAgICAgICAgICAgICAgICAvLyBtYXhlZCBvdXQuIGNhbid0IG9wZW4gYW55IG1vcmUgY29ubmVjdGlvbnMuCisgICAgICAgICAgICAgICAgICAgIC8vIGxldCB0aGUgY2FsbGVyIHdhaXQgb24gb25lIG9mIHRoZSBwb29sZWQgY29ubmVjdGlvbnMKKyAgICAgICAgICAgICAgICAgICAgLy8gcHJlZmVyYWJseSBhIGNvbm5lY3Rpb24gY2FjaGluZyB0aGUgcHJlLWNvbXBpbGVkIHN0YXRlbWVudCBvZiB0aGUgZ2l2ZW4gU1FMCisgICAgICAgICAgICAgICAgICAgIGlmIChtTWF4UG9vbFNpemUgPT0gMSkgeworICAgICAgICAgICAgICAgICAgICAgICAgcG9vbE9iaiA9IG1Qb29sLmdldCgwKTsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbU1heFBvb2xTaXplOyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobVBvb2wuZ2V0KGkpLm1EYi5pc1NxbEluU3RhdGVtZW50Q2FjaGUoc3FsKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwb29sT2JqID0gbVBvb2wuZ2V0KGkpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAocG9vbE9iaiA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gdGhlcmUgYXJlIG5vIGRhdGFiYXNlIGNvbm5lY3Rpb25zIHdpdGggdGhlIGdpdmVuIFNRTCBwcmUtY29tcGlsZWQuCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gb2sgdG8gcmV0dXJuIGFueSBvZiB0aGUgY29ubmVjdGlvbnMuCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHJhbmQgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByYW5kID0gbmV3IFJhbmRvbShTeXN0ZW1DbG9jay5lbGFwc2VkUmVhbHRpbWUoKSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBvb2xPYmogPSBtUG9vbC5nZXQocmFuZC5uZXh0SW50KG1NYXhQb29sU2l6ZSkpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGRiID0gcG9vbE9iai5tRGI7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gY3JlYXRlIGEgbmV3IGNvbm5lY3Rpb24gYW5kIGFkZCBpdCB0byB0aGUgcG9vbCwgc2luY2Ugd2UgaGF2ZW4ndCByZWFjaGVkCisgICAgICAgICAgICAgICAgICAgIC8vIG1heCBwb29sIHNpemUgYWxsb3dlZAorICAgICAgICAgICAgICAgICAgICBkYiA9IG1QYXJlbnREYk9iai5jcmVhdGVQb29sQ29ubmVjdGlvbigoc2hvcnQpKHBvb2xTaXplICsgMSkpOworICAgICAgICAgICAgICAgICAgICBwb29sT2JqID0gbmV3IFBvb2xPYmooZGIpOworICAgICAgICAgICAgICAgICAgICBtUG9vbC5hZGQocG9vbFNpemUsIHBvb2xPYmopOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgLy8gdGhlcmUgYXJlIGZyZWUgY29ubmVjdGlvbnMgYXZhaWxhYmxlLiBwaWNrIG9uZQorICAgICAgICAgICAgICAgIC8vIHByZWZlcmFibHkgYSBjb25uZWN0aW9uIGNhY2hpbmcgdGhlIHByZS1jb21waWxlZCBzdGF0ZW1lbnQgb2YgdGhlIGdpdmVuIFNRTAorICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgcG9vbFNpemU7IGkrKykgeworICAgICAgICAgICAgICAgICAgICBpZiAobVBvb2wuZ2V0KGkpLmlzRnJlZSgpICYmIG1Qb29sLmdldChpKS5tRGIuaXNTcWxJblN0YXRlbWVudENhY2hlKHNxbCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHBvb2xPYmogPSBtUG9vbC5nZXQoaSk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBpZiAocG9vbE9iaiA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIC8vIGRpZG4ndCBmaW5kIGEgZnJlZSBkYXRhYmFzZSBjb25uZWN0aW9uIHdpdGggdGhlIGdpdmVuIFNRTCBhbHJlYWR5CisgICAgICAgICAgICAgICAgICAgIC8vIHByZS1jb21waWxlZC4gcmV0dXJuIGEgZnJlZSBjb25uZWN0aW9uICh0aGlzIG1lYW5zLCB0aGUgc2FtZSBTUUwgY291bGQgYmUKKyAgICAgICAgICAgICAgICAgICAgLy8gcHJlLWNvbXBpbGVkIG9uIG1vcmUgdGhhbiBvbmUgZGF0YWJhc2UgY29ubmVjdGlvbi4gcG90ZW50aWFsIHdhc3RlZCBtZW1vcnkuKQorICAgICAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IHBvb2xTaXplOyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtUG9vbC5nZXQoaSkuaXNGcmVlKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBwb29sT2JqID0gbVBvb2wuZ2V0KGkpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGRiID0gcG9vbE9iai5tRGI7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGFzc2VydCBwb29sT2JqICE9IG51bGw7CisgICAgICAgICAgICBhc3NlcnQgcG9vbE9iai5tRGIgPT0gZGI7CisKKyAgICAgICAgICAgIHBvb2xPYmouYWNxdWlyZSgpOworICAgICAgICB9CisKKyAgICAgICAgaWYgKExvZy5pc0xvZ2dhYmxlKFRBRywgTG9nLkRFQlVHKSkgeworICAgICAgICAgICAgTG9nLmQoVEFHLCAiRU5EIGdldC1jb25uZWN0aW9uOiAiICsgdG9TdHJpbmcoKSArIHBvb2xPYmoudG9TdHJpbmcoKSk7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGRiOworICAgICAgICAvLyBUT0RPIGlmIGEgdGhyZWFkIGFjcXVpcmVzIGEgY29ubmVjdGlvbiBhbmQgZGllcyB3aXRob3V0IHJlbGVhc2luZyB0aGUgY29ubmVjdGlvbiwgdGhlbgorICAgICAgICAvLyB0aGVyZSBjb3VsZCBiZSBhIGNvbm5lY3Rpb24gbGVhay4KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiByZWxlYXNlIHRoZSBnaXZlbiBkYXRhYmFzZSBjb25uZWN0aW9uIGJhY2sgdG8gdGhlIHBvb2wuCisgICAgICogQHBhcmFtIGRiIHRoZSBjb25uZWN0aW9uIHRvIGJlIHJlbGVhc2VkCisgICAgICovCisgICAgLyogcGFja2FnZSAqLyB2b2lkIHJlbGVhc2UoU1FMaXRlRGF0YWJhc2UgZGIpIHsKKyAgICAgICAgUG9vbE9iaiBwb29sT2JqOworICAgICAgICBzeW5jaHJvbml6ZWQobVBhcmVudERiT2JqKSB7CisgICAgICAgICAgICBpZiAoTG9nLmlzTG9nZ2FibGUoVEFHLCBMb2cuREVCVUcpKSB7CisgICAgICAgICAgICAgICAgYXNzZXJ0IGRiLm1Db25uZWN0aW9uTnVtID4gMDsKKyAgICAgICAgICAgICAgICBkb0Fzc2VydHMoKTsKKyAgICAgICAgICAgICAgICBhc3NlcnQgbVBvb2wuZ2V0KGRiLm1Db25uZWN0aW9uTnVtIC0gMSkubURiID09IGRiOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBwb29sT2JqID0gbVBvb2wuZ2V0KGRiLm1Db25uZWN0aW9uTnVtIC0gMSk7CisKKyAgICAgICAgICAgIGlmIChMb2cuaXNMb2dnYWJsZShUQUcsIExvZy5ERUJVRykpIHsKKyAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJCRUdJTiByZWxlYXNlLWNvbm46ICIgKyB0b1N0cmluZygpICsgcG9vbE9iai50b1N0cmluZygpKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKHBvb2xPYmouaXNGcmVlKCkpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJSZWxlYXNpbmcgb2JqZWN0IGFscmVhZHkgZnJlZWQ6ICIgKworICAgICAgICAgICAgICAgICAgICAgICAgZGIubUNvbm5lY3Rpb25OdW0pOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBwb29sT2JqLnJlbGVhc2UoKTsKKyAgICAgICAgfQorCisgICAgICAgIGlmIChMb2cuaXNMb2dnYWJsZShUQUcsIExvZy5ERUJVRykpIHsKKyAgICAgICAgICAgIExvZy5kKFRBRywgIkVORCByZWxlYXNlLWNvbm46ICIgKyB0b1N0cmluZygpICsgcG9vbE9iai50b1N0cmluZygpKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIFJldHVybnMgYSBsaXN0IG9mIGFsbCBkYXRhYmFzZSBjb25uZWN0aW9ucyBpbiB0aGUgcG9vbCAoYm90aCBmcmVlIGFuZCBidXN5IGNvbm5lY3Rpb25zKS4KKyAgICAgKiBUaGlzIG1ldGhvZCBpcyB1c2VkIHdoZW4gImFkYiBidWdyZXBvcnQiIGlzIGRvbmUuCisgICAgICovCisgICAgLyogcGFja2FnZSAqLyBBcnJheUxpc3Q8U1FMaXRlRGF0YWJhc2U+IGdldENvbm5lY3Rpb25MaXN0KCkgeworICAgICAgICBBcnJheUxpc3Q8U1FMaXRlRGF0YWJhc2U+IGxpc3QgPSBuZXcgQXJyYXlMaXN0PFNRTGl0ZURhdGFiYXNlPigpOworICAgICAgICBzeW5jaHJvbml6ZWQobVBhcmVudERiT2JqKSB7CisgICAgICAgICAgICBmb3IgKGludCBpID0gbVBvb2wuc2l6ZSgpIC0gMTsgaSA+PSAwOyBpLS0pIHsKKyAgICAgICAgICAgICAgICBsaXN0LmFkZChtUG9vbC5nZXQoaSkubURiKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbGlzdDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBwYWNrYWdlIGxldmVsIGFjY2VzcyBmb3IgdGVzdGluZyBwdXJwb3NlcyBvbmx5LiBvdGhlcndpc2UsIHByaXZhdGUgc2hvdWxkIGJlIHN1ZmZpY2llbnQuCisgICAgICovCisgICAgLyogcGFja2FnZSAqLyBpbnQgZ2V0RnJlZVBvb2xTaXplKCkgeworICAgICAgICBpbnQgY291bnQgPSAwOworICAgICAgICBmb3IgKGludCBpID0gbVBvb2wuc2l6ZSgpIC0gMTsgaSA+PSAwOyBpLS0pIHsKKyAgICAgICAgICAgIGlmIChtUG9vbC5nZXQoaSkuaXNGcmVlKCkpIHsKKyAgICAgICAgICAgICAgICBjb3VudCsrOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiBjb3VudCsrOworICAgIH0KKworICAgIC8qKgorICAgICAqIG9ubHkgZm9yIHRlc3RpbmcgcHVycG9zZXMKKyAgICAgKi8KKyAgICAvKiBwYWNrYWdlICovIEFycmF5TGlzdDxQb29sT2JqPiBnZXRQb29sKCkgeworICAgICAgICByZXR1cm4gbVBvb2w7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIFN0cmluZyB0b1N0cmluZygpIHsKKyAgICAgICAgU3RyaW5nQnVpbGRlciBidWZmID0gbmV3IFN0cmluZ0J1aWxkZXIoKTsKKyAgICAgICAgYnVmZi5hcHBlbmQoImRiOiAiKTsKKyAgICAgICAgYnVmZi5hcHBlbmQobVBhcmVudERiT2JqLmdldFBhdGgoKSk7CisgICAgICAgIGJ1ZmYuYXBwZW5kKCIsIHRvdGFsc2l6ZSA9ICIpOworICAgICAgICBidWZmLmFwcGVuZChtUG9vbC5zaXplKCkpOworICAgICAgICBidWZmLmFwcGVuZCgiLCAjZnJlZSA9ICIpOworICAgICAgICBidWZmLmFwcGVuZChnZXRGcmVlUG9vbFNpemUoKSk7CisgICAgICAgIGJ1ZmYuYXBwZW5kKCIsIG1heHBvb2xzaXplID0gIik7CisgICAgICAgIGJ1ZmYuYXBwZW5kKG1NYXhQb29sU2l6ZSk7CisgICAgICAgIGZvciAoUG9vbE9iaiBwIDogbVBvb2wpIHsKKyAgICAgICAgICAgIGJ1ZmYuYXBwZW5kKCJcbiIpOworICAgICAgICAgICAgYnVmZi5hcHBlbmQocC50b1N0cmluZygpKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gYnVmZi50b1N0cmluZygpOworICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBkb0Fzc2VydHMoKSB7CisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbVBvb2wuc2l6ZSgpOyBpKyspIHsKKyAgICAgICAgICAgIG1Qb29sLmdldChpKS52ZXJpZnkoKTsKKyAgICAgICAgICAgIGFzc2VydCBtUG9vbC5nZXQoaSkubURiLm1Db25uZWN0aW9uTnVtID09IChpICsgMSk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKiBwYWNrYWdlICovIHZvaWQgc2V0TWF4UG9vbFNpemUoaW50IHNpemUpIHsKKyAgICAgICAgc3luY2hyb25pemVkKG1QYXJlbnREYk9iaikgeworICAgICAgICAgICAgbU1heFBvb2xTaXplID0gc2l6ZTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qIHBhY2thZ2UgKi8gaW50IGdldE1heFBvb2xTaXplKCkgeworICAgICAgICBzeW5jaHJvbml6ZWQobVBhcmVudERiT2JqKSB7CisgICAgICAgICAgICByZXR1cm4gbU1heFBvb2xTaXplOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqIG9ubH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nIHRoaXMgY29ubmVjdGlvbi4KKyAgICAgICAgICogdXNlZCBmb3IgZGVidWdnaW5nIHB1cnBvc2VzIG9ubHkuCisgICAgICAgICAqLworICAgICAgICAvLyBAR3VhcmRlZEJ5KCJ0aGlzIikKKyAgICAgICAgcHJpdmF0ZSBIYXNoU2V0PExvbmc+IG1Ib2xkZXJJZHMgPSBuZXcgSGFzaFNldDxMb25nPigpOworCisgICAgICAgIHB1YmxpYyBQb29sT2JqKFNRTGl0ZURhdGFiYXNlIGRiKSB7CisgICAgICAgICAgICBtRGIgPSBkYjsKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgc3luY2hyb25pemVkIHZvaWQgYWNxdWlyZSgpIHsKKyAgICAgICAgICAgIGlmIChMb2cuaXNMb2dnYWJsZShUQUcsIExvZy5ERUJVRykpIHsKKyAgICAgICAgICAgICAgICBhc3NlcnQgaXNGcmVlKCk7CisgICAgICAgICAgICAgICAgbG9uZyBpZCA9IFRocmVhZC5jdXJyZW50VGhyZWFkKCkuZ2V0SWQoKTsKKyAgICAgICAgICAgICAgICBhc3NlcnQgIW1Ib2xkZXJJZHMuY29udGFpbnMoaWQpOworICAgICAgICAgICAgICAgIG1Ib2xkZXJJZHMuYWRkKGlkKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgbU51bUhvbGRlcnMrKzsKKyAgICAgICAgICAgIG1GcmVlQnVzeUZsYWcgPSBCVVNZOworICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSBzeW5jaHJvbml6ZWQgdm9pZCByZWxlYXNlKCkgeworICAgICAgICAgICAgaWYgKExvZy5pc0xvZ2dhYmxlKFRBRywgTG9nLkRFQlVHKSkgeworICAgICAgICAgICAgICAgIGxvbmcgaWQgPSBUaHJlYWQuY3VycmVudFRocmVhZCgpLmdldElkKCk7CisgICAgICAgICAgICAgICAgYXNzZXJ0IG1Ib2xkZXJJZHMuc2l6ZSgpID09IG1OdW1Ib2xkZXJzOworICAgICAgICAgICAgICAgIGFzc2VydCBtSG9sZGVySWRzLmNvbnRhaW5zKGlkKTsKKyAgICAgICAgICAgICAgICBtSG9sZGVySWRzLnJlbW92ZShpZCk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIG1OdW1Ib2xkZXJzLS07CisgICAgICAgICAgICBpZiAobU51bUhvbGRlcnMgPT0gMCkgeworICAgICAgICAgICAgICAgIG1GcmVlQnVzeUZsYWcgPSBGUkVFOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSBzeW5jaHJvbml6ZWQgYm9vbGVhbiBpc0ZyZWUoKSB7CisgICAgICAgICAgICBpZiAoTG9nLmlzTG9nZ2FibGUoVEFHLCBMb2cuREVCVUcpKSB7CisgICAgICAgICAgICAgICAgdmVyaWZ5KCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gKG1GcmVlQnVzeUZsYWcgPT0gRlJFRSk7CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIHN5bmNocm9uaXplZCB2b2lkIHZlcmlmeSgpIHsKKyAgICAgICAgICAgIGlmIChtRnJlZUJ1c3lGbGFnID09IEZSRUUpIHsKKyAgICAgICAgICAgICAgICBhc3NlcnQgbU51bUhvbGRlcnMgPT0gMDsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgYXNzZXJ0IG1OdW1Ib2xkZXJzID4gMDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIC8qKgorICAgICAgICAgKiBvbmx5IGZvciB0ZXN0aW5nIHB1cnBvc2VzCisgICAgICAgICAqLworICAgICAgICAvKiBwYWNrYWdlICovIHN5bmNocm9uaXplZCBpbnQgZ2V0TnVtSG9sZGVycygpIHsKKyAgICAgICAgICAgIHJldHVybiBtTnVtSG9sZGVyczsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgU3RyaW5nIHRvU3RyaW5nKCkgeworICAgICAgICAg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ByZXZpb3VzbHkKLSAgICAgICAgICAgICAgICAvLyBleGlzdGluZyBwcm9ncmFtcyBiZWZvcmUgaXQgY29tcGlsZXMuCi0gICAgICAgICAgICAgICAgbmF0aXZlX2NvbXBpbGUoc3FsKTsKLSAgICAgICAgICAgIH0gZmluYWxseSB7Ci0gICAgICAgICAgICAgICAgbURhdGFiYXNlLnVubG9jaygpOwotICAgICAgICAgICAgfQorICAgICAgICAgICAgLy8gTm90ZSB0aGF0IHRoZSBuYXRpdmVfY29tcGlsZSgpIHRha2VzIGNhcmUgb2YgZGVzdHJveWluZyBhbnkgcHJldmlvdXNseQorICAgICAgICAgICAgLy8gZXhpc3RpbmcgcHJvZ3JhbXMgYmVmb3JlIGl0IGNvbXBpbGVzLgorICAgICAgICAgICAgbmF0aXZlX2NvbXBpbGUoc3FsKTsKICAgICAgICAgfQogICAgIH0KIApAQCAtMTAyLDEzICs5NSw4IEBACiAgICAgICAgICAgICBpZiAoU1FMaXRlRGVidWcuREVCVUdfQUNUSVZFX0NVUlNPUl9GSU5BTElaQVRJT04pIHsKICAgICAgICAgICAgICAgICBMb2cudihUQUcsICJjbG9zZWQgYW5kIGRlYWxsb2NhdGVkIERiT2JqIChpZCMiICsgblN0YXRlbWVudCArIikiKTsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICAgICAgbURhdGFiYXNlLmxvY2soKTsKLSAgICAgICAgICAgICAgICBuYXRpdmVfZmluYWxpemUoKTsKLSAgICAgICAgICAgICAgICBuU3RhdGVtZW50ID0gMDsKLSAgICAgICAgICAgIH0gZmluYWxseSB7Ci0gICAgICAgICAgICAgICAgbURhdGFiYXNlLnVubG9jaygpOwotICAgICAgICAgICAgfQorICAgICAgICAgICAgbURhdGFiYXNlLmZpbmFsaXplU3RhdGVtZW50TGF0ZXIoblN0YXRlbWVudCk7CisgICAgICAgICAgICBuU3RhdGVtZW50ID0gMDsKICAgICAgICAgfQogICAgIH0KIApAQCAtMTM0LDYgKzEyMiwxMCBAQAogICAgICAgICBtSW5Vc2UgPSBmYWxzZTsKICAgICB9CiAKKyAgICAvKiBwYWNrYWdlICovIHN5bmNocm9uaXplZCBib29sZWFuIGlzSW5Vc2UoKSB7CisgICAgICAgIHJldHVybiBtSW5Vc2U7CisgICAgfQorCiAgICAgLyoqCiAgICAgICogTWFrZSBzdXJlIHRoYXQgdGhlIG5hdGl2ZSByZXNvdXJjZSBpcyBjbGVhbmVkIHVwLgogICAgICAqLwpAQCAtMTQyLDkgKzEzNCw2IEBACiAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICBpZiAoblN0YXRlbWVudCA9PSAwKSByZXR1cm47CiAgICAgICAgICAgICAvLyBmaW5hbGl6ZXIgc2hvdWxkIE5FVkVSIGdldCBjYWxsZWQKLSAgICAgICAgICAgIGlmIChTUUxpdGVEZWJ1Zy5ERUJVR19BQ1RJVkVfQ1VSU09SX0ZJTkFMSVpBVElPTikgewotICAgICAgICAgICAgICAgIExvZy52KFRBRywgIioqIHdhcm5pbmcgKiogRmluYWxpemVkIERiT2JqIChpZCMiICsgblN0YXRlbWVudCArICIpIik7Ci0gICAgICAgICAgICB9CiAgICAgICAgICAgICBpbnQgbGVuID0gbVNxbFN0bXQubGVuZ3RoKCk7CiAgICAgICAgICAgICBMb2cudyhUQUcsICJSZWxlYXNpbmcgc3RhdGVtZW50IGluIGEgZmluYWxpemVyLiBQbGVhc2UgZW5zdXJlICIgKwogICAgICAgICAgICAgICAgICAgICAidGhhdCB5b3UgZXhwbGljaXRseSBjYWxsIGNsb3NlKCkgb24geW91ciBjdXJzb3I6ICIgKwpAQCAtMTU1LDYgKzE0NCwyMiBAQAogICAgICAgICB9CiAgICAgfQogCisgICAgQE92ZXJyaWRlIHB1YmxpYyBTdHJpbmcgdG9TdHJpbmcoKSB7CisgICAgICAgIHN5bmNocm9uaXplZCh0aGlzKSB7CisgICAgICAgICAgICBTdHJpbmdCdWlsZGVyIGJ1ZmYgPSBuZXcgU3RyaW5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vY2sgbUxvY2sgPSBudWxsOwogICAgIHByaXZhdGUgYm9vbGVhbiBtUGVuZGluZ0RhdGEgPSBmYWxzZTsKKworICAgIC8qKgorICAgICAqIFVzZWQgYnkge0BsaW5rICNyZXF1ZXJ5KCl9IHRvIHJlbWVtYmVyIGZvciB3aGljaCBkYXRhYmFzZSB3ZSd2ZSBhbHJlYWR5IHNob3duIHRoZSB3YXJuaW5nLgorICAgICAqLworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIEhhc2hNYXA8U3RyaW5nLCBCb29sZWFuPiBzQWxyZWFkeVdhcm5lZCA9IG5ldyBIYXNoTWFwPFN0cmluZywgQm9vbGVhbj4oKTsKICAgICAKICAgICAvKioKICAgICAgKiAgc3VwcG9ydCBmb3IgYSBjdXJzb3IgdmFyaWFudCB0aGF0IGRvZXNuJ3QgYWx3YXlzIHJlYWQgYWxsIHJlc3VsdHMKQEAgLTEzNiw3ICsxMzcsNyBAQAogICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgICAgICAgaW50IGNvdW50ID0gbVF1ZXJ5LmZpbGxXaW5kb3coY3csIG1NYXhSZWFkLCBtQ291bnQpOworICAgICAgICAgICAgICAgICAgICBpbnQgY291bnQgPSBnZXRRdWVyeSgpLmZpbGxXaW5kb3coY3csIG1NYXhSZWFkLCBtQ291bnQpOwogICAgICAgICAgICAgICAgICAgICAvLyByZXR1cm4gLTEgbWVhbnMgbm90IGZpbmlzaGVkCiAgICAgICAgICAgICAgICAgICAgIGlmIChjb3VudCAhPSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY291bnQgPT0gTk9fQ09VTlQpewpAQCAtMjAxLDI0ICsyMDIsNDYgQEAKICAgICAgKiBoYXMgcGFja2FnZSBzY29wZS4KICAgICAgKgogICAgICAqIEBwYXJhbSBkYiBhIHJlZmVyZW5jZSB0byBhIERhdGFiYXNl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maWxsSW5TdGFja1RyYWNlKCk7Ci0gICAgICAgIG1EYXRhYmFzZSA9IGRiOwogICAgICAgICBtRHJpdmVyID0gZHJpdmVyOwogICAgICAgICBtRWRpdFRhYmxlID0gZWRpdFRhYmxlOwogICAgICAgICBtQ29sdW1uTmFtZU1hcCA9IG51bGw7CiAgICAgICAgIG1RdWVyeSA9IHF1ZXJ5OwogCiAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICBkYi5sb2NrKCk7CisgICAgICAgICAgICBxdWVyeS5tRGF0YWJhc2UubG9jaygpOwogCiAgICAgICAgICAgICAvLyBTZXR1cCB0aGUgbGlzdCBvZiBjb2x1bW5zCiAgICAgICAgICAgICBpbnQgY29sdW1uQ291bnQgPSBtUXVlcnkuY29sdW1uQ291bnRMb2NrZWQoKTsKQEAgLTIzOSw3ICsyNjIsNyBAQAogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgfSBmaW5hbGx5IHsKLSAgICAgICAgICAgIGRiLnVubG9jaygpOworICAgICAgICAgICAgcXVlcnkubURhdGFiYXNlLnVubG9jaygpOwogICAgICAgICB9CiAgICAgfQogCkBAIC0yNDcsNyArMjcwLDkgQEAKICAgICAgKiBAcmV0dXJuIHRoZSBTUUxpdGVEYXRhYmFzZSB0aGF0IHRoaXMgY3Vyc29yIGlzIGFzc29jaWF0ZWQgd2l0aC4KICAgICAgKi8KICAgICBwdWJsaWMgU1FMaXRlRGF0YWJhc2UgZ2V0RGF0YWJhc2UoKSB7Ci0gICAgICAgIHJldHVybiBtRGF0YWJhc2U7CisgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgeworICAgICAgICAgICAgcmV0dXJuIG1RdWVyeS5tRGF0YWJhc2U7CisgICAgICAgIH0KICAgICB9CiAKICAgICBAT3ZlcnJpZGUKQEAgLTI4Myw3ICszMDgsNyBAQAogICAgICAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgICAgICBtV2luZG93LnNldFN0YXJ0UG9zaXRpb24oc3RhcnRQb3MpOwotICAgICAgICBtQ291bnQgPSBtUXVlcnkuZmlsbFdpbmRvdyhtV2luZG93LCBtSW5pdGlhbFJlYWQsIDApOworICAgICAgICBtQ291bnQgPSBnZXRRdWVyeSgpLmZpbGxXaW5kb3cobVdpbmRvdywgbUluaXRpYWxSZWFkLCAwKTsKICAgICAgICAgLy8gcmV0dXJuIC0xIG1lYW5zIG5vdCBmaW5pc2hlZAogICAgICAgICBpZiAobUNvdW50ID09IE5PX0NPVU5UKXsKICAgICAgICAgICAgIG1Db3VudCA9IHN0YXJ0UG9zICsgbUluaXRpYWxSZWFkOwpAQCAtMjkyLDYgKzMxNywxMCBAQAogICAgICAgICB9IAogICAgIH0KIAorICAgIHByaXZhdGUgc3luY2hyb25pemVkIFNRTGl0ZVF1ZXJ5IGdldFF1ZXJ5KCkgeworICAgICAgICByZXR1cm4gbVF1ZXJ5OworICAgIH0KKwogICAgIEBPdmVycmlkZQogICAgIHB1YmxpYyBpbnQgZ2V0Q29sdW1uSW5kZXgoU3RyaW5nIGNvbHVtbk5hbWUpIHsKICAgICAgICAgLy8gQ3JlYXRlIG1Db2x1bW5OYW1lTWFwIG9uIGRlbWFuZApAQCAtMzIxLDE2NiArMzUwLDExIEBACiAgICAgICAgIH0KICAgICB9CiAKLSAgICAvKioKLSAgICAgKiBAaGlkZQotICAgICAqIEBkZXByZWNhdGVkCi0gICAgICovCi0gICAgQE92ZXJyaWRlCi0gICAgcHVibGljIGJvb2xlYW4gZGVsZXRlUm93KCkgewotICAgICAgICBjaGVja1Bvc2l0aW9uKCk7Ci0KLSAgICAgICAgLy8gT25seSBhbGxvdyBkZWxldGVzIGlmIHRoZXJlIGlzIGFuIElEIGNvbHVtbiwgYW5kIHRoZSBJRCBoYXMgYmVlbiByZWFkIGZyb20gaXQKLSAgICAgICAgaWYgKG1Sb3dJZENvbHVtbkluZGV4ID09IC0xIHx8IG1DdXJyZW50Um93SUQgPT0gbnVsbCkgewotICAgICAgICAgICAgTG9n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KLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgaW50IHBvcyA9IG1Qb3M7Ci0gICAgICAgICAgICByZXF1ZXJ5KCk7Ci0KLSAgICAgICAgICAgIC8qCi0gICAgICAgICAgICAgKiBFbnN1cmUgcHJvcGVyIGN1cnNvciBzdGF0ZS4gTm90ZSB0aGF0IG1DdXJyZW50Um93SUQgY2hhbmdlcwotICAgICAgICAgICAgICogaW4gdGhpcyBjYWxsLgotICAgICAgICAgICAgICovCi0gICAgICAgICAgICBtb3ZlVG9Qb3NpdGlvbihwb3MpOwotICAgICAgICB9IGZpbmFsbHkgewotICAgICAgICAgICAgbURhdGFiYXNlLnVubG9jaygpOwotICAgICAgICB9Ci0KLSAgICAgICAgaWYgKHN1Y2Nlc3MpIHsKLSAgICAgICAgICAgIG9uQ2hhbmdlKHRydWUpOwotICAgICAgICAgICAgcmV0dXJuIHRydWU7Ci0gICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgIH0KLSAgICB9Ci0KICAgICBAT3ZlcnJpZGUKICAgICBwdWJsaWMgU3RyaW5nW10gZ2V0Q29sdW1uTmFtZXMoKSB7CiAgICAgICAgIHJldHVybiBtQ29sdW1uczsKICAgICB9CiAKLSAgICAvKioKLSAgICAgKiBAaGlkZQotICAgICAqIEBkZXByZWNhdGVkCi0gICAgICovCi0gICAgQE92ZXJyaWRlCi0gICAgcHVibGljIGJvb2xlYW4gc3VwcG9ydHNVcGRhdGVzKCkgewotICAgICAgICByZXR1cm4gc3VwZXIuc3VwcG9ydHNVcGRhdGVzKCkgJiYgIVRleHRVdGlscy5pc0VtcHR5KG1FZGl0VGFibGUpOwotICAgIH0KLQotICAgIC8qKgotICAgICAqIEBoaWRlCi0gICAgICogQGRlcHJlY2F0ZWQKLSAgICAgKi8KLSAgICBAT3ZlcnJpZGUKLSAgICBwdWJsaWMgYm9vbGVhbiBjb21taXRVcGRhdGVzKE1hcDw/IGV4dGVuZHMgTG9uZywKLSAgICAgICAgICAgID8gZXh0ZW5kcyBNYXA8U3RyaW5nLCBPYmplY3Q+PiBhZGRpdGlvbmFsVmFsdWVzKSB7Ci0gICAgICAgIGlmICghc3VwcG9ydHNVcGRhdGVzKCkpIHsKLSAgICAgICAgICAgIExvZy5lKFRBRywgImNvbW1pdFVwZGF0ZXMgbm90IHN1cHBvcnRlZCBvbiB0aGlzIGN1cnNvciwgZGlkIHlvdSAiCi0gICAgICAgICAgICAgICAgICAgICsgImluY2x1ZGUgdGhlIF9pZCBjb2x1bW4/Iik7Ci0gICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgIH0KLQotICAgICAgICAvKgotICAgICAgICAgKiBQcmV2ZW50IG90aGVyIHRocmVhZHMgZnJvbSBjaGFuZ2luZyB0aGUgdXBkYXRlZCByb3dzIHdoaWxlIHRoZXkncmUKLSAgICAgICAgICogYmVpbmcgcHJvY2Vzc2VkIGhlcmUuCi0gICAgICAgICAqLwotICAgICAgICBzeW5jaHJvbml6ZWQgKG1VcGRhdGVkUm93cykgewotICAgICAgICAgICAgaWYgKGFkZGl0aW9uYWxWYWx1ZXMgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIG1VcGRhdGVkUm93cy5wdXRBbGwoYWRkaXRpb25hbFZhbHVlcyk7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGlmIChtVXBkYXRlZFJvd3Muc2l6ZSgpID09IDApIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgLyoKLSAgICAgICAgICAgICAqIFByZXZlbnQgb3RoZXIgdGhyZWFkcyBmcm9tIGNoYW5naW5nIHRoZSBkYXRhYmFzZSBzdGF0ZSB3aGlsZQotICAgICAgICAgICAgICogd2UgcHJvY2VzcyB0aGUgdXBkYXRlZCByb3dzLCBhbmQgcHJldmVudHMgdXMgZnJvbSBjaGFuZ2luZyB0aGUKLSAgICAgICAgICAgICAqIGRhdGFiYXNlIGJlaGluZCB0aGUgYmFjayBvZiBhbm90aGVyIHRocmVhZC4KLSAgICAgICAgICAgICAqLwotICAgICAgICAgICAgbURhdGFiYXNlLmJlZ2luVHJhbnNhY3Rpb24oKTsKLSAgICAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICAgICAgU3RyaW5nQnVpbGRlciBzcWwgPSBuZXcgU3RyaW5nQnVpbGRlcigxMjgpOwotCi0gICAgICAgICAgICAgICAgLy8gRm9yIGVhY2ggcm93IHRoYXQgaGFzIGJlZW4gdXBkYXRlZAotICAgICAgICAgICAgICAgIGZvciAoTWFwLkVudHJ5PExvbmcsIE1hcDxTdHJpbmcsIE9iamVjdD4+IHJvd0VudHJ5IDoKLSAgICAgICAgICAgICAgICAgICAgICAgIG1VcGRhdGVkUm93cy5lbnRyeVNldCgpKSB7Ci0gICAgICAgICAgICAgICAgICAgIE1hcDxTdHJpbmcsIE9iamVjdD4gdmFsdWVzID0gcm93RW50cnkuZ2V0VmFsdWUoKTsKLSAgICAgICAgICAgICAgICAgICAgTG9uZyByb3dJZE9iaiA9IHJvd0VudHJ5LmdldEtleSgpOwotCi0gICAgICAgICAgICAgICAgICAgIGlmIChyb3dJZE9iaiA9PSBudWxsIHx8IHZhbHVlcyA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJudWxsIHJvd0lkIG9yIHZhbHVlcyBmb3VuZCEgcm93SWQgPSAiCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgcm93SWRPYmogKyAiLCB2YWx1ZXMgPSAiICsgdmFsdWVzKTsKLSAgICAgICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgICAgIGlmICh2YWx1ZXMuc2l6ZSgpID09IDApIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwotICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgbG9uZyByb3dJZCA9IHJvd0lkT2JqLmxvbmdWYWx1ZSgpOwotCi0gICAgICAgICAgICAgICAgICAgIEl0ZXJhdG9yPE1hcC5FbnRyeTxTdHJpbmcsIE9iamVjdD4+IHZhbHVlc0l0ZXIgPQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlcy5lbnRyeVNldCgpLml0ZXJhdG9yKCk7Ci0KLSAgICAgICAgICAgICAgICAgICAgc3FsLnNldExlbmd0aCgwKTsKLSAgICAgICAgICAgICAgICAgICAgc3FsLmFwcGVuZCgiVVBEQVRFICIgKyBtRWRpdFRhYmxlICsgIiBTRVQgIik7Ci0KLSAgICAgICAgICAgICAgICAgICAgLy8gRm9yIGVhY2ggY29sdW1uIHZhbHVlIHRoYXQgaGFzIGJlZW4gdXBkYXRlZAotICAgICAgICAgICAgICAgICAgICBPYmplY3RbXSBiaW5kaW5ncyA9IG5ldyBPYmplY3RbdmFsdWVzLnNpemUoKV07Ci0gICAgICAgICAgICAgICAgICAgIGludCBpID0gMDsKLSAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHZhbHVlc0l0ZXIuaGFzTmV4dCgpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBNYXAuRW50cnk8U3RyaW5nLCBPYmplY3Q+IGVudHJ5ID0gdmFsdWVzSXRlci5uZXh0KCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBzcWwuYXBwZW5kKGVudHJ5LmdldEtleSgpKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIHNxbC5hcHBlbmQoIj0/Iik7Ci0gICAgICAgICAgICAgICAgICAgICAgICBiaW5kaW5nc1tpXSA9IGVudHJ5LmdldFZhbHVlKCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAodmFsdWVzSXRlci5oYXNOZXh0KCkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcWwuYXBwZW5kKCIsICIpOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgaSsrOwotICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgc3FsLmFwcGVuZCgiIFdIRVJFICIgKyBtQ29sdW1uc1ttUm93SWRDb2x1bW5JbmRleF0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICArICc9JyArIHJvd0lkKTsKLSAgICAgICAgICAgICAgICAgICAgc3FsLmFwcGVuZCgnOycpOwotICAgICAgICAgICAgICAgICAgICBtRGF0YWJhc2UuZXhlY1NRTChzcWwudG9TdHJpbmcoKSwgYmluZGluZ3MpOwotICAgICAgICAgICAgICAgICAgICBtRGF0YWJhc2Uucm93VXBkYXRlZChtRWRpdFRhYmxlLCByb3dJZCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIG1EYXRhYmFzZS5zZXRUcmFuc2FjdGlvblN1Y2Nlc3NmdWwoKTsKLSAgICAgICAgICAgIH0gZmluYWxseSB7Ci0gICAgICAgICAgICAgICAgbURhdGFiYXNlLmVuZFRyYW5zYWN0aW9uKCk7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIG1VcGRhdGVkUm93cy5jbGVhcigpOwotICAgICAgICB9Ci0KLSAgICAgICAgLy8gTGV0IGFueSBjaGFuZ2Ugb2JzZXJ2ZXJzIGtub3cgYWJvdXQgdGhlIHVwZGF0ZQotICAgICAgICBvbkNoYW5nZSh0cnVlKTsKLQotICAgICAgICByZXR1cm4gdHJ1ZTsKLSAgICB9Ci0KICAgICBwcml2YXRlIHZvaWQgZGVhY3RpdmF0ZUNvbW1vbigpIHsKICAgICAgICAgaWYgKENvbmZpZy5MT0dWKSBMb2cudihUQUcsICI8PDwgUmVsZWFzaW5nIGN1cnNvciAiICsgdGhpcyk7CiAgICAgICAgIG1DdXJzb3JTdGF0ZSA9IDA7CkBAIC01MDEsOSArMzc1LDMyIEBACiAgICAgQE92ZXJyaWRlCiAgICAgcHVibGljIHZvaWQgY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uY3VycmVudFBhY2thZ2VOYW1lKCk7CisgICAgICAgICAgICAgICAgVGhyb3dhYmxlIHQgPSBudWxsOworICAgICAgICAgICAgICAgIC8vIEJFR0lOIFNUT1BTSElQIHJlbW92ZSB0aGUgZm9sbG93aW5nIGxpbmUKKyAgICAgICAgICAgICAgICB0ID0gbmV3IFJlcXVlcnlPblVpVGhyZWFkRXhjZXB0aW9uKHBhY2thZ2VOYW1lKTsKKyAgICAgICAgICAgICAgICAvLyBFTkQgU1RPUFNISVAKKyAgICAgICAgICAgICAgICBMb2cudyhUQUcsICJzaG91bGQgbm90IGF0dGVtcHQgcmVxdWVyeSBvbiBtYWluIChVSSkgdGhyZWFkOiBhcHAgPSAiICsKKyAgICAgICAgICAgICAgICAgICAgICAgIHBhY2thZ2VOYW1lID09IG51bGwgPyAiJ3Vua25vd24nIiA6IHBhY2thZ2VOYW1lLCB0KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQogICAgIH0KIAogICAgIEBPdmVycmlkZQpAQCAtNTExLDIwICs0MDgsMzAgQEAKICAgICAgICAgaWYgKGlzQ2xvc2VkKCkpIHsKICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICAgfQorICAgICAgICB3YXJuSWZVaVRocmVhZCgpOwogICAgICAgICBsb25nIHRpbWVTdGFydCA9IDA7CiAgICAgICAgIGlmIChDb25maWcuTE9HVikgewogICAgICAgICAgICAgdGltZVN0YXJ0ID0gU3lzdGVtLmN1cnJlbnRUaW1lTWlsbGlzKCk7CiAgICAgICAgIH0KLSAgICAgICAgLyoKLSAgICAgICAgICogU3luY2hyb25pemUgb24gdGhlIGRhdGFiYXNlIGxvY2sgdG8gZW5zdXJlIHRoYXQgbUNvdW50IG1hdGNoZXMgdGhlCi0gICAgICAgICAqIHJlc3VsdHMgb2YgbVF1ZXJ5LnJlcXVlcnkoKS4KLSAgICAgICAgICovCi0gICAgICAgIG1EYXRhYmFzZS5sb2NrKCk7Ci0gICAgICAgIHRyeSB7CisKKyAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CiAgICAgICAgICAgICBpZiAobVdpbmRvdyAhPSBudWxsKSB7CiAgICAgICAgICAgICAgICAgbVdpbmRvdy5jbGVhcigpOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgbVBvcyA9IC0xOworICAgICAgICAgICAgU1FMaXRlRGF0YWJhc2UgZGIgPSBtUXVlcnkubURhdGFiYXNlLmdldERhdGFiYXNlSGFuZGxlKG1RdWVyeS5tU3FsKTsKKyAgICAgICAgICAgIGlmICghZGIuZXF1YWxzKG1RdWVyeS5tRGF0YWJhc2UpKSB7CisgICAgICAgICAgICAgICAgLy8gc2luY2Ugd2UgbmVlZCB0byB1c2UgYSBkaWZmZXJlbnQgZGF0YWJhc2UgY29ubmVjdGlvbiBoYW5kbGUsCisgICAgICAgICAgICAgICAgLy8gcmUtY29tcGlsZSB0aGUgcXVlcnkKKyAgICAgICAgICAgICAgICBkYi5sb2NrKCk7CisgICAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAgICAgLy8gY2xvc2UgdGhlIG9sZCBtUXVlcnkgb2JqZWN0IGFuZCBvcGVuIGEgbmV3IG9uZQorICAgICAgICAgICAgICAgICAgICBtUXVlcnkuY2xvc2UoKTsKKyAgICAgICAgICAgICAgICAgICAgbVF1ZXJ5ID0gbmV3IFNRTGl0ZVF1ZXJ5KGRiLCBtUXVlcnkpOworICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICAgICAgICAgIGRiLnVubG9jaygpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KICAgICAgICAgICAgIC8vIFRoaXMgb25lIHdpbGwgcmVjcmVhdGUgdGhlIHRlbXAgdGFibGUsIGFuZCBnZXQgaXRzIGNvdW50CiAgICAgICAgICAgICBtRHJpdmVyLmN1cnNvclJlcXVlcmllZCh0aGlzKTsKICAgICAgICAgICAgIG1Db3VudCA9IE5PX0NPVU5UOwpAQCAtNTM1LDggKzQ0Miw2IEBACiAgICAgICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgICAgIHF1ZXJ5VGhyZWFkVW5sb2NrKCk7CiAgICAgICAgICAgICB9Ci0gICAgICAgIH0gZmluYWxseSB7Ci0gICAgICAgICAgICBtRGF0YWJhc2UudW5sb2NrKCk7CiAgICAgICAgIH0KIAogICAgICAgICBpZiAoQ29uZmlnLkxPR1YpIHsKQEAgLTU4NCwxNCArNDg5LDE0IEBACiAgICAgICAgICAgICBpZiAobVdpbmRvdyAhPSBudWxsKSB7CiAgICAgICAgICAgICAgICAgaW50IGxlbiA9IG1RdWVyeS5tU3FsLmxlbmd0aCgpOwogICAgICAgICAgICAgICAgIExvZy5lKFRBRywgIkZpbmFsaXppbmcgYSBDdXJzb3IgdGhhdCBoYXMgbm90IGJlZW4gZGVhY3RpdmF0ZWQgb3IgY2xvc2VkLiAiICsKLSAgICAgICAgICAgICAgICAgICAgICAgICJkYXRhYmFzZSA9ICIgKyBtRGF0YWJhc2UuZ2V0UGF0aCgpICsgIiwgdGFibGUgPSAiICsgbUVkaXRUYWJsZSArCisgICAgICAgICAgICAgICAgICAgICAgICAiZGF0YWJhc2UgPSAiICsgbVF1ZXJ5Lm1EYXRhYmFzZS5nZXRQYXRoKCkgKyAiLCB0YWJsZSA9ICIgKyBtRWRpdFRhYmxlICsKICAgICAgICAgICAgICAgICAgICAgICAgICIsIHF1ZXJ5ID0gIiArIG1RdWVyeS5tU3FsLnN1YnN0cmluZygwLCAobGVuID4gMTAwKSA/IDEwMCA6IGxlbiksCiAgICAgICAgICAgICAgICAgICAgICAgICBtU3RhY2tUcmFjZSk7CiAgICAgICAgICAgICAgICAgY2xvc2UoKTsKICAgICAgICAgICAgICAgICBTUUxpdGVEZWJ1Zy5ub3RpZnlBY3RpdmVDdXJzb3JGaW5hbGl6ZWQoKTsKICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgaWYgKENvbmZpZy5MT0dWKSB7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6ZSgpIDw9IG1NYXhTcWxDYWNoZVNpemUpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gY2FjaGUgaXMgbm90IGZ1bGwuIG5vdGhpbmcgbmVlZHMgdG8gYmUgcmVtb3ZlZAorICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIC8vIGNhY2hlIGlzIGZ1bGwuIGVsZGVzdCB3aWxsIGJlIHJlbW92ZWQuCisgICAgICAgICAgICAgICAgU1FMaXRlQ29tcGlsZWRTcWwgZW50cnkgPSBlbGRlc3QuZ2V0VmFsdWUoKTsKKyAgICAgICAgICAgICAgICBpZiAoIWVudHJ5LmlzSW5Vc2UoKSkgeworICAgICAgICAgICAgICAgICAgICAvLyB0aGlzIHtAbGluayBTUUxpdGVDb21waWxlZFNxbH0gaXMgbm90IGluIHVzZS4gcmVsZWFzZSBpdC4KKyAgICAgICAgICAgICAgICAgICAgZW50cnkucmVsZWFzZVNxbFN0YXRlbWVudCgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAvLyByZXR1cm4gdHJ1ZSwgc28gdGhhdCB0aGlzIGVudHJ5IGlzIHJlbW92ZWQgYXV0b21hdGljYWxseSBieSB0aGUgY2FsbGVyLgorICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgfQorICAgICAgICB9OwogICAgIC8qKgotICAgICAqIEBoaWRlCisgICAgICogYWJzb2x1dGUgbWF4IHZhbHVlIHRoYXQgY2FuIGJlIHNldCBieSB7QGxpbmsgI3NldE1heFNxbENhY2hlU2l6ZShpbnQpfQorICAgICAqIHNpemUgb2YgZWFjaCBwcmVwYXJlZC1zdGF0ZW1lbnQgaXMgYmV0d2VlbiAxSyAtIDZLLCBkZXBlbmRpbmcgb24gdGhlIGNvbXBsZXhpdHkgb2YgdGhlCisgICAgICogU1FMIHN0YXRlbWVudCAmIHNjaGVtYS4KICAgICAgKi8KLSAgIC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cm9tIHNjcmF0Y2guCi0gICAgICAgICAgICBpZiAoIW1QYXRoLmVxdWFsc0lnbm9yZUNhc2UoIjptZW1vcnkiKSkgewotICAgICAgICAgICAgICAgIC8vIGRlbGV0ZSBpcyBvbmx5IGZvciBub24tbWVtb3J5IGRhdGFiYXNlIGZpbGVzCi0gICAgICAgICAgICAgICAgbmV3IEZpbGUobVBhdGgpLmRlbGV0ZSgpOwotICAgICAgICAgICAgfQotICAgICAgICB9CisgICAgICAgIG1FcnJvckhhbmRsZXIub25Db3JydXB0aW9uKHRoaXMpOwogICAgIH0KIAogICAgIC8qKgpAQCAtMzc0LDYgKzQxMCw3IEBACiAgICAgICogQHNlZSAjdW5sb2NrKCkKICAgICAgKi8KICAgICAvKiBwYWNrYWdlICovIHZvaWQgbG9jaygpIHsKKyAgICAgICAgdmVyaWZ5RGJJc09wZW4oKTsKICAgICAgICAgaWYgKCFtTG9ja2luZ0VuYWJsZWQpIHJldHVybjsKICAgICAgICAgbUxvY2subG9jaygpOwogICAgICAgICBpZiAoU1FMaXRlRGVidWcuREVCVUdfTE9DS19USU1FX1RSQUNLSU5HKSB7CkBAIC0zOTQsNiArNDMxLDcgQEAKICAgICAgKiBAc2VlICN1bmxvY2tGb3JjZWQoKQogICAgICAqLwogICAgIHByaXZhdGUgdm9pZCBsb2NrRm9yY2VkKCkgeworICAgICAgICB2ZXJpZnlEYklzT3BlbigpOwogICAgICAgICBtTG9jay5sb2NrKCk7CiAgICAgICAgIGlmIChTUUxpdGVEZWJ1Zy5ERUJVR19MT0NLX1RJTUVfVFJBQ0tJTkcpIHsKICAgICAgICAgICAgIGlmIChtTG9jay5nZXRIb2xkQ291bnQoKSA9PSAxKSB7CkBAIC00NjAsMTEgKzQ5OCwxNCBAQAogICAgIH0KIAogICAgIC8qKgotICAgICAqIEJlZ2lucyBhIHRyYW5zYWN0aW9uLiBUcmFuc2FjdGlvbnMgY2FuIGJlIG5lc3RlZC4gV2hlbiB0aGUgb3V0ZXIgdHJhbn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ICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJubyB0cmFuc2FjdGlvbiBwZW5kaW5nIik7CiAgICAgICAgIH0KQEAgLTYzMSw3ICs3NDEsNTAgQEAKICAgICAgKiByZXR1cm4gdHJ1ZSBpZiB0aGVyZSBpcyBhIHRyYW5zYWN0aW9uIHBlbmRpbmcKICAgICAgKi8KICAgICBwdWJsaWMgYm9vbGVhbiBpblRyYW5zYWN0aW9uKCkgewotICAgICAgICByZXR1cm4gbUxvY2suZ2V0SG9sZENvdW50KCkgPiAwOworICAgICAgICByZXR1cm4gbUxvY2suZ2V0SG9sZENvdW50KCkgPiAwIHx8IG1UcmFuc2FjdGlvblVzaW5nRXhlY1NxbDsKKyAgICB9CisKKyAgICAvKiBwYWNrYWdlICovIHN5bmNocm9uaXplZCB2b2lkIHNldFRyYW5zYWN0aW9uVXNpbmdFeGVjU3FsRmxhZygpIHsKKyAgICAgICAgaWYgKExvZy5pc0xvZ2dhYmxlKFRBRywgTG9nLkRFQlVHKSkgeworICAgICAgICAgICAgTG9nLmkoVEFHLCAiZm91bmQgZXhlY1NRTCgnYmVnaW4gdHJhbnNhY3Rpb24nKSIpOworICAgICAgICB9CisgICAgICAgIG1UcmFuc2FjdGlvblVzaW5nRXhlY1NxbCA9IHRydWU7CisgICAgfQorCisgICAgLyogcGFja2FnZSAqLyBzeW5jaHJvbml6ZWQgdm9pZCByZXNldFRyYW5zYWN0aW9uVXNpbmdFeGVjU3FsRmxhZygpIHsKKyAgICAgICAgaWYgKExvZy5pc0xvZ2dhYmxlKFRBRywgTG9nLkRFQlVHKSkgeworICAgICAgICAgICAgaWYgKG1UcmFuc2FjdGlvblVzaW5nRXhlY1NxbCkgeworICAgICAgICAgICAgICAgIExvZy5pKFRBRywgImZvdW5kIGV4ZWNTUUwoJ2NvbW1pdCBvciBlbmQgb3Igcm9sbGJhY2snKSIpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIG1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BmYWN0b3J5LCBDUkVBVEVfSUZfTkVDRVNTQVJZKTsKICAgICB9CiAKICAgICAvKioKQEAgLTg3NywxOCArMTA1NiwzMSBAQAogICAgICAgICBpZiAoIWlzT3BlbigpKSB7CiAgICAgICAgICAgICByZXR1cm47IC8vIGFscmVhZHkgY2xvc2VkCiAgICAgICAgIH0KKyAgICAgICAgaWYgKExvZy5pc0xvZ2dhYmxlKFRBRywgTG9nLkRFQlVHKSkgeworICAgICAgICAgICAgTG9nLmkoVEFHLCAiY2xvc2luZyBkYjogIiArIG1QYXRoICsgIiAoY29ubmVjdGlvbiAjICIgKyBtQ29ubmVjdGlvbk51bSk7CisgICAgICAgIH0KICAgICAgICAgbG9jaygpOwogICAgICAgICB0cnkgewogICAgICAgICAgICAgY2xvc2VDbG9zYWJsZSgpOworICAgICAgICAgICAgLy8gZmluYWxpemUgQUxMIHN0YXRlbWVudHMgcXVldWVkIHVwIHNvIGZhcgorICAgICAgICAgICAgY2xvc2VQZW5kaW5nU3RhdGVtZW50cygpOworICAgICAgICAgICAgcmVsZWFzZUN1c3RvbUZ1bmN0aW9ucygpOwogICAgICAgICAgICAgLy8gY2xvc2UgdGhpcyBkYXRhYmFzZSBpbnN0YW5jZSAtIHJlZ2FyZGxlc3Mgb2YgaXRzIHJlZmVyZW5jZSBjb3VudCB2YWx1ZQotICAgICAgICAgICAgb25BbGxSZWZlcmVuY2VzUmVsZWFzZWQoKTsKKyAgICAgICAgICAgIGNsb3NlRGF0YWJhc2UoKTsKKyAgICAgICAgICAgIGlmIChtQ29ubmVjdGlvblBvb2wgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGlmIChMb2cuaXNMb2dnYWJsZShUQUcsIExvZy5ERUJVRykpIHsKKyAgICAgICAgICAgICAgICAgICAgYXNzZXJ0IG1Db25uZWN0aW9uUG9vbCAhPSBudWxsOworICAgICAgICAgICAgICAgICAgICBMb2cuaShUQUcsIG1Db25uZWN0aW9uUG9vbC50b1N0cmluZygpKTsKKyAg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10SWQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtc2cgPSBjb21waWxlZFNxbC50b1N0cmluZygpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvdW5kID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoIWZvdW5kKSB7CisgICAgICAgICAgICAgICAgLy8gdGhlIHN0YXRlbWVudCBpcyBhbHJlYWR5IHJlbGVhc2VkIGJ5IGNsb3NlQ2xvc2FibGUoKS4gaXMgaXQgd2FpdGluZyB0byBiZQorICAgICAgICAgICAgICAgIC8vIGZpbmFsaXplZD8KKyAgICAgICAgICAgICAgICBpZiAobUNsb3NlZFN0YXRlbWVudElkcy5jb250YWlucyhzdG10SWQpKSB7CisgICAgICAgICAgICAgICAgICAgIExvZy53KFRBRywgInRoaXMgc2hvdWxkbid0IGhhcHBlbi4gZmluYWxpemluZyB0aGUgc3RhdGVtZW50IG5vdzogIik7CisgICAgICAgICAgICAgICAgICAgIGNsb3NlUGVuZGluZ1N0YXRlbWVudHMoKTsKKyAgICAgICAgICAgICAgICAgICAgLy8gdHJ5IHRvIGNsb3NlIHRoZSBkYXRhYmFzZSBhZ2FpbgorICAgICAgICAgICAgICAgICAgICBjbG9zZURhdGFiYXNlKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAvLyB0aGUgc3RhdGVtZW50IGlzIG5vdCB5ZXQgY2xvc2VkLiBtb3N0IHByb2JhYmx5IHByb2dyYW1taW5nIGVycm9yIGluIHRoZSBhcHAuCisgICAgICAgICAgICAgICAgTG9nLncoVEFHLCAiZGJjbG9zZSBmYWlsZWQgZHVlIHRvIHVuLWNsb3NlKClkIFNRTCBzdGF0ZW1lbnRzOiAiICsgbXNnKTsKKyAgICAgICAgICAgICAgICB0aHJvdyBlOworICAgICAgICAgICAgfQor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uY3Rpb24gZnVuY3Rpb24pIHsKKyAgICAgICAgdmVyaWZ5RGJJc09wZW4oKTsKKyAgICAgICAgc3luY2hyb25pemVkIChtQ3VzdG9tRnVuY3Rpb25zKSB7CisgICAgICAgICAgICBpbnQgcmVmID0gbmF0aXZlX2FkZEN1c3RvbUZ1bmN0aW9uKG5hbWUsIG51bUFyZ3MsIGZ1bmN0aW9uKTsKKyAgICAgICAgICAgIGlmIChyZWYgIT0gMCkgeworICAgICAgICAgICAgICAgIC8vIHNhdmUgYSByZWZlcmVuY2UgdG8gdGhlIGZ1bmN0aW9uIGZvciBjbGVhbnVwIGxhdGVyCisgICAgICAgICAgICAgICAgbUN1c3RvbUZ1bmN0aW9ucy5hZGQobmV3IEludGVnZXIocmVmKSk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBTUUxpdGVFeGNlcHRpb24oImZhaWxlZCB0byBhZGQgY3VzdG9tIGZ1bmN0aW9uICIgKyBuYW1lKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgdm9pZCByZWxlYXNlQ3VzdG9tRnVuY3Rpb25zKCkgeworICAgICAgICBzeW5jaHJvbml6ZWQgKG1DdXN0b21GdW5jdGlvbnMpIHsKKyAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbUN1c3RvbUZ1bmN0aW9ucy5zaXplKCk7IGkrKykgeworICAgICAgICAgICAgICAgIEludGVnZXIgZnVuY3Rpb24gPSBtQ3VzdG9tRnVuY3Rpb25zLmdldChpKTsKKyAgICAgICAgICAgICAgICBuYXRpdmVfcmVsZWFzZUN1c3RvbUZ1bmN0aW9uKGZ1bmN0aW9uLmludFZhbHVlKCkpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbUN1c3RvbUZ1bmN0aW9ucy5jbGVhcigpOworICAgICAgICB9CisgICAgfQorCisgICAgLy8gbGlzdCBvZiBDdXN0b21GdW5jdGlvbiByZ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b2x1bW4gaW4gdGFibGUgd2hvc2UgdmFsdWUgaXMgYW4gX2lkIGluCi0gICAgICogICAgICAgICAgdXBkYXRlVGFibGUKLSAgICAgKiBAcGFyYW0gdXBkYXRlVGFibGUgdGhpcyBpcyB0aGUgdGFibGUgdGhhdCB3aWxsIGhhdmUgaXRzIF9zeW5jX2RpcnR5Ci0gICAgICogQHBhcmFtIGRlbGV0ZWRUYWJsZSBUaGUgZGVsZXRlZCB0YWJsZSB0aGF0IGNvcnJlc3BvbmRzIHRvIHRoZQotICAgICAqICAgICAgICAgIHVwZGF0ZVRhYmxlCi0gICAgICovCi0gICAgcHJpdmF0ZSB2b2lkIG1hcmtUYWJsZVN5bmNhYmxlKFN0cmluZyB0YWJsZSwgU3RyaW5nIGZvcmVpZ25LZXksCi0gICAgICAgICAgICBTdHJpbmcgdXBkYXRlVGFibGUsIFN0cmluZyBkZWxldGVkVGFibGUpIHsKLSAgICAgICAgbG9jaygpOwotICAgICAgICB0cnkgewotICAgICAgICAgICAgbmF0aXZlX2V4ZWNTUUwoIlNFTEVDVCBfc3luY19kaXJ0eSBGUk9NICIgKyB1cGRhdGVUYWJsZQotICAgICAgICAgICAgICAgICAgICArICIgTElNSVQgMCIpOwotICAgICAgICAgICAgbmF0aXZlX2V4ZWNTUUwoIlNFTEVDVCAiICsgZm9yZWlnbktleSArICIgRlJPTSAiICsgdGFibGUKLSAgICAgICAgICAgICAgICAgICAgKyAiIExJTUlUIDAiKTsKLSAgICAgICAgfSBmaW5hbGx5IHsKLSAgICAgICAgICAgIHVubG9jaygpOwotICAgICAgICB9Ci0KLSAgICAgICAgU3luY1VwZGF0ZUluZm8gaW5mbyA9IG5ldyBTeW5jVXBkYXRlSW5mbyh1cGRhdGVUYWJsZSwgZGVsZXRlZFRhYmxlLAotICAgICAgICAgICAgICAgIGZvcmVpZ25LZXkpOwotICAgICAgICBzeW5jaHJvbml6ZWQgKG1TeW5jVXBkYXRlSW5mbykgewotICAgICAgICAgICAgbVN5bmNV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7Ci0gICAgICAgIGlmICghaXNPcGVuKCkpIHsKLSAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oImRhdGFiYXNlIG5vdCBvcGVuIik7Ci0gICAgICAgIH0KKyAgICAgICAgdmVyaWZ5RGJJc09wZW4oKTsKICAgICAgICAgQmxvY2tHdWFyZC5nZXRUaHJlYWRQb2xpY3koKS5vblJlYWRGcm9tRGlzaygpOwogICAgICAgICBsb25nIHRpbWVTdGFydCA9IDA7CiAKQEAgLTEzNDksNyArMTUyNCw4IEBACiAgICAgICAgICAgICB0aW1lU3RhcnQgPSBTeXN0ZW0uY3VycmVudFRpbWVNaWxsaXMoKTsKICAgICAgICAgfQogCi0gICAgICAgIFNRTGl0ZUN1cnNvckRyaXZlciBkcml2ZXIgPSBuZXcgU1FMaXRlRGlyZWN0Q3Vyc29yRHJpdmVyKHRoaXMsIHNxbCwgZWRpdFRhYmxlKTsKKyAgICAgICAgU1FMaXRlRGF0YWJhc2UgZGIgPSBnZXREYkNvbm5lY3Rpb24oc3FsKTsKKyAgICAgICAgU1FMaXRlQ3Vyc29yRHJpdmVyIGRyaXZlciA9IG5ldyBTUUxpdGVEaXJlY3RDdXJzb3JEcml2ZXIoZGIsIHNxbCwgZWRpdFRhYmxlKTsKIAogICAgICAgICBDdXJzb3IgY3Vyc29yID0gbnVsbDsKICAgICAgICAgdHJ5IHsKQEAgLTEzNzUsNiArMTU1MSw3IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOiAiPG51bGw+IikgICsgIiwgY291bnQgaXMgIiArIGNvdW50KTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CisgICAgICAgICAgICByZWxlYXNlRGJDb25uZWN0aW9uKGRiKTsKICAgICAgICAgfQogICAgICAgICByZXR1cm4gY3Vyc29yOwogICAgIH0KQEAgLTE1MDEsODQgKzE2NzgsNDEgQEAKICAgICAgKi8KICAgICBwdWJsaWMgbG9uZyBpbn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bFZhbHVlcy5zaXplKCkgPiAwKSB7Ci0gICAgICAgICAgICBlbnRyeVNldCA9IGluaXRpYWxWYWx1ZXMudmFsdWVTZXQoKTsKLSAgICAgICAgICAgIEl0ZXJhdG9yPE1hcC5FbnRyeTxTdHJpbmcsIE9iamVjdD4+IGVudHJpZXNJdGVyID0gZW50cnlTZXQuaXRlcmF0b3IoKTsKLSAgICAgICAgICAgIHNxbC5hcHBlbmQoJygnKTsKLQotICAgICAgICAgICAgYm9vbGVhbiBuZWVkU2VwYXJhdG9yID0gZmFsc2U7Ci0gICAgICAgICAgICB3aGlsZSAoZW50cmllc0l0ZXIuaGFzTmV4dCgpKSB7Ci0gICAgICAgICAgICAgICAgaWYgKG5lZWRTZXBhcmF0b3IpIHsKLSAgICAgICAgICAgICAgICAgICAgc3FsLmFwcGVuZCgiLCAiKTsKLSAgICAgICAgICAgICAgICAgICAgdmFsdWVzLmFwcGVuZCgiLCAiKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgbmVlZFNlcGFyYXRvciA9IHRydWU7Ci0gICAgICAgICAgICAgICAgTWFwLkVudHJ5PFN0cmluZywgT2JqZWN0PiBlbnRyeSA9IGVudHJpZXNJdGVyLm5leHQoKTsKLSAgICAgICAgICAgICAgICBzcWwuYXBwZW5kKGVudHJ5LmdldEtleSgpKTsKLSAgICAgICAgICAgICAgICB2YWx1ZXMuYXBwZW5kKCc/Jyk7CisgICAgICAgIE9iamVjdFtdIGJpbmRBcmdzID0gbnVsbDsKKyAgICAgICAgaW50IHNpemUgPSAoaW5pdGlhbFZhbHVlcyAhPSBudWxsICYmIGluaXRpYWxWYWx1ZXMuc2l6ZSgpID4gMCkgPyBpbml0aWFsVmFsdWVzLnNpemUoKSA6IDA7CisgICAgICAgIGlmIChzaXplID4gMCkgeworICAgICAgICAgICAgYmluZEFyZ3MgPSBuZXcgT2JqZWN0W3NpemVdOworICAgICAgICAgICAgaW50IGkgPSAwOworICAgICAgICAgICAgZm9yIChTdHJpbmcgY29sTmFtZSA6IGluaXRpYWxWYWx1ZXMua2V5U2V0KCkpIHsKKyAgICAgICAgICAgICAgICBzcWwuYXBwZW5kKChpID4gMCkgPyAiLCIgOiAiIik7CisgICAgICAgICAgICAgICAgc3FsLmFwcGVuZChjb2xOYW1lKTsKKyAgICAgICAgICAgICAgICBiaW5kQXJnc1tpKytdID0gaW5pdGlhbFZhbHVlcy5nZXQoY29sTmFtZSk7CiAgICAgICAgICAgICB9Ci0KICAgICAgICAgICAgIHNxbC5hcHBlbmQoJyknKTsKKyAgICAgICAgICAgIHNxbC5hcHBlbmQoIiBWQUxVRVMgKCIpOworICAgICAgICAgICAgZm9yIChpID0gMDsgaSA8IHNpemU7IGkrKykgeworICAgICAgICAgICAgICAgIHNxbC5hcHBlbmQoKGkgPiAwKSA/ICIsPyIgOiAiPyIpOworICAgICAgICAgICAgfQogICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgc3FsLmFwcGVuZCgiKCIgKyBudWxsQ29sdW1uSGFjayArICIpICIpOwotICAgICAgICAgICAgdmFsdWVzLmFwcGVuZCgiTlVMTCIpOworICAgICAgICAgICAgc3FsLmFwcGVuZChudWxsQ29sdW1uSGFjayArICIpIFZBTFVFUyAoTlVMTCIpOwogICAgICAgICB9CisgICAgICAgIHNxbC5hcHBlbmQoJyknKTsKIAotICAgICAgICBzcWwuYXBwZW5kKCIgVkFMVUVTKCIpOwotICAgICAgICBzcWwuYXBwZW5kKHZhbHVlcyk7Ci0gICAgICAgIHNxbC5hcHBlbmQoIik7Iik7Ci0KLSAgICAgICAgbG9jaygpOwotICAgICAgICBTUUxpdGVTdGF0ZW1lbnQgc3RhdGVtZW50ID0gbnVsbDsKKyAgICAgICAgU1FMaXRlU3RhdGVtZW50IHN0YXRlbWVudCA9IG5ldyBTUUxpdGVTdGF0ZW1lbnQodGhpcywgc3FsLnRvU3RyaW5nKCksIGJpbmRBcmdzKTsKICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgIHN0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RVJCT1NFKSkgewotICAgICAgICAgICAgICAgICAgICBMb2cudihUQUcsICJJbnNlcnRpbmcgcm93ICIgKyBpbnNlcnRlZFJvd0lkICsgIiBmcm9tICIKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICArIGluaXRpYWxWYWx1ZXMgKyAiIHVzaW5nICIgKyBzcWwpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJldHVybiBpbnNlcnRlZFJvd0lkOworICAgICAgICAgICAgcmV0dXJuIHN0YXRlbWVudC5leGVjdXRlSW5zZXJ0KCk7CiAgICAgICAgIH0gY2F0Y2ggKFNRTGl0ZURhdGFiYXNlQ29ycnVwdEV4Y2VwdGlvbiBlKSB7CiAgICAgICAgICAgICBvbkNvcnJ1cHRpb24oKTsKICAgICAgICAgICAgIHRocm93IGU7CiAgICAgICAgIH0gZmluYWxseSB7Ci0gICAgICAgICAgICBpZiAoc3RhdGVtZW50ICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICBzdGF0ZW1lbnQuY2xvc2UoKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHVubG9jaygpOworICAgICAgICAgICAgc3RhdGVtZW50LmNsb3NlKCk7CiAgICAgICAgIH0KICAgICB9CiAKQEAgLTE1OTMsMzIgKzE3MjcsMTUgQEAKICAgICAgKiAgICAgICAgIHdoZXJlQ2xhdXNlLgogICAgICAqLwogICAgIHB1YmxpYyBpbnQgZGVsZXRlKFN0cmluZyB0YWJsZSwgU3RyaW5nIHdoZXJlQ2xhdXNlLCBTdHJpbmdbXSB3aGVyZUFyZ3MpIHsKLSAgICAgICAgQmxvY2tHdWFyZC5nZXRUaHJlYWRQb2xpY3koKS5vbldyaXRlVG9EaXNrKCk7Ci0gICAgICAgIGxvY2soKTsKLSAgICAgICAgaWYgKCFpc09wZW4oKSkgewotICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiZGF0YWJhc2Ugbm90IG9wZW4iKTsKLSAgICAgICAgfQotICAgICAgICBTUUxpdGVTdGF0ZW1lbnQgc3RhdGVtZW50ID0gbnVsbDsKKyAgICAgICAgU1FMaXRlU3RhdGVtZW50IHN0YXRlbWVudCA9ICBuZXcgU1FMaXRlU3RhdGVtZW50KHRoaXMsICJERUxFVEUgRlJPTSAiICsgdGFibGUgKworICAgICAgICAgICAgICAgICghVGV4dFV0aWxzLmlzRW1wdHkod2hlcmVDbGF1c2UpID8gIiBXSEVSRSAiICsgd2hlcmVDbGF1c2UgOiAiIiksIHdoZXJlQXJncyk7CiAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICBzdGF0ZW1lbnQgPSBjb21waWxlU3RhdGVtZW50KCJERUxFVEUgRlJPTSAiICsgdGFibGUKLSAgICAgICAgICAgICAgICAgICAgKyAoIVRleHRVdGlscy5pc0VtcHR5KHdoZXJlQ2xhdXNlKQotICAgICAgICAgICAgICAgICAgICA/ICIgV0hFUkUgIiArIHdoZXJlQ2xhdXNlIDogIiIpKTsKLSAgICAgICAgICAgIGlmICh3aGVyZUFyZ3MgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIGludCBudW1BcmdzID0gd2hlcmVBcmdzLmxlbmd0aDsKLSAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IG51bUFyZ3M7IGkrKykgewotICAgICAgICAgICAgICAgICAgICBEYXRhYmFzZVV0aWxzLmJpbmRPYmplY3RUb1Byb2dyYW0oc3RhdGVtZW50LCBpICsgMSwgd2hlcmVBcmdzW2ldKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBzdGF0ZW1lbnQuZXhlY3V0ZSgpOwotICAgICAgICAgICAgcmV0dXJuIGxhc3RDaGFuZ2VDb3VudCgpOworICAgICAgICAgICAgcmV0dXJuIHN0YXRlbWVudC5leGVjdXRlVXBkYXRlRGVsZXRlKCk7CiAgICAgICAgIH0gY2F0Y2ggKFNRTGl0ZURhdGFiYXNlQ29ycnVwdEV4Y2VwdGlvbiBlKSB7CiAgICAgICAgICAgICBvbkNvcnJ1cHRpb24oKTsKICAgICAgICAgICAgIHRocm93IGU7CiAgICAgICAgIH0gZmluYWxseSB7Ci0gICAgICAgICAgICBpZiAoc3RhdGVtZW50ICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICBzdGF0ZW1lbnQuY2xvc2UoKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHVubG9jaygpOworICAgICAgICAgICAgc3RhdGVtZW50LmNsb3NlKCk7CiAgICAgICAgIH0KICAgICB9CiAKQEAgLTE2NDksOCArMTc2Niw4IEBACiAgICAgICovCiAgICAgcHVibGljIGludCB1cGRhdGVXaXRoT25Db25mbGljdChTdHJpbmcgdGFibGUsIENvbnRlbnRWYWx1ZXMgdmFsdWVzLAogICAgICAgICAgICAgU3RyaW5nIHdoZXJlQ2xhdXNlLCBTdHJpbmdbXSB3aGVyZUFyZ3MsIGludCBjb25mbGljdEFsZ29yaXRobSkgewotICAgICAgICBCbG9ja0d1YXJkLmdldFRocmVhZFBvbGljeSgpLm9uV3JpdGVUb0Rpc2soKTsKLSAgICAgICAgaWYgKHZhbHVlcyA9PSBudWxsIHx8IHZhbHVlcy5zaXplKCkgPT0gMCkgeworICAgICAgICBpbnQgc2V0VmFsdWVzU2l6ZSA9IHZhbHVlcy5zaXplKCk7CisgICAgICAgIGlmICh2YWx1ZXMgPT0gbnVsbCB8fCBzZXRWYWx1ZXNTaXplID09IDApIHsKICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oIkVtcHR5IHZhbHVlcyIpOwogICAgICAgICB9CiAKQEAgLTE2NjAsOTggKzE3NzcsNjggQEAKICAgICAgICAgc3FsLmFwcGVuZCh0YWJsZSk7CiAgICAgICAgIHNxbC5hcHBlbmQoIiBTRVQgIik7CiAKLSAgICAgICAgU2V0PE1hcC5FbnRyeTxTdHJpbmcsIE9iam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ChpID0gc2V0VmFsdWVzU2l6ZTsgaSA8IGJpbmRBcmdzU2l6ZTsgaSsrKSB7CisgICAgICAgICAgICAgICAgYmluZEFyZ3NbaV0gPSB3aGVyZUFyZ3NbaSAtIHNldFZhbHVlc1NpemVdOwogICAgICAgICAgICAgfQogICAgICAgICB9Ci0KICAgICAgICAgaWYgKCFUZXh0VXRpbHMuaXNFbXB0eSh3aGVyZUNsYXVzZSkpIHsKICAgICAgICAgICAgIHNxbC5hcHBlbmQoIiBXSEVSRSAiKTsKICAgICAgICAgICAgIHNxbC5hcHBlbmQod2hlcmVDbGF1c2UpOwogICAgICAgICB9CiAKLSAgICAgICAgbG9jaygpOwotICAgICAgICBpZiAoIWlzT3BlbigpKSB7Ci0gICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJkYXRhYmFzZSBub3Qgb3BlbiIpOwotICAgICAgICB9Ci0gICAgICAgIFNRTGl0ZVN0YXRlbWVudCBzdGF0ZW1lbnQgPSBudWxsOworICAgICAgICBTUUxpdGVTdGF0ZW1lbnQgc3RhdGVtZW50ID0gbmV3IFNRTGl0ZVN0YXRlbWVudCh0aGlzLCBzcWwudG9TdHJpbmcoKSwgYmluZEFyZ3MpOwogICAgICAgICB0cnkgewotICAgICAgICAgICAgc3RhdGVtZW50ID0gY29tcGlsZVN0YXRlbWVudChzcWwudG9TdHJpbmcoKSk7Ci0KLSAgICAgICAgICAgIC8vIEJpbmQgdGhlIHZhbHVlcwotICAgICAgICAgICAgaW50IHNpemUgPSBlbnRyeVNldC5zaXplKCk7Ci0gICAgICAgICAgICBlbnRyaWVzSXRlciA9IGVudHJ5U2V0Lml0ZXJhdG9yKCk7Ci0gICAgICAgICAgICBpbnQgYmluZEFyZyA9IDE7Ci0gICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IHNpemU7IGkrKykgewotICAgICAgICAgICAgICAgIE1hcC5FbnRyeTxTdHJpbmcsIE9iamVjdD4gZW50cnkgPSBlbnRyaWVzSXRlci5uZXh0KCk7Ci0gICAgICAgICAgICAgICAgRGF0YWJhc2VVdGlscy5iaW5kT2JqZWN0VG9Qcm9ncmFtKHN0YXRlbWVudCwgYmluZEFyZywgZW50cnkuZ2V0VmFsdWUoKSk7Ci0gICAgICAgICAgICAgICAgYmluZEFyZysrOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBpZiAod2hlcmVBcmdzICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICBzaXplID0gd2hlcmVBcmdzLmxlbmd0aDsKLSAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IHNpemU7IGkrKykgewotICAgICAgICAgICAgICAgICAgICBzdGF0ZW1lbnQuYmluZFN0cmluZyhiaW5kQXJnLCB3aGVyZUFyZ3NbaV0pOwotICAgICAgICAgICAgICAgICAgICBiaW5kQXJnKys7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAvLyBSdW4gdGhlIHByb2dyYW0gYW5kIHRoZW4gY2xlYW51cAotICAgICAgICAgICAgc3RhdGVtZW50LmV4ZWN1dGUoKTsKLSAgICAgICAgICAgIGludCBudW1DaGFuZ2VkUm93cyA9IGxhc3RDaGFuZ2VDb3VudCgpOwotICAgICAgICAgICAgaWYgKENvbmZpZy5MT0dEICYmIExvZy5pc0xvZ2dhYmxlKFRBRywgTG9nLlZFUkJPU0UpKSB7Ci0gICAgICAgICAgICAgICAgTG9nLnYoVEFHLCAiVXBkYXRlZCAiICsgbnVtQ2hhbmdlZFJvd3MgKyAiIHVzaW5nICIgKyB2YWx1ZXMgKyAiIGFuZCAiICsgc3FsKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJldHVybiBudW1DaGFuZ2VkUm93czsKKyAgICAgICAgICAgIHJldHVybiBzdGF0ZW1lbnQuZXhlY3V0ZVVwZGF0ZURlbGV0ZSgpOwogICAgICAgICB9IGNhdGNoIChTUUxpdGVEYXRhYmFzZUN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3RyaW5nLCBDb250ZW50VmFsdWVzLCBpbnQpfTwvbGk+CisgICAgICogPC91bD4KKyAgICAgKiA8cD4KKyAgICAgKiBGb3IgVVBEQVRFIHN0YXRlbWVudHMsIHVzZSBhbnkgb2YgdGhlIGZvbGxvd2luZyBpbnN0ZWFkLgorICAgICAqIDx1bD4KKyAgICAgKiAgIDxsaT57QGxpbmsgI3VwZGF0ZShTdHJpbmcsIENvbnRlbnRWYWx1ZXMsIFN0cmluZywgU3RyaW5nW10pfTwvbGk+CisgICAgICogICA8bGk+e0BsaW5rICN1cGRhdGVXaXRoT25Db25mbGljdChTdHJpbmcsIENvbnRlbnRWYWx1ZXMsIFN0cmluZywgU3RyaW5nW10sIGludCl9PC9saT4KKyAgICAgKiA8L3VsPgorICAgICAqIDxwPgorICAgICAqIEZvciBERUxFVEUgc3RhdGVtZW50cywgdXNlIGFueSBvZiB0aGUgZm9sbG93aW5nIGluc3RlYWQuCisgICAgICogPHVsPgorICAgICAqICAgPGxpPntAbGluayAjZGVsZXRlKFN0cmluZywgU3RyaW5nLCBTdHJpbmdbXSl9PC9saT4KKyAgICAgKiA8L3VsPgorICAgICAqIDxwPgorICAgICAqIEZvciBleGFtcGxlLCB0aGUgZm9sbG93aW5nIGFyZSBnb29kIGNhbmRpZGF0ZXMgZm9yIHVzaW5nIHRoaXMgbWV0aG9kOgorICAgICAqIDx1bD4KKyAgICAgKiAgIDxsaT5BTFRFUiBUQUJMRTwvbGk+CisgICAgICogICA8bGk+Q1JFQVRFIG9yIERST1AgdGFibGUgLyB0cmlnZ2VyIC8gdmlldyAvIGluZGV4IC8gdmlydHVhbCB0YWJsZTwvbGk+CisgICAgICogICA8bGk+UkVJTkRFWDwvbGk+CisgICAgICogICA8bGk+UkVMRUFTRTwvbGk+CisgICAgICogICA8bGk+U0FWRVBPSU5UPC9saT4KKyAgICAgKiAgIDxsaT5QUkFHTUEgdGhhdCByZXR1cm5zIG5vIGRhdGE8L2xpPgorICAgICAqIDwvdWw+Cisg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leGVjdXRlVXBkYXRlRGVsZXRlKCk7CiAgICAgICAgIH0gY2F0Y2ggKFNRTGl0ZURhdGFiYXNlQ29ycnVwdEV4Y2VwdGlvbiBlKSB7CiAgICAgICAgICAgICBvbkNvcnJ1cHRpb24oKTsKICAgICAgICAgICAgIHRocm93IGU7CiAgICAgICAgIH0gZmluYWxseSB7Ci0gICAgICAgICAgICBpZiAoc3RhdGVtZW50ICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICBzdGF0ZW1lbnQuY2xvc2UoKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHVubG9jaygpOworICAgICAgICAgICAgc3RhdGVtZW50LmNsb3NlKCk7CiAgICAgICAgIH0KICAgICAgICAgbG9nVGltZVN0YXQoc3FsLCB0aW1lU3RhcnQpOwogICAgIH0KIAogICAgIEBPdmVycmlkZQotICAgIHByb3RlY3RlZCB2b2lkIGZpbmFsaXplKCkgewotICAgICAgICBpZiAoaXNPcGVuKCkpIHsKLSAgICAgICAgICAgIExvZy5lKFRBRywgImNsb3NlKCkgd2FzIG5ldmVyIGV4cGxpY2l0bHkgY2FsbGVkIG9uIGRhdGFiYXNlICciICsKLSAgICAgICAgICAgICAgICAgICAgbVBhdGggKyAiJyAiLCBtU3RhY2tUcmFjZSk7Ci0gICAgICAgICAgICBjbG9zZUNsb3NhYmxlKCk7Ci0gICAgICAgICAgICBvbkFsbFJlZmVyZW5jZXNSZWxlYXNlZCgpOworICAgIHByb3RlY3RlZCB2b2lkIGZpbmFsaXplKCkgdGhyb3dzIFRocm93YWJsZSB7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBpZiAoaXNPcGVuKCkpIHsKKyAgICAgICAgICAgICAgICBMb2cuZShUQUcsICJjbG9zZSgpIHdhcyBuZXZlciBleHBsaWNpdGx5IGNhbGxlZCBvbiBkYXRhYmFzZSAnIiArCisgICAgICAgICAgICAgICAgICAgICAgICBtUGF0aCArICInICIsIG1TdGFja1RyYWNlKTsKKyAgICAgICAgIC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Pj0gc1F1ZXJ5TG9nVGltZUluTWlsbGlzKSB7CiAgICAgICAgICAgICBzYW1wbGVQZXJjZW50ID0gMTAwOwotICAgICAgICB9IGVsc2UgezsKKyAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgIHNhbXBsZVBlcmNlbnQgPSAoaW50KSAoMTAwICogZHVyYXRpb25NaWxsaXMgLyBzUXVlcnlMb2dUaW1lSW5NaWxsaXMpICsgMTsKICAgICAgICAgICAgIGlmIChtUmFuZG9tLm5leHRJbnQoMTAwKSA+PSBzYW1wbGVQZXJjZW50KSByZXR1cm47CiAgICAgICAgIH0KQEAgLTE5NzAsNiArMjA3NiwyMCBAQAogICAgICAgICB9CiAgICAgfQogCisgICAgLyogcGFja2FnZSAqLyB2b2lkIHZlcmlmeURiSXNPcGVuKCkgeworICAgICAgICBpZiAoIWlzT3BlbigpKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJkYXRhYmFzZSAiICsgZ2V0UGF0aCgpICsgIiAoY29ubiMgIiArCisgICAgICAgICAgICAgICAgICAgIG1Db25uZWN0aW9uTnVtICsgIikgYWxyZWFkeSBjbG9zZWQiKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qIHBhY2thZ2UgKi8gdm9pZCB2ZXJpZnlMb2NrT3duZXIoKSB7CisgICAgICAgIHZlcmlmeURiSXNPcGVuKCk7CisgICAgICAgIGlmIChtTG9ja2luZ0VuYWJsZWQgJiYgIWlzRGJMb2NrZWRCeUN1cnJlbnRUaHJlYWQoKSkgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiRG9uJ3QgaGF2ZSBkYXRhYmFzZSBsb2NrISIpOworICAgICAgICB9CisgICAgfQorCiAgICAgLyoKICAgICAgKiA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09CiAg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Y2hlU2l6ZSA9PSAwKSB7Ci0gICAgICAgICAgICAvLyBmb3IgdGhpcyBkYXRhYmFzZSwgdGhlcmUgaXMgbm8gY2FjaGUgb2YgY29tcGlsZWQgc3FsLgotICAgICAgICAgICAgaWYgKFNRTGl0ZURlYnVnLkRFQlVHX1NRTF9DQUNIRSkgewotICAgICAgICAgICAgICAgIExvZy52KFRBRywgInxOT1QgYWRkaW5nX3NxbF90b19jYWNoZXwiICsgZ2V0UGF0aCgpICsgInwiICsgc3FsKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgfQotCi0gICAgICAgIFNRTGl0ZUNvbXBpbGVkU3FsIGNvbXBpbGVkU3FsID0gbnVsbDsKICAgICAgICAgc3luY2hyb25pemVkKG1Db21waWxlZFF1ZXJpZXMpIHsKICAgICAgICAgICAgIC8vIGRvbid0IGluc2VydCB0aGUgbmV3IG1hcHBpbmcgaWYgYSBtYXBwaW5nIGFscmVhZHkgZXhpc3RzCi0gICAgICAgICAgICBjb21waWxlZFNxbCA9IG1Db21waWxlZFF1ZXJpZXMuZ2V0KHNxbCk7Ci0gICAgICAgICAgICBpZiAoY29tcGlsZWRTcWwgIT0gbnVsbCkgeworICAgICAgICAgICAgaWYgKG1Db21waWxlZFF1ZXJpZXMuY29udGFpbnNLZXkoc3FsKSkgewogICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIC8vIGFkZCB0aGlzIDxzcWwsIGNvbXBpbGVkU3RhdGVtZW50PiB0byB0aGUgY2FjaGUKKwogICAgICAgICAgICAgaWYgKG1Db21waWxlZFF1ZXJpZXMuc2l6ZSgpID09IG1NYXhTcWxDYWNoZVNpemUpIHsKICAgICAgICAgICAgICAgICAvKgogICAgICAgICAgICAgICAgICAqIGNhY2hlIHNpemUgb2Yge0BsaW5rICNtTWF4U3FsQ2FjaGVTaXplfSBpcyBub3QgZW5vdWdoIGZvciB0aGlzIGFwcC4KLS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9yICIgKwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICJiaW5kYXJncywgaW5zdGVhZCBvZiB1c2luZyBhY3R1YWwgdmFsdWVzIik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0UGF0aCgpICsgIi4gVXNlIHNldE1heFNxbENhY2hlU2l6ZSgpIHRvIGluY3JlYXNlIGNhY2hlc2l6ZS4gIik7CiAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIC8vIGRvbid0IGFkZCB0aGlzIGVudHJ5IHRvIGNhY2hlCi0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIC8vIGNhY2hlIGlzIE5PVCBmdWxsLiBhZGQgdGhpcyB0byBjYWNoZS4KLSAgICAgICAgICAgICAgICBtQ29tcGlsZWRRdWVyaWVzLnB1dChzcWwsIGNvbXBpbGVkU3RhdGVtZW50KTsKLSAgICAgICAgICAgICAgICBpZiAoU1FMaXRlRGVidWcuREVCVUdfU1FMX0NBQ0hFKSB7Ci0gICAgICAgICAgICAgICAgICAgIExvZy52KFRBRywgInxhZGRpbmdfc3FsX3RvX2NhY2hlfCIgKyBnZXRQYXRoKCkgKyAifCIgKwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Db21waWxlZFF1ZXJpZXMuc2l6ZSgpICsgInwiICsgc3FsKTsKLSAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IAorICAgICAgICAgICAgLyogYWRkIHRoZSBnaXZlbiBTUUxpdGVDb21waWxlZFNxbCBjb21waWxlZFN0YXRlbWVudCB0byBjYWNoZS4KKyAgICAgICAgICAgICAqIG5vIG5lZWQgdG8gd29ycnkgYWJvdXQgdGhlIGNhY2hlIHNpemUgLSBiZWNhdXNlIHtAbGluayAjbUNvbXBpbGVkUXVlcmllc30KKyAgICAgICAgICAgICAqIHNlbGYtbGltaXRzIGl0cyBzaXplIHRvIHtAbGluayAjbU1heFNxbENhY2hlU2l6ZX0uCisgICAgICAgICAgICAgKi8KKyAgICAgICAgICAgIG1Db21waWxlZFF1ZXJpZXMucHV0KHNxbCwgY29tcGlsZWRTdGF0ZW1lbnQpOworICAgICAgICAgICAgaWYgKFNRTGl0ZURlYnVnLkRFQlVHX1NRTF9DQUNIRSkgeworICAgICAgICAgICAgICAgIExvZy52KFRBRywgInxhZGRpbmdfc3FsX3RvX2NhY2hlfCIgKyBnZXRQYXRoKCkgKyAifCIgKworICAgICAgICAgICAgICAgICAgICAgICAgbUNvbXBpbGVkUXVlcmllcy5zaXplKCkgKyAifCIgKyBzcWwpOwogICAgICAgICAgICAgfQogICAgICAgICB9Ci0gICAgICAgIHJldHVybjsKICAgICB9CiAKLQotICAgIHByaXZhdGUgdm9pZCBkZWFsbG9jQ2FjaGVkU3FsU3RhdGVtZW50cygpIHsKKyAgICAvKiogcGFja2FnZS1sZXZlbCBhY2Nlc3MgZm9yIHRlc3RpbmcgcHVycG9zZXMgKi8KKyAgICAvKiBwYWNrYWdlICovIHZvaWQgZGVhbGxvY0NhY2hlZFNxbFN0YXRlbWVudHMoKSB7CiAgICAgICAgIHN5bmNocm9uaXplZCAobUNvbXBpbGVkUXVlcmllcykgewogICAgICAgICAgICAgZm9yIChTUUxpdGVDb21waWxlZFNxbCBjb21waWxlZFNxbCA6IG1Db21waWxlZFF1ZXJpZXMudmFsdWVzKCkpIHsKICAgICAgICAgICAgICAgICBjb21waWxlZFNxbC5yZWxlYXNlU3FsU3RhdGVtZW50KCk7CkBAIC0yMDM5LDIwICsyMTQ1LDEzIEBACiAgICAgfQogCiAgICAgLyoqCi0gICAgICogZnJvbSB0aGUgY29tcGlsZWRRdWVyaWVzIGNhY2hlLCByZXR1cm5zIHRoZSBjb21waWxlZC1zdGF0ZW1lbnQtaWQgZm9yIHRoZSBnaXZlbiBzcWwuCi0gICAgICogcmV0dXJucyBudWxsLCBpZiBub3QgZm91bmQgaW4gdGhlIGNhY2hlLgorICAgICAqIEZyb20gdGhlIGNvbXBpbGVkUXVlcmllcyBjYWNoZSwgcmV0dXJucyB0aGUgY29tcGlsZWQtc3RhdGVtZW50LWlkIGZvciB0aGUgZ2l2ZW4gU1FMLgorICAgICAqIFJldHVybnMgbnVsbCwgaWYgbm90IGZvdW5kIGluIHRoZSBjYWNoZS4KICAgICAgKi8KICAgICAvKiBwYWNrYWdlICovIFNRTGl0ZUNvbXBpbGVkU3FsIGdldENvbXBpbGVkU3RhdGVtZW50Rm9yU3FsKFN0cmluZyBzcWwpIHsKICAgICAgICAgU1FMaXRlQ29tcGlsZWRTcWwgY29tcGlsZWRTdGF0ZW1lbnQgPSBudWxsOwogICAgICAgICBib29sZWFuIGNhY2hlSGl0OwogICAgICAgICBzeW5jaHJvbml6ZWQobUNvbXBpbGVkUXVlcmllcykgewotICAgICAgICAgICAgaWYgKG1NYXhTcWxDYWNoZVNpemUgPT0gMCkgewotICAgICAgICAgICAgICAgIC8vIGZvciB0aGlzIGRhdGFiYXNlLCB0aGVyZSBpcyBubyBjYWNoZSBvZiBjb21waWxlZCBzcWwuCi0gICAgICAgICAgICAgICAgaWYgKFNRTGl0ZURlYnVnLkRFQlVHX1NRTF9DQUNIRSkgewotICAgICAgICAgICAgICAgICAgICBMb2cudihUQUcsICJ8Y2FjaGUgTk9UIGZvdW5kfCIgKyBnZXRQYXRoKCkpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKLSAgICAgICAgICAgIH0KICAgICAgICAgICAgIGNhY2hlSGl0ID0gKGNvbXBpbGVkU3RhdGVtZW50ID0gbUNvbXBpbGVkUXVlcmllcy5nZXQoc3FsKSkgIT0gbnVsbDsKICAgICAgICAgfQogICAgICAgICBpZiAoY2FjaGVIaXQpIHsKQEAgLTIwNjUsNjMgKzIxNjQsMjQgQEAKICAgICAgICAgICAgIExvZy52KFRBRywgInxjYWNoZV9zdGF0c3wiICsKICAgICAgICAgICAgICAgICAgICAgZ2V0UGF0aCgpICsgInwiICsgbUNvbXBpbGVkUXVlcmllcy5zaXplKCkgKwogICAgICAgICAgICAgICAgICAgICAifCIgKyBtTnVtQ2FjaGVIaXRzICsgInwiICsgbU51bUNhY2hlTWlzc2VzICsKLSAgICAgICAgICAgICAgICAgICAgInwiICsgY2FjaGVIaXQgKyAifCIgKyBtVGltZU9wZW5lZCArICJ8IiArIG1UaW1lQ2xvc2VkICsgInwiICsgc3FsKTsKKyAgICAgICAgICAgICAgICAgICAgInwiICsgY2FjaGVIaXQgKyAifCIgKyBzcWwpOwogICAgICAgICB9CiAgICAgICAgIHJldHVybiBjb21waWxlZFN0YXRlbWVudDsKICAgICB9CiAKICAgICAvKioKLSAgICAgKiByZXR1cm5zIHRydWUgaWYgdGhlIGdpdmVuIHNxbCBpcyBjYWNoZWQgaW4gY29tcGlsZWQtc3FsIGNhY2hlLgotICAgICAqIEBoaWRlCi0gICAgICovCi0gICAgcHVibGljIGJvb2xlYW4gaXNJbkNvbXBpbGVkU3FsQ2FjaGUoU3RyaW5nIHNxbCkgewotICAgICAgICBzeW5jaHJvbml6ZWQobUNvbXBpbGVkUXVlcmllcykgewotICAgICAgICAgICAgcmV0dXJuIG1Db21waWxlZFF1ZXJpZXMuY29udGFpbnNLZXkoc3FsKTsKLSAgICAgICAgfQotICAgIH0KLQotICAgIC8qKgotICAgICAqIHB1cmdlcyB0aGUgZ2l2ZW4gc3FsIGZyb20gdGhlIGNvbXBpbGVkLXNxbCBjYWNoZS4KLSAgICAgKiBAaGlkZQotICAgICAqLwotICAgIHB1YmxpYyB2b2lkIHB1cmdlRnJvbUNvbXBpbGVkU3FsQ2FjaGUoU3RyaW5nIHNxbCkgewotICAgICAgICBzeW5jaHJvbml6ZWQobUNvbXBpbGVkUXVlcmllcykgewotICAgICAgICAgICAgbUNvbXBpbGVkUXVlcmllcy5yZW1vdmUoc3FsKTsKLSAgICAgICAgfQotICAgIH0KLQotICAgIC8qKgotICAgICAqIHJlbW92ZSBldmVyeXRoaW5nIGZyb20gdGhlIGNvbXBpbGVkIHNxbCBjYWNoZQotICAgICA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pbGVkUXVlcmllcy5jb250YWluc0tleShzcWwpOworICAgICAgICB9CisgICAgfQorCisgICAgLyogcGFja2FnZSAqLyB2b2lkIGZpbmFsaXplU3RhdGVtZW50TGF0ZXIoaW50IGlkKSB7CisgICAgICAgIGlmICghaXNPcGVuKCkpIHsKKyAgICAgICAgICAgIC8vIGRhdGFiYXNlIGFscmVhZHkgY2xvc2VkLiB0aGlzIHN0YXRlbWVudCB3aWxsIGFscmVhZHkgaGF2ZSBiZWVuIGZpbmFsaXplZC4KKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorICAgICAgICBzeW5jaHJvbml6ZWQobUNsb3NlZFN0YXRlbWVudElkcykgeworICAgICAgICAgICAgaWYgKG1DbG9zZWRTdGF0ZW1lbnRJZHMuY29udGFpbnMoaWQpKSB7CisgICAgICAgICAgICAgICAgLy8gdGhpcyBzdGF0ZW1lbnQgaWQgaXMgYWxyZWFkeSBxdWV1ZWQgdXAgZm9yIGZpbmFsaXphdGlvbi4KKyAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICB9CisgICAgICAgICAgICBtQ2xvc2VkU3RhdGVtZW50SWRzLmFkZChpZCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKiBwYWNrYWdlICovIHZvaWQgY2xvc2VQZW5kaW5nU3RhdGVtZW50cygpIHsKKyAgICAgICAgaWYgKCFpc09wZW4oKSkgeworICAgICAgICAgICAgLy8gc2luY2UgdGhpcyBkYXRhYmFzZSBpcyBhbHJlYWR5IGNsb3NlZCwgbm8gbmVlZCB0byBmaW5hbGl6ZSBhbnl0aGluZy4KKyAgICAgICAgICAgIG1DbG9zZWRTdGF0ZW1lbnRJZHMuY2xlYXIoKTsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorICAgICAgICB2ZXJpZnlMb2NrT3duZXIoKTsKKyAgICAgICAgLyogdG8gbWluaW1pemUgc3luY2hyb25pemF0aW9uIG9uIG1DbG9zZWRTdGF0ZW1lbnRJ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gd2l0aCBhdHRhY2hlZCBkYXRhYmFzZXMKKyAgICAgICAgaWYgKGdldEF0dGFjaGVkRGJzKCkuc2l6ZSgpID4gMSkgeworICAgICAgICAgICAgaWYgKExvZy5pc0xvZ2dhYmxlKFRBRywgTG9nLkRFQlVHKSkgeworICAgICAgICAgICAgICAgIExvZy5kKFRBRywKKyAgICAgICAgICAgICAgICAgICAgICAgICJ0aGlzIGRhdGFiYXNlOiAiICsgbVBhdGggKyAiIGhhcyBhdHRhY2hlZCBkYXRhYmFzZXMuIGNhbid0ICBlbmFibGUgV0FMLiIpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgICAgIGlmIChtQ29ubmVjdGlvblBvb2wgPT0gbnVsbCkgeworICAgICAgICAgICAgbUNvbm5lY3Rpb25Qb29sID0gbmV3IERhdGFiYXNlQ29ubmVjdGlvblBvb2wodGhpcyk7CisgICAgICAgICAgICBzZXRKb3VybmFsTW9kZShtUGF0aCwgIldBTCIpOworICAgICAgICB9CisgICAgICAgIHJldHVybiB0cnVlOworICAgIH0KKworICAgIC8qKgorICAgICAqIFRoaXMgbWV0aG9kIGRpc2FibGVzIHRoZSBmZWF0dXJlcyBlbmFibGVkIGJ5IHtAbGluayAjZW5hYmxlV3JpdGVBaGVhZExvZ2dpbmcoKX0uCisgICAgICogQGhpZGUKKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBkaXNhYmxlV3JpdGVBaGVhZExvZ2dpbmcoKSB7CisgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgeworICAgICAgICAgICAgaWYgKG1Db25uZWN0aW9uUG9vbCA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbUNvbm5lY3Rpb25Qb29sLmNsb3NlKCk7CisgICAgICAgICAgICBtQ29ubmVjdGlvblBvb2wgPSBudWxsOworICAgICAgICAgICAgc2V0Sm91cm5hbE1vZGUobVBhdGgsICJUUlVOQ0FURSIpOworICAgICAgICB9CisgICAgfQorCisgICAgLyogcGFja2FnZSAqLyBTUUxpdGVEYXRhYmFzZSBnZXREYXRhYmFzZUhhbmRsZShTdHJpbmcgc3FsKSB7CisgICAgICAgIGlmIChpc1Bvb2xlZENvbm5lY3Rpb24oKSkgeworICAgICAgICAgICAgLy8gdGhpcyBpcyBhIHBvb2xlZCBkYXRhYmFzZSBjb25uZWN0aW9uCisgICAgICAgICAgICAvLyB1c2UgaXQgaWYgaXQgaXMgb3BlbiBBTkQgaWYgSSBhbSBub3QgY3VycmVudGx5IHBhcnQgb2YgYSB0cmFuc2FjdGlvbgorICAgICAgICAgICAgaWYgKGlzT3BlbigpICYmICFhbUlJblRyYW5zYWN0aW9uKCkpIHsKKyAgICAgICAgICAgICAgICAvLyBUT0RPOiB1c2UgYW5vdGhlciBjb25uZWN0aW9uIGZyb20gdGhlIHBvb2wKKyAgICAgICAgICAgICAgICAvLyBpZiB0aGlzIGNvbm5lY3Rpb24gaXMgY3VycmVudGx5IGluIHVzZSBieSBzb21lIG90aGVyIHRocmVhZAorICAgICAgICAgICAgICAgIC8vIEFORCBpZiB0aGVyZSBhcmUgZnJlZSBjb25uZWN0aW9ucyBpbiB0aGUgcG9vbAorICAgICAgICAgICAgICAgIHJldHVybiB0aGlzOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAvLyB0aGUgcG9vbGVkIGNvbm5lY3Rpb24gaXMgbm90IG9wZW4hIGNvdWxkIGhhdmUgYmVlbiBjbG9zZWQgZWl0aGVyIGR1ZQorICAgICAgICAgICAgICAgIC8vIHRvIGNvcnJ1cHRpb24gb24gdGhpcyBvciBzb21lIG90aGVyIGNvbm5lY3Rpb24gdG8gdGhlIGRhdGFiYXNlCisgICAgICAgICAgICAgICAgLy8gT1IsIG1heWJlIHRoZSBjb25uZWN0aW9uIHBvb2wgaXMgZGlzYWJsZWQgYWZ0ZXIgdGhpcyBjb25uZWN0a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B0aGUgY29ubmVjdGlvbiBoYW5kbGUgcG9vbCBzaXplIHNob3VsZCBiZSBzZXQgdG8uCisgICAgICovCisgICAgcHVibGljIHN5bmNocm9uaXplZCB2b2lkIHNldENvbm5lY3Rpb25Qb29sU2l6ZShpbnQgc2l6ZSkgeworICAgICAgICBpZiAobUNvbm5lY3Rpb25Qb29sID09IG51bGwpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oImNvbm5lY3Rpb24gcG9vbCBub3QgZW5hYmxlZCIpOworICAgICAgICB9CisgICAgICAgIGludCBpID0gbUNvbm5lY3Rpb25Qb29sLmdldE1heFBvb2xTaXplKCk7CisgICAgICAgIGlmIChzaXplIDwgaSkgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigKKyAgICAgICAgICAgICAgICAgICAgImNhbm5vdCBzZXQgbWF4IHBvb2wgc2l6ZSB0byBhIHZhbHVlIGxlc3MgdGhhbiB0aGUgY3VycmVudCBtYXggdmFsdWUoPSIgKworICAgICAgICAgICAgICAgICAgICBpICsgIikiKTsKKyAgICAgICAgfQorICAgICAgICBtQ29ubmVjdGlvblBvb2wuc2V0TWF4UG9vbFNpemUoc2l6ZSk7CisgICAgfQorCisgICAgLyogcGFja2FnZSAqLyBTUUxpdGVEYXRhYmFzZSBjcmVhdGVQb29sQ29ubmVjdGlvbihzaG9ydCBjb25uZWN0aW9uTnVtKSB7CisgICAgICAgIFNRTGl0ZURhdGFiYXNlIGRiID0gb3BlbkRhdGFiYXNlKG1QYXRoLCBtRmFjdG9yeSwgbUZsYWdzLCBtRXJyb3JIYW5kbGVyLCBjb25uZWN0aW9uTnVtKTsKKyAgICAgICAgZGIubVBhcmVudENvbm5PYmogPSB0aGlzOworICAgICAgICByZXR1cm4gZGI7CisgICAgfQorCisgICAgcHJpdmF0ZSBzeW5jaHJvbml6ZWQgU1FMaXRlRGF0YWJhc2UgZ2V0U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hbmNlKCkubUFjdGl2ZURhdGFiYXNlcykgeworICAgICAgICAvLyBtYWtlIGEgbG9jYWwgY29weSBvZiBtQWN0aXZlRGF0YWJhc2VzIC0gc28gdGhhdCB0aGlzIG1ldGhvZCBpcyBub3QgY29tcGV0aW5nCisgICAgICAgIC8vIGZvciBzeW5jaHJvbml6YXRpb24gbG9jayBvbiBtQWN0aXZlRGF0YWJhc2VzCisgICAgICAgIEFycmF5TGlzdDxXZWFrUmVmZXJlbmNlPFNRTGl0ZURhdGFiYXNlPj4gdGVtcExpc3Q7CisgICAgICAgIHN5bmNocm9uaXplZChtQWN0aXZlRGF0YWJhc2VzKSB7CisgICAgICAgICAgICB0ZW1wTGlzdCA9IChBcnJheUxpc3Q8V2Vha1JlZmVyZW5jZTxTUUxpdGVEYXRhYmFzZT4+KW1BY3RpdmVEYXRhYmFzZXMuY2xvbmUoKTsKKyAgICAgICAgfQorICAgICAgICBmb3IgKFdlYWtSZWZlcmVuY2U8U1FMaXRlRGF0YWJhc2U+IHcgOiB0ZW1wTGlzdCkgewogICAgICAgICAgICAgU1FMaXRlRGF0YWJhc2UgZGIgPSB3LmdldCgpOwogICAgICAgICAgICAgaWYgKGRiID09IG51bGwgfHwgIWRiLmlzT3BlbigpKSB7CiAgICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAvLyBnZXQgU1FMSVRFX0RCU1RBVFVTX0xPT0tBU0lERV9VU0VEIGZvciB0aGUgZGIKLSAgICAgICAgICAgIGludCBsb29rYXNpZGVVc2VkID0gZGIubmF0aXZlX2dldERiTG9va2FzaWRlKCk7CiAKLSAgICAgICAgICAgIC8vIGdldCB0aGUgbGFzdG5vZGUgb2YgdGhlIGRibmFtZQotICAgICAgICAgICAgU3RyaW5nIHBhdGggPSBkYi5nZXRQYXRoKCk7Ci0gICAgICAgICAgICBpbnQgaW5keCA9IHBhdGgubGFzdEluZGV4T2YoIi8iKTsKLSAgICAgICAgICAgIFN0cmluZyBsYXN0bm9kZSA9IHBhdGguc3Vic3RyaW5nKChpbmR4ICE9IC0xKSA/ICsraW5keCA6IDApOworICAgICAgICAgICAgc3luY2hyb25pemVkIChkYikgeworICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgIC8vIGdldCBTUUxJVEVfREJTVEFUVVNfTE9PS0FTSURFX1VTRUQgZm9yIHRoZSBkYgorICAgICAgICAgICAgICAgICAgICBpbnQgbG9va2FzaWRlVXNlZCA9IGRiLm5hdGl2ZV9nZXREYkxvb2thc2lkZSgpOwogCi0gICAgICAgICAgICAvLyBnZXQgbGlzdCBvZiBhdHRhY2hlZCBkYnMgYW5kIGZvciBlYWNoIGRiLCBnZXQgaXRzIHNpemUgYW5kIHBhZ2VzaXplCi0gICAgICAgICAgICBBcnJheUxpc3Q8UGFpcjxTdHJpbmcsIFN0cmluZz4+IGF0dGFjaGVkRGJzID0gZ2V0QXR0YWNoZWREYnMoZGIpOwotICAgICAgICAgICAgaWYgKGF0dGFjaGVkRGJzID09IG51bGwpIHsKLSAgICAgICAgICAgICAgICBjb250aW51ZTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgYXR0YWNoZWREYnMuc2l6ZSgpOyBpKyspIHsKLSAgICAgICAgICAgICAgICBQYWlyPFN0cmluZywgU3RyaW5nPiBwID0gYXR0YWNoZWREYnMuZ2V0KGkpOwotICAgICAgICAgICAgICAgIGxvbmcgcGFnZUNvdW50ID0gZ2V0UHJhZ21hVmFsKGRiLCBwLmZpcnN0ICsgIi5wYWdlX2NvdW50OyIpOworICAgICAgICAgICAgICAgICAgICAvLyBnZXQgdGhlIGxhc3Rub2RlIG9mIHRoZSBkYm5hbWUKKyAgICAgICAgICAgICAgICAgICAgU3RyaW5nIHBhdGggPSBkYi5nZXRQYXRoKCk7CisgICAgICAgICAgICAgICAgICAgIGludCBpbmR4ID0gcGF0aC5sYXN0SW5kZXhPZigiLyIpOworICAgICAgICAgICAgICAgICAgICBTdHJpbmcgbGFzdG5vZGUgPSBwYXRoLnN1YnN0cmluZygoaW5keCAhPSAtMSkgPyArK2luZHggOiAwKTsKIAotICAgICAgICAgICAgICAgIC8vIGZpcnN0IGVudHJ5IGluIHRoZSBhdHRhY2hlZCBkYiBsaXN0IGlzIGFsd2F5cyB0aGUgbWFpbiBkYXRhYmFzZQotICAgICAgICAgICAgICAgIC8vIGRvbid0IHdvcnJ5IGFib3V0IHByZWZpeGluZyB0aGUgZGJuYW1lIHdpdGggIm1haW4iCi0gICAgICAgICAgICAgICAgU3RyaW5nIGRiTmFtZTsKLSAgICAgICAgICAgICAgICBpZiAoaSA9PSAwKSB7Ci0gICAgICAgICAgICAgICAgICAgIGRiTmFtZSA9IGxhc3Rub2RlOwotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIC8vIGxvb2thc2lkZSBpcyBvbmx5IHJlbGV2YW50IGZvciB0aGUgbWFpbiBkYgotICAgICAgICAgICAgICAgICAgICBsb29rYXNpZGVVc2VkID0gMDsKLSAgICAgICAgICAgICAgICAgICAgZGJOYW1lID0gIiAgKGF0dGFjaGVkKSAiICsgcC5maXJzdDsKLSAgICAgICAgICAgICAgICAgICAgLy8gaWYgdGhlIGF0dGFjaGVkIGRiIGhhcyBhIHBhdGgsIGF0dGFjaCB0aGUgbGFzdG5vZGUgZnJvbSB0aGUgcGF0aCB0byBhYm92ZQotICAgICAgICAgICAgICAgICAgICBpZiAocC5zZWNvbmQudHJpbSgpLmxlbmd0aCgpID4gMCkgewotICAgICAgICAgICAgICAgICAgICAgICAgaW50IGlkeCA9IHAuc2Vjb25kLmxhc3RJbmRleE9mKCIvIik7Ci0gICAgICAgICAgICAgICAgICAgICAgICBkYk5hbWUgKz0gIiA6ICIgKyBwLnNlY29uZC5zdWJzdHJpbmcoKGlkeCAhPSAtMSkgPyArK2lkeCA6IDApOworICAgICAgICAgICAgICAgICAgICAvLyBnZXQgbGlzdCBvZiBhdHRhY2hlZCBkYnMgYW5kIGZvciBlYWNoIGRiLCBnZXQgaXRzIHNpemUgYW5kIHBhZ2VzaXplCisgICAgICAgICAgICAgICAgICAgIEFycmF5TGlzdDxQYWlyPFN0cmluZywgU3RyaW5nPj4gYXR0YWNoZWREYnMgPSBkYi5nZXRBdHRhY2hlZERicygpOworICAgICAgICAgICAgICAgICAgICBpZiAoYXR0YWNoZWREYnMgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgaWYgKHBhZ2VDb3VudCA+IDApIHsKLSAgICAgICAgICAgICAgICAgICAgZGJTdGF0c0xpc3QuYWRkKG5ldyBEYlN0YXRzKGRiTmFtZSwgcGFnZUNvdW50LCBkYi5nZXRQYWdlU2l6ZSgpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvb2thc2lkZVVzZWQpKTsKKyAgICAgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBhdHRhY2hlZERicy5zaXplKCk7IGkrKykgeworICAgICAgICAgICAgICAgICAgICAgICAgUGFpcjxTdHJpbmcsIFN0cmluZz4gcCA9IGF0dGFjaGVkRGJzLmdldChpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGxvbmcgcGFnZUNvdW50ID0gRGF0YWJhc2VVdGlscy5sb25nRm9yUXVlcnkoZGIsICJQUkFHTUEgIiArIHAuZmlyc3QKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiLnBhZ2VfY291bnQ7IiwgbnVsbCk7CisKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIGZpcnN0IGVudHJ5IGluIHRoZSBhdHRhY2hlZCBkYiBsaXN0IGlzIGFsd2F5cyB0aGUgbWFpbiBkYXRhYmFzZQorICAgICAgICAgICAgICAgICAgICAgICAgLy8gZG9uJ3Qgd29ycnkgYWJvdXQgcHJlZml4aW5nIHRoZSBkYm5hbWUgd2l0aCAibWFpbiIKKyAgICAgICAgICAgICAgICAgICAgICAgIFN0cmluZyBkYk5hbWU7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaSA9PSAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGJOYW1lID0gbGFzdG5vZGU7CisgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGxvb2thc2lkZSBpcyBvbmx5IHJlbGV2YW50IGZvciB0aGUgbWFpbiBkYgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvb2thc2lkZVVzZWQgPSAwOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRiTmFtZSA9ICIgIChhdHRhY2hlZCkgIiArIHAuZmlyc3Q7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gaWYgdGhlIGF0dGFjaGVkIGRiIGhhcyBhIHBhdGgsIGF0dGFjaCB0aGUgbGFzdG5vZGUgZnJvbSB0aGUgcGF0aCB0byBhYm92ZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChwLnNlY29uZC50cmltKCkubGVuZ3RoKCkgPiAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBpZHggPSBwLnNlY29uZC5sYXN0SW5kZXhPZigiLyIpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYk5hbWUgKz0gIiA6ICIgKyBwLnNlY29uZC5zdWJzdHJpbmcoKGlkeCAhPSAtMSkgPyArK2lkeCA6IDApOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChwYWdlQ291bnQgPiAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGJTdGF0c0xpc3QuYWRkKG5ldyBEYlN0YXRzKGRiTmFtZSwgcGFnZUNvdW50LCBkYi5nZXRQYWdlU2l6ZSgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbG9va2FzaWRlVXNlZCwgZGIubU51bUNhY2hlSGl0cywgZGIubU51bUNhY2hlTWlzc2VzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGIubUNvbXBpbGVkUXVlcmllcy5zaXplKCkpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAvLyBpZiB0aGVyZSBhcmUgcG9vbGVkIGNvbm5lY3Rpb25zLCByZXR1cm4gdGhlIGNhY2hlIHN0YXRzIGZvciB0aGVtIGFsc28uCisgICAgICAgICAgICAgICAgICAgIGlmIChkYi5tQ29ubmVjdGlvblBvb2wgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChTUUxpdGVEYXRhYmFzZSBwRGIgOiBkYi5tQ29ubmVjdGlvblBvb2wuZ2V0Q29ubmVjdGlvbkxpc3QoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRiU3RhdHNMaXN0LmFkZChuZXcgRGJTdGF0cygiKHBvb2xlZCAjICIgKyBwRGIubUNvbm5lY3Rpb25OdW0gKyAiKSAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIGxhc3Rub2RlLCAwLCAwLCAwLCBwRGIubU51bUNhY2hlSGl0cywgcERiLm1OdW1DYWNoZU1pc3NlcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBEYi5tQ29tcGlsZWRRdWVyaWVzLnNpemUoKSkpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfSBjYXRjaCAoU1FMaXRlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gaWdub3JlLiB3ZSBkb24ndCBjYXJlIGFib3V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ZV9saXN0OyIsIG51bGwpOwotICAgICAgICB3aGlsZSAoYy5tb3ZlVG9OZXh0KCkpIHsKLSAgICAgICAgICAgICBhdHRhY2hlZERicy5hZGQobmV3IFBhaXI8U3RyaW5nLCBTdHJpbmc+KGMuZ2V0U3RyaW5nKDEpLCBjLmdldFN0cmluZygyKSkpOworICAgICAgICBDdXJzb3IgYyA9IG51bGw7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBjID0gcmF3UXVlcnkoInByYWdtYSBkYXRhYmFzZV9saXN0OyIsIG51bGwpOworICAgICAgICAgICAgd2hpbGUgKGMubW92ZVRvTmV4dCgpKSB7CisgICAgICAgICAgICAgICAgLy8gc3FsaXRlIHJldHVybnMgYSByb3cgZm9yIGVhY2ggZGF0YWJhc2UgaW4gdGhlIHJldHVybmVkIGxpc3Qgb2YgZGF0YWJhc2VzLgorICAgICAgICAgICAgICAgIC8vICAgaW4gZWFjaCByb3csCisgICAgICAgICAgICAgICAgLy8gICAgICAgMXN0IGNvbHVtbiBpcyB0aGUgZGF0YWJhc2UgbmFtZSBzdWNoIGFzIG1haW4sIG9yIHRoZSBkYXRhYmFzZQorICAgICAgICAgICAgICAgIC8vICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZSBzcGVjaWZpZWQgb24gdGhlICJBVFRBQ0giIGNvbW1hbmQKKyAgICAgICAgICAgICAgICAvLyAgICAgICAybmQgY29sdW1uIGlzIHRoZSBkYXRhYmFzZSBmaWxlIHBhdGguCisgICAgICAgICAgICAgICAgYXR0YWNoZWREYnMuYWRkKG5ldyBQYWlyPFN0cmluZywgU3RyaW5nPihjLmdldFN0cmluZygxKSwgYy5nZXRTdHJpbmcoMikpKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBmaW5hbGx5IHsKKyAgICAgICAgICAgIGlmIChjICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBjLmNsb3NlKCk7CisgICAgICAgICAgICB9CiAgICAgICAgIH0KLSAgICAgICAgYy5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ICAgICAgICAgIGlmIChhdHRhY2hlZERicyA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiZGF0YWJhc2VsaXN0IGZvcjogIiArIGdldFBhdGgoKSArICIgY291bGRuJ3QgIiArCisgICAgICAgICAgICAgICAgICAgICAgICAiYmUgcmV0cmlldmVkLiBwcm9iYWJseSBiZWNhdXNlIHRoZSBkYXRhYmFzZSBpcyBjbG9zZWQiKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBjYXRjaCAoU1FMaXRlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIC8vIGNhbid0IGdldCBhdHRhY2hlZERiIGxpc3QuIGRvIGludGVncml0eSBjaGVjayBvbiB0aGUgbWFpbiBkYXRhYmFzZQorICAgICAgICAgICAgYXR0YWNoZWREYnMgPSBuZXcgQXJyYXlMaXN0PFBhaXI8U3RyaW5nLCBTdHJpbmc+PigpOworICAgICAgICAgICAgYXR0YWNoZWREYnMuYWRkKG5ldyBQYWlyPFN0cmluZywgU3RyaW5nPigibWFpbiIsIHRoaXMubVBhdGgpKTsKKyAgICAgICAgfQorICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGF0dGFjaGVkRGJzLnNpemUoKTsgaSsrKSB7CisgICAgICAgICAgICBQYWlyPFN0cmluZywgU3RyaW5nPiBwID0gYXR0YWNoZWREYnMuZ2V0KGkpOworICAgICAgICAgICAgU1FMaXRlU3RhdGVtZW50IHByb2cgPSBudWxsOworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICBwcm9nID0gY29tcGlsZVN0YXRlbWVudCgiUFJBR01BICIgKyBwLmZpcnN0ICsgIi5pbnRlZ3JpdHlfY2hlY2soMSk7Iik7CisgICAgICAgICAgICAgICAgU3RyaW5nIHJzbHQgPSBwcm9nLnNpbXBsZVF1ZXJ5Rm9yU3RyaW5nKCk7CisgICAgICAgICAgICAgICAgaWYgKCFyc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lLmlzT3BlbigpKSB7CisgICAgICAgICAgICAgICAgLy8gZGFybiEgdGhlIHVzZXIgY2xvc2VkIHRoZSBkYXRhYmFzZSBieSBjYWxsaW5nIG1EYXRhYmFzZS5jbG9zZSgpCisgICAgICAgICAgICAgICAgbURhdGFiYXNlID0gbnVsbDsKKyAgICAgICAgICAgIH0gZWxzZSBpZiAoIW1EYXRhYmFzZS5pc1JlYWRPbmx5KCkpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gbURhdGFiYXNlOyAgLy8gVGhlIGRhdGFiYXNlIGlzIGFscmVhZHkgb3BlbiBmb3IgYnVzaW5lc3MKKyAgICAgICAgICAgIH0KICAgICAgICAgfQogCiAgICAgICAgIGlmIChtSXNJbml0aWFsaXppbmcpIHsKQEAgLTExNSwxMCArMTQ4LDE0IEBACiAgICAgICAgICAgICBpZiAobU5hbWUgPT0gbnVsbCkgewogICAgICAgICAgICAgICAgIGRiID0gU1FMaXRlRGF0YWJhc2UuY3JlYXRlKG51bGwpOwogICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBkYiA9IG1Db250ZXh0Lm9wZW5PckNyZWF0ZURhdGFiYXNlKG1OYW1lLCAwLCBtRmFjdG9yeSk7CisgICAgICAgICAgICAgICAgZGIgPSBtQ29udGV4dC5vcGVuT3JDcmVhdGVEYXRhYmFzZShtTmFtZSwgMCwgbUZhY3RvcnksIG1FcnJvckhhbmRsZXIpOwogICAgICAgICAgICAgfQogCiAgICAgICAgICAgICBpbnQgdmVyc2lvbiA9IGRiLmdldFZlcnNpb24oKTsKKyAgICAgICAgICAgIGlmICh2ZXJzaW9uID4gbU5ld1ZlcnNpb24pIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJEYXRhYmFzZSAiICsgbU5hbWUgKworICAgICAgICAgICAgICAgICAgICAgICAgIiBjYW5ub3QgYmUgZG93bmdyYWRlZC4gaW5zdGVhZCwgcGxlYXNlIHVuaW5zdGFsbCBuZXcgdmVyc2lvbiBmaXJzdC4iKTsKKyAgICAgICAgICAgIH0KICAgICAgICAgICAgIGlmICh2ZXJzaW9uICE9IG1OZXdWZXJzaW9uKSB7CiAgICAgICAgICAgICAgICAgZGIuYmVnaW5UcmFuc2FjdGlvbigpOwogICAgICAgICAgICAgICAgIHRyeSB7CkBAIC0xNzUsOCArMjEyLDEzIEBACiAgICAgICogICAgIG9yIHtAbGluayAjY2xvc2V9IGlzIGNhbGxlZC4KICAgICAgKi8KICAgICBwdWJsaWMgc3luY2hyb25pemVkIFNRTGl0ZURhdGFiYXNlIGdldFJlYWRhYmxlRGF0YWJhc2UoKSB7Ci0gICAgICAgIGlmIChtRGF0YWJhc2UgIT0gbnVsbCAmJiBtRGF0YWJhc2UuaXNPcGVuKCkpIHsKLSAgICAgICAgICAgIHJldHVybiBtRGF0YWJhc2U7ICAvLyBUaGUgZGF0YWJhc2UgaXMgYWxyZWFkeSBvcGVuIGZvciBidXNpbmVzcworICAgICAgICBpZiAobURhdGFiYXNlICE9IG51bGwpIHsKKyAgICAgICAgICAgIGlmICghbURhdGFiYXNlLmlzT3BlbigpKSB7CisgICAgICAgICAgICAgICAgLy8gZGFybiEgdGhlIHVzZXIgY2xvc2VkIHRoZSBkYXRhYmFzZSBieSBjYWxsaW5nIG1EYXRhYmFzZS5jbG9zZSgpCisgICAgICAgICAgICAgICAgbURhdGFiYXNlID0gbnVsbDsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIG1EYXRhYmFzZTsgIC8vIFRoZSBkYXRhYmFzZSBpcyBhbHJlYWR5IG9wZW4gZm9yIGJ1c2luZXNzCisgICAgICAgICAgICB9CiAgICAgICAgIH0KIAogICAgICAgICBpZiAobUlzSW5pdGlhbGl6aW5nKSB7CkBAIC0xOTQsNyArMjM2LDggQEAKICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgIG1Jc0luaXRpYWxpemluZyA9IHRydW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orICAgICAqICAgPGxpPntAbGluayAjYmluZExvbmcoaW50LCBsb25nKX08L2xpPgorICAgICAqICAgPGxpPntAbGluayAjYmluZE51bGwoaW50KX08L2xpPgorICAgICAqICAgPGxpPntAbGluayAjYmluZFN0cmluZyhpbnQsIFN0cmluZyl9PC9saT4KKyAgICAgKiA8L3VsPgorICAgICAqIDxwPgorICAgICAqIEVhY2ggZW50cnkgaW4gdGhlIGFycmF5IGlzIGEgUGFpciBvZgorICAgICAqIDxvbD4KKyAgICAgKiAgIDxsaT5iaW5kIGFyZyBwb3NpdGlvbiBudW1iZXI8L2xpPgorICAgICAqICAgPGxpPnRoZSB2YWx1ZSB0byBiZSBib3VuZCB0byB0aGUgYmluZGFyZzwvbGk+CisgICAgICogPC9vbD4KKyAgICAgKiA8cD4KKyAgICAgKiBJdCBpcyBsYXppbHkgaW5pdGlhbGl6ZWQgaW4gdGhlIGFib3ZlIGJpbmQgbWV0aG9kcworICAgICAqIGFuZCBpdCBpcyBjbGVhcmVkIGluIHtAbGluayAjY2xlYXJCaW5kaW5ncygpfSBtZXRob2QuCisgICAgICogPHA+CisgICAgICogSXQgaXMgcHJvdGVjdGVkIChpbiBtdWx0aS10aHJlYWRlZCBlbnZpcm9ubWVudCkgYnkge0BsaW5rIFNRTGl0ZVByb2dyYW19LnRoaXMKKyAgICAgKi8KKyAgICAvKiBwYWNrYWdlICovIEhhc2hNYXA8SW50ZWdlciwgT2JqZWN0PiBtQmluZEFyZ3MgPSBudWxsOworICAgIC8qIHBhY2thZ2UgKi8gZmluYWwgaW50IG1TdGF0ZW1lbnRUeXBlOwogCiAgICAgLyogcGFja2FnZSAqLyBTUUxpdGVQcm9ncmFtKFNRTGl0ZURhdGFiYXNlIGRiLCBTdHJpbmcgc3FsKSB7Ci0gICAgICAgIG1EYXRhYmFzZSA9IGRiOworICAgICAgICB0aGlzKGRiLCBzcWwsIG51bGwsIHRydWUpOworICAgIH0KKworICAgIC8qIHBhY2thZ2UgKi8gU1FMaXRlUHJvZ3JhbShTUUxpdGVEYXRhYmFzZSBkYiwgU3RyaW5nIHNxbCwgT2JqZWN0W10gYmluZEFyZ3MsCisgICAgICAgICAgICBib29sZWFuIGNvbXBpbGVGbGFnKSB7CiAgICAgICAgIG1TcWwgPSBzcWwudHJpbSgpOworICAgICAgICBtU3RhdGVtZW50VHlwZSA9IERhdGFiYXNlVXRpbHMuZ2V0U3FsU3RhdGVtZW50VHlwZShtU3FsKTsKICAgICAgICAgZGIuYWNxdWlyZVJlZmVyZW5jZSgpOwogICAgICAgICBkYi5hZGRTUUxpdGVDbG9zYWJsZSh0aGlzKTsKLSAgICAgICAgdGhpcy5uSGFuZGxlID0gZGIubU5hdGl2ZUhhbmRsZTsKKyAgICAgICAgbURhdGFiYXNlID0gZGI7CisgICAgICAgIG5IYW5kbGUgPSBkYi5tTmF0aXZlSGFuZGxlOworICAgICAgICBpZiAoYmluZEFyZ3MgIT0gbnVsbCkgeworICAgICAgICAgICAgaW50IHNpemUgPSBiaW5kQXJncy5sZW5ndGg7CisgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IHNpemU7IGkrKykgeworICAgICAgICAgICAgICAgIHRoaXMuYWRkVG9CaW5kQXJncyhpICsgMSwgYmluZEFyZ3NbaV0pOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGlmIChjb21waWxlRmxhZykgeworICAgICAgICAgICAgY29tcGlsZUFuZGJpbmRBbGxBcmdzKCk7CisgICAgICAgIH0KKyAgICB9CiAKKyAgICBwcml2YXRlIHZvaWQgY29tcGlsZVNxbCgpIHsKICAgICAgICAgLy8gb25seSBjYWNoZSBDUlVEIHN0YXRlbWVudHMKLSAgICAgICAgU3RyaW5nIHByZWZpeFNxbCA9IG1TcWwuc3Vic3RyaW5nKDAsIDYpOwotICAgICAgICBpZiAoIXByZWZpeFNxbC5lcXVhbHNJZ25vcmVDYXNlKCJJTlNFUlQiKSAmJiAhcHJlZml4U3FsLmVxdWFsc0lnbm9yZUNhc2UoI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XZlIHR3byBkaWZmZXJlbnQgU1FMaXRlUHJvZ2FtIG9iamVjdHMgY2FuJ3Qgc2hhcmUgdGhlIHNhbWUKICAgICAgICAgICAgICAgICAvLyBDb21waWxlZFNxbCBvYmplY3QuIGNyZWF0ZSBhIG5ldyBvbmUuCiAgICAgICAgICAgICAgICAgLy8gZmluYWxpemUgaXQgd2hlbiBJIGFtIGRvbmUgd2l0aCBpdCBpbiAidGhpcyIgb2JqZWN0LgotICAgICAgICAgICAgICAgIG1Db21waWxlZFNxbCA9IG5ldyBTUUxpdGVDb21waWxlZFNxbChkYiwgc3FsKTsKKyAgICAgICAgICAgICAgICBtQ29tcGlsZWRTcWwgPSBuZXcgU1FMaXRlQ29tcGlsZWRTcWwobURhdGFiYXNlLCBtU3FsKTsKICAgICAgICAgICAgICAgICBpZiAoU1FMaXRlRGVidWcuREVCVUdfQUNUSVZFX0NVUlNPUl9GSU5BTElaQVRJT04pIHsKICAgICAgICAgICAgICAgICAgICAgTG9nLnYoVEFHLCAiKiogcG9zc2libGUgYnVnICoqIENyZWF0ZWQgTkVXIERiT2JqIChpZCMiICsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtQ29tcGlsZWRTcWwublN0YXRlbWVudCArCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIikgYmVjYXVzZSB0aGUgcHJldmlvdXNseSBjcmVhdGVkIERiT2JqIChpZCMiICsgbGFzdCArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIikgd2FzIG5vdCByZWxlYXNlZCBmb3Igc3FsOiIgKyBzcWwpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICIpIHdhcyBub3QgcmVsZWFzZWQgZm9yIHNxbDoiICsgbVNxbCk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIC8vIHNpbmNlIGl0IGlzIG5vdCBpbiB0aGUgY2FjaGUsIG5vIG5lZWQgdG8gYWNxdWlyZSgpIGl0LgogICAgICAgICAgICAgfQpAQCAtMTE1L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gICAgICAgICAgICAgIG1Db21waWxlZFNxbCA9IG51bGw7Ci0gICAgICAgICAgICAgICAgblN0YXRlbWVudCA9IDA7CiAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgIC8vIGl0IGlzIGluIGNvbXBpbGVkLXNxbCBjYWNoZS4gcmVzZXQgaXRzIENvbXBpbGVkU3FsI21JblVzZSBmbGFnCiAgICAgICAgICAgICAgICAgbUNvbXBpbGVkU3FsLnJlbGVhc2UoKTsKICAgICAgICAgICAgIH0KLSAgICAgICAgfSAKKyAgICAgICAgfQorICAgICAgICBtQ29tcGlsZWRTcWwgPSBudWxsOworICAgICAgICBuU3RhdGVtZW50ID0gMDsKICAgICB9CiAKICAgICAvKioKICAgICAgKiBSZXR1cm5zIGEgdW5pcXVlIGlkZW50aWZpZXIgZm9yIHRoaXMgcHJvZ3JhbS4KICAgICAgKgogICAgICAqIEByZXR1cm4gYSB1bmlxdWUgaWRlbnRpZmllciBmb3IgdGhpcyBwcm9ncmFtCisgICAgICogQGRlcHJlY2F0ZWQgZG8gbm90IHVzZSB0aGlzIG1ldGhvZC4gaXQgaXMgbm90IGd1YXJhbnRlZWQgdG8gYmUgdGhlIHNhbWUgYWNyb3NzIGV4ZWN1dGlvbnMgb2YKKyAgICAgKiB0aGUgU1FMIHN0YXRlbWVudCBjb250YWluZWQgaW4gdGhpcyBvYmplY3QuCiAgICAgICovCisgICAgQERlcHJlY2F0ZWQKICAgICBwdWJsaWMgZmluYWwgaW50IGdldFVuaXF1ZUlkKCkgewotICAgICAgICByZXR1cm4gblN0YXRlbWVudDsKKyAgICAgIHJldHVybiAtMTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiB1c2VkIG9ubHkgZm9yIHRlc3RpbmcgcHVycG9zZXMKKyAgICAgKi8KKyAgICAvKiBwYWNrYWdlICovIGludCBnZXRTcWxTdGF0ZW1lbnRJZCgpIHsKKyAgICAgIHN5bmNocm9uaXplZCh0aGlzKSB7CisgICAgICAgIHJldHVybiAobUNvbXBpbGVkU3FsID09IG51bGwpID8gMCA6IG5TdGF0ZW1lbnQ7CisgICAgICB9CiAgICAgfQogCiAgICAgLyogcGFja2FnZSAqLyBTdHJpbmcgZ2V0U3FsU3RyaW5nKCkgewpAQCAtMTY5LDYgKzIyNCwzOSBAQAogICAgICAgICAvLyBUT0RPIGlzIHRoZXJlIGEgbmVlZCBmb3IgdGhpcz8KICAgICB9CiAKKyAgICBwcml2YXRlIHZvaWQgYmluZChpbnQgdHlwZSwgaW50IGluZGV4LCBPYmplY3QgdmFsdWUpIHsKKyAgICAgICAgbURhdGFiYXNlLnZlcmlmeURiSXNPcGVuKCk7CisgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgeworICAgICAgICAgICAgYWRkVG9CaW5kQXJncyhpbmRleCwgKHR5cGUgPT0gQ3Vyc29yLkZJRUxEX1RZUEVfTlVMTCkgPyBudWxsIDogdmFsdWUpOworICAgICAgICAgICAgaWYgKG5TdGF0ZW1lbnQgPiAwKSB7CisgICAgICAgICAgICAgICAgLy8gYmluZCBvbmx5IGlmIHRoZSBTUUwgc3RhdGVtZW50IGlzIGNvbXBpbGVkCisgICAgICAgICAgICAgICAgYWNxdWlyZVJlZmVyZW5jZSgpOworICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAodHlwZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBDdXJzb3IuRklFTERfVFlQRV9OVUxMOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hdGl2ZV9iaW5kX251bGwoaW5kZXgpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBDdXJzb3IuRklFTERfVFlQRV9CTE9COgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hdGl2ZV9iaW5kX2Jsb2IoaW5kZXgsIChieXRlW10pIHZhbHVlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgQ3Vyc29yLkZJRUxEX1RZUEVfRkxPQVQ6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmF0aXZlX2JpbmRfZG91YmxlKGluZGV4LCAoRG91YmxlKSB2YWx1ZSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEN1cnNvci5GSUVMRF9UWVBFX0lOVEVHRVI6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmF0aXZlX2JpbmRfbG9uZyhpbmRleCwgKExvbmcpIHZhbHVlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgQ3Vyc29yLkZJRUxEX1RZUEVfU1RSSU5HOgorICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYXRpdmVfYmluZF9zdHJpbmcoaW5kZXgsIChTdHJpbmcpIHZhbHVlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICAgICAgICAgIHJlbGVhc2VSZWZlcmVuY2UoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKICAgICAvKioKICAgICAgKiBCaW5kIGEgTlVMTCB2YWx1ZSB0byB0aGlzIHN0YXRlbWVudC4gVGhlIHZhbHVlIHJlbWFpbnMgYm91bmQgdW50aWwKICAgICAgKiB7QGxpbmsgI2NsZWFyQmluZGluZ3N9IGlzIGNhbGxlZC4KQEAgLTE3NiwzNCArMjY0LDE4IEBACiAgICAgICogQHBhcmFtIGluZGV4IFRoZSAxLWJhc2VkIGluZGV4IHRvIHRoZSBwYXJhbWV0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gICAgbmF0aXZlX2JpbmRfYmxvYihpbmRleCwgdmFsdWUpOwotICAgICAgICB9IGZpbmFsbHkgewotICAgICAgICAgICAgcmVsZWFzZVJlZmVyZW5jZSgpOwotICAgICAgICB9CisgICAgICAgIGJpbmQoQ3Vyc29yLkZJRUxEX1RZUEVfQkxPQiwgaW5kZXgsIHZhbHVlKTsKICAgICB9CiAKICAgICAvKioKICAgICAgKiBDbGVhcnMgYWxsIGV4aXN0aW5nIGJpbmRpbmdzLiBVbnNldCBiaW5kaW5ncyBhcmUgdHJlYXRlZCBhcyBOVUxMLgogICAgICAqLwogICAgIHB1YmxpYyB2b2lkIGNsZWFyQmluZGluZ3MoKSB7Ci0gICAgICAgIGlmICghbURhdGFiYXNlLmlzT3BlbigpKSB7Ci0gICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJkYXRhYmFzZSAiICsgbURhdGFiYXNlLmdldFBhdGgoKSArICIgYWxyZWFkeSBjbG9zZWQiKTsKLSAgICAgICAgfQotICAgICAgICBhY3F1aXJlUmVmZXJlbmNlKCk7Ci0gICAgICAgIHRyeSB7Ci0gICAgICAgICAgICBuYXRpdmVfY2xlYXJfYmluZGluZ3MoKTsKLSAgICAgICAgfSBmaW5hbGx5IHsKLSAgICAgICAgICAgIHJlbGVhc2VSZWZlcmVuY2UoKTsKKyAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CisgICAgICAgICAgICBtQmluZEFyZ3MgPSBudWxsOworICAgICAgICAgICAgaWYgKHRoaXMublN0YXRlbWVudCA9PSAwKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbURhdGFiYXNlLnZlcmlmeURiSXNPcGVuKCk7CisgICAgICAgICAgICBhY3F1aXJlUmVmZXJlbmNlKCk7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIG5hdGl2ZV9jbGVhcl9iaW5kaW5ncygpOworICAgICAgICAgICAgfSBmaW5hbGx5IHsKKyAgICAgICAgICAgICAgICByZWxlYXNlUmVmZXJlbmNlKCk7CisgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICB9CiAKQEAgLTI4OCwxNCArMzQwLDY4IEBACiAgICAgICogUmVsZWFzZSB0aGlzIHByb2dyYW0ncyByZXNvdXJjZXMsIG1ha2luZyBpdCBpbnZhbGlkLgogICAgICAqLwogICAgIHB1YmxpYyB2b2lkIGNsb3NlKCkgewotICAgICAgICBpZiAoIW1EYXRhYmFzZS5pc09wZW4oKSkgeworICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKKyAgICAgICAgICAgIG1CaW5kQXJncyA9IG51bGw7CisgICAgICAgICAgICBpZiAobkhhbmRsZSA9PSAwIHx8ICFtRGF0YWJhc2UuaXNPcGVuKCkpIHsKKyAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZWxlYXNlUmVmZXJlbmNlKCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIHN5bmNocm9uaXplZCB2b2lkIGFkZFRvQmluZEFyZ3MoaW50IGluZGV4LCBPYmplY3QgdmFsdWUpIHsKKyAgICAgICAgaWYgKG1CaW5kQXJncyA9PSBudWxsKSB7CisgICAgICAgICAgICBtQmluZEFyZ3MgPSBuZXcgSGFzaE1hcDxJbnRlZ2VyLCBPYmplY3Q+KCk7CisgICAgICAgIH0KKyAgICAgICAgbUJpbmRBcmdzLnB1dChpbmRleCwgdmFsdWUpOworICAgIH0KKworICAgIC8qIHBhY2thZ2UgKi8gc3luY2hyb25pemVkIHZvaWQgY29tcGlsZUFuZGJpbmRBbGxBcmdzKCkgeworICAgICAgICBpZiAoblN0YXRlbWVudCA9PSAwKSB7CisgICAgICAgICAgICAvLyBTUUwgc3RhdGVtZW50IGlzIG5vdCBjb21waWxlZCB5ZXQuIGNvbXBpbGUgaXQgbm93LgorICAgICAgICAgICAgY29tcGlsZVNxbCgpOworICAgICAgICB9CisgICAgICAgIGlmIChtQmluZEFyZ3MgPT0gbnVsbCkgewogICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICB9Ci0gICAgICAgIG1EYXRhYmFzZS5sb2NrKCk7Ci0gICAgICAgIHRyeSB7Ci0gICAgICAgICAgICByZWxlYXNlUmVmZXJlbmNlKCk7Ci0gICAgICAgIH0gZmluYWxseSB7Ci0gICAgICAgICAgICBtRGF0YWJhc2UudW5sb2NrKCk7CisgICAgICAgIGZvciAoaW50IGluZGV4IDogbUJpbmRBcmdzLmtleVNldCgpKSB7CisgICAgICAgICAgICBPYmplY3QgdmFsdWUgPSBtQmluZEFyZ3MuZ2V0KGluZGV4KTsKKyAgICAgICAgICAgIGlmICh2YWx1ZSA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgbmF0aXZlX2JpbmRfbnVsbChpbmRleCk7CisgICAgICAgICAgICB9IGVsc2UgaWYgKHZhbHVlIGluc3RhbmNlb2YgRG91YmxlIHx8IHZhbHVlIGluc3RhbmNlb2YgRmxvYXQpIHsKKyAgICAgICAgICAgICAgICBuYXRpdmVfYmluZF9kb3VibGUoaW5kZXgsICgoTnVtYmVyKSB2YWx1ZSkuZG91YmxlVmFsdWUoKSk7CisgICAgICAgICAgICB9IGVsc2UgaWYgKHZhbHVlIGluc3RhbmNlb2YgTnVtYmVyKSB7CisgICAgICAgICAgICAgICAgbmF0aXZlX2JpbmRfbG9uZyhpbmRleCwgKChOdW1iZXIpIHZhbHVlKS5sb25nVmFsdWUoKSk7CisgICAgICAgICAgICB9IGVsc2UgaWYgKHZhbHVlIGluc3RhbmNlb2YgQm9vbGVhbikgeworICAgICAgICAgICAgICAgIEJvb2xlYW4gYm9vbCA9IChCb29sZWFuKXZhbHVlOworICAgICAgICAgICAgICAgIG5hdGl2ZV9iaW5kX2xvbmcoaW5kZXgsIChib29sKSA/IDEgOiAwKTsKKyAgICAgICAgICAgICAgICBpZiAoYm9vbCkgeworICAgICAgICAgICAgICAgICAgICBuYXRpdmVfYmluZF9sb25nKGluZGV4LCAxKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICBuYXRpdmVfYmluZF9sb25nKGluZGV4LCAwKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGVsc2UgaWYgKHZhbHVlIGluc3RhbmNlb2YgYnl0ZVtdKXsKKyAgICAgICAgICAgICAgICBuYXRpdmVfYmluZF9ibG9iKGluZGV4LCAoYnl0ZVtdKSB2YWx1ZSk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIG5hdGl2ZV9iaW5kX3N0cmluZyhpbmRleCwgdmFsdWUudG9TdHJpbmcoKSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBHaXZlbiBhbiBhcnJheSBvZiBTdHJpbmcgYmluZEFyZ3MsIHRoaXMgbWV0aG9kIGJpbmRzIGFsbCBvZiB0aGVtIGluIG9uZSBzaW5nbGUgY2FsbC4KKyAgICAgKgorICAgICAqIEBwYXJhbSBiaW5kQXJncyB0aGUgU3RyaW5nIGFycmF5IG9mIGJpbmQgYXJncy4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBiaW5kQWxsQXJnc0FzU3RyaW5ncyhTdHJpbmdbXSBiaW5kQXJncykgeworICAgICAgICBpZiAoYmluZEFyZ3MgPT0gbnVsbCkgeworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisgICAgICAgIGludCBzaXplID0gYmluZEFyZ3MubGVuZ3RoOworICAgICAgICBzeW5jaHJvbml6ZWQodGhpcykgeworICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBzaXplOyBpKyspIHsKKyAgICAgICAgICAgICAgICBiaW5kU3RyaW5nKGkgKyAxLCBiaW5kQXJnc1tpXSk7CisgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICB9CiAKZGlmZiAtLWdpdCBhL2NvcmUvamF2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KTsKLSAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgbURhdGFiYXNlLmxvZ1RpbWVTdGF0KG1TcWwsIHRpbWVTdGFydCk7CiAgICAgICAgICAgICAgICAgcmV0dXJuIG51bVJvd3M7CiAgICAgICAgICAgICB9IGNhdGNoIChJbGxlZ2FsU3RhdGVFeGNlcHRpb24gZSl7CkBAIC0xNDEsNTEgKzE0NCwxMyBAQAogICAgICAqIENhbGxlZCBieSBTUUxpdGVDdXJzb3Igd2hlbiBpdCBpcyByZXF1ZXJpZWQuCiAgICAgICovCiAgICAgLyogcGFja2FnZSAqLyB2b2lkIHJlcXVlcnkoKSB7Ci0gICAgICAgIGlmIChtQmluZEFyZ3MgIT0gbnVsbCkgewotICAgICAgICAgICAgaW50IGxlbiA9IG1CaW5kQXJncy5sZW5ndGg7Ci0gICAgICAgICAgICB0cnkgewotICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbGVuOyBpKyspIHsKLSAgICAgICAgICAgICAgICAgICAgc3VwZXIuYmluZFN0cmluZyhpICsgMSwgbUJpbmRBcmdzW2ldKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9IGNhdGNoIChTUUxpdGVNaXN1c2VFeGNlcHRpb24gZSkgewotICAgICAgICAgICAgICAgIFN0cmluZ0J1aWxkZXIgZXJyTXNnID0gbmV3IFN0cmluZ0J1aWxkZXIoIm1TcWwgIiArIG1TcWwpOwotICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbGVuOyBpKyspIHsKLSAgICAgICAgICAgICAgICAgICAgZXJyTXNnLmFwcGVuZCgiICIpOwotICAgICAgICAgICAgICAgICAgICBlcnJNc2cuYXBwZW5kKG1CaW5kQXJnc1tpXSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGVyck1zZy5hcHBlbmQoIiAiKTsKLSAgICAgICAgICAgICAgICBJbGxlZ2FsU3RhdGVFeGNlcHRpb24g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V0aW9uLgorICAgICAqIEB0aHJvd3MgYW5kcm9pZC5kYXRhYmFzZS5TUUxFeGNlcHRpb24gSWYgdGhlIFNRTCBzdHJpbmcgaXMgaW52YWxpZCBmb3IKKyAgICAgKiAgICAgICAgIHNvbWUgcmVhc29uCisgICAgICovCisgICAgcHVibGljIGludCBleGVjdXRlVXBkYXRlRGVsZXRlKCkgeworICAgICAgICBzeW5jaHJvbml6ZWQodGhpcykgeworICAgICAgICAgICAgbG9uZyB0aW1lU3RhcnQgPSBhY3F1aXJlQW5kTG9jayhXUklURSk7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIGludCBudW1DaGFuZ2VzID0gbmF0aXZlX2V4ZWN1dGUoKTsKKyAgICAgICAgICAgICAgICBtRGF0YWJhc2UubG9nVGltZVN0YXQobVNxbCwgdGltZVN0YXJ0KTsKKyAgICAgICAgICAgICAgICByZXR1cm4gbnVtQ2hhbmdlczsKKyAgICAgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICAgICAgcmVsZWFzZUFuZFVubG9jaygpOworICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgfQogCkBAIC03NiwyMSArMTAyLDE1IEBACiAgICAgICogICAgICAgICBzb21lIHJlYXNvbgogICAgICAqLwogICAgIHB1YmxpYyBsb25nIGV4ZWN1dGVJbnNlcnQoKSB7Ci0gICAgICAgIEJsb2NrR3VhcmQuZ2V0VGhyZWFkUG9saWN5KCkub25Xcml0ZVRvRGlzaygpOwotICAgICAgICBpZiAoIW1EYXRhYmFzZS5pc09wZW4oKSkgewotICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiZGF0YWJhc2UgIiArIG1EYXRhYmFzZS5nZXRQYXRoKCkgKyAiIGFscmVhZHkgY2xvc2VkIik7Ci0gICAgICAgIH0KLSAgICAgICAgbG9uZyB0aW1lU3RhcnQgPSBTeXN0ZW1DbG9jay51cHRpbWVNaWxsaXMoKTsKLSAgICAgICAgbURhdGFiYXNlLmxvY2soKTsKLQotICAgICAgICBhY3F1aXJlUmVmZXJlbmNlKCk7Ci0gICAgICAgIHRyeSB7Ci0gICAgICAgICAgICBuYXRpdmVfZXhlY3V0ZSgpOwotICAgICAgICAgICAgbURhdGFiYXNlLmxvZ1RpbWVTdGF0KG1TcWwsIHRpbWVTdGFydCk7Ci0gICAgICAgICAgICByZXR1cm4gKG1EYXRhYmFzZS5sYXN0Q2hhbmdlQ291bnQoKSA+IDApID8gbURhdGFiYXNlLmxhc3RJbnNlcnRSb3coKSA6IC0xOwotICAgICAgICB9IGZpbmFsbHkgewotICAgICAgICAgICAgcmVsZWFzZVJlZmVyZW5jZSgpOwotICAgICAgICAgICAgbURhdGFiYXNlLnVubG9jaygpOworICAgICAgICBzeW5jaHJvbml6ZWQodGhpcykgeworICAgICAgICAgICAgbG9uZyB0aW1lU3RhcnQgPSBhY3F1aXJlQW5kTG9jayhXUklURSk7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIGxvbmcgbGFzdEluc2VydGVkUm93SWQgPSBuYXRpdmVfZXhlY3V0ZUluc2VydCgpOworICAgICAgICAgICAgICAgIG1EYXRhYmFzZS5sb2dUaW1lU3RhdChtU3FsLCB0aW1lU3RhcnQpOworICAgICAgICAgICAgICAgIHJldHVybiBsYXN0SW5zZXJ0ZWRSb3dJZDsKKyAgICAgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICAgICAgcmVsZWFzZUFuZFVubG9jaygpOworICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgfQogCkBAIC0xMDMsMjEgKzEyMywxNSBAQAogICAgICAqIEB0aHJvd3MgYW5kcm9pZC5kYXRhYmFzZS5zcWxpdGUuU1FMaXRlRG9uZUV4Y2VwdGlvbiBpZiB0aGUgcXVlcnkgcmV0dXJucyB6ZXJvIHJvd3MKICAgICAgKi8KICAgICBwdWJsaWMgbG9uZyBzaW1wbGVRdWVyeUZvckxvbmcoKSB7Ci0gICAgICAgIEJsb2NrR3VhcmQuZ2V0VGhyZWFkUG9saWN5KCkub25SZWFkRnJvbURpc2soKTsKLSAgICAgICAgaWYgKCFtRGF0YWJhc2UuaXNPcGVuKCkpIHsKLSAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oImRhdGFiYXNlICIgKyBtRGF0YWJhc2UuZ2V0UGF0aCgpICsgIiBhbHJlYWR5IGNsb3NlZCIpOwotICAgICAgICB9Ci0gICAgICAgIGxvbmcgdGltZVN0YXJ0ID0gU3lzdGVtQ2xvY2sudXB0aW1lTWlsbGlzKCk7Ci0gICAgICAgIG1EYXRhYmFzZS5sb2NrKCk7Ci0KLSAgICAgICAgYWNxdWlyZVJlZmVyZW5jZSgpOwotICAgICAgICB0cnkgewotICAgICAgICAgICAgbG9uZyByZXRWYWx1ZSA9IG5hdGl2ZV8xeDFfbG9uZygpOwotICAgICAgICAgICAgbURhdGFiYXNlLmxvZ1RpbWVTdGF0KG1TcWwsIHRpbWVTdGFydCk7Ci0gICAgICAgICAgICByZXR1cm4gcmV0VmFsdWU7Ci0gICAgICAgIH0gZmluYWxseSB7Ci0gICAgICAgICAgICByZWxlYXNlUmVmZXJlbmNlKCk7Ci0gICAgICAgICAgICBtRGF0YWJhc2UudW5sb2NrKCk7CisgICAgICAgIHN5bmNocm9uaXplZCh0aGlzKSB7CisgICAgICAgICAgICBsb25nIHRpbWVTdGFydCA9IGFjcXVpcmVBbmRMb2NrKFJFQUQpOworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICBsb25nIHJldFZhbHVlID0gbmF0aXZlXzF4MV9sb25nKCk7CisgICAgICAgICAgICAgICAgbURhdGFiYXNlLmxvZ1RpbWVTdGF0KG1TcWwsIHRpbWVTdGFydCk7CisgICAgICAgICAgICAgICAgcmV0dXJuIHJldFZhbHVlOworICAgICAgICAgICAgfSBmaW5hbGx5IHsKKyAgICAgICAgICAgICAgICByZWxlYXNlQW5kVW5sb2NrKC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VBRCk7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIFN0cmluZyByZXRWYWx1ZSA9IG5hdGl2ZV8xeDFfc3RyaW5nKCk7CisgICAgICAgICAgICAgICAgbURhdGFiYXNlLmxvZ1RpbWVTdGF0KG1TcWwsIHRpbWVTdGFydCk7CisgICAgICAgICAgICAgICAgcmV0dXJuIHJldFZhbHVlOworICAgICAgICAgICAgfSBmaW5hbGx5IHsKKyAgICAgICAgICAgICAgICByZWxlYXNlQW5kVW5sb2NrKCk7CisgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICB9CiAKLSAgICBwcml2YXRlIGZpbmFsIG5hdGl2ZSB2b2lkIG5hdGl2ZV9leGVjdXRlKCk7CisgICAgLyoqCisgICAgICogRXhlY3V0ZXMgYSBzdGF0ZW1lbnQgdGhhdCByZXR1cm5zIGEgMSBieSAxIHRhYmxlIHdpdGggYSBibG9iIHZhbHVlLgorICAgICAqCisgICAgICogQHJldHVybiBBIHJlYWQtb25seSBmaWxlIGRlc2NyaXB0b3IgZm9yIGEgY29weSBvZiB0aGUgYmxvYiB2YWx1ZSwgb3Ige0Bjb2RlIG51bGx9CisgICAgICogICAgICAgICBpZiB0aGUgdmFsdWUgaXMgbnVsbCBvciBjb3VsZCBub3QgYmUgcmVhZCBmb3Igc29tZSByZWFzb24uCisgICAgICoKKyAgICAgKiBAdGhyb3dzIGFuZHJvaWQuZGF0YWJhc2Uuc3FsaXRlLlNRTGl0ZURvbmVFeGNlcHRpb24gaWYgdGhlIHF1ZXJ5IHJldHVybnMgemVybyByb3dzCisgICAgICovCisgICAgcHVibGljIFBhcmNlbEZpbGVEZXNjcmlwdG9yIHNpbXBsZVF1ZXJ5Rm9yQmxvYkZpbGVEZXNjcmlwdG9yKCkgeworICAgICAgICBzeW5jaHJvbml6ZWQodGhpcykgeworICAgICAgICAgICAgbG9uZyB0aW1lU3RhcnQgPSBhY3F1aXJlQW5kTG9jayhSRUFEKTsKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgUGFyY2VsRmlsZURlc2NyaXB0b3IgcmV0VmFsdWUgPSBuYXRpdmVfMXgxX2Jsb2JfYXNobWVtKCk7CisgICAgICAgICAgICAgICAgbURhdGFiYXNlLmxvZ1RpbWVTdGF0KG1TcWwsIHRpbWVTdGFydCk7CisgICAgICAgICAgICAgICAgcmV0dXJuIHJldFZhbHVlOworICAgICAgICAgICAgfSBjYXRjaCAoSU9FeGNlcHRpb24gZXgpIHsKKyAgICAgICAgICAgICAgICBMb2cuZShUQUcsICJzaW1wbGVRdWVyeUZvckJsb2JGaWxlRGVzY3JpcHRvcigpIGZhaWxlZCIsIGV4KTsKKyAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICAgICAgcmVsZWFzZUFuZFVubG9jaygpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogQ2FsbGVkIGJlZm9yZSBldmVyeSBtZXRob2QgaW4gdGhpcyBjbGFzcyBiZWZvcmUgZXhlY3V0aW5nIGEgU1FMIHN0YXRlbWVudCwKKyAgICAgKiB0aGlzIG1ldGhvZCBkb2VzIHRoZSBmb2xsb3dpbmc6CisgICAgICogPHVsPgorICAgICAqICAgPGxpPm1ha2Ugc3VyZSB0aGUgZGF0YWJhc2UgaXMgb3BlbjwvbGk+CisgICAgICogICA8bGk+Z2V0IGEgZGF0YWJhc2UgY29ubmVjdGlvbiBmcm9tIHRoZSBjb25uZWN0aW9uIHBvb2wsaWYgcG9zc2libGU8L2xpPgorICAgICAqICAgPGxpPm5vdGlmaWVzIHtAbGluayBCbG9ja0d1YXJkfSBvZiByZWFkL3dyaXRlPC9saT4KKyAgICAgKiAgIDxsaT5pZiB0aGUgU1FMIHN0YXRlbWVudCBpcyBhbiB1cGRhdGUsIHN0YXJ0IHRyYW5zYWN0aW9uIGlmIG5vdCBhbHJlYWR5IGluIG9uZS4KKy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GVsc2UgaWYgKG1TdGF0ZW1lbnRUeXBlID09IERhdGFiYXNlVXRpbHMuU1RBVEVNRU5UX1VQREFURSkgeworICAgICAgICAgICAgLy8gZ290IHVwZGF0ZSBTUUwgc3RhdGVtZW50LiBpZiB0aGVyZSBpcyBOTyBwZW5kaW5nIHRyYW5zYWN0aW9uLCBzdGFydCBvbmUKKyAgICAgICAgICAgIGlmICghbURhdGFiYXNlLmluVHJhbnNhY3Rpb24oKSkgeworICAgICAgICAgICAgICAgIG1EYXRhYmFzZS5iZWdpblRyYW5zYWN0aW9uTm9uRXhjbHVzaXZlKCk7CisgICAgICAgICAgICAgICAgbVN0YXRlID0gVFJBTlNfU1RBUlRFRDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICAvLyBkbyBJIGhhdmUgZGF0YWJhc2UgbG9jaz8gaWYgbm90LCBncmFiIGl0LgorICAgICAgICBpZiAoIW1EYXRhYmFzZS5pc0RiTG9ja2VkQnlDdXJyZW50VGhyZWFkKCkpIHsKKyAgICAgICAgICAgIG1EYXRhYmFzZS5sb2NrKCk7CisgICAgICAgICAgICBtU3RhdGUgPSBMT0NLX0FDUVVJUkVEOworICAgICAgICB9CisKKyAgICAgICAgYWNxdWlyZVJlZmVyZW5jZSgpOworICAgICAgICBsb25nIHN0YXJ0VGltZSA9IFN5c3RlbUNsb2NrLnVwdGltZU1pbGxpcygpOworICAgICAgICBtRGF0YWJhc2UuY2xvc2VQZW5kaW5nU3RhdGVtZW50cygpOworICAgICAgICBjb21waWxlQW5kYmluZEFsbEFyZ3MoKTsKKyAgICAgICAgcmV0dXJuIHN0YXJ0VGltZTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiB0aGlzIG1ldGhvZCByZWxlYXNlcyBsb2NrcyBhbmQgcmVmZXJlbmNlcyBhY3F1aXJlZCBpbiB7QGxpbmsgI2FjcXVpcmVBbmRMb2NrKGJvb2xlYW4pfQorICAgICAqLworICAgIHByaXZhdGUgdm9pZCByZWxlY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dGhhdCBoYXZlIGJhY2tncm91bmQgc2VydmljZXMgdGhhdCB1c2UgdGhlIG5ldHdvcmsKICAgICAgKiBzaG91bGQgbGlzdGVuIHRvIHtAbGluayAjQUNUSU9OX0JBQ0tHUk9VTkRfREFUQV9TRVRUSU5HX0NIQU5HRUR9LgotICAgICAqIAorICAgICAqCiAgICAgICogQHJldHVybiBXaGV0aGVyIGJhY2tncm91bmQgZGF0YSB1c2FnZSBpcyBhbGxvd2VkLgogICAgICAqLwogICAgIHB1YmxpYyBib29sZWFuIGdldEJhY2tncm91bmREYXRhU2V0dGluZygpIHsKICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgIHJldHVybiBtU2VydmljZS5nZXRCYWNrZ3JvdW5kRGF0YVNldHRpbmcoKTsKICAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKLSAgICAgICAgICAgIC8vIEVyciBvbiB0aGUgc2lkZSBvZiBzYWZldHkgCisgICAgICAgICAgICAvLyBFcnIgb24gdGhlIHNpZGUgb2Ygc2FmZXR5CiAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgIH0KICAgICB9CkBAIC01MTMsNiArNTEzLDE3IEBACiAgICAgICAgIH0KICAgICB9CiAKKyAgICAvKioKKyAgICAgKiB7QGhpZGV9CisgICAgICovCisgICAgcHVibGljIFN0cmluZ1tdIGdldFRldGhlcmFibGVCbHVldG9vdGhSZWdleHMoKSB7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICByZXR1cm4gbVNlcnZpY2UuZ2V0VGV0aGVyYWJsZUJsdWV0b290aFJlZ2V4cygpOworICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgcmV0dXJuIG5ldyBTdHJpbmdbMF07CisgICAgICAgIH0KKyAgICB9CisKICAgICAvKioge0BoaWRlfSAqLwogICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IFRFVEhFUl9FUlJPUl9OT19F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hL2FuZHJvaWQvbmV0L0Rvd25sb2Fkcy5qYXZhCisrKyBiL2NvcmUvamF2YS9hbmRyb2lkL25ldC9Eb3dubG9hZHMuamF2YQpAQCAtNDMwLDExICs0MzAsMTAgQEAKIAogICAgICAgICAgICAgQ29udGVudFJlc29sdmVyIGNyID0gY29udGV4dC5nZXRDb250ZW50UmVzb2x2ZXIoKTsKIAotICAgICAgICAgICAgQ3Vyc29yIGMgPSBjci5xdWVyeSgKLSAgICAgICAgICAgICAgICAgICAgZG93bmxvYWRVcmksIERPV05MT0FEU19QUk9KRUNUSU9OLCBudWxsIC8qIHNlbGVjdGlvbiAqLywgbnVsbCAvKiBzZWxlY3Rpb24gYXJncyAqLywKLSAgICAgICAgICAgICAgICAgICAgbnVsbCAvKiBzb3J0IG9yZGVyICovKTsKKyAgICAgICAgICAgIEN1cnNvciBjID0gY3IucXVlcnkoZG93bmxvYWRVcmksIERPV05MT0FEU19QUk9KRUNUSU9OLCBudWxsIC8qIHNlbGVjdGlvbiAqLywKKyAgICAgICAgICAgICAgICAgICAgbnVsbCAvKiBzZWxlY3Rpb24gYXJncyAqLywgbnVsbCAvKiBzb3J0IG9yZGVyICovKTsKICAgICAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICAgICAgaWYgKCFjLm1vdmVUb05leHQoKSkgeworICAgICAgICAgICAgICAgIGlmIChjID09IG51bGwgfHwgIWMubW92ZVRvTmV4dCgpKSB7CiAgICAgICAgICAgICAgICAgICAgIHJldHVybiByZXN1bHQ7CiAgICAgICAgICAgICAgICAgfQogCmRpZmYgLS1naXQgYS9jb3JlL2phdmEvYW5kcm9pZC9uZXQvSUNvbm5lY3Rpdml0eU1hbmFnZXIuYWlkbCBiL2NvcmUvamF2YS9hbmRyb2lkL25ldC9JQ29ubmVjdGl2aXR5TWFuYWdlci5haWRsCmluZGV4IDBlYjNhZmQuLmYzMWZiNzUgMTAwNjQ0Ci0tLSBhL2NvcmUvamF2YS9hbmRyb2lkL25ldC9JQ29ubm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XRlIEluZXRBZGRyZXNzIG1HYXRld2F5OworICAgIHByaXZhdGUgUHJveHlQcm9wZXJ0aWVzIG1IdHRwUHJveHk7CisKKyAgICBwdWJsaWMgTGlua1Byb3BlcnRpZXMoKSB7CisgICAgICAgIGNsZWFyKCk7CisgICAgfQorCisgICAgLy8gY29weSBjb25zdHJ1Y3RvciBpbnN0ZWFkIG9mIGNsb25lCisgICAgcHVibGljIExpbmtQcm9wZXJ0aWVzKExpbmtQcm9wZXJ0aWVzIHNvdXJjZSkgeworICAgICAgICBpZiAoc291cmNlICE9IG51bGwpIHsKKyAgICAgICAgICAgIG1JZmFjZSA9IHNvdXJjZS5nZXRJbnRlcmZhY2UoKTsKKyAgICAgICAgICAgIG1BZGRyZXNzZXMgPSBzb3VyY2UuZ2V0QWRkcmVzc2VzKCk7CisgICAgICAgICAgICBtRG5zZXMgPSBzb3VyY2UuZ2V0RG5zZXMoKTsKKyAgICAgICAgICAgIG1HYXRld2F5ID0gc291cmNlLmdldEdhdGV3YXkoKTsKKyAgICAgICAgICAgIG1IdHRwUHJveHkgPSBuZXcgUHJveHlQcm9wZXJ0aWVzKHNvdXJjZS5nZXRIdHRwUHJveHkoKSk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBzZXRJbnRlcmZhY2UoTmV0d29ya0ludGVyZmFjZSBpZmFjZSkgeworICAgICAgICBtSWZhY2UgPSBpZmFjZTsKKyAgICB9CisgICAgcHVibGljIE5ldHdvcmtJbnRlcmZhY2UgZ2V0SW50ZXJmYWNlKCkgeworICAgICAgICByZXR1cm4gbUlmYWNlOworICAgIH0KKyAgICBwdWJsaWMgU3RyaW5nIGdldEludGVyZmFjZU5hbWUoKSB7CisgICAgICAgIHJldHVybiAobUlmYWNlID09IG51bGwgPyBudWxsIDogbUlmYWNlLmdldE5hbWUoKSk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgYWRkQWRkcmVzcyhJbmV0QWRkcmVzcyBhZGRyZXNzKSB7CisgICAgICAgIG1BZGRyZXNzZXMuYWRkKGFkZHJlc3MpOworICAgIH0KKyAgICBwdWJsaWMgQ29sbGVjdGlvbjxJbmV0QWRkcmVzcz4gZ2V0QWRkcmVzc2VzKCkgeworICAgICAgICByZXR1cm4gQ29sbGVjdGlvbnMudW5tb2RpZmlhYmxlQ29sbGVjdGlvbihtQWRkcmVzc2VzKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBhZGREbnMoSW5ldEFkZHJlc3MgZG5zKSB7CisgICAgICAgIG1EbnNlcy5hZGQoZG5zKTsKKyAgICB9CisgICAgcHVibGljIENvbGxlY3Rpb248SW5ldEFkZHJlc3M+IGdldERuc2VzKCkgeworICAgICAgICByZXR1cm4gQ29sbGVjdGlvbnMudW5tb2RpZmlhYmxlQ29sbGVjdGlvbihtRG5zZXMpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHNldEdhdGV3YXkoSW5ldEFkZHJlc3MgZ2F0ZXdheSkgeworICAgICAgICBtR2F0ZXdheSA9IGdhdGV3YXk7CisgICAgfQorICAgIHB1YmxpYyBJbmV0QWRkcmVzcyBnZXRHYXRld2F5KCkgeworICAgICAgICByZXR1cm4gbUdhdGV3YXk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc2V0SHR0cFByb3h5KFByb3h5UHJvcGVydGllcyBwcm94eSkgeworICAgICAgICBtSHR0cFByb3h5ID0gcHJveHk7CisgICAgfQorICAgIHB1YmxpYyBQcm94eVByb3BlcnRpZXMgZ2V0SHR0cFByb3h5KCkgeworICAgICAgICByZXR1cm4gbUh0dHBQcm94eTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBjbGVhcigpIHsKKyAgICAgICAgbUlmYWNlID0gbnVsbDsKKyAgICAgICAgbUFkZHJlc3NlcyA9IG5ldyBBcnJheUxpc3Q8SW5ldEFkZHJlc3M+KCk7CisgICAgICAgIG1EbnNlcyA9IG5ldyBBcnJheUxpc3Q8SW5ldEFkZHJlc3M+KCk7CisgICAgICAgIG1HYXRld2F5ID0gbnVsbDsKKyAgICAgICAgbUh0dHBQcm94eSA9IG51bGw7CisgICAgfQorCisgICAgLyoqCisgICAgICogSW1wbGVtZW50IHRoZSBQYXJjZWxhYmxlIGludGVyZmFjZQorICAgICAqIEBoaWRlCisgICAgICovCisgICAgcHVibGljIGludCBkZXNjcmliZUNvbnRlbnRzKCkgeworICAgICAgICByZXR1cm4gMDsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgU3RyaW5nIHRvU3RyaW5nKCkgeworICAgICAgICBTdHJpbmcgaWZhY2VOYW1lID0gKG1JZmFjZSA9PSBudWxsID8gIiIgOiAiSW50ZXJmYWNlTmFtZTogIiArIG1JZmFjZS5nZXROYW1lKCkgKyAiICIpOworCisgICAgICAgIFN0cmluZyBpcCA9ICJJcEFkZHJlc3NlczogWyI7CisgICAgICAgIGZvciAoSW5ldEFkZHJlc3MgYWRkciA6IG1BZGRyZXNzZXMpIGlwICs9ICBhZGRyLmdldEhvc3RBZGRyZXNzKCkgKyAiLCI7CisgICAgICAgIGlwICs9ICJdICI7CisKKyAgICAgICAgU3RyaW5nIGRucyA9ICJEbnNBZGRyZXNzZXM6IFsiOworICAgICAgICBmb3IgKEluZXRBZGRyZXNzIGFkZHIgOiBtRG5zZXMpIGRucyArPSBhZGRyLmdldEhvc3RBZGRyZXNzKCkgKyAiLCI7CisgICAgICAgIGRucyArPSAiXSAiOworCisgICAgICAgIFN0cmluZyBwcm94eSA9IChtSHR0cFByb3h5ID09IG51bGwgPyAiIiA6ICJIdHRwUHJveHk6ICIgKyBtSHR0cFByb3h5LnRvU3RyaW5nKCkgKyAiICIpOworICAgICAgICBTdHJpbmcgZ2F0ZXdheSA9IChtR2F0ZXdheSA9PSBudWxsID8gIiIgOiAiR2F0ZXdheTogIiArIG1HYXRld2F5LmdldEhvc3RBZGRyZXNzKCkgKyAiICIpOworCisgICAgICAgIHJldHVybiBpZmFjZU5hbWUgKyBpcCArIGdhdGV3YXkgKyBkbnMgKyBwcm94eTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBJbXBsZW1lbnQgdGhlIFBhcmNlbGFibGUgaW50ZXJmYWNlLgorICAgICAqIEBoaWRlCisgICAgICovCisgICAgcHVibGljIHZvaWQgd3JpdGVUb1BhcmNlbChQYXJjZWwgZGVzdCwgaW50IGZsYWdzKSB7CisgICAgICAgIGRlc3Qud3JpdGVTdHJpbmcoZ2V0SW50ZXJmYWNlTmFtZSgpKTsKKyAgICAgICAgZGVzdC53cml0ZUludChtQWRkcmVzc2VzLnNpemUoKSk7CisgICAgICAgIC8vVE9ETzogZXhwbG9yZSBhbiBlYXN5IGFsdGVybmF0aXZlIHRvIHByZXNlcnZlIGhvc3RuYW1lCisgICAgICAgIC8vIHdpdGhvdXQgZG9pbmcgYSBsb29rdXAKKyAgICAgICAgZm9yKEluZXRBZGRyZXNzIGEgOiBtQWRkcmVzc2VzKSB7CisgICAgICAgICAgICBkZXN0LndyaXRlQnl0ZUFycmF5KGEuZ2V0QWRkcmVzcygpKTsKKyAgICAgICAgfQorICAgICAgICBkZXN0LndyaXRlSW50KG1EbnNlcy5zaXplKCkpOworICAgICAgICBmb3IoSW5ldEFkZHJlc3MgZCA6IG1EbnNlcykgeworICAgICAgICAgICAgZGVzdC53cml0ZUJ5dGVBcnJheShkLmdldEFkZHJlc3MoKSk7CisgICAgICAgIH0KKyAgICAgICAgaWYgKG1HYXRld2F5ICE9IG51bGwpIHsKKyAgICAgICAgICAgIGRlc3Qud3JpdGVCeXRlKChieXRlKTEpOworICAgICAgICAgICAgZGVzdC53cml0ZUJ5dGVBcnJheShtR2F0ZXdheS5nZXRBZGRyZXNzKCkpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgZGVzdC53cml0ZUJ5dGUoKGJ5dGUpMCk7CisgICAgICAgIH0KKyAgICAgICAgaWYgKG1IdHRwUHJveHkgIT0gbnVsbCkgeworICAgICAgICAgICAgZGVzdC53cml0ZUJ5dGUoKGJ5dGUpMSk7CisgICAgICAgICAgICBkZXN0LndyaXRlUGFyY2VsYWJsZShtSHR0cFByb3h5LCBmbGFncyk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBkZXN0LndyaXRlQnl0ZSgoYnl0ZSkwKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIEltcGxlbWVudCB0aGUgUGFyY2VsYWJsZSBpbnRlcmZhY2UuCisgICAgICogQGhpZGUKKyAgICAgKi8KKyAgICBwdWJsaWMgc3RhdGljIGZpbmFsIENyZWF0b3I8TGlua1Byb3BlcnRpZXM+IENSRUFUT1IgPQorICAgICAgICBuZXcgQ3JlYXRvcjxMaW5rUHJvcGVydGllcz4oKSB7CisgICAgICAgICAgICBwdWJsaWMgTGlua1Byb3BlcnRpZXMgY3JlYXRlRnJvbVBhcmNlbChQYXJjZWwgaW4pIHsKKyAgICAgICAgICAgICAgICBMaW5rUHJvcGVydGllcyBuZXRQcm9wID0gbmV3IExpbmtQcm9wZXJ0aWVzKCk7CisgICAgICAgICAgICAgICAgU3RyaW5nIGlmYWNlID0gaW4ucmVhZFN0cmluZygpOworICAgICAgICAgICAgICAgIGlmIChpZmFjZSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgICAgICBuZXRQcm9wLnNldEludGVyZmFjZShOZXR3b3JrSW50ZXJmYWNlLmdldEJ5TmFtZShpZmFjZSkpOworICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaW50IGFkZHJlc3NDb3VudCA9IGluLnJlYWRJbnQoKTsKKyAgICAgICAgICAgICAgICBmb3IgKGludCBpPTA7IGk8YWRkcmVzc0NvdW50OyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG5ldFByb3AuYWRkQWRkcmVzcyhJbmV0QWRkcmVzcy5nZXRCeUFkZHJlc3MoaW4uY3JlYXRlQnl0ZUFycmF5KCkpKTsKKyAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoVW5rbm93bkhvc3RFeGNlcHRpb24gZSkgeyB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGFkZHJlc3NDb3VudCA9IGluLnJlYWRJbnQoKTsKKyAgICAgICAgICAgICAgICBmb3IgKGludCBpPTA7IGk8YWRkcmVzc0NvdW50OyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG5ldFByb3AuYWRkRG5zKEluZXRBZGRyZXNzLmdldEJ5QWRkcmVzcyhpbi5jcmVhdGVCeXRlQXJyYXkoKSkpOworICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChVbmtub3duSG9zdEV4Y2VwdGlvbiBlKSB7IH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKGluLnJlYWRCeXRlKCkgPT0gMSkgeworICAgICAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICAgICAgbmV0UHJvcC5zZXRHYXRld2F5KEluZXRBZGRyZXNzLmdldEJ5QWRkcmVzcyhpbi5jcmVhdGVCeXRlQXJyYXkoKSkpOworICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChVbmtub3duSG9zdEV4Y2VwdGlvbiBlKSB7fQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBpZiAoaW4ucmVhZEJ5dGUoKSA9PSAxKSB7CisgICAgICAgICAgICAgICAgICAgIG5ldFByb3Auc2V0SHR0cFByb3h5KChQcm94eVByb3BlcnRpZXMpaW4ucmVhZFBhcmNlbGFibGUobnVsbCkpOworICAgICAgICAgICAgICAgIH0KKyAgIC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ZSA9PSBDb25uZWN0aXZpdHlNYW5hZ2VyLlRZUEVfTU9CSUxFIHx8CiAgICAgICAgICAgICAgICAgbmV0VHlwZSA9PSBDb25uZWN0aXZpdHlNYW5hZ2VyLlRZUEVfTU9CSUxFX0hJUFJJKSB7CiAgICAgICAgICAgICBtSXNEZWZhdWx0T3JIaXByaSA9IHRydWU7CiAgICAgICAgIH0KIAogICAgICAgICBtUGhvbmVTZXJ2aWNlID0gbnVsbDsKLSAgICAgICAgaWYobmV0VHlwZSA9PSBDb25uZWN0aXZpdHlNYW5hZ2VyLlRZUEVfTU9CSUxFKSB7Ci0gICAgICAgICAgICBtRW5hYmxlZCA9IHRydWU7Ci0gICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICBtRW5hYmxlZCA9IGZhbHNlOwotICAgICAgICB9CiAKLSAgICAgICAgbURuc1Byb3BOYW1lcyA9IG5ldyBTdHJpbmdbXSB7CisgICAgICAgIHNEbnNQcm9wTmFtZXMgPSBuZXcgU3RyaW5nW10gewogICAgICAgICAgICAgICAgICJuZXQucm1uZXQwLmRuczEiLAogICAgICAgICAgICAgICAgICJuZXQucm1uZXQwLmRuczIiLAogICAgICAgICAgICAgICAgICJuZXQuZXRoMC5kbnMxIiwKQEAgLTk5LDE2NSArOTMsMTYyIEBACiAgICAgICAgICAgICAgICAgIm5ldC5ncHJzLmRuczIiLAogICAgICAgICAgICAgICAgICJuZXQucHBwMC5kbnMxIiwKICAgICAgICAgICAgICAgICAibmV0LnBwcDAuZG5zMiJ9OwotCiAgICAgfQogCiAgICAgLyoqCi0gICAgICogQmVnaW4gbW9uaXRvcmluZyBtb2JpbGUgZGF0YSBjb25uZWN0aXZpdHkuCisgICAgICogQmVnaW4gbW9uaXRvcmluZyBkYXRhIGNvbm5lY3Rpdml0eS4KKyAgICAgKgorICAgICAqIEBwYXJhbSBjb250ZXh0IGlzIHRoZSBjdXJyZW50IEFuZHJvaWQgY29udGV4dAorICAgICAqIEBwYXJhbSB0YXJnZXQg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8oKSB7CisgICAgICAgIHJldHVybiBtTmV0d29ya0luZm87CisgICAgfQorCisgICAgcHVibGljIGludCBnZXREZWZhdWx0R2F0ZXdheUFkZHIoKSB7CisgICAgICAgIHJldHVybiBtRGVmYXVsdEdhdGV3YXlBZGRyOworICAgIH0KKworICAgIHB1YmxpYyBib29sZWFuIGlzRGVmYXVsdFJvdXRlU2V0KCkgeworICAgICAgICByZXR1cm4gbURlZmF1bHRSb3V0ZVNldDsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBkZWZhdWx0Um91dGVTZXQoYm9vbGVhbiBlbmFibGVkKSB7CisgICAgICAgIG1EZWZhdWx0Um91dGVTZXQgPSBlbmFibGVkOworICAgIH0KKworICAgIC8qKgorICAgICAqIFRoaXMgaXMgbm90IGltcGxlbWVudGVkLgorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHJlbGVhc2VXYWtlTG9jaygpIHsKICAgICB9CiAKICAgICBwcml2YXRlIGNsYXNzIE1vYmlsZURhdGFTdGF0ZVJlY2VpdmVyIGV4dGVuZHMgQnJvYWRjYXN0UmVjZWl2ZXIgewotICAgICAgICBDb25uZWN0aXZpdHlNYW5hZ2VyIG1Db25uZWN0aXZpdHlNYW5hZ2VyOworICAgICAgICBJQ29ubmVjdGl2aXR5TWFuYWdlciBtQ29ubmVjdGl2aXR5TWFuYWdlcjsKKwogICAgICAgICBwdWJsaWMgdm9pZCBvblJlY2VpdmUoQ29udGV4dCBjb250ZXh0LCBJbnRlbnQgaW50ZW50KSB7Ci0gICAgICAgICAgICBzeW5jaHJvbml6ZWQodGhpcykgewotICAgICAgICAgICAgICAgIGlmIChpbnRlbnQuZ2V0QWN0aW9uKCkuZXF1YWxzKFRlbGVwaG9ueUludGVudHMuCi0gICAgICAgICAgICAgICAgICAgICAgICBBQ1RJT05fQU5ZX0RBVEFfQ09OTkVDVElPTl9TVEFURV9DSEFOR0VEKSkgewotICAgICAgICAgICAgICAgICAgICBQaG9uZS5EYXRhU3RhdGUgc3RhdGUgPSBnZXRNb2JpbGVEYXRhU3RhdGUoaW50ZW50KTsKLSAgICAgICAgICAgICAgICAgICAgU3RyaW5nIHJlYXNvbiA9IGludGVudC5nZXRTdHJpbmdFeHRyYShQaG9uZS5TVEFURV9DSEFOR0VfUkVBU09OX0tFWSk7Ci0gICAgICAgICAgICAgICAgICAgIFN0cmluZyBhcG5OYW1lID0gaW50ZW50LmdldFN0cmluZ0V4dHJhKFBob25lLkRBVEFfQVBOX0tFWSk7Ci0gICAgICAgICAgICAgICAgICAgIFN0cmluZyBhcG5UeXBlTGlzdCA9IGludGVudC5nZXRTdHJpbmdFeHRyYShQaG9uZS5EQVRBX0FQTl9UWVBFU19LRVkpOwotICAgICAgICAgICAgICAgICAgICBtQXBuTmFtZSA9IGFwbk5hbWU7CisgICAgICAgICAgICBpZiAoaW50ZW50LmdldEFjdGlvbigpLmVxdWFscyhUZWxlcGhvbnlJbnRlbnRzLgorICAgICAgICAgICAgICAgICAgICBBQ1RJT05fQU5ZX0RBVEFfQ09OTkVDVElPTl9TVEFURV9DSEFOR0VEKSkgeworICAgICAgICAgICAgICAgIFN0cmluZyBhcG5UeXBlID0gaW50ZW50LmdldFN0cmluZ0V4dHJhKFBob25lLkRBVEFfQVBOX1RZUEVfS0VZKTsKKyAgICAgICAgICAgICAgICBpZiAoIVRleHRVdGlscy5lcXVhbHMoYXBuVHlwZSwgbUFwblR5cGUpKSB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgUGhvbmUuRGF0YVN0YXRlIHN0YXRlID0gRW51bS52YWx1ZU9mKFBob25lLkRhdGFTdGF0ZS5jbGFzcywKKyAgICAgICAgICAgICAgICAgICAgICAgIGludGVudC5nZXRTdHJpbmdFeHRyYShQaG9uZS5TVEFURV9LRVkpKTsKKyAgICAgICAgICAgICAgICBTdHJpbmcgcmVhc29uID0gaW50ZW50LmdldFN0cmluZ0V4dHJhKFBob25lLlNUQVRFX0NIQU5HRV9SRUFTT05fS0VZKTsKKyAgICAgICAgICAgICAgICBTdHJpbmcgYXBuTmFtZSA9IGludGVudC5nZXRTdHJpbmdFeHRyYShQaG9uZS5EQVRBX0FQTl9LRVkpOwogCi0gICAgICAgICAgICAgICAgICAgIGJvb2xlYW4gdW5hdmFpbGFibGUgPSBpbnRlbnQuZ2V0Qm9vbGVhbkV4dHJhKFBob25lLk5FVFdPUktfVU5BVkFJTEFCTEVfS0VZLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZhbHNlKTsKKyAgICAgICAgICAgICAgICBtTmV0d29ya0luZm8uc2V0SXNBdmFpbGFibGUoIWludGVudC5nZXRCb29sZWFuRXh0cmEoUGhvbmUuTkVUV09SS19VTkFWQUlMQUJMRV9LRVksCisgICAgICAgICAgICAgICAgICAgICAgICBmYWxzZSkpOwogCi0gICAgICAgICAgICAgICAgICAgIC8vIHNldCB0aGlzIHJlZ2FyZGxlc3Mgb2YgdGhlIGFwblR5cGVMaXN0LiAgSXQncyBhbGwgdGhlIHNhbWUgcmFkaW8vbmV0d29yawotICAgICAgICAgICAgICAgICAgICAvLyB1bmRlcm5lYXRoCi0gICAgICAgICAgICAgICAgICAgIG1OZXR3b3JrSW5mby5zZXRJc0F2YWlsYWJsZSghdW5hdmFpbGFibGUpOworICAgICAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKFRBRywgbUFwblR5cGUgKyAiIFJlY2VpdmVkIHN0YXRlPSAiICsgc3RhdGUgKyAiLCBvbGQ9ICIgKworICAgICAgICAgICAgICAgICAgICAgICAgbU1vYmlsZURhdGFTdGF0ZSArICIsIHJlYXNvbj0gIiArCisgICAgICAgICAgICAgICAgICAgICAgICAocmVhc29uID09IG51bGwgPyAiKHVuc3BlY2lmaWVkKSIgOiByZWFzb24pKTsKIAotICAgICAgICAgICAgICAgICAgICBpZiAoaXNBcG5UeXBlSW5jbHVkZWQoYXBuVHlwZUxpc3QpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAobUVuYWJsZWQgPT0gZmFsc2UpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBpZiB3ZSdyZSBub3QgZW5hYmxlZCBidXQgdGhlIEFQTiBUeXBlIGlzIHN1cHBvcnRlZCBieSB0aGlzIGNvbm5lY3Rpb24KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyB3ZSBzaG91bGQgcmVjb3JkIHRoZSBpbnRlcmZhY2UgbmFtZSBpZiBvbmUncyBwcm92aWRlZC4gIElmIHRoZSB1c2VyCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gdHVybnMgb24gdGhpcyBuZXR3b3JrIHdlIHdpbGwgbmVlZCB0aGUgaW50ZXJmYWNlbmFtZSBidXQgd29uJ3QgZ2V0Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gYSBmcmVzaCBjb25uZWN0ZWQgbWVzc2FnZSAtIFRPRE8gZml4IHRoaXMgd2hlbiB3ZSBnZXQgcGVyLUFQTgotICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIG5vdGlmaWNhdGlvbnMKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoc3RhdGUgPT0gUGhvbmUuRGF0YVN0YXRlLkNPTk5FQ1RFRCkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsICJyZXBsYWNpbmcgb2xkIG1JbnRlcmZhY2VOYW1lICgiICsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtSW50ZXJmYWNlTmFtZSArICIpIHdpdGggIiArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50ZW50LmdldFN0cmluZ0V4dHJhKFBob25lLkRBVEFfSUZBQ0VfTkFNRV9LRVkpICsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiIGZvciAiICsgbUFwblR5cGUpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtSW50ZXJmYWNlTmFtZSA9IGludGVudC5nZXRTdHJpbmdFeHRyYShQaG9uZS5EQVRBX0lGQUNFX05BTUVfS0VZKTsKKyAgICAgICAgICAgICAgICBpZiAobU1vYmlsZURhdGFTdGF0ZSAhPSBzdGF0ZSkgeworICAgICAgICAgICAgICAgICAgICBtTW9iaWxlRGF0YVN0YXRlID0gc3RhdGU7CisgICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoc3RhdGUpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgRElTQ09OTkVDVEVEOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKGlzVGVhcmRvd25SZXF1ZXN0ZWQoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXRUZWFyZG93blJlcXVlc3RlZChmYWxzZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgICAgICAgICAgICAgfQogCi0gICAgICAgICAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKFRBRywgbUFwblR5cGUgKyAiIFJlY2VpdmVkIHN0YXRlPSAiICsgc3RhdGUgKyAiLCBvbGQ9ICIgKwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Nb2JpbGVEYXRhU3RhdGUgKyAiLCByZWFzb249ICIgKwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIChyZWFzb24gPT0gbnVsbCA/ICIodW5zcGVjaWZpZWQpIiA6IHJlYXNvbikgKwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICIsIGFwblR5cGVMaXN0PSAiICsgYXBuVHlwZUxpc3QpOwotCi0gICAgICAgICAgICAgICAgICAgIGlmIChtTW9iaWxlRGF0YVN0YXRlICE9IHN0YXRlKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBtTW9iaWxlRGF0YVN0YXRlID0gc3RhdGU7Ci0gICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKHN0YXRlKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBESVNDT05ORUNURUQ6Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKGlzVGVhcmRvd25SZXF1ZXN0ZWQoKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUVuYWJsZWQgPSBmYWxzZTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldFRlYXJkb3duUmVxdWVzdGVkKGZhbHNlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXREZXRhaWxlZFN0YXRlKERldGFpbGVkU3RhdGUuRElTQ09OTkVDVEVELCByZWFzb24sIGFwbk5hbWUpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2xlYW4gZG9SZXNldCA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1Jc0RlZmF1bHRPckhpcHJpID09IHRydWUpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gYm90aCBkZWZhdWx0IGFuZCBoaXByaSBtdXN0IGdvIGRvd24gYmVmb3JlIHdlIHJlc2V0CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCB0eXBlVG9DaGVjayA9IChQaG9uZS5BUE5fVFlQRV9ERUZBVUxULmVxdWFscyhtQXBuVHlwZSkgPworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ29ubmVjdGl2aXR5TWFuYWdlci5UWVBFX01PQklMRV9ISVBSSSA6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDb25uZWN0aXZpdHlNYW5hZ2VyLlRZUEVfTU9CSUxFKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1Db25uZWN0aXZpdHlNYW5hZ2VyID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIElCaW5kZXIgYiA9IFNlcnZpY2VNYW5hZ2VyLmdldFNlcnZpY2UoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENvbnRleHQuQ09OTkVDVElWSVRZX1NFUlZJQ0UpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUNvbm5lY3Rpdml0eU1hbmFnZXIgPSBJQ29ubmVjdGl2aXR5TWFuYWdlci5TdHViLmFzSW50ZXJmYWNlKGIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0RGV0YWlsZWRTdGF0ZShEZXRhaWxlZFN0YXRlLkRJU0NPTk5FQ1RFRCwgcmVhc29uLCBhcG5OYW1lKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbGVhbiBkb1Jlc2V0ID0gdHJ1ZTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1Jc0RlZmF1bHRPckhpcHJpID09IHRydWUpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGJvdGggZGVmYXVsdCBhbmQgaGlwcmkgbXVzdCBnbyBkb3duIGJlZm9yZSB3ZSByZXNldAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHR5cGVUb0NoZWNrID0gKFBob25lLkFQTl9UWVBFX0RFRkFVTFQuZXF1YWxzKG1BcG5UeXBlKSA/Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENvbm5lY3Rpdml0eU1hbmFnZXIuVFlQRV9NT0JJTEVfSElQUkkgOgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDb25uZWN0aXZpdHlNYW5hZ2VyLlRZUEVfTU9CSUxFKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtQ29ubmVjdGl2aXR5TWFuYWdlciA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUNvbm5lY3Rpdml0eU1hbmFnZXIgPQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKENvbm5lY3Rpdml0eU1hbmFnZXIpY29udGV4dC5nZXRTeXN0ZW1TZXJ2aWNlKAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ29udGV4dC5DT05ORUNUSVZJVFlfU0VSVklDRSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobUNvbm5lY3Rpdml0eU1hbmFnZXIgIT0gbnVsbCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5ldHdvcmtJbmZvIGluZm8gPSBtQ29ubmVjdGl2aXR5TWFuYWdlci5nZXROZXR3b3JrSW5mbygKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlVG9DaGVjayk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGluZm8gIT0gbnVsbCAmJiBpbmZvLmlzQ29ubmVjdGVkKCkgPT0gdHJ1ZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZVRvQ2hlY2spOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpbmZvLmlzQ29ubmVjdGVkKCkgPT0gdHJ1ZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb1Jlc2V0ID0gZmFsc2U7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8ganVzdCBnbyBhaGVhZCB3aXRoIHRoZSByZXNldAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTG9nLmUoVEFHLCAiRXhjZXB0aW9uIHRyeWluZyB0byBjb250YWN0IENvbm5TZXJ2aWNlOiAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRvUmVzZXQgJiYgbUludGVyZmFjZU5hbWUgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTmV0d29ya1V0aWxzLnJlc2V0Q29ubmVjdGlvbnMobUludGVyZmFjZU5hbWUpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGNhbid0IGRvIHRoaXMgaGVyZSAtIENvbm5lY3Rpdml0eVNlcnZpY2UgbmVlZHMgaXQgdG8gY2xlYXIgc3R1ZmYKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gaXQncyBvayB0aG91Z2ggLSBqdXN0IGxlYXZlIGl0IHRvIGJlIHJlZnJlc2hlZCBuZXh0IHRpbWUKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gd2UgY29ubmVjdC4KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy9pZiAoREJHKSBMb2cuZChUQUcsICJjbGVhcmluZyBtSW50ZXJmYWNlTmFtZSBmb3IgIisgbUFwblR5cGUgKwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyAgICAgICAgIiBhcyBpdCBESVNDT05ORUNURUQiKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy9tSW50ZXJmYWNlTmFtZSA9IG51bGw7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vbURlZmF1bHRHYXRld2F5QWRkciA9IDA7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgQ09OTkVDVElORzoKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0RGV0YWlsZWRTdGF0ZShEZXRhaWxlZFN0YXRlLkNPTk5FQ1RJTkcsIHJlYXNvbiwgYXBuTmFtZSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgU1VTUEVOREVEOgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXREZXRhaWxlZFN0YXRlKERldGFpbGVkU3RhdGUuU1VTUEVOREVELCByZWFzb24sIGFwbk5hbWUpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIENPTk5FQ1RFRDoKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUludGVyZmFjZU5hbWUgPSBpbnRlbnQuZ2V0U3RyaW5nRXh0cmEoUGhvbmUuREFUQV9JRkFDRV9OQU1FX0tFWSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtSW50ZXJmYWNlTmFtZSA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJDT05ORUNURUQgZXZlbnQgZGlkIG5vdCBzdXBwbHkgaW50ZXJmYWNlIG5hbWUuIik7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbURlZmF1bHRHYXRld2F5QWRkciA9IGludGVudC5nZXRJbnRFeHRyYShQaG9uZS5EQVRBX0dBVEVXQVlfS0VZLCAwKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0RGV0YWlsZWRTdGF0ZShEZXRhaWxlZFN0YXRlLkNPTk5FQ1RFRCwgcmVhc29uLCBhcG5OYW1lKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkb1Jlc2V0ICYmIG1MaW5rUHJvcGVydGllcyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFN0cmluZyBpZmFjZSA9IG1MaW5rUHJvcGVydGllcy5nZXRJbnRlcmZhY2VOYW1lKCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpZmFjZSAhPSBudWxsKSBOZXR3b3JrVXRpbHMucmVzZXRDb25uZWN0aW9ucyhpZmFjZSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIFRPRE8gLSBjaGVjayB0aGlzCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gY2FuJ3QgZG8gdGhpcyBoZXJlIC0gQ29ubmVjdGl2aXR5U2VydmljZSBuZWVkcyBpdCB0byBjbGVhciBzdHVmZgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGl0J3Mgb2sgdGhvdWdoIC0ganVzdCBsZWF2ZSBpdCB0byBiZSByZWZyZXNoZWQgbmV4dCB0aW1lCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gd2UgY29ubmVjdC4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL2lmIChEQkcpIExvZy5kKFRBRywgImNsZWFyaW5nIG1JbnRlcmZhY2VOYW1lIGZvciAiKyBtQXBuVHlwZSArCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gICAgICAgICIgYXMgaXQgRElTQ09OTkVDVEVEIik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy9tSW50ZXJmYWNlTmFtZSA9IG51bGw7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy9tRGVmYXVsdEdhdGV3YXlBZGRyID0gMDsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgQ09OTkVDVElORzoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXREZXRhaWxlZFN0YXRlKERldGFpbGVkU3RhdGUuQ09OTkVDVElORywgcmVhc29uLCBhcG5OYW1lKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgU1VTUEVOREVEOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldERldGFpbGVkU3RhdGUoRGV0YWlsZWRTdGF0ZS5TVVNQRU5ERUQsIHJlYXNvbiwgYXBuTmFtZSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIENPTk5FQ1RFRDoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtTGlua1Byb3BlcnRpZXMgPSBpbnRlbnQuZ2V0UGFyY2VsYWJsZUV4dHJhKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUGhvbmUuREFUQV9MSU5LX1BST1BFUlRJRVNfS0VZKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobUxpbmtQcm9wZXJ0aWVzID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTG9nLmQoVEFHLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJDT05ORUNURUQgZXZlbnQgZGlkIG5vdCBzdXBwbHkgbGluayBwcm9wZXJ0aWVzLiIpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXREZXRhaWxlZFN0YXRlKERldGFpbGVkU3RhdGUuQ09OTkVDVEVELCByZWFzb24sIGFwbk5hbWUpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChpbnRlbnQuZ2V0QWN0aW9uKCkuCi0gICAgICAgICAgICAgICAgICAgICAgICBlcXVhbHMoVGVsZXBob255SW50ZW50cy5BQ1RJT05fREFUQV9DT05ORUNUSU9OX0ZBSUxFRCkpIHsKLSAgICAgICAgICAgICAgICAgICAgbUVuYWJsZWQgPSBmYWxzZTsKLSAgICAgICAgICAgICAgICAgICAgU3RyaW5nIHJlYXNvbiA9IGludGVudC5nZXRTdHJpbmdFeHRyYShQaG9uZS5GQUlMVVJFX1JFQVNPTl9LRVkpOwotICAgICAgICAgICAgICAgICAgICBTdHJpbmcgYXBuTmFtZSA9IGludGVudC5nZXRTdHJpbmdFeHRyYShQaG9uZS5EQVRBX0FQTl9LRVkpOwotICAgICAgICAgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsICJSZWNlaXZlZCAiICsgaW50ZW50LmdldEFjdGlvbigpICsgIiBicm9hZGNhc3QiICsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWFzb24gPT0gbnVsbCA/ICIiIDogIigiICsgcmVhc29uICsgIikiKTsKLSAgICAgICAgICAgICAgICAgICAgc2V0RGV0YWlsZWRTdGF0ZShEZXRhaWxlZFN0YXRlLkZBSUxFRCwgcmVhc29uLCBhcG5OYW1lKTsKICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgVGVsZXBob255TWFuYWdlciB0bSA9IFRlbGVwaG9ueU1hbmFnZXIuZ2V0RGVmYXVsdCgpOwotICAgICAgICAgICAgICAgIHNldFJvYW1pbmdTdGF0dXModG0uaXNOZXR3b3JrUm9hbWluZygpKTsKLSAgICAgICAgICAgICAgICBzZXRTdWJ0eXBlKHRtLmdldE5ldHdvcmtUeXBlKCksIHRtLmdldE5ldHdvcmtUeXBlTmFtZSgpKTsKKyAgICAgICAgICAgIH0gZWxzZSBpZiAoaW50ZW50LmdldEFjdGlvbigpLgorICAgICAgICAgICAgICAgICAgICBlcXVhbHMoVGVsZXBob255SW50ZW50cy5BQ1RJT05fREFUQV9DT05ORUNUSU9OX0ZBSUxFRCkpIHsKKyAgICAgICAgICAgICAgICBTdHJpbmcgYXBuVHlwZSA9IGludGVudC5nZXRTdHJpbmdFeHRyYShQaG9uZS5EQVRBX0FQTl9UWVBFX0tFWSk7CisgICAgICAgICAgICAgICAgaWYgKCFUZXh0VXRpbHMuZXF1YWxzKGFwblR5cGUsIG1BcG5UeXBlKSkgeworICAgICAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIFN0cmluZyByZWFzb24gPSBpbnRlbnQuZ2V0U3RyaW5nRXh0cmEoUGhvbmUuRkFJTFVSRV9SRUFTT05fS0VZKTsKKyAgICAgICAgICAgICAgICBTdHJpbmcgYXBuTmFtZSA9IGludGVudC5nZXRTdHJpbmdFeHRyYShQaG9uZS5EQVRBX0FQTl9LRVkpOworICAgICAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKFRBRywgbUFwblR5cGUgKyAiUmVjZWl2ZWQgIiArIGludGVudC5nZXRBY3Rpb24oKSArCisgICAgICAgICAgICAgICAgICAgICAgICAiIGJyb2FkY2FzdCIgKyByZWFzb24gPT0gbnVsbCA/ICIiIDogIigiICsgcmVhc29uICsgIikiKTsKKyAgICAgICAgICAgICAgICBzZXREZXRhaWxlZFN0YXRlKERldGFpbGVkU3RhdGUuRkFJTEVELCByZWFzb24sIGFwbk5hbWUpOwogICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgfQpAQCAtMjcyLDMzICsyNjMsNyBAQAogICAgICAqIFJlcG9ydCB3aGV0aGVyIGRhdGEgY29ubmVjdGl2aXR5IGlzIHBvc3NpYmxlLgogICAgICAqLwogICAgIHB1YmxpYyBib29sZWFuIGlzQXZhaWxhYmxlKCkgewotICAgICAgICBnZXRQaG9uZVNlcnZpY2UoZmFsc2UpOwotCi0gICAgICAgIC8qCi0gICAgICAgICAqIElmIHRoZSBwaG9uZSBwcm9jZXNzIGhhcyBjcmFzaGVkIGluIHRoZSBwYXN0LCB3ZSdsbCBnZXQgYQotICAgICAgICAgKiBSZW1vdGVFeGNlcHRpb24gYW5kIG5lZWQgdG8gcmUtcmVmZXJlbmNlIHRoZSBzZXJ2aWNlLgotICAgICAgICAgKi8KLSAgICAgICAgZm9yIChpbnQgcmV0cnkgPSAwOyByZXRyeSA8IDI7IHJldHJ5KyspIHsKLSAgICAgICAgICAgIGlmIChtUGhvbmVTZXJ2aWNlID09IG51bGwpIGJyZWFrOwotCi0gICAgICAgICAgICB0cnkgewotICAgICAgICAgICAgICAgIHJldHVybiBtUGhvbmVTZXJ2aWNlLmlzRGF0YUNvbm5lY3Rpdml0eVBvc3NpYmxlKCk7Ci0gICAgICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZSkgewotICAgICAgICAgICAgICAgIC8vIEZpcnN0LXRpbWUgZmFpbGVkLCBnZXQgdGhlIHBob25lIHNlcnZpY2UgYWdhaW4KLSAgICAgICAgICAgICAgICBpZiAocmV0cnkgPT0gMCkgZ2V0UGhvbmVTZXJ2aWNlKHRydWUpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgcmV0dXJuIGZhbHN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HJpbmcgZXh0cmFJbmZvKSB7CisgICAgICAgIGlmIChEQkcpIExvZy5kKFRBRywgInNldERldGFpbGVkIHN0YXRlLCBvbGQgPSIKKyAgICAgICAgICAgICAgICArIG1OZXR3b3JrSW5mby5nZXREZXRhaWxlZFN0YXRlKCkgKyAiIGFuZCBuZXcgc3RhdGU9IiArIHN0YXRlKTsKKyAgICAgICAgaWYgKHN0YXRlICE9IG1OZXR3b3JrSW5mby5nZXREZXRhaWxlZFN0YXRlKCkpIHsKKyAgICAgICAgICAgIGJvb2xlYW4gd2FzQ29ubmVjdGluZyA9IChtTmV0d29ya0luZm8uZ2V0U3RhdGUoKSA9PSBOZXR3b3JrSW5mby5TdGF0ZS5DT05ORUNUSU5HKTsKKyAgICAgICAgICAgIFN0cmluZyBsYXN0UmVhc29uID0gbU5ldHdvcmtJbmZvLmdldFJlYXNvbigpOworICAgICAgICAgICAgLyoKKyAgICAgICAgICAgICAqIElmIGEgcmVhc29uIHdhcyBzdXBwbGllZCB3aGVuIHRoZSBDT05ORUNUSU5HIHN0YXRlIHdhcyBlbnRlcmVkLCBhbmQgbm8KKyAgICAgICAgICAgICAqIHJlYXNvbiB3YXMgc3VwcGxpZWQgZm9yIGVudGVyaW5nIHRoZSBDT05ORUNURUQgc3RhdGUsIHRoZW4gcmV0YWluIHRoZQorICAgICAgICAgICAgICogcmVhc29uIHRoYXQgd2FzIHN1cHBsaWVkIHdoZW4gZ29pbmcgdG8gQ09OTkVDVElORy4KKyAgICAgICAgICAgICAqLworICAgICAgICAgICAgaWYgKHdhc0Nvbm5lY3RpbmcgJiYgc3RhdGUgPT0gTmV0d29ya0luZm8uRGV0YWlsZWRTdGF0ZS5DT05ORUNURUQgJiYgcmVhc29uID09IG51bGwKKyAgICAgICAgICAgICAgICAgICAgJiYgbGFzdFJlYXNvbiAhPSBudWxsKQorICAgICAgICAgICAgICAgIHJlYXNvbiA9IGxhc3RSZWFzb247CisgICAgICAgICAgICBtTmV0d29ya0luZm8uc2V0RG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Y2F0aW9ucwotICAgICAgICAgICAgICAgIG1FbmFibGVkID0gdHJ1ZTsKICAgICAgICAgICAgICAgICAvLyBuZWVkIHRvIHNldCBzZWxmIHRvIENPTk5FQ1RJTkcgc28gdGhlIGJlbG93IG1lc3NhZ2UgaXMgaGFuZGxlZC4KLSAgICAgICAgICAgICAgICBtTW9iaWxlRGF0YVN0YXRlID0gUGhvbmUuRGF0YVN0YXRlLkNPTk5FQ1RJTkc7Ci0gICAgICAgICAgICAgICAgc2V0RGV0YWlsZWRTdGF0ZShEZXRhaWxlZFN0YXRlLkNPTk5FQ1RJTkcsIFBob25lLlJFQVNPTl9BUE5fQ0hBTkdFRCwgbnVsbCk7Ci0gICAgICAgICAgICAgICAgLy9zZW5kIG91dCBhIGNvbm5lY3RlZCBtZXNzYWdlCi0gICAgICAgICAgICAgICAgSW50ZW50IGludGVudCA9IG5ldyBJbnRlbnQoVGVsZXBob255SW50ZW50cy4KLSAgICAgICAgICAgICAgICAgICAgICAgIEFDVElPTl9BTllfREFUQV9DT05ORUNUSU9OX1NUQVRFX0NIQU5HRUQpOwotICAgICAgICAgICAgICAgIGludGVudC5wdXRFeHRyYShQaG9uZS5TVEFURV9LRVksIFBob25lLkRhdGFTdGF0ZS5DT05ORUNURUQudG9TdHJpbmcoKSk7Ci0gICAgICAgICAgICAgICAgaW50ZW50LnB1dEV4dHJhKFBob25lLlNUQVRFX0NIQU5HRV9SRUFTT05fS0VZLCBQaG9uZS5SRUFTT05fQVBOX0NIQU5HRUQpOwotICAgICAgICAgICAgICAgIGludGVudC5wdXRFeHRyYShQaG9uZS5EQVRBX0FQTl9UWVBFU19LRVksIG1BcG5UeXBlVG9XYXRjaEZvcik7Ci0gICAgICAgICAgICAgICAgaW50ZW50LnB1dEV4dHJhKFBob25lLkRBVEFfQVBOX0tFWSwgbUFwbk5hbWUpOwotICAgICAgICAgICAgICAgIGludGVudC5wdXRFeHRyYShQaG9uZS5EQVRBX0lGQUNFX05BTUVfS0VZLCBtSW50ZXJmYWNlTmFtZSk7Ci0gICAgICAgICAgICAgICAgaW50ZW50LnB1dEV4dHJhKFBob25lLk5FVFdPUktfVU5BVkFJTEFCTEVfS0VZLCBmYWxzZSk7Ci0gICAgICAgICAgICAgICAgaWYgKG1TdGF0ZVJlY2VpdmVyICE9IG51bGwpIG1TdGF0ZVJlY2VpdmVyLm9uUmVjZWl2ZShtQ29udGV4dCwgaW50ZW50KTsKKyAgICAgICAgICAgICAgICByZXRWYWx1ZSA9IHRydWU7CiAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICBjYXNlIFBob25lLkFQTl9SRVFVRVNUX1NUQVJURUQ6Ci0gICAgICAgICAgICAgICAgbUVuYWJsZWQgPSB0cnVlOwogICAgICAgICAgICAgICAgIC8vIG5vIG5lZWQgdG8gZG8gYW55dGhpbmcgLSB3ZSdyZSBhbHJlYWR5IGR1ZSBzb21lIHN0YXR1cyB1cGRhdGUgaW50ZW50cworICAgICAgICAgICAgICAgIHJldFZhbHVlID0gdHJ1ZTsKICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIGNhc2UgUGhvbmUuQVBOX1JFUVVFU1RfRkFJTEVEOgotICAgICAgICAgICAgICAgIGlmIChtUGhvbmVTZXJ2aWNlID09IG51bGwgJiYgbUFwblR5cGUgPT0gUGhvbmUuQVBOX1RZUEVfREVGQVVMVCkgewotICAgICAgICAgICAgICAgICAgICAvLyBvbiBzdGFydHVwIHdlIG1heSB0cnkgdG8gdGFsayB0byB0aGUgcGhvbmUgYmVmb3JlIGl0J3MgcmVhZHkKLSAgICAgICAgICAgICAgICAgICAgLy8gc2luY2UgdGhlIHBob25lIHdpbGwgY29tZSB1cCBlbmFibGVkLCBnbyB3aXRoIHRoYXQuCi0gICAgICAgICAgICAgICAgICAgIC8vIFRPRE8gLSB0aGlzIGFsc28gY29tZXMgdXAgb24gdGVsZXBob255IGNyYXNoOiBpZiB3ZSB0aGluayBtb2JpbGUgZGF0YSBpcwotICAgICAgICAgICAgICAgICAgICAvLyBvZmYgYW5kIHRoZSB0ZWxlcGhvbnkgc3R1ZmYgY3Jhc2hlcyBhbmQgaGFzIHRvIHJlc3RhcnQgaXQgd2lsbCBjb21lIHVwCi0gICAgICAgICAgICAgICAgICAgIC8vIGVuYWJsZWQgKG1ha2luZyBhIGRhdGEgY29ubmVjdGlvbikuICBXZSB3aWxsIHRoZW4gYmUgb3V0IG9mIHN5bmMuCi0gICAgICAgICAgICAgICAgICAgIC8vIEEgcG9zc2libGUgc29sdXRpb24gaXMgYSBicm9hZGNhc3Qgd2hlbiB0ZWxlcGhvbnkgcmVzdGFydHMuCi0gICAgICAgICAgICAgICAgICAgIG1FbmFibGVkID0gdHJ1ZTsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAvLyBlbHNlIGZhbGwgdGhyb3VnaAogICAgICAgICAgICAgY2FzZSBQaG9uZS5BUE5fVFlQRV9OT1RfQVZBSUxBQkxFOgotICAgICAgICAgICAgICAgIC8vIERlZmF1bHQgaXMgYWx3YXlzIGF2YWlsYWJsZSwgYnV0IG1heSBiZSBvZmYgZHVlIHRvCi0gICAgICAgICAgICAgICAgLy8gQWlycGxhbmVNb2RlIG9yIEUtQ2FsbCBvciB3aGF0ZXZlci4uCi0gICAgICAgICAgICAgICAgaWYgKG1BcG5UeXBlICE9IFBob25lLkFQTl9UWVBFX0RFRkFVTFQpIHsKLSAgICAgICAgICAgICAgICAgICAgbUVuYWJsZWQgPSBmYWxzZTsKLSAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgIExvZy5lKFRBRywgIkVycm9yIGluIHJlY29ubmVjdCAtIHVuZXhwZWN0ZWQgcmVzcG9uc2UuIik7Ci0gICAgICAgICAgICAgICAgbUVuYWJsZWQgPSBmYWxzZTsKICAgICAgICAgICAg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wIEBACiAgICAgICovCiAgICAgcHVibGljIE5ldHdvcmtJbmZvKGludCB0eXBlKSB7fQogCi0gICAgTmV0d29ya0luZm8oaW50IHR5cGUsIGludCBzdWJ0eXBlLCBTdHJpbmcgdHlwZU5hbWUsIFN0cmluZyBzdWJ0eXBlTmFtZSkgeworICAgIC8qKgorICAgICAqIEBoaWRlCisgICAgICovCisgICAgcHVibGljIE5ldHdvcmtJbmZvKGludCB0eXBlLCBpbnQgc3VidHlwZSwgU3RyaW5nIHR5cGVOYW1lLCBTdHJpbmcgc3VidHlwZU5hbWUpIHsKICAgICAgICAgaWYgKCFDb25uZWN0aXZpdHlNYW5hZ2VyLmlzTmV0d29ya1R5cGVWYWxpZCh0eXBlKSkgewogICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiSW52YWxpZCBuZXR3b3JrIHR5cGU6ICIgKyB0eXBlKTsKICAgICAgICAgfQpAQCAtMTQxLDcgKzE0NCw5IEBACiAgICAgICogQHJldHVybiB0aGUgbmV0d29yayB0eXBlCiAgICAgICovCiAgICAgcHVibGljIGludCBnZXRUeXBlKCkgewotICAgICAgICByZXR1cm4gbU5ldHdvcmtUeXBlOworICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKKyAgICAgICAgICAgIHJldHVybiBtTmV0d29ya1R5cGU7CisgICAgICAgIH0KICAgICB9CiAKICAgICAvKioKQEAgLTE1MCwxMiArMTU1LDE2IEBACiAgICAgICogQHJldHVybiB0aGUgbmV0d29yayBzdWJ0eXBlCiAgICAgICovCiAgICAgcHVibGljIGludCBnZXRTdWJ0eXBlKCkgewotICAgICAgICByZXR1cm4gbVN1YnR5cGU7CisgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgeworICAgICAgICAgICAgcmV0dXJuIG1TdWJ0eXBlOworICAgICAgICB9CiAgICAgfQogCiAgICAgdm9pZCBzZXRTdWJ0eXBlKGludCBzdWJ0eXBlLCBTdHJpbmcgc3VidHlwZU5hbWUpIHsKLSAgICAgICAgbVN1YnR5cGUgPSBzdWJ0eXBlOwotICAgICAgICBtU3VidHlwZU5hbWUgPSBzdWJ0eXBlTmFtZTsKKyAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CisgICAgICAgICAgICBtU3VidHlwZSA9IHN1YnR5cGU7CisgICAgICAgICAgICBtU3VidHlwZU5hbWUgPSBzdWJ0eXBlTmFtZTsKKyAgICAgICAgfQogICAgIH0KIAogICAgIC8qKgpAQCAtMTY0LDcgKzE3Myw5IEBACiAgICAgICogQHJldHVybiB0aGUgbmFtZSBvZiB0aGUgbmV0d29yayB0eXBlCiAgICAgICovCiAgICAgcHVibGljIFN0cmluZyBnZXRUeXBlTmFtZSgpIHsKLSAgICAgICAgcmV0dXJuIG1UeXBlTmFtZTsKKyAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CisgICAgICAgICAgICByZXR1cm4gbVR5cGVOYW1lOworICAgICAgICB9CiAgICAgfQogCiAgICAgLyoqCkBAIC0xNzIsNyArMTgzLDkgQEAKICAgICAgKiBAcmV0dXJuIHRoZSBuYW1lIG9mIHRoZSBuZXR3b3JrIHN1YnR5cGUKICAgICAgKi8KICAgICBwdWJsaWMgU3RyaW5nIGdldFN1YnR5cGVOYW1lKCkgewotICAgICAgICByZXR1cm4gbVN1YnR5cGVOYW1lOworICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKKyAgICAgICAgICAgIHJldHVybiBtU3VidHlwZU5hbWU7CisgICAgICAgIH0KICAgICB9CiAKICAgICAvKioKQEAgLTE4NSw3ICsxOTgsOSBAQAogICAgICAqIG9mIGJlaW5nIGVzdGFibGlzaGVkLCB7QGNvZGUgZmFsc2V9IG90aGVyd2lzZS4KICAgICAgKi8KICAgICBwdWJsaWMgYm9vbGVhbiBpc0Nvbm5lY3RlZE9yQ29ubmVjdGluZygpIHsKLSAgICAgICAgcmV0dXJuIG1TdGF0ZSA9PSBTdGF0ZS5DT05ORUNURUQgfHwgbVN0YXRlID09IFN0YXRlLkNPTk5FQ1RJTkc7CisgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgeworICAgICAgICAgICAgcmV0dXJuIG1TdGF0ZSA9PSBTdGF0ZS5DT05ORUNURUQgfHwgbVN0YXRlID09IFN0YXRlLkNPTk5FQ1RJTkc7CisgICAgICAgIH0KICAgICB9CiAKICAgICAvKioKQEAgLTE5NCw3ICsyMDksOSBAQAogICAgICAqIEByZXR1cm4ge0Bjb2RlIHRydWV9IGlmIG5ldHdvcmsgY29ubmVjdGl2aXR5IGV4aXN0cywge0Bjb2RlIGZhbHNlfSBvdGhlcndpc2UuCiAgICAgICovCiAgICAgcHVibGljIGJvb2xlYW4gaXNDb25uZWN0ZWQoKSB7Ci0gICAgICAgIHJldHVybiBtU3RhdGUgPT0gU3RhdGUuQ09OTkVDVEVEOworICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKKyAgICAgICAgICAgIHJldHVybiBtU3RhdGUgPT0gU3RhdGUuQ09OTkVDVEVEOworICAgICAgICB9CiAgICAgfQogCiAgICAgLyoqCkBAIC0yMTAsNyArMjI3LDkgQEAKICAgICAgKiBAcmV0dXJuIHtAY29kZSB0cnVlfSBpZiB0aGUgbmV0d29yayBpcyBhdmFpbGFibGUsIHtAY29kZSBmYWxzZX0gb3RoZXJ3aXNlCiAgICAgICovCiAgICAgcHVibGljIGJvb2xlYW4gaXNBdmFpbGFibGUoKSB7Ci0gICAgICAgIHJldHVybiBtSXNBdmFpbGFibGU7CisgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgeworICAgICAgICAgICAgcmV0dXJuIG1Jc0F2YWlsYWJsZTsKKyAgICAgICAgfQogICAgIH0KIAogICAgIC8qKgpAQCAtMjIwLDcgKzIzOSw5IEBACiAgICAgICogQGhpZGUKICAgICAgKi8KICAgICBwdWJsaWMgdm9pZCBzZXRJc0F2YWlsYWJsZShib29sZWFuIGlzQXZhaWxhYmxlKSB7Ci0gICAgICAgIG1Jc0F2YWlsYWJsZSA9IGlzQXZhaWxhYmxlOworICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKKyAgICAgICAgICAgIG1Jc0F2YWlsYWJsZSA9IGlzQXZhaWxhYmxlOworICAgICAgICB9CiAgICAgfQogCiAgICAgLyoqCkBAIC0yMzEsNyArMjUyLDkgQEAKICAgICAgKiBvdGhlcndpc2UuCiAgICAgICovCiAgICAgcHVibGljIGJvb2xlYW4gaXNGYWlsb3ZlcigpIHsKLSAgICAgICAgcmV0dXJuIG1Jc0ZhaWxvdmVyOworICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKKyAgICAgICAgICAgIHJldHVybiBtSXNGYWlsb3ZlcjsKKyAgICAgICAgfQogICAgIH0KIAogICAgIC8qKgpAQCAtMjQxLDcgKzI2NCw5IEBACiAgICAgICogQGhpZGUKICAgICAgKi8KICAgICBwdWJsaWMgdm9pZCBzZXRGYWlsb3Zlcihib29sZWFuIGlzRmFpbG92ZXIpIHsKLSAgICAgICAgbUlzRmFpbG92ZXIgPSBpc0ZhaWxvdmVyOworICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKKyAgICAgICAgICAgIG1Jc0ZhaWxvdmVyID0gaXNGYWlsb3ZlcjsKKyAgICAgICAgfQogICAgIH0KIAogICAgIC8qKgpAQCAtMjUxLDExICsyNzYsMTUgQEAKICAgICAgKiBAcmV0dXJuIHtAY29kZSB0cnVlfSBpZiByb2FtaW5nIGlzIGluIGVmZmVjdCwge0Bjb2RlIGZhbHNlfSBvdGhlcndpc2UuCiAgICAgICovCiAgICAgcHVibGljIGJvb2xlYW4gaXNSb2FtaW5nKCkgewotICAgICAgICByZXR1cm4gbUlzUm9hbWluZzsKKyAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CisgICAgICAgICAgICByZXR1cm4gbUlzUm9hbWluZzsKKyAgICAgICAgfQogICAgIH0KIAogICAgIHZvaWQgc2V0Um9hbWluZyhib29sZWFuIGlzUm9hbWluZykgewotICAgICAgICBtSXNSb2FtaW5nID0gaXNSb2FtaW5nOworICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKKyAgICAgICAgICAgIG1Jc1JvYW1pbmcgPSBpc1JvYW1pbmc7CisgICAgICAgIH0KICAgICB9CiAKICAgICAvKioKQEAgLTI2Myw3ICsyOTIsOSBAQAogICAgICAqIEByZXR1cm4gdGhlIGNvYXJzZS1ncmFpbmVkIHN0YXRlCiAgICAgICovCiAgICAgcHVibGljIFN0YXRlIGdldFN0YXRlKCkgewotICAgICAgICByZXR1cm4gbVN0YXRlOworICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKKyAgICAgICAgICAgIHJldHVybiBtU3RhdGU7CisgICAgICAgIH0KICAgICB9CiAKICAgICAvKioKQEAgLTI3MSw3ICszMDIsOSBAQAogICAgICAqIEByZXR1cm4gdGhlIGZpbmUtZ3JhaW5lZCBzdGF0ZQogICAgICAqLwogICAgIHB1YmxpYyBEZXRhaWxlZFN0YXRlIGdldERldGFpbGVkU3RhdGUoKSB7Ci0gICAgICAgIHJldHVybiBtRGV0YWlsZWRTdGF0ZTsKKyAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CisgICAgICAgICAgICByZXR1cm4gbURldGFpbGVkU3RhdGU7CisgICAgICAgIH0KICAgICB9CiAKICAgICAvKioKQEAgLTI4MSwxMiArMzE0LDE1IEBACiAgICAgICogaWYgb25lIHdhcyBzdXBwbGllZC4gTWF5IGJlIHtAY29kZSBudWxsfS4KICAgICAgKiBAcGFyYW0gZXh0cmFJbmZvIGFuIG9wdGlvbmFsIHtAY29kZSBTdHJpbmd9IHByb3ZpZGluZyBhZGRkaXRpb25hbCBuZXR3b3JrIHN0YXRlCiAgICAgICogaW5mb3JtYXRpb24gcGFzc2VkIHVwIGZyb20gdGhlIGxvd2VyIG5ldHdvcmtpbmcgbGF5ZXJzLgorICAgICAqIEBoaWRlCiAgICAgICovCi0gICAgdm9pZC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ICAqLwogICAgIHB1YmxpYyB2b2lkIHdyaXRlVG9QYXJjZWwoUGFyY2VsIGRlc3QsIGludCBmbGFncykgewotICAgICAgICBkZXN0LndyaXRlSW50KG1OZXR3b3JrVHlwZSk7Ci0gICAgICAgIGRlc3Qud3JpdGVJbnQobVN1YnR5cGUpOwotICAgICAgICBkZXN0LndyaXRlU3RyaW5nKG1UeXBlTmFtZSk7Ci0gICAgICAgIGRlc3Qud3JpdGVTdHJpbmcobVN1YnR5cGVOYW1lKTsKLSAgICAgICAgZGVzdC53cml0ZVN0cmluZyhtU3RhdGUubmFtZSgpKTsKLSAgICAgICAgZGVzdC53cml0ZVN0cmluZyhtRGV0YWlsZWRTdGF0ZS5uYW1lKCkpOwotICAgICAgICBkZXN0LndyaXRlSW50KG1Jc0ZhaWxvdmVyID8gMSA6IDApOwotICAgICAgICBkZXN0LndyaXRlSW50KG1Jc0F2YWlsYWJsZSA/IDEgOiAwKTsKLSAgICAgICAgZGVzdC53cml0ZUludChtSXNSb2FtaW5nID8gMSA6IDApOwotICAgICAgICBkZXN0LndyaXRlU3RyaW5nKG1SZWFzb24pOwotICAgICAgICBkZXN0LndyaXRlU3RyaW5nKG1FeHRyYUluZm8pOworICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKKyAgICAgICAgICAgIGRlc3Qud3JpdGVJbnQobU5ldHdvcmtUeXBlKTsKKyAgICAgICAgICAgIGRlc3Qud3JpdGVJbnQobVN1YnR5cGUpOworICAgICAgICAgICAgZGVzdC53cml0ZVN0cmluZyhtVHlwZU5hbWUpOworICAgICAgICAgICAgZGVzdC53cml0ZVN0cmluZyhtU3VidHlwZU5hbWUpOworICAgICAgICAgICAgZGVzdC53cml0ZVN0cmluZyhtU3RhdGUubmFtZSgpKTsKKyAgICAgICAgICAgIGRlc3Qud3JpdGVTdHJpbmcobURldGFpbGVkU3RhdGUubmFtZSgpKTsKKyAgICAgICAgICAgIGRlc3Qud3JpdGVJbnQobUlzRmFpbG92ZXIg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EFHLCAiYWRkUHJpdmF0ZURuc1JvdXRlcyBmb3IgIiArIHRoaXMgKwotICAgICAgICAgICAgICAgICAgICAiKCIgKyBtSW50ZXJmYWNlTmFtZSArICIpIC0gbVByaXZhdGVEbnNSb3V0ZVNldCA9ICIrbVByaXZhdGVEbnNSb3V0ZVNldCk7Ci0gICAgICAgIH0KLSAgICAgICAgaWYgKG1JbnRlcmZhY2VOYW1lICE9IG51bGwgJiYgIW1Qcml2YXRlRG5zUm91dGVTZXQpIHsKLSAgICAgICAgICAgIGZvciAoU3RyaW5nIGFkZHJTdHJpbmcgOiBnZXROYW1lU2VydmVycygpKSB7Ci0gICAgICAgICAgICAgICAgaWYgKGFkZHJTdHJpbmcgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICB0cnkgewotICAgICAgICAgICAgICAgICAgICAgICAgSW5ldEFkZHJlc3MgaW5ldEFkZHJlc3MgPSBJbmV0QWRkcmVzcy5nZXRCeU5hbWUoYWRkclN0cmluZyk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsICIgIGFkZGluZyAiICsgYWRkclN0cmluZyk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoTmV0d29ya1V0aWxzLmFkZEhvc3RSb3V0ZShtSW50ZXJmYWNlTmFtZSwgaW5ldEFkZHJlc3MsIG51bGwpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbVByaXZhdGVEbnNSb3V0ZVNldCA9IHRydWU7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKFVua25vd25Ib3N0RXhjZXB0aW9uIGUpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKFRBRywgIiBETlMgYWRkcmVzcyAiICsgYWRkclN0cmluZyArICIgOiBFeGNlcHRpb24gIiArIGUpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAg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giICsgbUludGVyZmFjZU5hbWUgKyAiKSwgR2F0ZXdheUFkZHI9IiArIG1EZWZhdWx0R2F0ZXdheUFkZHIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgSW5ldEFkZHJlc3MgaW5ldEFkZHJlc3MgPSBOZXR3b3JrVXRpbHMuaW50VG9JbmV0QWRkcmVzcyhtRGVmYXVsdEdhdGV3YXlBZGRyKTsKLSAgICAgICAgICAgIGlmIChpbmV0QWRkcmVzcyA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgaWYgKERCRykgTG9nLmQoVEFHLCAiIFVuYWJsZSB0byBhZGQgZGVmYXVsdCByb3V0ZS4gbURlZmF1bHRHYXRld2F5QWRkciBFcnJvciIpOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBpZiAoIU5ldHdvcmtVdGlscy5hZGREZWZhdWx0Um91dGUobUludGVyZmFjZU5hbWUsIGluZXRBZGRyZXNzKSAmJiBEQkcpIHsKLSAgICAgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAiICBVbmFibGUgdG8gYWRkIGRlZmF1bHQgcm91dGUuIik7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgfQotCi0gICAgcHVibGljIHZvaWQgcmVtb3ZlRGVmYXVsdFJvdXRlKCkgewotICAgICAgICBpZiAobUludGVyZmFjZU5hbWUgIT0gbnVsbCkgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKFRBRywgInJlbW92ZURlZmF1bHRSb3V0ZSBmb3IgIiArIG1OZXR3b3JrSW5mby5nZXRUeXBlTmFtZSgpICsgIiAoIiArCi0gICAgICAgICAgICAgICAgICAgICAgICBtSW50ZXJmYWNlTmFtZSArICIpIik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBOZXR3b3JrVXRpbHMucmVtb3ZlRGVmYXVsdFJvdXRlKG1JbnRlcmZhY2VOYW1lKTs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CwxOSArMTk4LDQgQEAKICAgICAgICAgfQogICAgICAgICByZXR1cm4gYWRkUm91dGUoaW50ZXJmYWNlTmFtZSwgZHN0U3RyLCBwcmVmaXhMZW5ndGgsIGd3U3RyKSA9PSAwOwogICAgIH0KLQotICAgIHB1YmxpYyBzdGF0aWMgaW50IHY0U3RyaW5nVG9JbnQoU3RyaW5nIHN0cikgewotICAgICAgICBpbnQgcmVzdWx0ID0gMDsKLSAgICAgICAgU3RyaW5nW10gYXJyYXkgPSBzdHIuc3BsaXQoIlxcLiIpOwotICAgICAgICBpZiAoYXJyYXkubGVuZ3RoICE9IDQpIHJldHVybiAwOwotICAgICAgICB0cnkgewotICAgICAgICAgICAgcmVzdWx0ID0gSW50ZWdlci5wYXJzZUludChhcnJheVszXSk7Ci0gICAgICAgICAgICByZXN1bHQgPSAocmVzdWx0IDw8IDgpICsgSW50ZWdlci5wYXJzZUludChhcnJheVsyXSk7Ci0gICAgICAgICAgICByZXN1bHQgPSAocmVzdWx0IDw8IDgpICsgSW50ZWdlci5wYXJzZUludChhcnJheVsxXSk7Ci0gICAgICAgICAgICByZXN1bHQgPSAocmVzdWx0IDw8IDgpICsgSW50ZWdlci5wYXJzZUludChhcnJheVswXSk7Ci0gICAgICAgIH0gY2F0Y2ggKE51bWJlckZvcm1hdEV4Y2VwdGlvbiBlKSB7Ci0gICAgICAgICAgICByZXR1cm4gMDsKLSAgICAgICAgfQotICAgICAgICByZXR1cm4gcmVzdWx0OwotICAgIH0KIH0KZGlmZiAtLWdpdCBhL2NvcmUvamF2YS9hbmRyb2lkL25ldC9Qcm94eS5qYXZhIGIvY29yZS9qYXZhL2FuZHJvaWQvbmV0L1Byb3h5LmphdmEKaW5kZXggMjJjMzBhNS4uZTJlNGQyYyAxMDA2NDQKLS0tIGEvY29yZS9qYXZhL2FuZHJvaWQvbmV0L1Byb3h5LmphdmEKKysrIGIvY29yZS9qYXZhL2FuZHJvaWQvbmV0L1Byb3h5LmphdmEKQEAgLTE2LDMyICs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5nZXRIb3N0KCk7CisgICAgICAgIC8vIElmIHRoZSBkb21haW4gaXMgZGVmaW5lZCBhcyAiLmFuZHJvaWQuY29tIiBvciAiYW5kcm9pZC5jb20iLCB3ZSB3aXNoIHRvIG1hdGNoCisgICAgICAgIC8vIGh0dHA6Ly9hbmRyb2lkLmNvbSBhcyB3ZWxsIGFzIGh0dHA6Ly94eHguYW5kcm9pZC5jb20gLCBidXQgbm90CisgICAgICAgIC8vIGh0dHA6Ly9teWFuZHJvaWQuY29tIC4gVGhpcyBjb2RlIHdvcmtzIG91dCB0aGUgbG9naWMuCisgICAgICAgIGZvciAoU3RyaW5nIGV4Y2x1ZGVkRG9tYWluIDogZXhjbHVzaW9uTGlzdCkgeworICAgICAgICAgICAgU3RyaW5nIGRvdERvbWFpbiA9ICIuIiArIGV4Y2x1ZGVkRG9tYWluOworICAgICAgICAgICAgaWYgKHVybERvbWFpbi5lcXVhbHMoZXhjbHVkZWREb21haW4pKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAodXJsRG9tYWluLmVuZHNXaXRoKGRvdERvbWFpbikpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICAvLyBObyBtYXRjaAorICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgcHJpdmF0ZSBzdGF0aWMgU3RyaW5nIHBhcnNlSG9zdChTdHJpbmcgcHJveHlTcGVjKSB7CisgICAgICAgIGludCBpID0gcHJveHlTcGVjLmluZGV4T2YoJzonKTsKKyAgICAgICAgaWYgKGkgPT0gLTEpIHsKKyAgICAgICAgICAgIGlmIChERUJVRykgeworICAgICAgICAgICAgICAgIEFzc2VydC5hc3NlcnRUcnVlKHByb3h5U3BlYy5sZW5ndGgoKSA9PSAwKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICB9CisgICAgICAgIHJldHVybiBwcm94eVNwZWMuc3Vic3RyaW5nKDAsIGkpOworICAgIH0KKworICAgIHByaXZhdGUgc3RhdGljIGludCBwYXJzZVBvcnQoU3RyaW5nIHByb3h5U3BlYykgeworICAgICAgICBpbnQgaSA9IHByb3h5U3BlYy5pbmRleE9mKCc6Jyk7CisgICAgICAgIGlmIChpID09IC0xKSB7CisgICAgICAgICAgICBpZiAoREVCVUcpIHsKKyAgICAgICAgICAgICAgICBBc3NlcnQuYXNzZXJ0VHJ1ZShwcm94eVNwZWMubGVuZ3RoKCkgPT0gMCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gLTE7CisgICAgICAgIH0KKyAgICAgICAgaWYgKERFQlVHKSB7CisgICAgICAgICAgICBBc3NlcnQuYXNzZXJ0VHJ1ZShpIDwgcHJveHlTcGVjLmxlbmd0aCgpKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gSW50ZWdlci5wYXJzZUludChwcm94eVNwZWMuc3Vic3RyaW5nKGkrMSkpOworICAgIH0KKworICAgIC8qKgorICAgICAqIFJldHVybiB0aGUgcHJveHkgb2JqZWN0IHRvIGJlIHVzZWQgZm9yIHRoZSBVUkwgZ2l2ZW4gYXMgcGFyYW1ldGVyLgorICAgICAqIEBwYXJhbSBjdHggQSBDb250ZXh0IHVzZWQgdG8gZ2V0IHRoZSBzZXR0aW5ncyBmb3IgdGhlIHByb3h5IGhvc3QuCisgICAgICogQHBhcmFtIHVybCBBIFVSTCB0byBiZSBhY2Nlc3NlZC4gVXNlZCB0byBldmFsdWF0ZSBleGNsdXNpb24gbGlzdC4KKyAgICAgKiBAcmV0dXJuIFByb3h5IChqYXZhLm5ldCkgb2JqZWN0IGNvbnRhaW5pbmcgdGhlIGhvc3QgbmFtZS4gSWYgdGhlCisgICAgICogICAgICAgICB1c2VyIGRpZCBub3Qgc2V0IGEgaG9zdG5hbWUgaXQgcmV0dXJucyB0aGUgZGVmYXVsdCBob3N0LgorICAgICAqICAgICAgICAgQSBudWxsIHZhbHVlIG1lYW5zIHRoYXQgbm8gaG9zdCBpcyB0byBiZSB1c2VkLgorICAgICAqIHtAaGlkZX0KKyAgICAgKi8KKyAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGphdmEubmV0LlByb3h5IGdldFByb3h5KENvbnRleHQgY3R4LCBTdHJpbmcgdXJsKSB7CisgICAgICAgIHNQcm94eUluZm9Mb2NrLnJlYWRMb2NrKCkubG9jaygpOworICAgICAgICBqYXZhLm5ldC5Qcm94eSByZXR2YWw7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBpZiAoc0dsb2JhbFByb3h5Q2hhbmdlZE9ic2VydmVyID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICByZWdpc3RlckNvbnRlbnRPYnNlcnZlcnNSZWFkTG9ja2VkKGN0eCk7CisgICAgICAgICAgICAgICAgcGFyc2VHbG9iYWxQcm94eUluZm9SZWFkTG9ja2VkKGN0eCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoc0dsb2JhbFByb3h5U3BlYyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgLy8gUHJveHkgZGVmaW5lZCAtIEFwcGx5IGV4Y2x1c2lvbiBydWxlcworICAgICAgICAgICAgICAgIGlmIChpc1VSTEluRXhjbHVzaW9uTGlzdFJlYWRMb2NrZWQodXJsLCBzR2xvYmFsUHJveHlTcGVjLmV4Y2x1c2lvbkxpc3QpKSB7CisgICAgICAgICAgICAgICAgICAgIC8vIFJldHVybiBubyBwcm94eQorICAgICAgICAgICAgICAgICAgICByZXR2YWwgPSBqYXZhLm5ldC5Qcm94eS5OT19QUk9YWTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICByZXR2YWwgPQorICAgICAgICAgICAgICAgICAgICAgICAgbmV3IGphdmEubmV0LlByb3h5KGphdmEubmV0LlByb3h5LlR5cGUuSFRUUCwgc0dsb2JhbFByb3h5U3BlYy5wcm94eUFkZHJlc3MpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgLy8gSWYgbmV0d29yayBpcyBXaUZpLCByZXR1cm4gbm8gcHJveHkuCisgICAgICAgICAgICAgICAgLy8gT3RoZXJ3aXNlLCByZXR1cm4gdGhlIE1vYmlsZSBPcGVyYXRvciBwcm94eS4KKyAgICAgICAgICAgICAgICBpZiAoIWlzTmV0d29ya1dpZmkoY3R4KSkgeworICAgICAgICAgICAgICAgICAgICByZXR2YWwgPSBnZXREZWZhdWx0UHJveHkodXJsKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICByZXR2YWwgPSBqYXZhLm5ldC5Qcm94eS5OT19QUk9YWTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICBzUHJveHlJbmZvTG9jay5yZWFkTG9jaygpLnVubG9jaygpOworICAgICAgICB9CisgICAgICAgIGlmICgocmV0dmFsICE9IGphdmEubmV0LlByb3h5Lk5PX1BST1hZKSAmJiAoaXNMb2NhbEhvc3QodXJsKSkpIHsKKyAgICAgICAgICAgIHJldHZhbCA9IGphdmEubmV0LlByb3h5Lk5PX1BST1hZOworICAgICAgICB9CisgICAgICAgIHJldHVybiByZXR2YWw7CisgICAgfQorCisgICAgLy8gVE9ETzogZGVwcmVjYXRlIHRoaXMgZnVuY3Rpb24KICAgICAvKioKICAgICAgKiBSZXR1cm4gdGhlIHByb3h5IGhvc3Qgc2V0IGJ5IHRoZSB1c2VyLgogICAgICAqIEBwYXJhbSBjdHggQSBDb250ZXh0IHVzZWQgdG8gZ2V0IHRoZSBzZXR0aW5ncyBmb3IgdGhlIHByb3h5IGhvc3QuCkBAIC00OSw2MCArMTc5LDU1IEBACiAgICAgICogICAgICAgICBuYW1lIGl0IHJldHVybnMgdGhlIGRlZmF1bHQgaG9zdC4gQSBudWxsIHZhbHVlIG1lYW5zIHRoYXQgbm8KICAgICAgKiAgICAgICAgIGhvc3QgaXMgdG8gYmUgdXNlZC4KICAgICAgKi8KLSAgICBzdGF0aWMgZmluYWwgcHVibGljIFN0cmluZyBnZXRIb3N0KENvbnRleHQgY3R4KSB7Ci0gICAgICAgIENvbnRlbnRSZXNvbHZlciBjb250ZW50UmVzb2x2ZXIgPSBjdHguZ2V0Q29udGVudFJlc29sdmVyKCk7Ci0gICAgICAgIEFzc2VydC5hc3NlcnROb3ROdWxsKGNvbnRlbnRSZXNvbHZlcik7Ci0gICAgICAgIFN0cmluZyBob3N0ID0gU2V0dGluZ3MuU2VjdXJlLmdldFN0cmluZygKLSAgICAgICAgICAgICAgICBjb250ZW50UmVzb2x2ZXIsCi0gICAgICAgICAgICAgICAgU2V0dGluZ3MuU2VjdXJlLkhUVFBfUFJPWFkpOwotICAgICAgICBpZiAoaG9zdCAhPSBudWxsKSB7Ci0gICAgICAgICAgICBpbnQgaSA9IGhvc3QuaW5kZXhPZignOicpOwotICAgICAgICAgICAgaWYgKGkgPT0gLTEpIHsKLSAgICAgICAgICAgICAgICBpZiAoREVCVUcpIHsKLSAgICAgICAgICAgICAgICAgICAgQXNzZXJ0LmFzc2VydFRydWUoaG9zdC5sZW5ndGgoKSA9PSAwKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgZ2V0SG9zdChDb250ZXh0IGN0eCkgeworICAgICAgICBzUHJveHlJbmZvTG9jay5yZWFkTG9jaygpLmxvY2soKTsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIGlmIChzR2xvYmFsUHJveHlDaGFuZ2VkT2JzZXJ2ZXIgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIHJlZ2lzdGVyQ29udGVudE9ic2VydmVyc1JlYWRMb2NrZWQoY3R4KTsKKyAgICAgICAgICAgICAgICBwYXJzZUdsb2JhbFByb3h5SW5mb1JlYWRMb2NrZWQoY3R4KTsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJldHVybiBob3N0LnN1YnN0cmluZygwLCBpKTsKKyAgICAgICAgICAgIGlmIChzR2xvYmFsUHJveHlTcGVjICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBJbmV0U29ja2V0QWRkcmVzcyBzYSA9IHNHbG9iYWxQcm94eVNwZWMucHJveHlBZGRyZXNzOworICAgICAgICAgICAgICAgIHJldHVybiBzYS5nZXRIb3N0TmFtZSgpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIGdldERlZmF1bHRIb3N0KCk7CisgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICBzUHJveHlJbmZvTG9jay5yZWFkTG9jaygpLnVubG9jaygpOwogICAgICAgICB9Ci0gICAgICAgIHJldHVybiBnZXREZWZhdWx0SG9zdCgpOwogICAgIH0KIAorICAgIC8vIFRPRE86IGRlcHJlY2F0ZSB0aGlzIGZ1bmN0aW9uCiAgICAgLyoqCiAgICAgICogUmV0dXJuIHRoZSBwcm94eSBwb3J0IHNldCBieSB0aGUgdXNlci4KICAgICAgKiBAcGFyYW0gY3R4IEEgQ29udGV4dCB1c2VkIHRvIGdldCB0aGUgc2V0dGluZ3MgZm9yIHRoZSBwcm94eSBwb3J0LgogICAgICAqIEByZXR1cm4gVGhlIHBvcnQgbnVtYmVyIHRvIHVzZSBvciAtMSBpZiBubyBwcm94eSBpcyB0byBiZSB1c2VkLgogICAgICAqLwotICAgIHN0YXRpYyBmaW5hbCBwdWJsaWMgaW50IGdldFBvcnQoQ29udGV4dCBjdHgpIHsKLSAgICAgICAgQ29udGVudFJlc29sdmVyIGNvbnRlbnRSZXNvbHZlciA9IGN0eC5nZXRDb250ZW50UmVzb2x2ZXIoKTsKLSAgICAgICAgQXNzZXJ0LmFzc2VydE5vdE51bGwoY29udGVudFJlc29sdmVyKTsKLSAgICAgICAgU3RyaW5nIGhvc3QgPSBTZXR0aW5ncy5TZWN1cmUuZ2V0U3RyaW5nKAotICAgICAgICAgICAgICAgIGNvbnRlbnRSZXNvbHZlciwKLSAgICAgICAgICAgICAgICBTZXR0aW5ncy5TZWN1cmUuSFRUUF9QUk9YWSk7Ci0gICAgICAgIGlmIChob3N0ICE9IG51bGwpIHsKLSAgICAgICAgICAgIGludCBpID0gaG9zdC5pbmRleE9mKCc6Jyk7Ci0gICAgICAgICAgICBpZiAoaSA9PSAtMSkgewotICAgICAgICAgICAgICAgIGlmIChERUJVRykgewotICAgICAgICAgICAgICAgICAgICBBc3NlcnQuYXNzZXJ0VHJ1ZShob3N0Lmxlbmd0aCgpID09IDApOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICByZXR1cm4gLTE7CisgICAgcHVibGljIHN0YXRpYyBmaW5hbCBpbnQgZ2V0UG9ydChDb250ZXh0IGN0eCkgeworICAgICAgICBzUHJveHlJbmZvTG9jay5yZWFkTG9jaygpLmxvY2soKTsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIGlmIChzR2xvYmFsUHJveHlDaGFuZ2VkT2JzZXJ2ZXIgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIHJlZ2lzdGVyQ29udGVudE9ic2VydmVyc1JlYWRMb2NrZWQoY3R4KTsKKyAgICAgICAgICAgICAgICBwYXJzZUdsb2JhbFByb3h5SW5mb1JlYWRMb2NrZWQoY3R4KTsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmIChERUJVRykgewotICAgICAgICAgICAgICAgIEFzc2VydC5hc3NlcnRUcnVlKGkgPCBob3N0Lmxlbmd0aCgpKTsKKyAgICAgICAgICAgIGlmIChzR2xvYmFsUHJveHlTcGVjICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBJbmV0U29ja2V0QWRkcmVzcyBzYSA9IHNHbG9iYWxQcm94eVNwZWMucHJveHlBZGRyZXNzOworICAgICAgICAgICAgICAgIHJldHVybiBzYS5nZXRQb3J0KCk7CiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICByZXR1cm4gSW50ZWdlci5wYXJzZUludChob3N0LnN1YnN0cmluZyhpKzEpKTsKKyAgICAgICAgICAgIHJldHVybiBnZXREZWZhdWx0UG9ydCgpOworICAgICAgICB9IGZpbmFsbHkgeworICAgICAgICAgICAgc1Byb3h5SW5mb0xvY2sucmVhZExvY2soKS51bmxvY2soKTsKICAgICAgICAgfQotICAgICAgICByZXR1cm4gZ2V0RGVmYXVsdFBvcnQoKTsKICAgICB9CiAKKyAgICAvLyBUT0RPOiBkZXByZWNhdGUgdGhpcyBmdW5jdGlvbgogICAgIC8qKgogICAgICAqIFJldHVybiB0aGUgZGVmYXVsdCBwcm94eSBob3N0IHNwZWNpZmllZCBieSB0aGUgY2Fycmllci4KICAgICAgKiBAcmV0dXJuIFN0cmluZyBjb250YWluaW5nIHRoZSBob3N0IG5hbWUgb3IgbnVsbCBpZiB0aGVyZSBpcyBubyBwcm94eSBmb3IKICAgICAgKiB0aGlzIGNhcnJpZXIuCiAgICAgICovCi0gICAgc3RhdGljIGZpbmFsIHB1YmxpYyBTdHJpbmcgZ2V0RGVmYXVsdEhvc3QoKSB7CisgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgZ2V0RGVmYXVsdEhvc3QoKSB7CiAgICAgICAgIFN0cmluZyBob3N0ID0gU3lzdGVtUHJvcGVydGllcy5nZXQoIm5ldC5ncHJzLmh0dHAtcHJveHkiKTsKLSAgICAgICAgaWYgKGhvc3QgIT0gbnVsbCkgeworICAgICAgICBpZiAoKGhvc3QgIT0gbnVsbCkgJiYgKGhvc3QubGVuZ3RoKCkgIT0gMCkpIHsKICAgICAgICAgICAgIFVyaSB1ID0gVXJpLnBhcnNlKGhvc3QpOwogICAgICAgICAgICAgaG9zdCA9IHUuZ2V0SG9zdCgpOwogICAgICAgICAgICAgcmV0dXJuIGhvc3Q7CkBAIC0xMTEsMTQgKzIzNiwxNSBAQAogICAgICAgICB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Byb3hpZXMsIHNvIHRoZXkgYXJlIHBhcnNlIG1hbnVhbGx5LgorICAgICAgICBTdHJpbmcgaG9zdCA9IFN5c3RlbVByb3BlcnRpZXMuZ2V0KCJuZXQuZ3Bycy5odHRwLXByb3h5Iik7CisgICAgICAgIGlmICgoaG9zdCAhPSBudWxsKSAmJiAoaG9zdC5sZW5ndGgoKSAhPSAwKSkgeworICAgICAgICAgICAgVXJpIHUgPSBVcmkucGFyc2UoaG9zdCk7CisgICAgICAgICAgICByZXR1cm4gbmV3IGphdmEubmV0LlByb3h5KGphdmEubmV0LlByb3h5LlR5cGUuSFRUUCwKKyAgICAgICAgICAgICAgICAgICAgbmV3IEluZXRTb2NrZXRBZGRyZXNzKHUuZ2V0SG9zdCgpLCB1LmdldFBvcnQoKSkpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgcmV0dXJuIGphdmEubmV0LlByb3h5Lk5PX1BST1hZOworICAgICAgICB9CisgICAgfQorCisgICAgLy8gVE9ETzogcmVtb3ZlIHRoaXMgZnVuY3Rpb24gLyBkZXByZWNhdGUKICAgICAvKioKICAgICAgKiBSZXR1cm5zIHRoZSBwcmVmZXJyZWQgcHJveHkgdG8gYmUgdXNlZCBieSBjbGllbnRzLiBUaGlzIGlzIGEgd3JhcHBlcgogICAgICAqIGFyb3VuZCB7QGxpbmsgYW5kcm9pZC5uZXQuUHJveHkjZ2V0SG9zdCgpfS4gQ3VycmVudGx5IG5vIHByb3h5IHdpbGwKQEAgLTEzOCwyNiArMjc4LDIzIEBACiAgICAgICogYW5kcm9pZC5wZXJtaXNzaW9uLkFDQ0VTU19ORVRXT1JLX1NUQVRFCiAgICAgICogQHJldHVybiBUaGUgcHJlZmVycmVkIHByb3h5IHRvIGJlIHVzZWQgYnkgY2xpZW50cywgb3IgbnVsbCBpZiB0aGVyZQogICAgICAqIGlzIG5vIHByb3h5LgotICAgICAqCiAgICAgICoge0BoaWRlfQogICAgICAqLwotICAgIHN0YXRpYyBmaW5hbCBwdWJsaWMgSHR0cEhvc3QgZ2V0UHJlZmVycmVkSHR0cEhvc3QoQ29udGV4dCBjb250ZXh0LAorICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgSHR0cEhvc3QgZ2V0UHJlZmVycmVkSHR0cEhvc3QoQ29udGV4dCBjb250ZXh0LAogICAgICAgICAgICAgU3RyaW5nIHVybCkgewotICAgICAgICBpZiAoIWlzTG9jYWxIb3N0KHVybCkgJiYgIWlzTmV0d29ya1dpZmkoY29udGV4dCkpIHsKLSAgICAgICAgICAgIGZpbmFsIFN0cmluZyBwcm94eUhvc3QgPSBQcm94eS5nZXRIb3N0KGNvbnRleHQpOwotICAgICAgICAgICAgaWYgKHByb3h5SG9zdCAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBIdHRwSG9zdChwcm94eUhvc3QsIFByb3h5LmdldFBvcnQoY29udGV4dCksICJodHRwIik7Ci0gICAgICAgICAgICB9CisgICAgICAgIGphdmEubmV0LlByb3h5IHByZWZQcm94eSA9IGdldFByb3h5KGNvbnRleHQsIHVybCk7CisgICAgICAgIGlmIChwcmVmUHJveHkuZXF1YWxzKGphdmEubmV0LlByb3h5Lk5PX1BST1hZKSkgeworICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBJbmV0U29ja2V0QWRkcmVzcyBzYSA9IChJbmV0U29ja2V0QWRkcmVzcylwcmVmUHJveHkuYWRkcmVzcygpOworICAgICAgICAgICAgcmV0dXJuIG5ldyBIdHRwSG9zdChzYS5nZXRIb3N0TmFtZSgpLCBzYS5nZXRQb3J0KCksICJodHRwIik7CiAgICAgICAgIH0KLQotICAgICAgICByZXR1cm4gbnVsbDsKICAgICB9CiAKLSAgICBzdGF0aWMgZmluYWwgcHJpdmF0ZSBib29sZWFuIGlzTG9jYWxIb3N0KFN0cmluZyB1cmwpIHsKKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBib29sZWFuIGlzTG9jYWxIb3N0KFN0cmluZyB1cmwpIHsKICAgICAgICAgaWYgKHVybCA9PSBudWxsKSB7CiAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgIH0KLQogICAgICAgICB0cnkgewogICAgICAgICAgICAgZmluYWwgVVJJIHVyaSA9IFVSSS5jcmVhdGUodXJsKTsKICAgICAgICAgICAgIGZpbmFsIFN0cmluZyBob3N0ID0gdXJpLmdldEhvc3QoKTsKQEAgLTE3NCwxNSArMzExLDEzIEBACiAgICAgICAgIH0gY2F0Y2ggKElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbiBpZXgpIHsKICAgICAgICAgICAgIC8vIElnbm9yZSAoVVJJLmNyZWF0ZSkKICAgICAgICAgfQotCiAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICB9CiAKLSAgICBzdGF0aWMgZmluYWwgcHJpdmF0ZSBib29sZWFuIGlzTmV0d29ya1dpZmkoQ29udGV4dCBjb250ZXh0KSB7CisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgYm9vbGVhbiBpc05ldHdvcmtXaWZpKENvbnRleHQgY29udGV4dCkgewogICAgICAgICBpZiAoY29udGV4dCA9PSBudWxsKSB7CiAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgIH0KLQogICAgICAgICBmaW5hbCBDb25uZWN0aXZpdHlNYW5hZ2VyIGNvbm5lY3Rpdml0eSA9IChDb25uZWN0aXZpdHlNYW5hZ2VyKQogICAgICAgICAgICAgY29udGV4dC5nZXRTeXN0ZW1TZXJ2aWNlKENvbnRleHQuQ09OTkVDVElWSVRZX1NFUlZJQ0UpOwogICAgICAgICBpZiAoY29ubmVjdGl2aXR5ICE9IG51bGwpIHsKQEAgLTE5Miw3ICszMjcsMTI5IEBACiAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KLQogICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgfQotfTsKKworICAgI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Zm9Mb2NrLnJlYWRMb2NrKCkudW5sb2NrKCk7CisgICAgICAgIHNQcm94eUluZm9Mb2NrLndyaXRlTG9jaygpLmxvY2soKTsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIHNHbG9iYWxQcm94eUNoYW5nZWRPYnNlcnZlciA9IG5ldyBTZXR0aW5nc09ic2VydmVyKGN0eCk7CisgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICAvLyBEb3duZ3JhZGluZyBsb2NrcyAoZnJvbSB3cml0ZSB0byByZWFkKSBpcyBhbGxvd2VkCisgICAgICAgICAgICBzUHJveHlJbmZvTG9jay5yZWFkTG9jaygpLmxvY2soKTsKKyAgICAgICAgICAgIHNQcm94eUluZm9Mb2NrLndyaXRlTG9jaygpLnVubG9jaygpOworICAgICAgICB9CisgICAgICAgIGN0eC5nZXRDb250ZW50UmVzb2x2ZXIoKS5yZWdpc3RlckNvbnRlbnRPYnNlcnZlcih1cmlHbG9iYWxQcm94eSwgZmFsc2UsCisgICAgICAgICAgICAgICAgc0dsb2JhbFByb3h5Q2hhbmdlZE9ic2VydmVyKTsKKyAgICAgICAgY3R4LmdldENvbnRlbnRSZXNvbHZlcigpLnJlZ2lzdGVyQ29udGVudE9ic2VydmVyKHVyaUdsb2JhbEV4Y2xMaXN0LCBmYWxzZSwKKyAgICAgICAgICAgICAgICBzR2xvYmFsUHJveHlDaGFuZ2VkT2JzZXJ2ZXIpOworICAgIH0KKworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIHZvaWQgcGFyc2VHbG9iYWxQcm94eUluZm9SZWFkTG9ja2VkKENvbnRleHQgY3R4KSB7CisgICAgICAgIENvbnRlbnRSZXNvbHZlciBjb250ZW50UmVzb2x2ZXIgPSBjdHguZ2V0Q29udGVudFJlc29sdmVyKCk7CisgICAgICAgIFN0cmluZyBwcm94eUhvc3QgPSAgU2V0dGluZ3MuU2VjdXJlLmdldFN0cmluZygKKyAgICAgICAgICAgICAgICBjb250ZW50UmVzb2x2ZXIsCisgICAgICAgICAgICAgICAgU2V0dGluZ3MuU2VjdXJlLkhUVFBfUFJPWFkpOworICAgICAgICBpZiAoKHByb3h5SG9zdCA9PSBudWxsKSB8fCAocHJveHlIb3N0Lmxlbmd0aCgpID09IDApKSB7CisgICAgICAgICAgICAvLyBDbGVhciBzaWduYWwKKyAgICAgICAgICAgIHNQcm94eUluZm9Mb2NrLnJlYWRMb2NrKCkudW5sb2NrKCk7CisgICAgICAgICAgICBzUHJveHlJbmZvTG9jay53cml0ZUxvY2soKS5sb2NrKCk7CisgICAgICAgICAgICBzR2xvYmFsUHJveHlTcGVjID0gbnVsbDsKKyAgICAgICAgICAgIHNQcm94eUluZm9Mb2NrLnJlYWRMb2NrKCkubG9jaygpOworICAgICAgICAgICAgc1Byb3h5SW5mb0xvY2sud3JpdGVMb2NrKCkudW5sb2NrKCk7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKyAgICAgICAgU3RyaW5nIGV4Y2x1c2lvbkxpc3RTcGVjID0gU2V0dGluZ3MuU2VjdXJlLmdldFN0cmluZygKKyAgICAgICAgICAgICAgICBjb250ZW50UmVzb2x2ZXIsCisgICAgICAgICAgICAgICAgU2V0dGluZ3MuU2VjdXJlLkhUVFBfUFJPWFlfRVhDTFVTSU9OX0xJU1QpOworICAgICAgICBTdHJpbmcgaG9zdCA9IHBhcnNlSG9zdChwcm94eUhvc3QpOworICAgICAgICBpbnQgcG9ydCA9IHBhcnNlUG9ydChwcm94eUhvc3QpOworICAgICAgICBpZiAocHJveHlIb3N0ICE9IG51bGwpIHsKKyAgICAgICAgICAgIHNHbG9iYWxQcm94eVNwZWMgPSBuZXcgUHJveHlTcGVjKCk7CisgICAgICAgICAgICBzR2xvYmFsUHJveHlTcGVjLnByb3h5QWRkcmVzcyA9IG5ldyBJbmV0U29ja2V0QWRkcmVzcyhob3N0LCBwb3J0KTsKKyAgICAgICAgICAgIGlmICgoZXhjbHVzaW9uTGlzdFNwZWMgIT0gbnVsbCkgJiYgKGV4Y2x1c2lvbkxpc3RTcGVjLmxlbmd0aCgpICE9IDApKSB7CisgICAgICAgICAgICAgICAgU3RyaW5nW10gZXhjbHVzaW9uTGlzdEVudHJpZXMgPSBleGNsdXNpb25MaXN0U3BlYy50b0xvd2VyQ2FzZSgpLnNwbGl0KCIsIik7CisgICAgICAgICAgICAgICAgU3RyaW5nW10gcHJvY2Vzc2VkRW50cmllcyA9IG5ldyBTdHJpbmdbZXhjbHVzaW9uTGlzdEVudHJpZXMubGVuZ3RoXTsKKyAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGV4Y2x1c2lvbkxpc3RFbnRyaWVzLmxlbmd0aDsgaSsrKSB7CisgICAgICAgICAgICAgICAgICAgIFN0cmluZyBlbnRyeSA9IGV4Y2x1c2lvbkxpc3RFbnRyaWVzW2ldLnRyaW0oKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGVudHJ5LnN0YXJ0c1dpdGgoIi4iKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgZW50cnkgPSBlbnRyeS5zdWJzdHJpbmcoMSk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgcHJvY2Vzc2VkRW50cmllc1tpXSA9IGVudHJ5OworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBzUHJveHlJbmZvTG9jay5yZWFkTG9jaygpLnVubG9jaygpOworICAgICAgICAgICAgICAgIHNQcm94eUluZm9Mb2NrLndyaXRlTG9jaygpLmxvY2soKTsKKyAgICAgICAgICAgICAgICBzR2xvYmFsUHJveHlTcGVjLmV4Y2x1c2lvbkxpc3QgPSBwcm9jZXNzZWRFbnRyaWVzOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBzUHJveHlJbmZvTG9jay5yZWFkTG9jaygpLnVubG9jaygpOworICAgICAgICAgICAgICAgIHNQcm94eUluZm9Mb2NrLndyaXRlTG9jaygpLmxvY2soKTsKKyAgICAgICAgICAgICAgICBzR2xvYmFsUHJveHlTcGVjLmV4Y2x1c2lvbkxpc3QgPSBudWxsOworICAgICAgICAgICAgfQorICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgc1Byb3h5SW5mb0xvY2sucmVhZExvY2soKS51bmxvY2soKTsKKyAgICAgICAgICAgIHNQcm94eUluZm9Mb2NrLndyaXRlTG9jaygpLmxvY2soKTsKKyAgICAgICAgICAgIHNHbG9iYWxQcm94eVNwZWMgPSBudWxsOworICAgICAgICB9CisgICAgICAgIHNQcm94eUluZm9Mb2NrLnJlYWRMb2NrKCkubG9jaygpOworICAgICAgICBzUHJveHlJbmZvTG9jay53cml0ZUxvY2soKS51bmxvY2soKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBWYWxpZGF0ZSBzeW50YXggb2YgaG9zdG5hbWUsIHBvcnQgYW5kIGV4Y2x1c2lvbiBsaXN0IGVudHJpZXMKKyAgICAgKiB7QGhpZGV9CisgICAgICovCisgICAgcHVibGljIHN0YXRpYyB2b2lkIHZhbGlkYXRlKFN0cmluZyBob3N0bmFtZSwgU3RyaW5nIHBvcnQsIFN0cmluZyBleGNsTGlzdCkgeworICAgICAgICBNYXRjaGVyIG1hdGNoID0gSE9TVE5BTUVfUEFUVEVSTi5tYXRjaGVyKGhvc3RuYW1lKTsKKyAgICAgICAgTWF0Y2hlciBsaXN0TWF0Y2ggPSBFWENMTElTVF9QQVRURVJOLm1hdGNoZXIoZXhjbExpc3QpOworCisgICAgICAgIGlmICghbWF0Y2gubWF0Y2hlcygpKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCk7CisgICAgICAgIH0KKworICAgICAgICBpZiAoIWxpc3RNYXRjaC5tYXRjaGVzKCkpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oKTsKKyAgICAgICAgfQorCisgICAgICAgIGlmIChob3N0bmFtZS5sZW5ndGgoKSA+IDAgJiYgcG9ydC5sZW5ndGgoKSA9PSAwKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCk7CisgICAgICAgIH0KKworICAgICAgICBpZiAocG9ydC5sZW5ndGgoKSA+IDApIHsKKyAgICAgICAgICAgIGlmIChob3N0bmFtZS5sZW5ndGgoKSA9PSAwKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaW50IHBvcnRWYWwgPSAtMTsKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgcG9ydFZhbCA9IEludGVnZXIucGFyc2VJbnQocG9ydCk7CisgICAgICAgICAgICB9IGNhdGNoIChOdW1iZXJGb3JtYXRFeGNlcHRpb24gZXgpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAocG9ydFZhbCA8PSAwIHx8IHBvcnRWYWwgPiAweEZGRkYpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9Cit9CmRpZmYgLS1naXQgYS9jb3JlL2phdmEvYW5kcm9pZC9uZXQvUHJveHlQcm9wZXJ0aWVzLmphdmEgYi9jb3JlL2phdmEvYW5kcm9pZC9uZXQvUHJveHlQcm9wZXJ0aWVzLmphdmEKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMC4uYmNlN2VjMAotLS0gL2Rldi9udWxsCisrKyBiL2NvcmUvamF2YS9hbmRyb2lkL25ldC9Qcm94eVByb3BlcnRpZXMuamF2YQpAQCAtMCwwICsxLDEzNCBAQAorLyoKKyAqIEN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ZvciB0aGUgaHR0cCBwcm94eSBpbmZvCisgKiBAaGlkZQorICovCitwdWJsaWMgY2xhc3MgUHJveHlQcm9wZXJ0aWVzIGltcGxlbWVudHMgUGFyY2VsYWJsZSB7CisKKyAgICBwcml2YXRlIEluZXRBZGRyZXNzIG1Qcm94eTsKKyAgICBwcml2YXRlIGludCBtUG9ydDsKKyAgICBwcml2YXRlIFN0cmluZyBtRXhjbHVzaW9uTGlzdDsKKworICAgIHB1YmxpYyBQcm94eVByb3BlcnRpZXMoKSB7CisgICAgfQorCisgICAgLy8gY29weSBjb25zdHJ1Y3RvciBpbnN0ZWFkIG9mIGNsb25lCisgICAgcHVibGljIFByb3h5UHJvcGVydGllcyhQcm94eVByb3BlcnRpZXMgc291cmNlKSB7CisgICAgICAgIGlmIChzb3VyY2UgIT0gbnVsbCkgeworICAgICAgICAgICAgbVByb3h5ID0gc291cmNlLmdldEFkZHJlc3MoKTsKKyAgICAgICAgICAgIG1Qb3J0ID0gc291cmNlLmdldFBvcnQoKTsKKyAgICAgICAgICAgIFN0cmluZyBleGNsdXNpb25MaXN0ID0gc291cmNlLmdldEV4Y2x1c2lvbkxpc3QoKTsKKyAgICAgICAgICAgIGlmIChleGNsdXNpb25MaXN0ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBtRXhjbHVzaW9uTGlzdCA9IG5ldyBTdHJpbmcoZXhjbHVzaW9uTGlzdCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgSW5ldEFkZHJlc3MgZ2V0QWRkcmVzcygpIHsKKyAgICAgICAgcmV0dXJuIG1Qcm94eTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBzZXRBZGRyZXNzKEluZXRBZGRyZXNzIHByb3h5KSB7CisgICAgICAgIG1Qcm94eSA9IHByb3h5OworICAgIH0KKworICAgIHB1YmxpYyBpbnQgZ2V0UG9ydCgpIHsKKyAgICAgICAgcmV0dXJuIG1Qb3J0OworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHNldFBvcnQoaW50IHBvcnQpIHsKKyAgICAgICAgbVBvcnQgPSBwb3J0OworICAgIH0KKworICAgIHB1YmxpYyBTdHJpbmcgZ2V0RXhjbHVzaW9uTGlzdCgpIHsKKyAgICAgICAgcmV0dXJuIG1FeGNsdXNpb25MaXN0OworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHNldEV4Y2x1c2lvbkxpc3QoU3RyaW5nIGV4Y2x1c2lvbkxpc3QpIHsKKyAgICAgICAgbUV4Y2x1c2lvbkxpc3QgPSBleGNsdXNpb25MaXN0OworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyBTdHJpbmcgdG9TdHJpbmcoKSB7CisgICAgICAgIFN0cmluZ0J1aWxkZXIgc2IgPSBuZXcgU3RyaW5nQnVpbGRlcigpOworICAgICAgICBpZiAobVByb3h5ICE9IG51bGwpIHsKKyAgICAgICAgICAgIHNiLmFwcGVuZChtUHJveHkuZ2V0SG9zdEFkZHJlc3MoKSkuYXBwZW5kKCI6IikuYXBwZW5kKG1Qb3J0KTsKKyAgICAgICAgICAgIGlmIChtRXhjbHVzaW9uTGlzdCAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIHNiLmFwcGVuZCgiIHhsPSIpLmFwcGVuZChtRXhjbHVzaW9uTGlzdCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHNiLnRvU3RyaW5nKCk7CisgICAgfQorCisgICAgLyoqCisgICAgICogSW1wbGVtZW50IHRoZSBQYXJjZWxhYmxlIGludGVyZmFjZQorICAgICAqIEBoaWRlCisgICAgICovCisgICAgcHVibGljIGludCBkZXNjcmliZUNvbnRlbnRzKCkgeworICAgICAgICByZXR1cm4gMDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBJbXBsZW1lbnQgdGhlIFBhcmNlbGFibGUgaW50ZXJmYWNlLgorICAgICAqIEBoaWRlCisgICAgICovCisgICAgcHVibGljIHZvaWQgd3JpdGVUb1BhcmNlbChQYXJjZWwgZGVzdCwgaW50IGZsYWdzKSB7CisgICAgICAgIGlmIChtUHJveHkgIT0gbnVsbCkgeworICAgICAgICAgICAgZGVzdC53cml0ZUJ5dGUoKGJ5dGUpMSk7CisgICAgICAgICAgICBkZXN0LndyaXRlU3RyaW5nKG1Qcm94eS5nZXRIb3N0TmFtZSgpKTsKKyAgICAgICAgICAgIGRlc3Qud3JpdGVCeXRlQXJyYXkobVByb3h5LmdldEFkZHJlc3MoKSk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBkZXN0LndyaXRlQnl0ZSgoYnl0ZSkwKTsKKyAgICAgICAgfQorICAgICAgICBkZXN0LndyaXRlSW50KG1Qb3J0KTsKKyAgICAgICAgZGVzdC53cml0ZVN0cmluZyhtRXhjbHVzaW9uTGlzdCk7CisgICAgfQorCisgICAgLyoqCisgICAgICogSW1wbGVtZW50IHRoZSBQYXJjZWxhYmxlIGludGVyZmFjZS4KKyAgICAgKiBAaGlkZQorICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgQ3JlYXRvcjxQcm94eVByb3BlcnRpZXM+IENSRUFUT1IgPQorICAgICAgICBuZXcgQ3JlYXRvcjxQcm94eVByb3BlcnRpZXM+KCkgeworICAgICAgICAgICAgcHVibGljIFByb3h5UHJvcGVydGllcyBjcmVhdGVGcm9tUGFyY2VsKFBhcmNlbCBpbikgeworICAgICAgICAgICAgICAgIFByb3h5UHJvcGVydGllcyBwcm94eVByb3BlcnRpZXMgPSBuZXcgUHJveHlQcm9wZXJ0aWVzKCk7CisgICAgICAgICAgICAgICAgaWYgKGluLnJlYWRCeXRlKCkgPT0gMSkgeworICAgICAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICAgICAgcHJveHlQcm9wZXJ0aWVzLnNldEFkZHJlc3MoSW5ldEFkZHJlc3MuZ2V0QnlBZGRyZXNzKGluLnJlYWRTdHJpbmcoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW4uY3JlYXRlQnl0ZUFycmF5KCkpKTsKKyAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoVW5rbm93bkhvc3RFeGNlcHRpb24gZSkge30KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcHJveHlQcm9wZXJ0aWVzLnNldFBvcnQoaW4ucmVhZEludCgpKTsKKyAgICAgICAgICAgICAgICBwcm94eVByb3BlcnRpZXMuc2V0RXhjbHVzaW9uTGlzdChpbi5yZWFkU3RyaW5nKCkpOworICAgICAgICAgICAgICAgIHJldHVybiBwcm94eVByb3BlcnRpZXM7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHB1YmxpYyBQcm94eVByb3BlcnRpZXNbXSBuZXdBcnJheShpbnQgc2l6ZSkgeworICAgICAgICAgICAgICAgIHJldHVybiBuZXcgUHJveHlQcm9wZXJ0aWVzW3NpemVdOworICAgICAgICAgICAgfQorICAgICAgICB9OworfQpkaWZmIC0tZ2l0IGEvY29yZS9qYXZhL2FuZHJvaWQvbmV0L1VyaS5qYXZhIGIvY29yZS9qYXZhL2FuZHJvaWQvbmV0L1VyaS5qYXZhCmluZGV4IDQ3ZmFhYmEuLjNiMjE1OTAgMTAwNjQ0Ci0tLSBhL2NvcmUvamF2YS9hbmRyb2lkL25ldC9VcmkuamF2YQorKysgYi9jb3JlL2phdmEvYW5kcm9pZC9uZXQvVXJpLmphdmEKQEAgLTI4LDggKzI4LDEwIEBACiBpbXBvcnQgamF2YS51dGlsLkFic3RyYWN0TGlzdDsKIGltcG9ydCBqYXZhLnV0aWwuQXJyYXlMaXN0OwogaW1wb3J0IGphdmEudXRpbC5Db2xsZWN0aW9uczsKK2ltcG9ydCBqYXZhLnV0aWwuTGlua2VkSGFzaFNldDsKIGltcG9ydCBqYXZhLnV0aWwuTGlzdDsKIGltcG9ydCBqYXZhLnV0aWwuUmFuZG9tQWNjZXNzOworaW1wb3J0IGphdmEud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gICAgICB9CisKKyAgICAgICAgU3RyaW5nIHF1ZXJ5ID0gZ2V0RW5jb2RlZFF1ZXJ5KCk7CisgICAgICAgIGlmIChxdWVyeSA9PSBudWxsKSB7CisgICAgICAgICAgICByZXR1cm4gQ29sbGVjdGlvbnMuZW1wdHlTZXQoKTsKKyAgICAgICAgfQorCisgICAgICAgIFNldDxTdHJpbmc+IG5hbWVzID0gbmV3IExpbmtlZEhhc2hTZXQ8U3RyaW5nPigpOworICAgICAgICBpbnQgc3RhcnQgPSAwOworICAgICAgICBkbyB7CisgICAgICAgICAgICBpbnQgbmV4dCA9IHF1ZXJ5LmluZGV4T2YoJyYnLCBzdGFydCk7CisgICAgICAgICAgICBpbnQgZW5kID0gKG5leHQgPT0gLTEpID8gcXVlcnkubGVuZ3RoKCkgOiBuZXh0OworCisgICAgICAgICAgICBpbnQgc2VwYXJhdG9yID0gcXVlcnkuaW5kZXhPZignPScsIHN0YXJ0KTsKKyAgICAgICAgICAgIGlmIChzZXBhcmF0b3IgPiBlbmQgfHwgc2VwYXJhdG9yID09IC0xKSB7CisgICAgICAgICAgICAgICAgc2VwYXJhdG9yID0gZW5kOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBTdHJpbmcgbmFtZSA9IHF1ZXJ5LnN1YnN0cmluZyhzdGFydCwgc2VwYXJhdG9yKTsKKyAgICAgICAgICAgIG5hbWVzLmFkZChkZWNvZGUobmFtZSkpOworCisgICAgICAgICAgICAvLyBNb3ZlIHN0YXJ0IHRvIGVuZCBvZiBuYW1lLgorICAgICAgICAgICAgc3RhcnQgPSBlbmQgKyAxOworICAgICAgICB9IHdoaWxlIChzdGFydCA8IHF1ZXJ5Lmxlbmd0aCgpKTsKKworICAgICAgICByZXR1cm4gQ29sbGVjdGlvbnMudW5tb2RpZmlhYmxlU2V0KG5hbWVzKTsKKyAgICB9CisKKyAgICAvKioKICAgICAgKiBTZWFyY2hlcyB0aGUgcXVlcnkgc3RyaW5nIGZvciBwYXJhbWV0ZXIgd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cHJlZml4LgotICAgICAgICBTdHJpbmcgcHJlZml4ID0gIiYiICsgZW5jb2RlZEtleSArICI9IjsKLQogICAgICAgICBBcnJheUxpc3Q8U3RyaW5nPiB2YWx1ZXMgPSBuZXcgQXJyYXlMaXN0PFN0cmluZz4oKTsKIAogICAgICAgICBpbnQgc3RhcnQgPSAwOwotICAgICAgICBpbnQgbGVuZ3RoID0gcXVlcnkubGVuZ3RoKCk7Ci0gICAgICAgIHdoaWxlIChzdGFydCA8IGxlbmd0aCkgewotICAgICAgICAgICAgc3RhcnQgPSBxdWVyeS5pbmRleE9mKHByZWZpeCwgc3RhcnQpOworICAgICAgICBkbyB7CisgICAgICAgICAgICBpbnQgbmV4dEFtcGVyc2FuZCA9IHF1ZXJ5LmluZGV4T2YoJyYnLCBzdGFydCk7CisgICAgICAgICAgICBpbnQgZW5kID0gbmV4dEFtcGVyc2FuZCAhPSAtMSA/IG5leHRBbXBlcnNhbmQgOiBxdWVyeS5sZW5ndGgoKTsKIAotICAgICAgICAgICAgaWYgKHN0YXJ0ID09IC0xKSB7Ci0gICAgICAgICAgICAgICAgLy8gTm8gbW9yZSB2YWx1ZXMuCisgICAgICAgICAgICBpbnQgc2VwYXJhdG9yID0gcXVlcnkuaW5kZXhPZignPScsIHN0YXJ0KTsKKyAgICAgICAgICAgIGlmIChzZXBhcmF0b3IgPiBlbmQgfHwgc2VwYXJhdG9yID09IC0xKSB7CisgICAgICAgICAgICAgICAgc2VwYXJhdG9yID0gZW5kOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAoc2VwYXJhdG9yIC0gc3RhcnQgPT0gZW5jb2RlZEtleS5sZW5ndGgoKQorICAgICAgICAgICAgICAgICAgICAmJiBxdWVyeS5yZWdpb25NYXRjaGVzKHN0YXJ0LCBlbmNvZGVkS2V5LCAwLCBlbmNvZGVkS2V5Lmxlbmd0aCgpKSkgeworICAgICAgICAgICAgICAgIGlmIChzZXBhcmF0b3IgPT0gZW5kKSB7CisgICAgICAgICAgICAgICAgICB2YWx1ZXMuYWRkKCIiKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgdmFsdWVzLmFkZChkZWNvZGUocXVlcnkuc3Vic3RyaW5nKHNlcGFyYXRvciArIDEsIGVuZCkpKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIE1vdmUgc3RhcnQgdG8gZW5kIG9mIG5hbWUuCisgICAgICAgICAgICBpZiAobmV4dEFtcGVyc2FuZCAhPSAtMSkgeworICAgICAgICAgICAgICAgIHN0YXJ0ID0gbmV4dEFtcGVyc2FuZCArIDE7CisgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAvLyBNb3ZlIHN0YXJ0IHRvIHN0YXJ0IG9mIHZhbHVlLgotICAgICAgICAgICAgc3RhcnQgKz0gcHJlZml4Lmxlbmd0aCgpOwotCi0gICAgICAgICAgICAvLyBGaW5kIGVuZCBvZiB2YWx1ZS4KLSAgICAgICAgICAgIGludCBlbmQgPSBxdWVyeS5pbmRleE9mKCcmJywgc3RhcnQpOwotICAgICAgICAgICAgaWYgKGVuZCA9PSAtMSkgewotICAgICAgICAgICAgICAgIGVuZCA9IHF1ZXJ5Lmxlbmd0aCgpOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBTdHJpbmcgdmFsdWUgPSBxdWVyeS5zdWJzdHJpbmcoc3RhcnQsIGVuZCk7Ci0gICAgICAgICAgICB2YWx1ZXMuYWRkKGRlY29kZSh2YWx1ZSkpOwotCi0gICAgICAgICAgICBzdGFydCA9IGVuZDsKLSAgICAgICAgfQorICAgICAgICB9IHdoaWxlICh0cnVlKTsKIAogICAgICAgICByZXR1cm4gQ29sbGVjdGlvbnMudW5tb2RpZmlhYmxlTGlzdCh2YWx1ZXMpOwogICAgIH0KQEAgLTE1NjAsNyArMTYwNyw2IEBACiAgICAg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AgIGludCBuZXh0QW1wZXJzYW5kID0gcXVlcnkuaW5kZXhPZignJicsIHN0YXJ0KTsKKyAgICAgICAgICAgIGludCBlbmQgPSBuZXh0QW1wZXJzYW5kICE9IC0xID8gbmV4dEFtcGVyc2FuZCA6IGxlbmd0aDsKIAotICAgICAgICBpbnQgZW5jb2RlZEtleVNlYXJjaEluZGV4ID0gMDsKLSAgICAgICAgZmluYWwgaW50IGVuY29kZWRLZXlTZWFyY2hFbmQgPSBxdWVyeS5sZW5ndGgoKSAtIChlbmNvZGVkS2V5TGVuZ3RoICsgMSk7CisgICAgICAgICAgICBpbnQgc2VwYXJhdG9yID0gcXVlcnkuaW5kZXhPZignPScsIHN0YXJ0KTsKKyAgICAgICAgICAgIGlmIChzZXBhcmF0b3IgPiBlbmQgfHwgc2VwYXJhdG9yID09IC0xKSB7CisgICAgICAgICAgICAgICAgc2VwYXJhdG9yID0gZW5kOworICAgICAgICAgICAgfQogCi0gICAgICAgIHdoaWxlIChlbmNvZGVkS2V5U2VhcmNoSW5kZXggPD0gZW5jb2RlZEtleVNlYXJjaEVuZCkgewotICAgICAgICAgICAgaW50IGtleUluZGV4ID0gcXVlcnkuaW5kZXhPZihlbmNvZGVkS2V5LCBlbmNvZGVkS2V5U2VhcmNoSW5kZXgpOwotICAgICAgICAgICAgaWYgKGtleUluZGV4ID09IC0xKSB7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBmaW5hbCBpbnQgZXF1YWxzSW5kZXggPSBrZXlJbmRleCArIGVuY29kZWRLZXlMZW5ndGg7Ci0gICAgICAgICAgICBpZiAoZXF1YWxzSW5kZXggPj0gcXVlcnkubGVuZ3RoKCkpIHsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmIChxdWVyeS5jaGFyQXQoZXF1YWxzSW5kZXgpICE9ICc9JykgewotICAgICAgICAgICAgICAgIGVuY29kZWRLZXlTZWFyY2hJbmRleCA9IGVxdWFsc0luZGV4ICsgMTsKLSAgICAgICAgICAgICAgICBjb250aW51ZTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmIChrZXlJbmRleCA9PSAwIHx8IHF1ZXJ5LmNoYXJBdChrZXlJbmRleCAtIDEpID09ICcmJykgewotICAgICAgICAgICAgICAgIGludCBlbmQgPSBxdWVyeS5pbmRleE9mKCcmJywgZXF1YWxzSW5kZXgpOwotICAgICAgICAgICAgICAgIGlmIChlbmQgPT0gLTEpIHsKLSAgICAgICAgICAgICAgICAgICAgZW5kID0gcXVlcnkubGVuZ3RoKCk7CisgICAgICAgICAgICBpZiAoc2VwYXJhdG9yIC0gc3RhcnQgPT0gZW5jb2RlZEtleS5sZW5ndGgoKQorICAgICAgICAgICAgICAgICAgICAmJiBxdWVyeS5yZWdpb25NYXRjaGVzKHN0YXJ0LCBlbmNvZGVkS2V5LCAwLCBlbmNvZGVkS2V5Lmxlbmd0aCgpKSkgeworICAgICAgICAgICAgICAgIGlmIChzZXBhcmF0b3IgPT0gZW5kKSB7CisgICAgICAgICAgICAgICAgICByZXR1cm4gIiI7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgIHJldHVybiBkZWNvZGUocXVlcnkuc3Vic3RyaW5nKHNlcGFyYXRvciArIDEsIGVuZCkpOwogICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICByZXR1cm4gZGVjb2RlKHF1ZXJ5LnN1YnN0cmluZyhlcXVhbHNJbmRleCArIDEsIGVuZCkpOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBlbmNvZGVkS2V5U2VhcmNoSW5kZXggPSBlcXVhbHNJbmRleCArIDE7CiAgICAgICAgICAgICB9Ci0gICAgICAgIH0KKworICAgICAgICAgICAgLy8gTW92ZSBzdGFydCB0byBlbmQgb2YgbmFtZS4KKyAgICAgICAgICAgIGlmIChuZXh0QW1wZXJzYW5k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mluZyA9IHN0cmVhbS50b1N0cmluZygpOwogCi0gICAgICAgICAgICAgICAgICAgIC8vIFRPRE86IENoZWNrIHRoZSBjb250ZW50IHR5cGUsIHRvby4KLSAgICAgICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQoIiAtLWRhdGEtYXNjaWkgXCIiKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5hcHBlbmQoZW50aXR5U3RyaW5nKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5hcHBlbmQoIlwiIik7CisgICAgICAgICAgICAgICAgICAgIGlmIChpc0JpbmFyeUNvbnRlbnQocmVxdWVzdCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIFN0cmluZyBiYXNlNjQgPSBCYXNlNjQuZW5jb2RlVG9TdHJpbmcoc3RyZWFtLnRvQnl0ZUFycmF5KCksIEJhc2U2NC5OT19XUkFQKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIuaW5zZXJ0KDAsICJlY2hvICciICsgYmFzZTY0ICsgIicgfCBiYXNlNjQgLWQgPiAvdG1wLyQkLmJpbjsgIik7CisgICAgICAgICAgICAgICAgICAgICAgICBidWlsZGVyLmFwcGVuZCgiIC0tZGF0YS1iaW5hcnkgQC90bXAvJCQuYmluIik7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICBTdHJpbmcgZW50aXR5U3RyaW5nID0gc3RyZWFtLnRvU3RyaW5nKCk7CisgICAgICAgICAgICAgICAgICAgICAgICBidWlsZGVyLmFwcGVuZCgiIC0tZGF0YS1hc2NpaSBcIiIpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5hcHBlbmQoZW50aXR5U3RyaW5nKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAuYXBwZW5kKCJcIiIpOworICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQoIiBbVE9PIE1VQ0ggREFUQSBUTyBJTkNMVURFXSIpOwogICAgICAgICAgICAgICAgIH0KQEAgLTQ0Niw2ICs0NTcsMzAgQEAKICAgICAgICAgcmV0dXJuIGJ1aWxkZXIudG9TdHJpbmcoKTsKICAgICB9CiAKKyAgICBwcml2YXRlIHN0YXRpYyBib29sZWFuIGlzQmluYXJ5Q29udGVudChIdHRwVXJpUmVxdWVzdCByZXF1ZXN0KSB7CisgICAgICAgIEhlYWRlcltdIGhlYWRlcnM7CisgICAgICAgIGhlYWRlcnMgPSByZXF1ZXN0LmdldEhlYWRlcnMoSGVhZGVycy5DT05URU5UX0VOQ09ESU5HKTsKKyAgICAgICAgaWYgKGhlYWRlcnMgIT0gbnVsbCkgeworICAgICAgICAgICAgZm9yIChIZWFkZXIgaGVhZGVyIDogaGVhZGVycykgeworICAgICAgICAgICAgICAgIGlmICgiZ3ppcCIuZXF1YWxzSWdub3JlQ2FzZShoZWFkZXIuZ2V0VmFsdWUoKSkpIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgaGVhZGVycyA9IHJlcXVlc3QuZ2V0SGVhZGVycyhIZWFkZXJzLkNPTlRFTlRfVFlQRSk7CisgICAgICAgIGlmIChoZWFkZXJzICE9IG51bGwpIHsKKyAgICAgICAgICAgIGZvciAoSGVhZGVyIGhlYWRlciA6IGhlYWRlcnMpIHsKKyAgICAgICAgICAgICAgICBmb3IgKFN0cmluZyBjb250ZW50VHlwZSA6IHRleHRDb250ZW50VHlwZXMpIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGhlYWRlci5nZXRWYWx1ZSgpLnN0YXJ0c1dpdGgoY29udGVudFR5cGUpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgIC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ciBtdXN0IGJlIGludm9rZWQgb24gdGhlIFVJIHRocmVhZC4KICAgICAgKi8KQEAgLTE4Nyw2ICsxOTIsMTcgQEAKICAgICAgICAgfTsKIAogICAgICAgICBtRnV0dXJlID0gbmV3IEZ1dHVyZVRhc2s8UmVzdWx0PihtV29ya2VyKSB7CisKKyAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgcHJvdGVjdGVkIHZvaWQgc2V0KFJlc3VsdCB2KSB7CisgICAgICAgICAgICAgICAgc3VwZXIuc2V0KHYpOworICAgICAgICAgICAgICAgIGlmIChpc0NhbmNlbGxlZCgpKSB7CisgICAgICAgICAgICAgICAgICAgIE1lc3NhZ2UgbWVzc2FnZSA9IHNIYW5kbGVyLm9idGFpbk1lc3NhZ2UoTUVTU0FHRV9QT1NUX0NBTkNFTCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXcgQXN5bmNUYXNrUmVzdWx0PFJlc3VsdD4oQXN5bmNUYXNrLnRoaXMsIChSZXN1bHRbXSkgbnVsbCkpOworICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLnNlbmRUb1RhcmdldCgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKwogICAgICAgICAgICAgQE92ZXJyaWRlCiAgICAgICAgICAgICBwcm90ZWN0ZWQgdm9pZCBkb25lKCkgewogICAgICAgICAgICAgICAgIE1lc3NhZ2UgbWVzc2FnZTsKQEAgLTQwMiwxNCArNDE4LDE5IEBACiAgICAgICogc3RpbGwgcnVubmluZy4gRWFjaCBjYWxsIHRvIHRoaXMgbWV0aG9kIHdpbGwgdHJpZ2dlciB0aGUgZXhlY3V0aW9uIG9mCiAgICAgICoge0BsaW5rICNvblByb2dyZXNzVXBkYXRlfSBvbiB0aGUgVUkgdGhyZWFkLgogICAgICAqCisgICAgICoge0BsaW5rICNvblByb2dyZXNzVXBkYXRlfSB3aWxsIG5vdGUgYmUgY2FsbGVkIGlmIHRoZSB0YXNrIGhhcyBiZ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m9pZC9waW0vUmVjdXJyZW5jZVNldC5qYXZhCisrKyBiL2NvcmUvamF2YS9hbmRyb2lkL3BpbS9SZWN1cnJlbmNlU2V0LmphdmEKQEAgLTE4MSw3ICsxODEsOSBAQAogICAgICAgICBib29sZWFuIGluVXRjID0gc3RhcnQucGFyc2UoZHRzdGFydCk7CiAgICAgICAgIGJvb2xlYW4gYWxsRGF5ID0gc3RhcnQuYWxsRGF5OwogCi0gICAgICAgIGlmIChpblV0YykgeworICAgICAgICAvLyBXZSBmb3JjZSBUaW1lWm9uZSB0byBVVEMgZm9yICJhbGwgZGF5IHJlY3VycmluZyBldmVudHMiIGFzIHRoZSBzZXJ2ZXIgaXMgc2VuZGluZyBubworICAgICAgICAvLyBUaW1lWm9uZSBpbiBEVFNUQVJUIGZvciB0aGVtCisgICAgICAgIGlmIChpblV0YyB8fCBhbGxEYXkpIHsKICAgICAgICAgICAgIHR6aWQgPSBUaW1lLlRJTUVaT05FX1VUQzsKICAgICAgICAgfQogICAgICAgICAgICAgICAgIApAQCAtMjA0LDEwICsyMDYsNyBAQAogICAgICAgICB9CiAgICAgICAgIAogICAgICAgICBpZiAoYWxsRGF5KSB7Ci0gICAgICAgIAkvLyBUT0RPOiBhbHNvIGNoYW5nZSB0emlkIHRvIGJlIFVUQz8gIHRoYXQgd291bGQgYmUgY29uc2lzdGVudCwgYnV0Ci0gICAgICAgIAkvLyB0aGF0IHdvdWxkIG5vdCByZWZsZWN0IHRoZSBvcmlnaW5hbCB0aW1lem9uZSB2YWx1ZSBiYWNrIHRvIHRoZQotICAgICAgICAJLy8gc2VydmVyLgotICAgICAgICAJc3RhcnQudGltZXpvbmUgPSBUaW1lLlRJTUVaT05FX1VUQzsKKyAgICAgICAgICAgIHN0YXJ0LnRpbWV6b25lID0gVGltZS5USU1FWk9ORV9VVEM7CiAgICAgICAgIH0KICAgICAgICAgbG9uZyBtaWxsaXMgPSBzdGFydC50b01pbGxpcyhmYWxzZSAvKiB1c2UgaXNEc3QgKi8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WcuaXNWZXJzaW9uMzAodmNhcmRUeXBlKSAmJiAiVVRGLTgiLmVxdWFsc0lnbm9yZUNhc2UoY2hhcnNldCkpOwotCi0gICAgICAgIGlmIChWQ2FyZENvbmZpZy5pc0RvQ29Nbyh2Y2FyZFR5cGUpKSB7Ci0gICAgICAgICAgICBpZiAoIVNISUZUX0pJUy5lcXVhbHNJZ25vcmVDYXNlKGNoYXJzZXQpKSB7Ci0gICAgICAgICAgICAgICAgTG9nLncoTE9HX1RBRywKLSAgICAgICAgICAgICAgICAgICAgICAgICJUaGUgY2hhcnNldCBcIiIgKyBjaGFyc2V0ICsgIlwiIGlzIHVzZWQgd2hpbGUgIgotICAgICAgICAgICAgICAgICAgICAgICAgKyBTSElGVF9KSVMgKyAiIGlzIG5lZWRlZCB0byBiZSB1c2VkLiIpOwotICAgICAgICAgICAgICAgIGlmIChUZXh0VXRpbHMuaXNFbXB0eShjaGFyc2V0KSkgewotICAgICAgICAgICAgICAgICAgICBtQ2hhcnNldCA9IFNISUZUX0pJUzsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICB0cnkgewotICAgICAgICAgICAgICAgICAgICAgICAgY2hhcnNldCA9IENoYXJzZXRVdGlscy5jaGFyc2V0Rm9yVmVuZG9yKGNoYXJzZXQpLm5hbWUoKTsKLSAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoVW5zdXBwb3J0ZWRDaGFyc2V0RXhjZXB0aW9uIGUpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIExvZy5pKExPR19UQUcsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJDYXJlZXItc3BlY2lmaWMgXCIiICsgY2hhcnNldCArICJcIiB3YXMgbm90IGZvdW5kIChhcyB1c3VhbCkuICIKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiVXNlIGl0IGFzIGlzLiIpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIG1DaGFyc2V0ID0gY2hhcnNldDsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIGlmIChtSXNEb0NvTW8pIHsKLSAgICAgICAgICAgICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGNoYXJzZXQgPSBDaGFyc2V0VXRpbHMuY2hhcnNldEZvclZlbmRvcihTSElGVF9KSVMsICJkb2NvbW8iKS5uYW1lKCk7Ci0gICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKFVuc3VwcG9ydGVkQ2hhcnNldEV4Y2VwdGlvbiBlKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBMb2cuZShMT0dfVEFHLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiRG9Db01vLXNwZWNpZmljIFNISUZUX0pJUyB3YXMgbm90IGZvdW5kLiAiCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgIlVzZSBTSElGVF9KSVMgYXMgaXMuIik7Ci0gICAgICAgICAgICAgICAgICAgICAgICBjaGFyc2V0ID0gU0hJRlRfSklTOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGNoYXJzZXQgPSBDaGFyc2V0VXRpbHMuY2hhcnNldEZvclZlbmRvcihTSElGVF9KSVMpLm5hbWUoKTsKLSAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoVW5zdXBwb3J0ZWRDaGFyc2V0RXhjZXB0aW9uIGUpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIExvZy5lKExPR19UQUcsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJDYXJlZXItc3BlY2lmaWMgU0hJRlRfSklTIHdhcyBub3QgZm91bmQuICIKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiVXNlIFNISUZUX0pJUyBhcyBpcy4iKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGNoYXJzZXQgPSBTSElGVF9KSVM7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgbUNoYXJzZXQgPSBjaGFyc2V0OwotICAgICAgICAgICAgfQotICAgICAgICAgICAgbVZDYXJkQ2hhcnNldFBhcmFtZXRlciA9ICJDSEFSU0VUPSIgKyBTSElGVF9KSVM7Ci0gICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICBpZiAoVGV4dFV0aWxzLmlzRW1wdHkoY2hhcnNldCkpIHsKLSAgICAgICAgICAgICAgICBMb2cuaShMT0dfVEFHLAotICAgICAgICAgICAgICAgICAgICAgICAgIlVzZSB0aGUgY2hhcnNldCBcIiIgKyBWQ2FyZENvbmZpZy5ERUZBVUxUX0VYUE9SVF9DSEFSU0VUCi0gICAgICAgICAgICAgICAgICAgICAgICArICJcIiBmb3IgZXhwb3J0LiIpOwotICAgICAgICAgICAgICAgIG1DaGFyc2V0ID0gVkNhcmRDb25maWcuREVGQVVMVF9FWFBPUlRfQ0hBUlNFVDsKLSAgICAgICAgICAgICAgICBtVkNhcmRDaGFyc2V0UGFyYW1ldGVyID0gIkNIQVJTRVQ9IiArIFZDYXJkQ29uZmlnLkRFRkFVTFRfRVhQT1JUX0NIQVJTRVQ7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICAgICAgICAgIGNoYXJzZXQgPSBDaGFyc2V0VXRpbHMuY2hhcnNldEZvclZlbmRvcihjaGFyc2V0KS5uYW1lKCk7Ci0gICAgICAgICAgICAgICAgfSBjYXRjaCAoVW5zdXBwb3J0ZWRDaGFyc2V0RXhjZXB0aW9uIGUpIHsKLSAgICAgICAgICAgICAgICAgICAgTG9nLmkoTE9HX1RBRywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAiQ2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IENvbnRlbnRWYWx1ZXMgcHJpbWFyeUNvbnRlbnRWYWx1ZXMgPSBudWxsOwotICAgICAgICBDb250ZW50VmFsdWVzIHN1YnByaW1hcnlDb250ZW50VmFsdWVzID0gbnVsbDsKLSAgICAgICAgZm9yIChDb250ZW50VmFsdWVzIGNvbnRlbnRWYWx1ZXMgOiBjb250ZW50VmFsdWVzTGlzdCkgewotICAgICAgICAgICAgaWYgKGNvbnRlbnRWYWx1ZXMgPT0gbnVsbCl7Ci0gICAgICAgICAgICAgICAgY29udGludWU7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBJbnRlZ2VyIGlzU3VwZXJQcmltYXJ5ID0gY29udGVudFZhbHVlcy5nZXRBc0ludGVnZXIoU3RydWN0dXJlZE5hbWUuSVNfU1VQRVJfUFJJTUFSWSk7Ci0gICAgICAgICAgICBpZiAoaXNTdXBlclByaW1hcnkgIT0gbnVsbCAmJiBpc1N1cGVyUHJpbWFyeSA+IDApIHsKLSAgICAgICAgICAgICAgICAvLyBXZSBjaG9vc2UgInN1cGVyIHByaW1hcnkiIENvbnRlbnRWYWx1ZXMuCi0gICAgICAgICAgICAgICAgcHJpbWFyeUNvbnRlbnRWYWx1ZXMgPSBjb250ZW50VmFsdWVzOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfSBlbHNlIGlmIChwcmltYXJ5Q29udGVudFZhbHVlcyA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgLy8gV2UgY2hvb3NlIHRoZSBmaXJzdCAicHJpbWFyeSIgQ29udGVudFZhbHVlcwotICAgICAgICAgICAgICAgIC8vIGlmICJzdXBlciBwcmltYXJ5IiBDb250ZW50VmFsdWVzIGRvZXMgbm90IGV4aXN0LgotICAgICAgICAgICAgICAgIGZpbmFsIEludGVnZXIgaXNQcmltYXJ5ID0gY29udGVudFZhbHVlcy5nZXRBc0ludGVnZXIoU3RydWN0dXJlZE5hbWUuSVNfUFJJTUFSWSk7Ci0gICAgICAgICAgICAgICAgaWYgKGlzUHJpbWFyeSAhPSBudWxsICYmIGlzUHJpbWFyeSA+IDAgJiYKLSAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRhaW5zTm9uRW1wdHlOYW1lKGNvbnRlbnRWYWx1ZXMpKSB7Ci0gICAgICAgICAgICAgICAgICAgIHByaW1hcnlDb250ZW50VmFsdWVzID0gY29udGVudFZhbHVlczsKLSAgICAgICAgICAgICAgICAgICAgLy8gRG8gbm90IGJyZWFrLCBzaW5jZSB0aGVyZSBtYXkgYmUgQ29udGVudFZhbHVlcyB3aXRoICJzdXBlciBwcmltYXJ5IgotICAgICAgICAgICAgICAgICAgICAvLyBhZnRlcndvcmQuCi0gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChzdWJwcmltYXJ5Q29udGVudFZhbHVlcyA9PSBudWxsICYmCi0gICAgICAgICAgICAgICAgICAgICAgICBjb250YWluc05vbkVtcHR5TmFtZShjb250ZW50VmFsdWVzKSkgewotICAgICAgICAgICAgICAgICAgICBzdWJwcmltYXJ5Q29udGVudFZhbHVlcyA9IGNvbnRlbnRWYWx1ZXM7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgaWYgKHByaW1hcnlDb250ZW50VmFsdWVzID09IG51bGwpIHsKLSAgICAgICAgICAgIGlmIChzdWJwcmltYXJ5Q29udGVudFZhbHVlcyAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgLy8gV2UgY2hvb3NlIHRoZSBmaXJzdCBDb250ZW50VmFsdWVzIGlmIGFueSAicHJpbWFyeSIgQ29udGVudFZhbHVlcyBkb2VzIG5vdCBleGlzdC4KLSAgICAgICAgICAgICAgICBwcmltYXJ5Q29udGVudFZhbHVlcyA9IHN1YnByaW1hcnlDb250ZW50VmFsdWVzOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBMb2cuZShMT0dfVEFHLCAiQWxsIENvbnRlbnRWYWx1ZXM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2FyZFV0aWxzLmNvbnRhaW5zT25seU5vbkNyTGZQcmludGFibGVBc2NpaShnaXZlbk5hbWUpICYmCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBWQ2FyZFV0aWxzLmNvbnRhaW5zT25seU5vbkNyTGZQcmludGFibGVBc2NpaShtaWRkbGVOYW1lKSAmJgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVkNhcmRVdGlscy5jb250YWluc09ubHlOb25DckxmUHJpbnRhYmxlQXNjaWkocHJlZml4KSAmJgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVkNhcmRVdGlscy5jb250YWluc09ubHlOb25DckxmUHJpbnRhYmxlQXNjaWkoc3VmZml4KSkpOwotCi0gICAgICAgICAgICBmaW5hbCBTdHJpbmcgZm9ybWF0dGVkTmFtZTsKLSAgICAgICAgICAgIGlmICghVGV4dFV0aWxzLmlzRW1wdHkoZGlzcGxheU5hbWUpKSB7Ci0gICAgICAgICAgICAgICAgZm9ybWF0dGVkTmFtZSA9IGRpc3BsYXlOYW1lOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBmb3JtYXR0ZWROYW1lID0gVkNhcmRVdGlscy5jb25zdHJ1Y3ROYW1lRnJvbUVsZW1lbnRzKAotICAgICAgICAgICAgICAgICAgICAgICAgVkNhcmRDb25maWcuZ2V0TmFtZU9yZGVyVHlwZShtVkNhcmRUeXBlKSwKLSAgICAgICAgICAgICAgICAgICAgICAgIGZhbWlseU5hbWUsIG1pZGRsZU5hbWUsIGdpdmVuTmFtZSwgcHJlZml4LCBzdWZmaXgpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZmluYWwgYm9vbGVhbiByZWFsbHlBcHBlbmRDaGFyc2V0UGFyYW1ldGVyVG9GTiA9Ci0gICAgICAgICAgICAgICAgICAgIHNob3VsZEFwcGVuZENoYXJzZXRQYXJhbShmb3JtYXR0ZWROYW1lKTsKLSAgICAgICAgICAg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ZXJzKGZhbWlseU5hbWUpOwotICAgICAgICAgICAgICAgIGVuY29kZWRHaXZlbiA9IGVzY2FwZUNoYXJhY3RlcnMoZ2l2ZW5OYW1lKTsKLSAgICAgICAgICAgICAgICBlbmNvZGVkTWlkZGxlID0gZXNjYXBlQ2hhcmFjdGVycyhtaWRkbGVOYW1lKTsKLSAgICAgICAgICAgICAgICBlbmNvZGVkUHJlZml4ID0gZXNjYXBlQ2hhcmFjdGVycyhwcmVmaXgpOwotICAgICAgICAgICAgICAgIGVuY29kZWRTdWZmaXggPSBlc2NhcGVDaGFyYWN0ZXJzKHN1ZmZpeCk7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGZpbmFsIFN0cmluZyBlbmNvZGVkRm9ybWF0dGVkbmFtZSA9Ci0gICAgICAgICAgICAgICAgICAgIChyZWFsbHlVc2VRdW90ZWRQcmludGFibGVUb0ZOID8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbmNvZGVRdW90ZWRQcmludGFibGUoZm9ybWF0dGVkTmFtZSkgOiBlc2NhcGVDaGFyYWN0ZXJzKGZvcm1hdHRlZE5hbWUpKTsKLQotICAgICAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKFZDYXJkQ29uc3RhbnRzLlBST1BFUlRZX04pOwotICAgICAgICAgICAgaWYgKG1Jc0RvQ29NbykgewotICAgICAgICAgICAgICAgIGlmIChyZWFsbHlBcHBlbmRDaGFyc2V0UGFyYW1ldGVyVG9OYW1lKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChWQ0FSRF9QQVJBTV9TRVBBUkFUT1IpOwotICAgICAgICAgICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQobVZDYXJkQ2hhcnNldFBhcmFtZXRlcik7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGlmIChyZWFsbHlVc2VRdW90ZWRQcmludGFibGVUb05hbWUpIHsKLSAgICAgICAgICAgICAgICAgICAgbU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UgPwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVuY29kZVF1b3RlZFByaW50YWJsZShkaXNwbGF5TmFtZSkgOgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlc2NhcGVDaGFyYWN0ZXJzKGRpc3BsYXlOYW1lKTsKLQotICAgICAgICAgICAgLy8gTgotICAgICAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKFZDYXJkQ29uc3RhbnRzLlBST1BFUlRZX04pOwotICAgICAgICAgICAgaWYgKHNob3VsZEFwcGVuZENoYXJzZXRQYXJhbShkaXNwbGF5TmFtZSkpIHsKLSAgICAgICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQoVkNBUkRfUEFSQU1fU0VQQVJBVE9SKTsKLSAgICAgICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQobVZDYXJkQ2hhcnNldFBhcmFtZXRlcik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAocmVhbGx5VXNlUXVvdGVkUHJpbnRhYmxlVG9EaXNwbGF5TmFtZSkgewotICAgICAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChWQ0FSRF9QQVJBTV9TRVBBUkFUT1IpOwotICAgICAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChWQ0FSRF9QQVJBTV9FTkNPRElOR19RUCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQoVkNBUkRfREFUQV9TRVBBUkFUT1IpOwotICAgICAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKGVuY29kZWREaXNwbGF5TmFtZSk7Ci0gICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQoVkNBUkRfSVRFTV9TRVBBUkFUT1IpOwotICAgICAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKFZDQVJEX0lURU1fU0VQQVJBVE9SKTsKLSAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChWQ0FSRF9JVEVNX1NFUEFSQVRPUik7Ci0g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RWYWx1ZXMuZ2V0QXNTdHJpbmcoU3RydWN0dXJlZE5hbWUuUEhPTkVUSUNfTUlERExFX05BTUUpOwotICAgICAgICAgICAgZmluYWwgU3RyaW5nIHRtcFBob25ldGljR2l2ZW5OYW1lID0KLSAgICAgICAgICAgICAgICBjb250ZW50VmFsdWVzLmdldEFzU3RyaW5nKFN0cnVjdHVyZWROYW1lLlBIT05FVElDX0dJVkVOX05BTUUpOwotICAgICAgICAgICAgaWYgKG1OZWVkc1RvQ29udmVydFBob25ldGljU3RyaW5nKSB7Ci0gICAgICAgICAgICAgICAgcGhvbmV0aWNGYW1pbHlOYW1lID0gVkNhcmRVdGlscy50b0hhbGZXaWR0aFN0cmluZyh0bXBQaG9uZXRpY0ZhbWlseU5hbWUpOwotICAgICAgICAgICAgICAgIHBob25ldGljTWlkZGxlTmFtZSA9IFZDYXJkVXRpbHMudG9IYWxmV2lkdGhTdHJpbmcodG1wUGhvbmV0aWNNaWRkbGVOYW1lKTsKLSAgICAgICAgICAgICAgICBwaG9uZXRpY0dpdmVuTmFtZSA9IFZDYXJkVXRpbHMudG9IYWxmV2lkdGhTdHJpbmcodG1wUGhvbmV0aWNHaXZlbk5hbWUpOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBwaG9uZXRpY0ZhbWlseU5hbWUgPSB0bXBQaG9uZXRpY0ZhbWlseU5hbWU7Ci0gICAgICAgICAgICAgICAgcGhvbmV0aWNNaWRkbGVOYW1lID0gdG1wUGhvbmV0aWNNaWRkbGVOYW1lOwotICAgICAgICAgICAgICAgIHBob25ldGljR2l2ZW5OYW1lID0gdG1wUGhvbmV0aWNHaXZlbk5hbWU7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICBpZiAoVGV4dFV0aWxzLmlzRW1wdHkocGhvbmV0aWNGYW1pbHlOYW1lKQotICAgICAgICAgICAgICAgICYmIFRleHRVdGlscy5pc0VtcHR5KHBob25ldGljTWlkZGxlTmFtZS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gIGNvbHVtbi4KLSAgICAgICAgICAgIC8vICAgICAgIGkuZS4KLSAgICAgICAgICAgIC8vICAgICAgIGdvb2Q6ICBTT1VORDtYLUlSTUMtTjpNaXlha2F3YSBEYWlzdWtlOzs7OwotICAgICAgICAgICAgLy8gICAgICAgYmFkIDogIFNPVU5EO1gtSVJNQy1OOk1peWFrYXdhO0RhaXN1a2U7OzsKLSAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChWQ2FyZENvbnN0YW50cy5QUk9QRVJUWV9TT1VORCk7Ci0gICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQoVkNBUkRfUEFSQU1fU0VQQVJBVE9SKTsKLSAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChWQ2FyZENvbnN0YW50cy5QQVJBTV9UWVBFX1hfSVJNQ19OKTsKLQotICAgICAgICAgICAgYm9vbGVhbiByZWFsbHlVc2VRdW90ZWRQcmludGFibGUgPQotICAgICAgICAgICAgICAgICghbVJlZnJhaW5zUVBUb05hbWVQcm9wZXJ0aWVzCi0gICAgICAgICAgICAgICAgICAgICAgICAmJiAhKFZDYXJkVXRpbHMuY29udGFpbnNPbmx5Tm9uQ3JMZlByaW50YWJsZUFzY2lpKAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaG9uZXRpY0ZhbWlseU5hbWUpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICYmIFZDYXJkVXRpbHMuY29udGFpbnNPbmx5Tm9uQ3JMZlByaW50YWJsZUFzY2lpKAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBob25ldGljTWlkZGxlTmFtZSkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJiYgVkNhcmRVdGlscy5jb250YWluc09ubHlOb25DckxmUHJpbnRhYmxlQXNjaWkoCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGhvbmV0aWNHaXZlbk5hbWUpKSk7Ci0KLSAgICAgIC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QaG9uZXRpY01pZGRsZU5hbWUsIGVuY29kZWRQaG9uZXRpY0dpdmVuTmFtZSkpIHsKLSAgICAgICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQoVkNBUkRfUEFSQU1fU0VQQVJBVE9SKTsKLSAgICAgICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQobVZDYXJkQ2hhcnNldFBhcmFtZXRlcik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQoVkNBUkRfREFUQV9TRVBBUkFUT1IpOwotICAgICAgICAgICAgewotICAgICAgICAgICAgICAgIGJvb2xlYW4gZmlyc3QgPSB0cnVlOwotICAgICAgICAgICAgICAgIGlmICghVGV4dFV0aWxzLmlzRW1wdHkoZW5jb2RlZFBob25ldGljRmFtaWx5TmFtZSkpIHsKLSAgICAgICAgICAgICAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKGVuY29kZWRQaG9uZXRpY0ZhbWlseU5hbWUpOwotICAgICAgICAgICAgICAgICAgICBmaXJzdCA9IGZhbHNlOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBpZiAoIVRleHRVdGlscy5pc0VtcHR5KGVuY29kZWRQaG9uZXRpY01pZGRsZU5hbWUpKSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChmaXJzdCkgewotICAgICAgICAgICAgICAgICAgICAgICAgZmlyc3QgPSBmYWxzZTsKLSAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZCgnICcpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChlbmNvZGVkUGhvbmV0aWNNaWRkbGVOYW1lKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgaWYgKCFUZXh0VXRpbHMuaXNFbXB0eShlbmNvZGVkUGhvbmV0aWNHaXZlbk5hbWUpKSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmICghZmlyc3QpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZCgnICcpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChlbmNvZGVkUGhvbmV0aWNHaXZlbk5hbWUpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChWQ0FSRF9JVEVNX1NFUEFSQVRPUik7ICAvLyBmYW1pbHk7Z2l2ZW4KLSAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChWQ0FSRF9JVEVNX1NFUEFSQVRPUik7ICAvLyBnaXZlbjttaWRkbGUKLSAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChWQ0FSRF9JVEVNX1NFUEFSQVRPUik7ICAvLyBtaWRkbGU7cHJlZml4Ci0gICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQoVkNBUkRfSVRFTV9TRVBBUkFUT1IpOyAgLy8gcHJlZml4O3N1ZmZpeAotICAgICAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKFZDQVJEX0VORF9PRl9MSU5FKTsKLSAgICAgICAgfQotCi0gICAgICAgIExvZy5kKCJAQEAiLCAiaG9nZSIpOwotICAgICAgICBpZiAobVVzZXNEZWZhY3RQcm9wZXJ0eSkgewotICAgICAgICAgICAgaWYgKCFUZXh0VXRpbHMuaXNFbXB0eShwaG9uZXRpY0dpdmVuTmFtZSkpIHsKLSAgICAgICAgICAgICAgICBmaW5hbCBib29sZWFuIHJlYWxseVVzZVF1b3RlZFByaW50YWJsZSA9Ci0gICAgICAgICAgICAgICAgICAgIChtU2hvdWxkVXNlUXVvdGVkUHJpbnRhYmxlICYmCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIVZDYXJkVXRpbHMuY29udGFpbnNPbmx5Tm9uQ3JMZlByaW50YWJsZUFzY2lpKHBob25ldGljR2l2ZW5OYW1lKSk7Ci0gICAgICAgICAgICAgICAgZmluYWwgU3RyaW5nIGVuY29kZWRQaG9uZXRpY0dpdmVuTmFtZTsKLSAgICAgICAgICAgICAgICBpZiAocmVhbGx5VXNlUXVvdGVkUHJpbnRhYmxlKSB7Ci0gICAgICAgICAgICAgICAgICAgIGVuY29kZWRQaG9uZXRpY0dpdmVuTmFtZSA9IGVuY29kZVF1b3RlZFByaW50YWJsZShwaG9uZXRpY0dpdmVuTmFtZSk7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgZW5jb2RlZFBob25ldGljR2l2ZW5OYW1lID0gZXNjYXBlQ2hhcmFjdGVycyhwaG9uZXRpY0dpdmVuTmFtZSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChWQ2FyZENvbnN0YW50cy5QUk9QRVJUWV9YX1BIT05FVElDX0ZJUlNUX05BTUUpOwotICAgICAgICAgICAgICAgIGlmIChzaG91bGRBcHBlbmRDaGFyc2V0UGFyYW0ocGhvbmV0aWNHaXZlbk5hbWUpKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChWQ0FSRF9QQVJBTV9TRVBBUkFUT1IpOwotICAgICAgICAgICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQobVZDYXJkQ2hhcnNldFBhcmFtZXRlcik7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGlmIChyZWFsbHlVc2VRdW90ZWRQcmludGFibGUpIHsKLSAgICAgICAgICAgICAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKFZDQVJEX1BBUkFNX1NFUEFSQVRPUik7Ci0gICAgICAgICAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChWQ0FSRF9QQVJBTV9FTkNPRElOR19RUCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChWQ0FSRF9EQVRBX1NFUEFSQVRPUik7Ci0gICAgICAgICAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKGVuY29kZWRQaG9uZXRpY0dpdmVuTmFtZSk7Ci0gICAgICAgICAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKFZDQVJEX0VORF9PRl9MSU5FKTsKLSAgICAgICAgICAgIH0gIC8vIGlmICghVGV4dFV0aWxzLmlzRW1wdHkocGhvbmV0aWNHaXZlbk5hbWUpKQotICAgICAgICAgICAgaWYgKCFUZXh0VXRpbHMuaXNFbXB0eShwaG9uZXRpY01pZGRsZU5hbWUpKSB7Ci0gICAgICAgICAgICAgICAgZmluYWwgYm9vbGVhbiByZWFsbHlVc2VRdW90ZWRQcmludGFibGUgPQotICAgICAgICAgICAgICAgICAgICAobVNob3VsZFVzZVF1b3RlZFByaW50YWJsZSAmJgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICFWQ2FyZFV0aWxzLmNvbnRhaW5zT25seU5vbkNyTGZQcmludGFibGVBc2NpaShwaG9uZXRpY01pZGRsZU5hbWUpKTsKLSAgICAgICAgICAgICAgICBmaW5hbCBTdHJpbmcgZW5jb2RlZFBob25ldGljTWlkZGxlTmFtZTsKLSAgICAgICAgICAgICAgICBpZiAocmVhbGx5VXNlUXVvdGVkUHJpbnRhYmxlKSB7Ci0gICAgICAgICAgICAgICAgICAgIGVuY29kZWRQaG9uZXRpY01pZGRsZU5hbWUgPSBlbmNvZGVRdW90ZWRQcmludGFibGUocGhvbmV0aWNNaWRkbGVOYW1lKTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBlbmNvZGVkUGhvbmV0aWNNaWRkbGVOYW1lID0gZXNjYXBlQ2hhcmFjdGVycyhwaG9uZXRpY01pZGRsZU5hbWUpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQoVkNhcmRDb25zdGFudHMuUFJPUEVSVFlfWF9QSE9ORVRJQ19NSURETEVfTkFNRSk7Ci0gICAgICAgICAgICAgICAgaWYgKHNob3VsZEFwcGVuZENoYXJzZXRQYXJhbShwaG9uZXRpY01pZGRsZU5hbWUpKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChWQ0FSRF9QQVJBTV9TRVBBUkFUT1IpOwotICAgICAgICAgICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQobVZDYXJkQ2hhcnNldFBhcmFtZXRlcik7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGlmIChyZWFsbHlVc2VRdW90ZWRQcmludGFibGUpIHsKLSAgICAgICAgICAgICAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKFZDQVJEX1BBUkFNX1NFUEFSQVRPUik7Ci0gICAgICAgICAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChWQ0FSRF9QQVJBTV9FTkNPRElOR19RUCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChWQ0FSRF9EQVRBX1NFUEFSQVRPUik7Ci0gICAgICAgICAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKGVuY29kZWRQaG9uZXRpY01pZGRsZU5hbWUpOwotICAgICAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChWQ0FSRF9FTkRfT0ZfTElORSk7Ci0gICAgICAgICAgICB9ICAvLyBpZiAoIVRleHRVdGlscy5pc0VtcHR5KHBob25ldGljR2l2ZW5OYW1lKSkKLSAgICAgICAgICAgIGlmICghVGV4dFV0aWxzLmlzRW1wdHkocGhvbmV0aWNGYW1pbHlOYW1lKSkgewotICAgICAgICAgICAgICAgIGZpbmFsIGJvb2xlYW4gcmVhbGx5VXNlUXVvdGVkUHJpbnRhYmxlID0KLSAgICAgICAgICAgICAgICAgICAgKG1TaG91bGRVc2VRdW90ZWRQcmludGFibGUgJiYKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAhVkNhcmRVdGlscy5jb250YWluc09ubHlOb25DckxmUHJpbnRhYmxlQXNjaWkocGhvbmV0aWNGYW1pbHlOYW1lKSk7Ci0gICAgICAgICAgICAgICAgZmluYWwgU3RyaW5nIGVuY29kZWRQaG9uZXRpY0ZhbWlseU5hbWU7Ci0gICAgICAgICAgICAgICAgaWYgKHJlYWxseVVzZVF1b3RlZFByaW50YWJsZSkgewotICAgICAgICAgICAgICAgICAgICBlbmNvZGVkUGhvbmV0aWNGYW1pbHlOYW1lID0gZW5jb2RlUXVvdGVkUHJpbnRhYmxlKHBob25ldGljRmFtaWx5TmFtZSk7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgZW5jb2RlZFBob25ldGljRmFtaWx5TmFtZSA9IGVzY2FwZUNoYXJhY3RlcnMocGhvbmV0aWNGYW1pbHlOYW1lKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKFZDYXJkQ29uc3RhbnRzLlBST1BFUlRZX1hfUEhPTkVUSUNfTEFTVF9OQU1FKTsKLSAgICAgICAgICAgICAgICBpZiAoc2hvdWxkQXBwZW5kQ2hhcnNldFBhcmFtKHBob25ldGljRmFtaWx5TmFtZSkpIHsKLSAgICAgICAgICAgICAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKFZDQVJEX1BBUkFNX1NFUEFSQVRPUik7Ci0gICAgICAgICAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChtVkNhcmRDaGFyc2V0UGFyYW1ldGVyKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgaWYgKHJlYWxseVVzZVF1b3RlZFByaW50YWJsZSkgewotICAgICAgICAgICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQoVkNBUkRfUEFSQU1fU0VQQVJBVE9SKTsKLSAgICAgICAgICAgICAgICAgICAgbUJ1aWxk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mFsdWVzIDogY29udGVudFZhbHVlc0xpc3QpIHsKLSAgICAgICAgICAgICAgICBmaW5hbCBTdHJpbmcgbmlja25hbWUgPSBjb250ZW50VmFsdWVzLmdldEFzU3RyaW5nKE5pY2tuYW1lLk5BTUUpOwotICAgICAgICAgICAgICAgIGlmIChUZXh0VXRpbHMuaXNFbXB0eShuaWNrbmFtZSkpIHsKLSAgICAgICAgICAgICAgICAgICAgY29udGludWU7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGlmICh1c2VBbmRyb2lkUHJvcGVydHkpIHsKLSAgICAgICAgICAgICAgICAgICAgYXBwZW5kQW5kcm9pZFNwZWNpZmljUHJvcGVydHkoTmlja25hbWUuQ09OVEVOVF9JVEVNX1RZUEUsIGNvbnRlbnRWYWx1ZXMpOwotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIGFwcGVuZExpbmVXaXRoQ2hhcnNldEFuZFFQRGV0ZWN0aW9uKFZDYXJkQ29uc3RhbnRzLlBST1BFUlRZX05JQ0tOQU1FLCBuaWNrbmFtZSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgICAgIHJldHVybiB0aGlzOwotICAgIH0KLQotICAgIHB1YmxpYyBWQ2FyZEJ1aWxkZXIgYXBwZW5kUGhvbmVzKGZpbmFsIExpc3Q8Q29udGVudFZhbHVlcz4gY29udGVudFZhbHVlc0xpc3QpIHsKLSAgICAgICAgYm9vbGVhbiBwaG9uZUxpbmVFeGlzdHMgPSBmYWxzZTsKLSAgICAgICAgaWYgKGNvbnRlbnRWYWx1ZXNMaXN0ICE9IG51bGwpIHsKLSAgICAgICAgICAgIFNldDxTdHJpbmc+IHBob25lU2V0ID0gbmV3IEhhc2hTZXQ8U3RyaW5nPigpOwotICAgICAgICAgICAgZm9yIChDb250ZW50VmFsdWVzIGNvbnRlbnRWYWx1ZXMgOiBjb250ZW50VmFsdWVzTGlzdCkgewotICAgICAgICAgICAgICAgIGZpbmFsIEludGVnZXIgdHlwZUFzT2JqZWN0ID0gY29udGVudFZhbHVlcy5nZXRBc0ludGVnZXIoUGhvbmUuVFlQRSk7Ci0gICAgICAgICAgICAgICAgZmluYWwgU3RyaW5nIGxhYmVsID0gY29udGVudFZhbHVlcy5nZXRBc1N0cmluZyhQaG9uZS5MQUJFTCk7Ci0gICAgICAgICAgICAgICAgZmluYWwgSW50ZWdlciBpc1ByaW1hcnlBc0ludGVnZXIgPSBjb250ZW50VmFsdWVzLmdldEFzSW50ZWdlcihQaG9uZS5JU19QUklNQVJZKTsKLSAgICAgICAgICAgICAgICBmaW5hbCBib29sZWFuIGlzUHJpbWFyeSA9IChpc1ByaW1hcnlBc0ludGVnZXIgIT0gbnVsbCA/Ci0gICAgICAgICAgICAgICAgICAgICAgICAoaXNQcmltYXJ5QXNJbnRlZ2VyID4gMCkgOiBmYWxzZSk7Ci0gICAgICAgICAgICAgICAgU3RyaW5nIHBob25lTnVtYmVyID0gY29udGVudFZhbHVlcy5nZXRBc1N0cmluZyhQaG9uZS5OVU1CRVIpOwotICAgICAgICAgICAgICAgIGlmIChwaG9uZU51bWJlciAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIHBob25lTnVtYmVyID0gcGhvbmVOdW1iZXIudHJpbSgpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBpZiAoVGV4dFV0aWxzLmlzRW1wdHkocGhvbmVOdW1iZXIpKSB7Ci0gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwotICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgIC8vIFBBR0VSIG51bWJlciBuZWVkcyB1bmZvcm1hdHRlZCAicGhvbmUgbnVtYmVyIi4KLSAgICAgICAgICAgICAgICBmaW5hbCBpbnQgdHlwZSA9ICh0eXBlQXNPYmplY3QgIT0gbnVsbCA/IHR5cGVBc09iamVjdCA6IERFRkFVTFRfUEhPTkVfVFlQRSk7Ci0gICAgICAgICAgICAgICAgaWYgKHR5cGUgPT0gUGhvbmUuVFlQRV9QQUdFUiB8fAotICAgICAgICAgICAgICAgICAgICAgICAgVkNhcmRDb25maWcucmVmcmFpblBob25lTnVtYmVyRm9ybWF0dGluZyhtVkNhcmRUeXBlKSkgewotICAgICAgICAgICAgICAgICAgICBwaG9uZUxpbmVFeGlzdHMgPSB0cnVlOwotICAgICAgICAgICAgICAgICAgICBpZiAoIXBob25lU2V0LmNvbnRhaW5zKHBob25lTnVtYmVyKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgcGhvbmVTZXQuYWRkKHBob25lTnVtYmVyKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGFwcGVuZFRlbExpbmUodHlwZSwgbGFiZWwsIHBob25lTnVtYmVyLCBpc1ByaW1hcnkpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgZmluYWwgTGlzdDxTdHJpbmc+IHBob25lTnVtYmVyTGlzdCA9IHNwbGl0QW5kVHJpbVBob25lTnVtYmVycyhwaG9uZU51bWJlcik7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChwaG9uZU51bWJlckxpc3QuaXNFbXB0eSgpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBwaG9uZUxpbmVFeGlzdHMgPSB0cnVlOwotICAgICAgICAgICAgICAgICAgICBmb3IgKFN0cmluZyBhY3R1YWxQaG9uZU51bWJlciA6IHBob25lTnVtYmVyTGlzdCkgewotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFwaG9uZVNldC5jb250YWlucyhhY3R1YWxQaG9uZU51bWJlcikpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaW5hbCBpbnQgZm9ybWF0ID0gVkNhcmRVdGlscy5nZXRQaG9uZU51bWJlckZvcm1hdChtVkNhcmRUeXBlKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaW5hbCBTdHJpbmcgZm9ybWF0dGVkUGhvbmVOdW1iZXIgPQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUGhvbmVOdW1iZXJVdGlscy5mb3JtYXROdW1iZXIoYWN0dWFsUGhvbmVOdW1iZXIsIGZvcm1hdCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgcGhvbmVTZXQuYWRkKGFjdHVhbFBob25lTnVtYmVyKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBhcHBlbmRUZWxMaW5lKHR5cGUsIGxhYmVsLCBmb3JtYXR0ZWRQaG9uZU51bWJlciwgaXNQcmltYXJ5KTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgfSAgLy8gZm9yIChTdHJpbmcgYWN0dWFsUGhvbmVOdW1iZXIgOiBwaG9uZU51bWJlckxpc3QpIHsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICBpZiAoIXBob25lTGluZUV4aXN0cyAmJiBtSXNEb0NvTW8pIHsKLSAgICAgICAgICAgIGFwcGVuZFRlbExpbmUoUGhvbmUuVFlQRV9IT01FLCAiIiwgIiIsIGZhbHNlKTsKLSAgICAgICAgfQotCi0gICAgICAgIHJldHVybiB0aGlzOwotICAgIH0KLQotICAgIC8qKgotICAgICAqIDxwPgotICAgICAqIFNwbGl0cyBhIGdpdmVuIHN0cmluZyBleHByZXNzaW5nIHBob25lIG51bWJlcnMgaW50byBzZXZlcmFsIHN0cmluZ3MsIGFuZCByZW1vdmUKLSAgICAgKiB1bm5lY2Vzc2FyeSBjaGFyYWN0ZXJzIGluc2lkZSB0aGVtLiBUaGUgc2l6ZSBvZiBhIHJldHVybmVkIGxpc3QgYmVjb21lcyAxIHdoZW4KLSAgICAgKiBubyBzcGxpdCBpcyBuZWVkZ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ICAgICAgICAgICAgZmluYWwgSW50ZWdlciBwcmlvcml0eUFzSW50ZWdlciA9IHNQb3N0YWxUeXBlUHJpb3JpdHlNYXAuZ2V0KHR5cGVBc0ludGVnZXIpOwotICAgICAgICAgICAgZmluYWwgaW50IHByaW9yaXR5ID0KLSAgICAgICAgICAgICAgICAgICAgKHByaW9yaXR5QXNJbnRlZ2VyICE9IG51bGwgPyBwcmlvcml0eUFzSW50ZWdlciA6IEludGVnZXIuTUFYX1ZBTFVFKTsKLSAgICAgICAgICAgIGlmIChwcmlvcml0eSA8IGN1cnJlbnRQcmlvcml0eSkgewotICAgICAgICAgICAgICAgIGN1cnJlbnRQcmlvcml0eSA9IHByaW9yaXR5OwotICAgICAgICAgICAgICAgIGN1cnJlbnRUeXBlID0gdHlwZUFzSW50ZWdlcjsKLSAgICAgICAgICAgICAgICBjdXJyZW50Q29udGVudFZhbHVlcyA9IGNvbnRlbnRWYWx1ZXM7Ci0gICAgICAgICAgICAgICAgaWYgKHByaW9yaXR5ID09IDApIHsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgaWYgKGN1cnJlbnRDb250ZW50VmFsdWVzID09IG51bGwpIHsKLSAgICAgICAgICAgIExvZy53KExPR19UQUcsICJTaG91bGQgbm90IGNvbWUgaGVyZS4gTXVzdCBoYXZlIGF0IGxlYXN0IG9uZSBwb3N0YWwgZGF0YS4iKTsKLSAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgfQotCi0gICAgICAgIGZpbmFsIFN0cmluZyBsYWJlbCA9IGN1cnJlbnRDb250ZW50VmFsdWVzLmdldEFzU3RyaW5nKFN0cnVjdHVyZWRQb3N0YWwuTEFCRUwpOwotICAgICAgICBhcHBlbmRQb3N0YWxMaW5lKGN1cnJlbnRUeXBlLCBsYWJlbCwgY3VycmVudENvbnRlbnRWYWx1ZXMsIGZhbHNlLCB0cnVlKT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ksCi0gICAgICAgICAgICAgICAgcmF3UmVnaW9uLCByYXdQb3N0YWxDb2RlLCByYXdDb3VudHJ5fTsKLSAgICAgICAgaWYgKCFWQ2FyZFV0aWxzLmFyZUFsbEVtcHR5KHJhd0FkZHJlc3NBcnJheSkpIHsKLSAgICAgICAgICAgIGZpbmFsIGJvb2xlYW4gcmVhbGx5VXNlUXVvdGVkUHJpbnRhYmxlID0KLSAgICAgICAgICAgICAgICAobVNob3VsZFVzZVF1b3RlZFByaW50YWJsZSAmJgotICAgICAgICAgICAgICAgICAgICAgICAgIVZDYXJkVXRpbHMuY29udGFpbnNPbmx5Tm9uQ3JMZlByaW50YWJsZUFzY2lpKHJhd0FkZHJlc3NBcnJheSkpOwotICAgICAgICAgICAgZmluYWwgYm9vbGVhbiBhcHBlbmRDaGFyc2V0ID0KLSAgICAgICAgICAgICAgICAhVkNhcmRVdGlscy5jb250YWluc09ubHlQcmludGFibGVBc2NpaShyYXdBZGRyZXNzQXJyYXkpOwotICAgICAgICAgICAgZmluYWwgU3RyaW5nIGVuY29kZWRQb0JveDsKLSAgICAgICAgICAgIGZpbmFsIFN0cmluZyBlbmNvZGVkU3RyZWV0OwotICAgICAgICAgICAgZmluYWwgU3RyaW5nIGVuY29kZWRMb2NhbGl0eTsKLSAgICAgICAgICAgIGZpbmFsIFN0cmluZyBlbmNvZGVkUmVnaW9uOwotICAgICAgICAgICAgZmluYWwgU3RyaW5nIGVuY29kZWRQb3N0YWxDb2RlOwotICAgICAgICAgICAgZmluYWwgU3RyaW5nIGVuY29kZWRDb3VudHJ5OwotICAgICAgICAgICAgZmluYWwgU3RyaW5nIGVuY29kZWROZWlnaGJvcmhvb2Q7Ci0KLSAgICAgICAgICAgIGZpbmFsIFN0cmluZyByYXdMb2NhbGl0eTI7Ci0gICAgICAgICAgICAvLyBUaGlzIGxvb2tzIGluZWZmaWNpZW50IHNpbmNlIHdlIGVuY29kZSByYXdMb2NhbGl0eSBhbmQgcmF3TmVpZ2hib3Job29kIHR3aWNlLAotICAgICAgICAgICAgLy8gYnV0IHRoaXMgaXMgaW50ZW50aW9uYWwuCi0gICAgICAgICAgICAvLwotICAgICAgICAgICAgLy8gUVAgZW5jb2RpbmcgbWF5IGFkZCBsaW5lIGZlZWRzIHdoZW4gbmVlZGVkIGFuZCB0aGUgcmVzdWx0IG9mCi0gICAgICAgICAgICAvLyAtIGVuY29kZVF1b3RlZFByaW50YWJsZShyYXdMb2NhbGl0eSArICIgIiArIHJhd05laWdoYm9yaG9vZCkKLSAgICAgICAgICAgIC8vIG1heSBiZSBkaWZmZXJlbnQgZnJvbQotICAgICAgICAgICAgLy8gLSBlbmNvZGVkTG9jYWxpdHkgKyAiICIgKyBlbmNvZGVkTmVpZ2hib3Job29kLgotICAgICAgICAgICAgLy8KLSAgICAgICAgICAgIC8vIFdlIHVzZSBzYWZlciB3YXkuCi0gICAgICAgICAgICBpZiAoVGV4dFV0aWxzLmlzRW1wdHkocmF3TG9jYWxpdHkpKSB7Ci0gICAgICAgICAgICAgICAgaWYgKFRleHRVdGlscy5pc0VtcHR5KHJhd05laWdoYm9yaG9vZCkpIHsKLSAgICAgICAgICAgICAgICAgICAgcmF3TG9jYWxpdHkyID0gIiI7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgcmF3TG9jYWxpdHkyID0gcmF3TmVpZ2hib3Job29kOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgaWYgKFRleHRVdGlscy5pc0VtcHR5KHJhd05laWdoYm9yaG9vZCkpIHsKLSAgICAgICAgICAgICAgICAgICAgcmF3TG9jYWxpdHkyID0gcmF3TG9jYWxpdHk7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgcmF3TG9jYWxpdHkyID0gcmF3TG9jYWxpdHkgKyAiICIgKyByYXdOZWlnaGJvcmhvb2Q7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKHJlYWxseVVzZVF1b3RlZFByaW50YWJsZSkgewotICAgICAgICAgICAgICAgIGVuY29kZWRQb0JveCA9IGVuY29kZVF1b3RlZFByaW50YWJsZShyYXdQb0JveCk7Ci0gICAgICAgICAgICAgICAgZW5jb2RlZFN0cmVldCA9IGVuY29kZVF1b3RlZFByaW50YWJsZShyYXdTdHJlZXQpOwotICAgICAgICAgICAgICAgIGVuY29kZWRMb2NhbGl0eSA9IGVuY29kZVF1b3RlZFByaW50YWJsZShyYXdMb2NhbGl0eTIpOwotICAgICAgICAgICAgICAgIGVuY29kZWRSZWdpb24gPSBlbmNvZGVRdW90ZWRQcmludGFibGUocmF3UmVnaW9uKTsKLSAgICAgICAgICAgICAgICBlbmNvZGVkUG9zdGFsQ29kZSA9IGVuY29kZVF1b3RlZFByaW50YWJsZShyYXdQb3N0YWxDb2RlKTsKLSAgICAgICAgICAgICAgICBlbmNvZGVkQ291bnRyeSA9IGVuY29kZVF1b3RlZFByaW50YWJsZShyYXdDb3VudHJ5KTsKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgZW5jb2RlZFBvQm94ID0gZXNjYXBlQ2hhcmFjdGVycyhyYXdQb0JveCk7Ci0gICAgICAgICAgICAgICAgZW5jb2RlZFN0cmVldCA9IGVzY2FwZUNoYXJhY3RlcnMocmF3U3RyZWV0KTsKLSAgICAgICAgICAgICAgICBlbmNvZGVkTG9jYWxpdHkgPSBlc2NhcGVDaGFyYWN0ZXJzKHJhd0xvY2FsaXR5Mik7Ci0gICAgICAgICAgICAgICAgZW5jb2RlZFJlZ2lvbiA9IGVzY2FwZUNoYXJhY3RlcnMocmF3UmVnaW9uKTsKLSAgICAgICAgICAgICAgICBlbmNvZGVkUG9zdGFsQ29kZSA9IGVzY2FwZUNoYXJhY3RlcnMocmF3UG9zdGFsQ29kZSk7Ci0gICAgICAgICAgICAgICAgZW5jb2RlZENvdW50c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OiBjb250ZW50VmFsdWVzTGlzdCkgewotICAgICAgICAgICAgICAgIGZpbmFsIEludGVnZXIgcHJvdG9jb2xBc09iamVjdCA9IGNvbnRlbnRWYWx1ZXMuZ2V0QXNJbnRlZ2VyKEltLlBST1RPQ09MKTsKLSAgICAgICAgICAgICAgICBpZiAocHJvdG9jb2xBc09iamVjdCA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBmaW5hbCBTdHJpbmcgcHJvcGVydHlOYW1lID0gVkNhcmRVdGlscy5nZXRQcm9wZXJ0eU5hbWVGb3JJbShwcm90b2NvbEFzT2JqZWN0KTsKLSAgICAgICAgICAgICAgICBpZiAocHJvcGVydHlOYW1lID09IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgY29udGludWU7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIFN0cmluZyBkYXRhID0gY29udGVudFZhbHVlcy5nZXRBc1N0cmluZyhJbS5EQVRBKTsKLSAgICAgICAgICAgICAgICBpZiAoZGF0YSAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIGRhdGEgPSBkYXRhLnRyaW0oKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgaWYgKFRleHRVdGlscy5pc0VtcHR5KGRhdGEpKSB7Ci0gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBmaW5hbCBTdHJpbmcgdHlwZUFzU3RyaW5nOwotICAgICAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICAgICAgZmluYWwgSW50ZWdlciB0eXBlQXNJbnRlZ2VyID0gY29udGVudFZhbHVlcy5nZXRBc0ludGVnZXIoSW0uVFlQRSk7Ci0gICAgICAgICAgICAgICAgICAgIHN3aXRjaCAodHlwZUFzSW50ZWdlciAhPSBudWxsID8gdHlwZUFzSW50ZWdlciA6IEltLlRZUEVfT1RIRVIpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgSW0uVFlQRV9IT01FOiB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZUFzU3RyaW5nID0gVkNhcmRDb25zdGFudHMuUEFSQU1fVFlQRV9IT01FOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBJbS5UWVBFX1dPUks6IHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlQXNTdHJpbmcgPSBWQ2FyZENvbnN0YW50cy5QQVJBTV9UWVBFX1dPUks7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEltLlRZUEVfQ1VTVE9NOiB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZmluYWwgU3RyaW5nIGxhYmVsID0gY29udGVudFZhbHVlcy5nZXRBc1N0cmluZyhJbS5MQUJFTCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZUFzU3RyaW5nID0gKGxhYmVsICE9IG51bGwgPyAiWC0iICsgbGFiZWwgOiBudWxsKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgSW0uVFlQRV9PVEhFUjogIC8vIElnbm9yZQotICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDogewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGVBc1N0cmluZyA9IG51bGw7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICA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cyA6IGNvbnRlbnRWYWx1ZXNMaXN0KSB7Ci0gICAgICAgICAgICAgICAgU3RyaW5nIGNvbXBhbnkgPSBjb250ZW50VmFsdWVzLmdldEFzU3RyaW5nKE9yZ2FuaXphdGlvbi5DT01QQU5ZKTsKLSAgICAgICAgICAgICAgICBpZiAoY29tcGFueSAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIGNvbXBhbnkgPSBjb21wYW55LnRyaW0oKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgU3RyaW5nIGRlcGFydG1lbnQgPSBjb250ZW50VmFsdWVzLmdldEFzU3RyaW5nKE9yZ2FuaXphdGlvbi5ERVBBUlRNRU5UKTsKLSAgICAgICAgICAgICAgICBpZiAoZGVwYXJ0bWVudCAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIGRlcGFydG1lbnQgPSBkZXBhcnRtZW50LnRyaW0oKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgU3RyaW5nIHRpdGxlID0gY29udGVudFZhbHVlcy5nZXRBc1N0cmluZyhPcmdhbml6YXRpb24uVElUTEUpOwotICAgICAgICAgICAgICAgIGlmICh0aXRsZSAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIHRpdGxlID0gdGl0bGUudHJpbSgpOwotICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgIFN0cmluZ0J1aWxkZXIgb3JnQnVpbGRlciA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7Ci0gICAgICAgICAgICAgICAgaWYgKCFUZXh0VXRpbHMuaXNFbXB0eShjb21wYW55KSkgewotICAgICAgICAgICAgICAgICAgICBvcmdCdWlsZGVyLmFwcGVuZChjb21wYW55KTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgaWYgKCFUZXh0VXRpbHMuaXNFbXB0eShkZXBhcnRtZW50KSkgewotICAgICAgICAgICAgICAgICAgICBpZiAob3JnQnVpbGRlci5sZW5ndGgoKSA+IDApIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIG9yZ0J1aWxkZXIuYXBwZW5kKCc7Jyk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgb3JnQnVpbGRlci5hcHBlbmQoZGVwYXJ0bWVudCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGZpbmFsIFN0cmluZyBvcmdsaW5lID0gb3JnQnVpbGRlci50b1N0cmluZygpOwotICAgICAgICAgICAgICAgIGFwcGVuZExpbmUoVkNhcmRDb25zdGFudHMuUFJPUEVSVFlfT1JHLCBvcmdsaW5lLAotICAgICAgICAgICAgICAgICAgICAgICAgIVZDYXJkVXRpbHMuY29udGFpbnNPbmx5UHJpbnRhYmxlQXNjaWkob3JnbGluZSksCi0gICAgICAgICAgICAgICAgICAgICAgICAobVNob3VsZFVzZVF1b3RlZFByaW50YWJsZSAmJgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAhVkNhcmRVdGlscy5jb250YWluc09ubHlOb25DckxmUHJpbnRhYmxlQXNjaWkob3JnbGluZSkpKTsKLQotICAgICAgICAgICAgICAgIGlmICghVGV4dFV0aWxzLmlzRW1wdHkodGl0bGUpKSB7Ci0gICAgICAgICAgICAgICAgICAgIGFwcGVuZExpbmUoVkNhcmRDb25zdGFudHMuUFJPUEVSVFlfVElUTEUsIHRpdGxlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICFWQ2FyZFV0aWxzLmNvbnRhaW5zT25seVByaW50YWJsZUFzY2lpKHRpdGxlKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAobVNob3VsZFVzZVF1b3RlZFByaW50YWJsZSAmJgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIVZDYXJkVXRpbHMuY29udGFpbnNPbmx5Tm9uQ3JMZlByaW50YWJsZUFzY2lpKHRpdGxlKSkpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgICAgICByZXR1cm4gdGhpczsKLSAgICB9Ci0KLSAgICBwdWJsaWMgVkNhcmRCdWlsZGVyIGFwcGVuZFBob3RvcyhmaW5hbCBMaXN0PENvbnRlbnRWYWx1ZXM+IGNvbnRlbnRWYWx1ZXNMaXN0KSB7Ci0gICAgICAgIGlmIChjb250ZW50VmFsdWVzTGlzdCAhPSBudWxsKSB7Ci0gICAgICAgICAgICBmb3IgKENvbnRlbnRWYWx1ZXMgY29udGVudFZhbHVlcyA6IGNvbnRlbnRWYWx1ZXNMaXN0KSB7Ci0gICAgICAgICAgICAgICAgaWYgKGNvbnRlbnRWYWx1ZXMgPT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgYnl0ZVtdIGRhdGEgPSBjb250ZW50VmFsdWVzLmdldEFzQnl0ZUFycmF5KFBob3RvLlBIT1RPKTsKLSAgICAgICAgICAgICAgICBpZiAoZGF0YSA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBmaW5hbCBTdHJpbmcgcGhvdG9UeXBlID0gVkNhcmRVdGlscy5ndWVzc0ltYWdlVHlwZShkYXRhKTsKLSAgICAgICAgICAgICAgICBpZiAocGhvdG9UeXBlID09IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIlVua25vd24gcGhvdG8gdHlwZS4gSWdub3JlZC4iKTsKLSAgICAgICAgICAgICAgICAgICAgY29udGludWU7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIC8vIFRPRE86IGNoZWNrIHRoaXMgd29ya3MgZmluZS4KLSAgICAgICAgICAgICAgICBmaW5hbCBTdHJpbmcgcGhvdG9TdHJpbmcgPSBuZXcgU3RyaW5nKEJhc2U2NC5lbmNvZGUoZGF0YSwgQmFzZTY0Lk5PX1dSQVApKTsKLSAgICAgICAgICAgICAgICBpZiAoIVRleHRVdGlscy5pc0VtcHR5KHBob3RvU3RyaW5nKSkgewotICAgICAgICAgICAgICAgICAgICBhcHBlbmRQaG90b0xpbmUocGhvdG9TdHJpbmcsIHBob3RvVHlwZSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgICAgIHJldHVybiB0aGlzOwotICAgIH0KLQotICAgIHB1YmxpYyBWQ2FyZEJ1aWxkZXIgYXBwZW5kTm90ZXMoZmluYWwgTGlzdDxDb250ZW50VmFsdWVzPiBjb250ZW50VmFsdWVzTGlzdCkgewotICAgICAgICBpZiAoY29udGVudFZhbHVlc0xpc3QgIT0gbnVsbCkgewotICAgICAgICAgICAgaWYgKG1Pbmx5T25lTm90ZUZpZWxkSXNBdmFpbGFibGUpIHsKLSAgICAgICAgICAgICAgICBmaW5hbCBTdHJpbmdCdWlsZGVyIG5vdGVCdWlsZGVyID0gbmV3IFN0cmluZ0J1aWxkZXIoKTsKLSAgICAgICAgICAgICAgICBib29sZWFuIGZpcnN0ID0gdHJ1ZTsKLSAgICAgICAgICAgICAgICBmb3IgKGZpbmFsIENvbnRlbnRWYWx1ZXMgY29udGVudFZhbHVlcyA6IGNvbnRlbnRWYWx1ZXNMaXN0KSB7Ci0gICAgICAgICAgICAgICAgICAgIFN0cmluZyBub3RlID0gY29udGVudFZhbHVlcy5nZXRBc1N0cmluZyhOb3RlLk5PVEUpOwotICAgICAgICAgICAgICAgICAgICBpZiAobm90ZSA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBub3RlID0gIiI7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgaWYgKG5vdGUubGVuZ3RoKCkgPiAwKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZmlyc3QpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaXJzdCA9IGZhbHNlOwotICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBub3RlQnVpbGRlci5hcHBlbmQoJ1xuJyk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICBub3RlQnVpbGRlci5hcHBlbmQobm90ZSk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgZmluYWwgU3RyaW5nIG5vdGVTdHIgPSBub3RlQnVpbGRlci50b1N0cmluZygpOwotICAgICAgICAgICAgICAgIC8vIFRoaXMgbWVhbnMgd2Ugc2NhbiBub3RlU3RyIGNvbXBsZXRlbHkgdHdpY2UsIHdoaWNoIGlzIHJlZHVuZGFudC4KLSAgICAgICAgICAgICAgICAvLyBCdXQgZm9yIG5vdywgd2UgYXNzdW1lIHRoaXMgaXMgbm90IHNvIHRpbWUtY29uc3VtaW5nLi4KLSAgICAgICAgICAgICAgICBmaW5hbCBib29sZWFuIHNob3VsZEFwcGVuZENoYXJzZXRJbmZvID0KLSAgICAgICAgICAgICAgICAgICAgIVZDYXJkVXRpbHMuY29udGFpbnNPbmx5UHJpbnRhYmxlQXNjaWkobm90ZVN0cik7Ci0gICAgICAgICAgICAgICAgZmluYWwgYm9vbGVhbiByZWFsbHlVc2VRdW90ZWRQcmludGFibGUgPQotICAgICAgICAgICAgICAgICAgICAgICAgKG1TaG91bGRVc2VRdW90ZWRQcmludGFibGUgJiYKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAhVkNhcmRVdGlscy5jb250YWluc09ubHlOb25DckxmUHJpbnRhYmxlQXNjaWkobm90ZVN0cikpOwotICAgICAgICAgICAgICAgIGFwcGVuZExpbmUoVkNhcmRDb25zdGFudHMuUFJPUEVSVFlfTk9URSwgbm90ZVN0ciwKLSAgICAgICAgICAgICAgICAgICAgICAgIHNob3VsZEFwcGVuZENoYXJzZXRJbmZvLCByZWFsbHlVc2VRdW90ZWRQcmludGFibGUpOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBmb3IgKENvbnRlbnRWYWx1ZXMgY29udGVudFZhbHVlcyA6IGNvbnRlbnRWYWx1ZXNMaXN0KSB7Ci0gICAgICAgICAgICAgICAgICAgIGZpbmFsIFN0cmluZyBub3RlU3RyID0gY29udGVudFZhbHVlcy5nZXRBc1N0cmluZyhOb3RlLk5PVEUpOwotICAgICAgICAgICAgICAgICAgICBpZiAoIVRleHRVdGlscy5pc0VtcHR5KG5vdGVTdHIpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBmaW5hbCBib29sZWFuIHNob3VsZEFwcGVuZENoYXJzZXRJbmZvID0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIVZDYXJkVXRpbHMuY29udGFpbnNPbmx5UHJpbnRhYmxlQXNjaWkobm90ZVN0cik7Ci0gICAgICAgICAgICAgICAgICAgICAgICBmaW5hbCBib29sZWFuIHJlYWxseVVzZVF1b3RlZFByaW50YWJsZSA9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChtU2hvdWxkVXNlUXVvdGVkUHJpbnRhYmxlICYmCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAhVkNhcmRVdGlscy5jb250YWluc09ubHlOb25DckxmUHJpbnRhYmxlQXNjaWkobm90ZVN0cikpOwotICAgICAgICAgICAgICAgICAgICAgICAgYXBwZW5kTGluZShWQ2FyZENvbnN0YW50cy5QUk9QRVJUWV9OT1RFLCBub3RlU3RyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaG91bGRBcHBlbmRDaGFyc2V0SW5mbywgcmVhbGx5VXNlUXVvdGVkUHJpbnRhYmxlKTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgICAgICByZXR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UeXBlID0gRXZlbnQuVFlQRV9PVEhFUjsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgaWYgKGV2ZW50VHlwZSA9PSBFdmVudC5UWVBFX0JJUlRIREFZKSB7Ci0gICAgICAgICAgICAgICAgICAgIGZpbmFsIFN0cmluZyBiaXJ0aGRheUNhbmRpZGF0ZSA9IGNvbnRlbnRWYWx1ZXMuZ2V0QXNTdHJpbmcoRXZlbnQuU1RBUlRfREFURSk7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChiaXJ0aGRheUNhbmRpZGF0ZSA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBmaW5hbCBJbnRlZ2VyIGlzU3VwZXJQcmltYXJ5QXNJbnRlZ2VyID0KLSAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnRWYWx1ZXMuZ2V0QXNJbnRlZ2VyKEV2ZW50LklTX1NVUEVSX1BSSU1BUlkpOwotICAgICAgICAgICAgICAgICAgICBmaW5hbCBib29sZWFuIGlzU3VwZXJQcmltYXJ5ID0gKGlzU3VwZXJQcmltYXJ5QXNJbnRlZ2VyICE9IG51bGwgPwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIChpc1N1cGVyUHJpbWFyeUFzSW50ZWdlciA+IDApIDogZmFsc2UpOwotICAgICAgICAgICAgICAgICAgICBpZiAoaXNTdXBlclByaW1hcnkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vICJzdXBlciBwcmltYXJ5IiBiaXJ0aGRheSBzaG91bGQgdGhlIHByZWZlcmVkIG9uZS4KLSAgICAgICAgICAgICAgICAgICAgICAgIHByaW1hcnlCaXJ0aGRheSA9IGJpcnRoZGF5Q2FuZGlkYXRlOwotICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgZmluYWwgSW50ZWdlciBpc1ByaW1hcnlBc0ludGVnZXIgPQotICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudFZhbHVlcy5nZXRBc0ludGVnZXIoRXZlbnQuSVNfUFJJTUFSWSk7Ci0gICAgICAgICAgICAgICAgICAgIGZpbmFsIGJvb2xlYW4gaXNQcmltYXJ5ID0gKGlzUHJpbWFyeUFzSW50ZWdlciAhPSBudWxsID8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAoaXNQcmltYXJ5QXNJbnRlZ2VyID4gMCkgOiBmYWxzZSk7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChpc1ByaW1hcnkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIFdlIGRvbid0IGJyZWFrIGhlcmUgc2luY2UgInN1cGVyIHByaW1hcnkiIGJpcnRoZGF5IG1heSBleGlzdCBsYXRlci4KLSAgICAgICAgICAgICAgICAgICAgICAgIHByaW1hcnlCaXJ0aGRheSA9IGJpcnRoZGF5Q2FuZGlkYXRlOwotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHNlY29uZGFyeUJpcnRoZGF5ID09IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIEZpcnN0IGVudHJ5IGlzIHNldCB0byB0aGUgInNlY29uZGFyeSIgY2FuZGlkYXRlLgotICAgICAgICAgICAgICAgICAgICAgICAgc2Vjb25kYXJ5QmlydGhkYXkgPSBiaXJ0aGRheUNhbmRpZGF0ZTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobVVzZXNBbmRyb2lkUHJvcGVydHkpIHsKLSAgICAgICAgICAgICAgICAgICAgLy8gRXZlbnQgdHlwZXMgb3RoZXIgdGhhbiBCaXJ0aGRheSBpcyBub3Qgc3VwcG9ydGVkIGJ5IHZDYXJkLgotICAgICAgICAgICAgICAgICAgICBhcHBlbmRBbmRyb2lkU3BlY2lmaWNQcm9wZXJ0eShFdmVudC5DT05URU5UX0lURU1fVFlQRSwgY29udGVudFZhbHVlcyk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKHByaW1hcnlCaXJ0aGRheSAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgYXBwZW5kTGluZVdpdGhDaGFyc2V0QW5kUVBEZXRlY3Rpb24oVkNhcmRDb25zdGFudHMuUFJPUEVSVFlfQkRBWSwKLSAgICAgICAgICAgICAgICAgICAgICAgIHByaW1hcnlCaXJ0aGRheS50cmltKCkpOwotICAgICAgICAgICAgfSBlbHNlIGlmIChzZWNvbmRhcnlCaXJ0aGRheSAhPSBudWxsKXsKLSAgICAgICAgICAgICAgICBhcHBlbmRMaW5lV2l0aENoYXJzZXRBbmRRUERldGVjdGlvbihWQ2FyZENvbnN0YW50cy5QUk9QRVJUWV9CREFZLAotICAgICAgICAgICAgICAgICAgICAgICAgc2Vjb25kYXJ5QmlydGhkYXkudHJpbSgpKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgICAgICByZXR1cm4gdGhpczsKLSAgICB9Ci0KLSAgICBwdWJsaWMgVkNhcmRCdWlsZGVyIGFwcGVuZFJlbGF0aW9uKGZpbmFsIExpc3Q8Q29udGVudFZhbHVlcz4gY29udGVudFZhbHVlc0xpc3QpIHsKLSAgICAgICAgaWYgKG1Vc2VzQW5kcm9pZFByb3BlcnR5ICYmIGNvbnRlbnRWYWx1ZXNMaXN0ICE9IG51bGwpIHsKLSAgICAgICAgICAgIGZvciAoZmluYWwgQ29udGVudFZhbHVlcyBjb250ZW50VmFsdWVzIDogY29udGVudFZhbHVlc0xpc3QpIHsKLSAgICAgICAgICAgICAgICBpZiAoY29udGVudFZhbHVlcyA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBhcHBlbmRBbmRyb2lkU3BlY2lmaWNQ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Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgcmVhbGx5VXNlUXVvdGVkUHJpbnRhYmxlID0gcG9zdGFsU3RydWN0LnJlYWxseVVzZVF1b3RlZFByaW50YWJsZTsKLSAgICAgICAgICAgICAgICBhcHBlbmRDaGFyc2V0ID0gcG9zdGFsU3RydWN0LmFwcGVuZENoYXJzZXQ7Ci0gICAgICAgICAgICAgICAgYWRkcmVzc1ZhbHVlID0gcG9zdGFsU3RydWN0LmFkZHJlc3NEYXRhOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgTGlzdDxTdHJpbmc+IHBhcmFtZXRlckxpc3QgPSBuZXcgQXJyYXlMaXN0PFN0cmluZz4oKTsKLSAgICAgICAgaWYgKGlzUHJpbWFyeSkgewotICAgICAgICAgICAgcGFyYW1ldGVyTGlzdC5hZGQoVkNhcmRDb25zdGFudHMuUEFSQU1fVFlQRV9QUkVGKTsKLSAgICAgICAgfQotICAgICAgICBzd2l0Y2ggKHR5cGUpIHsKLSAgICAgICAgICAgIGNhc2UgU3RydWN0dXJlZFBvc3RhbC5UWVBFX0hPTUU6IHsKLSAgICAgICAgICAgICAgICBwYXJhbWV0ZXJMaXN0LmFkZChWQ2FyZENvbnN0YW50cy5QQVJBTV9UWVBFX0hPTUUpOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgY2FzZSBTdHJ1Y3R1cmVkUG9zdGFsLlRZUEVfV09SSzogewotICAgICAgICAgICAgICAgIHBhcmFtZXRlckxpc3QuYWRkKFZDYXJkQ29uc3RhbnRzLlBBUkFNX1RZUEVfV09SSyk7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBjYXNlIFN0cnVjdHVyZWRQb3N0YWwuVFlQRV9DVVNUT006IHsKLSAgICAgICAgICAgICAgICBpZiAoIVRleHRVdGlscy5pc0VtcHR5KGxhYmVsKQotICAgICAgICAgICAgICAgICAgICAgICAgJiYgVkNhcmRVdGlscy5jb250YWluc09ubHlBbHBoYURpZ2l0SHlwaGVuKGxhYmVsKSkgewotICAgICAgICAgICAgICAgICAgICAvLyBXZSdyZSBub3Qgc3VyZSB3aGV0aGVyIHRoZSBsYWJlbCBpcyB2YWxpZCBpbiB0aGUgc3BlYwotICAgICAgICAgICAgICAgICAgICAvLyAoIklBTkEtdG9rZW4iIGluIHRoZSB2Q2FyZCAzLjAgaXMgdW5jbGVhci4uLikKLSAgICAgICAgICAgICAgICAgICAgLy8gSnVzdCAgZm9yIHNhZmV0eSwgd2UgYWRkICJYLSIgYXQgdGhlIGJlZ2dpbmluZyBvZiBlYWNoIGxhYmVsLgotICAgICAgICAgICAgICAgICAgICAvLyBBbHNvIGNoZWNrcyB0aGUgbGFiZWwgb2JleXMgd2l0aCB2Q2FyZCAzLjAgc3BlYy4KLSAgICAgICAgICAgICAgICAgICAgcGFyYW1ldGVyTGlzdC5hZGQoIlgtIiArIGxhYmVsKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBjYXNlIFN0cnVjdHVyZWRQb3N0YWwuVFlQRV9PVEhFUjogewotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZGVmYXVsdDogewotICAgICAgICAgICAgICAgIExvZy5lKExPR19UQUcsICJVbmtub3duIFN0cnVjdHVyZWRQb3N0YWwgdHlwZTogIiArIHR5cGUpOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKFZDYXJkQ29uc3RhbnRzLlBST1BFUlRZX0FEUik7Ci0gIC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mVzc1ZhbHVlKTsKLSAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKFZDQVJEX0VORF9PRl9MSU5FKTsKLSAgICB9Ci0KLSAgICBwdWJsaWMgdm9pZCBhcHBlbmRFbWFpbExpbmUoZmluYWwgaW50IHR5cGUsIGZpbmFsIFN0cmluZyBsYWJlbCwKLSAgICAgICAgICAgIGZpbmFsIFN0cmluZyByYXdWYWx1ZSwgZmluYWwgYm9vbGVhbiBpc1ByaW1hcnkpIHsKLSAgICAgICAgZmluYWwgU3RyaW5nIHR5cGVBc1N0cmluZzsKLSAgICAgICAgc3dpdGNoICh0eXBlKSB7Ci0gICAgICAgICAgICBjYXNlIEVtYWlsLlRZUEVfQ1VTVE9NOiB7Ci0gICAgICAgICAgICAgICAgaWYgKFZDYXJkVXRpbHMuaXNNb2JpbGVQaG9uZUxhYmVsKGxhYmVsKSkgewotICAgICAgICAgICAgICAgICAgICB0eXBlQXNTdHJpbmcgPSBWQ2FyZENvbnN0YW50cy5QQVJBTV9UWVBFX0NFTEw7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIGlmICghVGV4dFV0aWxzLmlzRW1wdHkobGFiZWwpCi0gICAgICAgICAgICAgICAgICAgICAgICAmJiBWQ2FyZFV0aWxzLmNvbnRhaW5zT25seUFscGhhRGlnaXRIeXBoZW4obGFiZWwpKSB7Ci0gICAgICAgICAgICAgICAgICAgIHR5cGVBc1N0cmluZyA9ICJYLSIgKyBsYWJlbDsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICB0eXBlQXNTdHJpbmcgPSBudWxsOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGNhc2UgRW1haWwuVFlQRV9IT01FOiB7Ci0gICAgICAgICAgICAgICAgdHlwZUFzU3RyaW5nID0gVkNhcmRDb25zdGFudHMuUEFSQU1fVFlQRV9IT01FOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgY2FzZSBFbWFpbC5UWVBFX1dPUks6IHsKLSAgICAgICAgICAgICAgICB0eXBlQXNTdHJpbmcgPSBWQ2FyZENvbnN0YW50cy5QQVJBTV9UWVBFX1dPUks7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBjYXNlIEVtYWlsLlRZUEVfT1RIRVI6IHsKLSAgICAgICAgICAgICAgICB0eXBlQXNTdHJpbmcgPSBudWxsOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgY2FzZSBFbWFpbC5UWVBFX01PQklMRTogewotICAgICAgICAgICAgICAgIHR5cGVBc1N0cmluZyA9IFZDYXJkQ29uc3RhbnRzLlBBUkFNX1RZUEVfQ0VMTDsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGRlZmF1bHQ6IHsKLSAgICAgICAgICAgICAgICBMb2cuZShMT0dfVEFHLCAiVW5rbm93biBFbWFpbCB0eXBlOiAiICsgdHlwZSk7Ci0gICAgICAgICAgICAgICAgdHlwZUFzU3RyaW5nID0gbnVsbDsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIGZpbmFsIExpc3Q8U3RyaW5nPiBwYXJhbWV0ZXJMaXN0ID0gbmV3IEFycmF5TGlzdDxTdHJpbmc+KCk7Ci0gICAgICAgIGlmIChpc1ByaW1hcnkpIHsKLSAgICAgICAgICAgIHBhcmFtZXRlckxpc3QuYWRkKFZDYXJkQ29uc3RhbnRzLlBBUkFNX1RZUEVfUFJFRik7Ci0gICAgICAgIH0KLSAgICAgICAgaWYgKCFUZXh0VXRpbHMuaXNFbXB0eSh0eXBlQXNTdHJpbmcpKSB7Ci0gICAgICAgICAgICBwYXJhbWV0ZXJMaXN0LmFkZCh0eX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ICAgICAgICAgICB9Ci0gICAgICAgICAgICBjYXNlIFBob25lLlRZUEVfV09SSzogewotICAgICAgICAgICAgICAgIHBhcmFtZXRlckxpc3QuYWRkQWxsKAotICAgICAgICAgICAgICAgICAgICAgICAgQXJyYXlzLmFzTGlzdChWQ2FyZENvbnN0YW50cy5QQVJBTV9UWVBFX1dPUkspKTsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGNhc2UgUGhvbmUuVFlQRV9GQVhfSE9NRTogewotICAgICAgICAgICAgICAgIHBhcmFtZXRlckxpc3QuYWRkQWxsKAotICAgICAgICAgICAgICAgICAgICAgICAgQXJyYXlzLmFzTGlzdChWQ2FyZENvbnN0YW50cy5QQVJBTV9UWVBFX0hPTUUsIFZDYXJkQ29uc3RhbnRzLlBBUkFNX1RZUEVfRkFYKSk7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBjYXNlIFBob25lLlRZUEVfRkFYX1dPUks6IHsKLSAgICAgICAgICAgICAgICBwYXJhbWV0ZXJMaXN0LmFkZEFsbCgKLSAgICAgICAgICAgICAgICAgICAgICAgIEFycmF5cy5hc0xpc3QoVkNhcmRDb25zdGFudHMuUEFSQU1fVFlQRV9XT1JLLCBWQ2FyZENvbnN0YW50cy5QQVJBTV9UWVBFX0ZBWCkpOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgY2FzZSBQaG9uZS5UWVBFX01PQklMRTogewotICAgICAgICAgICAgICAgIHBhcmFtZXRlckxpc3QuYWRkKFZDYXJkQ29uc3RhbnRzLlBBUkFNX1RZUEVfQ0VMTCk7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBjYXNlIFBob25lLlRZUEVfUEFHRVI6IHsKLSAgICAgICAgICAgICAgICBpZiAobUlzRG9Db01vKSB7Ci0gICAgICAgICAgICAgICAgICAgIC8vIE5vdCBzdXJlIGFib3V0IHRoZSByZWFzb24sIGJ1dCBwcmV2aW91cyBpbXBsZW1lbnRhdGlvbiBoYWQKLSAgICAgICAgICAgICAgICAgICAgLy8gdXNlZCAiVk9JQ0UiIGluc3RlYWQgb2YgIlBBR0VSIgotICAgICAgICAgICAgICAgICAgICBwYXJhbWV0ZXJMaXN0LmFkZChWQ2FyZENvbnN0YW50cy5QQVJBTV9UWVBFX1ZPSUNFKTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBwYXJhbWV0ZXJMaXN0LmFkZChWQ2FyZENvbnN0YW50cy5QQVJBTV9UWVBFX1BBR0VSKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBjYXNlIFBob25lLlRZUEVfT1RIRVI6IHsKLSAgICAgICAgICAgICAgICBwYXJhbWV0ZXJMaXN0LmFkZChWQ2FyZENvbnN0YW50cy5QQVJBTV9UWVBFX1ZPSUNFKTsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGNhc2UgUGhvbmUuVFlQRV9DQVI6IHsKLSAgICAgICAgICAgICAgICBwYXJhbWV0ZXJMaXN0LmFkZChWQ2FyZENvbnN0YW50cy5QQVJBTV9UWVBFX0NBUik7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBjYXNlIFBob25lLlRZUEVfQ09NUEFOWV9NQUlOOiB7Ci0gICAgICAgICAgICAgICAgLy8gVGhlcmUncyBubyByZWxldmFudCBmaWVsZCBpbiB2Q2FyZCAoYXQgbGVhc3QgMi4xKS4KLSAgICAgICAgICAgICAgICBwYXJhbWV0ZXJMaXN0LmFkZChWQ2FyZENvbnN0YW50cy5QQVJBTV9UWVBFX1dPUkspOwotICAgICAgICAgICAgICAgIGlzUHJpbWFyeSA9IHRydWU7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBjYXNlIFBob25lLlRZUEVfSVNETjogewotICAgICAgICAgICAgICAgIHBhcmFtZXRlckxpc3QuYWRkKFZDYXJkQ29uc3RhbnRzLlBBUkFNX1RZUEVfSVNETik7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBjYXNlIFBob25lLlRZUEVfTUFJTjogewotICAgICAgICAgICAgICAgIGlzUHJpbWFyeSA9IHRydWU7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBjYXNlIFBob25lLlRZUEVfT1RIRVJfRkFYOiB7Ci0gICAgICAgICAgICAgICAgcGFyYW1ldGVyTGlzdC5hZGQoVkNhcmRDb25zdGFudHMuUEFSQU1fVFlQRV9GQVgpOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgY2FzZSBQaG9uZS5UWVBFX1RFTEVYOiB7Ci0gICAgICAgICAgICAgICAgcGFyYW1ldGVyTGlzdC5hZGQoVkNhcmRDb25zdGFudHMuUEFSQU1fVFlQRV9UTFgpOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgY2FzZSBQaG9uZS5UWVBFX1dPUktfTU9CSUxFOiB7Ci0gICAgICAgICAgICAgICAgcGFyYW1ldGVyTGlzdC5hZGRBbGwoCi0gICAgICAgICAgICAgICAgICAgICAgICBBcnJheXMuYXNMaXN0KFZDYXJkQ29uc3RhbnRzLlBBUkFNX1RZUEVfV09SSywgVkNhcmRDb25zdGFudHMuUEFSQU1fVFlQRV9DRUxMKSk7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBjYXNlIFBob25lLlRZUEVfV09SS19QQUdFUjogewotICAgICAgICAgICAgICAgIHBhcmFtZXRlckxpc3QuYWRkKFZDYXJkQ29uc3RhbnRzLlBBUkFNX1RZUEVfV09SSyk7Ci0gICAgICAgICAgICAgICAgLy8gU2VlIGFib3ZlLgotICAgICAgICAgICAgICAgIGlmIChtSXNEb0NvTW8pIHsKLSAgICAgICAgICAgICAgICAgICAgcGFyYW1ldGVyTGlzdC5hZGQoVkNhcmRDb25zdGFudHMuUEFSQU1fVFlQRV9WT0lDRSk7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgcGFyYW1ldGVyTGlzdC5hZGQoVkNhcmRDb25zdGFudHMuUEFSQU1fVFlQRV9QQUdFUik7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgY2FzZSBQaG9uZS5UWVBFX01NUzogewotICAgICAgICAgICAgICAgIHBhcmFtZXRlckxpc3QuYWRkKFZDYXJkQ29uc3RhbnRzLlBBUkFNX1RZUEVfTVNHKTsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGNhc2UgUGhvbmUuVFlQRV9DVVNUT006IHsKLSAgICAgICAgICAgICAgICBpZiAoVGV4dFV0aWxzLmlzRW1wdHkobGFiZWwpKSB7Ci0gICAgICAgICAgICAgICAgICAgIC8vIEp1c3QgaWdub3JlIHRoZSBjdXN0b20gdHlwZS4KLSAgICAgICAgICAgICAgICAgICAgcGFyYW1ldGVyTGlzdC5hZGQoVkNhcmRDb25zdGFudHMuUEFSQU1fVFlQRV9WT0lDRSk7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChWQ2FyZFV0aWxzLmlzTW9iaWxlUGhvbmVMYWJlbChsYWJlbCkpIHsKLSAgICAgICAgICAgICAgICAgICAgcGFyYW1ldGVyTGlzdC5hZGQoVkNhcmRDb25zdGFudHMuUEFSQU1fVFlQRV9DRUxMKTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKG1Jc1YzME9yVjQwKSB7Ci0gICAgICAgICAgICAgICAgICAgIC8vIFRoaXMgbGFiZWwgaXMgYXBwcm9wcmlhdGVseSBlbmNvZGVkIGluIGFwcGVuZFR5cGVQYXJhbWV0ZXJzLgotICAgICAgICAgICAgICAgICAgICBwYXJhbWV0ZXJMaXN0LmFkZChsYWJlbCk7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgZmluYWwgU3RyaW5nIHVwcGVyTGFiZWwgPSBsYWJlbC50b1VwcGVyQ2FzZSgpOwotICAgICAgICAgICAgICAgICAgICBpZiAoVkNhcmRVdGlscy5pc1ZhbGlkSW5WMjFCdXRVbmtub3duVG9Db250YWN0c1Bob3RlVHlwZSh1cHBlckxhYmVsKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW1ldGVyTGlzdC5hZGQodXBwZXJMYWJlbCk7Ci0gICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoVkNhcmRVdGlscy5jb250YWluc09ubHlBbHBoYURpZ2l0SHlwaGVuKGxhYmVsKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgLy8gTm90ZTogU3RyaWN0bHksIHZDYXJkIDIuMSBkb2VzIG5vdCBhbGxvdyAiWC0iIHBhcmFtZXRlciB3aXRob3V0Ci0gICAgICAgICAgICAgICAgICAgICAgICAvLyAgICAgICAiVFlQRT0iIHN0cmluZy4KLSAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtZXRlckxpc3QuYWRkKCJYLSIgKyBsYWJlbCk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBjYXNlIFBob25lLlRZUEVfUkFESU86Ci0gICAgICAgICAgICBjYXNlIFBob25lLlRZUEVfVFRZX1RERDoKL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BlbmNvZGVRdW90ZWRQcmludGFibGUocmF3VmFsdWUpOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAvLyBUT0RPOiBvbmUgbGluZSBtYXkgYmUgdG9vIGh1Z2UsIHdoaWNoIG1heSBiZSBpbnZhbGlkIGluIHZDYXJkIDMuMAotICAgICAgICAgICAgICAgIC8vICAgICAgICAod2hpY2ggc2F5cyAiV2hlbiBnZW5lcmF0aW5nIGEgY29udGVudCBsaW5lLCBsaW5lcyBsb25nZXIgdGhhbgotICAgICAgICAgICAgICAgIC8vICAgICAgICA3NSBjaGFyYWN0ZXJzIFNIT1VMRCBiZSBmb2xkZWQiKSwgdGhvdWdoIHNldmVyYWwKLSAgICAgICAgICAgICAgICAvLyAgICAgICAgKGV2ZW4gd2VsbC1rbm93bikgYXBwbGljYXRpb25zIGRvIG5vdCBjYXJlIHRoaXMuCi0gICAgICAgICAgICAgICAgZW5jb2RlZFZhbHVlID0gZXNjYXBlQ2hhcmFjdGVycyhyYXdWYWx1ZSk7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGlmIChmaXJzdCkgewotICAgICAgICAgICAgICAgIGZpcnN0ID0gZmFsc2U7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIG1CdWlsZGVyLmFwcGVuZChWQ0FSRF9JVEVNX1NFUEFSQVRPUik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQoZW5jb2RlZFZhbHVlKTsKLSAgICAgICAgfQotICAgICAgICBtQnVpbGRlci5hcHBlbmQoVkNBUkRfRU5EX09GX0xJTkUpOwotICAgIH0KLQotICAgIC8qKgotICAgICAqIFZDQVJEX1BBUkFNX1NFUEFSQVRPUiBtdXN0IGJlIGFwcGVuZGVkIGJlZm9yZSB0aGlzIG1ldGhvZCBiZWluZyBjYWxsZWQuCi0gICAgICovCi0gICAgcHJpdmF0ZSB2b2lkIGFwcGVuZFR5cG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N0YW5kIHRoZW0uCi0gICAgICAgICAgICAgICAgLy8KLSAgICAgICAgICAgICAgICAvLyBlLmcuIFRZUEU9Ilx1NTc4Qlx1MzA2Qlx1MzA4NyIgKHZDYXJkIDMuMCBhbGxvd3Mgbm9uLUFzY2lpIGNoYXJhY3RlcnMgaWYgdGhleQotICAgICAgICAgICAgICAgIC8vICAgICAgYXJlIHF1b3RlZC4pCi0gICAgICAgICAgICAgICAgaWYgKGZpcnN0KSB7Ci0gICAgICAgICAgICAgICAgICAgIGZpcnN0ID0gZmFsc2U7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgbUJ1aWxkZXIuYXBwZW5kKFZDQVJEX1BBUkFNX1NFUEFSQVRPUik7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGFwcGVuZFR5cGVQYXJhbWV0ZXIoZW5jb2RlZCk7Ci0gICAgICAgICAgICB9IGVsc2UgeyAgLy8gdkNhcmQgMi4xCi0gICAgICAgICAgICAgICAgaWYgKCFWQ2FyZFV0aWxzLmlzVjIxV29yZCh0eXBlVmFsdWUpKSB7Ci0gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBpZiAoZmlyc3QpIHsKLSAgICAgICAgICAgICAgICAgICAgZmlyc3QgPSBmYWxzZTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBtQnVpbGRlci5hcHBlbmQoVkNBUkRfUEFSQU1fU0VQQVJBVE9SKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgYXBwZW5kVHlwZVBhcmFtZXRlcih0eXBlVmFsdWUpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgfQotCi0gICAgLyoqCi0gICAgICogVkNBUkRfUEFSQU1fU0VQQVJBVE9SIG11c3QgYmUgYXBwZW5kZWQgYmVmb3JlIHRoaXMg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JlLgotICAgICAqLwotICAgIEBTdXBwcmVzc1dhcm5pbmdzKCJmYWxsdGhyb3VnaCIpCi0gICAgcHJpdmF0ZSBTdHJpbmcgZXNjYXBlQ2hhcmFjdGVycyhmaW5hbCBTdHJpbmcgdW5lc2NhcGVkKSB7Ci0gICAgICAgIGlmIChUZXh0VXRpbHMuaXNFbXB0eSh1bmVzY2FwZWQpKSB7Ci0gICAgICAgICAgICByZXR1cm4gIiI7Ci0gICAgICAgIH0KLQotICAgICAgICBmaW5hbCBTdHJpbmdCdWlsZGVyIHRtcEJ1aWxkZXIgPSBuZXcgU3RyaW5nQnVpbGRlcigpOwotICAgICAgICBmaW5hbCBpbnQgbGVuZ3RoID0gdW5lc2NhcGVkLmxlbmd0aCgpOwotICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGxlbmd0aDsgaSsrKSB7Ci0gICAgICAgICAgICBmaW5hbCBjaGFyIGNoID0gdW5lc2NhcGVkLmNoYXJBdChpKTsKLSAgICAgICAgICAgIHN3aXRjaCAoY2gpIHsKLSAgICAgICAgICAgICAgICBjYXNlICc7JzogewotICAgICAgICAgICAgICAgICAgICB0bXBCdWlsZGVyLmFwcGVuZCgnXFwnKTsKLSAgICAgICAgICAgICAgICAgICAgdG1wQnVpbGRlci5hcHBlbmQoJzsnKTsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGNhc2UgJ1xyJzogewotICAgICAgICAgICAgICAgICAgICBpZiAoaSArIDEgPCBsZW5ndGgpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGNoYXIgbmV4dENoYXIgPSB1bmVzY2FwZWQuY2hhckF0KGkpOwotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG5leHRDaGFyID09ICdcbicpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gZmFsbCB0aHJvdWdoCi0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAvLyBmYWxsIHRocm91Z2gKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBjYXNlICdcbic6IHsKLSAgICAgICAgICAgICAgICAgICAgLy8gSW4gdkNhcmQgMi4xLCB0aGVyZSdzIG5vIHNwZWNpZmljYXRpb24gYWJvdXQgdGhpcywgd2hpbGUKLSAgICAgICAgICAgICAgICAgICAgLy8gdkNhcmQgMy4wIGV4cGxpY2l0bHkgcmVxdWlyZXMgdGhpcyBzaG91bGQgYmUgZW5jb2RlZCB0byAiXG4iLgotICAgICAgICAgICAgICAgICAgICB0bXBCdWlsZGVyLmFwcGVuZCgiXFxuIik7Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBjYXNlICdcXCc6IHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKG1Jc1YzME9yVjQwKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICB0bXBCdWlsZGVyLmFwcGVuZCgiXFxcXCIpOwotICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAvLyBmYWxsIHRocm91Z2gKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBjYXNlICc8JzoKLSAgICAgICAgICAgICAgICBjYXNlICc+JzogewotICAgICAgICAgICAgICAgICAgICBpZiAobUlzRG9Db01vKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICB0bXBCdWlsZGVyLmFwcGVuZCgnXFwnKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIHRtcEJ1aWxkZXIuYXBwZW5kKGNoKTsKLSAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHRtcEJ1aWxkZXIuYXBwZW5kKGNoKTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgY2FzZSAnLCc6IHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKG1Jc1YzME9yVjQwKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICB0bXBCdWlsZGVyLmFwcGVuZCgiXFwsIik7Ci0gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICB0bXBCdWlsZGVyLmFwcGVuZChjaCk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGRlZmF1bHQ6IHsKLSAgICAgICAgICAgICAgICAgICAgdG1wQnVpbGRlci5hcHBlbmQoY2gpOwotICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICAgICAgcmV0dXJuIHRtcEJ1aWxkZXIudG9TdHJpbmcoKTsKLSAgICB9Ci0KLSAgICBAT3ZlcnJpZGUKLSAgICBwdWJsaWMgU3RyaW5nIHRvU3RyaW5nKCkgewotICAgICAgICBpZiAoIW1FbmRBcHBlbmRlZCkgewotICAgICAgICAgICAgaWYgKG1Jc0RvQ29NbykgewotICAgICAgICAgICAgICAgIGFwcGVuZExpbmUoVkNhcmRDb25zdGFudHMuUFJPUEVSVFlfWF9DTEFTUywgVkNBUkRfREFUQV9QVUJMSUMpOwotICAgICAgICAgICAgICAgIGFwcGVuZExpbmUoVkNhcmRDb25zdGFudHMuUFJPUEVSVFlfWF9SRUR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wotCi0vKioKLSAqIDxwPgotICogVGhlIGNsYXNzIGZvciBjb21wb3NpbmcgdkNhcmQgZnJvbSBDb250YWN0cyBpbmZvcm1hdGlvbi4KLSAqIDwvcD4KLSAqIDxwPgotICogVXN1YWxseSwgdGhpcyBjbGFzcyBzaG91bGQgYmUgdXNlZCBsaWtlIHRoaXMuCi0gKiA8L3A+Ci0gKiA8cHJlIGNsYXNzPSJwcmV0dHlwcmludCI+VkNhcmRDb21wb3NlciBjb21wb3NlciA9IG51bGw7Ci0gKiB0cnkgewotICogICAgIGNvbXBvc2VyID0gbmV3IFZDYXJkQ29tcG9zZXIoY29udGV4dCk7Ci0gKiAgICAgY29tcG9zZXIuYWRkSGFuZGxlcigKLSAqICAgICAgICAgICAgIGNvbXBvc2VyLm5ldyBIYW5kbGVyRm9yT3V0cHV0U3RyZWFtKG91dHB1dFN0cmVhbSkpOwotICogICAgIGlmICghY29tcG9zZXIuaW5pdCgpKSB7Ci0gKiAgICAgICAgIC8vIERvIHNvbWV0aGluZyBoYW5kbGluZyB0aGUgc2l0dWF0aW9uLgotICogICAgICAgICByZXR1cm47Ci0gKiAgICAgfQotICogICAgIHdoaWxlICghY29tcG9zZXIuaXNBZnRlckxhc3QoKSkgewotICogICAgICAgICBpZiAobUNhbmNlbGVkKSB7Ci0gKiAgICAgICAgICAgICAvLyBBc3N1bWUgYSB1c2VyIG1heSBjYW5jZWwgdGhpcyBvcGVyYXRpb24gZHVyaW5nIHRoZSBleHBvcnQuCi0gKiAgICAgICAgICAgICByZXR1cm47Ci0gKiAgICAgICAgIH0KLSAqICAgICAgICAgaWYgKCFjb21wb3Nlci5jcmVhdGVPbmVFbnRyeSgpKSB7Ci0gKiAgICAgICAgICAgICAvLyBEbyBzb21ldGhpbmcgaGFuZGxpbmcgdGhlIGVycm9yIHNpdHVhdGlvbi4KLSAqICAgICAgICAgICAgIHJldHVybjsKLSAqICAgICAgICAgfQotICogICAgIH0KLSAqIH0gZmluYWxseSB7Ci0gKiAgICA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bG9zZSB0aGlzLgotICAgICAgICBwcml2YXRlIFdyaXRlciBtV3JpdGVyOwotCi0gICAgICAgIC8qKgotICAgICAgICAgKiBJbnB1dCBzdHJlYW0gd2lsbCBiZSBjbG9zZWQgb24gdGhlIGRldHJ1Y3Rpb24gb2YgdGhpcyBvYmplY3QuCi0gICAgICAgICAqLwotICAgICAgICBwdWJsaWMgSGFuZGxlckZvck91dHB1dFN0cmVhbShmaW5hbCBPdXRwdXRTdHJlYW0gb3V0cHV0U3RyZWFtKSB7Ci0gICAgICAgICAgICBtT3V0cHV0U3RyZWFtID0gb3V0cHV0U3RyZWFtOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIGJvb2xlYW4gb25Jbml0KGZpbmFsIENvbnRleHQgY29udGV4dCkgewotICAgICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgICBtV3JpdGVyID0gbmV3IEJ1ZmZlcmVkV3JpdGVyKG5ldyBPdXRwdXRTdHJlYW1Xcml0ZXIoCi0gICAgICAgICAgICAgICAgICAgICAgICBtT3V0cHV0U3RyZWFtLCBtQ2hhcnNldCkpOwotICAgICAgICAgICAgfSBjYXRjaCAoVW5zdXBwb3J0ZWRFbmNvZGluZ0V4Y2VwdGlvbiBlMSkgewotICAgICAgICAgICAgICAgIExvZy5lKExPR19UQUcsICJVbnN1cHBvcnRlZCBjaGFyc2V0OiAiICsgbUNoYXJzZXQpOwotICAgICAgICAgICAgICAgIG1FcnJvclJlYXNvbiA9ICJFbmNvZGluZyBpcyBub3Qgc3VwcG9ydGVkICh1c3VhbGx5IHRoaXMgZG9lcyBub3QgaGFwcGVuISk6ICIKLSAgICAgICAgICAgICAgICAgICAgICAgICsgbUNoYXJzZXQ7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBpZiAobUlzRG9Db01vKSB7Ci0gICAgICAgICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgICAgICAgLy8gQ3JlYXRlIG9uZSBlbXB0eSBlbnRyeS4KLSAgICAgICAgICAgICAgICAgICAgbVdyaXRlci53cml0ZShjcmVhdGVPbmVFbnRyeUludGVybmFsKCItMSIsIG51bGwpKTsKLSAgICAgICAgICAgICAgICB9IGNhdGNoIChWQ2FyZEV4Y2VwdGlvbiBlKSB7Ci0gICAgICAgICAgICAgICAgICAgIExvZy5lKExPR19UQUcsICJWQ2FyZEV4Y2VwdGlvbiBoYXMgYmVlbiB0aHJvd24gZHVyaW5nIG9uIEluaXQoKTogIiArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5nZXRNZXNzYWdlKCkpOwotICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgICAgICAgICAgfSBjYXRjaCAoSU9FeGNlcHRpb24gZSkgewotICAgICAgICAgICAgICAgICAgICBMb2cuZShMT0dfVEFHLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICJJT0V4Y2VwdGlvbiBvY2N1cnJlZCBkdXJpbmcgZXhwb3J0T25lQ29udGFjdERhdGE6ICIKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgZS5nZXRNZXNzYWdlKCkpOwotICAgICAgICAgICAgICAgICAgICBtRXJyb3JSZWFzb24gPSAiSU9FeGNlcHRpb24gb2NjdXJyZWQ6ICIgKyBlLmdldE1lc3NhZ2UoKTsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIGJvb2xlYW4gb25FbnRyeUNyZWF0ZWQoU3RyaW5nIHZjYXJkKSB7Ci0gICAgICAgICAgICB0cnkgewotICAgICAgICAgICAgICAgIG1Xcml0ZXIud3JpdGUodmNhcmQpOwotICAgICAgICAgICAgfSBjYXRjaCAoSU9FeGNlcHRpb24gZSkgewotICAgICAgICAgICAgICAgIExvZy5lKExPR19UQUcsCi0gICAgICAgICAgICAgICAgICAgICAgICAiSU9FeGNlcHRpb24gb2NjdXJyZWQgZHVyaW5nIGV4cG9ydE9uZUNvbnRhY3REYXRhOiAiCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgZS5nZXRNZXNzYWdlKCkpOwotICAgICAgICAgICAgICAgIG1FcnJvclJlYXNvbiA9ICJJT0V4Y2VwdGlvbiBvY2N1cnJlZDogIiArIGUuZ2V0TWVzc2FnZSgpOwotICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIHZvaWQgb25UZXJtaW5hdGUoKSB7Ci0gICAgICAgICAgICBtT25UZXJtaW5hdGVJc0NhbGxlZCA9IHRydWU7Ci0gICAgICAgICAgICBpZiAobVdyaXRlciAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgICAgICAgLy8gRmx1c2ggYW5kIHN5bmMgdGhlIGRhdGEgc28gdGhhdCBhIHVzZXIgaXMgYWJsZSB0byBwdWxsCi0gICAgICAgICAgICAgICAgICAgIC8vIHRoZSBTRENhcmQganVzdCBhZnRlcgotICAgICAgICAgICAgICAgICAgICAvLyB0aGUgZXhwb3J0LgotICAgICAgICAgICAgICAgICAgICBtV3JpdGVyLmZsdXNoKCk7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChtT3V0cHV0U3RyZWFtICE9IG51bGwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAmJiBtT3V0cHV0U3RyZWFtIGluc3RhbmNlb2YgRmlsZU91dHB1dFN0cmVhbSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICgoRmlsZU91dHB1dFN0cmVhbSkgbU91dHB1dFN0cmVhbSkuZ2V0RkQoKS5zeW5jKCk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9IGNhdGNoIChJT0V4Y2VwdGlvbiBlKSB7Ci0gICAgICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIklPRXhjZXB0aW9uIGR1cmluZyBjbG9zaW5nIHRoZSBvdXRwdXQgc3RyZWFtOiAiCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIGUuZ2V0TWVzc2FnZSgpKTsKLSAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewotICAgICAgICAgICAgICAgICAgICBjbG9zZU91dHB1dFN0cmVhbSgpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIHB1YmxpYyB2b2lkIGNsb3NlT3V0cHV0U3RyZWFtKCkgewotICAgICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgICBtV3JpdGVyLmNsb3NlKCk7Ci0gICAgICAgICAgICB9IGNhdGNoIChJT0V4Y2VwdGlvbiBlKSB7Ci0gICAgICAgICAgICAgICAgTG9nLncoTE9HX1RBRywgIklPRXhjZXB0aW9uIGlzIHRocm93biBkdXJpbmcgY2xvc2UoKS4gSWdub3JpbmcuIik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICBAT3ZlcnJpZGUKLSAgICAgICAgcHVibGljIHZvaWQgZmluYWxpemUoKSB7Ci0gICAgICAgICAgICBpZiAoIW1PblRlcm1pbmF0ZUlzQ2FsbGVkKSB7Ci0gICAgICAgICAgICAgICAgb25UZXJtaW5hdGUoKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgIH0KLQotICAgIHByaXZhdGUgZmluYWwgQ29udGV4dCBtQ29udGV4dDsKLSAgICBwcml2YXRlIGZpbmFsIGludCBtVkNhcmRUeXBlOwotICAgIHByaXZhdGUgZmluYWwgYm9vbGVhbiBtQ2FyZUhhbmRsZXJFcnJvcnM7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hc2UoY2hhcnNldCkpIHsKLSAgICAgICAgICAgICAgICBpZiAobUlzRG9Db01vKSB7Ci0gICAgICAgICAgICAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBjaGFyc2V0ID0gQ2hhcnNldFV0aWxzLmNoYXJzZXRGb3JWZW5kb3IoU0hJRlRfSklTLCAiZG9jb21vIikubmFtZSgpOwotICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChVbnN1cHBvcnRlZENoYXJzZXRFeGNlcHRpb24gZSkgewotICAgICAgICAgICAgICAgICAgICAgICAgTG9nLmUoTE9HX1RBRywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkRvQ29Nby1zcGVjaWZpYyBTSElGVF9KSVMgd2FzIG5vdCBmb3VuZC4gIgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArICJVc2UgU0hJRlRfSklTIGFzIGlzLiIpOwotICAgICAgICAgICAgICAgICAgICAgICAgY2hhcnNldCA9IFNISUZUX0pJUzsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBjaGFyc2V0ID0gQ2hhcnNldFV0aWxzLmNoYXJzZXRGb3JWZW5kb3IoU0hJRlRfSklTKS5uYW1lKCk7Ci0gICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKFVuc3VwcG9ydGVkQ2hhcnNldEV4Y2VwdGlvbiBlKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBMb2cuZShMT0dfVEFHLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiQ2FyZWVyLXNwZWNpZmljIFNISUZUX0pJUyB3YXMgbm90IGZvdW5kLiAiCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgIlVzZSBTSElGVF9KSVMgYXMgaXMuIik7Ci0gICAgICAgICAgICAgICAgICAgICAgICBjaGFyc2V0ID0gU0hJRlRfSklTOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIG1DaGFyc2V0ID0gY2hhcnNldDsKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgTG9nLncoTE9HX1RBRywKLSAgICAgICAgICAgICAgICAgICAgICAgICJUaGUgY2hhcnNldCBcIiIgKyBjaGFyc2V0ICsgIlwiIGlzIHVzZWQgd2hpbGUgIgotICAgICAgICAgICAgICAgICAgICAgICAgKyBTSElGVF9KSVMgKyAiIGlzIG5lZWRlZCB0byBiZSB1c2VkLiIpOwotICAgICAgICAgICAgICAgIGlmIChUZXh0VXRpbHMuaXNFbXB0eShjaGFyc2V0KSkgewotICAgICAgICAgICAgICAgICAgICBtQ2hhcnNldCA9IFNISUZUX0pJUzsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICB0cnkgewotICAgICAgICAgICAgICAgICAgICAgICAgY2hhcnNldCA9IENoYXJzZXRVdGlscy5jaGFyc2V0Rm9yVmVuZG9yKGNoYXJzZXQpLm5hbWUoKTsKLSAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoVW5zdXBwb3J0ZWRDaGFyc2V0RXhjZXB0aW9uIGUpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIExvZy5pKExPR19UQUcsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJDYXJlZXItc3BlY2lmaWMgXCIiICsgY2hhcnNldCArICJcIiB3YXMgbm90IGZvdW5kIChhcyB1c3VhbCkuICIKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiVXNlIGl0IGFzIGlzLiIpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIG1DaGFyc2V0ID0gY2hhcnNldDsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICBpZiAoVGV4dFV0aWxzLmlzRW1wdHkoY2hhcnNldCkpIHsKLSAgICAgICAgICAgICAgICBtQ2hhcnNldCA9IFVURl84OwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICB0cnkgewotICAgICAgICAgICAgICAgICAgICBjaGFyc2V0ID0gQ2hhcnNldFV0aWxzLmNoYXJzZXRGb3JWZW5kb3IoY2hhcnNldCkubmFtZSgpOwotICAgICAgICAgICAgICAgIH0gY2F0Y2ggKFVuc3VwcG9ydGVkQ2hhcnNldEV4Y2VwdGlvbiBlKSB7Ci0gICAgICAgICAgICAgICAgICAgIExvZy5pKExPR19UQUcsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIkNhcmVlci1zcGVjaWZpYyBcIiIgKyBjaGFyc2V0ICsgIlwiIHdhcyBub3QgZm91bmQgKGFzIHVzdWFsKS4gIgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgIlVzZSBpdCBhcyBpcy4iKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgbUNoYXJzZXQgPSBjaGFyc2V0OwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgTG9nLmQoTE9HX1RBRywgIlVzZSB0aGUgY2hhcnNldCBcIiIgKyBtQ2hhcnNldCArICJcIiIpOwotICAgIH0KLQotICAgIC8qKgotICAgICAqIE11c3QgYmUgY2FsbGVkIGJlZm9yZSB7QGxpbmsgI2luaXQoKX0uCi0gICAgICovCi0gICAgcHVibGljIHZvaWQgYWRkSGFuZGxlcihPbmVFbnRyeUhhbmRsZXIgaGFuZGxlcikgewotICAgICAgICBpZiAoaGFuZGxlciAhPSBudWxsKSB7Ci0gICAgICAgICAgICBtSGFuZGxlckxpc3QuYWRkKGhhbmRsZXIpOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgLyoqCi0gICAgICogQHJldHVybiBSZXR1cm5zIHRydWUgd2hlbiBpbml0aWF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gICAgICAgICAgZm9yIChPbmVFbnRyeUhhbmRsZXIgaGFuZGxlciA6IG1IYW5kbGVyTGlzdCkgewotICAgICAgICAgICAgICAgIGlmICghaGFuZGxlci5vbkluaXQobUNvbnRleHQpKSB7Ci0gICAgICAgICAgICAgICAgICAgIGZvciAoT25lRW50cnlIYW5kbGVyIGZpbmlzaGVkIDogZmluaXNoZWRMaXN0KSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBmaW5pc2hlZC5vblRlcm1pbmF0ZSgpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAvLyBKdXN0IGlnbm9yZSB0aGUgZmFsc2UgcmV0dXJuZWQgZnJvbSBvbkluaXQoKS4KLSAgICAgICAgICAgIGZvciAoT25lRW50cnlIYW5kbGVyIGhhbmRsZXIgOiBtSGFuZGxlckxpc3QpIHsKLSAgICAgICAgICAgICAgICBoYW5kbGVyLm9uSW5pdChtQ29udGV4dCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICBmaW5hbCBTdHJpbmdbXSBwcm9qZWN0aW9uOwotICAgICAgICBpZiAoQ29udGFjdHMuQ09OVEVOVF9VUkkuZXF1YWxzKGNvbnRlbnRVcmkpIHx8Ci0gICAgICAgICAgICAgICAgQ09OVEFDVFNfVEVTVF9DT05URU5UX1VSSS5lcXVhbHMoY29udGVudFVyaSkpIHsKLSAgICAgICAgICAgIHByb2plY3Rpb24gPSBzQ29udGFjdHNQcm9qZWN0aW9uOwotICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgbUVycm9yUmVhc29uID0gRkFJTFVSRV9SRUFTT05fVU5TVVBQT1JURURfVVJJOwotICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICB9Ci0gICAgICAgIG1DdXJzb3IgPS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kgPSBSYXdDb250YWN0c0VudGl0eS5DT05URU5UX1VSSS5idWlsZFVwb24oKQotICAgICAgICAgICAgICAgICAgICAvLyAuYXBwZW5kUXVlcnlQYXJhbWV0ZXIoImZvcl9leHBvcnRfb25seSIsICIxIikKLSAgICAgICAgICAgICAgICAgICAgLmFwcGVuZFF1ZXJ5UGFyYW1ldGVyKERhdGEuRk9SX0VYUE9SVF9PTkxZLCAiMSIpCi0gICAgICAgICAgICAgICAgICAgIC5idWlsZCgpOwotICAgICAgICAgICAgZmluYWwgU3RyaW5nIHNlbGVjdGlvbiA9IERhdGEuQ09OVEFDVF9JRCArICI9PyI7Ci0gICAgICAgICAgICBmaW5hbCBTdHJpbmdbXSBzZWxlY3Rpb25BcmdzID0gbmV3IFN0cmluZ1tdIHtjb250YWN0SWR9OwotICAgICAgICAgICAgaWYgKGdldEVudGl0eUl0ZXJhdG9yTWV0aG9kICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAvLyBQbGVhc2Ugbm90ZSB0aGF0IHRoaXMgYnJhbmNoIGlzIGV4ZWN1dGVkIGJ5IHVuaXQgdGVzdHMgb25seQotICAgICAgICAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICAgICAgICAgIGVudGl0eUl0ZXJhdG9yID0gKEVudGl0eUl0ZXJhdG9yKWdldEVudGl0eUl0ZXJhdG9yTWV0aG9kLmludm9rZShudWxsLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Db250ZW50UmVzb2x2ZXIsIHVyaSwgc2VsZWN0aW9uLCBzZWxlY3Rpb25BcmdzLCBudWxsKTsKLSAgICAgICAgICAgICAgICB9IGNhdGNoIChJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24gZSkgewotICAgICAgICAgICAgICAgICAgICBMb2cuZShMT0dfVEFHLCAiSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uIGhhcyBiZWVuIHRocm93bjogIiArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5nZXRNZXNzYWdlKCkpOwotICAgICAgICAgICAgICAgIH0gY2F0Y2ggKElsbGVnYWxBY2Nlc3NFeGNlcHRpb24gZSkgewotICAgICAgICAgICAgICAgICAgICBMb2cuZShMT0dfVEFHLCAiSWxsZWdhbEFjY2Vzc0V4Y2VwdGlvbiBoYXMgYmVlbiB0aHJvd246ICIgKwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGUuZ2V0TWVzc2FnZSgpKTsKLSAgICAgICAgICAgICAgICB9IGNhdGNoIChJbnZvY2F0aW9uVGFyZ2V0RXhjZXB0aW9uIGUpIHsKLSAgICAgICAgICAgICAgICAgICAgTG9nLmUoTE9HX1RBRywgIkludm9jYXRpb25UYXJnZXRFeGNlcHRpb24gaGFzIGJlZW4gdGhyb3duOiAiKTsKLSAgICAgICAgICAgICAgICAgICAgU3RhY2tUcmFjZUVsZW1lbnRbXSBzdGFja1RyYWNlRWxlbWVudHMgPSBlLmdldENhdXNlKCkuZ2V0U3RhY2tUcmFjZSgpOwotICAgICAgICAgICAgICAgICAgICBmb3IgKFN0YWNrVHJhY2VFbGVtZW50IGVsZW1lbnQgOiBzdGFja1RyYWNlRWxlbWVudHMpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIExvZy5lKExPR19UQUcsICIgICAgYXQgIiArIGVsZW1lbnQudG9TdHJpbmcoKSk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFZDYXJkRXhjZXB0aW9uKCJJbnZvY2F0aW9uVGFyZ2V0RXhjZXB0aW9uIGhhcyBiZWVuIHRocm93bjogIiArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5nZXRDYXVzZSgpLmdldE1lc3NhZ2UoKSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBlbnRpdHlJdGVyYXRvciA9IFJhd0NvbnRhY3RzLm5ld0VudGl0eUl0ZXJhdG9yKG1Db250ZW50UmVzb2x2ZXIucXVlcnkoCi0gICAgICAgICAgICAgICAgICAgICAgICB1cmksIG51bGwsIHNlbGVjdGlvbiwgc2VsZWN0aW9uQXJncywgbnVsbCkpOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBpZiAoZW50aXR5SXRlcmF0b3IgPT0gbnVsbCkgewotICAgICAgICAgICAgICAgIExvZy5lKExPR19UQUcsICJFbnRpdHlJdGVyYXRvciBpcyBudWxsIik7Ci0gICAgICAgICAgICAgICAgcmV0dXJuICIiOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBpZiAoIWVudGl0eUl0ZXJhdG9yLmhhc05leHQoKSkgewotICAgICAgICAgICAgICAgIExvZy53KExPR19UQUcsICJEYXRhIGRvZXMgbm90IGV4aXN0LiBjb250YWN0SWQ6ICIgKyBjb250YWN0SWQpOwotICAgICAgICAgICAgICAgIHJldHVybiAiIjsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgd2hpbGUgKGVudGl0eUl0ZXJhdG9yLmhhc05leHQoKSkgewotICAgICAgICAgICAgICAgIEVudGl0eSBlbnRpdHkgPSBlbnRpdHlJdGVyYXRvci5uZXh0KCk7Ci0gICAgICAgICAgICAgICAgZm9yIChOYW1lZENvbnRlbnRWYWx1ZXMgbmFtZWRDb250ZW50VmFsdWVzIDogZW50aXR5LmdldFN1YlZhbHVlcygpKSB7Ci0gICAgICAgICAgICAgICAgICAgIENvbnRlbnRWYWx1ZXMgY29udGVudFZhbHVlcyA9IG5hbWVkQ29udGVudFZhbHVlcy52YWx1ZXM7Ci0gICAgICAgICAgICAgICAgICAgIFN0cmluZyBrZXkgPSBjb250ZW50VmFsdWVzLmdldEFzU3RyaW5nKERhdGEuTUlNRVRZUEUpOwotICAgICAgICAgICAgICAgICAgICBpZiAoa2V5ICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIExpc3Q8Q29udGVudFZhbHVlcz4gY29udGVudFZhbHVlc0xpc3QgPQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50VmFsdWVzTGlzdE1hcC5nZXQoa2V5KTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjb250ZW50VmFsdWVzTGlzdCA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudFZhbHVlc0xpc3QgPSBuZXcgQXJyYXlMaXN0PENvbnRlbnRWYWx1ZXM+KCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudFZhbHVlc0xpc3RNYXAucHV0KGtleSwgY29udGVudFZhbHVlc0xpc3QpOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudFZhbHVlc0xpc3QuYWRkKGNvbnRlbnRWYWx1ZXMpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICB9IGZpbmFsbHkgewotICAgICAgICAgICAgaWYgKGVudGl0eUl0ZXJhdG9yICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICBlbnRpdHlJdGVyYXRvci5jbG9zZSgpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgcmV0dXJuIGJ1aWxkVkNhcmQoY29udGVudFZhbHVlc0xpc3RNYXApOwotICAgIH0KLQotICAgIC8qKgotICAgICAqIEJ1aWxkcyBhbmQgcmV0dXJucyB2Q2FyZCB1c2luZyBnaXZlbiBtYXAsIHdob3NlIGtleSBpcyBDT05URU5UX0lURU1fVFlQRSBkZWZpbmVkIGluCi0gICAgICoge0NvbnRhY3RzQ29udHJhY3R9LiBEZXZlbG9wZXJzIGNhbiBvdmVycmlkZSB0aGlzIG1ldGhvZCB0byBjdXN0b21pemUgdGhlIG91dHB1dC4KLSAgICAgKi8KLSAgICBwdWJsaWMgU3RyaW5nIGJ1aWxkVkNhcmQoZmluYWwgTWFwPFN0cmluZywgTGlzdDxDb250ZW50VmFsd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SAgICAgICAgfQotCi0gICAgICAgIGlmIChtQ3Vyc29yICE9IG51bGwpIHsKLSAgICAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICAgICAgbUN1cnNvci5jbG9zZSgpOwotICAgICAgICAgICAgfSBjYXRjaCAoU1FMaXRlRXhjZXB0aW9uIGUpIHsKLSAgICAgICAgICAgICAgICBMb2cuZShMT0dfVEFHLCAiU1FMaXRlRXhjZXB0aW9uIG9uIEN1cnNvciNjbG9zZSgpOiAiICsgZS5nZXRNZXNzYWdlKCkpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgbUN1cnNvciA9IG51bGw7Ci0gICAgICAgIH0KLQotICAgICAgICBtVGVybWluYXRlSXNDYWxsZWQgPSB0cnVlOwotICAgIH0KLQotICAgIEBPdmVycmlkZQotICAgIHB1YmxpYyB2b2lkIGZpbmFsaXplKCkgewotICAgICAgICBpZiAoIW1UZXJtaW5hdGVJc0NhbGxlZCkgewotICAgICAgICAgICAgTG9nLncoTE9HX1RBRywgInRlcm1pbmF0ZSgpIGlzIG5vdCBjYWxsZWQgeWV0LiBXZSBjYWxsIGl0IGluIGZpbmFsaXplKCkgc3RlcC4iKTsKLSAgICAgICAgICAgIHRlcm1pbmF0ZSgpOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgLyoqCi0gICAgICogQHJldHVybiByZXR1cm5zIHRoZSBudW1iZXIgb2YgYXZhaWxhYmxlIGVudGl0aWVzLiBUaGUgcmV0dXJuIHZhbHVlIGlzIHVuZGVmaW5lZAotICAgICAqIHdoZW4gdGhpcyBvYmplY3QgaXMgbm90IHJlYWR5IHlldCAodHlwaWNhbGx5IHdoZW4ge3tAbGluayAjaW5pdCgpfSBpcyBub3QgY2FsbGVkCi0gICAgICogb3Igd2hlbiB7QGxpbmsgI3Rlcm1pbmF0ZSgpfSBpcyBhbHJlYWR5IGNhbGxlZCkuCi0gICAgICovCi0gICAgcHVibGljIGludCBnZXRDb3VudCgpIHsKLSAgICAgICAgaWYgKG1Dd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mVsOwotICAgICAgICAvLyBpc1ByaW1hcnkgaXMgKG5vdCBmaW5hbCBidXQpIGNoYW5nYWJsZSwgb25seSB3aGVuIHRoZXJlJ3Mgbm8gYXBwcm9wcmlhdGUgb25lIGV4aXN0aW5nCi0gICAgICAgIC8vIGluIHRoZSBvcmlnaW5hbCBWQ2FyZC4KLSAgICAgICAgcHVibGljIGJvb2xlYW4gaXNQcmltYXJ5OwotICAgICAgICBwdWJsaWMgUGhvbmVEYXRhKGludCB0eXBlLCBTdHJpbmcgZGF0YSwgU3RyaW5nIGxhYmVsLCBib29sZWFuIGlzUHJpbWFyeSkgewotICAgICAgICAgICAgdGhpcy50eXBlID0gdHlwZTsKLSAgICAgICAgICAgIHRoaXMuZGF0YSA9IGRhdGE7Ci0gICAgICAgICAgICB0aGlzLmxhYmVsID0gbGFiZWw7Ci0gICAgICAgICAgICB0aGlzLmlzUHJpbWFyeSA9IGlzUHJpbWFyeTsKLSAgICAgICAgfQotCi0gICAgICAgIEBPdmVycmlkZQotICAgICAgICBwdWJsaWMgYm9vbGVhbiBlcXVhbHMoT2JqZWN0IG9iaikgewotICAgICAgICAgICAgaWYgKCEob2JqIGluc3RhbmNlb2YgUGhvbmVEYXRhKSkgewotICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIFBob25lRGF0YSBwaG9uZURhdGEgPSAoUGhvbmVEYXRhKW9iajsKLSAgICAgICAgICAgIHJldHVybiAodHlwZSA9PSBwaG9uZURhdGEudHlwZSAmJiBkYXRhLmVxdWFscyhwaG9uZURhdGEuZGF0YSkgJiYKLSAgICAgICAgICAgICAgICAgICAgbGFiZWwuZXF1YWxzKHBob25lRGF0YS5sYWJlbCkgJiYgaXNQcmltYXJ5ID09IHBob25lRGF0YS5pc1ByaW1hcnkpOwotICAgICAgICB9Ci0KLSAgICAgICAgQE92ZXJyaWRlCi0gICAgICAgIHB1YmxpYyBTdHJpbmcgdG9TdHJpbmcoK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IHJlZ2lvbjsKLSAgICAgICAgcHVibGljIGZpbmFsIFN0cmluZyBwb3N0YWxDb2RlOwotICAgICAgICBwdWJsaWMgZmluYWwgU3RyaW5nIGNvdW50cnk7Ci0gICAgICAgIHB1YmxpYyBmaW5hbCBpbnQgdHlwZTsKLSAgICAgICAgcHVibGljIGZpbmFsIFN0cmluZyBsYWJlbDsKLSAgICAgICAgcHVibGljIGJvb2xlYW4gaXNQcmltYXJ5OwotCi0gICAgICAgIHB1YmxpYyBQb3N0YWxEYXRhKGZpbmFsIGludCB0eXBlLCBmaW5hbCBMaXN0PFN0cmluZz4gcHJvcFZhbHVlTGlzdCwKLSAgICAgICAgICAgICAgICBmaW5hbCBTdHJpbmcgbGFiZWwsIGJvb2xlYW4gaXNQcmltYXJ5KSB7Ci0gICAgICAgICAgICB0aGlzLnR5cGUgPSB0eXBlOwotICAgICAgICAgICAgZGF0YUFycmF5ID0gbmV3IFN0cmluZ1tBRERSX01BWF9EQVRBX1NJWkVdOwotCi0gICAgICAgICAgICBpbnQgc2l6ZSA9IHByb3BWYWx1ZUxpc3Quc2l6ZSgpOwotICAgICAgICAgICAgaWYgKHNpemUgPiBBRERSX01BWF9EQVRBX1NJWkUpIHsKLSAgICAgICAgICAgICAgICBzaXplID0gQUREUl9NQVhfREFUQV9TSVpFOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAvLyBhZHItdmFsdWUgPSAwKjYodGV4dC12YWx1ZSAiOyIpIHRleHQtdmFsdWUKLSAgICAgICAgICAgIC8vICAgICAgICAgICA7IFBPIEJveCwgRXh0ZW5kZWQgQWRkcmVzcywgU3RyZWV0LCBMb2NhbGl0eSwgUmVnaW9uLCBQb3N0YWwKLSAgICAgICAgICAgIC8vICAgICAgICAgICA7IENvZGUsIENvdW50cnkgTmFtZQotICAgICAgICAgICAgLy8KLSAgICAgICAgICAgIC8vIFVzZSBJdGVyYXRvciBhc3N1bWluZyBMaXN0IG1heSBiZSBMaW5rZWRMaXN0LCB0aG91Z2ggYWN0dWFsbHkgaXQgaXMKLSAgICAgICAgICAgIC8vIGFsd2F5cyBBcnJheUxpc3QgaW4gdGhlIGN1cnJlbnQgaW1wbGVtZW50YXRpb24uCi0gICAgICAgICAgICBpbnQgaSA9IDA7Ci0gICAgICAgICAgICBmb3IgKFN0cmluZyBhZGRyZXNzRWxlbWVudCA6IHByb3BWYWx1ZUxpc3QpIHsKLSAgICAgICAgICAgICAgICBkYXRhQXJyYXlbaV0gPSBhZGRyZXNzRWxlbWVudDsKLSAgICAgICAgICAgICAgICBpZiAoKytpID49IHNpemUpIHsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICAgICAgd2hpbGUgKGkgPCBBRERSX01BWF9EQVRBX1NJWkUpIHsKLSAgICAgICAgICAgICAgICBkYXRhQXJyYXlbaSsrXSA9IG51bGw7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIHRoaXMucG9ib3ggPSBkYXRhQXJyYXlbMF07Ci0gICAgICAgICAgICB0aGlzLmV4dGVuZGVkQWRkcmVzcyA9IGRhdGFBcnJheVsxXTsKLSAgICAgICAgICAgIHRoaXMuc3RyZWV0ID0gZGF0YUFycmF5WzJdOwotICAgICAgICAgICAgdGhpcy5sb2NhbHR5ID0gZGF0YUFycmF5WzNdOwotICAgICAgICAgICAgdGhpcy5yZWdpb24gPSBkYXRhQXJyYXlbNF07Ci0gICAgICAgICAgICB0aGlzLnBvc3RhbENvZGUgPSBkYXRhQXJyYXlbNV07Ci0gICAgICAgICAgICB0aGlzLmNvdW50cnkgPSBkYXRhQXJyYXlbNl07Ci0gICAgICAgICAgICB0aGlzLmxhYmVsID0gbGFiZWw7Ci0gICAgICAgICAgICB0aGlzLmlzUHJpbWFyeSA9IGlzUHJpbWFyeTsKLSAgICAgICAgfQotCi0gICAgICAgIEBPdmVycmlkZQotICAgICAgICBwdWJsaWMgYm9vbGVhbiBlcXVhbHMoT2JqZWN0IG9iaikgewotICAgICAgICAgICAgaWYgKCEob2JqIGluc3RhbmNlb2YgUG9zdGFsRGF0YSkpIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBmaW5hbCBQb3N0YWxEYXRhIHBvc3RhbERhdGEgPSAoUG9zdGFsRGF0YSlvYmo7Ci0gICAgICAgICAgICByZXR1cm4gKEFycmF5cy5lcXVhbHMoZGF0YUFycmF5LCBwb3N0YWxEYXRhLmRhdGFBcnJheSkgJiYKLSAgICAgICAgICAgICAgICAgICAgKHR5cGUgPT0gcG9zdGFsRGF0YS50eXBlICYmCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgKHR5cGUgPT0gU3RydWN0dXJlZFBvc3RhbC5UWVBFX0NVU1RPTSA/Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAobGFiZWwgPT0gcG9zdGFsRGF0YS5sYWJlbCkgOiB0cnVlKSkgJiYKLSAgICAgICAgICAgICAgICAgICAgKGlzUHJpbWFyeSA9PSBwb3N0YWxEYXRhLmlzUHJpbWFyeSkpOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIFN0cmluZyBnZXRGb3JtYXR0ZWRBZGRyZXNzKGZpbmFsIGludCB2Y2FyZFR5cGUpIHsKLSAgICAgICAgICAgIFN0cmluZ0J1aWxkZXIgYnVpbGRlciA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7Ci0gICAgICAgICAgICBib29sZWFuIGVtcHR5ID0gdHJ1ZTsKLSAgICAgICAgICAgIGlmIChWQ2FyZENvbmZpZy5pc0phcGFuZXNlRGV2aWNlKHZjYXJkVHlwZSkpIHsKLSAgICAgICAgICAgICAgICAvLyBJbiBKYXBhbiwgdGhlIG9yZGVyIGlzIHJldmVyc2VkLgotICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSBBRERSX01BWF9EQVRBX1NJWkUgLSAxOyBpID49IDA7IGktLSkgewotICAgICAgICAgICAgICAgICAgICBTdHJpbmcgYWRkcmVzc1BhcnQgPSBkYXRhQXJyYXlbaV07Ci0gICAgICAgICAgICAgICAgICAgIGlmICghVGV4dFV0aWxzLmlzRW1wdHkoYWRkcmVzc1BhcnQpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWVtcHR5KSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQoJyAnKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZW1wdHkgPSBmYWxzZTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kKGFkZHJlc3NQYXJ0KTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBBRERSX01BWF9EQVRBX1NJWkU7IGkrKykgewotICAgICAgICAgICAgICAgICAgICBTdHJpbmcgYWRkcmVzc1BhcnQgPSBkYXRhQXJyYXlbaV07Ci0gICAgICAgICAgICAgICAgICAgIGlmICghVGV4dFV0aWxzLmlzRW1wdHkoYWRkcmVzc1BhcnQpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWVtcHR5KSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQoJyAnKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZW1wdHkgPSBmYWxzZTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kKGFkZHJlc3NQYXJ0KTsKLSAgICAgICAgICAgICAgICAgICAgfQ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aW9uRGF0YShpbnQgdHlwZSwKLSAgICAgICAgICAgICAgICBmaW5hbCBTdHJpbmcgY29tcGFueU5hbWUsCi0gICAgICAgICAgICAgICAgZmluYWwgU3RyaW5nIGRlcGFydG1lbnROYW1lLAotICAgICAgICAgICAgICAgIGZpbmFsIFN0cmluZyB0aXRsZU5hbWUsCi0gICAgICAgICAgICAgICAgZmluYWwgU3RyaW5nIHBob25ldGljTmFtZSwKLSAgICAgICAgICAgICAgICBmaW5hbCBib29sZWFuIGlzUHJpbWFyeSkgewotICAgICAgICAgICAgdGhpcy50eXBlID0gdHlwZTsKLSAgICAgICAgICAgIHRoaXMuY29tcGFueU5hbWUgPSBjb21wYW55TmFtZTsKLSAgICAgICAgICAgIHRoaXMuZGVwYXJ0bWVudE5hbWUgPSBkZXBhcnRtZW50TmFtZTsKLSAgICAgICAgICAgIHRoaXMudGl0bGVOYW1lID0gdGl0bGVOYW1lOwotICAgICAgICAgICAgdGhpcy5waG9uZXRpY05hbWUgPSBwaG9uZXRpY05hbWU7Ci0gICAgICAgICAgICB0aGlzLmlzUHJpbWFyeSA9IGlzUHJpbWFyeTsKLSAgICAgICAgfQotCi0gICAgICAgIEBPdmVycmlkZQotICAgICAgICBwdWJsaWMgYm9vbGVhbiBlcXVhbHMoT2JqZWN0IG9iaikgewotICAgICAgICAgICAgaWYgKCEob2JqIGluc3RhbmNlb2YgT3JnYW5pemF0aW9uRGF0YSkpIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBPcmdhbml6YXRpb25EYXRhIG9yZ2FuaXphdGlvbiA9IChPcmdhbml6YXRpb25EYXRhKW9iajsKLSAgICAgICAgICAgIHJldHVybiAodHlwZSA9PSBvcmdhbml6YXRpb24udHlwZSAmJgotICAgICAgICAgICAgICAgICAgICBUZXh0VXRpbHMuZXF1YWxzKGNvbXBhbnlOYW1lLCBvcmdhbml6YXRpb24uY29tcGFueU5hbWUpICYmCi0gICAgICAgICAgICAgICAgICAgIFRleHRVdGlscy5lcXVhbHMoZGVwYXJ0bWVudE5hbWUsIG9yZ2FuaXphdGlvbi5kZXBhcnRtZW50TmFtZSkgJiYKLSAgICAgICAgICAgICAgICAgICAgVGV4dFV0aWxzLmVxdWFscyh0aXRsZU5hbWUsIG9yZ2FuaXphdGlvbi50aXRsZU5hbWUpICYmCi0gICAgICAgICAgICAgICAgICAgIGlzUHJpbWFyeSA9PSBvcmdhbml6YXRpb24uaXNQcmltYXJ5KTsKLSAgICAgICAgfQotCi0gICAgICAgIHB1YmxpYyBTdHJpbmcgZ2V0Rm9ybWF0dGVkU3RyaW5nKCkgewotICAgICAgICAgICAgZmluYWwgU3RyaW5nQnVpbGRlciBidWlsZGVyID0gbmV3IFN0cmluZ0J1aWxkZXIoKTsKLSAgICAgICAgICAgIGlmICghVGV4dFV0aWxzLmlzRW1wdHkoY29tcGFueU5hbWUpKSB7Ci0gICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQoY29tcGFueU5hbWUpOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBpZiAoIVRleHRVdGlscy5pc0VtcHR5KGRlcGFydG1lbnROYW1lKSkgewotICAgICAgICAgICAgICAgIGlmIChidWlsZGVyLmxlbmd0aCgpID4gMCkgewotICAgICAgICAgICAgICAgICAgICBidWlsZGVyLmFwcGVuZCgiLCAiKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQoZGVwYXJ0bWVudE5hbWUpOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBpZiAoIVRleHRVdGlscy5pc0VtcHR5KHRpdGxlTmFtZSkpIHsKLSAgICAgICAgICAgICAgICBpZiAoYnVpbGRlci5sZW5ndGgoKSA+IDApIHsKLSAgICAgICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQoIiwgIik7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGJ1aWxkZXI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ICAgICAgICAgICB0aGlzLnR5cGUgPSB0eXBlOwotICAgICAgICAgICAgdGhpcy5kYXRhID0gZGF0YTsKLSAgICAgICAgICAgIHRoaXMuaXNQcmltYXJ5ID0gaXNQcmltYXJ5OwotICAgICAgICB9Ci0KLSAgICAgICAgQE92ZXJyaWRlCi0gICAgICAgIHB1YmxpYyBib29sZWFuIGVxdWFscyhPYmplY3Qgb2JqKSB7Ci0gICAgICAgICAgICBpZiAoIShvYmogaW5zdGFuY2VvZiBJbURhdGEpKSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgSW1EYXRhIGltRGF0YSA9IChJbURhdGEpb2JqOwotICAgICAgICAgICAgcmV0dXJuICh0eXBlID09IGltRGF0YS50eXBlICYmIHByb3RvY29sID09IGltRGF0YS5wcm90b2NvbAotICAgICAgICAgICAgICAgICAgICAmJiAoY3VzdG9tUHJvdG9jb2wgIT0gbnVsbCA/IGN1c3RvbVByb3RvY29sLmVxdWFscyhpbURhdGEuY3VzdG9tUHJvdG9jb2wpIDoKLSAgICAgICAgICAgICAgICAgICAgICAgIChpbURhdGEuY3VzdG9tUHJvdG9jb2wgPT0gbnVsbCkpCi0gICAgICAgICAgICAgICAgICAgICYmIChkYXRhICE9IG51bGwgPyBkYXRhLmVxdWFscyhpbURhdGEuZGF0YSkgOiAoaW1EYXRhLmRhdGEgPT0gbnVsbCkpCi0gICAgICAgICAgICAgICAgICAgICYmIGlzUHJpbWFyeSA9PSBpbURhdGEuaXNQcmltYXJ5KTsKLSAgICAgICAgfQotCi0gICAgICAgIEBPdmVycmlkZQotICAgICAgICBwdWJsaWMgU3RyaW5nIHRvU3RyaW5nKCkgewotICAgICAgICAgICAgcmV0dXJuIFN0cmluZy5mb3JtYXQoCi0gICAgICAgICAgICAgICAgICAgICJ0eXBlOiAlZCwgcHJvdG9jb2w6ICVkLCBjdXN0b21fcHJvdGNvbDogJXMsIGRhdGE6ICVzLCBpc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ICAgICAgIFBob3RvRGF0YSBwaG90b0RhdGEgPSAoUGhvdG9EYXRhKW9iajsKLSAgICAgICAgICAgIHJldHVybiAodHlwZSA9PSBwaG90b0RhdGEudHlwZSAmJgotICAgICAgICAgICAgICAgICAgICAoZm9ybWF0TmFtZSA9PSBudWxsID8gKHBob3RvRGF0YS5mb3JtYXROYW1lID09IG51bGwpIDoKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3JtYXROYW1lLmVxdWFscyhwaG90b0RhdGEuZm9ybWF0TmFtZSkpICYmCi0gICAgICAgICAgICAgICAgICAgIChBcnJheXMuZXF1YWxzKHBob3RvQnl0ZXMsIHBob3RvRGF0YS5waG90b0J5dGVzKSkgJiYKLSAgICAgICAgICAgICAgICAgICAgKGlzUHJpbWFyeSA9PSBwaG90b0RhdGEuaXNQcmltYXJ5KSk7Ci0gICAgICAgIH0KLQotICAgICAgICBAT3ZlcnJpZGUKLSAgICAgICAgcHVibGljIFN0cmluZyB0b1N0cmluZygpIHsKLSAgICAgICAgICAgIHJldHVybiBTdHJpbmcuZm9ybWF0KCJ0eXBlOiAlZCwgZm9ybWF0OiAlczogc2l6ZTogJWQsIGlzUHJpbWFyeTogJXMiLAotICAgICAgICAgICAgICAgICAgICB0eXBlLCBmb3JtYXROYW1lLCBwaG90b0J5dGVzLmxlbmd0aCwgaXNQcmltYXJ5KTsKLSAgICAgICAgfQotICAgIH0KLQotICAgIC8qIHBhY2thZ2UgKi8gc3RhdGljIGNsYXNzIFByb3BlcnR5IHsKLSAgICAgICAgcHJpdmF0ZSBTdHJpbmcgbVByb3BlcnR5TmFtZTsKLSAgICAgICAgcHJpdmF0ZSBNYXA8U3RyaW5nLCBDb2xsZWN0aW9uPFN0cmluZz4+IG1QYXJhbWV0ZXJNYXAgPQotICAgICAgICAgICAgbmV3IEhhc2hNYXA8U3RyaW5nLCBDb2xsZWN0aW9uPFN0cmluZz4+KCk7Ci0gICAgICAgIHByaXZhdGUgTGlzdDxTdHJpbmc+IG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LSAgICAgICAgZmluYWwgaW50IHNpemUgPSBvcmdMaXN0LnNpemUoKTsKLSAgICAgICAgc3dpdGNoIChzaXplKSB7Ci0gICAgICAgICAgICBjYXNlIDA6IHsKLSAgICAgICAgICAgICAgICBjb21wYW55TmFtZSA9ICIiOwotICAgICAgICAgICAgICAgIGRlcGFydG1lbnROYW1lID0gbnVsbDsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGNhc2UgMTogewotICAgICAgICAgICAgICAgIGNvbXBhbnlOYW1lID0gb3JnTGlzdC5nZXQoMCk7Ci0gICAgICAgICAgICAgICAgZGVwYXJ0bWVudE5hbWUgPSBudWxsOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZGVmYXVsdDogeyAgLy8gTW9yZSB0aGFuIDEuCi0gICAgICAgICAgICAgICAgY29tcGFueU5hbWUgPSBvcmdMaXN0LmdldCgwKTsKLSAgICAgICAgICAgICAgICAvLyBXZSdyZSBub3Qgc3VyZSB3aGljaCBpcyB0aGUgY29ycmVjdCBzdHJpbmcgZm9yIGRlcGFydG1lbnQuCi0gICAgICAgICAgICAgICAgLy8gSW4gb3JkZXIgdG8ga2VlcCBhbGwgdGhlIGRhdGEsIGNvbmNhdGluYXRlIHRoZSByZXN0IG9mIGVsZW1lbnRzLgotICAgICAgICAgICAgICAgIFN0cmluZ0J1aWxkZXIgYnVpbGRlciA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7Ci0gICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDE7IGkgPCBzaXplOyBpKyspIHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKGkgPiAxKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBidWlsZGVyLmFwcGVuZCgnICcpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kKG9yZ0xpc3QuZ2V0KGk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ICAgICAgICEoVGV4dFV0aWxzLmlzRW1wdHkobVBob25ldGljRmFtaWx5TmFtZSkgJiYKLSAgICAgICAgICAgICAgICAgICAgICAgIFRleHRVdGlscy5pc0VtcHR5KG1QaG9uZXRpY01pZGRsZU5hbWUpICYmCi0gICAgICAgICAgICAgICAgICAgICAgICBUZXh0VXRpbHMuaXNFbXB0eShtUGhvbmV0aWNHaXZlbk5hbWUpKSkgewotICAgICAgICAgICAgcmV0dXJuOwotICAgICAgICB9Ci0KLSAgICAgICAgZmluYWwgQ29sbGVjdGlvbjxTdHJpbmc+IHNvcnRBc0NvbGxlY3Rpb24gPSBwYXJhbU1hcC5nZXQoVkNhcmRDb25zdGFudHMuUEFSQU1fU09SVF9BUyk7Ci0gICAgICAgIGlmIChzb3J0QXNDb2xsZWN0aW9uICE9IG51bGwgJiYgc29ydEFzQ29sbGVjdGlvbi5zaXplKCkgIT0gMCkgewotICAgICAgICAgICAgaWYgKHNvcnRBc0NvbGxlY3Rpb24uc2l6ZSgpID4gMSkgewotICAgICAgICAgICAgICAgIExvZy53KExPR19UQUcsICJJbmNvcnJlY3QgbXVsdGlwbGUgU09SVF9BUyBwYXJhbWV0ZXJzIGRldGVjdGVkOiAiICsKLSAgICAgICAgICAgICAgICAgICAgICAgIEFycmF5cy50b1N0cmluZyhzb3J0QXNDb2xsZWN0aW9uLnRvQXJyYXkoKSkpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZmluYWwgTGlzdDxTdHJpbmc+IHNvcnROYW1lcyA9Ci0gICAgICAgICAgICAgICAgICAgIFZDYXJkVXRpbHMuY29uc3RydWN0TGlzdEZyb21WYWx1ZShzb3J0QXNDb2xsZWN0aW9uLml0ZXJhdG9yKCkubmV4dCgpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1WQ2FyZFR5cGUpOwotICAgICAgICAgICAgaW50IHNpemUgPSBzb3J0TmFtZXMuc2l6ZSgpOwotICAgICAgICAgICAgaWYgKHNpemUgPiAzKSB7Ci0gICAgICAgICAgICAgICAgc2l6ZSA9IDM7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBzd2l0Y2ggKHNpemUpIHsKLSAgICAgICAgICAgIGNhc2UgMzogbVBob25ldGljTWlkZGxlTmFtZSA9IHNvcnROYW1lcy5nZXQoMik7IC8vJEZBTEwtVEhST1VHSCQKLSAgICAgICAgICAgIGNhc2UgMjogbVBob25ldGljR2l2ZW5OYW1lID0gc29ydE5hbWVzLmdldCgxKTsgLy8kRkFMTC1USFJPVUdIJAotICAgICAgICAgICAgZGVmYXVsdDogbVBob25ldGljRmFtaWx5TmFtZSA9IHNvcnROYW1lcy5nZXQoMCk7IGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgfQotCi0gICAgQFN1cHByZXNzV2FybmluZ3MoImZhbGx0aHJvdWdoIikKLSAgICBwcml2YXRlIHZvaWQgaGFuZGxlTlByb3BlcnR5KGZpbmFsIExpc3Q8U3RyaW5nPiBwYXJhbVZhbHVlcywKLSAgICAgICAgICAgIE1hcDxTdHJpbmcsIENvbGxlY3Rpb248U3RyaW5nPj4gcGFyYW1NYXApIHsKLSAgICAgICAgLy8gaW4gdkNhcmQgNC4wLCBTT1JULUFTIHBhcmFtZXRlciBpcyBhdmFpbGFibGUuCi0gICAgICAgIHRyeUhhbmRsZVNvcnRBc05hbWUocGFyYW1NYXApOwotCi0gICAgICAgIC8vIEZhbWlseSwgR2l2ZW4sIE1pZGRsZSwgUHJlZml4LCBTdWZmaXguICgxIC0gNSkKLSAgICAgICAgaW50IHNpemU7Ci0gICAgICAgIGlmIChwYXJhbVZhbHVlcyA9PSBudWxsIHx8IChzaXplID0gcGFyYW1WYWx1ZXMuc2l6ZSgpKSA8IDEpIHsKLSAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgfQotICAgICAgICBpZiAoc2l6ZSA+IDUpIHsKLSAgICAgICAgICAgIHNpemUgPSA1OwotICAgICAgICB9Ci0KLSAgICAgICAgc3dpdGNoIChz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AgICAgfQotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKG9ubHlGaXJzdEVsZW1Jc05vbkVtcHR5KSB7Ci0gICAgICAgICAgICAgICAgZmluYWwgU3RyaW5nW10gbmFtZXNBcnJheSA9IGVsZW1zLmdldCgwKS5zcGxpdCgiICIpOwotICAgICAgICAgICAgICAgIGZpbmFsIGludCBuYW1lQXJyYXlMZW5ndGggPSBuYW1lc0FycmF5Lmxlbmd0aDsKLSAgICAgICAgICAgICAgICBpZiAobmFtZUFycmF5TGVuZ3RoID09IDMpIHsKLSAgICAgICAgICAgICAgICAgICAgLy8gQXNzdW1lIHRoZSBzdHJpbmcgaXMgIkZhbWlseSBNaWRkbGUgR2l2ZW4iLgotICAgICAgICAgICAgICAgICAgICBtUGhvbmV0aWNGYW1pbHlOYW1lID0gbmFtZXNBcnJheVswXTsKLSAgICAgICAgICAgICAgICAgICAgbVBob25ldGljTWlkZGxlTmFtZSA9IG5hbWVzQXJyYXlbMV07Ci0gICAgICAgICAgICAgICAgICAgIG1QaG9uZXRpY0dpdmVuTmFtZSA9IG5hbWVzQXJyYXlbMl07Ci0gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChuYW1lQXJyYXlMZW5ndGggPT0gMikgewotICAgICAgICAgICAgICAgICAgICAvLyBBc3N1bWUgdGhlIHN0cmluZyBpcyAiRmFtaWx5IEdpdmVuIiBiYXNlZCBvbiB0aGUgSmFwYW5lc2UgbW9iaWxlCi0gICAgICAgICAgICAgICAgICAgIC8vIHBob25lcycgcHJlZmVyZW5jZS4KLSAgICAgICAgICAgICAgICAgICAgbVBob25ldGljRmFtaWx5TmFtZSA9IG5hbWVzQXJyYXlbMF07Ci0gICAgICAgICAgICAgICAgICAgIG1QaG9uZXRpY0dpdmVuTmFtZSA9IG5hbWVzQXJyYXlbMV07Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgbVBob25ldGljRnVsbE5hbWUgPSBlbGVtcy5nZXQ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HlwZSk7Ci0gICAgICAgICAgICAgICAgaGFuZGxlUGhvbmV0aWNOYW1lRnJvbVNvdW5kKHBob25ldGljTmFtZUxpc3QpOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAvLyBJZ25vcmUgdGhpcyBmaWVsZCBzaW5jZSBBbmRyb2lkIGNhbm5vdCB1bmRlcnN0YW5kIHdoYXQgaXQgaXMuCi0gICAgICAgICAgICB9Ci0gICAgICAgIH0gZWxzZSBpZiAocHJvcE5hbWUuZXF1YWxzKFZDYXJkQ29uc3RhbnRzLlBST1BFUlRZX0FEUikpIHsKLSAgICAgICAgICAgIGJvb2xlYW4gdmFsdWVzQXJlQWxsRW1wdHkgPSB0cnVlOwotICAgICAgICAgICAgZm9yIChTdHJpbmcgdmFsdWUgOiBwcm9wVmFsdWVMaXN0KSB7Ci0gICAgICAgICAgICAgICAgaWYgKHZhbHVlLmxlbmd0aCgpID4gMCkgewotICAgICAgICAgICAgICAgICAgICB2YWx1ZXNBcmVBbGxFbXB0eSA9IGZhbHNlOwotICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAodmFsdWVzQXJlQWxsRW1wdHkpIHsKLSAgICAgICAgICAgICAgICByZXR1cm47Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGludCB0eXBlID0gLTE7Ci0gICAgICAgICAgICBTdHJpbmcgbGFiZWwgPSAiIjsKLSAgICAgICAgICAgIGJvb2xlYW4gaXNQcmltYXJ5ID0gZmFsc2U7Ci0gICAgICAgICAgICBDb2xsZWN0aW9uPFN0cmluZz4gdHlwZUNvbGxlY3Rpb24gPSBwYXJhbU1hcC5nZXQoVkNhcmRDb25zdGFudHMuUEFSQU1fVFlQRSk7Ci0gICAgICAgICAgICBpZiAodHlwZUNvbGxlY3Rpb24gIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIGZvciAoU3RyaW5nIHR5cGVTdHJpbmcgOiB0eXBlQ29sbGVjdGlvbikgewotICAgICAgICAgICAgICAgICAgICB0eXBlU3RyaW5nID0gdHlwZVN0cmluZy50b1VwcGVyQ2FzZSgpOwotICAgICAgICAgICAgICAgICAgICBpZiAodHlwZVN0cmluZy5lcXVhbHMoVkNhcmRDb25zdGFudHMuUEFSQU1fVFlQRV9QUkVGKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgaXNQcmltYXJ5ID0gdHJ1ZTsKLSAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICh0eXBlU3RyaW5nLmVxdWFscyhWQ2FyZENvbnN0YW50cy5QQVJBTV9UWVBFX0hPTUUpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICB0eXBlID0gU3RydWN0dXJlZFBvc3RhbC5UWVBFX0hPTUU7Ci0gICAgICAgICAgICAgICAgICAgICAgICBsYWJlbCA9ICIiOwotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHR5cGVTdHJpbmcuZXF1YWxzKFZDYXJkQ29uc3RhbnRzLlBBUkFNX1RZUEVfV09SSykgfHwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlU3RyaW5nLmVxdWFsc0lnbm9yZUNhc2UoVkNhcmRDb25zdGFudHMuUEFSQU1fRVhUUkFfVFlQRV9DT01QQU5ZKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgLy8gIkNPTVBBTlkiIHNlZW1zIGVtaXR0ZWQgYnkgV2luZG93cyBNb2JpbGUsIHdoaWNoIGlzIG5vdAotICAgICAgICAgICAgICAgICAgICAgICAgLy8gc3BlY2lmaWNhbGx5IHN1cHBvcnRlZCBieSB2Q2FyZCAyLjEuIFdlIGFzc3VtZSB0aGlzIGlzIHNhbWUKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIGFzICJXT1JLIi4KLSAgICAgICAgICAgICAgICAgICAgICAgIHR5cGUgPSBTdHJ1Y3R1cmVkUG9zdGFsLlRZUEVfV09SSzsKLSAgICAgICAgICAgICAgICAgICAgICAgIGxhYmVsID0gIiI7Ci0gICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAodHlwZVN0cmluZy5lcXVhbHMoVkNhcmRDb25zdGFudHMuUEFSQU1fQURSX1RZUEVfUEFSQ0VMKSB8fAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGVTdHJpbmcuZXF1YWxzKFZDYXJkQ29uc3RhbnRzLlBBUkFNX0FEUl9UWVBFX0RPTSkgfHwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlU3RyaW5nLmVxdWFscyhWQ2FyZENvbnN0YW50cy5QQVJBTV9BRFJfVFlQRV9JTlRMKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgLy8gV2UgZG8gbm90IGhhdmUgYW55IGFwcHJvcHJpYXRlIHdheSB0byBzdG9yZSB0aGlzIGluZm9ybWF0aW9uLgotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVTdHJpbmcuc3RhcnRzV2l0aCgiWC0iKSAmJiB0eXBlIDwgMCkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGVTdHJpbmcgPSB0eXBlU3RyaW5nLnN1YnN0cmluZygyKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIHZDYXJkIDMuMCBhbGxvd3MgaWFuYS10b2tlbi4gQWxzbyBzb21lIHZDYXJkIDIuMSBleHBvcnRlcnMKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIGVtaXQgbm9uLXN0YW5kYXJkIHR5cGVzLiBXZSBkbyBub3QgaGFuZGxlIHRoZWlyIHZhbHVlcyBub3cuCi0gICAgICAgICAgICAgICAgICAgICAgICB0eXBlID0gU3RydWN0dXJlZFBvc3RhbC5UWVBFX0NVU1RPTTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGxhYmVsID0gdHlwZVN0cmluZzsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIC8vIFdlIHVzZSAiSE9NRSIgYXMgZGVmYXVsdAotICAgICAgICAgICAgaWYgKHR5cGUgPCAwKSB7Ci0gICAgICAgICAgICAgICAgdHlwZSA9IFN0cnVjdHVyZWRQb3N0YWwuVFlQRV9IT01FOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBhZGRQb3N0YWwodHlwZSwgcHJvcFZhbHVlTGlzdCwgbGFiZWwsIGlzUHJpbWFyeSk7Ci0gICAgICAgIH0gZWxzZSBpZiAocHJvcE5hbWUuZXF1YWxzKFZDYXJkQ29uc3RhbnRzLlBST1BFUlRZX0VNQUlMKSkgewotICAgICAgICAgICAgaW50IHR5cGUgPSAtMTsKLSAgICAgICAgICAgIFN0cmluZyBsYWJlbCA9IG51bGw7Ci0gICAgICAgICAgICBib29sZWFuIGlzUHJpbWFyeSA9IGZhbHNlOwotICAgICAgICAgICAgQ29sbGVjdGlvbjxTdHJpbmc+IHR5cGVDb2xsZWN0aW9uID0gcGFyYW1NYXAuZ2V0KFZDYXJkQ29uc3RhbnRzLlBBUkFNX1RZUEUpOwotICAgICAgICAgICAgaWYgKHR5cGVDb2xsZWN0aW9uICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICBmb3IgKFN0cmluZyB0eXBlU3RyaW5nIDogdHlwZUNvbGxlY3Rpb24pIHsKLSAgICAgICAgICAgICAgICAgICAgdHlwZVN0cmluZyA9IHR5cGVTdHJpbmcudG9VcHBlckNhc2UoKTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVTdHJpbmcuZXF1YWxzKFZDYXJkQ29uc3RhbnRzLlBBUkFNX1RZUEVfUFJFRikpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlzUHJpbWFyeSA9IHRydWU7Ci0gICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAodHlwZVN0cmluZy5lcXVhbHMoVkNhcmRDb25zdGFudHMuUEFSQU1fVFlQRV9IT01FKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgdHlwZSA9IEVtYWlsLlRZUEVfSE9NRTsKLSAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICh0eXBlU3RyaW5nLmVxdWFscyhWQ2FyZENvbnN0YW50cy5QQVJBTV9UWVBFX1dPUkspKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICB0eXBlID0gRW1haWwuVFlQRV9XT1JLOwotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHR5cGVTdHJpbmcuZXF1YWxzKFZDYXJkQ29uc3RhbnRzLlBBUkFNX1RZUEVfQ0VMTCkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHR5cGUgPSBFbWFpbC5UWVBFX01PQklMRTsKLSAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0eXBlU3RyaW5nLnN0YXJ0c1dpdGgoIlgtIikgJiYgdHlwZSA8IDApIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlU3RyaW5nID0gdHlwZVN0cmluZy5zdWJzdHJpbmcoMik7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAvLyB2Q2FyZCAzLjAgYWxsb3dzIGlhbmEtdG9rZW4uCi0gICAgICAgICAgICAgICAgICAgICAgICAvLyBXZSBtYXkgaGF2ZSBJTlRFUk5FVCAoc3BlY2lmaWVkIGluIHZDYXJkIHNwZWMpLAotICAgICAgICAgICAgICAgICAgICAgICAgLy8gU0NIT09MLCBldGMuCi0gICAgICAgICAgICAgICAgICAgICAgICB0eXBlID0gRW1haWwuVFlQRV9DVVNUT007Ci0gICAgICAgICAgICAgICAgICAgICAgICBsYWJlbCA9IHR5cGVTdHJpbmc7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAodHlwZSA8IDApIHsKLSAgICAgICAgICAgICAgICB0eXBlID0gRW1haWwuVFlQRV9PVEhFUjsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGFkZEVtYWlsKHR5cGUsIHByb3BWYWx1ZSwgbGFiZWwsIGlzUHJpbWFyeSk7Ci0gICAgICAgIH0gZWxzZSBpZiAocHJvcE5hbWUuZXF1YWxzKFZDYXJkQ29uc3RhbnRzLlBST1BFUlRZX09SRykpIHsKLSAgICAgICAgICAgIC8vIHZDYXJkIHNwZWNpZmljYXRpb24gZG9lcyBub3Qgc3BlY2lmeSBvdGhlciB0eXBlcy4KLSAgICAgICAgICAgIGZpbmFsIGludCB0eXBlID0gT3JnYW5pemF0aW9uLlRZUEVfV09SSzsKLSAgICAgICAgICAgIGJvb2xlYW4gaXNQcmltYXJ5ID0gZmFsc2U7Ci0gICAgICAgICAgICBDb2xsZWN0aW9uPFN0cmluZz4gdHlwZUNvbGxlY3Rpb24gPSBwYXJhbU1hcC5nZXQoVkNhcmRDb25zdGFudHMuUEFSQU1fVFlQRSk7Ci0gICAgICAgICAgICBpZiAodHlwZUNvbGxlY3Rpb24gIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIGZvciAoU3RyaW5nIHR5cGVTdHJpbmcgOiB0eXBlQ29sbGVjdGlvbikgewotICAgICAgICAgICAgICAgICAgICBpZiAodHlwZVN0cmluZy5lcXVhbHMoVkNhcmRDb25zdGFudHMuUEFSQU1fVFlQRV9QUkVGKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgaXNQcmltYXJ5ID0gdHJ1ZTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGhhbmRsZU9yZ1ZhbHVlKHR5cGUsIHByb3BWYWx1ZUxpc3QsIHBhcmFtTWFwLCBpc1ByaW1hcnkpOwotICAgICAgICB9IGVsc2UgaW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zZTsKLSAgICAgICAgICAgICAgICBpZiAodHlwZUNvbGxlY3Rpb24gIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICBmb3IgKFN0cmluZyB0eXBlVmFsdWUgOiB0eXBlQ29sbGVjdGlvbikgewotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKFZDYXJkQ29uc3RhbnRzLlBBUkFNX1RZUEVfUFJFRi5lcXVhbHModHlwZVZhbHVlKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzUHJpbWFyeSA9IHRydWU7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGZvcm1hdE5hbWUgPT0gbnVsbCl7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9ybWF0TmFtZSA9IHR5cGVWYWx1ZTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBhZGRQaG90b0J5dGVzKGZvcm1hdE5hbWUsIHByb3BCeXRlcywgaXNQcmltYXJ5KTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfSBlbHNlIGlmIChwcm9wTmFtZS5lcXVhbHMoVkNhcmRDb25zdGFudHMuUFJPUEVSVFlfVEVMKSkgewotICAgICAgICAgICAgZmluYWwgQ29sbGVjdGlvbjxTdHJpbmc+IHR5cGVDb2xsZWN0aW9uID0gcGFyYW1NYXAuZ2V0KFZDYXJkQ29uc3RhbnRzLlBBUkFNX1RZUEUpOwotICAgICAgICAgICAgZmluYWwgT2JqZWN0IHR5cGVPYmplY3QgPQotICAgICAgICAgICAgICAgIFZDYXJkVXRpbHMuZ2V0UGhvbmVUeXBlRnJvbVN0cmluZ3ModHlwZUNvbGxlY3Rpb24sIHByb3BWYWx1ZSk7Ci0gICAgICAgICAgICBmaW5hbCBpbnQgdHlwZTsKLSAgICAgICAgICAgIGZpbmFsIFN0cmluZyBsYWJlbDsKLSAgICAgICAgICAgIGlmICh0eXBlT2JqZWN0IGluc3RhbmNlb2YgSW50ZWdlcikgewotICAgICAgICAgICAgICAgIHR5cGUgPSAoSW50ZWdlcil0eXBlT2JqZWN0OwotICAgICAgICAgICAgICAgIGxhYmVsID0gbnVsbDsKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgdHlwZSA9IFBob25lLlRZUEVfQ1VTVE9NOwotICAgICAgICAgICAgICAgIGxhYmVsID0gdHlwZU9iamVjdC50b1N0cmluZygpOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBmaW5hbCBib29sZWFuIGlzUHJpbWFyeTsKLSAgICAgICAgICAgIGlmICh0eXBlQ29sbGVjdGlvbiAhPSBudWxsICYmIHR5cGVDb2xsZWN0aW9uLmNvbnRhaW5zKFZDYXJkQ29uc3RhbnRzLlBBUkFNX1RZUEVfUFJFRikpIHsKLSAgICAgICAgICAgICAgICBpc1ByaW1hcnkgPSB0cnVlOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBpc1ByaW1hcnkgPSBmYWxzZTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGFkZFBob25lKHR5cGUsIHByb3BWYWx1ZSwgbGFiZWwsIGlzUHJpbWFyeSk7Ci0gICAgICAgIH0gZWxzZSBpZiAocHJvcE5hbWUuZXF1YWxzKFZDYXJkQ29uc3RhbnRzLlBST1BFUlRZX1hfU0tZUEVfUFNUTk5VTUJFUikpIHsKLSAgICAgICAgICAgIC8vIFRoZSBwaG9uZSBudW1iZXIgYXZhaWxhYmxlIHZpYSBTa3lwZS4KLSAgICAgICAgICAgIENvbGxlY3Rpb248U3RyaW5nPiB0eXBlQ29sbGVjdGlvbiA9IHBhcmFtTWFwLmdldChWQ2FyZENvbnN0YW50cy5QQVJBTV9UWVBFKTsKLSAgICAgICAgICAgIGZpbmFsIGludCB0eXBlID0gUGhvbmUuVFlQRV9PVEhFUjsKLSAgICAgICAgICAgIGZpbmFsIGJvb2xlYW4gaXNQcmltYXJ5OwotICAgICAgICAgICAgaWYgKHR5cGVDb2xsZWN0aW9uICE9IG51bGwgJiYgdHlwZUNvbGxlY3Rpb24uY29udGFpbnMoVkNhcmRDb25zdGFudHMuUEFSQU1fVFlQRV9QUkVGKSkgewotICAgICAgICAgICAgICAgIGlzUHJpbWFyeSA9IHRydWU7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIGlzUHJpbWFyeSA9IGZhbHNlOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgYWRkUGhvbmUodHlwZSwgcHJvcFZhbHVlLCBudWxsLCBpc1ByaW1hcnkpOwotICAgICAgICB9IGVsc2UgaWYgKHNJbU1hcC5jb250YWluc0tleShwcm9wTmFtZSkpIHsKLSAgICAgICAgICAgIGZpbmFsIGludCBwcm90b2NvbCA9IHNJbU1hcC5nZXQocHJvcE5hbWUpOwotICAgICAgICAgICAgYm9vbGVhbiBpc1ByaW1hcnkgPSBmYWxzZTsKLSAgICAgICAgICAgIGludCB0eXBlID0gLTE7Ci0gICAgICAgICAgICBmaW5hbCBDb2xsZWN0aW9uPFN0cmluZz4gdHlwZUNvbGxlY3Rpb24gPSBwYXJhbU1hcC5nZXQoVkNhcmRDb25zdGFudHMuUEFSQU1fVFlQRSk7Ci0gICAgICAgICAgICBpZiAodHlwZUNvbGxlY3Rpb24gIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIGZvciAoU3RyaW5nIHR5cGVTdHJpbmcgOiB0eXBlQ29sbGVjdGlvbikgewotICAgICAgICAgICAgICAgICAgICBpZiAodHlwZVN0cmluZy5lcXVhbHMoVkNhcmRDb25zdGFudHMuUEFSQU1fVFlQRV9QUkVGKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgaXNQcmltYXJ5ID0gdHJ1ZTsKLSAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICh0eXBlIDwgMCkgewotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVTdHJpbmcuZXF1YWxzSWdub3JlQ2FzZShWQ2FyZENvbnN0YW50cy5QQVJBTV9UWVBFX0hPTUUpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZSA9IEltLlRZUEVfSE9NRTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAodHlwZVN0cmluZy5lcXVhbHNJZ25vcmVDYXNlKFZDYXJkQ29uc3RhbnRzLlBBUkFNX1RZUEVfV09SSykpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlID0gSW0uVFlQRV9XT1JLOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKHR5cGUgPCAwKSB7Ci0gICAgICAgICAgICAgICAgdHlwZSA9IEltLlRZUEVfSE9NRTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGFkZEltKHByb3RvY29sLCBudWxsLCB0eXBlLCBwcm9wVmFsdWUsIGlzUHJpbWFyeSk7Ci0gICAgICAgIH0gZWxzZSBpZiAocHJvcE5hbWUuZXF1YWxzKFZDYXJkQ29uc3RhbnRzLlBST1BFUlRZX05PVEUpKSB7Ci0gICAgICAgICAgICBhZGROb3RlKHByb3BWYWx1ZSk7Ci0gICAgICAgIH0gZWxzZSBpZiAocHJvcE5hbWUuZXF1YWxzKFZDYXJkQ29uc3RhbnRzLlBST1BFUlRZX1VSTCkpIHsKLSAgICAgICAgICAgIGlmIChtV2Vic2l0ZUxpc3QgPT0gbnVsbCkgewotICAgICAgICAgICAgICAgIG1XZWJzaXRlTGlzdCA9IG5ldyBBcnJheUxpc3Q8U3RyaW5nPigxKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIG1XZWJzaXRlTGlzdC5hZGQocHJvcFZhbHVlKTsKLSAgICAgICAgfSBlbHNlIGlmIChwcm9wTmFtZS5lcXVhbHMoVkNhcm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KLSAgICAgICAgfQotCi0gICAgICAgIGlmIChtUGhvbmVMaXN0ICE9IG51bGwpIHsKLSAgICAgICAgICAgIGZvciAoUGhvbmVEYXRhIHBob25lRGF0YSA6IG1QaG9uZUxpc3QpIHsKLSAgICAgICAgICAgICAgICBidWlsZGVyID0gQ29udGVudFByb3ZpZGVyT3BlcmF0aW9uLm5ld0luc2VydChEYXRhLkNPTlRFTlRfVVJJKTsKLSAgICAgICAgICAgICAgICBidWlsZGVyLndpdGhWYWx1ZUJhY2tSZWZlcmVuY2UoUGhvbmUuUkFXX0NPTlRBQ1RfSUQsIDApOwotICAgICAgICAgICAgICAgIGJ1aWxkZXIud2l0aFZhbHVlKERhdGEuTUlNRVRZUEUsIFBob25lLkNPTlRFTlRfSVRFTV9UWVBFKTsKLQotICAgICAgICAgICAgICAgIGJ1aWxkZXIud2l0aFZhbHVlKFBob25lLlRZUEUsIHBob25lRGF0YS50eXBlKTsKLSAgICAgICAgICAgICAgICBpZiAocGhvbmVEYXRhLnR5cGUgPT0gUGhvbmUuVFlQRV9DVVNUT00pIHsKLSAgICAgICAgICAgICAgICAgICAgYnVpbGRlci53aXRoVmFsdWUoUGhvbmUuTEFCRUwsIHBob25lRGF0YS5sYWJlbCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGJ1aWxkZXIud2l0aFZhbHVlKFBob25lLk5VTUJFUiwgcGhvbmVEYXRhLmRhdGEpOwotICAgICAgICAgICAgICAgIGlmIChwaG9uZURhdGEuaXNQcmltYXJ5KSB7Ci0gICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIud2l0aFZhbHVlKFBob25lLklTX1BSSU1BUlksIDEpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBvcGVyYXRpb25MaXN0LmFkZChidWlsZGVyLmJ1aWxkKCkpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgaWYgKG1Pcmdhbml6YXRpb25MaXN0ICE9IG51bGwpIHsKLSAgICAgICAgICAgIGZvciAoT3JnYW5pemF0aW9uRGF0YSBvcmdhbml6YXRpb25EYXRhIDogbU9yZ2FuaXphdGlvbkxpc3QpIHsKLSAgICAgICAgICAgICAgICBidWlsZGVyID0gQ29udGVudFByb3ZpZGVyT3BlcmF0aW9uLm5ld0luc2VydChEYXRhLkNPTlRFTlRfVVJJKTsKLSAgICAgICAgICAgICAgICBidWlsZGVyLndpdGhWYWx1ZUJhY2tSZWZlcmVuY2UoT3JnYW5pemF0aW9uLlJBV19DT05UQUNUX0lELCAwKTsKLSAgICAgICAgICAgICAgICBidWlsZGVyLndpdGhWYWx1ZShEYXRhLk1JTUVUWVBFLCBPcmdhbml6YXRpb24uQ09OVEVOVF9JVEVNX1RZUEUpOwotICAgICAgICAgICAgICAgIGJ1aWxkZXIud2l0aFZhbHVlKE9yZ2FuaXphdGlvbi5UWVBFLCBvcmdhbml6YXRpb25EYXRhLnR5cGUpOwotICAgICAgICAgICAgICAgIGlmIChvcmdhbml6YXRpb25EYXRhLmNvbXBhbnlOYW1lICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgYnVpbGRlci53aXRoVmFsdWUoT3JnYW5pemF0aW9uLkNPTVBBTlksIG9yZ2FuaXphdGlvbkRhdGEuY29tcGFueU5hbWUpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBpZiAob3JnYW5pemF0aW9uRGF0YS5kZXBhcnRtZW50TmFtZSAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIud2l0aFZhbHVlKE9yZ2FuaXphdGlvbi5ERVBBUlRNRU5ULCBvcmdhbml6YXRpb25EYXRhLmRlcGFydG1lbnROYW1lKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgaWYgKG9yZ2FuaXphdGlvbkRhdGEudGl0bGVOYW1lICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgYnVpbGRlci53aXRoVmFsdWUoT3JnYW5pemF0aW9uLlRJVExFLCBvcmdhbml6YXRpb25EYXRhLnRpdGxlTmFtZSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGlmIChvcmdhbml6YXRpb25EYXRhLnBob25ldGljTmFtZSAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIud2l0aFZhbHVlKE9yZ2FuaXphdGlvbi5QSE9ORVRJQ19OQU1FLCBvcmdhbml6YXRpb25EYXRhLnBob25ldGljTmFtZSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGlmIChvcmdhbml6YXRpb25EYXRhLmlzUHJpbWFyeSkgewotICAgICAgICAgICAgICAgICAgICBidWlsZGVyLndpdGhWYWx1ZShPcmdhbml6YXRpb24uSVNfUFJJTUFSWSwgMSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIG9wZXJhdGlvbkxpc3QuYWRkKGJ1aWxkZXIuYnVpbGQoKSk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICBpZiAobUVtYWlsTGlzdCAhPSBudWxsKSB7Ci0gICAgICAgICAgICBmb3IgKEVtYWlsRGF0YSBlbWFpbERhdGEgOiBtRW1haWxMaXN0KSB7Ci0gICAgICAgICAgICAgICAgYnVpbGRlciA9IENvbnRlbnRQcm92aWRlck9wZXJhdGlvbi5uZXdJbnNlcnQoRGF0YS5DT05URU5UX1VSSSk7Ci0gICAgICAgICAgICAgICAgYnVpbGRlci53aXRoVmFsdWVCYWNrUmVmZXJlbmNlKEVtYWlsLlJBV19DT05UQUNUX0lELCAwKTsKLSAgICAgICAgICAgICAgICBidWlsZGVyLndpdGhWYWx1ZShEYXRhLk1JTUVUWVBFLCBFbWFpbC5DT05URU5UX0lURU1fVFlQRSk7Ci0KLSAgICAgICAgICAgICAgICBidWlsZGVyLndpdGhWYWx1ZShFbWFpbC5UWVBFLCBlbWFpbERhdGEudHlwZSk7Ci0gICAgICAgICAgICAgICAgaWYgKGVtYWlsRGF0YS50eXBlID09IEVtYWlsLlRZUEVfQ1VTVE9NKSB7Ci0gICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIud2l0aFZhbHVlKEVtYWlsLkxBQkVMLCBlbWFpbERhdGEubGFiZWwpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBidWlsZGVyLndpdGhWYWx1ZShFbWFpbC5EQVRBLCBlbWFpbERhdGEuZGF0YSk7Ci0gICAgICAgICAgICAgICAgaWYgKGVtYWlsRGF0YS5pc1ByaW1hcnkpIHsKLSAgICAgICAgICAgICAgICAgICAgYnVpbGRlci53aXRoVmFsdWUoRGF0YS5JU19QUklNQVJZLCAxKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgb3BlcmF0aW9uTGlzdC5hZGQoYnVpbGRlci5idWlsZCgpKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIGlmIChtUG9zdGFsTGlzdCAhPSBudWxsKSB7Ci0gICAgICAgICAgICBmb3IgKFBvc3RhbERhdGEgcG9zdGFsRGF0YSA6IG1Qb3N0YWxMaXN0KSB7Ci0gICAgICAgICAgICAgICAgYnVpbGRlciA9IENvbnRlbnRQcm92aWRlck9wZXJhdGlvbi5uZXdJbnNlcnQoRGF0YS5DT05URU5UX1VSSSk7Ci0gICAgICAgICAgICAgICAgVkNhcmRVdGlscy5pbnNlcnRTdHJ1Y3R1cmVkUG9zdGFsRGF0YVVzaW5nQ29udGFjdHNTdHJ1Y3QoCi0gICAgICAgICAgICAgICAgICAgICAgICBtVkNhcmRUeXBlLCBidWlsZGVyLCBwb3N0YWxEYXRhKTsKLSAgICAgICAgICAgICAgICBvcGVyYXRpb25MaXN0LmFkZChidWlsZGVyLmJ1aWxkKCkpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgaWYgKG1JbUxpc3QgIT0gbnVsbCkgewotICAgICAgICAgICAgZm9yIChJbURhdGEgaW1EYXRhIDogbUltTGlzdCkgewotICAgICAgICAgICAgICAgIGJ1aWxkZXIgPSBDb250ZW50UHJvdmlkZXJPcGVyYXRpb24ubmV3SW5zZXJ0KERhdGEuQ09OVEVOVF9VUkkpOwotICAgICAgICAgICAgICAgIGJ1aWxkZXIud2l0aFZhbHVlQmFja1JlZmVyZW5jZShJbS5SQVdfQ09OVEFDVF9JRCwgMCk7Ci0gICAgICAgICAgICAgICAgYnVpbGRlci53aXRoVmFsdWUoRGF0YS5NSU1FVFlQRSwgSW0uQ09OVEVOVF9JVEVNX1RZUEUpOwotICAgICAgICAgICAgICAgIGJ1aWxkZXIud2l0aFZhbHVlKEltLlRZUEUsIGltRGF0YS50eXBlKTsKLSAgICAgICAgICAgICAgICBidWlsZGVyLndpdGhWYWx1ZShJbS5QUk9UT0NPTCwgaW1EYXRhLnByb3RvY29sKTsKLSAgICAgICAgICAgICAgICBidWlsZGVyLndpdGhWYWx1ZShJbS5EQVRBLCBpbURhdGEuZGF0YSk7Ci0gICAgICAgICAgICAgICAgaWYgKGltRGF0YS5wcm90b2NvbCA9PSBJbS5QUk9UT0NPTF9DVVNUT00pIHsKLSAgICAgICAgICAgICAgICAgICAgYnVpbGRlci53aXRoVmFsdWUoSW0uQ1VTVE9NX1BST1RPQ09MLCBpbURhdGEuY3VzdG9tUHJvdG9jb2wpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBpZiAoaW1EYXRhLmlzUHJpbWFyeSkgewotICAgICAgICAgICAgICAgICAgICBidWlsZGVyLndpdGhWYWx1ZShEYXRhLklTX1BSSU1BUlksIDEpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBvcGVyYXRpb25MaXN0LmFkZChidWlsZGVyLmJ1aWxkKCkpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgaWYgKG1Ob3RlTGlzdCAhPSBudWxsKSB7Ci0gICAgICAgICAgICBmb3IgKFN0cmluZy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mFkZChidWlsZGVyLmJ1aWxkKCkpOwotICAgICAgICB9Ci0KLSAgICAgICAgaWYgKG1BbmRyb2lkQ3VzdG9tUHJvcGVydHlMaXN0ICE9IG51bGwpIHsKLSAgICAgICAgICAgIGZvciAoTGlzdDxTdHJpbmc+IGN1c3RvbVByb3BlcnR5TGlzdCA6IG1BbmRyb2lkQ3VzdG9tUHJvcGVydHlMaXN0KSB7Ci0gICAgICAgICAgICAgICAgaW50IHNpemUgPSBjdXN0b21Qcm9wZXJ0eUxpc3Quc2l6ZSgpOwotICAgICAgICAgICAgICAgIGlmIChzaXplIDwgMiB8fCBUZXh0VXRpbHMuaXNFbXB0eShjdXN0b21Qcm9wZXJ0eUxpc3QuZ2V0KDApKSkgewotICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHNpemUgPiBWQ2FyZENvbnN0YW50cy5NQVhfREFUQV9DT0xVTU4gKyAxKSB7Ci0gICAgICAgICAgICAgICAgICAgIHNpemUgPSBWQ2FyZENvbnN0YW50cy5NQVhfREFUQV9DT0xVTU4gKyAxOwotICAgICAgICAgICAgICAgICAgICBjdXN0b21Qcm9wZXJ0eUxpc3QgPQotICAgICAgICAgICAgICAgICAgICAgICAgY3VzdG9tUHJvcGVydHlMaXN0LnN1Ykxpc3QoMCwgVkNhcmRDb25zdGFudHMuTUFYX0RBVEFfQ09MVU1OICsgMik7Ci0gICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgaW50IGkgPSAwOwotICAgICAgICAgICAgICAgIGZvciAoZmluYWwgU3RyaW5nIGN1c3RvbVByb3BlcnR5VmFsdWUgOiBjdXN0b21Qcm9wZXJ0eUxpc3QpIHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKGkgPT0gMCkgewotICAgICAgICAgICAgICAgICAgICAgICAgZmluYWwgU3RyaW5nIG1pbWVUeXBlID0gY3VzdG9tUHJvcGVydHlWYWx1ZTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIgPSBDb250ZW50UHJvdmlkZXJPcGVyYXRpb24ubmV3SW5zZXJ0KERhdGEuQ09OVEVOVF9VUkkpOwotICAgICAgICAgICAgICAgICAgICAgICAgYnVpbGRlci53aXRoVmFsdWVCYWNrUmVmZXJlbmNlKEdyb3VwTWVtYmVyc2hpcC5SQVdfQ09OVEFDVF9JRCwgMCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBidWlsZGVyLndpdGhWYWx1ZShEYXRhLk1JTUVUWVBFLCBtaW1lVHlwZSk7Ci0gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7ICAvLyAxIDw9IGkgJiYgaSA8PSBNQVhfREFUQV9DT0xVTU5TCi0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIVRleHRVdGlscy5pc0VtcHR5KGN1c3RvbVByb3BlcnR5VmFsdWUpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnVpbGRlci53aXRoVmFsdWUoImRhdGEiICsgaSwgY3VzdG9tUHJvcGVydHlWYWx1ZSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgICAgICBpKys7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIG9wZXJhdGlvbkxpc3QuYWRkKGJ1aWxkZXIuYnVpbGQoKSk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICBpZiAobXlHcm91cHNJZCAhPSBudWxsKSB7Ci0gICAgICAgICAgICBidWlsZGVyID0gQ29udGVudFByb3ZpZGVyT3BlcmF0aW9uLm5ld0luc2VydChEYXRhLkNPTlRFTlRfVVJJKTsKLSAgICAgICAgICAgIGJ1aWxkZXIud2l0aFZhbHVlQmFja1JlZmVyZW5jZShHcm91cE1lbWJlcnNoaXAuUkFXX0NPTlRBQ1RfSUQsIDApOwotICAgICAgICAgICAgYnVpbGRlci53aXRoVmFsdWU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AgfSBjYXRjaCAoT3BlcmF0aW9uQXBwbGljYXRpb25FeGNlcHRpb24gZSkgewotICAgICAgICAgICAgTG9nLmUoTE9HX1RBRywgU3RyaW5nLmZvcm1hdCgiJXM6ICVzIiwgZS50b1N0cmluZygpLCBlLmdldE1lc3NhZ2UoKSkpOwotICAgICAgICAgICAgcmV0dXJuIG51bGw7Ci0gICAgICAgIH0KLSAgICB9Ci0KLSAgICBwdWJsaWMgc3RhdGljIFZDYXJkRW50cnkgYnVpbGRGcm9tUmVzb2x2ZXIoQ29udGVudFJlc29sdmVyIHJlc29sdmVyKSB7Ci0gICAgICAgIHJldHVybiBidWlsZEZyb21SZXNvbHZlcihyZXNvbHZlciwgQ29udGFjdHMuQ09OVEVOVF9VUkkpOwotICAgIH0KLQotICAgIHB1YmxpYyBzdGF0aWMgVkNhcmRFbnRyeSBidWlsZEZyb21SZXNvbHZlcihDb250ZW50UmVzb2x2ZXIgcmVzb2x2ZXIsIFVyaSB1cmkpIHsKLQotICAgICAgICByZXR1cm4gbnVsbDsKLSAgICB9Ci0KLSAgICBwcml2YXRlIGJvb2xlYW4gbmFtZUZpZWxkc0FyZUVtcHR5KCkgewotICAgICAgICByZXR1cm4gKFRleHRVdGlscy5pc0VtcHR5KG1GYW1pbHlOYW1lKQotICAgICAgICAgICAgICAgICYmIFRleHRVdGlscy5pc0VtcHR5KG1NaWRkbGVOYW1lKQotICAgICAgICAgICAgICAgICYmIFRleHRVdGlscy5pc0VtcHR5KG1HaXZlbk5hbWUpCi0gICAgICAgICAgICAgICAgJiYgVGV4dFV0aWxzLmlzRW1wdHkobVByZWZpeCkKLSAgICAgICAgICAgICAgICAmJiBUZXh0VXRpbHMuaXNFbXB0eShtU3VmZml4KQotICAgICAgICAgICAgICAgICYmIFRleHRVdGlscy5pc0VtcHR5KG1Gb3JtYXR0ZWROYW1lKQotICAgICAgICAgICAgICAgICYmIFRleHRVdGlscy5pc0VtcHR5KG1QaG9uZXRpY0ZhbWlseU5hbWUpCi0gICAgICAgICAgICAgICAgJiYgVGV4dFV0aWxzLmlzRW1wdHkobVBob25ldGljTWlkZGxlTmFtZSkKLSAgICAgICAgICAgICAgICAmJiBUZXh0VXRpbHMuaXNFbXB0eShtUGhvbmV0aWNHaXZlbk5hbWUpCi0gICAgICAgICAgICAgICAgJiYgVGV4dFV0aWxzLmlzRW1wdHkobVBob25ldGljRnVsbE5hbWUpKTsKLSAgICB9Ci0KLSAgICBwdWJsaWMgYm9vbGVhbiBpc0lnbm9yYWJsZSgpIHsKLSAgICAgICAgcmV0dXJuIGdldERpc3BsYXlOYW1lKCkubGVuZ3RoKCkgPT0gMDsKLSAgICB9Ci0KLSAgICBwcml2YXRlIFN0cmluZyBsaXN0VG9TdHJpbmcoTGlzdDxTdHJpbmc+IGxpc3QpewotICAgICAgICBmaW5hbCBpbnQgc2l6ZSA9IGxpc3Quc2l6ZSgpOwotICAgICAgICBpZiAoc2l6ZSA+IDEpIHsKLSAgICAgICAgICAgIFN0cmluZ0J1aWxkZXIgYnVpbGRlciA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7Ci0gICAgICAgICAgICBpbnQgaSA9IDA7Ci0gICAgICAgICAgICBmb3IgKFN0cmluZyB0eXBlIDogbGlzdCkgewotICAgICAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kKHR5cGUpOwotICAgICAgICAgICAgICAgIGlmIChpIDwgc2l6ZSAtIDEpIHsKLSAgICAgICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQoIjsiKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICByZXR1cm4gYnVpbGRlci50b1N0cmluZygpOwotICAgICAgICB9IGVsc2UgaWYgKHNpemUgPT0gMSkgewotICAgICAgICAgICAgcmV0dXJuIGxpc3QuZ2V0KDApOwotICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgcmV0dXJuICIiOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgLy8gQWxsIGdldHRlci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maW5hbCBjbGFzcyBFbXB0eUludGVycHJldGVyIGltcGxlbWVudHMgVkNhcmRJbnRlcnByZXRlciB7Ci0gICAgICAgIEBPdmVycmlkZQotICAgICAgICBwdWJsaWMgdm9pZCBlbmQoKSB7Ci0gICAgICAgIH0KLSAgICAgICAgQE92ZXJyaWRlCi0gICAgICAgIHB1YmxpYyB2b2lkIGVuZEVudHJ5KCkgewotICAgICAgICB9Ci0gICAgICAgIEBPdmVycmlkZQotICAgICAgICBwdWJsaWMgdm9pZCBlbmRQcm9wZXJ0eSgpIHsKLSAgICAgICAgfQotICAgICAgICBAT3ZlcnJpZGUKLSAgICAgICAgcHVibGljIHZvaWQgcHJvcGVydHlHcm91cChTdHJpbmcgZ3JvdXApIHsKLSAgICAgICAgfQotICAgICAgICBAT3ZlcnJpZGUKLSAgICAgICAgcHVibGljIHZvaWQgcHJvcGVydHlOYW1lKFN0cmluZyBuYW1lKSB7Ci0gICAgICAgIH0KLSAgICAgICAgQE92ZXJyaWRlCi0gICAgICAgIHB1YmxpYyB2b2lkIHByb3BlcnR5UGFyYW1UeXBlKFN0cmluZyB0eXBlKSB7Ci0gICAgICAgIH0KLSAgICAgICAgQE92ZXJyaWRlCi0gICAgICAgIHB1YmxpYyB2b2lkIHByb3BlcnR5UGFyYW1WYWx1ZShTdHJpbmcgdmFsdWUpIHsKLSAgICAgICAgfQotICAgICAgICBAT3ZlcnJpZGUKLSAgICAgICAgcHVibGljIHZvaWQgcHJvcGVydHlWYWx1ZXMoTGlzdDxTdHJpbmc+IHZhbHVlcykgewotICAgICAgICB9Ci0gICAgICAgIEBPdmVycmlkZQotICAgICAgICBwdWJsaWMgdm9pZCBzdGFydCgpIHsKLSAgICAgICAgfQotICAgICAgICBAT3ZlcnJpZGUKLSAgICAgICAgcHVibGljIHZvaWQgc3RhcnRFbnRyeSgpIHsKLSAgICAgICAgfQotICAgICAgICBAT3ZlcnJpZGUKLSAgICAgICAgcHVibGljIHZvaWQgc3RhcnRQcm9wZXJ0eSgpIHsKLSAgICAgICAgfQotICAgIH0KLQotICAgIHByb3RlY3RlZCBzdGF0aWMgZmluYWwgY2xhc3MgQ3VzdG9tQnVmZmVyZWRSZWFkZXIgZXh0ZW5kcyBCdWZmZXJlZFJlYWRlciB7Ci0gICAgICAgIHByaXZhdGUgbG9uZyBtVGltZTsKLQotICAgICAgICAvKioKLSAgICAgICAgICogTmVlZGVkIHNpbmNlICJuZXh0IGxpbmUiIG1heSBiZSBudWxsIGR1ZSB0byBlbmQgb2YgbGluZS4KLSAgICAgICAgICovCi0gICAgICAgIHByaXZhdGUgYm9vbGVhbiBtTmV4dExpbmVJc1ZhbGlkOwotICAgICAgICBwcml2YXRlIFN0cmluZyBtTmV4dExpbmU7Ci0KLSAgICAgICAgcHVibGljIEN1c3RvbUJ1ZmZlcmVkUmVhZGVyKFJlYWRlciBpbikgewotICAgICAgICAgICAgc3VwZXIoaW4pOwotICAgICAgICB9Ci0KLSAgICAgICAgQE92ZXJyaWRlCi0gICAgICAgIHB1YmxpYyBTdHJpbmcgcmVhZExpbmUoKSB0aHJvd3MgSU9FeGNlcHRpb24gewotICAgICAgICAgICAgaWYgKG1OZXh0TGluZUlzVmFsaWQpIHsKLSAgICAgICAgICAgICAgICBmaW5hbCBTdHJpbmcgcmV0ID0gbU5leHRMaW5lOwotICAgICAgICAgICAgICAgIG1OZXh0TGluZSA9IG51bGw7Ci0gICAgICAgICAgICAgICAgbU5leHRMaW5lSXNWYWxpZCA9IGZhbHNlOwotICAgICAgICAgICAgICAgIHJldHVybiByZXQ7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGxvbmcgc3RhcnQgPSBTeXN0ZW0uY3VycmVudFRpbWVNaWxsaXMoKTsKLSAgICAgICAgICAgIGZpbmFsIFN0cmluZyBsaW5lID0gc3VwZXIucmVhZExpbmUoKTsKLSAgICAgICAgICAgIGxvbmcgZW5kID0gU3lzdGVtLmN1cnJlbnRUaW1lTWlsbGlzKCk7Ci0gICAgICAgICAgICBtVGltZSArPSBlbmQgLSBzdGFydDsKLSAgICAgICAgICAgIHJldHVybiBsaW5lOwotICAgICAgICB9Ci0KLSAgICAgICAgLyoqCi0gICAgICAgICAqIFJlYWQgb25lIGxpbmUsIGJ1dCBtYWtlIHRoaXMgb2JqZWN0IHN0b3JlIGl0IGluIGl0cyBxdWV1ZS4KLSAgICAgICAgICovCi0gICAgICAgIHB1YmxpYyBTdHJpbmcgcGVla0xpbmUoKSB0aHJvd3MgSU9FeGNlcHRpb24gewotICAgICAgICAgICAgaWYgKCFtTmV4dExpbmVJc1ZhbGlkKSB7Ci0gICAgICAgICAgICAgICAgbG9uZyBzdGFydCA9IFN5c3RlbS5jdXJyZW50VGltZU1pbGxpcygpOwotICAgICAgICAgICAgICAgIGZpbmFsIFN0cmluZyBsaW5lID0gc3VwZXIucmVhZExpbmUoKTsKLSAgICAgICAgICAgICAgICBsb25nIGVuZCA9IFN5c3RlbS5jdXJyZW50VGltZU1pbGxpcygpOwotICAgICAgICAgICAgICAgIG1UaW1lICs9IGVuZCAtIHN0YXJ0OwotCi0gICAgICAgICAgICAgICAgbU5leHRMaW5lID0gbGluZTsKLSAgICAgICAgICAgICAgICBtTmV4dExpbmVJc1ZhbGlkID0gdHJ1ZTsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgcmV0dXJuIG1OZXh0TGluZTsKLSAgICAgICAgfQotCi0gICAgICAgIHB1YmxpYyBsb25nIGdldFRvdGFsbWlsbGlzZWNvbmQoKSB7Ci0gICAgICAgICAgICByZXR1cm4gbVRpbWU7Ci0gICAgICAgIH0KLSAgICB9Ci0KLSAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBTdHJpbmcgREVGQVVMVF9FTkNPRElORyA9ICI4QklUIjsKLQotICAgIHByb3RlY3RlZCBib29sZWFuIG1DYW5jZWxlZDsKLSAgICBwcm90ZWN0ZWQgVkNhcmRJbnRlcnByZXRlciBtSW50ZXJwcmV0ZXI7Ci0KLSAgICBwcm90ZWN0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gYWxsb3cgbG93ZXIgY2FzZXMsCi0gICAgICAgICAgICAvLyB3ZSBmb3VuZCB2Q2FyZCBmaWxlIGVtaXR0ZWQgYnkgc29tZSBleHRlcm5hbCB2Q2FyZCBleHBvdGVyIGhhdmUgc3VjaAotICAgICAgICAgICAgLy8gaW52YWxpZCBTdHJpbmdzLgotICAgICAgICAgICAgLy8gU28gd2UgYWxsb3cgaXQuCi0gICAgICAgICAgICAvLyBlLmcuCi0gICAgICAgICAgICAvLyBCRUdJTjp2Q2FyZAotICAgICAgICAgICAgaWYgKGxlbmd0aCA9PSAyICYmIHN0ckFycmF5WzBdLnRyaW0oKS5lcXVhbHNJZ25vcmVDYXNlKCJCRUdJTiIpCi0gICAgICAgICAgICAgICAgICAgICYmIHN0ckFycmF5WzFdLnRyaW0oKS5lcXVhbHNJZ25vcmVDYXNlKCJWQ0FSRCIpKSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7Ci0gICAgICAgICAgICB9IGVsc2UgaWYgKCFhbGxvd0dhcmJhZ2UpIHsKLSAgICAgICAgICAgICAgICBpZiAobU5lc3RDb3VudCA+IDApIHsKLSAgICAgICAgICAgICAgICAgICAgbVByZXZpb3VzTGluZSA9IGxpbmU7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVkNhcmRFeGNlcHRpb24oIkV4cGVjdGVkIFN0cmluZyBcIkJFR0lOOlZDQVJEXCIgZGlkIG5vdCBjb21lICIKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICArICIoSW5zdGVhZCwgXCIiICsgbGluZSArICJcIiBjYW1lKSIpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfSB3aGlsZSAoYWxsb3dHYXJiYWdlKTsKLQotICAgICAgICB0aHJvdyBuZXcgVkNhcmRFeGNlcHRpb24oIlJlYWNoZW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3cgaXQuCi0gICAgICAgICAgICAgICAgbGluZSA9IG1QcmV2aW91c0xpbmU7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIHdoaWxlICh0cnVlKSB7Ci0gICAgICAgICAgICAgICAgICAgIGxpbmUgPSBnZXRMaW5lKCk7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChsaW5lID09IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBWQ2FyZEV4Y2VwdGlvbigiRXhwZWN0ZWQgRU5EOlZDQVJEIHdhcyBub3QgZm91bmQuIik7Ci0gICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobGluZS50cmltKCkubGVuZ3RoKCkgPiAwKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgU3RyaW5nW10gc3RyQXJyYXkgPSBsaW5lLnNwbGl0KCI6IiwgMik7Ci0gICAgICAgICAgICBpZiAoc3RyQXJyYXkubGVuZ3RoID09IDIgJiYgc3RyQXJyYXlbMF0udHJpbSgpLmVxdWFsc0lnbm9yZUNhc2UoIkVORCIpCi0gICAgICAgICAgICAgICAgICAgICYmIHN0ckFycmF5WzFdLnRyaW0oKS5lcXVhbHNJZ25vcmVDYXNlKCJWQ0FSRCIpKSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuOwotICAgICAgICAgICAgfSBlbHNlIGlmICghYWxsb3dHYXJiYWdlKSB7Ci0gICAgICAgICAgICAgICAgdGhyb3cgbmV3IFZDYXJkRXhjZXB0aW9uKCJFTkQ6VkNBUkQgIT0gXCIiICsgbVByZXZpb3VzTGluZSArICJcIiIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgdXNlQ2FjaGUgPSBmYWxzZTsKLSAgICAgICAgfSB3aGlsZSAoYWxsb3dHYXJiYWdlKTsKLSAgICB9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W5hbCBTdHJpbmcgcHJvcGVydHlOYW1lID0gbGluZS5zdWJzdHJpbmcobmFtZUluZGV4LCBpKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChwcm9wZXJ0eU5hbWUuZXF1YWxzSWdub3JlQ2FzZSgiRU5EIikpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBtUHJldmlvdXNMaW5lID0gbGluZTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIG1JbnRlcnByZXRlci5wcm9wZXJ0eU5hbWUocHJvcGVydHlOYW1lKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIHByb3BlcnR5TmFtZUFuZFZhbHVlWzBdID0gcHJvcGVydHlOYW1lOwotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkgPCBsZW5ndGggLSAxKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvcGVydHlOYW1lQW5kVmFsdWVbMV0gPSBsaW5lLnN1YnN0cmluZyhpICsgMSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb3BlcnR5TmFtZUFuZFZhbHVlWzFdID0gIiI7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcHJvcGVydHlOYW1lQW5kVmFsdWU7Ci0gICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoY2ggPT0gJy4nKSB7ICAvLyBFYWNoIGdyb3VwIGlzIGZvbGxvd2VkIGJ5IHRoZSBkb3QuCi0gICAgICAgICAgICAgICAgICAgICAgICBmaW5hbCBTdHJpbmcgZ3JvdXBOYW1lID0gbGluZS5zdWJzdHJpbmcobmFtZUluZGV4LCBpKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChncm91cE5hbWUubGVuZ3RoKCkgPT0gMCkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIExvZy53KExPR19UQUcsICJFbXB0eSBncm91cCBmb3VuZC4gSWdub3JpbmcuIik7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1JbnRlcnByZXRlci5wcm9wZXJ0eUdyb3VwKGdyb3VwTmFtZSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICBuYW1lSW5kZXggPSBpICsgMTsgIC8vIE5leHQgc2hvdWxkIGJlIGFub3RoZXIgZ3JvdXAgb3IgYSBwcm9wZXJ0eSBuYW1lLgotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGNoID09ICc7JykgeyAgLy8gRW5kIG9mIHByb3BlcnR5IG5hbWUgYW5kIGJlZ2lubmVuZyBvZiBwYXJhbWV0ZXJzLiAgCi0gICAgICAgICAgICAgICAgICAgICAgICBmaW5hbCBTdHJpbmcgcHJvcGVydHlOYW1lID0gbGluZS5zdWJzdHJpbmcobmFtZUluZGV4LCBpKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChwcm9wZXJ0eU5hbWUuZXF1YWxzSWdub3JlQ2FzZSgiRU5EIikpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBtUHJldmlvdXNMaW5lID0gbGluZTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIG1JbnRlcnByZXRlci5wcm9wZXJ0eU5hbWUocHJvcGVydHlOYW1lKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIHByb3BlcnR5TmFtZUFuZFZhbHVlWzBdID0gcHJvcGVydHlOYW1lOwotICAgICAgICAgICAgICAgICAgICAgICAgbmFtZUluZGV4ID0gaSArIDE7Ci0gICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZSA9IFNUQVRFX1BBUkFNUzsgIC8vIFN0YXJ0IHBhcmFtZXRlciBwYXJzaW5nLgotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIC8vIFRPRE86IGNvbW1hIHN1cHBvcnQgKGluIHZDYXJkIDMuMCBhbmQgNC4wKS4KLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGNhc2UgU1RBVEVfUEFSQU1TOiB7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChjaCA9PSAnIicpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChWQ2FyZENvbnN0YW50cy5WRVJTSU9OX1YyMS5lcXVhbHNJZ25vcmVDYXNlKGdldFZlcnNpb25TdHJpbmcoKSkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBMb2cudyhMT0dfVEFHLCAiRG91YmxlLXF1b3RlZCBwYXJhbXMgZm91bmQgaW4gdkNhcmQgMi4xLiAiICsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJTaWxlbnRseSBhbGxvdyBpdCIpOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGUgPSBTVEFURV9QQVJBTVNfSU5fRFFVT1RFOwotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGNoID09ICc7JykgeyAgLy8gU3RhcnRzIGFub3RoZXIgcGFyYW0uCi0gICAgICAgICAgICAgICAgICAgICAgICBoYW5kbGVQYXJhbXMobGluZS5zdWJzdHJpbmcobmFtZUluZGV4LCBpKSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBuYW1lSW5kZXggPSBpICsgMTsKLSAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChjaCA9PSAnOicpIHsgIC8vIEVuZCBvZiBwYXJhbSBhbmQgYmVnaW5lbm5pbmcgb2YgdmFsdWVzLgotICAgICAgICAgICAgICAgICAgICAgICAgaGFuZGxlUGFyYW1zKGxpbmUuc3Vic3RyaW5nKG5hbWVJbmRleCwgaSkpOwotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkgPCBsZW5ndGggLSAxKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvcGVydHlOYW1lQW5kVmFsdWVbMV0gPSBsaW5lLnN1YnN0cmluZyhpICsgMSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb3BlcnR5TmFtZUFuZFZhbHVlWzFdID0gIiI7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcHJvcGVydHlOYW1lQW5kVmFsdWU7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGNhc2UgU1RBVEVfUEFSQU1TX0lOX0RRVU9URTogewotICAgICAgICAgICAgICAgICAgICBpZiAoY2ggPT0gJyInKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoVkNhcmRDb25zdGFudHMuVkVSU0lPTl9WMjEuZXF1YWxzSWdub3JlQ2FzZShnZXRWZXJzaW9uU3RyaW5nKCkpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgTG9nLncoTE9HX1RBRywgIkRvdWJsZS1xdW90ZWQgcGFyYW1zIGZvdW5kIGluIHZDYXJkIDIuMS4gIiArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiU2lsZW50bHkgYWxsb3cgaXQiKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlID0gU1RBVEVfUEFSQU1TOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgIC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m9wZXJ0eVZhbHVlcyhhcnJheUxpc3QpOwotICAgICAgICAgICAgfSBjYXRjaCAoT3V0T2ZNZW1vcnlFcnJvciBlcnJvcikgewotICAgICAgICAgICAgICAgIExvZy5lKExPR19UQUcsICJPdXRPZk1lbW9yeUVycm9yIGhhcHBlbmVkIGR1cmluZyBwYXJzaW5nIEJBU0U2NCBkYXRhISIpOwotICAgICAgICAgICAgICAgIG1JbnRlcnByZXRlci5wcm9wZXJ0eVZhbHVlcyhudWxsKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIG1UaW1lSGFuZGxlQmFzZTY0ICs9IFN5c3RlbS5jdXJyZW50VGltZU1pbGxpcygpIC0gc3RhcnQ7Ci0gICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICBpZiAoISh1cHBlckVuY29kaW5nLmVxdWFscygiN0JJVCIpIHx8IHVwcGVyRW5jb2RpbmcuZXF1YWxzKCI4QklUIikgfHwKLSAgICAgICAgICAgICAgICAgICAgdXBwZXJFbmNvZGluZy5zdGFydHNXaXRoKCJYLSIpKSkgewotICAgICAgICAgICAgICAgIExvZy53KExPR19UQUcsCi0gICAgICAgICAgICAgICAgICAgICAgICBTdHJpbmcuZm9ybWF0KCJUaGUgZW5jb2RpbmcgXCIlc1wiIGlzIHVuc3VwcG9ydGVkIGJ5IHZDYXJkICVzIiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUN1cnJlbnRFbmNvZGluZywgZ2V0VmVyc2lvblN0cmluZygpKSk7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIC8vIFNvbWUgZGV2aWNlIHVzZXMgbGluZSBmb2xkaW5nIGRlZmluZWQgaW4gUkZDIDI0MjUsIHdoaWNoIGlzIG5vdCBhbGxvd2VkCi0gICAgICAgICAgICAvLyBpbiB2Q2FyZCAyLjEgKHdoaWxlIG5lZWRlZCBpbiB2Q2FyZCAzLjApLgotICAgICAgICAgICAgLy8KLSAgICAgICAgICAgIC8vIGUuZy4KLSAgICAgICAgICAgIC8vIEJFR0lOOlZDQVJECi0gICAgICAgICAgICAvLyBWRVJTSU9OOjIuMQotICAgICAgICAgICAgLy8gTjo7T21lZ2E7OzsKLSAgICAgICAgICAgIC8vIEVNQUlMO0lOVEVSTkVUOiJPbWVnYSIKLSAgICAgICAgICAgIC8vICAgPG9tZWdhQGV4YW1wbGUuY29tPgotICAgICAgICAgICAgLy8gRk46T21lZ2EKLSAgICAgICAgICAgIC8vIEVORDpWQ0FSRAotICAgICAgICAgICAgLy8KLSAgICAgICAgICAgIC8vIFRoZSB2Q2FyZCBhYm92ZSBhc3N1bWVzIHRoYXQgZW1haWwgYWRkcmVzcyBzaG91bGQgYmVjb21lOgotICAgICAgICAgICAgLy8gIk9tZWdhIiA8b21lZ2FAZXhhbXBsZS5jb20+Ci0gICAgICAgICAgICAvLwotICAgICAgICAgICAgLy8gQnV0IHZDYXJkIDIuMSByZXF1aXJlcyBRdW90ZS1QcmludGFibGUgd2hlbiBhIGxpbmUgY29udGFpbnMgbGluZSBicmVhayhzKS4KLSAgICAgICAgICAgIC8vCi0gICAgICAgICAgICAvLyBGb3IgbW9yZSBpbmZvcm1hdGlvbiBhYm91dCBsaW5lIGZvbGRpbmcsCi0gICAgICAgICAgICAvLyBzZWUgIjUuOC4xLiBMaW5lIGRlbGltaXRpbmcgYW5kIGZvbGRpbmciIGluIFJGQyAyNDI1LgotICAgICAgICAgICAgLy8KLSAgICAgICAgICAgIC8vIFdlIHRha2UgY2FyZSBvZiB0aGlzIGNhc2UgbW9yZSBmb3JtYWxseSBpbiB2Q2FyZCAzLjAsIHNvIHdlIG9ubHkgbmVlZCB0bwotICAgICAgICAgICAgLy8gZG8gdGhpcyBpbiB2Q2FyZCAyLjEuCi0gICAgICAgICAgICBpZiAoZ2V0VmVyc2lvbigpID09IFZDYXJkQ29uZmlnLlZFUlNJT05fMjEpIHsKLSAgICAgICAgICAgICAgICBTdHJpbmdCdWlsZGVyIGJ1aWxkZXIgPSBudWxsOwotICAgICAgICAgICAgICAgIHdoaWxlICh0cnVlKSB7Ci0gICAgICAgICAgICAgICAgICAgIGZpbmFsIFN0cmluZyBuZXh0TGluZSA9IHBlZWtMaW5lKCk7Ci0gICAgICAgICAgICAgICAgICAgIC8vIFdlIGRvbid0IG5lZWQgdG8gY2FyZSB0b28gbXVjaCBhYm91dCB0aGlzIGV4Y2VwdGlvbmFsIGNhc2UsCi0gICAgICAgICAgICAgICAgICAgIC8vIGJ1dCB3ZSBzaG91bGQgbm90IHdyb25nbHkgZWF0IHVwICJFTkQ6VkNBUkQiLCBzaW5jZSBpdCBjcml0aWNhbGx5Ci0gICAgICAgICAgICAgICAgICAgIC8vIGJyZWFrcyB0aGlzIHBhcnNlcidzIHN0YXRlIG1hY2hpbmUuCi0gICAgICAgICAgICAgICAgICAgIC8vIFRodXMgd2Ugcm91Z2hseSBsb29rIG92ZXIgdGhlIG5leHQgbGluZSBhbmQgY29uZmlybSBpdCBpcyBhdCBsZWFzdCBub3QKLSAgICAgICAgICAgICAgICAgICAgLy8gIkVORDpWQ0FSRCIuIFRoaXMgZXh0cmEgZmVlIGlzIHdvcnRoIHBheWluZy4gVGhpcyBpcyBleGNlcHRpb25hbAotICAgICAgICAgICAgICAgICAgICAvLyBhbnl3YXkuCi0gICAgICAgICAgICAgICAgICAgIGlmICghVGV4dFV0aWxzLmlzRW1wdHkobmV4dExpbmUpICYmCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV4dExpbmUuY2hhckF0KDApID09ICcgJyAmJgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICEiRU5EOlZDQVJEIi5jb250YWlucyhuZXh0TGluZS50b1VwcGVyQ2FzZSgpKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgZ2V0TGluZSgpOyAgLy8gRHJvcCB0aGUgbmV4dCBsaW5lLgotCi0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoYnVpbGRlciA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnVpbGRlciA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQocHJvcGVydHlWYWx1ZSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICBidWlsZGVyLmFwcGVuZChuZXh0TGluZS5zdWJzdHJpbmcoMSkpOwotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgaWYgKGJ1aWxkZXIgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICBwcm9wZXJ0eVZhbHVlID0gYnVpbGRlci50b1N0cmluZygpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgZmluYWwgbG9uZyBzdGFydCA9IFN5c3RlbS5jdXJyZW50VGltZU1pbGxpcygpOwotICAgICAgICAgICAgQXJyYXlMaXN0PFN0cmluZz4gdiA9IG5ldyBBcnJheUxpc3Q8U3RyaW5nPigpOwotICAgICAgICAgICAgdi5hZGQobWF5YmVVbmVzY2FwZVRleHQocHJvcGVydHlWYWx1ZSkpOwotICAgICAgICAgICAgbUludGVycHJldGVyLnByb3BlcnR5VmFsdWVzKHYpOwotICAgICAgICAgICAgbVRpbWVIYW5kbGVNaXNjUHJvcGVydHlWYWx1ZSArPSBTeXN0ZW0uY3VycmVudFRpbWVNaWxsaXMoKSAtIHN0YXJ0OwotICAgICAgICB9Ci0gICAgfQotCi0gICAgLyoqCi0gICAgICogPHA+Ci0gICAgICogUGFyc2VzIGFuZCByZXR1cm5zIFF1b3RlZC1QcmludGFibGUuCi0gICAgICogPC9wPgotICAgICAqCi0gICAgICogQHBhcmFtIGZpcnN0U3RyaW5nIFRoZSBzdHJpbmcgZm9sbG93aW5n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9tIFJGQyAyMDQ1KQotICAgICAgICAvLyBOb3cncyB0aGUgdGltZSA9Ci0gICAgICAgIC8vIGZvciBhbGwgZm9sayB0byBjb21lPQotICAgICAgICAvLyB0byB0aGUgYWlkIG9mIHRoZWlyIGNvdW50cnkuCi0gICAgICAgIGlmIChmaXJzdFN0cmluZy50cmltKCkuZW5kc1dpdGgoIj0iKSkgewotICAgICAgICAgICAgLy8gcmVtb3ZlICJ0cmFuc3BvcnQtcGFkZGluZyIKLSAgICAgICAgICAgIGludCBwb3MgPSBmaXJzdFN0cmluZy5sZW5ndGgoKSAtIDE7Ci0gICAgICAgICAgICB3aGlsZSAoZmlyc3RTdHJpbmcuY2hhckF0KHBvcykgIT0gJz0nKSB7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBTdHJpbmdCdWlsZGVyIGJ1aWxkZXIgPSBuZXcgU3RyaW5nQnVpbGRlcigpOwotICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQoZmlyc3RTdHJpbmcuc3Vic3RyaW5nKDAsIHBvcyArIDEpKTsKLSAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kKCJcclxuIik7Ci0gICAgICAgICAgICBTdHJpbmcgbGluZTsKLSAgICAgICAgICAgIHdoaWxlICh0cnVlKSB7Ci0gICAgICAgICAgICAgICAgbGluZSA9IGdldExpbmUoKTsKLSAgICAgICAgICAgICAgICBpZiAobGluZSA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBWQ2FyZEV4Y2VwdGlvbigiRmlsZSBlbmRlZCBkdXJpbmcgcGFyc2luZyBhIFF1b3RlZC1QcmludGFibGUgU3RyaW5nIik7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGlmIChsaW5lLnRyaW0oKS5lbmRzV2l0aCgiPSIpKSB7Ci0gICAgICAgICAgICAgICAgICAgIC8vIHJlbW92ZSAidHJhbnNwb3J0LXBhZGRpbmciCi0gICAgICAgICAgICAgICAgICAgIHBvcyA9IGxpbmUubGVuZ3RoKCkgLSAxOwotICAgICAgICAgICAgICAgICAgICB3aGlsZSAobGluZS5jaGFyQXQocG9zKSAhPSAnPScpIHsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBidWlsZGVyLmFwcGVuZChsaW5lLnN1YnN0cmluZygwLCBwb3MgKyAxKSk7Ci0gICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kKCJcclxuIik7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQobGluZSk7Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJldHVybiBidWlsZGVyLnRvU3RyaW5nKCk7Ci0gICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICByZXR1cm4gZmlyc3RTdHJpbmc7Ci0gICAgICAgIH0KLSAgICB9Ci0KLSAgICBwcm90ZWN0ZWQgU3RyaW5nIGdldEJhc2U2NChTdHJpbmcgZmlyc3RTdHJpbmcpIHRocm93cyBJT0V4Y2VwdGlvbiwgVkNhcmRFeGNlcHRpb24gewotICAgICAgICBTdHJpbmdCdWlsZGVyIGJ1aWxkZXIgPSBuZXcgU3RyaW5nQnVpbGRlcigpOwotICAgICAgICBidWlsZGVyLmFwcGVuZChmaXJzdFN0cmluZyk7Ci0KLSAgICAgICAgd2hpbGUgKHRydWUpIHsKLSAgICAgICAgICAgIFN0cmluZyBsaW5lID0gZ2V0TGluZSgpOwotICAgICAgICAgICAgaWYgKGxpbmUgPT0gbnVsbCkgewotICAgICAgICAgICAgICAgIHRocm93IG5ldyBWQ2FyZEV4Y2VwdGlvbigiRmlsZSBlbmRlZCBkdXJpbmcgcGFyc2luZyBCQVNFNjQgYmluYXJ5Iik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAobGluZS5s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rpbmc7Ci0gICAgfQotCi0gICAgcHJvdGVjdGVkIFN0cmluZyBnZXREZWZhdWx0RW5jb2RpbmcoKSB7Ci0gICAgICAgIHJldHVybiBERUZBVUxUX0VOQ09ESU5HOwotICAgIH0KLQotCi0gICAgcHVibGljIHZvaWQgcGFyc2UoSW5wdXRTdHJlYW0gaXMsIFZDYXJkSW50ZXJwcmV0ZXIgaW50ZXJwcmV0ZXIpCi0gICAgICAgICAgICB0aHJvd3MgSU9FeGNlcHRpb24sIFZDYXJkRXhjZXB0aW9uIHsKLSAgICAgICAgaWYgKGlzID09IG51bGwpIHsKLSAgICAgICAgICAgIHRocm93IG5ldyBOdWxsUG9pbnRlckV4Y2VwdGlvbigiSW5wdXRTdHJlYW0gbXVzdCBub3QgYmUgbnVsbC4iKTsKLSAgICAgICAgfQotCi0gICAgICAgIGZpbmFsIElucHV0U3RyZWFtUmVhZGVyIHRtcFJlYWRlciA9IG5ldyBJbnB1dFN0cmVhbVJlYWRlcihpcywgbUludGVybWVkaWF0ZUNoYXJzZXQpOwotICAgICAgICBtUmVhZGVyID0gbmV3IEN1c3RvbUJ1ZmZlcmVkUmVhZGVyKHRtcFJlYWRlcik7Ci0KLSAgICAgICAgbUludGVycHJldGVyID0gKGludGVycHJldGVyICE9IG51bGwgPyBpbnRlcnByZXRlciA6IG5ldyBFbXB0eUludGVycHJldGVyKCkpOwotCi0gICAgICAgIGZpbmFsIGxvbmcgc3RhcnQgPSBTeXN0ZW0uY3VycmVudFRpbWVNaWxsaXMoKTsKLSAgICAgICAgaWYgKG1JbnRlcnByZXRlciAhPSBudWxsKSB7Ci0gICAgICAgICAgICBtSW50ZXJwcmV0ZXIuc3RhcnQoKTsKLSAgICAgICAgfQotICAgICAgICBwYXJzZVZDYXJkRmlsZSgpOwotICAgICAgICBpZiAobUludGVycHJldGVyICE9IG51bGwpIHsKLSAgICAgICAgICAgIG1JbnRlcnByZXRlci5lbmQoKTsKLSAgICAgICAgfQotICAgICAgICBtVGltZVRvd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pb3VzTGluZSAhPSBudWxsKSB7Ci0gICAgICAgICAgICBTdHJpbmcgcmV0ID0gbVByZXZpb3VzTGluZTsKLSAgICAgICAgICAgIG1QcmV2aW91c0xpbmUgPSBudWxsOwotICAgICAgICAgICAgcmV0dXJuIHJldDsKLSAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgIHJldHVybiBtUmVhZGVyLnJlYWRMaW5lKCk7Ci0gICAgICAgIH0KLSAgICB9Ci0KLSAgICAvKioKLSAgICAgKiB2Q2FyZCAzLjAgcmVxdWlyZXMgdGhhdCB0aGUgbGluZSB3aXRoIHNwYWNlIGF0IHRoZSBiZWdpbm5pbmcgb2YgdGhlIGxpbmUKLSAgICAgKiBtdXN0IGJlIGNvbWJpbmVkIHdpdGggcHJldmlvdXMgbGluZS4KLSAgICAgKi8KLSAgICBAT3ZlcnJpZGUKLSAgICBwcm90ZWN0ZWQgU3RyaW5nIGdldE5vbkVtcHR5TGluZSgpIHRocm93cyBJT0V4Y2VwdGlvbiwgVkNhcmRFeGNlcHRpb24gewotICAgICAgICBTdHJpbmcgbGluZTsKLSAgICAgICAgU3RyaW5nQnVpbGRlciBidWlsZGVyID0gbnVsbDsKLSAgICAgICAgd2hpbGUgKHRydWUpIHsKLSAgICAgICAgICAgIGxpbmUgPSBtUmVhZGVyLnJlYWRMaW5lKCk7Ci0gICAgICAgICAgICBpZiAobGluZSA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgaWYgKGJ1aWxkZXIgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICByZXR1cm4gYnVpbGRlci50b1N0cmluZygpOwotICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobVByZXZpb3VzTGluZSAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIFN0cmluZyByZXQgPSBtUHJldmlvdXNMaW5lOwotICAgICAgICAgICAgICAgICAgICBtUHJldmlvdXNMaW5lID0gbnVsbDsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJldDsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgdGhyb3cgbmV3IFZDYXJkRXhjZXB0aW9uKCJSZWFjaGVkIGVuZCBvZiBidWZmZXIuIik7Ci0gICAgICAgICAgICB9IGVsc2UgaWYgKGxpbmUubGVuZ3RoKCkgPT0gMCkgewotICAgICAgICAgICAgICAgIGlmIChidWlsZGVyICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGJ1aWxkZXIudG9TdHJpbmcoKTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKG1QcmV2aW91c0xpbmUgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICBTdHJpbmcgcmV0ID0gbVByZXZpb3VzTGluZTsKLSAgICAgICAgICAgICAgICAgICAgbVByZXZpb3VzTGluZSA9IG51bGw7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiByZXQ7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfSBlbHNlIGlmIChsaW5lLmNoYXJBdCgwKSA9PSAnICcgfHwgbGluZS5jaGFyQXQoMCkgPT0gJ1x0JykgewotICAgICAgICAgICAgICAgIGlmIChidWlsZGVyICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgLy8gU2VlIFNlY3Rpb24gNS44LjEgb2YgUkZDIDI0MjUgKE1JTUUtRElSIGRvY3VtZW50KS4KLSAgICAgICAgICAgICAgICAgICAgLy8gRm9sbG93aW5nIGlzIHRoZSBleGNlcnB0cyBmcm9tIGl0LgotICAgICAgICAgICAgICAgICAgICAvLwotICAgICAgICAgICAgICAgICAgICAvLyBERVNDUklQVElPTjpUaGlzIGlzIGEgbG9uZyBkZXNjcmlwdGlvbiB0aGF0IGV4aXN0cyBvbiBhIGxvbmcgbGluZS4KLSAgICAgICAgICAgICAgICAgICAgLy8KLSAgICAgICAgICAgICAgICAgICAgLy8gQ2FuIGJlIHJlcHJlc2VudGVkIGFzOgotICAgICAgICAgICAgICAgICAgICAvLwotICAgICAgICAgICAgICAgICAgICAvLyBERVNDUklQVElPTjpUaGlzIGlzIGEgbG9uZyBkZXNjcmlwdGlvbgotICAgICAgICAgICAgICAgICAgICAvLyAgdGhhdCBleGlzdHMgb24gYSBsb25nIGxpbmUuCi0gICAgICAgICAgICAgICAgICAgIC8vCi0gICAgICAgICAgICAgICAgICAgIC8vIEl0IGNvdWxkIGFsc28gYmUgcmVwcmVzZW50ZWQgYXM6Ci0gICAgICAgICAgICAgICAgICAgIC8vCi0gICAgICAgICAgICAgICAgICAgIC8vIERFU0NSSVBUSU9OOlRoaXMgaXMgYSBsb25nIGRlc2NyaXAKLSAgICAgICAgICAgICAgICAgICAgLy8gIHRpb24gdGhhdCBleGlzdHMgbwotICAgICAgICAgICAgICAgICAgICAvLyAgbiBhIGxvbmcgbGluZS4KLSAgICAgICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQobGluZS5zdWJzdHJpbmcoMSkpOwotICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobVByZXZpb3VzTGluZSAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIgPSBuZXcgU3RyaW5nQnVpbGRlcigpOwotICAgICAgICAgICAgICAgICAgICBidWlsZGVyLmFwcGVuZChtUHJldmlvdXNMaW5lKTsKLSAgICAgICAgICAgICAgICAgICAgbVByZXZpb3VzTGluZSA9IG51bGw7Ci0gICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kKGxpbmUuc3Vic3RyaW5nKDEpKTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgVkNhcmRFeGNlcHRpb24oIlNwYWNlIGV4aXN0cyBhdCB0aGUgYmVnaW5uaW5nIG9mIHRoZSBsaW5lIik7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBpZiAobVByZXZpb3VzTGluZSA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1QcmV2aW91c0xpbmUgPSBsaW5lOwotICAgICAgICAgICAgICAgICAgICBpZiAoYnVpbGRlciAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYnVpbGRlci50b1N0cmluZygpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgU3RyaW5nIHJldCA9IG1QcmV2aW91c0xpbmU7Ci0gICAgICAgICAgICAgICAgICAgIG1QcmV2aW91c0xpbmUgPSBsaW5lOwotICAgICAgICAgICAgICAgICAgICByZXR1cm4gcmV0OwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgIH0KLQotICAgIC8qCi0gICAgICogdmNhcmQgPSBbZ3JvdXAgIi4iXSAiQkVHSU4iICI6IiAiVkNBUkQiIDEgKiBDUkxGCi0gICAgICogICAgICAgICAxICogKGNvbnRlbnRsaW5lKQotICAgICAqICAgICAgICAgO0EgdkNhcmQgb2JqZWN0IE1VU1QgaW5jbHVkZSB0aGUgVkVSU0lPTiwgRk4gYW5kIE4gdHlwZXMuCi0gICAgICogICAgICAgICBbZ3JvdXAgIi4iXSAiRU5EIiAiOiIgIlZDQVJEIiAxICogQ1JMRgotICAgICAqLwotICAgIEBPdmVycmlkZQotICAgIHByb3RlY3RlZCBib29sZWFuIHJlYWRCZWdpblZDYXJkKGJvb2xlYW4gYWxsb3dHYXJiYWdlKSB0aHJvd3MgSU9FeGNlcHRpb24sIFZDYXJkRXhjZXB0aW9uIHsKLSAgICAgICAgLy8gVE9ETzogdkNhcmQgMy4wIHN1cHBvcnRzIGdyb3VwLgotICAgICAgICByZXR1cm4gc3VwZXIucmVhZEJlZ2luVkNhcmQoYWxsb3dHYXJiYWdlKTsKLSAgICB9Ci0KLSAgICBAT3ZlcnJpZGUKLSAgICBwcm90ZWN0ZW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DppbnNpZGUuZHF1b3RlCi0gICAgICAgIC8vIC0gcHJlZgotICAgICAgICAvLwotICAgICAgICAvLyBOb3RlOiBUaG91Z2ggdGhlcmUncyBhIGNvZGUsIHdlIGRvbid0IG5lZWQgdG8gdGFrZSBtdWNoIGNhcmUgb2YKLSAgICAgICAgLy8gd3JvbmdseS1hZGRlZCBxdW90ZXMgbGlrZSB0aGUgZXhhbXBsZSBhYm92ZSwgYXMgdGhleSBpbmR1Y2UKLSAgICAgICAgLy8gcGFyc2UgZXJyb3JzIGF0IHRoZSB0b3AgbGV2ZWwgKHdoZW4gc3BsaXR0aW5nIGEgbGluZSBpbnRvIHBhcnRzKS4KLSAgICAgICAgU3RyaW5nQnVpbGRlciBidWlsZGVyID0gbnVsbDsgIC8vIERlbGF5IGluaXRpYWxpemF0aW9uLgotICAgICAgICBib29sZWFuIGluc2lkZURxdW90ZSA9IGZhbHNlOwotICAgICAgICBmaW5hbCBpbnQgbGVuZ3RoID0gcGFyYW1WYWx1ZS5sZW5ndGgoKTsKLSAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBsZW5ndGg7IGkrKykgewotICAgICAgICAgICAgZmluYWwgY2hhciBjaCA9IHBhcmFtVmFsdWUuY2hhckF0KGkpOwotICAgICAgICAgICAgaWYgKGNoID09ICciJykgewotICAgICAgICAgICAgICAgIGlmIChpbnNpZGVEcXVvdGUpIHsKLSAgICAgICAgICAgICAgICAgICAgLy8gRW5kIG9mIERxdW90ZS4KLSAgICAgICAgICAgICAgICAgICAgbUludGVycHJldGVyLnByb3BlcnR5UGFyYW1WYWx1ZShidWlsZGVyLnRvU3RyaW5nKCkpOwotICAgICAgICAgICAgICAgICAgICBidWlsZGVyID0gbnVsbDsKLSAgICAgICAgICAgICAgICAgICAgaW5zaWRlRHF1b3RlID0gZmFsc2U7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKGJ1aWxkZXIgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGJ1aWxkZXIubGVuZ3RoKCkgPiAwKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gZS5nLgotICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHByZWYicXVvdGVkIgotICAgICAgICAgICAgICAgICAgICAgICAgICAgIExvZy53KExPR19UQUcsICJVbmV4cGVjdGVkIERxdW90ZSBpbnNpZGUgcHJvcGVydHkuIik7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGUuZy4KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBwcmVmLCJxdW90ZWQiCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gInF1b3RlZCIscHJlZgotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1JbnRlcnByZXRlci5wcm9wZXJ0eVBhcmFtVmFsdWUoYnVpbGRlci50b1N0cmluZygpKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBpbnNpZGVEcXVvdGUgPSB0cnVlOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0gZWxzZSBpZiAoY2ggPT0gJywnICYmICFpbnNpZGVEcXVvdGUpIHsKLSAgICAgICAgICAgICAgICBpZiAoYnVpbGRlciA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIExvZy53KExPR19UQUcsICJDb21tYSBpcyB1c2VkIGJlZm9yZSBhY3R1YWwgc3RyaW5nIGNvbWVzLiAoIiArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW1WYWx1ZSArICIpIik7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgbUludGVycHJldGVyLnByb3BlcnR5UGFyYW1WYWx1ZShidWlsZGVyLnRvU3RyaW5nKCkpOwotICAgICAgICAgICAgICAgICAgICBidWlsZGVyID0gbnVsbDsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIC8vIFRvIHN0b3AgY3JlYXRpbmcgZW1wdHkgU3RyaW5nQnVmZmVyIGF0IHRoZSBlbmQgb2YgcGFyYW1ldGVyLAotICAgICAgICAgICAgICAgIC8vIHdlIGRlbGF5IGNyZWF0aW5nIHRoaXMgb2JqZWN0IHVudGlsIHRoaXMgcG9pbnQuCi0gICAgICAgICAgICAgICAgaWYgKGJ1aWxkZXIgPT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICBidWlsZGVyID0gbmV3IFN0cmluZ0J1aWxkZXIoKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQoY2gpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgICAgIGlmIChpbnNpZGVEcXVvdGUpIHsKLSAgICAgICAgICAgIC8vIGUuZy4KLSAgICAgICAgICAgIC8vICJub24tcXVvdGUtYXQtZW5kCi0gICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiRGFuZ2xpbmcgRHF1b3RlLiIpOwotICAgICAgICB9Ci0gICAgICAgIGlmIChidWlsZGVyICE9IG51bGwpIHsKLSAgICAgICAgICAgIGlmIChidWlsZGVyLmxlbmd0aCgpID09IDApIHsKLSAgICAgICAgICAgICAgICBMb2cudyhMT0dfVEFHLCAiVW5pbnRlbmRlZCBiZWhhdmlvci4gV2UgbXVzdCBub3Qgc2VlIGVtcHR5IFN0cmluZ0J1aWxkZXIgIiArCi0gICAgICAgICAgICAgICAgICAgICAgICAiYXQgdGhlIGVuZCBvZiBwYXJhbWV0ZXIgdmFsdWUgcGFyc2luZy4iKTsKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgbUludGVycHJldGVyLnByb3BlcnR5UGFyYW1WYWx1ZShidWlsZGVyLnRvU3RyaW5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FydHNXaXRoKCIgIikgJiYgIWxpbmUuc3RhcnRzV2l0aCgiXHQiKSkgewotICAgICAgICAgICAgICAgIG1QcmV2aW91c0xpbmUgPSBsaW5lOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQobGluZSk7Ci0gICAgICAgIH0KLQotICAgICAgICByZXR1cm4gYnVpbGRlci50b1N0cmluZygpOwotICAgIH0KLQotICAgIC8qKgotICAgICAqIEVTQ0FQRUQtQ0hBUiA9ICJcXCIgLyAiXDsiIC8gIlwsIiAvICJcbiIgLyAiXE4iKQotICAgICAqICAgICAgICAgICAgICA7IFxcIGVuY29kZXMgXCwgXG4gb3IgXE4gZW5jb2RlcyBuZXdsaW5lCi0gICAgICogICAgICAgICAgICAgIDsgXDsgZW5jb2RlcyA7LCBcLCBlbmNvZGVzICwKLSAgICAgKgotICAgICAqIE5vdGU6IEFwcGxlIGVzY2FwZXMgJzonIGludG8gJ1w6JyB3aGlsZSBkb2VzIG5vdCBlc2NhcGUgJ1wnCi0gICAgICovCi0gICAgQE92ZXJyaWRlCi0gICAgcHJvdGVjdGVkIFN0cmluZyBtYXliZVVuZXNjYXBlVGV4dChmaW5hbCBTdHJpbmcgdGV4dCkgewotICAgICAgICByZXR1cm4gdW5lc2NhcGVUZXh0KHRleHQpOwotICAgIH0KLQotICAgIHB1YmxpYyBzdGF0aWMgU3RyaW5nIHVuZXNjYXBlVGV4dChmaW5hbCBTdHJpbmcgdGV4dCkgewotICAgICAgICBTdHJpbmdCdWlsZGVyIGJ1aWxkZXIgPSBuZXcgU3RyaW5nQnVpbGRlcigpOwotICAgICAgICBmaW5hbCBpbnQgbGVuZ3RoID0gdGV4dC5sZW5ndGgoKTsKLSAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBsZW5ndGg7IGkrKykgewotICAgICAgICAgICAgY2hhciBjaCA9IHRleHQuY2hhckF0KGkpOwotICAgICAgICAgICAgaWYgKGNoID09ICdcXCcgJiYgaSA8IGxlbmd0aCAtIDEpIHsKLSAgICAgICAgICAgICAgICBmaW5hbCBjaGFyIG5leHRfY2ggPSB0ZXh0LmNoYXJBdCgrK2kpOwotICAgICAgICAgICAgICAgIGlmIChuZXh0X2NoID09ICduJyB8fCBuZXh0X2NoID09ICdOJykgewotICAgICAgICAgICAgICAgICAgICBidWlsZGVyLmFwcGVuZCgiXG4iKTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBidWlsZGVyLmFwcGVuZChuZXh0X2NoKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kKGNoKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgICAgICByZXR1cm4gYnVpbGRlci50b1N0cmluZygpOwotICAgIH0KLQotICAgIEBPdmVycmlkZQotICAgIHByb3RlY3RlZCBTdHJpbmcgbWF5YmVVbmVzY2FwZUNoYXJhY3RlcihmaW5hbCBjaGFyIGNoKSB7Ci0gICAgICAgIHJldHVybiB1bmVzY2FwZUNoYXJhY3RlcihjaCk7Ci0gICAgfQotCi0gICAgcHVibGljIHN0YXRpYyBTdHJpbmcgdW5lc2NhcGVDaGFyYWN0ZXIoZmluYWwgY2hhciBjaCkgewotICAgICAgICBpZiAoY2ggPT0gJ24nIHx8IGNoID09ICdOJykgewotICAgICAgICAgICAgcmV0dXJuICJcbiI7Ci0gICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICByZXR1cm4gU3RyaW5nLnZhbHVlT2YoY2gpOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgQE92ZXJyaWRlCi0gICAgcHJvdGVjdGVkIFNldDxTdHJpbmc+IGdldEtub3duUHJvcGVydHlOYW1lU2V0KCkgewotICAgICAgICByZXR1cm4gVkNhcmRQYXJzZXJfVjMwLnNLbm93blByb3BlcnR5TmFtZVNldDsKLSAgICB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uIFZDYXJkQ29uZmlnLlZDQVJEX1RZUEVfVjIxX0pBUEFORVNFX01PQklMRTsKLSAgICAgICAgICAgIGNhc2UgUEFSU0VfVFlQRV9BUFBMRToKLSAgICAgICAgICAgIGNhc2UgUEFSU0VfVFlQRV9XSU5ET1dTX01PQklMRV9WNjVfSlA6Ci0gICAgICAgICAgICBkZWZhdWx0OiB7Ci0gICAgICAgICAgICAgICAgaWYgKG1WZXJzaW9uID09IFZDYXJkQ29uZmlnLlZFUlNJT05fMjEpIHsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFZDYXJkQ29uZmlnLlZDQVJEX1RZUEVfVjIxX0dFTkVSSUM7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChtVmVyc2lvbiA9PSBWQ2FyZENvbmZpZy5WRVJTSU9OXzMwKSB7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiBWQ2FyZENvbmZpZy5WQ0FSRF9UWVBFX1YzMF9HRU5FUklDOwotICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobVZlcnNpb24gPT0gVkNhcmRDb25maWcuVkVSU0lPTl80MCkgewotICAgICAgICAgICAgICAgICAgICByZXR1cm4gVkNhcmRDb25maWcuVkNBUkRfVFlQRV9WNDBfR0VORVJJQzsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICByZXR1cm4gVkNhcmRDb25maWcuVkNBUkRfVFlQRV9VTktOT1dOOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgIH0KLQotICAgIC8qKgotICAgICAqIDxwPgotICAgICAqIFJldHVybnMgY2hhcnNldCBTdHJpbmcgZ3Vlc3NlZCBmcm9tIHRoZSBzb3VyY2UncyBwcm9wZXJ0aWVzLgotICAgICAqIFRoaXMgbWV0aG9kIG11c3QgYmUgY2FsbGVkIGFmdGVyIHBhcnNpbmcgdGFyZ2V0IGZpbGUocykuCi0gICAgICogPC9wPgotICAgIC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ICAgICAgICAgICAgICAgdHlwZVN0cmluZyA9IHR5cGVTdHJpbmcudG9VcHBlckNhc2UoKTsKLSAgICAgICAgICAgICAgICBpZiAodHlwZVN0cmluZy5lcXVhbHMoVkNhcmRDb25zdGFudHMuUEFSQU1fVFlQRV9QUkVGKSkgewotICAgICAgICAgICAgICAgICAgICBoYXNQcmVmID0gdHJ1ZTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHR5cGVTdHJpbmcuZXF1YWxzKFZDYXJkQ29uc3RhbnRzLlBBUkFNX1RZUEVfRkFYKSkgewotICAgICAgICAgICAgICAgICAgICBpc0ZheCA9IHRydWU7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVTdHJpbmcuc3RhcnRzV2l0aCgiWC0iKSAmJiB0eXBlIDwgMCkgewotICAgICAgICAgICAgICAgICAgICAgICAgdHlwZVN0cmluZyA9IHR5cGVTdHJpbmcuc3Vic3RyaW5nKDIpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIGlmICh0eXBlU3RyaW5nLmxlbmd0aCgpID09IDApIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIGZpbmFsIEludGVnZXIgdG1wID0gc0tub3duUGhvbmVUeXBlTWFwX1N0b0kuZ2V0KHR5cGVTdHJpbmcpOwotICAgICAgICAgICAgICAgICAgICBpZiAodG1wICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGZpbmFsIGludCB0eXBlQ2FuZGlkYXRlID0gdG1wOwotICAgICAgICAgICAgICAgICAgICAgICAgLy8gVFlQRV9QQUdFUiBpcyBwcmVmZXJlZCB3aGVuIHRoZSBudW1iZXIgY29udGFpbnMgQCBzdXJyb25kZWQgYnkKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIGEgcGFnZXIgbnVtYmVyIGFuZCBhIGRvbWFpbiBuYW1lLgotICAgICAgICAgICAgICAgICAgICAgICAgLy8gZS5nLgotICAgICAgICAgICAgICAgICAgICAgICAgLy8gbyAxMTExQGRvbWFpbi5jb20KLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIHggQGRvbWFpbi5jb20KLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIHggMTExMUAKLSAgICAgICAgICAgICAgICAgICAgICAgIGZpbmFsIGludCBpbmRleE9mQXQgPSBudW1iZXIuaW5kZXhPZigiQCIpOwotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCh0eXBlQ2FuZGlkYXRlID09IFBob25lLlRZUEVfUEFHRVIKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJiYgMCA8IGluZGV4T2ZBdCAmJiBpbmRleE9mQXQgPCBudW1iZXIubGVuZ3RoKCkgLSAxKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8fCB0eXBlIDwgMAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8fCB0eXBlID09IFBob25lLlRZUEVfQ1VTVE9NKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZSA9IHRtcDsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICh0eXBlIDwgMCkgewotICAgICAgICAgICAgICAgICAgICAgICAgdHlwZSA9IFBob25lLlRZUEVfQ1VTVE9NOwotICAgICAgICAgICAgICAgICAgICAgICAgbGFiZWwgPSB0eXBlU3RyaW5nOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgICAgIGlmICh0eXBlIDwgMCkgewotICAgICAgICAgICAgaWYgKGhhc1ByZWYpIHsKLSAgICAgICAgICAgICAgICB0eXBlID0gUGhvbmUuVFlQRV9NQUlOOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAvLyBkZWZhdWx0IHRvIFRZUEVfSE9NRQotICAgICAgICAgICAgICAgIHR5cGUgPSBQaG9uZS5UWVBFX0hPTUU7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICAgICAgaWYgKGlzRmF4KSB7Ci0gICAgICAgICAgICBpZiAodHlwZSA9PSBQaG9uZS5UWVBFX0hPTUUpIHsKLSAgICAgICAgICAgICAgICB0eXBlID0gUGhvbmUuVFlQRV9GQVhfSE9NRTsKLSAgICAgICAgICAgIH0gZWxzZSBpZiAodHlwZSA9PSBQaG9uZS5UWVBFX1dPUkspIHsKLSAgICAgICAgICAgICAgICB0eXBlID0gUGhvbmUuVFlQRV9GQVhfV09SSzsKLSAgICAgICAgICAgIH0gZWxzZSBpZiAodHlwZSA9PSBQaG9uZS5UWVBFX09USEVSKSB7Ci0gICAgICAgICAgICAgICAgdHlwZSA9IFBob25lLlRZUEVfT1RIRVJfRkFYOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgICAgIGlmICh0eXBlID09IFBob25lLlRZUEVfQ1VTVE9NKSB7Ci0gICAgICAgICAgICByZXR1cm4gbGFiZWw7Ci0gICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICByZXR1cm4gdHlwZTsKLSAgICAgICAgfQotICAgIH0KLQotICAgIEBTdXBwcmVzc1dhcm5pbmdzKCJkZXByZWNhdGlvbiIpCi0gICAgcHVibGljIHN0YXRpYyBib29sZWFuIGlzTW9iaWxlUGhvbmVMYWJlbChmaW5hbCBTdHJpbmcgbGFiZWwpIHsKLSAgICAgICAgLy8gRm9yIGJhY2t3YXJkIGNvbXBhdGliaWxpdHkuCi0gICAgICAgIC8vIERldGFpbDogVW50aWwgRG9udXQsIHRoZXJlIGlzbid0IFRZUEVfTU9CSUxFIGZvciBlbWFpbCB3aGlsZSB0aGVyZSBpcyBub3cuCi0gICAgICAgIC8vICAgICAgICAgVG8gc3VwcG9ydCBtb2JpbGUgdHlwZS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AgICAgICAgICBpZiAoY29udGFpbnNPbmx5UHJpbnRhYmxlQXNjaWkoZmFtaWx5TmFtZSkgJiYKLSAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRhaW5zT25seVByaW50YWJsZUFzY2lpKGdpdmVuTmFtZSkpIHsKLSAgICAgICAgICAgICAgICAgICAgbGlzdFswXSA9IGdpdmVuTmFtZTsKLSAgICAgICAgICAgICAgICAgICAgbGlzdFsxXSA9IG1pZGRsZU5hbWU7Ci0gICAgICAgICAgICAgICAgICAgIGxpc3RbMl0gPSBmYW1pbHlOYW1lOwotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIGxpc3RbMF0gPSBmYW1pbHlOYW1lOwotICAgICAgICAgICAgICAgICAgICBsaXN0WzFdID0gbWlkZGxlTmFtZTsKLSAgICAgICAgICAgICAgICAgICAgbGlzdFsyXSA9IGdpdmVuTmFtZTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBjYXNlIFZDYXJkQ29uZmlnLk5BTUVfT1JERVJfRVVST1BFOiB7Ci0gICAgICAgICAgICAgICAgbGlzdFswXSA9IG1pZGRsZU5hbWU7Ci0gICAgICAgICAgICAgICAgbGlzdFsxXSA9IGdpdmVuTmFtZTsKLSAgICAgICAgICAgICAgICBsaXN0WzJdID0gZmFtaWx5TmFtZTsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGRlZmF1bHQ6IHsKLSAgICAgICAgICAgICAgICBsaXN0WzBdID0gZ2l2ZW5OYW1lOwotICAgICAgICAgICAgICAgIGxpc3RbMV0gPSBtaWRkbGVOYW1lOwotICAgICAgICAgICAgICAgIGxpc3RbMl0gPSBmYW1pbHlOYW1lOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgICAgIHJldHV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aWxkZXIoKTsKLSAgICAgICAgZmluYWwgaW50IGxlbmd0aCA9IHZhbHVlLmxlbmd0aCgpOwotICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGxlbmd0aDsgaSsrKSB7Ci0gICAgICAgICAgICBjaGFyIGNoID0gdmFsdWUuY2hhckF0KGkpOwotICAgICAgICAgICAgaWYgKGNoID09ICdcXCcgJiYgaSA8IGxlbmd0aCAtIDEpIHsKLSAgICAgICAgICAgICAgICBjaGFyIG5leHRDaCA9IHZhbHVlLmNoYXJBdChpICsgMSk7Ci0gICAgICAgICAgICAgICAgZmluYWwgU3RyaW5nIHVuZXNjYXBlZFN0cmluZzsKLSAgICAgICAgICAgICAgICBpZiAoVkNhcmRDb25maWcuaXNWZXJzaW9uNDAodmNhcmRUeXBlKSkgewotICAgICAgICAgICAgICAgICAgICB1bmVzY2FwZWRTdHJpbmcgPSBWQ2FyZFBhcnNlckltcGxfVjQwLnVuZXNjYXBlQ2hhcmFjdGVyKG5leHRDaCk7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChWQ2FyZENvbmZpZy5pc1ZlcnNpb24zMCh2Y2FyZFR5cGUpKSB7Ci0gICAgICAgICAgICAgICAgICAgIHVuZXNjYXBlZFN0cmluZyA9IFZDYXJkUGFyc2VySW1wbF9WMzAudW5lc2NhcGVDaGFyYWN0ZXIobmV4dENoKTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBpZiAoIVZDYXJkQ29uZmlnLmlzVmVyc2lvbjIxKHZjYXJkVHlwZSkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIFVua25vd24gdkNhcmQgdHlwZQotICAgICAgICAgICAgICAgICAgICAgICAgTG9nLncoTE9HX1RBRywgIlVua25vd24gdkNhcmQgdHlwZSIpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIHVuZXNjYXBlZFN0cmluZyA9IFZDYXJkUGFyc2VySW1wbF9WMjEudW5lc2NhcGVDaGFyYWN0ZXIobmV4dENoKTsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBpZiAodW5lc2NhcGVkU3RyaW5nICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQodW5lc2NhcGVkU3RyaW5nKTsKLSAgICAgICAgICAgICAgICAgICAgaSsrOwotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kKGNoKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9IGVsc2UgaWYgKGNoID09ICc7JykgewotICAgICAgICAgICAgICAgIGxpc3QuYWRkKGJ1aWxkZXIudG9TdHJpbmcoKSk7Ci0gICAgICAgICAgICAgICAgYnVpbGRlciA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kKGNoKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgICAgICBsaXN0LmFkZChidWlsZGVyLnRvU3RyaW5nKCkpOwotICAgICAgICByZXR1cm4gbGlzdDsKLSAgICB9Ci0KLSAgICBwdWJsaWMgc3RhdGljIGJvb2xlYW4gY29udGFpbnNPbmx5UHJpbnRhYmxlQXNjaWkoZmluYWwgU3RyaW5nLi4udmFsdWVzKSB7Ci0gICAgICAgIGlmICh2YWx1ZXMgPT0gbnVsbCkgewotICAgICAgICAgICAgcmV0dXJuIHRydWU7Ci0gICAgICAgIH0KLSAgICAgICAgcmV0dXJuIGNvbnRhaW5zT25seVByaW50YWJsZUFzY2lpKEFycmF5cy5hc0xpc3QodmFsdWVzKSk7Ci0gICAgfQotCi0gICAgcHVibGljIHN0YXRpYyBib29sZWFuIGNvbnRhaW5zT25seVByaW50YWJsZUFzY2lpKGZpbmFsIENvbGxlY3Rpb248U3RyaW5nPiB2YWx1ZXMpIHsKLSAgICAgICAgaWYgKHZhbHVlcyA9PSBudWxsKSB7Ci0gICAgICAgICAgICByZXR1cm4gdHJ1ZTsKLSAgICAgICAgfQotICAgICAgICBmb3IgKGZpbmFsIFN0cmluZyB2YWx1ZSA6IHZhbHVlcykgewotICAgICAgICAgICAgaWYgKFRleHRVdGlscy5pc0VtcHR5KHZhbHVlKSkgewotICAgICAgICAgICAgICAgIGNvbnRpbnVlOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKCFUZXh0VXRpbHMuaXNQcmludGFibGVBc2NpaU9ubHkodmFsdWUpKSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgICAgIHJldHVybiB0cnVlOwotICAgIH0KLQotICAgIC8qKgotICAgICAqIDxwPgotICAgICAqIFRoaXMgaXMgdXNlZnVsIHdoZW4gY2hlY2tpbmcgdGhlIHN0cmluZyBzaG91bGQgYmUgZW5jb2RlZCBpbnRvIHF1b3RlZC1wcmludGFibGUKLSAgICAgKiBvciBub3QsIHdoaWNoIGlzIHJlcXVpcmVkIGJ5IHZDYXJkIDIuMS4KLSAgICAgKiA8L3A+Ci0gICAgICogPHA+Ci0gICAgICogU2VlIHRoZSBkZWZpbml0aW9uIG9mICI3Yml0IiBpbiB2Q2FyZCAyLjEgc3BlYyBmb3IgbW9yZSBpbmZvcm1hdGlvbi4KLSAgICAgKiA8L3A+Ci0gICAgICovCi0gICAgcHVibGljIHN0YXRpYyBib29sZWFuIGNvbnRhaW5zT25seU5vbkNyTGZQcmludGFibGVBc2NpaShmaW5hbCBTdHJpbmcuLi52YWx1ZXMpIHsKLSAgICAgICAgaWYgKHZhbHVlcyA9PSBudWxsKSB7Ci0gICAgICAgICAgICByZXR1cm4gdHJ1ZTsKLSAgICAgICAgfQotICAgICAgICByZXR1cm4gY29udGFpbnNPbmx5Tm9uQ3JMZlByaW50YWJsZUFzY2lpKEFycmF5cy5hc0xpc3QodmFsdWVzKSk7Ci0gICAgfQotCi0gICAgcHVibGljIHN0YXRpYyBib29sZWFuIGNvbnRhaW5zT25seU5vbkNyTGZQcmludGFibGVBc2NpaShmaW5hbCBDb2xsZWN0aW9uPFN0cmluZz4gdmFsdWVzKSB7Ci0gICAgICAgIGlmICh2YWx1ZXMgPT0gbnVsbCkgewotICAgICAgICAgICAgcmV0dXJuIHRydWU7Ci0gICAgICAgIH0KLSAgICAgICAgZmluYWwgaW50IGFzY2lpRmlyc3QgPSAweDIwOwotICAgICAgICBmaW5hbCBpbnQgYXNjaWlMYXN0ID0gMHg3RTsgIC8vIGluY2x1ZGVkCi0gICAgICAgIGZvciAoZmluYWwgU3RyaW5nIHZhbHVlIDogdmFsdWVzKSB7Ci0gICAgICAgICAgICBpZiAoVGV4dFV0aWxzLmlzRW1wdHkodmFsdWUpKSB7Ci0gICAgICAgICAgICAgICAgY29udGludWU7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBmaW5hbCBpbnQgbGVuZ3RoID0gdmFsdWUubGVuZ3RoKCk7Ci0gICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGxlbmd0aDsgaSA9IHZhbHVlLm9mZnNldEJ5Q29kZVBvaW50cyhpLCAxKSkgewotICAgICAgICAgICAgICAgIGZpbmFsIGludCBjID0gdmFsdWUuY29kZVBvaW50QXQoaSk7Ci0gICAgICAgICAgICAgICAgaWYgKCEoYXNjaWlGaXJzdCA8PSBjICYmIGMgPD0gYXNjaWlMYXN0KSkgewotICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgICAgIHJldHVybiB0cnVlOwotICAgIH0KLQotICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIFNldDxDaGFyYWN0ZXI+IHNVbkFjY2VwdGFibGVBc2NpaUluVjIxV29yZFNldCA9Ci0gICAgICAgIG5ldyBIYXNoU2V0PEN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0KHZhbHVlcykpOwotICAgIH0KLQotICAgIHB1YmxpYyBzdGF0aWMgYm9vbGVhbiBjb250YWluc09ubHlBbHBoYURpZ2l0SHlwaGVuKGZpbmFsIENvbGxlY3Rpb248U3RyaW5nPiB2YWx1ZXMpIHsKLSAgICAgICAgaWYgKHZhbHVlcyA9PSBudWxsKSB7Ci0gICAgICAgICAgICByZXR1cm4gdHJ1ZTsKLSAgICAgICAgfQotICAgICAgICBmaW5hbCBpbnQgdXBwZXJBbHBoYWJldEZpcnN0ID0gMHg0MTsgIC8vIEEKLSAgICAgICAgZmluYWwgaW50IHVwcGVyQWxwaGFiZXRBZnRlckxhc3QgPSAweDViOyAgLy8gWwotICAgICAgICBmaW5hbCBpbnQgbG93ZXJBbHBoYWJldEZpcnN0ID0gMHg2MTsgIC8vIGEKLSAgICAgICAgZmluYWwgaW50IGxvd2VyQWxwaGFiZXRBZnRlckxhc3QgPSAweDdiOyAgLy8gewotICAgICAgICBmaW5hbCBpbnQgZGlnaXRGaXJzdCA9IDB4MzA7ICAvLyAwCi0gICAgICAgIGZpbmFsIGludCBkaWdpdEFmdGVyTGFzdCA9IDB4M0E7ICAvLyA6Ci0gICAgICAgIGZpbmFsIGludCBoeXBoZW4gPSAnLSc7Ci0gICAgICAgIGZvciAoZmluYWwgU3RyaW5nIHN0ciA6IHZhbHVlcykgewotICAgICAgICAgICAgaWYgKFRleHRVdGlscy5pc0VtcHR5KHN0cikpIHsKLSAgICAgICAgICAgICAgICBjb250aW51ZTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGZpbmFsIGludCBsZW5ndGggPSBzdHIubGVuZ3RoKCk7Ci0gICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGxlbmd0aDsgaSA9IHN0ci5vZmZzZXRCeUNvZGVQb2ludHMoaSwgMSkpIHsKLSAgICAgICAgICAgICAgICBpbnQgY29kZXBvaW50ID0gc3RyLmNvZGVQb2ludEF0KGkpOwotICAgICAgICAgICAgICAgIGlmICghKChsb3dlckFscGhhYmV0Rmlyc3QgPD0gY29kZXBvaW50ICYmIGNvZGVwb2ludCA8IGxvd2VyQWxwaGFiZXRBZnRlckxhc3QpIHx8Ci0gICAgICAgICAgICAgICAgICAgICh1cHBlckFscGhhYmV0Rmlyc3QgPD0gY29kZXBvaW50ICYmIGNvZGVwb2ludCA8IHVwcGVyQWxwaGFiZXRBZnRlckxhc3QpIHx8Ci0gICAgICAgICAgICAgICAgICAgIChkaWdpdEZpcnN0IDw9IGNvZGVwb2ludCAmJiBjb2RlcG9pbnQgPCBkaWdpdEFmdGVyTGFzdCkgfHwKLSAgICAgICAgICAgICAgICAgICAgKGNvZGVwb2ludCA9PSBoeXBoZW4pKSkgewotICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgICAgIHJldHVybiB0cnVlOwotICAgIH0KLQotICAgIHB1YmxpYyBzdGF0aWMgYm9vbGVhbiBjb250YWluc09ubHlXaGl0ZVNwYWNlcyhmaW5hbCBTdHJpbmcuLi52YWx1ZXMpIHsKLSAgICAgICAgaWYgKHZhbHVlcyA9PSBudWxsKSB7Ci0gICAgICAgICAgICByZXR1cm4gdHJ1ZTsKLSAgICAgICAgfQotICAgICAgICByZXR1cm4gY29udGFpbnNPbmx5V2hpdGVTcGFjZXMoQXJyYXlzLmFzTGlzdCh2YWx1ZXMpKTsKLSAgICB9Ci0KLSAgICBwdWJsaWMgc3RhdGljIGJvb2xlYW4gY29udGFpbnNPbmx5V2hpdGVTcGFjZXMoZmluYWwgQ29sbGVjdGlvbjxTdHJpbmc+IHZhbHVlcykgewotICAgICAgICBpZiAodmFsdWVzID09IG51bGwpIHsKLSAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICB9Ci0gICAgICAgIGZvciAoZmluYWwgU3RyaW5nIHN0ciA6IHZhbHVlcykgewotICAgICAgICAgICAgaWYgKFRleHRVdGlscy5pc0VtcHR5KHN0cikpIHsKLSAgICAgICAgICAgICAgICBjb250aW51ZTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGZpbmFsIGludCBsZW5ndGggPSBzdHIubGVuZ3RoKCk7Ci0gICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGxlbmd0aDsgaSA9IHN0ci5vZmZzZXRCeUNvZGVQb2ludHMoaSwgMSkpIHsKLSAgICAgICAgICAgICAgICBpZiAoIUNoYXJhY3Rlci5pc1doaXRlc3BhY2Uoc3RyLmNvZGVQb2ludEF0KGkpKSkgewotICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgICAgIHJldHVybiB0cnVlOwotICAgIH0KLQotICAgIC8qKgotICAgICAqIDxwPgotICAgICAqIFJldHVybnMgdHJ1ZSB3aGVuIHRoZSBnaXZlbiBTdHJpbmcgaXMgY2F0ZWdvcml6ZWQgYXMgIndvcmQiIHNwZWNpZmllZCBpbiB2Q2FyZCBzcGVjIDIuMS4KLSAgICAgKiA8L3A+Ci0gICAgICogPHA+Ci0gICAgICogdkNhcmQgMi4xIHNwZWNpZmllczo8YnIgLz4KLSAgICAgKiB3b3JkID0gJmx0O2FueSBwcmludGFibGUgN2JpdCB1cy1hc2NpaSBleGNlcHQgW109Oi4sICZndDsKLSAgICAgKiA8L3A+Ci0gICAgICovCi0gICAgcHVibGljIHN0YXRpYyBib29sZWFuIGlzVjIxV29yZChmaW5hbCBTdHJpbmcgdmFsdWUpIHsKLSAgICAgICAgaWYgKFRleHRVdGlscy5pc0VtcHR5KHZhbHVlKSkgewotICAgICAgICAgICAgcmV0dXJuIHRydWU7Ci0gICAgICAgIH0KLSAgICAgICAgZmluYWwgaW50IGFzY2lpRmlyc3QgPSAweDIwOwotICAgICAgICBmaW5hbCBpbnQgYXNjaWlMYXN0ID0gMHg3RTsgIC8vIGluY2x1ZGVkCi0gICA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maW5hbCBpbnQgbGVuZ3RoID0gdmFsdWUubGVuZ3RoKCk7Ci0gICAgICAgIGJvb2xlYW4gbmVlZFF1b3RlID0gZmFsc2U7Ci0gICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbGVuZ3RoOyBpID0gdmFsdWUub2Zmc2V0QnlDb2RlUG9pbnRzKGksIDEpKSB7Ci0gICAgICAgICAgICBmaW5hbCBpbnQgY29kZVBvaW50ID0gdmFsdWUuY29kZVBvaW50QXQoaSk7Ci0gICAgICAgICAgICBpZiAoY29kZVBvaW50IDwgYXNjaWlGaXJzdCB8fCBjb2RlUG9pbnQgPT0gJyInKSB7Ci0gICAgICAgICAgICAgICAgLy8gQ1RMIGNoYXJhY3RlcnMgYW5kIERRVU9URSBhcmUgbmV2ZXIgYWNjZXB0ZWQuIFJlbW92ZSB0aGVtLgotICAgICAgICAgICAgICAgIGNvbnRpbnVlOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgYnVpbGRlci5hcHBlbmRDb2RlUG9pbnQoY29kZVBvaW50KTsKLSAgICAgICAgICAgIGZvciAoaW50IGluZGljYXRvciA6IGVzY2FwZUluZGljYXRvcnMpIHsKLSAgICAgICAgICAgICAgICBpZiAoY29kZVBvaW50ID09IGluZGljYXRvcikgewotICAgICAgICAgICAgICAgICAgICBuZWVkUXVvdGUgPSB0cnVlOwotICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICBmaW5hbCBTdHJpbmcgcmVzdWx0ID0gYnVpbGRlci50b1N0cmluZygpOwotICAgICAgICByZXR1cm4gKChyZXN1bHQuaXNFbXB0eSgpIHx8IFZDYXJkVXRpbHMuY29udGFpbnNPbmx5V2hpdGVTcGFjZXMocmVzdWx0KSkKLSAgICAgICAgICAgICAgICA/ICIiCi0gICAgICAgICAgICAgICAgOiAobmVlZFF1b3RlID8gKCciJyArIHJlc3VsdCArICciJykKLSAg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GVyLmFwcGVuZChuZXh0Q2gpOwotICAgICAgICAgICAgICAgICAgICAgICAgaSsrOwotICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQoY2gpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgcXVvdGVkUHJpbnRhYmxlID0gYnVpbGRlci50b1N0cmluZygpOwotICAgICAgICB9Ci0KLSAgICAgICAgU3RyaW5nW10gbGluZXM7Ci0gICAgICAgIGlmIChzdHJpY3RMaW5lQnJlYWtpbmcpIHsKLSAgICAgICAgICAgIGxpbmVzID0gcXVvdGVkUHJpbnRhYmxlLnNwbGl0KCJcclxuIik7Ci0gICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICBTdHJpbmdCdWlsZGVyIGJ1aWxkZXIgPSBuZXcgU3RyaW5nQnVpbGRlcigpOwotICAgICAgICAgICAgZmluYWwgaW50IGxlbmd0aCA9IHF1b3RlZFByaW50YWJsZS5sZW5ndGgoKTsKLSAgICAgICAgICAgIEFycmF5TGlzdDxTdHJpbmc+IGxpc3QgPSBuZXcgQXJyYXlMaXN0PFN0cmluZz4oKTsKLSAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbGVuZ3RoOyBpKyspIHsKLSAgICAgICAgICAgICAgICBjaGFyIGNoID0gcXVvdGVkUHJpbnRhYmxlLmNoYXJBdChpKTsKLSAgICAgICAgICAgICAgICBpZiAoY2ggPT0gJ1xuJykgewotICAgICAgICAgICAgICAgICAgICBsaXN0LmFkZChidWlsZGVyLnRvU3RyaW5nKCkpOwotICAgICAgICAgICAgICAgICAgICBidWlsZGVyID0gbmV3IFN0cmluZ0J1aWxkZXIoKTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGNoID09ICdccicpIHsKLSAgICAgICAgICAgICAgICAgICAgbGlzdC5hZGQoYnVpbGRlci50b1N0cmluZygpKTsKLSAgICAgICAgICAgICAgICAgICAgYnVpbGRlciA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChpIDwgbGVuZ3RoIC0gMSkgewotICAgICAgICAgICAgICAgICAgICAgICAgY2hhciBuZXh0Q2ggPSBxdW90ZWRQcmludGFibGUuY2hhckF0KGkgKyAxKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuZXh0Q2ggPT0gJ1xuJykgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkrKzsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kKGNoKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBmaW5hbCBTdHJpbmcgbGFzdExpbmUgPSBidWlsZGVyLnRvU3RyaW5nKCk7Ci0gICAgICAgICAgICBpZiAobGFzdExpbmUubGVuZ3RoKCkgPiAwKSB7Ci0gICAgICAgICAgICAgICAgbGlzdC5hZGQobGFzdExpbmUpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgbGluZXMgPSBsaXN0LnRvQXJyYXkobmV3IFN0cmluZ1swXSk7Ci0gICAgICAgIH0KLQotICAgICAgICBmaW5hbCBTdHJpbmdCdWlsZGVyIGJ1aWxkZXIgPSBuZXcgU3RyaW5nQnVpbGRlcigpOwotICAgICAgICBmb3IgKFN0cmluZyBsaW5lIDogbGluZXMpIHsKLSAgICAgICAgICAgIGlmIChsaW5lLmVuZHNXaXRoKCI9IikpIHsKLSAgICAgICAgICAgICAgICBsaW5lID0gbGluZS5zdWJzdHJpbmcoMCwgbGluZS5sZW5ndGgoKSAtIDEpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQobGluZSk7Ci0gICAgIC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lIGVudHJpZXMgdG8gYmUgc2hvd24gaW4gdGhlIGxpc3QuIFRoaXMgd2lsbCBiZQorICAgICAqIHNob3duIGluIHN1YnNlcXVlbnQgZGlhbG9ncy4KKyAgICAgKiA8cD4KKyAgICAgKiBFYWNoIGVudHJ5IG11c3QgaGF2ZSBhIGNvcnJlc3BvbmRpbmcgaW5kZXggaW4KKyAgICAgKiB7QGxpbmsgI3NldEVudHJ5VmFsdWVzKENoYXJTZXF1ZW5jZVtdKX0uCisgICAgICogCisgICAgICogQHBhcmFtIGVudHJpZXMgVGhlIGVudHJpZXMuCisgICAgICogQHNlZSAjc2V0RW50cnlWYWx1ZXMoQ2hhclNlcXVlbmNlW10pCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0RW50cmllcyhDaGFyU2VxdWVuY2VbXSBlbnRyaWVzKSB7CisgICAgICAgIG1FbnRyaWVzID0gZW50cmllczsKKyAgICB9CisgICAgCisgICAgLyoqCisgICAgICogQHNlZSAjc2V0RW50cmllcyhDaGFyU2VxdWVuY2VbXSkKKyAgICAgKiBAcGFyYW0gZW50cmllc1Jlc0lkIFRoZSBlbnRyaWVzIGFycmF5IGFzIGEgcmVzb3VyY2UuCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0RW50cmllcyhpbnQgZW50cmllc1Jlc0lkKSB7CisgICAgICAgIHNldEVudHJpZXMoZ2V0Q29udGV4dCgpLmdldFJlc291cmNlcygpLmdldFRleHRBcnJheShlbnRyaWVzUmVzSWQpKTsKKyAgICB9CisgICAgCisgICAgLyoqCisgICAgICogVGhlIGxpc3Qgb2YgZW50cmllcyB0byBiZSBzaG93biBpbiB0aGUgbGlzdCBpbiBzdWJzZXF1ZW50IGRpYWxvZ3MuCisgICAgICogCisgICAgICogQHJldHVybiBUaGUgbGlzdCBhcyBhbiBhcnJheS4KKyAgICAgKi8KKyAgICBwdWJsaWMgQ2hhclNlcXVlbmNlW10gZ2V0RW50cmllcygpIHsKKyAgICAgICAgcmV0dXJuIG1F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yAgICBwdWJsaWMgaW50IGZpbmRJbmRleE9mVmFsdWUoU3RyaW5nIHZhbHVlKSB7CisgICAgICAgIGlmICh2YWx1ZSAhPSBudWxsICYmIG1FbnRyeVZhbHVlcyAhPSBudWxsKSB7CisgICAgICAgICAgICBmb3IgKGludCBpID0gbUVudHJ5VmFsdWVzLmxlbmd0aCAtIDE7IGkgPj0gMDsgaS0tKSB7CisgICAgICAgICAgICAgICAgaWYgKG1FbnRyeVZhbHVlc1tpXS5lcXVhbHModmFsdWUpKSB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4gLTE7CisgICAgfQorICAgIAorICAgIEBPdmVycmlkZQorICAgIHByb3RlY3RlZCB2b2lkIG9uUHJlcGFyZURpYWxvZ0J1aWxkZXIoQnVpbGRlciBidWlsZGVyKSB7CisgICAgICAgIHN1cGVyLm9uUHJlcGFyZURpYWxvZ0J1aWxkZXIoYnVpbGRlcik7CisgICAgICAgIAorICAgICAgICBpZiAobUVudHJpZXMgPT0gbnVsbCB8fCBtRW50cnlWYWx1ZXMgPT0gbnVsbCkgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigKKyAgICAgICAgICAgICAgICAgICAgIk11bHRpU2VsZWN0TGlzdFByZWZlcmVuY2UgcmVxdWlyZXMgYW4gZW50cmllcyBhcnJheSBhbmQgIiArCisgICAgICAgICAgICAgICAgICAgICJhbiBlbnRyeVZhbHVlcyBhcnJheS4iKTsKKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgYm9vbGVhbltdIGNoZWNrZWRJdGVtcyA9IGdldFNlbGVjdGVkSXRlbXMoKTsKKyAgICAgICAgYnVpbGRlci5zZXRNdWx0aUNob2ljZUl0ZW1zKG1FbnRyaWVzLCBjaGVja2VkSXRlbXMsCisgICAgICAgICAgICAgICAgbmV3IERpYWxvZ0ludGVyZmFjZS5Pbk11bHRpQ2hvaWNlQ2xpY2tMaXN0ZW5lcigpIHsKKyAgICAgICAgICAgICAgICAgICAgcHVibGljIHZvaWQgb25DbGljayhEaWFsb2dJbnRlcmZhY2UgZGlhbG9nLCBpbnQgd2hpY2gsIGJvb2xlYW4gaXNDaGVja2VkKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXNDaGVja2VkKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVByZWZlcmVuY2VDaGFuZ2VkIHw9IG1OZXdWYWx1ZXMuYWRkKG1FbnRyaWVzW3doaWNoXS50b1N0cmluZygpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVByZWZlcmVuY2VDaGFuZ2VkIHw9IG1OZXdWYWx1ZXMucmVtb3ZlKG1FbnRyaWVzW3doaWNoXS50b1N0cmluZygpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0pOworICAgICAgICBtTmV3VmFsdWVzLmNsZWFyKCk7CisgICAgICAgIG1OZXdWYWx1ZXMuYWRkQWxsKG1WYWx1ZXMpOworICAgIH0KKyAgICAKKyAgICBwcml2YXRlIGJvb2xlYW5bXSBnZXRTZWxlY3RlZEl0ZW1zKCkgeworICAgICAgICBmaW5hbCBDaGFyU2VxdWVuY2VbXSBlbnRyaWVzID0gbUVudHJpZXM7CisgICAgICAgIGZpbmFsIGludCBlbnRyeUNvdW50ID0gZW50cmllcy5sZW5ndGg7CisgICAgICAgIGZpbmFsIFNldDxTdHJpbmc+IHZhbHVlcyA9IG1WYWx1ZXM7CisgICAgICAgIGJvb2xlYW5bXSByZXN1bHQgPSBuZXcgYm9vbGVhbltlbnRyeUNvdW50XTsKKyAgICAgICAgCisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgZW50cnlDb3VudDsgaSsrKSB7C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cHVibGljIFNhdmVkU3RhdGUoUGFyY2VsIHNvdXJjZSkgeworICAgICAgICAgICAgc3VwZXIoc291cmNlKTsKKyAgICAgICAgICAgIHZhbHVlcyA9IG5ldyBIYXNoU2V0PFN0cmluZz4oKTsKKyAgICAgICAgICAgIFN0cmluZ1tdIHN0cmluZ3MgPSBzb3VyY2UucmVhZFN0cmluZ0FycmF5KCk7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIGZpbmFsIGludCBzdHJpbmdDb3VudCA9IHN0cmluZ3MubGVuZ3RoOworICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBzdHJpbmdDb3VudDsgaSsrKSB7CisgICAgICAgICAgICAgICAgdmFsdWVzLmFkZChzdHJpbmdzW2ldKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgcHVibGljIFNhdmVkU3RhdGUoUGFyY2VsYWJsZSBzdXBlclN0YXRlKSB7CisgICAgICAgICAgICBzdXBlcihzdXBlclN0YXRlKTsKKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIHdyaXRlVG9QYXJjZWwoUGFyY2VsIGRlc3QsIGludCBmbGFncykgeworICAgICAgICAgICAgc3VwZXIud3JpdGVUb1BhcmNlbChkZXN0LCBmbGFncyk7CisgICAgICAgICAgICBkZXN0LndyaXRlU3RyaW5nQXJyYXkodmFsdWVzLnRvQXJyYXkobmV3IFN0cmluZ1swXSkpOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFBhcmNlbGFibGUuQ3JlYXRvcjxTYXZlZFN0YXRlPiBDUkVBVE9SID0KKyAgICAgICAgICAgICAgICBuZXcgUGFyY2VsYWJsZS5DcmVhdG9yPFNhdmVkU3RhdGU+KCkgeworICAgICAgICAgICAgcHVibGljIFNhdmVkU3RhdGUgY3JlYXRlRnJvbVBhcmNlbChQYXJjZWw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BACiAgICAgcHJpdmF0ZSBDaGFyU2VxdWVuY2UgbVN1bW1hcnk7CiAgICAgcHJpdmF0ZSBTdHJpbmcgbUtleTsKICAgICBwcml2YXRlIEludGVudCBtSW50ZW50OworICAgIHByaXZhdGUgU3RyaW5nIG1GcmFnbWVudDsKKyAgICBwcml2YXRlIEJ1bmRsZSBtRXh0cmFzOwogICAgIHByaXZhdGUgYm9vbGVhbiBtRW5hYmxlZCA9IHRydWU7CiAgICAgcHJpdmF0ZSBib29sZWFuIG1TZWxlY3RhYmxlID0gdHJ1ZTsKICAgICBwcml2YXRlIGJvb2xlYW4gbVJlcXVpcmVzS2V5OwpAQCAtMjA4LDYgKzIxMywxMCBAQAogICAgICAgICAgICAgICAgICAgICBtT3JkZXIgPSBhLmdldEludChhdHRyLCBtT3JkZXIpOwogICAgICAgICAgICAgICAgICAgICBicmVhazsKIAorICAgICAgICAgICAgICAgIGNhc2UgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuUHJlZmVyZW5jZV9mcmFnbWVudDoKKyAgICAgICAgICAgICAgICAgICAgbUZyYWdtZW50ID0gYS5nZXRTdHJpbmcoYXR0cik7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCiAgICAgICAgICAgICAgICAgY2FzZSBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5QcmVmZXJlbmNlX2xheW91dDoKICAgICAgICAgICAgICAgICAgICAgbUxheW91dFJlc0lkID0gYS5nZXRSZXNvdXJjZUlkKGF0dHIsIG1MYXlvdXRSZXNJZCk7CiAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwpAQCAtMzEzLDYgKzMyMiw0NCBAQAogICAgIH0KIAogICAgIC8qKgorICAgICAqIFNldHMgdGhlIGNsYXNzIG5hbWUgb2YgYSBmcmFnbWVudCB0byBiZSBzaG93biB3aGVuIHRoaXMgUHJlZmVyZW5jZSBpcyBjbGlja2VkLgorICAgICAqCisgICAgICogQHBhcmFtIG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dC4KKyAgICAgKiBAcmV0dXJuIFRydWUgaWYgdGhlIFByZWZlcmVuY2UgaXMgcGVyc2lzdGVudC4gKFRoaXMgaXMgbm90IHdoZXRoZXIgdGhlCisgICAgICogICAgICAgICB2YWx1ZSB3YXMgcGVyc2lzdGVkLCBzaW5jZSB3ZSBtYXkgbm90IG5lY2Vzc2FyaWx5IGNvbW1pdCBpZiB0aGVyZQorICAgICAqICAgICAgICAgd2lsbCBiZSBhIGJhdGNoIGNvbW1pdCBsYXRlci4pCisgICAgICogQHNlZSAjZ2V0UGVyc2lzdGVkU3RyaW5nKFNldCkKKyAgICAgKiAKKyAgICAgKiBAaGlkZSBQZW5kaW5nIEFQSSBhcHByb3ZhbAorICAgICAqLworICAgIHByb3RlY3RlZCBib29sZWFuIHBlcnNpc3RTdHJpbmdTZXQoU2V0PFN0cmluZz4gdmFsdWVzKSB7CisgICAgICAgIGlmIChzaG91bGRQZXJzaXN0KCkpIHsKKyAgICAgICAgICAgIC8vIFNob3VsZG4ndCBzdG9yZSBudWxsCisgICAgICAgICAgICBpZiAodmFsdWVzLmVxdWFscyhnZXRQZXJzaXN0ZWRTdHJpbmdTZXQobnVsbCkpKSB7CisgICAgICAgICAgICAgICAgLy8gSXQncyBhbHJlYWR5IHRoZXJlLCBzbyB0aGUgc2FtZSBhcyBwZXJzaXN0aW5nCisgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICAKKyAgICAgICAgICAgIFNoYXJlZFByZWZlcmVuY2VzLkVkaXRvciBlZGl0b3IgPSBtUHJlZmVyZW5jZU1hbmFnZXIuZ2V0RWRpdG9yKCk7CisgICAgICAgICAgICBlZGl0b3IucHV0U3RyaW5nU2V0KG1LZXksIHZhbHVlcyk7CisgICAgICAgICAgICB0cnlDb21taXQoZWRpdG9yKTsKKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKK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gIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgTVNHX0JVSUxEX0hFQURFUlM6CisgICAgICAgICAgICAgICAgICAgIG9uQnVpbGRIZWFkZXJzKG1IZWFkZXJzKTsKKyAgICAgICAgICAgICAgICAgICAgbUFkYXB0ZXIubm90aWZ5RGF0YVNldENoYW5nZWQoKTsKKyAgICAgICAgICAgICAgICAgICAgSGVhZGVyIGhlYWRlciA9IG9uR2V0TmV3SGVhZGVyKCk7CisgICAgICAgICAgICAgICAgICAgIGlmIChoZWFkZXIgIT0gbnVsbCAmJiBoZWFkZXIuZnJhZ21lbnQgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoVG9IZWFkZXIoaGVhZGVyLmZyYWdtZW50LCBoZWFkZXIuZnJhZ21lbnRBcmd1bWVudHMpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgfTsKIAorICAgIHByaXZhdGUgc3RhdGljIGNsYXNzIEhlYWRlckFkYXB0ZXIgZXh0ZW5kcyBBcnJheUFkYXB0ZXI8SGVhZGVyPiB7CisgICAgICAgIHByaXZhdGUgc3RhdGljIGNsYXNzIEhlYWRlclZpZXdIb2xkZXIgeworICAgICAgICAgICAgSW1hZ2VWaWV3IGljb247CisgICAgICAgICAgICBUZXh0VmlldyB0aXRsZTsKKyAgICAgICAgICAgIFRleHRWaWV3IHN1bW1hcnk7CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIExheW91dEluZmxhdGVyIG1JbmZsYXRlcjsKKworICAgICAgICBwdWJsaWMgSGVhZGVyQWRhcHRlcihDb250ZXh0IGNvbnRleHQsIExpc3Q8SGVhZGVyPiBvYmplY3RzKSB7CisgICAgICAgICAgICBzdXBlcihjb250ZXh0LCAwLCBvYmplY3RzKTsKKyAgICAgICAgICAgIG1JbmZsYXRlciA9IChMYXlvdXRJbmZsYXRlciljb250ZXh0LmdldFN5c3RlbVNlcnZpY2UoQ29udGV4dC5MQVlPVVRfSU5GTEFURVJfU0VSVklDRSk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIFZpZXcgZ2V0VmlldyhpbnQgcG9zaXRpb24sIFZpZXcgY29udmVydFZpZXcsIFZpZXdHcm91cCBwYXJlbnQpIHsKKyAgICAgICAgICAgIEhlYWRlclZpZXdIb2xkZXIgaG9sZGVyOworICAgICAgICAgICAgVmlldyB2aWV3OworCisgICAgICAgICAgICBpZiAoY29udmVydFZpZXcgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIHZpZXcgPSBtSW5mbGF0ZXIuaW5mbGF0ZShjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmxheW91dC5wcmVmZXJlbmNlX2xpc3RfaXRlbSwKKyAgICAgICAgICAgICAgICAgICAgICAgIHBhcmVudCwgZmFsc2UpOworICAgICAgICAgICAgICAgIGhvbGRlciA9IG5ldyBIZWFkZXJWaWV3SG9sZGVyKCk7CisgICAgICAgICAgICAgICAgaG9sZGVyLmljb24gPSAoSW1hZ2VWaWV3KSB2aWV3LmZpbmRWaWV3QnlJZChjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmlkLmljb24pOworICAgICAgICAgICAgICAgIGhvbGRlci50aXRsZSA9IChUZXh0Vmlldykgdmlldy5maW5kVmlld0J5SWQoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5pZC50aXRsZSk7CisgICAgICAgICAgICAgICAgaG9sZGVyLnN1bW1hcnkgPSAoVGV4dFZpZXcpIHZpZXcuZmluZFZpZXdCeUlkKGNvbS5hbmRyb2lkLmludGVybmFsLlIuaWQuc3VtbWFyeSk7CisgICAgICAgICAgICAgICAgdmlldy5zZXRUYWcoaG9sZGVyKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgdmlldyA9IGNvbnZlcnRWaWV3OworICAgICAgICAgICAgICAgIGhvbGRlciA9IChIZWFkZXJWaWV3SG9sZGVyKSB2aWV3LmdldFRhZygpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvLyBBbGwgdmlldyBmaWVsZHMgbXVzdCBiZSB1cGRhdGVkIGV2ZXJ5IHRpbWUsIGJlY2F1c2UgdGhlIHZpZXcgbWF5IGJlIHJlY3ljbGVkIAorICAgICAgICAgICAgSGVhZGVyIGhlYWRlciA9IGdldEl0ZW0ocG9zaXRpb24pOworICAgICAgICAgICAgaWYgKGhlYWRlci5pY29uID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICBob2xkZXIuaWNvbi5zZXRJbWFnZURyYXdhYmxlKG51bGwpOworICAgICAgICAgICAgICAgIGhvbGRlci5pY29uLnNldEltYWdlUmVzb3VyY2UoaGVhZGVyLmljb25SZXMpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBob2xkZXIuaWNvbi5zZXRJbWFnZVJlc291cmNlKDApOworICAgICAgICAgICAgICAgIGhvbGRlci5pY29uLnNldEltYWdlRHJhd2FibGUoaGVhZGVyLmljb24pOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaG9sZGVyLnRpdGxlLnNldFRleHQoaGVhZGVyLnRpdGxlKTsKKyAgICAgICAgICAgIGlmIChUZXh0VXRpbHMuaXNFbXB0eShoZWFkZXIuc3VtbWFyeSkpIHsKKyAgICAgICAgICAgICAgICBob2xkZXIuc3VtbWFyeS5zZXRWaXNpYmlsaXR5KFZpZXcuR09ORSk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGhvbGRlci5zdW1tYXJ5LnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKKyAgICAgICAgICAgICAgICBob2xkZXIuc3VtbWFyeS5zZXRUZXh0KGhlYWRlci5zdW1tYXJ5KTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcmV0dXJuIHZpZXc7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBEZXNjcmlwdGlvbiBvZiBhIHNpbmdsZSBIZWFkZXIgaXRlbSB0aGF0IHRoZSB1c2VyIGNhbiBzZWxlY3QuCisgICAgICovCisgICAgcHVibGljIHN0YXRpYyBjbGFzcyBIZWFkZXIgeworICAgICAgICAvKioKKyAgICAgICAgICogVGl0bGUgb2YgdGhlIGhlYWRlciB0aGF0IGlzIHNob3duIHRvIHRoZSB1c2VyLgorICAgICAgICAgKiBAYXR0ciByZWYgYW5kcm9pZC5SLnN0eWxlYWJsZSNQcmVmZXJlbmNlSGVhZGVyX3RpdGxlCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgQ2hhclNlcXVlbmNlIHRpdGxlOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBPcHRpb25hbCBzdW1tYXJ5IGRlc2NyaWJpbmcgd2hhdCB0aGlzIGhlYWRlciBjb250cm9scy4KKyAgICAgICAgICogQGF0dHIgcmVmIGFuZHJvaWQuUi5zdHlsZWFibGUjUHJlZmVyZW5jZUhlYWRlcl9zdW1tYXJ5CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgQ2hhclNlcXVlbmNlIHN1bW1hcnk7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIE9wdGlvbmFsIGljb24gcmVzb3VyY2UgdG8gc2hvdyBmb3IgdGhpcyBoZWFkZXIuCisgICAgICAgICAqIEBhdHRyIHJlZiBhbmRyb2lkLlIuc3R5bGVhYmxlI1ByZWZlcmVuY2VIZWFkZXJfaWNvbgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIGludCBpY29uUmVzOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBPcHRpb25hbCBpY29uIGRyYXdhYmxlIHRvIHNob3cgZm9yIHRoaXMgaGVhZGVyLiAgKElmIHRoaXMgaXMgbm9uLW51bGwsCisgICAgICAgICAqIHRoZSBpY29uUmVzIHdpbGwgYmUgaWdub3JlZC4pCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgRHJhd2FibGUgaWNvbjsKKworICAgICAgICAvKioKKyAgICAgICAgICogRnVsbCBjbGFzcyBuYW1lIG9mIHRoZSBmcmFnbWVudCB0byBkaXNwbGF5IHdoZW4gdGhpcyBoZWFkZXIgaXMKKyAgICAgICAgICogc2VsZWN0ZWQuCisgICAgICAgICAqIEBhdHRyIHJlZiBhbmRyb2lkLlIuc3R5bGVhYmxlI1ByZWZlcmVuY2VIZWFkZXJfZnJhZ21lbnQKKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBTdHJpbmcgZnJhZ21lbnQ7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIE9wdGlvbmFsIGFyZ3VtZW50cyB0byBzdXBwbHkgdG8gdGhlIGZyYWdtZW50IHdoZW4gaXQgaXMKKyAgICAgICAgICogaW5zdGFudGlhdGVkLgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIEJ1bmRsZSBmcmFnbWVudEFyZ3VtZW50czsKKworICAgICAgICAvKioKKyAgICAgICAgICogSW50ZW50IHRvIGxhdW5jaCB3aGVuIHRoZSBwcmVmZXJlbmNlIGlzIHNlbGVjdGVkLgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIEludGVudCBpbnRlbnQ7CisgICAgfQorCiAgICAgQE92ZXJyaWRlCiAgICAgcHJvdGVjdGVkIHZvaWQgb25DcmVhdGUoQnVuZGxlIHNhdmVkSW5zdGFuY2VTdGF0ZSkgewogICAgICAgICBzdXBlci5vbkNyZWF0ZShzYXZlZEluc3RhbmNlU3RhdGUpOwogCiAgICAgICAgIHNldENvbnRlbnRWaWV3KGNvbS5hbmRyb2lkLmludGVybmFsLlIubGF5b3V0LnByZWZlcmVuY2VfbGlzdF9jb250ZW50KTsKLSAgICAgICAgCi0gICAgICAgIG1QcmVmZXJlbmNlTWFuYWdlciA9IG9uQ3JlYXRlUHJlZmVyZW5jZU1hbmFnZXIoKTsKKworICAgICAgICBtTGlzdEZvb3RlciA9IChGcmFtZUxheW91dClmaW5kVmlld0J5SWQoY29tLmFuZ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LyBXZSBuZWVkIHRvIHRyeSB0byBidWlsZCB0aGUgaGVhZGVycy4KKyAgICAgICAgICAgIG9uQnVpbGRIZWFkZXJzKG1IZWFkZXJzKTsKKworICAgICAgICAgICAgLy8gSWYgdGhlcmUgYXJlIGhlYWRlcnMsIHRoZW4gYXQgdGhpcyBwb2ludCB3ZSBuZWVkIHRvIHNob3cKKyAgICAgICAgICAgIC8vIHRoZW0gYW5kLCBkZXBlbmRpbmcgb24gdGhlIHNjcmVlbiwgd2UgbWF5IGFsc28gc2hvdyBpbi1saW5lCisgICAgICAgICAgICAvLyB0aGUgY3VycmVudGx5IHNlbGVjdGVkIHByZWZlcmVuY2UgZnJhZ21lbnQuCisgICAgICAgICAgICBpZiAobUhlYWRlcnMuc2l6ZSgpID4gMCkgeworICAgICAgICAgICAgICAgIG1BZGFwdGVyID0gbmV3IEhlYWRlckFkYXB0ZXIodGhpcywgbUhlYWRlcnMpOworICAgICAgICAgICAgICAgIHNldExpc3RBZGFwdGVyKG1BZGFwdGVyKTsKKyAgICAgICAgICAgICAgICBpZiAoIW1TaW5nbGVQYW5lKSB7CisgICAgICAgICAgICAgICAgICAgIG1QcmVmc0NvbnRhaW5lci5zZXRWaXNpYmlsaXR5KFZpZXcuVklTSUJMRSk7CisgICAgICAgICAgICAgICAgICAgIGlmIChpbml0aWFsRnJhZ21lbnQgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgSGVhZGVyIGggPSBvbkdldEluaXRpYWxIZWFkZXIoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGluaXRpYWxGcmFnbWVudCA9IGguZnJhZ21lbnQ7CisgICAgICAgICAgICAgICAgICAgICAgICBpbml0aWFsQXJndW1lbnRzID0gaC5mcmFnbWVudEFyZ3VtZW50czsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBzd2l0Y2hUb0hlYWRlcihpbml0aWFsRnJhZ21lbnQsIGluaXRpYWxBcmd1bWVudHMpOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLy8gSWYgdGhlcmUgYXJlIG5vIGhlYWRlcnMsIHdlIGFyZSBpbiB0aGUgb2xkICJqdXN0IHNob3cgYSBzY3JlZW4KKyAgICAgICAgICAgIC8vIG9mIHByZWZlcmVuY2VzIiBtb2RlLgorICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBtUHJlZmVyZW5jZU1hbmFnZXIgPSBuZXcgUHJlZmVyZW5jZU1hbmFnZXIodGhpcywgRklSU1RfUkVRVUVTVF9DT0RFKTsKKyAgICAgICAgICAgICAgICBtUHJlZmVyZW5jZU1hbmFnZXIuc2V0T25QcmVmZXJlbmNlVHJlZUNsaWNrTGlzdGVuZXIodGhpcyk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKwogICAgICAgICBnZXRMaXN0VmlldygpLnNldFNjcm9sbEJhclN0eWxlKFZpZXcuU0NST0xMQkFSU19JTlNJREVfT1ZFUkxBWSk7CisKKyAgICAgICAgLy8gc2VlIGlmIHdlIHNob3VsZCBzaG93IEJhY2svTmV4dCBidXR0b25zCisgICAgICAgIEludGVudCBpbnRlbnQgPSBnZXRJbnRlbnQoKTsKKyAgICAgICAgaWYgKGludGVudC5nZXRCb29sZWFuRXh0cmEoRVhUUkFfUFJFRlNfU0hPV19CVVRUT05fQkFSLCBmYWxzZSkpIHsKKworICAgICAgICAgICAgZmluZFZpZXdCeUlkKGNvbS5hbmRyb2lkLmludGVybmFsLlIuaWQuYnV0dG9uX2Jhcikuc2V0VmlzaWJpbGl0eShWaWV3LlZJU0lCTEUpOworCisgICAgICAgICAgICBCdXR0b24gYmFja0J1dHRvbiA9IChCdXR0b24pZmluZFZpZXdCeUlkKGNvbS5hbmRyb2lkLmludGVybmFsLlIuaWQuYmFja19idXR0b24pOworICAgICAgICAgICAgYmFja0J1dHRvbi5zZXRPbkNsaWNrTGlzdGVuZXIobmV3IE9uQ2xpY2tMaXN0ZW5lcigpIHsKKyAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBvbkNsaWNrKFZpZXcgdikgeworICAgICAgICAgICAgICAgICAgICBzZXRSZXN1bHQoUkVTVUxUX0NBTkNFTEVEKTsKKyAgICAgICAgICAgICAgICAgICAgZmluaXNoKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSk7CisgICAgICAgICAgICBCdXR0b24gc2tpcEJ1dHRvbiA9IChCdXR0b24pZmluZFZpZXdCeUlkKGNvbS5hbmRyb2lkLmludGVybmFsLlIuaWQuc2tpcF9idXR0b24pOworICAgICAgICAgICAgc2tpcEJ1dHRvbi5zZXRPbkNsaWNrTGlzdGVuZXIobmV3IE9uQ2xpY2tMaXN0ZW5lcigpIHsKKyAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBvbkNsaWNrKFZpZXcgdikgeworICAgICAgICAgICAgICAgICAgICBzZXRSZXN1bHQoUkVTVUxUX09LKTsKKyAgICAgICAgICAgICAgICAgICAgZmluaXNoKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSk7CisgICAgICAgICAgICBtTmV4dEJ1dHRvbiA9IChCdXR0b24pZmluZFZpZXdCeUlkKGNvbS5hbmRyb2lkLmludGVybmFsLlIuaWQubmV4dF9idXR0b24pOworICAgICAgICAgICAgbU5leHRCdXR0b24uc2V0T25DbGlja0xpc3RlbmVyKG5ldyBPbkNsaWNrTGlzdGVuZXIoKSB7CisgICAgICAgICAgICAgICAgcHVibGljIHZvaWQgb25DbGljayhWaWV3IHYpIHsKKyAgICAgICAgICAgICAgICAgICAgc2V0UmVzdWx0KFJFU1VMVF9PSyk7CisgICAgICAgICAgICAgICAgICAgIGZpbmlzaCgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0pOworCisgICAgICAgICAgICAvLyBzZXQgb3VyIHZhcmlvdXMgYnV0dG9uIHBhcmFtZXRlcnMKKyAgICAgICAgICAgIGlmIChpbnRlbnQuaGFzRXh0cmEoRVhUUkFfUFJFRlNfU0VUX05FWFRfVEVYVCkpIHsKKyAgICAgICAgICAgICAgICBTdHJpbmcgYnV0dG9uVGV4dCA9IGludGVudC5nZXRTdHJpbmdFeHRyYShFWFRSQV9QUkVGU19TRVRfTkVYVF9URVhUKTsKKyAgICAgICAgICAgICAgICBpZiAoVGV4dFV0aWxzLmlzRW1wdHkoYnV0dG9uVGV4dCkpIHsKKyAgICAgICAgICAgICAgICAgICAgbU5leHRCdXR0b24uc2V0VmlzaWJpbGl0eShWaWV3LkdPTkUpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgbU5leHRCdXR0b24uc2V0VGV4dChidXR0b25UZXh0KTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoaW50ZW50Lmhhc0V4dHJhKEVYVFJBX1BSRUZTX1NFVF9CQUNLX1RFWFQpKSB7CisgICAgICAgICAgICAgICAgU3RyaW5nIGJ1dHRvblRleHQgPSBpbnRlbnQuZ2V0U3RyaW5nRXh0cmEoRVhUUkFfUFJFRlNfU0VUX0JBQ0tfVEVYVCk7CisgICAgICAgICAgICAgICAgaWYgKFRleHRVdGlscy5pc0VtcHR5KGJ1dHRvblRleHQpKSB7CisgICAgICAgICAgICAgICAgICAgIGJhY2tCdXR0b24uc2V0VmlzaWJpbGl0eShWaWV3LkdPTkUpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgYmFja0J1dHRvbi5zZXRUZXh0KGJ1dHRvblRleHQpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChpbnRlbnQuZ2V0Qm9vbGVhbkV4dHJhKEVYVFJBX1BSRUZTX1NIT1dfU0tJUCwgZmFsc2UpKSB7CisgICAgICAgICAgICAgICAgc2tpcEJ1dHRvbi5zZXRWaXNpYmlsaXR5KFZpZXcuVklTSUJMRSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZXR1cm5zIHRydWUgaWYgdGhpcyBhY3Rpdml0eSBpcyBjdXJyZW50bHkgc2hvd2luZyB0aGUgaGVhZGVyIGxpc3QuCisgICAgICovCisgICAgcHVibGljIGJvb2xlYW4gaGFzSGVhZGVycygpIHsKKyAgICAgICAgcmV0dXJuIGdldExpc3RWaWV3KCkuZ2V0VmlzaWJpbGl0eSgpID09IFZpZXcuVklTSUJMRQorICAgICAgICAgICAgICAgICYmIG1QcmVmZXJlbmNlTWFuYWdlciA9PSBudWxsOworICAgIH0KKworICAgIC8qKgorICAgICAqIFJldHVybnMgdHJ1ZSBpZiB0aGlzIGFjdGl2aXR5IGlzIHNob3dpbmcgbXVsdGlwbGUgcGFuZXMgLS0gdGhlIGhlYWRlcnMKKyAgICAgKiBhbmQgYSBwcmVmZXJlbmNlIGZyYWdtZW50LgorICAgICAqLworICAgIHB1YmxpYyBib29sZWFuIGlzTXVsdGlQYW5lKCkgeworICAgICAgICByZXR1cm4gaGFzSGVhZGVycygpICYmIG1QcmVmc0NvbnRhaW5lci5nZXRWaXNpYmlsaXR5KCkgPT0gVmlldy5WSVNJQkxFOworICAgIH0KKworICAgIC8qKgorICAgICAqIENhbGxlZCB0byBkZXRlcm1pbmUgaWYgdGhlIGFjdGl2aXR5IHNob3VsZCBydW4gaW4gbXVsdGktcGFuZSBtb2RlLgorICAgICAqIFRoZSBkZWZhdWx0IGltcGxlbWVudGF0aW9uIHJldHVybnMgdHJ1ZSBpZiB0aGUgc2NyZWVuIGlzIGxhcmdlCisgICAgICogZW5vdWdoLgorICAgICAqLworICAgIHB1YmxpYyBib29sZWFuIG9uSXNNdWx0aVBhbmUoKSB7CisgICAgICAgIENvbmZpZ3VyYXRpb24gY29uZmlnID0gZ2V0UmVzb3VyY2VzKCkuZ2V0Q29uZmlndXJhdGlvbigpOworICAgICAgICBpZiAoKGNvbmZpZy5zY3JlZW5MYXlvdXQmQ29uZmlndXJhdGlvbi5TQ1JFRU5MQVlPVVRfU0laRV9NQVNLKQorICAgICAgICAgICAgICAgID09IENvbmZpZ3VyYXRpb24uU0NSRUVOTEFZT1VUX1NJWkVfWExBUkdFCisgICAgICAgICAgICAgICAgJiYgY29uZmlnLm9yaWVudGF0aW9uID09IENvbmZpZ3VyYXRpb24uT1JJRU5UQVRJT05fTEFORFNDQVBFKSB7CisgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgLyoqCisgICAgICogQ2FsbGVkIHRvIGRldGVybWluZSB3aGV0aGVyIHRoZSBoZWFkZXIgbGlzdCBzaG91bGQgYmUgaGlkZGVuLgorICAgICAqIFRoZSBkZWZhdWx0IGltcGxlbWVudGF0aW9uIHJldHVybnMgdGhlCisgICAgICogdmFsdWUgZ2l2ZW4gaW4ge0BsaW5rICNFWFRSQV9OT19IRUFERVJTfSBvciBmYWxzZSBpZiBpdCBpcyBub3Qgc3VwcGxpZWQuCisgICAgICogVGhpcyBpcyBzZXQgdG8gZmFsc2UsIGZvciBleGFtcGxlLCB3aGVuIHRoZSBhY3Rpdml0eSBpcyBiZWluZyByZS1sYXVuY2hlZAorICAgICAqIHRvIHNob3cgYSBwYXJ0aWN1bGFyIHByZWZlcmVuY2UgYWN0aXZpdHkuCisgICAgICovCisgICAgcHVibGljIGJvb2xlYW4gb25Jc0hpZGluZ0hlYWRlcnMoKSB7CisgICAgICAgIHJldHVybiBnZXRJbnRlbnQoKS5nZXRCb29sZWFuRXh0cmEoRVhUUkFfTk9fSEVBREVSUywgZmFsc2UpOworICAgIH0KKworICAgIC8qKgorICAgICAqIENhbGxlZCB0byBkZXRlcm1pbmUgdGhlIGluaXRpYWwgaGVhZGVyIHRvIGJlIHNob3duLiAgVGhlIGRlZmF1bHQKKyAgICAgKiBpbXBsZW1lbnRhdGlvbiBzaW1wbHk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W1lID0gcGFyc2VyLmdldE5hbWUoKTsKKyAgICAgICAgICAgIGlmICghInByZWZlcmVuY2UtaGVhZGVycyIuZXF1YWxzKG5vZGVOYW1lKSkgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBSdW50aW1lRXhjZXB0aW9uKAorICAgICAgICAgICAgICAgICAgICAgICAgIlhNTCBkb2N1bWVudCBtdXN0IHN0YXJ0IHdpdGggPHByZWZlcmVuY2UtaGVhZGVycz4gdGFnOyBmb3VuZCIKKyAgICAgICAgICAgICAgICAgICAgICAgICsgbm9kZU5hbWUgKyAiIGF0ICIgKyBwYXJzZXIuZ2V0UG9zaXRpb25EZXNjcmlwdGlvbigpKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgQnVuZGxlIGN1ckJ1bmRsZSA9IG51bGw7CisKKyAgICAgICAgICAgIGZpbmFsIGludCBvdXRlckRlcHRoID0gcGFyc2VyLmdldERlcHRoKCk7CisgICAgICAgICAgICB3aGlsZSAoKHR5cGU9cGFyc2VyLm5leHQoKSkgIT0gWG1sUHVsbFBhcnNlci5FTkRfRE9DVU1FTlQKKyAgICAgICAgICAgICAgICAgICAmJiAodHlwZSAhPSBYbWxQdWxsUGFyc2VyLkVORF9UQUcgfHwgcGFyc2VyLmdldERlcHRoKCkgPiBvdXRlckRlcHRoKSkgeworICAgICAgICAgICAgICAgIGlmICh0eXBlID09IFhtbFB1bGxQYXJzZXIuRU5EX1RBRyB8fCB0eXBlID09IFhtbFB1bGxQYXJzZXIuVEVYVCkgeworICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBub2RlTmFtZSA9IHBhcnNlci5nZXROYW1lKCk7CisgICAgICAgICAgICAgICAgaWYgKCJoZWFkZXIiLmVxdWFscyhub2RlTmFtZSkpIHsKKyAgICAgICAgICAgICAgICAgICAgSGVhZGVyIGhlYWRlciA9IG5ldyBIZWFkZXIoKTsKKworICAgICAgICAgICAgICAgICAgICBUeXBlZEFycmF5IHNhID0gZ2V0UmVzb3VyY2VzKCkub2J0YWluQXR0cmlidXRlcyhhdHRycywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5QcmVmZXJlbmNlSGVhZGVyKTsKKyAgICAgICAgICAgICAgICAgICAgaGVhZGVyLnRpdGxlID0gc2EuZ2V0VGV4dCgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5QcmVmZXJlbmNlSGVhZGVyX3RpdGxlKTsKKyAgICAgICAgICAgICAgICAgICAgaGVhZGVyLnN1bW1hcnkgPSBzYS5nZXRUZXh0KAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLlByZWZlcmVuY2VIZWFkZXJfc3VtbWFyeSk7CisgICAgICAgICAgICAgICAgICAgIGhlYWRlci5pY29uUmVzID0gc2EuZ2V0UmVzb3VyY2VJZCgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5QcmVmZXJlbmNlSGVhZGVyX2ljb24sIDApOworICAgICAgICAgICAgICAgICAgICBoZWFkZXIuZnJhZ21lbnQgPSBzYS5nZXRTdHJpbmcoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuUHJlZmVyZW5jZUhlYWRlcl9mcmFnbWVudCk7CisgICAgICAgICAgICAgICAgICAgIHNhLnJlY3ljbGUoKTsKKworICAgICAgICAgICAgICAgICAgICBpZiAoY3VyQnVuZGxlID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGN1ckJ1bmRsZSA9IG5ldyBCdW5kbGUoKTsKKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIGZpbmFsIGludCBpbm5lckRlcHRoID0gcGFyc2VyLmdldERlcHRoKCk7CisgICAgICAgICAgICAgICAgICAgIHdoaWxlICgodHlwZT1wYXJzZXIubmV4dCgpKSAhPSBYbWxQdWxsUGFyc2VyLkVORF9ET0NVTUVOVAorICAgICAgICAgICAgICAgICAgICAgICAgICAgJiYgKHR5cGUgIT0gWG1sUHVsbFBhcnNlci5FTkRfVEFHIHx8IHBhcnNlci5nZXREZXB0aCgpID4gaW5uZXJEZXB0aCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0eXBlID09IFhtbFB1bGxQYXJzZXIuRU5EX1RBRyB8fCB0eXBlID09IFhtbFB1bGxQYXJzZXIuVEVYVCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgICAgICBTdHJpbmcgaW5uZXJOb2RlTmFtZSA9IHBhcnNlci5nZXROYW1lKCk7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaW5uZXJOb2RlTmFtZS5lcXVhbHMoImV4dHJhIikpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRSZXNvdXJjZXMoKS5wYXJzZUJ1bmRsZUV4dHJhKCJleHRyYSIsIGF0dHJzLCBjdXJCdW5kbGUpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIFhtbFV0aWxzLnNraXBDdXJyZW50VGFnKHBhcnNlcik7CisKKyAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoaW5uZXJOb2RlTmFtZS5lcXVhbHMoImludGVudCIpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyLmludGVudCA9IEludGVudC5wYXJzZUludGVudChnZXRSZXNvdXJjZXMoKSwgcGFyc2VyLCBhdHRycyk7CisKKyAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgWG1sVXRpbHMuc2tpcEN1cnJlbnRUYWcocGFyc2VyKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIGlmIChjdXJCdW5kbGUuc2l6ZSgpID4gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyLmZyYWdtZW50QXJndW1lbnRzID0gY3VyQnVuZGxlOworICAgICAgICAgICAgICAgICAgICAgICAgY3VyQnVuZGxlID0gbnVsbDsKKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIHRhcmdldC5hZGQoaGVhZGVyKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICBYbWxVdGlscy5za2lwQ3VycmVudFRhZyhwYXJzZXIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICB9IGNhdGNoIChYbWxQdWxsUGFyc2VyRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBSdW50aW1lRXhjZXB0aW9uKCJFcnJvciBwYXJzaW5nIGhlYWRlcnMiLCBlKTsKKyAgICAgICAgfSBjYXRjaCAoSU9FeGNlcHRpb24gZSkgeworICAgICAgICAgICAgdGhyb3cgbmV3IFJ1bnRpbWVFeGNlcHRpb24oIkVycm9yIHBhcnNpbmcgaGVhZGVycyIsIGUpOworICAgICAgICB9IGZpbmFsbHkgeworICAgICAgICAgICAgaWYgKHBhcnNlciAhPSBudWxsKSBwYXJzZXIuY2xvc2UoKTsKKyAgICAgICAgfQorCisgICAgfQorCisgICAgLyoqCisgICAgICogU2V0IGEgZm9vdGVyIHRoYXQgc2hvdWxkIGJlIHNob3duIGF0IHRoZSBib3R0b20gb2YgdGhlIGhlYWRlciBsaXN0LgorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNldExpc3RGb290ZXIoVmlldyB2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AgICAgICBpZiAoY29udGFpbmVyICE9IG51bGwpIHsKLSAgICAgICAgICAgIGZpbmFsIFByZWZlcmVuY2VTY3JlZW4gcHJlZmVyZW5jZVNjcmVlbiA9IGdldFByZWZlcmVuY2VTY3JlZW4oKTsKLSAgICAgICAgICAgIGlmIChwcmVmZXJlbmNlU2NyZWVuICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICBwcmVmZXJlbmNlU2NyZWVuLnJlc3RvcmVIaWVyYXJjaHlTdGF0ZShjb250YWluZXIpOwotICAgICAgICAgICAgICAgIG1TYXZlZEluc3RhbmNlU3RhdGUgPSBzdGF0ZTsKLSAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgIGlmIChtUHJlZmVyZW5jZU1hbmFnZXIgIT0gbnVsbCkgeworICAgICAgICAgICAgQnVuZGxlIGNvbnRhaW5lciA9IHN0YXRlLmdldEJ1bmRsZShQUkVGRVJFTkNFU19UQUcpOworICAgICAgICAgICAgaWYgKGNvbnRhaW5lciAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgZmluYWwgUHJlZmVyZW5jZVNjcmVlbiBwcmVmZXJlbmNlU2NyZWVuID0gZ2V0UHJlZmVyZW5jZVNjcmVlbigpOworICAgICAgICAgICAgICAgIGlmIChwcmVmZXJlbmNlU2NyZWVuICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgcHJlZmVyZW5jZVNjcmVlbi5yZXN0b3JlSGllcmFyY2h5U3RhdGUoY29udGFpbmVyKTsKKyAgICAgICAgICAgICAgICAgICAgbVNhdmVkSW5zdGFuY2VTdGF0ZSA9IHN0YXRlOworICAgICAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICB9CiAKQEAgLTE1NiwxNCArNjUzLDEwNCBAQAogICAgIEBPdmVycmlkZQogICAgIHByb3RlY3RlZCB2b2lkIG9uQWN0aXZpdHlSZXN1bHQoaW50IHJlcXVlc3RDb2RlLCBp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mZXJlbmNlU2NyZWVuIGdldFByZWZlcmVuY2VTY3JlZW4oKSB7Ci0gICAgICAgIHJldHVybiBtUHJlZmVyZW5jZU1hbmFnZXIuZ2V0UHJlZmVyZW5jZVNjcmVlbigpOworICAgICAgICBpZiAobVByZWZlcmVuY2VNYW5hZ2VyICE9IG51bGwpIHsKKyAgICAgICAgICAgIHJldHVybiBtUHJlZmVyZW5jZU1hbmFnZXIuZ2V0UHJlZmVyZW5jZVNjcmVlbigpOworICAgICAgICB9CisgICAgICAgIHJldHVybiBudWxsOwogICAgIH0KLSAgICAKKwogICAgIC8qKgogICAgICAqIEFkZHMgcHJlZmVyZW5jZXMgZnJvbSBhY3Rpdml0aWVzIHRoYXQgbWF0Y2ggdGhlIGdpdmVuIHtAbGluayBJbnRlbnR9LgotICAgICAqIAorICAgICAqCiAgICAgICogQHBhcmFtIGludGVudCBUaGUge0BsaW5rIEludGVudH0gdG8gcXVlcnkgYWN0aXZpdGllcy4KKyAgICAgKgorICAgICAqIEBkZXByZWNhdGVkIFRoaXMgZnVuY3Rpb24gaXMgbm90IHJlbGV2YW50IGZvciBhIG1vZGVybiBmcmFnbWVudC1iYXNlZAorICAgICAqIFByZWZlcmVuY2VBY3Rpdml0eS4KICAgICAgKi8KKyAgICBARGVwcmVjYXRlZAogICAgIHB1YmxpYyB2b2lkIGFkZFByZWZlcmVuY2VzRnJvbUludGVudChJbnRlbnQgaW50ZW50KSB7CiAgICAgICAgIHJlcXVpcmVQcmVmZXJlbmNlTWFuYWdlcigpOwotICAgICAgICAKKwogICAgICAgICBzZXRQcmVmZXJlbmNlU2NyZWVuKG1QcmVmZXJlbmNlTWFuYWdlci5pbmZsYXRlRnJvbUludGVudChpbnRlbnQsIGdldFByZWZlcmVuY2VTY3JlZW4oKSkpOwogICAgIH0KLSAgICAKKwogICAgIC8qKgogICAgICAqIEluZmxhdGVzIHRoZSBnaXZlbiBYTUwgcmVzb3VyY2UgYW5kIGFkZHMgdGhlIHByZWZlcmVuY2Ug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ICBmaW5hbCBQcmVmZXJlbmNlU2NyZWVuIHByZWZlcmVuY2VTY3JlZW4gPSBnZXRQcmVmZXJlbmNlU2NyZWVuKCk7CisgICAgICAgICAgICAgICAgaWYgKHByZWZlcmVuY2VTY3JlZW4gIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBwcmVmZXJlbmNlU2NyZWVuLnJlc3RvcmVIaWVyYXJjaHlTdGF0ZShjb250YWluZXIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIG9uU3RvcCgpIHsKKyAgICAgICAgc3VwZXIub25TdG9wKCk7CisgICAgICAgIG1QcmVmZXJlbmNlTWFuYWdlci5kaXNwYXRjaEFjdGl2aXR5U3RvcCgpOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIG9uRGVzdHJveVZpZXcoKSB7CisgICAgICAgIG1MaXN0ID0gbnVsbDsKKyAgICAgICAgbUhhbmRsZXIucmVtb3ZlQ2FsbGJhY2tzKG1SZXF1ZXN0Rm9jdXMpOworICAgICAgICBzdXBlci5vbkRlc3Ryb3lWaWV3KCk7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgb25EZXN0cm95KCkgeworICAgICAgICBzdXBlci5vbkRlc3Ryb3koKTsKKyAgICAgICAgbVByZWZlcmVuY2VNYW5hZ2VyLmRpc3BhdGNoQWN0aXZpdHlEZXN0cm95KCk7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgb25TYXZlSW5zdGFuY2VTdGF0ZShCdW5kbGUgb3V0U3RhdGUpIHsKKyAgICAgICAgc3VwZXIub25TYXZlSW5zdGFuY2VTdGF0ZShvdXRTdGF0ZSk7CisKKyAgICAgICAgZmluYWwgUHJlZmVyZW5jZVNjcmVlbiBwcmVmZXJlbmNlU2NyZWVuID0gZ2V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saWNrKFByZWZlcmVuY2VTY3JlZW4gcHJlZmVyZW5jZVNjcmVlbiwKKyAgICAgICAgICAgIFByZWZlcmVuY2UgcHJlZmVyZW5jZSkgeworICAgICAgICBpZiAocHJlZmVyZW5jZS5nZXRGcmFnbWVudCgpICE9IG51bGwgJiYKKyAgICAgICAgICAgICAgICBnZXRBY3Rpdml0eSgpIGluc3RhbmNlb2YgT25QcmVmZXJlbmNlU3RhcnRGcmFnbWVudENhbGxiYWNrKSB7CisgICAgICAgICAgICByZXR1cm4gKChPblByZWZlcmVuY2VTdGFydEZyYWdtZW50Q2FsbGJhY2spZ2V0QWN0aXZpdHkoKSkub25QcmVmZXJlbmNlU3RhcnRGcmFnbWVudCgKKyAgICAgICAgICAgICAgICAgICAgdGhpcywgcHJlZmVyZW5jZSk7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIC8qKgorICAgICAqIEZpbmRzIGEge0BsaW5rIFByZWZlcmVuY2V9IGJhc2VkIG9uIGl0cyBrZXkuCisgICAgICoKKyAgICAgKiBAcGFyYW0ga2V5IFRoZSBrZXkgb2YgdGhlIHByZWZlcmVuY2UgdG8gcmV0cmlldmUuCisgICAgICogQHJldHVybiBUaGUge0BsaW5rIFByZWZlcmVuY2V9IHdpdGggdGhlIGtleSwgb3IgbnVsbC4KKyAgICAgKiBAc2VlIFByZWZlcmVuY2VHcm91cCNmaW5kUHJlZmVyZW5jZShDaGFyU2VxdWVuY2UpCisgICAgICovCisgICAgcHVibGljIFByZWZlcmVuY2UgZmluZFByZWZlcmVuY2UoQ2hhclNlcXVlbmNlIGtleSkgeworICAgICAgICBpZiAobVByZWZlcmVuY2VNYW5hZ2VyID09IG51bGwpIHsKKyAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICB9CisgICAgICAgIHJldHVybiBtUHJlZmVyZW5jZU1hbmFnZXIuZmluZFByZWZlcmVuY2Uoa2V5KTsKKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgcmVxdWlyZVByZWZlcmVuY2VNYW5hZ2VyKCkgeworICAgICAgICBpZiAobVByZWZlcmVuY2VNYW5hZ2VyID09IG51bGwpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBSdW50aW1lRXhjZXB0aW9uKCJUaGlzIHNob3VsZCBiZSBjYWxsZWQgYWZ0ZXIgc3VwZXIub25DcmVhdGUuIik7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgcG9zdEJpbmRQcmVmZXJlbmNlcygpIHsKKyAgICAgICAgaWYgKG1IYW5kbGVyLmhhc01lc3NhZ2VzKE1TR19CSU5EX1BSRUZFUkVOQ0VTKSkgcmV0dXJuOworICAgICAgICBtSGFuZGxlci5vYnRhaW5NZXNzYWdlKE1TR19CSU5EX1BSRUZFUkVOQ0VTKS5zZW5kVG9UYXJnZXQoKTsKKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgYmluZFByZWZlcmVuY2VzKCkgeworICAgICAgICBmaW5hbCBQcmVmZXJlbmNlU2NyZWVuIHByZWZlcmVuY2VTY3JlZW4gPSBnZXRQcmVmZXJlbmNlU2NyZWVuKCk7CisgICAgICAgIGlmIChwcmVmZXJlbmNlU2NyZWVuICE9IG51bGwpIHsKKyAgICAgICAgICAgIHByZWZlcmVuY2VTY3JlZW4uYmluZChnZXRMaXN0VmlldygpKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKiBAaGlkZSAqLworICAgIHB1YmxpYyBMaXN0VmlldyBnZXRMaXN0VmlldygpIHsKKyAgICAgICAgZW5zdXJlTGlzdCgpOworICAgICAgICByZXR1cm4gbUxpc3Q7CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIGVuc3VyZUxpc3QoKSB7CisgICAgICAgIGlmIChtTGlzdCAhPSBudWxsKSB7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKyAgICAgICAgVmlldyByb290ID0gZ2V0VmlldygpOworICAgICAgICBpZiAocm9vdCA9PSBudWxsKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJDb250ZW50IHZpZXcgbm90IHlldCBjcmVhdGVkIik7CisgICAgICAgIH0KKyAgICAgICAgVmlldyByYXdMaXN0VmlldyA9IHJvb3QuZmluZFZpZXdCeUlkKGFuZHJvaWQuUi5pZC5saXN0KTsKKyAgICAgICAgaWYgKCEocmF3TGlzdFZpZXcgaW5zdGFuY2VvZiBMaXN0VmlldykpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBSdW50aW1lRXhjZXB0aW9uKAorICAgICAgICAgICAgICAgICAgICAiQ29udGVudCBoYXMgdmlldyB3aXRoIGlkIGF0dHJpYnV0ZSAnYW5kcm9pZC5SLmlkLmxpc3QnICIKKyAgICAgICAgICAgICAgICAgICAgKyAidGhhdCBpcyBub3QgYSBMaXN0VmlldyBjbGFzcyIpOworICAgICAgICB9CisgICAgICAgIG1MaXN0ID0gKExpc3RWaWV3KXJhd0xpc3RWaWV3OworICAgICAgICBpZiAobUxpc3QgPT0gbnVsbCkgeworICAgICAgICAgICAgdGhyb3cgbmV3IFJ1bnRpbWVFeGNlcHRpb24oCisgICAgICAgICAgICAgICAgICAgICJZb3VyIGNvbnRlbnQgbXVzdCBoYXZlIGEgTGlzdFZpZXcgd2hvc2UgaWQgYXR0cmlidXRlIGlzICIgKworICAgICAgICAgICAgICAgICAgICAiJ2FuZHJvaWQuUi5pZC5saXN0JyIpOworICAgICAgICB9CisgICAgICAgIG1IYW5kbGVyLnBvc3QobVJlcXVlc3RGb2N1cyk7CisgICAgfQorfQpkaWZmIC0tZ2l0IGEvY29yZS9qYXZhL2FuZHJvaWQvcHJlZmVyZW5jZS9QcmVmZXJlbmNlSW5mbGF0ZXIuamF2YSBiL2NvcmUvamF2YS9hbmRyb2lkL3ByZWZlcmVuY2UvUHJlZmVyZW5jZUluZmxhdGVyLmphdmEKaW5kZXggNzc5ZTc0Ni4uYzIxYWExOCAxMD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iKTsKLSAgICAgICAgICAgICAgICBMb2cudyhUQUcsIGUpOworICAgICAgICAgICAgICAgIFhtbFB1bGxQYXJzZXJFeGNlcHRpb24gZXggPSBuZXcgWG1sUHVsbFBhcnNlckV4Y2VwdGlvbigKKyAgICAgICAgICAgICAgICAgICAgICAgICJFcnJvciBwYXJzaW5nIHByZWZlcmVuY2UiKTsKKyAgICAgICAgICAgICAgICBleC5pbml0Q2F1c2UoZSk7CisgICAgICAgICAgICAgICAgdGhyb3cgZXg7CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICAKICAgICAgICAgICAgIGlmIChpbnRlbnQgIT0gbnVsbCkgewpAQCAtODIsNiArODcsMTggQEAKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIAogICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgIH0gZWxzZSBpZiAodGFnLmVxdWFscyhFWFRSQV9UQUdfTkFNRSkpIHsKKyAgICAgICAgICAgIGdldENvbnRleHQoKS5nZXRSZXNvdXJjZXMoKS5wYXJzZUJ1bmRsZUV4dHJhKEVYVFJBX1RBR19OQU1FLCBhdHRycywKKyAgICAgICAgICAgICAgICAgICAgcGFyZW50UHJlZmVyZW5jZS5nZXRFeHRyYXMoKSk7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIFhtbFV0aWxzLnNraXBDdXJyZW50VGFnKHBhcnNlcik7CisgICAgICAgICAgICB9IGNhdGNoIChJT0V4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgWG1sUHVsbFBhcnNlckV4Y2VwdGlvbiBleCA9IG5ldyBYbWxQdWxsUGFyc2VyRXhjZXB0aW9uKAorICAgICAgICAgICAgICAgICAgICAgICAgIkVycm9yIHBhcnNpbmcgcHJlZmVyZW5jZSIpOworICAgICAgICAgICAgICAgIGV4LmluaXRDYXVzZShlKTsKKyAgICAgICAgICAgICAgICB0aHJvdyBleDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiB0cnVlO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ldFN0cmluZyhjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0cmluZy5zZW5kVGV4dCkpOwogICAgIH0KIAogICAgIC8qKgpAQCAtMTc0LDQ4ICsyMTAsNDkgQEAKICAgICAgICAgc2VuZC5wdXRFeHRyYShJbnRlbnQuRVhUUkFfVEVYVCwgc3RyaW5nVG9TZW5kKTsKIAogICAgICAgICB0cnkgewotICAgICAgICAgICAgYy5zdGFydEFjdGl2aXR5KEludGVudC5jcmVhdGVDaG9vc2VyKHNlbmQsIGNob29zZXJEaWFsb2dUaXRsZSkpOworICAgICAgICAgICAgSW50ZW50IGkgPSBJbnRlbnQuY3JlYXRlQ2hvb3NlcihzZW5kLCBjaG9vc2VyRGlhbG9nVGl0bGUpOworICAgICAgICAgICAgLy8gSW4gY2FzZSB0aGlzIGlzIGNhbGxlZCBmcm9tIG91dHNpZGUgYW4gQWN0aXZpdHkKKyAgICAgICAgICAgIGkuc2V0RmxhZ3MoSW50ZW50LkZMQUdfQUNUSVZJVFlfTkVXX1RBU0spOworICAgICAgICAgICAgYy5zdGFydEFjdGl2aXR5KGkpOwogICAgICAgICB9IGNhdGNoKGFuZHJvaWQuY29udGVudC5BY3Rpdml0eU5vdEZvdW5kRXhjZXB0aW9uIGV4KSB7CiAgICAgICAgICAgICAvLyBpZiBubyBhcHAgaGFuZGxlcyBpdCwgZG8gbm90aGluZwogICAgICAgICB9CiAgICAgfQogCiAgICAgLyoqCi0gICAgICogIFJldHVybiBhIGN1cnNvciBwb2ludGluZyB0byBhIGxpc3Qgb2YgYWxsIHRoZSBib29rbWFya3MuCisgICAgICogIFJldHVybiBhIGN1cnNvciBwb2ludGluZyB0byBhIGxpc3Qgb2YgYWxsIHRoZSBib29rbWFya3MuIFRoZSBjdXJzb3Igd2lsbCBoYXZlIGEgc2luZ2xlCisgICAgICogIGNvbHVtbiwge0BsaW5rIEJvb2ttYXJrQ29sdW1ucyNVUkx9LgorICAgICAqICA8cD4KICAgICAgKiAgUmVxdWlyZXMge0BsaW5rIGFuZHJvaWQuTWFuaWZlc3QucGVybWlzc2lvbiNSRUFEX0hJU1RPUllfQk9PS01BUktTfQorICAgICAqCiAgICAgICogIEBwYXJhbSBjciAgIFRoZSBDb250ZW50UmVzb2x2ZXIgdXNlZCB0byBhY2Nlc3MgdGhlIGRhdGFiYXNlLgogICAgICAqLwogICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgQ3Vyc29yIGdldEFsbEJvb2ttYXJrcyhDb250ZW50UmVzb2x2ZXIgY3IpIHRocm93cyAKICAgICAgICAgICAgIElsbGVnYWxTdGF0ZUV4Y2VwdGlvbiB7Ci0gICAgICAgIHJldHVybiBjci5xdWVyeShCT09LTUFSS1NfVVJJLAotICAgICAgICAgICAgICAgIG5ldyBTdHJpbmdbXSB7IEJvb2ttYXJrQ29sdW1ucy5VUkwgfSwgCi0gICAgICAgICAgICAgICAgImJvb2ttYXJrID0gMSIsIG51bGwsIG51bGwpOworICAgICAgICByZXR1cm4gY3IucXVlcnkoQm9va21hcmtzLkNPTlRFTlRfVVJJLAorICAgICAgICAgICAgICAgIG5ldyBTdHJpbmdbXSB7IEJvb2ttYXJrcy5VUkwgfSwgCisgICAgICAgICAgICAgICAgQm9va21hcmtzLklTX0ZPTERFUiArICIgPSAwIiwgbnVsbCwgbnVsbCk7CiAgICAgfQogCiAgICAgLyoqCi0gICAgICogIFJldHVybiBhIGN1cnNvciBwb2ludGluZyB0byBhIGxpc3Qgb2YgYWxsIHZpc2l0ZWQgc2l0ZSB1cmxzLgorICAgICAqICBSZXR1cm4gYSBjdXJzb3IgcG9pbnRpbmcgdG8gYSBsaXN0IG9mIGFsbCB2aXNpdGVkIHNpdGUgdXJscy4gVGhlIGN1cnNvciB3aWxsCisgICAgICogIGhhdmUgYSBzaW5nbGUgY29sdW1uLCB7QGxpbmsgQm9va21hcmtDb2x1bW5zI1VSTH0uCisgICAgICogIDxwPgogICAgICAqICBSZXF1aXJlcyB7QGxpbmsgYW5kcm9pZC5NYW5pZ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RTFN0cmluZyh3aGVyZUNsYXVzZSwKICAgICAgICAgICAgICAgICAgICAgImh0dHBzOi8vd3d3LiIgKyBjb21wYXJlU3RyaW5nKTsKICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgIHdoZXJlQ2xhdXNlID0gbmV3IFN0cmluZ0J1aWxkZXIoQm9va21hcmtDb2x1bW5zLlVSTCArICIgPSAiKTsKKyAgICAgICAgICAgIHdoZXJlQ2xhdXNlID0gbmV3IFN0cmluZ0J1aWxkZXIoQm9va21hcmtzLlVSTCArICIgPSAiKTsKICAgICAgICAgICAgIERhdGFiYXNlVXRpbHMuYXBwZW5kRXNjYXBlZFNRTFN0cmluZyh3aGVyZUNsYXVzZSwKICAgICAgICAgICAgICAgICAgICAgY29tcGFyZVN0cmluZyk7CiAgICAgICAgICAgICBhZGRPclVybEVxdWFscyh3aGVyZUNsYXVzZSk7CkBAIC0yNTAsNyArMjg3LDcgQEAKICAgICAgICAgICAgIERhdGFiYXNlVXRpbHMuYXBwZW5kRXNjYXBlZFNRTFN0cmluZyh3aGVyZUNsYXVzZSwKICAgICAgICAgICAgICAgICAgICAgImh0dHA6Ly8iICsgd3d3U3RyaW5nKTsKICAgICAgICAgfQotICAgICAgICByZXR1cm4gY3IucXVlcnkoQk9PS01BUktTX1VSSSwgSElTVE9SWV9QUk9KRUNUSU9OLAorICAgICAgICByZXR1cm4gY3IucXVlcnkoSGlzdG9yeS5DT05URU5UX1VSSSwgbmV3IFN0cmluZ1tdIHsgSGlzdG9yeS5fSUQsIEhpc3RvcnkuVklTSVRTIH0sCiAgICAgICAgICAgICAgICAgd2hlcmVDbGF1c2UudG9TdHJpbmcoKSwgbnVsbCwgbnVsbCk7CiAgICAgfQogCkBAIC0yNjYsMjYgKzMwMywyNCBAQAogICAgICAqLwogICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgdm9pZCB1cGRhdGVWaXNpdGVkSGlzdG9yeShDb250ZW50UmVzb2x2ZXIgY3IsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFN0cmluZyB1cmwsIGJvb2xlYW4gcmVhbCkgewotICAgICAgICBsb25nIG5vdyA9IG5ldyBEYXRlKCkuZ2V0VGltZSgpOworICAgICAgICBsb25nIG5vdyA9IFN5c3RlbS5jdXJyZW50VGltZU1pbGxpcygpOwogICAgICAgICBDdXJzb3IgYyA9IG51bGw7CiAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICBjID0gZ2V0VmlzaXRlZExpa2UoY3IsIHVybCk7CiAgICAgICAgICAgICAvKiBXZSBzaG91bGQgb25seSBnZXQgb25lIGFuc3dlciB0aGF0IGlzIGV4YWN0bHkgdGhlIHNhbWUuICovCiAgICAgICAgICAgICBpZiAoYy5tb3ZlVG9GaXJzdCgpKSB7Ci0gICAgICAgICAgICAgICAgQ29udGVudFZhbHVlcyBtYXAgPSBuZXcgQ29udGVudFZhbHVlcygpOworICAgICAgICAgICAgICAgIENvbnRlbnRWYWx1ZXMgdmFsdWVzID0gbmV3IENvbnRlbnRWYWx1ZXMoKTsKICAgICAgICAgICAgICAgICBpZiAocmVhbCkgewotICAgICAgICAgICAgICAgICAgICBtYXAucHV0KEJvb2ttYXJrQ29sdW1ucy5WSVNJVFMsIGMKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAuZ2V0SW50KEhJU1RPUllfUFJPSkVDVElPTl9WSVNJVFNfSU5ERVgpICsgMSk7CisgICAgICAgICAgICAgICAgICAgIHZhbHVlcy5wdXQoSGlzdG9yeS5WSVNJVFMsIGMuZ2V0SW50KDEpICsgMSk7CiAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgbWFwLnB1dChCb29rbWFya0NvbHVtbnMuVVNFUl9FTlRFUkVELCAxKTsKKyAgICAgICAgICAgICAgICAgICAgdmFsdWVzLnB1dChIaXN0b3J5LlVTRVJfRU5URVJFRCwgMSk7CiAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIG1hcC5wdXQoQm9va21hcmtDb2x1bW5zLkRBVEUsIG5vdyk7Ci0gICAgICAgICAgICAgICAgU3RyaW5nW10gcHJvamVjdGlvbiA9IG5ldyBTdHJpbmdbXQotICAgICAgICAgICAgICAgICAgICAgICAgeyBJbnRlZ2VyLnZhbHVlT2YoYy5nZXRJbnQoMCkpLnRvU3RyaW5nKCkgfTsKLSAgICAgICAgICAgICAgICBjci51cGRhdGUoQk9PS01BUktTX1VSSSwgbWFwLCAiX2lkID0gPyIsIHByb2plY3Rpb24pOworICAgICAgICAgICAgICAgIHZhbHVlcy5wdXQoSGlzdG9yeS5EQVRFX0xBU1RfVklTSVRFRCwgbm93KTsKKyAgICAgICAgICAgICAgICBjci51cGRhdGUoQ29udGVudFVyaXMud2l0aEFwcGVuZGVkSWQoSGlzdG9yeS5DT05URU5UX1VSSSwgYy5nZXRMb25nKDApKSwKKyAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlcywgbnVsbCwgbnVsbCk7CiAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgIHRydW5jYXRlSGlzdG9yeShjcik7Ci0gICAgICAgICAgICAgICAgQ29udGVudFZhbHVlcyBtYXAgPSBuZXcgQ29udGVudFZhbHVlcygpOworICAgICAgICAgICAgICAgIENvbnRlbnRWYWx1ZXMgdmFsdWVzID0gbmV3IENvbnRlbnRWYWx1ZXMoKTsKICAgICAgICAgICAgICAgICBpbnQgdmlzaXRzOwogICAgICAgICAgICAgICAgIGludCB1c2VyX2VudGVyZWQ7CiAgICAgICAgICAgICAgICAgaWYgKHJlYWwpIHsKQEAgLTI5NSwxNCArMzMwLDEzIEBACiAgICAgICAgICAgICAgICAgICAgIHZpc2l0cyA9IDA7CiAgICAgICAgICAgICAgICAgICAgIHVzZXJfZW50ZXJlZCA9IDE7CiAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIG1hcC5wdXQoQm9va21hcmtDb2x1bW5zLlVSTCwgdXJsKTsKLSAgICAgICAgICAgICAgICBtYXAucHV0KEJvb2ttYXJrQ29sdW1ucy5WSVNJVFMsIHZpc2l0cyk7Ci0gICAgICAgICAgICAgICAgbWFwLnB1dChCb29rbWFya0NvbHVtbnMuREFURSwgbm93KTsKLSAgICAgICAgICAgICAgICBtYXAucHV0KEJvb2ttYXJrQ29sdW1ucy5CT09LTUFSSywgMCk7Ci0gICAgICAgICAgICAgICAgbWFwLnB1dChCb29rbWFya0NvbHVtbnMuVElUTEUsIHVybCk7Ci0gICAgICAgICAgICAgICAgbWFwLnB1dChCb29rbWFya0NvbHVtbnMuQ1JFQVRFRCwgMCk7Ci0gICAgICAgICAgICAgICAgbWFwLnB1dChCb29rbWFya0NvbHVtbnMuVVNFUl9FTlRFUkVELCB1c2VyX2VudGVyZWQpOwotICAgICAgICAgICAgICAgIGNyLmluc2VydChCT09LTUFSS1NfVVJJLCBtYXApOworICAgICAgICAgICAgICAgIHZhbHVlcy5wdXQoSGlzdG9yeS5VUkwsIHVybCk7CisgICAgICAgICAgICAgICAgdmFsdWVzLnB1dChIaXN0b3J5LlZJU0lUUywgdmlzaXRzKTsKKyAgICAgICAgICAgICAgICB2YWx1ZXMucHV0KEhpc3RvcnkuREFURV9MQVNUX1ZJU0lURUQsIG5vdyk7CisgICAgICAgICAgICAgICAgdmFsdWVzLnB1dChIaXN0b3J5LlRJVExFLCB1cmwpOworICAgICAgICAgICAgICAgIHZhbHVlcy5wdXQoSGlzdG9yeS5EQVRFX0NSRUFURUQsIDApOworICAgICAgICAgICAgICAgIHZhbHVlcy5wdXQoSGlzdG9yeS5VU0VSX0VOVEVSRUQsIHVzZXJfZW50ZXJlZCk7CisgICAgICAgICAgICAgICAgY3IuaW5zZXJ0KEhpc3RvcnkuQ09OVEVOVF9VUkksIHZhbHVlcyk7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0gY2F0Y2ggKElsbGVnYWxTdGF0ZUV4Y2VwdGlvbiBlKSB7CiAgICAgICAgICAgICBMb2cuZShMT0dUQUcsICJ1cGRhdGVWaXNpdGVkSGlzdG9yeSIsIGUpOwpAQCAtMzIyLDEwICszNTYsMTAgQEAKICAgICAgICAgU3RyaW5nW10gc3RyID0gbnVsbDsKICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgIFN0cmluZ1tdIHByb2plY3Rpb24gPSBuZXcgU3RyaW5nW10gewotICAgICAgICAgICAgICAgICJ1cmwiCisgICAgICAgICAgICAgICAgICAgIEhpc3RvcnkuVVJMLAogICAgICAgICAgICAgfTsKLSAgICAgICAgICAgIGMgPSBjci5xdWVyeShCT09LTUFSS1NfVVJJLCBwcm9qZWN0aW9uLCAidmlzaXRzID4gMCIsIG51bGwsCi0gICAgICAgICAgICAgICAgICAgIG51bGwpOworICAgICAgICAgICAgYyA9IGNyLnF1ZXJ5KEhpc3RvcnkuQ09OVEVOVF9VUkksIHByb2plY3Rpb24sIEhpc3RvcnkuVklTSVRTICsgIiA+IDAiLCBudWxsLCBudWxsKTsKKyAgICAgICAgICAgIGlmIChjID09IG51bGwpIHJldHVybiBuZXcgU3RyaW5nWzBdOwogICAgICAgICAgICAgc3RyID0gbmV3IFN0cmluZ1tjLmdldENvdW50KCldOwogICAgICAgICAgICAgaW50IGkgPSAwOwogICAgICAgICAgICAgd2hpbGUgKGMubW92ZVRvTmV4dCgpKSB7CkBAIC0zNTMsMzEgKzM4NywyOSBAQAogICAgICAqIEBwYXJhbSBjciBUaGUgQ29udGVudFJlc29sdmVyIHVzZWQgdG8gYWNjZXNzIHRoZSBkYXRhYmFzZS4KICAgICAgKi8KICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIHZvaWQgdHJ1bmNhdGVIaXN0b3J5KENvbnRlbnRSZXNvbHZlciBjcikgewotICAgICAgICBDdXJzb3IgYyA9IG51bGw7CisgICAgICAgIC8vIFRPRE8gbWFrZSBhIHNpbmdsZSByZXF1ZXN0IHRvIHRoZSBwcm92aWRlciB0byBkbyB0aGlzIGluIGEgc2luZ2xlIHRyYW5zYWN0aW9uCisgICAgICAgIEN1cnNvciBjdXJzb3IgPSBudWxsOwogICAgICAgICB0cnkgeworICAgICAgICAgICAgCiAgICAgICAgICAgICAvLyBTZWxlY3Qgbm9uLWJvb2ttYXJrIGhpc3RvcnksIG9yZGVyZWQgYnkgZGF0ZQotICAgICAgICAgICAgYyA9IGNyLnF1ZXJ5KAotICAgICAgICAgICAgICAgICAgICBCT09LTUFSS1NfVVJJLAotICAgICAgICAgICAgICAgICAgICBUUlVOQ0FURV9ISVNUT1JZX1BST0pFQ1RJT04sCi0gICAgICAgICAgICAgICAgICAgICJib29rbWFyayA9IDAiLAotICAgICAgICAgICAgICAgICAgICBudWxsLAotICAgICAgICAgICAgICAgICAgICBCb29rbWFya0NvbHVtbnMuREFURSk7Ci0gICAgICAgICAgICAvLyBMb2cudihMT0dUQUcsICJoaXN0b3J5IGNvdW50ICIgKyBjLmNvdW50KCkpOwotICAgICAgICAgICAgaWYgKGMubW92ZVRvRmlyc3QoKSAmJiBjLmdldENvdW50KCkgPj0gTUFYX0hJU1RPUllfQ09VTlQpIHsKKyAgICAgICAgICAgIGN1cnNvciA9IGNyLnF1ZXJ5KEhpc3RvcnkuQ09OVEVOVF9VUkksCisgICAgICAgICAgICAgICAgICAgIG5ldyBTdHJpbmdbXSB7IEhpc3RvcnkuX0lELCBIaXN0b3J5LlVSTCwgSGlzdG9yeS5EQVRFX0xBU1RfVklTSVRFRCB9LAorICAgICAgICAgICAgICAgICAgICBudWxsLCBudWxsLCBIaXN0b3J5LkRBVEVfTEFTVF9WSVNJVEVEICsgIiBBU0MiKTsKKworICAgICAgICAgICAgaWYgKGN1cnNvci5tb3ZlVG9GaXJzdCgpICYmIGN1cnNvci5nZXRDb3VudCgpID49IE1BWF9ISVNUT1JZX0NPVU5UKSB7CisgICAgICAgICAgICAgICAgZmluYWwgV2ViSWNvbkRhdGFiYXNlIGljb25EYiA9IFdlYkljb25EYXRhYmFzZS5nZXRJbnN0YW5jZSgpOwogICAgICAgICAgICAgICAgIC8qIGVsaW1pbmF0ZSBvbGRlc3QgaGlzdG9yeSBpdGVtcyAqLwogICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgVFJVTkNBVEVfTl9PTERFU1Q7IGkrKykgewotICAgICAgICAgICAgICAgICAgICAvLyBMb2cudihMT0dUQUcsICJ0cnVuY2F0ZSBoaXN0b3J5ICIgKwotICAgICAgICAgICAgICAgICAgICAvLyBjLmdldEludChUUlVOQ0FURV9ISVNUT1JZX1BST0pFQ1RJT05fSURfSU5ERVgpKTsKLSAgICAgICAgICAgICAgICAgICAgY3IuZGVsZXRlKEJPT0tNQVJLU19VUkksICJfaWQgPSAiICsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBjLmdldEludChUUlVOQ0FURV9ISVNUT1JZX1BST0pFQ1RJT05fSURfSU5ERVgpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwpOwotICAgICAgICAgICAgICAgICAgICBpZiAoIWMubW92ZVRvTmV4dCgpKSBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY3IuZGVsZXRlKENvbnRlbnRVcmlzLndpdGhBcHBlbmRlZElkKEhpc3RvcnkuQ09OVEVOVF9VUkksIGN1cnNvci5nZXRMb25nKDApKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsLCBudWxsKTsKKyAgICAgICAgICAgICAgICAgICAgaWNvbkRiLnJlbGVhc2VJY29uRm9yUGFnZVVybChjdXJzb3IuZ2V0U3RyaW5nKDEpKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKCFjdXJzb3IubW92ZVRvTmV4dCgpKSBicmVhazsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAgICAgICAgIH0gY2F0Y2ggKElsbGVnYWxTdGF0ZUV4Y2VwdGlvbiBlKSB7CiAgICAgICAgICAgICBMb2cuZShMT0dUQUcsICJ0cnVuY2F0ZUhpc3RvcnkiLCBlKTsKICAgICAgICAgfSBmaW5hbGx5IHsKLSAgICAgICAgICAgIGlmIChjICE9IG51bGwpIGMuY2xvc2UoKTsKKyAgICAgICAgICAgIGlmIChjdXJzb3IgIT0gbnVsbCkgY3Vyc29yLmNsb3NlKCk7CiAgICAgICAgIH0KICAgICB9CiAKQEAgLTM4OCwyMyArNDIwLDE3IEBACiAgICAgICogQHJldHVybiBib29sZWFuICBUcnVlIGlmIHRoZSBoaXN0b3J5IGNhbiBiZSBjbGVhcmVkLgogICAgICAqLwogICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgYm9vbGVhbiBjYW5DbGVhckhpc3RvcnkoQ29udGVudFJlc29sdmVyIGNyKSB7Ci0gICAgICAgIEN1cnNvciBjID0gbnVsbDsKKyAgICAgICAgQ3Vyc29yIGN1cnNvciA9IG51bGw7CiAgICAgICAgIGJvb2xlYW4gcmV0ID0gZmFsc2U7CiAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICBjID0gY3IucXVlcnkoCi0gICAgICAgICAgICAgICAgQk9PS01BUktTX1VSSSwKLSAgICAgICAgICAgICAgICBuZXcgU3RyaW5nIFtdIHsgQm9va21hcmtDb2x1bW5zLl9JRCwgCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEJvb2ttYXJrQ29sdW1ucy5CT09LTUFSSywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQm9va21hcmtDb2x1bW5zLlZJU0lUUyB9LAotICAgICAgICAgICAgICAgICJib29rbWFyayA9IDAgT1IgdmlzaXRzID4gMCIsIAotICAgICAgICAgICAgICAgIG51bGwsCi0gICAgICAgICAgICAgICAgbnVsbAotICAgICAgICAgICAgICAgICk7Ci0gICAgICAgICAgICByZXQgPSBjLm1vdmVUb0ZpcnN0KCk7CisgICAgICAgICAgICBjdXJzb3IgPSBjci5xdWVyeShIaXN0b3J5LkNPTlRFTlRfVVJJLAorICAgICAgICAgICAgICAgIG5ldyBTdHJpbmcgW10geyBIaXN0b3J5Ll9JRCwgSGlzdG9yeS5WSVNJVFMgfSwKKyAgICAgICAgICAgICAgICBudWxsLCBudWxsLCBudWxsKTsKKyAgICAgICAgICAgIHJldCA9IGN1cnNvci5nZXRDb3VudCgpID4gMDsKICAgICAgICAgfSBjYXRjaCAoSWxsZWdhbFN0YXRlRXhjZXB0aW9uIGUpIHsKICAgICAgICAgICAgIExvZy5lKExPR1RBRywgImNhbkNsZWFySGlzdG9yeSIsIGUpOwogICAgICAgICB9IGZpbmFsbHkgewotICAgICAgICAgICAgaWYgKGMgIT0gbnVsbCkgYy5jbG9zZSgpOworICAgICAgICAgICAgaWYgKGN1cnNvciAhPSBudWxsKSBjdXJzb3IuY2xvc2UoKTsKICAgICAgICAgfQogICAgICAgICByZXR1cm4gcmV0OwogICAgIH0KQEAgLTQyMCw2NyArNDQ2LDM2IEBACiAgICAgfQogCiAgICAgLyoqCi0gICAgICogSGVscGVyIGZ1bmN0aW9uIHRvIGRlbGV0ZSBhbGwgaGlzdG9yeSBpdGVtcyBhbmQgcmV2ZXJ0IGFsbAotICAgICAqIGJvb2ttYXJrcyB0byB6ZXJvIHZpc2l0cyB3aGljaCBtZWV0IHRoZSBjcml0ZXJpYSBwcm92aWRlZC4KLSAgICAgKiAgUmVxdWlyZXMge0BsaW5rIGFuZHJvaWQuTWFuaWZlc3QucGVybWlzc2lvbiNSRUFEX0hJU1RPUllfQk9PS01BUktTfQotICAgICAqICBSZXF1aXJlcyB7QGxpbmsgYW5kcm9pZC5NYW5pZmVzdC5wZXJtaXNzaW9uI1dSSVRFX0hJU1RPUllfQk9PS01BUktTfQorICAgICAqIEhlbHBlciBmdW5jdGlvbiB0byBkZWxldGUgYWxsIGhpc3RvcnkgaXRlbXMgYW5kIHJlbGVhc2UgdGhlIGljb25zIGZvciB0aGVtIGluIHRoZQorICAgICAqIHtAbGluayBXZWJJY29uRGF0YWJhc2V9LgorICAgICAqCisgICAgICogUmVxdWlyZXMge0BsaW5rIGFuZHJvaWQuTWFuaWZlc3QucGVybWlzc2lvbiNSRUFEX0hJU1RPUllfQk9PS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ICAgICAgICAgICAgICAgICAgICBudWxsLCBudWxsKTsKKyAgICAgICAgICAgIGlmIChjdXJzb3IubW92ZVRvRmlyc3QoKSkgewogICAgICAgICAgICAgICAgIGZpbmFsIFdlYkljb25EYXRhYmFzZSBpY29uRGIgPSBXZWJJY29uRGF0YWJhc2UuZ2V0SW5zdGFuY2UoKTsKLSAgICAgICAgICAgICAgICAvKiBEZWxldGUgZmF2aWNvbnMsIGFuZCByZXZlcnQgYm9va21hcmtzIHdoaWNoIGhhdmUgYmVlbiB2aXNpdGVkCi0gICAgICAgICAgICAgICAgICogdG8gc2ltcGx5IGJvb2ttYXJrcy4KLSAgICAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgICAgICBTdHJpbmdCdWZmZXIgc2IgPSBuZXcgU3RyaW5nQnVmZmVyKCk7Ci0gICAgICAgICAgICAgICAgYm9vbGVhbiBmaXJzdFRpbWUgPSB0cnVlOwogICAgICAgICAgICAgICAgIGRvIHsKLSAgICAgICAgICAgICAgICAgICAgU3RyaW5nIHVybCA9IGMuZ2V0U3RyaW5nKEhJU1RPUllfUFJPSkVDVElPTl9VUkxfSU5ERVgpOwotICAgICAgICAgICAgICAgICAgICBib29sZWFuIGlzQm9va21hcmsgPQotICAgICAgICAgICAgICAgICAgICAgICAgYy5nZXRJbnQoSElTVE9SWV9QUk9KRUNUSU9OX0JPT0tNQVJLX0lOREVYKSA9PSAxOwotICAgICAgICAgICAgICAgICAgICBpZiAoaXNCb29rbWFyaykgewotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGZpcnN0VGltZSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpcnN0VGltZSA9IGZhbHNlOwotICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBzYi5hcHBlbmQoIiBPUiAiKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIHNiLmFwcGVuZCgiKCBfaWQgPSAiKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIHNiLmFwcGVuZChjLmdldEludCgwKSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBzYi5hcHBlbmQoIiApIik7Ci0gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpY29uRGIucmVsZWFzZUljb25Gb3JQYWdlVXJsKHVybCk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9IHdoaWxlIChjLm1vdmVUb05leHQoKSk7CisgICAgICAgICAgICAgICAgICAgIC8vIERlbGV0ZSBmYXZpY29ucworICAgICAgICAgICAgICAgICAgICAvLyBUT0RPIGRvbid0IHJlbGVhc2UgaWYgdGhlIFVSTCBpcyBib29rbWFya2VkCisgICAgICAgICAgICAgICAgICAgIGljb25EYi5yZWxlYXNlSWNvbkZvclBhZ2VVcmwoY3Vyc29yLmdldFN0cmluZygwKSk7CisgICAgICAgICAgICAgICAgfSB3aGlsZSAoY3Vyc29yLm1vdmVUb05leHQoKSk7CiAKLSAgICAgICAgICAgICAgICBpZiAoIWZpcnN0VGltZSkgewotICAgICAgICAgICAgICAgICAgICBDb250ZW50VmFsdWVzIG1hcCA9IG5ldyBDb250ZW50VmFsdWVzKCk7Ci0gICAgICAgICAgICAgICAgICAgIG1hcC5wdXQoQm9va21hcmtDb2x1bW5zLlZJU0lUUywgMCk7Ci0gICAgICAgICAgICAgICAgICAgIG1hcC5wdXQoQm9va21hcmtDb2x1bW5zLkRBVEUsIDApOwotICAgICAgICAgICAgICAgICAgICAvKiBGSVhNRTogU2hvdWxkIEkgYWxzbyByZW1vdmUgdGhlIHRpdGxlPyAqLwotICAgICAgICAgICAgICAgICAgICBjci51cGRhdGUoQk9PS01BUktTX1VSSSwgbWFwLCBzYi50b1N0cmluZygpLCBudWxsKTsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBTdHJpbmcgZGVsZXRlV2hlcmVDbGF1c2UgPSBCb29rbWFya0NvbHVtbnMuQk9PS01BUksgKyAiID0gMCI7Ci0gICAgICAgICAgICAgICAgaWYgKHdoZXJlQ2xhdXNlICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgZGVsZXRlV2hlcmVDbGF1c2UgKz0gIiBBTkQgIiArIHdoZXJlQ2xhdXNlOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBjci5kZWxldGUoQk9PS01BUktTX1VSSSwgZGVsZXRlV2hlcmVDbGF1c2UsIG51bGwpOworICAgICAgICAgICAgICAgIGNyLmRlbGV0ZShCT09LTUFSS1NfVVJJLCB3aGVyZUNsYXVzZSwgbnVsbCk7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0gY2F0Y2ggKElsbGVnYWxTdGF0ZUV4Y2VwdGlvbiBlKSB7CiAgICAgICAgICAgICBMb2cuZShMT0dUQUcsICJkZWxldGVIaXN0b3J5V2hlcmUiLCBlKTsKICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgfSBmaW5hbGx5IHsKLSAgICAgICAgICAgIGlmIChjICE9IG51bGwpIGMuY2xvc2UoKTsKKyAgICAgICAgICAgIGlmIChjdXJzb3IgIT0gbnVsbCkgY3Vyc29yLmNsb3NlKCk7CiAgICAgICAgIH0KICAgICB9CiAKQEAgLTUyMCwxMCArNTE1LDcgQEAKICAgICAgKi8KICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIHZvaWQgZGVsZXRlRnJvbUhpc3RvcnkoQ29udGVudFJlc29sdmVyIGNyLCAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU3RyaW5nIHVybCkgewotICAgICAgICBTdHJpbmdCdWlsZGVyIHNiID0gbmV3IFN0cmluZ0J1aWxkZXIoQm9va21hcmtDb2x1bW5zLlVSTCArICIgPSAiKTsKLSAgICAgICAgRGF0YWJhc2VVdGlscy5hcHBlbmRFc2NhcGVkU1FMU3RyaW5nK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CBhIHZhbHVlCisgICAgICAgICAqIG9mIDAgaW5kaWNhdGVzIGEgaGlzdG9yeSBpdGVtLgorICAgICAgICAgKiA8cD5UeXBlOiBJTlRFR0VSIChib29sZWFuKTwvcD4KKyAgICAgICAgICovCiAgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIEJPT0tNQVJLID0gImJvb2ttYXJrIjsKKworICAgICAgICAvKioKKyAgICAgICAgICogVGhlIHVzZXIgdmlzaWJsZSB0aXRsZSBvZiB0aGUgYm9va21hcmsgb3IgaGlzdG9yeSBpdGVtLgorICAgICAgICAgKiA8cD5UeXBlOiBURVhUPC9wPgorICAgICAgICAgKi8KICAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgVElUTEUgPSAidGl0bGUiOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgZGF0ZSB0aGUgaXRlbSBjcmVhdGVkLCBpbiBtaWxsaXNlY29uZHMgc2luY2UgdGhlIGVwb2NoLgorICAgICAgICAgKiA8cD5UeXBlOiBOVU1CRVIgKGRhdGUgaW4gbWlsbGlzZWNvbmRzIHNpbmNlIEphbnVhcnkgMSwgMTk3MCk8L3A+CisgICAgICAgICAqLwogICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBDUkVBVEVEID0gImNyZWF0ZWQiOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgZmF2aWNvbiBvZiB0aGUgYm9va21hcmsuIE11c3QgZGVjb2RlIHZpYSB7QGxpbmsgQml0bWFwRmFjdG9yeSNkZWNvZGVCeXRlQXJyYXl9LgorICAgICAgICAgKiA8cD5UeXBlOiBCTE9CIChpbWFnZSk8L3A+CisgICAgICAgICAqLwogICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBGQVZJQ09OID0gImZhdmljb24iOworCiAgICAgICAgIC8qKgogICAgICAgICAgKiBAaGlkZQogICAgICAgICAgKi8KICAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgVEhVTUJOQUlMID0gInRodW1ibmFpbCI7CisKICAgICAgICAgLyoqCiAgICAgICAgICAqIEBoaWRlCiAgICAgICAgICAqLwogICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBUT1VDSF9JQ09OID0gInRvdWNoX2ljb24iOworCiAgICAgICAgIC8qKgogICAgICAgICAgKiBAaGlkZQogICAgICAgICAgKi8KICAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgVVNFUl9FTlRFUkVEID0gInVzZXJfZW50ZXJlZCI7CiAgICAgfQogCisgICAgLyoqCisgICAgICogQ29sdW1uIGRlZmluaXRpb25zIGZvciB0aGUgc2VhcmNoIGhpc3RvcnkgdGFibGUsIGF2YWlsYWJsZSBhdCB7QGxpbmsgI1NFQVJDSEVTX1VSSX0uCisgICAgICovCiAgICAgcHVibGljIHN0YXRpYyBjbGFzcyBTZWFyY2hDb2x1bW5zIGltcGxlbWVudHMgQmFzZUNvbHVtbnMgeworICAgICAgICAvKioKKyAgICAgICAgICogQGRlcHJlY2F0ZWQgTm90IHVzZWQuCisgICAgICAgICAqLworICAgICAgICBARGVwcmVjYXRlZAogICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBVUkwgPSAidXJsIjsKKworICAgICAgICAvKioKKyAgICAgICAgICogVGhlIHVzZXIgZW50ZXJlZCBzZWFyY2ggdGVybS4KKyAgICAgICAgICovCiAgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIFNFQVJDSCA9ICJzZWFyY2giOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgZGF0ZSB0aGUgc2VhcmNoIHdhcyBwZXJmb3JtZWQsIGluIG1pbGxpc2Vjb25kcyBzaW5jZSB0aGUgZXBvY2guCisgICAgICAgICAqIDxwPlR5cGU6IE5VTUJFUiAoZGF0ZSBpbiBtaWxsaXNlY29uZHMgc2luY2UgSmF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XMgcm93IGJlbG9uZ3MsIHdoaWNoIHdoZW4gcGFpcmVkIHdpdGgKKyAgICAgICAgICoge0BsaW5rICNBQ0NPVU5UX1RZUEV9IGlkZW50aWZpZXMgYSBzcGVjaWZpYyBhY2NvdW50LgorICAgICAgICAgKiA8UD5UeXBlOiBURVhUPC9QPgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgQUNDT1VOVF9OQU1FID0gImFjY291bnRfbmFtZSI7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSB0eXBlIG9mIGFjY291bnQgdG8gd2hpY2ggdGhpcyByb3cgYmVsb25ncywgd2hpY2ggd2hlbiBwYWlyZWQgd2l0aAorICAgICAgICAgKiB7QGxpbmsgI0FDQ09VTlRfTkFNRX0gaWRlbnRpZmllcyBhIHNwZWNpZmljIGFjY291bnQuCisgICAgICAgICAqIDxQPlR5cGU6IFRFWFQ8L1A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBBQ0NPVU5UX1RZUEUgPSAiYWNjb3VudF90eXBlIjsKKworICAgICAgICAvKioKKyAgICAgICAgICogU3RyaW5nIHRoYXQgdW5pcXVlbHkgaWRlbnRpZmllcyB0aGlzIHJvdyB0byBpdHMgc291cmNlIGFjY291bnQuCisgICAgICAgICAqIDxQPlR5cGU6IFRFWFQ8L1A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBTT1VSQ0VfSUQgPSAic291cmNlaWQiOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBWZXJzaW9uIG51bWJlciB0aGF0IGlzIHVwZGF0ZWQgd2hlbmV2ZXIgdGhpcyByb3cgb3IgaXRzIHJlbGF0ZWQgZGF0YQorICAgICAgICAgKiBjaGFuZ2VzLgorICAgICAgICAgKiA8UD5UeXBlOiBJTlRFR0VSPC9QPgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgVkVSU0lPTiA9ICJ2ZXJzaW9uIjsKKworICAgICAgICAvKioKKyAgICAgICAgICogRmxhZyBpbmRpY2F0aW5nIHRoYXQge0BsaW5rICNWRVJTSU9OfSBoYXMgY2hhbmdlZCwgYW5kIHRoaXMgcm93IG5lZWRzCisgICAgICAgICAqIHRvIGJlIHN5bmNocm9uaXplZCBieSBpdHMgb3duaW5nIGFjY291bnQuCisgICAgICAgICAqIDxQPlR5cGU6IElOVEVHRVIgKGJvb2xlYW4pPC9QPgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgRElSVFkgPSAiZGlydHkiOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgdGltZSB0aGF0IHRoaXMgcm93IHdhcyBjcmVhdGVkIG9uIGl0cyBvcmlnaW5hdGluZyBjbGllbnQgKG1zZWNzCisgICAgICAgICAqIHNpbmNlIHRoZSBlcG9jaCkuCisgICAgICAgICAqIDxQPlR5cGU6IElOVEVHRVI8L1A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBEQVRFX0NSRUFURUQgPSAiY3JlYXRlZCI7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSB0aW1lIHRoYXQgdGhpcyByb3cgd2FzIGxhc3QgbW9kaWZpZWQgYnkgYSBjbGllbnQgKG1zZWNzIHNpbmNlIHRoZSBlcG9jaCkuCisgICAgICAgICAqIDxQPlR5cGU6IElOVEVHRVI8L1A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBEQVRFX01PRElGSUVEID0gIm1vZGlmaWVkIjsKKworICAgIH0KKworICAgIGludGVyZmFjZSBCb29rbWFya0NvbHVtbnMgeworICAgICAgICAvKioKKyAgICAgICAgICogVGhlIHVuaXF1ZSBJRCBmb3IgYSByb3cuCisgICAgICAgICAqIDxQPlR5cGU6IElOVEVHRVIgKGxvbmcpPC9QPgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgX0lEID0gIl9pZCI7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSBVUkwgb2YgdGhlIGJvb2ttYXJrLgorICAgICAgICAgKiA8UD5UeXBlOiBURVhUIChVUkwpPC9QPgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgVVJMID0gInVybCI7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSB1c2VyIHZpc2libGUgdGl0bGUgb2YgdGhlIGJvb2ttYXJrLgorICAgICAgICAgKiA8UD5UeXBlOiBURVhUPC9QPgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgVElUTEUgPSAidGl0bGUiOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgZmF2aWNvbiBvZiB0aGUgYm9va21hcmssIG1heSBiZSBOVUxMLgorICAgICAgICAgKiBNdXN0IGRlY29kZSB2aWEge0BsaW5rIEJpdG1hcEZhY3RvcnkjZGVjb2RlQnl0ZUFycmF5fS4KKyAgICAgICAgICogPHA+VHlwZTogQkxPQiAoaW1hZ2UpPC9wPgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgRkFWSUNPTiA9ICJmYXZpY29uIjsKKworICAgICAgICAvKioKKyAgICAgICAgICogQSB0aHVtYm5haWwgb2YgdGhlIHBhZ2UsbWF5IGJlIE5VTEwuCisgICAgICAgICAqIE11c3QgZGVjb2RlIHZpYSB7QGxpbmsgQml0bWFwRmFjdG9yeSNkZWNvZGVCeXRlQXJyYXl9LgorICAgICAgICAgKiA8cD5UeXBlOiBCTE9CIChpbWFnZSk8L3A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBUSFVNQk5BSUwgPSAidGh1bWJuYWlsIjsKKworICAgICAgICAvKioKKyAgICAgICAgICogVGhlIHRvdWNoIGljb24gZm9yIHRoZSB3ZWIgcGFnZSwgbWF5IGJlIE5VTEwuCisgICAgICAgICAqIE11c3QgZGVjb2RlIHZpYSB7QGxpbmsgQml0bWFwRmFjdG9yeSNkZWNvZGVCeXRlQXJyYXl9LgorICAgICAgICAgKiA8cD5UeXBlOiBCTE9CIChpbWFnZSk8L3A+CisgICAgICAgICAqIEBoaWRlCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBUT1VDSF9JQ09OID0gInRvdWNoX2ljb24iOworICAgIH0KKworICAgIC8qKgorICAgICAqIFRoZSBib29rbWFya3MgdGFibGUsIHdoaWNoIGhvbGRzIHRoZSB1c2VyJ3MgYnJvd3NlciBib29rbWFya3MuCisgICAgICovCisgICAgcHVibGljIHN0YXRpYyBmaW5hbCBjbGFzcyBCb29rbWFya3MgaW1wbGVtZW50cyBCb29rbWFya0NvbHVtbnMsIFN5bmNDb2x1bW5zIHsKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoaXMgdXRpbGl0eSBjbGFzcyBjYW5ub3QgYmUgaW5zdGFudGlhdGVkLgorICAgICAgICAgKi8KKyAgICAgICAgcHJpdmF0ZSBCb29rbWFya3MoKSB7fQorCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgY29udGVudDovLyBzdHlsZSBVUkkgZm9yIHRoaXMgdGFibGUKKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgVXJpIENPTlRFTlRfVVJJID0gVXJpLndpdGhBcHBlbmRlZFBhdGgoQVVUSE9SSVRZX1VSSSwgImJvb2ttYXJrcyIpOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgY29udGVudDovLyBzdHlsZSBVUkkgZm9yIHRoZSBkZWZhdWx0IGZvbGRlcgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBVcmkgQ09OVEVOVF9VUklfREVGQVVMVF9GT0xERVIgPQorICAgICAgICAgICAgICAgIFVyaS53aXRoQXBwZW5kZWRQYXRoKENPTlRFTlRfVVJJLCAiZm9sZGVyIik7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIEJ1aWxkcyBhIFVSSSB0aGF0IHBvaW50cyB0byBhIHNwZWNpZmljIGZvbGRlci4KKyAgICAgICAgICogQHBhcmFtIGZvbGRlcklkIHRoZSBJRCBvZiB0aGUgZm9sZGVyIHRvIHBvaW50IHRvCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFVyaSBidWlsZEZvbGRlclVyaShsb25nIGZvbGRlcklkKSB7CisgICAgICAgICAgICByZXR1cm4gQ29udGVudFVyaXMud2l0aEFwcGVuZGVkSWQoQ09OVEVOVF9VUklfREVGQVVMVF9GT0xERVIsIGZvbGRlcklkKTsKKyAgICAgICAgfQorCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgTUlNRSB0eXBlIG9mIHtAbGluayAjQ09OVEVOVF9VUkl9IHByb3ZpZGluZyBhIGRpcmVjdG9yeSBvZiBib29rbWFya3MuCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBDT05URU5UX1RZUEUgPSAidm5kLmFuZHJvaWQuY3Vyc29yLmRpci9ib29rbWFyayI7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSBNSU1FIHR5cGUgb2YgYSB7QGxpbmsgI0NPTlRFTlRfVVJJfSBvZiBhIHNpbmdsZSBib29rbWFyay4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIENPTlRFTlRfSVRFTV9UWVBFID0gInZuZC5hbmRyb2lkLmN1cnNvci5pdGVtL2Jvb2ttYXJrIjsKKworICAgICAgICAvKioKKyAgICAgICAgICogUXVlcnkgc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Ugc2FtZQorICAgICAgICAgKiB7QGxpbmsgI1BBUkVOVH0uIE1heSBiZSBuZWdhdGl2ZS4KKyAgICAgICAgICogPFA+VHlwZTogSU5URUdFUjwvUD4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIFBPU0lUSU9OID0gInBvc2l0aW9uIjsKKworICAgICAgICAvKioKKyAgICAgICAgICogVGhlIGl0ZW0gdGhhdCB0aGUgYm9va21hcmsgc2hvdWxkIGJlIGluc2VydGVkIGFmdGVyLgorICAgICAgICAgKiBNYXkgYmUgbmVnYXRpdmUuCisgICAgICAgICAqIDxQPlR5cGU6IElOVEVHRVI8L1A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBJTlNFUlRfQUZURVIgPSAiaW5zZXJ0X2FmdGVyIjsKKworICAgICAgICAvKioKKyAgICAgICAgICogQSBmbGFnIHRvIGluZGljYXRlIGlmIGFuIGl0ZW0gaGFzIGJlZW4gZGVsZXRlZC4gUXVlcmllcyB3aWxsIG5vdCByZXR1cm4gZGVsZXRlZAorICAgICAgICAgKiBlbnRyaWVzIHVubGVzcyB5b3UgYWRkIHRoZSB7QGxpbmsgI1FVRVJZX1BBUkFNRVRFUl9TSE9XX0RFTEVURUR9IHF1ZXJ5IHBhcmFtdGVyCisgICAgICAgICAqIHRvIHRoZSBVUkkgd2hlbiBwZXJmb3JtaW5nIHlvdXIgcXVlcnkuCisgICAgICAgICAqIDxwPlR5cGU6IElOVEVHRVIgKG5vbi16ZXJvIGlmIHRoZSBpdGVtIGhhcyBiZWVuIGRlbGV0ZWQsIHplcm8gaWYgaXQgaGFzbid0KQorICAgICAgICAgKiBAc2VlICNRVUVSWV9QQVJBTUVURVJfU0hPV19ERUxFVEVECisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBJU19ERUxFVEVEID0gImRlbGV0ZWQiOworICAgIH0KKwor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BzdGF0aWMgZmluYWwgY2xhc3MgU2VhcmNoZXMgeworICAgICAgICBwcml2YXRlIFNlYXJjaGVzKCkge30KKworICAgICAgICAvKioKKyAgICAgICAgICogVGhlIGNvbnRlbnQ6Ly8gc3R5bGUgVVJJIGZvciB0aGlzIHRhYmxlCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFVyaSBDT05URU5UX1VSSSA9IFVyaS53aXRoQXBwZW5kZWRQYXRoKEFVVEhPUklUWV9VUkksICJzZWFyY2hlcyIpOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgTUlNRSB0eXBlIG9mIHtAbGluayAjQ09OVEVOVF9VUkl9IHByb3ZpZGluZyBhIGRpcmVjdG9yeSBvZiBicm93c2VyIHNlYXJjaCBpdGVtcy4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIENPTlRFTlRfVFlQRSA9ICJ2bmQuYW5kcm9pZC5jdXJzb3IuZGlyL3NlYXJjaGVzIjsKKworICAgICAgICAvKioKKyAgICAgICAgICogVGhlIE1JTUUgdHlwZSBvZiBhIHtAbGluayAjQ09OVEVOVF9VUkl9IG9mIGEgc2luZ2xlIGJyb3dzZXIgc2VhcmNoIGl0ZW0uCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBDT05URU5UX0lURU1fVFlQRSA9ICJ2bmQuYW5kcm9pZC5jdXJzb3IuaXRlbS9zZWFyY2hlcyI7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSB1bmlxdWUgSUQgZm9yIGEgcm93LgorICAgICAgICAgKiA8UD5UeXBlOiBJTlRFR0VSIChsb25nKTwvUD4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIF9JRCA9ICJfaWQiOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgdXNlciBlbnRlcmVkIH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MgdGFibGUKKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgVXJpIENPTlRFTlRfVVJJID0KKyAgICAgICAgICAgICAgICBVcmkud2l0aEFwcGVuZGVkUGF0aChBVVRIT1JJVFlfVVJJLCBDT05URU5UX0RJUkVDVE9SWSk7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIEBzZWUgYW5kcm9pZC5wcm92aWRlci5TeW5jU3RhdGVDb250cmFjdC5IZWxwZXJzI2dldAorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBieXRlW10gZ2V0KENvbnRlbnRQcm92aWRlckNsaWVudCBwcm92aWRlciwgQWNjb3VudCBhY2NvdW50KQorICAgICAgICAgICAgICAgIHRocm93cyBSZW1vdGVFeGNlcHRpb24geworICAgICAgICAgICAgcmV0dXJuIFN5bmNTdGF0ZUNvbnRyYWN0LkhlbHBlcnMuZ2V0KHByb3ZpZGVyLCBDT05URU5UX1VSSSwgYWNjb3VudCk7CisgICAgICAgIH0KKworICAgICAgICAvKioKKyAgICAgICAgICogQHNlZSBhbmRyb2lkLnByb3ZpZGVyLlN5bmNTdGF0ZUNvbnRyYWN0LkhlbHBlcnMjZ2V0CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIFBhaXI8VXJpLCBieXRlW10+IGdldFdpdGhVcmkoQ29udGVudFByb3ZpZGVyQ2xpZW50IHByb3ZpZGVyLCBBY2NvdW50IGFjY291bnQpCisgICAgICAgICAgICAgICAgdGhyb3dzIFJlbW90ZUV4Y2VwdGlvbiB7CisgICAgICAgICAgICByZXR1cm4gU3luY1N0YXRlQ29udHJhY3QuSGVscGVycy5nZXRXaXRoVXJpKHByb3ZpZGVyLCBDT05URU5UX1VSSSwgYWNjb3VudCk7CisgICAgICAgIH0KKworICAgICAgICAvKioKKyAgICAgICAgICogQHNlZSBhbmRyb2lkLnByb3ZpZGVyLlN5bmNTdGF0ZUNvbnRyYWN0LkhlbHBlcnM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BhZGFwdGVycy4gKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgU1lOQzUgPSAic3luYzUiOworICAgIH0KKworICAgIC8qKgorICAgICAqIENvbHVtbnMgZm9yIFN5bmMgaW5mb3JtYXRpb24gdXNlZCBieSBDYWxlbmRhcnMgYW5kIEV2ZW50cyB0YWJsZXMuCisgICAgICovCisgICAgcHVibGljIGludGVyZmFjZSBTeW5jQ29sdW1ucyBleHRlbmRzIEJhc2VTeW5jQ29sdW1ucyB7CisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgYWNjb3VudCB0aGF0IHdhcyB1c2VkIHRvIHN5bmMgdGhlIGVudHJ5IHRvIHRoZSBkZXZpY2UuCisgICAgICAgICAqIDxQPlR5cGU6IFRFWFQ8L1A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBfU1lOQ19BQ0NPVU5UID0gIl9zeW5jX2FjY291bnQiOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgdHlwZSBvZiB0aGUgYWNjb3VudCB0aGF0IHdhcyB1c2VkIHRvIHN5bmMgdGhlIGVudHJ5IHRvIHRoZSBkZXZpY2UuCisgICAgICAgICAqIDxQPlR5cGU6IFRFWFQ8L1A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBfU1lOQ19BQ0NPVU5UX1RZUEUgPSAiX3N5bmNfYWNjb3VudF90eXBlIjsKKworICAgICAgICAvKioKKyAgICAgICAgICogVGhlIHVuaXF1ZSBJRCBmb3IgYSByb3cgYXNzaWduZWQgYnkgdGhlIHN5bmMgc291cmNlLiBOVUxMIGlmIHRoZSByb3cgaGFzIG5ldmVyIGJlZW4gc3luY2VkLgorICAgICAgICAgKiA8UD5UeXBlOiBURVhUPC9QPgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgX1NZTkNfS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BVEEgPSAiX3N5bmNfbG9jYWxfaWQiOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBVc2VkIG9ubHkgaW4gcGVyc2lzdGVudCBwcm92aWRlcnMsIGFuZCBvbmx5IGR1cmluZyBtZXJnaW5nLgorICAgICAgICAgKiA8UD5UeXBlOiBJTlRFR0VSIChsb25nKTwvUD4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIF9TWU5DX01BUksgPSAiX3N5bmNfbWFyayI7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFVzZWQgdG8gaW5kaWNhdGUgdGhhdCBsb2NhbCwgdW5zeW5jZWQsIGNoYW5nZXMgYXJlIHByZXNlbnQuCisgICAgICAgICAqIDxQPlR5cGU6IElOVEVHRVIgKGxvbmcpPC9QPgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgX1NZTkNfRElSVFkgPSAiX3N5bmNfZGlydHkiOworCisgICAgfQorCisgICAgLyoqCisgICAgICogQ29sdW1ucyBmcm9tIHRoZSBBY2NvdW50IGluZm9ybWF0aW9uIHVzZWQgYnkgQ2FsZW5kYXJzIGFuZCBFdmVudHMgdGFibGVzLgorICAgICAqLworICAgIHB1YmxpYyBpbnRlcmZhY2UgQWNjb3VudENvbHVtbnMgeworICAgICAgICAvKioKKyAgICAgICAgICogVGhlIG5hbWUgb2YgdGhlIGFjY291bnQgaW5zdGFuY2UgdG8gd2hpY2ggdGhpcyByb3cgYmVsb25ncywgd2hpY2ggd2hlbiBwYWlyZWQgd2l0aAorICAgICAgICAgKiB7QGxpbmsgI0FDQ09VTlRfVFlQRX0gaWRlbnRpZmllcyBhIHNwZWNpZmljIGFjY291bnQuCisgICAgICAgICAqIDxQPlR5cGU6IFRFWFQ8L1A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBBQ0NPVU5UX05BTUUgPSAiYW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dWxkIGJlIGlnbm9yZWQuCisgICAgICAgICAqIDxQPlR5cGU6IElOVEVHRVIgKGJvb2xlYW4pPC9QPgogICAgICAgICAgKi8KLSAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgX1NZTkNfQUNDT1VOVCA9ICJfc3luY19hY2NvdW50IjsKLQotICAgICAgICAvKioKLSAgICAgICAgICogVGhlIHR5cGUgb2YgdGhlIGFjY291bnQgdGhhdCB3YXMgdXNlZCB0byBzeW5jIHRoZSBlbnRyeSB0byB0aGUgZGV2aWNlLgotICAgICAgICAgKiA8UD5UeXBlOiBURVhUPC9QPgotICAgICAgICAgKi8KLSAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgX1NZTkNfQUNDT1VOVF9UWVBFID0gIl9zeW5jX2FjY291bnRfdHlwZSI7Ci0KLSAgICAgICAgLyoqCi0gICAgICAgICAqIFRoZSB1bmlxdWUgSUQgZm9yIGEgcm93IGFzc2lnbmVkIGJ5IHRoZSBzeW5jIHNvdXJjZS4gTlVMTCBpZiB0aGUgcm93IGhhcyBuZXZlciBiZWVuIHN5bmNlZC4KLSAgICAgICAgICogPFA+VHlwZTogVEVYVDwvUD4KLSAgICAgICAgICovCi0gICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIF9TWU5DX0lEID0gIl9zeW5jX2lkIjsKLQotICAgICAgICAvKioKLSAgICAgICAgICogVGhlIGxhc3QgdGltZSwgZnJvbSB0aGUgc3luYyBzb3VyY2UncyBwb2ludCBvZiB2aWV3LCB0aGF0IHRoaXMgcm93IGhhcyBiZWVuIHN5bmNocm9uaXplZC4KLSAgICAgICAgICogPFA+VHlwZTogSU5URUdFUiAobG9uZyk8L1A+Ci0gICAgICAgICAqLwotICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBfU1lOQ19USU1FID0gIl9zeW5jX3RpbWUiOwotCi0gICAgICAgIC8qKgotICAgICAgICAgKiBUaGUg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GVyYXRvckltcGwoQ3Vyc29yIGN1cnNvciwgQ29udGVudFJlc29sdmVyIHJlc29sdmVyKSB7CisgICAgICAgICAgICAgICAgc3VwZXIoY3Vyc29yKTsKKyAgICAgICAgICAgICAgICBtUmVzb2x2ZXIgPSByZXNvbHZlcjsKKyAgICAgICAgICAgICAgICBtUHJvdmlkZXIgPSBudWxsOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBwdWJsaWMgRW50aXR5SXRlcmF0b3JJbXBsKEN1cnNvciBjdXJzb3IsIENvbnRlbnRQcm92aWRlckNsaWVudCBwcm92aWRlcikgeworICAgICAgICAgICAgICAgIHN1cGVyKGN1cnNvcik7CisgICAgICAgICAgICAgICAgbVJlc29sdmVyID0gbnVsbDsKKyAgICAgICAgICAgICAgICBtUHJvdmlkZXIgPSBwcm92aWRlcjsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgQE92ZXJyaWRlCisgICAgICAgICAgICBwdWJsaWMgRW50aXR5IGdldEVudGl0eUFuZEluY3JlbWVudEN1cnNvcihDdXJzb3IgY3Vyc29yKSB0aHJvd3MgUmVtb3RlRXhjZXB0aW9uIHsKKyAgICAgICAgICAgICAgICAvLyB3ZSBleHBlY3QgdGhlIGN1cnNvciBpcyBhbHJlYWR5IGF0IHRoZSByb3cgd2UgbmVlZCB0byByZWFkIGZyb20KKyAgICAgICAgICAgICAgICBmaW5hbCBsb25nIGNhbGVuZGFySWQgPSBjdXJzb3IuZ2V0TG9uZyhjdXJzb3IuZ2V0Q29sdW1uSW5kZXhPclRocm93KF9JRCkpOworCisgICAgICAgICAgICAgICAgLy8gQ3JlYXRlIHRoZSBjb250ZW50IHZhbHVlCisgICAgICAgICAgICAgICAgQ29udGVudFZhbHVlcyBjdiA9IG5ldyBDb250ZW50VmFsdWVzKCk7CisgICAgICAgICAgICAgICAgY3YucHV0KF9JRCwgY2FsZW5kYXJJZCk7CisKKyAgICAgICAgICAgICAgICBEYXRhYmFzZVV0aWxzLmN1cnNvclN0c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lByZXNlbnQoY3Vyc29yLCBjdiwgU0VMRUNURUQpOworICAgICAgICAgICAgICAgIERhdGFiYXNlVXRpbHMuY3Vyc29ySW50VG9Db250ZW50VmFsdWVzSWZQcmVzZW50KGN1cnNvciwgY3YsIFNZTkNfRVZFTlRTKTsKKyAgICAgICAgICAgICAgICBEYXRhYmFzZVV0aWxzLmN1cnNvclN0cmluZ1RvQ29udGVudFZhbHVlc0lmUHJlc2VudChjdXJzb3IsIGN2LCBDYWxlbmRhcnMuTE9DQVRJT04pOworICAgICAgICAgICAgICAgIERhdGFiYXNlVXRpbHMuY3Vyc29yU3RyaW5nVG9Db250ZW50VmFsdWVzSWZQcmVzZW50KGN1cnNvciwgY3YsIFRJTUVaT05FKTsKKyAgICAgICAgICAgICAgICBEYXRhYmFzZVV0aWxzLmN1cnNvclN0cmluZ1RvQ29udGVudFZhbHVlc0lmUHJlc2VudChjdXJzb3IsIGN2LAorICAgICAgICAgICAgICAgICAgICAgICAgQ2FsZW5kYXJzLk9XTkVSX0FDQ09VTlQpOworICAgICAgICAgICAgICAgIERhdGFiYXNlVXRpbHMuY3Vyc29ySW50VG9Db250ZW50VmFsdWVzSWZQcmVzZW50KGN1cnNvciwgY3YsCisgICAgICAgICAgICAgICAgICAgICAgICBDYWxlbmRhcnMuT1JHQU5JWkVSX0NBTl9SRVNQT05EKTsKKworICAgICAgICAgICAgICAgIERhdGFiYXNlVXRpbHMuY3Vyc29ySW50VG9Db250ZW50VmFsdWVzSWZQcmVzZW50KGN1cnNvciwgY3YsIERFTEVURUQpOworCisgICAgICAgICAgICAgICAgLy8gQ3JlYXRlIHRoZSBFbnRpdHkgZnJvbSB0aGUgQ29udGVudFZhbHVlCisgICAgICAgICAgICAgICAgRW50aXR5IGVudGl0eSA9IG5ldyBFbnRpdHkoY3YpOworCisgICAgICAgICAgICAgICAgLy8gU2V0IGN1cnNvciB0byBuZXh0IHJvdworICAgICAgICAgICAgICAgIGN1cnNvci5tb3ZlVG9OZXh0KCk7CisKKyAgICAgICAgICAgICAgICAvLyBSZXR1cm4gdGhlIGNyZWF0ZWQgRW50aXR5CisgICAgICAgICAgICAgICAgcmV0dXJuIGVudGl0eTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICB9CisKKyAgICAvKioKICAgICAgKiBDb250YWlucyBhIGxpc3Qgb2YgYXZhaWxhYmxlIGNhbGVuZGFycy4KICAgICAgKi8KLSAgICBwdWJsaWMgc3RhdGljIGNsYXNzIENhbGVuZGFycyBpbXBsZW1lbnRzIEJhc2VDb2x1bW5zLCBDYWxlbmRhcnNDb2x1bW5zCisgICAgcHVibGljIHN0YXRpYyBjbGFzcyBDYWxlbmRhcnMgaW1wbGVtZW50cyBCYXNlQ29sdW1ucywgU3luY0NvbHVtbnMsIEFjY291bnRDb2x1bW5zLAorICAgICAgICAgICAgQ2FsZW5kYXJzQ29sdW1ucwogICAgIHsKICAgICAgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgU3RyaW5nIFdIRVJFX0RFTEVURV9GT1JfQUNDT1VOVCA9IENhbGVuZGFycy5fU1lOQ19BQ0NPVU5UICsgIj0/IgogICAgICAgICAgICAgICAgICsgIiBBTkQgIiArIENhbGVuZGFycy5fU1lOQ19BQ0NPVU5UX1RZUEUgKyAiPT8iOwpAQCAtMjU4LDYgKzM4MSwyNCBAQAogICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBVUkwgPSAidXJsIjsKIAogICAgICAgICAvKioKKyAgICAgICAgICogVGhlIFVSTCBmb3IgdGhlIGNhbGVuZGFyIGl0c2VsZgorICAgICAgICAgKiA8UD5UeXBlOiBURVhUIChVUkwpPC9QPgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgU0VMRl9VUkwgPSAic2VsZlVybCI7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSBVUkwgZm9yIHRoZSBjYWxlbmRhciB0byBiZSBlZGl0ZWQKKyAgICAgICAgICogPFA+VHlwZTogVEVYVCAoVVJMKTwvUD4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIEVESVRfVVJMID0gImVkaXRVcmwiOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgVVJMIGZvciB0aGUgY2FsZW5kYXIgZXZlbnRzCisgICAgICAgICAqIDxQPlR5cGU6IFRFWFQgKFVSTCk8L1A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBFVkVOVFNfVVJMID0gImV2ZW50c1VybCI7CisKKyAgICAgICAgLyoqCiAgICAgICAgICAqIFRoZSBuYW1lIG9mIHRoZSBjYWxlbmRhcgogICAgICAgICAgKiA8UD5UeXBlOiBURVhUPC9QPgogICAgICAgICAgKi8KQEAgLTI3NiwxMiArNDE3LDYgQEAKICAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgTE9DQVRJT04gPSAibG9jYXRpb24iOwogCiAgICAgICAgIC8qKgotICAgICAgICAgKiBTaG91bGQgdGhlIGNhbGVuZGFyIGJlIGhpZGRlbiBpbiB0aGUgY2FsZW5kYXIgc2VsZWN0aW9uIHBhbmVsPwotICAgICAgICAgKiA8UD5UeXBlOiBJTlRFR0VSIChib29sZWFuKTwvUD4KLSAgICAgICAgICovCi0gICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIEhJRERFTiA9ICJoaWRkZW4iOwotCi0gICAgICAgIC8qKgogICAgICAgICAgKiBUaGUgb3duZXIgYWNjb3VudCBmb3IgdGhpcyBjYWxlbmRhciwgYmFzZWQgb24gdGhlIGNhbGVuZGFyIGZlZWQuCiAgICAgICAgICAqIFRoaXMgd2lsbCBiZSBkaWZmZXJlbnQgZnJvbSB0aGUgX1NZTkNfQUNDT1VOVCBmb3IgZGVsZWdhdGVkIGNhbGVuZGFycy4KICAgICAgICAgICogPFA+VHlwZTogU3RyaW5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TFRfU09SVF9PUkRFUiA6IG9yZGVyQnkpOworICAgICAgICB9CisKICAgICAgICAgLyoqCiAgICAgICAgICAqIFRoZSBjb250ZW50Oi8vIHN0eWxlIFVSTCBmb3IgdGhpcyB0YWJsZQogICAgICAgICAgKi8KQEAgLTg4MCw2ICsxMDYxLDEwIEBACiAgICAgICAgICAgICAgICAgIi9pbnN0YW5jZXMvd2hlbiIpOwogICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFVyaSBDT05URU5UX0JZX0RBWV9VUkkgPQogICAgICAgICAgICAgVXJpLnBhcnNlKCJjb250ZW50Oi8vIiArIEFVVEhPUklUWSArICIvaW5zdGFuY2VzL3doZW5ieWRheSIpOworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFVyaSBDT05URU5UX1NFQVJDSF9VUkkgPSBVcmkucGFyc2UoImNvbnRlbnQ6Ly8iICsgQVVUSE9SSVRZICsKKyAgICAgICAgICAgICAgICAiL2luc3RhbmNlcy9zZWFyY2giKTsKKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBVcmkgQ09OVEVOVF9TRUFSQ0hfQllfREFZX1VSSSA9CisgICAgICAgICAgICBVcmkucGFyc2UoImNvbnRlbnQ6Ly8iICsgQVVUSE9SSVRZICsgIi9pbnN0YW5jZXMvc2VhcmNoYnlkYXkiKTsKIAogICAgICAgICAvKioKICAgICAgICAgICogVGhlIGRlZmF1bHQgc29ydCBvcmRlciBmb3IgdGhpcyB0YWJsZS4KQEAgLTg5Niw3ICsxMDgxLDYgQEAKICAgICAgICAgICogcmVxdWlyZWQgZm9yIGNvcnJlY3RuZXNzLCBpdCBqdXN0IGFkZHMgYSBuaWNlIHRvdWNoLgogICAgICAgICAgKi8KICAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgU09SVF9DQUxFTkRBUl9WSUVXID0gImJlZ2luIEFTQywgZW5kIERFU0MsIHRpdGxlIEFTQyI7Ci0KICAgICAgICAgLyoqCiAgIC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aW5nIGRpcmVjdG9yeSByb3dzIGFyZSBhdXRvbWF0aWNhbGx5IHJlbW92ZWQgZnJvbSB0aGUgQ29udGFjdHMgUHJvdmlkZXIuCisgICAgICogPC9wPgorICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgY2xhc3MgRGlyZWN0b3J5IGltcGxlbWVudHMgQmFzZUNvbHVtbnMgeworCisgICAgICAgIC8qKgorICAgICAgICAgKiBOb3QgaW5zdGFudGlhYmxlLgorICAgICAgICAgKi8KKyAgICAgICAgcHJpdmF0ZSBEaXJlY3RvcnkoKSB7CisgICAgICAgIH0KKworICAgICAgICAvKioKKyAgICAgICAgICogVGhlIGNvbnRlbnQ6Ly8gc3R5bGUgVVJJIGZvciB0aGlzIHRhYmxlLiAgUmVxdWVzdHMgdG8gdGhpcyBVUkkgY2FuIGJlCisgICAgICAgICAqIHBlcmZvcm1lZCBvbiB0aGUgVUkgdGhyZWFkIGJlY2F1c2UgdGhleSBhcmUgYWx3YXlzIHVuYmxvY2tpbmcuCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFVyaSBDT05URU5UX1VSSSA9CisgICAgICAgICAgICAgICAgVXJpLndpdGhBcHBlbmRlZFBhdGgoQVVUSE9SSVRZX1VSSSwgImRpcmVjdG9yaWVzIik7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSBNSU1FLXR5cGUgb2Yge0BsaW5rICNDT05URU5UX1VSSX0gcHJvdmlkaW5nIGEgZGlyZWN0b3J5IG9mCisgICAgICAgICAqIGNvbnRhY3QgZGlyZWN0b3JpZXMuCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBDT05URU5UX1RZUEUgPQorICAgICAgICAgICAgICAgICJ2bmQuYW5kcm9pZC5jdXJzb3IuZGlyL2NvbnRhY3RfZGlyZWN0b3JpZXMiOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgTUlNRSB0eX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0aGlzIGNvbHVtbiBlbXB0eSAtIENvbnRhY3RzIFByb3ZpZGVyIHdpbGwgZmlsbCBpdCBpbi4KKyAgICAgICAgICogPC9wPgorICAgICAgICAgKiA8cD4KKyAgICAgICAgICogQ2xpZW50cyBvZiB0aGlzIEFQSSBzaG91bGQgbm90IHNlbmQgcmVxdWVzdHMgZGlyZWN0bHkgdG8gdGhpcyBhdXRob3JpdHkuCisgICAgICAgICAqIEFsbCBkaXJlY3RvcnkgcmVxdWVzdHMgbXVzdCBiZSByb3V0ZWQgdGhyb3VnaCBDb250YWN0cyBQcm92aWRlci4KKyAgICAgICAgICogPC9wPgorICAgICAgICAgKgorICAgICAgICAgKiA8cD5UWVBFOiB0ZXh0PC9wPgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgRElSRUNUT1JZX0FVVEhPUklUWSA9ICJhdXRob3JpdHkiOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgYWNjb3VudCB0eXBlIHdoaWNoIHRoaXMgZGlyZWN0b3J5IGlzIGFzc29jaWF0ZWQuCisgICAgICAgICAqCisgICAgICAgICAqIDxwPlRZUEU6IHRleHQ8L3A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBBQ0NPVU5UX1RZUEUgPSAiYWNjb3VudFR5cGUiOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgYWNjb3VudCB3aXRoIHdoaWNoIHRoaXMgZGlyZWN0b3J5IGlzIGFzc29jaWF0ZWQuIElmIHRoZSBhY2NvdW50IGlzIGxhdGVyCisgICAgICAgICAqIHJlbW92ZWQsIHRoZSBkaXJlY3RvcmllcyBpdCBvd25zIGFyZSBhdXRvbWF0aWNhbGx5IHJlbW92ZWQgZnJvbSB0aGlzIHRhYmxlLgorICAgICAgICAgKgorICAgICAgICAgKiA8cD5UWVBFOiB0ZXh0PC9wPgorICAgICAgICAgKi8KKyAgICAg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W55IHNob3J0Y3V0cyBjcmVhdGVkIGZvciBpdHMgY29udGFjdHMuCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBTSE9SVENVVF9TVVBQT1JUX05PTkUgPSAwOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBBbiB7QGxpbmsgI1NIT1JUQ1VUX1NVUFBPUlR9IHNldHRpbmcgdGhhdCBpbmRpY2F0ZXMgdGhhdCB0aGUgZGlyZWN0b3J5CisgICAgICAgICAqIGFsbG93IGNyZWF0aW9uIG9mIHNob3J0Y3V0cyBmb3IgZGF0YSBpdGVtcyBsaWtlIGVtYWlsLCBwaG9uZSBvciBwb3N0YWwgYWRkcmVzcywKKyAgICAgICAgICogYnV0IG5vdCB0aGUgZW50aXJlIGNvbnRhY3QuCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBTSE9SVENVVF9TVVBQT1JUX0RBVEFfSVRFTVNfT05MWSA9IDE7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIEFuIHtAbGluayAjU0hPUlRDVVRfU1VQUE9SVH0gc2V0dGluZyB0aGF0IGluZGljYXRlcyB0aGF0IHRoZSBkaXJlY3RvcnkKKyAgICAgICAgICogYWxsb3cgY3JlYXRpb24gb2Ygc2hvcnRjdXRzIGZvciBjb250YWN0IGFzIHdlbGwgYXMgdGhlaXIgY29uc3RpdHVlbnQgZWxlbWVudHMuCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBTSE9SVENVVF9TVVBQT1JUX0ZVTEwgPSAyOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBOb3RpZmllcyB0aGUgc3lzdGVtIG9mIGEgY2hhbmdlIGluIHRoZSBsaXN0IG9mIGRpcmVjdG9yaWVzIGhhbmRsZWQgYnkKKyAgICAgICAgICogYSBwYXJ0aWN1bGFyIGRpcmVjdG9yeSBwcm92aWRlci4gVGhlIENvbnRhY3RzIHBy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bnRhY3RzCiAgICAgICogQHNlZSBSYXdDb250YWN0cwotICAgICAqIEBoaWRlCiAgICAgICovCiAgICAgcHJvdGVjdGVkIGludGVyZmFjZSBDb250YWN0TmFtZUNvbHVtbnMgewogCiAgICAgICAgIC8qKgogICAgICAgICAgKiBUaGUga2luZCBvZiBkYXRhIHRoYXQgaXMgdXNlZCBhcyB0aGUgZGlzcGxheSBuYW1lIGZvciB0aGUgY29udGFjdCwgc3VjaCBhcwotICAgICAgICAgKiBzdHJ1Y3R1cmVkIG5hbWUgb3IgZW1haWwgYWRkcmVzcy4gIFNlZSBEaXNwbGF5TmFtZVNvdXJjZXMuCi0gICAgICAgICAqCi0gICAgICAgICAqIFRPRE86IGNvbnZlcnQgRGlzcGxheU5hbWVTb3VyY2VzIHRvIGEgbGluayBhZnRlciBpdCBpcyB1bi1oaWRkZW4KKyAgICAgICAgICogc3RydWN0dXJlZCBuYW1lIG9yIGVtYWlsIGFkZHJlc3MuICBTZWUge0BsaW5rIERpc3BsYXlOYW1lU291cmNlc30uCiAgICAgICAgICAqLwogICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBESVNQTEFZX05BTUVfU09VUkNFID0gImRpc3BsYXlfbmFtZV9zb3VyY2UiOwogCkBAIC01NzUsOSArODcyLDcgQEAKIAogICAgICAgICAvKioKICAgICAgICAgICogVGhlIHBob25ldGljIGFscGhhYmV0IHVzZWQgdG8gcmVwcmVzZW50IHRoZSB7QGxpbmsgI1BIT05FVElDX05BTUV9LiAgU2VlCi0gICAgICAgICAqIFBob25ldGljTmFtZVN0eWxlLgotICAgICAgICAgKgotICAgICAgICAgKiBUT0RPOiBjb252ZXJ0IFBob25ldGljTmFtZVN0eWxlIHRvIGEgbGluayBhZnRlciBpdCBpcyB1bi1oaWRkZW4KKyAgICAgICAgICoge0BsaW5rIFBob25ldGljTmFtZVN0eWxlfS4KICAgICAgICAgICovCiAgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW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SAgICAgICAgICogTWFyayBhIGNvbnRhY3QgYXMgaGF2aW5nIGJlZW4gY29udGFjdGVkLiAgVGhpcyB1cGRhdGVzIHRoZQotICAgICAgICAgKiB7QGxpbmsgI1RJTUVTX0NPTlRBQ1RFRH0gYW5kIHtAbGluayAjTEFTVF9USU1FX0NPTlRBQ1RFRH0gZm9yIHRoZQotICAgICAgICAgKiBjb250YWN0LCBwbHVzIHRoZSBjb3JyZXNwb25kaW5nIHZhbHVlcyBvZiBhbnkgYXNzb2NpYXRlZCByYXcKLSAgICAgICAgICogY29udGFjdHMuCisgICAgICAgICAqIE1hcmsgYSBjb250YWN0IGFzIGhhdmluZyBiZWVuIGNvbnRhY3RlZC4gVXBkYXRlcyB0d28gZmllbGRzOgorICAgICAgICAgKiB7QGxpbmsgI1RJTUVTX0NPTlRBQ1RFRH0gYW5kIHtAbGluayAjTEFTVF9USU1FX0NPTlRBQ1RFRH0uIFRoZQorICAgICAgICAgKiBUSU1FU19DT05UQUNURUQgZmllbGQgaXMgaW5jcmVtZW50ZWQgYnkgMSBhbmQgdGhlIExBU1RfVElNRV9DT05UQUNURUQKKyAgICAgICAgICogZmllbGQgaXMgcG9wdWxhdGVkIHdpdGggdGhlIGN1cnJlbnQgc3lzdGVtIHRpbWUuCiAgICAgICAgICAqCiAgICAgICAgICAqIEBwYXJhbSByZXNvbHZlciB0aGUgQ29udGVudFJlc29sdmVyIHRvIHVzZQogICAgICAgICAgKiBAcGFyYW0gY29udGFjdElkIHRoZSBwZXJzb24gd2hvIHdhcyBjb250YWN0ZWQKQEAgLTEwNDAsNyArMTMzMiw4IEBACiAKICAgICAgICAgLyoqCiAgICAgICAgICAqIEEgc3ViLWRpcmVjdG9yeSBvZiBhIHNpbmdsZSBjb250YWN0IHRoYXQgY29udGFpbnMgYWxsIG9mIHRoZSBjb25zdGl0dWVudCByYXcgY29udGFjdAotICAgICAgICAgKiB7QGxpbmsgQ29udGFjdHNDb250cmFjdC5EYXRhfSByb3dzLgorICAgICAgICAgKiB7QGxpbmsgQ29udGFjdHNDb250cmFjdC5EYXRhfSByb3dzLiAgVGhpcyBkaXJlY3RvcnkgY2FuIGJlIHVzZWQgZWl0aGVyCisgICAgICAgICAqIHdpdGggYSB7QGxpbmsgI0NPTlRFTlRfVVJJfSBvciB7QGxpbmsgI0NPTlRFTlRfTE9PS1VQX1VSSX0uCiAgICAgICAgICAqLwogICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGNsYXNzIERhdGEgaW1wbGVtZW50cyBCYXNlQ29sdW1ucywgRGF0YUNvbHVtbnMgewogICAgICAgICAgICAgLyoqCkBAIC0xMDU2LDYgKzEzNDksNTcgQEAKIAogICAgICAgICAvKioKICAgICAgICAgICogPHA+CisgICAgICAgICAqIEEgc3ViLWRpcmVjdG9yeSBvZiBhIGNvbnRhY3QgdGhhdCBjb250YWlucyBhbGwgb2YgaXRzCisgICAgICAgICAqIHtAbGluayBDb250YWN0c0NvbnRyYWN0LlJhd0NvbnRhY3RzfSBhcyB3ZWxsIGFzCisgICAgICAgICAqIHtAbGluayBDb250YWN0c0NvbnRyYWN0LkRhdGF9IHJvd3MuIFRvIGFjY2VzcyB0aGlzIGRpcmVjdG9yeSBhcHBlbmQKKyAgICAgICAgICoge0BsaW5rICNDT05URU5UX0RJUkVDVE9SWX0gdG8gdGhlIGNvbnRhY3QgVVJJLgorICAgICAgICAgKiA8L3A+CisgICAgICAgICAqIDxwPgorICAgICAgICAgKiBFbnRpdHkgaGFzIHRocmVlIElEIGZpZWxkczoge0BsaW5rICNDT05UQUNUX0lEfSBmb3IgdGhlIGNvbnRhY3QsCisgICAgICAgICAqIHtAbGluayAjUkFXX0NPTlRBQ1RfSUR9IGZvciB0aGUgcmF3IGNvbnRhY3QgYW5kIHtAbGluayAjREFUQV9JRH0gZm9yCisgICAgICAgICAqIHRoZSBkYXRhIHJvd3MuIEVudGl0eSBhbHdheXMgY29udGFpbnMgYXQgbGVhc3Qgb25lIHJvdyBwZXIKKyAgICAgICAg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VtbnMsIENvbnRhY3RPcHRpb25zQ29sdW1ucywgQ29udGFjdFN0YXR1c0NvbHVtbnMgeworICAgICAgICAgICAgLyoqCisgICAgICAgICAgICAgKiBubyBwdWJsaWMgY29uc3RydWN0b3Igc2luY2UgdGhpcyBpcyBhIHV0aWxpdHkgY2xhc3MKKyAgICAgICAgICAgICAqLworICAgICAgICAgICAgcHJpdmF0ZSBFbnRpdHkoKSB7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8qKgorICAgICAgICAgICAgICogVGhlIGRpcmVjdG9yeSB0d2lnIGZvciB0aGlzIHN1Yi10YWJsZQorICAgICAgICAgICAgICovCisgICAgICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBDT05URU5UX0RJUkVDVE9SWSA9ICJlbnRpdGllcyI7CisKKyAgICAgICAgICAgIC8qKgorICAgICAgICAgICAgICogVGhlIElEIG9mIHRoZSByYXcgY29udGFjdCByb3cuCisgICAgICAgICAgICAgKiA8UD5UeXBlOiBJTlRFR0VSPC9QPgorICAgICAgICAgICAgICovCisgICAgICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBSQVdfQ09OVEFDVF9JRCA9ICJyYXdfY29udGFjdF9pZCI7CisKKyAgICAgICAgICAgIC8qKgorICAgICAgICAgICAgICogVGhlIElEIG9mIHRoZSBkYXRhIHJvdy4gVGhlIHZhbHVlIHdpbGwgYmUgbnVsbCBpZiB0aGlzIHJhdyBjb250YWN0IGhhcyBubworICAgICAgICAgICAgICogZGF0YSByb3dzLgorICAgICAgICAgICAgICogPFA+VHlwZTogSU5URUdFUjwvUD4KKyAgICAgICAgICAgICAqLworICAgICAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgREFUQV9JRCA9ICJkYXRhX2lkIjsKKyAgICAgICAgfQorCisgICAgICAgIC8qKgorICAgICAgICAgKiA8cD4KICAgICAgICAgICogQSA8aT5yZWFkLW9ubHk8L2k+IHN1Yi1ka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XNzCiAgICAgICAgICAgICAgKi8KQEAgLTEwOTQsNiArMTQ0MiwxMDYgQEAKICAgICAgICAgICAgICAqIHtAbGluayBhbmRyb2lkLnByb3ZpZGVyLkNvbnRhY3RzQ29udHJhY3QuQ29udGFjdHMjQ09OVEVOVF9GSUxURVJfVVJJfS4KICAgICAgICAgICAgICAqLwogICAgICAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgQ09OVEVOVF9ESVJFQ1RPUlkgPSAic3VnZ2VzdGlvbnMiOworCisgICAgICAgICAgICAvKioKKyAgICAgICAgICAgICAqIFVzZWQgd2l0aCB7QGxpbmsgQnVpbGRlciNhZGRQYXJhbWV0ZXJ9IHRvIHNwZWNpZnkgd2hhdCBraW5kIG9mIGRhdGEgaXMKKyAgICAgICAgICAgICAqIHN1cHBsaWVkIGZvciB0aGUgc3VnZ2VzdGlvbiBxdWVyeS4KKyAgICAgICAgICAgICAqCisgICAgICAgICAgICAgKiBAaGlkZQorICAgICAgICAgICAgICovCisgICAgICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBQQVJBTUVURVJfTUFUQ0hfTkFNRSA9ICJuYW1lIjsKKworICAgICAgICAgICAgLyoqCisgICAgICAgICAgICAgKiBVc2VkIHdpdGgge0BsaW5rIEJ1aWxkZXIjYWRkUGFyYW1ldGVyfSB0byBzcGVjaWZ5IHdoYXQga2luZCBvZiBkYXRhIGlzCisgICAgICAgICAgICAgKiBzdXBwbGllZCBmb3IgdGhlIHN1Z2dlc3Rpb24gcXVlcnkuCisgICAgICAgICAgICAgKgorICAgICAgICAgICAgICogQGhpZGUKKyAgICAgICAgICAgICAqLworICAgICAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgUEFSQU1FVEVSX01BVENIX0VNQUlMID0gImVtYWlsIjsKKworICAgICAgICAgICAgLyoqCisgICAgICAgICAgICAgKiBVc2VkIHdpdGgge0BsaW5rIEJ1aWxkZXIjYWRkUGFyYW1ldGVyfSB0byBzcGVjaWZ5IHdoYXQga2luZCBvZiBkYXRhIGlzCisgICAgICAgICAgICAgKiBzdXBwbGllZCBmb3IgdGhlIHN1Z2dlc3Rpb24gcXVlcnkuCisgICAgICAgICAgICAgKgorICAgICAgICAgICAgICogQGhpZGUKKyAgICAgICAgICAgICAqLworICAgICAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgUEFSQU1FVEVSX01BVENIX1BIT05FID0gInBob25lIjsKKworICAgICAgICAgICAgLyoqCisgICAgICAgICAgICAgKiBVc2VkIHdpdGgge0BsaW5rIEJ1aWxkZXIjYWRkUGFyYW1ldGVyfSB0byBzcGVjaWZ5IHdoYXQga2luZCBvZiBkYXRhIGlzCisgICAgICAgICAgICAgKiBzdXBwbGllZCBmb3IgdGhlIHN1Z2dlc3Rpb24gcXVlcnkuCisgICAgICAgICAgICAgKgorICAgICAgICAgICAgICogQGhpZGUKKyAgICAgICAgICAgICAqLworICAgICAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgUEFSQU1FVEVSX01BVENIX05JQ0tOQU1FID0gIm5pY2tuYW1lIjsKKworICAgICAgICAgICAgLyoqCisgICAgICAgICAgICAgKiBBIGNvbnZlbmllbmNlIGJ1aWxkZXIgZm9yIGFnZ3JlZ2F0aW9uIHN1Z2dlc3Rpb24gY29udGVudCBVUklzLgorICAgICAgICAgICAgICoKKyAgICAgICAgICAgICAqIFRPRE86IGNoYW5nZSBkb2N1bWVudGF0aW9uIGZvciB0aGlzIGNsYXNzIHRvIHVzZSB0aGUgYnVpbGRlci4KKyAgICAgICAgICAgICAqIEBoaWRlCisgICAgICAgICAgICAgKi8KKyAgICAgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgY2xhc3MgQnVpbGRlciB7CisgICAgICAgICAgICAgICAgcHJpdmF0ZSBsb25nIG1Db250YWN0SWQ7CisgICAgICAgICAgICAgICAgcHJpdmF0ZSBBcnJheUxpc3Q8U3RyaW5nPiBtS2luZHMgPSBuZXcgQXJyYXlMaXN0PFN0cmluZz4oKTsKKyAgICAgICAgICAgICAgICBwcml2YXRlIEFycmF5TGlzdDxTdHJpbmc+IG1WYWx1ZXMgPSBuZXcgQXJyYXlMaXN0PFN0cmluZz4oKTsKKyAgICAgICAgICAgICAgICBwcml2YXRlIGludCBtTGltaXQ7CisKKyAgICAgICAgICAgICAgICAvKioKKyAgICAgICAgICAgICAgICAgKiBPcHRpb25hbCBleGlzdGluZyBjb250YWN0IElELiAgSWYgaXQgaXMgbm90IHByb3ZpZGVkLCB0aGUgc2VhcmNoCisgICAgICAgICAgICAgICAgICogd2lsbCBiZSBiYXNlZCBleGNsdXNpdmVseSBvbiB0aGUgdmFsdWVzIHN1cHBsaWVkIHdpdGgge0BsaW5rICNhZGRQYXJhbWV0ZXJ9LgorICAgICAgICAgICAgICAgICAqLworICAgICAgICAgICAgICAgIHB1YmxpYyBCdWlsZGVyIHNldENvbnRhY3RJZChsb25nIGNvbnRhY3RJZCkgeworICAgICAgICAgICAgICAgICAgICB0aGlzLm1Db250YWN0SWQgPSBjb250YWN0SWQ7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIC8qKgorICAgICAgICAgICAgICAgICAqIEEgdmFsdWUgdGhhdCBjYW4gYmUgdXNlZCB3aGVuIHNlYXJjaGluZyBmb3IgYW4gYWdncmVnYXRpb24KKyAgICAgICAgICAgICAgICAgKiBzdWdnZXN0aW9uLgorICAgICAgICAgICAgICAgICAqCisgICAgICAgICAgICAgICAgICogQHBhcmFtIGtpbmQgY2FuIGJlIG9uZSBvZgorICAgICAgICAgICAgICAgICAqICAgICAgICAgICAge0BsaW5rIEFnZ3JlZ2F0aW9uU3VnZ2VzdGlvbnMjUEFSQU1FVEVSX01BVENIX05BTUV9LAorICAgICAgICAgICAgICAgICAqICAgICAgICAgICAge0BsaW5rIEFnZ3JlZ2F0aW9uU3VnZ2VzdGlvbnMjUEFSQU1FVEVSX01BVENIX0VNQUlMfSwKKyAgICAgICAgICAgICAgICAgKiAgICAgICAgICAgIHtAbGluayBBZ2dyZWdhdGlvblN1Z2dlc3Rpb25zI1BBUkFNRVRFUl9NQVRDSF9OSUNLTkFNRX0sCisgICAgICAgICAgICAgICAgICogICAgICAgICAgICB7QGxpbmsgQWdncmVnYXRpb25TdWdnZXN0aW9ucyNQQVJBTUVURVJfTUFUQ0hfUEhPTkV9CisgICAgICAgICAgICAgICAgICovCisgICAgICAgICAgICAgICAgcHVibGljIEJ1aWxkZXIgYWRkUGFyYW1ldGVyKFN0cmluZyBraW5kLCBTdHJpbmcgdmFsdWUpIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKCFUZXh0VXRpbHMuaXNFbXB0eSh2YWx1ZSkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1LaW5kcy5hZGQoa2luZCk7CisgICAgICAgICAgICAgICAgICAgICAgICBtVmFsdWVzLmFkZCh2YWx1ZSk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXM7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgcHVibGljIEJ1aWxkZXIgc2V0TGltaXQoaW50IGxpbWl0KSB7CisgICAgICAgICAgICAgICAgICAgIG1MaW1pdCA9IGxpbWl0OworICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpczsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBwdWJsaWMgVXJpIGJ1aWxkKCkgeworICAgICAgICAgICAgICAgICAgICBhbmRyb2lkLm5ldC5VcmkuQnVpbGRlciBidWlsZGVyID0gQ29udGFjdHMuQ09OVEVOVF9VUkkuYnVpbGRVcG9uKCk7CisgICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kRW5jb2RlZFBhdGgoU3RyaW5nLnZhbHVlT2YobUNvbnRhY3RJZCkpOworICAgICAgICAgICAgICAgICAgICBidWlsZGVyLmFwcGVuZFBhdGgoQ29udGFjdHMuQWdncmVnYXRpb25TdWdnZXN0aW9ucy5DT05URU5UX0RJUkVDVE9SWSk7CisgICAgICAgICAgICAgICAgICAgIGlmIChtTGltaXQgIT0gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmRRdWVyeVBhcmFtZXRlcigibGltaXQiLCBTdHJpbmcudmFsdWVPZihtTGltaXQpKTsKKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIGludCBjb3VudCA9IG1LaW5kcy5zaXplKCk7CisgICAgICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgY291bnQ7IGkrKykgeworICAgICAgICAgICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmRRdWVyeVBhcmFtZXRlcigicXVlcnkiLCBtS2luZHMuZ2V0KGkpICsgIjoiICsgbVZhbHVlcy5nZXQoaSkpOworICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGJ1aWxkZXIuYnVpbGQoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8qKgorICAgICAgICAgICAgICogQGhpZGUKKyAgICAgICAgICAgICAqLworICAgICAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBCdWlsZGVyIGJ1aWxkZXIoKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBCdWlsZGVyKCk7CisgICAgICAgICAgICB9CiAgICAgICAgIH0KIAogICAgICAgICAvKioKQEAgLTExMjksOSArMTU3NywxMiBAQAogICAgICAgICAgKiA8cD5Zb3Ugc2hvdWxkIGFsc28gY29uc2lkZXIgdXNpbmcgdGhlIGNvbnZlbmllbmNlIG1ldGhvZAogICAgICAgICAgKiB7QGxpbmsgQ29udGFjdHNDb250cmFjdC5Db250YWN0cyNvcGVuQ29udGFjdFBob3RvSW5wdXRTdHJlYW0oQ29udGVudFJlc29sdmVyLCBVcmkpfQogICAgICAgICAgKiA8L3A+CisgICAgICAgICAqIDxwPgorICAgICAgICAgKiBUaGlzIGRpcmVjdG9yeSBjYW4gYmUgdXNlZCBlaXRoZXIgd2l0aCBhIHtAbGluayAjQ09OVEVOVF9VUkl9IG9yCisgICAgICAgICAqIHtAbGluayAjQ09OVEVOVF9MT09LVVBfVVJJfS4KKyAgICAgICAgICogPC9wPgogICAgICAgICAgKi8KLSAgICAgICAgLy8gVE9ETzogY2hhbmdlIERhdGFDb2x1bW5zIHRvIERhdGFDb2x1bW5zV2l0aEpvaW5zCi0gICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgY2xhc3MgUGhvdG8gaW1wbGVtZW50cyBCYXNlQ29sdW1ucywgRGF0YUNvbHVtbnMgeworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGNsYXNzIFBob3RvIGltcGxlbWVudHMgQmFzZUNvbHVtbnMsIERhdGFDb2x1bW5zV2l0aEpvaW5zIHsKICAgICAgICAgICAgIC8qKgogICAgICAgICAgICAgICogbm8gcHVibGljIGNvbnN0cnVjdG9yIHNpbmNlIHRoaXMgaXMgYSB1dGlsaXR5IGNsYXNzCiAgICAgICAgICAgICAgKi8KQEAgLTExNDcsNyArMTU5OCw2IEBACiAgICAgICAgICAgICAgKiB0aGF0IGNvdWxkIGJlIGluZmxhdGVkIHVzaW5nIHtAbGluayBhbmRyb2lkLmdyYXBoaWNzLkJpdG1hcEZhY3Rvcnl9LgogICAgICAgICAgICAgICogPHA+CiAgICAgICAgICAgICAgKiBUeXBlOiBCTE9CCi0gICAgICAgICAgICAgKiBAaGlkZSBUT0RPOiBVbmhpZGUgaW4gYSBzZXBhcmF0ZSBDTAogICAgICAgICAgICAgICovCiAgICAgICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBQSE9UTyA9IERBVEExNTsKICAgICAgICAgfQpAQCAtMTE1Niw3ICsxNjA2LDEwIEBACiAgICAgICAgICAqIE9wZW5zIGFuIElucHV0U3RyZWFtIGZvciB0aGUgY29udGFjdHMncyBkZWZhdWx0IHBob3RvIGFuZCByZXR1cm5zIHRoZQogICAgICAgICAgKiBwaG90byBhcyBhIGJ5dGUgc3RyZWFtLiBJZiB0aGVyZSBpcyBub3QgcGhvdG8gbnVsbCB3aWxsIGJlIHJldHVybmVkLgogICAgICAgICAgKgotICAgICAgICAgKiBAcGFyYW0gY29udGFjdFVyaSB0aGUgY29udGFjdCB3aG9zZSBwaG90byBzaG91bGQgYmUgdXNlZAorICAgICAgICAgKiBAcGFyYW0gY29udGFjdFVyaSB0aGUgY29udGFjdCB3aG9zZSBwaG90byBzaG91bGQgYmUgdXNlZC4gVGhpcyBjYW4gYmUgdXNlZCB3aXRoCisgICAgICAgICAqIGVpdGhlciBhIHtAbGluayAjQ09OVEVOVF9VUkl9IG9yIGEge0BsaW5rICNDT05URU5UX0xPT0tVUF9VUkl9IFVSSS4KKyAgICAgICAgICogPC9wPgorCiAgICAgICAgICAqIEByZXR1cm4gYW4gSW5wdXRTdHJlYW0gb2YgdGhlIHBob3RvLCBvciBudWxsIGlmIG5vIHBob3RvIGlzIHByZXNlbnQKICAgICAgICAgICovCiAgICAgICAgIHB1YmxpYyBzdGF0aWMgSW5wdXRTdHJlYW0gb3BlbkNvbnRhY3RQaG90b0lucHV0U3RyZWFtKENvbnRlbnRSZXNvbHZlciBjciwgVXJpIGNvbnRhY3RVcmkpIHsKQEAgLTEyNDQsNiArMTY5NywxMyBAQAogICAgICAgICAgKiBAaGlkZQogICAgICAgICAgKi8KICAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgTkFNRV9WRVJJRklFRCA9ICJuYW1lX3ZlcmlmaWVkIjsKKworICAgICAgICAvKioKKyAgICAgICAgICogVGhlICJyZWFkLW9ubHkiIGZsYWc6ICIwIiBieSBkZWZhdWx0LCAiMSIgaWYgdGhlIHJvdyBjYW5ub3QgYmUgbW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hbmQtYWxvbmUgdGFibGUgY29udGFpbmluZyB0aGUgc2FtZQogICAgICAgICAgKiBkYXRhLgogICAgICAgICAgKiA8L3A+CkBAIC0xNzMzLDEwICsyMTkxLDEwIEBACiAgICAgICAgICAqIG51bGwuCiAgICAgICAgICAqIDwvcD4KICAgICAgICAgICogPHA+Ci0gICAgICAgICAqIEVudGl0eSByZWFkcyBhbGwKLSAgICAgICAgICogZGF0YSBmb3IgYSByYXcgY29udGFjdCBpbiBvbmUgdHJhbnNhY3Rpb24sIHRvIGd1YXJhbnRlZQotICAgICAgICAgKiBjb25zaXN0ZW5jeS4KLSAgICAgICAgICogPC9wPgorICAgICAgICAgKiBVc2luZyBFbnRpdHkgc2hvdWxkIGJlIHByZWZlcnJlZCB0byB1c2luZyB0d28gc2VwYXJhdGUgcXVlcmllczoKKyAgICAgICAgICogUmF3Q29udGFjdHMgZm9sbG93ZWQgYnkgRGF0YS4gVGhlIHJlYXNvbiBpcyB0aGF0IEVudGl0eSByZWFkcyBhbGwKKyAgICAgICAgICogZGF0YSBmb3IgYSByYXcgY29udGFjdCBpbiBvbmUgdHJhbnNhY3Rpb24sIHNvIHRoZXJlIGlzIG5vIHBvc3NpYmlsaXR5CisgICAgICAgICAqIG9mIHRoZSBkYXRhIGNoYW5naW5nIGJldHdlZW4gdGhlIHR3byBxdWVyaWVzLgogICAgICAgICAgKi8KICAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBjbGFzcyBFbnRpdHkgaW1wbGVtZW50cyBCYXNlQ29sdW1ucywgRGF0YUNvbHVtbnMgewogICAgICAgICAgICAgLyoqCkBAIC0xNzUxLDcgKzIyMDksNyBAQAogICAgICAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgQ09OVEVOVF9ESVJFQ1RPUlkgPSAiZW50aXR5IjsKIAogICAgICAgICAgICAgLyoqCi0gICAgICAgICAgICAgKiBUaGUgSUQgb2YgdGhlIGRhdGEgY29sdW1uLiBUaGUgdmFsdWUgd2lsbCBiZSBudWxsIGlmIHRoaXMgcmF3IGNvbnRhY3QgaGFzIG5vCisgICAgICAgICAgICAgKiBUaGUgSUQgb2YgdGhlIGRhdGEgcm93LiBUaGUgdmFsdWUgd2lsbCBiZSBudWxsIGlmIHRoaXMgcmF3IGNvbnRhY3QgaGFzIG5vCiAgICAgICAgICAgICAgKiBkYXRhIHJvd3MuCiAgICAgICAgICAgICAgKiA8UD5UeXBlOiBJTlRFR0VSPC9QPgogICAgICAgICAgICAgICovCkBAIC0xODM5LDI4ICsyMjk3LDIxIEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRGF0YS5EQVRBX1ZFUlNJT04pOwogICAgICAgICAgICAgICAgICAgICBmb3IgKFN0cmluZyBrZXkgOiBEQVRBX0tFWVMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgIGZpbmFsIGludCBjb2x1bW5JbmRleCA9IGN1cnNvci5nZXRDb2x1bW5JbmRleE9yVGhyb3coa2V5KTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjdXJzb3IuaXNOdWxsKGNvbHVtbkluZGV4KSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGRvbid0IHB1dCBhbnl0aGluZwotICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChjdXJzb3IuZ2V0VHlwZShjb2x1bW5JbmRleCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEN1cnNvci5GSUVMRF9UWVBFX05VTEw6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGRvbid0IHB1dCBhbnl0aGluZworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEN1cnNvci5GSUVMRF9UWVBFX0lOVEVHRVI6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBDdXJzb3IuRklFTERfVFlQRV9GTE9BVDoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEN1cnNvci5GSUVMRF9UWVBFX1NUUklORzoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3YucHV0KGtleSwgY3Vyc29yLmdldFN0cmluZyhjb2x1bW5JbmRleCkpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKFNRTGl0ZUV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgQ3Vyc29yLkZJRUxEX1RZUEVfQkxPQjoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3YucHV0KGtleSwgY3Vyc29yLmdldEJsb2IoY29sdW1uSW5kZXgpKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oIkludmFsaWQgb3IgdW5oYW5kbGVkIGRhdGEgdHlwZSIpOwogICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgLy8gVE9ETzogZ28gYmFjayB0byB0aGlzIHZlcnNpb24gb2YgdGhlIGNvZGUgd2hlbiBidWcKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIGh0dHA6Ly9iL2lzc3VlP2lkPTIzMDYzNzAgaXMgZml4ZWQuCi0vLyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjdXJzb3IuaXNOdWxsKGNvbHVtbkluZGV4KSkgewotLy8gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gZG9uJ3QgcHV0IGFueXRoaW5nCi0vLyAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoY3Vyc29yLmlzTG9uZyhjb2x1bW5JbmRleCkpIHsKLS8vICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlcy5wdXQoa2V5LCBjdXJzb3IuZ2V0TG9uZyhjb2x1bW5JbmRleCkpOwotLy8gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGN1cnNvci5pc0Zsb2F0KGNvbHVtbkluZGV4KSkgewotLy8gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWVzLnB1dChrZXksIGN1cnNvci5nZXRGbG9hdChjb2x1bW5JbmRleCkpOwotLy8gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGN1cnNvci5pc1N0cmluZyhjb2x1bW5JbmRleCkpIHsKLS8vICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlcy5wdXQoa2V5LCBjdXJzb3IuZ2V0U3RyaW5nKGNvbHVtbkluZGV4KSk7Ci0vLyAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoY3Vyc29yLmlzQmxvYihjb2x1bW5JbmRleCkpIHsKLS8vICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlcy5wdXQoa2V5LCBjdXJzb3IuZ2V0QmxvYihjb2x1bW5JbmRleCkpOwotLy8gICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgY29udGFjdC5hZGRTdWJWYWx1ZShDb250YWN0c0NvbnRyYWN0LkRhdGEuQ09OVEVOVF9VUkksIGN2KTsKICAgICAgICAgICAgICAgICB9IHdoaWxlIChjdXJzb3IubW92ZVRvTmV4dCgpKTsKQEAgLTE5NjUsMTggKzI0MTYsMTkgQEAKICAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgQ0hBVF9DQVBBQklMSVRZID0gImNoYXR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WNlIGNhbiBvbmx5IGRvIHRleHQgbWVzc2FnaW5nLgogICAgICAqIDxwPgogICAgICAqIDx1bD4KLSAgICAgKiA8bGk+e0BsaW5rICNDQVBBQklMSVRZX0hBU19WSURFT19QTEFZQkFDS19PTkxZfTwvbGk+CisgICAgICogPGxpPntAbGluayAjQ0FQQUJJTElUWV9IQVNfVklERU99PC9saT4KICAgICAgKiA8bGk+e0BsaW5rICNDQVBBQklMSVRZX0hBU19WT0lDRX08L2xpPgogICAgICAqIDxsaT57QGxpbmsgI0NBUEFCSUxJVFlfSEFTX0NBTUVSQX08L2xpPgogICAgICAqIDwvdWw+CkBAIC0zNzA4LDYgKzQxNzYsMTQgQEAKICAgICAgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIE5VTUJFUiA9IERBVEE7CiAKICAgICAgICAgICAgIC8qKgorICAgICAgICAgICAgICogVGhlIHBob25lIG51bWJlcidzIEUxNjQgcmVwcmVzZW50YXRpb24uCisgICAgICAgICAgICAgKiA8UD5UeXBlOiBURVhUPC9QPgorICAgICAgICAgICAgICoKKyAgICAgICAgICAgICAqIEBoaWRlCisgICAgICAgICAgICAgKi8KKyAgICAgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIE5PUk1BTElaRURfTlVNQkVSID0gREFUQTQ7CisKKyAgICAgICAgICAgIC8qKgogICAgICAgICAgICAgICogQGRlcHJlY2F0ZWQgdXNlIHtAbGluayAjZ2V0VHlwZUxhYmVsKFJlc291cmNlcywgaW50LCBDaGFyU2VxdWVuY2UpfSBpbnN0ZWFkLgogICAgICAgICAgICAgICogQGhpZGUKICAgICAgICAgICAgICAqLwpAQCAtMzc4OSw3ICs0MjY1LDcgQEAKICAgICAgICAgICogPC90cj4KICAgICAgICAgICogPHRyPgogICAgICAgICAgKiA8dGQ+U3RyaW5nPC90ZD4KLSAgICAgICAgICogPHRkPntAbGluayAjREFUQX08L3RkPgorICAgICAgICAgKiA8dGQ+e0BsaW5rICNBRERSRVNTfTwvdGQ+CiAgICAgICAgICAqIDx0ZD57QGxpbmsgI0RBVEExfTwvdGQ+CiAgICAgICAgICAqIDx0ZD5FbWFpbCBhZGRyZXNzIGl0c2VsZi48L3RkPgogICAgICAgICAgKiA8L3RyPgpAQCAtMzg4MCw3ICs0MzU2LDYgQEAKICAgICAgICAgICAgIC8qKgogICAgICAgICAgICAgICogVGhlIGVtYWlsIGFkZHJlc3MuCiAgICAgICAgICAgICAgKiA8UD5UeXBlOiBURVhUPC9QPgotICAgICAgICAgICAgICogQGhpZGUgVE9ETzogVW5oaWRlIGluIGEgc2VwYXJhdGUgQ0wKICAgICAgICAgICAgICAqLwogICAgICAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgQUREUkVTUyA9IERBVEExOwogCkBAIC00OTk4LDYgKzU0NzMsMjMgQEAKICAgICAgICAgICogVHlwZTogSU5URUdFUiAoYm9vbGVhbikKICAgICAgICAgICovCiAgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIFNIT1VMRF9TWU5DID0gInNob3VsZF9zeW5jIjsKKworICAgICAgICAvKioKKyAgICAgICAgICogQW55IG5ld2x5IGNyZWF0ZWQgY29udGFjdHMgd2lsbCBhdXRvbWF0aWNhbGx5IGJlIGFkZGVkIHRvIGdyb3VwcyB0aGF0IGhhdmUgdGhpcworICAgICAgICAgKiBmbGFnIHNldCB0byB0cnVlLgorICAgICAgICAgKiA8cD4KKyAgICAgICAgICogVHlwZTogSU5URUdFUiAoYm9vbGVhbikKKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIEFVVE9fQUREID0gImF1dG9fYWRkIjsKKworICAgICAgICAvKioKKyAgICAgICAgICogV2hlbiBhIGNvbnRhY3RzIGlzIG1hcmtlZCBhcyBhIGZhdm9yaXRlcyBpdCB3aWxsIGJlIGF1dG9tYXRpY2FsbHkgYWRkZWQKKyAgICAgICAgICogdG8gdGhlIGdyb3VwcyB0aGF0IGhhdmUgdGhpcyBmbGFnIHNldCwgYW5kIHdoZW4gaXQgaXMgcmVtb3ZlZCBmcm9tIGZhdm9yaXRlcworICAgICAgICAgKiBpdCB3aWxsIGJlIHJlbW92ZWQgZnJvbSB0aGVzZSBncm91cHMuCisgICAgICAgICAqIDxwPgorICAgICAgICAgKiBUeXBlOiBJTlRFR0VSIChib29sZWFuKQorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgRkFWT1JJVEVTID0gImZhdm9yaXRlcyI7CiAgICAgfQogCiAgICAgLyoqCkBAIC01MTM4LDYgKzU2MzAsOCBAQAogICAgICAgICAgICAgICAgIERhdGFiYXNlVXRpbHMuY3Vyc29yTG9uZ1RvQ29udGVudFZhbHVlc0lmUHJlc2VudChjdXJzb3IsIHZhbHVlcywgREVMRVRFRCk7CiAgICAgICAgICAgICAgICAgRGF0YWJhc2VVdGlscy5jdXJzb3JTdHJpbmdUb0NvbnRlbnRWYWx1ZXNJZlByZXNlbnQoY3Vyc29yLCB2YWx1ZXMsIE5PVEVTKTsKICAgICAgICAgICAgICAgICBEYXRhYmFzZVV0aWxzLmN1cnNvclN0cmluZ1RvQ29udGVudFZhbHVlc0lmUHJlc2VudChjdXJzb3IsIHZhbHVlcywgU0hPVUxEX1NZTkMpOworICAgICAgICAgICAgICAgIERhdGFiYXNlVXRpbHMuY3Vyc29yU3RyaW5nVG9Db250ZW50VmFsdWVzSWZQcmVzZW50KGN1cnNvciwgdmFsdWVzLCBGQVZPUklURVMpOworICAgICAgICAgICAgICAgIERhdGFiYXNlVXRpbHMuY3Vyc29yU3RyaW5nVG9Db250ZW50VmFsdWVzSWZQcmVzZW50KGN1cnNvciwgdmFsdWVzLCBBVVRPX0FERCk7CiAgICAgICAgICAgICAgICAgY3Vyc29yLm1vdmVUb05leHQoKTsKICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IEVudGl0eSh2YWx1ZXMpOwogICAgICAgICAgICAgfQpAQCAtNTY1NCw2ICs2MTQ4LDI4IEBACiAgICAgICAgICAgICAgICAgImNvbS5hbmRyb2lkLmNvbnRhY3RzLmFjdGlvbi5TSE9XX09SX0NSRUFURV9DT05UQUNUIjsKIAogICAgICAgICAvKioKKyAgICAgICAgICogU3RhcnRzIGFuIEFjdGl2aXR5IHRoYXQgbGV0cyB0aGUgdXNlciBzZWxlY3QgdGhlIG11bHRpcGxlIHBob25lcyBmcm9tIGEKKyAgICAgICAgICogbGlzdCBvZiBwaG9uZSBudW1iZXJzIHdoaWNoIGNvbWUgZnJvbSB0aGUgY29udGFjdHMgb3IKKyAgICAgICAgICoge0BsaW5rICNFWFRSQV9QSE9ORV9VUklTfS4KKyAgICAgICAgICogPHA+CisgICAgICAgICAqIFRoZSBwaG9uZSBudW1iZXJzIGJlaW5nIHBhc3NlZCBpbiB0aHJvdWdoIHtAbGluayAjRVhUUkFfUEhPTkVfVVJJU30KKyAgICAgICAgICogY291bGQgYmVsb25nIHRvIHRoZSBjb250YWN0cyBvciBub3QsIGFuZCB3aWxsIGJlIHNlbGVjdGVkIGJ5IGRlZmF1bHQuCisgICAgICAgICAqIDxwPgorICAgICAgICAgKiBUaGUgdXNlcidzIHNlbGVjdGlvbiB3aWxsIGJlIHJldHVybmVkIGZyb20KKyAgICAgICAgICoge0BsaW5rIGFuZHJvaWQuYXBwLkFjdGl2aXR5I29uQWN0aXZpdHlSZXN1bHQoaW50LCBpbnQsIGFuZHJvaWQuY29udGVudC5JbnRlbnQpfQorICAgICAgICAgKiBpZiB0aGUgcmVzdWx0Q29kZSBpcworICAgICAgICAgKiB7QGxpbmsgYW5kcm9pZC5hcHAuQWN0aXZpdHkjUkVTVUxUX09LfSwgdGhlIGFycmF5IG9mIHBpY2tlZCBwaG9uZQorICAgICAgICAgKiBudW1iZXJzIGFyZSBpbiB0aGUgSW50ZW50J3MKKyAgICAgICAgICoge0BsaW5rICNFWFRSQV9QSE9ORV9VUklTfTsgb3RoZ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QvcHJvdmlkZXIvRHJtU3RvcmUuamF2YQppbmRleCBjNDM4YWM0Li4zNGYyZjBkIDEwMDY0NAotLS0gYS9jb3JlL2phdmEvYW5kcm9pZC9wcm92aWRlci9Ecm1TdG9yZS5qYXZhCisrKyBiL2NvcmUvamF2YS9hbmRyb2lkL3Byb3ZpZGVyL0RybVN0b3JlLmphdmEKQEAgLTEzMSw3ICsxMzEsNyBAQAogICAgICAqIFV0aWxpdHkgZnVuY3Rpb24gZm9yIGluc2VydGluZyBhIGZpbGUgc3RyZWFtIGludG8gdGhlIERSTSBjb250ZW50IHByb3ZpZGVyLgogICAgICAqCiAgICAgICogQHBhcmFtIGNyIFRoZSBjb250ZW50IHJlc29sdmVyIHRvIHVzZQotICAgICAqIEBwYXJhbSBmaWxlU3RyZWFtIFRoZSBGaWxlSW5wdXRTdHJlYW0gdG8gaW5zZXJ0CisgICAgICogQHBhcmFtIGZpcyBUaGUgRmlsZUlucHV0U3RyZWFtIHRvIGluc2VydAogICAgICAqIEBwYXJhbSB0aXRsZSBUaGUgdGl0bGUgZm9yIHRoZSBjb250ZW50IChvciBudWxsKQogICAgICAqIEByZXR1cm4gdXJpIHRvIHRoZSBEUk0gcmVjb3JkIG9yIG51bGwKICAgICAgKi8KQEAgLTE0MywxMSArMTQzLDExIEBACiAgICAgICAgICAgICBEcm1SYXdDb250ZW50IGNvbnRlbnQgPSBuZXcgRHJtUmF3Q29udGVudChmaXMsIChpbnQpIGZpcy5hdmFpbGFibGUoKSwKICAgICAgICAgICAgICAgICAgICAgRHJtUmF3Q29udGVudC5EUk1fTUlNRVRZUEVfTUVTU0FHRV9TVFJJTkcpOwogICAgICAgICAgICAgU3RyaW5nIG1pbWVUeXBlID0gY29udGVudC5nZXRDb250ZW50VHlwZSgpOworICAgICAgICAgICAgbG9uZyBzaXplID0gZmlzLmdldENoYW5uZWwoKS5zaXplKCk7CiAKICAgICAgICAgICAgIERybVJpZ2h0c01hbmFnZXIgbWFuYWdlciA9IG1hbmFn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HN0YXRpYyBmaW5hbCBTdHJpbmcgTVRQX09CSkVDVF9JRCA9ICJvYmplY3RfaWQiOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgTVRQIG9iamVjdCBoYW5kbGUgb2YgYSBuZXdseSB0cmFuc2ZlcmVkIGZpbGUuCisgICAgICAgICAqIFVzZWQgdG8gcGFzcyB0aGUgbmV3IGZpbGUncyBvYmplY3QgaGFuZGxlIHRocm91Z2ggdGhlIG1lZGlhIHNjYW5uZXIKKyAgICAgICAgICogZnJvbSBNVFAgdG8gdGhlIG1lZGlhIHByb3ZpZGVyCisgICAgICAgICAqIEZvciBpbnRlcm5hbCB1c2Ugb25seSBieSBNVFAsIG1lZGlhIHNjYW5uZXIgYW5kIG1lZGlhIHByb3ZpZGVyLgorICAgICAgICAgKiA8UD5UeXBlOiBJTlRFR0VSPC9QPgorICAgICAgICAgKiBAaGlkZQorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgTUVESUFfU0NBTk5FUl9ORVdfT0JKRUNUX0lEID0gIm1lZGlhX3NjYW5uZXJfbmV3X29iamVjdF9pZCI7CiAgICAgIH0KIAogICAgIC8qKgorICAgICAqIE1lZGlhIHByb3ZpZGVyIGludGVyZmFjZSB1c2VkIGJ5IE1UUCBpbXBsZW1lbnRhdGlvbi4KKyAgICAgKiBAaGlkZQorICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgY2xhc3MgTXRwT2JqZWN0cyB7CisKKyAgICAgICAgcHVibGljIHN0YXRpYyBVcmkgZ2V0Q29udGVudFVyaShTdHJpbmcgdm9sdW1lTmFtZSkgeworICAgICAgICAgICAgcmV0dXJuIFVyaS5wYXJzZShDT05URU5UX0FVVEhPUklUWV9TTEFTSCArIHZvbHVtZU5hbWUgKworICAgICAgICAgICAgICAgICAgICAiL29iamVjdCIpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBVcmkgZ2V0Q29udGVudFVyaShTdHJpbmcgdm9sdW1lTmFtZSwKKyAgICAgICAgICAgICAgICBsb25nIG9iamVjdElkKSB7CisgICAgICAgICAgICByZXR1cm4gVXJpLnBhcnNlKENPTlRFTlRfQVVUSE9SSVRZX1NMQVNIICsgdm9sdW1lTmFtZQorICAgICAgICAgICAgICAgICAgICArICIvb2JqZWN0LyIgKyBvYmplY3RJZCk7CisgICAgICAgIH0KKworICAgICAgICAvLyB1c2VkIGZvciBNVFAgR2V0T2JqZWN0UmVmZXJlbmNlcyBhbmQgU2V0T2JqZWN0UmVmZXJlbmNlcworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFVyaSBnZXRSZWZlcmVuY2VzVXJpKFN0cmluZyB2b2x1bWVOYW1lLAorICAgICAgICAgICAgICAgIGxvbmcgb2JqZWN0SWQpIHsKKyAgICAgICAgICAgIHJldHVybiBVcmkucGFyc2UoQ09OVEVOVF9BVVRIT1JJVFlfU0xBU0ggKyB2b2x1bWVOYW1lCisgICAgICAgICAgICAgICAgICAgICsgIi9vYmplY3QvIiArIG9iamVjdElkICsgIi9yZWZlcmVuY2VzIik7CisgICAgICAgIH0KKworICAgICAgICAvKioKKyAgICAgICAgICogRmllbGRzIGZvciBtYXN0ZXIgdGFibGUgZm9yIGFsbCBtZWRpYSBmaWxlcy4KKyAgICAgICAgICogVGFibGUgYWxzbyBjb250YWlucyBNZWRpYUNvbHVtbnMuX0lELCBEQVRBLCBTSVpFIGFuZCBEQVRFX01PRElGSUVELgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIGludGVyZmFjZSBPYmplY3RDb2x1bW5zIGV4dGVuZHMgTWVkaWFDb2x1bW5zIHsKKyAgICAgICAgICAgIC8qKgorICAgICAgICAgICAgICogVGhlIE1UUCBmb3JtYXQgY29kZSBvZiB0aGUgZmlsZQorICAgICAgICAgICAgICogPFA+VHlwZTogSU5URUdFUjwvUD4KKyAgICAgICAgICAgICAqLworICAgICAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgRk9STUFUID0gImZvcm1hdCI7CisKKyAgICAgICAgICAgIC8qKgorICAgICAgICAgICAgICogVGhlIGluZGV4IG9mIHRoZSBwYXJlbnQgZGlyZWN0b3J5IG9mIHRoZSBmaWxlCisgICAgICAgICAgICAgKiA8UD5UeXBlOiBJTlRFR0VSPC9QPgorICAgICAgICAgICAgICovCisgICAgICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBQQVJFTlQgPSAicGFyZW50IjsKKworICAgICAgICAgICAgLyoqCisgICAgICAgICAgICAgKiBJZGVudGlmaWVyIGZvciB0aGUgbWVkaWEgdGFibGUgY29udGFpbmluZyB0aGUgb2JqZWN0LgorICAgICAgICAgICAgICogVXNlZCBpbnRlcm5hbGx5IGJ5IE1lZGlhUHJvdmlkZXIKKyAgICAgICAgICAgICAqIDxQPlR5cGU6IElOVEVHRVI8L1A+CisgICAgICAgICAgICAgKi8KKyAgICAgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIE1FRElBX1RBQkxFID0gIm1lZGlhX3RhYmxlIjsKKworICAgICAgICAgICAgLyoqCisgICAgICAgICAgICAgKiBUaGUgSUQgb2YgdGhlIG9iamVjdCBpbiBpdHMgbWVkaWEgdGFibGUuCisgICAgICAgICAgICAgKiA8UD5UeXBlOiBJTlRFR0VSPC9QPgorICAgICAgICAgICAgICovCisgICAgICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBNRURJQV9JRCA9ICJtZWRpYV9pZCI7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKICAgICAgKiBUaGlzIGNsYXNzIGlzIHVzZWQgaW50ZXJuYWxseSBieSBJbWFnZXMuVGh1bWJuYWlscyBhbmQgVmlkZW8uVGh1bWJuYWlscywgaXQncyBub3QgaW50ZW5kZWQKICAgICAgKiB0byBiZSBhY2Nlc3NlZCBlbHNld2hlcmUuCiAgICAgICovCkBAIC0zMTksMjYgKzM5MiwyNyBAQAogICAgICAgICAgICAgLy8gTG9nLnYoVEFHLCAiZ2V0VGh1bWJuYWlsOiBvcmlnSWQ9IitvcmlnSWQrIiwga2luZD0iK2tpbmQrIiwgaXNWaWRlbz0iK2lzVmlkZW8pOwogICAgICAgICAgICAgLy8gSWYgdGhlIG1hZ2ljIGlzIG5vbi16ZXJvLCB3ZSBzaW1wbHkgcmV0dXJuIHRodW1ibmFpbCBpZiBpdCBkb2VzIGV4aXN0LgogICAgICAgICAgICAgLy8gcXVlcnlpbmcgTWVkaWFQcm92aWRlciBhbmQgc2ltcGx5IHJldHVybiB0aHVtYm5haWwuCi0gICAgICAgICAgICBNaW5pVGh1bWJGaWxlIHRodW1iRmlsZSA9IE1pbmlUaHVtYkZpbGUuaW5zdGFuY2UoYmFzZVVyaSk7Ci0gICAgICAgICAgICBsb25nIG1hZ2ljID0gdGh1bWJGaWxlLmdldE1hZ2ljKG9yaWdJZCk7Ci0gICAgICAgICAgICBpZiAobWFnaWMgIT0gMCkgewotICAgICAgICAgICAgICAgIGlmIChraW5kID09IE1JQ1JPX0tJTkQpIHsKLSAgICAgICAgICAgICAgICAgICAgc3luY2hyb25pemVkIChzVGh1bWJCdWZMb2NrKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoc1RodW1iQnVmID09IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBzVGh1bWJCdWYgPSBuZXcgYnl0ZVtNaW5pVGh1bWJGaWxlLkJZVEVTX1BFUl9NSU5USFVNQl07Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAodGh1bWJGaWxlLmdldE1pbmlUaHVtYkZyb21GaWxlKG9yaWdJZCwgc1RodW1iQnVmKSAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgYml0bWFwID0gQml0bWFwRmFjdG9yeS5kZWNvZGVCeXRlQXJyYXkoc1RodW1iQnVmLCAwLCBzVGh1bWJCdWYubGVuZ3RoKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYml0bWFwID09IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTG9nLncoVEFHLCAiY291bGRuJ3QgZGVjb2RlIGJ5dGUgYXJyYXkuIik7CisgICAgICAgICAgICBNaW5pVGh1bWJGaWxlIHRodW1iRmlsZSA9IG5ldyBNaW5pVGh1bWJGaWxlKGlzVmlkZW8gPyBWaWRlby5NZWRpYS5FWFRFUk5BTF9DT05URU5UX1VSSQorICAgICAgICAgICAgICAgICAgICA6IEltYWdlcy5NZWRpYS5FWFRFUk5BTF9DT05URU5UX1VSSSk7CisgICAgICAgICAgICBDdXJzb3IgYyA9IG51bGw7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIGxvbmcgbWFnaWMgPSB0aHVtYkZpbGUuZ2V0TWFnaWMob3JpZ0lkKTsKKyAgICAgICAgICAgICAgICBpZiAobWFnaWMgIT0gMCkgeworICAgICAgICAgICAgICAgICAgICBpZiAoa2luZCA9PSBNSUNST19LSU5EKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBzeW5jaHJvbml6ZWQgKHNUaHVtYkJ1ZkxvY2spIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoc1RodW1iQnVmID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc1RodW1iQnVmID0gbmV3IGJ5dGVbTWluaVRodW1iRmlsZS5CWVRFU19QRVJfTUlOVEhVTUJdOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGh1bWJGaWxlLmdldE1pbmlUaHVtYkZyb21GaWxlKG9yaWdJZCwgc1RodW1iQnVmKSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpdG1hcCA9IEJpdG1hcEZhY3RvcnkuZGVjb2RlQnl0ZUFycmF5KHNUaHVtYkJ1ZiwgMCwgc1RodW1iQnVmLmxlbmd0aCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChiaXRtYXAgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTG9nLncoVEFHLCAiY291bGRuJ3QgZGVjb2RlIGJ5dGUgYXJyYXkuIik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGJpdG1hcDsKLSAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGtpbmQgPT0gTUlOSV9LSU5EKSB7Ci0gICAgICAgICAgICAgICAgICAgIFN0cmluZyBjb2x1bW4gPSBpc1ZpZGVvID8gInZpZGVvX2lkPSIgOiAiaW1hZ2VfaWQ9IjsKLSAgICAgICAgICAgICAgICAgICAgQ3Vyc29yIGMgPSBudWxsOwotICAgICAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGJpdG1hcDsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChraW5kID09IE1JTklfS0lORCkgeworICAgICAgICAgICAgICAgICAgICAgICAgU3RyaW5nIGNvbHVtbiA9IGlzVmlkZW8gPyAidmlkZW9faWQ9IiA6ICJpbWFnZV9pZD0iOwogICAgICAgICAgICAgICAgICAgICAgICAgYyA9IGNyLnF1ZXJ5KGJhc2VVcmksIFBST0pFQ1RJT04sIGNvbHVtbiArIG9yaWdJZCwgbnVsbCwgbnVsbCk7CiAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYyAhPSBudWxsICYmIGMubW92ZVRvRmlyc3QoKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpdG1hcCA9IGdldE1pbmlUaHVtYkZyb21GaWxlKGMsIGJhc2VVcmksIGNyLCBvcHRpb25zKTsKQEAgLTM0NiwxNyArNDIwLDEzIEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBiaXRtYXA7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGMgIT0gbnVsbCkgYy5jbG9zZSgpOwogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQogCi0gICAgICAgICAgICBDdXJzb3IgYyA9IG51bGw7Ci0gICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgIFVyaSBibG9ja2luZ1VyaSA9IGJhc2VVcmkuYnVpbGRVcG9uKCkuYXBwZW5kUXVlcnlQYXJhbWV0ZXIoImJsb2NraW5nIiwgIjEiKQogICAgICAgICAgICAgICAgICAgICAgICAgLmFwcGVuZFF1ZXJ5UGFyYW1ldGVyKCJvcmlnX2lkIiwgU3RyaW5nLnZhbHVlT2Yob3JpZ0lkKSkKICAgICAgICAgICAgICAgICAgICAgICAgIC5hcHBlbmRRdWVyeVBhcmFtZXRlcigiZ3JvdXBfaWQiLCBTdHJpbmcudmFsdWVPZihncm91cElkKSkuYnVpbGQoKTsKKyAgICAgICAgICAgICAgICBpZiAoYyAhPSBudWxsKSBjLmNsb3NlKCk7CiAgICAgICAgICAgICAgICAgYyA9IGNyLnF1ZXJ5KGJsb2NraW5nVXJpLCBQUk9KRUNUSU9OLCBudWxsLCBudWxsLCBudWxsKTsKICAgICAgICAgICAgICAgICAvLyBUaGlzIGhhcHBlbnMgd2hlbiBvcmlnaW5hbCBpbWFnZS92aWRlbyBkb2Vzbid0IGV4aXN0LgogICAgICAgICAgICAgICAgIGlmIChjID09IG51bGwpIHJldHVybiBudWxsOwpAQCAtNDA3LDY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29udGVudDovLyIgKyBBVVRIT1JJVFkgKyAiL2RldmljZS8iOworCisKKyAgIC8qKgorICAgICAqIEJyb2FkY2FzdCBBY3Rpb246ICBBIGJyb2FkY2FzdCB0byBpbmRpY2F0ZSB0aGUgZW5kIG9mIGFuIE1UUCBzZXNzaW9uIHdpdGggdGhlIGhvc3QuCisgICAgICogVGhpcyBicm9hZGNhc3QgaXMgb25seSBzZW50IGlmIE1UUCBhY3Rpdml0eSBoYXMgbW9kaWZpZWQgdGhlIG1lZGlhIGRhdGFiYXNlIGR1cmluZyB0aGUKKyAgICAgKiBtb3N0IHJlY2VudCBNVFAgc2Vzc2lvbgorICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIEFDVElPTl9NVFBfU0VTU0lPTl9FTkQgPSAiYW5kcm9pZC5wcm92aWRlci5hY3Rpb24uTVRQX1NFU1NJT05fRU5EIjsKKworICAgIC8qKgorICAgICAqIENvbnRhaW5zIGxpc3Qgb2YgYWxsIE1UUC9QVFAgZGV2aWNlcworICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgY2xhc3MgRGV2aWNlIGltcGxlbWVudHMgQmFzZUNvbHVtbnMgeworCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgVXJpIENPTlRFTlRfVVJJID0gVXJpLnBhcnNlKENPTlRFTlRfQVVUSE9SSVRZX1NMQVNIICsgImRldmljZSIpOworCisgICAgICAgIHB1YmxpYyBzdGF0aWMgVXJpIGdldENvbnRlbnRVcmkoaW50IGRldmljZUlEKSB7CisgICAgICAgICAgICByZXR1cm4gVXJpLnBhcnNlKENPTlRFTlRfQVVUSE9SSVRZX0RFVklDRV9TTEFTSCArIGRldmljZUlEKTsKKyAgICAgICAgfQorCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgbWFudWZhY3R1cmVyIG9mIHRoZSBkZXZpY2UKKyAgICAgICAgICogPFA+VHlwZTogVEVYVDwvUD4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIE1BTlVGQUNUVVJFUiA9ICJtYW51ZmFjdHVyZXIiOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgbW9kZWwgbmFtZSBvZiB0aGUgZGV2aWNlCisgICAgICAgICAqIDxQPlR5cGU6IFRFWFQ8L1A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBNT0RFTCA9ICJtb2RlbCI7CisgICAgfQorCisgICAgLyoqCisgICAgICogQ29udGFpbnMgbGlzdCBvZiBzdG9yYWdlIHVuaXRzIGZvciBhbiBNVFAvUFRQIGRldmljZQorICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgY2xhc3MgU3RvcmFnZSBpbXBsZW1lbnRzIEJhc2VDb2x1bW5zIHsKKworICAgICAgICBwdWJsaWMgc3RhdGljIFVyaSBnZXRDb250ZW50VXJpKGludCBkZXZpY2VJRCkgeworICAgICAgICAgICAgcmV0dXJuIFVyaS5wYXJzZShDT05URU5UX0FVVEhPUklUWV9ERVZJQ0VfU0xBU0ggKyBkZXZpY2VJRCArICIvc3RvcmFnZSIpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHN0YXRpYyBVcmkgZ2V0Q29udGVudFVyaShpbnQgZGV2aWNlSUQsIGludCBzdG9yYWdlSUQpIHsKKyAgICAgICAgICAgIHJldHVybiBVcmkucGFyc2UoQ09OVEVOVF9BVVRIT1JJVFlfREVWSUNFX1NMQVNIICsgZGV2aWNlSUQgKyAiL3N0b3JhZ2UvIiArIHN0b3JhZ2VJRCk7CisgICAgICAgIH0KKworICAgICAgICAvKioKKyAgICAgICAgICogU3RvcmFnZSB1bml0IGlkZW50aWZpZXIKKyAgICAgICAgICogPFA+VHlwZTogVEVYVDwvUD4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIElERU5USUZJRVIgPSAiaWRlbnRpZmllciI7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFN0b3JhZ2UgdW5pdCBkZXNjcmlwdGlvbgorICAgICAgICAgKiA8UD5UeXBlOiBURVhUPC9QPgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgREVTQ1JJUFRJT04gPSAiZGVzY3JpcHRpb24iOworICAgIH0KKworICAgIC8qKgorICAgICAqIENvbnRhaW5zIGxpc3Qgb2Ygb2JqZWN0cyBvbiBhbiBNVFAvUFRQIGRldmljZQorICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgY2xhc3MgT2JqZWN0IGltcGxlbWVudHMgQmFzZUNvbHVtbnMgeworCisgICAgICAgIHB1YmxpYyBzdGF0aWMgVXJpIGdldENvbnRlbnRVcmkoaW50IGRldmljZUlELCBpbnQgb2JqZWN0SUQpIHsKKyAgICAgICAgICAgIHJldHVybiBVcmkucGFyc2UoQ09OVEVOVF9BVVRIT1JJVFlfREVWSUNFX1NMQVNIICsgZGV2aWNlSUQKKyAgICAgICAgICAgICAgICAgICAgKyAiL29iamVjdC8iICsgb2JqZWN0SUQpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHN0YXRpYyBVcmkgZ2V0Q29udGVudFVyaUZvck9iamVjdENoaWxkcmVuKGludCBkZXZpY2VJRCwgaW50IG9iamVjdElEKSB7CisgICAgICAgICAgICByZXR1cm4gVXJpLnBhcnNlKENPTlRFTlRfQVVUSE9SSVRZX0RFVklDRV9TTEFTSCArIGRldmljZUlECisgICAgICAgICAgICAgICAgICAgICsgIi9vYmplY3QvIiArIG9iamVjdElEICsgIi9jaGlsZCIpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHN0YXRpYyBVcmkgZ2V0Q29udGVudFVyaUZvclN0b3JhZ2VDaGlsZHJlbihpbnQgZGV2aWNlSUQsIGludCBzdG9yYWdlSUQpIHsKKyAgICAgICAgICAgIHJldHVybiBVcmkucGFy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MgYmVsb3cuCisgICAgICAgICAqIDxQPlR5cGU6IElOVEVHRVI8L1A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBQUk9URUNUSU9OX1NUQVRVUyA9ICJwcm90ZWN0aW9uX3N0YXR1cyI7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSBzaXplIG9mIHRoZSBvYmplY3QgaW4gYnl0ZXMuCisgICAgICAgICAqIDxQPlR5cGU6IElOVEVHRVI8L1A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBTSVpFID0gInNpemUiOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgb2JqZWN0J3MgdGh1bWJuYWlsIGZvcm1hdC4gIENhbiBiZSBvbmUgb2YgdGhlIEZPUk1BVF8qIHN5bWJvbHMgYmVsb3csCisgICAgICAgICAqIG9yIGFueSBvZiB0aGUgdmFsaWQgTVRQIG9iamVjdCBmb3JtYXRzIGFzIGRlZmluZWQgaW4gdGhlIE1UUCBzcGVjaWZpY2F0aW9uLgorICAgICAgICAgKiA8UD5UeXBlOiBJTlRFR0VSPC9QPgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgVEhVTUJfRk9STUFUID0gImZvcm1hdCI7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSBzaXplIG9mIHRoZSBvYmplY3QncyB0aHVtYm5haWwgaW4gYnl0ZXMuCisgICAgICAgICAqIDxQPlR5cGU6IElOVEVHRVI8L1A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBUSFVNQl9TSVpFID0gInRodW1iX3NpemUiOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgd2lkdGggb2YgdGhlIG9iamVjdCdzIHRodW1ibmFpbCBpbiBwaXhlbHMuCisgICAgICAgICAqIDxQPlR5cGU6IElOVEVHRVI8L1A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBUSFVNQl9XSURUSCA9ICJ0aHVtYl93aWR0aCI7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSBoZWlnaHQgb2YgdGhlIG9iamVjdCdzIHRodW1ibmFpbCBpbiBwaXhlbHMuCisgICAgICAgICAqIDxQPlR5cGU6IElOVEVHRVI8L1A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBUSFVNQl9IRUlHSFQgPSAidGh1bWJfaGVpZ2h0IjsKKworICAgICAgICAvKioKKyAgICAgICAgICogVGhlIG9iamVjdCdzIHRodW1ibmFpbC4KKyAgICAgICAgICogPFA+VHlwZTogQkxPQjwvUD4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIFRIVU1CID0gInRodW1iIjsKKworICAgICAgICAvKioKKyAgICAgICAgICogVGhlIHdpZHRoIG9mIHRoZSBvYmplY3QgaW4gcGl4ZWxzLgorICAgICAgICAgKiA8UD5UeXBlOiBJTlRFR0VSPC9QPgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgSU1BR0VfV0lEVEggPSAiaW1hZ2Vfd2lkdGgiOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgaGVpZ2h0IG9mIHRoZSBvYmplY3QgaW4gcGl4ZWxzLgorICAgICAgICAgKiA8UD5UeXBlOiBJTlRFR0VSPC9QPgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgSU1BR0VfSEVJR0hUID0gImltYWdlX2hlaWdodCI7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSBkZXB0aCBvZiB0aGUgb2JqZWN0IGluIGJpdHMgcGVyIHBpeGVsLgorICAgICAgICAgKiA8UD5UeXBlOiBJTlRFR0VSPC9QPgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgSU1BR0VfREVQVEggPSAiaW1hZ2VfZGVwdGgiOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBUaGUgSUQgb2YgdGhlIG9iamVjdCdzIHBhcmVudCwgb3IgemVybyBpZiB0aGUgb2JqZWN0CisgICAgICAgICAqIGlzIGluIHRoZSByb290IG9mIGl0cyBzdG9yYWdlIHVuaXQuCisgICAgICAgICAqIDxQPlR5cGU6IElOVEVHRVI8L1A+CisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBQQVJFTlQgPSAicGFyZW50IjsKKworICAgICAgICAvKioKKyAgICAgICAgICogVGhlIGFzc29jaWF0aW9uIHR5cGUgZm9yIGEgY29udGFpbmVyIG9iamVjdC4KKyAgICAgICAgICogRm9yIGZvbGRlcnMgdGhpcyBpcyB0eXBpY2FsbHkge0BsaW5rICNBU1NPQ0lBVElPTl9UWVBFX0dFTkVSSUNfRk9MREVSfQorICAgICAgICAgKiA8UD5UeXBlOiBJTlRFR0VSPC9QPgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgQVNTT0NJQVRJT05fVFlQRSA9ICJhc3NvY2lhdGlvbl90eXBlIjsKKworICAgICAgICAvKioKKyAgICAgICAgICogQ29udGFpbnMgYWRkaXRpb25hbCBpbmZvcm1hdGlvbiBhYm91dCBjb250YWluZXIgb2JqZWN0cy4KKyAgICAgICAgICogPFA+VHlwZTogSU5URUdFUjwvUD4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIEFTU09DSUFUSU9OX0RFU0MgPSAiYXNzb2NpYXRpb25fZGVzYyI7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSBzZXF1ZW5jZSBudW1iZXIgb2YgdGhlIG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V9TVEFUVVMsIDApICE9IDA7CiAgICAgICAgIH0KQEAgLTEyMTYsNyArMTIwOCw3IEBACiAgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIExPQ0tfUEFUVEVSTl9WSVNJQkxFID0gImxvY2tfcGF0dGVybl92aXNpYmxlX3BhdHRlcm4iOwogCiAgICAgICAgIC8qKgotICAgICAgICAgKiBAZGVwcmVjYXRlZCBVc2UgCisgICAgICAgICAqIEBkZXByZWNhdGVkIFVzZQogICAgICAgICAgKiB7QGxpbmsgYW5kcm9pZC5wcm92aWRlci5TZXR0aW5ncy5TZWN1cmUjTE9DS19QQVRURVJOX1RBQ1RJTEVfRkVFREJBQ0tfRU5BQkxFRH0KICAgICAgICAgICogaW5zdGVhZAogICAgICAgICAgKi8KQEAgLTE2OTQsNiArMTY4NiwxMiBAQAogICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBVTkxPQ0tfU09VTkQgPSAidW5sb2NrX3NvdW5kIjsKIAogICAgICAgICAvKioKKyAgICAgICAgICogVHJ1ZSBpZiB3ZSBzaG91bGQgYXBwZWFyIGFzIGEgUFRQIGRldmljZSBpbnN0ZWFkIG9mIE1UUC4KKyAgICAgICAgICogQGhpZGUKKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIFVTRV9QVFBfSU5URVJGQUNFID0gInVzZV9wdHBfaW50ZXJmYWNlIjsKKworICAgICAgICAvKioKICAgICAgICAgICogUmVjZWl2ZSBpbmNvbWluZyBTSVAgY2FsbHM/CiAgICAgICAgICAqIDAgPSBubwogICAgICAgICAgKiAxID0geWVzCkBAIC0xNzg5LDYgKzE3ODcsNyBAQAogICAgICAgICAgICAgTE9DS1NDUkVFTl9TT1VORFNfRU5BQkxFRCwKICAgICAgICAgICAgIFNIT1dfV0VCX1NVR0dFU1RJT05TLAogICAgICAgICAgICAgTk9USUZJQ0FUSU9OX0xJR0hUX1BVTFNFLA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ciBnbG9iYWwgcHJveHkuCiAgICAgICAgICAqLwogICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBIVFRQX1BST1hZID0gImh0dHBfcHJveHkiOwogCiAgICAgICAgIC8qKgorICAgICAgICAgKiBFeGNsdXNpb24gbGlzdCBmb3IgZ2xvYmFsIHByb3h5LiBUaGlzIHN0cmluZyBjb250YWlucyBhIGxpc3Qgb2YgY29tbWEtc2VwYXJhdGVkCisgICAgICAgICAqIGRvbWFpbnMgd2hlcmUgdGhlIGdsb2JhbCBwcm94eSBkb2VzIG5vdCBhcHBseS4gRG9tYWlucyBzaG91bGQgYmUgbGlzdGVkIGluIGEgY29tbWEtCisgICAgICAgICAqIHNlcGFyYXRlZCBsaXN0LiBFeGFtcGxlIG9mIGFjY2VwdGFibGUgZm9ybWF0czogIi5kb21haW4xLmNvbSxteS5kb21haW4yLmNvbSIKKyAgICAgICAgICogQGhpZGUKKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgU3RyaW5nIEhUVFBfUFJPWFlfRVhDTFVTSU9OX0xJU1QgPSAiaHR0cF9wcm94eV9leGNsdXNpb25fbGlzdCI7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIEVuYWJsZXMgdGhlIFVJIHNldHRpbmcgdG8gYWxsb3cgdGhlIHVzZXIgdG8gc3BlY2lmeSB0aGUgZ2xvYmFsIEhUVFAgcHJveHkKKyAgICAgICAgICogYW5kIGFzc29jaWF0ZWQgZXhjbHVzaW9uIGxpc3QuCisgICAgICAgICAqIEBoaWRlCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBTRVRfR0xPQkFMX0hUVFBfUFJPWFkgPSAic2V0X2dsb2JhbF9odHRwX3Byb3h5IjsKKworICAgICAgICAvKioKKyAgICAgICAgICogU2V0dGluZyBmb3IgZGVmYXVsdCBETlMgaW4gY2FzZSBub2JvZHkgc3VnZ2VzdHMgb25lCisgICAgICAgICAqIEBoaWRlCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBERUZBVUxUX0ROU19TRVJWRVIgPSAiZGVmYXVsdF9kbnNfc2VydmVyIjsKKworICAgICAgICAvKioKICAgICAgICAgICogV2hldGhlciB0aGUgcGFja2FnZSBpbnN0YWxsZXIgc2hvdWxkIGFsbG93IGluc3RhbGxhdGlvbiBvZiBhcHBzIGRvd25sb2FkZWQgZnJvbQogICAgICAgICAgKiBzb3VyY2VzIG90aGVyIHRoYW4gdGhlIEFuZHJvaWQgTWFya2V0ICh2ZW5kaW5nIG1hY2hpbmUpLgogICAgICAgICAgKgpAQCAtMjM5Myw2ICsyNDIxLDE0IEBACiAgICAgICAgICAgICAibG9ja19wYXR0ZXJuX3RhY3RpbGVfZmVlZGJhY2tfZW5hYmxlZCI7CiAKICAgICAgICAgLyoqCisgICAgICAgICAqIFRoaXMgcHJlZmVyZW5jZSBhbGxvd3MgdGhlIGRldmljZSB0byBiZSBsb2NrZWQgZ2l2ZW4gdGltZSBhZnRlciBzY3JlZW4gZ29lcyBvZmYsCisgICAgICAgICAqIHN1YmplY3QgdG8gY3VycmVudCBEZXZpY2VBZG1pbiBwb2xpY3kgbGltaXRzLgorICAgICAgICAgKiBAaGlkZQorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBTdHJpbmcgTE9DS19TQ1JFRU5fTE9DS19BRlRFUl9USU1FT1VUID0gImxvY2tfc2NyZWVuX2xvY2tfYWZ0ZXJfdGltZW91dCI7CisKKworICAgICAgICAvKioKICAgICAgICAgICogV2hldGhlciBhc3Npc3RlZCBHUFMgc2hvdWxkIGJlIGVuYWJsZWQgb3Igbm90LgogICAgICAgICAgKiBAaGlkZQogICAgICAgICAgKi8KQEAgLTI0NTMsNiArMjQ4OSwxNCBAQAogICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFN0cmluZyBQQVJFTlRBTF9DT05U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biwgc1Nob3J0Y3V0U2VsZWN0aW9uLAotICAgICAgICAgICAgICAgICAgICAgICAgbmV3IFN0cmluZ1tdIHsgU3RyaW5nLnZhbHVlT2YoKGludCkgc2hvcnRjdXQpIH0sIG51bGwpOwotICAgICAgICAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChjLm1vdmVUb0ZpcnN0KCkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlIChjLmdldENvdW50KCkgPiAwKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFjLmRlbGV0ZVJvdygpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExvZy53KFRBRywgIkNvdWxkIG5vdCBkZWxldGUgZXhpc3Rpbmcgc2hvcnRjdXQgcm93Iik7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKGMgIT0gbnVsbCkgYy5jbG9zZSgpOwotICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBjci5kZWxldGUoQ09OVEVOVF9VUkksIHNTaG9ydGN1dFNlbGVjdGlvbiwKKyAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBTdHJpbmdbXSB7IFN0cmluZy52YWx1ZU9mKChpbnQpIHNob3J0Y3V0KSB9KTsKICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgQ29udGVudFZhbHVlcyB2YWx1ZXMgPSBuZXcgQ29udGVudFZhbHVlcygpOwpkaWZmIC0tZ2l0IGEvY29yZS9qYXZhL2FuZHJvaWQvc2VydmVyL0JsdWV0b290aEV2ZW50TG9vcC5qYXZhIGIvY29yZS9qYXZhL2FuZHJvaWQvc2VydmVyL0JsdWV0b290aEV2ZW50TG9vcC5qYXZhCmluZGV4IDM1Y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mdldEFkZHJlc3NGcm9tT2JqZWN0UGF0aChkZXZpY2VPYmplY3RQYXRoKTsKKyAgICAgICAgaWYgKGFkZHJlc3MgPT0gbnVsbCkgeworICAgICAgICAgICAgTG9nLmUoVEFHLCAib25QYW5EZXZpY2VQcm9wZXJ0eUNoYW5nZWQ6IEFkZHJlc3Mgb2YgdGhlIHJlbW90ZSBkZXZpY2UgaW4gbnVsbCIpOworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisgICAgICAgIGlmIChEQkcpIHsKKyAgICAgICAgICAgIGxvZygiUGFuIERldmljZSBwcm9wZXJ0eSBjaGFuZ2VkOiAiICsgYWRkcmVzcyArICIgIHByb3BlcnR5OiAiCisgICAgICAgICAgICAgICAgICAgICsgbmFtZSArICIgdmFsdWU6ICIrIHByb3BWYWx1ZXNbMV0pOworICAgICAgICB9CisgICAgICAgIEJsdWV0b290aERldmljZSBkZXZpY2UgPSBtQWRhcHRlci5nZXRSZW1vdGVEZXZpY2UoYWRkcmVzcyk7CisgICAgICAgIGlmIChuYW1lLmVxdWFscygiQ29ubmVjdGVkIikpIHsKKyAgICAgICAgICAgIGludCBzdGF0ZSA9IHByb3BWYWx1ZXNbMV0uZXF1YWxzKCJ0cnVlIikgPyBCbHVldG9vdGhJbnB1dERldmljZS5TVEFURV9DT05ORUNURUQgOgorICAgICAgICAgICAgICAgIEJsdWV0b290aElucHV0RGV2aWNlLlNUQVRFX0RJU0NPTk5FQ1RFRDsKKyAgICAgICAgICAgIG1CbHVldG9vdGhTZXJ2aWNlLmhhbmRsZVBhbkRldmljZVN0YXRlQ2hhbmdlKGRldmljZSwgc3RhdGUpOworICAgICAgICB9CisgICAgfQorCiAgICAgcHJpdmF0ZSBTdHJpbmcgY2hlY2tQYWlyaW5nUmVxdWVzdEFuZEdldEFkZHJlc3MoU3RyaW5nIG9iamVjdFBhdGgsIGludCBuYXRpdmVEYXRhKSB7CiAgICAgICAgIFN0cmluZyBhZGRyZXNzID0gbUJsdWV0b290aF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ICAgICAgICAgICAgICAgTG9nLmkoVEFHLCAiUmVqZWN0aW5nIGluY29taW5nIEEyRFAgLyBBVlJDUCBjb25uZWN0aW9uIGZyb20gIiArIGFkZHJlc3MpOwogICAgICAgICAgICAgfQorICAgICAgICB9IGVsc2UgaWYgKEJsdWV0b290aFV1aWQuaXNJbnB1dERldmljZSh1dWlkKSAmJiAhaXNPdGhlcklucHV0RGV2aWNlQ29ubmVjdGVkKGFkZHJlc3MpKSB7CisgICAgICAgICAgICBCbHVldG9vdGhJbnB1dERldmljZSBpbnB1dERldmljZSA9IG5ldyBCbHVldG9vdGhJbnB1dERldmljZShtQ29udGV4dCk7CisgICAgICAgICAgICBhdXRob3JpemVkID0gaW5wdXREZXZpY2UuZ2V0SW5wdXREZXZpY2VQcmlvcml0eShkZXZpY2UpID4KKyAgICAgICAgICAgICAgICAgICAgICAgICBCbHVldG9vdGhJbnB1dERldmljZS5QUklPUklUWV9PRkY7CisgICAgICAgICAgICAgaWYgKGF1dGhvcml6ZWQpIHsKKyAgICAgICAgICAgICAgICAgTG9nLmkoVEFHLCAiQWxsb3dpbmcgaW5jb21pbmcgSElEIGNvbm5lY3Rpb24gZnJvbSAiICsgYWRkcmVzcyk7CisgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgTG9nLmkoVEFHLCAiUmVqZWN0aW5nIGluY29taW5nIEhJRCBjb25uZWN0aW9uIGZyb20gIiArIGFkZHJlc3MpOworICAgICAgICAgICAgIH0KKyAgICAgICAgfSBlbHNlIGlmIChCbHVldG9vdGhVdWlkLmlzQm5lcCh1dWlkKSB8fCBCbHVldG9vdGhVdWlkLmlzTmFwKHV1aWQpICYmCisgICAgICAgICAgICAgICAgbUJsdWV0b290aFNlcnZpY2UuaXNUZXRoZXJpbmdPbigpKXsKKyAgICAgICAgICAgIGF1dGhvcml6ZWQgPSB0cnVlOwogICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgTG9nLmkoVEFHLCAiUmVqZWN0aW5nIGluY29taW5nICIgKyBkZXZpY2VVdWlkICsgIiBjb25uZWN0aW9uIGZyb20gIiArIGFkZHJlc3MpOwogICAgICAgICB9CkBAIC02MDQsNyArNjU0LDE5IEBACiAgICAgICAgIHJldHVybiBhdXRob3JpemVkOwogICAgIH0KIAotICAgIGJvb2xlYW4gaXNPdGhlclNpbmtJbk5vbkRpc2Nvbm5lY3RpbmdTdGF0ZShTdHJpbmcgYWRkcmVzcykgeworICAgIHByaXZhdGUgYm9vbGVhbiBpc090aGVySW5wdXREZXZpY2VDb25uZWN0ZWQoU3RyaW5nIGFkZHJlc3MpIHsKKyAgICAgICAgU2V0PEJsdWV0b290aERldmljZT4gZGV2aWNlcyA9CisgICAgICAgICAgICBtQmx1ZXRvb3RoU2VydmljZS5sb29rdXBJbnB1dERldmljZXNNYXRjaGluZ1N0YXRlcyhuZXcgaW50W10geworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQmx1ZXRvb3RoSW5wdXREZXZpY2UuU1RBVEVfQ09OTkVDVElORywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEJsdWV0b290aElucHV0RGV2aWNlLlNUQVRFX0NPTk5FQ1RFRH0pOworCisgICAgICAgIGZvciAoQmx1ZXRvb3RoRGV2aWNlIGRldmljZSA6IGRldmljZXMpIHsKKyAgICAgICAgICAgIGlmICghZGV2aWNlLmdldEFkZHJlc3MoKS5lcXVhbHMoYWRkcmVzcykpIHJldHVybiB0cnVlOworICAgICAgICB9CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKKyAgICBwcml2YXRlIGJvb2xlYW4gaXNPdGhlclNpbmtJbk5vbkRpc2Nvbm5lY3RpbmdTdGF0ZShTdHJpbmcgYWRkcmVzcykgewogICAgICAgICBCbHVldG9vdGhBMmRwIGEyZHAgPSBuZXcgQmx1ZXRvb3RoQTJkcChtQ29udGV4dCk7CiAgICAgICAgIFNldDxCbHVldG9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ICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIExvZy5lKFRBRywgIkVycm9yIG9uSW5wdXREZXZpY2VDb25uZWN0aW9uUmVzdWx0LiBTdGF0ZSBpczoiICsgc3RhdGUpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbUJsdWV0b290aFNlcnZpY2UuaGFuZGxlSW5wdXREZXZpY2VQcm9wZXJ0eUNoYW5nZShhZGRyZXNzLCBjb25uZWN0ZWQpOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIG9uUGFuRGV2aWNlQ29ubmVjdGlvblJlc3VsdChTdHJpbmcgcGF0aCwgYm9vbGVhbiByZXN1bHQpIHsKKyAgICAgICAgbG9nICgib25QYW5EZXZpY2VDb25uZWN0aW9uUmVzdWx0ICIgKyBwYXRoICsgIiAiICsgcmVzdWx0KTsKKyAgICAgICAgLy8gU3VjY2VzcyBjYXNlIGdldHMgaGFuZGxlZCBieSBQcm9wZXJ0eSBDaGFuZ2Ugc2lnbmFsCisgICAgICAgIGlmICghcmVzdWx0KSB7CisgICAgICAgICAgICBTdHJpbmcgYWRkcmVzcyA9IG1CbHVldG9vdGhTZXJ2aWNlLmdldEFkZHJlc3NGcm9tT2JqZWN0UGF0aChwYXRoKTsKKyAgICAgICAgICAgIGlmIChhZGRyZXNzID09IG51bGwpIHJldHVybjsKKworICAgICAgICAgICAgYm9vbGVhbiBjb25uZWN0ZWQgPSBmYWxzZTsKKyAgICAgICAgICAgIEJsdWV0b290aERldmljZSBkZXZpY2UgPSBtQWRhcHRlci5nZXRSZW1vdGVEZXZpY2UoYWRkcmVzcyk7CisgICAgICAgICAgICBpbnQgc3RhdGUgPSBtQmx1ZXRvb3RoU2VydmljZS5nZXRQYW5EZXZpY2VTdGF0ZShkZXZpY2UpOworICAgICAgICAgICAgaWYgKHN0YXRlID09IEJsdWV0b290aFBhbi5TVEFURV9DT05ORUNUSU5HKSB7CisgICAgICAgICAgICAgICAgY29ubmVjdGVkID0gZmFsc2U7CisgICAgICAgICAgICB9IGVsc2UgaWYgKHN0YXRlID09IEJsdWV0b290aFBhbi5TVEFURV9ESVNDT05ORUNUSU5HKSB7CisgICAgICAgICAgICAgICAgY29ubmVjdGVkID0gdHJ1ZTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgTG9nLmUoVEFHLCAiRXJyb3Igb25QYW5EZXZpY2VDb25uZWN0aW9uUmVzdWx0LiBTdGF0ZSBpczogIgorICAgICAgICAgICAgICAgICAgICAgICAgKyBzdGF0ZSArICIgcmVzdWx0OiAiKyByZXN1bHQpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaW50IG5ld1N0YXRlID0gY29ubmVjdGVkPyBCbHVldG9vdGhQYW4uU1RBVEVfQ09OTkVDVEVEIDoKKyAgICAgICAgICAgICAgICBCbHVldG9vdGhQYW4uU1RBVEVfRElTQ09OTkVDVEVEOworICAgICAgICAgICAgbUJsdWV0b290aFNlcnZpY2UuaGFuZGxlUGFuRGV2aWNlU3RhdGVDaGFuZ2UoZGV2aWNlLCBuZXdTdGF0ZSk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgb25OZXR3b3JrRGV2aWNlRGlzY29ubmVjdGVkKFN0cmluZyBhZGRyZXNzKSB7CisgICAgICAgIEJsdWV0b290aERldmljZSBkZXZpY2UgPSBtQWRhcHRlci5nZXRSZW1vdGVEZXZpY2UoYWRkcmVzcyk7CisgICAgICAgIG1CbHVldG9vdGhTZXJ2aWNlLmhhbmRsZVBhbkRldmljZVN0YXRlQ2hhbmdlKGRldmljZSwgQmx1ZXRvb3RoUGFuLlNUQVRFX0RJU0NPTk5FQ1RFRCk7CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIG9uTmV0d29ya0RldmljZUNvbm5lY3RlZChTdHJpbmcgYWRkcmVzcywgaW50IGRlc3RVdWlkKSB7CisgICAgICAgIEJsdWV0b290aERldmljZSBkZXZpY2UgPSBtQWRhcHRlci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MgZm9yIHByb2ZpbGVzIHRvIGdyYWNlZnVsbHkgZGlzY29ubmVjdAogICAgICAgICAvLyBUT0RPOiBJbnRyb2R1Y2UgYSBjYWxsYmFjayBtZWNoYW5pc20gc28gdGhhdCBlYWNoIHByb2ZpbGUgY2FuIG5vdGlmeQpAQCAtNTQ4LDggKzU3NiwxMiBAQAogICAgICAgICAgICAgICAgIG1Cb25kU3RhdGUucmVhZEF1dG9QYWlyaW5nRGF0YSgpOwogICAgICAgICAgICAgICAgIG1Cb25kU3RhdGUubG9hZEJvbmRTdGF0ZSgpOwogICAgICAgICAgICAgICAgIGluaXRQcm9maWxlU3RhdGUoKTsKKworICAgICAgICAgICAgICAgIC8vUmVnaXN0ZXIgU0RQIHJlY29yZHMuCiAgICAgICAgICAgICAgICAgbUhhbmRsZXIuc2VuZE1lc3NhZ2VEZWxheWVkKAogICAgICAgICAgICAgICAgICAgICAgICAgbUhhbmRsZXIub2J0YWluTWVzc2FnZShNRVNTQUdFX1JFR0lTVEVSX1NEUF9SRUNPUkRTLCAxLCAtMSksIDMwMDApOworICAgICAgICAgICAgICAgIHNldEJsdWV0b290aFRldGhlcmluZ05hdGl2ZSh0cnVlLCBCbHVldG9vdGhQYW4uTkFQX1JPTEUsIEJsdWV0b290aFBhbi5OQVBfQlJJREdFKTsKKwogCiAgICAgICAgICAgICAgICAgLy8gTG9nIGJsdWV0b290aCBvbiB0byBiYXR0ZXJ5IHN0YXRzLgogICAgICAgICAgICAgICAgIGxvbmcgaWRlbnQgPSBCaW5kZXIuY2xlYXJDYWxsaW5nSWRlbnRpdHkoKTsKQEAgLTY2OCw2ICs3MDAsMTAgQEAKICAgICAgICAgICAgICAgICByZW1vdmVQcm9maWxlU3RhdGUoYWRkcmVzcyk7CiAgICAgICAgICAgICB9CiAKKyAgICAgICAgICAgIC8vIEhJRCBpcyBoYW5kbGVkIGJ5IEJsdWV0b290aFNlcnZpY2UsIG90aGVyIHByb2ZpbGVzCisgICAgICAgICAgICAvLyB3aW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ldyBJbnRlbnRGaWx0ZXIoKTsKKyAgICAgICAgICAgIGZpbHRlci5hZGRBY3Rpb24oQmx1ZXRvb3RoQWRhcHRlci5BQ1RJT05fU1RBVEVfQ0hBTkdFRCk7CisgICAgICAgICAgICBtVGV0aGVyaW5nUmVjZWl2ZXIgPSBuZXcgQnJvYWRjYXN0UmVjZWl2ZXIoKSB7CisgICAgICAgICAgICAgICAgQE92ZXJyaWRlCisgICAgICAgICAgICAgICAgcHVibGljIHN5bmNocm9uaXplZCB2b2lkIG9uUmVjZWl2ZShDb250ZXh0IGNvbnRleHQsIEludGVudCBpbnRlbnQpIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGludGVudC5nZXRJbnRFeHRyYShCbHVldG9vdGhBZGFwdGVyLkVYVFJBX1NUQVRFLCBCbHVldG9vdGhBZGFwdGVyLlNUQVRFX09GRikKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICA9PSBCbHVldG9vdGhBZGFwdGVyLlNUQVRFX09OKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtVGV0aGVyaW5nT24gPSB0cnVlOworICAgICAgICAgICAgICAgICAgICAgICAgbUNvbnRleHQudW5yZWdpc3RlclJlY2VpdmVyKG1UZXRoZXJpbmdSZWNlaXZlcik7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9OworICAgICAgICAgICAgbUNvbnRleHQucmVnaXN0ZXJSZWNlaXZlcihtVGV0aGVyaW5nUmVjZWl2ZXIsIGZpbHRlcik7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBtVGV0aGVyaW5nT24gPSB2YWx1ZTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyBzeW5jaHJvbml6ZWQgaW50IGdldFBhbkRldmljZVN0YXRlKEJsdWV0b290aERldmljZSBkZXZpY2UpIHsKKyAgICAgICAgbUNvbnRleHQuZW5mb3JjZUNhbGxpbmdPclNlbGZQZXJtaXNzaW9uKEJMVUVUT09USF9QRVJNLCAiTmVlZCBCTFVFVE9PVEggcGVybWlzc2lvbiIpOworCisgICAgICAgIGlmIChtUGFuRGV2aWNlcy5nZXQoZGV2aWNlKSA9PSBudWxsKSB7CisgICAgICAgICAgICByZXR1cm4gQmx1ZXRvb3RoUGFuLlNUQVRFX0RJU0NPTk5FQ1RFRDsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbVBhbkRldmljZXMuZ2V0KGRldmljZSk7CisgICAgfQorCisgICAgcHVibGljIHN5bmNocm9uaXplZCBib29sZWFuIGNvbm5lY3RQYW5EZXZpY2UoQmx1ZXRvb3RoRGV2aWNlIGRldmljZSkgeworICAgICAgICBtQ29udGV4dC5lbmZvcmNlQ2FsbGluZ09yU2VsZlBlcm1pc3Npb24oQkxVRVRPT1RIX0FETUlOX1BFUk0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiTmVlZCBCTFVFVE9PVEhfQURNSU4gcGVybWlzc2lvbiIpOworCisgICAgICAgIFN0cmluZyBvYmplY3RQYXRoID0gZ2V0T2JqZWN0UGF0aEZyb21BZGRyZXNzKGRldmljZS5nZXRBZGRyZXNzKCkpOworICAgICAgICBpZiAoREJHKSBsb2coImNvbm5lY3QgUEFOKCIgKyBvYmplY3RQYXRoICsgIikiKTsKKyAgICAgICAgaWYgKGdldFBhbkRldmljZVN0YXRlKGRldmljZSkgIT0gQmx1ZXRvb3RoUGFuLlNUQVRFX0RJU0NPTk5FQ1RFRCkgeworICAgICAgICAgICAgbG9nIChkZXZpY2UgKyAiIGFscmVhZHkgY29ubmVjdGVkIHRvIFBBTiIpOworICAgICAgICB9CisKKyAgICAgICAgaW50IGNvbm5lY3RlZENvdW50ID0gMDsKKyAgICAgICAgZm9yIChCbHVldG9vdGhEZXZpY2UgQlRkZXZpY2U6IG1QYW5EZXZpY2VzLmtleVNldCgpKSB7CisgICAgICAgICAgICBpZiAoZ2V0UGFuRGV2aWNlU3RhdGUoQlRkZXZpY2UpID09IEJsdWV0b290aFBhbi5TVEFURV9DT05ORUNURUQpIHsKKyAgICAgICAgICAgICAgICBjb25uZWN0ZWRDb3VudCArKzsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBpZiAoY29ubmVjdGVkQ291bnQgPiA4KSB7CisgICAgICAgICAgICBsb2cgKGRldmljZSArICIgY291bGQgbm90IGNvbm5lY3QgdG8gUEFOIGJlY2F1c2UgOCBvdGhlciBkZXZpY2VzIGFyZSBhbHJlYWR5IGNvbm5lY3RlZCIpOworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisKKyAgICAgICAgaGFuZGxlUGFuRGV2aWNlU3RhdGVDaGFuZ2UoZGV2aWNlLCBCbHVldG9vdGhQYW4uU1RBVEVfQ09OTkVDVElORyk7CisgICAgICAgIGlmIChjb25uZWN0UGFuRGV2aWNlTmF0aXZlKG9iamVjdFBhdGgsICJuYXAiLCAicGFudSIpKSB7CisgICAgICAgICAgICBsb2cgKCJjb25uZWN0aW5nIHRvIFBBTiIpOworICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBoYW5kbGVQYW5EZXZpY2VTdGF0ZUNoYW5nZShkZXZpY2UsIEJsdWV0b290aFBhbi5TVEFURV9ESVNDT05ORUNURUQpOworICAgICAgICAgICAgbG9nICgiY291bGQgbm90IGNvbm5lY3QgdG8gUEFOIik7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIHN5bmNocm9uaXplZCBib29sZWFuIGRpc2Nvbm5lY3RQYW4oKSB7CisgICAgICAgIG1Db250ZXh0LmVuZm9yY2VDYWxsaW5nT3JTZWxmUGVybWlzc2lvbihCTFVFVE9PVEhfUEVSTSwgIk5lZWQgQkxVRVRPT1RIIHBlcm1pc3Npb24iKTsKKyAgICAgICAgaWYgKERCRykgbG9nKCJkaXNjb25uZWN0IGFsbCBQQU4gZGV2aWNlcyIpOworCisgICAgICAgIGZvciAoQmx1ZXRvb3RoRGV2aWNlIGRldmljZTogbVBhbkRldmljZXMua2V5U2V0KCkpIHsKKyAgICAgICAgICAgIGlmIChnZXRQYW5EZXZpY2VTdGF0ZShkZXZpY2UpID09IEJsdWV0b290aFBhbi5TVEFURV9DT05ORUNURUQpIHsKKyAgICAgICAgICAgICAgICBpZiAoIWRpc2Nvbm5lY3RQYW5EZXZpY2UoZGV2aWNlKSkgeworICAgICAgICAgICAgICAgICAgICBsb2cgKCJjb3VsZCBub3QgZGlzY29ubmVjdCBQYW4gRGV2aWNlICIrZGV2aWNlLmdldEFkZHJlc3MoKSk7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHRydWU7CisgICAgfQorCisgICAgcHVibGljIHN5bmNocm9uaXplZCBCbHVldG9vdGhEZXZpY2VbXSBnZXRDb25uZWN0ZWRQYW5EZXZpY2VzKCkgeworICAgICAgICBtQ29udGV4dC5lbmZvcmNlQ2FsbGluZ09yU2VsZlBlcm1pc3Npb24oQkxVRVRPT1RIX1BFUk0sICJOZWVkIEJMVUVUT09USCBwZXJtaXNzaW9uIik7CisKKyAgICAgICAgU2V0PEJsdWV0b290aERldmljZT4gZGV2aWNlcyA9IG5ldyBIYXNoU2V0PEJsdWV0b290aERldmljZT4oKTsKKyAgICAgICAgZm9yIChCbHVldG9vdGhEZXZpY2UgZGV2aWNlOiBtUGFuRGV2aWNlcy5rZXlTZXQoKSkgeworICAgICAgICAgICAgaWYgKGdldFBhbkRldmljZVN0YXRlKGRldmljZSkgPT0gQmx1ZXRvb3RoUGFuLlNUQVRFX0NPTk5FQ1RFRCkgeworICAgICAgICAgICAgICAgIGRldmljZXMuYWRkKGRldmljZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGRldmljZXMudG9BcnJheShuZXcgQmx1ZXRvb3RoRGV2aWNlW2RldmljZXMuc2l6ZSgpXSk7CisgICAgfQorCisgICAgcHVibGljIHN5bmNocm9uaXplZCBib29sZWFuIGRpc2Nvbm5lY3RQYW5EZXZpY2UoQmx1ZXRvb3RoRGV2aWNlIGRldmljZSkgeworICAgICAgICBtQ29udGV4dC5lbmZvcmNlQ2FsbGluZ09yU2VsZlBlcm1pc3Npb24oQkxVRVRPT1RIX0FETUlOX1BFUk0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiTmVlZCBCTFVFVE9PVEhfQURNSU4gcGVybWlzc2lvbiIpOworICAgICAgICBTdHJpbmcgb2JqZWN0UGF0aCA9IGdldE9iamVjdFBhdGhGcm9tQWRkcmVzcyhkZXZpY2UuZ2V0QWRkcmVzcygpKTsKKyAgICAgICAgaWYgKERCRykgbG9nKCJkaXNjb25uZWN0IFBBTigiICsgb2JqZWN0UGF0aCArICIpIik7CisgICAgICAgIGlmIChnZXRQYW5EZXZpY2VTdGF0ZShkZXZpY2UpICE9IEJsdWV0b290aFBhbi5TVEFURV9DT05ORUNURUQpIHsKKyAgICAgICAgICAgIGxvZyAoZGV2aWNlICsgIiBhbHJlYWR5IGRpc2Nvbm5lY3RlZCBmcm9tIFBBTiIpOworICAgICAgICB9CisgICAgICAgIGhhbmRsZVBhbkRldmljZVN0YXRlQ2hhbmdlKGRldmljZSwgQmx1ZXRvb3RoUGFuLlNUQVRFX0RJU0NPTk5FQ1RJTkcpOworICAgICAgICByZXR1cm4gZGlzY29ubmVjdFBhbkRldmljZU5hdGl2ZShvYmplY3RQYXRoKTsKKyAgICB9CisKKyAgICAvKnBhY2thZ2UqLyB2b2lkIGhhbmRsZVBhbkRldmljZVN0YXRlQ2hhbmdlKEJsdWV0b290aERldmljZSBkZXZpY2UsIGludCBzdGF0ZSkgeworICAgICAgICBpbnQgcHJldlN0YXRlOworICAgICAgICBpZiAob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XJ0IHRldGhlcmluZyBhbmQgdW5jb25maWcnZCBvbiBlcnJvciBvciBjb25jbHVzaW9uCisgICAgcHJpdmF0ZSBib29sZWFuIHVwZGF0ZVRldGhlclN0YXRlKGJvb2xlYW4gZW5hYmxlZCkgeworICAgICAgICBMb2cuZChUQUcsICJjb25maWd1cmVCbHVldG9vdGhJZmFjZSgiICsgZW5hYmxlZCArICIpIik7CisKKyAgICAgICAgSUJpbmRlciBiID0gU2VydmljZU1hbmFnZXIuZ2V0U2VydmljZShDb250ZXh0Lk5FVFdPUktNQU5BR0VNRU5UX1NFUlZJQ0UpOworICAgICAgICBJTmV0d29ya01hbmFnZW1lbnRTZXJ2aWNlIHNlcnZpY2UgPSBJTmV0d29ya01hbmFnZW1lbnRTZXJ2aWNlLlN0dWIuYXNJbnRlcmZhY2UoYik7CisgICAgICAgIENvbm5lY3Rpdml0eU1hbmFnZXIgY20gPQorICAgICAgICAgICAgKENvbm5lY3Rpdml0eU1hbmFnZXIpbUNvbnRleHQuZ2V0U3lzdGVtU2VydmljZShDb250ZXh0LkNPTk5FQ1RJVklUWV9TRVJWSUNFKTsKKyAgICAgICAgU3RyaW5nW10gYmx1ZXRvb3RoUmVnZXhzID0gY20uZ2V0VGV0aGVyYWJsZUJsdWV0b290aFJlZ2V4cygpOworCisgICAgICAgIC8vIGJyaW5nIHRvZ2dsZSB0aGUgaW50ZXJmYWNlcworICAgICAgICBTdHJpbmdbXSBpZmFjZXMgPSBuZXcgU3RyaW5nWzBdOworICAgICAgICB0cnkgeworICAgICAgICAgICAgaWZhY2VzID0gc2VydmljZS5saXN0SW50ZXJmYWNlcygpOworICAgICAgICB9IGNhdGNoIChFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgTG9nLmUoVEFHLCAiRXJyb3IgbGlzdGluZyBJbnRlcmZhY2VzIDoiICsgZSk7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKworICAgICAgICBBcnJheUxpc3Q8U3RyaW5nPiBpZmFjZUFkZHJlc3NlcyA9IChBcnJheUxpc3Q8U3RyaW5nPikgbUJsdWV0b290aElmYWNlQWRkcmVzc2VzLmNsb25lKCk7CisgICAgICAgIGZvciAoU3RyaW5nIGlmYWNlIDogaWZhY2VzKSB7CisgICAgICAgICAgICBmb3IgKFN0cmluZyByZWdleCA6IGJsdWV0b290aFJlZ2V4cykgeworICAgICAgICAgICAgICAgIGlmIChpZmFjZS5tYXRjaGVzKHJlZ2V4KSkgeworICAgICAgICAgICAgICAgICAgICBJbnRlcmZhY2VDb25maWd1cmF0aW9uIGlmY2cgPSBudWxsOworICAgICAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICAgICAgaWZjZyA9IHNlcnZpY2UuZ2V0SW50ZXJmYWNlQ29uZmlnKGlmYWNlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpZmNnICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZW5hYmxlZCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTdHJpbmdbXSBhZGRyID0gQkxVRVRPT1RIX05FVE1BU0suc3BsaXQoIlxcLiIpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZmNnLm5ldG1hc2sgPSAoSW50ZWdlci5wYXJzZUludChhZGRyWzBdKSA8PCAyNCkgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChJbnRlZ2VyLnBhcnNlSW50KGFkZHJbMV0pIDw8IDE2KSArCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKEludGVnZXIucGFyc2VJbnQoYWRkclsyXSkgPDwgOCkgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChJbnRlZ2VyLnBhcnNlSW50KGFkZHJbM10pKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlmY2cuaXBBZGRyID09IDAgJiYgIWlmYWNlQWRkcmVzc2VzLmlzRW1wdHkoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRkciA9IGlmYWNlQWRkcmVzc2VzLnJlbW92ZSgwKS5zcGxpdCgiXFwuIik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZmNnLmlwQWRkciA9IChJbnRlZ2VyLnBhcnNlSW50KGFkZHJbMF0pIDw8IDI0KSArCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChJbnRlZ2VyLnBhcnNlSW50KGFkZHJbMV0pIDw8IDE2KSArCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChJbnRlZ2VyLnBhcnNlSW50KGFkZHJbMl0pIDw8IDgpICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKEludGVnZXIucGFyc2VJbnQoYWRkclszXSkpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU3RyaW5nIElmYWNlQWRkcmVzcyA9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFN0cmluZy52YWx1ZU9mKGlmY2cuaXBBZGRyID4+PiAyNCkgKyAiLiIgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTdHJpbmcudmFsdWVPZigoaWZjZy5pcEFkZHIgJiAweDAwRkYwMDAwKSA+Pj4gMTYpICsgIi4iICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU3RyaW5nLnZhbHVlT2YoKGlmY2cuaXBBZGRyICYgMHgwMDAwRkYwMCkgPj4+IDgpICsgIi4iICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU3RyaW5nLnZhbHVlT2YoaWZjZy5pcEFkZHIgJiAweDAwMDAwMEZGKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmYWNlQWRkcmVzc2VzLnJlbW92ZShJZmFjZUFkZHJlc3MpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmY2cuaW50ZXJmYWNlRmxhZ3MgPSBpZmNnLmludGVyZmFjZUZsYWdzLnJlcGxhY2UoImRvd24iLCAidXAiKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZmNnLmludGVyZmFjZUZsYWdzID0gaWZjZy5pbnRlcmZhY2VGbGFncy5yZXBsYWNlKCJ1cCIsICJkb3duIik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmY2cuaW50ZXJmYWNlRmxhZ3MgPSBpZmNnLmludGVyZmFjZUZsYWdzLnJlcGxhY2UoInJ1bm5pbmciLCAiIik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWZjZy5pbnRlcmZhY2VGbGFncyA9IGlmY2cuaW50ZXJmYWNlRmxhZ3MucmVwbGFjZSgiICAiLCIgIik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VydmljZS5zZXRJbnRlcmZhY2VDb25maWcoaWZhY2UsIGlmY2cpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlbmFibGVkKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjbS50ZXRoZXIoaWZhY2UpICE9IENvbm5lY3Rpdml0eU1hbmFnZXIuVEVUSEVSX0VSUk9SX05PX0VSUk9SKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMb2cuZShUQUcsICJFcnJvciB0ZXRoZXJpbmcgIitpZmFjZXMpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgTG9nLmUoVEFHLCAiRXJyb3IgY29uZmlndXJpbmcgaW50ZXJmYWNlICIgKyBpZmFjZSArICIsIDoiICsgZSk7CisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICB9CisKKyAgICBwdWJsaWMgc3luY2hyb25pemVkIGJvb2xlYW4gY29ubmVjdElucHV0RGV2aWNlKEJsdWV0b290aERldmljZSBkZXZpY2UpIHsKKyAgICAgICAgbUNvbnRleHQuZW5mb3JjZUNhbGxpbmdPclNlbGZQZXJtaXNzaW9uKEJMVUVUT09USF9BRE1JTl9QRVJNLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIk5lZWQgQkxVRVRPT1RIX0FETUlOIHBlcm1pc3Npb24iKTsKKworICAgICAgICBTdHJpbmcgb2JqZWN0UGF0aCA9IGdldE9iamVjdFBhdGhGcm9tQWRkcmVzcyhkZXZpY2UuZ2V0QWRkcmVzcygpKTsKKyAgICAgICAgaWYgKG9iamVjdFBhdGggPT0gbnVsbCB8fAorICAgICAgICAgICAgZ2V0SW5wdXREZXZpY2VTdGF0ZShkZXZpY2UpICE9IEJsdWV0b290aElucHV0RGV2aWNlLlNUQVRFX0RJU0NPTk5FQ1RFRCB8fAorICAgICAgICAgICAgZ2V0SW5wdXREZXZpY2VQcmlvcml0eShkZXZpY2UpID09IEJsdWV0b290aElucHV0RGV2aWNlLlBSSU9SSVRZX09GRikgeworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgICAgIEJsdWV0b290aERldmljZVByb2ZpbGVTdGF0ZSBzdGF0ZSA9IG1EZXZpY2VQcm9maWxlU3RhdGUuZ2V0KGRldmljZS5nZXRBZGRyZXNzKCkpOworICAgICAgICBpZiAoc3RhdGUgIT0gbnVsbCkgeworICAgICAgICAgICAgTWVzc2FnZSBtc2cgPSBuZXcgTWVzc2FnZSgpOworICAgICAgICAgICAgbXNnLmFyZzEgPSBCbHVldG9vdGhEZXZpY2VQcm9maWxlU3RhdGUuQ09OTkVDVF9ISURfT1VUR09JTkc7CisgICAgICAgICAgICBtc2cub2JqID0gc3RhdGU7CisgICAgICAgICAgICBtSGlkUHJvZmlsZVN0YXRlLnNlbmRNZXNzYWdlKG1zZyk7CisgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgcHVibGljIHN5bmNocm9uaXplZCBib29sZWFuIGNvbm5lY3RJbnB1dERldmljZUludGVybmFsKEJsdWV0b290aERldmljZSBkZXZpY2UpIHsKKyAgICAgICAgU3RyaW5nIG9iamVjdFBhdGggPSBnZXRPYmplY3RQYXRoRnJvbUFkZHJlc3MoZGV2aWNlLmdldEFkZHJlc3MoKSk7CisgICAgICAgIGhhbmRsZUlucHV0RGV2aWNlU3RhdGVDaGFuZ2UoZGV2aWNlLCBCbHVldG9vdGhJbnB1dERldmljZS5TVEFURV9DT05ORUNUSU5HKTsKKyAgICAgICAgaWYgKCFjb25uZWN0SW5wdXREZXZpY2VOYXRpdmUob2JqZWN0UGF0aCkpIHsKKyAgICAgICAgICAgIGhhbmRsZUlucHV0RGV2aWNlU3RhdGVDaGFuZ2UoZGV2aWNlLCBCbHVldG9vdGhJbnB1dERldmljZS5TVEFURV9ESVNDT05ORUNURUQpOworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgICAgIHJldHVybiB0cnVlOworICAgIH0KKworICAgIHB1YmxpYyBzeW5jaHJvbml6ZWQgYm9vbGVhbiBkaXNjb25uZWN0SW5wdXREZXZpY2UoQmx1ZXRvb3RoRGV2aWNlIGRldmljZSkgeworICAgICAgICBtQ29udGV4dC5lbmZvcmNlQ2FsbGluZ09yU2VsZlBlcm1pc3Npb24oQkxVRVRPT1RIX0FETUlOX1BFUk0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiTmVlZCBCTFVFVE9PVEhfQURNSU4gcGVybWlzc2lvbiIpOworCisgICAgICAgIFN0cmluZyBvYmplY3RQYXRoID0gZ2V0T2JqZWN0UGF0aEZyb21BZGRyZXNzKGRldmljZS5nZXRBZGRyZXNzKCkpOworICAgICAgICBpZiAob2JqZWN0UGF0aCA9PSBudWxsIHx8IGdldENvbm5lY3RlZElucHV0RGV2aWNlcygpLmxlbmd0aCA9PSAwKSB7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKyAgICAgICAgQmx1ZXRvb3RoRGV2aWNlUHJvZmlsZVN0YXRlIHN0YXRlID0gbURldmljZVByb2ZpbGVTdGF0ZS5nZXQoZGV2aWNlLmdldEFkZHJlc3MoKSk7CisgICAgICAgIGlmIChzdGF0ZSAhPSBudWxsKSB7CisgICAgICAgICAgICBNZXNzYWdlIG1zZyA9IG5ldyBNZXNzYWdlKCk7CisgICAgICAgICAgICBtc2cuYXJnMSA9IEJsdWV0b290aERldmljZVByb2ZpbGVTdGF0ZS5ESVNDT05ORUNUX0hJRF9PVVRHT0lORzsKKyAgICAgICAgICAgIG1zZy5vYmogPSBzdGF0ZTsKKyAgICAgICAgICAgIG1IaWRQcm9maWxlU3RhdGUuc2VuZE1lc3NhZ2UobXNnKTsKKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKKyAgICBwdWJsaWMgc3luY2hyb25pemVkIGJvb2xlYW4gZGlzY29ubmVjdElucHV0RGV2aWNlSW50ZXJuYWwoQmx1ZX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Q2FsbGluZ09yU2VsZlBlcm1pc3Npb24oQkxVRVRPT1RIX1BFUk0sICJOZWVkIEJMVUVUT09USCBwZXJtaXNzaW9uIik7CisgICAgICAgIFNldDxCbHVldG9vdGhEZXZpY2U+IGRldmljZXMgPSBsb29rdXBJbnB1dERldmljZXNNYXRjaGluZ1N0YXRlcygKKyAgICAgICAgICAgIG5ldyBpbnRbXSB7Qmx1ZXRvb3RoSW5wdXREZXZpY2UuU1RBVEVfQ09OTkVDVEVEfSk7CisgICAgICAgIHJldHVybiBkZXZpY2VzLnRvQXJyYXkobmV3IEJsdWV0b290aERldmljZVtkZXZpY2VzLnNpemUoKV0pOworICAgIH0KKworICAgIHB1YmxpYyBzeW5jaHJvbml6ZWQgaW50IGdldElucHV0RGV2aWNlUHJpb3JpdHkoQmx1ZXRvb3RoRGV2aWNlIGRldmljZSkgeworICAgICAgICBtQ29udGV4dC5lbmZvcmNlQ2FsbGluZ09yU2VsZlBlcm1pc3Npb24oQkxVRVRPT1RIX1BFUk0sICJOZWVkIEJMVUVUT09USCBwZXJtaXNzaW9uIik7CisgICAgICAgIHJldHVybiBTZXR0aW5ncy5TZWN1cmUuZ2V0SW50KG1Db250ZXh0LmdldENvbnRlbnRSZXNvbHZlcigpLAorICAgICAgICAgICAgICAgIFNldHRpbmdzLlNlY3VyZS5nZXRCbHVldG9vdGhJbnB1dERldmljZVByaW9yaXR5S2V5KGRldmljZS5nZXRBZGRyZXNzKCkpLAorICAgICAgICAgICAgICAgIEJsdWV0b290aElucHV0RGV2aWNlLlBSSU9SSVRZX1VOREVGSU5FRCk7CisgICAgfQorCisgICAgcHVibGljIHN5bmNocm9uaXplZCBib29sZWFuIHNldElucHV0RGV2aWNlUHJpb3JpdHkoQmx1ZXRvb3RoRGV2aWNlIGRldmljZSwgaW50IHByaW9yaXR5KSB7CisgICAgICAgIG1Db250ZXh0LmVuZm9yY2VDYWxsaW5nT3JTZWxmUGVybWlzc2lvbihCTFVFVE9PVEhfQURNSU5fUEVSTSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJOZWVkIEJMVUVUT09USF9BRE1JTiBwZXJtaXNzaW9uIik7CisgICAgICAgIGlmICghQmx1ZXRvb3RoQWRhcHRlci5jaGVja0JsdWV0b290aEFkZHJlc3MoZGV2aWNlLmdldEFkZHJlc3MoKSkpIHsKKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gU2V0dGluZ3MuU2VjdXJlLnB1dEludChtQ29udGV4dC5nZXRDb250ZW50UmVzb2x2ZXIoKSwKKyAgICAgICAgICAgICAgICBTZXR0aW5ncy5TZWN1cmUuZ2V0Qmx1ZXRvb3RoSW5wdXREZXZpY2VQcmlvcml0eUtleShkZXZpY2UuZ2V0QWRkcmVzcygpKSwKKyAgICAgICAgICAgICAgICBwcmlvcml0eSk7CisgICAgfQorCisgICAgLypwYWNrYWdlKi9zeW5jaHJvbml6ZWQgU2V0PEJsdWV0b290aERldmljZT4gbG9va3VwSW5wdXREZXZpY2VzTWF0Y2hpbmdTdGF0ZXMoaW50W10gc3RhdGVzKSB7CisgICAgICAgIFNldDxCbHVldG9vdGhEZXZpY2U+IGlucHV0RGV2aWNlcyA9IG5ldyBIYXNoU2V0PEJsdWV0b290aERldmljZT4oKTsKKyAgICAgICAgaWYgKG1JbnB1dERldmljZXMuaXNFbXB0eSgpKSB7CisgICAgICAgICAgICByZXR1cm4gaW5wdXREZXZpY2VzOworICAgICAgICB9CisgICAgICAgIGZvciAoQmx1ZXRvb3RoRGV2aWNlIGRldmljZTogbUlucHV0RGV2aWNlcy5rZXlTZXQoKSkgeworICAgICAgICAgICAgaW50IGlucHV0RGV2aWNlU3RhdGUgPSBnZXRJbnB1dERldmljZVN0YXRlKGRldmljZSk7CisgICAgICAgICAgICBmb3IgKGludCBzdGF0ZSA6IHN0YXRlcykgeworICAgICAgICAgICAgICAgIGlmIChzdGF0ZSA9PSBpbnB1dERldmljZVN0YXRlKSB7CisgICAgICAgICAgICAgICAgICAgIGlucHV0RGV2aWNlcy5hZGQoZGV2aWNlKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiBpbnB1dERldmljZXM7CisgICAgfQorCisgICAgcHJpdmF0ZSBzeW5jaHJvbml6ZWQgdm9pZCBoYW5kbGVJbnB1dERldmljZVN0YXRlQ2hhbmdlKEJsdWV0b290aERldmljZSBkZXZpY2UsIGludCBzdGF0ZSkgeworICAgICAgICBpbnQgcHJldlN0YXRlOworICAgICAgICBpZiAobUlucHV0RGV2aWNlcy5nZXQoZGV2aWNlKSA9PSBudWxsKSB7CisgICAgICAgICAgICBwcmV2U3RhdGUgPSBCbHVldG9vdGhJbnB1dERldmljZS5TVEFURV9ESVNDT05ORUNURUQ7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBwcmV2U3RhdGUgPSBtSW5wdXREZXZpY2VzLmdldChkZXZpY2UpOworICAgICAgICB9CisgICAgICAgIGlmIChwcmV2U3RhdGUgPT0gc3RhdGUpIHJldHVybjsKKworICAgICAgICBtSW5wdXREZXZpY2VzLnB1dChkZXZpY2UsIHN0YXRlKTsKKworICAgICAgICBpZiAoZ2V0SW5wdXREZXZpY2VQcmlvcml0eShkZXZpY2UpID4KKyAgICAgICAgICAgICAgQmx1ZXRvb3RoSW5wdXREZXZpY2UuUFJJT1JJVFlfT0ZGICYmCisgICAgICAgICAgICBzdGF0ZSA9PSBCbHVldG9vdGhJbnB1dERldmljZS5TVEFURV9DT05ORUNUSU5HIHx8CisgICAgICAgICAgICBzdGF0ZSA9PSBCbHVldG9vdGhJbnB1dERldmljZS5TVEFURV9DT05ORUNURUQpIHsKKyAgICAgICAgICAgIC8vIFdlIGhhdmUgY29ubmVjdGVkIG9yIGF0dGVtcHRpbmcgdG8gY29ubmVjdC4KKyAgICAgICAgICAgIC8vIE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AgQmx1ZXRvb3RoRGV2aWNlIGRldmljZSA9IG1BZGFwdGVyLmdldFJlbW90ZURldmljZShhZGRyZXNzKTsKKyAgICAgICAgaGFuZGxlSW5wdXREZXZpY2VTdGF0ZUNoYW5nZShkZXZpY2UsIHN0YXRlKTsKKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgc2V0SW5pdGlhbElucHV0RGV2aWNlUHJpb3JpdHkoQmx1ZXRvb3RoRGV2aWNlIGRldmljZSwgaW50IHN0YXRlKSB7CisgICAgICAgIHN3aXRjaCAoc3RhdGUpIHsKKyAgICAgICAgICAgIGNhc2UgQmx1ZXRvb3RoRGV2aWNlLkJPTkRfQk9OREVEOgorICAgICAgICAgICAgICAgIGlmIChnZXRJbnB1dERldmljZVByaW9yaXR5KGRldmljZSkgPT0gQmx1ZXRvb3RoSW5wdXREZXZpY2UuUFJJT1JJVFlfVU5ERUZJTkVEKSB7CisgICAgICAgICAgICAgICAgICAgIHNldElucHV0RGV2aWNlUHJpb3JpdHkoZGV2aWNlLCBCbHVldG9vdGhJbnB1dERldmljZS5QUklPUklUWV9PTik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBCbHVldG9vdGhEZXZpY2UuQk9ORF9OT05FOgorICAgICAgICAgICAgICAgIHNldElucHV0RGV2aWNlUHJpb3JpdHkoZGV2aWNlLCBCbHVldG9vdGhJbnB1dERldmljZS5QUklPUklUWV9VTkRFRklORUQpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgfQorCiAgICAgLypwYWNrYWdlKi8gYm9vbGVhbiBpc1JlbW90ZURldmljZUluQ2FjaGUoU3RyaW5nIGFkZHJlc3MpIHsKICAgICAgICAgcmV0dXJuIChtRGV2aWNlUHJvcGVydGllcy5nZXQoYWRkcmVzcykgIT0gbnVsbCk7CiAgICAgfQpAQCAtMTI0Miw3ICsxNjQ1LDcgQEAKICAgICAgICAgICAgIGlmICh1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KiBAcGFyYW0gY2hhcnMgdGhlIGNoYXJhY3RlciBhcnJheSAodXNlZCB0byBkZXRlcm1pbmUgd2hpdGVzcGFjZSkKKyAgICAgKiBAcGFyYW0gY3N0YXJ0IHRoZSBzdGFydCBvZiB0aGUgbGluZSBpbiB0aGUgY2hhcnMgYXJyYXkKKyAgICAgKiBAcGFyYW0gbGVuIHRoZSBsZW5ndGggb2YgdGhlIGxpbmUKKyAgICAgKiBAcmV0dXJuIHRoZSBkaXJlY3Rpb25zCisgICAgICovCisgICAgcHVibGljIHN0YXRpYyBEaXJlY3Rpb25zIGRpcmVjdGlvbnMoaW50IGRpciwgYnl0ZVtdIGxldmVscywgaW50IGxzdGFydCwKKyAgICAgICAgICAgIGNoYXJbXSBjaGFycywgaW50IGNzdGFydCwgaW50IGxlbikgeworCisgICAgICAgIGludCBiYXNlTGV2ZWwgPSBkaXIgPT0gTGF5b3V0LkRJUl9MRUZUX1RPX1JJR0hUID8gMCA6IDE7CisgICAgICAgIGludCBjdXJMZXZlbCA9IGxldmVsc1tsc3RhcnRdOworICAgICAgICBpbnQgbWluTGV2ZWwgPSBjdXJMZXZlbDsKKyAgICAgICAgaW50IHJ1bkNvdW50ID0gMTsKKyAgICAgICAgZm9yIChpbnQgaSA9IGxzdGFydCArIDEsIGUgPSBsc3RhcnQgKyBsZW47IGkgPCBlOyArK2kpIHsKKyAgICAgICAgICAgIGludCBsZXZlbCA9IGxldmVsc1tpXTsKKyAgICAgICAgICAgIGlmIChsZXZlbCAhPSBjdXJMZXZlbCkgeworICAgICAgICAgICAgICAgIGN1ckxldmVsID0gbGV2ZWw7CisgICAgICAgICAgICAgICAgKytydW5Db3VudDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIC8vIGFkZCBmaW5hbCBydW4gZm9yIHRyYWlsaW5nIGNvdW50ZXItZGlyZWN0aW9uYWwgd2hpdGVzcGFjZQorICAgICAgICBpbnQgdmlzTGVuID0gbGVuOworICAgICAgICBpZiAoKGN1ckxldmVsICYgMSkgIT0gKGJhc2VMZXZlbCAmIDEpKSB7CisgICAgICAgICAgICAvLyBsb29rIGZvciB2aXNpYmxlIGVuZAorICAgICAgICAgICAgd2hpbGUgKC0tdmlzTGVuID49IDApIHsKKyAgICAgICAgICAgICAgICBjaGFyIGNoID0gY2hhcnNbY3N0YXJ0ICsgdmlzTGVuXTsKKworICAgICAgICAgICAgICAgIGlmIChjaCA9PSAnXG4nKSB7CisgICAgICAgICAgICAgICAgICAgIC0tdmlzTGVuOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBpZiAoY2ggIT0gJyAnICYmIGNoICE9ICdcdCcpIHsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgKyt2aXNMZW47CisgICAgICAgICAgICBpZiAodmlzTGVuICE9IGxlbikgeworICAgICAgICAgICAgICAgICsrcnVuQ291bnQ7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBpZiAocnVuQ291bnQgPT0gMSAmJiBtaW5MZXZlbCA9PSBiYXNlTGV2ZWwpIHsKKyAgICAgICAgICAgIC8vIHdlJ3JlIGRvbmUsIG9ubHkgb25lIHJ1biBvbiB0aGlzIGxpbmUKKyAgICAgICAgICAgIGlmICgobWluTGV2ZWwgJiAxKSAhPSAwKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIExheW91dC5ESVJTX0FMTF9SSUdIVF9UT19MRUZUOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIExheW91dC5ESVJTX0FMTF9MRUZUX1RPX1JJR0hUOworICAgICAgICB9CisKKyAgICAgICAgaW50W10gbGQgPSBuZXcgaW50W3J1bkNvdW50ICogMl07CisgICAgICAgIGludCBtYXhMZXZlbCA9IG1pbkxldmVsOworICAgICAgICBpbnQgbGV2ZWxCaXRzID0gbWluTGV2ZWwgPDwgTGF5b3V0LlJVTl9MRVZFTF9TSElGVDsKKyAgICAgICAgeworICAgICAgICAgICAgLy8gU3RhcnQgb2YgZmlyc3QgcGFpciBpcyBhbHdheXMgMCwgd2Ugd3JpdGUKKyAgICAgICAgICAgIC8vIGxlbmd0aCB0aGVuIHN0YXJ0IGF0IGVhY2ggbmV3IHJ1biwgYW5kIHRoZQorICAgICAgICAgICAgLy8gbGFzdCBydW4gbGVuZ3RoIGFmdGVyIHdlJ3JlIGRvbmUuCisgICAgICAgICAgICBpbnQgbiA9IDE7CisgICAgICAgICAgICBpbnQgcHJldiA9IGxzdGFydDsKKyAgICAgICAgICAgIGN1ckxldmVsID0gbWluTGV2ZWw7CisgICAgICAgICAgICBmb3IgKGludCBpID0gbHN0YXJ0LCBlID0gbHN0YXJ0ICsgdmlzTGVuOyBpIDwgZTsgKytpKSB7CisgICAgICAgICAgICAgICAgaW50IGxldmVsID0gbGV2ZWxzW2ldOworICAgICAgICAgICAgICAgIGlmIChsZXZlbCAhPSBjdXJMZXZlbCkgeworICAgICAgICAgICAgICAgICAgICBjdXJMZXZlbCA9IGxldmVsOworICAgICAgICAgICAgICAgICAgICBpZiAobGV2ZWwgPiBtYXhMZXZlbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgbWF4TGV2ZWwgPSBsZXZlbDsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChsZXZlbCA8IG1pbkxldmVsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtaW5MZXZlbCA9IGxldmVsOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIC8vIFhYWCBpZ25vcmUgcnVuIGxlbmd0aCBsaW1pdCBvZiAyXlJVTl9MRVZFTF9TSElGVAorICAgICAgICAgICAgICAgICAgICBsZFtuKytdID0gKGkgLSBwcmV2KSB8IGxldmVsQml0czsKKyAgICAgICAgICAgICAgICAgICAgbGRbbisrXSA9IGkgLSBsc3RhcnQ7CisgICAgICAgICAgICA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gICAgLy8gaXMgYWxyZWFkeSBpbiBvcmRlciwgc28gdGhlcmUncyBubyBtb3JlIHRvIGRvLgorICAgICAgICAvLworICAgICAgICBib29sZWFuIHN3YXA7CisgICAgICAgIGlmICgobWluTGV2ZWwgJiAxKSA9PSBiYXNlTGV2ZWwpIHsKKyAgICAgICAgICAgIG1pbkxldmVsICs9IDE7CisgICAgICAgICAgICBzd2FwID0gbWF4TGV2ZWwgPiBtaW5MZXZlbDsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIHN3YXAgPSBydW5Db3VudCA+IDE7CisgICAgICAgIH0KKyAgICAgICAgaWYgKHN3YXApIHsKKyAgICAgICAgICAgIGZvciAoaW50IGxldmVsID0gbWF4TGV2ZWwgLSAxOyBsZXZlbCA+PSBtaW5MZXZlbDsgLS1sZXZlbCkgeworICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbGQubGVuZ3RoOyBpICs9IDIpIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGxldmVsc1tsZFtpXV0gPj0gbGV2ZWwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGludCBlID0gaSArIDI7CisgICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAoZSA8IGxkLmxlbmd0aCAmJiBsZXZlbHNbbGRbZV1dID49IGxldmVsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZSArPSAyOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChpbnQgbG93ID0gaSwgaGkgPSBlIC0gMjsgbG93IDwgaGk7IGxvdyArPSAyLCBoaSAtPSAyKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHggPSBsZFtsb3ddOyBsZFtsb3ddID0gbGRbaGldOyBsZFtoaV0gPSB4OworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHggPSBsZFtsb3crMV07IGxkW2xvdysxXSA9IGxkW2hpKzFdOyBsZFtoaSsxXSA9IHg7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBpID0gZSArIDI7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIG5ldyBEaXJlY3Rpb25zKGxkKTsKKyAgICB9CisKICAgICBwcml2YXRlIG5hdGl2ZSBzdGF0aWMgaW50IHJ1bkJpZGkoaW50IGRpciwgY2hhcltdIGNocywgYnl0ZVtdIGNoSW5mbywgaW50IG4sIGJvb2xlYW4gaGF2ZUluZm8pOwogfQpcIE5vIG5ld2xpbmUgYXQgZW5kIG9mIGZpbGUKZGlmZiAtLWdpdCBhL2NvcmUvamF2YS9hbmRyb2lkL3RleHQvQm9yaW5nTGF5b3V0LmphdmEgYi9jb3JlL2phdmEvYW5kcm9pZC90ZXh0L0JvcmluZ0xheW91dC5qYXZhCmluZGV4IDk0NGY3MzUuLjkzMDliMDUgMTAwNjQ0Ci0tLSBhL2NvcmUvamF2YS9hbmRyb2lkL3RleHQvQm9yaW5nTGF5b3V0LmphdmEKKysrIGIvY29yZS9qYXZhL2FuZHJvaWQvdGV4dC9Cb3JpbmdMYXlvdXQuamF2YQpAQCAtMjA4LDExICsyMDgsMTEgQEAKICAgICAgICAgICAgICAqIHdpZHRoIGJlY2F1c2UgdGhlIHdpZHRoIHRoYXQgd2FzIHBhc3NlZCBpbiB3YXMgZm9yIHRoZQogICAgICAgICAgICAgICogZnVsbCB0ZXh0LCBub3QgdGhlIGVsbGlwc2l6ZWQgZm9ybS4KICAgICAgICAgICAgICAqLwotICAgICAgICAgICAgc3luY2hyb25pemVkIChzVGVtcCkgewotICAgICAgICAgICAgICAgIG1NYXggPSAoaW50KSAoRmxvYXRNYXRoLmNlaWwoU3R5bGVkLm1lYXN1cmVUZXh0KHBhaW50LCBzVGVtcCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZSwgMCwgc291cmNlLmxlbmd0aCgpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCkpKTsKLSAgICAgICAgICAgIH0KKyAgICAgICAgICAgIFRleHRMaW5lIGxpbmUgPSBUZXh0TGluZS5vYnRhaW4oKTsKKyAgICAgICAgICAgIGxpbmUuc2V0KHBhaW50LCBzb3VyY2UsIDAsIHNvdXJjZS5sZW5ndGgoKSwgTGF5b3V0LkRJUl9MRUZUX1RPX1JJR0hULAorICAgICAgICAgICAgICAgICAgICBMYXlvdXQuRElSU19BTExfTEVGVF9UT19SSUdIVCwgZmFsc2UsIG51bGwpOworICAgICAgICAgICAgbU1heCA9IChpbnQpIEZsb2F0TWF0aC5jZWlsKGxpbmUubWV0cmljcyhudWxsKSk7CisgICAgICAgICAgICBUZXh0TGluZS5yZWN5Y2xlKGxpbmUpOwogICAgICAgICB9CiAKICAgICAgICAgaWYgKGluY2x1ZGVwYWQpIHsKQEAgLTI3NiwxNCArMjc2LDEzIEBACiAgICAgICAgICAgICBpZiAoZm0gPT0gbnVsbCkgewogICAgICAgICAgICAgICAgIGZtID0gbmV3IE1ldHJpY3MoKTsKICAgICAgICAgICAgIH0KLSAgICAKLSAgICAgICAgICAgIGludCB3aWQ7CiAKLSAgICAgICAgICAgIHN5bmNocm9uaXplZCAoc1RlbXApIHsKLSAgICAgICAgICAgICAgICB3aWQgPSAoaW50KSAoRmxvYXRNYXRoLmNlaWwoU3R5bGVkLm1lYXN1cmVUZXh0KHBhaW50LCBzVGVtcCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRleHQsIDAsIHRleHQubGVuZ3RoKCksIGZtKSkpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZm0ud2lkdGggPSB3aWQ7CisgICAgICAgICAgICBUZXh0TGluZSBsaW5lID0gVGV4dExpbmUub2J0YWluKCk7CisgICAgICAgICAg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LmVtcHR5QXJyYXkoUGFyYWdyYXBoU3R5bGUuY2xhc3MpOwogCkBAIC01NCw5ICs1OCw3IEBACiAgICAgICAgICAgICBNSU5fRU1PSkkgPSAtMTsKICAgICAgICAgICAgIE1BWF9FTU9KSSA9IC0xOwogICAgICAgICB9Ci0gICAgfTsKLQotICAgIHByaXZhdGUgUmVjdEYgbUVtb2ppUmVjdDsKKyAgICB9CiAKICAgICAvKioKICAgICAgKiBSZXR1cm4gaG93IHdpZGUgYSBsYXlvdXQgbXVzdCBiZSBpbiBvcmRlciB0byBkaXNwbGF5IHRoZQpAQCAtNjYsNyArNjgsNyBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRleHRQYWludCBwYWludCkgewogICAgICAgICByZXR1cm4gZ2V0RGVzaXJlZFdpZHRoKHNvdXJjZSwgMCwgc291cmNlLmxlbmd0aCgpLCBwYWludCk7CiAgICAgfQotICAgIAorCiAgICAgLyoqCiAgICAgICogUmV0dXJuIGhvdyB3aWRlIGEgbGF5b3V0IG11c3QgYmUgaW4gb3JkZXIgdG8gZGlzcGxheSB0aGUKICAgICAgKiBzcGVjaWZpZWQgdGV4dCBzbGljZSB3aXRoIG9uZSBsaW5lIHBlciBwYXJhZ3JhcGguCkBAIC04NSw4ICs4Nyw3IEBACiAgICAgICAgICAgICAgICAgbmV4dCA9IGVuZDsKIAogICAgICAgICAgICAgLy8gbm90ZSwgb21pdHMgdHJhaWxpbmcgcGFyYWdyYXBoIGNoYXIKLSAgICAgICAgICAgIGZsb2F0IHcgPSBtZWFzdXJlVGV4dChwYWludCwgd29ya1BhaW50LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZSwgaSwgbmV4dCwgbnVsbCwgdHJ1ZSwgbnVsbCk7CisgICAgICAgICAgICBmbG9hdCB3ID0gbWVhc3VyZVBhcmEocGFpbnQsIHdvcmtQYWludCwgc291cmNlLCBpLCBuZXh0KTsKIAogICAgICAgICAgICAgaWY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HRvbSkgewogICAgICAgICAgICAgYm90dG9tID0gZGJvdHRvbTsKICAgICAgICAgfQotICAgICAgICAKLSAgICAgICAgaW50IGZpcnN0ID0gZ2V0TGluZUZvclZlcnRpY2FsKHRvcCk7IAorCisgICAgICAgIGludCBmaXJzdCA9IGdldExpbmVGb3JWZXJ0aWNhbCh0b3ApOwogICAgICAgICBpbnQgbGFzdCA9IGdldExpbmVGb3JWZXJ0aWNhbChib3R0b20pOwotICAgICAgICAKKwogICAgICAgICBpbnQgcHJldmlvdXNMaW5lQm90dG9tID0gZ2V0TGluZVRvcChmaXJzdCk7CiAgICAgICAgIGludCBwcmV2aW91c0xpbmVFbmQgPSBnZXRMaW5lU3RhcnQoZmlyc3QpOwotICAgICAgICAKKwogICAgICAgICBUZXh0UGFpbnQgcGFpbnQgPSBtUGFpbnQ7CiAgICAgICAgIENoYXJTZXF1ZW5jZSBidWYgPSBtVGV4dDsKICAgICAgICAgaW50IHdpZHRoID0gbVdpZHRoOwogICAgICAgICBib29sZWFuIHNwYW5uZWRUZXh0ID0gbVNwYW5uZWRUZXh0OwogCiAgICAgICAgIFBhcmFncmFwaFN0eWxlW10gc3BhbnMgPSBOT19QQVJBX1NQQU5TOwotICAgICAgICBpbnQgc3BhbmVuZCA9IDA7CisgICAgICAgIGludCBzcGFuRW5kID0gMDsKICAgICAgICAgaW50IHRleHRMZW5ndGggPSAwOwogCiAgICAgICAgIC8vIEZpcnN0LCBkcmF3IExpbmVCYWNrZ3JvdW5kU3BhbnMuCi0gICAgICAgIC8vIExpbmVCYWNrZ3JvdW5kU3BhbnMga25vdyBub3RoaW5nIGFib3V0IHRoZSBhbGlnbm1lbnQgb3IgZGlyZWN0aW9uIG9mCi0gICAgICAgIC8vIHRoZSBsYXlvdXQgb3IgbGluZS4gIFhYWDogU2hvdWxkIHRoZXk/CisgICAgICAgIC8vIExpbmVCYWNrZ3JvdW5kU3BhbnMga25vdyBub3RoaW5nIGFib3V0IHRoZSBhbGlnbm1lbnQsIG1hcmdpbnMsIG9yCisgICAgICAgIC8vIGRpcmVjdGlvbiBvZiB0aGUgbGF5b3V0IG9yIGxpbmUuICBYWFg6IFNob3VsZCB0aGV5PworICAgICAgICAvLyBUaGV5IGFyZSBldmFsdWF0ZWQgYXQgZWFjaCBsaW5lLgogICAgICAgICBpZiAoc3Bhbm5lZFRleHQpIHsKKyAgICAgICAgICAgIFNwYW5uZWQgc3AgPSAoU3Bhbm5lZCkgYnVmOwogICAgICAgICAgICAgdGV4dExlbmd0aCA9IGJ1Zi5sZW5ndGgoKTsKICAgICAgICAgICAgIGZvciAoaW50IGkgPSBmaXJzdDsgaSA8PSBsYXN0OyBpKyspIHsKICAgICAgICAgICAgICAgICBpbnQgc3RhcnQgPSBwcmV2aW91c0xpbmVFbmQ7CkBAIC0yMTYsMTIgKzIyNywxNCBAQAogICAgICAgICAgICAgICAgIHByZXZpb3VzTGluZUJvdHRvbSA9IGxib3R0b207CiAgICAgICAgICAgICAgICAgaW50IGxiYXNlbGluZSA9IGxib3R0b20gLSBnZXRMaW5lRGVzY2VudChpKTsKIAotICAgICAgICAgICAgICAgIGlmIChzdGFydCA+PSBzcGFuZW5kKSB7Ci0gICAgICAgICAgICAgICAgICAgU3Bhbm5lZCBzcCA9IChTcGFubmVkKSBidWY7Ci0gICAgICAgICAgICAgICAgICAgc3BhbmVuZCA9IHNwLm5leHRTcGFuVHJhbnNpdGlvbihzdGFydCwgdGV4dExlbmd0aCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExpbmVCYWNrZ3JvdW5kU3Bhbi5jbGFzcyk7Ci0gICAgICAgICAgICAgICAgICAgc3BhbnMgPSBzcC5nZXRTcGFucyhzdGFydCwgc3BhbmVuZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExpbmVCYWNrZ3JvdW5kU3Bhbi5jbGFzcyk7CisgICAgICAgICAgICAgICAgaWYgKHN0YXJ0ID49IHNwYW5FbmQpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gVGhlc2Ugc2hvdWxkIGJlIGluZnJlcXVlbnQsIHNvIHdlJ2xsIHVzZSB0aGlzIHNvIHRoYXQKKyAgICAgICAgICAgICAgICAgICAgLy8gd2UgZG9uJ3QgaGF2ZSB0byBjaGVjayBhcyBvZnRlbi4KKyAgICAgICAgICAgICAgICAgICAgc3BhbkVuZCA9IHNwLm5leHRTcGFuVHJhbnNpdGlvbihzdGFydCwgdGV4dExlbmd0aCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBMaW5lQmFja2dyb3VuZFNwYW4uY2xhc3MpOworICAgICAgICAgICAgICAgICAgICAvLyBBbGwgTGluZUJhY2tncm91bmRTcGFucyBvbiBhIGxpbmUgY29udHJpYnV0ZSB0byBpdHMKKyAgICAgICAgICAgICAgICAgICAgLy8gYmFja2dyb3VuZC4KKyAgICAgICAgICAgICAgICAgICBzcGFucyA9IGdldFBhcmFncmFwaFNwYW5zKHNwLCBzdGFydCwgZW5kLCBMaW5lQmFja2dyb3VuZFNwYW4uY2xhc3MpOwogICAgICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgICAgIGZvciAoaW50IG4gPSAwOyBuIDwgc3BhbnMubGVuZ3RoOyBuKyspIHsKQEAgLTIzNCwxMSArMjQ3LDExIEBACiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICAgICAgLy8gcmVzZXQgdG8gdGhlaXIgb3JpZ2luYWwgdmFsdWVzCi0gICAgICAgICAgICBzcGFuZW5kID0gMDsKKyAgICAgICAgICAgIHNwYW5FbmQgPSAwOwogICAgICAgICAgICAgcHJldmlvdXNMaW5lQm90dG9tID0gZ2V0TGluZVRvcChmaXJzdCk7CiAgICAgICAgICAgICBwcmV2aW91c0xpbmVFbmQgPSBnZXRMaW5lU3RhcnQoZmlyc3QpOwogICAgICAgICAgICAgc3BhbnMgPSBOT19QQVJBX1NQQU5TOwotICAgICAgICB9IAorICAgICAgICB9Ci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gICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgLy8gTmV3IGJhdGNoIG9mIHBhcmFncmFwaCBzdHlsZXMsIGNvbXB1dGUgdGhlIGFsaWdubWVudC4KLSAgICAgICAgICAgICAgICAvLyBMYXN0IGFsaWdubWVudCBzdHlsZSB3aW5zLgotICAgICAgICAgICAgICAgIGlmIChzdGFydCA+PSBzcGFuZW5kKSB7Ci0gICAgICAgICAgICAgICAgICAgIFNwYW5uZWQgc3AgPSAoU3Bhbm5lZCkgYnVmOwotICAgICAgICAgICAgICAgICAgICBzcGFuZW5kID0gc3AubmV4dFNwYW5UcmFuc2l0aW9uKHN0YXJ0LCB0ZXh0TGVuZ3RoLAorICAgICAgICAgICAgaW50IGRpciA9IGdldFBhcmFncmFwaERpcmVjdGlvbihpKTsKKyAgICAgICAgICAgIGludCBsZWZ0ID0gMDsKKyAgICAgICAgICAgIGludCByaWdodCA9IG1XaWR0aDsKKworICAgICAgICAgICAgaWYgKHNwYW5uZWRUZXh0KSB7CisgICAgICAgICAgICAgICAgU3Bhbm5lZCBzcCA9IChTcGFubmVkKSBidWY7CisgICAgICAgICAgICAgICAgYm9vbGVhbiBpc0ZpcnN0UGFyYUxpbmUgPSAoc3RhcnQgPT0gMCB8fAorICAgICAgICAgICAgICAgICAgICAgICAgYnVmLmNoYXJBdChzdGFydCAtIDEpID09ICdcbicpOworCisgICAgICAgICAgICAgICAgLy8gTmV3IGJhdGNoIG9mIHBhcmFncmFwaCBzdHlsZXMsIGNvbGxlY3QgaW50byBzcGFucyBhcnJheS4KKyAgICAgICAgICAgICAgICAvLyBDb21wdXRlIHRoZSBhbGlnbm1lbnQsIGxhc3QgYWxpZ25tZW50IHN0eWxlIHdpbnMuCisgICAgICAgICAgICAgICAgLy8gUmVzZXQgdGFiU3RvcHMsIHdlJ2xsIHJlYnVpbGQgaWYgd2UgZW5jb3VudGVyIGEgbGluZSB3aXRoCisgICAgICAgICAgICAgICAgLy8gdGFicy4KKyAgICAgICAgICAgICAgICAvLyBXZSBleHBlY3QgcGFyYWdyYXBoIHNwYW5zIHRvIGJlIHJlbGF0aXZlbHkgaW5mcmVxdWVudCwgdXNlCisgICAgICAgICAgICAgICAgLy8gc3BhbkVuZCBzbyB0aGF0IHdlIGNhbiBjaGVjayBsZXNzIGZyZXF1ZW50bHkuICBTaW5jZQorICAgICAgICAgICAgICAgIC8vIHBhcmFncmFwaCBzdHlsZXMgb3VnaHQgdG8gYXBwbHkgdG8gZW50aXJlIHBhcmFncmFwaHMsIHdlIGNhbgorICAgICAgICAgICAgICAgIC8vIGp1c3QgY29sbGVjdCB0aGUgb25lcyBwcmVzZW50IGF0IHRoZSBzdGFydCBvZiB0aGUgcGFyYWdyYXBoLgorICAgICAgICAgICAgICAgIC8vIElmIHNwYW5FbmQgaXMgYmVmb3JlIHRoZSBlbmQgb2YgdGhlIHBhcmFncmFwaCwgdGhhdCdzIG5vdAorICAgICAgICAgICAgICAgIC8vIG91ciBwcm9ibGVtLgorICAgICAgICAgICAgICAgIGlmIChzdGFydCA+PSBzcGFuRW5kICYmIChpID09IGZpcnN0IHx8IGlzRmlyc3RQYXJhTGluZSkpIHsKKyAgICAgICAgICAgICAgICAgICAgc3BhbkVuZCA9IHNwLm5leHRTcGFuVHJhbnNpdGlvbihzdGFydCwgdGV4dExlbmd0aCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQYXJhZ3JhcGhTdHlsZS5jbGFzcyk7Ci0gICAgICAgICAgICAgICAgICAgIHNwYW5zID0gc3AuZ2V0U3BhbnMoc3RhcnQsIHNwYW5lbmQsIFBhcmFncmFwaFN0eWxlLmNsYXNzKTsKLSAgICAgICAgICAgICAgICAgICAgCisgICAgICAgICAgICAgICAgICAgIHNwYW5zID0gZ2V0UGFyYWdyYXBoU3BhbnMoc3AsIHN0YXJ0LCBzcGFuRW5kLCBQYXJhZ3JhcGhTdHlsZS5jbGFzcyk7CisKICAgICAgICAgICAgICAgICAgICAgYWxpZ24gPSBtQWxpZ25tZW50OwogICAgICAgICAgICAgICAgICAgICBmb3IgKGludCBuID0gc3BhbnMubGVuZ3RoLTE7IG4gPj0gMDsgbi0tKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoc3BhbnNbbl0gaW5zdGFuY2VvZiBBbGlnbm1lbnRTcGFuKSB7CkBAIC0yOTAsNDUgKzMxOCw0OSBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICAgICAgCi0gICAgICAgICAgICBpbnQgZGlyID0gZ2V0UGFyYWdyYXBoRGlyZWN0aW9uKGkpOwotICAgICAgICAgICAgaW50IGxlZnQgPSAwOwotICAgICAgICAgICAgaW50IHJpZ2h0ID0gbVdpZHRoOwogCi0gICAgICAgICAgICAvLyBEcmF3IGFsbCBsZWFkaW5nIG1hcmdpbiBzcGFucy4gIEFkanVzdCBsZWZ0IG9yIHJpZ2h0IGFjY29yZGluZwotICAgICAgICAgICAgLy8gdG8gdGhlIHBhcmFncmFwaCBkaXJlY3Rpb24gb2YgdGhlIGxpbmUuCi0gICAgICAgICAgICBpZiAoc3Bhbm5lZFRleHQpIHsKKyAgICAgICAgICAgICAgICAgICAgdGFiU3RvcHNJc0luaXRpYWxpemVkID0gZmFsc2U7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgLy8gRHJhdyBhbGwgbGVhZGluZyBtYXJnaW4gc3BhbnMuICBBZGp1c3QgbGVmdCBvciByaWdodCBhY2NvcmRpbmcKKyAgICAgICAgICAgICAgICAvLyB0byB0aGUgcGFyYWdyYXBoIGRpcmVjdGlvbiBvZiB0aGUgbGluZS4KICAgICAgICAgICAgICAgICBmaW5hbCBpbnQgbGVuZ3RoID0gc3BhbnMubGVuZ3RoOwogICAgICAgICAgICAgICAgIGZvciAoaW50IG4gPSAwOyBuIDwgbGVuZ3RoOyBuKyspIHsKICAgICAgICAgICAgICAgICAgICAgaWYgKHNwYW5zW25dIGluc3RhbmNlb2YgTGVhZGluZ01hcmdpblNwYW4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgIExlYWRpbmdNYXJnaW5TcGFuIG1hcmdpbiA9IChMZWFkaW5nTWFyZ2luU3Bhbikgc3BhbnNbbl07CisgICAgICAgICAgICAgICAgICAgICAgICBib29sZWFuIHVzZUZpcnN0TGluZU1hcmdpbiA9IGlzRmlyc3RQYXJhTGluZTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtYXJnaW4gaW5zdGFuY2VvZiBMZWFkaW5nTWFyZ2luU3BhbjIpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgY291bnQgPSAoKExlYWRpbmdNYXJnaW5TcGFuMikgbWFyZ2luKS5nZXRMZWFkaW5nTWFyZ2luTGluZUNvdW50KCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHN0YXJ0TGluZSA9IGdldExpbmVGb3JPZmZzZXQoc3AuZ2V0U3BhblN0YXJ0KG1hcmdpbikpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVzZUZpcnN0TGluZU1hcmdpbiA9IGkgPCBzdGFydExpbmUgKyBjb3VudDsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRpciA9PSBESVJfUklHSFRfVE9fTEVGVCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1hcmdpbi5kcmF3TGVhZGluZ01hcmdpbihjLCBwYWludCwgcmlnaHQsIGRpciwgbHRvcCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGJhc2VsaW5lLCBsYm90dG9tLCBidWYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0LCBlbmQsIGlzRmlyc3RQYXJhTGluZSwgdGhpcyk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJpZ2h0IC09IG1hcmdpbi5nZXRMZWFkaW5nTWFyZ2luKGlzRmlyc3RQYXJhTGluZSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmlnaHQgLT0gbWFyZ2luLmdldExlYWRpbmdNYXJnaW4odXNlRmlyc3RMaW5lTWFyZ2luKTsKICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFyZ2luLmRyYXdMZWFkaW5nTWFyZ2luKGMsIHBhaW50LCBsZWZ0LCBkaXIsIGx0b3AsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxiYXNlbGluZSwgbGJvdHRvbSwgYnVmLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGFydCwgZW5kLCBpc0ZpcnN0UGFyYUxpbmUsIHRoaXMpOwotCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbGVhbiB1c2VNYXJnaW4gPSBpc0ZpcnN0UGFyYUxpbmU7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1hcmdpbiBpbnN0YW5jZW9mIExlYWRpbmdNYXJnaW5TcGFuLkxlYWRpbmdNYXJnaW5TcGFuMikgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgY291bnQgPSAoKExlYWRpbmdNYXJnaW5TcGFuLkxlYWRpbmdNYXJnaW5TcGFuMiltYXJnaW4pLmdldExlYWRpbmdNYXJnaW5MaW5lQ291bnQoKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXNlTWFyZ2luID0gY291bnQgPiBpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZWZ0ICs9IG1hcmdpbi5nZXRMZWFkaW5nTWFyZ2luKHVzZU1hcmdpbik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGVmdCArPSBtYXJnaW4uZ2V0TGVhZGluZ01hcmdpbih1c2VGaXJzdExpbmVNYXJnaW4pOwogICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogCi0gICAgICAgICAgICAvLyBBZGp1c3QgdGhlIHBvaW50IGF0IHdoaWNoIHRvIHN0YXJ0IHJlbmRlcmluZyBkZXBlbmRpbmcgb24gdGhlCi0gICAgICAgICAgICAvLyBhbGlnbm1lbnQgb2YgdGhlIHBhcmFncmFwaC4KKyAgICAgICAgICAgIGJvb2xlYW4gaGFzVGFiT3JFbW9qaSA9IGdldExpbmVDb250YWluc1RhYihpKTsKKyAgICAgICAgICAgIC8vIENhbid0IHRlbGwgaWYgd2UgaGF2ZSB0YWJzIGZvciBzdXJlLCBjdXJyZW50bHkKKyAgICAgICAgICAgIGlmIChoYXNUYWJPckVtb2ppICYmICF0YWJTdG9wc0lzSW5pdGlhbGl6ZWQpIHsKKyAgICAgICAgICAgICAgICBpZiAodGFiU3RvcHMgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICB0YWJTdG9wcyA9IG5ldyBUYWJTdG9wcyhUQUJfSU5DUkVNRU5ULCBzcGFucyk7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgdGFiU3RvcHMucmVzZXQoVEFCX0lOQ1JFTUVOVCwgc3BhbnMpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB0YWJTdG9wc0lzSW5pdGlhbGl6ZWQgPSB0cnVlOworICAgICAgICAgICAgfQorCiAgICAgICAgICAgICBpbnQgeDsKICAgICAgICAgICAgIGlmIChhbGlnbiA9PSBBbGlnbm1lbnQuQUxJR05fTk9STUFMKSB7CiAgICAgICAgICAgICAgICAgaWYgKGRpciA9PSBESVJfTEVGVF9UT19SSUdIVCkgewpAQCAtMzM3LDQxICszNjksODAgQEAKICAgICAgICAgICAgICAgICAgICAgeCA9IHJpZ2h0OwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgaW50IG1heCA9IChpbnQpZ2V0TGluZU1heChpLCBzcGFucywgZmFsc2UpOworICAgICAgICAgICAgICAgIGludCBtYXggPSAoaW50KWdldExpbmVFeHRlbnQoaSwgdGFiU3RvcHMsIGZhbHNlKTsKICAgICAgICAgICAgICAgICBpZiAoYWxpZ24gPT0gQWxpZ25tZW50LkFMSUdOX09QUE9TSVRFKSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChkaXIgPT0gRElSX1JJR0hUX1RPX0xFRlQpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHggPSBsZWZ0ICsgbWF4OwotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICBpZiAoZGlyID09IERJUl9MRUZUX1RPX1JJR0hUKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICB4ID0gcmlnaHQgLSBtYXg7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAvLyBBbGlnbm1lbnQuQUxJR05fQ0VOVEVSCi0gICAgICAgICAgICAgICAgICAgIG1heCA9IG1heCAmIH4xOwotICAgICAgICAgICAgICAgICAgICBpbnQgaGFsZiA9IChyaWdodCAtIGxlZnQgLSBtYXgpID4+IDE7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChkaXIgPT0gRElSX1JJR0hUX1RPX0xFRlQpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHggPSByaWdodCAtIGhhbGY7CiAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICB4ID0gbGVmdCArIGhhbGY7CisgICAgICAgICAgICAgICAgICAgICAgICB4ID0gbGVmdCAtIG1heDsKICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0gZWxzZSB7IC8vIEFsaWdubWVudC5BTElHTl9DRU5URVIKKyAgICAgICAgICAgICAgICAgICAgbWF4ID0gbWF4ICYgfjE7CisgICAgICAgICAgICAgICAgICAgIHggPSAocmlnaHQgKyBsZWZ0IC0gbWF4KSA+PiAxOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgRGlyZWN0aW9ucyBkaXJlY3Rpb25zID0gZ2V0TGluZURpcmVjdGlvbnMoaSk7Ci0gICAgICAgICAgICBib29sZWFuIGhhc1RhYiA9IGdldExpbmVDb250YWluc1RhYihpKTsKICAgICAgICAgICAgIGlmIChkaXJlY3Rpb25zID09IERJUlNfQUxMX0xFRlRfVE9fUklHSFQgJiYKLSAgICAgICAgICAgICAgICAgICAgIXNwYW5uZWRUZXh0ICYmICFoYXNUYWIpIHsKLSAgICAgICAgICAgICAgICBpZiAoREVCVUcpIHsKLSAgICAgICAgICAgICAgICAgICAgQXNzZXJ0LmFzc2VydFRydWUoZGlyID09IERJUl9MRUZUX1RPX1JJR0hUKTsKLSAgICAgICAgICAgICAgICAgICAgQXNzZXJ0LmFzc2VydE5vdE51bGwoYyk7Ci0gICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAhc3Bhbm5lZFRleHQgJiYgIWhhc1RhYk9yRW1vamkpIHsKICAgICAgICAgICAgICAgICAvLyBYWFg6IGFzc3VtZXMgdGhlcmUncyBub3RoaW5nIGFkZGl0aW9uYWwgdG8gYmUgZG9uZQogICAgICAgICAgICAgICAgIGMuZHJhd1RleHQoYnVmLCBzdGFydCwgZW5kLCB4LCBsYmFzZWxpbmUsIHBhaW50KTsKICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgIC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HsKKyAgICAgICAgLy8gQWRqdXN0IHRoZSBwb2ludCBhdCB3aGljaCB0byBzdGFydCByZW5kZXJpbmcgZGVwZW5kaW5nIG9uIHRoZQorICAgICAgICAvLyBhbGlnbm1lbnQgb2YgdGhlIHBhcmFncmFwaC4KKyAgICAgICAgQWxpZ25tZW50IGFsaWduID0gZ2V0UGFyYWdyYXBoQWxpZ25tZW50KGxpbmUpOworICAgICAgICBpbnQgZGlyID0gZ2V0UGFyYWdyYXBoRGlyZWN0aW9uKGxpbmUpOworCisgICAgICAgIGludCB4OworICAgICAgICBpZiAoYWxpZ24gPT0gQWxpZ25tZW50LkFMSUdOX05PUk1BTCkgeworICAgICAgICAgICAgaWYgKGRpciA9PSBESVJfTEVGVF9UT19SSUdIVCkgeworICAgICAgICAgICAgICAgIHggPSBsZWZ0OworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICB4ID0gcmlnaHQ7CisgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBUYWJTdG9wcyB0YWJTdG9wcyA9IG51bGw7CisgICAgICAgICAgICBpZiAobVNwYW5uZWRUZXh0ICYmIGdldExpbmVDb250YWluc1RhYihsaW5lKSkgeworICAgICAgICAgICAgICAgIFNwYW5uZWQgc3Bhbm5lZCA9IChTcGFubmVkKSBtVGV4dDsKKyAgICAgICAgICAgICAgICBpbnQgc3RhcnQgPSBnZXRMaW5lU3RhcnQobGluZSk7CisgICAgICAgICAgICAgICAgaW50IHNwYW5FbmQgPSBzcGFubmVkLm5leHRTcGFuVHJhbnNpdGlvbihzdGFydCwgc3Bhbm5lZC5sZW5ndGgoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgIFRhYlN0b3BTcGFuLmNsYXNzKTsKKyAgICAgICAgICAgICAgICBUYWJTdG9wU3BhbltdIHRhYlNwYW5zID0gZ2V0UGFyYWdyYXBoU3BhbnMoc3Bhbm5lZCwgc3RhcnQsIHNwYW5FbmQsIFRhYlN0b3BTcGFuLmNsYXNzKTsKKyAgICAgICAgICAgICAgICBpZiAodGFiU3BhbnMubGVuZ3RoID4gMCkgeworICAgICAgICAgICAgICAgICAgICB0YWJTdG9wcyA9IG5ldyBUYWJTdG9wcyhUQUJfSU5DUkVNRU5ULCB0YWJTcGFucyk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgaW50IG1heCA9IChpbnQpZ2V0TGluZUV4dGVudChsaW5lLCB0YWJTdG9wcywgZmFsc2UpOworICAgICAgICAgICAgaWYgKGFsaWduID09IEFsaWdubWVudC5BTElHTl9PUFBPU0lURSkgeworICAgICAgICAgICAgICAgIGlmIChkaXIgPT0gRElSX0xFRlRfVE9fUklHSFQpIHsKKyAgICAgICAgICAgICAgICAgICAgeCA9IHJpZ2h0IC0gbWF4OworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIHggPSBsZWZ0IC0gbWF4OworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gZWxzZSB7IC8vIEFsaWdubWVudC5BTElHTl9DRU5URVIKKyAgICAgICAgICAgICAgICBtYXggPSBtYXggJiB+MTsKKyAgICAgICAgICAgICAgICB4ID0gKGxlZnQgKyByaWdodCAtIG1heCkgPj4gMTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4geDsKICAgICB9CiAKICAgICAvKioKQEAgLTQxNyw3ICs0ODgsNyBAQAogCiAgICAgICAgIG1XaWR0aCA9IHdpZDsKICAgICB9Ci0gICAgCisKICAgICAvKioKICAgICAgKiBSZXR1cm4gdGhlIHRvdGFsIGhlaWdodCBvZiB0aGlzIGxheW91dC4KICAgICAgKi8KQEAgLTQ1MCw3ICs1MjEsNyBAQAogICAgICAqIFJldHVybiB0aGUgbnVtYmVyIG9mIGxpbmVzIG9mIHRleHQgaW4gdGhpcyBsYXlvdXQuCiAgICAgICovCiAgICAgcHVibGljIGFic3RyYWN0IGludCBnZX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IGdldExpbmVTdGFydChsaW5lKTsKKyAgICAgICAgaW50IGxpbmVFbmQgPSBnZXRMaW5lRW5kKGxpbmUpOworICAgICAgICBpZiAob2Zmc2V0ID09IGxpbmVTdGFydCB8fCBvZmZzZXQgPT0gbGluZUVuZCkgeworICAgICAgICAgICAgaW50IHBhcmFMZXZlbCA9IGdldFBhcmFncmFwaERpcmVjdGlvbihsaW5lKSA9PSAxID8gMCA6IDE7CisgICAgICAgICAgICBpbnQgcnVuSW5kZXggPSBvZmZzZXQgPT0gbGluZVN0YXJ0ID8gMCA6IHJ1bnMubGVuZ3RoIC0gMjsKKyAgICAgICAgICAgIHJldHVybiAoKHJ1bnNbcnVuSW5kZXggKyAxXSA+Pj4gUlVOX0xFVkVMX1NISUZUKSAmIFJVTl9MRVZFTF9NQVNLKSAhPSBwYXJhTGV2ZWw7CisgICAgICAgIH0KKworICAgICAgICBvZmZzZXQgLT0gbGluZVN0YXJ0OworICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IHJ1bnMubGVuZ3RoOyBpICs9IDIpIHsKKyAgICAgICAgICAgIGlmIChvZmZzZXQgPT0gcnVuc1tpXSkgeworICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKKyAgICBwcml2YXRlIGJvb2xlYW4gcHJpbWFyeUlzVHJhaWxpbmdQcmV2aW91cyhpbnQgb2Zmc2V0KSB7CisgICAgICAgIGludCBsaW5lID0gZ2V0TGluZUZvck9mZnNldChvZmZzZXQpOworICAgICAgICBpbnQgbGluZVN0YXJ0ID0gZ2V0TGluZVN0YXJ0KGxpbmUpOworICAgICAgICBpbnQgbGluZUVuZCA9IGdldExpbmVFbmQobGluZSk7CisgICAgICAgIGludFtdIHJ1bnMgPSBnZXRMaW5lRGlyZWN0aW9ucyhsaW5lKS5tRGlyZWN0aW9uczsKKworICAgICAgICBpbnQgbGV2ZWxBdCA9IC0xOworICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IHJ1bnMubGVuZ3RoOyBpICs9IDIpIHsKKyAgICAgICAgICAgIGludCBzdGFydCA9IGxpbmVTdGFydCArIHJ1bnNbaV07CisgICAgICAgICAgICBpbnQgbGltaXQgPSBzdGFydCArIChydW5zW2krMV0gJiBSVU5fTEVOR1RIX01BU0spOworICAgICAgICAgICAgaWYgKGxpbWl0ID4gbGluZUVuZCkgeworICAgICAgICAgICAgICAgIGxpbWl0ID0gbGluZUVuZDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChvZmZzZXQgPj0gc3RhcnQgJiYgb2Zmc2V0IDwgbGltaXQpIHsKKyAgICAgICAgICAgICAgICBpZiAob2Zmc2V0ID4gc3RhcnQpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gUHJldmlvdXMgY2hhcmFjdGVyIGlzIGF0IHNhbWUgbGV2ZWwsIHNvIGRvbid0IHVzZSB0cmFpbGluZy4KKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBsZXZlbEF0ID0gKHJ1bnNbaSsxXSA+Pj4gUlVOX0xFVkVMX1NISUZUKSAmIFJVTl9MRVZFTF9NQVNLOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGlmIChsZXZlbEF0ID09IC0xKSB7CisgICAgICAgICAgICAvLyBPZmZzZXQgd2FzIGxpbWl0IG9mIGxpbmUuCisgICAgICAgICAgICBsZXZlbEF0ID0gZ2V0UGFyYWdyYXBoRGlyZWN0aW9uKGxpbmUpID09IDEgPyAwIDogMTsKKyAgICAgICAgfQorCisgICAgICAgIC8vIEF0IGxldmVsIGJvdW5kYXJ5LCBjaGVjayBwcmV2aW91cyBsZXZlbC4KKyAgICAgICAgaW50IGxldmVsQmVmb3JlID0gLTE7CisgICAgICAgIGlmIChvZmZzZXQgPT0gbGluZVN0YXJ0KSB7CisgICAgICAgICAgICBsZXZlbEJlZm9yZSA9IGdldFBhcmFncmFwaERpcmVjdGlvbihsaW5lKSA9PSAxID8gMCA6IDE7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBvZmZzZXQgLT0gMTsKKyAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgcnVucy5sZW5ndGg7IGkgKz0gMikgeworICAgICAgICAgICAgICAgIGludCBzdGFydCA9IGxpbmVTdGFydCArIHJ1bnNbaV07CisgICAgICAgICAgICAgICAgaW50IGxpbWl0ID0gc3RhcnQgKyAocnVuc1tpKzFdICYgUlVOX0xFTkdUSF9NQVNLKTsKKyAgICAgICAgICAgICAgICBpZiAobGltaXQgPiBsaW5lRW5kKSB7CisgICAgICAgICAgICAgICAgICAgIGxpbWl0ID0gbGluZUVuZDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKG9mZnNldCA+PSBzdGFydCAmJiBvZmZzZXQgPCBsaW1pdCkgeworICAgICAgICAgICAgICAgICAgICBsZXZlbEJlZm9yZSA9IChydW5zW2krMV0gPj4+IFJVTl9MRVZFTF9TSElGVCkgJiBSVU5fTEVWRUxfTUFTSzsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcmV0dXJuIGxldmVsQmVmb3JlIDwgbGV2ZWxBdDsKKyAgICB9CisKICAgICAvKioKICAgICAgKiBHZXQgdGhlIHByaW1hcnkgaG9yaXpvbnRhbCBwb3NpdGlvbiBmb3IgdGhlIHNwZWNpZmllZCB0ZXh0IG9mZnNldC4KICAgICAgKiBUaGlzIGlzIHRoZSBsb2NhdGlvbiB3aGVyZSBhIG5ldyBjaGFyYWN0ZXIgd291bGQgYmUgaW5zZXJ0ZWQgaW4KICAgICAgKiB0aGUgcGFyYWdyYXBoJ3MgcHJpbWFyeSBkaXJlY3Rpb24uCi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gICAgICAgICAgICAgICAgd2lkIC09IG1lYXN1cmVUZXh0KG1QYWludCwgbVdvcmtQYWludCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVRleHQsIGVuZCwgb2Zmc2V0LCBudWxsLCB0YWIsIHRhYnMpOwotICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgIHdpZCArPSBtZWFzdXJlVGV4dChtUGFpbnQsIG1Xb3JrUGFpbnQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1UZXh0LCBlbmQsIG9mZnNldCwgbnVsbCwgdGFiLCB0YWJzKTsKLSAgICAgICAgfQotCi0gICAgICAgIEFsaWdubWVudCBhbGlnbiA9IGdldFBhcmFncmFwaEFsaWdubWVudChsaW5lKTsKICAgICAgICAgaW50IGxlZnQgPSBnZXRQYXJhZ3JhcGhMZWZ0KGxpbmUpOwogICAgICAgICBpbnQgcmlnaHQgPSBnZXRQYXJhZ3JhcGhSaWdodChsaW5lKTsKIAotICAgICAgICBpZiAoYWxpZ24gPT0gQWxpZ25tZW50LkFMSUdOX05PUk1BTCkgewotICAgICAgICAgICAgaWYgKGRpciA9PSBESVJfUklHSFRfVE9fTEVGVCkKLSAgICAgICAgICAgICAgICByZXR1cm4gcmlnaHQgKyB3aWQ7Ci0gICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICAgICAgcmV0dXJuIGxlZnQgKyB3aWQ7Ci0gICAgICAgIH0KLQotICAgICAgICBmbG9hdCBtYXggPSBnZXRMaW5lTWF4KGxpbmUpOwotCi0gICAgICAgIGlmIChhbGlnbiA9PSBBbGlnbm1lbnQuQUxJR05fT1BQT1NJVEUpIHsKLSAgICAgICAgICAgIGlmIChkaXIgPT0gRElSX1JJR0hUX1RPX0xFRlQpCi0gICAgICAgICAgICAgICAgcmV0dXJuIGxlZnQgKyBtYXggKyB3aWQ7Ci0gICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICAgICAgcmV0dXJuIHJpZ2h0IC0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lY3ljbGUodGwpOworICAgICAgICByZXR1cm4gd2lkdGg7CisgICAgfQorCisgICAgLyoqCisgICAgICogUmV0dXJucyB0aGUgc2lnbmVkIGhvcml6b250YWwgZXh0ZW50IG9mIHRoZSBzcGVjaWZpZWQgbGluZSwgZXhjbHVkaW5nCisgICAgICogbGVhZGluZyBtYXJnaW4uICBJZiBmdWxsIGlzIGZhbHNlLCBleGNsdWRlcyB0cmFpbGluZyB3aGl0ZXNwYWNlLgorICAgICAqIEBwYXJhbSBsaW5lIHRoZSBpbmRleCBvZiB0aGUgbGluZQorICAgICAqIEBwYXJhbSB0YWJTdG9wcyB0aGUgdGFiIHN0b3BzLCBjYW4gYmUgbnVsbCBpZiB3ZSBrbm93IHRoZXkncmUgbm90IHVzZWQuCisgICAgICogQHBhcmFtIGZ1bGwgd2hldGhlciB0byBpbmNsdWRlIHRyYWlsaW5nIHdoaXRlc3BhY2UKKyAgICAgKiBAcmV0dXJuIHRoZSBleHRlbnQgb2YgdGhlIHRleHQgb24gdGhpcyBsaW5lCisgICAgICovCisgICAgcHJpdmF0ZSBmbG9hdCBnZXRMaW5lRXh0ZW50KGludCBsaW5lLCBUYWJTdG9wcyB0YWJTdG9wcywgYm9vbGVhbiBmdWxsKSB7CisgICAgICAgIGludCBzdGFydCA9IGdldExpbmVTdGFydChsaW5lKTsKKyAgICAgICAgaW50IGVuZCA9IGZ1bGwgPyBnZXRMaW5lRW5kKGxpbmUpIDogZ2V0TGluZVZpc2libGVFbmQobGluZSk7CisgICAgICAgIGJvb2xlYW4gaGFzVGFic09yRW1vamkgPSBnZXRMaW5lQ29udGFpbnNUYWIobGluZSk7CisgICAgICAgIERpcmVjdGlvbnMgZGlyZWN0aW9ucyA9IGdldExpbmVEaXJlY3Rpb25zKGxpbmUpOworICAgICAgICBpbnQgZGlyID0gZ2V0UGFyYWdyYXBoRGlyZWN0aW9uKGxpbmUpOworCisgICAgICAgIFRleHRMaW5lIHRsID0gVGV4dExpbmUub2J0YWluKCk7Cis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m9yIChpbnQgaSA9IDA7IGkgPCBkaXJzLm1EaXJlY3Rpb25zLmxlbmd0aDsgaSsrKSB7Ci0gICAgICAgICAgICBpbnQgdGhlcmUgPSBoZXJlICsgZGlycy5tRGlyZWN0aW9uc1tpXTsKLSAgICAgICAgICAgIGludCBzd2FwID0gKChpICYgMSkgPT0gMCkgPyAxIDogLTE7CisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgZGlycy5tRGlyZWN0aW9ucy5sZW5ndGg7IGkgKz0gMikgeworICAgICAgICAgICAgaW50IGhlcmUgPSBtaW4gKyBkaXJzLm1EaXJlY3Rpb25zW2ldOworICAgICAgICAgICAgaW50IHRoZXJlID0gaGVyZSArIChkaXJzLm1EaXJlY3Rpb25zW2krMV0gJiBSVU5fTEVOR1RIX01BU0spOworICAgICAgICAgICAgaW50IHN3YXAgPSAoZGlycy5tRGlyZWN0aW9uc1tpKzFdICYgUlVOX1JUTF9GTEFHKSAhPSAwID8gLTEgOiAxOwogCiAgICAgICAgICAgICBpZiAodGhlcmUgPiBtYXgpCiAgICAgICAgICAgICAgICAgdGhlcmUgPSBtYXg7Ci0KICAgICAgICAgICAgIGludCBoaWdoID0gdGhlcmUgLSAxICsgMSwgbG93ID0gaGVyZSArIDEgLSAxLCBndWVzczsKIAogICAgICAgICAgICAgd2hpbGUgKGhpZ2ggLSBsb3cgPiAxKSB7CkBAIC03OTUsNyArOTU4LDcgQEAKIAogICAgICAgICAgICAgICAgIGlmIChkaXN0IDwgYmVzdGRpc3QpIHsKICAgICAgICAgICAgICAgICAgICAgYmVzdGRpc3QgPSBkaXN0OwotICAgICAgICAgICAgICAgICAgICBiZXN0ID0gbG93OyAgIAorICAgICAgICAgICAgICAgICAgICBiZXN0ID0gbG93OwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KIApAQCAtODA1LDggKzk2OCw2IEBACiAgICAgICAgICAgICAgICAgYmVzdGRpc3QgPSBkaXN0OwogICAgICAgICAgICAgICAgIGJlc3QgPSBoZXJlOwogICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBoZXJlID0gdGhlcmU7CiAgICAgICAgIH0KIAogICAgICAgICBmbG9hdCBkaXN0ID0gTWF0aC5hYnMoZ2V0UHJpbWFyeUhvcml6b250YWwobWF4KSAtIGhvcml6KTsKQEAgLTgyNiwxOSArOTg3LDE1IEBACiAgICAgICAgIHJldHVybiBnZXRMaW5lU3RhcnQobGluZSArIDEpOwogICAgIH0KIAotICAgIC8qKiAKKyAgICAvKioKICAgICAgKiBSZXR1cm4gdGhlIHRleHQgb2Zmc2V0IGFmdGVyIHRoZSBsYXN0IHZpc2libGUgY2hhcmFjdGVyIChzbyB3aGl0ZXNwYWNlCiAgICAgICogaXMgbm90IGNvdW50ZWQpIG9uIHRoZSBzcGVjaWZpZWQgbGluZS4KICAgICAgKi8KICAgICBwdWJsaWMgaW50IGdldExpbmVWaXNpYmxlRW5kKGludCBsaW5lKSB7CiAgICAgICAgIHJldHVybiBnZXRMaW5lVmlzaWJsZUVuZChsaW5lLCBnZXRMaW5lU3RhcnQobGluZSksIGdldExpbmVTdGFydChsaW5lKzEpKTsKICAgICB9Ci0gICAgCi0gICAgcHJpdmF0ZSBpbnQgZ2V0TGluZVZpc2libGVFbmQoaW50IGxpbmUsIGludCBzdGFydCwgaW50IGVuZCkgewotICAgICAgICBpZiAoREVCVUcpIHsKLSAgICAgICAgICAgIEFzc2VydC5hc3NlcnRUcnVlKGdldExpbmVTdGFydChsaW5lKSA9PSBzdGFydCAmJiBnZXRMaW5lU3RhcnQobGluZSsxKSA9PSBlbmQpOwotICAgICAgICB9CiAKKyAgICBwcml2YXRlIGludCBnZXRMaW5lVmlzaWJsZUVuZChpbnQgbGluZSwgaW50IHN0YXJ0LCBpbnQgZW5kKSB7CiAgICAgICAgIENoYXJTZXF1ZW5jZSB0ZXh0ID0gbVRleHQ7CiAgICAgICAgIGNoYXIgY2g7CiAgICAgICAgIGlmIChsaW5lID09IGdldExpbmVDb3VudCgpIC0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IHN0YXJ0ICYmIGNhbmRpZGF0ZSA8PSBlbmQpIHsKLSAgICAgICAgICAgIGZsb2F0IGggPSBnZXRQcmltYXJ5SG9yaXpvbnRhbChjYW5kaWRhdGUpOwotCi0gICAgICAgICAgICBpZiAoaCA8IGhvcml6ICYmIGggPiBiZXN0aCkgewotICAgICAgICAgICAgICAgIGJlc3QgPSBjYW5kaWRhdGU7Ci0gICAgICAgICAgICAgICAgYmVzdGggPSBoOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgY2FuZGlkYXRlID0gVGV4dFV0aWxzLmdldE9mZnNldEFmdGVyKG1UZXh0LCBvZmZzZXQpOwotICAgICAgICBpZiAoY2FuZGlkYXRlID49IHN0YXJ0ICYmIGNhbmRpZGF0ZSA8PSBlbmQpIHsKLSAgICAgICAgICAgIGZsb2F0IGggPSBnZXRQcmltYXJ5SG9yaXpvbnRhbChjYW5kaWRhdGUpOwotCi0gICAgICAgICAgICBpZiAoaCA8IGhvcml6ICYmIGggPiBiZXN0aCkgewotICAgICAgICAgICAgICAgIGJlc3QgPSBjYW5kaWRhdGU7Ci0gICAgICAgICAgICAgICAgYmVzdGggPSBoOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgaW50IGhlcmUgPSBzdGFydDsKLSAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBkaXJzLm1EaXJlY3Rpb25zLmxlbmd0aDsgaSsrKSB7Ci0gICAgICAgICAgICBpbnQgdGhlcmUgPSBoZXJlICsgZGlycy5tRGlyZWN0aW9uc1tpXTsKLSAgICAgICAgICAgIGlmICh0aGVyZSA+IGVuZCkKLSAgICAgICAgICAgICAgICB0aGVyZSA9IGVuZDsKLQotICAgICAgICAgICAgZmxvYXQgaCA9IGdldFByaW1hcnlIb3Jpem9udGFsKGhlcmUpOwotCi0gICAgICAgICAgICBpZiAoaCA8IGhvcml6ICYmIGggPiBiZXN0aCkgewotICAgICAgICAgICAgICAgIGJlc3QgPSBoZXJlOwotICAgICAgICAgICAgICAgIGJlc3RoID0gaDsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgY2FuZGlkYXRlID0gVGV4dFV0aWxzLmdldE9mZnNldEFmdGVyKG1UZXh0LCBoZXJlKTsKLSAgICAgICAgICAgIGlmIChjYW5kaWRhdGUgPj0gc3RhcnQgJiYgY2FuZGlkYXRlIDw9IGVuZCkgewotICAgICAgICAgICAgICAgIGggPSBnZXRQcmltYXJ5SG9yaXpvbnRhbChjYW5kaWRhdGUpOwotCi0gICAgICAgICAgICAgICAgaWYgKGggPCBob3JpeiAmJiBoID4gYmVzdGgpIHsKLSAgICAgICAgICAgICAgICAgICAgYmVzdCA9IGNhbmRpZGF0ZTsKLSAgICAgICAgICAgICAgICAgICAgYmVzdGggPSBoOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgY2FuZGlkYXRlID0gVGV4dFV0aWxzLmdldE9mZnNldEJlZm9yZShtVGV4dCwgdGhlcmUpOwotICAgICAgICAgICAgaWYgKGNhbmRpZGF0ZSA+PSBzdGFydCAmJiBjYW5kaWRhdGUgPD0gZW5kKSB7Ci0gICAgICAgICAgICAgICAgaCA9IGdldFByaW1hcnlIb3Jpem9udGFsKGNhbmRpZGF0ZSk7Ci0KLSAgICAgICAgICAgICAgICBpZiAoaCA8IGhvcml6ICYmIGggPiBiZXN0aCkgewotICAgICAgICAgICAgICAgICAgICBiZXN0ID0gY2FuZGlkYXRlOwotICAgICAgICAgICAgICAgICAgICBiZXN0aCA9IGg7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBoZXJlID0gdGhlcmU7Ci0gICAgICAgIH0KLQotICAgICAgICBmbG9hdCBoID0gZ2V0UHJpbWFyeUhvcml6b250YWwoZW5kKTsKLQotICAgICAgICBpZiAoaCA8IGhvcml6ICYmIGggPiBiZXN0aCkgewotICAgICAgICAgICAgYmVzdCA9IGVuZDsKLSAgICAgICAgICAgIGJlc3RoID0gaDsKLSAgICAgICAgfQotCi0gICAgICAgIGlmIChiZXN0ICE9IG9mZnNldCkKLSAgICAgICAgICAgIHJldHVybiBiZXN0OwotCi0gICAgICAgIGludCBkaXIgPSBnZXRQYXJhZ3JhcGhEaXJlY3Rpb24obGluZSk7Ci0KLSAgICAgICAgaWYgKGRpciA+IDApIHsKLSAgICAgICAgICAgIGlmIChsaW5lID09IDApCi0gICAgICAgICAgICAgICAgcmV0dXJuIGJlc3Q7Ci0gICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICAgICAgcmV0dXJuIGdldE9mZnNldEZvckhvcml6b250YWwobGluZSAtIDEsIDEwMDAwKTsKLSAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgIGlmIChsaW5lID09IGdldExpbmVDb3VudCgpIC0gMSkKLSAgICAgICAgICAgICAgICByZXR1cm4gYmVzdDsKLSAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgICAgICByZXR1cm4gZ2V0T2Zmc2V0Rm9ySG9yaXpvbnRhbChsaW5lICsgMSwgMTAwMDApOwotICAgICAgICB9CisgICAgICAgIHJldHVybiBnZXRPZmZzZXRUb0xlZnRSaWdodE9mKG9mZnNldCwgdHJ1ZSk7CiAgICAgfQogCi0gICAgLyoqCi0gICAgICogUmV0dXJuIHRoZSB0ZXh0IG9mZnNldCB0aGF0IHdvdWxkIGJlIHJlYWNoZWQgYnkgbW92aW5nIHJpZ2h0Ci0gICAgICogKHBvc3NpYmx5IG9udG8gYW5vdGhlciBsaW5lKSBmcm9tIHRoZSBzcGVjaWZpZWQgb2Zmc2V0LgotICAgICAqLwogICAgIHB1YmxpYyBpbnQgZ2V0T2Zmc2V0VG9SaWdodE9mKGludCBvZmZzZXQpIHsKLSAgICAgICAgaW50IGxpbmUgPSBnZXRMaW5lRm9yT2Zmc2V0KG9mZnNldCk7Ci0gICAgICAgIGludCBzdGFydCA9IGdldExpbmVTdGFydChsaW5lKTsKLSAgICAgICAg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WYgKGggPiBob3JpeiAmJiBoIDwgYmVzdGgpIHsKLSAgICAgICAgICAgICAgICBiZXN0ID0gY2FuZGlkYXRlOwotICAgICAgICAgICAgICAgIGJlc3RoID0gaDsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIGNhbmRpZGF0ZSA9IFRleHRVdGlscy5nZXRPZmZzZXRBZnRlcihtVGV4dCwgb2Zmc2V0KTsKLSAgICAgICAgaWYgKGNhbmRpZGF0ZSA+PSBzdGFydCAmJiBjYW5kaWRhdGUgPD0gZW5kKSB7Ci0gICAgICAgICAgICBmbG9hdCBoID0gZ2V0UHJpbWFyeUhvcml6b250YWwoY2FuZGlkYXRlKTsKLQotICAgICAgICAgICAgaWYgKGggPiBob3JpeiAmJiBoIDwgYmVzdGgpIHsKLSAgICAgICAgICAgICAgICBiZXN0ID0gY2FuZGlkYXRlOwotICAgICAgICAgICAgICAgIGJlc3RoID0gaDsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIGludCBoZXJlID0gc3RhcnQ7Ci0gICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgZGlycy5tRGlyZWN0aW9ucy5sZW5ndGg7IGkrKykgewotICAgICAgICAgICAgaW50IHRoZXJlID0gaGVyZSArIGRpcnMubURpcmVjdGlvbnNbaV07Ci0gICAgICAgICAgICBpZiAodGhlcmUgPiBlbmQpCi0gICAgICAgICAgICAgICAgdGhlcmUgPSBlbmQ7Ci0KLSAgICAgICAgICAgIGZsb2F0IGggPSBnZXRQcmltYXJ5SG9yaXpvbnRhbChoZXJlKTsKLQotICAgICAgICAgICAgaWYgKGggPiBob3JpeiAmJiBoIDwgYmVzdGgpIHsKLSAgICAgICAgICAgICAgICBiZXN0ID0gaGVyZTsKLSAgICAgICAgICAgICAgICBiZXN0aCA9IGg7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGNhbmRpZGF0ZSA9IFRleHRVdGlscy5nZXRPZmZzZXRBZnRlcihtVGV4dCwgaGVyZSk7Ci0gICAgICAgICAgICBpZiAoY2FuZGlkYXRlID49IHN0YXJ0ICYmIGNhbmRpZGF0ZSA8PSBlbmQpIHsKLSAgICAgICAgICAgICAgICBoID0gZ2V0UHJpbWFyeUhvcml6b250YWwoY2FuZGlkYXRlKTsKLQotICAgICAgICAgICAgICAgIGlmIChoID4gaG9yaXogJiYgaCA8IGJlc3RoKSB7Ci0gICAgICAgICAgICAgICAgICAgIGJlc3QgPSBjYW5kaWRhdGU7Ci0gICAgICAgICAgICAgICAgICAgIGJlc3RoID0gaDsKKyAgICAgICAgYm9vbGVhbiBhZHZhbmNlID0gdG9MZWZ0ID09IChsaW5lRGlyID09IERJUl9SSUdIVF9UT19MRUZUKTsKKyAgICAgICAgaWYgKGNhcmV0ID09IChhZHZhbmNlID8gbGluZUVuZCA6IGxpbmVTdGFydCkpIHsKKyAgICAgICAgICAgIC8vIHdhbGtpbmcgb2ZmIGxpbmUsIHNvIGxvb2sgYXQgdGhlIGxpbmUgd2UncmUgaGVhZGVkIHRvCisgICAgICAgICAgICBpZiAoY2FyZXQgPT0gbGluZVN0YXJ0KSB7CisgICAgICAgICAgICAgICAgaWYgKGxpbmUgPiAwKSB7CisgICAgICAgICAgICAgICAgICAgIC0tbGluZTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICByZXR1cm4gY2FyZXQ7IC8vIGF0IHZlcnkgc3RhcnQsIGRvbid0IG1vdmUKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGlmIChsaW5lIDwgZ2V0TGluZUNvdW50KCkgLSAxKSB7CisgICAgICAgICAgICAgICAgICAgICsrbGluZTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICByZXR1cm4gY2FyZXQ7IC8vIGF0IHZlcnkgZW5kLCBkb24ndCBtb3ZlCiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogCi0gICAgICAgICAgICBjYW5kaWRhdGUgPSBUZXh0VXRpbHMuZ2V0T2Zmc2V0QmVmb3JlKG1UZXh0LCB0aGVyZSk7Ci0gICAgICAgICAgICBpZiAoY2FuZGlkYXRlID49IHN0YXJ0ICYmIGNhbmRpZGF0ZSA8PSBlbmQpIHsKLSAgICAgICAgICAgICAgICBoID0gZ2V0UHJpbWFyeUhvcml6b250YWwoY2FuZGlkYXRlKTsKLQotICAgICAgICAgICAgICAgIGlmIChoID4gaG9yaXogJiYgaCA8IGJlc3RoKSB7Ci0gICAgICAgICAgICAgICAgICAgIGJlc3QgPSBjYW5kaWRhdGU7Ci0gICAgICAgICAgICAgICAgICAgIGJlc3RoID0gaDsKLSAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICBsaW5lU3RhcnQgPSBnZXRMaW5lU3RhcnQobGluZSk7CisgICAgICAgICAgICBsaW5lRW5kID0gZ2V0TGluZUVuZChsaW5lKTsKKyAgICAgICAgICAgIGludCBuZXdEaXIgPSBnZXRQYXJhZ3JhcGhEaXJlY3Rpb24obGluZSk7CisgICAgICAgICAgICBpZiAobmV3RGlyICE9IGxpbmVEaXIpIHsKKyAgICAgICAgICAgICAgICAvLyB1bnVzdWFsIGNhc2UuICB3ZSB3YW50IHRvIHdhbGsgb250byB0aGUgbGluZSwgYnV0IGl0IHJ1bnMKKyAgICAgICAgICAgICAgICAvLyBpbiBhIGRpZmZlcmVudCBkaXJlY3Rpb24gdGhhbiB0aGlzIG9uZSwgc28gd2UgZmFrZSBtb3ZlbWVudAorICAgICAgICAgICAgICAgIC8vIGluIHRoZSBvcHBvc2l0ZSBkaXJlY3Rpb24uCisgICAgICAgICAgICAgICAgdG9MZWZ0ID0gIXRvTGVmdDsKKyAgICAgICAgICAgICAgICBsaW5lRGlyID0gbmV3RGlyOwogICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBoZXJlID0gdGhlcmU7CiAgICAgICAgIH0KIAotICAgICAgICBmbG9hdCBoID0gZ2V0UHJpbWFyeUhvcml6b250YWwoZW5kKTsKKyAgICAgICAgRGlyZWN0aW9ucyBkaXJlY3Rpb25zID0gZ2V0TGluZURpcmVjdGlvbnMobGluZSk7CiAKLSAgICAgICAgaWYgKGggPiBob3JpeiAmJiBoIDwgYmVzdGgpIHsKLSAgICAgICAgICAgIGJlc3QgPSBlbmQ7Ci0gICAgICAgICAgICBiZXN0aCA9IGg7Ci0gICAgICAgIH0KLQotICAgICAgICBpZiAoYmVzdCAhPSBvZmZzZXQpCi0gICAgICAgICAgICByZXR1cm4gYmVzdDsKLQotICAgICAgICBpbnQgZGlyID0gZ2V0UGFyYWdyYXBoRGlyZWN0aW9uKGxpbmUpOwotCi0gICAgICAgIGlmIChkaXIgPiAwKSB7Ci0gICAgICAgICAgICBpZiAobGluZSA9PSBnZXRMaW5lQ291bnQoKSAtIDEpCi0gICAgICAgICAgICAgICAgcmV0dXJuIGJlc3Q7Ci0gICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICAgICAgcmV0dXJuIGdldE9mZnNldEZvckhvcml6b250YWwobGluZSArIDEsIC0xMDAwMCk7Ci0gICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICBpZiAobGluZSA9PSAwKQotICAgICAgICAgICAgICAgIHJldHVybiBiZXN0OwotICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgIHJldHVybiBnZXRPZmZzZXRGb3JIb3Jpem9udGFsKGxpbmUgLSAxLCAtMTAwMDApOwotICAgICAgICB9CisgICAgICAgIFRleHRMaW5lIHRsID0gVGV4dExpbmUub2J0YWluKCk7CisgICAgICAgIC8vIFhYWDogd2UgZG9uJ3QgY2FyZSBhYm91dCB0YWJzCisgICAgICAgIHRsLnNldChtUGFpbnQsIG1UZXh0LCBsaW5lU3RhcnQsIGxpbmVFbmQsIGxpbmVEaXIsIGRpcmVjdGlvbnMsIGZhbHNlLCBudWxsKTsKKyAgICAgICAgY2FyZXQgPSBsaW5lU3RhcnQgKyB0bC5nZ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GFsKHBvaW50KSAtIDAuNWY7Ci0gICAgICAgIGZsb2F0IGgyID0gZ2V0U2Vjb25kYXJ5SG9yaXpvbnRhbChwb2ludCkgLSAwLjVmOworICAgICAgICBmbG9hdCBoMiA9IGlzTGV2ZWxCb3VuZGFyeShwb2ludCkgPworICAgICAgICAgICAgICAgICAgICBnZXRTZWNvbmRhcnlIb3Jpem9udGFsKHBvaW50KSAtIDAuNWYgOiBoMTsKIAogICAgICAgICBpbnQgY2FwcyA9IFRleHRLZXlMaXN0ZW5lci5nZXRNZXRhU3RhdGUoZWRpdGluZ0J1ZmZlciwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEtleUV2ZW50Lk1FVEFfU0hJRlRfT04pIHwKQEAgLTEyMDcsOSArMTIyMCwxMCBAQAogICAgICAgICBpZiAobGluZWVuZCA+IGxpbmVzdGFydCAmJiBtVGV4dC5jaGFyQXQobGluZWVuZCAtIDEpID09ICdcbicpCiAgICAgICAgICAgICBsaW5lZW5kLS07CiAKLSAgICAgICAgaW50IGhlcmUgPSBsaW5lc3RhcnQ7Ci0gICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgZGlycy5tRGlyZWN0aW9ucy5sZW5ndGg7IGkrKykgewotICAgICAgICAgICAgaW50IHRoZXJlID0gaGVyZSArIGRpcnMubURpcmVjdGlvbnNbaV07CisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgZGlycy5tRGlyZWN0aW9ucy5sZW5ndGg7IGkgKz0gMikgeworICAgICAgICAgICAgaW50IGhlcmUgPSBsaW5lc3RhcnQgKyBkaXJzLm1EaXJlY3Rpb25zW2ldOworICAgICAgICAgICAgaW50IHRoZXJlID0gaGVyZSArIChkaXJzLm1EaXJlY3Rpb25zW2krMV0gJiBSVU5fTEVOR1RIX01BU0spOworCiAgICAgICAgICAgICBpZiAodGhlcmUgPiBsaW5lZW5kKQogICAgICAgICAgICAgICAgIHRoZXJlID0gbGluZWVuZDsKIApAQCAtMTIxOCwxNCArMTIzMiwxMiBAQAogICAgICAgICAgICAgICAgIGludCBlbiA9IE1hdGgubWluKGVuZCwgdGhlcmUpOwogCiAgICAgICAgICAgICAgICAgaWYgKHN0ICE9IGVuKSB7Ci0gICAgICAgICAgICAgICAgICAgIGZsb2F0IGgxID0gZ2V0SG9yaXpvbnRhbChzdCwgZmFsc2UsIGZhbHNlLCBsaW5lKTsKLSAgICAgICAgICAgICAgICAgICAgZmxvYXQgaDIgPSBnZXRIb3Jpem9udGFsKGVuLCB0cnVlLCBmYWxzZSwgbGluZSk7CisgICAgICAgICAgICAgICAgICAgIGZsb2F0IGgxID0gZ2V0SG9yaXpvbnRhbChzdCwgZmFsc2UsIGxpbmUpOworICAgICAgICAgICAgICAgICAgICBmbG9hdCBoMiA9IGdldEhvcml6b250YWwoZW4sIHRydWUsIGxpbmUpOwogCiAgICAgICAgICAgICAgICAgICAgIGRlc3QuYWRkUmVjdChoMSwgdG9wLCBoMiwgYm90dG9tLCBQYXRoLkRpcmVjdGlvbi5DVyk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBoZXJlID0gdGhlcmU7CiAgICAgICAgIH0KICAgICB9CiAKQEAgLTEyNjAsNyArMTI3Miw3IEBACiAKICAgICAgICAgICAgIGFkZFNlbGVjdGlvbihzdGFydGxpbmUsIHN0YXJ0LCBnZXRMaW5lRW5kKHN0YXJ0bGluZSksCiAgICAgICAgICAgICAgICAgICAgICAgICAgdG9wLCBnZXRMaW5lQm90dG9tKHN0YXJ0bGluZSksIGRlc3QpOwotICAgICAgICAgICAgCisKICAgICAgICAgICAgIGlmIChnZXRQYXJhZ3JhcGhEaXJlY3Rpb24oc3RhcnRsaW5lKSA9PSBESVJfUklHSFRfVE9fTEVGVCkKICAgICAgICAgICAgICAgICBkZXN0LmFkZFJlY3QoZ2V0TGluZUxlZnQoc3RhcnRsaW5lKSwgdG9wLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCwgZ2V0TGluZUJvdHRvbShzdGFydGxpbmUpLCBQYXRoLkRpcmVjdGlvbi5DVyk7CkBAIC0xMjk2LDcgKzEzMDgsNyBAQAogCiAgICAgICAgIGlmIChtU3Bhbm5lZFRleHQpIHsKICAgICAgICAgICAgIFNwYW5uZWQgc3AgPSAoU3Bhbm5lZCkgbVRleHQ7Ci0gICAgICAgICAgICBBbGlnbm1lbnRTcGFuW10gc3BhbnMgPSBzcC5nZXRTcGFucyhnZXRMaW5lU3RhcnQobGluZSksCisgICAgICAgICAgICBBbGlnbm1lbnRTcGFuW10gc3BhbnMgPSBnZXRQYXJhZ3JhcGhTcGFucyhzcCwgZ2V0TGluZVN0YXJ0KGxpbmUpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0TGluZUVuZChsaW5lKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFsaWdubWVudFNwYW4uY2xhc3MpOwogCkBAIC0xMzEzLDQyMyArMTMyNSwxNzMgQEAKICAgICAgKiBHZXQgdGhlIGxlZnQgZWRnZSBvZiB0aGUgc3BlY2lmaWVkIHBhcmFncmFwaCwgaW5zZXQgYnkgbGVmdCBtYXJnaW5zLgogICAgICAqLwogICAgIHB1YmxpYyBmaW5hbCBpbnQgZ2V0UGFyYWdyYXBoTGVmdChpbnQgbGluZSkgewotICAgICAgICBpbnQgZGlyID0gZ2V0UGFyYWdyYXBoRGlyZWN0aW9uKGxpbmUpOwotCiAgICAgICAgIGludCBsZWZ0ID0gMDsKLQotICAgICAgICBib29sZWFuIHBhciA9IGZhbHNlOwotICAgICAgICBpbnQgb2ZmID0gZ2V0TGluZVN0YXJ0KGxpbmUpOwotICAgICAgICBpZiAob2ZmID09IDAgfHwgbVRleHQuY2hhckF0KG9mZiAtIDEpID09ICdcbicpCi0gICAgICAgICAgICBwYXIgPSB0cnVlOwotCi0gICAgICAgIGlmIChkaXIgPT0gRElSX0xFRlRfVE9fUklHSFQpIHsKLSAgICAgICAgICAgIGlmIChtU3Bhbm5lZFRleHQpIHsKLSAgICAgICAgICAgICAgICBTcGFubmVkIHNwID0gKFNwYW5uZWQpIG1UZXh0OwotICAgICAgICAgICAgICAgIExlYWRpbmdNYXJnaW5TcGFuW10gc3BhbnMgPSBzcC5nZXRTcGFucyhnZXRMaW5lU3RhcnQobGluZSksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldExpbmVFbmQobGluZSksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIExlYWRpbmdNYXJnaW5TcGFuLmNsYXNzKTsKLQotICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgc3BhbnMubGVuZ3RoOyBpKyspIHsKLSAgICAgICAgICAgICAgICAgICAgYm9vbGVhbiBtYXJnaW4gPSBwYXI7Ci0gICAgICAgICAgICAgICAgICAgIExlYWRpbmdNYXJnaW5TcGFuIHNwYW4gPSBzcGFuc1tpXTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKHNwYW4gaW5zdGFuY2VvZiBMZWFkaW5nTWFyZ2luU3Bhbi5MZWFkaW5nTWFyZ2luU3BhbjIpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGludCBjb3VudCA9ICgoTGVhZGluZ01hcmdpblNwYW4uTGVhZGluZ01hcmdpblNwYW4yKXNwYW4pLmdldExlYWRpbmdNYXJnaW5MaW5lQ291bnQoKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIG1hcmdpbiA9IGNvdW50ID49IGxpbmU7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgbGVmdCArPSBzcGFuLmdldExlYWRpbmdNYXJnaW4obWFyZ2luKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9CisgICAgICAgIGludCBkaXIgPSBnZXRQYXJhZ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gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRMaW5lRW5kKGxpbmUpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMZWFkaW5nTWFyZ2luU3Bhbi5jbGFzcyk7Ci0KLSAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IHNwYW5zLmxlbmd0aDsgaSsrKSB7Ci0gICAgICAgICAgICAgICAgICAgIHJpZ2h0IC09IHNwYW5zW2ldLmdldExlYWRpbmdNYXJnaW4ocGFyKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9CisgICAgICAgIGludCBkaXIgPSBnZXRQYXJhZ3JhcGhEaXJlY3Rpb24obGluZSk7CisgICAgICAgIGlmIChkaXIgPT0gRElSX0xFRlRfVE9fUklHSFQgfHwgIW1TcGFubmVkVGV4dCkgeworICAgICAgICAgICAgcmV0dXJuIHJpZ2h0OyAvLyBsZWFkaW5nIG1hcmdpbiBoYXMgbm8gaW1wYWN0LCBvciBubyBzdHlsZXMKICAgICAgICAgfQotCi0gICAgICAgIHJldHVybiByaWdodDsKLSAgICB9Ci0KLSAgICBwcml2YXRlIHZvaWQgZHJhd1RleHQoQ2FudmFzIGNhbnZhcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENoYXJTZXF1ZW5jZSB0ZXh0LCBpbnQgc3RhcnQsIGludCBlbmQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgZGlyLCBEaXJlY3Rpb25zIGRpcmVjdGlvbnMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB4LCBpbnQgdG9wLCBpbnQgeSwgaW50IGJvdHRvbSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRleHRQYWludCBwYWludCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRleHRQYWludCB3b3JrUGFpbnQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sZWFuIGhhc1RhYnMsIE9iamVjdFtdIHBhcnNwYW5zKSB7Ci0gICAgICAgIGNoYXJbXSBidWY7Ci0gICAgICAgIGlmICghaGFzVGFicykgewotICAgICAgICAgICAgaWYgKGRpcmVjdGlvbnMgPT0gRElSU19BTExfTEVGVF9UT19SSUdIVCkgewotICAgICAgICAgICAgICAgIGlmIChERUJVRykgewotICAgICAgICAgICAgICAgICAgICBBc3NlcnQuYXNzZXJ0VHJ1ZShESVJfTEVGVF9UT19SSUdIVCA9PSBkaXIpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBTdHlsZWQuZHJhd1RleHQoY2FudmFzLCB0ZXh0LCBzdGFydCwgZW5kLCBkaXIsIGZhbHNlLCB4LCB0b3AsIHksIGJvdHRvbSwgcGFpbnQsIHdvcmtQYWludCwgZmFsc2UpOwotICAgICAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGJ1ZiA9IG51bGw7Ci0gICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICBidWYgPSBUZXh0VXRpbHMub2J0YWluKGVuZCAtIHN0YXJ0KTsKLSAgICAgICAgICAgIFRleHRVdGlscy5nZXRDaGFycyh0ZXh0LCBzdGFydCwgZW5kLCBidWYsIDApOwotICAgICAgICB9Ci0KLSAgICAgICAgZmxvYXQgaCA9IDA7Ci0KLSAgICAgICAgaW50IGhlcmUgPSAwOwotICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGRpcmVjdGlvbnMubURpcmVjdGlvbnMubGVuZ3RoOyBpKyspIHsKLSAgICAgICAgICAgIGludCB0aGVyZSA9IGhlcmUgKyBkaXJlY3Rpb25zLm1EaXJlY3Rpb25zW2ldOwotICAgICAgICAgICAgaWYgKHRoZXJlID4gZW5kIC0gc3RhcnQpCi0gICAgICAgICAgICAgICAgdGhlcmUgPSBlbmQgLSBzdGFydDsKLQotICAgICAgICAgICAgaW50IHNlZ3N0YXJ0ID0gaGVyZTsKLSAgICAgICAgICAgIGZvciAoaW50IGogPSBoYXNUYWJzID8gaGVyZSA6IHRoZXJlOyBqIDw9IHRoZXJlOyBqKyspIHsKLSAgICAgICAgICAgICAgICBpZiAoaiA9PSB0aGVyZSB8fCBidWZbal0gPT0gJ1x0JykgewotICAgICAgICAgICAgICAgICAgICBoICs9IFN0eWxlZC5kcmF3VGV4dChjYW52YXMsIHRleHQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0ICsgc2Vnc3RhcnQsIHN0YXJ0ICsgaiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlyLCAoaSAmIDEpICE9IDAsIHggKyBoLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b3AsIHksIGJvdHRvbSwgcGFpbnQsIHdvcmtQYWludCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnQgKyBqICE9IGVuZCk7Ci0KLSAgICAgICAgICAgICAgICAgICAgaWYgKGogIT0gdGhlcmUgJiYgYnVmW2pdID09ICdcdCcpCi0gICAgICAgICAgICAgICAgICAgICAgICBoID0gZGlyICogbmV4dFRhYih0ZXh0LCBzdGFydCwgZW5kLCBoICogZGlyLCBwYXJzcGFucyk7Ci0KLSAgICAgICAgICAgICAgICAgICAgc2Vnc3RhcnQgPSBqICsgMTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGhhc1RhYnMgJiYgYnVmW2pdID49IDB4RDgwMCAmJiBidWZbal0gPD0gMHhERkZGICYmIGogKyAxIDwgdGhlcmUpIHsKLSAgICAgICAgICAgICAgICAgICAgaW50IGVtb2ppID0gQ2hhcmFjdGVyLmNvZGVQb2ludEF0KGJ1Ziwgaik7Ci0KLSAgICAgICAgICAgICAgICAgICAgaWYgKGVtb2ppID49IE1JTl9FTU9KSSAmJiBlbW9qaSA8PSBNQVhfRU1PSkkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIEJpdG1hcCBibSA9IEVNT0pJX0ZBQ1RPUlkuCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0Qml0bWFwRnJvbUFuZHJvaWRQdWEoZW1vamkpOwotCi0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoYm0gIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGggKz0gU3R5bGVkLmRyYXdUZXh0KGNhbnZhcywgdGV4dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGFydCArIHNlZ3N0YXJ0LCBzdGFydCArIGosCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlyLCAoaSAmIDEpICE9IDAsIHggKyBoLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvcCwgeSwgYm90dG9tLCBwYWludCwgd29ya1BhaW50LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0ICsgaiAhPSBlbmQpOwotCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1FbW9qaVJlY3QgPT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtRW1vamlSZWN0ID0gbmV3IFJlY3RGKCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgd29ya1BhaW50LnNldChwYWludCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgU3R5bGVkLm1lYXN1cmVUZXh0KHBhaW50LCB3b3JrUGFpbnQsIHRleHQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0ICsgaiwgc3RhcnQgKyBqICsgMSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgYml0bWFwSGVpZ2h0ID0gYm0uZ2V0SGVpZ2h0KCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgdGV4dEhlaWdodCA9IC13b3JrUGFpbnQuYXNjZW50KCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgc2NhbGUgPSB0ZXh0SGVpZ2h0IC8gYml0bWFwSGVpZ2h0OwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IHdpZHRoID0gYm0uZ2V0V2lkdGgoKSAqIHNjYWxlOwotCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbUVtb2ppUmVjdC5zZXQoeCArIGgsIHkgLSB0ZXh0SGVpZ2h0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHggKyBoICsgd2lkdGgsIHkpOwotCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FudmFzLmRyYXdCaXRtYXAoYm0sIG51bGwsIG1FbW9qaVJlY3QsIHBhaW50KTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBoICs9IHdpZHRoOwotCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaisrOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlZ3N0YXJ0ID0gaiArIDE7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGhlcmUgPSB0aGVyZTsKLSAgICAgICAgfQotCi0gICAgICAgIGlmIChoYXNUYWJzKQotICAgICAgICAgICAgVGV4dFV0aWxzLnJlY3ljbGUoYnVmKTsKLSAgICB9Ci0KLSAgICBwcml2YXRlIHN0YXRpYyBmbG9hdCBtZWFzdXJlVGV4dChUZXh0UGFpbnQgcGFpbnQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGV4dFBhaW50IHdvcmtQYWludCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDaGFyU2VxdWVuY2UgdGV4dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgc3RhcnQsIGludCBvZmZzZXQsIGludCBlbmQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGRpciwgRGlyZWN0aW9ucyBkaXJlY3Rpb25zLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2xlYW4gdHJhaWxpbmcsIGJvb2xlYW4gYWx0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2xlYW4gaGFzVGFicywgT2JqZWN0W10gdGFicykgewotICAgICAgICBjaGFyW10gYnVmID0gbnVsbDsKLQotICAgICAgICBpZiAoaGFzVGFicykgewotICAgICAgICAgICAgYnVmID0gVGV4dFV0aWxzLm9idGFpbihlbmQgLSBzdGFydCk7Ci0gICAgICAgICAgICBUZXh0VXRpbHMuZ2V0Q2hhcnModGV4dCwgc3RhcnQsIGVuZCwgYnVmLCAwKTsKLSAgICAgICAgfQotCi0gICAgICAgIGZsb2F0IGggPSAwOwotCi0gICAgICAgIGlmIChhbHQpIHsKLSAgICAgICAgICAgIGlmIChkaXIgPT0gRElSX1JJR0hUX1RPX0xFRlQpCi0gICAgICAgICAgICAgICAgdHJhaWxpbmcgPSAhdHJhaWxpbmc7Ci0gICAgICAgIH0KLQotICAgICAgICBpbnQgaGVyZSA9IDA7Ci0gICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgZGlyZWN0aW9ucy5tRGlyZWN0aW9ucy5sZW5ndGg7IGkrKykgewotICAgICAgICAgICAgaWYgKGFsdCkKLSAgICAgICAgICAgICAgICB0cmFpbGluZyA9ICF0cmFpbGluZzsKLQotICAgICAgICAgICAgaW50IHRoZXJlID0gaGVyZSArIGRpcmVjdGlvbnMubURpcmVjdGlvbnNbaV07Ci0gICAgICAgICAgICBpZiAodGhlcmUgPiBlbmQgLSBzdGFydCkKLSAgICAgICAgICAgICAgICB0aGVyZSA9IGVuZCAtIHN0YXJ0OwotCi0gICAgICAgICAgICBpbnQgc2Vnc3RhcnQgPSBoZXJlOwotICAgICAgICAgICAgZm9yIChpbnQgaiA9IGhhc1RhYnMgPyBoZXJlIDogdGhlcmU7IGogPD0gdGhlcmU7IGorKykgewotICAgICAgICAgICAgICAgIGludCBjb2RlcHQgPSAwOwotICAgICAgICAgICAgICAgIEJpdG1hcCBibSA9IG51bGw7Ci0KLSAgICAgICAgICAgICAgICBpZiAoaGFzVGFicyAmJiBqIDwgdGhlcmUpIHsKLSAgICAgICAgICAgICAgICAgICAgY29kZXB0ID0gYnVmW2pdOwotICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgIGlmIChjb2RlcHQgPj0gMHhEODAwICYmIGNvZGVwdCA8PSAweERGRkYgJiYgaiArIDEgPCB0aGVyZSkgewotICAgICAgICAgICAgICAgICAgICBjb2RlcHQgPSBDaGFyYWN0ZXIuY29kZVBvaW50QXQoYnVmLCBqKTsKLQotICAgICAgICAgICAgICAgICAgICBpZiAoY29kZXB0ID49IE1JTl9FTU9KSSAmJiBjb2RlcHQgPD0gTUFYX0VNT0pJKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBibSA9IEVNT0pJX0ZBQ1RPUlkuZ2V0Qml0bWFwRnJvbUFuZHJvaWRQdWEoY29kZXB0KTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgIGlmIChqID09IHRoZXJlIHx8IGNvZGVwdCA9PSAnXHQnIHx8IGJtICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgZmxvYXQgc2VndzsKLQotICAgICAgICAgICAgICAgICAgICBpZiAob2Zmc2V0IDwgc3RhcnQgKyBqIHx8Ci0gICAgICAgICAgICAgICAgICAgICAgICh0cmFpbGluZyAmJiBvZmZzZXQgPD0gc3RhcnQgKyBqKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRpciA9PSBESVJfTEVGVF9UT19SSUdIVCAmJiAoaSAmIDEpID09IDApIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBoICs9IFN0eWxlZC5tZWFzdXJlVGV4dChwYWludCwgd29ya1BhaW50LCB0ZXh0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0ICsgc2Vnc3RhcnQsIG9mZnNldCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaDsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRpciA9PSBESVJfUklHSFRfVE9fTEVGVCAmJiAoaSAmIDEpICE9IDApIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBoIC09IFN0eWxlZC5tZWFzdXJlVGV4dChwYWludCwgd29ya1BhaW50LCB0ZXh0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0ICsgc2Vnc3RhcnQsIG9mZnNldCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaDsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgICAgIHNlZ3cgPSBTdHlsZWQubWVhc3VyZVRleHQocGFpbnQsIHdvcmtQYWludCwgdGV4dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGFydCArIHNlZ3N0YXJ0LCBzdGFydCArIGosCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCk7Ci0KLSAgICAgICAgICAgICAgICAgICAgaWYgKG9mZnNldCA8IHN0YXJ0ICsgaiB8fAotICAgICAgICAgICAgICAgICAgICAgICAgKHRyYWlsaW5nICYmIG9mZnNldCA8PSBzdGFydCArIGopKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZGlyID09IERJUl9MRUZUX1RPX1JJR0hUKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaCArPSBzZWd3IC0gU3R5bGVkLm1lYXN1cmVUZXh0KHBhaW50LCB3b3JrUGFpbnQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRleHQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0ICsgc2Vnc3RhcnQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9mZnNldCwgbnVsbCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGg7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkaXIgPT0gRElSX1JJR0hUX1RPX0xFRlQpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBoIC09IHNlZ3cgLSBTdHlsZWQubWVhc3VyZVRleHQocGFpbnQsIHdvcmtQYWludCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGV4dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnQgKyBzZWdzdGFydCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb2Zmc2V0LCBudWxsKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaDsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgICAgIGlmIChkaXIgPT0gRElSX1JJR0hUX1RPX0xFRlQpCi0gICAgICAgICAgICAgICAgICAgICAgICBoIC09IHNlZ3c7Ci0gICAgICAgICAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgICAgICAgICAgICAgIGggKz0gc2VndzsKLQotICAgICAgICAgICAgICAgICAgICBpZiAoaiAhPSB0aGVyZSAmJiBidWZbal0gPT0gJ1x0JykgewotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG9mZnNldCA9PSBzdGFydCArIGopCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGg7Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgIGggPSBkaXIgKiBuZXh0VGFiKHRleHQsIHN0YXJ0LCBlbmQsIGggKiBkaXIsIHRhYnMpOwotICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgaWYgKGogIT0gdGhlcmUgJiYgYm0gIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG9mZnNldCA9PSBzdGFydCArIGopIHJldHVybiBoOwotICAgICAgICAgICAgICAgICAgICAgICAgd29ya1BhaW50LnNldChwYWludCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBTdHlsZWQubWVhc3VyZVRleHQocGFpbnQsIHdvcmtQYWludCwgdGV4dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqLCBqICsgMiwgbnVsbCk7Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IHdpZCA9IChmbG9hdCkgYm0uZ2V0V2lkdGgoKSAqCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtd29ya1BhaW50LmFzY2VudCgpIC8gYm0uZ2V0SGVpZ2h0KCk7Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkaXIgPT0gRElSX1JJR0hUX1RPX0xFRlQpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBoIC09IHdpZDsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaCArPSB3aWQ7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgIGorKzsKLSAgICAgICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgICAgIHNlZ3N0YXJ0ID0gaiArIDE7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBoZXJlID0gdGhlcmU7Ci0gICAgICAgIH0KLQotICAgICAgICBpZiAoaGFzVGFicykKLSAgICAgICAgICAgIFRleHRVdGlscy5yZWN5Y2xlKGJ1Zik7Ci0KLSAgICAgICAgcmV0dXJuIGg7CisgICAgICAgIHJldHVybiByaWdodCAtIGdldFBhcmFncmFwaExlYWRpbmdNYXJnaW4obGluZSk7CiAgICAgfQogCiAgICAgLyoqCi0gICAgICogTWVhc3VyZSB3aWR0aCBvZiBhIHJ1biBvZiB0ZXh0IG9uIGEgc2luZ2xlIGxpbmUgdGhhdCBpcyBrbm93biB0byBhbGwgYmUKLSAgICAgKiBpbiB0aGUgc2FtZSBkaXJlY3Rpb24gYXMgdGhlIHBhcmFncmFwaCBiYXNlIGRpcmVjdGlvbi4gUmV0dXJucyB0aGUgd2lkdGgsCi0gICAgICogYW5kIHRoZSBsaW5lIG1ldHJpY3MgaW4gZm0gaWYgZm0gaXMgbm90IG51bGwuCi0gIC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gICAgICAgICAgICAgICAgICAgICAgICAgIENoYXJTZXF1ZW5jZSB0ZXh0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBzdGFydCwgaW50IGVuZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQYWludC5Gb250TWV0cmljc0ludCBmbSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sZWFuIGhhc1RhYnMsIE9iamVjdFtdIHRhYnMpIHsKLSAgICAgICAgY2hhcltdIGJ1ZiA9IG51bGw7Ci0gIAotICAgICAgICBpZiAoaGFzVGFicykgewotICAgICAgICAgICAgYnVmID0gVGV4dFV0aWxzLm9idGFpbihlbmQgLSBzdGFydCk7Ci0gICAgICAgICAgICBUZXh0VXRpbHMuZ2V0Q2hhcnModGV4dCwgc3RhcnQsIGVuZCwgYnVmLCAwKTsKKyAgICBwcml2YXRlIGludCBnZXRQYXJhZ3JhcGhMZWFkaW5nTWFyZ2luKGludCBsaW5lKSB7CisgICAgICAgIGlmICghbVNwYW5uZWRUZXh0KSB7CisgICAgICAgICAgICByZXR1cm4gMDsKKyAgICAgICAgfQorICAgICAgICBTcGFubmVkIHNwYW5uZWQgPSAoU3Bhbm5lZCkgbVRleHQ7CisKKyAgICAgICAgaW50IGxpbmVTdGFydCA9IGdldExpbmVTdGFydChsaW5lKTsKKyAgICAgICAgaW50IGxpbmVFbmQgPSBnZXRMaW5lRW5kKGxpbmUpOworICAgICAgICBpbnQgc3BhbkVuZCA9IHNwYW5uZWQubmV4dFNwYW5UcmFuc2l0aW9uKGxpbmVTdGFydCwgbGluZUVuZCwKKyAgICAgICAgICAgICAgICBMZWFkaW5nTWFyZ2luU3Bhbi5jbGFzcyk7CisgICAgICAgIExlYWRpbmdNYXJnaW5TcGFuW10gc3BhbnMgPSBnZXRQYXJhZ3JhcGhTcGFucyhzcGFubmVkLCBsaW5lU3RhcnQsIHNwYW5FbmQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMZWFkaW5nTWFyZ2luU3Bhbi5jbGFzcyk7CisgICAgICAgIGlmIChzcGFucy5sZW5ndGggPT0gMCkgeworICAgICAgICAgICAgcmV0dXJuIDA7IC8vIG5vIGxlYWRpbmcgbWFyZ2luIHNwYW47CiAgICAgICAgIH0KIAotICAgICAgICBpbnQgbGVuID0gZW5kIC0gc3RhcnQ7CisgICAgICAgIGludCBtYXJnaW4gPSAwOwogCi0gICAgICAgIGludCBsYXN0UG9zID0gMDsKLSAgICAgICAgZmxvYXQgd2lkdGggPSAwOwotICAgICAgICBpbnQgYXNjZW50ID0gMCwgZGVzY2VudCA9IDAsIHRvcCA9IDAsIGJvdHRvbSA9IDA7CisgICAgICAgIGJvb2xlYW4gaXNGaXJzdFBhcmFMaW5lID0gbGluZVN0YXJ0ID09IDAgfHwKKyAgICAgICAgICAgIHNwYW5uZWQuY2hhckF0KGxpbmVTdGFydCAtIDEpID09ICdcbic7CiAKLSAgICAgICAgaWYgKGZtICE9IG51bGwpIHsKLSAgICAgICAgICAgIGZtLmFzY2VudCA9IDA7Ci0gICAgICAgICAgICBmbS5kZXNjZW50ID0gMDsKLSAgICAgICAgfQotCi0gICAgICAgIGZvciAoaW50IHBvcyA9IGhhc1RhYnMgPyAwIDogbGVuOyBwb3MgPD0gbGVuOyBwb3MrKykgewotICAgICAgICAgICAgaW50IGNvZGVwdCA9IDA7Ci0gICAgICAgICAgICBCaXRtYXAgYm0gPSBudWxsOwotCi0gICAgICAgICAgICBpZiAoaGFzVGFicyAmJiBwb3MgPCBsZW4pIHsKLSAgICAgICAgICAgICAgICBjb2RlcHQgPSBidWZbcG9zXTsKKyAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBzcGFucy5sZW5ndGg7IGkrKykgeworICAgICAgICAgICAgTGVhZGluZ01hcmdpblNwYW4gc3BhbiA9IHNwYW5zW2ldOworICAgICAgICAgICAgYm9vbGVhbiB1c2VGaXJzdExpbmVNYXJnaW4gPSBpc0ZpcnN0UGFyYUxpbmU7CisgICAgICAgICAgICBpZiAoc3BhbiBpbnN0YW5jZW9mIExlYWRpbmdNYXJnaW5TcGFuMikgeworICAgICAgICAgICAgICAgIGludCBzcFN0YXJ0ID0gc3Bhbm5lZC5nZXRTcGFuU3RhcnQoc3Bhbik7CisgICAgICAgICAgICAgICAgaW50IHNwYW5MaW5lID0gZ2V0TGluZUZvck9mZnNldChzcFN0YXJ0KTsKKyAgICAgICAgICAgICAgICBpbnQgY291bnQgPSAoKExlYWRpbmdNYXJnaW5TcGFuMilzcGFuKS5nZXRMZWFkaW5nTWFyZ2luTGluZUNvdW50KCk7CisgICAgICAgICAgICAgICAgdXNlRmlyc3RMaW5lTWFyZ2luID0gbGluZSA8IHNwYW5MaW5lICsgY291bnQ7CiAgICAgICAgICAgICB9CisgICAgICAgICAgICBtYXJnaW4gKz0gc3Bhbi5nZXRMZWFkaW5nTWFyZ2luKHVzZUZpcnN0TGluZU1hcmdpbik7CisgICAgICAgIH0KIAotICAgICAgICAgICAgaWYgKGNvZGVwdCA+PSAweEQ4MDAgJiYgY29kZXB0IDw9IDB4REZGRiAmJiBwb3MgPCBsZW4pIHsKLSAgICAgICAgICAgICAgICBjb2RlcHQgPSBDaGFyYWN0ZXIuY29kZVBvaW50QXQoYnVmLCBwb3MpOworICAgICAgICByZXR1cm4gbWFyZ2luOworICAgIH0KIAotICAgICAgICAgICAgICAgIGlmIChjb2RlcHQgPj0gTUlOX0VNT0pJICYmIGNvZGVwdCA8PSBNQVhfRU1PSkkpIHsKLSAgICAgICAgICAgICAgICAgICAgYm0gPSBFTU9KSV9GQUNUT1JZLmdldEJpdG1hcEZyb21BbmRyb2lkUHVhKGNvZGVwdCk7CisgICAgLyogcGFja2FnZSAqLworICAgIHN0YXRpYyBmbG9hdCBtZWFzdXJlUGFyYShUZXh0UGFpbnQgcGFpbnQsIFRleHRQYWludCB3b3JrUGFpbnQsCisgICAgICAgICAgICBDaGFyU2VxdWVuY2UgdGV4dCwgaW50IHN0YXJ0LCBpbnQgZW5kKSB7CisKKyAgICAgICAgTWVhc3VyZWRUZXh0IG10ID0gTWVhc3VyZWRUZXh0Lm9idGFpbigpOworICAgICAgICBUZXh0TGluZSB0bCA9IFRleHRMaW5lLm9idGFpbigpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgbXQuc2V0UGFyYSh0ZXh0LCBzdGFydCwgZW5kLCBESVJfUkVRVUVTVF9MVFIpOworICAgICAgICAgICAgRGlyZWN0aW9ucyBkaXJlY3Rpb25zOworICAgICAgICAgICAgaW50IGRpcjsKKyAgICAgICAgICAgIGlmIChtdC5tRWFzeSkgeworICAgICAgICAgICAgICAgIGRpcmVjdGlvbnMgPSBESVJTX0FMTF9MRUZUX1RPX1JJR0hUOworICAgICAgICAgICAgICAgIGRpciA9IExheW91dC5ESVJfTEVGVF9UT19SSUdIVDsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgZGlyZWN0aW9ucyA9IEFuZHJvaWRCaWRpLmRpcmVjdGlvbnMobXQubURpciwgbXQubUxldmVscywKKyAgICAgICAgICAgICAgICAgICAgMCwgbXQubUNoYXJzLCAwLCBtdC5tTGVuKTsKKyAgICAgICAgICAgICAgICBkaXIgPSBtdC5tRGlyOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2hhcltdIGNoYXJzID0gbXQubUNoYXJzOworICAgICAgICAgICAgaW50IGxlbiA9IG10Lm1MZW47CisgICAgICAgICAgICBib29sZWFuIGhhc1RhYnMgPSBmYWxzZTsKKyAgICAgICAgICAgIFRhYlN0b3BzIHRhYlN0b3BzID0gbnVsbDsKKyAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbGVuOyArK2kpIHsKKyAgICAgICAgICAgICAgICBpZiAoY2hhcnNbaV0gPT0gJ1x0JykgeworICAgICAgICAgICAgICAgICAgICBoYXNUYWJzID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKHRleHQgaW5zdGFuY2VvZiBTcGFubmVkKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBTcGFubmVkIHNwYW5uZWQgPSAoU3Bhbm5lZCkgdGV4dDsKKyAgICAgICAgICAgICAgICAgICAgICAgIGludCBzcGFuRW5kID0gc3Bhbm5lZC5uZXh0U3BhblRyYW5zaXRpb24oc3RhcnQsIGVuZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGFiU3RvcFNwYW4uY2xhc3MpOworICAgICAgICAgICAgICAgICAgICAgICAgVGFiU3RvcFNwYW5bXSBzcGFucyA9IGdldFBhcmFncmFwaFNwYW5zKHNwYW5uZWQsIHN0YXJ0LCBzcGFuRW5kLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUYWJTdG9wU3Bhbi5jbGFzcyk7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoc3BhbnMubGVuZ3RoID4gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRhYlN0b3BzID0gbmV3IFRhYlN0b3BzKFRBQl9JTkNSRU1FTlQsIHNwYW5zKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CisgICAgICAgICAgICB0bC5zZXQocGFpbnQsIHRleHQsIHN0YXJ0LCBlbmQsIGRpciwgZGlyZWN0aW9ucywgaGFzVGFicywgdGFiU3RvcHMpOworICAgICAgICAgICAgcmV0dXJuIHRsLm1ldHJpY3MobnVsbCk7CisgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICBUZXh0TGluZS5yZWN5Y2xlKHRsKTsKKyAgICAgICAgICAgIE1lYXN1cmVkVGV4dC5yZWN5Y2xlKG10KTsKKyAgICAgICAgfQorICAgIH0KIAotICAgICAgICAgICAgaWYgKHBvcyA9PSBsZW4gfHwgY29kZXB0ID09ICdcdCcgfHwgYm0gIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIHdvcmtQYWludC5iYXNlbGluZVNoaWZ0ID0gMDsKKyAgICAvKioKKyAgICAgKiBAaGlkZQorICAgICAqLworICAgIC8qIHBhY2thZ2UgKi8gc3RhdGljIGNsYXNzIFRhYlN0b3BzIHsKKyAgICAgICAgcHJpdmF0ZSBpbnRbXSBtU3RvcHM7CisgICAgICAgIHByaXZhdGUgaW50IG1OdW1TdG9wczsKKyAgICAgICAgcHJpdmF0ZSBpbnQgbUluY3JlbWVudDsKIAotICAgICAgICAgICAgICAgIHdpZHRoICs9IFN0eWxlZC5tZWFzdXJlVGV4dChwYWludCwgd29ya1BhaW50LCB0ZXh0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0ICsgbGFzdFBvcywgc3RhcnQgKyBwb3MsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm0pOworICAgICAgICBUYWJTdG9wcyhpbnQgaW5jcmVtZW50LCBPYmplY3RbXSBzcGFucykgeworICAgICAgICAgICAgcmVzZXQoaW5jcmVtZW50LCBzcGFucyk7CisgICAgICAgIH0KIAotICAgICAgICAgICAgICAgIGlmIChmbSAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmICh3b3JrUGFpbnQuYmFzZWxpbmVTaGlmdCA8IDApIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGZtLmFzY2VudCArPSB3b3JrUGFpbnQuYmFzZWxpbmVTaGlmdDsKLSAgICAgICAgICAgICAgICAgICAgICAgIGZtLnRvcCArPSB3b3JrUGFpbnQuYmFzZWxpbmVTaGlmdDsKLSAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGZtLmRlc2NlbnQgKz0gd29ya1BhaW50LmJhc2VsaW5lU2hpZnQ7Ci0gICAgICAgICAgICAgICAgICAgICAgICBmbS5ib3R0b20gKz0gd29ya1BhaW50LmJhc2VsaW5lU2hpZnQ7CisgICAgICAgIHZvaWQgcmVzZXQoaW50IGluY3JlbWVudCwgT2JqZWN0W10gc3BhbnMpIHsKKyAgICAgICAgICAgIHRoaXMubUluY3JlbWVudCA9IGluY3JlbWVudDsKKworICAgICAgICAgICAgaW50IG5zID0gMDsKKyAgICAgICAgICAgIGlmIChzcGFucyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgaW50W10gc3RvcHMgPSB0aGlzLm1TdG9wczsKKyAgICAgICAgICAgICAgICBmb3IgKE9iamVjdCBvIDogc3BhbnMpIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKG8gaW5zdGFuY2VvZiBUYWJTdG9wU3BhbikgeworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHN0b3BzID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdG9wcyA9IG5ldyBpbnRbMTBdOworICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChucyA9PSBzdG9wcy5sZW5ndGgpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnRbXSBuc3RvcHMgPSBuZXcgaW50W25zICogMl07CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBuczsgKytpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5zdG9wc1tpXSA9IHN0b3BzW2ldOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdG9wcyA9IG5zdG9wczsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIHN0b3BzW25zKytdID0gKChUYWJTdG9wU3BhbikgbykuZ2V0VGFiU3RvcCgpOwogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgaWYgKHBvcyAhPSBsZW4pIHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKGJtID09IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIG5vIGVtb2ppLCBtdXN0IGhhdmUgaGl0IGEgdGFiCi0gICAgICAgICAgICAgICAgICAgICAgICB3aWR0aCA9IG5leHRUYWIodGV4dCwgc3RhcnQsIGVuZCwgd2lkdGgsIHRhYnMpOwotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgLy8gVGhpcyBzZXRzIHVwIHdvcmtQYWludCB3aXRoIHRoZSBmb250IG9uIHRoZSBlbW9qaQotICAgICAgICAgICAgICAgICAgICAgICAgLy8gdGV4dCwgc28gdGhhdCB3ZSBjYW4gZXh0cmFjdCB0aGUgYXNjZW50IGFuZCBzY2FsZS4KLQotICAgICAgICAgICAgICAgICAgICAgICAgLy8gV2UgY2FuJ3QgdXNlIHRoZSByZXN1bHQgb2YgdGhlIHByZXZpb3VzIGNhbGwgdG8KLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIG1lYXN1cmVUZXh0IGJlY2F1c2UgdGhlIGVtb2ppIG1pZ2h0IGhhdmUgaXRzIG93biBzdHlsZS4KLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIFdlIGhhdmUgdG8gaW5pdGlhbGl6ZSB3b3JrUGFpbnQgaGVyZSBiZWNhdXNlIGlmIHRoZQotICAgICAgICAgICAgICAgICAgICAgICAgLy8gdGV4dCBpcyB1bnN0eWxlZCBtZWFzdXJlVGV4dCBtaWdodCBub3QgdXNlIHdvcmtQYWludAotICAgICAgICAgICAgICAgICAgICAgICAgLy8gYXQgYWxsLgotICAgICAgICAgICAgICAgICAgICAgICAgd29ya1BhaW50LnNldChwYWludCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBTdHlsZWQubWVhc3VyZVRleHQocGFpbnQsIHdvcmtQYWludCwgdGV4dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGFydCArIHBvcywgc3RhcnQgKyBwb3MgKyAxLCBudWxsKTsKLQotICAgICAgICAgICAgICAgICAgICAgICAgd2lkdGggKz0gKGZsb2F0KSBibS5nZXRXaWR0aCgpICoKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC13b3JrUGFpbnQuYXNjZW50KCkgLyBibS5nZXRIZWlnaHQoKTsKLQotICAgICAgICAgICAgICAgICAgICAgICAgLy8gU2luY2Ugd2UgaGFkIGFuIGVtb2ppLCB3ZSBidW1wIHBhc3QgdGhlIHNlY29uZCBoYWxmCi0gICAgICAgICAgICAgICAgICAgICAgICAvLyBvZiB0aGUgc3Vycm9nYXRlIHBhaXIuCi0gICAgICAgICAgICAgICAgICAgICAgICBwb3MrKzsKLSAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGlmIChucyA+IDEpIHsKKyAgICAgICAgICAgICAgICAgICAgQXJyYXlzLnNvcnQoc3RvcHMsIDAsIG5zKTsKICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBpZiAoZm0gIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICBpZiAoZm0uYXNjZW50IDwgYXNjZW50KSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBhc2NlbnQgPSBmbS5hc2NlbnQ7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgaWYgKGZtLmRlc2NlbnQgPiBkZXNjZW50KSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBkZXNjZW50ID0gZm0uZGVzY2VudDsKLSAgICAgICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgICAgIGlmIChmbS50b3AgPCB0b3ApIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHRvcCA9IGZtLnRvcDsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBpZiAoZm0uYm90dG9tID4gYm90dG9tKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBib3R0b20gPSBmbS5ib3R0b207Ci0gICAgICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgICAgICAvLyBObyBuZWVkIHRvIHRha2UgYml0bWFwIGhlaWdodCBpbnRvIGFjY291bnQgaGVyZSwKLSAgICAgICAgICAgICAgICAgICAgLy8gc2luY2UgaXQgaXMgc2NhbGVkIHRvIG1hdGNoIHRoZSB0ZXh0IGhlaWdodC4KKyAgICAgICAgICAgICAgICBpZiAoc3RvcHMgIT0gdGhpcy5tU3RvcHMpIHsKKyAgICAgICAgICAgICAgICAgICAgdGhpcy5tU3RvcHMgPSBzdG9wczsKICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBsYXN0UG9zID0gcG9zICsgMTsKICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHRoaXMubU51bVN0b3BzID0gbnM7CiAgICAgICAgIH0KIAotICAgICAgICBpZiAoZm0gIT0gbnVsbCkgewotICAgICAgICAgICAgZm0uYXNjZW50ID0gYXNjZW50OwotICAgICAgICAgICAgZm0uZGVzY2VudCA9IGRlc2NlbnQ7Ci0gICAgICAgICAgICBmbS50b3AgPSB0b3A7Ci0gICAgICAgICAgICBmbS5ib3R0b20gPSBib3R0b207CisgICAgICAgIGZsb2F0IG5leHRUYWIoZmxvYXQgaCkgeworICAgICAgICAgICAgaW50IG5zID0gdGhpcy5tTnVtU3RvcHM7CisgICAgICAgICAgICBpZiAobnMgPiAwKSB7CisgICAgICAgICAgICAgICAgaW50W10gc3RvcHMgPSB0aGlzLm1TdG9wczsKKyAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IG5zOyArK2kpIHsKKyAgICAgICAgICAgICAgICAgICAgaW50IHN0b3AgPSBzdG9wc1tpXTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKHN0b3AgPiBoKSB7CisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gc3RvcDsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiBuZXh0RGVmYXVsdFN0b3AoaCwgbUluY3JlbWVudCk7CiAgICAgICAgIH0KIAotICAgICAgICBpZiAoaGFzVGFicykKLSAgICAgICAgICAgIFRleHRVdGlscy5yZWN5Y2xlKGJ1Zik7Ci0KLSAgICAgICAgcmV0dXJuIHdpZHRoOworICAgICAgICBwdWJsaWMgc3RhdGljIGZsb2F0IG5leHREZWZhdWx0U3RvcChmbG9hdCBoLCBpbnQgaW5jKSB7CisgICAgICAgICAgICByZXR1cm4gKChpbnQpICgoaCArIGluYykgLyBpbmMpKSAqIGluYzsKKyAgICAgICAgfQogICAgIH0KIAogICAgIC8qKgpAQCAtMTc1MSw3ICsxNTEzLDcgQEAKIAogICAgICAgICBpZiAodGV4dCBpbnN0YW5jZW9mIFNwYW5uZWQpIHsKICAgICAgICAgICAgIGlmICh0YWJzID09IG51bGwpIHsKLSAgICAgICAgICAgICAgICB0YWJzID0gKChTcGFubmVkKSB0ZXh0KS5nZXRTcGFucyhzdGFydCwgZW5kLCBUYWJTdG9wU3Bhbi5jbGFzcyk7CisgICAgICAgICAgICAgICAgdGFicyA9IGdldFBhcmFncmFwaFNwYW5zKChTcGFubmVkKSB0ZXh0LCBzdGFydCwgZW5kLCBUYWJTdG9wU3Bhbi5jbGFzcyk7CiAgICAgICAgICAgICAgICAgYWxsdGFicyA9IHRydWU7CiAgICAgICAgICAgICB9CiAKQEAgLTE3NzgsNiArMTU0MCwzOCBAQAogICAgICAgICByZXR1cm4gbVNwYW5uZWRUZXh0OwogICAgIH0KIAorICAgIC8qKgorICAgICAqIFJldHVybnMgdGhlIHNhbWUgYXMgPGNvZGU+dGV4dC5nZXRTcGFucygpPC9jb2RlPiwgZXhjZXB0IHdoZXJlCisgICAgICogPGNvZGU+c3RhcnQ8L2NvZGU+IGFuZCA8Y29kZT5lbmQ8L2NvZGU+IGFyZSB0aGUgc2FtZSBh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gICBNZWFzdXJlZFRleHQgbXQ7CisgICAgICAgIHN5bmNocm9uaXplZCAoY2FjaGVkKSB7CisgICAgICAgICAgICBmb3IgKGludCBpID0gY2FjaGVkLmxlbmd0aDsgLS1pID49IDA7KSB7CisgICAgICAgICAgICAgICAgaWYgKGNhY2hlZFtpXSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIG10ID0gY2FjaGVkW2ldOworICAgICAgICAgICAgICAgICAgICBjYWNoZWRbaV0gPSBudWxsOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gbXQ7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIG10ID0gbmV3IE1lYXN1cmVkVGV4dCgpOworICAgICAgICBMb2cuZSgiTUVBUyIsICJuZXc6ICIgKyBtdCk7CisgICAgICAgIHJldHVybiBtdDsKKyAgICB9CisKKyAgICAvKiBwYWNrYWdlICovCisgICAgc3RhdGljIE1lYXN1cmVkVGV4dCByZWN5Y2xlKE1lYXN1cmVkVGV4dCBtdCkgeworICAgICAgICBtdC5tVGV4dCA9IG51bGw7CisgICAgICAgIGlmIChtdC5tTGVuIDwgMTAwMCkgeworICAgICAgICAgICAgc3luY2hyb25pemVkKGNhY2hlZCkgeworICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgY2FjaGVkLmxlbmd0aDsgKytpKSB7CisgICAgICAgICAgICAgICAgICAgIGlmIChjYWNoZWRbaV0gPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgY2FjaGVkW2ldID0gbXQ7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbnVsbDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBBbmFseXplcyB0ZXh0IGZvciBiaWRpcmVjdGlvbmFsIHJ1bnMuICBBbGxvY2F0ZXMgd29ya2luZyBidWZmZXJzLgorICAgICAqLworICAgIC8qIHBhY2thZ2UgKi8KKyAgICB2b2lkIHNldFBhcmEoQ2hhclNlcXVlbmNlIHRleHQsIGludCBzdGFydCwgaW50IGVuZCwgaW50IGJpZGlSZXF1ZXN0KSB7CisgICAgICAgIG1UZXh0ID0gdGV4dDsKKyAgICAgICAgbVRleHRTdGFydCA9IHN0YXJ0OworCisgICAgICAgIGludCBsZW4gPSBlbmQgLSBzdGFydDsKKyAgICAgICAgbUxlbiA9IGxlbjsKKyAgICAgICAgbVBvcyA9IDA7CisKKyAgICAgICAgaWYgKG1XaWR0aHMgPT0gbnVsbCB8fCBtV2lkdGhzLmxlbmd0aCA8IGxlbikgeworICAgICAgICAgICAgbVdpZHRocyA9IG5ldyBmbG9hdFtBcnJheVV0aWxzLmlkZWFsRmxvYXRBcnJheVNpemUobGVuKV07CisgICAgICAgIH0KKyAgICAgICAgaWYgKG1DaGFycyA9PSBudWxsIHx8IG1DaGFycy5sZW5ndGggPCBsZW4pIHsKKyAgICAgICAgICAgIG1DaGFycyA9IG5ldyBjaGFyW0FycmF5VXRpbHMuaWRlYWxDaGFyQXJyYXlTaXplKGxlbildOworICAgICAgICB9CisgICAgICAgIFRleHRVdGlscy5nZXRDaGFycyh0ZXh0LCBzdGFydCwgZW5kLCBtQ2hhcnMsIDApOworCisgICAgICAgIGlmICh0ZXh0IGluc3RhbmNlb2YgU3Bhbm5lZCkgeworICAgICAgICAgICAgU3Bhbm5lZCBzcGFubmVkID0gKFNwYW5uZWQpIHRleHQ7CisgICAgICAgICAgICBSZXBsYWNlbWVudFNwYW5bXSBzcGFucyA9IHNwYW5uZWQuZ2V0U3BhbnMoc3RhcnQsIGVuZCwKKyAgICAgICAgICAgICAgICAgICAgUmVwbGFjZW1lbnRTcGFuLmNsYXNzKTsKKworICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBzcGFucy5sZW5ndGg7IGkrKykgeworICAgICAgICAgICAgICAgIGludCBzdGFydEluUGFyYSA9IHNwYW5uZWQuZ2V0U3BhblN0YXJ0KHNwYW5zW2ldKSAtIHN0YXJ0OworICAgICAgICAgICAgICAgIGludCBlbmRJblBhcmEgPSBzcGFubmVkLmdldFNwYW5FbmQoc3BhbnNbaV0pIC0gc3RhcnQ7CisgICAgICAgICAgICAgICAgZm9yIChpbnQgaiA9IHN0YXJ0SW5QYXJhOyBqIDwgZW5kSW5QYXJhOyBqKyspIHsKKyAgICAgICAgICAgICAgICAgICAgbUNoYXJzW2pdID0gJ1x1RkZGQyc7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgaWYgKFRleHRVdGlscy5kb2VzTm90TmVlZEJpZGkobUNoYXJzLCAwLCBsZW4pKSB7CisgICAgICAgICAgICBtRGlyID0gTGF5b3V0LkRJUl9MRUZUX1RPX1JJR0hUOworICAgICAgICAgICAgbUVhc3kgPSB0cnVlOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgaWYgKG1MZXZlbHMgPT0gbnVsbCB8fCBtTGV2ZWxzLmxlbmd0aCA8IGxlbikgeworICAgICAgICAgICAgICAgIG1MZXZlbHMgPSBuZXcgYnl0ZVtBcnJheVV0aWxzLmlkZWFsQnl0ZUFycmF5U2l6ZShsZW4pXTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1EaXIgPSBBbmRyb2lkQmlkaS5iaWRpKGJpZGlSZXF1ZXN0LCBtQ2hhcnMsIG1MZXZlbHMsIGxlbiwgZmFsc2UpOworICAgICAgICAgICAgbUVhc3kgPSBmYWxzZTsKKyAgICAgICAgfQorICAgIH0KKworICAgIGZsb2F0IGFkZFN0eWxlUnVuKFRleHRQYWludCBwYWludCwgaW50IGxlbiwgUGFpbnQuRm9udE1ldHJpY3NJbnQgZm0pIHsKKyAgICAgICAgaWYgKGZtICE9IG51bGwpIHsKKyAgICAgICAgICAgIHBhaW50LmdldEZvbnRNZXRyaWNzSW50KGZtKTsKKyAgICAgICAgfQorCisgICAgICAgIGludCBwID0gbVBvczsKKyAgICAgICAgbVBvcyA9IHAgKyBsZW47CisKKyAgICAgICAgaWYgKG1FYXN5KSB7CisgICAgICAgICAgICBpbnQgZmxhZ3MgPSBtRGlyID09IExheW91dC5ESVJfTEVGVF9UT19SSUdIVAorICAgICAgICAgICAgICAgID8gQ2FudmFzLkRJUkVDVElPTl9MVFIgOiBDYW52YXMuRElSRUNUSU9OX1JUTDsKKyAgICAgICAgICAgIHJldHVybiBwYWludC5nZXRUZXh0UnVuQWR2YW5jZXMobUNoYXJzLCBwLCBsZW4sIHAsIGxlbiwgZmxhZ3MsIG1XaWR0aHMsIHApOworICAgICAgICB9CisKKyAgICAgICAgZmxvYXQgdG90YWxBZHZhbmNlID0gMDsKKyAgICAgICAgaW50IGxldmVsID0gbUxldmVsc1twXTsKKyAgICAgICAgZm9yIChpbnQgcSA9IHAsIGkgPSBwICsgMSwgZSA9IHAgKyBsZW47OyArK2kpIHsKKyAgICAgICAgICAgIGlmIChpID09IGUgfHwgbUxldmVsc1tpXSAhPSBsZXZlbCkgeworICAgICAgICAgICAgICAgIGludCBmbGFncyA9IChsZXZlbCAmIDB4MSkgPT0gMCA/IENhbnZhcy5ESVJFQ1RJT05fTFRSIDogQ2FudmFzLkRJUkVDVElPTl9SVEw7CisgICAgICAgICAgICAgICAgdG90YWxBZHZhbmNlICs9CisgICAgICAgICAgICAgICAgICAgICAgICBwYWludC5nZXRUZXh0UnVuQWR2YW5jZXMobUNoYXJzLCBxLCBpIC0gcSwgcSwgaSAtIHEsIGZsYWdzLCBtV2lkdGhzLCBxKTsKKyAgICAgICAgICAgICAgICBpZiAoaSA9PSBlKSB7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBxID0gaTsKKyAgICAgICAgICAgICAgICBsZXZlbCA9IG1MZXZlbHNbaV07CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHRvdGFsQWR2YW5jZTsKKyAgICB9CisKKyAgICBmbG9hdCBhZGRTdHlsZVJ1bihUZXh0UGFpbnQgcGFpbnQsIE1ldHJpY0FmZmVjdGluZ1NwYW5bXSBzcGFucywgaW50IGxlbiwKKyAgICAgICAgICAgIFBhaW50LkZvbnRNZXRyaWNzSW50IGZtKSB7CisKKyAgICAgICAgVGV4dFBhaW50IHdvcmtQYWludCA9IG1Xb3JrUGFpbnQ7CisgICAgICAgIHdvcmtQYWludC5zZXQocGFpbnQpOworICAgICAgICAvLyBYWFggcGFpbnQgc2hvdWxkIG5vdCBoYXZlIGEgYmFzZWxpbmUgc2hpZnQsIGJ1dC4uLgorICAgICAgICB3b3JrUGFpbnQuYmFzZWxpbmVTaGlmdCA9IDA7CisKKyAgICAgICAgUmVwbGFjZW1lbnRTcGFuIHJlcGxhY2VtZW50ID0gbnVsbDsKKyAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBzcGFucy5sZW5ndGg7IGkrKykgeworICAgICAgICAgICAgTWV0cmljQWZmZWN0aW5nU3BhbiBzcGFuID0gc3BhbnNbaV07CisgICAgICAgICAgICBpZiAoc3BhbiBpbnN0YW5jZW9mIFJlcGxhY2VtZW50U3BhbikgeworICAgICAgICAgICAgICAgIHJlcGxhY2VtZW50ID0gKFJlcGxhY2VtZW50U3BhbilzcGFuOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBzcGFuLnVwZGF0ZU1lYXN1cmVTdGF0ZSh3b3JrUGFpbnQpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgZmxvYXQgd2lkOworICAgICAgICBpZiAocmVwbGFjZW1lbnQgPT0gbnVsbCkgeworICAgICAgICAgICAgd2lkID0gYWRkU3R5bGVSdW4od29ya1BhaW50LCBsZW4sIGZtKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIC8vIFVzZSBvcmlnaW5hbCB0ZXh0LiAgU2hvdWxkbid0IG1hdHRlci4KKyAgICAgICAgICAgIHdpZCA9IHJlcGxhY2VtZW50LmdldFNpemUod29ya1BhaW50LCBtVGV4dCwgbVRleHRTdGFydCArIG1Qb3MsCisgICAgICAgICAgICAgICAgICAgIG1UZXh0U3RhcnQgKyBtUG9zICsgbGVuLCBmbSk7CisgICAgICAgICAgICBmbG9hdFtdIHcgPSBtV2lkdGhzOworICAgICAgICAgICAgd1ttUG9zXSA9IHdpZDsKKyAgICAgICAgICAgIGZvciAoaW50IGkgPSBtUG9zICsgMSwgZSA9IG1Qb3MgKyBsZW47IGkgPCBlOyBpKyspCisgICAgICAgICAgICAgICAgd1tpXSA9IDA7CisgICAgICAgIH0KKworICAgICAgICBpZiAoZm0gIT0gbnVsbCkgeworICAgICAgICAgICAgaWYgKHdvcmtQYWludC5iYXNlbGluZVNoaWZ0IDwgMCkgeworICAgICAgICAgICAgICAgIGZtLmFzY2VudCArPSB3b3JrUGFpbnQuYmFzZWxpbmVTaGlmdDsKKyAgICAgICAgICAgICAgICBmbS50b3AgKz0gd29ya1BhaW50LmJhc2VsaW5lU2hpZnQ7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGZtLmRlc2NlbnQgKz0gd29ya1BhaW50LmJhc2VsaW5lU2hpZnQ7CisgICAgICAgICAgICAgICAgZm0uYm90dG9tICs9IHdvcmtQYWludC5iYXNlbGluZVNoaWZ0OworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcmV0dXJuIHdpZDsKKyAgICB9CisKKyAgICBpbnQgYnJlYWtUZXh0KGludCBzdGFydCwgaW50IGxpbWl0LCBib29sZWFuIGZvcndhcmRzLCBmbG9hdCB3aWR0aCkgeworICAgICAgICBmbG9hdFtdIHcgPSBtV2lkdGhzOworICAgICAgICBpZiAoZm9yd2FyZHMpIHsKKyAgICAgICAgICAgIGZvciAoaW50IGkgPSBzdGFydDsgaSA8IGxpbWl0OyArK2kpIHsKKyAgICAgICAgICAgICAgICBpZiAoKHdpZHRoIC09IHdbaV0pIDwgMCkgeworICAgICAgICAgICAgICAgICAgICByZXR1cm4gaSAtIHN0YXJ0OworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGZvciAoaW50IGkgPSBsaW1pdDsgLS1pID49IHN0YXJ0OykgeworICAgICAgICAgICAgICAgIGlmICgod2lkdGggLT0gd1tpXSkgPCAwKSB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBsaW1pdCAtIGkgLTE7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcmV0dXJuIGxpbWl0IC0gc3RhcnQ7CisgICAgfQorCisgICAgZmxvYXQgbWVhc3VyZShpbnQgc3RhcnQsIGludCBsaW1pdCkgeworICAgICAgICBmbG9hdCB3aWR0aCA9IDA7CisgICAgICAgIGZsb2F0W10gdyA9IG1XaWR0aHM7CisgICAgICAgIGZvciAoaW50IGkgPSBzdGFydDsgaSA8IGxpbWl0OyArK2kpIHsKKyAgICAgICAgICAgIHdpZHRoICs9IHdbaV07CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHdpZHRoOworICAgIH0KK30KXCBObyBuZXdsaW5lIGF0IGVuZCBvZiBmaWxlCmRpZmYgLS1naXQgYS9jb3JlL2phdmEvYW5kcm9pZC90ZXh0L1NwYW5uYWJsZVN0cmluZ0J1aWxkZXIuamF2YSBiL2NvcmUvamF2YS9hbmRyb2lkL3RleHQvU3Bhbm5hYmxlU3RyaW5nQnVpbGRlci5qYXZhCmluZGV4IGNhYWFmYTEuLmZjMDFlZjIgMTAwNjQ0Ci0tLSBhL2NvcmUvamF2YS9hbmRyb2lkL3RleHQvU3Bhbm5hYmxlU3RyaW5nQnVpbGRlci5qYXZhCisrKyBiL2NvcmUvamF2YS9hbmRyb2lkL3RleHQvU3Bhbm5hYmxlU3RyaW5nQnVpbGRl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ZXdDaGFyczsKIAogICAgICAgICBpZiAobUdhcExlbmd0aCA8IDEpCiAgICAgICAgICAgICBuZXcgRXhjZXB0aW9uKCJtR2FwTGVuZ3RoIDwgMSIpLnByaW50U3RhY2tUcmFjZSgpOwpAQCAtNzA3LDYgKzcxMSw3IEBACiAgICAgICogdGhlIHNwZWNpZmllZCByYW5nZSBvZiB0aGUgYnVmZmVyLiAgVGhlIGtpbmQgbWF5IGJlIE9iamVjdC5jbGFzcyB0byBnZXQKICAgICAgKiBhIGxpc3Qgb2YgYWxsIHRoZSBzcGFucyByZWdhcmRsZXNzIG9mIHR5cGUuCiAgICAgICovCisgICAgQFN1cHByZXNzV2FybmluZ3MoInVuY2hlY2tlZCIpCiAgICAgcHVibGljIDxUPiBUW10gZ2V0U3BhbnMoaW50IHF1ZXJ5U3RhcnQsIGludCBxdWVyeUVuZCwgQ2xhc3M8VD4ga2luZCkgewogICAgICAgICBpbnQgc3BhbkNvdW50ID0gbVNwYW5Db3VudDsKICAgICAgICAgT2JqZWN0W10gc3BhbnMgPSBtU3BhbnM7CkBAIC03MTcsOCArNzIyLDggQEAKICAgICAgICAgaW50IGdhcGxlbiA9IG1HYXBMZW5ndGg7CiAKICAgICAgICAgaW50IGNvdW50ID0gMDsKLSAgICAgICAgT2JqZWN0W10gcmV0ID0gbnVsbDsKLSAgICAgICAgT2JqZWN0IHJldDEgPSBudWxsOworICAgICAgICBUW10gcmV0ID0gbnVsbDsKKyAgICAgICAgVCByZXQxID0gbnVsbDsKIAogICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IHNwYW5Db3VudDsgaSsrKSB7CiAgICAgICAgICAgICBpbnQgc3BhblN0YXJ0ID0gc3RhcnRzW2ldOwpAQCAtNzUwLDExICs3NTUsMTMgQEAKICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgaWYgKGNvdW50ID09IDApIHsKLSAgICAgICAgICAgICAgICByZXQxID0gc3BhbnNbaV07CisgICAgICAgICAgICAgICAgLy8gU2FmZSBjb252ZXJzaW9uIHRoYW5rcyB0byB0aGUgaXNJbnN0YW5jZSB0ZXN0IGFib3ZlCisgICAgICAgICAgICAgICAgcmV0MSA9IChUKSBzcGFuc1tpXTsKICAgICAgICAgICAgICAgICBjb3VudCsrOwogICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICBpZiAoY291bnQgPT0gMSkgewotICAgICAgICAgICAgICAgICAgICByZXQgPSAoT2JqZWN0W10pIEFycmF5Lm5ld0luc3RhbmNlKGtpbmQsIHNwYW5Db3VudCAtIGkgKyAxKTsKKyAgICAgICAgICAgICAgICAgICAgLy8gU2FmZSBjb252ZXJzaW9uLCBidXQgcmVxdWlyZXMgYSBzdXBwcmVzc1dhcm5pbmcKKyAgICAgICAgICAgICAgICAgICAgcmV0ID0gKFRbXSkgQXJyYXkubmV3SW5zdGFuY2Uoa2luZCwgc3BhbkNvdW50IC0gaSArIDEpOwogICAgICAgICAgICAgICAgICAgICByZXRbMF0gPSByZXQxOwogICAgICAgICAgICAgICAgIH0KIApAQCAtNzcxLDI5ICs3NzgsMzMgQEAKICAgICAgICAgICAgICAgICAgICAgfQogCiAgICAgICAgICAgICAgICAgICAgIFN5c3RlbS5hcnJheWNvcHkocmV0LCBqLCByZXQsIGogKyAxLCBjb3VudCAtIGopOwotICAgICAgICAgICAgICAgICAgICByZXRbal0gPSBzcGFuc1tpXTsKKyAgICAgICAgICAgICAgICAgICAgLy8gU2FmZSBjb252ZXJzaW9uIHRoYW5rcyB0byB0aGUgaXNJbnN0YW5jZSB0ZXN0IGFib3ZlCisgICAgICAgICAgICAgICAgICAgIHJldFtqXSA9IChUKSBzcGFuc1tpXTsKICAgICAgICAgICAgICAgICAgICAgY291bnQrKzsKICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICByZXRbY291bnQrK10gPSBzcGFuc1tpXTsKKyAgICAgICAgICAgICAgICAgICAgLy8gU2FmZSBjb252ZXJzaW9uIHRoYW5rcyB0byB0aGUgaXNJbnN0YW5jZSB0ZXN0IGFib3ZlCisgICAgICAgICAgICAgICAgICAgIHJldFtjb3VudCsrXSA9IChUKSBzcGFuc1tpXTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KIAogICAgICAgICBpZiAoY291bnQgPT0gMCkgewotICAgICAgICAgICAgcmV0dXJuIChUW10pIEFycmF5VXRpbHMuZW1wdHlBcnJheShraW5kKTsKKyAgICAgICAgICAgIHJldHVybiBBcnJheVV0aWxzLmVtcHR5QXJyYXkoa2luZCk7CiAgICAgICAgIH0KICAgICAgICAgaWYgKGNvdW50ID09IDEpIHsKLSAgICAgICAgICAgIHJldCA9IChPYmplY3RbXSkgQXJyYXkubmV3SW5zdGFuY2Uoa2luZCwgMSk7CisgICAgICAgICAgICAvLyBTYWZlIGNvbnZlcnNpb24sIGJ1dCByZXF1aXJlcyBhIHN1cHByZXNzV2FybmluZworICAgICAgICAgICAgcmV0ID0gKFRbXSkgQXJyYXkubmV3SW5zdGFuY2Uoa2luZCwgMSk7CiAgICAgICAgICAgICByZXRbMF0gPSByZXQxOwotICAgICAgICAgICAgcmV0dXJuIChUW10pIHJldDsKKyAgICAgICAgICAgIHJldHVybiByZXQ7CiAgICAgICAgIH0KICAgICAgICAgaWYgKGNvdW50ID09IHJldC5sZW5ndGgpIHsKLSAgICAgICAgICAgIHJldHVybiAoVFtdKSByZXQ7CisgICAgICAgICAgICByZXR1cm4gcmV0OwogICAgICAgICB9CiAKLSAgICAgICAgT2JqZWN0W10gbnJldCA9IChPYmplY3RbXSkgQXJyYXkubmV3SW5zdGFuY2Uoa2luZCwgY291bnQpOworICAgICAgICAvLyBTYWZlIGNvbnZlcnNpb24sIGJ1dCByZXF1aXJlcyBhIHN1cHByZXNzV2FybmluZworICAgICAgICBUW10gbnJldCA9IChUW10pIEFycmF5Lm5ld0luc3RhbmNlKGtpbmQsIGNvdW50KTsKICAgICAgICAgU3lzdGVtLmFycmF5Y29weShyZXQsIDAsIG5yZXQsIDAsIGNvdW50KTsKLSAgICAgICAgcmV0dXJuIChUW10pIG5yZXQ7CisgICAgICAgIHJldHVybiBucmV0OwogICAgIH0KIAogICAgIC8qKgpAQCAtODYyLDYgKzg3Myw3IEBACiAgICAgLyoqCiAgICAgICogUmV0dXJuIGEgU3RyaW5nIGNvbnRhaW5pbmcgYSBjb3B5IG9mIHRoZSBjaGFycyBpbiB0aGlzIGJ1ZmZlci4KICAgICAgKi8KKyAgICBAT3ZlcnJpZGUKICAgICBwdWJsaWMgU3RyaW5nIHRvU3RyaW5nKCkgewogICAgICAgICBpbnQgbGVuID0gbGVuZ3RoKCk7CiAgICAgICAgIGNoYXJbXSBidWYgPSBuZXcgY2hhcltsZW5dOwpAQCAtOTUyLDYgKzk2NCw3IEBACiAgICAgICAgIH0KICAgICB9CiAKKy8qCiAgICAgcHJpdmF0ZSBib29sZWFuIGlzcHJpbnQoY2hhciBjKSB7IC8vIFhYWAogICAgICAgICBpZiAoYyA+PSAnICcgJiYgYyA8PSAnficpCiAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKQEAgLTk1OSw3ICs5NzIsNiBAQAogICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgIH0KIAotLyoKICAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgc3RhcnRGbGFnKGludCBmbGFnKSB7CiAgICAgICAgIHJldHVybiAoZmxhZyA+PiA0KSAmIDB4MEY7CiAgICAgfQpAQCAtMTA1NCw3ICsxMDY2LDMyIEBACiAgICAgICAgIH0KICAgICB9CiAKKwogICAgIC8qKgorICAgICAqIERvbid0IGNhbGwgdGhpcyB5b3Vyc2VsZiAtLSBleGlzdHMgZm9yIENhbnZhcyB0byB1c2UgaW50ZXJuYWxseS4KKyAgICAgKiB7QGhpZGV9CisgICAgICovCisgICAgcHVibGljIHZvaWQgZHJhd1RleHRSdW4oQ2FudmFzIGMsIGludCBzdGFydCwgaW50IGVuZCwKKyAgICAgICAgICAgIGludCBjb250ZXh0U3RhcnQsIGludCBjb250ZXh0RW5kLAorICAgICAgICAgICAgZmxvYXQgeCwgZmxvYXQgeSwgaW50IGZsYWdzLCBQYWludCBwKSB7CisgICAgICAgIGNoZWNrUmFuZ2UoImRyYXdUZXh0UnVuIiwgc3RhcnQsIGVuZCk7CisKKyAgICAgICAgaW50IGNvbnRleHRMZW4gPSBjb250ZXh0RW5kIC0gY29udGV4dFN0YXJ0OworICAgICAgICBpbnQgbGVuID0gZW5kIC0gc3RhcnQ7CisgICAgICAgIGlmIChjb250ZXh0RW5kIDw9IG1HYXBTdGFydCkgeworICAgICAgICAgICAgYy5kcmF3VGV4dFJ1bihtVGV4dCwgc3RhcnQsIGxlbiwgY29udGV4dFN0YXJ0LCBjb250ZXh0TGVuLCB4LCB5LCBmbGFncywgcCk7CisgICAgICAgIH0gZWxzZSBpZiAoY29udGV4dFN0YXJ0ID49IG1HYXBTdGFydCkgeworICAgICAgICAgICAgYy5kcmF3VGV4dFJ1bihtVGV4dCwgc3RhcnQgKyBtR2FwTGVuZ3RoLCBsZW4sIGNvbnRleHRTdGFydCArIG1HYXBMZW5ndGgsCisgICAgICAgICAgICAgICAgICAgIGNvbnRleHRMZW4sIHgsIHksIGZsYWdzLCBwKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGNoYXJbXSBidWYgPSBUZXh0VXRpbHMub2J0YWluKGNvbnRleHRMZW4pOworICAgICAgICAgICAgZ2V0Q2hhcnMoY29udGV4dFN0YXJ0LCBjb250ZXh0RW5kLCBidWYsIDApOworICAgICAgICAgICAgYy5kcmF3VGV4dFJ1bihidWYsIHN0YXJ0IC0gY29udGV4dFN0YXJ0LCBsZW4sIDAsIGNvbnRleHRMZW4sIHgsIHksIGZsYWdzLCBwKTsKKyAgICAgICAgICAgIFRleHRVdGlscy5yZWN5Y2xlKGJ1Zik7CisgICAgICAgIH0KKyAgICB9CisKKyAgIC8qKgogICAgICAqIERvbid0IGNhbGwgdGhpcyB5b3Vyc2VsZiAtLSBleGlzdHMgZm9yIFBhaW50IHRvIHVzZSBpbnRlcm5hbGx5LgogICAgICAqIHtAaGlkZX0KICAgICAgKi8KQEAgLTExMDMsNiArMTE0MCw1OCBAQAogICAgICAgICByZXR1cm4gcmV0OwogICAgIH0KIAorICAgIC8qKgorICAgICAqIERvbid0IGNhbGwgdGhpcyB5b3Vyc2VsZiAtLSBleGlzdHMgZm9yIFBhaW50IHRvIHVzZSBpbnRlcm5hbGx5LgorICAgICAqIHtAaGlkZX0KKyAgICAgKi8KKyAgICBwdWJsaWMgZmxvYXQgZ2V0VGV4dFJ1bkFkdmFuY2VzKGludCBzdGFydCwgaW50IGVuZCwgaW50IGNvbnRleHRTdGFydCwgaW50IGNvbnRleHRFbmQsIGludCBmbGFncywKKyAgICAgICAgICAgIGZsb2F0W10gYWR2YW5jZXMsIGludCBhZHZhbmNlc1BvcywgUGFpbnQgcCkgeworCisgICAgICAgIGZsb2F0IHJldDsKKworICAgICAgICBpbnQgY29udGV4dExlbiA9IGNvbnRleHRFbmQgLSBjb250ZXh0U3RhcnQ7CisgICAgICAgIGludCBsZW4gPSBlbmQgLSBzdGFydDsKKworICAgICAgICBpZiAoZW5kIDw9IG1HYXBTdGFydCkgeworICAgICAgICAgICAgcmV0ID0gcC5nZXRUZXh0UnVuQWR2YW5jZXMobVRleHQsIHN0YXJ0LCBsZW4sIGNvbnRleHRTdGFydCwgY29udGV4dExlbiwKKyAgICAgICAgICAgICAgICAgICAgZmxhZ3MsIGFkdmFuY2VzLCBhZHZhbmNlc1Bvcyk7CisgICAgICAgIH0gZWxzZSBpZiAoc3RhcnQgPj0gbUdhcFN0YXJ0KSB7CisgICAgICAgICAgICByZXQgPSBwLmdldFRleHRSdW5BZHZhbmNlcyhtVGV4dCwgc3RhcnQgKyBtR2FwTGVuZ3RoLCBsZW4sCisgICAgICAgICAgICAgICAgICAgIGNvbnRleHRTdGFydCArIG1HYXBMZW5ndGgsIGNvbnRleHRMZW4sIGZsYWdzLCBhZHZhbmNlcywgYWR2YW5jZXNQb3MpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgY2hhcltdIGJ1ZiA9IFRleHRVdGlscy5vYnRhaW4oY29udGV4dExlbik7CisgICAgICAgICAgICBnZXRDaGFycyhjb250ZXh0U3RhcnQsIGNvbnRleHRFbmQsIGJ1ZiwgMCk7CisgICAgICAgICAgICByZXQgPSBwLmdldFRleHRSdW5BZHZhbmNlcyhidWYsIHN0YXJ0IC0gY29udGV4dFN0YXJ0LCBsZW4sCisgICAgICAgICAgICAgICAgICAgIDAsIGNvbnRleHRMZW4sIGZsYWdzLCBhZHZhbmNlcywgYWR2YW5jZXNQb3MpOworICAgICAgICAgICAgVGV4dFV0aWxzLnJlY3ljbGUoYnVmKTsKKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiByZXQ7CisgICAgfQorCisgICAgcHVibGljIGludCBnZXRUZXh0UnVuQ3Vyc29yKGludCBjb250ZXh0U3RhcnQsIGludCBjb250ZXh0RW5kLCBpbnQgZmxhZ3MsIGludCBvZmZzZXQsCisgICAgICAgICAgICBpbnQgY3Vyc29yT3B0LCBQYWludCBwKSB7CisKKyAgICAgICAgaW50IHJldDsKKworICAgICAgICBpbnQgY29udGV4dExlbiA9IGNvbnRleHRFbmQgLSBjb250ZXh0U3RhcnQ7CisgICAgICAgIGlmIChjb250ZXh0RW5kIDw9IG1HYXBTdGFydCkgeworICAgICAgICAgICAgcmV0ID0gcC5nZXRUZXh0UnVuQ3Vyc29yKG1UZXh0LCBjb250ZXh0U3RhcnQsIGNvbnRleHRMZW4sCisgICAgICAgICAgICAgICAgICAgIGZsYWdzLCBvZmZzZXQsIGN1cnNvck9wdCk7CisgICAgICAgIH0gZWxzZSBpZiAoY29udGV4dFN0YXJ0ID49IG1HYXBTdGFydCkgeworICAgICAgICAgICAgcmV0ID0gcC5nZXRUZXh0UnVuQ3Vyc29yKG1UZXh0LCBjb250ZXh0U3RhcnQgKyBtR2FwTGVuZ3RoLCBjb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HJvaWQuZ3JhcGhpY3MuUGFpbnQpCisgKiBDYW52YXMuZHJhd1RleHQoKX0gZGlyZWN0bHkuPC9wPgogICovCiBwdWJsaWMgY2xhc3MKIFN0YXRpY0xheW91dApAQCAtNjIsNyArNjQsNyBAQAogICAgICAgICAgICAgICAgICAgICAgICAgYm9vbGVhbiBpbmNsdWRlcGFkLAogICAgICAgICAgICAgICAgICAgICAgICAgVGV4dFV0aWxzLlRydW5jYXRlQXQgZWxsaXBzaXplLCBpbnQgZWxsaXBzaXplZFdpZHRoKSB7CiAgICAgICAgIHN1cGVyKChlbGxpcHNpemUgPT0gbnVsbCkKLSAgICAgICAgICAgICAgICA/IHNvdXJjZSAKKyAgICAgICAgICAgICAgICA/IHNvdXJjZQogICAgICAgICAgICAgICAgIDogKHNvdXJjZSBpbnN0YW5jZW9mIFNwYW5uZWQpCiAgICAgICAgICAgICAgICAgICAgID8gbmV3IFNwYW5uZWRFbGxpcHNpemVyKHNvdXJjZSkKICAgICAgICAgICAgICAgICAgICAgOiBuZXcgRWxsaXBzaXplcihzb3VyY2UpLApAQCAtNzIsNyArNzQsNyBAQAogICAgICAgICAgKiBUaGlzIGlzIGFubm95aW5nLCBidXQgd2UgY2FuJ3QgcmVmZXIgdG8gdGhlIGxheW91dCB1bnRpbAogICAgICAgICAgKiBzdXBlcmNsYXNzIGNvbnN0cnVjdGlvbiBpcyBmaW5pc2hlZCwgYW5kIHRoZSBzdXBlcmNsYXNzCiAgICAgICAgICAqIGNvbnN0cnVjdG9yIHdhbnRzIHRoZSByZWZlcmVuY2UgdG8gdGhlIGRpc3BsYXkgdGV4dC4KLSAgICAgICAgICogCisgICAgICAgICAqCiAgICAgICAgICAqIFRoaXMgd2lsbCBicmVhayBpZiB0aGUgc3VwZXJjbGFzcyBjb25zdHJ1Y3RvciBldmVyIGFjdHVhbGx5CiAgICAgICAgICAqIGNhcmVzIGFib3V0IHRoZSBjb250ZW50IGluc3RlYWQgb2YganVzdCBob2xkaW5nIHRoZSBy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cGFubmVkIHNwYW5uZWQgPSBudWxsOwotCiAgICAgICAgIGlmIChzb3VyY2UgaW5zdGFuY2VvZiBTcGFubmVkKQogICAgICAgICAgICAgc3Bhbm5lZCA9IChTcGFubmVkKSBzb3VyY2U7CiAKICAgICAgICAgaW50IERFRkFVTFRfRElSID0gRElSX0xFRlRfVE9fUklHSFQ7IC8vIFhYWAogCi0gICAgICAgIGZvciAoaW50IHN0YXJ0ID0gYnVmc3RhcnQ7IHN0YXJ0IDw9IGJ1ZmVuZDsgc3RhcnQgPSBlbmQpIHsKLSAgICAgICAgICAgIGlmIChmaXJzdCkKLSAgICAgICAgICAgICAgICBmaXJzdCA9IGZhbHNlOworICAgICAgICBpbnQgcGFyYUVuZDsKKyAgICAgICAgZm9yIChpbnQgcGFyYVN0YXJ0ID0gYnVmc3RhcnQ7IHBhcmFTdGFydCA8PSBidWZlbmQ7IHBhcmFTdGFydCA9IHBhcmFFbmQpIHsKKyAgICAgICAgICAgIHBhcmFFbmQgPSBUZXh0VXRpbHMuaW5kZXhPZihzb3VyY2UsICdcbicsIHBhcmFTdGFydCwgYnVmZW5kKTsKKyAgICAgICAgICAgIGlmIChwYXJhRW5kIDwgMCkKKyAgICAgICAgICAgICAgICBwYXJhRW5kID0gYnVmZW5kOwogICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgIGVuZCA9IFRleHRVdGlscy5pbmRleE9mKHNvdXJjZSwgJ1xuJywgc3RhcnQsIGJ1ZmVuZCk7CisgICAgICAgICAgICAgICAgcGFyYUVuZCsrOworICAgICAgICAgICAgaW50IHBhcmFMZW4gPSBwYXJhRW5kIC0gcGFyYVN0YXJ0OwogCi0gICAgICAgICAgICBpZiAoZW5kIDwgMCkKLSAgICAgICAgICAgICAgICBlbmQgPSBidWZlbmQ7Ci0gICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICAgICAgZW5kKys7Ci0KLSAgICAgICAgICAgIGludCBmaXJzdFdpZHRoTGluZUNvdW50ID0gMTsKKyAgICAgICAgICAgIGludCBmaXJzdFdpZHRoTGluZUxpbWl0ID0gbUxpbmVDb3VudCArIDE7CiAgICAgICAgICAgICBpbnQgZmlyc3R3aWR0aCA9IG91dGVyd2lkdGg7CiAgICAgICAgICAgICBpbnQgcmVzdHdpZHRoID0gb3V0ZXJ3aWR0aDsKIAogICAgICAgICAgICAgTGluZUhlaWdodFNwYW5bXSBjaG9vc2VodCA9IG51bGw7CiAKICAgICAgICAgICAgIGlmIChzcGFubmVkICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICBMZWFkaW5nTWFyZ2luU3BhbltdIHNwOwotCi0gICAgICAgICAgICAgICAgc3AgPSBzcGFubmVkLmdldFNwYW5zKHN0YXJ0LCBlbmQsIExlYWRpbmdNYXJnaW5TcGFuLmNsYXNzKTsKKyAgICAgICAgICAgICAgICBMZWFkaW5nTWFyZ2luU3BhbltdIHNwID0gZ2V0UGFyYWdyYXBoU3BhbnMoc3Bhbm5lZCwgcGFyYVN0YXJ0LCBwYXJhRW5kLAorICAgICAgICAgICAgICAgICAgICAgICAgTGVhZGluZ01hcmdpblNwYW4uY2xhc3MpOwogICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgc3AubGVuZ3RoOyBpKyspIHsKICAgICAgICAgICAgICAgICAgICAgTGVhZGluZ01hcmdpblNwYW4gbG1zID0gc3BbaV07CiAgICAgICAgICAgICAgICAgICAgIGZpcnN0d2lkdGggLT0gc3BbaV0uZ2V0TGVhZGluZ01hcmdpbih0cnVlKTsKICAgICAgICAgICAgICAgICAgICAgcmVzdHdpZHRoIC09IHNwW2ldLmdldExlYWRpbmdNYXJnaW4oZmFsc2UpOwotICAgICAgICAgICAgICAgICAgICBpZiAobG1zIGluc3RhbmNlb2YgTGVhZGluZ01hcmdpblNwYW4uTGVhZGluZ01hcmdpblNwYW4yKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBmaXJzdFdpZHRoTGluZUNvdW50ID0gKChMZWFkaW5nTWFyZ2luU3Bhbi5MZWFkaW5nTWFyZ2luU3BhbjIpbG1zKS5nZXRMZWFkaW5nTWFyZ2luTGluZUNvdW50KCk7CisgICAgICAgICAgICAgICAgICAgIAorICAgICAgICAgICAgICAgICAgICAvLyBMZWFkaW5nTWFyZ2luU3BhbjIgaXMgb2RkLiAgVGhlIGNvdW50IGFmZmVjdHMgYWxsCisgICAgICAgICAgICAgICAgICAgIC8vIGxlYWRpbmcgbWFyZ2luIHNwYW5zLCBub3QganVzdCB0aGlzIHBhcnRpY3VsYXIgb25lLAorICAgICAgICAgICAgICAgICAgICAvLyBhbmQgc3RhcnQgZnJvbSB0aGUgdG9wIG9mIHRoZSBzcGFuLCBub3QgdGhlIHRvcCBvZiB0aGUKKyAgICAgICAgICAgICAgICAgICAgLy8gcGFyYWdyYXBoLgorICAgICAgICAgICAgICAgICAgICBpZiAobG1zIGluc3RhbmNlb2YgTGVhZGluZ01hcmdpblNwYW4yKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBMZWFkaW5nTWFyZ2luU3BhbjIgbG1zMiA9IChMZWFkaW5nTWFyZ2luU3BhbjIpIGxtczsKKyAgICAgICAgICAgICAgICAgICAgICAgIGludCBsbXNGaXJzdExpbmUgPSBnZXRMaW5lRm9yT2Zmc2V0KHNwYW5uZWQuZ2V0U3BhblN0YXJ0KGxtczIpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZpcnN0V2lkdGhMaW5lTGltaXQgPSBsbXNGaXJzdExpbmUgKyAKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBsbXMyLmdldExlYWRpbmdNYXJnaW5MaW5lQ291bnQoKTsKICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgICAgIGNob29zZWh0ID0gc3Bhbm5lZC5nZXRTcGFucyhzdGFydCwgZW5kLCBMaW5lSGVpZ2h0U3Bhbi5jbGFzcyk7CisgICAgICAgICAgICAgICAgY2hvb3NlaHQgPSBnZXRQYXJhZ3JhcGhTcGFucyhzcGFubmVkLCBwYXJhU3RhcnQsIHBhcmFFbmQsIExpbmVIZWlnaHRTcGFuLmNsYXNzKTsKIAogICAgICAgICAgICAgICAgIGlmIChjaG9vc2VodC5sZW5ndGggIT0gMCkgewogICAgICAgICAgICAgICAgICAgICBpZiAoY2hvb3NlaHR2ID09IG51bGwgfHwKQEAgLTE5MiwxMSArMTg2LDExIEBACiAgICAgICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgY2hvb3NlaHQubGVuZ3RoOyBpKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgIGludCBvID0gc3Bhbm5lZC5nZXRTcGFuU3RhcnQoY2hvb3NlaHRbaV0pOwogCi0gICAgICAgICAgICAgICAgICAgICAgICBpZiAobyA8IHN0YXJ0KSB7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAobyA8IHBhcmFTdGFydCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHN0YXJ0cyBpbiB0aGlzIGxheW91dCwgYmVmb3JlIHRoZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGN1cnJlbnQgcGFyYWdyYXBoCiAKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaG9vc2VodHZbaV0gPSBnZXRMaW5lVG9wKGdldExpbmVGb3JPZmZzZXQobykpOyAKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaG9vc2VodHZbaV0gPSBnZXRMaW5lVG9wKGdldExpbmVGb3JPZmZzZXQobykpOwogICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBzdGFydHMgaW4gdGhpcyBwYXJhZ3JhcGgKIApAQCAtMjA2LDE2NiArMjAwLDg3IEBACiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogCi0gICAgICAgICAgICBpZiAoZW5kIC0gc3RhcnQgPiBjaGRpcnMubGVuZ3RoKSB7Ci0gICAgICAgICAgICAgICAgY2hkaXJzID0gbmV3IGJ5dGVbQXJyYXlVdGlscy5pZGVhbEJ5dGVBcnJheVNpemUoZW5kIC0gc3RhcnQpXTsKLSAgICAgICAgICAgICAgICBtQ2hkaXJzID0gY2hkaXJzOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKGVuZCAtIHN0YXJ0ID4gY2hzLmxlbmd0aCkgewotICAgICAgICAgICAgICAgIGNocyA9IG5ldyBjaGFyW0FycmF5VXRpbHMuaWRlYWxDaGFyQXJyYXlTaXplKGVuZCAtIHN0YXJ0KV07Ci0gICAgICAgICAgICAgICAgbUNocyA9IGNoczsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmICgoZW5kIC0gc3RhcnQpICogMiA+IHdpZHRocy5sZW5ndGgpIHsKLSAgICAgICAgICAgICAgICB3aWR0aHMgPSBuZXcgZmxvYXRbQXJyYXlVdGlscy5pZGVhbEludEFycmF5U2l6ZSgoZW5kIC0gc3RhcnQpICogMildOwotICAgICAgICAgICAgICAgIG1XaWR0aHMgPSB3aWR0aHM7Ci0gICAgICAgICAgICB9CisgICAgICAgICAgICBtZWFzdXJlZC5zZXRQYXJhKHNvdXJjZSwgcGFyYVN0YXJ0LCBwYXJhRW5kLCBESVJfUkVRVUVTVF9ERUZBVUxUX0xUUik7CisgICAgICAgICAgICBjaGFyW10gY2hzID0gbWVhc3VyZWQubUNoYXJzOworICAgICAgICAgICAgZmxvYXRbXSB3aWR0aHMgPSBtZWFzdXJlZC5tV2lkdGhzOworICAgICAgICAgICAgYnl0ZVtdIGNoZGlycyA9IG1lYXN1cmVkLm1MZXZlbHM7CisgICAgICAgICAgICBpbnQgZGlyID0gbWVhc3VyZWQubURpcjsKKyAgICAgICAgICAgIGJvb2xlYW4gZWFzeSA9IG1lYXN1cmVkLm1FYXN5OwogCi0gICAgICAgICAgICBUZXh0VXRpbHMuZ2V0Q2hhcnMoc291cmNlLCBzdGFydCwgZW5kLCBjaHMsIDApOwotICAgICAgICAgICAgZmluYWwgaW50IG4gPSBlbmQgLSBzdGFydDsKLQotICAgICAgICAgICAgYm9vbGVhbiBlYXN5ID0gdHJ1ZTsKLSAgICAgICAgICAgIGJvb2xlYW4gYWx0ZXJlZCA9IGZhbHNlOwotICAgICAgICAgICAgaW50IGRpciA9IERFRkFVTFRfRElSOyAvLyBYWFgKLQotICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBuOyBpKyspIHsKLSAgICAgICAgICAgICAgICBpZiAoY2hzW2ldID49IEZJUlNUX1JJR0hUX1RPX0xFRlQpIHsKLSAgICAgICAgICAgICAgICAgICAgZWFzeSA9IGZhbHNlOwotICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIC8vIEVuc3VyZSB0aGF0IG5vbmUgb2YgdGhlIHVuZGVybHlpbmcgY2hhcmFjdGVycyBhcmUgdHJlYXRlZAotICAgICAgICAgICAgLy8gYXMgdmlhYmxlIGJyZWFrcG9pbnRzLCBhbmQgdGhhdCB0aGUgZW50aXJlIHJ1biBnZXRzIHRoZQotICAgICAgICAgICAgLy8gc2FtZSBiaWRpIGRpcmVjdGlvbi4KLQotICAgICAgICAgICAgaWYgKHNvdXJjZSBpbnN0YW5jZW9mIFNwYW5uZWQpIHsKLSAgICAgICAgICAgICAgICBTcGFubmVkIHNwID0gKFNwYW5uZWQpIHNvdXJjZTsKLSAgICAgICAgICAgICAgICBSZXBsYWNlbWVudFNwYW5bXSBzcGFucyA9IHNwLmdldFNwYW5zKHN0YXJ0LCBlbmQsIFJlcGxhY2VtZW50U3Bhbi5jbGFzcyk7Ci0KLSAgICAgICAgICAgICAgICBmb3IgKGludCB5ID0gMDsgeSA8IHNwYW5zLmxlbmd0aDsgeSsrKSB7Ci0gICAgICAgICAgICAgICAgICAgIGludCBhID0gc3AuZ2V0U3BhblN0YXJ0KHNwYW5zW3ldKTsKLSAgICAgICAgICAgICAgICAgICAgaW50IGIgPSBzcC5nZXRTcGFuRW5kKHNwYW5zW3ldKTsKLQotICAgICAgICAgICAgICAgICAgICBmb3IgKGludCB4ID0gYTsgeCA8IGI7IHgrKykgewotICAgICAgICAgICAgICAgICAgICAgICAgY2hzW3ggLSBzdGFydF0gPSAnXHVGRkZDJzsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgaWYgKCFlYXN5KSB7Ci0gICAgICAgICAgICAgICAgLy8gWFhYIHB1dCBvdmVycmlkZSBmbGFncywgZXRjLiBpbnRvIGNoZGlycwotICAgICAgICAgICAgICAgIGRpciA9IGJpZGkoZGlyLCBjaHMsIGNoZGlycywgbiwgZmFsc2UpOwotCi0gICAgICAgICAgICAgICAgLy8gRG8gbWlycm9yaW5nIGZvciByaWdodC10by1sZWZ0IHNlZ21lbnRzCi0KLSAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IG47IGkrKykgewotICAgICAgICAgICAgICAgICAgICBpZiAoY2hkaXJzW2ldID09IENoYXJhY3Rlci5ESVJFQ1RJT05BTElUWV9SSUdIVF9UT19MRUZUKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpbnQgajsKLQotICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChqID0gaTsgaiA8IG47IGorKykgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjaGRpcnNbal0gIT0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ2hhcmFjdGVyLkRJUkVDVElPTkFMSVRZX1JJR0hUX1RPX0xFRlQpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoQW5kcm9pZENoYXJhY3Rlci5taXJyb3IoY2hzLCBpLCBqIC0gaSkpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgYWx0ZXJlZCA9IHRydWU7Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgIGkgPSBqIC0gMTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgQ2hhclNlcXVlbmNlIHN1YjsKLQotICAgICAgICAgICAgaWYgKGFsdGVyZWQpIHsKLSAgICAgICAgICAgICAgICBpZiAoYWx0ZXIgPT0gbnVsbCkKLSAgICAgICAgICAgICAgICAgICAgYWx0ZXIgPSBBbHRlcmVkQ2hhclNlcXVlbmNlLm1ha2Uoc291cmNlLCBjaHMsIHN0YXJ0LCBlbmQpOwotICAgICAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgICAgICAgICAgYWx0ZXIudXBkYXRlKGNocywgc3RhcnQsIGVuZCk7Ci0KLSAgICAgICAgICAgICAgICBzdWIgPSBhbHRlcjsKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgc3ViID0gc291cmNlOwotICAgICAgICAgICAgfQorICAgICAgICAgICAgQ2hhclNlcXVlbmNlIHN1YiA9IHNvdXJjZTsKIAogICAgICAgICAgICAgaW50IHdpZHRoID0gZmlyc3R3aWR0aDsKIAogICAgICAgICAgICAgZmxvYXQgdyA9IDA7Ci0gICAgICAgICAgICBpbnQgaGVyZSA9IHN0YXJ0OworICAgICAgICAgICAgaW50IGhlcmUgPSBwYXJhU3RhcnQ7CiAKLSAgICAgICAgICAgIGludCBvayA9IHN0YXJ0OworICAgICAgICAgICAgaW50IG9rID0gcGFyYVN0YXJ0OwogICAgICAgICAgICAgZmxvYXQgb2t3aWR0aCA9IHc7CiAgICAgICAgICAgICBpbnQgb2thc2NlbnQgPSAwLCBva2Rlc2NlbnQgPSAwLCBva3RvcCA9IDAsIG9rYm90dG9tID0gMDsKIAotICAgICAgICAgICAgaW50IGZpdCA9IHN0YXJ0OworICAgICAgICAgICAgaW50IGZpdCA9IHBhcmFTdGFydDsKICAgICAgICAgICAgIGZsb2F0IGZpdHdpZHRoID0gdzsKICAgICAgICAgICAgIGludCBmaXRhc2NlbnQgPSAwLCBmaXRkZXNjZW50ID0gMCwgZml0dG9wID0gMCwgZml0Ym90dG9tID0gMDsKIAotICAgICAgICAgICAgYm9vbGVhbiB0YWIgPSBmYWxzZTsKKyAgICAgICAgICAgIGJvb2xlYW4gaGFzVGFiT3JFbW9qaSA9IGZhbHNlOworICAgICAgICAgICAgYm9vbGVhbiBoYXNUYWIgPSBmYWxzZTsKKyAgICAgICAgICAgIFRhYlN0b3BzIHRhYlN0b3BzID0gbnVsbDsKIAotICAgICAgICAgICAgaW50IG5leHQ7Ci0gICAgICAgICAgICBmb3IgKGludCBpID0gc3RhcnQ7IGkgPCBlbmQ7IGkgPSBuZXh0KSB7Ci0gICAgICAgICAgICAgICAgaWYgKHNwYW5uZWQgPT0gbnVsbCkKLSAgICAgICAgICAgICAgICAgICAgbmV4dCA9IGVuZDsKLSAgICAgICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICAgICAgICAgIG5leHQgPSBzcGFubmVkLm5leHRTcGFuVHJhbnNpdGlvbihpLCBlbmQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNZXRyaWNBZmZlY3RpbmdTcGFuLgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xhc3MpOworICAgICAgICAgICAgZm9yIChpbnQgc3BhblN0YXJ0ID0gcGFyYVN0YXJ0LCBzcGFuRW5kID0gc3BhblN0YXJ0LCBuZXh0U3BhblN0YXJ0OworICAgICAgICAgICAgICAgICAgICBzcGFuU3RhcnQgPCBwYXJhRW5kOyBzcGFuU3RhcnQgPSBuZXh0U3BhblN0YXJ0KSB7CiAKLSAgICAgICAgICAgICAgICBpZiAoc3Bhbm5lZCA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIGZpbmFsIGludCBhY3R1YWxOdW0gPSBwYWludC5nZXRUZXh0V2lkdGhzKHN1YiwgaSwgbmV4dCwgd2lkdGhzKTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKG5leHQgLSBpID4gYWN0dWFsTnVtKQotICAgICAgICAgICAgICAgICAgICAgICAgYWRqdXN0VGV4dFdpZHRocyh3aWR0aHMsIHN1YiwgaSwgbmV4dCwgYWN0dWFsTnVtKTsKLSAgICAgICAgICAgICAgICAgICAgU3lzdGVtLmFycmF5Y29weSh3aWR0aHMsIDAsIHdpZHRocywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbmQgLSBzdGFydCArIChpIC0gc3RhcnQpLCBuZXh0IC0gaSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCi0gICAgICAgICAgICAgICAgICAgIHBhaW50LmdldEZvbnRNZXRyaWNzSW50KGZtKTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBtV29ya1BhaW50LmJhc2VsaW5lU2hpZnQgPSAwOworICAgICAgICAgICAgICAgIGlmIChzcGFuU3RhcnQgPT0gc3BhbkVuZCkgeworICAgICAgICAgICAgICAgICAgICBpZiAoc3Bhbm5lZCA9PSBudWxsKQorICAgICAgICAgICAgICAgICAgICAgICAgc3BhbkVuZCA9IHBhcmFFbmQ7CisgICAgICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICAgICAgICAgIHNwYW5FbmQgPSBzcGFubmVkLm5leHRTcGFuVHJhbnNpdGlvbihzcGFuU3RhcnQsIHBhcmFFbmQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1ldHJpY0FmZmVjdGluZ1NwYW4uY2xhc3MpOwogCi0gICAgICAgICAgICAgICAgICAgIGZpbmFsIGludCBhY3R1YWxOdW0gPSBTdHlsZWQuZ2V0VGV4dFdpZHRocyhwYWludCwgbVdvcmtQYWludCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcGFubmVkLCBpLCBuZXh0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRocywgZm0pOwotICAgICAgICAgICAgICAgICAgICBpZiAobmV4dCAtIGkgPiBhY3R1YWxOdW0pCi0gICAgICAgICAgICAgICAgICAgICAgICBhZGp1c3RUZXh0V2lkdGhzKHdpZHRocywgc3Bhbm5lZCwgaSwgbmV4dCwgYWN0dWFsTnVtKTsKLSAgICAgICAgICAgICAgICAgICAgU3lzdGVtLmFycmF5Y29weSh3aWR0aHMsIDAsIHdpZHRocywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbmQgLSBzdGFydCArIChpIC0gc3RhcnQpLCBuZXh0IC0gaSk7Ci0KLSAgICAgICAgICAgICAgICAgICAgaWYgKG1Xb3JrUGFpbnQuYmFzZWxpbmVTaGlmdCA8IDApIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGZtLmFzY2VudCArPSBtV29ya1BhaW50LmJhc2VsaW5lU2hpZnQ7Ci0gICAgICAgICAgICAgICAgICAgICAgICBmbS50b3AgKz0gbVdvcmtQYWludC5iYXNlbGluZVNoaWZ0OworICAgICAgICAgICAgICAgICAgICBpbnQgc3BhbkxlbiA9IHNwYW5FbmQgLSBzcGFuU3RhcnQ7CisgICAgICAgICAgICAgICAgICAgIGlmIChzcGFubmVkID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1lYXN1cmVkLmFkZFN0eWxlUnVuKHBhaW50LCBzcGFuTGVuLCBmbSk7CiAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBmbS5kZXNjZW50ICs9IG1Xb3JrUGFpbnQuYmFzZWxpbmVTaGlmdDsKLSAgICAgICAgICAgICAgICAgICAgICAgIGZtLmJvdHRvbSArPSBtV29ya1BhaW50LmJhc2VsaW5lU2hpZnQ7CisgICAgICAgICAgICAgICAgICAgICAgICBNZXRyaWNBZmZlY3RpbmdTcGFuW10gc3BhbnMgPQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNwYW5uZWQuZ2V0U3BhbnMoc3BhblN0YXJ0LCBzcGFuRW5kLCBNZXRyaWNBZmZlY3RpbmdTcGFuLmNsYXNzKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1lYXN1cmVkLmFkZFN0eWxlUnVuKHBhaW50LCBzcGFucywgc3BhbkxlbiwgZm0pOwogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfQogCisgICAgICAgICAgICAgICAgbmV4dFNwYW5TdGFydCA9IHNwYW5FbmQ7CisgICAgICAgICAgICAgICAgaW50IHN0YXJ0SW5QYXJhID0gc3BhblN0YXJ0IC0gcGFyYVN0YXJ0OworICAgICAgICAgICAgICAgIGludCBlbmRJblBhcmEgPSBzcGFuRW5kIC0gcGFyYVN0YXJ0OworCiAgICAgICAgICAgICAgICAgaW50IGZtdG9wID0gZm0udG9wOwogICAgICAgICAgICAgICAgIGludCBmbWJvdHRvbSA9IGZtLmJvdHRvbTsKICAgICAgICAgICAgICAgICBpbnQgZm1hc2NlbnQgPSBmbS5hc2NlbnQ7CiAgICAgICAgICAgICAgICAgaW50IGZtZGVzY2VudCA9IGZtLmRlc2NlbnQ7CiAKLSAgICAgICAgICAgICAgICBpZiAoZmFsc2UpIHsKLSAgICAgICAgICAgICAgICAgICAgU3RyaW5nQnVpbGRlciBzYiA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7Ci0gICAgICAgICAgICAgICAgICAgIGZvciAoaW50IGogPSBpOyBqIDwgbmV4dDsgaisrKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBzYi5hcHBlbmQod2lkdGhzW2ogLSBzdGFydCArIChlbmQgLSBzdGFydCldKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIHNiLmFwcGVuZCgnICcpOwotICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgTG9nLmUoInRleHQiLCBzYi50b1N0cmluZygpKTsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBmb3IgKGludCBqID0gaTsgaiA8IG5leHQ7IGorKykgewotICAgICAgICAgICAgICAgICAgICBjaGFyIGMgPSBjaHNbaiAtIHN0YXJ0XTsKKyAgICAgICAgICAgICAgICBmb3IgKGludCBqID0gc3BhblN0YXJ0OyBqIDwgc3BhbkVuZDsgaisrKSB7CisgICAgICAgICAgICAgICAgICAgIGNoYXIgYyA9IGNoc1tqIC0gcGFyYVN0YXJ0XTsKICAgICAgICAgICAgICAgICAgICAgZmxvYXQgYmVmb3JlID0gdzsKIAogICAgICAgICAgICAgICAgICAgICBpZiAoYyA9PSAnXG4nKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICA7CiAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoYyA9PSAnXHQnKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICB3ID0gTGF5b3V0Lm5leHRUYWIoc3ViLCBzdGFydCwgZW5kLCB3LCBudWxsKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIHRhYiA9IHRydWU7Ci0gICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoYyA+PSAweEQ4MDAgJiYgYyA8PSAweERGRkYgJiYgaiArIDEgPCBuZXh0KSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpbnQgZW1vamkgPSBDaGFyYWN0ZXIuY29kZVBvaW50QXQoY2hzLCBqIC0gc3RhcnQpOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGhhc1RhYiA9PSBmYWxzZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhc1RhYiA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGFzVGFiT3JFbW9qaSA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHNwYW5uZWQgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBGaXJzdCB0YWIgdGhpcyBwYXJhLCBjaGVjayBmb3IgdGFic3RvcHMKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGFiU3RvcFNwYW5bXSBzcGFucyA9IGdldFBhcmFncmFwaFNwYW5zKHNwYW5uZWQsIHBhcmFTdGFydCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJhRW5kLCBUYWJTdG9wU3Bhbi5jbGFzcyk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzcGFucy5sZW5ndGggPiAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0YWJTdG9wcyA9IG5ldyBUYWJTdG9wcyhUQUJfSU5DUkVNRU5ULCBzcGFucyk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGFiU3RvcHMgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHcgPSB0YWJTdG9wcy5uZXh0VGFiKHcpOworICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB3ID0gVGFiU3RvcHMubmV4dERlZmF1bHRTdG9wKHcsIFRBQl9JTkNSRU1FTlQpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGMgPj0gMHhEODAwICYmIGMgPD0gMHhERkZGICYmIGogKyAxIDwgc3BhbkVuZCkgeworICAgICAgICAgICAgICAgICAgICAgICAgaW50IGVtb2ppID0gQ2hhcmFjdGVyLmNvZGVQb2ludEF0KGNocywgaiAtIHBhcmFTdGFydCk7CiAKICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlbW9qaSA+PSBNSU5fRU1PSkkgJiYgZW1vamkgPD0gTUFYX0VNT0pJKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQml0bWFwIGJtID0gRU1PSklfRkFDVE9SWS4KQEAgLTM4MCwyMSArMjk1LDIxIEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aGljaFBhaW50ID0gbVdvcmtQYWludDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IHdpZCA9IChmbG9hdCkgYm0uZ2V0V2lkdGgoKSAqCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IHdpZCA9IGJtLmdldFdpZHRoKCkgKgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtd2hpY2hQYWludC5hc2NlbnQoKSAvCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJtLmdldEhlaWdodCgpOwogCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHcgKz0gd2lkOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0YWIgPSB0cnVlOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoYXNUYWJPckVtb2ppID0gdHJ1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaisrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHcgKz0gd2lkdGhzW2ogLSBzdGFydCArIChlbmQgLSBzdGFydCldOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3ICs9IHdpZHRoc1tqIC0gcGFyYVN0YXJ0XTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHcgKz0gd2lkdGhzW2ogLSBzdGFydCArIChlbmQgLSBzdGFydCldOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHcgKz0gd2lkdGhzW2ogLSBwYXJhU3RhcnRdOwogICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgdyArPSB3aWR0aHNbaiAtIHN0YXJ0ICsgKGVuZCAtIHN0YXJ0KV07CisgICAgICAgICAgICAgICAgICAgICAgICB3ICs9IHdpZHRoc1tqIC0gcGFyYVN0YXJ0XTsKICAgICAgICAgICAgICAgICAgICAgfQogCiAgICAgICAgICAgICAgICAgICAgIC8vIExvZy5lKCJ0ZXh0IiwgIndhcyAiICsgYmVmb3JlICsgIiBub3cgIiArIHcgKyAiIGFmdGVyICIgKyBjICsgIiB3aXRoaW4gIiArIHdpZHRoKTsKQEAgLTQxNSw3ICszMzAsNyBAQAogICAgICAgICAgICAgICAgICAgICAgICAgLyoKICAgICAgICAgICAgICAgICAgICAgICAgICAqIEZyb20gdGhlIFVuaWNvZGUgTGluZSBCcmVha2luZyBBbGdvcml0aG06CiAgICAgICAgICAgICAgICAgICAgICAgICAgKiAoYXQgbGVhc3QgYXBwcm94aW1hdGVseSkKLSAgICAgICAgICAgICAgICAgICAgICAgICAqICAKKyAgICAgICAgICAgICAgICAgICAgICAgICAqCiAgICAgICAgICAgICAgICAgICAgICAgICAgKiAuLDo7IGFyZSBjbGFzcyBJUzogYnJlYWtwb2ludHMKICAgICAgICAgICAgICAgICAgICAgICAgICAqICAgICAgZXhjZXB0IHdoZW4gYWRqYWNlbnQgdG8gZGlnaXRzCiAgICAgICAgICAgICAgICAgICAgICAgICAgKiAvICAgIGlzIGNsYXNzIFNZOiBhIGJyZWFrcG9pbnQKQEAgLTQzMCwxMiArMzQ1LDEyIEBACiAKICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjID09ICcgJyB8fCBjID09ICdcdCcgfHwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoKGMgPT0gJy4nICB8fCBjID09ICcsJyB8fCBjID09ICc6JyB8fCBjID09ICc7JykgJiYKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGogLSAxIDwgaGVyZSB8fCAhQ2hhcmFjdGVyLmlzRGlnaXQoY2hzW2ogLSAxIC0gc3RhcnRdKSkgJiYKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGogKyAxID49IG5leHQgfHwgIUNoYXJhY3Rlci5pc0RpZ2l0KGNoc1tqICsgMSAtIHN0YXJ0XSkpKSB8fAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoaiAtIDEgPCBoZXJlIHx8ICFDaGFyYWN0ZXIuaXNEaWdpdChjaHNbaiAtIDEgLSBwYXJhU3RhcnRdKSkgJiYKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGogKyAxID49IHNwYW5FbmQgfHwgIUNoYXJhY3Rlci5pc0RpZ2l0KGNoc1tqICsgMSAtIHBhcmFTdGFydF0pKSkgfHwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoKGMgPT0gJy8nIHx8IGMgPT0gJy0nKSAmJgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoaiArIDEgPj0gbmV4dCB8fCAhQ2hhcmFjdGVyLmlzRGlnaXQoY2hzW2ogKyAxIC0gc3RhcnRdKSkpIHx8CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChqICsgMSA+PSBzcGFuRW5kIHx8ICFDaGFyYWN0ZXIuaXNEaWdpdChjaHNbaiArIDEgLSBwYXJhU3RhcnRdKSkpIHx8CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGMgPj0gRklSU1RfQ0pLICYmIGlzSWRlb2dyYXBoaWMoYywgdHJ1ZSkgJiYKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaiArIDEgPCBuZXh0ICYmIGlzSWRlb2dyYXBoaWMoY2hzW2ogKyAxIC0gc3RhcnRdLCBmYWxzZSkpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGogKyAxIDwgc3BhbkVuZCAmJiBpc0lkZW9ncmFwaGljKGNoc1tqICsgMSAtIHBhcmFTdGFydF0sIGZhbHNlKSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBva3dpZHRoID0gdzsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvayA9IGogKyAxOwogCkBAIC00NTIsNyArMzY3LDcgQEAKICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChvayAhPSBoZXJlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gTG9nLmUoInRleHQiLCAib3V0cHV0IG9rICIgKyBoZXJlICsgIiB0byAiICtvayk7CiAKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAob2sgPCBuZXh0ICYmIGNoc1tvayAtIHN0YXJ0XSA9PSAnICcpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAob2sgPCBzcGFuRW5kICYmIGNoc1tvayAtIHBhcmFTdGFydF0gPT0gJyAnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9rKys7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogCkBAIC00NjEsMTAgKzM3NiwxMCBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgb2thc2NlbnQsIG9rZGVzY2VudCwgb2t0b3AsIG9rYm90dG9tLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNwYWNpbmdtdWx0LCBzcGFjaW5nYWRkLCBjaG9vc2VodCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNob29zZWh0diwgZm0sIHRhYiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5lZWRNdWx0aXBseSwgc3RhcnQsIGNoZGlycywgZGlyLCBlYXN5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hvb3NlaHR2LCBmbSwgaGFzVGFiT3JFbW9qaSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5lZWRNdWx0aXBseSwgcGFyYVN0YXJ0LCBjaGRpcnMsIGRpciwgZWFzeSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9rID09IGJ1ZmVuZCwgaW5jbHVkZXBhZCwgdHJhY2twYWQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aWR0aHMsIHN0YXJ0LCBlbmQgLSBzdGFydCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNocywgd2lkdGhzLCBoZXJlIC0gcGFyYVN0YXJ0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2hlcmUsIGVsbGlwc2l6ZWRXaWR0aCwgb2t3aWR0aCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhaW50KTsKIApAQCAtNDg4LDcgKzQwMyw3IEBACiAgICAgICAgICAgICAgICAgICAgICAgICBpZiAob2sgIT0gaGVyZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIExvZy5lKCJ0ZXh0IiwgIm91dHB1dCBvayAiICsgaGVyZSArICIgdG8gIiArb2spOwogCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKG9rIDwgbmV4dCAmJiBjaHNbb2sgLSBzdGFydF0gPT0gJyAnKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKG9rIDwgc3BhbkVuZCAmJiBjaHNbb2sgLSBwYXJhU3RhcnRdID09ICcgJykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvaysrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KIApAQCAtNDk3LDEwICs0MTIsMTAgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9rYXNjZW50LCBva2Rlc2NlbnQsIG9rdG9wLCBva2JvdHRvbSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcGFjaW5nbXVsdCwgc3BhY2luZ2FkZCwgY2hvb3NlaHQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaG9vc2VodHYsIGZtLCB0YWIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZWVkTXVsdGlwbHksIHN0YXJ0LCBjaGRpcnMsIGRpciwgZWFzeSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNob29zZWh0diwgZm0sIGhhc1RhYk9yRW1vamksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZWVkTXVsdGlwbHksIHBhcmFTdGFydCwgY2hkaXJzLCBkaXIsIGVhc3ksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvayA9PSBidWZlbmQsIGluY2x1ZGVwYWQsIHRyYWNrcGFkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2lkdGhzLCBzdGFydCwgZW5kIC0gc3RhcnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaHMsIHdpZHRocywgaGVyZSAtIHBhcmFTdGFydCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdoZXJlLCBlbGxpcHNpemVkV2lkdGgsIG9rd2lkdGgsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWludCk7CiAKQEAgLTUxMywxOSArNDI4LDIwIEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaXR0b3AsIGZpdGJvdHRvbSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcGFjaW5nbXVsdCwgc3BhY2luZ2FkZCwgY2hvb3NlaHQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaG9vc2VodHYsIGZtLCB0YWIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZWVkTXVsdGlwbHksIHN0YXJ0LCBjaGRpcnMsIGRpciwgZWFzeSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNob29zZWh0diwgZm0sIGhhc1RhYk9yRW1vamksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZWVkTXVsdGlwbHksIHBhcmFTdGFydCwgY2hkaXJzLCBkaXIsIGVhc3ksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaXQgPT0gYnVmZW5kLCBpbmNsdWRlcGFkLCB0cmFja3BhZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRocywgc3RhcnQsIGVuZCAtIHN0YXJ0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hzLCB3aWR0aHMsIGhlcmUgLSBwYXJhU3RhcnQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aGVyZSwgZWxsaXBzaXplZFdpZHRoLCBmaXR3aWR0aCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhaW50KTsKIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhlcmUgPSBmaXQ7CiAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIExvZy5lKCJ0ZXh0IiwgIm91dHB1dCBvbmUgIiArIGhlcmUgKyAiIHRvICIgKyhoZXJlICsgMSkpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lYXN1cmVUZXh0KHBhaW50LCBtV29ya1BhaW50LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZSwgaGVyZSwgaGVyZSArIDEsIGZtLCB0YWIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gWFhYIG5vdCBzdXJlIHdoeSB0aGUgZXhpc3RpbmcgZm0gd2Fzbid0IG9rLgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIG1lYXN1cmVUZXh0KHBhaW50LCBtV29ya1BhaW50LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vICAgICAgICAgICAgIHNvdXJjZSwgaGVyZSwgaGVyZSArIDEsIGZtLCB0YWIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gICAgICAgICAgICAgbnVsbCk7CiAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2ID0gb3V0KHNvdXJjZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhlcmUsIGhlcmUrMSwKQEAgLTUzMywxOSArNDQ5LDIyIEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbS50b3AsIGZtLmJvdHRvbSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHYsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzcGFjaW5nbXVsdCwgc3BhY2luZ2FkZCwgY2hvb3NlaHQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaG9vc2VodHYsIGZtLCB0YWIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZWVkTXVsdGlwbHksIHN0YXJ0LCBjaGRpcnMsIGRpciwgZWFzeSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNob29zZWh0diwgZm0sIGhhc1RhYk9yRW1vamksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZWVkTXVsdGlwbHksIHBhcmFTdGFydCwgY2hkaXJzLCBkaXIsIGVhc3ksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZXJlICsgMSA9PSBidWZlbmQsIGluY2x1ZGVwYWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFja3BhZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRocywgc3RhcnQsIGVuZCAtIHN0YXJ0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hzLCB3aWR0aHMsIGhlcmUgLSBwYXJhU3RhcnQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aGVyZSwgZWxsaXBzaXplZFdpZHRoLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2lkdGhzW2hlcmUgLSBzdGFydF0sIHBhaW50KTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRoc1toZXJlIC0gcGFyYVN0YXJ0XSwgcGFpbnQpOwogCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVyZSA9IGhlcmUgKyAxOwogICAgICAgICAgICAgICAgICAgICAgICAgfQogCi0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoaGVyZSA8IGkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBqID0gbmV4dCA9IGhlcmU7IC8vIG11c3QgcmVtZWFzdXJlCisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaGVyZSA8IHNwYW5TdGFydCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGRpZG4ndCBvdXRwdXQgYWxsIHRoZSB0ZXh0IGZvciB0aGlzIHNwYW4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyB3ZSd2ZSBtZWFzdXJlZCB0aGUgcmF3IHdpZHRocywgdGhvdWdoLCBzbworICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGp1c3QgcmVzZXQgdGhlIHN0YXJ0IHBvaW50CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaiA9IG5leHRTcGFuU3RhcnQgPSBoZXJlOwogICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqID0gaGVyZSAtIDE7ICAgIC8vIGNvbnRpbnVlIGxvb3BpbmcKICAgICAgICAgICAgICAgICAgICAgICAgIH0KQEAgLTU1NSwxNCArNDc0LDE0IEBACiAgICAgICAgICAgICAgICAgICAgICAgICBmaXRhc2NlbnQgPSBmaXRkZXNjZW50ID0gZml0dG9wID0gZml0Ym90dG9tID0gMDsKICAgICAgICAgICAgICAgICAgICAgICAgIG9rYXNjZW50ID0gb2tkZXNjZW50ID0gb2t0b3AgPSBva2JvdHRvbSA9IDA7CiAKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmICgtLWZpcnN0V2lkdGhMaW5lQ291bnQgPD0gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKC0tZmlyc3RXaWR0aExpbmVMaW1pdCA8PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2lkdGggPSByZXN0d2lkdGg7CiAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgIGlmIChlbmQgIT0gaGVyZSkgeworICAgICAgICAgICAgaWYgKHBhcmFFbmQgIT0gaGVyZSkgewogICAgICAgICAgICAgICAgIGlmICgoZml0dG9wIHwgZml0Ym90dG9tIHwgZml0ZGVzY2VudCB8IGZpdGFzY2VudCkgPT0gMCkgewogICAgICAgICAgICAgICAgICAgICBwYWludC5nZXRGb250TWV0cmljc0ludChmbSk7CiAKQEAgLTU3NSwyMCArNDk0LDIwIEBACiAgICAgICAgICAgICAgICAgLy8gTG9nLmUoInRleHQiLCAib3V0cHV0IHJlc3QgIiArIGhlcmUgKyAiIHRvICIgKyBlbmQpOwogCiAgICAgICAgICAgICAgICAgdiA9IG91dChzb3VyY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICBoZXJlLCBlbmQsIGZpdGFzY2VudCwgZml0ZGVzY2VudCwKKyAgICAgICAgICAgICAgICAgICAgICAgIGhlcmUsIHBhcmFFbmQsIGZpdGFzY2VudCwgZml0ZGVzY2VudCwKICAgICAgICAgICAgICAgICAgICAgICAgIGZpdHRvcCwgZml0Ym90dG9tLAogICAgICAgICAgICAgICAgICAgICAgICAgdiwKICAgICAgICAgICAgICAgICAgICAgICAgIHNwYWNpbmdtdWx0LCBzcGFjaW5nYWRkLCBjaG9vc2VodCwKLSAgICAgICAgICAgICAgICAgICAgICAgIGNob29zZWh0diwgZm0sIHRhYiwKLSAgICAgICAgICAgICAgICAgICAgICAgIG5lZWRNdWx0aXBseSwgc3RhcnQsIGNoZGlycywgZGlyLCBlYXN5LAotICAgICAgICAgICAgICAgICAgICAgICAgZW5kID09IGJ1ZmVuZCwgaW5jbHVkZXBhZCwgdHJhY2twYWQsCi0gICAgICAgICAgICAgICAgICAgICAgICB3aWR0aHMsIHN0YXJ0LCBlbmQgLSBzdGFydCwKKyAgICAgICAgICAgICAgICAgICAgICAgIGNob29zZWh0diwgZm0sIGhhc1RhYk9yRW1vamksCisgICAgICAgICAgICAgICAgICAgICAgICBuZWVkTXVsdGlwbHksIHBhcmFTdGFydCwgY2hkaXJzLCBkaXIsIGVhc3ksCisgICAgICAgICAgICAgICAgICAgICAgICBwYXJhRW5kID09IGJ1ZmVuZCwgaW5jbHVkZXBhZCwgdHJhY2twYWQsCisgICAgICAgICAgICAgICAgICAgICAgICBjaHMsIHdpZHRocywgaGVyZSAtIHBhcmFTdGFydCwKICAgICAgICAgICAgICAgICAgICAgICAgIHdoZXJlLCBlbGxpcHNpemVkV2lkdGgsIHcsIHBhaW50KTsKICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgc3RhcnQgPSBlbmQ7CisgICAgICAgICAgICBwYXJhU3RhcnQgPSBwYXJhRW5kOwogCi0gICAgICAgICAgICBpZiAoZW5kID09IGJ1ZmVuZCkKKyAgICAgICAgICAgIGlmIChwYXJhRW5kID09IGJ1ZmVuZCkKICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgfQogCkBAIC02MDMsMjQ2ICs1MjIsMTMgQEAKICAgICAgICAgICAgICAgICAgICAgdiwKICAgICAgICAgICAgICAgICAgICAgc3BhY2luZ211bHQsIHNwYWNpbmdhZGQsIG51bGwsCiAgICAgICAgICAgICAgICAgICAgIG51bGwsIGZtLCBmYWxzZSwKLSAgICAgICAgICAgICAgICAgICAgbmVlZE11bHRpcGx5LCBidWZlbmQsIGNoZGlycywgREVGQVVMVF9ESVIsIHRydWUsCisgICAgICAgICAgICAgICAgICAgIG5lZWRNdWx0aXBseSwgYnVmZW5kLCBudWxsLCBERUZBVUxUX0RJUiwgdHJ1ZSwKICAgICAgICAgICAgICAgICAgICAgdHJ1ZSwgaW5jbHVkZXBhZCwgdHJhY2twYWQsCi0gICAgICAgICAgICAgICAgICAgIHdpZHRocywgYnVmc3RhcnQsIDAsCisgICAgICAgICAgICAgICAgICAgIG51bGwsIG51bGwsIGJ1ZnN0YXJ0LAogICAgICAgICAgICAgICAgICAgICB3aGVyZSwgZWxsaXBzaXplZFdpZHRoLCAwLCBwYWludCk7CiAgICAgICAgIH0KICAgICB9CiAKLSAgICAvKioKLSAgICAgKiBSdW5zIHRoZSB1bmljb2RlIGJpZGkgYWxnb3JpdGhtIG9uIHRoZSBmaXJzdCBuIGNoYXJzIGluIGNocywgcmV0dXJuaW5nCi0gICAgICogdGhlIGNoYXIgZGlycyBpbiBjaEluZm8gYW5kIHRoZSBiYXNlIGxpbmUgZGlyZWN0aW9uIG9mIHRoZSBmaXJzdAotICAgICAqIHBhcmFncmFwaC4KLSAgICAgKiAKLSAgICAgKiBYWFggY2hhbmdlIHJlc3VsdCBmcm9tIGRpcnMgdG8gbGV2ZWxzCi0gICAgICogIAotICAgICAqIEBwYXJhbSBkaXIgdGhlIGRpcmVjdGlvbiB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cyhjaHMsIGNoSW5mbywgbik7Ci0KLSAgICAgICAgLyoKLSAgICAgICAgICogRGV0ZXJtaW5lIHByaW1hcnkgcGFyYWdyYXBoIGRpcmVjdGlvbiBpZiBub3Qgc3BlY2lmaWVkCi0gICAgICAgICAqLwotICAgICAgICBpZiAoZGlyICE9IERJUl9SRVFVRVNUX0xUUiAmJiBkaXIgIT0gRElSX1JFUVVFU1RfUlRMKSB7Ci0gICAgICAgICAgICAvLyBzZXQgdXAgZGVmYXVsdAotICAgICAgICAgICAgZGlyID0gZGlyID49IDAgPyBESVJfTEVGVF9UT19SSUdIVCA6IERJUl9SSUdIVF9UT19MRUZUOwotICAgICAgICAgICAgZm9yIChpbnQgaiA9IDA7IGogPCBuOyBqKyspIHsKLSAgICAgICAgICAgICAgICBpbnQgZCA9IGNoSW5mb1tqXTsKLQotICAgICAgICAgICAgICAgIGlmIChkID09IENoYXJhY3Rlci5ESVJFQ1RJT05BTElUWV9MRUZUX1RPX1JJR0hUKSB7Ci0gICAgICAgICAgICAgICAgICAgIGRpciA9IERJUl9MRUZUX1RPX1JJR0hUOwotICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgaWYgKGQgPT0gQ2hhcmFjdGVyLkRJUkVDVElPTkFMSVRZX1JJR0hUX1RPX0xFRlQpIHsKLSAgICAgICAgICAgICAgICAgICAgZGlyID0gRElSX1JJR0hUX1RPX0xFRlQ7Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIGZpbmFsIGJ5dGUgU09SID0gZGlyID09IERJUl9MRUZUX1RPX1JJR0hUID8KLSAgICAgICAgICAgICAgICBDaGFyYWN0ZXIuRElSRUNUSU9OQUxJVFlfTEVGVF9UT19SSUdIVCA6Ci0gICAgICAgICAgICAgICAgQ2hhcmFjdGVyLkRJUkVDVElPTkFMSVRZX1JJR0hUX1RPX0xFRlQ7Ci0KLSAgICAgICAgLyoKLSAgICAgICAgICogWFhYIEV4cGxpY2l0IG92ZXJyaWRlcyBzaG91bGQgZ28gaGVyZQotICAgICAgICAgKi8KLQotICAgICAgICAvKgotICAgICAgICAgKiBXZWFrIHR5cGUgcmVzb2x1dGlvbgotICAgICAgICAgKi8KLQotICAgICAgICAvLyBkdW1wKGNoZGlycywgbiwgImluaXRpYWwiKTsKLQotICAgICAgICAvLyBXMSBub24gc3BhY2luZyBtYXJrcwotICAgICAgICBmb3IgKGludCBqID0gMDsgaiA8IG47IGorKykgewotICAgICAgICAgICAgaWYgKGNoSW5mb1tqXSA9PSBDaGFyYWN0ZXIuTk9OX1NQQUNJTkdfTUFSSykgewotICAgICAgICAgICAgICAgIGlmIChqID09IDApCi0gICAgICAgICAgICAgICAgICAgIGNoSW5mb1tqXSA9IFNPUjsKLSAgICAgICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICAgICAgICAgIGNoSW5mb1tqXSA9IGNoSW5mb1tqIC0gMV07Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICAvLyBkdW1wKGNoZGlycywgbiwgIlcxIik7Ci0KLSAgICAgICAgLy8gVzIgZXVyb3BlYW4gbnVtYmVycwotICAgICAgICBieXRlIGN1ciA9IFNPUjsKLSAgICAgICAgZm9yIChpbnQgaiA9IDA7IGogPCBuOyBqKyspIHsKLSAgICAgICAgICAgIGJ5dGUgZCA9IGNoSW5mb1tqXTsKLQotICAgICAgICAgICAgaWYgKGQgPT0gQ2hhcmFjdGVyLkRJUkVDVElPTkFMSVRZX0xFRlRfVE9fUklHSFQgfHwKLSAgICAgICAgICAgICAgICBkID09IENoYXJhY3Rlci5ESVJFQ1RJT05BTElUWV9SSUdIVF9UT19MRUZUIHx8Ci0gICAgICAgICAgICAgICAgZCA9PSBDaGFyYWN0ZXIuRElSRUNUSU9OQUxJVFlfUklHSFRfVE9fTEVGVF9BUkFCSUMpCi0gICAgICAgICAgICAgICAgY3VyID0gZDsKLSAgICAgICAgICAgIGVsc2UgaWYgKGQgPT0gQ2hhcmFjdGVyLkRJUkVDVElPTkFMSVRZX0VVUk9QRUFOX05VTUJFUikgewotICAgICAgICAgICAgICAgICBpZiAoY3VyID09Ci0gICAgICAgICAgICAgICAgICAgIENoYXJhY3Rlci5ESVJFQ1RJT05BTElUWV9SSUdIVF9UT19MRUZUX0FSQUJJQykKLSAgICAgICAgICAgICAgICAgICAgY2hJbmZvW2pdID0gQ2hhcmFjdGVyLkRJUkVDVElPTkFMSVRZX0FSQUJJQ19OVU1CRVI7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICAvLyBkdW1wKGNoZGlycywgbiwgIlcyIik7Ci0KLSAgICAgICAgLy8gVzMgYXJhYmljIGxldHRlcnMKLSAgICAgICAgZm9yIChpbnQgaiA9IDA7IGogPCBuOyBqKyspIHsKLSAgICAgICAgICAgIGlmIChjaEluZm9bal0gPT0gQ2hhcmFjdGVyLkRJUkVDVElPTkFMSVRZX1JJR0hUX1RPX0xFRlRfQVJBQklDKQotICAgICAgICAgICAgICAgIGNoSW5mb1tqXSA9IENoYXJhY3Rlci5ESVJFQ1RJT05BTElUWV9SSUdIVF9UT19MRUZUOwotICAgICAgICB9Ci0KLSAgICAgICAgLy8gZHVtcChjaGRpcnMsIG4sICJXMyIpOwotCi0gICAgICAgIC8vIFc0IHNpbmdsZSBzZXBhcmF0b3IgYmV0d2VlbiBudW1iZXJzCi0gICAgICAgIGZvciAoaW50IGogPSAxOyBqIDwgbiAtIDE7IGorKykgewotICAgICAgICAgICAgYnl0ZSBkID0gY2hJbmZvW2pdOwotICAgICAgICAgICAgYnl0ZSBwcmV2ID0gY2hJbmZvW2ogLSAxXTsKLSAgICAgICAgICAgIGJ5dGUgbmV4dCA9IGNoSW5mb1tqICsgMV07Ci0KLSAgICAgICAgICAgIGlmIChkID09IENoYXJhY3Rlci5ESVJFQ1RJT05BTElUWV9FVVJPU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8gVzUgZXVyb3BlYW4gbnVtYmVyIHRlcm1pbmF0b3JzCi0gICAgICAgIGJvb2xlYW4gYWRqYWNlbnQgPSBmYWxzZTsKLSAgICAgICAgZm9yIChpbnQgaiA9IDA7IGogPCBuOyBqKyspIHsKLSAgICAgICAgICAgIGJ5dGUgZCA9IGNoSW5mb1tqXTsKLQotICAgICAgICAgICAgaWYgKGQgPT0gQ2hhcmFjdGVyLkRJUkVDVElPTkFMSVRZX0VVUk9QRUFOX05VTUJFUikKLSAgICAgICAgICAgICAgICBhZGphY2VudCA9IHRydWU7Ci0gICAgICAgICAgICBlbHNlIGlmIChkID09IENoYXJhY3Rlci5ESVJFQ1RJT05BTElUWV9FVVJPUEVBTl9OVU1CRVJfVEVSTUlOQVRPUiAmJiBhZGphY2VudCkKLSAgICAgICAgICAgICAgICBjaEluZm9bal0gPSBDaGFyYWN0ZXIuRElSRUNUSU9OQUxJVFlfRVVST1BFQU5fTlVNQkVSOwotICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgIGFkamFjZW50ID0gZmFsc2U7Ci0gICAgICAgIH0KLQotICAgICAgICAvL2R1bXAoY2hkaXJzLCBuLCAiVzUiKTsKLQotICAgICAgICAvLyBXNSBldXJvcGVhbiBudW1iZXIgdGVybWluYXRvcnMgcGFydCAyLAotICAgICAgICAvLyBXNiBzZXBhcmF0b3JzIGFuZCB0ZXJtaW5hdG9ycwotICAgICAgICBhZGphY2VudCA9IGZhbHNlOwotICAgICAgICBmb3IgKGludCBqID0gbiAtIDE7IGogPj0gMDsgai0tKSB7Ci0gICAgICAgICAgICBieXRlIGQgPSBjaEluZm9bal07Ci0KLSAgICAgICAgICAgIGlmIChkID09IENoYXJhY3Rlci5ESVJFQ1RJT05BTElUWV9FVVJPUEVBTl9OVU1CRVIpCi0gICAgICAgICAgICAgICAgYWRqYWNlbnQgPSB0cnVlOwotICAgICAgICAgICAgZWxzZSBpZiAoZCA9PSBDaGFyYWN0ZXIuRElSRUNUSU9OQUxJVFlfRVVST1BFQU5fTlVNQkVSX1RFUk1JTkFUT1IpIHsKLSAgICAgICAgICAgICAgICBpZiAoYWRqYWNlbnQpCi0gICAgICAgICAgICAgICAgICAgIGNoSW5mb1tqXSA9IENoYXJhY3Rlci5ESVJFQ1RJT05BTElUWV9FVVJPUEVBTl9OVU1CRVI7Ci0gICAgICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgICAgICBjaEluZm9bal0gPSBDaGFyYWN0ZXIuRElSRUNUSU9OQUxJVFlfT1RIRVJfTkVVVFJBTFM7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBlbHNlIHsKLSAgICAgICAgICAgICAgICBhZGphY2VudCA9IGZhbHNlOwotCi0gICAgICAgICAgICAgICAgaWYgKGQgPT0gQ2hhcmFjdGVyLkRJUkVDVElPTkFMSVRZX0VVUk9QRUFOX05VTUJFUl9TRVBBUkFUT1IgfHwKLSAgICAgICAgICAgICAgICAgICAgZCA9PSBDaGFyYWN0ZXIuRElSRUNUSU9OQUxJVFlfQ09NTU9OX05VTUJFUl9TRVBBUkFUT1IgfHwKLSAgICAgICAgICAgICAgICAgICAgZCA9PSBDaGFyYWN0ZXIuRElSRUNUSU9OQUxJVFlfUEFSQUdSQVBIX1NFUEFSQVRPUiB8fAotICAgICAgICAgICAgICAgICAgICBkID09IENoYXJhY3Rlci5ESVJFQ1RJT05BTElUWV9TRUdNRU5UX1NFUEFSQVRPUikKLSAgICAgICAgICAgICAgICAgICAgY2hJbmZvW2pdID0gQ2hhcmFjdGVyLkRJUkVDVElPTkFMSVRZX09USEVSX05FVVRSQUxTOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgLy8gZHVtcChjaGRpcnMsIG4sICJXNiIpOwotCi0gICAgICAgIC8vIFc3IHN0cm9uZyBkaXJlY3Rpb24gb2YgZXVyb3BlYW4gbnVtYmVycwotICAgICAgICBjdXIgPSBTT1I7Ci0gICAgICAgIGZvciAoaW50IGogPSAwOyBqIDwgbjsgaisrKSB7Ci0gICAgICAgICAgICBieXRlIGQgPSBjaEluZm9bal07Ci0KLSAgICAgICAgICAgIGlmIChkID09IFNPUiB8fAotICAgICAgICAgICAgICAgIGQgPT0gQ2hhcmFjdGVyLkRJUkVDVElPTkFMSVRZX0xFRlRfVE9fUklHSFQgfHwKLSAgICAgICAgICAgICAgICBkID09IENoYXJhY3Rlci5ESVJFQ1RJT05BTElUWV9SSUdIVF9UT19MRUZUKQotICAgICAgICAgICAgICAgIGN1ciA9IGQ7Ci0KLSAgICAgICAgICAgIGlmIChkID09IENoYXJhY3Rlci5ESVJFQ1RJT05BTElUWV9FVVJPUEVBTl9OVU1CRVIpCi0gICAgICAgICAgICAgICAgY2hJbmZvW2pdID0gY3VyOwotICAgICAgICB9Ci0KLSAgICAgICAgLy8gZHVtcChjaGRpcnMsIG4sICJXNyIpOwotCi0gICAgICAgIC8vIE4xLCBOMiBuZXV0cmFscwotICAgICAgICBjdXIgPSBTT1I7Ci0gICAgICAgIGZvciAoaW50IGogPSAwOyBqIDwgbjsgaisrKSB7Ci0gICAgICAgICAgICBieXRlIGQgPSBjaEluZm9bal07Ci0KLSAgICAgICAgICAgIGlmIChkID09IENoYXJhY3Rlci5ESVJFQ1RJT05BTElUWV9MRUZUX1RPX1JJR0hUIHx8Ci0gICAgICAgICAgICAgICAgZCA9PSBDaGFyYWN0ZXIuRElSRUNUSU9OQUxJVFlfUklHSFRfVE9fTEVGVCkgewotICAgICAgICAgICAgICAgIGN1ciA9IGQ7Ci0gICAgICAgICAgICB9IGVsc2UgaWYgKGQgPT0gQ2hhcmFjdGVyLkRJUkVDVElPTkFMSVRZX0VVUk9QRUFOX05VTUJFUiB8fAotICAgICAgICAgICAgICAgICAgICAgICBkID09IENoYXJhY3Rlci5ESVJFQ1RJT05BTElUWV9BUkFCSUNfTlVNQkVSKSB7Ci0gICAgICAgICAgICAgICAgY3VyID0gQ2hhcmFjdGVyLkRJUkVDVElPTkFMSVRZX1JJR0hUX1RPX0xFRlQ7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIGJ5dGUgZGQgPSBTT1I7Ci0gICAgICAgICAgICAgICAgaW50IGs7Ci0KLSAgICAgICAgICAgICAgICBmb3IgKGsgPSBqICsgMTsgayA8IG47IGsrKykgewotICAgICAgICAgICAgICAgICAgICBkZCA9IGNoSW5mb1trXTsKLQotICAgICAgICAgICAgICAgICAgICBpZiAoZGQgPT0gQ2hhcmFjdGVyLkRJUkVDVElPTkFMSVRZX0xFRlRfVE9fUklHSFQgfHwKLSAgICAgICAgICAgICAgICAgICAgICAgIGRkID09IENoYXJhY3Rlci5ESVJFQ1RJT05BTElUWV9SSUdIVF9UT19MRUZUKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBpZiAoZGQgPT0gQ2hhcmFjdGVyLkRJUkVDVElPTkFMSVRZX0VVUk9QRUFOX05VTUJFUiB8fAotICAgICAgICAgICAgICAgICAgICAgICAgZGQgPT0gQ2hhcmFjdGVyLkRJUkVDVElPTkFMSVRZX0FSQUJJQ19OVU1CRVIpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGRkID0gQ2hhcmFjdGVyLkRJUkVDVElPTkFMSVRZX1JJR0hUX1RPX0xFRlQ7Ci0gICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgIGZvciAoaW50IHkgPSBqOyB5IDwgazsgeSsrKSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChkZCA9PSBjdXIpCi0gICAgICAgICAgICAgICAgICAgICAgICBjaEluZm9beV0gPSBjdXI7Ci0gICAgICAgICAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgICAgICAgICAgICAgIGNoSW5mb1t5XSA9IFNPUjsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBqID0gayAtIDE7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICAvLyBkdW1wKGNoZGlycywgbiwgImZpbmFsIik7Ci0KLSAgICAgICAgLy8gZXh0cmE6IGVuZm9yY2UgdGhhdCBhbGwgdGFicyBhbmQgc3Vycm9nYXRlIGNoYXJhY3RlcnMgZ28gdGhlCi0gICAgICAgIC8vIHByaW1hcnkgZGlyZWN0aW9uCi0gICAgICAgIC8vIFRPRE86IGFjdHVhbGx5IGRvIGRpcmVjdGlvbnMgcmlnaHQgZm9yIHN1cnJvZ2F0ZXMKLQotICAgICAgICBmb3IgKGludCBqID0gMDsgaiA8IG47IGorKykgewotICAgICAgICAgICAgY2hhciBjID0gY2hzW2pdOwotCi0gICAgICAgICAgICBpZiAoYyA9PSAnXHQnIHx8IChjID49IDB4RDgwMCAmJiBjIDw9IDB4REZGRikpIHsKLSAgICAgICAgICAgICAgICBjaEluZm9bal0gPSBTT1I7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICAgICAgCi0gICAgICAgIHJldHVybiBkaXI7Ci0gICAgfQotCiAgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgY2hhciBGSVJTVF9DSksgPSAnXHUyRTgwJzsKICAgICAvKioKICAgICAgKiBSZXR1cm5zIHRydWUgaWYgdGhlIHNwZWNpZmllZCBjaGFyYWN0ZXIgaXMgb25lIG9mIHRob3NlIHNwZWNpZmllZApAQCAtOTQ4LDUzICs2MzQsMTUgQEAKICAgICB9CiAqLwogCi0gICAgcHJpdmF0ZSBzdGF0aWMgaW50IGdldEZpdChUZXh0UGFpbnQgcGFpbnQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUZXh0UGFpbnQgd29ya1BhaW50LAotICAgICAgICAgICAgICAgICAgICAgICBDaGFyU2VxdWVuY2UgdGV4dCwgaW50IHN0YXJ0LCBpbnQgZW5kLAotICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB3aWQpIHsKLSAgICAgICAgaW50IGhpZ2ggPSBlbmQgKyAxLCBsb3cgPSBzdGFydCAtIDEsIGd1ZXNzOwotCi0gICAgICAgIHdoaWxlIChoaWdoIC0gbG93ID4gMSkgewotICAgICAgICAgICAgZ3Vlc3MgPSAoaGlnaCArIGxvdykgLyAyOwotCi0gICAgICAgICAgICBpZiAobWVhc3VyZVRleHQocGFpbnQsIHdvcmtQYWludCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ZXh0LCBzdGFydCwgZ3Vlc3MsIG51bGwsIHRydWUsIG51bGwpID4gd2lkKQotICAgICAgICAgICAgICAgIGhpZ2ggPSBndWVzczsKLSAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgICAgICBsb3cgPSBndWVzczsKLSAgICAgICAgfQotCi0gICAgICAgIGlmIChsb3cgPCBzdGFydCkKLSAgICAgICAgICAgIHJldHVybiBzdGFydDsKLSAgICAgICAgZWxzZQotICAgICAgICAgICAgcmV0dXJuIGxvdzsKLSAgICB9Ci0KLSAgICBwcml2YXRlIHN0YXRpYyB2b2lkIGFkanVzdFRleHRXaWR0aHMoZmxvYXRbXSB3aWR0aHMsIENoYXJTZXF1ZW5jZSB0ZXh0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGN1clBvcywgaW50IG5leHRQb3MsIGludCBhY3R1YWxOdW0pIHsKLSAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgIGludCBkc3RJbmRleCA9IG5leHRQb3MgLSBjdXJQb3MgLSAxOwotICAgICAgICAgICAgZm9yIChpbnQgc3JjSW5kZXggPSBhY3R1YWxOdW0gLSAxOyBzcmNJbmRleCA+PSAwOyBzcmNJbmRleC0tKSB7Ci0gICAgICAgICAgICAgICAgZmluYWwgY2hhciBjID0gdGV4dC5jaGFyQXQoZHN0SW5kZXggKyBjdXJQb3MpOwotICAgICAgICAgICAgICAgIGlmIChjID49IDB4RDgwMCAmJiBjIDw9IDB4REZGRikgewotICAgICAgICAgICAgICAgICAgICB3aWR0aHNbZHN0SW5kZXgtLV0gPSAwLjBmOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB3aWR0aHNbZHN0SW5kZXgtLV0gPSB3aWR0aHNbc3JjSW5kZXhdOwotICAgICAgICAgICAgfQotICAgICAgICB9IGNhdGNoIChJbmRleE91dE9mQm91bmRzRXhjZXB0aW9uIGUpIHsKLSAgICAgICAgICAgIExvZy5lKCJ0ZXh0IiwgImFkanVzdCB0ZXh0IHdpZHRocyBmYWlsZWQiKTsKLSAgICAgICAgfQotICAgIH0KLQogICAgIHByaXZhdGUgaW50IG91dChDaGFyU2VxdWVuY2UgdGV4dCwgaW50IHN0YXJ0LCBpbnQgZW5kLAogICAgICAgICAgICAgICAgICAgICAgIGludCBhYm92ZSwgaW50IGJlbG93LCBpbnQgdG9wLCBpbnQgYm90dG9tLCBpbnQgdiwKICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCBzcGFjaW5nbXVsdCwgZmxvYXQgc3BhY2luZ2FkZCwKICAgICAgICAgICAgICAgICAgICAgICBMaW5lSGVpZ2h0U3BhbltdIGNob29zZWh0LCBpbnRbXSBjaG9vc2VodHYsCi0gICAgICAgICAgICAgICAgICAgICAgUGFpbnQuRm9udE1ldHJpY3NJbnQgZm0sIGJvb2xlYW4gdGFiLAorICAgICAgICAgICAgICAgICAgICAgIFBhaW50LkZvbnRNZXRyaWNzSW50IGZtLCBib29sZWFuIGhhc1RhYk9yRW1vamksCiAgICAgICAgICAgICAgICAgICAgICAgYm9vbGVhbiBuZWVkTXVsdGlwbHksIGludCBwc3RhcnQsIGJ5dGVbXSBjaGRpcnMsCiAgICAgICAgICAgICAgICAgICAgICAgaW50IGRpciwgYm9vbGVhbiBlYXN5LCBib29sZWFuIGxhc3QsCiAgICAgICAgICAgICAgICAgICAgICAgYm9vbGVhbiBpbmNsdWRlcGFkLCBib29sZWFuIHRyYWNrcGFkLAotICAgICAgICAgICAgICAgICAgICAgIGZsb2F0W10gd2lkdGhzLCBpbnQgd2lkc3RhcnQsIGludCB3aWRvZmYsCisgICAgICAgICAgICAgICAgICAgICAgY2hhcltdIGNocywgZmxvYXRbXSB3aWR0aHMsIGludCB3aWRzdGFydCwKICAgICAgICAgICAgICAgICAgICAgICBUZXh0VXRpbHMuVHJ1bmNhdGVBdCBlbGxpcHNpemUsIGZsb2F0IGVsbGlwc2lzd2lkdGgsCiAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgdGV4dHdpZHRoLCBUZXh0UGFpbnQgcGFpbnQpIHsKICAgICAgICAgaW50IGogPSBtTGluZUNvdW50OwpAQCAtMTAwMiw4ICs2NTAsNiBAQAogICAgICAgICBpbnQgd2FudCA9IG9mZiArIG1Db2x1bW5zICsgVE9QOwogICAgICAgICBpbnRbXSBsaW5lcyA9IG1MaW5lczsKIAotICAgICAgICAvLyBMb2cuZSgidGV4dCIsICJsaW5lICIgKyBzdGFydCArICIgdG8gIiArIGVuZCArIChsYXN0ID8gIj09PSIgOiAiIikpOwotCiAgICAgICAgIGlmICh3YW50ID49IGxpbmVzLmxlbmd0aCkgewogICAgICAgICAgICAgaW50IG5sZW4gPSBBcnJheVV0aWxzLmlkZWFsSW50QXJyYXlTaXplKHdhbnQgKyAxKTsKICAgICAgICAgICAgIGludFtdIGdyb3cgPSBuZXcgaW50W25sZW5dOwpAQCAtMTA3OSw1OSArNzI1LDIzIEBACiAgICAgICAgIGxpbmVzW29mZiArIG1Db2x1bW5zICsgU1RBUlRdID0gZW5kOwogICAgICAgICBsaW5lc1tvZmYgKyBtQ29sdW1ucyArIFRPUF0gPSB2OwogCi0gICAgICAgIGlmICh0YWIpCisgICAgICAgIGlmIChoYXNUYWJPckVtb2ppKQogICAgICAgICAgICAgbGluZXNbb2ZmICsgVEFCXSB8PSBUQUJfTUFTSzsKIAotICAgICAgICB7Ci0gICAgICAgICAgICBsaW5lc1tvZmYgKyBESVJdIHw9IGRpciA8PCBESVJfU0hJRlQ7Ci0KLSAgICAgICAgICAgIGludCBjdXIgPSBDaGFyYWN0ZXIuRElSRUNUSU9OQUxJVFlfTEVGVF9UT19SSUdIVDsKLSAgICAgICAgICAgIGludCBjb3VudCA9IDA7Ci0KLSAgICAgICAgICAgIGlmICghZWFzeSkgewotICAgICAgICAgICAgICAgIGZvciAoaW50IGsgPSBzdGFydDsgayA8IGVuZDsgaysrKSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChjaGRpcnNbayAtIHBzdGFydF0gIT0gY3VyKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBjb3VudCsrOwotICAgICAgICAgICAgICAgICAgICAgICAgY3VyID0gY2hkaXJzW2sgLSBwc3RhcnRdOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBEaXJlY3Rpb25zIGxpbmVkaXJzOwotCi0gICAgICAgICAgICBpZiAoY291bnQgPT0gMCkgewotICAgICAgICAgICAgICAgIGxpbmVkaXJzID0gRElSU19BTExfTEVGVF9UT19SSUdIVDsKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgc2hvcnRbXSBsZCA9IG5ldyBzaG9ydFtjb3VudCArIDFdOwotCi0gICAgICAgICAgICAgICAgY3VyID0gQ2hhcmFjdGVyLkRJUkVDVElPTkFMSVRZX0xFRlRfVE9fUklHSFQ7Ci0gICAgICAgICAgICAgICAgY291bnQgPSAwOwotICAgICAgICAgICAgICAgIGludCBoZXJlID0gc3RhcnQ7Ci0KLSAgICAgICAgICAgICAgICBmb3IgKGludCBrID0gc3RhcnQ7IGsgPCBlbmQ7IGsrKykgewotICAgICAgICAgICAgICAgICAgICBpZiAoY2hkaXJzW2sgLSBwc3RhcnRdICE9IGN1cikgewotICAgICAgICAgICAgICAgICAgICAgICAgLy8gWFhYIGNoZWNrIHRvIG1ha2Ugc3VyZSB3ZSBkb24ndAotICAgICAgICAgICAgICAgICAgICAgICAgLy8gICAgIG92ZXJmbG93IHNob3J0Ci0gICAgICAgICAgICAgICAgICAgICAgICBsZFtjb3VudCsrXSA9IChzaG9ydCkgKGsgLSBoZXJlKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGN1ciA9IGNoZGlyc1trIC0gcHN0YXJ0XTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGhlcmUgPSBrOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgbGRbY291bnRdID0gKHNob3J0KSAoZW5kIC0gaGVyZSk7Ci0KLSAgICAgICAgICAgICAgICBpZiAoY291bnQgPT0gMSAmJiBsZFswXSA9PSAwKSB7Ci0gICAgICAgICAgICAgICAgICAgIGxpbmVkaXJzID0gRElSU19BTExfUklHSFRfVE9fTEVGVDsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBsaW5lZGlycyA9IG5ldyBEaXJlY3Rpb25zKGxkKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0KKyAgICAgICAgbGluZXNbb2ZmICsgRElSXSB8PSBkaXIgPDwgRElSX1NISUZUOworICAgICAgICBEaXJlY3Rpb25zIGxpbmVkaXJzID0gRElSU19BTExfTEVGVF9UT19SSUdIVDsKKyAgICAgICAgLy8gZWFzeSBtZWFucyBhbGwgY2hhcnMgPCB0aGUgZmlyc3QgUlRMLCBzbyBubyBlbW9qaSwgbm8gbm90aGluZworICAgICAgICAvLyBYWFggYSBydW4gd2l0aCBubyB0ZXh0IG9yIGFsbCBzcGFjZXMgaXMgZWFzeSBidXQgbWlnaHQgYmUgYW4gZW1wdHkKKyAgICAgICAgLy8gUlRMIHBhcmFncmFwaC4gIE1ha2Ugc3VyZSBlYXN5IGlzIGZhbHNlIGlmIHRoaXMgaXMgdGhlIGNhc2UuCisgICAgICAgIGlmIChlYXN5KSB7CiAgICAgICAgICAgICBtTGluZURpcmVjdGlvbnNbal0gPSBsaW5lZGlyczsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIG1MaW5lRGlyZWN0aW9uc1tqXSA9IEFuZHJvaWRCaWRpLmRpcmVjdGlvbnMoZGlyLCBjaGRpcnMsIHdpZHN0YXJ0LCBjaHMsCisgICAgICAgICAgICAgICAgICAgIHdpZHN0YXJ0LCBlbmQgLSBzdGFydCk7CiAKICAgICAgICAgICAgIC8vIElmIGVsbGlwc2l6ZSBpcyBpbiBtYXJxdWVlIG1vZGUsIGRvIG5vdCBhcHBseSBlbGxpcHNpcyBvbiB0aGUgZmlyc3QgbGluZQogICAgICAgICAgICAgaWYgKGVsbGlwc2l6ZSAhPSBudWxsICYmIChlbGxpcHNpemUgIT0gVGV4dFV0aWxzLlRydW5jYXRlQXQuTUFSUVVFRSB8fCBqICE9IDApKSB7Ci0gICAgICAgICAgICAgICAgY2FsY3VsYXRlRWxsaXBzaXMoc3RhcnQsIGVuZCwgd2lkdGhzLCB3aWRzdGFydCwgd2lkb2ZmLAorICAgICAgICAgICAgICAgIGNhbGN1bGF0ZUVsbGlwc2lzKHN0YXJ0LCBlbmQsIHdpZHRocywgd2lkc3RhcnQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxsaXBzaXN3aWR0aCwgZWxsaXBzaXplLCBqLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRleHR3aWR0aCwgcGFpbnQpOwogICAgICAgICAgICAgfQpAQCAtMTE0Miw3ICs3NTIsNyBAQAogICAgIH0KIAogICAgIHByaXZhdGUgdm9pZCBjYWxjdWxhdGVFbGxpcHNpcyhpbnQgbGluZXN0YXJ0LCBpbnQgbGluZWVuZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXRbXSB3aWR0aHMsIGludCB3aWRzdGFydCwgaW50IHdpZG9mZiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXRbXSB3aWR0aHMsIGludCB3aWRzdGFydCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgYXZhaWwsIFRleHRVdGlscy5UcnVuY2F0ZUF0IHdoZXJlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgbGluZSwgZmxvYXQgdGV4dHdpZHRoLCBUZXh0UGFpbnQgcGFpbnQpIHsKICAgICAgICAgaW50IGxlbiA9IGxpbmVlbmQgLSBsaW5lc3RhcnQ7CkBAIC0xMTYyLDcgKzc3Miw3IEBACiAgICAgICAgICAgICBpbnQgaTsKIAogICAgICAgICAgICAgZm9yIChpID0gbGVuOyBpID49IDA7IGktLSkgewotICAgICAgICAgICAgICAgIGZsb2F0IHcgPSB3aWR0aHNbaSAtIDEgKyBsaW5lc3RhcnQgLSB3aWRzdGFydCArIHdpZG9mZl07CisgICAgICAgICAgICAgICAgZmxvYXQgdyA9IHdpZHRoc1tpIC0gMSArIGxpbmVzdGFydCAtIHdpZHN0YXJ0XTsKIAogICAgICAgICAgICAgICAgIGlmICh3ICsgc3VtICsgZWxsaXBzaXN3aWQgPiBhdmFpbCkgewogICAgICAgICAgICAgICAgICAgICBicmVhazsKQEAgLTExNzgsNyArNzg4LDcgQEAKICAgICAgICAgICAgIGludCBpOwogCiAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbGVuOyBpKyspIHsKLSAgICAgICAgICAgICAgICBmbG9hdCB3ID0gd2lkdGhzW2kgKyBsaW5lc3RhcnQgLSB3aWRzdGFydCArIHdpZG9mZl07CisgICAgICAgICAgICAgICAgZmxvYXQgdyA9IHdpZHRoc1tpICsgbGluZXN0YXJ0IC0gd2lkc3RhcnRdOwogCiAgICAgICAgICAgICAgICAgaWYgKHcgKyBzdW0gKyBlbGxpcHNpc3dpZCA+IGF2YWlsKSB7CiAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwpAQCAtMTE5NSw3ICs4MDUsNyBAQAogCiAgICAgICAgICAgICBmbG9hdCByYXZhaWwgPSAoYXZhaWwgLSBlbGxp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WQgd2lkdGggaXMgc2lnbmVkIGFuZCB3aWxsIGJlIDwgMCBpZiB0aGUgcGFyYWdyYXBoCi0gICAgICogZGlyZWN0aW9uIGlzIHJpZ2h0LXRvLWxlZnQuCi0gICAgICovCi0gICAgcHJpdmF0ZSBzdGF0aWMgZmxvYXQgZHJhd1VuaWZvcm1SdW4oQ2FudmFzIGNhbnZhcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNwYW5uZWQgdGV4dCwgaW50IHN0YXJ0LCBpbnQgZW5kLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGRpciwgYm9vbGVhbiBydW5Jc1J0bCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IHgsIGludCB0b3AsIGludCB5LCBpbnQgYm90dG9tLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUGFpbnQuRm9udE1ldHJpY3NJbnQgZm1pLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGV4dFBhaW50IHBhaW50LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGV4dFBhaW50IHdvcmtQYWludCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2xlYW4gbmVlZFdpZHRoKSB7Ci0KLSAgICAgICAgYm9vbGVhbiBoYXZlV2lkdGggPSBmYWxzZTsKLSAgICAgICAgZmxvYXQgcmV0ID0gMDsKLSAgICAgICAgQ2hhcmFjdGVyU3R5bGVbXSBzcGFucyA9IHRleHQuZ2V0U3BhbnMoc3RhcnQsIGVuZCwgQ2hhcmFjdGVyU3R5bGUuY2xhc3MpOwotCi0gICAgICAgIFJlcGxhY2VtZW50U3BhbiByZXBsYWNlbWVudCA9IG51bGw7Ci0KLSAgICAgICAgLy8gWFhYOiBUaGlzIHNob3VsZG4ndCBiZSBtb2RpZnlpbmcgcGFpbnQsIG9ubHkgd29ya1BhaW50LgotICAgICAgICAvLyBIb3dldmVyLCB0aGUgbWVtYmVycyBiZWxvbm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kID0gZW5kIC0gc3RhcnQ7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIHRtcCA9IHRleHQ7Ci0gICAgICAgICAgICAgICAgdG1wc3RhcnQgPSBzdGFydDsKLSAgICAgICAgICAgICAgICB0bXBlbmQgPSBlbmQ7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGlmIChmbWkgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIHdvcmtQYWludC5nZXRGb250TWV0cmljc0ludChmbWkpOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBpZiAoY2FudmFzICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICBpZiAod29ya1BhaW50LmJnQ29sb3IgIT0gMCkgewotICAgICAgICAgICAgICAgICAgICBpbnQgYyA9IHdvcmtQYWludC5nZXRDb2xvcigpOwotICAgICAgICAgICAgICAgICAgICBQYWludC5TdHlsZSBzID0gd29ya1BhaW50LmdldFN0eWxlKCk7Ci0gICAgICAgICAgICAgICAgICAgIHdvcmtQYWludC5zZXRDb2xvcih3b3JrUGFpbnQuYmdDb2xvcik7Ci0gICAgICAgICAgICAgICAgICAgIHdvcmtQYWludC5zZXRTdHlsZShQYWludC5TdHlsZS5GSUxMKTsKLQotICAgICAgICAgICAgICAgICAgICBpZiAoIWhhdmVXaWR0aCkgewotICAgICAgICAgICAgICAgICAgICAgICAgcmV0ID0gd29ya1BhaW50Lm1lYXN1cmVUZXh0KHRtcCwgdG1wc3RhcnQsIHRtcGVuZCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBoYXZlV2lkdGggPSB0cnVlOwotICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgaWYgKGRpciA9PSBMYXlvdXQuRElSX1JJR0hUX1RPX0xFRlQpCi0gICAgICAgICAgICAgICAgICAgICAgICBjYW52YXMuZHJhd1JlY3QoeCAtIHJldCwgdG9wLCB4LCBib3R0b20sIHdvcmtQYWludCk7Ci0gICAgICAgICAgICAgICAgICAgIGVsc2UKLSAgICAgICAgICAgICAgICAgICAgICAgIGNhbnZhcy5kcmF3UmVjdCh4LCB0b3AsIHggKyByZXQsIGJvdHRvbSwgd29ya1BhaW50KTsKLQotICAgICAgICAgICAgICAgICAgICB3b3JrUGFpbnQuc2V0U3R5bGUocyk7Ci0gICAgICAgICAgICAgICAgICAgIHdvcmtQYWludC5zZXRDb2xvcihjKTsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBpZiAoZGlyID09IExheW91dC5ESVJfUklHSFRfVE9fTEVGVCkgewotICAgICAgICAgICAgICAgICAgICBpZiAoIWhhdmVXaWR0aCkgewotICAgICAgICAgICAgICAgICAgICAgICAgcmV0ID0gd29ya1BhaW50Lm1lYXN1cmVUZXh0KHRtcCwgdG1wc3RhcnQsIHRtcGVuZCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBoYXZlV2lkdGggPSB0cnVlOwotICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgY2FudmFzLmRyYXdUZXh0KHRtcCwgdG1wc3RhcnQsIHRtcGVuZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHggLSByZXQsIHkgKyB3b3JrUGFpbnQuYmFzZWxpbmVTaGlmdCwgd29ya1BhaW50KTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBpZiAobmVlZFdpZHRoKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWhhdmVXaWR0aCkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldCA9IHdvcmtQYWludC5tZWFzdXJlVGV4dCh0bXAsIHRtcHN0YXJ0LCB0bXBlbmQpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhdmVXaWR0aCA9IHRydWU7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgICAgICBjYW52YXMuZHJhd1RleHQodG1wLCB0bXBzdGFydCwgdG1wZW5kLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeCwgeSArIHdvcmtQYWludC5iYXNlbGluZVNoaWZ0LCB3b3JrUGFpbnQpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgaWYgKG5lZWRXaWR0aCAmJiAhaGF2ZVdpZHRoKSB7Ci0gICAgICAgICAgICAgICAgICAgIHJldCA9IHdvcmtQYWludC5tZWFzdXJlVGV4dCh0bXAsIHRtcHN0YXJ0LCB0bXBlbmQpOwotICAgICAgICAgICAgICAgICAgICBoYXZlV2lkdGggPSB0cnVlOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgIHJldCA9IHJlcGxhY2VtZW50LmdldFNpemUod29ya1BhaW50LCB0ZXh0LCBzdGFydCwgZW5kLCBmbWkpOwotCi0gICAgICAgICAgICBpZiAoY2FudmFzICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICBpZiAoZGlyID09IExheW91dC5ESVJfUklHSFRfVE9fTEVGVCkKLSAgICAgICAgICAgICAgICAgICAgcmVwbGFjZW1lbnQuZHJhdyhjYW52YXMsIHRleHQsIHN0YXJ0LCBlbmQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeCAtIHJldCwgdG9wLCB5LCBib3R0b20sIHdvcmtQYWludCk7Ci0gICAgICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgICAgICByZXBsYWNlbWVudC5kcmF3KGNhbnZhcywgdGV4dCwgc3RhcnQsIGVuZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB4LCB0b3AsIHksIGJvdHRvbSwgd29ya1BhaW50KTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIGlmI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gdGhlIHRleHQuIEluIGEgcmlnaHQtdG8tbGVmdAotICAgICAqIHBhcmFncmFwaCwgdGhpcyB3aWxsIGJlIHRvIHRoZSByaWdodCBvZiB0aGUgdGV4dCB0byBiZSBkcmF3bi4gUGFpbnQKLSAgICAgKiBzaG91bGQgbm90IGhhdmUgYW4gQWxpZ24gdmFsdWUgb3RoZXIgdGhhbiBMRUZUIG9yIHBvc2l0aW9uaW5nIHdpbGwgZ2V0Ci0gICAgICogY29uZnVzZWQuCi0gICAgICoKLSAgICAgKiA8cD5UaGlzIG9wdGltaXplcyBmb3IgdW5zdHlsZWQgdGV4dCBhbmQgc28gd29ya1BhaW50IG1pZ2h0IG5vdCBiZQotICAgICAqIG1vZGlmaWVkIGJ5IHRoaXMgY2FsbC4KLSAgICAgKgotICAgICAqIDxwPlRoZSByZXR1cm5lZCBhZHZhbmNlIHdpZHRoIHdpbGwgYmUgPCAwIGlmIHRoZSBwYXJhZ3JhcGgKLSAgICAgKiBkaXJlY3Rpb24gaXMgcmlnaHQtdG8tbGVmdC4KLSAgICAgKi8KLSAgICBwcml2YXRlIHN0YXRpYyBmbG9hdCBkcmF3RGlyZWN0aW9uYWxSdW4oQ2FudmFzIGNhbnZhcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENoYXJTZXF1ZW5jZSB0ZXh0LCBpbnQgc3RhcnQsIGludCBlbmQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgZGlyLCBib29sZWFuIHJ1bklzUnRsLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgeCwgaW50IHRvcCwgaW50IHksIGludCBib3R0b20sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQYWludC5Gb250TWV0cmljc0ludCBmbWksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUZXh0UGFpbnQgcGFpbnQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUZXh0UGFpbnQgd29ya1BhaW50LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbGVhbiBuZWVkV2lkdGgpIHsKLQotICAgICAgICAvLyBYWFg6IEl0IGxvb2tzIGxpa2UgYWxsIGNhbGxzIHRvIHRoaXMgQVBJIG1hdGNoIGRpciBhbmQgcnVuSXNSdGwsIHNvCi0gICAgICAgIC8vIGhhdmluZyBib3RoIHBhcmFtZXRlcnMgaXMgcmVkdW5kYW50IGFuZCBjb25mdXNpbmcuCi0KLSAgICAgICAgLy8gZmFzdCBwYXRoIGZvciB1bnN0eWxlZCB0ZXh0Ci0gICAgICAgIGlmICghKHRleHQgaW5zdGFuY2VvZiBTcGFubmVkKSkgewotICAgICAgICAgICAgZmxvYXQgcmV0ID0gMDsKLQotICAgICAgICAgICAgaWYgKHJ1bklzUnRsKSB7Ci0gICAgICAgICAgICAgICAgQ2hhclNlcXVlbmNlIHRtcCA9IFRleHRVdGlscy5nZXRSZXZlcnNlKHRleHQsIHN0YXJ0LCBlbmQpOwotICAgICAgICAgICAgICAgIC8vIFhYWDogdGhpcyBhc3N1bWVzIGdldFJldmVyc2UgZG9lc24ndCB0d2VhayB0aGUgbGVuZ3RoIG9mCi0gICAgICAgICAgICAgICAgLy8gdGhlIHRleHQKLSAgICAgICAgICAgICAgICBpbnQgdG1wZW5kID0gZW5kIC0gc3RhcnQ7Ci0KLSAgICAgICAgICAgICAgICBpZiAoY2FudmFzICE9IG51bGwgfHwgbmVlZFdpZHRoKQotICAgICAgICAgICAgICAgICAgICByZXQgPSBwYWludC5tZWFzdXJlVGV4dCh0bXAsIDAsIHRtcGVuZCk7Ci0KLSAgICAgICAgICAgICAgICBpZiAoY2FudmFzICE9IG51bGwpCi0gICAgICAgICAgICAgICAgICAgIGNhbnZhcy5kcmF3VGV4dCh0bXAsIDAsIHRtcGVuZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHggLSByZXQsIHksIHBhaW50KTsKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgaWYgKG5lZWRXaWR0aCkKLSAgICAgICAgICAgICAgICAgICAgcmV0ID0gcGFpbnQubWVhc3VyZVRleHQodGV4dCwgc3RhcnQsIGVuZCk7Ci0KLSAgICAgICAgICAgICAgICBpZiAoY2FudmFzICE9IG51bGwpCi0gICAgICAgICAgICAgICAgICAgIGNhbnZhcy5kcmF3VGV4dCh0ZXh0LCBzdGFydCwgZW5kLCB4LCB5LCBwYWludCk7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGlmIChmbWkgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIHBhaW50LmdldEZvbnRNZXRyaWNzSW50KGZtaSk7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIHJldHVybiByZXQgKiBkaXI7ICAgLy8gTGF5b3V0LkRJUl9SSUdIVF9UT19MRUZUID09IC0xCi0gICAgICAgIH0KLSAgICAgICAgCi0gICAgICAgIGZsb2F0IG94ID0geDsKLSAgICAgICAgaW50IG1pbkFzY2VudCA9IDAsIG1heERlc2NlbnQgPSAwLCBtaW5Ub3AgPSAwLCBtYXhCb3R0b20gPSAwOwotCi0gICAgICAgIFNwYW5uZWQgc3AgPSAoU3Bhbm5lZCkgdGV4dDsKLSAgICAgICAgQ2xhc3M8Pz4gZGl2aXNpb247Ci0KLSAgICAgICAgaWYgKGNhbnZhcyA9PSBudWxsKQotICAgICAgICAgICAgZGl2aXNpb24gPSBNZXRyaWNBZmZlY3RpbmdTcGFuLmNsYXNzOwotICAgICAgICBlbHNlCi0gICAgICAgICAgICBkaXZpc2lvbiA9IENoYXJhY3RlclN0eWxlLmNsYXNzOwotCi0gICAgICAgIGludCBuZXh0OwotICAgICAgICBmb3IgKGludCBpID0gc3RhcnQ7IGkgPCBlbmQ7IGkgPSBuZXh0KSB7Ci0gICAgICAgICAgICBuZXh0ID0gc3AubmV4dFNwYW5UcmFuc2l0aW9uKGksIGVuZCwgZGl2aXNpb24pOwotCi0gICAgICAgICAgICAvLyBYWFg6IGlmIGRpciBhbmQgcnVuSXNSdGwgd2VyZSBub3QgdGhlIHNhbWUsIHRoaXMgd291bGQgZHJhdwotICAgICAgICAgICAgLy8gc3BhbnMgaW4gdGhlIHdyb25nIG9yZGVyLCBidXQgbm8gb25lIGFwcGVhcnMgdG8gY2FsbCBpdCB0aGlzCi0gICAgICAgICAgICAvLyB3YXkuCi0gICAgICAgICAgICB4ICs9IGRyYXdVbmlmb3JtUnVuKGNhbnZhcywgc3AsIGksIG5leHQsIGRpciwgcnVuSXNSdGwsCi0gICAgICAgICAgICAgICAgICB4LCB0b3AsIHksIGJvdHRvbSwgZm1pLCBwYWludCwgd29ya1BhaW50LAotICAgICAgICAgICAgICAgICAgbmVlZFdpZHRoIHx8IG5leHQgIT0gZW5kKTsKLQotICAgICAgICAgICAgaWYgKGZtaSAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgaWYgKGZtaS5hc2NlbnQgPCBtaW5Bc2NlbnQpCi0gICAgICAgICAgICAgICAgICAgIG1pbkFzY2VudCA9IGZtaS5hc2NlbnQ7Ci0gICAgICAgICAgICAgICAgaWYgKGZtaS5kZXNjZW50ID4gbWF4RGVzY2VudCkKLSAgICAgICAgICAgICAgICAgICAgbWF4RGVzY2VudCA9IGZtaS5kZXNjZW50OwotCi0gICAgICAgICAgICAgICAgaWYgKGZtaS50b3AgPCBtaW5Ub3ApCi0gICAgICAgICAgICAgICAgICAgIG1pblRvcCA9IGZtaS50b3A7Ci0gICAgICAgICAgICAgICAgaWYgKGZtaS5ib3R0b20gPiBtYXhCb3R0b20pCi0gICAgICAgICAgICAgICAgICAgIG1heEJvdHRvbSA9IGZtaS5ib3R0b207Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICBpZiAoZm1pICE9IG51bGwpIHsKLSAgICAgICAgICAgIGlmIChzdGFydCA9PSBlbmQpIHsKLSAgICAgICAgICAgICAgICBwYWludC5nZXRGb250TWV0cmljc0ludChmbWkpOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBmbWkuYXNjZW50ID0gbWluQXNjZW50OwotICAgICAgICAgICAgICAgIGZtaS5kZXNjZW50ID0gbWF4RGVzY2VudDsKLSAgICAgICAgICAgICAgICBmbWkudG9wID0gbWluVG9wOwotICAgICAgICAgICAgICAgIGZtaS5ib3R0b20gPSBtYXhCb3R0b207Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICByZXR1cm4geCAtIG94OwotICAgIH0KLQotICAgIC8qKgotICAgICAqIERyYXdzIGEgdW5pZGlyZWN0aW9uYWwgcnVuIG9mIHRleHQgb24gYSBzaW5nbGUgbGluZSwgYW5kIG9wdGlvbmFsbHkKLSAgICAgKiByZXR1cm5zIHRoZSBzaWduZWQgYWR2YW5jZS4gIFVubGlrZSBkcmF3RGlyZWN0aW9uYWxSdW4sIHRoZSBwYXJhZ3JhcGgKLSAgICAgKiBkaXJlY3Rpb24gYW5kIHJ1biBkaXJlY3Rpb24gY2FuIGJlIGRpZmZlcmVudC4KLSAgICAgKi8KLSAgICAvKiBwYWNrYWdlICovIHN0YXRpYyBmbG9hdCBkcmF3VGV4dChDYW52YXMgY2FudmFzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ2hhclNlcXVlbmNlIHRleHQsIGludCBzdGFydCwgaW50IGVuZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBkaXIsIGJvb2xlYW4gcnVuSXNSdGwsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB4LCBpbnQgdG9wLCBpbnQgeSwgaW50IGJvdHRvbSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRleHRQYWludCBwYWludCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRleHRQYWludCB3b3JrUGFpbnQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sZWFuIG5lZWRXaWR0aCkgewotICAgICAgICAvLyBYWFggdGhpcyBsb2dpYyBpcyAoZGlyID09IERJUl9MRUZUX1RPX1JJR0hUKSA9PSBydW5Jc1J0bAotICAgICAgICBpZiAoKGRpciA9PSBMYXlvdXQuRElSX1JJR0hUX1RPX0xFRlQgJiYgIXJ1bklzUnRsKSB8fAotICAgICAgICAgICAgKHJ1bklzUnRsICYmIGRpciA9PSBMYXlvdXQuRElSX0xFRlRfVE9fUklHSFQpKSB7Ci0gICAgICAgICAgICAvLyBUT0RPOiB0aGlzIG5lZWRzIHRoZSByZWFsIGRpcmVjdGlvbgotICAgICAgICAgICAgZmxvYXQgY2ggPSBkcmF3RGlyZWN0aW9uYWxSdW4obnVsbCwgdGV4dCwgc3RhcnQsIGVuZCwKLSAgICAgICAgICAgICAgICAgICAgTGF5b3V0LkRJUl9MRUZUX1RPX1JJR0hULCBmYWxzZSwgMCwgMCwgMCwgMCwgbnVsbCwgcGFpbnQsCi0gICAgICAgICAgICAgICAgICAgIHdvcmtQYWludCwgdHJ1ZSk7Ci0KLSAgICAgICAgICAgIGNoICo9IGRpcjsgIC8vIERJUl9SSUdIVF9UT19MRUZUID09IC0xCi0gICAgICAgICAgICBkcmF3RGlyZWN0aW9uYWxSdW4oY2FudmFzLCB0ZXh0LCBzdGFydCwgZW5kLCAtZGlyLAotICAgICAgICAgICAgICAgICAgICBydW5Jc1J0bCwgeCArIGNoLCB0b3AsIHksIGJvdHRvbSwgbnVsbCwgcGFpbnQsCi0gICAgICAgICAgICAgICAgICAgIHdvcmtQYWludCwgdHJ1ZSk7Ci0KLSAgICAgICAgICAgIHJldHVybiBjaDsKLSAgICAgICAgfQotCi0gICAgICAgIHJldHVybiBkcmF3RGlyZWN0aW9uYWxSdW4oY2FudmFzLCB0ZXh0LCBzdGFydCwgZW5kLCBkaXIsIHJ1bklzUnRsLAotICAgICAgICAgICAgICAgICAgICAgIC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GUgZHJhd24gdGV4dCBpZiBuZWVkV2lkdGggaXMgdHJ1ZQotICAgICAqLwotICAgIHB1YmxpYyBzdGF0aWMgZmxvYXQgZHJhd1RleHQoQ2FudmFzIGNhbnZhcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENoYXJTZXF1ZW5jZSB0ZXh0LCBpbnQgc3RhcnQsIGludCBlbmQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgZGlyZWN0aW9uLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgeCwgaW50IHRvcCwgaW50IHksIGludCBib3R0b20sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUZXh0UGFpbnQgcGFpbnQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUZXh0UGFpbnQgd29ya1BhaW50LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbGVhbiBuZWVkV2lkdGgpIHsKLSAgICAgICAgLy8gRm9yIHNhZmV0eS4KLSAgICAgICAgZGlyZWN0aW9uID0gZGlyZWN0aW9uID49IDAgPyBMYXlvdXQuRElSX0xFRlRfVE9fUklHSFQKLSAgICAgICAgICAgICAgICA6IExheW91dC5ESVJfUklHSFRfVE9fTEVGVDsKLQotICAgICAgICAvLyBIaWRlIHJ1bklzUnRsIHBhcmFtZXRlciBzaW5jZSBpdCBpcyBtZWFuaW5nbGVzcyBmb3IgZXh0ZXJuYWwKLSAgICAgICAgLy8gZGV2ZWxvcGVycy4KLSAgICAgICAgLy8gWFhYOiB0aGUgcnVuSXNSdGwgcHJvYmFibHkgb3VnaHQgdG8gYmUgdGhlIHNhbWUgYXMgZGlyZWN0aW9uLCB0aGVuCi0gICAgICAgIC8vIHRoaXMgY291bGQgZHJhdyBydGwgdGV4dC4KLSAgICAgICAgcmV0dXJuIGRyYXdUZXh0KGNhbnZhcywgdGV4dCwgc3RhcnQsIGVuZCwgZGlyZWN0aW9uLCBm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iBAcmV0dXJuIFRoZSB3aWR0aCBvZiB0aGUgdGV4dAotICAgICAqLwotICAgIHB1YmxpYyBzdGF0aWMgZmxvYXQgbWVhc3VyZVRleHQoVGV4dFBhaW50IHBhaW50LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGV4dFBhaW50IHdvcmtQYWludCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENoYXJTZXF1ZW5jZSB0ZXh0LCBpbnQgc3RhcnQsIGludCBlbmQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQYWludC5Gb250TWV0cmljc0ludCBmbWkpIHsKLSAgICAgICAgcmV0dXJuIGRyYXdEaXJlY3Rpb25hbFJ1bihudWxsLCB0ZXh0LCBzdGFydCwgZW5kLAotICAgICAgICAgICAgICAgICAgICAgICBMYXlvdXQuRElSX0xFRlRfVE9fUklHSFQsIGZhbHNlLAotICAgICAgICAgICAgICAgICAgICAgICAwLCAwLCAwLCAwLCBmbWksIHBhaW50LCB3b3JrUGFpbnQsIHRydWUpOwotICAgIH0KLX0KZGlmZiAtLWdpdCBhL2NvcmUvamF2YS9hbmRyb2lkL3RleHQvVGV4dExpbmUuamF2YSBiL2NvcmUvamF2YS9hbmRyb2lkL3RleHQvVGV4dExpbmUuamF2YQpuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi4yZjc0ODJjCi0tLSAvZGV2L251bGwKKysrIGIvY29yZS9qYXZhL2FuZHJvaWQvdGV4dC9UZXh0TGluZS5qYXZhCkBAIC0wLDAgKzEsOTQwIEBACisvKgorICogQ29weXJpZ2h0IChDKSAyMDEwIFRoZSBBbmRyb2lkIE9wZW4gU291cmNlIFByb2plY3QKKyAqCisgKiBMaWNlbnNlZCB1bmRlciB0aGUgQXBhY2hlIExpY2Vuc2UsIFZlcnNpb24gMi4wICh0aGUgIkxpY2Vuc2UiKTsKKyAqIHlvdSBtYXkgbm90IHVzZSB0aGlzIGZ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cnNWYWxpZDsKKyAgICBwcml2YXRlIFNwYW5uZWQgbVNwYW5uZWQ7CisgICAgcHJpdmF0ZSBmaW5hbCBUZXh0UGFpbnQgbVdvcmtQYWludCA9IG5ldyBUZXh0UGFpbnQoKTsKKworICAgIHByaXZhdGUgc3RhdGljIFRleHRMaW5lW10gY2FjaGVkID0gbmV3IFRleHRMaW5lWzNdOworCisgICAgLyoqCisgICAgICogUmV0dXJucyBhIG5ldyBUZXh0TGluZSBmcm9tIHRoZSBzaGFyZWQgcG9vbC4KKyAgICAgKgorICAgICAqIEByZXR1cm4gYW4gdW5pbml0aWFsaXplZCBUZXh0TGluZQorICAgICAqLworICAgIHN0YXRpYyBUZXh0TGluZSBvYnRhaW4oKSB7CisgICAgICAgIFRleHRMaW5lIHRsOworICAgICAgICBzeW5jaHJvbml6ZWQgKGNhY2hlZCkgeworICAgICAgICAgICAgZm9yIChpbnQgaSA9IGNhY2hlZC5sZW5ndGg7IC0taSA+PSAwOykgeworICAgICAgICAgICAgICAgIGlmIChjYWNoZWRbaV0gIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICB0bCA9IGNhY2hlZFtpXTsKKyAgICAgICAgICAgICAgICAgICAgY2FjaGVkW2ldID0gbnVsbDsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRsOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICB0bCA9IG5ldyBUZXh0TGluZSgpOworICAgICAgICBMb2cudigiVExJTkUiLCAibmV3OiAiICsgdGwpOworICAgICAgICByZXR1cm4gdGw7CisgICAgfQorCisgICAgLyoqCisgICAgICogUHV0cyBhIFRleHRMaW5lIGJhY2sgaW50byB0aGUgc2hhcmVkIHBvb2wuIERvIG5vdCB1c2UgdGhpcyBUZXh0TGluZSBvbmNlCisgICAgICogaXQgaGFzIGJlZW4gcmV0dXJuZWQuCisgICAgICogQHBhcmFtIHRsIHRoZSB0ZXh0TGluZQorICAgICAqIEByZXR1cm4gbnVsbCwgYXMgYSBjb252ZW5pZW5jZSBmcm9tIGNsZWFyaW5nIHJlZmVyZW5jZXMgdG8gdGhlIHByb3ZpZGVkCisgICAgICogVGV4dExpbmUKKyAgICAgKi8KKyAgICBzdGF0aWMgVGV4dExpbmUgcmVjeWNsZShUZXh0TGluZSB0bCkgeworICAgICAgICB0bC5tVGV4dCA9IG51bGw7CisgICAgICAgIHRsLm1QYWludCA9IG51bGw7CisgICAgICAgIHRsLm1EaXJlY3Rpb25zID0gbnVsbDsKKyAgICAgICAgaWYgKHRsLm1MZW4gPCAyNTApIHsKKyAgICAgICAgICAgIHN5bmNocm9uaXplZChjYWNoZWQpIHsKKyAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGNhY2hlZC5sZW5ndGg7ICsraSkgeworICAgICAgICAgICAgICAgICAgICBpZiAoY2FjaGVkW2ldID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhY2hlZFtpXSA9IHRsOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIG51bGw7CisgICAgfQorCisgICAgLyoqCisgICAgICogSW5pdGlhbGl6ZXMgYSBUZXh0TGluZSBhbmQgcHJlcGFyZXMgaXQgZm9yIHVzZS4KKyAgICAgKgorICAgICAqIEBwYXJhbSBwYWludCB0aGUgYmFzZSBwYWludCBmb3IgdGhlIGxpbmUKKyAgICAgKiBAcGFyYW0gdGV4dCB0aGUgdGV4dCwgY2FuIGJlIFN0eWxlZAorICAgICAqIEBwYXJhbSBzdGFydCB0aGUgc3RhcnQgb2YgdGhlIGxpbmUgcmVsYXRpdmUgdG8gdGhlIHRleHQKKyAgICAgKiBAcGFyYW0gbGltaXQgdGhlIGxpbWl0IG9mIHRoZSBsaW5lIHJlbGF0aXZlIHRvIHRoZSB0ZXh0CisgICAgICogQHBhcmFtIGRpciB0aGUgcGFyYWdyYXBoIGRpcmVjdGlvbiBvZiB0aGlzIGxpbmUKKyAgICAgKiBAcGFyYW0gZGlyZWN0aW9ucyB0aGUgZGlyZWN0aW9ucyBpbmZvcm1hdGlvbiBvZiB0aGlzIGxpbmUKKyAgICAgKiBAcGFyYW0gaGFzVGFicyB0cnVlIGlmIHRoZSBsaW5lIG1pZ2h0IGNvbnRhaW4gdGFicyBvciBlbW9qaQorICAgICAqIEBwYXJhbSB0YWJTdG9wcyB0aGUgdGFiU3RvcHMuIENhbiBiZSBudWxsLgorICAgICAqLworICAgIHZvaWQgc2V0KFRleHRQYWludCBwYWludCwgQ2hhclNlcXVlbmNlIHRleHQsIGludCBzdGFydCwgaW50IGxpbWl0LCBpbnQgZGlyLAorICAgICAgICAgICAgRGlyZWN0aW9ucyBkaXJlY3Rpb25zLCBib29sZWFuIGhhc1RhYnMsIFRhYlN0b3BzIHRhYlN0b3BzKSB7CisgICAgICAgIG1QYWludCA9IHBhaW50OworICAgICAgICBtVGV4dCA9IHRleHQ7CisgICAgICAgIG1TdGFydCA9IHN0YXJ0OworICAgICAgICBtTGVuID0gbGltaXQgLSBzdGFydDsKKyAgICAgICAgbURpciA9IGRpcjsKKyAgICAgICAgbURpcmVjdGlvbnMgPSBkaXJlY3Rpb25zOworICAgICAgICBtSGFzVGFicyA9IGhhc1RhYnM7CisgICAgICAgIG1TcGFubmVkID0gbnVsbDsKKworICAgICAgICBib29sZWFuIGhhc1JlcGxhY2VtZW50ID0gZmFsc2U7CisgICAgICAgIGlmICh0ZXh0IGluc3RhbmNlb2YgU3Bhbm5lZCkgeworICAgICAgICAgICAgbVNwYW5uZWQgPSAoU3Bhbm5lZCkgdGV4dDsKKyAgICAgICAgICAgIGhhc1JlcGxhY2VtZW50ID0gbVNwYW5uZWQuZ2V0U3BhbnMoc3RhcnQsIGxpbWl0LAorICAgICAgICAgICAgICAgICAgICBSZXBsYWNlbWVudFNwYW4uY2x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GludCBpID0gc3RhcnQsIGluZXh0OyBpIDwgbGltaXQ7IGkgPSBpbmV4dCkgeworICAgICAgICAgICAgICAgICAgICBpbmV4dCA9IG1TcGFubmVkLm5leHRTcGFuVHJhbnNpdGlvbihpLCBsaW1pdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBSZXBsYWNlbWVudFNwYW4uY2xhc3MpOworICAgICAgICAgICAgICAgICAgICBpZiAobVNwYW5uZWQuZ2V0U3BhbnMoaSwgaW5leHQsIFJlcGxhY2VtZW50U3Bhbi5jbGFzcykKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAubGVuZ3RoID4gMCkgeyAvLyB0cmFuc2l0aW9uIGludG8gYSBzcGFuCisgICAgICAgICAgICAgICAgICAgICAgICBjaGFyc1tpIC0gc3RhcnRdID0gJ1x1ZmZmYyc7CisgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGludCBqID0gaSAtIHN0YXJ0ICsgMSwgZSA9IGluZXh0IC0gc3RhcnQ7IGogPCBlOyArK2opIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFyc1tqXSA9ICdcdWZlZmYnOyAvLyB1c2VkIGFzIFpXTkJTLCBtYXJrcyBwb3NpdGlvbnMgdG8gc2tpcAorICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIG1UYWJzID0gdGFiU3RvcHM7CisgICAgfQorCisgICAgLyoqCisgICAgICogUmVuZGVycyB0aGUgVGV4dExpbmUuCisgICAgICoKKyAgICAgKiBAcGFyYW0gYyB0aGUgY2FudmFzIHRvIHJlbmRlciBvbgorICAgICAqIEBwYXJhbSB4IHRoZSBsZWFkaW5nIG1hcmdpbiBwb3NpdGlvbgorICAgICAqIEBwYXJhbSB0b3AgdGhlIHRvcCBvZiB0aGUgbGluZQorICAgICAqIEBwYXJhbSB5IHRoZSBiYXNlbGluZQorICAgICAqIEBwYXJhbSBib3R0b20gdGhlIGJvdHRvbSBvZiB0aGUgbGluZQorICAgICAqLworICAgIHZvaWQgZHJhdyhDYW52YXMgYywgZmxvYXQgeCwgaW50IHRvcCwgaW50IHksIGludCBib3R0b20pIHsKKyAgICAgICAgaWYgKCFtSGFzVGFicykgeworICAgICAgICAgICAgaWYgKG1EaXJlY3Rpb25zID09IExheW91dC5ESVJTX0FMTF9MRUZUX1RPX1JJR0hUKSB7CisgICAgICAgICAgICAgICAgZHJhd1J1bihjLCAwLCAwLCBtTGVuLCBmYWxzZSwgeCwgdG9wLCB5LCBib3R0b20sIGZhbHNlKTsKKyAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAobURpcmVjdGlvbnMgPT0gTGF5b3V0LkRJUlNfQUxMX1JJR0hUX1RPX0xFRlQpIHsKKyAgICAgICAgICAgICAgICBkcmF3UnVuKGMsIDAsIDAsIG1MZW4sIHRydWUsIHgsIHRvcCwgeSwgYm90dG9tLCBmYWxzZSk7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgZmxvYXQgaCA9IDA7CisgICAgICAgIGludFtdIHJ1bnMgPSBtRGlyZWN0aW9ucy5tRGlyZWN0aW9uczsKKyAgICAgICAgUmVjdEYgZW1vamlSZWN0ID0gbnVsbDsKKworICAgICAgICBpbnQgbGFzdFJ1bkluZGV4ID0gcnVucy5sZW5ndGggLSAyOworICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IHJ1bnMubGVuZ3RoOyBpICs9IDIpIHsKKyAgICAgICAgICAgIGludCBydW5TdGFydCA9IHJ1bnNbaV07CisgICAgICAgICAgICBpbnQgcnVuTGltaXQgPSBydW5TdGFydCArIChydW5zW2krMV0gJiBMYXlvdXQuUlVOX0xFTkdUSF9NQVNLKTsKKyAgICAgICAgICAgIGlmIChydW5MaW1pdCA+IG1MZW4pIHsKKyAgICAgICAgICAgICAgICBydW5MaW1pdCA9IG1MZW47CisgICAgICAgICAgICB9CisgICAgICAgICAgICBib29sZWFuIHJ1bklzUnRsID0gKHJ1bnNbaSsxXSAmIExheW91dC5SVU5fUlRMX0ZMQUcpICE9IDA7CisKKyAgICAgICAgICAgIGludCBzZWdzdGFydCA9IHJ1blN0YXJ0OworICAgICAgICAgICAgY2hhcltdIGNoYXJzID0gbUNoYXJzOworICAgICAgICAgICAgZm9yIChpbnQgaiA9IG1IYXNUYWJzID8gcnVuU3RhcnQgOiBydW5MaW1pdDsgaiA8PSBydW5MaW1pdDsgaisrKSB7CisgICAgICAgICAgICAgICAgaW50IGNvZGVwdCA9IDA7CisgICAgICAgICAgICAgICAgQml0bWFwIGJtID0gbnVsbDsKKworICAgICAgICAgICAgICAgIGlmIChtSGFzVGFicyAmJiBqIDwgcnVuTGltaXQpIHsKKyAgICAgICAgICAgICAgICAgICAgY29kZXB0ID0gbUNoYXJzW2pdOworICAgICAgICAgICAgICAgICAgICBpZiAoY29kZXB0ID49IDB4ZDgwMCAmJiBjb2RlcHQgPCAweGRjMDAgJiYgaiArIDEgPCBydW5MaW1pdCkgeworICAgICAgICAgICAgICAgICAgICAgICAgY29kZXB0ID0gQ2hhcmFjdGVyLmNvZGVQb2ludEF0KG1DaGFycywgaik7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY29kZXB0ID49IExheW91dC5NSU5fRU1PSkkgJiYgY29kZXB0IDw9IExheW91dC5NQVhfRU1PSkkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBibSA9IExheW91dC5FTU9KSV9GQUNUT1JZLmdldEJpdG1hcEZyb21BbmRyb2lkUHVhKGNvZGVwdCk7CisgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGNvZGVwdCA+IDB4ZmZmZikgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICsrajsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIGlmIChqID09IHJ1bkxpbWl0IHx8IGNvZGVwdCA9PSAnXHQnIHx8IGJtICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgaCArPSBkcmF3UnVuKGMsIGksIHNlZ3N0YXJ0LCBqLCBydW5Jc1J0bCwgeCtoLCB0b3AsIHksIGJvdHRvbSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpICE9IGxhc3RSdW5JbmRleCB8fCBqICE9IG1MZW4pOworCisgICAgICAgICAgICAgICAgICAgIGlmIChjb2RlcHQgPT0gJ1x0JykgeworICAgICAgICAgICAgICAgICAgICAgICAgaCA9IG1EaXIgKiBuZXh0VGFiKGggKiBtRGlyKTsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChibSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCBibUFzY2VudCA9IGFzY2VudChqKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IGJpdG1hcEhlaWdodCA9IGJtLmdldEhlaWdodCgpOworICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgc2NhbGUgPSAtYm1Bc2NlbnQgLyBiaXRtYXBIZWlnaHQ7CisgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB3aWR0aCA9IGJtLmdldFdpZHRoKCkgKiBzY2FsZTsKKworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGVtb2ppUmVjdCA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW1vamlSZWN0ID0gbmV3IFJlY3RGKCk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBlbW9qaVJlY3Quc2V0KHggKyBoLCB5ICsgYm1Bc2NlbnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHggKyBoICsgd2lkdGgsIHkpOworICAgICAgICAgICAgICAgICAgICAgICAgYy5kcmF3Qml0bWFwKGJtLCBudWxsLCBlbW9qaVJlY3QsIG1QYWludCk7CisgICAgICAgICAgICAgICAgICAgICAgICBoICs9IHdpZHRoOworICAgICAgICAgICAgICAgICAgICAgICAgaisrOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIHNlZ3N0YXJ0ID0gaiArIDE7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogUmV0dXJucyBtZXRyaWNzIGluZm9ybWF0aW9uIGZvciB0aGUgZW50aXJlIGxpbmUuCisgICAgICoKKyAgICAgKiBAcGFyYW0gZm1pIHJlY2VpdmVzIGZvbnQgbWV0cmljcyBpbmZvcm1hdGlvbiwgY2FuIGJlIG51bGwKKyAgICAgKiBAcmV0dXJuIHRoZSBzaWduZWQgd2lkdGggb2YgdGhlIGxpbmUKKyAgICAgKi8KKyAgICBmbG9hdCBtZXRyaWNzKEZvbnRNZXRyaWNzSW50IGZtaSkgeworICAgICAgICByZXR1cm4gbWVhc3VyZShtTGVuLCBmYWxzZSwgZm1pKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZXR1cm5zIGluZm9ybWF0aW9uIGFib3V0IGEgcG9zaXRpb24gb24gdGhlIGxpbmUuCisgICAgICoKKyAgICAgKiBAcGFyYW0gb2Zmc2V0IHRoZSBsaW5lLXJlbGF0aXZlIGNoYXJhY3RlciBvZmZzZXQsIGJldHdlZW4gMCBhbmQgdGhlCisgICAgICogbGluZSBsZW5ndGgsIGluY2x1c2l2ZQorICAgICAqIEBwYXJhbSB0cmFpbGluZyB0cnVlIHRvIG1lYXN1cmUgdGhlIHRyYWlsaW5nIGVkZ2Ugb2YgdGhlIGNoYXJhY3RlcgorICAgICAqIGJlZm9yZSBvZmZzZXQsIGZhbHNlIHRvIG1lYXN1cmUgdGhlIGxlYWR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SBydW5zID0gbURpcmVjdGlvbnMubURpcmVjdGlvbnM7CisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgcnVucy5sZW5ndGg7IGkgKz0gMikgeworICAgICAgICAgICAgaW50IHJ1blN0YXJ0ID0gcnVuc1tpXTsKKyAgICAgICAgICAgIGludCBydW5MaW1pdCA9IHJ1blN0YXJ0ICsgKHJ1bnNbaSsxXSAmIExheW91dC5SVU5fTEVOR1RIX01BU0spOworICAgICAgICAgICAgaWYgKHJ1bkxpbWl0ID4gbUxlbikgeworICAgICAgICAgICAgICAgIHJ1bkxpbWl0ID0gbUxlbjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGJvb2xlYW4gcnVuSXNSdGwgPSAocnVuc1tpKzFdICYgTGF5b3V0LlJVTl9SVExfRkxBRykgIT0gMDsKKworICAgICAgICAgICAgaW50IHNlZ3N0YXJ0ID0gcnVuU3RhcnQ7CisgICAgICAgICAgICBmb3IgKGludCBqID0gbUhhc1RhYnMgPyBydW5TdGFydCA6IHJ1bkxpbWl0OyBqIDw9IHJ1bkxpbWl0OyBqKyspIHsKKyAgICAgICAgICAgICAgICBpbnQgY29kZXB0ID0gMDsKKyAgICAgICAgICAgICAgICBCaXRtYXAgYm0gPSBudWxsOworCisgICAgICAgICAgICAgICAgaWYgKG1IYXNUYWJzICYmIGogPCBydW5MaW1pdCkgeworICAgICAgICAgICAgICAgICAgICBjb2RlcHQgPSBjaGFyc1tqXTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGNvZGVwdCA+PSAweGQ4MDAgJiYgY29kZXB0IDwgMHhkYzAwICYmIGogKyAxIDwgcnVuTGltaXQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNvZGVwdCA9IENoYXJhY3Rlci5jb2RlUG9pbnRBdChjaGFycywgaik7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY29kZXB0ID49IExheW91dC5NSU5fRU1PSkkgJiYgY29kZXB0IDw9IExheW91dC5NQVhfRU1PSkkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBibSA9IExheW91dC5FTU9KSV9GQUNUT1JZLmdldEJpdG1hcEZyb21BbmRyb2lkUHVhKGNvZGVwdCk7CisgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGNvZGVwdCA+IDB4ZmZmZikgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICsrajsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIGlmIChqID09IHJ1bkxpbWl0IHx8IGNvZGVwdCA9PSAnXHQnIHx8IGJtICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgYm9vbGVhbiBpblNlZ21lbnQgPSB0YXJnZXQgPj0gc2Vnc3RhcnQgJiYgdGFyZ2V0IDwgajsKKworICAgICAgICAgICAgICAgICAgICBib29sZWFuIGFkdmFuY2UgPSAobURpciA9PSBMYXlvdXQuRElSX1JJR0hUX1RPX0xFRlQpID09IHJ1bklzUnRsOworICAgICAgICAgICAgICAgICAgICBpZiAoaW5TZWdtZW50ICYmIGFkdmFuY2UpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBoICs9IG1lYXN1cmVSdW4oaSwgc2Vnc3RhcnQsIG9mZnNldCwgaiwgcnVuSXNSdGwsIGZtaSk7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICBmbG9hdCB3ID0gbWVhc3VyZVJ1bihpLCBzZWdzdGFydCwgaiwgaiwgcnVuSXNSdGwsIGZtaSk7CisgICAgICAgICAgICAgICAgICAgIGggKz0gYWR2YW5jZSA/IHcgOiAtdzsKKworICAgICAgICAgICAgICAgICAgICBpZiAoaW5TZWdtZW50KSB7CisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaCArPSBtZWFzdXJlUnVuKGksIHNlZ3N0YXJ0LCBvZmZzZXQsIGosIHJ1bklzUnRsLCBudWxsKTsKKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIGlmIChjb2RlcHQgPT0gJ1x0JykgeworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG9mZnNldCA9PSBqKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGg7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBoID0gbURpciAqIG5leHRUYWIoaCAqIG1EaXIpOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRhcmdldCA9PSBqKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGg7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICBpZiAoYm0gIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgYm1Bc2NlbnQgPSBhc2NlbnQoaik7CisgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB3aWQgPSBibS5nZXRXaWR0aCgpICogLWJtQXNjZW50IC8gYm0uZ2V0SGVpZ2h0KCk7CisgICAgICAgICAgICAgICAgICAgICAgICBoICs9IG1EaXIgKiB3aWQ7CisgICAgICAgICAgICAgICAgICAgICAgICBqKys7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICBzZWdzdGFydCA9IGogKyAxOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiBoOworICAgIH0KKworICAgIC8qKgorICAgICAqIERyYXdzIGEgdW5pZGlyZWN0aW9uYWwgKGJ1dCBwb3NzaWJseSBtdWx0aS1zdHlsZWQpIHJ1biBvZiB0ZXh0LgorICAgICAqCisgICAgICogQHBhcmFtIGMgdGhlIGNhbnZhcyB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luZGV4ID0gLTI7CisgICAgICAgIH0gZWxzZSBpZiAoY3Vyc29yID09IGxpbmVFbmQpIHsKKyAgICAgICAgICAgIHJ1bkluZGV4ID0gcnVucy5sZW5ndGg7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgLy8gRmlyc3QsIGdldCBpbmZvcm1hdGlvbiBhYm91dCB0aGUgcnVuIGNvbnRhaW5pbmcgdGhlIGNoYXJhY3RlciB3aXRoCisgICAgICAgICAgLy8gdGhlIGFjdGl2ZSBjYXJldC4KKyAgICAgICAgICBmb3IgKHJ1bkluZGV4ID0gMDsgcnVuSW5kZXggPCBydW5zLmxlbmd0aDsgcnVuSW5kZXggKz0gMikgeworICAgICAgICAgICAgcnVuU3RhcnQgPSBsaW5lU3RhcnQgKyBydW5zW3J1bkluZGV4XTsKKyAgICAgICAgICAgIGlmIChjdXJzb3IgPj0gcnVuU3RhcnQpIHsKKyAgICAgICAgICAgICAgcnVuTGltaXQgPSBydW5TdGFydCArIChydW5zW3J1bkluZGV4KzFdICYgTGF5b3V0LlJVTl9MRU5HVEhfTUFTSyk7CisgICAgICAgICAgICAgIGlmIChydW5MaW1pdCA+IGxpbmVFbmQpIHsKKyAgICAgICAgICAgICAgICAgIHJ1bkxpbWl0ID0gbGluZUVuZDsKKyAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICBpZiAoY3Vyc29yIDwgcnVuTGltaXQpIHsKKyAgICAgICAgICAgICAgICBydW5MZXZlbCA9IChydW5zW3J1bkluZGV4KzFdID4+PiBMYXlvdXQuUlVOX0xFVkVMX1NISUZUKSAmCisgICAgICAgICAgICAgICAgICAgIExheW91dC5SVU5fTEVWRUxfTUFTSzsKKyAgICAgICAgICAgICAgICBpZiAoY3Vyc29yID09IHJ1blN0YXJ0KSB7CisgICAgICAgICAgICAgICAgICAvLyBUaGUgY2FyZXQgaXMgb24gYSBydW4gYm91bmRhcnksIHNlZSBpZiB3ZSBzaG91bGQKKyAgICAgICAgICAgICAgICAgIC8vIHVzZSB0aGUgcG9zaXRpb24gb24gdGhlIHRyYWlsaW5nIGVkZ2Ugb2YgdGhlIHByZXZpb3VzCisgICAgICAgICAgICAgICAgICAvLyBsb2dpY2FsIGNoYXJhY3RlciBpbnN0ZWFkLgorICAgICAgICAgICAgICAgICAgaW50IHByZXZSdW5JbmRleCwgcHJldlJ1bkxldmVsLCBwcmV2UnVuU3RhcnQsIHByZXZSdW5MaW1pdDsKKyAgICAgICAgICAgICAgICAgIGludCBwb3MgPSBjdXJzb3IgLSAxOworICAgICAgICAgICAgICAgICAgZm9yIChwcmV2UnVuSW5kZXggPSAwOyBwcmV2UnVuSW5kZXggPCBydW5zLmxlbmd0aDsgcHJldlJ1bkluZGV4ICs9IDIpIHsKKyAgICAgICAgICAgICAgICAgICAgcHJldlJ1blN0YXJ0ID0gbGluZVN0YXJ0ICsgcnVuc1twcmV2UnVuSW5kZXhdOworICAgICAgICAgICAgICAgICAgICBpZiAocG9zID49IHByZXZSdW5TdGFydCkgeworICAgICAgICAgICAgICAgICAgICAgIHByZXZSdW5MaW1pdCA9IHByZXZSdW5TdGFydCArCisgICAgICAgICAgICAgICAgICAgICAgICAgIChydW5zW3ByZXZSdW5JbmRleCsxXSAmIExheW91dC5SVU5fTEVOR1RIX01BU0spOworICAgICAgICAgICAgICAgICAgICAgIGlmIChwcmV2UnVuTGltaXQgPiBsaW5lRW5kKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgIHByZXZSdW5MaW1pdCA9IGxpbmVFbmQ7CisgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgIGlmIChwb3MgPCBwcmV2UnVuTGltaXQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHByZXZSdW5MZXZlbCA9IChydW5zW3ByZXZSdW5JbmRleCsxXSA+Pj4gTGF5b3V0LlJVTl9MRVZFTF9TSElGVCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAmIExheW91dC5SVU5fTEVWRUxfTUFTSzsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChwcmV2UnVuTGV2ZWwgPCBydW5MZXZlbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBTdGFydCBmcm9tIGxvZ2ljYWxseSBwcmV2aW91cyBjaGFyYWN0ZXIuCisgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bkluZGV4ID0gcHJldlJ1bkluZGV4OworICAgICAgICAgICAgICAgICAgICAgICAgICBydW5MZXZlbCA9IHByZXZSdW5MZXZlbDsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgcnVuU3RhcnQgPSBwcmV2UnVuU3RhcnQ7CisgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bkxpbWl0ID0gcHJldlJ1bkxpbWl0OworICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFpbGluZyA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgIH0KKworICAgICAgICAgIC8vIGNhcmV0IG1pZ2h0IGJlID09IGxpbmVFbmQuICBUaGlzIGlzIGdlbmVyYWxseSBhIHNwYWNlIG9yIHBhcmFncmFwaAorICAgICAgICAgIC8vIHNlcGFyYXRvciBhbmQgaGFzIGFuIGFzc29jaWF0ZWQgcnVuLCBidXQgbWlnaHQgYmUgdGhlIGVuZCBvZgorICAgICAgICAgIC8vIHRleHQsIGluIHdoaWNoIGNhc2UgaXQgZG9lc24ndC4gIElmIHRoYXQgaGFwcGVucywgd2UgcmFuIG9mZiB0aGUKKyAgICAgICAgICAvLyBlbmQgb2YgdGhlIHJ1biBsaXN0LCBhbmQgcnVuSW5kZXggPT0gcnVucy5sZW5ndGguICBJbiB0aGlzIGNhc2UsCisgICAgICAgICAgLy8gd2UgYXJlIGF0IGEgcnVuIGJvdW5kYXJ5IHNvIHdlIHNraXAgdGhlIGJlbG93IHRlc3QuCisgICAgICAgICAgaWYgKHJ1bkluZGV4ICE9IHJ1bnMubGVuZ3RoKSB7CisgICAgICAgICAgICAgIGJvb2xlYW4gcnVuSXNSdGwgPSAocnVuTGV2ZWwgJiAweDEpICE9IDA7CisgICAgICAgICAgICAgIGJvb2xlYW4gYWR2YW5jZSA9IHRvTGVmdCA9PSBydW5Jc1J0bDsKKyAgICAgICAgICAgICAgaWYgKGN1cnNvciAhPSAoYWR2YW5jZSA/IHJ1bkxpbWl0IDogcnVuU3RhcnQpIHx8IGFkdmFuY2UgIT0gdHJhaWxpbmcpIHsKKyAgICAgICAgICAgICAgICAgIC8vIE1vdmluZyB3aXRoaW4gb3IgaW50byB0aGUgcnVuLCBzbyB3ZSBjYW4gbW92ZSBsb2dpY2FsbHkuCisgICAgICAgICAgICAgICAgICBuZXdDYXJldCA9IGdldE9mZnNldEJlZm9yZUFmdGVyKHJ1bkluZGV4LCBydW5TdGFydCwgcnVuTGltaXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bklzUnRsLCBjdXJzb3IsIGFkdmFuY2UpOworICAgICAgICAgICAgICAgICAgLy8gSWYgdGhlIG5ldyBwb3NpdGlvbiBpcyBpbnRlcm5hbCB0byB0aGUgcnVuLCB3ZSdyZSBhdCB0aGUgc3Ryb25nCisgICAgICAgICAgICAgICAgICAvLyBwb3NpdGlvbiBhbHJlYWR5IHNvIHdlJ3JlIGZpbmlzaGVkLgorICAgICAgICAgICAgICAgICAgaWYgKG5ld0NhcmV0ICE9IChhZHZhbmNlID8gcnVuTGltaXQgOiBydW5TdGFydCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3Q2FyZXQ7CisgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgIH0KKyAgICAgICAgICB9CisgICA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gICAgICBpbnQgb3RoZXJSdW5MZXZlbCA9IChydW5zW290aGVyUnVuSW5kZXgrMV0gPj4+IExheW91dC5SVU5fTEVWRUxfU0hJRlQpICYKKyAgICAgICAgICAgICAgICBMYXlvdXQuUlVOX0xFVkVMX01BU0s7CisgICAgICAgICAgICBib29sZWFuIG90aGVyUnVuSXNSdGwgPSAob3RoZXJSdW5MZXZlbCAmIDEpICE9IDA7CisKKyAgICAgICAgICAgIGFkdmFuY2UgPSB0b0xlZnQgPT0gb3RoZXJSdW5Jc1J0bDsKKyAgICAgICAgICAgIGlmIChuZXdDYXJldCA9PSAtMSkgeworICAgICAgICAgICAgICAgIG5ld0NhcmV0ID0gZ2V0T2Zmc2V0QmVmb3JlQWZ0ZXIob3RoZXJSdW5JbmRleCwgb3RoZXJSdW5TdGFydCwKKyAgICAgICAgICAgICAgICAgICAgICAgIG90aGVyUnVuTGltaXQsIG90aGVyUnVuSXNSdGwsCisgICAgICAgICAgICAgICAgICAgICAgICBhZHZhbmNlID8gb3RoZXJSdW5TdGFydCA6IG90aGVyUnVuTGltaXQsIGFkdmFuY2UpOworICAgICAgICAgICAgICAgIGlmIChuZXdDYXJldCA9PSAoYWR2YW5jZSA/IG90aGVyUnVuTGltaXQgOiBvdGhlclJ1blN0YXJ0KSkgeworICAgICAgICAgICAgICAgICAgICAvLyBDcm9zc2VkIGFuZCBlbmRlZCB1cCBhdCBhIG5ldyBib3VuZGFyeSwKKyAgICAgICAgICAgICAgICAgICAgLy8gcmVwZWF0IGEgc2Vjb25kIGFuZCBmaW5hbCB0aW1lLgorICAgICAgICAgICAgICAgICAgICBydW5JbmRleCA9IG90aGVyUnVuSW5kZXg7CisgICAgICAgICAgICAgICAgICAgIHJ1bkxldmVsID0gb3RoZXJSdW5MZXZlbDsKKyAgICAgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvLy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ByZXR1cm4gYWNjdXJhdGUgdmFsdWVzLiAgVGhlc2UgYXJlIGEgZ3Vlc3MuCisgICAgICAgICAgICBpZiAoYWZ0ZXIpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gVGV4dFV0aWxzLmdldE9mZnNldEFmdGVyKG1UZXh0LCBvZmZzZXQgKyBtU3RhcnQpIC0gbVN0YXJ0OworICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIFRleHRVdGlscy5nZXRPZmZzZXRCZWZvcmUobVRleHQsIG9mZnNldCArIG1TdGFydCkgLSBtU3RhcnQ7CisgICAgICAgIH0KKworICAgICAgICBUZXh0UGFpbnQgd3AgPSBtV29ya1BhaW50OworICAgICAgICB3cC5zZXQobVBhaW50KTsKKworICAgICAgICBpbnQgc3BhblN0YXJ0ID0gcnVuU3RhcnQ7CisgICAgICAgIGludCBzcGFuTGltaXQ7CisgICAgICAgIGlmIChtU3Bhbm5lZCA9PSBudWxsKSB7CisgICAgICAgICAgICBzcGFuTGltaXQgPSBydW5MaW1pdDsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGludCB0YXJnZXQgPSBhZnRlciA/IG9mZnNldCArIDEgOiBvZmZzZXQ7CisgICAgICAgICAgICBpbnQgbGltaXQgPSBtU3RhcnQgKyBydW5MaW1pdDsKKyAgICAgICAgICAgIHdoaWxlICh0cnVlKSB7CisgICAgICAgICAgICAgICAgc3BhbkxpbWl0ID0gbVNwYW5uZWQubmV4dFNwYW5UcmFuc2l0aW9uKG1TdGFydCArIHNwYW5TdGFydCwgbGltaXQsCisgICAgICAgICAgICAgICAgICAgICAgICBNZXRyaWNBZmZlY3RpbmdTcGFuLmNsYXNzKSAtIG1TdGFydDsKKyAgICAgICAgICAgICAgICBpZiAoc3BhbkxpbWl0ID49IHRhcmdldCkgeworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgc3BhblN0YXJ0ID0gc3BhbkxpbWl0OworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBNZXRyaWNBZmZlY3RpbmdTcGFuW10gc3BhbnMgPSBtU3Bhbm5lZC5nZXRTcGFucyhtU3RhcnQgKyBzcGFuU3RhcnQsCisgICAgICAgICAgICAgICAgICAgIG1TdGFydCArIHNwYW5MaW1pdCwgTWV0cmljQWZmZWN0aW5nU3Bhbi5jbGFzcyk7CisKKyAgICAgICAgICAgIGlmIChzcGFucy5sZW5ndGggPiAwKSB7CisgICAgICAgICAgICAgICAgUmVwbGFjZW1lbnRTcGFuIHJlcGxhY2VtZW50ID0gbnVsbDsKKyAgICAgICAgICAgICAgICBmb3IgKGludCBqID0gMDsgaiA8IHNwYW5zLmxlbmd0aDsgaisrKSB7CisgICAgICAgICAgICAgICAgICAgIE1ldHJpY0FmZmVjdGluZ1NwYW4gc3BhbiA9IHNwYW5zW2pdOworICAgICAgICAgICAgICAgICAgICBpZiAoc3BhbiBpbnN0YW5jZW9mIFJlcGxhY2VtZW50U3BhbikgeworICAgICAgICAgICAgICAgICAgICAgICAgcmVwbGFjZW1lbnQgPSAoUmVwbGFjZW1lbnRTcGFuKXNwYW47CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICBzcGFuLnVwZGF0ZU1lYXN1cmVTdGF0ZSh3cCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBpZiAocmVwbGFjZW1lbnQgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAvLyBJZiB3ZSBoYXZlIGEgcmVwbGFjZW1lbnQgc3Bhbiwgd2UncmUgbW92aW5nIGVpdGhlciB0bworICAgICAgICAgICAgICAgICAgICAvLyB0aGUgc3RhcnQgb3IgZW5kIG9mIHRoaXMgc3Bhbi4KKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFmdGVyID8gc3BhbkxpbWl0IDogc3BhblN0YXJ0OworICA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CAtIGNvbnRleHRTdGFydDsKKyAgICAgICAgaWYgKG5lZWRXaWR0aCB8fCAoYyAhPSBudWxsICYmICh3cC5iZ0NvbG9yICE9IDAgfHwgcnVuSXNSdGwpKSkgeworICAgICAgICAgICAgaW50IGZsYWdzID0gcnVuSXNSdGwgPyBQYWludC5ESVJFQ1RJT05fUlRMIDogUGFpbnQuRElSRUNUSU9OX0xUUjsKKyAgICAgICAgICAgIGlmIChtQ2hhcnNWYWxpZCkgeworICAgICAgICAgICAgICAgIHJldCA9IHdwLmdldFRleHRSdW5BZHZhbmNlcyhtQ2hhcnMsIHN0YXJ0LCBydW5MZW4sCisgICAgICAgICAgICAgICAgICAgICAgICBjb250ZXh0U3RhcnQsIGNvbnRleHRMZW4sIGZsYWdzLCBudWxsLCAwKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgaW50IGRlbHRhID0gbVN0YXJ0OworICAgICAgICAgICAgICAgIHJldCA9IHdwLmdldFRleHRSdW5BZHZhbmNlcyhtVGV4dCwgZGVsdGEgKyBzdGFydCwKKyAgICAgICAgICAgICAgICAgICAgICAgIGRlbHRhICsgZW5kLCBkZWx0YSArIGNvbnRleHRTdGFydCwgZGVsdGEgKyBjb250ZXh0RW5kLAorICAgICAgICAgICAgICAgICAgICAgICAgZmxhZ3MsIG51bGwsIDApOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgaWYgKGZtaSAhPSBudWxsKSB7CisgICAgICAgICAgICB3cC5nZXRGb250TWV0cmljc0ludChmbWkpOworICAgICAgICB9CisKKyAgICAgICAgaWYgKGMgIT0gbnVsbCkgeworICAgICAgICAgICAgaWYgKHJ1bklzUnRsKSB7CisgICAgICAgICAgICAgICAgeCAtPSByZXQ7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmICh3cC5iZ0NvbG9yICE9IDApIHsKKyAgICAgICAgICAgICAgICBpbnQgY29sb3IgPSB3cC5nZXRDb2xvcigpOworICAgICAgICAgICAgICAgIFBhaW50LlN0eWxlIHMgPSB3cC5nZXRTdHlsZSgpOworICAgICAgICAgICAgICAgIHdwLnNldENvbG9yKHdwLmJnQ29sb3IpOworICAgICAgICAgICAgICAgIHdwLnNldFN0eWxlKFBhaW50LlN0eWxlLkZJTEwpOworCisgICAgICAgICAgICAgICAgYy5kcmF3UmVjdCh4LCB0b3AsIHggKyByZXQsIGJvdHRvbSwgd3ApOworCisgICAgICAgICAgICAgICAgd3Auc2V0U3R5bGUocyk7CisgICAgICAgICAgICAgICAgd3Auc2V0Q29sb3IoY29sb3IpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBkcmF3VGV4dFJ1bihjLCB3cCwgc3RhcnQsIGVuZCwgY29udGV4dFN0YXJ0LCBjb250ZXh0RW5kLCBydW5Jc1J0bCwKKyAgICAgICAgICAgICAgICAgICAgeCwgeSArIHdwLmJhc2VsaW5lU2hpZnQpOworICAgICAgICB9CisKKyAgICAgICAgcmV0dXJuIHJ1bklzUnRsID8gLXJldCA6IHJldDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBVdGlsaXR5IGZ1bmN0aW9uIGZvciBtZWFzdXJpbmcgYW5kIHJlbmRlcmluZyBhIHJlcGxhY2VtZW50LgorICAgICAqCisgICAgICogQHBhcmFtIHJlcGxhY2VtZW50IHRoZSByZXBsYWNlbWVudAorICAgICAqIEBwYXJhbSB3cCB0aGUgd29yayBwYWludAorICAgICAqIEBwYXJhbSBydW5JbmRleCB0aGUgcnVuIGluZGV4CisgICAgICogQHBhcmFtIHN0YXJ0IHRoZSBzdGFydCBvZiB0aGUgcnVuCisgICAgICogQHBhcmFtIGxpbWl0IHRoZSBsaW1pdCBvZiB0aGUgcnVuCisgICAgICogQHBhcmFtIHJ1bklzUnRsIHRydWUgaWYgdGhlIHJ1biBpcyByaWdodC10by1sZWZ0CisgICAgICogQHBhcmFtIGMgdGhlIGNhbnZhcywgY2FuIGJlIG51bGwgaWYgbm90IHJlbmRlcmluZworICAgICA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oIHx8IChjICE9IG51bGwgJiYgcnVuSXNSdGwpKSB7CisgICAgICAgICAgICByZXQgPSByZXBsYWNlbWVudC5nZXRTaXplKHdwLCBtVGV4dCwgdGV4dFN0YXJ0LCB0ZXh0TGltaXQsIGZtaSk7CisgICAgICAgIH0KKworICAgICAgICBpZiAoYyAhPSBudWxsKSB7CisgICAgICAgICAgICBpZiAocnVuSXNSdGwpIHsKKyAgICAgICAgICAgICAgICB4IC09IHJldDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJlcGxhY2VtZW50LmRyYXcoYywgbVRleHQsIHRleHRTdGFydCwgdGV4dExpbWl0LAorICAgICAgICAgICAgICAgICAgICB4LCB0b3AsIHksIGJvdHRvbSwgd3ApOworICAgICAgICB9CisKKyAgICAgICAgcmV0dXJuIHJ1bklzUnRsID8gLXJldCA6IHJldDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBVdGlsaXR5IGZ1bmN0aW9uIGZvciBoYW5kbGluZyBhIHVuaWRpcmVjdGlvbmFsIHJ1bi4gIFRoZSBydW4gbXVzdCBub3QKKyAgICAgKiBjb250YWluIHRhYnMgb3IgZW1vamkgYnV0IGNhbiBjb250YWluIHN0eWxlcy4KKyAgICAgKgorICAgICAqIEBwYXJhbSBydW5JbmRleCB0aGUgcnVuIGluZGV4CisgICAgICogQHBhcmFtIHN0YXJ0IHRoZSBsaW5lLXJlbGF0aXZlIHN0YXJ0IG9mIHRoZSBydW4KKyAgICAgKiBAcGFyYW0gbWVhc3VyZUxpbWl0IHRoZSBvZmZzZXQgdG8gbWVhc3VyZSB0bywgYmV0d2VlbiBzdGFydCBhbmQgbGltaXQgaW5jbHVzaXZlCisgICAgICogQHBhcmFtIGxpbWl0IHRoZSBsaW1pdCBvZiB0aGUgcnVuCisgICAgICogQHBhcmFtIHJ1bklzUnRsIHRydWUgaWYgdGhlIHJ1biBpcyByaWdodC10by1sZWZ0CisgICAgICogQHBhcmFtIGMgdGhlIGNhbnZhcywgY2FuIG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SB0aHJvdWdoIG1ldHJpYyBydW5zIHRvIGdldCBtZXRyaWMgYm91bmRzLAorICAgICAgICAvLyB0aGVuIHdpdGhpbiBlYWNoIG1ldHJpYyBydW4gaXRlcmF0ZSB0aHJvdWdoIGNoYXJhY3RlciBzdHlsZSBydW5zCisgICAgICAgIC8vIGZvciB0aGUgcnVuIGJvdW5kcy4KKyAgICAgICAgZmxvYXQgb3ggPSB4OworICAgICAgICBmb3IgKGludCBpID0gc3RhcnQsIGluZXh0OyBpIDwgbWVhc3VyZUxpbWl0OyBpID0gaW5leHQpIHsKKyAgICAgICAgICAgIFRleHRQYWludCB3cCA9IG1Xb3JrUGFpbnQ7CisgICAgICAgICAgICB3cC5zZXQobVBhaW50KTsKKworICAgICAgICAgICAgaW50IG1saW1pdDsKKyAgICAgICAgICAgIGlmIChtU3Bhbm5lZCA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgaW5leHQgPSBsaW1pdDsKKyAgICAgICAgICAgICAgICBtbGltaXQgPSBtZWFzdXJlTGltaXQ7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGluZXh0ID0gbVNwYW5uZWQubmV4dFNwYW5UcmFuc2l0aW9uKG1TdGFydCArIGksIG1TdGFydCArIGxpbWl0LAorICAgICAgICAgICAgICAgICAgICAgICAgTWV0cmljQWZmZWN0aW5nU3Bhbi5jbGFzcykgLSBtU3RhcnQ7CisKKyAgICAgICAgICAgICAgICBtbGltaXQgPSBpbmV4dCA8IG1lYXN1cmVMaW1pdCA/IGluZXh0IDogbWVhc3VyZUxpbWl0OworICAgICAgICAgICAgICAgIE1ldHJpY0FmZmVjdGluZ1NwYW5bXSBzcGFucyA9IG1TcGFubmVkLmdldFNwYW5zKG1TdGFydCArIGksCisgICAgICAgICAgICAgICAgICAgICAgICBtU3RhcnQgKyBtbGltaXQsIE1ldHJpY0FmZmVjdGluZ1NwYW4uY2xhc3MpOworCisgICAgICAgICAgICAgICAgaWYgKHNwYW5zLmxlbmd0aCA+IDApIHsKKyAgICAgICAgICAgICAgICAgICAgUmVwbGFjZW1lbnRTcGFuIHJlcGxhY2VtZW50ID0gbnVsbDsKKyAgICAgICAgICAgICAgICAgICAgZm9yIChpbnQgaiA9IDA7IGogPCBzcGFucy5sZW5ndGg7IGorKykgeworICAgICAgICAgICAgICAgICAgICAgICAgTWV0cmljQWZmZWN0aW5nU3BhbiBzcGFuID0gc3BhbnNbal07CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoc3BhbiBpbnN0YW5jZW9mIFJlcGxhY2VtZW50U3BhbikgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcGxhY2VtZW50ID0gKFJlcGxhY2VtZW50U3BhbilzcGFuOworICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBXZSBtaWdodCBoYXZlIGEgcmVwbGFjZW1lbnQgdGhhdCB1c2VzIHRoZSBkcmF3CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gc3RhdGUsIG90aGVyd2lzZSBtZWFzdXJlIHN0YXRlIHdvdWxkIHN1ZmZpY2UuCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3Bhbi51cGRhdGVEcmF3U3RhdGUod3ApOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgaWYgKHJlcGxhY2VtZW50ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHggKz0gaGFuZGxlUmVwbGFjZW1lbnQocmVwbGFjZW1lbnQsIHdwLCBydW5JbmRleCwgaSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWxpbWl0LCBydW5Jc1J0bCwgYywgeCwgdG9wLCB5LCBib3R0b20sIGZtaSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmVlZFdpZHRoIHx8IG1saW1pdCA8IG1lYXN1cmVMaW1pdCk7CisgICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKG1TcGFubmVkID09IG51bGwgfHwgYyA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgeCArPSBoYW5kbGVUZXh0KHdwLCBpLCBtbGltaXQsIGksIGluZXh0LCBydW5Jc1J0bCwgYywgeCwgdG9wLAorICAgICAgICAgICAgICAgICAgICAgICAgeSwgYm90dG9tLCBmbWksIG5lZWRXaWR0aCB8fCBtbGltaXQgPCBtZWFzdXJlTGltaXQpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBmb3IgKGludCBqID0gaSwgam5leHQ7IGogPCBtbGltaXQ7IGogPSBqbmV4dCkgeworICAgICAgICAgICAgICAgICAgICBqbmV4dCA9IG1TcGFubmVkLm5leHRTcGFuVHJhbnNpdGlvbihtU3RhcnQgKyBqLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1TdGFydCArIG1saW1pdCwgQ2hhcmFjdGVyU3R5bGUuY2xhc3MpIC0gbVN0YXJ0OworCisgICAgICAgICAgICAgICAgICAgIENoYXJhY3RlclN0eWxlW10gc3BhbnMgPSBtU3Bhbm5lZC5nZXRTcGFucyhtU3RhcnQgKyBqLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1TdGFydCArIGpuZXh0LCBDaGFyYWN0ZXJTdHlsZS5jbGFzcyk7CisKKyAgICAgICAgICAgICAgICAgICAgd3Auc2V0KG1QYWludCk7CisgICAgICAgICAgICAgICAgICAgIGZvciAoaW50IGsgPSAwOyBrIDwgc3BhbnMubGVuZ3RoOyBrKyspIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIENoYXJhY3RlclN0eWxlIHNwYW4gPSBzcGFuc1trXTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHNwYW4udXBkYXRlRHJhd1N0YXRlKHdwKTsKKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIHggKz0gaGFuZGxlVGV4dCh3cCwgaiwgam5leHQsIGksIGluZXh0LCBydW5Jc1J0bCwgYywgeCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b3AsIHksIGJvdHRvbSwgZm1pLCBuZWVkV2lkdGggfHwgam5leHQgPCBtZWFzdXJlTGltaXQpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiB4IC0gb3g7CisgICAgfQorCisgICAgLyoqCisgICAgICogUmVuZGVyIGEgdGV4dCBydW4gd2l0aCB0aGUgc2V0LXVwIHBhaW50LgorICAgICAqCisgICAgICogQHBhcmFtIGMgdGhlIGNhbnZhcworICAgICAqIEBwYXJhbSB3cCB0aGUgcGFpbnQgdXNlZCB0byByZW5kZXIgdGhlIHRleHQKKyAgICAgKiBAcGFyYW0gc3RhcnQgdGhlIHN0YXJ0IG9mIHRoZSBydW4KKyAgICAgKiBAcGFyYW0gZW5kIHRoZSBlbmQgb2YgdGhlIHJ1bgorICAgICAqIEBwYXJhbSBjb250ZXh0U3RhcnQgdGhlIHN0YXJ0IG9mIGNvbnRleHQgZm9yIHRoZSBydW4KKyAgICAgKiBAcGFyYW0gY29udGV4dEVuZCB0aGUgZW5kIG9mIHRoZSBjb250ZXh0IGZvciB0aGUgcnVuCisgICAgICogQHBhcmFtIHJ1bklzUnRsIHRydWUgaWYgdGhlIHJ1biBpcyByaWdodC10by1sZWZ0CisgICAgICogQHBhcmFtIHggdGhlIHggcG9zaXRpb24gb2YgdGhlIGxlZnQgZWRnZSBvZiB0aGUgcnVuCisgICAgICogQHBhcmFtIHkgdGhlIGJhc2VsaW5lIG9mIHRoZSBydW4KKyAgICAgKi8KKyAgICBwcml2YXRlIHZvaWQgZHJhd1RleHRSdW4oQ2FudmFzIGMsIFRleHRQYWludCB3cCwgaW50IHN0YXJ0LCBpbnQgZW5kLAorICAgICAgICAgICAgaW50IGNvbnRleHRTdGFydCwgaW50IGNvbnRleHRFbmQsIGJvb2xlYW4gcnVuSXNSdGwsIGZsb2F0IHgsIGludCB5KSB7CisKKyAgICAgICAgaW50IGZsYWdzID0gcnVuSXNSdGwgPyBDYW52YXMuRElSRUNUSU9OX1JUTCA6IENhbnZhcy5ESVJFQ1RJT05fTFRSOworICAgICAgICBpZiAobUNoYXJzVmFsaWQpIHsKKyAgICAgICAgICAgIGludCBjb3VudCA9IGVuZCAtIHN0YXJ0OworICAgICAgICAgICAgaW50IGNvbnRleHRDb3VudCA9IGNvbnRleHRFbmQgLSBjb250ZXh0U3RhcnQ7CisgICAgICAgICAgICBjLmRyYXdUZXh0UnVuKG1DaGFycywgc3RhcnQsIGNvdW50LCBjb250ZXh0U3RhcnQsIGNvbnRleHRDb3VudCwKKyAgICAgICAgICAgICAgICAgICAgeCwgeSwgZmxhZ3MsIHdwKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGludCBkZWx0YSA9IG1TdGFydDsKKyAgICAgICAgICAgIGMuZHJhd1RleHRSdW4obVRleHQsIGRlbHRhICsgc3RhcnQsIGRlbHRhICsgZW5kLAorICAgICAgICAgICAgICAgICAgICBkZWx0YSArIGNvbnRleHRTdGFydCwgZGVsdGEgKyBjb250ZXh0RW5kLCB4LCB5LCBmbGFncywgd3ApOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogUmV0dXJucyB0aGUgYXNjZW50IG9mIHRoZSB0ZXh0IGF0IHN0YXJ0LiAgVGhpcyBpcyB1c2VkIGZvciBzY2FsaW5nCisgICAgICogZW1vamkuCisgICAgICoKKyAgICAgKiBAcGFyYW0gcG9zIHRoZSBsaW5lLXJlbGF0aXZlIHBvc2l0aW9uCisgICAgICogQHJldHVybiB0aGUgYXNjZW50IG9mIHRoZSB0ZXh0IGF0IHN0YXJ0CisgICAgICovCisgICAgZmxvYXQgYXNjZW50KGludCBwb3MpIHsKKyAgICAgICAgaWYgKG1TcGFubmVkID09IG51bGwpIHsKKyAgICAgICAgICAgIHJldHVybiBtUGFpbnQuYXNjZW50KCk7CisgICAgICAgIH0KKworICAgICAgICBwb3MgKz0gbVN0YXJ0OworICAgICAgICBNZXRyaWNBZmZlY3RpbmdTcGFuW10gc3BhbnMgPSBtU3Bhbm5lZC5nZXRTcGFucyhwb3MsIHBvcyArIDEsCisgICAgICAgICAgICAgICAgTWV0cmljQWZmZWN0aW5nU3Bhbi5jbGFzcyk7CisgICAgICAgIGlmIChzcGFucy5sZW5ndGggPT0gMCkgeworICAgICAgICAgICAgcmV0dXJuIG1QYWludC5hc2NlbnQoKTsKKyAgICAgICAgfQorCisgICAgICAgIFRleHRQYWludCB3cCA9IG1Xb3JrUGFpbnQ7CisgICAgICAgIHdwLnNldChtUGFpbnQpOworICAgICAgICBmb3IgKE1ldHJpY0FmZmVjdGluZ1NwYW4gc3BhbiA6IHNwYW5zKSB7CisgICAgICAgICAgICBzcGFuLnVwZGF0ZU1lYXN1cmVTdGF0ZSh3cCk7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHdwLmFzY2VudCgpOworICAgIH0KKworICAgIC8qKgorICAgICAqIFJldHVybnMgdGhlIG5leHQgdGFiIHBvc2l0aW9uLgorICAgICAqCisgICAgICogQHBhcmFtIGggdGhlICh1bnNpZ25lZCkgb2Zmc2V0IGZyb20gdGhlIGxlYWRpbmcgbWFyZ2luCisgICAgICogQHJldHVybiB0aGUgKHVuc2lnbmVkKSB0YWIgcG9zaXRpb24gYWZ0ZXIgdGhpcyBvZmZzZXQKKyAgICAgKi8KKyAgICBmbG9hdCBuZXh0VGFiKGZsb2F0IGgpIHsKKyAgICAgICAgaWYgKG1UYWJzICE9IG51bGwpIHsKKyAgICAgICAgICAgIHJldHVybiBtVGFicy5uZXh0VGFiKGgpOworICAgICAgICB9CisgICAgICAgIHJldHVybiBUYWJTdG9wcy5uZXh0RGVmYXVsdFN0b3AoaCwgVEFCX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ICAgcHVibGljIHN0YXRpYyBDaGFyU2VxdWVuY2UgZWxsaXBzaXplKENoYXJTZXF1ZW5jZSB0ZXh0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUZXh0UGFpbnQgcCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGV4dFBhaW50IHBhaW50LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCBhdmFpbCwgVHJ1bmNhdGVBdCB3aGVyZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbGVhbiBwcmVzZXJ2ZUxlbmd0aCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRWxsaXBzaXplQ2FsbGJhY2sgY2FsbGJhY2spIHsKQEAgLTEwMDMsMTMgKzEwMDAsMTIgQEAKIAogICAgICAgICBpbnQgbGVuID0gdGV4dC5sZW5ndGgoKTsKIAotICAgICAgICAvLyBVc2UgUGFpbnQuYnJlYWtUZXh0KCkgZm9yIHRoZSBub24tU3Bhbm5lZCBjYXNlIHRvIGF2b2lkIGhhdmluZwotICAgICAgICAvLyB0byBhbGxvY2F0ZSBtZW1vcnkgYW5kIGFjY3VtdWxhdGUgdGhlIGNoYXJhY3RlciB3aWR0aHMgb3Vyc2VsdmVzLgorICAgICAgICBNZWFzdXJlZFRleHQgbXQgPSBNZWFzdXJlZFRleHQub2J0YWluKCk7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBmbG9hdCB3aWR0aCA9IHNldFBhcmEobXQsIHBhaW50LCB0ZXh0LCAwLCB0ZXh0Lmxlbmd0aCgpLAorICAgICAgICAgICAgICAgICAgICBMYXlvdXQuRElSX1JFUVVFU1RfREVGQVVMVF9MVFIpOwogCi0gICAgICAgIGlmICghKHRleHQgaW5zdGFuY2VvZiBTcGFubmVkKSkgewotICAgICAgICAgICAgZmxvYXQgd2lkID0gcC5tZWFzdXJlVGV4dCh0ZXh0LCAwLCBsZW4pOwotCi0gICAgICAgICAgICBpZiAod2lkIDw9IGF2YWlsKSB7CisgICAgICAgICAgICBpZiAod2lkdGggPD0gYXZhaWwpIHsKICAgICAgICAgICAgICAgICBpZiAoY2FsbGJhY2sgIT0gbnVsbCkgewogICAgICAgICAgICAgICAgICAgICBjYWxsYmFjay5lbGxpcHNpemVkKDAsIDApOwogICAgICAgICAgICAgICAgIH0KQEAgLTEwMTcsMjUwICsxMDEzLDY5IEBACiAgICAgICAgICAgICAgICAgcmV0dXJuIHRleHQ7CiAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgIGZsb2F0IGVsbGlwc2lzd2lkID0gcC5tZWFzdXJlVGV4dChzRWxsaXBzaXMpOworICAgICAgICAgICAgLy8gWFhYIGFzc3VtZXMgZWxsaXBzaXMgc3RyaW5nIGRvZXMgbm90IHJlcXVpcmUgc2hhcGluZyBhbmQKKyAgICAgICAgICAgIC8vIGlzIHVuYWZmZWN0ZWQgYnkgc3R5bGUKKyAgICAgICAgICAgIGZsb2F0IGVsbGlwc2lzd2lkID0gcGFpbnQubWVhc3VyZVRleHQoc0VsbGlwc2lzKTsKKyAgICAgICAgICAgIGF2YWlsIC09IGVsbGlwc2lzd2lkOwogCi0gICAgICAgICAgICBpZiAoZWxsaXBzaXN3aWQgPiBhdmFpbCkgewotICAgICAgICAgICAgICAgIGlmIChjYWxsYmFjayAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIGNhbGxiYWNrLmVsbGlwc2l6ZWQoMCwgbGVuKTsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBpZiAocHJlc2VydmVMZW5ndGgpIHsKLSAgICAgICAgICAgICAgICAgICAgY2hhcltdIGJ1ZiA9IG9idGFpbihsZW4pOwotICAgICAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGxlbjsgaSsrKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBidWZbaV0gPSAnXHVGRUZGJzsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBTdHJpbmcgcmV0ID0gbmV3IFN0cmluZyhidWYsIDAsIGxlbik7Ci0gICAgICAgICAgICAgICAgICAgIHJlY3ljbGUoYnVmKTsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJldDsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICByZXR1cm4gIiI7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBpZiAod2hlcmUgPT0gVHJ1bmNhdGVBdC5TVEFSVCkgewotICAgICAgICAgICAgICAgIGludCBmaXQgPSBwLmJyZWFrVGV4dCh0ZXh0LCAwLCBsZW4sIGZhbHNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdmFpbCAtIGVsbGlwc2lzd2lkLCBudWxsKTsKLQotICAgICAgICAgICAgICAgIGlmIChjYWxsYmFjayAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIGNhbGxiYWNrLmVsbGlwc2l6ZWQoMCwgbGVuIC0gZml0KTsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBpZiAocHJlc2VydmVMZW5ndGgpIHsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGJsYW5rKHRleHQsIDAsIGxlbiAtIGZpdCk7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHNFbGxpcHNpcyArIHRleHQudG9TdHJpbmcoKS5zdWJzdHJpbmcobGVuIC0gZml0LCBsZW4pOwotICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGludCBsZWZ0ID0gMDsKKyAgICAgICAgICAgIGludCByaWdodCA9IGxlbjsKKyAgICAgICAgICAgIGlmIChhdmFpbCA8IDApIHsKKyAgICAgICAgICAgICAgICAvLyBpdCBhbGwgZ29lcworICAgICAgICAgICAgfSBlbHNlIGlmICh3aGVyZSA9PSBUcnVuY2F0ZUF0LlNUQVJUKSB7CisgICAgICAgICAgICAgICAgcmlnaHQgPSBsZW4gLSBtdC5icmVha1RleHQoMCwgbGVuLCBmYWxzZSwgYXZhaWwpOwogICAgICAgICAgICAgfSBlbHNlIGlmICh3aGVyZSA9PSBUcnVuY2F0ZUF0LkVORCkgewotICAgICAgICAgICAgICAgIGludCBmaXQgPSBwLmJyZWFrVGV4dCh0ZXh0LCAwLCBsZW4sIHRydWUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGF2YWlsIC0gZWxsaXBzaXN3aWQsIG51bGwpOwotCi0gICAgICAgICAgICAgICAgaWYgKGNhbGxiYWNrICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgY2FsbGJhY2suZWxsaXBzaXplZChmaXQsIGxlbik7Ci0gICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgaWYgKHByZXNlcnZlTGVuZ3RoKSB7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiBibGFuayh0ZXh0LCBmaXQsIGxlbik7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRleHQudG9TdHJpbmcoKS5zdWJzdHJpbmcoMCwgZml0KSArIHNFbGxpcHNpczsKLSAgICAgICAgICAgICAgICB9IAotICAgICAgICAgICAgfSBlbHNlIC8qIHdoZXJlID09IFRydW5jYXRlQXQuTUlERExFICovIHsKLSAgICAgICAgICAgICAgICBpbnQgcmlnaHQgPSBwLmJyZWFrVGV4dCh0ZXh0LCAwLCBsZW4sIGZhbHNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChhdmFpbCAtIGVsbGlwc2lzd2lkKSAvIDIsIG51bGwpOwotICAgICAgICAgICAgICAgIGZsb2F0IHVzZWQgPSBwLm1lYXN1cmVUZXh0KHRleHQsIGxlbiAtIHJpZ2h0LCBsZW4pOwotICAgICAgICAgICAgICAgIGludCBsZWZ0ID0gcC5icmVha1RleHQodGV4dCwgMCwgbGVuIC0gcmlnaHQsIHRydWUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhdmFpbCAtIGVsbGlwc2lzd2lkIC0gdXNlZCwgbnVsbCk7Ci0KLSAgICAgICAgICAgICAgICBpZiAoY2FsbGJhY2sgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICBjYWxsYmFjay5lbGxpcHNpemVkKGxlZnQsIGxlbiAtIHJpZ2h0KTsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBpZiAocHJlc2VydmVMZW5ndGgpIHsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGJsYW5rKHRleHQsIGxlZnQsIGxlbiAtIHJpZ2h0KTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBTdHJpbmcgcyA9IHRleHQudG9TdHJpbmcoKTsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHMuc3Vic3RyaW5nKDAsIGxlZnQpICsgc0VsbGlwc2lzICsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgIHMuc3Vic3RyaW5nKGxlbiAtIHJpZ2h0LCBsZW4pOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIC8vIEJ1dCBkbyB0aGUgU3Bhbm5lZCBjYXNlcyBieSBoYW5kLCBiZWNhdXNlIGl0J3Mgc3VjaCBhIHBhaW4KLSAgICAgICAgLy8gdG8gaXRlcmF0ZSB0aGUgc3BhbiB0cmFuc2l0aW9ucyBiYWNrd2FyZHMgYW5kIGdldFRleHRXaWR0aHMoKQotICAgICAgICAvLyB3aWxsIGdpdmUgdXMgdGhlIGluZm9ybWF0aW9uIHdlIG5lZWQuCi0KLSAgICAgICAgLy8gZ2V0VGV4dF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LQotICAgICAgICAgICAgcmV0dXJuIHRleHQ7Ci0gICAgICAgIH0KLQotICAgICAgICBmbG9hdCBlbGxpcHNpc3dpZCA9IHAubWVhc3VyZVRleHQoc0VsbGlwc2lzKTsKLQotICAgICAgICBpZiAoZWxsaXBzaXN3aWQgPiBhdmFpbCkgewotICAgICAgICAgICAgaWYgKGNhbGxiYWNrICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICBjYWxsYmFjay5lbGxpcHNpemVkKDAsIGxlbik7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGlmIChwcmVzZXJ2ZUxlbmd0aCkgewotICAgICAgICAgICAgICAgIGNoYXJbXSBidWYgPSBvYnRhaW4obGVuKTsKLSAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGxlbjsgaSsrKSB7Ci0gICAgICAgICAgICAgICAgICAgIGJ1ZltpXSA9ICdcdUZFRkYnOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBTcGFubmFibGVTdHJpbmcgc3MgPSBuZXcgU3Bhbm5hYmxlU3RyaW5nKG5ldyBTdHJpbmcoYnVmLCAwLCBsZW4pKTsKLSAgICAgICAgICAgICAgICByZWN5Y2xlKGJ1Zik7Ci0gICAgICAgICAgICAgICAgY29weVNwYW5zRnJvbShzcCwgMCwgbGVuLCBPYmplY3QuY2xhc3MsIHNzLCAwKTsKLSAgICAgICAgICAgICAgICByZXR1cm4gc3M7CisgICAgICAgICAgICAgICAgbGVmdCA9IG10LmJyZWFrVGV4dCgwLCBsZW4sIHRydWUsIGF2YWlsKTsKICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuICIiOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgaWYgKHdoZXJlID09IFRydW5jYXRlQXQuU1RBUlQpIHsKLSAgICAgICAgICAgIHN1bSA9IDA7Ci0gICAgICAgICAgICBpbnQgaTsKLQotICAgICAgICAgICAgZm9yIChpID0gbGVuOyBpID49IDA7IGktLSkgewotICAgICAgICAgICAgICAgIGZsb2F0IHcgPSB3aWRbbGVuICsgaSAtIDFdOwotCi0gICAgICAgICAgICAgICAgaWYgKHcgKyBzdW0gKyBlbGxpcHNpc3dpZCA+IGF2YWlsKSB7Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgIHN1bSArPSB3OwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBpZiAoY2FsbGJhY2sgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIGNhbGxiYWNrLmVsbGlwc2l6ZWQoMCwgaSk7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGlmIChwcmVzZXJ2ZUxlbmd0aCkgewotICAgICAgICAgICAgICAgIFNwYW5uYWJsZVN0cmluZyBzcyA9IG5ldyBTcGFubmFibGVTdHJpbmcoYmxhbmsodGV4dCwgMCwgaSkpOwotICAgICAgICAgICAgICAgIGNvcHlTcGFuc0Zyb20oc3AsIDAsIGxlbiwgT2JqZWN0LmNsYXNzLCBzcywgMCk7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIHNzOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBTcGFubmFibGVTdHJpbmdCdWlsZGVyIG91dCA9IG5ldyBTcGFubmFibGVTdHJpbmdCdWlsZGVyKHNFbGxpcHNpcyk7Ci0gICAgICAgICAgICAgICAgb3V0Lmluc2VydCgxLCB0ZXh0LCBpLCBsZW4pOwotCi0gICAgICAgICAgICAgICAgcmV0dXJuIG91dDsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfSBlbHNlIGlmICh3aGVyZSA9PSBUcnVuY2F0ZUF0LkVORCkgewotICAgICAgICAgICAgc3VtID0gMDsKLSAgICAgICAgICAgIGludCBpOwotCi0gICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbGVuOyBpKyspIHsKLSAgICAgICAgICAgICAgICBmbG9hdCB3ID0gd2lkW2xlbiArIGldOwotCi0gICAgICAgICAgICAgICAgaWYgKHcgKyBzdW0gKyBlbGxpcHNpc3dpZCA+IGF2YWlsKSB7Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgIHN1bSArPSB3OwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBpZiAoY2FsbGJhY2sgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIGNhbGxiYWNrLmVsbGlwc2l6ZWQoaSwgbGVuKTsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgaWYgKHByZXNlcnZlTGVuZ3RoKSB7Ci0gICAgICAgICAgICAgICAgU3Bhbm5hYmxlU3RyaW5nIHNzID0gbmV3IFNwYW5uYWJsZVN0cmluZyhibGFuayh0ZXh0LCBpLCBsZW4pKTsKLSAgICAgICAgICAgICAgICBjb3B5U3BhbnNGcm9tKHNwLCAwLCBsZW4sIE9iamVjdC5jbGFzcywgc3MsIDApOwotICAgICAgICAgICAgICAgIHJldHVybiBzczsKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgU3Bhbm5hYmxlU3RyaW5nQnVpbGRlciBvdXQgPSBuZXcgU3Bhbm5hYmxlU3RyaW5nQnVpbGRlcihzRWxsaXBzaXMpOwotICAgICAgICAgICAgICAgIG91dC5pbnNlcnQoMCwgdGV4dCwgMCwgaSk7Ci0KLSAgICAgICAgICAgICAgICByZXR1cm4gb3V0OwotICAgICAgICAgICAgfQotICAgICAgICB9IGVsc2UgLyogd2hlcmUgPSBUcnVuY2F0ZUF0Lk1JRERMRSAqLyB7Ci0gICAgICAgICAgICBmbG9hdCBsc3VtID0gMCwgcnN1bSA9IDA7Ci0gICAgICAgICAgICBpbnQgbGVmdCA9IDAsIHJpZ2h0ID0gbGVuOwotCi0gICAgICAgICAgICBmbG9hdCByYXZhaWwgPSAoYXZhaWwgLSBlbGxpcHNpc3dpZCkgLyAyOwotICAgICAgICAgICAgZm9yIChyaWdodCA9IGxlbjsgcmlnaHQgPj0gMDsgcmlnaHQtLSkgewotICAgICAgICAgICAgICAgIGZsb2F0IHcgPSB3aWRbbGVuICsgcmlnaHQgLSAxXTsKLQotICAgICAgICAgICAgICAgIGlmICh3ICsgcnN1bSA+IHJhdmFpbCkgewotICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICByc3VtICs9IHc7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGZsb2F0IGxhdmFpbCA9IGF2YWlsIC0gZWxsaXBzaXN3aWQgLSByc3VtOwotICAgICAgICAgICAgZm9yIChsZWZ0ID0gMDsgbGVmdCA8IHJpZ2h0OyBsZWZ0KyspIHsKLSAgICAgICAgICAgICAgICBmbG9hdCB3ID0gd2lkW2xlbiArIGxlZnRdOwotCi0gICAgICAgICAgICAgICAgaWYgKHcgKyBsc3VtID4gbGF2YWlsKSB7Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgIGxzdW0gKz0gdzsKKyAgICAgICAgICAgICAgICByaWdodCA9IGxlbiAtIG10LmJyZWFrVGV4dCgwLCBsZW4sIGZhbHNlLCBhdmFpbCAvIDIpOworICAgICAgICAgICAgICAgIGF2YWlsIC09IG10Lm1lYXN1cmUocmlnaHQsIGxlbik7CisgICAgICAgICAgICAgICAgbGVmdCA9IG10LmJyZWFrVGV4dCgwLCByaWdodCwgdHJ1ZSwgYXZhaWwpOwogICAgICAgICAgICAgfQogCiAgICAgICAgICAgICBpZiAoY2FsbGJhY2sgIT0gbnVsbCkgewogICAgICAgICAgICAgICAgIGNhbGxiYWNrLmVsbGlwc2l6ZWQobGVmdCwgcmlnaHQpOwogICAgICAgICAgICAgfQogCisgICAgICAgICAgICBjaGFyW10gYnVmID0gbXQubUNoYXJzOworICAgICAgICAgICAgU3Bhbm5lZCBzcCA9IHRleHQgaW5zdGFuY2VvZiBTcGFubmVkID8gKFNwYW5uZWQpIHRleHQgOiBudWxsOworCisgICAgICAgICAgICBpbnQgcmVtYWluaW5nID0gbGVuIC0gKHJpZ2h0IC0gbGVmdCk7CiAgICAgICAgICAgICBpZiAocHJlc2VydmVMZW5ndGgpIHsKLSAgICAgICAgICAgICAgICBTcGFubmFibGVTdHJpbmcgc3MgPSBuZXcgU3Bhbm5hYmxlU3RyaW5nKGJsYW5rKHRleHQsIGxlZnQsIHJpZ2h0KSk7CisgICAgICAgICAgICAgICAgaWYgKHJlbWFpbmluZyA+IDApIHsgLy8gZWxzZSBlbGltaW5hdGUgdGhlIGVsbGlwc2lzIHRvbworICAgICAgICAgICAgICAgICAgICBidWZbbGVmdCsrXSA9ICdcdTIwMjYnOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gbGVmdDsgaSA8IHJpZ2h0OyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgYnVmW2ldID0gJ1x1RkVGRic7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIFN0cmluZyBzID0gbmV3IFN0cmluZyhidWYsIDAsIGxlbik7CisgICAgICAgICAgICAgICAgaWYgKHNwID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHM7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIFNwYW5uYWJsZVN0cmluZyBzcyA9IG5ldyBTcGFubmFibGVTdHJpbmcocyk7CiAgICAgICAgICAgICAgICAgY29weVNwYW5zRnJvbShzcCwgMCwgbGVuLCBPYmplY3QuY2xhc3MsIHNzLCAwKTsKICAgICAgICAgICAgICAgICByZXR1cm4gc3M7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIFNwYW5uYWJsZVN0cmluZ0J1aWxkZXIgb3V0ID0gbmV3IFNwYW5uYWJsZVN0cmluZ0J1aWxkZXIoc0VsbGlwc2lzKTsKLSAgICAgICAgICAgICAgICBvdXQuaW5zZXJ0KDAsIHRleHQsIDAsIGxlZnQpOwotICAgICAgICAgICAgICAgIG91dC5pbnNlcnQob3V0Lmxlbmd0aCgpLCB0ZXh0LCByaWdodCwgbGVuKTsKLQotICAgICAgICAgICAgICAgIHJldHVybiBvdXQ7CiAgICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICB9CiAKLSAgICBwcml2YXRlIHN0YXRpYyBTdHJpbmcgYmxhbmsoQ2hhclNlcXVlbmNlIHNvdXJjZSwgaW50IHN0YXJ0LCBpbnQgZW5kKSB7Ci0gICAgICAgIGludCBsZW4gPSBzb3VyY2UubGVuZ3RoKCk7Ci0gICAgICAgIGNoYXJbXSBidWYgPSBvYnRhaW4obGVuKTsKLQotICAgICAgICBpZiAoc3RhcnQgIT0gMCkgewotICAgICAgICAgICAgZ2V0Q2hhcnMoc291cmNlLCAwLCBzdGFydCwgYnVmLCAwKTsKLSAgICAgICAgfQotICAgICAgICBpZiAoZW5kICE9IGxlbikgewotICAgICAgICAgICAgZ2V0Q2hhcnMoc291cmNlLCBlbmQsIGxlbiwgYnVmLCBlbmQpOwotICAgICAgICB9Ci0KLSAgICAgICAgaWYgKHN0YXJ0ICE9IGVuZCkgewotICAgICAgICAgICAgYnVmW3N0YXJ0XSA9ICdcdTIwMjYnOwotCi0gICAgICAgICAgICBmb3IgKGludCBpID0gc3RhcnQgKyAxOyBpIDwgZW5kOyBpKyspIHsKLSAgICAgICAgICAgICAgICBidWZbaV0gPSAnXHVGRUZGJzsKKyAgICAgICAgICAgIGlmIChyZW1haW5pbmcgPT0gMCkgeworICAgICAgICAgICAgICAgIHJldHVybiAiIjsKICAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgIAotICAgICAgICBTdHJpbmcgcmV0ID0gbmV3IFN0cmluZyhidWYsIDAsIGxlbik7Ci0gICAgICAgIHJlY3ljbGUoYnVmKTsKIAotICAgICAgICByZXR1cm4gcmV0OworICAgICAgICAgICAgaWYgKHNwID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICBTdHJpbmdCdWlsZGVyIHNiID0gbmV3IFN0cmluZ0J1aWxkZXIocmVtYWluaW5nICsgc0VsbGlwc2lzLmxlbmd0aCgpKTsKKyAgICAgICAgICAgICAgICBzYi5hcHBlbmQoYnVmLCAwLCBsZWZ0KTsKKyAgICAgICAgICAgICAgICBzYi5hcHBlbmQoc0VsbGlwc2lzKTsKKyAgICAgICAgICAgICAgICBzYi5hcHBlbmQoYnVmLCByaWdodCwgbGVuIC0gcmlnaHQpOworICAgICAgICAgICAgICAgIHJldHVybiBzYi50b1N0cmluZygpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBTcGFubmFibGVTdHJpbmdCdWlsZGVyIHNzYiA9IG5ldyBTcGFubmFibGVTdHJpbmdCdWlsZGVyKCk7CisgICAgICAgICAgICBzc2IuYXBwZW5kKHRleHQsIDAsIGxlZnQpOworICAgICAgICAgICAgc3NiLmFwcGVuZChzRWxsaXBzaXMpOworICAgICAgICAgICAgc3NiLmFwcGVuZCh0ZXh0LCByaWdodCwgbGVuKTsKKyAgICAgICAgICAgIHJldHVybiBzc2I7CisgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICBNZWFzdXJlZFRleHQucmVjeWNsZShtdCk7CisgICAgICAgIH0KICAgICB9CiAKICAgICAvKioKQEAgLTEyNzgsODAgKzEwOTMsMTIxIEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGV4dFBhaW50IHAsIGZsb2F0IGF2YWlsLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFN0cmluZyBvbmVNb3JlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFN0cmluZyBtb3JlKSB7Ci0gICAgICAgIGludCBsZW4gPSB0ZXh0Lmxlbmd0aCgpOwotICAgICAgICBjaGFyW10gYnVmID0gbmV3IGNoYXJbbGVuXTsKLSAgICAgICAgVGV4dFV0aWxzLmdldENoYXJzKHRleHQsIDAsIGxlbiwgYnVmLCAwKTsKIAotICAgICAgICBpbnQgY29tbWFDb3VudCA9IDA7Ci0gICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbGVuOyBpKyspIHsKLSAgICAgICAgICAgIGlmIChidWZbaV0gPT0gJywnKSB7Ci0gICAgICAgICAgICAgICAgY29tbWFDb3VudCsrOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgZmxvYXRbXSB3aWQ7Ci0KLSAgICAgICAgaWYgKHRleHQgaW5zdGFuY2VvZiBTcGFubmVkKSB7Ci0gICAgICAgICAgICBTcGFubmVkIHNwID0gKFNwYW5uZWQpIHRleHQ7Ci0gICAgICAgICAgICBUZXh0UGFpbnQgdGVtcHBhaW50ID0gbmV3IFRleHRQYWludCgpOwotICAgICAgICAgICAgd2lkID0gbmV3IGZsb2F0W2xlbiAqIDJdOwotCi0gICAgICAgICAgICBpbnQgbmV4dDsKLSAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbGVuOyBpID0gbmV4dCkgewotICAgICAgICAgICAgICAgIG5leHQgPSBzcC5uZXh0U3BhblRyYW5zaXRpb24oaSwgbGVuLCBNZXRyaWNBZmZlY3RpbmdTcGFuLmNsYXNzKTsKLQotICAgICAgICAgICAgICAgIFN0eWxlZC5nZXRUZXh0V2lkdGhzKHAsIHRlbXBwYWludCwgc3AsIGksIG5leHQsIHdpZCwgbnVsbCk7Ci0gICAgICAgICAgICAgICAgU3lzdGVtLmFycmF5Y29weSh3aWQsIDAsIHdpZCwgbGVuICsgaSwgbmV4dCAtIGkpOworICAgICAgICBNZWFzdXJlZFRleHQgbXQgPSBNZWFzdXJlZFRleHQub2J0YWluKCk7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBpbnQgbGVuID0gdGV4dC5sZW5ndGgoKTsKKyAgICAgICAgICAgIGZsb2F0IHdpZHRoID0gc2V0UGFyYShtdCwgcCwgdGV4dCwgMCwgbGVuLCBMYXlvdXQuRElSX1JFUVVFU1RfREVGQVVMVF9MVFIpOworICAgICAgICAgICAgaWYgKHdpZHRoIDw9IGF2YWlsKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIHRleHQ7CiAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgIFN5c3RlbS5hcnJheWNvcHkod2lkLCBsZW4sIHdpZCwgMCwgbGVuKTsKLSAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgIHdpZCA9IG5ldyBmbG9hdFtsZW5dOwotICAgICAgICAgICAgcC5nZXRUZXh0V2lkdGhzKHRleHQsIDAsIGxlbiwgd2lkKTsKLSAgICAgICAgfQorICAgICAgICAgICAgY2hhcltdIGJ1ZiA9IG10Lm1DaGFyczsKIAotICAgICAgICBpbnQgb2sgPSAwOwotICAgICAgICBpbnQgb2tSZW1haW5pbmcgPSBjb21tYUNvdW50ICsgMTsKLSAgICAgICAgU3RyaW5nIG9rRm9ybWF0ID0gIiI7Ci0KLSAgICAgICAgaW50IHcgPSAwOwotICAgICAgICBpbnQgY291bnQgPSAwOwotCi0gICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbGVuOyBpKyspIHsKLSAgICAgICAgICAgIHcgKz0gd2lkW2ldOwotCi0gICAgICAgICAgICBpZiAoYnVmW2ldID09ICcsJykgewotICAgICAgICAgICAgICAgIGNvdW50Kys7Ci0KLSAgICAgICAgICAgICAgICBpbnQgcmVtYWluaW5nID0gY29tbWFDb3VudCAtIGNvdW50ICsgMTsKLSAgICAgICAgICAgICAgICBmbG9hdCBtb3JlV2lkOwotICAgICAgICAgICAgICAgIFN0cmluZyBmb3JtYXQ7Ci0KLSAgICAgICAgICAgICAgICBpZiAocmVtYWluaW5nID09IDEpIHsKLSAgICAgICAgICAgICAgICAgICAgZm9ybWF0ID0gIiAiICsgb25lTW9yZTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBmb3JtYXQgPSAiICIgKyBTdHJpbmcuZm9ybWF0KG1vcmUsIHJlbWFpbmluZyk7Ci0gICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgbW9yZVdpZCA9IHAubWVhc3VyZVRleHQoZm9ybWF0KTsKLQotICAgICAgICAgICAgICAgIGlmICh3ICsgbW9yZVdpZCA8PSBhdmFpbCkgewotICAgICAgICAgICAgICAgICAgICBvayA9IGkgKyAxOwotICAgICAgICAgICAgICAgICAgICBva1JlbWFpbmluZyA9IHJlbWFpbmluZzsKLSAgICAgICAgICAgICAgICAgICAgb2tGb3JtYXQgPSBmb3JtYXQ7CisgICAgICAgICAgICBpbnQgY29tbWFDb3VudCA9IDA7CisgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGxlbjsgaSsrKSB7CisgICAgICAgICAgICAgICAgaWYgKGJ1ZltpXSA9PSAnLCcpIHsKKyAgICAgICAgICAgICAgICAgICAgY29tbWFDb3VudCsrOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KLSAgICAgICAgfQogCi0gICAgICAgIGlmICh3IDw9IGF2YWlsKSB7Ci0gICAgICAgICAgICByZXR1cm4gdGV4dDsKLSAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGludCByZW1haW5pbmcgPSBjb21tYUNvdW50ICsgMTsKKworICAgICAgICAgICAgaW50IG9rID0gMDsKKyAgICAgICAgICAgIGludCBva1JlbWFpbmluZyA9IHJlbWFpbmluZzsKKyAgICAgICAgICAgIFN0cmluZyBva0Zvcm1hdCA9ICIiOworCisgICAgICAgICAgICBpbnQgdyA9IDA7CisgICAgICAgICAgICBpbnQgY291bnQgPSAwOworICAgICAgICAgICAgZmxvYXRbXSB3aWR0aHMgPSBtdC5tV2lkdGhzOworCisgICAgICAgICAgICBpbnQgcmVxdWVzdCA9IG10Lm1EaXIgPT0gMSA/IExheW91dC5ESVJfUkVRVUVTVF9MVFIgOgorICAgICAgICAgICAgICAgIExheW91dC5ESVJfUkVRVUVTVF9SVEw7CisKKyAgICAgICAgICAgIE1lYXN1cmVkVGV4dCB0ZW1wTXQgPSBNZWFzdXJlZFRleHQub2J0YWluKCk7CisgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGxlbjsgaSsrKSB7CisgICAgICAgICAgICAgICAgdyArPSB3aWR0aHNbaV07CisKKyAgICAgICAgICAgICAgICBpZiAoYnVmW2ldID09ICcsJykgeworICAgICAgICAgICAgICAgICAgICBjb3VudCsrOworCisgICAgICAgICAgICAgICAgICAgIFN0cmluZyBmb3JtYXQ7CisgICAgICAgICAgICAgICAgICAgIC8vIFhYWCBzaG91bGQgbm90IGluc2VydCBzcGFjZXMsIHNob3VsZCBiZSBwYXJ0IG9mIHN0cmluZworICAgICAgICAgICAgICAgICAgICAvLyBYWFggc2hvdWxkIHVzZSBwbHVyYWwgcnVsZXMgYW5kIG5vdCBhc3N1bWUgRW5nbGlzaCBwbHVyYWxzCisgICAgICAgICAgICAgICAgICAgIGlmICgtLXJlbWFpbmluZyA9PSAxKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBmb3JtYXQgPSAiICIgKyBvbmVNb3JlOworICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgZm9ybWF0ID0gIiAiICsgU3RyaW5nLmZvcm1hdChtb3JlLCByZW1haW5pbmcpOworICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgLy8gWFhYIHRoaXMgaXMgcHJvYmFibHkgb2ssIGJ1dCBuZWVkIHRvIGxvb2sgYXQgaXQgbW9yZQorICAgICAgICAgICAgICAgICAgICB0ZW1wTXQuc2V0UGFyYShmb3JtYXQsIDAsIGZvcm1hdC5sZW5ndGgoKSwgcmVxdWVzdCk7CisgICAgICAgICAgICAgICAgICAgIGZsb2F0IG1vcmVXaWQgPSBtdC5hZGRTdHlsZVJ1bihwLCBtdC5tTGVuLCBudWxsKTsKKworICAgICAgICAgICAgICAgICAgICBpZiAodyArIG1vcmVXaWQgPD0gYXZhaWwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG9rID0gaSArIDE7CisgICAgICAgICAgICAgICAgICAgICAgICBva1JlbWFpbmluZyA9IHJlbWFpbmluZzsKKyAgICAgICAgICAgICAgICAgICAgICAgIG9rRm9ybWF0ID0gZm9ybWF0OworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgTWVhc3VyZWRUZXh0LnJlY3ljbGUodGVtcE10KTsKKwogICAgICAgICAgICAgU3Bhbm5hYmxlU3RyaW5nQnVpbGRlciBvdXQgPSBuZXcgU3Bhbm5hYmxlU3RyaW5nQnVpbGRlcihva0Zvcm1hdCk7CiAgICAgICAgICAgICBvdXQuaW5zZXJ0KDAsIHRleHQsIDAsIG9rKTsKICAgICAgICAgICAgIHJldHVybiBvdXQ7CisgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICBNZWFzdXJlZFRleHQucmVjeWNsZShtdCk7CiAgICAgICAgIH0KICAgICB9CiAKKyAgICBwcml2YXRlIHN0YXRpYyBmbG9hdCBzZXRQYXJhKE1lYXN1cmVkVGV4dCBtdCwgVGV4dFBhaW50IHBhaW50LAorICAgICAgICAgICAgQ2hhclNlcXVlbmNlIHRleHQsIGludCBzdGFydCwgaW50IGVuZCwgaW50IGJpZGlSZXF1ZXN0KSB7CisKKyAgICAgICAgbXQuc2V0UGFyYSh0ZXh0LCBzdGFydCwgZW5kLCBiaWRpUmVxdWVzdCk7CisKKyAgICAgICAgZmxvYXQgd2lkdGg7CisgICAgICAgIFNwYW5uZWQgc3AgPSB0ZXh0IGluc3RhbmNlb2YgU3Bhbm5lZCA/IChTcGFubmVkKSB0ZXh0IDogbnVsbDsKKyAgICAgICAgaW50IGxlbiA9IGVuZCAtIHN0YXJ0OworICAgICAgICBpZiAoc3AgPT0gbnVsbCkgeworICAgICAgICAgICAgd2lkdGggPSBtdC5hZGRTdHlsZVJ1bihwYWludCwgbGVuLCBudWxsKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIHdpZHRoID0gMDsKKyAgICAgICAgICAgIGludCBzcGFuRW5kOworICAgICAgICAgICAgZm9yIChpbnQgc3BhblN0YXJ0ID0gMDsgc3BhblN0YXJ0IDwgbGVuOyBzcGFuU3RhcnQgPSBzcGFuRW5kKSB7CisgICAgICAgICAgICAgICAgc3BhbkVuZCA9IHNwLm5leHRTcGFuVHJhbnNpdGlvbihzcGFuU3RhcnQsIGxlbiwKKyAgICAgICAgICAgICAgICAgICAgICAgIE1ldHJpY0FmZmVjdGluZ1NwYW4uY2xhc3MpOworICAgICAgICAgICAgICAgIE1ldHJpY0FmZmVjdGluZ1NwYW5bXSBzcGFucyA9IHNwLmdldFNwYW5zKAorICAgICAgICAgICAgICAgICAgICAgICAgc3BhblN0YXJ0LCBzcGFuRW5kLCBNZXRyaWNBZmZlY3RpbmdTcGFuLmNsYXNzKTsKKyAgICAgICAgICAgICAgICB3aWR0aCArPSBtdC5hZGRTdHlsZVJ1bihwYWludCwgc3BhbnMsIHNwYW5FbmQgLSBzcGFuU3RhcnQsIG51bGwpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcmV0dXJuIHdpZHRoOworICAgIH0KKworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGNoYXIgRklSU1RfUklHSFRfVE9fTEVGVCA9ICdcdTA1OTAnOworCisgICAgLyogcGFja2FnZSAqLworICAgIHN0YXRpYyBib29sZWFuIGRvZXNOb3ROZWVkQmlkaShDaGFyU2VxdWVuY2UgcywgaW50IHN0YXJ0LCBpbnQgZW5kKSB7CisgICAgICAgIGZvciAoaW50IGkgPSBzdGFydDsgaSA8IGVuZDsgaSsrKSB7CisgICAgICAgICAgICBpZiAocy5jaGFyQXQoaSkgPj0gRklSU1RfUklHSFRfVE9fTEVGVCkgeworICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICB9CisKKyAgICAvKiBwYWNrYWdlICovCisgICAgc3RhdGljIGJvb2xlYW4gZG9lc05vdE5lZWRCaWRpKGNoYXJbXSB0ZXh0LCBpbnQgc3RhcnQsIGludCBsZW4pIHsKKyAgICAgICAgZm9yIChpbnQgaSA9IHN0YXJ0LCBlID0gaSArIGxlbjsgaSA8IGU7IGkrKykgeworICAgICAgICAgICAgaWYgKHRleHRbaV0gPj0gRklSU1RfUklHSFRfVE9fTEVGVCkgeworICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICB9CisKICAgICAvKiBwYWNrYWdlICovIHN0YXRpYyBjaGFyW10gb2J0YWluKGludCBsZW4pIHsKICAgICAgICAgY2hhcltdIGJ1ZjsKIApAQCAtMTUyOSw3ICsxMzg1LDcgQEAKICAgICAgKi8KICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBDQVBfTU9ERV9DSEFSQUNURVJTCiAgICAgICAgICAgICA9IElucHV0VHlwZS5UWVBFX1RFWFRfRkxBR19DQVBfQ0hBUkFDVEVSUzsKLSAgICAKKwogICAgIC8qKgogICAgICAqIENhcGl0YWxpemF0aW9uIG1vZGUgZm9yIHtAbGluayAjZ2V0Q2Fwc01vZGV9OiBjYXBpdGFsaXplIHRoZSBmaXJzdAogICAgICAqIGNoYXJhY3RlciBvZiBhbGwgd29yZHMuICBUaGlzIHZhbHVlIGlzIGV4cGxpY2l0bHkgZGVmaW5lZCB0byBiZSB0aGUgc2FtZSBhcwpAQCAtMTUzNyw3ICsxMzkzLDcgQEAKICAgICAgKi8KICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBDQVBfTU9ERV9XT1JEUwogICAgICAgICAgICAgPSBJbnB1dFR5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gICAgICAgIAorICAgICAgICBwdWJsaWMgYWJzdHJhY3Qgdm9pZCByZWNsYWltKCk7CisgICAgfQorCisgICAgLyoqCisgICAgICogUmV0dXJucyB0aGUgcXVldWUgdXNlZCB0byByZWNsYWltIFJlY2xhaW1hYmxlUmVmZXJlbmNlcy4KKyAgICAgKiAKKyAgICAgKiBAcmV0dXJuIEEgcmVmZXJlbmNlIHF1ZXVlIG9yIG51bGwgYmVmb3JlIGluaXRpYWxpemF0aW9uCisgICAgICovCisgICAgcHVibGljIHN0YXRpYyBSZWZlcmVuY2VRdWV1ZTxPYmplY3Q+IGdldFF1ZXVlKCkgeworICAgICAgICBzeW5jaHJvbml6ZWQgKHNMb2NrKSB7CisgICAgICAgICAgICBpZiAoIXNJbml0KSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoIXNSZWNsYWltZXIuaXNSdW5uaW5nKCkpIHsKKyAgICAgICAgICAgICAgICBzUmVjbGFpbWVyID0gbmV3IFJlY2xhaW1lcihzUmVjbGFpbWVyLm1RdWV1ZSk7CisgICAgICAgICAgICAgICAgc1JlY2xhaW1lci5zdGFydCgpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIHNSZWNsYWltZXIubVF1ZXVlOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogSW52b2tlZCBieSBaeWdvdGUuIERvbid0IHRvdWNoIQorICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgdm9pZCBpbml0KCkgeworICAgICAgICBzeW5jaHJvbml6ZWQgKHNMb2NrKSB7CisgICAgICAgICAgICBpZiAoIXNJbml0ICYmIHNSZWNsYWltZXIgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIHNSZWNsYWltZXIgPSBuZXcgUmVjbGFpbWVyKCk7CisgICAgICAgICAgICAgICAgc1JlY2xhaW1lci5zdGFydCgpOworICAgICAgICAgICAgICAgIHNJbml0ID0gdHJ1ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKyAgICAKKyAgICBwcml2YXRlIHN0YXRpYyBjbGFzcyBSZWNsYWltZXIgZXh0ZW5kcyBUaHJlYWQgeworICAgICAgICBSZWZlcmVuY2VRdWV1ZTxPYmplY3Q+IG1RdWV1ZTsKKworICAgICAgICBwcml2YXRlIHZvbGF0aWxlIGJvb2xlYW4gbVJ1bm5pbmcgPSBmYWxzZTsKKworICAgICAgICBSZWNsYWltZXIoKSB7CisgICAgICAgICAgICB0aGlzKG5ldyBSZWZlcmVuY2VRdWV1ZTxPYmplY3Q+KCkpOworICAgICAgICB9CisKKyAgICAgICAgUmVjbGFpbWVyKFJlZmVyZW5jZVF1ZXVlPE9iamVjdD4gcXVldWUpIHsKKyAgICAgICAgICAgIHN1cGVyKCJSZWNsYWltZXIiKTsKKyAgICAgICAgICAgIHNldERhZW1vbih0cnVlKTsKKyAgICAgICAgICAgIG1RdWV1ZSA9IHF1ZXVlOyAgICAgICAgICAgIAorICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIHN0YXJ0KCkgeworICAgICAgICAgICAgbVJ1bm5pbmcgPSB0cnVlOworICAgICAgICAgICAgc3VwZXIuc3RhcnQoKTsKKyAgICAgICAgfQorCisgICAgICAgIGJvb2xlYW4gaXNSdW5uaW5nKCkgeworICAgICAgICAgICAgcmV0dXJuIG1SdW5uaW5nOworICAgICAgICB9CisKKyAgICAgICAgQFN1cHByZXNzV2FybmluZ3MoeyJJbmZpbml0ZUxvb3BTdGF0ZW1lbnQifSkKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIHJ1bigpIHsKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgd2hpbGUgKHRydWUpIHsKKyAgICAgICAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFuVXAobVF1ZXVlLnJlbW92ZSgpKTsKKyAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoSW50ZXJydXB0ZWRFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgLy8gSWdub3JlCisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGNhdGNoIChFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgIExvZy5lKExPR19UQUcsICJSZWNsYWltZXIgdGhyZWFkIGV4aXRpbmc6ICIsIGUpOworICAgICAgICAgICAgfSBmaW5hbGx5IHsKKyAgICAgICAgICAgICAgICBtUnVubmluZyA9IGZhbHNlOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSB2b2lkIGNsZWFuVXAoUmVmZXJlbmNlPD8+IHJlZmVyZW5jZSkgeworICAgICAgICAgICAgZG8geworICAgICAgICAgICAgICAgIHJlZmVyZW5jZS5jbGVhcigpOworICAgICAgICAgICAgICAgICgoUmVjbGFpbWFibGVSZWZlcmVuY2U8Pz4pIHJlZmVyZW5jZSkucmVjbGFpbSgpOworICAgICAgICAgICAgfSB3aGlsZSAoKHJlZmVyZW5jZSA9IG1RdWV1ZS5wb2xsKCkpICE9IG51bGwpOworICAgICAgICB9CisgICAgfQorfQpkaWZmIC0tZ2l0IGEvY29yZS9qYXZhL2FuZHJvaWQvdXRpbC9Kc29uUmVhZGVyLmphdmEgYi9jb3JlL2phdmEvYW5kcm9pZC91dGlsL0pzb25SZWFkZXIuamF2YQpuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi4zMzQ1YmZhCi0tLSAvZGV2L251bGwKKysrIGIvY29yZS9qYXZhL2FuZHJvaWQvdXRpbC9Kc29uUmVhZGVyLmphdmEKQEAgLTAsMCArMSwxMDU4IEBACisvKgorICogQ29weXJpZ2h0IChDKSAyMDEwIFRoZSBBbmRyb2lkIE9wZW4gU291cmNlIFByb2plY3QKKyAq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iAgICAgICAiZm9sbG93ZXJzX2NvdW50IjogMgorICogICAgIH0KKyAqICAgfQorICogXX08L3ByZT4KKyAqIFRoaXMgY29kZSBpbXBsZW1lbnRzIHRoZSBwYXJzZXIgZm9yIHRoZSBhYm92ZSBzdHJ1Y3R1cmU6IDxwcmU+ICAge0Bjb2RlCisgKgorICogICBwdWJsaWMgTGlzdDxNZXNzYWdlPiByZWFkSnNvblN0cmVhbShJbnB1dFN0cmVhbSBpbikgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAqICAgICBKc29uUmVhZGVyIHJlYWRlciA9IG5ldyBKc29uUmVhZGVyKG5ldyBJbnB1dFN0cmVhbVJlYWRlcihpbiwgIlVURi04IikpOworICogICAgIHJldHVybiByZWFkTWVzc2FnZXNBcnJheShyZWFkZXIpOworICogICB9CisgKgorICogICBwdWJsaWMgTGlzdDxNZXNzYWdlPiByZWFkTWVzc2FnZXNBcnJheShKc29uUmVhZGVyIHJlYWRlcikgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAqICAgICBMaXN0PE1lc3NhZ2U+IG1lc3NhZ2VzID0gbmV3IEFycmF5TGlzdDxNZXNzYWdlPigpOworICoKKyAqICAgICByZWFkZXIuYmVnaW5BcnJheSgpOworICogICAgIHdoaWxlIChyZWFkZXIuaGFzTmV4dCgpKSB7CisgKiAgICAgICBtZXNzYWdlcy5hZGQocmVhZE1lc3NhZ2UocmVhZGVyKSk7CisgKiAgICAgfQorICogICAgIHJlYWRlci5lbmRBcnJheSgpOworICogICAgIHJldHVybiBtZXNzYWdlczsKKyAqICAgfQorICoKKyAqICAgcHVibGljIE1lc3NhZ2UgcmVhZE1lc3NhZ2UoSnNvblJlYWRlciByZWFkZXIpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgKiAgICAgbG9uZyBpZCA9IC0xOworICogICAgIFN0cmluZyB0ZXh0ID0gbnVsbDsKKyAqICAgICBVc2VyIHVzZXIgPSBudWxsOworICogICAgIExpc3Q8RG91YmxlPiBnZW8gPSBudWxsOworICoKKyAqICAgICByZWFkZXIuYmVnaW5PYmplY3QoKTsKKyAqICAgICB3aGlsZSAocmVhZGVyLmhhc05leHQoKSkgeworICogICAgICAgU3RyaW5nIG5hbWUgPSByZWFkZXIubmV4dE5hbWUoKTsKKyAqICAgICAgIGlmIChuYW1lLmVxdWFscygiaWQiKSkgeworICogICAgICAgICBpZCA9IHJlYWRlci5uZXh0TG9uZygpOworICogICAgICAgfSBlbHNlIGlmIChuYW1lLmVxdWFscygidGV4dCIpKSB7CisgKiAgICAgICAgIHRleHQgPSByZWFkZXIubmV4dFN0cmluZygpOworICogICAgICAgfSBlbHNlIGlmIChuYW1lLmVxdWFscygiZ2VvIikgJiYgcmVhZGVyLnBlZWsoKSAhPSBKc29uVG9rZW4uTlVMTCkgeworICogICAgICAgICBnZW8gPSByZWFkRG91Ymxlc0FycmF5KHJlYWRlcik7CisgKiAgICAgICB9IGVsc2UgaWYgKG5hbWUuZXF1YWxzKCJ1c2VyIikpIHsKKyAqICAgICAgICAgdXNlciA9IHJlYWRVc2VyKHJlYWRlcik7CisgKiAgICAgICB9IGVsc2UgeworICogICAgICAgICByZWFkZXIuc2tpcFZhbHVlKCk7CisgKiAgICAgICB9CisgKiAgICAgfQorICogICAgIHJlYWRlci5lbmRPYmplY3QoKTsKKyAqICAgICByZXR1cm4gbmV3IE1lc3NhZ2UoaWQsIHRleHQsIHVzZXIsIGdlbyk7CisgKiAgIH0KKyAqCisgKiAgIHB1YmxpYyBMaXN0PERvdWJsZT4gcmVhZERvdWJsZXNBcnJheShKc29uUmVhZGVyIHJlYWRlcikgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAqICAgICBMaXN0PERvdWJsZT4gZG91YmxlcyA9IG5ldyBBcnJheUxpc3Q8RG91YmxlPigpOworICoKKyAqICAgICByZWFkZXIuYmVnaW5BcnJheSgpOworICogICAgIHdoaWxlIChyZWFkZXIuaGFzTmV4dCgpKSB7CisgKiAgICAgICBkb3VibGVzLmFkZChyZWFkZXIubmV4dERvdWJsZSgpKTsKKyAqICAgICB9CisgKiAgICAgcmVhZGVyLmVuZEFycmF5KCk7CisgKiAgICAgcmV0dXJuIGRvdWJsZXM7CisgKiAgIH0KKyAqCisgKiAgIHB1YmxpYyBVc2VyIHJlYWRVc2VyKEpzb25SZWFkZXIgcmVhZGVyKSB0aHJvd3MgSU9FeGNlcHRpb24geworICogICAgIFN0cmluZyB1c2VybmFtZSA9IG51bGw7CisgKiAgICAgaW50IGZvbGxvd2Vyc0NvdW50ID0gLTE7CisgKgorICogICAgIHJlYWRlci5iZWdpbk9iamVjdCgpOworICogICAgIHdoaWxlIChyZWFkZXIuaGFzTmV4dCgpKSB7CisgKiAgICAgICBTdHJpbmcgbmFtZSA9IHJlYWRlci5uZXh0TmFtZSgpOworICogICAgICAgaWYgKG5hbWUuZXF1YWxzKCJuYW1lIikpIHsKKyAqICAgICAgICAgdXNlcm5hbWUgPSByZWFkZXIubmV4dFN0cmluZygpOworICogICAgICAgfSBlbHNlIGlmIChuYW1lLmVxdWFscygiZm9sbG93ZXJzX2NvdW50IikpIHsKKyAqICAgICAgICAgZm9sbG93ZXJzQ291bnQgPSByZWFkZXIubmV4dEludCgpOworICogICAgICAgfSBlbHNlIHsKKyAqICAgICAgICAgcmVhZGVyLnNraXBWYWx1ZSgpOworICogICAgICAgfQorICogICAgIH0KKyAqICAgICByZWFkZXIuZW5kT2JqZWN0KCk7CisgKiAgICAgcmV0dXJuIG5ldyBVc2VyKHVzZXJuYW1lLCBmb2xsb3dlcnNDb3VudCk7CisgKiAgIH19PC9wcmU+CisgKgorICogPGgzPk51bWJlciBIYW5kbGluZzwvaDM+CisgKiBUaGlzIHJlYWRlciBwZXJtaXRzIG51bWVyaWMgdmFsdWVzIHRvIGJlIHJlYWQgYXMgc3RyaW5ncyBhbmQgc3RyaW5nIHZhbHVlcyB0bworICogYmUgcmVhZCBhcyBudW1iZXJzLiBGb3IgZXhhbXBsZSwgYm90aCBlbGVtZW50cyBvZiB0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uaW5nIG9mIGEgbmV3IG9iamVjdC4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBiZWdpbk9iamVjdCgpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIGV4cGVjdChKc29uVG9rZW4uQkVHSU5fT0JKRUNUKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBDb25zdW1lcyB0aGUgbmV4dCB0b2tlbiBmcm9tIHRoZSBKU09OIHN0cmVhbSBhbmQgYXNzZXJ0cyB0aGF0IGl0IGlzIHRoZQorICAgICAqIGVuZCBvZiB0aGUgY3VycmVudCBhcnJheS4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBlbmRPYmplY3QoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBleHBlY3QoSnNvblRva2VuLkVORF9PQkpFQ1QpOworICAgIH0KKworICAgIC8qKgorICAgICAqIENvbnN1bWVzIHtAY29kZSBleHBlY3RlZH0uCisgICAgICovCisgICAgcHJpdmF0ZSB2b2lkIGV4cGVjdChKc29uVG9rZW4gZXhwZWN0ZWQpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIHF1aWNrUGVlaygpOworICAgICAgICBpZiAodG9rZW4gIT0gZXhwZWN0ZWQpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oIkV4cGVjdGVkICIgKyBleHBlY3RlZCArICIgYnV0IHdhcyAiICsgcGVlaygpKTsKKyAgICAgICAgfQorICAgICAgICBhZHZhbmNlKCk7CisgICAgfQorCisgICAgLyoqCisgICAgICogUmV0dXJucyB0cnVlIGlmIHRoZSBjdXJyZW50IGFycmF5IG9yIG9iamVjdCBoYXMgYW5vdGhlciBlbGVtZW50LgorICAgICAqLworICAgIHB1YmxpYyBib29sZWFuIGhhc05leHQoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBxdWlja1BlZWsoKTsKKyAgICAgICAgcmV0dXJuIHRva2VuICE9IEpzb25Ub2tlbi5FTkRfT0JKRUNUICYmIHRva2VuICE9IEpzb25Ub2tlbi5FTkRfQVJSQVk7CisgICAgfQorCisgICAgLyoqCisgICAgICogUmV0dXJucyB0aGUgdHlwZSBvZiB0aGUgbmV4dCB0b2tlbiB3aXRob3V0IGNvbnN1bWluZyBpdC4KKyAgICAgKi8KKyAgICBwdWJsaWMgSnNvblRva2VuIHBlZWsoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBxdWlja1BlZWsoKTsKKworICAgICAgICBpZiAodG9rZW4gPT0gbnVsbCkgeworICAgICAgICAgICAgZGVjb2RlTGl0ZXJhbCgpOworICAgICAgICB9CisKKyAgICAgICAgcmV0dXJuIHRva2VuOworICAgIH0KKworICAgIC8qKgorICAgICAqIEVuc3VyZXMgdGhhdCBhIHRva2VuIGlzIHJlYWR5LiBBZnRlciB0aGlzIGNhbGwgZWl0aGVyIHtAY29kZSB0b2tlbn0gb3IKKyAgICAgKiB7QGNvZGUgdmFsdWV9IHdpbGwgYmUgbm9uLW51bGwuIFRvIGVuc3VyZSB7QGNvZGUgdG9rZW59IGhhcyBhIGRlZmluaXRpdmUKKyAgICAgKiB2YWx1ZSwgdXNlIHtAbGluayAjcGVlaygpfQorICAgICAqLworICAgIHByaXZhdGUgSnNvblRva2VuIHF1aWNrUGVlaygpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIGlmIChoYXNUb2tlbikgeworICAgICAgICAgICAgcmV0dXJuIHRva2VuOworICAgICAgICB9CisKKyAgICAgICAgc3dpdGNoIChwZWVrU3RhY2soKSkgeworICAgICAgICAgICAgY2FzZSBFTVBUWV9ET0NVTUVOVDoKKyAgICAgICAgICAgICAgICByZXBsYWNlVG9wKEpzb25TY29wZS5OT05FTVBUWV9ET0NVTUVOVCk7CisgICAgICAgICAgICAgICAgSnNvblRva2VuIGZpcnN0VG9rZW4gPSBuZXh0VmFsdWUoKTsKKyAgICAgICAgICAgICAgICBpZiAodG9rZW4gIT0gSnNvblRva2VuLkJFR0lOX0FSUkFZICYmIHRva2VuICE9IEpzb25Ub2tlbi5CRUdJTl9PQkpFQ1QpIHsKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElPRXhjZXB0aW9uKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICJFeHBlY3RlZCBKU09OIGRvY3VtZW50IHRvIHN0YXJ0IHdpdGggJ1snIG9yICd7JyBidXQgd2FzICIgKyB0b2tlbik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHJldHVybiBmaXJzdFRva2VuOworICAgICAgICAgICAgY2FzZSBFTVBUWV9BUlJBWToKKyAgICAgICAgICAgICAgICByZXR1cm4gbmV4dEluQXJyYXkodHJ1ZSk7CisgICAgICAgICAgICBjYXNlIE5PTkVNUFRZX0FSUkFZOgorICAgICAgICAgICAgICAgIHJldHVybiBuZXh0SW5BcnJheShmYWxzZSk7CisgICAgICAgICAgICBjYXNlIEVNUFRZX09CSkVDVDoKKyAgICAgICAgICAgICAgICByZXR1cm4gbmV4dEluT2JqZWN0KHRydWUpOworICAgICAgICAgICAgY2FzZSBEQU5HTElOR19OQU1FOgorICAgICAgICAgICAgICAgIHJldHVybiBvYmplY3RWYWx1ZSgpOworICAgICAgICAgICAgY2FzZSBOT05FTVBUWV9PQkpFQ1Q6CisgICAgICAgICAgICAgICAgcmV0dXJuIG5leHRJbk9iamVjdChmYWxzZSk7CisgICAgICAgICAgICBjYXNlIE5PTkVNUFRZX0RPQ1VNRU5UOgorICAgICAgICAgICAgICAgIGhhc1Rva2VuID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICByZXR1cm4gdG9rZW4gPSBKc29uVG9rZW4uRU5EX0RPQ1VNRU5UOworICAgICAgICAgICAgY2FzZSBDTE9TRUQ6CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiSnNvblJlYWRlciBpcyBjbG9zZWQiKTsKKyAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEFzc2VydGlvbkVycm9yKCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBBZHZhbmNlcyB0aGUgY3Vyc29yIGluIHRoZSBKU09OIHN0cmVhbSB0byB0aGUgbmV4dCB0b2tlbi4KKyAgICAgKi8KKyAgICBwcml2YXRlIEpzb25Ub2tlbiBhZHZhbmNlKCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgcXVpY2tQZWVrKCk7CisKKyAgICAgICAgSnNvblRva2VuIHJlc3VsdCA9IHRva2VuOworICAgICAgICBoYXNUb2tlbiA9IGZhbHNlOworICAgICAgICB0b2tlbiA9IG51bGw7CisgICAgICAgIHZhbHVlID0gbnVsbDsKKyAgICAgICAgbmFtZSA9IG51bGw7CisgICAgICAgIHJldHVybiByZXN1bHQ7CisgICAgfQorCisgICAgLyoqCisgICAgICogUmV0dXJucyB0aGUgbmV4dCB0b2tlbiwgYSB7QGxpbmsgSnNvblRva2VuI05BTUUgcHJvcGVydHkgbmFtZX0sIGFuZAorICAgICAqIGNvbnN1bWVzIGl0LgorICAgICAqCisgICAgICogQHRocm93cyBJT0V4Y2VwdGlvbiBpZiB0aGUgbmV4dCB0b2tlbiBpbiB0aGUgc3RyZWFtIGlzIG5vdCBhIHByb3BlcnR5CisgICAgICogICAgIG5hbWUuCisgICAgICovCisgICAgcHVibGljIFN0cmluZyBuZXh0TmFtZSgpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIHF1aWNrUGVlaygpOworICAgICAgICBpZiAodG9rZW4gIT0gSnNvblRva2VuLk5BTUUpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oIkV4cGVjdGVkIGEgbmFtZSBidXQgd2FzICIgKyBwZWVrKCkpOworICAgICAgICB9CisgICAgICAgIFN0cmluZyByZXN1bHQgPSBuYW1lOworICAgICAgICBhZHZhbmNlKCk7CisgICAgICAgIHJldHVybiByZXN1bHQ7CisgICAgfQorCisgICAgLyoqCisgICAgICogUmV0dXJucyB0aGUge0BsaW5rIEpzb25Ub2tlbiNTVFJJTkcgc3RyaW5nfSB2YWx1ZSBvZiB0aGUgbmV4dCB0b2tlbiwKKyAgICAgKiBjb25zdW1pbmcgaXQuIElmIHRoZSBuZXh0IHRva2VuIGlzIGEgbnVtYmVyLCB0aGlzIG1ldGhvZCB3aWxsIHJldHVybiBpdHMKKyAgICAgKiBzdHJpbmcgZm9ybS4KKyAgICAgKgorICAgICAqIEB0aHJvd3MgSWxsZWdhbFN0YXRlRXhjZXB0aW9uIGlmIHRoZSBuZXh0IHRva2VuIGlzIG5vdCBhIHN0cmluZyBvciBpZgorICAgICAqICAgICB0aGlzIHJlYWRlciBpcyBjbG9zZWQuCisgICAgICovCisgICAgcHVibGljIFN0cmluZyBuZXh0U3RyaW5nKCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgcGVlaygpOworICAgICAgICBpZiAodmFsdWUgPT0gbnVsbCB8fCAodG9rZW4gIT0gSnNvblRva2VuLlNUUklORyAmJiB0b2tlbiAhPSBKc29uVG9rZW4uTlVNQkVSKSkgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiRXhwZWN0ZWQgYSBzdHJpbmcgYnV0IHdhcyAiICsgcGVlaygpKTsKKyAgICAgICAgfQorCisgICAgICAgIFN0cmluZyByZXN1bHQgPSB2YWx1ZTsKKyAgICAgICAgYWR2YW5jZSgpOworICAgICAgICByZXR1cm4gcmVzdWx0OworICAgIH0KKworICAgIC8qKgorICAgICAqIFJldHVybnMgdGhlIHtAbGluayBKc29uVG9rZW4jQk9PTEVBTiBib29sZWFufSB2YWx1ZSBvZiB0aGUgbmV4dCB0b2tlbiwKKyAgICAgKiBjb25zdW1pbmcgaXQuCisgICAgICoKKyAgICAgKiBAdGhyb3dzIEl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gICogICAgIGFzIGEgZG91YmxlLCBvciBpcyBub24tZmluaXRlLgorICAgICAqLworICAgIHB1YmxpYyBkb3VibGUgbmV4dERvdWJsZSgpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIHF1aWNrUGVlaygpOworICAgICAgICBpZiAodmFsdWUgPT0gbnVsbCkgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiRXhwZWN0ZWQgYSBkb3VibGUgYnV0IHdhcyAiICsgcGVlaygpKTsKKyAgICAgICAgfQorCisgICAgICAgIGRvdWJsZSByZXN1bHQgPSBEb3VibGUucGFyc2VEb3VibGUodmFsdWUpOworCisgICAgICAgIGlmICgocmVzdWx0ID49IDEuMGQgJiYgdmFsdWUuc3RhcnRzV2l0aCgiMCIpKQorICAgICAgICAgICAgICAgIHx8IERvdWJsZS5pc05hTihyZXN1bHQpCisgICAgICAgICAgICAgICAgfHwgRG91YmxlLmlzSW5maW5pdGUocmVzdWx0KSkgeworICAgICAgICAgICAgdGhyb3cgbmV3IE51bWJlckZvcm1hdEV4Y2VwdGlvbigKKyAgICAgICAgICAgICAgICAgICAgIkpTT04gZm9yYmlkcyBvY3RhbCBwcmVmaXhlcywgTmFOIGFuZCBpbmZpbml0aWVzOiAiICsgdmFsdWUpOworICAgICAgICB9CisKKyAgICAgICAgYWR2YW5jZSgpOworICAgICAgICByZXR1cm4gcmVzdWx0OworICAgIH0KKworICAgIC8qKgorICAgICAqIFJldHVybnMgdGhlIHtAbGluayBKc29uVG9rZW4jTlVNQkVSIGxvbmd9IHZhbHVlIG9mIHRoZSBuZXh0IHRva2VuLAorICAgICAqIGNvbnN1bWluZyBpdC4gSWYgdGhlIG5leHQgdG9rZW4gaXMgYSBzdHJpbmcsIHRoaXMgbWV0aG9kIHdpbGwgYXR0ZW1wdCB0bworICAgICAqIHBhcnNlIGl0IGFzIGEgbG9uZy4gSWYgdGhlIG5leHQgdG9rZW4ncyBudW1lcmljI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YXMgYW4gaW50LgorICAgICAqLworICAgIHB1YmxpYyBpbnQgbmV4dEludCgpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIHF1aWNrUGVlaygpOworICAgICAgICBpZiAodmFsdWUgPT0gbnVsbCkgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiRXhwZWN0ZWQgYW4gaW50IGJ1dCB3YXMgIiArIHBlZWsoKSk7CisgICAgICAgIH0KKworICAgICAgICBpbnQgcmVzdWx0OworICAgICAgICB0cnkgeworICAgICAgICAgICAgcmVzdWx0ID0gSW50ZWdlci5wYXJzZUludCh2YWx1ZSk7CisgICAgICAgIH0gY2F0Y2ggKE51bWJlckZvcm1hdEV4Y2VwdGlvbiBpZ25vcmVkKSB7CisgICAgICAgICAgICBkb3VibGUgYXNEb3VibGUgPSBEb3VibGUucGFyc2VEb3VibGUodmFsdWUpOyAvLyBkb24ndCBjYXRjaCB0aGlzIE51bWJlckZvcm1hdEV4Y2VwdGlvbgorICAgICAgICAgICAgcmVzdWx0ID0gKGludCkgYXNEb3VibGU7CisgICAgICAgICAgICBpZiAoKGRvdWJsZSkgcmVzdWx0ICE9IGFzRG91YmxlKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IE51bWJlckZvcm1hdEV4Y2VwdGlvbih2YWx1ZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBpZiAocmVzdWx0ID49IDFMICYmIHZhbHVlLnN0YXJ0c1dpdGgoIjAiKSkgeworICAgICAgICAgICAgdGhyb3cgbmV3IE51bWJlckZvcm1hdEV4Y2VwdGlvbigiSlNPTiBmb3JiaWRzIG9jdGFsIHByZWZpeGVzOiAiICsgdmFsdWUpOworICAgICAgICB9CisKKyAgICAgICAgYWR2YW5jZSgpOworICAgICAgICByZXR1cm4gcmVzdWx0OworICAgIH0KKworICAgIC8qKgorICAgICAqIENsb3NlcyB0aGlzIEpTT04gcmVhZGVyIGFuZCB0aGUgdW5kZXJseWluZyB7QGxpbmsgUmVhZGVyfS4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBjbG9zZSgpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIGhhc1Rva2VuID0gZmFsc2U7CisgICAgICAgIHZhbHVlID0gbnVsbDsKKyAgICAgICAgdG9rZW4gPSBudWxsOworICAgICAgICBzdGFjay5jbGVhcigpOworICAgICAgICBzdGFjay5hZGQoSnNvblNjb3BlLkNMT1NFRCk7CisgICAgICAgIGluLmNsb3NlKCk7CisgICAgfQorCisgICAgLyoqCisgICAgICogU2tpcHMgdGhlIG5leHQgdmFsdWUgcmVjdXJzaXZlbHkuIElmIGl0IGlzIGFuIG9iamVjdCBvciBhcnJheSwgYWxsIG5lc3RlZAorICAgICAqIGVsZW1lbnRzIGFyZSBza2lwcGVkLiBUaGlzIG1ldGhvZCBpcyBpbnRlbmRlZCBmb3IgdXNlIHdoZW4gdGhlIEpTT04gdG9rZW4KKyAgICAgKiBzdHJlYW0gY29udGFpbnMgdW5yZWNvZ25pemVkIG9yIHVuaGFuZGxlZCB2YWx1ZXMuCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2tpcFZhbHVlKCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgc2tpcHBpbmcgPSB0cnVlOworICAgICAgICB0cnkgeworICAgICAgICAgICAgaW50IGNvdW50ID0gMDsKKyAgICAgICAgICAgIGRvIHsKKyAgICAgICAgICAgICAgICBKc29uVG9rZW4gdG9rZW4gPSBhZHZhbmNlKCk7CisgICAgICAgICAgICAgICAgaWYgKHRva2VuID09IEpzb25Ub2tlbi5CRUdJTl9BUlJBWSB8fCB0b2tlbiA9PSBKc29uVG9rZW4uQkVHSU5fT0JKRUNUKSB7CisgICAgICAgICAgICAgICAgICAgIGNvdW50Kys7CisgICAgICAgICAgICAgICAgfSBlbHNlIGlmICh0b2tlbiA9PSBKc29uVG9rZW4uRU5EX0FSUkFZIHx8IHRva2VuID09IEpzb25Ub2tlbi5FTkRfT0JKRUNUKSB7CisgICAgICAgICAgICAgICAgICAgIGNvdW50LS07CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSB3aGlsZSAoY291bnQgIT0gMCk7CisgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICBza2lwcGluZyA9IGZhbHNlOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSBKc29uU2NvcGUgcGVla1N0YWNrKCkgeworICAgICAgICByZXR1cm4gc3RhY2suZ2V0KHN0YWNrLnNpemUoKSAtIDEpOworICAgIH0KKworICAgIHByaXZhdGUgSnNvblNjb3BlIHBvcCgpIHsKKyAgICAgICAgcmV0dXJuIHN0YWNrLnJlbW92ZShzdGFjay5zaXplKCkgLSAxKTsKKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgcHVzaChKc29uU2NvcGUgbmV3VG9wKSB7CisgICAgICAgIHN0YWNrLmFkZChuZXdUb3ApOworICAgIH0KKworICAgIC8qKgorICAgICAqIFJlcGxhY2UgdGhlIHZhbHVlIG9uIHRoZSB0b3Agb2YgdGhlIHN0YWNrIHdpdGggdGhlIGdpdmVuIHZhbHVlLgorICAgICAqLworICAgIHByaXZhdGUgdm9pZCByZXBsYWNlVG9wKEpzb25TY29wZSBuZXdUb3ApIHsKKyAgICAgICAgc3RhY2suc2V0KHN0YWNrLnNpemUoKSAtIDEsIG5ld1RvcCk7CisgICAgfQorCisgICAgcHJpdmF0ZSBKc29uVG9rZW4gbmV4dEluQXJyYXkoYm9vbGVhbiBmaXJzdEVsZW1lbnQpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIGlmIChmaXJzdEVsZW1lbnQpIHsKKyAgICAgICAgICAgIHJlcGxhY2VUb3AoSnNvblNjb3BlLk5PTkVNUFRZX0FSUkFZKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIC8qIExvb2sgZm9yIGEgY29tbWEgYmVmb3JlIGVhY2ggZWxlbWVudCBhZnRlciB0aGUgZmlyc3QgZWxlbWVudC4gKi8KKyAgICAgICAgICAgIHN3aXRjaCAobmV4dE5vbldoaXRlc3BhY2UoKSkgeworICAgICAgICAgICAgICAgIGNhc2UgJ10nOgorICAgICAgICAgICAgICAgICAgICBwb3AoKTsKKyAgICAgICAgICAgICAgICAgICAgaGFzVG9rZW4gPSB0cnVlOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gdG9rZW4gPSBKc29uVG9rZW4uRU5EX0FSUkFZOworICAgICAgICAgICAgICAgIGNhc2UgJzsnOgorICAgICAgICAgICAgICAgICAgICBjaGVja0xlbmllbnQoKTsgLy8gZmFsbC10aHJvdWdoCisgICAgICAgICAgICAgICAgY2FzZSAnLCc6CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgICAgIHRocm93IHN5bnRheEVycm9yKCJVbnRlcm1pbmF0ZWQgYXJyYXkiKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHN3aXRjaCAobmV4dE5vbldoaXRlc3BhY2UoKSkgeworICAgICAgICAgICAgY2FzZSAnXSc6CisgICAgICAgICAgICAgICAgaWYgKGZpcnN0RWxlbWVudCkgeworICAgICAgICAgICAgICAgICAgICBwb3AoKTsKKyAgICAgICAgICAgICAgICAgICAgaGFzVG9rZW4gPSB0cnVlOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gdG9rZW4gPSBKc29uVG9rZW4uRU5EX0FSUkFZOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAvLyBmYWxsLXRocm91Z2ggdG8gaGFuZGxlICIsXSIKKyAgICAgICAgICAgIGNhc2UgJzsnOgorICAgICAgICAgICAgY2FzZSAnLCc6CisgICAgICAgICAgICAgICAgLyogSW4gbGVuaWVudCBtb2RlLCBhIDAtbGVuZ3RoIGxpdGVyYWwgbWVhbnMgJ251bGwnICovCisgICAgICAgICAgICAgICAgY2hlY2tMZW5pZW50KCk7CisgICAgICAgICAgICAgICAgcG9zLS07CisgICAgICAgICAgICAgICAgaGFzVG9rZW4gPSB0cnVlOworICAgICAgICAgICAgICAgIHZhbHVlID0gIm51bGwiOworICAgICAgICAgICAgICAgIHJldHVybiB0b2tlbiA9IEpzb25Ub2tlbi5OVUxMOworICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICBwb3MtLTsKKyAgICAgICAgICAgICAgICByZXR1cm4gbmV4dFZhbHVlKCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIEpzb25Ub2tlbiBuZXh0SW5PYmplY3QoYm9vbGVhbiBmaXJzdEVsZW1lbnQpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIC8qCisgICAgICAgICAqIFJlYWQgZGVsaW1pdGVycy4gRWl0aGVyIGEgY29tbWEvc2VtaWNvbG9uIHNlcGFyYXRpbmcgdGhpcyBhbmQgdGhlCisgICAgICAgICAqIHByZXZpb3VzIG5hbWUtdmFsdWUgcGFpciwgb3IgYSBjbG9zZSBicmFjZSB0byBkZW5vdGUgdGhlIGVuZCBvZiB0aGUKKyAgICAgICAgICogb2JqZWN0LgorICAgICAgICAgKi8KKyAgICAgICAgaWYgKGZpcnN0RWxlbWVudCkgeworICAgICAgICAgICAgLyogUGVlayB0byBzZWUgaWYgdGhpcyBpcyB0aGUgZW1wdHkgb2JqZWN0LiAqLworICAgICAgICAgICAgc3dpdGNoIChuZXh0Tm9uV2hpdGVzcGFjZSgpKSB7CisgICAgICAgICAgICAgICAgY2FzZSAnfSc6CisgICAgICAgICAgICAgICAgICAgIHBvcCgpOworICAgICAgICAgICAgICAgICAgICBoYXNUb2tlbiA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiB0b2tlbiA9IEpzb25Ub2tlbi5FTkRfT0JKRUNUOworICAgICAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgICAgIHBvcy0tOworICAgICAgICAgICAgfQorICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgc3dpdGNoIChuZXh0Tm9uV2hpdGVzcGFjZSgpKSB7CisgICAgICAgICAgICAgICAgY2FzZSAnfSc6CisgICAgICAgICAgICAgICAgICAgIHBvcCgpOworICAgICAgICAgICAgICAgICAgICBoYXNUb2tlbiA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiB0b2tlbiA9IEpzb25Ub2tlbi5FTkRfT0JKRUNUOworICAgICAgICAgICAgICAgIGNhc2UgJzsnOgorICAgICAgICAgICAgICAgIGNhc2UgJywnOgorICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgICAgICB0aHJvdyBzeW50YXhFcnJvcigiVW50ZXJtaW5hdGVkIG9iamVjdCIpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgLyogUmVhZCB0aGUgbmFtZS4gKi8KKyAgICAgICAgaW50IHF1b3RlID0gbmV4dE5vbldoaXRlc3BhY2UoKTsKKyAgICAgICAgc3dpdGNoIChxdW90ZSkgeworICAgICAgICAgICAgY2FzZSAnXCcnOgorICAgICAgICAgICAgICAgIGNoZWNrTGVuaWVudCgpOyAvLyBmYWxsLXRocm91Z2gKKyAgICAgICAgICAgIGNhc2UgJyInOgorICAgICAgICAgICAgICAgIG5hbWUgPSBuZXh0U3RyaW5nKChjaGFyKSBxdW90ZSk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgIGNoZWNrTGVuaWVudCgpOworICAgICAgICAgICAgICAgIHBvcy0tOworICAgICAgICAgICAgICAgIG5hbWUgPSBuZXh0TGl0ZXJhbCgpOworICAgICAgICAgICAgICAgIGlmIChuYW1lLmlzRW1wdHkoKSkgeworICAgICAgICAgICAgICAgICAgICB0aHJvdyBzeW50YXhFcnJvcigiRXhwZWN0ZWQgbmFtZSIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHJlcGxhY2VUb3AoSnNvblNjb3BlLkRBTkdMSU5HX05BTUUpOworICAgICAgICBoYXNUb2tlbiA9IHRydWU7CisgICAgICAgIHJldHVybiB0b2tlbiA9IEpzb25Ub2tlbi5OQU1FOworICAgIH0KKworICAgIHByaXZhdGUgSnNvblRva2VuIG9iamVjdFZhbHVlKCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgLyoKKyAgICAgICAgICogUmVhZCB0aGUgbmFtZS92YWx1ZSBzZXBhcmF0b3IuIFVzdWFsbHkgYSBjb2xvbiAnOicuIEluIGxlbmllbnQgbW9kZQorICAgICAgICAgKiB3ZSBhbHNvIGFjY2VwdCBhbiBlcXVhbHMgc2lnbiAnPScsIG9yIGFuIGFycm93ICI9PiIuCisgICAgICAgICAqLworICAgICAgICBzd2l0Y2ggKG5leHROb25XaGl0ZXNwYWNlKCkpIHsKKyAgICAgICAgICAgIGNhc2UgJzonOgorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSAnPSc6CisgICAgICAgICAgICAgICAgY2hlY2tMZW5pZW50KCk7CisgICAgICAgICAgICAgICAgaWYgKChwb3MgPCBsaW1pdCB8fCBmaWxsQnVmZmVyKDEpKSAmJiBidWZmZXJbcG9zXSA9PSAnPicpIHsKKyAgICAgICAgICAgICAgICAgICAgcG9zKys7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICB0aHJvdyBzeW50YXhFcnJvcigiRXhwZWN0ZWQgJzonIik7CisgICAgICAgIH0KKworICAgICAgICByZXBsYWNlVG9wKEpzb25TY29wZS5OT05FTVBUWV9PQkpFQ1QpOworICAgICAgICByZXR1cm4gbmV4dFZhbHVlKCk7CisgICAgfQorCisgICAgcHJpdmF0ZSBKc29uVG9rZW4gbmV4dFZhbHVlKCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgaW50IGMgPSBuZXh0Tm9uV2hpdGVzcGFjZSgpOworICAgICAgICBzd2l0Y2ggKGMpIHsKKyAgICAgICAgICAgIGNhc2UgJ3snOgorICAgICAgICAgICAgICAgIHB1c2goSnNvblNjb3BlLkVNUFRZX09CSkVDVCk7CisgICAgICAgICAgICAgICAgaGFzVG9rZW4gPSB0cnVlOworICAgICAgICAgICAgICAgIHJldHVybiB0b2tlbiA9IEpzb25Ub2tlbi5CRUdJTl9PQkpFQ1Q7CisKKyAgICAgICAgICAgIGNhc2UgJ1snOgorICAgICAgICAgICAgICAgIHB1c2goSnNvblNjb3BlLkVNUFRZX0FSUkFZKTsKKyAgICAgICAgICAgICAgICBoYXNUb2tlbiA9IHRydWU7CisgICAgICAgICAgICAgICAgcmV0dXJuIHRva2VuID0gSnNvblRva2VuLkJFR0lOX0FSUkFZOworCisgICAgICAgICAgICBjYXNlICdcJyc6CisgICAgICAgICAgICAgICAgY2hlY2tMZW5pZW50KCk7IC8vIGZhbGwtdGhyb3VnaAorICAgICAgICAgICAgY2FzZSAnIic6CisgICAgICAgICAgICAgICAgdmFsdWUgPSBuZXh0U3RyaW5nKChjaGFyKSBjKTsKKyAgICAgICAgICAgICAgICBoYXNUb2tlbiA9IHRydWU7CisgICAgICAgICAgICAgICAgcmV0dXJuIHRva2VuID0gSnNvblRva2VuLlNUUklORzsKKworICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICBwb3MtLTsKKyAgICAgICAgICAgICAgICByZXR1cm4gcmVhZExpdGVyYWwoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIFJldHVybnMgdHJ1ZSBvbmNlIHtAY29kZSBsaW1pdCAtIHBvcyA+PSBtaW5pbXVtfS4gSWYgdGhlIGRhdGEgaXMKKyAgICAgKiBleGhhdXN0ZWQgYmVmb3JlIHRoYXQgbWFueSBjaGFyYWN0ZXJzIGFyZSBhdmFpbGFibGUsIHRoaXMgcmV0dXJucworICAgICAqIGZhbHNlLgorICAgICAqLworICAgIHByaXZhdGUgYm9vbGVhbiBmaWxsQnVmZmVyKGludCBtaW5pbXVtKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBpZiAobGltaXQgIT0gcG9zKSB7CisgICAgICAgICAgICBsaW1pdCAtPSBwb3M7CisgICAgICAgICAgICBTeXN0ZW0uYXJyYXljb3B5KGJ1ZmZlciwgcG9zLCBidWZmZXIsIDAsIGxpbWl0KTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGxpbWl0ID0gMDsKKyAgICAgICAgfQorCisgICAgICAgIHBvcyA9IDA7CisgICAgICAgIGludCB0b3RhbDsKKyAgICAgICAgd2hpbGUgKCh0b3RhbCA9IGluLnJlYWQoYnVmZmVyLCBsaW1pdCwgYnVmZmVyLmxlbmd0aCAtIGxpbWl0KSkgIT0gLTEpIHsKKyAgICAgICAgICAgIGxpbWl0ICs9IHRvdGFsOworICAgICAgICAgICAgaWYgKGxpbWl0ID49IG1pbmltdW0pIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgcHJpdmF0ZSBpbnQgbmV4dE5vbldoaXRlc3BhY2UoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICB3aGlsZSAocG9zIDwgbGltaXQgfHwgZmlsbEJ1ZmZlcigxKSkgeworICAgICAgICAgICAgaW50IGMgPSBidWZmZXJbcG9zKytdOworICAgICAgICAgICAgc3dpdGNoIChjKSB7CisgICAgICAgICAgICAgICAgY2FzZSAnXHQnOgorICAgICAgICAgICAgICAgIGNhc2UgJyAnOgorICAgICAgICAgICAgICAgIGNhc2UgJ1xuJzoKKyAgICAgICAgICAgICAgICBjYXNlICdccic6CisgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOworCisgICAgICAgICAgICAgICAgY2FzZSAnLyc6CisgICAgICAgICAgICAgICAgICAgIGlmIChwb3MgPT0gbGltaXQgJiYgIWZpbGxCdWZmZXIoMSkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjOworICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgY2hlY2tMZW5pZW50KCk7CisgICAgICAgICAgICAgICAgICAgIGNoYXIgcGVlayA9IGJ1ZmZlcltwb3NdOworICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKHBlZWspIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJyonOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHNraXAgYSAvKiBjLXN0eWxlIGNvbW1lbnQgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBwb3MrKzsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXNraXBUbygiKi8iKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyBzeW50YXhFcnJvcigiVW50ZXJtaW5hdGVkIGNvbW1lbnQiKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcG9zICs9IDI7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CisKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgJy8nOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHNraXAgYSAvLyBlbmQtb2YtbGluZSBjb21tZW50CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcG9zKys7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2tpcFRvRW5kT2ZMaW5lKCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CisKKyAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGM7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIGNhc2UgJyMnOgorICAgICAgICAgICAgICAgICAgICAvKgorICAgICAgICAgICAgICAgICAgICAgKiBTa2lwIGEgIyBoYXNoIGVuZC1vZi1saW5lIGNvbW1lbnQuIFRoZSBKU09OIFJGQyBkb2Vzbid0CisgICAgICAgICAgICAgICAgICAgICAqIHNwZWNpZnkgdGhpcyBiZWhhdmlvdXIsIGJ1dCBpdCdzIHJlcXVpcmVkIHRvIHBhcnNlCisgICAgICAgICAgICAgICAgICAgICAqIGV4aXN0aW5nIGRvY3VtZW50cy4gU2VlIGh0dHA6Ly9iLzI1NzE0MjMuCisgICAgICAgICAgICAgICAgICAgICAqLworICAgICAgICAgICAgICAgICAgICBjaGVja0xlbmllbnQoKTsKKyAgICAgICAgICAgICAgICAgICAgc2tpcFRvRW5kT2ZMaW5lKCk7CisgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOworCisgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGM7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICB0aHJvdyBzeW50YXhFcnJvcigiRW5kIG9mIGlucHV0Iik7CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIGNoZWNrTGVuaWVudCgpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIGlmICghbGVuaWVudCkgeworICAgICAgICAgICAgdGhyb3cgc3ludGF4RXJyb3IoIlVzZSBKc29uUmVhZGVyLnNldExlbmllbnQodHJ1ZSkgdG8gYWNjZXB0IG1hbGZvcm1lZCBKU09OIik7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBBZHZhbmNlcyB0aGUgcG9zaXRpb24gdW50aWwgYWZ0ZXIgdGhlIG5leHQgbmV3bGluZSBjaGFyYWN0ZXIuIElmIHRoZSBsaW5lCisgICAgICogaXMgdGVybWluYXRlZCBieSAiXHJcbiIsIHRoZSAnXG4nIG11c3QgYmUgY29uc3VtZWQgYXMgd2hpdGVzcGFjZSBieSB0aGUKKyAgICAgKiBjYWxsZXIuCisgICAgICovCisgICAgcHJpdmF0ZSB2b2lkIHNraXBUb0VuZE9mTGluZSgpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIHdoaWxlIChwb3MgPCBsaW1pdCB8fCBmaWxsQnVmZmVyKDEpKSB7CisgICAgICAgICAgICBjaGFyIGMgPSBidWZmZXJbcG9zKytdOworICAgICAgICAgICAgaWYgKGMgPT0gJ1xyJyB8fCBjID09ICdcbicpIHsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgYm9vbGVhbiBza2lwVG8oU3RyaW5nIHRvRmluZCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgb3V0ZXI6CisgICAgICAgIGZvciAoOyBwb3MgKyB0b0ZpbmQubGVuZ3RoKCkgPCBsaW1pdCB8fCBmaWxsQnVmZmVyKHRvRmluZC5sZW5ndGgoKSk7IHBvcysrKSB7CisgICAgICAgICAgICBmb3IgKGludCBjID0gMDsgYyA8IHRvRmluZC5sZW5ndGgoKTsgYysrKSB7CisgICAgICAgICAgICAgICAgaWYgKGJ1ZmZlcltwb3MgKyBjXSAhPSB0b0ZpbmQuY2hhckF0KGMpKSB7CisgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlIG91dGVyOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZXR1cm5zIHRoZSBzdHJpbmcgdXAgdG8gYnV0IG5vdCBpbmNsdWRpbmcge0Bjb2RlIHF1b3RlfSwgdW5lc2NhcGluZyBhbnkKKyAgICAgKiBjaGFyYWN0ZXIgZXNjYXBlIHNlcXVlbmNlcyBlbmNvdW50ZXJlZCBhbG9uZyB0aGUgd2F5LiBUaGUgb3BlbmluZyBxdW90ZQorICAgICAqIHNob3VsZCBoYXZlIGFscmVhZHkgYmVlbiByZWFkLiBUaGlzIGNvbnN1bWVzIHRoZSBjbG9zaW5nIHF1b3RlLCBidXQgZG9lcworICAgICAqIG5vdCBpbmNsdWRlIGl0IGluIHRoZSByZXR1cm5lZCBzdHJpbmcuCisgICAgICoKKyAgICAgKiBAcGFyYW0gcXVvdGUgZWl0aGVyICcgb3IgIi4KKyAgICAgKiBAdGhyb3dzIE51bWJlckZvcm1hdEV4Y2VwdGlvbiBpZiBhbnkgdW5pY29kZSBlc2NhcGUgc2VxdWVuY2VzIGFyZQorICAgICAqICAgICBtYWxmb3JtZWQuCisgICAgICovCisgICAgcHJpdmF0ZSBTdHJpbmcgbmV4dFN0cmluZyhjaGFyIHF1b3RlKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBTdHJpbmdCdWlsZGVyIGJ1aWxkZXIgPSBudWxsOworICAgICAgICBkbyB7CisgICAgICAgICAgICAvKiB0aGUgaW5kZXggb2YgdGhlIGZpcnN0IGNoYXJhY3RlciBub3QgeWV0IGFwcGVuZGVkIHRvIHRoZSBidWlsZGVyLiAqLworICAgICAgICAgICAgaW50IHN0YXJ0ID0gcG9zOworICAgICAgICAgICAgd2hpbGUgKHBvcyA8IGxpbWl0KSB7CisgICAgICAgICAgICAgICAgaW50IGMgPSBidWZmZXJbcG9zKytdOworCisgICAgICAgICAgICAgICAgaWYgKGMgPT0gcXVvdGUpIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKHNraXBwaW5nKSB7CisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gInNraXBwZWQhIjsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChidWlsZGVyID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgU3RyaW5nKGJ1ZmZlciwgc3RhcnQsIHBvcyAtIHN0YXJ0IC0gMSk7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICBidWlsZGVyLmFwcGVuZChidWZmZXIsIHN0YXJ0LCBwb3MgLSBzdGFydCAtIDEpOworICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGJ1aWxkZXIudG9TdHJpbmcoKTsKKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChjID09ICdcXCcpIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGJ1aWxkZXIgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgYnVpbGRlciA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQoYnVmZmVyLCBzdGFydCwgcG9zIC0gc3RhcnQgLSAxKTsKKyAgICAgICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQocmVhZEVzY2FwZUNoYXJhY3RlcigpKTsKKyAgICAgICAgICAgICAgICAgICAgc3RhcnQgPSBwb3M7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAoYnVpbGRlciA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgYnVpbGRlciA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBidWlsZGVyLmFwcGVuZChidWZmZXIsIHN0YXJ0LCBwb3MgLSBzdGFydCk7CisgICAgICAgIH0gd2hpbGUgKGZpbGxCdWZmZXIoMSkpOworCisgICAgICAgIHRocm93IHN5bnRheEVycm9yKCJVbnRlcm1pbmF0ZWQgc3RyaW5nIik7CisgICAgfQorCisgICAgLyoqCisgICAgICogUmV0dXJucyB0aGUgc3RyaW5nIHVwIHRvIGJ1dCBub3QgaW5jbHVkaW5nIGFueSBkZWxpbWl0ZXIgY2hhcmFjdGVycy4gVGhpcworICAgICAqIGRvZXMgbm90IGNvbnN1bWUgdGhlIGRlbGltaXRlciBjaGFyYWN0ZXIuCisgICAgICovCisgICAgcHJpdmF0ZSBTdHJpbmcgbmV4dExpdGVyYWwoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBTdHJpbmdCdWlsZGVyIGJ1aWxkZXIgPSBudWxsOworICAgICAgICBkbyB7CisgICAgICAgICAgICAvKiB0aGUgaW5kZXggb2YgdGhlIGZpcnN0IGNoYXJhY3RlciBub3QgeWV0IGFwcGVuZGVkIHRvIHRoZSBidWlsZGVyLiAqLworICAgICAgICAgICAgaW50IHN0YXJ0ID0gcG9zOworICAgICAgICAgICAgd2hpbGUgKHBvcyA8IGxpbWl0KSB7CisgICAgICAgICAgICAgICAgaW50IGMgPSBidWZmZXJbcG9zKytdOworICAgICAgICAgICAgICAgIHN3aXRjaCAoYykgeworICAgICAgICAgICAgICAgICAgICBjYXNlICcvJzoKKyAgICAgICAgICAgICAgICAgICAgY2FzZSAnXFwnOgorICAgICAgICAgICAgICAgICAgICBjYXNlICc7JzoKKyAgICAgICAgICAgICAgICAgICAgY2FzZSAnIyc6CisgICAgICAgICAgICAgICAgICAgIGNhc2UgJz0nOgorICAgICAgICAgICAgICAgICAgICAgICAgY2hlY2tMZW5pZW50KCk7IC8vIGZhbGwtdGhyb3VnaAorCisgICAgICAgICAgICAgICAgICAgIGNhc2UgJ3snOgorICAgICAgICAgICAgICAgICAgICBjYXNlICd9JzoKKyAgICAgICAgICAgICAgICAgICAgY2FzZSAnWyc6CisgICAgICAgICAgICAgICAgICAgIGNhc2UgJ10nOgorICAgICAgICAgICAgICAgICAgICBjYXNlICc6JzoKKyAgICAgICAgICAgICAgICAgICAgY2FzZSAnLCc6CisgICAgICAgICAgICAgICAgICAgIGNhc2UgJyAnOgorICAgICAgICAgICAgICAgICAgICBjYXNlICdcdCc6CisgICAgICAgICAgICAgICAgICAgIGNhc2UgJ1xmJzoKKyAgICAgICAgICAgICAgICAgICAgY2FzZSAnXHInOgorICAgICAgICAgICAgICAgICAgICBjYXNlICdcbic6CisgICAgICAgICAgICAgICAgICAgICAgICBwb3MtLTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChza2lwcGluZykgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAic2tpcHBlZCEiOworICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChidWlsZGVyID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IFN0cmluZyhidWZmZXIsIHN0YXJ0LCBwb3MgLSBzdGFydCk7CisgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kKGJ1ZmZlciwgc3RhcnQsIHBvcyAtIHN0YXJ0KTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYnVpbGRlci50b1N0cmluZygpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKGJ1aWxkZXIgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGJ1aWxkZXIgPSBuZXcgU3RyaW5nQnVpbGRlcigpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQoYnVmZmVyLCBzdGFydCwgcG9zIC0gc3RhcnQpOworICAgICAgICB9IHdoaWxlIChmaWxsQnVmZmVyKDEpKTsKKworICAgICAgICByZXR1cm4gYnVpbGRlci50b1N0cmluZygpOworICAgIH0KKworICAgIEBPdmVycmlkZSBwdWJsaWMgU3RyaW5nIHRvU3RyaW5nKCkgeworICAgICAgICByZXR1cm4gZ2V0Q2xhc3MoKS5nZXRTaW1wbGVOYW1lKCkgKyAiIG5lYXIgIiArIGdldFNuaXBwZXQoKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBVbmVzY2FwZXMgdGhlIGNoYXJhY3RlciBpZGVudGlmaWVkIGJ5IHRoZSBjaGFyYWN0ZXIgb3IgY2hhcmFjdGVycyB0aGF0CisgICAgICogaW1tZWRpYXRlbHkgZm9sbG93IGEgYmFja3NsYXNoLiBUaGUgYmFja3NsYXNoICdcJyBzaG91bGQgaGF2ZSBhbHJlYWR5CisgICAgICogYmVlbiByZWFkLiBUaGlzIHN1cHBvcnRzIGJvdGggdW5pY29kZSBlc2NhcGVzICJ1MDAwQSIgYW5kIHR3by1jaGFyYWN0ZXIKKyAgICAgKiBlc2NhcGVzICJcbiIuCisgICAgICoKKyAgICAgKiBAdGhyb3dzIE51bWJlckZvcm1hdEV4Y2VwdGlvbiBpZiBhbnkgdW5pY29kZSBlc2NhcGUgc2VxdWVuY2VzIGFyZQorICAgICAqICAgICBtYWxmb3JtZWQuCisgICAgICovCisgICAgcHJpdmF0ZSBjaGFyIHJlYWRFc2NhcGVDaGFyYWN0ZXIoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBpZiAocG9zID09IGxpbWl0ICYmICFmaWxsQnVmZmVyKDEpKSB7CisgICAgICAgICAgICB0aHJvdyBzeW50YXhFcnJvcigiVW50ZXJtaW5hdGVkIGVzY2FwZSBzZXF1ZW5jZSIpOworICAgICAgICB9CisKKyAgICAgICAgY2hhciBlc2NhcGVkID0gYnVmZmVyW3BvcysrXTsKKyAgICAgICAgc3dpdGNoIChlc2NhcGVkKSB7CisgICAgICAgICAgICBjYXNlICd1JzoKKyAgICAgICAgICAgICAgICBpZiAocG9zICsgNCA+IGxpbWl0ICYmICFmaWxsQnVmZmVyKDQpKSB7CisgICAgICAgICAgICAgICAgICAgIHRocm93IHN5bnRheEVycm9yKCJVbnRlcm1pbmF0ZWQgZXNjYXBlIHNlcXVlbmNlIik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIFN0cmluZyBoZXggPSBuZXcgU3RyaW5nKGJ1ZmZlciwgcG9zLCA0KTsKKyAgICAgICAgICAgICAgICBwb3MgKz0gNDsKKyAgICAgICAgICAgICAgICByZXR1cm4gKGNoYXIpIEludGVnZXIucGFyc2VJbnQoaGV4LCAxNik7CisKKyAgICAgICAgICAgIGNhc2UgJ3QnOgorICAgICAgICAgICAgICAgIHJldHVybiAnXHQnOworCisgICAgICAgICAgICBjYXNlICdiJzoKKyAgICAgICAgICAgICAgICByZXR1cm4gJ1xiJzsKKworICAgICAgICAgICAgY2FzZSAnbic6CisgICAgICAgICAgICAgICAgcmV0dXJuICdcbic7CisKKyAgICAgICAgICAgIGNhc2UgJ3InOgorICAgICAgICAgICAgICAgIHJldHVybiAnXHInOworCisgICAgICAgICAgICBjYXNlICdmJzoKKyAgICAgICAgICAgICAgICByZXR1cm4gJ1xmJzsKKworICAgICAgICAgICAgY2FzZSAnXCcnOgorICAgICAgICAgICAgY2FzZSAnIic6CisgICAgICAgICAgICBjYXNlICdcXCc6CisgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgIHJldHVybiBlc2NhcGVkOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogUmVhZHMgYSBudWxsLCBib29sZWFuLCBudW1lcmljIG9yIHVucXVvdGVkIHN0cmluZyBsaXRlcmFsIHZhbHVlLgorICAgICAqLworICAgIHByaXZhdGUgSnNvblRva2VuIHJlYWRMaXRlcmFsKCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgU3RyaW5nIGxpdGVyYWwgPSBuZXh0TGl0ZXJhbCgpOworICAgICAgICBpZiAobGl0ZXJhbC5pc0VtcHR5KCkpIHsKKyAgICAgICAgICAgIHRocm93IHN5bnRheEVycm9yKCJFeHBlY3RlZCBsaXRlcmFsIHZhbHVlIik7CisgICAgICAgIH0KKyAgICAgICAgdmFsdWUgPSBsaXRlcmFsOworICAgICAgICBoYXNUb2tlbiA9IHRydWU7CisgICAgICAgIHJldHVybiB0b2tlbiA9IG51bGw7IC8vIHVzZSBkZWNvZGVMaXRlcmFsKCkgdG8gZ2V0IHRoZSB0b2tlbiB0eXBlCisgICAgfQorCisgICAgLyoqCisgICAgICogQXNzaWducyB7QGNvZGUgbmV4dFRva2VufSBiYXNlZCBvbiB0aGUgdmFsdWUgb2Yge0Bjb2RlIG5leHRWYWx1ZX0uCisgICAgICovCisgICAgcHJpdmF0ZSB2b2lkIGRlY29kZUxpdGVyYWwoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBpZiAodmFsdWUuZXF1YWxzSWdub3JlQ2FzZSgibnVsbCIpKSB7CisgICAgICAgICAgICB0b2tlbiA9IEpzb25Ub2tlbi5OVUxMOworICAgICAgICB9IGVsc2UgaWYgKHZhbHVlLmVxdWFsc0lnbm9yZUNhc2UoInRydWUiKSB8fCB2YWx1ZS5lcXVhbHNJZ25vcmVDYXNlKCJmYWxzZSIpKSB7CisgICAgICAgICAgICB0b2tlbiA9IEpzb25Ub2tlbi5CT09MRUFOOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICBEb3VibGUucGFyc2VEb3VibGUodmFsdWUpOyAvLyB0aGlzIHdvcmsgY291bGQgcG90ZW50aWFsbHkgYmUgY2FjaGVkCisgICAgICAgICAgICAgICAgdG9rZW4gPSBKc29uVG9rZW4uTlVNQkVSOworICAgICAgICAgICAgfSBjYXRjaCAoTnVtYmVyRm9ybWF0RXhjZXB0aW9uIGlnbm9yZWQpIHsKKyAgICAgICAgICAgICAgICAvLyB0aGlzIG11c3QgYmUgYW4gdW5xdW90ZWQgc3RyaW5nCisgICAgICAgICAgICAgICAgY2hlY2tMZW5pZW50KCk7CisgICAgICAgICAgICAgICAgdG9rZW4gPSBKc29uVG9rZW4uU1RSSU5HOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogVGhyb3dzIGEgbmV3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bGVtZW50cyB3aXRoaW4gYSBKU09OIHJlYWRlciBvciB3cml0ZXIuCisgKi8KK2VudW0gSnNvblNjb3BlIHsKKworICAgIC8qKgorICAgICAqIEFuIGFycmF5IHdpdGggbm8gZWxlbWVudHMgcmVxdWlyZXMgbm8gc2VwYXJhdG9ycyBvciBuZXdsaW5lcyBiZWZvcmUKKyAgICAgKiBpdCBpcyBjbG9zZWQuCisgICAgICovCisgICAgRU1QVFlfQVJSQVksCisKKyAgICAvKioKKyAgICAgKiBBIGFycmF5IHdpdGggYXQgbGVhc3Qgb25lIHZhbHVlIHJlcXVpcmVzIGEgY29tbWEgYW5kIG5ld2xpbmUgYmVmb3JlCisgICAgICogdGhlIG5leHQgZWxlbWVudC4KKyAgICAgKi8KKyAgICBOT05FTVBUWV9BUlJBWSwKKworICAgIC8qKgorICAgICAqIEFuIG9iamVjdCB3aXRoIG5vIG5hbWUvdmFsdWUgcGFpcnMgcmVxdWlyZXMgbm8gc2VwYXJhdG9ycyBvciBuZXdsaW5lcworICAgICAqIGJlZm9yZSBpdCBpcyBjbG9zZWQuCisgICAgICovCisgICAgRU1QVFlfT0JKRUNULAorCisgICAgLyoqCisgICAgICogQW4gb2JqZWN0IHdob3NlIG1vc3QgcmVjZW50IGVsZW1lbnQgaXMgYSBrZXkuIFRoZSBuZXh0IGVsZW1lbnQgbXVzdAorICAgICAqIGJlIGEgdmFsdWUuCisgICAgICovCisgICAgREFOR0xJTkdfTkFNRSwKKworICAgIC8qKgorICAgICAqIEFuIG9iamVjdCB3aXRoIGF0IGxlYXN0IG9uZSBuYW1lL3ZhbHVlIHBhaXIgcmVxdWlyZXMgYSBjb21tYSBhbmQKKyAgICAgKiBuZXdsaW5lIGJlZm9yZSB0aGUgbmV4dCBlbGVtZW50LgorICAgICAqLworICAgIE5PTkVNUFRZX09CSkVDVCwKKworICAgIC8qKgorICAgICAqIE5vIG9iamVjdCBvciBhcnJheSBoYXMgYmVlbiBzdGFydGVkLgorICAgICAqLworICAgIEV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dpbk9iamVjdH0uCisgICAgICovCisgICAgQkVHSU5fT0JKRUNULAorCisgICAgLyoqCisgICAgICogVGhlIGNsb3Npbmcgb2YgYSBKU09OIG9iamVjdC4gV3JpdHRlbiB1c2luZyB7QGxpbmsgSnNvbldyaXRlciNlbmRPYmplY3R9CisgICAgICogYW5kIHJlYWQgdXNpbmcge0BsaW5rIEpzb25SZWFkZXIjZW5kT2JqZWN0fS4KKyAgICAgKi8KKyAgICBFTkRfT0JKRUNULAorCisgICAgLyoqCisgICAgICogQSBKU09OIHByb3BlcnR5IG5hbWUuIFdpdGhpbiBvYmplY3RzLCB0b2tlbnMgYWx0ZXJuYXRlIGJldHdlZW4gbmFtZXMgYW5kCisgICAgICogdGhlaXIgdmFsdWVzLiBXcml0dGVuIHVzaW5nIHtAbGluayBKc29uV3JpdGVyI25hbWV9IGFuZCByZWFkIHVzaW5nIHtAbGluaworICAgICAqIEpzb25SZWFkZXIjbmV4dE5hbWV9CisgICAgICovCisgICAgTkFNRSwKKworICAgIC8qKgorICAgICAqIEEgSlNPTiBzdHJpbmcuCisgICAgICovCisgICAgU1RSSU5HLAorCisgICAgLyoqCisgICAgICogQSBKU09OIG51bWJlciByZXByZXNlbnRlZCBpbiB0aGlzIEFQSSBieSBhIEphdmEge0Bjb2RlIGRvdWJsZX0sIHtAY29kZQorICAgICAqIGxvbmd9LCBvciB7QGNvZGUgaW50fS4KKyAgICAgKi8KKyAgICBOVU1CRVIsCisKKyAgICAvKioKKyAgICAgKiBBIEpTT04ge0Bjb2RlIHRydWV9IG9yIHtAY29kZSBmYWxzZX0uCisgICAgICovCisgICAgQk9PTEVBTiwKKworICAgIC8qKgorICAgICAqIEEgSlNPTiB7QGNvZGUgbnVsbH0uCisgICAgICovCisgICAgTlVMTCwKKworICAgIC8qKgorICAgICAqIFRoZSBlbmQgb2YgdGhlIEpTT04gc3RyZWFtLiBUaGlzIHNlbnRpbmVsIHZhbHVlIGlzIHJldHVybmVkIGJ5IHtAbGluaworICAgICA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ggYXMgdGhlIGZvbGxvd2luZzogPHByZT4ge0Bjb2RlCisgKiBbCisgKiAgIHsKKyAqICAgICAiaWQiOiA5MTIzNDU2Nzg5MDEsCisgKiAgICAgInRleHQiOiAiSG93IGRvIEkgd3JpdGUgSlNPTiBvbiBBbmRyb2lkPyIsCisgKiAgICAgImdlbyI6IG51bGwsCisgKiAgICAgInVzZXIiOiB7CisgKiAgICAgICAibmFtZSI6ICJhbmRyb2lkX25ld2IiLAorICogICAgICAgImZvbGxvd2Vyc19jb3VudCI6IDQxCisgKiAgICAgIH0KKyAqICAgfSwKKyAqICAgeworICogICAgICJpZCI6IDkxMjM0NTY3ODkwMiwKKyAqICAgICAidGV4dCI6ICJAYW5kcm9pZF9uZXdiIGp1c3QgdXNlIGFuZHJvaWQudXRpbC5Kc29uV3JpdGVyISIsCisgKiAgICAgImdlbyI6IFs1MC40NTQ3MjIsIC0xMDQuNjA2NjY3XSwKKyAqICAgICAidXNlciI6IHsKKyAqICAgICAgICJuYW1lIjogImplc3NlIiwKKyAqICAgICAgICJmb2xsb3dlcnNfY291bnQiOiAyCisgKiAgICAgfQorICogICB9CisgKiBdfTwvcHJlPgorICogVGhpcyBjb2RlIGVuY29kZXMgdGhlIGFib3ZlIHN0cnVjdHVyZTogPHByZT4gICB7QGNvZGUKKyAqICAgcHVibGljIHZvaWQgd3JpdGVKc29uU3RyZWFtKE91dHB1dFN0cmVhbSBvdXQsIExpc3Q8TWVzc2FnZT4gbWVzc2FnZXMpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgKiAgICAgSnNvbldyaXRlciB3cml0ZXIgPSBuZXcgSnNvbldyaXRlcihuZXcgT3V0cHV0U3RyZWFtV3JpdGVyKG91dCwgIlVURi04IikpOworICogICAgIHdyaXRlci5zZXRJbmRlbnRTcGFjZXMoNCk7CisgKiAgICAgd3JpdGVNZXNzYWdlc0FycmF5KHdyaXRlciwgbWVzc2FnZXMpOworICogICAgIHdyaXRlci5jbG9zZSgpOworICogICB9Cisg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2JqZWN0LiAqLworICAgIHByaXZhdGUgZmluYWwgV3JpdGVyIG91dDsKKworICAgIHByaXZhdGUgZmluYWwgTGlzdDxKc29uU2NvcGU+IHN0YWNrID0gbmV3IEFycmF5TGlzdDxKc29uU2NvcGU+KCk7CisgICAgeworICAgICAgICBzdGFjay5hZGQoSnNvblNjb3BlLkVNUFRZX0RPQ1VNRU5UKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBBIHN0cmluZyBjb250YWluaW5nIGEgZnVsbCBzZXQgb2Ygc3BhY2VzIGZvciBhIHNpbmdsZSBsZXZlbCBvZgorICAgICAqIGluZGVudGF0aW9uLCBvciBudWxsIGZvciBubyBwcmV0dHkgcHJpbnRpbmcuCisgICAgICovCisgICAgcHJpdmF0ZSBTdHJpbmcgaW5kZW50OworCisgICAgLyoqCisgICAgICogVGhlIG5hbWUvdmFsdWUgc2VwYXJhdG9yOyBlaXRoZXIgIjoiIG9yICI6ICIuCisgICAgICovCisgICAgcHJpdmF0ZSBTdHJpbmcgc2VwYXJhdG9yID0gIjoiOworCisgICAgLyoqCisgICAgICogQ3JlYXRlcyBhIG5ldyBpbnN0YW5jZSB0aGF0IHdyaXRlcyBhIEpTT04tZW5jb2RlZCBzdHJlYW0gdG8ge0Bjb2RlIG91dH0uCisgICAgICogRm9yIGJlc3QgcGVyZm9ybWFuY2UsIGVuc3VyZSB7QGxpbmsgV3JpdGVyfSBpcyBidWZmZXJlZDsgd3JhcHBpbmcgaW4KKyAgICAgKiB7QGxpbmsgamF2YS5pby5CdWZmZXJlZFdyaXRlciBCdWZmZXJlZFdyaXRlcn0gaWYgbmVjZXNzYXJ5LgorICAgICAqLworICAgIHB1YmxpYyBKc29uV3JpdGVyKFdyaXRlciBvdXQpIHsKKyAgICAgICAgaWYgKG91dCA9PSBudWxsKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgTnVsbFBvaW50ZXJFeGNlcHRpb24oIm91dCA9PSBudWxsIik7CisgICAgICAgIH0KKyAgICAgICAgdGhpcy5vdXQgPSBvdXQ7CisgICAgfQorCisgICAgLyoqCisgICAgICogU2V0cyB0aGUgaW5kZW50YXRpb24gc3RyaW5nIHRvIGJlIHJlcGVhdGVkIGZvciBlYWNoIGxldmVsIG9mIGluZGVudGF0aW9uCisgICAgICogaW4gdGhlIGVuY29kZWQgZG9jdW1lbnQuIElmIHtAY29kZSBpbmRlbnQuaXNFbXB0eSgpfSB0aGUgZW5jb2RlZCBkb2N1bWVudAorICAgICAqIHdpbGwgYmUgY29tcGFjdC4gT3RoZXJ3aXNlIHRoZSBlbmNvZGVkIGRvY3VtZW50IHdpbGwgYmUgbW9yZQorICAgICAqIGh1bWFuLXJlYWRhYmxlLgorICAgICAqCisgICAgICogQHBhcmFtIGluZGVudCBhIHN0cmluZyBjb250YWluaW5nIG9ubHkgd2hpdGVzcGFjZS4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBzZXRJbmRlbnQoU3RyaW5nIGluZGVudCkgeworICAgICAgICBpZiAoaW5kZW50LmlzRW1wdHkoKSkgeworICAgICAgICAgICAgdGhpcy5pbmRlbnQgPSBudWxsOworICAgICAgICAgICAgdGhpcy5zZXBhcmF0b3IgPSAiOiI7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICB0aGlzLmluZGVudCA9IGluZGVudDsKKyAgICAgICAgICAgIHRoaXMuc2VwYXJhdG9yID0gIjogIjsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIEJlZ2lucyBlbmNvZGluZyBhIG5ldyBhcnJheS4gRWFjaCBjYWxsIHRvIHRoaXMgbWV0aG9kIG11c3QgYmUgcGFpcmVkIHdpdGgKKyAgICAgKiBhIGNhbGwgdG8ge0BsaW5rICNlbmRBcnJheX0uCisgICAgICoKKyAgICAgKiBAcmV0dXJuIHRoaXMgd3JpdGVyLgorICAgICAqLworICAgIHB1YmxpYyBKc29uV3JpdGVyIGJlZ2luQXJyYXkoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICByZXR1cm4gb3BlbihKc29uU2NvcGUuRU1QVFlfQVJSQVksICJbIik7CisgICAgfQorCisgICAgLyoqCisgICAgICogRW5kcyBlbmNvZGluZyB0aGUgY3VycmVudCBhcnJheS4KKyAgICAgKgorICAgICAqIEByZXR1cm4gdGhpcyB3cml0ZXIuCisgICAgICovCisgICAgcHVibGljIEpzb25Xcml0ZXIgZW5kQXJyYXkoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICByZXR1cm4gY2xvc2UoSnNvblNjb3BlLkVNUFRZX0FSUkFZLCBKc29uU2NvcGUuTk9ORU1QVFlfQVJSQVksICJdIik7CisgICAgfQorCisgICAgLyoqCisgICAgICogQmVnaW5zIGVuY29kaW5nIGEgbmV3IG9iamVjdC4gRWFjaCBjYWxsIHRvIHRoaXMgbWV0aG9kIG11c3QgYmUgcGFpcmVkCisgICAgICogd2l0aCBhIGNhbGwgdG8ge0BsaW5rICNlbmRPYmplY3R9LgorICAgICAqCisgICAgICogQHJldHVybiB0aGlzIHdyaXRlci4KKyAgICAgKi8KKyAgICBwdWJsaWMgSnNvbldyaXRlciBiZWdpbk9iamVjdCgpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIHJldHVybiBvcGVuKEpzb25TY29wZS5FTVBUWV9PQkpFQ1QsICJ7Iik7CisgICAgfQorCisgICAgLyoqCisgICAgICogRW5kcyBlbmNvZGluZyB0aGUgY3VycmVudCBvYmplY3QuCisgICAgICoKKyAgICAgKiBAcmV0dXJuIHRoaXMgd3JpdGVyLgorICAgICAqLworICAgIHB1YmxpYyBKc29uV3JpdGVyIGVuZE9iamVjdCgpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIHJldHVybiBjbG9zZShKc29uU2NvcGUuRU1QVFlfT0JKRUNULCBKc29uU2NvcGUuTk9ORU1QVFlfT0JKRUNULCAifSIpOworICAgIH0KKworICAgIC8qKgorICAgICAqIEVudGVycyBhIG5ldyBzY29wZSBieSBh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2VCcmFja2V0KTsKKyAgICAgICAgcmV0dXJuIHRoaXM7CisgICAgfQorCisgICAgLyoqCisgICAgICogUmV0dXJucyB0aGUgdmFsdWUgb24gdGhlIHRvcCBvZiB0aGUgc3RhY2suCisgICAgICovCisgICAgcHJpdmF0ZSBKc29uU2NvcGUgcGVlaygpIHsKKyAgICAgICAgcmV0dXJuIHN0YWNrLmdldChzdGFjay5zaXplKCkgLSAxKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZXBsYWNlIHRoZSB2YWx1ZSBvbiB0aGUgdG9wIG9mIHRoZSBzdGFjayB3aXRoIHRoZSBnaXZlbiB2YWx1ZS4KKyAgICAgKi8KKyAgICBwcml2YXRlIHZvaWQgcmVwbGFjZVRvcChKc29uU2NvcGUgdG9wT2ZTdGFjaykgeworICAgICAgICBzdGFjay5zZXQoc3RhY2suc2l6ZSgpIC0gMSwgdG9wT2ZTdGFjayk7CisgICAgfQorCisgICAgLyoqCisgICAgICogRW5jb2RlcyB0aGUgcHJvcGVydHkgbmFtZS4KKyAgICAgKgorICAgICAqIEBwYXJhbSBuYW1lIHRoZSBuYW1lIG9mIHRoZSBmb3J0aGNvbWluZyB2YWx1ZS4gTWF5IG5vdCBiZSBudWxsLgorICAgICAqIEByZXR1cm4gdGhpcyB3cml0ZXIuCisgICAgICovCisgICAgcHVibGljIEpzb25Xcml0ZXIgbmFtZShTdHJpbmcgbmFtZSkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgaWYgKG5hbWUgPT0gbnVsbCkgeworICAgICAgICAgICAgdGhyb3cgbmV3IE51bGxQb2ludGVyRXhjZXB0aW9uKCJuYW1lID09IG51bGwiKTsKKyAgICAgICAgfQorICAgICAgICBiZWZvcmVOYW1lKCk7CisgICAgICAgIHN0cmluZyhuYW1lKTsKKyAgICAgICAgcmV0dXJuIHRoaXM7CisgICAgfQorCisgICAgLyoqCisgICAgICogRW5jb2RlcyB7QGNvZGUgdmFsdWV9LgorICAgICAqCisgICAgICogQHBhcmFtIHZhbHVlIHRoZSBsaXRlcmFsIHN0cmluZyB2YWx1ZSwgb3IgbnVsbCB0byBlbmNvZGUgYSBudWxsIGxpdGVyYWwuCisgICAgICogQHJldHVybiB0aGlzIHdyaXRlci4KKyAgICAgKi8KKyAgICBwdWJsaWMgSnNvbldyaXRlciB2YWx1ZShTdHJpbmcgdmFsdWUpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIGlmICh2YWx1ZSA9PSBudWxsKSB7CisgICAgICAgICAgICByZXR1cm4gbnVsbFZhbHVlKCk7CisgICAgICAgIH0KKyAgICAgICAgYmVmb3JlVmFsdWUoZmFsc2UpOworICAgICAgICBzdHJpbmcodmFsdWUpOworICAgICAgICByZXR1cm4gdGhpczsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBFbmNvZGVzIHtAY29kZSBudWxsfS4KKyAgICAgKgorICAgICAqIEByZXR1cm4gdGhpcyB3cml0ZXIuCisgICAgICovCisgICAgcHVibGljIEpzb25Xcml0ZXIgbnVsbFZhbHVlKCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgYmVmb3JlVmFsdWUoZmFsc2UpOworICAgICAgICBvdXQud3JpdGUoIm51bGwiKTsKKyAgICAgICAgcmV0dXJuIHRoaXM7CisgICAgfQorCisgICAgLyoqCisgICAgICogRW5jb2RlcyB7QGNvZGUgdmFsdWV9LgorICAgICAqCisgICAgICogQHJldHVybiB0aGlzIHdyaXRlci4KKyAgICAgKi8KKyAgICBwdWJsaWMgSnNvbldyaXRlciB2YWx1ZShib29sZWFuIHZhbHVlKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBiZWZvcmVWYWx1ZShmYWxzZSk7CisgICAgICAgIG91dC53cml0ZSh2YWx1ZSA/ICJ0cnVlIiA6ICJmYWxzZSIpOworICAgICAgICByZXR1cm4gdGhpczsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBFbmNvZGVzIHtAY29kZSB2YWx1ZX0uCisgICAgICoKKyAgICAgKiBAcGFyYW0gdmFsdWUgYSBmaW5pdGUgdmFsdWUuIE1heSBub3QgYmUge0BsaW5rIERvdWJsZSNpc05hTigpIE5hTnN9IG9yCisgICAgICogICAgIHtAbGluayBEb3VibGUjaXNJbmZpbml0ZSgpIGluZmluaXRpZXN9LgorICAgICAqIEByZXR1cm4gdGhpcyB3cml0ZXIuCisgICAgICovCisgICAgcHVibGljIEpzb25Xcml0ZXIgdmFsdWUoZG91YmxlIHZhbHVlKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBpZiAoRG91YmxlLmlzTmFOKHZhbHVlKSB8fCBEb3VibGUuaXNJbmZpbml0ZSh2YWx1ZSkpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oIk51bWVyaWMgdmFsdWVzIG11c3QgYmUgZmluaXRlLCBidXQgd2FzICIgKyB2YWx1ZSk7CisgICAgICAgIH0KKyAgICAgICAgYmVmb3JlVmFsdWUoZmFsc2UpOworICAgICAgICBvdXQuYXBwZW5kKERvdWJsZS50b1N0cmluZyh2YWx1ZSkpOworICAgICAgICByZXR1cm4gdGhpczsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBFbmNvZGVzIHtAY29kZSB2YWx1ZX0uCisgICAgICoKKyAgICAgKiBAcmV0dXJuIHRoaXMgd3JpdGVyLgorICAgICAqLworICAgIHB1YmxpYyBKc29uV3JpdGVyIHZhbHVlKGxvbmcgdmFsdWUpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIGJlZm9yZVZhbHVlKGZhbHNlKTsKKyAgICAgICAgb3V0LndyaXRlKExvbmcudG9TdHJpbmcodmFsdWUpKTsKKyAgICAgICAgcmV0dXJuIHRoaXM7CisgICAgfQorCisgICAgLyoqCisgICAgICogRW5zdXJlcyBhbGwgYnVmZmVyZWQgZGF0YSBpcyB3cml0dGVuIHRvIHRoZSB1bmRlcmx5aW5nIHt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XJhY3RlcnMgdGhhdCBtdXN0IGJlIGVzY2FwZWQ6CisgICAgICAgICAgICAgKiBxdW90YXRpb24gbWFyaywgcmV2ZXJzZSBzb2xpZHVzLCBhbmQgdGhlIGNvbnRyb2wgY2hhcmFjdGVycworICAgICAgICAgICAgICogKFUrMDAwMCB0aHJvdWdoIFUrMDAxRikuIgorICAgICAgICAgICAgICovCisgICAgICAgICAgICBzd2l0Y2ggKGMpIHsKKyAgICAgICAgICAgICAgICBjYXNlICciJzoKKyAgICAgICAgICAgICAgICBjYXNlICdcXCc6CisgICAgICAgICAgICAgICAgY2FzZSAnLyc6CisgICAgICAgICAgICAgICAgICAgIG91dC53cml0ZSgnXFwnKTsKKyAgICAgICAgICAgICAgICAgICAgb3V0LndyaXRlKGMpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgICAgIGNhc2UgJ1x0JzoKKyAgICAgICAgICAgICAgICAgICAgb3V0LndyaXRlKCJcXHQiKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICBjYXNlICdcYic6CisgICAgICAgICAgICAgICAgICAgIG91dC53cml0ZSgiXFxiIik7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgY2FzZSAnXG4nOgorICAgICAgICAgICAgICAgICAgICBvdXQud3JpdGUoIlxcbiIpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgICAgIGNhc2UgJ1xyJzoKKyAgICAgICAgICAgICAgICAgICAgb3V0LndyaXRlKCJcXHIiKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICBjYXNlICdcZic6CisgICAgICAgICAgICAgICAgICAgIG91dC53cml0ZSgiXFxmIik7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgaWYgKGMgPD0gMHgxRikgeworICAgICAgICAgICAgICAgICAgICAgICAgb3V0LndyaXRlKFN0cmluZy5mb3JtYXQoIlxcdSUwNHgiLCAoaW50KSBjKSk7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICBvdXQud3JpdGUoYyk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisKKyAgICAgICAgfQorICAgICAgICBvdXQud3JpdGUoIlwiIik7CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIG5ld2xpbmUoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBpZiAoaW5kZW50ID09IG51bGwpIHsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorCisgICAgICAgIG91dC53cml0ZSgiXG4iKTsKKyAgICAgICAgZm9yIChpbnQgaSA9IDE7IGkgPCBzdGFjay5zaXplKCk7IGkrKykgeworICAgICAgICAgICAgb3V0LndyaXRlKGluZGVudCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBJbnNlcnRzIGFueSBuZWNlc3Nhcnkgc2VwYXJhdG9ycyBhbmQgd2hpdGVzcGFjZSBiZWZvcmUgYSBuYW1lLiBBbHNvCisgICAgICogYWRqdXN0cyB0aGUgc3RhY2sgdG8gZXhwZWN0IHRoZSBuYW1lJ3MgdmFsdWUuCisgICAgICovCisgICAgcHJpdmF0ZSB2b2lkIGJlZm9yZU5hbWUoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBKc29uU2NvcGUgY29udGV4dCA9IHBlZWsoKTsKKyAgICAgICAgaWYgKGNvbnRleHQgPT0gSnNvblNjb3BlLk5PTkVNUFRZX09CSkVDVCkgeyAvLyBmaXJzdCBpbiBvYmplY3QKKyAgICAgICAgICAgIG91dC53cml0ZSgnLCcpOworICAgICAgICB9IGVsc2UgaWYgKGNvbnRleHQgIT0gSnNvblNj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W4gYXJyYXkgb3IgYW4gb2JqZWN0LiIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICByZXBsYWNlVG9wKEpzb25TY29wZS5OT05FTVBUWV9ET0NVTUVOVCk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgIGNhc2UgRU1QVFlfQVJSQVk6IC8vIGZpcnN0IGluIGFycmF5CisgICAgICAgICAgICAgICAgcmVwbGFjZVRvcChKc29uU2NvcGUuTk9ORU1QVFlfQVJSQVkpOworICAgICAgICAgICAgICAgIG5ld2xpbmUoKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgY2FzZSBOT05FTVBUWV9BUlJBWTogLy8gYW5vdGhlciBpbiBhcnJheQorICAgICAgICAgICAgICAgIG91dC5hcHBlbmQoJywnKTsKKyAgICAgICAgICAgICAgICBuZXdsaW5lKCk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgIGNhc2UgREFOR0xJTkdfTkFNRTogLy8gdmFsdWUgZm9yIG5hbWUKKyAgICAgICAgICAgICAgICBvdXQuYXBwZW5kKHNlcGFyYXRvcik7CisgICAgICAgICAgICAgICAgcmVwbGFjZVRvcChKc29uU2NvcGUuTk9ORU1QVFlfT0JKRUNUKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgY2FzZSBOT05FTVBUWV9ET0NVTUVOVDoKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKAorICAgICAgICAgICAgICAgICAgICAgICAgIkpTT04gbXVzdCBoYXZlIG9ubHkgb25lIHRvcC1sZXZlbCB2YWx1ZS4iKTsKKworICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJOZXN0aW5nIHByb2JsZW06ICIgKyBzdGFjayk7CisgICAgICAgIH0KKyAgICB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ld3BvcnQoaW50IHdpZHRoLCBpbnQgaGVpZ2h0KSB7CisgICAgICAgIG1XaWR0aCA9IHdpZHRoOworICAgICAgICBtSGVpZ2h0ID0gaGVpZ2h0OworCisgICAgICAgIG5TZXRWaWV3cG9ydChtUmVuZGVyZXIsIHdpZHRoLCBoZWlnaHQpOworICAgIH0KKyAgICAKKyAgICBwcml2YXRlIG5hdGl2ZSB2b2lkIG5TZXRWaWV3cG9ydChpbnQgcmVuZGVyZXIsIGludCB3aWR0aCwgaW50IGhlaWdodCk7CisKKyAgICB2b2lkIG9uUHJlRHJhdygpIHsKKyAgICAgICAgblByZXBhcmUobVJlbmRlcmVyKTsKKyAgICB9CisgICAgCisgICAgcHJpdmF0ZSBuYXRpdmUgdm9pZCBuUHJlcGFyZShpbnQgcmVuZGVyZXIpOworCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIGJvb2xlYW4gYWNxdWlyZUNvbnRleHQoKSB7CisgICAgICAgIGlmICghbUNvbnRleHRMb2NrZWQpIHsKKyAgICAgICAgICAgIG5BY3F1aXJlQ29udGV4dChtUmVuZGVyZXIpOworICAgICAgICAgICAgbUNvbnRleHRMb2NrZWQgPSB0cnVlOworICAgICAgICB9CisgICAgICAgIHJldHVybiBtQ29udGV4dExvY2tlZDsKKyAgICB9CisKKyAgICBwcml2YXRlIG5hdGl2ZSB2b2lkIG5BY3F1aXJlQ29udGV4dChpbnQgcmVuZGVyZXIpOworCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgcmVsZWFzZUNvbnRleHQoKSB7CisgICAgICAgIGlmIChtQ29udGV4dExvY2tlZCkgeworICAgICAgICAgICAgblJlbGVhc2VDb250ZXh0KG1SZW5kZXJlcik7CisgICAgICAgICAgICBtQ29udGV4dExvY2tlZCA9IGZhbHNlOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSBuYXRpdmUgdm9pZCBuUmVsZWFzZUNvbnRleHQoaW50IHJlbmRlcmVyKTsKKworICAgIC8v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lbnRlciwKKyAgICAgICAgICAgIFBhaW50IHBhaW50KSB7CisgICAgICAgIHRocm93IG5ldyBVbnN1cHBvcnRlZE9wZXJhdGlvbkV4Y2VwdGlvbigpOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIGRyYXdBUkdCKGludCBhLCBpbnQgciwgaW50IGcsIGludCBiKSB7CisgICAgICAgIGRyYXdDb2xvcigoYSAmIDB4RkYpIDw8IDI0IHwgKHIgJiAweEZGKSA8PCAxNiB8IChnICYgMHhGRikgPDwgOCB8IChiICYgMHhGRikpOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIGRyYXdQYXRjaChCaXRtYXAgYml0bWFwLCBieXRlW10gY2h1bmtzLCBSZWN0RiBkc3QsIFBhaW50IHBhaW50KSB7CisgICAgICAgIC8vIFNoYWRlcnMgYXJlIGlnbm9yZWQgd2hlbiBkcmF3aW5nIHBhdGNoZXMKKyAgICAgICAgYm9vbGVhbiBoYXNDb2xvckZpbHRlciA9IHBhaW50ICE9IG51bGwgJiYgc2V0dXBDb2xvckZpbHRlcihwYWludCk7CisgICAgICAgIGZpbmFsIGludCBuYXRpdmVQYWludCA9IHBhaW50ID09IG51bGwgPyAwIDogcGFpbnQubU5hdGl2ZVBhaW50OworICAgICAgICBuRHJhd1BhdGNoKG1SZW5kZXJlciwgYml0bWFwLm1OYXRpdmVCaXRtYXAsIGNodW5rcywgZHN0LmxlZnQsIGRzdC50b3AsCisgICAgICAgICAgICAgICAgZHN0LnJpZ2h0LCBkc3QuYm90dG9tLCBuYXRpdmVQYWludCk7CisgICAgICAgIGlmIChoYXNDb2xvckZpbHRlcikgblJlc2V0TW9kaWZpZXJzKG1SZW5kZXJlcik7CisgICAgfQorCisgICAgcHJpdmF0ZSBuYXRpdmUgdm9pZCBuRHJhd1BhdGNoKGludCByZW5kZXJlciwgaW50IGJpdG1hcCwgYnl0ZVtdIGNodW5rcywgZmxvYXQgbGVmdCwg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UJpdG1hcCwgeCwgeSwgbmF0aXZlUGFpbnQpOworICAgICAgICBiLnJlY3ljbGUoKTsKKyAgICAgICAgaWYgKGhhc0NvbG9yRmlsdGVyKSBuUmVzZXRNb2RpZmllcnMobVJlbmRlcmVyKTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCBkcmF3Qml0bWFwKGludFtdIGNvbG9ycywgaW50IG9mZnNldCwgaW50IHN0cmlkZSwgaW50IHgsIGludCB5LAorICAgICAgICAgICAgaW50IHdpZHRoLCBpbnQgaGVpZ2h0LCBib29sZWFuIGhhc0FscGhhLCBQYWludCBwYWludCkgeworICAgICAgICAvLyBTaGFkZXJzIGFyZSBpZ25vcmVkIHdoZW4gZHJhd2luZyBiaXRtYXBzCisgICAgICAgIGRyYXdCaXRtYXAoY29sb3JzLCBvZmZzZXQsIHN0cmlkZSwgKGZsb2F0KSB4LCAoZmxvYXQpIHksIHdpZHRoLCBoZWlnaHQsIGhhc0FscGhhLCBwYWludCk7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgZHJhd0JpdG1hcE1lc2goQml0bWFwIGJpdG1hcCwgaW50IG1lc2hXaWR0aCwgaW50IG1lc2hIZWlnaHQsIGZsb2F0W10gdmVydHMsCisgICAgICAgICAgICBpbnQgdmVydE9mZnNldCwgaW50W10gY29sb3JzLCBpbnQgY29sb3JPZmZzZXQsIFBhaW50IHBhaW50KSB7CisgICAgICAgIC8vIFRPRE86IEltcGxlbWVudAorICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIGRyYXdDaXJjbGUoZmxvYXQgY3gsIGZsb2F0IGN5LCBmbG9hdCByYWRpdXMsIFBhaW50IHBhaW50KSB7CisgICAgICAgIHRocm93IG5ldyBVbnN1cHBvcnRlZE9wZXJhdGlvbkV4Y2VwdGlvbigpOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIGR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ICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCBkcmF3T3ZhbChSZWN0RiBvdmFsLCBQYWludCBwYWludCkgeworICAgICAgICB0aHJvdyBuZXcgVW5zdXBwb3J0ZWRPcGVyYXRpb25FeGNlcHRpb24oKTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCBkcmF3UGFpbnQoUGFpbnQgcGFpbnQpIHsKKyAgICAgICAgZmluYWwgUmVjdCByID0gbUNsaXBCb3VuZHM7CisgICAgICAgIG5HZXRDbGlwQm91bmRzKG1SZW5kZXJlciwgcik7CisgICAgICAgIGRyYXdSZWN0KHIubGVmdCwgci50b3AsIHIucmlnaHQsIHIuYm90dG9tLCBwYWludCk7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgZHJhd1BhdGgoUGF0aCBwYXRoLCBQYWludCBwYWludCkgeworICAgICAgICBib29sZWFuIGhhc01vZGlmaWVyID0gc2V0dXBNb2RpZmllcnMocGFpbnQpOworICAgICAgICBpZiAocGF0aC5pc1NpbXBsZVBhdGgpIHsKKyAgICAgICAgICAgIGlmIChwYXRoLnJlY3RzICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBuRHJhd1JlY3RzKG1SZW5kZXJlciwgcGF0aC5yZWN0cy5tTmF0aXZlUmVnaW9uLCBwYWludC5tTmF0aXZlUGFpbnQpOworICAgICAgICAgICAgfQorICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgbkRyYXdQYXRoKG1SZW5kZXJlciwgcGF0aC5tTmF0aXZlUGF0aCwgcGFpbnQubU5hdGl2ZVBhaW50KTsKKyAgICAgICAgfQorICAgICAgICBpZiAoaGFzTW9kaWZpZXIpIG5SZXNldE1vZGlmaWVycyhtUmVuZGVyZXIpOworICAgIH0KKworICAgIHByaXZhdGUgbmF0aXZlIHZvaWQgbkRyYXdQYXRoKGludCByZW5kZXJlciwgaW50IHBhdGgsIGludCBwYWludCk7CisgICAgcHJpdmF0ZSBuYXRpdmUgdm9pZCBuRHJhd1JlY3RzKGludCByZW5kZXJlciwgaW50IHJlZ2lvbiwgaW50IHBhaW50KTsKKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIGRyYXdQaWN0dXJlKFBpY3R1cmUgcGljdHVyZSkgeworICAgICAgICB0aHJvdyBuZXcgVW5zdXBwb3J0ZWRPcGVyYXRpb25FeGNlcHRpb24oKTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCBkcmF3UGljdHVyZShQaWN0dXJlIHBpY3R1cmUsIFJlY3QgZHN0KSB7CisgICAgICAgIHRocm93IG5ldyBVbnN1cHBvcnRlZE9wZXJhdGlvbkV4Y2VwdGlvbigpOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIGRyYXdQaWN0dXJlKFBpY3R1cmUgcGljdHVyZSwgUmVjdEYgZHN0KSB7CisgICAgICAgIHRocm93IG5ldyBVbnN1cHBvcnRlZE9wZXJhdGlvbkV4Y2VwdGlvbigpOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIGRyYXdQb2ludChmbG9hdCB4LCBmbG9hdCB5LCBQYWludCBwYWludCkgeworICAgICAgICBtUG9pbnRbMF0gPSB4OworICAgICAgICBtUG9pbnRbMV0gPSB5OworICAgICAgICBkcmF3UG9pbnRzKG1Qb2ludCwgMCwgMSwgcGFpbnQpOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIGRyYXdQb2ludHMoZmxvYXRbXSBwdHMsIGludCBvZmZzZXQsIGludCBjb3VudCwgUGFpbnQgcGFpbnQpIHsKKyAgICAgICAgLy8gVE9ETzogSW1wbGVtZW50CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgZHJhd1BvaW50cyhmbG9hdFtdIHB0cywgUGFpbnQgcGFpbnQpIHsKKy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pZCBkcmF3UmVjdChSZWN0IHIsIFBhaW50IHBhaW50KSB7CisgICAgICAgIGRyYXdSZWN0KHIubGVmdCwgci50b3AsIHIucmlnaHQsIHIuYm90dG9tLCBwYWludCk7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgZHJhd1JlY3QoUmVjdEYgciwgUGFpbnQgcGFpbnQpIHsKKyAgICAgICAgZHJhd1JlY3Qoci5sZWZ0LCByLnRvcCwgci5yaWdodCwgci5ib3R0b20sIHBhaW50KTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCBkcmF3UkdCKGludCByLCBpbnQgZywgaW50IGIpIHsKKyAgICAgICAgZHJhd0NvbG9yKDB4RkYwMDAwMDAgfCAociAmIDB4RkYpIDw8IDE2IHwgKGcgJiAweEZGKSA8PCA4IHwgKGIgJiAweEZGKSk7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgZHJhd1JvdW5kUmVjdChSZWN0RiByZWN0LCBmbG9hdCByeCwgZmxvYXQgcnksIFBhaW50IHBhaW50KSB7CisgICAgICAgIC8vIFRPRE86IEltcGxlbWVudAorICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIGRyYXdUZXh0KGNoYXJbXSB0ZXh0LCBpbnQgaW5kZXgsIGludCBjb3VudCwgZmxvYXQgeCwgZmxvYXQgeSwgUGFpbnQgcGFpbnQpIHsKKyAgICAgICAgaWYgKChpbmRleCB8IGNvdW50IHwgKGluZGV4ICsgY291bnQpIHwgKHRleHQubGVuZ3RoIC0gaW5kZXggLSBjb3VudCkpIDwgMCkgeworICAgICAgICAgICAgdGhyb3cgbmV3IEluZGV4T3V0T2ZCb3VuZHNFeGNlcHRpb24oKTsKKyAgICAgICAgfQorCisgICAgICAgIGJvb2xlYW4gaGFzTW9kaWZpZXIgPSBzZXR1cE1vZGlmaWVycyhwYWludCk7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBuRHJhd1RleHQobVJlbmRlcmVyLCB0ZXh0LCBpbmRleCwgY291bnQsIHgsIHksIHBhaW50Lm1CaWRpRmxhZ3MsIHBhaW50Lm1OYXRpdmVQYWludCk7CisgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICBpZiAoaGFzTW9kaWZpZXIpIG5SZXNldE1vZGlmaWVycyhtUmVuZGVyZXIpOworICAgICAgICB9CisgICAgfQorICAgIAorICAgIHByaXZhdGUgbmF0aXZlIHZvaWQgbkRyYXdUZXh0KGludCByZW5kZXJlciwgY2hhcltdIHRleHQsIGludCBpbmRleCwgaW50IGNvdW50LCBmbG9hdCB4LCBmbG9hdCB5LAorICAgICAgICAgICAgaW50IGJpZGlGbGFncywgaW50IHBhaW50KTsKKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIGRyYXdUZXh0KENoYXJTZXF1ZW5jZSB0ZXh0LCBpbnQgc3RhcnQsIGludCBlbmQsIGZsb2F0IHgsIGZsb2F0IHksIFBhaW50IHBhaW50KSB7CisgICAgICAgIGJvb2xlYW4gaGFzTW9kaWZpZXIgPSBzZXR1cE1vZGlmaWVycyhwYWludCk7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBpZiAodGV4dCBpbnN0YW5jZW9mIFN0cmluZyB8fCB0ZXh0IGluc3RhbmNlb2YgU3Bhbm5lZFN0cmluZyB8fAorICAgICAgICAgICAgICAgICAgICB0ZXh0IGluc3RhbmNlb2YgU3Bhbm5hYmxlU3RyaW5nKSB7CisgICAgICAgICAgICAgICAgbkRyYXdUZXh0KG1SZW5kZXJlciwgdGV4dC50b1N0cmluZygpLCBzdGFydCwgZW5kLCB4LCB5LCBwYWludC5tQmlkaUZsYWdzLAorICAgICAgICAgICAgICAgICAgICAgICAgcGFpbnQubU5hdGl2ZVBhaW50KTsKKyAgICAgICAgICAgIH0gZWxzZSBpZiAodGV4dCBpbnN0YW5jZW9mIEdyYXBoaWNzT3BlcmF0aW9ucykgeworICAgICAgICAgICAgICAgICgoR3JhcGhpY3NPcGVyYXRpb25zKSB0ZXh0KS5kcmF3VGV4dCh0aGlzLCBzdGFydCwgZW5kLCB4LCB5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFpbnQpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBjaGFyW10gYnVmID0gVGVtcG9yYXJ5QnVmZmVyLm9idGFpbihlbmQgLSBzdGFydCk7CisgICAgICAgICAgICAgICAgVGV4dFV0aWxzLmdldENoYXJzKHRleHQsIHN0YXJ0LCBlbmQsIGJ1ZiwgMCk7CisgICAgICAgICAgICAgICAgbkRyYXdUZXh0KG1SZW5kZXJlciwgYnVmLCAwLCBlbmQgLSBzdGFydCwgeCwgeSwgcGFpbnQubUJpZGlGbGFncywgcGFpbnQubU5hdGl2ZVBhaW50KTsKKyAgICAgICAgICAgICAgICBUZW1wb3JhcnlCdWZmZXIucmVjeWNsZShidWYpOworICAgICAgICAgICAgfQorICAgICAgICB9IGZpbmFsbHkgeworICAgICAgICAgICAgaWYgKGhhc01vZGlmaWVyKSBuUmVzZXRNb2RpZmllcnMobVJlbmRlcmVyKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIGRyYXdUZXh0KFN0cmluZyB0ZXh0LCBpbnQgc3RhcnQsIGludCBlbmQsIGZsb2F0IHgsIGZsb2F0IHksIFBhaW50IHBhaW50KSB7CisgICAgICAgIGlmICgoc3RhcnQgfCBlbmQgfCAoZW5kIC0gc3RhcnQpIHwgKHRleHQubGVuZ3RoKCkgLSBlbmQpKSA8IDApIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBJbmRleE91dE9mQm91bmRzRXhjZXB0aW9uKCk7CisgICAgICAgIH0KKworICAgICAgICBib29sZWFuIGhhc01vZGlmaWVyID0gc2V0dXBNb2RpZmllcnMocGFpbnQpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgbkRyYXdUZXh0KG1SZW5kZXJlciwgdGV4dCwgc3RhcnQsIGVuZCwgeCwgeSwgcGFpbnQubUJpZGlGbGFncywgcGFpbnQubU5hdGl2ZVBhaW50KTsKKyAgICAgICAgfSBmaW5hbGx5IHsKKyAgICAgICAgICAgIGlmIChoYXNNb2RpZmllcikgblJlc2V0TW9kaWZpZXJzKG1SZW5kZXJlcik7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIG5hdGl2ZSB2b2lkIG5EcmF3VGV4dChpbnQgcmVuZGVyZXIsIFN0cmluZyB0ZXh0LCBpbnQgc3RhcnQsIGludCBlbmQsIGZsb2F0IHgsIGZsb2F0IHksCisgICAgICAgICAgICBpbnQgYmlkaUZsYWdzLCBpbnQgcGFpbnQpOworCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgZHJhd1RleHQoU3RyaW5nIHRleHQsIGZsb2F0IHgsIGZsb2F0IHksIFBhaW50IHBhaW50KSB7CisgICAgICAgIGJvb2xlYW4gaGFzTW9kaWZpZXIgPSBzZXR1cE1vZGlmaWVycyhwYWludCk7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBuRHJhd1RleHQobVJlbmRlcmVyLCB0ZXh0LCAwLCB0ZXh0Lmxlbmd0aCgpLCB4LCB5LCBwYWludC5tQmlkaUZsYWdzLAorICAgICAgICAgICAgICAgICAgICBwYWludC5tTmF0aXZlUGFpbnQpOworICAgICAgICB9IGZpbmFsbHkgeworICAgICAgICAgICAgaWYgKGhhc01vZGlmaWVyKSBuUmVzZXRNb2RpZmllcnMobVJlbmRlcmVyKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIGRyYXdUZXh0T25QYXRoKGNoYXJbXSB0ZXh0LCBpbnQgaW5kZXgsIGludCBjb3VudCwgUGF0aCBwYXRoLCBmbG9hdCBoT2Zmc2V0LAorICAgICAgICAgICAgZmxvYXQgdk9mZnNldCwgUGFpbnQgcGFpbnQpIHsKKyAgICAgICAgdGhyb3cgbmV3IFVuc3VwcG9ydGVkT3BlcmF0aW9uRXhjZXB0aW9uKCk7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgZHJhd1RleHRPblBhdGgoU3RyaW5nIHRleHQsIFBhdGggcGF0aCwgZmxvYXQgaE9mZnNldCwgZmxvYXQgdk9mZnNldCwgUGFpbnQgcGFpbnQpIHsKKyAgICAgICAgdGhyb3cgbmV3IFVuc3VwcG9ydGVkT3BlcmF0aW9uRXhjZXB0aW9uKCk7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgZHJhd1RleHRSdW4oY2hhcltdIHRleHQsIGludCBpbmRleCwgaW50IGNvdW50LCBpbnQgY29udGV4dEluZGV4LCBpbnQgY29udGV4dENvdW50LAorICAgICAgICAgICAgZmxvYXQgeCwgZmxvYXQgeSwgaW50IGRpciwgUGFpbnQgcGFpbnQpIHsKKyAgICAgICAgaWYgKChpbmRleCB8IGNvdW50IHwgdGV4dC5sZW5ndGggLSBpbmRleCAtIGNvdW50KSA8IDApIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBJbmRleE91dE9mQm91bmRzRXhjZXB0aW9uKCk7CisgICAgICAgIH0KKyAgICAgICAgaWYgKGRpciAhPSBESVJFQ1RJT05fTFRSICYmIGRpciAhPSBESVJFQ1RJT05fUlRMKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJVbmtub3duIGRpcmVjdGlvbjogIiArIGRpcik7CisgICAgICAgIH0KKworICAgICAgICBib29sZWFuIGhhc01vZGlmaWVyID0gc2V0dXBNb2RpZmllcnMocGFpbnQpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgbkRyYXdUZXh0UnVuKG1SZW5kZXJlciwgdGV4dCwgaW5kZXgsIGNvdW50LCBjb250ZXh0SW5kZXgsIGNvbnRleHRDb3VudCwgeCwgeSwgZGlyLAorICAgICAgICAgICAgICAgICAgICBwYWludC5tTmF0aXZlUGFpbnQpOworICAgICAgICB9IGZpbmFsbHkgeworICAgICAgICAgICAgaWYgKGhhc01vZGlmaWVyKSBuUmVzZXRNb2RpZmllcnMobVJlbmRlcmVyKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgbmF0aXZlIHZvaWQgbkRyYXdUZXh0UnVuKGludCByZW5kZXJlciwgY2hhcltdIHRleHQsIGludCBpbmRleCwgaW50IGNvdW50LAorICAgICAgICAgICAgaW50IGNvbnRleHRJbmRleCwgaW50IGNvbnRleHRDb3VudCwgZmxvYXQgeCwgZmxvYXQgeSwgaW50IGRpciwgaW50IG5hdGl2ZVBhaW50KTsKKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIGRyYXdUZXh0UnVuKENoYXJTZXF1ZW5jZSB0ZXh0LCBpbnQgc3RhcnQsIGludCBlbmQsIGludCBjb250ZXh0U3RhcnQsIGludCBjb250ZXh0RW5kLAorICAgICAgICAgICAgZmxvYXQgeCwgZmxvYXQgeSwgaW50IGRpciwgUGFpbnQgcGFpbnQpIHsKKyAgICAgICAgaWYgKChzdGFydCB8IGVuZCB8IGVuZCAtIHN0YXJ0IHwgdGV4dC5sZW5ndGgoKSAtIGVuZCkgPCAwKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgSW5kZXhPdXRPZkJvdW5kc0V4Y2VwdGlvbigpOworICAgICAgICB9CisKKyAgICAgICAgYm9vbGVhbiBoYXNNb2RpZmllciA9IHNldHVwTW9kaWZpZXJzKHBhaW50KTsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIGludCBmbGFncyA9IGRpciA9PSAwID8gMCA6IDE7CisgICAgICAgICAgICBpZiAodGV4dCBpbnN0YW5jZW9mIFN0cmluZyB8fCB0ZXh0IGluc3RhbmNlb2YgU3Bhbm5lZFN0cmluZyB8fAorICAgICAgICAgICAgICAgICAgICB0ZXh0IGluc3RhbmNlb2YgU3Bhbm5hYmxlU3RyaW5nKSB7CisgICAgICAgICAgICAgICAgbkRyYXdUZXh0UnVuKG1SZW5kZXJlciwgdGV4dC50b1N0cmluZygpLCBzdGFydCwgZW5kLCBjb250ZXh0U3RhcnQsCisgICAgICAgICAgICAgICAgICAgICAgICBjb250ZXh0RW5kLCB4LCB5LCBmbGFncywgcGFpbnQubU5hdGl2ZVBhaW50KTsKKyAgICAgICAgICAgIH0gZWxzZSBpZiAodGV4dCBpbnN0YW5jZW9mIEdyYXBoaWNzT3BlcmF0aW9ucykgeworICAgICAgICAgICAgICAgICgoR3JhcGhpY3NPcGVyYXRpb25zKSB0ZXh0KS5kcmF3VGV4dFJ1bih0aGlzLCBzdGFydCwgZW5kLAorICAgICAgICAgICAgICAgICAgICAgICAgY29udGV4dFN0YXJ0LCBjb250ZXh0RW5kLCB4LCB5LCBmbGFncywgcGFpbnQpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBpbnQgY29udGV4dExlbiA9IGNvbnRleHRFbmQgLSBjb250ZXh0U3RhcnQ7CisgICAgICAgICAgICAgICAgaW50IGxlbiA9IGVuZCAtIHN0YXJ0OworICAgICAgICAgICAgICAgIGNoYXJbXSBidWYgPSBUZW1wb3JhcnlCdWZmZXIub2J0YWluKGNvbnRleHRMZW4pOworICAgICAgICAgICAgICAgIFRleHRVdGlscy5nZXRDaGFycyh0ZXh0LCBjb250ZXh0U3RhcnQsIGNvbnRleHRFbmQsIGJ1ZiwgMCk7CisgICAgICAgICAgICAgICAgbkRyYXdUZXh0UnVuKG1SZW5kZXJlciwgYnVmLCBzdGFydCAtIGNvbnRleHRTdGFydCwgbGVuLCAwLCBjb250ZXh0TGVuLAorICAgICAgICAgICAgICAgICAgICAgICAgeCwgeSwgZmxhZ3MsIHBhaW50Lm1OYXRpdmVQYWludCk7CisgICAgICAgICAgICAgICAgVGVtcG9yYXJ5QnVmZmVyLnJlY3ljbGUoYnVmKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBmaW5hbGx5IHsKKyAgICAgICAgICAgIGlmIChoYXNNb2RpZmllcikgblJlc2V0TW9kaWZpZXJzKG1SZW5kZXJlcik7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIG5hdGl2ZSB2b2lkIG5EcmF3VGV4dFJ1bihpbnQgcmVuZGVyZXIsIFN0cmluZyB0ZXh0LCBpbnQgc3RhcnQsIGludCBlbmQsCisgICAgICAgICAgICBpbnQgY29udGV4dFN0YXJ0LCBpbnQgY29udGV4dEVuZCwgZmxvYXQgeCwgZmxvYXQgeSwgaW50IGZsYWdzLCBpbnQgbmF0aXZlUGFpbnQpOworCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgZHJhd1ZlcnRpY2VzKFZlcnRleE1vZGUgbW9kZSwgaW50IHZlcnRleENvdW50LCBmbG9hdFtdIHZlcnRzLCBpbnQgdmVydE9mZnNldCwKKyAgICAgICAgICAgIGZsb2F0W10gdGV4cywgaW50IHRleE9mZnNldCwgaW50W10gY29sb3JzLCBpbnQgY29sb3JPZmZzZXQsIHNob3J0W10gaW5kaWNlcywKKyAgICAgICAgICAgIGludCBpbmRleE9mZnNldCwgaW50IGluZGV4Q291bnQsIFBhaW50IHBhaW50KSB7CisgICAgICAgIC8vIFRPRE86IEltcGxlbWVudAorICAgIH0KKworICAgIHByaXZhdGUgYm9vbGVhbiBzZXR1cE1vZGlmaWVycyhQYWludCBwYWludCkgeworICAgICAgICBib29sZWFuIGhhc01vZGlmaWVyID0gZmFsc2U7CisKKyAgICAgICAgaWYgKHBhaW50Lmhhc1NoYWRvdykgeworICAgICAgICAgICAgblNldHVwU2hhZG93KG1SZW5kZXJlciwgcGFpbnQuc2hhZG93UmFkaXVzLCBwYWludC5zaGFkb3dEeCwgcGFpbnQuc2hhZG93RHksCisgICAgICAgICAgICAgICAgICAgIHBhaW50LnNoYWRvd0NvbG9yKTsKKyAgICAgICAgICAgIGhhc01vZGlmaWVyID0gdHJ1ZTsKKyAgICAgICAgfQorCisgICAgICAgIGZpbmFsIFNoYWRlciBzaGFkZXIgPSBwYWludC5nZXRTaGFkZXIoKTsKKyAgICAgICAgaWYgKHNoYWRlciAhPSBudWxsKSB7CisgICAgICAgICAgICBuU2V0dXBTaGFkZXIobVJlbmRlcmVyLCBzaGFkZXIubmF0aXZlX3NoYWRlcik7CisgICAgICAgICAgICBoYXNNb2RpZmllciA9IHRydWU7CisgICAgICAgIH0KKworICAgICAgICBmaW5hbCBDb2xvckZpbHRlciBmaWx0ZXIgPSBwYWludC5nZXRDb2xvckZpbHRlcigpOworICAgICAgICBpZiAoZmlsdGVyICE9IG51bGwpIHsKKyAgICAgICAgICAgIG5TZXR1cENvbG9yRmlsdGVyKG1SZW5kZXJlciwgZmlsdGVyLm5hdGl2ZUNvbG9yRmlsdGVyKTsKKyAgICAgICAgICAgIGhhc01vZGlmaWVyID0gdHJ1ZTsKKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiBoYXNNb2RpZmllcjsKKyAgICB9CisKKyAgICBwcml2YXRlIGJvb2xlYW4gc2V0dXBDb2xvckZpbHRlcihQYWludCBwYWludCkgeworICAgICAgICBmaW5hbCBDb2xvckZpbHRlciBmaWx0ZXIgPSBwYWludC5nZXRDb2xvckZpbHRlcigpOworICAgICAgICBpZiAoZmlsdGVyICE9IG51bGwpIHsKKyAgICAgICAgICAgIG5TZXR1cENvbG9yRmlsdGVyKG1SZW5kZXJlciwgZmlsdGVyLm5hdGl2ZUNvbG9yRmlsdGVyKTsKKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9CisgICAgICAgIHJldHVybiBmYWxzZTsgICAgICAgIAorICAgIH0KKyAgICAKKyAgICBwcml2YXRlIG5hdGl2ZSB2b2lkIG5TZXR1cFNoYWRlcihpbnQgcmVuZGVyZXIsIGludCBzaGFkZXIpOworICAgIHByaXZhdGUgbmF0aXZlIHZvaWQgblNld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aWR0aCwgaW50IGhlaWdodCwgVmlldy5BdHRhY2hJbmZvIGF0dGFjaEluZm8sCisgICAgICAgICAgICBTdXJmYWNlSG9sZGVyIGhvbGRlcikgeworICAgICAgICBpZiAoaXNSZXF1ZXN0ZWQoKSkgeworICAgICAgICAgICAgLy8gV2UgbG9zdCB0aGUgZ2wgY29udGV4dCwgc28gcmVjcmVhdGUgaXQuCisgICAgICAgICAgICBpZiAoIWlzRW5hYmxlZCgpKSB7CisgICAgICAgICAgICAgICAgaWYgKGluaXRpYWxpemUoaG9sZGVyKSkgeworICAgICAgICAgICAgICAgICAgICBzZXR1cCh3aWR0aCwgaGVpZ2h0KTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0gICAgICAgIAorICAgIH0KKworICAgIC8qKgorICAgICAqIENyZWF0ZXMgYSBoYXJkd2FyZSByZW5kZXJlciB1c2luZyBPcGVuR0wuCisgICAgICogCisgICAgICogQHBhcmFtIGdsVmVyc2lvbiBUaGUgdmVyc2lvbiBvZiBPcGVuR0wgdG8gdXNlICgxIGZvciBPcGVuR0wgMSwgMTEgZm9yIE9wZW5HTCAxLjEsIGV0Yy4pCisgICAgICogQHBhcmFtIHRyYW5zbHVjZW50IFRydWUgaWYgdGhlIHN1cmZhY2UgaXMgdHJhbnNsdWNlbnQsIGZhbHNlIG90aGVyd2lzZQorICAgICAqIAorICAgICAqIEByZXR1cm4gQSBoYXJkd2FyZSByZW5kZXJlciBiYWNrZWQgYnkgT3BlbkdMLgorICAgICAqLworICAgIHN0YXRpYyBIYXJkd2FyZVJlbmRlcmVyIGNyZWF0ZUdsUmVuZGVyZXIoaW50IGdsVmVyc2lvbiwgYm9vbGVhbiB0cmFuc2x1Y2VudCkgeworICAgICAgICBzd2l0Y2ggKGdsVmVyc2lvbikgeworICAgICAgICAgICAgY2FzZSAyOgorICAgICAgICAgICAgICAgIHJldHVybiBHbDIwUmVuZGVyZXIuY3JlYXRlKHRyYW5zbHVjZW50KTsKKyAgICAgICAgfQorICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJVbmtub3duIEdMIHZlcnNpb246ICIgKyBnbFZlcnNpb24pOworICAgIH0KKworICAgIC8qKgorICAgICAqIEluZGljYXRlcyB3aGV0aGVyIGhhcmR3YXJlIGFjY2VsZXJhdGlvbiBpcyBjdXJyZW50bHkgZW5hYmxlZC4KKyAgICAgKiAKKyAgICAgKiBAcmV0dXJuIFRydWUgaWYgaGFyZHdhcmUgYWNjZWxlcmF0aW9uIGlzIGluIHVzZSwgZmFsc2Ugb3RoZXJ3aXNlLgorICAgICAqLworICAgIGJvb2xlYW4gaXNFbmFibGVkKCkgeworICAgICAgICByZXR1cm4gbUVuYWJsZWQ7CisgICAgfQorCisgICAgLyoqCisgICAgICogSW5kaWNhdGVzIHdoZXRoZXIgaGFyZHdhcmUgYWNjZWxlcmF0aW9uIGlzIGN1cnJlbnRseSBlbmFibGVkLgorICAgICAqIAorICAgICAqIEBwYXJhbSBlbmFibGVkIFRydWUgaWYgdGhlIGhhcmR3YXJlIHJlbmRlcmVyIGlzIGluIHVzZSwgZmFsc2Ugb3RoZXJ3aXNlLgorICAgICAqLworICAgIHZvaWQgc2V0RW5hYmxlZChib29sZWFuIGVuYWJsZWQpIHsKKyAgICAgICAgbUVuYWJsZWQgPSBlbmFibGVkOworICAgIH0KKworICAgIC8qKgorICAgICAqIEluZGljYXRlcyB3aGV0aGVyIGhhcmR3YXJlIGFjY2VsZXJhdGlvbiBpcyBjdXJyZW50bHkgcmVxdWVzdCBidXQgbm90CisgICAgICogbmVjZXNzYXJpbHkgZW5hYmxlZCB5ZXQuCisgICAgICogCisgICAgICogQHJldHVybiBUcnVlIGlmIHJlcXVlc3RlZCwgZmFsc2Ugb3RoZXJ3aXNlLgorICAgICAqLworICAgIGJvb2xlYW4gaXNSZXF1ZXN0ZWQoKSB7CisgICAgICAgIHJldHVybiBtUmVxdWVzdGVkOworICAgIH0KKworICAgIC8qKgorICAgICAqIEluZGljYXRlcyB3aGV0aGVyIGhhcmR3YXJlIGFjY2VsZXJhdGlvbiBpcyBjdXJyZW50bHkgcmVxdWVzdCBidXQgbm90CisgICAgICogbmVjZXNzYXJpbHkgZW5hYmxlZCB5ZXQuCisgICAgICogCisgICAgICogQHJldHVybiBUcnVlIHRvIHJlcXVlc3QgaGFyZHdhcmUgYWNjZWxlcmF0aW9uLCBmYWxzZSBvdGhlcndpc2UuCisgICAgICovCisgICAgdm9pZCBzZXRSZXF1ZXN0ZWQoYm9vbGVhbiByZXF1ZXN0ZWQpIHsKKyAgICAgICAgbVJlcXVlc3RlZCA9IHJlcXVlc3RlZDsKKyAgICB9CisKKyAgICBAU3VwcHJlc3NXYXJuaW5ncyh7ImRlcHJlY2F0aW9uIn0pCisgICAgc3RhdGljIGFic3RyYWN0IGNsYXNzIEdsUmVuZGVyZXIgZXh0ZW5kcyBIYXJkd2FyZVJlbmRlcmVyIHsKKyAgICAgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IEVHTF9DT05URVhUX0NMSUVOVF9WRVJTSU9OID0gMHgzMDk4OworCisgICAgICAgIHN0YXRpYyBFR0xDb250ZXh0IHNFZ2xDb250ZXh0OworICAgICAgICBzdGF0aWMgRUdMMTAgc0VnbDsKKyAgICAgICAgc3RhdGljIEVHTERpc3BsYXkgc0VnbERpc3BsYXk7CisgICAgICAgIHN0YXRpYyBFR0xDb25maWcgc0VnbENvbmZpZzsKKworICAgICAgICBwcml2YXRlIHN0YXRpYyBUaHJlYWQgc0VnbFRocmVhZDsgICAgICAgIAorCisgICAgICAgIEVHTFN1cmZhY2UgbUVnbFN1cmZhY2U7CisgICAgICAgIAorICAgICAgICBHTCBtR2w7CisgICAgICAgIEdMRVMyMENhbnZhcyBtQ2FudmFzOworCisgICAgICAgIGZpbmFsIGludCBtR2xWZXJzaW9uOworICAgICAgICBmaW5hbCBib29sZWFuIG1UcmFuc2x1Y2VudDsKKworICAgICAgICBwcml2YXRlIGJvb2xlYW4gbURlc3Ryb3llZDsKKworICAgICAgICBHbFJlbmRlcmVyKGludCBnbFZlcnNpb24sIGJvb2xlYW4gdHJhbnNsdWNlbnQpIHsKKyAgICAgICAgICAgIG1HbFZlcnNpb24gPSBnbFZlcnNpb247CisgICAgICAgICAgICBtVHJhbnNsdWNlbnQgPSB0cmFuc2x1Y2VudDsKKyAgICAgICAgfQorCisgICAgICAgIC8qKgorICAgICAgICAgKiBDaGVja3MgZm9yIE9wZW5HTCBlcnJvcnMuIElmIGFuIGVycm9yIGhhcyBvY2N1cmVkLCB7QGxpbmsgI2Rlc3Ryb3koYm9vbGVhbil9CisgICAgICAgICAqIGlzIGludm9rZWQgYW5kIHRoZSByZXF1ZXN0ZWQgZmxhZyBpcyB0dXJuZWQgb2ZmLiBUaGUgZXJyb3IgY29kZSBpcworICAgICAgICAgKiBhbHNvIGxvZ2dlZCBhcyBhIHdhcm5pbmcuCisgICAgICAgICAqLworICAgICAgICB2b2lkIGNoZWNrRXJyb3JzKCkgeworICAgICAgICAgICAgaWYgKGlzRW5hYmxlZCgpKSB7CisgICAgICAgICAgICAgICAgaW50IGVycm9yID0gc0VnbC5lZ2xHZXRFcnJvcigpOworICAgICAgICAgICAgICAgIGlmIChlcnJvciAhPSBFR0wxMC5FR0xfU1VDQ0VTUykgeworICAgICAgICAgICAgICAgICAgICAvLyBzb21ldGhpbmcgYmFkIGhhcyBoYXBwZW5lZCByZXZlcnQgdG8KKyAgICAgICAgICAgICAgICAgICAgLy8gbm9ybWFsIHJlbmRlcmluZy4KKyAgICAgICAgICAgICAgICAgICAgZGVzdHJveSh0cnVlKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGVycm9yICE9IEVHTDExLkVHTF9DT05URVhUX0xPU1QpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIHdlJ2xsIHRyeSBhZ2FpbiBpZiBpdCB3YXMgY29udGV4dCBsb3N0CisgICAgICAgICAgICAgICAgICAgICAgICBzZXRSZXF1ZXN0ZWQoZmFsc2UpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIExvZy53KExPR19UQUcsICJPcGVuR0wgZXJyb3I6ICIgKyBlcnJvcik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIAorICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgYm9vbGVhbiBpbml0aWFsaXplKFN1cmZhY2VIb2xkZXIgaG9sZGVyKSB7CisgICAgICAgICAgICBpZiAoaXNSZXF1ZXN0ZWQoKSAmJiAhaXNFbmFibGVkKCkpIHsKKyAgICAgICAgICAgICAgICBpbml0aWFsaXplRWdsKCk7CisgICAgICAgICAgICAgICAgbUdsID0gY3JlYXRlRWdsU3VyZmFjZShob2xkZXIpOworICAgICAgICAgICAgICAgIG1EZXN0cm95ZWQgPSBmYWxzZTsKKworICAgICAgICAgICAgICAgIGlmIChtR2wgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBpbnQgZXJyID0gc0VnbC5lZ2xHZXRFcnJvcigpOworICAgICAgICAgICAgICAgICAgICBpZiAoZXJyICE9IEVHTDEwLkVHTF9TVUNDRVNTKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBkZXN0cm95KHRydWUpOworICAgICAgICAgICAgICAgICAgICAgICAgc2V0UmVxdWVzdGVkKGZhbHNlKTsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtQ2FudmFzID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtQ2FudmFzID0gY3JlYXRlQ2FudmFzKCk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAobUNhbnZhcyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0RW5hYmxlZCh0cnVlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgTG9nLncoTE9HX1RBRywgIkhhcmR3YXJlIGFjY2VsZXJhdGVkIENhbnZhcyBjb3VsZCBub3QgYmUgY3JlYXRlZCIpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG1DYW52YXMgIT0gbnVsbDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKworICAgICAgICBhYnN0cmFjdCBHTEVTMjBDYW52YXMgY3JlYXRlQ2FudmFzKCk7CisKKyAgICAgICAgdm9pZCBpbml0aWFsaXplRWdsKCkgeworICAgICAgICAgICAgaWYgKHNFZ2xDb250ZXh0ICE9IG51bGwpIHJldHVybjsKKworICAgICAgICAgICAgc0VnbFRocmVhZCA9IFRocmVhZC5jdXJyZW50VGhyZWFkKCk7CisgICAgICAgICAgICBzRWdsID0gKEVHTDEwKSBFR0xDb250ZXh0LmdldEVHTCgpOworICAgICAgICAgICAgCisgICAgICAgICAgICAvLyBHZXQgdG8gdGhlIGRlZmF1bHQgZGlzcGxheS4KKyAgICAgICAgICAgIHNFZ2xEaXNwbGF5ID0gc0VnbC5lZ2xHZXREaXNwbGF5KEVHTDEwLkVHTF9ERUZBVUxUX0RJU1BMQVkpOworICAgICAgICAgICAgCisgICAgICAgICAgICBpZiAoc0VnbERpc3BsYXkgPT0gRUdMMTAuRUdMX05PX0RJU1BMQVkpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgUnVudGltZUV4Y2VwdGlvbigiZWdsR2V0RGlzcGxheSBmYWlsZWQiKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIAorICAgICAgICAgICAgLy8gV2UgY2FuIG5vdyBpbml0aWFsaXplIEVHTCBmb3IgdGhhdCBkaXNwbGF5CisgICAgICAgICAgICBpbnRbXSB2ZXJzaW9uID0gbmV3IGludFsyXTsKKyAgICAgICAgICAgIGlmICghc0VnbC5lZ2xJbml0aWFsaXplKHNFZ2xEaXNwbGF5LCB2ZXJzaW9uKSkgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBSdW50aW1lRXhjZXB0aW9uKCJlZ2xJbml0aWFsaXplIGZhaWxlZCIpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgc0VnbENvbmZpZyA9IGdldENvbmZpZ0Nob29zZXIobUdsVmVyc2lvbikuY2hvb3NlQ29uZmlnKHNFZ2wsIHNFZ2xEaXNwbGF5KTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgLyoKKyAgICAgICAgICAgICogQ3JlYXRlIGFuIEVHTCBjb250ZXh0LiBXZSB3YW50IHRvIGRvIHRoaXMgYXMgcmFyZWx5IGFzIHdlIGNhbiwgYmVjYXVzZSBhbgorICAgICAgICAgICAgKiBFR0wgY29udGV4dCBpcyBhIHNvbWV3aGF0IGhlYXZ5IG9iamVjdC4KKyAgICAgICAgICAgICovCisgICAgICAgICAgICBzRWdsQ29udGV4dCA9IGNyZWF0ZUNvbnRleHQoc0VnbCwgc0VnbERpc3BsYXksIHNFZ2xDb25maWcpOworICAgICAgICB9CisKKyAgICAgICAgR0wgY3JlYXRlRWdsU3VyZmFjZShTdXJmYWNlSG9sZGVyIGhvbGRlcikgeworICAgICAgICAgICAgLy8gQ2hlY2sgcHJlY29uZGl0aW9ucy4KKyAgICAgICAgICAgIGlmIChzRWdsID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgUnVudGltZUV4Y2VwdGlvbigiZWdsIG5vdCBpbml0aWFsaXplZCIpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKHNFZ2xEaXNwbGF5ID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgUnVudGltZUV4Y2VwdGlvbigiZWdsRGlzcGxheSBub3QgaW5pdGlhbGl6ZWQiKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChzRWdsQ29uZmlnID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgUnVudGltZUV4Y2VwdGlvbigibUVnbENvbmZpZyBub3QgaW5pdGlhbGl6ZWQiKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChUaHJlYWQuY3VycmVudFRocmVhZCgpICE9IHNFZ2xUaHJlYWQpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJIYXJkd2FyZVJlbmRlcmVyIGNhbm5vdCBiZSB1c2VkICIgCisgICAgICAgICAgICAgICAgICAgICAgICArICJmcm9tIG11bHRpcGxlIHRocmVhZHMiKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLyoKKyAgICAgICAgICAgICAqICBUaGUgd2luZG93IHNpemUgaGFzIGNoYW5nZWQsIHNvIHdlIG5lZWQgdG8gY3JlYXRlIGEgbmV3CisgICAgICAgICAgICAgKiAgc3VyZmFjZS4KKyAgICAgICAgICAgICAqLworICAgICAgICAgICAgaWYgKG1FZ2xTdXJmYWNlICE9IG51bGwgJiYgbUVnbFN1cmZhY2UgIT0gRUdMMTAuRUdMX05PX1NVUkZBQ0UpIHsKKyAgICAgICAgICAgICAgICAvKgorICAgICAgICAgICAgICAgICAqIFVuYmluZCBhbmQgZGVzdHJveSB0aGUgb2xkIEVHTCBzdXJmYWNlLCBpZgorICAgICAgICAgICAgICAgICAqIHRoZXJlIGlzIG9uZS4KKyAgICAgICAgICAgICAgICAgKi8KKyAgICAgICAgICAgICAgICBzRWdsLmVnbE1ha2VDdXJyZW50KHNFZ2xEaXNwbGF5LCBFR0wxMC5FR0xfTk9fU1VSRkFDRSwKKyAgICAgICAgICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9OT19TVVJGQUNFLCBFR0wxMC5FR0xfTk9fQ09OVEVYVCk7CisgICAgICAgICAgICAgICAgc0VnbC5lZ2xEZXN0cm95U3VyZmFjZShzRWdsRGlzcGxheSwgbUVnbFN1cmZhY2UpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvLyBDcmVhdGUgYW4gRUdMIHN1cmZhY2Ugd2UgY2FuIHJlbmRlciBpbnRvLgorICAgICAgICAgICAgbUVnbFN1cmZhY2UgPSBzRWdsLmVnbENyZWF0ZVdpbmRvd1N1cmZhY2Uoc0VnbERpc3BsYXksIHNFZ2xDb25maWcsIGhvbGRlciwgbnVsbCk7CisKKyAgICAgICAgICAgIGlmIChtRWdsU3VyZmFjZSA9PSBudWxsIHx8IG1FZ2xTdXJmYWNlID09IEVHTDEwLkVHTF9OT19TVVJGQUNFKSB7CisgICAgICAgICAgICAgICAgaW50IGVycm9yID0gc0VnbC5lZ2xHZXRFcnJvcigpOworICAgICAgICAgICAgICAgIGlmIChlcnJvciA9PSBFR0wxMC5FR0xfQkFEX05BVElWRV9XSU5ET1cpIHsKKyAgICAgICAgICAgICAgICAgICAgTG9nLmUoIkVnbEhlbHBlciIsICJjcmVhdGVXaW5kb3dTdXJmYWNlIHJldHVybmVkIEVHTF9CQURfTkFUSVZFX1dJTkRPVy4iKTsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHRocm93IG5ldyBSdW50aW1lRXhjZXB0aW9uKCJjcmVhdGVXaW5kb3dTdXJmYWNlIGZhaWxlZCIpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvKgorICAgICAgICAgICAgICogQmVmb3JlIHdlIGNhbiBpc3N1ZSBHTCBjb21tYW5kcywgd2UgbmVlZCB0byBtYWtlIHN1cmUKKyAgICAgICAgICAgICAqIHRoZSBjb250ZXh0IGlzIGN1cnJlbnQgYW5kIGJvdW5kIHRvIGEgc3VyZmFjZS4KKyAgICAgICAgICAgICAqLworICAgICAgICAgICAgaWYgKCFzRWdsLmVnbE1ha2VDdXJyZW50KHNFZ2xEaXNwbGF5LCBtRWdsU3VyZmFjZSwgbUVnbFN1cmZhY2UsIHNFZ2xDb250ZXh0KSkgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBSdW50aW1lRXhjZXB0aW9uKCJlZ2xNYWtlQ3VycmVudCBmYWlsZWQiKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcmV0dXJuIHNFZ2xDb250ZXh0LmdldEdMKCk7CisgICAgICAgIH0KKworICAgICAgICBFR0xDb250ZXh0IGNyZWF0ZUNvbnRleHQoRUdMMTAgZWdsLCBFR0xEaXNwbGF5IGVnbERpc3BsYXksIEVHTENvbmZpZyBlZ2xDb25maWcpIHsKKyAgICAgICAgICAgIGludFtdIGF0dHJpYl9saXN0ID0geyBFR0xfQ09OVEVYVF9DTElFTlRfVkVSU0lPTiwgbUdsVmVyc2lvbiwgRUdMMTAuRUdMX05PTkUgfTsKKworICAgICAgICAgICAgcmV0dXJuIGVnbC5lZ2xDcmVhdGVDb250ZXh0KGVnbERpc3BsYXksIGVnbENvbmZpZywgRUdMMTAuRUdMX05PX0NPTlRFWFQsCisgICAgICAgICAgICAgICAgICAgIG1HbFZlcnNpb24gIT0gMCA/IGF0dHJpYl9saXN0IDogbnVsbCk7ICAgICAgICAgICAgCisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgdm9pZCBpbml0aWFsaXplSWZOZWVkZWQoaW50IHdpZHRoLCBpbnQgaGVpZ2h0LCBWaWV3LkF0dGFjaEluZm8gYXR0YWNoSW5mbywKKyAgICAgICAgICAgICAgICBTdXJmYWNlSG9sZGVyIGhvbGRlcikgeworICAgICAgICAgICAgaWYgKGlzUmVxdWVzdGVkKCkpIHsKKyAgICAgICAgICAgICAgICBjaGVja0Vycm9ycygpOworICAgICAgICAgICAgICAgIHN1cGVyLmluaXRpYWxpemVJZk5lZWRlZCh3aWR0aCwgaGVpZ2h0LCBhdHRhY2hJbmZvLCBob2xkZXIpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIAorICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgdm9pZCBkZXN0cm95KGJvb2xlYW4gZnVsbCkgeworICAgICAgICAgICAgaWYgKGZ1bGwgJiYgbUNhbnZhcyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgbUNhbnZhcy5kZXN0cm95KCk7CisgICAgICAgICAgICAgICAgbUNhbnZhcyA9IG51bGw7CisgICAgICAgICAgICB9CisgICAgICAgICAgICAKKyAgICAgICAgICAgIGlmICghaXNFbmFibGVkKCkgfHwgbURlc3Ryb3llZCkgcmV0dXJuOworCisgICAgICAgICAgICBtRGVzdHJveWVkID0gdHJ1ZTsKKworICAgICAgICAgICAgc0VnbC5lZ2xNYWtlQ3VycmVudChzRWdsRGlzcGxheSwgRUdMMTAuRUdMX05PX1NVUkZBQ0UsCisgICAgICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9OT19TVVJGQUNFLCBFR0wxMC5FR0xfTk9fQ09OVEVYVCk7CisgICAgICAgICAgICBzRWdsLmVnbERlc3Ryb3lTdXJmYWNlKHNFZ2xEaXNwbGF5LCBtRWdsU3VyZmFjZSk7CisKKyAgICAgICAgICAgIG1FZ2xTdXJmYWNlID0gbnVsbDsKKyAgICAgICAgICAgIG1HbCA9IG51bGw7CisKKyAgICAgICAgICAgIHNldEVuYWJsZWQoZmFsc2UpOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHZvaWQgc2V0dXAoaW50IHdpZHRoLCBpbnQgaGVpZ2h0KSB7CisgICAgICAgICAgICBtQ2FudmFzLnNldFZpZXdwb3J0KHdpZHRoLCBoZWlnaHQpOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICBib29sZWFuIGNhbkRyYXcoKSB7CisgICAgICAgICAgICByZXR1cm4gbUdsICE9IG51bGwgJiYgbUNhbnZhcyAhPSBudWxsOworICAgICAgICB9ICAgICAgICAKKyAgICAgICAgCisgICAgICAgIHZvaWQgb25QcmVEcmF3KCkgeworICAgICAgICB9CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIERlZmluZXMgdGhlIEVHTCBjb25maWd1cmF0aW9uIGZvciB0aGlzIHJlbmRlcmVyLiBUaGUgZGVmYXVsdCBjb25maWd1cmF0aW9uCisgICAgICAgICAqIGlzIFJHQlgsIG5vIGRlcHRoLCBubyBzdGVuY2lsLgorICAgICAgICAgKiAKKyAgICAgICAgICogQHJldHVybiBBbiB7QGxpbmsgYW5kcm9pZC52aWV3LkhhcmR3YXJlUmVuZGVyZXIuR2xSZW5kZXJlci5FZ2xDb25maWdDaG9vc2VyfS4KKyAgICAgICAgICogQHBhcmFtIGdsVmVyc2lvbgorICAgICAgICAgKi8KKyAgICAgICAgRWdsQ29uZmlnQ2hvb3NlciBnZXRDb25maWdDaG9vc2VyKGludCBnbFZlcnNpb24pIHsKKyAgICAgICAgICAgIHJldHVybiBuZXcgQ29tcG9uZW50U2l6ZUNob29zZXIoZ2xWZXJzaW9uLCA4LCA4LCA4LCA4LCAwLCAwKTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICB2b2lkIGRyYXcoVmlldyB2aWV3LCBWaWV3LkF0dGFjaEluZm8gYXR0YWNoSW5mbywgaW50IHlPZmZzZXQpIHsKKyAgICAgICAgICAgIGlmIChjYW5EcmF3KCkpIHsKKyAgICAgICAgICAgICAgICBhdHRhY2hJbmZvLm1EcmF3aW5nVGltZSA9IFN5c3RlbUNsb2NrLnVwdGltZU1pbGxpcygpOworICAgICAgICAgICAgICAgIGF0dGFjaEluZm8ubUlnbm9yZURpcnR5U3RhdGUgPSB0cnVlOworICAgICAgICAgICAgICAgIHZpZXcubVByaXZhdGVGbGFncyB8PSBWaWV3LkRSQVdOOworCisgICAgICAgICAgICAgICAgY2hlY2tDdXJyZW50KCk7CisKKyAgICAgICAgICAgICAgICBvblByZURyYXcoKTsKKworICAgICAgICAgICAgICAgIENhbnZhcyBjYW52YXMgPSBtQ2FudmFzOworICAgICAgICAgICAgICAgIGludCBzYXZlQ291bnQgPSBjYW52YXMuc2F2ZSgpOworICAgICAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoMCwgLXlPZmZzZXQpOworCisgICAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAgICAgdmlldy5kcmF3KGNhbnZhcyk7CisgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKKyAgICAgICAgICAgICAgICAgICAgY2FudmFzLnJlc3RvcmVUb0NvdW50KHNhdmVDb3VudCk7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgYXR0YWNoSW5mby5tSWdub3JlRGlydHlTdGF0ZSA9IGZhbHNlOworCisgICAgICAgICAgICAgICAgc0VnbC5lZ2xTd2FwQnVmZmVycyhzRWdsRGlzcGxheSwgbUVnbFN1cmZhY2UpOworICAgICAgICAgICAgICAgIGNoZWNrRXJyb3JzKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIHZvaWQgY2hlY2tDdXJyZW50KCkgeworICAgICAgICAgICAgLy8gVE9ETzogRG9uJ3QgY2hlY2sgdGhlIGN1cnJlbnQgY29udGV4dCB3aGVuIHdlIGhhdmUgb25lIHBlciBVSSB0aHJlYWQKKyAgICAgICAgICAgIC8vIFRPRE86IFVzZSBhIHRocmVhZGxvY2FsIGZsYWcgdG8ga25vdyB3aGV0aGVyIHRoZSBzdXJmYWNlIGhhcyBjaGFuZ2VkCisgICAgICAgICAgICBpZiAoc0VnbC5lZ2xHZXRDdXJyZW50Q29udGV4dCgpICE9IHNFZ2xDb250ZXh0IHx8CisgICAgICAgICAgICAgICAgICAgIHNFZ2wuZWdsR2V0Q3VycmVudFN1cmZhY2UoRUdMMTAuRUdMX0RSQVcpICE9IG1FZ2xTdXJmYWNlKSB7CisgICAgICAgICAgICAgICAgaWYgKCFzRWdsLmVnbE1ha2VDdXJyZW50KHNFZ2xEaXNwbGF5LCBtRWdsU3VyZmFjZSwgbUVnbFN1cmZhY2UsIHNFZ2xDb250ZXh0KSkgeworICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgUnVudGltZUV4Y2VwdGlvbigiZWdsTWFrZUN1cnJlbnQgZmFpbGVkIik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgc3RhdGljIGFic3RyYWN0IGNsYXNzIEVnbENvbmZpZ0Nob29zZXIgeworICAgICAgICAgICAgZmluYWwgaW50W10gbUNvbmZpZ1NwZWM7CisgICAgICAgICAgICBwcml2YXRlIGZpbmFsIGludCBtR2xWZXJzaW9uOworCisgICAgICAgICAgICBFZ2xDb25maWdDaG9vc2VyKGludCBnbFZlcnNpb24sIGludFtdIGNvbmZpZ1NwZWMpIHsKKyAgICAgICAgICAgICAgICBtR2xWZXJzaW9uID0gZ2xWZXJzaW9uOworICAgICAgICAgICAgICAgIG1Db25maWdTcGVjID0gZmlsdGVyQ29uZmlnU3BlYyhjb25maWdTcGVjKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgRUdMQ29uZmlnIGNob29zZUNvbmZpZyhFR0wxMCBlZ2wsIEVHTERpc3BsYXkgZGlzcGxheSkgeworICAgICAgICAgICAgICAgIGludFtdIGluZGV4ID0gbmV3IGludFsxXTsKKyAgICAgICAgICAgICAgICBpZiAoIWVnbC5lZ2xDaG9vc2VDb25maWcoZGlzcGxheSwgbUNvbmZpZ1NwZWMsIG51bGwsIDAsIGluZGV4KSkgeworICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJlZ2xDaG9vc2VDb25maWcgZmFpbGVkIik7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgaW50IG51bUNvbmZpZ3MgPSBpbmRleFswXTsKKyAgICAgICAgICAgICAgICBpZiAobnVtQ29uZmlncyA8PSAwKSB7CisgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oIk5vIGNvbmZpZ3MgbWF0Y2ggY29uZmlnU3BlYyIpOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIEVHTENvbmZpZ1tdIGNvbmZpZ3MgPSBuZXcgRUdMQ29uZmlnW251bUNvbmZpZ3NdOworICAgICAgICAgICAgICAgIGlmICghZWdsLmVnbENob29zZUNvbmZpZyhkaXNwbGF5LCBtQ29uZmlnU3BlYywgY29uZmlncywgbnVtQ29uZmlncywgaW5kZXgpKSB7CisgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oImVnbENob29zZUNvbmZpZyBmYWlsZWQiKTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBFR0xDb25maWcgY29uZmlnID0gY2hvb3NlQ29uZmlnKGVnbCwgZGlzcGxheSwgY29uZmlncyk7CisgICAgICAgICAgICAgICAgaWYgKGNvbmZpZyA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oIk5vIGNvbmZpZyBjaG9zZW4iKTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICByZXR1cm4gY29uZmlnOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBhYnN0cmFjdCBFR0xDb25maWcgY2hvb3NlQ29uZmlnKEVHTDEwIGVnbCwgRUdMRGlzcGxheSBkaXNwbGF5LCBFR0xDb25maWdbXSBjb25maWdzKTsKKworICAgICAgICAgICAgcHJpdmF0ZSBpbnRbXSBmaWx0ZXJDb25maWdTcGVjKGludFtdIGNvbmZpZ1NwZWMpIHsKKyAgICAgICAgICAgICAgICBpZiAobUdsVmVyc2lvbiAhPSAyKSB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBjb25maWdTcGVjOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAvKiBXZSBrbm93IG5vbmUgb2YgdGhlIHN1YmNsYXNzZXMgZGVmaW5lIEVHTF9SRU5ERVJBQkxFX1RZUEUuCisgICAgICAgICAgICAgICAgICogQW5kIHdlIGtub3cgdGhlIGNvbmZpZ1NwZWMgaXMgd2VsbCBmb3JtZWQuCisgICAgICAgICAgICAgICAgICovCisgICAgICAgICAgICAgICAgaW50IGxlbiA9IGNvbmZpZ1NwZWMubGVuZ3RoOworICAgICAgICAgICAgICAgIGludFtdIG5ld0NvbmZpZ1NwZWMgPSBuZXcgaW50W2xlbiArIDJdOworICAgICAgICAgICAgICAgIFN5c3RlbS5hcnJheWNvcHkoY29uZmlnU3BlYywgMCwgbmV3Q29uZmlnU3BlYywgMCwgbGVuIC0gMSk7CisgICAgICAgICAgICAgICAgbmV3Q29uZmlnU3BlY1tsZW4gLSAxXSA9IEVHTDEwLkVHTF9SRU5ERVJBQkxFX1RZUEU7CisgICAgICAgICAgICAgICAgbmV3Q29uZmlnU3BlY1tsZW5dID0gNDsgLyogRUdMX09QRU5HTF9FUzJfQklUICovCisgICAgICAgICAgICAgICAgbmV3Q29uZmlnU3BlY1tsZW4gKyAxXSA9IEVHTDEwLkVHTF9OT05FOworICAgICAgICAgICAgICAgIHJldHVybiBuZXdDb25maWdTcGVjOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIENob29zZSBhIGNvbmZpZ3VyYXRpb24gd2l0aCBleGFjdGx5IHRoZSBzcGVjaWZpZWQgcixnLGIsYSBzaXplcywKKyAgICAgICAgICogYW5kIGF0IGxlYXN0IHRoZSBzcGVjaWZpZWQgZGVwdGggYW5kIHN0ZW5jaWwgc2l6ZXMuCisgICAgICAgICAqLworICAgICAgICBzdGF0aWMgY2xhc3MgQ29tcG9uZW50U2l6ZUNob29zZXIgZXh0ZW5kcyBFZ2xDb25maWdDaG9vc2VyIHsKKyAgICAgICAgICAgIHByaXZhdGUgaW50W10gbVZhbHVlOworCisgICAgICAgICAgICBwcml2YXRlIGludCBtUmVkU2l6ZTsKKyAgICAgICAgICAgIHByaXZhdGUgaW50IG1HcmVlblNpemU7CisgICAgICAgICAgICBwcml2YXRlIGludCBtQmx1ZVNpemU7CisgICAgICAgICAgICBwcml2YXRlIGludCBtQWxwaGFTaXplOworICAgICAgICAgICAgcHJpdmF0ZSBpbnQgbURlcHRoU2l6ZTsKKyAgICAgICAgICAgIHByaXZhdGUgaW50IG1TdGVuY2lsU2l6ZTsKKworICAgICAgICAgICAgQ29tcG9uZW50U2l6ZUNob29zZXIoaW50IGdsVmVyc2lvbiwgaW50IHJlZFNpemUsIGludCBncmVlblNpemUsIGludCBibHVlU2l6ZSwKKyAgICAgICAgICAgICAgICAgICAgaW50IGFscGhhU2l6ZSwgaW50IGRlcHRoU2l6ZSwgaW50IHN0ZW5jaWxTaXplKSB7CisgICAgICAgICAgICAgICAgc3VwZXIoZ2xWZXJzaW9uLCBuZXcgaW50W10geworICAgICAgICAgICAgICAgICAgICAgICAgRUdMMTAuRUdMX1JFRF9TSVpFLCByZWRTaXplLAorICAgICAgICAgICAgICAgICAgICAgICAgRUdMMTAuRUdMX0dSRUVOX1NJWkUsIGdyZWVuU2l6ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9CTFVFX1NJWkUsIGJsdWVTaXplLAorICAgICAgICAgICAgICAgICAgICAgICAgRUdMMTAuRUdMX0FMUEhBX1NJWkUsIGFscGhhU2l6ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9ERVBUSF9TSVpFLCBkZXB0aFNpemUsCisgICAgICAgICAgICAgICAgICAgICAgICBFR0wxMC5FR0xfU1RFTkNJTF9TSVpFLCBzdGVuY2lsU2l6ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9OT05FIH0pOworICAgICAgICAgICAgICAgIG1WYWx1ZSA9IG5ldyBpbnRbMV07CisgICAgICAgICAgICAgICAgbVJlZFNpemUgPSByZWRTaXplOworICAgICAgICAgICAgICAgIG1HcmVlblNpemUgPSBncmVlblNpemU7CisgICAgICAgICAgICAgICAgbUJsdWVTaXplID0gYmx1ZVNpemU7CisgICAgICAgICAgICAgICAgbUFscGhhU2l6ZSA9IGFscGhhU2l6ZTsKKyAgICAgICAgICAgICAgICBtRGVwdGhTaXplID0gZGVwdGhTaXplOworICAgICAgICAgICAgICAgIG1TdGVuY2lsU2l6ZSA9IHN0ZW5jaWxTaXplOworICAgICAgICAgICB9CisKKyAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgRUdMQ29uZmlnIGNob29zZUNvbmZpZyhFR0wxMCBlZ2wsIEVHTERpc3BsYXkgZGlzcGxheSwgRUdMQ29uZmlnW10gY29uZmlncykgeworICAgICAgICAgICAgICAgIGZvciAoRUdMQ29uZmlnIGNvbmZpZyA6IGNvbmZpZ3MpIHsKKyAgICAgICAgICAgICAgICAgICAgaW50IGQgPSBmaW5kQ29uZmlnQXR0cmliKGVnbCwgZGlzcGxheSwgY29uZmlnLCBFR0wxMC5FR0xfREVQVEhfU0laRSwgMCk7CisgICAgICAgICAgICAgICAgICAgIGludCBzID0gZmluZENvbmZpZ0F0dHJpYihlZ2wsIGRpc3BsYXksIGNvbmZpZywgRUdMMTAuRUdMX1NURU5DSUxfU0laRSwgMCk7CisgICAgICAgICAgICAgICAgICAgIGlmIChkID49IG1EZXB0aFNpemUgJiYgcyA+PSBtU3RlbmNpbFNpemUpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGludCByID0gZmluZENvbmZpZ0F0dHJpYihlZ2wsIGRpc3BsYXksIGNvbmZpZywgRUdMMTAuRUdMX1JFRF9TSVpFLCAwKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGludCBnID0gZmluZENvbmZpZ0F0dHJpYihlZ2wsIGRpc3BsYXksIGNvbmZpZywgRUdMMTAuRUdMX0dSRUVOX1NJWkUsIDApOworICAgICAgICAgICAgICAgICAgICAgICAgaW50IGIgPSBmaW5kQ29uZmlnQXR0cmliKGVnbCwgZGlzcGxheSwgY29uZmlnLCBFR0wxMC5FR0xfQkxVRV9TSVpFLCAwKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGludCBhID0gZmluZENvbmZpZ0F0dHJpYihlZ2wsIGRpc3BsYXksIGNvbmZpZywgRUdMMTAuRUdMX0FMUEhBX1NJWkUsIDApOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIgPj0gbVJlZFNpemUgJiYgZyA+PSBtR3JlZW5TaXplICYmIGIgPj0gbUJsdWVTaXplICYmIGEgPj0gbUFscGhhU2l6ZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjb25maWc7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHByaXZhdGUgaW50IGZpbmRDb25maWdBdHRyaWIoRUdMMTAgZWdsLCBFR0xEaXNwbGF5IGRpc3BsYXksIEVHTENvbmZpZyBjb25maWcsCisgICAgICAgICAgICAgICAgICAgIGludCBhdHRyaWJ1dGUsIGludCBkZWZhdWx0VmFsdWUpIHsKKyAgICAgICAgICAgICAgICBpZiAoZWdsLmVnbEdldENvbmZpZ0F0dHJpYihkaXNwbGF5LCBjb25maWcsIGF0dHJpYnV0ZSwgbVZhbHVlKSkgeworICAgICAgICAgICAgICAgICAgICByZXR1cm4gbVZhbHVlWzBdOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIHJldHVybiBkZWZhdWx0VmFsdWU7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBIYXJkd2FyZSByZW5kZXJlciB1c2luZyBPcGVuR0wgRVMgMi4wLgorICAgICAqLworICAgIHN0YXRpYyBjbGFzcyBHbDIwUmVuZGVyZXIgZXh0ZW5kcyBHbFJlbmRlcmVyIHsKKyAgICAgICAgcHJpdmF0ZSBHTEVTMjBDYW52YXMgbUdsQ2FudmFzOworCisgICAgICAgIEdsMjBSZW5kZXJlcihib29sZWFuIHRyYW5zbHVjZW50KSB7CisgICAgICAgICAgICBzdXBlcigyLCB0cmFuc2x1Y2VudCk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgR0xFUzIwQ2FudmFzIGNyZWF0ZUNhbnZhcygpIHsKKyAgICAgICAgICAgIHJldHVybiBtR2xDYW52YXMgPSBuZXcgR0xFUzIwQ2FudmFzKG1HbCwgdHJ1ZSk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgdm9pZCBvblByZURyYXcoKSB7CisgICAgICAgICAgICBtR2xDYW52YXMub25QcmVEcmF3KCk7CisgICAgICAgIH0KKworICAgICAgICBzdGF0aWMgSGFyZHdhcmVSZW5kZXJlciBjcmVhdGUoYm9vbGVhbiB0cmFuc2x1Y2VudCkgeworICAgICAgICAgICAgaWYgKEdMRVMyMENhbnZhcy5pc0F2YWlsYWJsZSgpKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBHbDIwUmVuZGVyZXIodHJhbnNsdWNlbnQpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgIH0KKyAgICB9Cit9CmRpZmYgLS1naXQgYS9jb3JlL2phdmEvYW5kcm9pZC92aWV3L0xheW91dEluZmxhdGVyLmphdmEgYi9jb3JlL2phdmEvYW5kcm9pZC92aWV3L0xheW91dEluZmxhdGVyLmphdmEKaW5kZXggMTk0YzAxMy4uNDU4Mjc0ZiAxMDA2NDQKLS0tIGEvY29yZS9qYXZhL2FuZHJvaWQvdmlldy9MYXlvdXRJbmZsYXRlci5qYXZhCisrKyBiL2NvcmUvamF2YS9hbmRyb2lkL3ZpZXcvTGF5b3V0SW5mbGF0ZX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ZvdW5kIGluIHRoZSB4bWwKICAgICAgICAgICAgICAgICAgICAgVmlldyB0ZW1wID0gY3JlYXRlVmlld0Zyb21UYWcobmFtZSwgYXR0cnMpOwpAQCAtNDA1LDcgKzQwNiw3IEBACiAgICAgICAgICAgICAgICAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oIi0tLS0tPiBzdGFydCBpbmZsYXRpbmcgY2hpbGRyZW4iKTsKICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAvLyBJbmZsYXRlIGFsbCBjaGlsZHJlbiB1bmRlciB0ZW1wCi0gICAgICAgICAgICAgICAgICAgIHJJbmZsYXRlKHBhcnNlciwgdGVtcCwgYXR0cnMpOworICAgICAgICAgICAgICAgICAgICBySW5mbGF0ZShwYXJzZXIsIHRlbXAsIGF0dHJzLCB0cnVlKTsKICAgICAgICAgICAgICAgICAgICAgaWYgKERFQlVHKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oIi0tLS0tPiBkb25lIGluZmxhdGluZyBjaGlsZHJlbiIpOwogICAgICAgICAgICAgICAgICAgICB9CkBAIC00NTgsMTggKzQ1OSwxOCBAQAogICAgICAqIEBwYXJhbSBuYW1lIFRoZSBmdWxsIG5hbWUgb2YgdGhlIGNsYXNzIHRvIGJlIGluc3RhbnRpYXRlZC4KICAgICAgKiBAcGFyYW0gYXR0cnMgVGhlIFhNTCBhdHRyaWJ1dGVzIHN1cHBsaWVkIGZvciB0aGlzIGluc3RhbmNlLgogICAgICAqIAotICAgICAqIEByZXR1cm4gVmlldyBUaGUgbmV3bHkgaW5zdGFudGllZCB2aWV3LCBvciBudWxsLgorICAgICAqIEByZXR1cm4gVmlldyBUaGUgbmV3bHkgaW5zdGFudGlhdGVkIHZpZXcsIG9yIG51bGwuCiAgICAgICovCiAgICAgcHVibGljIGZpbmFsIFZpZXcgY3JlYXRlVmlldyhTdHJpbmcgbmFtZSwgU3RyaW5nIHByZWZpeCwgQXR0cmlidXRlU2V0IGF0dHJzKQogICAgICAgICAgICAgdGhyb3dzIENsYXNzTm90Rm91bmRFeGNlcHRpb24sIEluZmxhdGVFeGNlcHRpb24gewotICAgICAgICBDb25zdHJ1Y3RvciBjb25zdHJ1Y3RvciA9IHNDb25zdHJ1Y3Rvck1hcC5nZXQobmFtZSk7Ci0gICAgICAgIENsYXNzIGNsYXp6ID0gbnVsbDsKKyAgICAgICAgQ29uc3RydWN0b3I8PyBleHRlbmRzIFZpZXc+IGNvbnN0cnVjdG9yID0gc0NvbnN0cnVjdG9yTWFwLmdldChuYW1lKTsKKyAgICAgICAgQ2xhc3M8PyBleHRlbmRzIFZpZXc+IGNsYXp6ID0gbnVsbDsKIAogICAgICAgICB0cnkgewogICAgICAgICAgICAgaWYgKGNvbnN0cnVjdG9yID09IG51bGwpIHsKICAgICAgICAgICAgICAgICAvLyBDbGFzcyBub3QgZm91bmQgaW4gdGhlIGNhY2hlLCBzZWUgaWYgaXQncyByZWFsLCBhbmQgdHJ5IHRvIGFkZCBpdAogICAgICAgICAgICAgICAgIGNsYXp6ID0gbUNvbnRleHQuZ2V0Q2xhc3NMb2FkZXIoKS5sb2FkQ2xhc3MoCi0gICAgICAgICAgICAgICAgICAgICAgICBwcmVmaXggIT0gbnVsbCA/IChwcmVmaXggKyBuYW1lKSA6IG5hbWUpOworICAgICAgICAgICAgICAgICAgICAgICAgcHJlZml4ICE9IG51bGwgPyAocHJlZml4ICsgbmFtZSkgOiBuYW1lKS5hc1N1YmNsYXNzKFZpZXcuY2xhc3MpOwogICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgIGlmIChtRmlsdGVyICE9IG51bGwgJiYgY2xhenogIT0gbnVsbCkgewogICAgICAgICAgICAgICAgICAgICBib29sZWFuIGFsbG93ZWQgPSBtRmlsdGVyLm9uTG9hZENsYXNzKGNsYXp6KTsKQEAgLTQ4Nyw3ICs0ODgsNyBAQAogICAgICAgICAgICAgICAgICAgICBpZiAoYWxsb3dlZFN0YXRlID09IG51bGwpIHsKICAgICAgICAgICAgICAgICAgICAgICAgIC8vIE5ldyBjbGFzcyAtLSByZW1lbWJlciB3aGV0aGVyIGl0IGlzIGFsbG93ZWQKICAgICAgICAgICAgICAgICAgICAgICAgIGNsYXp6ID0gbUNvbnRleHQuZ2V0Q2xhc3NMb2FkZXIoKS5sb2FkQ2xhc3MoCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByZWZpeCAhPSBudWxsID8gKHByZWZpeCArIG5hbWUpIDogbmFtZSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByZWZpeCAhPSBudWxsID8gKHByZWZpeCArIG5hbWUpIDogbmFtZSkuYXNTdWJjbGFzcyhWaWV3LmNsYXNzKTsKICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgYm9vbGVhbiBhbGxvd2VkID0gY2xhenogIT0gbnVsbCAmJiBtRmlsdGVyLm9uTG9hZENsYXNzKGNsYXp6KTsKICAgICAgICAgICAgICAgICAgICAgICAgIG1GaWx0ZXJNYXAucHV0KG5hbWUsIGFsbG93ZWQpOwpAQCAtNTAyLDcgKzUwMyw3IEBACiAKICAgICAgICAgICAgIE9iamVjdFtdIGFyZ3MgPSBtQ29uc3RydWN0b3JBcmdzOwogICAgICAgICAgICAgYXJnc1sxXSA9IGF0dHJzOwotICAgICAgICAgICAgcmV0dXJuIChWaWV3KSBjb25zdHJ1Y3Rvci5uZXdJbnN0YW5jZShhcmdzKTsKKyAgICAgICAgICAgIHJldHVybiBjb25zdHJ1Y3Rvci5uZXdJbnN0YW5jZShhcmdzKTsKIAogICAgICAgICB9IGNhdGNoIChOb1N1Y2hNZXRob2RFeGNlcHRpb24gZSkgewogICAgICAgICAgICAgSW5mbGF0ZUV4Y2VwdGlvbiBpZSA9IG5ldyBJbmZsYXRlRXhjZXB0aW9uKGF0dHJzLmdldFBvc2l0aW9uRGVzY3JpcHRpb24oKQpAQCAtNTExLDYgKzUxMiwxMyBAQAogICAgICAgICAgICAgaWUuaW5pdENhdXNlKGUpOwogICAgICAgICAgICAgdGhyb3cgaWU7CiAKKyAgICAgICAgfSBjYXRjaCAoQ2xhc3NDYXN0RXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIC8vIElmIGxvYWRlZCBjbGFzcyBpcyBub3QgYSBWaWV3IHN1YmNsYXNzCisgICAgICAgICAgICBJbmZsYXRlRXhjZXB0aW9uIGllID0gbmV3IEluZmxhdGVFeGNlcHRpb24oYXR0cnMuZ2V0UG9zaXRpb25EZXNjcmlwdGlvbigpCisgICAgICAgICAgICAgICAgICAgICsgIjogQ2xhc3MgaXMgbm90IGEgVmlldyAiCisgICAgICAgICAgICAgICAgICAgICsgKHByZWZpeCAhPSBudWxsID8gKHByZWZpeCArIG5hbWUpIDogbmFtZSkpOworICAgICAgICAgICAgaWUuaW5pdENhdXNlKGUpOworICAgICAgICAgICAgdGhyb3cgaWU7CiAgICAgICAgIH0gY2F0Y2ggKENsYXNzTm90Rm91bmRFeGNlcHRpb24gZSkgewogICAgICAgICAgICAgLy8gSWYgbG9hZENsYXNzIGZhaWxzLCB3ZSBzaG91bGQgcHJvcGFnYXRlIHRoZSBleGNlcHRpb24uCiAgICAgICAgICAgICB0aHJvdyBlOwpAQCAtNTI0LDcgKzUzMiw3IEBACiAgICAgfQogCiAgICAgLyoqCi0gICAgICogVGhyb3cgYW4gZXhjcGV0aW9uIGJlY2F1c2UgdGhlIHNwZWNpZmllZCBjbGFzcyBpcyBub3QgYWxsb3dlZCB0byBiZSBpbmZsYXRlZC4KKyAgICAgKiBUaHJvdyBhbiBleGNlcHRpb24gYmVjYXVzZSB0aGUgc3BlY2lmaWVkIGNsYXNzIGlzIG5vdCBhbGxvd2VkIHRvIGJlIGluZmxhdGVkLgogICAgICAqLwogICAgIHByaXZhdGUgdm9pZCBmYWlsTm90QWxsb3dlZChTdHJpbmcgbmFtZSwgU3RyaW5nIHByZWZpeCwgQXR0cmlid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gICAgICAgICAgICAgICAgZmluYWwgVmlld0dyb3VwLkxheW91dFBhcmFtcyBwYXJhbXMgPSB2aWV3R3JvdXAuZ2VuZXJhdGVMYXlvdXRQYXJhbXMoYXR0cnMpOwotICAgICAgICAgICAgICAgIHJJbmZsYXRlKHBhcnNlciwgdmlldywgYXR0cnMpOworICAgICAgICAgICAgICAgIHJJbmZsYXRlKHBhcnNlciwgdmlldywgYXR0cnMsIHRydWUpOwogICAgICAgICAgICAgICAgIHZpZXdHcm91cC5hZGRWaWV3KHZpZXcsIHBhcmFtcyk7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KIAotICAgICAgICBwYXJlbnQub25GaW5pc2hJbmZsYXRlKCk7CisgICAgICAgIGlmIChmaW5pc2hJbmZsYXRlKSBwYXJlbnQub25GaW5pc2hJbmZsYXRlKCk7CiAgICAgfQogCiAgICAgcHJpdmF0ZSB2b2lkIHBhcnNlUmVxdWVzdEZvY3VzKFhtbFB1bGxQYXJzZXIgcGFyc2VyLCBWaWV3IHBhcmVudCkKQEAgLTY3OSw3ICs2ODcsNyBAQAogCiAgICAgICAgICAgICAgICAgICAgIGlmIChUQUdfTUVSR0UuZXF1YWxzKGNoaWxkTmFtZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgIC8vIEluZmxhdGUgYWxsIGNoaWxkcmVuLgotICAgICAgICAgICAgICAgICAgICAgICAgckluZmxhdGUoY2hpbGRQYXJzZXIsIHBhcmVudCwgY2hpbGRBdHRycyk7CisgICAgICAgICAgICAgICAgICAgICAgICBySW5mbGF0ZShjaGlsZFBhcnNlciwgcGFyZW50LCBjaGlsZEF0dHJzLCBmYWxzZSk7CiAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBmaW5hbCBWaWV3IHZpZXcgPSBjcmVhdGVWaWV3RnJvbVRhZyhjaGlsZE5hbWUsIGNoaWxkQXR0cnMpOwogICAgICAgICAgICAgICAgICAgICAgICAgZmluYWwgV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2QobWV0aG9kTmFtZSwgUEFSQU1fVFlQRVMpOworICAgICAgICAgICAgfSBjYXRjaCAoRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICBJbmZsYXRlRXhjZXB0aW9uIGV4ID0gbmV3IEluZmxhdGVFeGNlcHRpb24oCisgICAgICAgICAgICAgICAgICAgICAgICAiQ291bGRuJ3QgcmVzb2x2ZSBtZW51IGl0ZW0gb25DbGljayBoYW5kbGVyICIgKyBtZXRob2ROYW1lICsKKyAgICAgICAgICAgICAgICAgICAgICAgICIgaW4gY2xhc3MgIiArIGMuZ2V0TmFtZSgpKTsKKyAgICAgICAgICAgICAgICBleC5pbml0Q2F1c2UoZSk7CisgICAgICAgICAgICAgICAgdGhyb3cgZXg7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIHB1YmxpYyBib29sZWFuIG9uTWVudUl0ZW1DbGljayhNZW51SXRlbSBpdGVtKSB7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIGlmIChtTWV0aG9kLmdldFJldHVyblR5cGUoKSA9PSBCb29sZWFuLlRZUEUpIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIChCb29sZWFuKSBtTWV0aG9kLmludm9rZShtQ29udGV4dCwgaXRlbSk7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgbU1ldGhvZC5pbnZva2UobUNvbnRleHQsIGl0ZW0pOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGNhdGNoIChFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBSdW50aW1lRXhjZXB0aW9uKGUpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorICAgIAogICAgIC8qKgogICAgICAqIFN0YXRlIGZvciB0aGUgY3VycmVudCBtZW51LgogICAgICAqIDxwPgpAQCAtMjA1LDYgKzI0MSwxNyBAQAogICAgICAgICBwcml2YXRlIGJvb2xlYW4gaXRlbVZpc2libGU7CiAgICAgICAgIHByaXZhdGUgYm9vbGVhbiBpdGVtRW5hYmxlZDsKICAgICAgICAgCisgICAgICAgIC8qKgorICAgICAgICAgKiBTeW5jIHRvIGF0dHJzLnhtbCBlbnVtLCB2YWx1ZXMgaW4gTWVudUl0ZW06CisgICAgICAgICAqIC0gMDogbmV2ZXIKKyAgICAgICAgICogLSAxOiBpZlJvb20KKyAgICAgICAgICogLSAyOiBhbHdheXMKKyAgICAgICAgICogLSAtMTogU2FmZSBzZW50aW5lbCBmb3IgIm5vIHZhbHVlIi4KKyAgICAgICAgICovCisgICAgICAgIHByaXZhdGUgaW50IGl0ZW1TaG93QXNBY3Rpb247CisgICAgICAgIAorICAgICAgICBwcml2YXRlIFN0cmluZyBpdGVtTGlzdGVuZXJNZXRob2ROYW1lOworICAgICAgICAKICAgICAgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IGRlZmF1bHRHcm91cElkID0gTk9fSUQ7CiAgICAgICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBkZWZhdWx0SXRlbUlkID0gTk9fSUQ7CiAgICAgICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBkZWZhdWx0SXRlbUNhdGVnb3J5ID0gMDsKQEAgLTI3Niw2ICszMjMsOCBAQAogICAgICAgICAgICAgaXRlbUNoZWNrZWQgPSBhLmdldEJvb2xlYW4oY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuTWVudUl0ZW1fY2hlY2tlZCwgZGVmYXVsdEl0ZW1DaGVja2VkKTsKICAgICAgICAgICAgIGl0ZW1WaXNpYmxlID0gYS5nZXRCb29sZWFuKGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLk1lbnVJdGVtX3Zpc2libGUsIGdyb3VwVmlzaWJsZSk7CiAgICAgICAgICAgICBpdGVtRW5hYmxlZCA9IGEuZ2V0Qm9vbGVhbihjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5NZW51SXRlbV9lbmFibGVkLCBncm91cEVuYWJsZWQpOworICAgICAgICAgICAgaXRlbVNob3dBc0FjdGlvbiA9IGEuZ2V0SW50KGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLk1lbnVJdGVtX3Nob3dBc0FjdGlvbiwgLTEpOworICAgICAgICAgICAgaXRlbUxpc3RlbmVyTWV0aG9kTmFtZSA9IGEuZ2V0U3RyaW5nKGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLk1lbnVJdGVtX29uQ2xpY2spOwogICAgICAgICAgICAgCiAgICAgICAgICAgICBhLnJlY3ljbGUoKTsKICAgICAgICAgICAgIApAQCAtMjk5LDkgKzM0OCwyNSBAQAogICAgICAgICAgICAgICAgIC5zZXRJY29uKGl0ZW1JY29uUmVzSWQpCiAgICAgICAgICAgICAgICAgLnNldEFscGhhYmV0aWNTaG9ydGN1dChpdGVtQWxwaGFiZXRpY1Nob3J0Y3V0KQogICAgICAgICAgICAgICAgIC5zZXROdW1lcmljU2hvcnRjdXQoaXRlbU51bWVyaWNTaG9ydGN1dCk7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIGlmIChpdGVtU2hvd0FzQWN0aW9uID49IDApIHsKKyAgICAgICAgICAgICAgICBpdGVtLnNldFNob3dBc0FjdGlvbihpdGVtU2hvd0FzQWN0aW9uKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIAorICAgICAgICAgICAgaWYgKGl0ZW1MaXN0ZW5lck1ldGhvZE5hbWUgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGlmIChtQ29udGV4dC5pc1Jlc3RyaWN0ZWQoKSkgeworICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJUaGUgYW5kcm9pZDpvbkNsaWNrIGF0dHJpYnV0ZSBjYW5ub3QgIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgImJlIHVzZWQgd2l0aGluIGEgcmVzdHJpY3RlZCBjb250ZXh0Iik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGl0ZW0uc2V0T25NZW51SXRlbUNsaWNrTGlzdGVuZXIoCisgICAgICAgICAgICAgICAgICAgICAgICBuZXcgSW5mbGF0ZWRPbk1lbnVJdGVtQ2xpY2tMaXN0ZW5lcihtQ29udGV4dCwgaXRlbUxpc3RlbmVyTWV0aG9kTmFtZSkpOworICAgICAgICAgICAgfQogCi0gICAgICAgICAgICBpZiAoaXRlbUNoZWNrYWJsZSA+PSAyKSB7Ci0gICAgICAgICAgICAgICAgKChNZW51SXRlbUltcGwpIGl0ZW0pLnNldEV4Y2x1c2l2ZUNoZWNrYWJsZSh0cnVlKTsKKyAgICAgICAgICAgIGlmIChpdGVtIGluc3RhbmNlb2YgTWVudUl0ZW1JbXBsKSB7CisgICAgICAgICAgICAgICAgTWVudUl0ZW1JbXBsIGltcGwgPSAoTWVudUl0ZW1JbXBsKSBpdGVtOworICAgICAgICAgICAgICAgIGlmIChpdGVtQ2hlY2thYmxlID49IDIpIHsKKyAgICAgICAgICAgICAgICAgICAgaW1wbC5zZXRFeGNsdXNpdmVDaGVja2FibGUodHJ1ZSk7CisgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgICAgIApkaWZmIC0tZ2l0IGEvY29yZS9qYXZhL2FuZHJvaWQvdmlldy9NZW51SXRlbS5qYXZhIGIvY29yZS9qYXZhL2FuZHJvaWQvdmlldy9NZW51SXRlbS5qYXZhCmluZGV4IGZjZWJlYzUuLjI2MDRjZjkgMTAwNjQ0Ci0tLSBhL2NvcmUvamF2YS9hbmRyb2lkL3ZpZXcvTWVudUl0ZW0uamF2YQorKysgYi9jb3JlL2phdmEvYW5kcm9pZC92aWV3L01lbnVJdGVtLmphdmEKQEAgLTMxLDYgKzMxL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gb3Igbm90IHRoZSBkZXRlY3RvciBzaG91bGQgY29udGludWUgcmVjb2duaXppbmcKQEAgLTgyLDE3ICs4MiwxNyBAQAogICAgICAgICAvKioKICAgICAgICAgICogUmVzcG9uZHMgdG8gdGhlIGVuZCBvZiBhIHNjYWxlIGdlc3R1cmUuIFJlcG9ydGVkIGJ5IGV4aXN0aW5nCiAgICAgICAgICAqIHBvaW50ZXJzIGdvaW5nIHVwLgotICAgICAgICAgKiAKKyAgICAgICAgICoKICAgICAgICAgICogT25jZSBhIHNjYWxlIGhhcyBlbmRlZCwge0BsaW5rIFNjYWxlR2VzdHVyZURldGVjdG9yI2dldEZvY3VzWCgpfQogICAgICAgICAgKiBhbmQge0BsaW5rIFNjYWxlR2VzdHVyZURldGVjdG9yI2dldEZvY3VzWSgpfSB3aWxsIHJldHVybiB0aGUgbG9jYXRpb24KICAgICAgICAgICogb2YgdGhlIHBvaW50ZXIgcmVtYWluaW5nIG9uIHRoZSBzY3JlZW4uCi0gICAgICAgICAqIAorICAgICAgICAgKgogICAgICAgICAgKiBAcGFyYW0gZGV0ZWN0b3IgVGhlIGRldGVjdG9yIHJlcG9ydGluZyB0aGUgZXZlbnQgLSB1c2UgdGhpcyB0bwogICAgICAgICAgKiAgICAgICAgICByZXRyaWV2ZSBleHRlbmRlZCBpbmZvIGFib3V0IGV2ZW50IHN0YXRlLgogICAgICAgICAgKi8KICAgICAgICAgcHVibGljIHZvaWQgb25TY2FsZUVuZChTY2FsZUdlc3R1cmVEZXRlY3RvciBkZXRlY3Rvcik7CiAgICAgfQotICAgIAorCiAgICAgLyoqCiAgICAgICogQSBjb252ZW5pZW5jZSBjbGFzcyB0byBleHRlbmQgd2hlbiB5b3Ugb25seSB3YW50IHRvIGxpc3RlbiBmb3IgYSBzdWJzZXQKICAgICAgKiBvZiBzY2FsaW5nLXJlbGF0ZWQgZXZlbnRzLiBUaGlzIGltcGxlbWVudHMgYWxsIG1ldGhvZHMgaW4KQEAgLTEwMSw3ICsxMDE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aGUKICAgICAgKiBnZXN0dXJlIGluIHByb2dyZXNzLgotICAgICAqIAorICAgICAqCiAgICAgICogQHJldHVybiBQcmV2aW91cyBkaXN0YW5jZSBiZXR3ZWVuIHBvaW50ZXJzIGluIHBpeGVscy4KICAgICAgKi8KICAgICBwdWJsaWMgZmxvYXQgZ2V0UHJldmlvdXNTcGFuKCkgewpAQCAtNDQzLDEwICs0NjMsMzAgQEAKICAgICB9CiAKICAgICAvKioKKyAgICAgKiBSZXR1cm4gdGhlIHByZXZpb3VzIHggZGlzdGFuY2UgYmV0d2VlbiB0aGUgdHdvIHBvaW50ZXJzIGZvcm1pbmcgdGhlCisgICAgICogZ2VzdHVyZSBpbiBwcm9ncmVzcy4KKyAgICAgKgorICAgICAqIEByZXR1cm4gUHJldmlvdXMgZGlzdGFuY2UgYmV0d2VlbiBwb2ludGVycyBpbiBwaXhlbHMuCisgICAgICovCisgICAgcHVibGljIGZsb2F0IGdldFByZXZpb3VzU3BhblgoKSB7CisgICAgICAgIHJldHVybiBtUHJldkZpbmdlckRpZmZYOworICAgIH0KKworICAgIC8qKgorICAgICAqIFJldHVybiB0aGUgcHJldmlvdXMgeSBkaXN0YW5jZSBiZXR3ZWVuIHRoZSB0d28gcG9pbnRlcnMgZm9ybWluZyB0aGUKKyAgICAgKiBnZXN0dXJlIGluIHByb2dyZXNzLgorICAgICAqCisgICAgICogQHJldHVybiBQcmV2aW91cyBkaXN0YW5jZSBiZXR3ZWVuIHBvaW50ZXJzIGluIHBpeGVscy4KKyAgICAgKi8KKyAgICBwdWJsaWMgZmxvYXQgZ2V0UHJldmlvdXNTcGFuWSgpIHsKKyAgICAgICAgcmV0dXJuIG1QcmV2RmluZ2VyRGlmZlk7CisgICAgfQorCisgICAgLyoqCiAgICAgICogUmV0dXJuIHRoZSBzY2FsaW5nIGZhY3RvciBmcm9tIHRoZSBwcmV2aW91cyBzY2FsZSBldmVudCB0byB0aGUgY3VycmVudAogICAgICAqIGV2ZW50LiBUaGlzIHZhb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1cywgb3IgZmFsc2Ugb3RoZXJ3aXNlLgpAQCAtNDQxMyw5ICs0NTk1LDcgQEAKICAgICAgICAgICAgICAgICAgICAgZmluYWwgaW50IHkgPSAoaW50KSBldmVudC5nZXRZKCk7CiAKICAgICAgICAgICAgICAgICAgICAgLy8gQmUgbGVuaWVudCBhYm91dCBtb3Zpbmcgb3V0c2lkZSBvZiBidXR0b25zCi0gICAgICAgICAgICAgICAgICAgIGludCBzbG9wID0gbVRvdWNoU2xvcDsKLSAgICAgICAgICAgICAgICAgICAgaWYgKCh4IDwgMCAtIHNsb3ApIHx8ICh4ID49IGdldFdpZHRoKCkgKyBzbG9wKSB8fAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICh5IDwgMCAtIHNsb3ApIHx8ICh5ID49IGdldEhlaWdodCgpICsgc2xvcCkpIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKCFwb2ludEluVmlldyh4LCB5LCBtVG91Y2hTbG9wKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgLy8gT3V0c2lkZSBidXR0b24KICAgICAgICAgICAgICAgICAgICAgICAgIHJlbW92ZVRhcENhbGxiYWNrKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoKG1Qcml2YXRlRmxhZ3MgJiBQUkVTU0VEKSAhPSAwKSB7CkBAIC00NjUwLDYgKzQ4MzAsMjggQEAKICAgICB9CiAKICAgICAvKioKKyAgICAgKiBJbnRlcmZhY2UgZGVmaW5pdGlvbiBmb3IgYSBjYWxsYmFjayB0byBiZSBpbnZva2VkIHdoZW4gdGhlIGxheW91dCBib3VuZHMgb2YgYSB2aWV3CisgICAgICogY2hhbmdlcyBkdWUgdG8gbGF5b3V0IHByb2Nlc3NpbmcuCisgICAgICovCisgICAgcHVibGljIGludGVyZmFjZSBPbkxheW91dENoYW5nZUxpc3RlbmVyIHsKKyAgICAgICAgLyoqCisgICAgICAgICAqIENhbGxlZCB3aGVuIHRoZSBmb2N1cyBzdGF0ZSBvZiBhIHZpZ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SBtTGVmdCkgIT0gbVByZXZXaWR0aCAmJiAobUJvdHRvbSAtIG1Ub3ApICE9IG1QcmV2SGVpZ2h0KSB7CisgICAgICAgICAgICAgICAgICAgIG1QcmV2V2lkdGggPSBtUmlnaHQgLSBtTGVmdDsKKyAgICAgICAgICAgICAgICAgICAgbVByZXZIZWlnaHQgPSBtQm90dG9tIC0gbVRvcDsKKyAgICAgICAgICAgICAgICAgICAgbVBpdm90WCA9IChmbG9hdCkgbVByZXZXaWR0aCAvIDJmOworICAgICAgICAgICAgICAgICAgICBtUGl2b3RZID0gKGZsb2F0KSBtUHJldkhlaWdodCAvIDJmOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1NYXRyaXgucmVzZXQoKTsKKyAgICAgICAgICAgIG1NYXRyaXguc2V0VHJhbnNsYXRlKG1UcmFuc2xhdGlvblgsIG1UcmFuc2xhdGlvblkpOworICAgICAgICAgICAgbU1hdHJpeC5wcmVSb3RhdGUobVJvdGF0aW9uLCBtUGl2b3RYLCBtUGl2b3RZKTsKKyAgICAgICAgICAgIG1NYXRyaXgucHJlU2NhbGUobVNjYWxlWCwgbVNjYWxlWSwgbVBpdm90WCwgbVBpdm90WSk7CisgICAgICAgICAgICBpZiAobm9uemVybyhtUm90YXRpb25YKSB8fCBub256ZXJvKG1Sb3RhdGlvblkpKSB7CisgICAgICAgICAgICAgICAgaWYgKG1DYW1lcmEgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBtQ2FtZXJhID0gbmV3IENhbWVyYSgpOworICAgICAgICAgICAgICAgICAgICBtYXRyaXgzRCA9IG5ldyBNYXRyaXgoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgbUNhbWVyYS5zYXZlKCk7CisgICAgICAgICAgICAgICAgbUNhbWVyYS5yb3RhdGVYKG1Sb3RhdGlvblgpOworICAgICAgICAgICAgICAgIG1DYW1lcmEucm90YXRlWShtUm90YXRpb25ZKTsKKyAgICAgICAgICAgICAgICBtQ2FtZXJhLmdldE1hdHJpeChtYXRyaXgzRCk7CisgICAgICAgICAgICAgICAgbWF0cml4M0QucHJlVHJhbnNsYXRlKC1tUGl2b3RYLCAtbVBpdm90WSk7CisgICAgICAgICAgICAgICAgbWF0cml4M0QucG9zdFRyYW5zbGF0ZShtUGl2b3RYLCBtUGl2b3RZKTsKKyAgICAgICAgICAgICAgICBtTWF0cml4LnBvc3RDb25jYXQobWF0cml4M0QpOworICAgICAgICAgICAgICAgIG1DYW1lcmEucmVzdG9yZSgpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbU1hdHJpeERpcnR5ID0gZmFsc2U7CisgICAgICAgICAgICBtTWF0cml4SXNJZGVudGl0eSA9IG1NYXRyaXguaXNJZGVudGl0eSgpOworICAgICAgICAgICAgbUludmVyc2VNYXRyaXhEaXJ0eSA9IHRydWU7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIG1NYXRyaXhJc0lkZW50aXR5OworICAgIH0KKworICAgIC8qKgorICAgICAqIFV0aWxpdHkgbWV0aG9kIHRvIHJldHJpZXZlIHRoZSBpbnZlcnNlIG9mIHRoZSBjdXJyZW50IG1NYXRyaXggcHJvcGVydHkuCisgICAgICogV2UgY2FjaGUgdGhlIG1hdHJpeCB0byBhdm9pZCByZWNhbGN1bGF0aW5nIGl0IHdoZW4gdHJhbnNmb3JtIHByb3BlcnRpZXMKKyAgICAgKiBoYXZlIG5vdCBjaGFuZ2VkLgorICAgICAqCisgICAgICogQHJldHVybiBUaGUgaW52ZXJzZSBvZiB0aGUgY3VycmVudCBtYXRyaXggb2YgdGhpcyB2aWV3LgorICAgICAqLworICAgIE1hdHJpeCBnZXRJbnZlcnNlTWF0cml4KCkgeworICAgICAgICBpZiAobUludmVyc2VNYXRyaXhEaXJ0eSkgeworICAgICAgICAgICAgaWYgKG1JbnZlcnNlTWF0cml4ID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICBtSW52ZXJzZU1hdHJpeCA9IG5ldyBNYXRyaXgoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1NYXRyaXguaW52ZXJ0KG1JbnZlcnNlTWF0cml4KTsKKyAgICAgICAgICAgIG1JbnZlcnNlTWF0cml4RGlydHkgPSBmYWxzZTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbUludmVyc2VNYXRyaXg7CisgICAgfQorCisgICAgLyoqCisgICAgICogVGhlIGRlZ3JlZXMgdGhhdCB0aGUgdmlldyBpcyByb3RhdGVkIGFyb3VuZCB0aGUgcGl2b3QgcG9pbnQuCisgICAgICoKKyAgICAgKiBAc2VlICNnZXRQaXZvdFgoKQorICAgICAqIEBzZWUgI2dldFBpdm90WSgpCisgICAgICogQHJldHVybiBUaGUgZGVncmVlcyBvZiByb3RhdGlvbi4KKyAgICAgKi8KKyAgICBwdWJsaWMgZmxvYXQgZ2V0Um90YXRpb24oKSB7CisgICAgICAgIHJldHVybiBtUm90YXRpb247CisgICAgfQorCisgICAgLyoqCisgICAgICogU2V0cyB0aGUgZGVncmVlcyB0aGF0IHRoZSB2aWV3IGlzIHJvdGF0ZWQgYXJvdW5kIHRoZSBwaXZvdCBwb2ludC4KKyAgICAgKgorICAgICAqIEBwYXJhbSByb3RhdGlvbiBUaGUgZGVncmVlcyBvZiByb3RhdGlvbi4KKyAgICAgKiBAc2VlICNnZXRQaXZvdFgoKQorICAgICAqIEBzZWUgI2dldFBpdm90WSgpCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0Um90YXRpb24oZmxvYXQgcm90YXRpb24pIHsKKyAgICAgICAgaWYgKG1Sb3RhdGlvbiAhPSByb3RhdGlvbikgeworICAgICAgICAgICAgLy8gRG91YmxlLWludmFsaWRhdGlvbiBpcyBuZWNlc3NhcnkgdG8gY2FwdHVyZSB2aWV3J3Mgb2xkIGFuZCBuZXcgYXJlYXMKKyAgICAgICAgICAgIGludmFsaWRhdGUoKTsKKyAgICAgICAgICAgIG1Sb3RhdGlvbiA9IHJvdGF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pZXcncyBvbGQgYW5kIG5ldyBhcmVhcworICAgICAgICAgICAgaW52YWxpZGF0ZSgpOworICAgICAgICAgICAgbVJvdGF0aW9uWSA9IHJvdGF0aW9uWTsKKyAgICAgICAgICAgIG1NYXRyaXhEaXJ0eSA9IHRydWU7CisgICAgICAgICAgICBtUHJpdmF0ZUZsYWdzIHw9IERSQVdOOyAvLyBmb3JjZSBhbm90aGVyIGludmFsaWRhdGlvbiB3aXRoIHRoZSBuZXcgb3JpZW50YXRpb24KKyAgICAgICAgICAgIGludmFsaWRhdGUoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIFRoZSBkZWdyZWVzIHRoYXQgdGhlIHZpZXcgaXMgcm90YXRlZCBhcm91bmQgdGhlIGhvcml6b250YWwgYXhpcyB0aHJvdWdoIHRoZSBwaXZvdCBwb2ludC4KKyAgICAgKgorICAgICAqIEBzZWUgI2dldFBpdm90WCgpCisgICAgICogQHNlZSAjZ2V0UGl2b3RZKCkKKyAgICAgKiBAcmV0dXJuIFRoZSBkZWdyZWVzIG9mIFggcm90YXRpb24uCisgICAgICovCisgICAgcHVibGljIGZsb2F0IGdldFJvdGF0aW9uWCgpIHsKKyAgICAgICAgcmV0dXJuIG1Sb3RhdGlvblg7CisgICAgfQorCisgICAgLyoqCisgICAgICogU2V0cyB0aGUgZGVncmVlcyB0aGF0IHRoZSB2aWV3IGlzIHJvdGF0ZWQgYXJvdW5kIHRoZSBob3Jpem9udGFsIGF4aXMgdGhyb3VnaCBwaXZvdCBwb2ludC4KKyAgICAgKgorICAgICAqIEBwYXJhbSByb3RhdGlvblggVGhlIGRlZ3JlZXMgb2YgWCByb3RhdGlvbi4KKyAgICAgKiBAc2VlICNnZXRQaXZvdFgoKQorICAgICAqIEBzZWUgI2dldFBpdm90WSgpCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0Um90YXRpb25YKGZsb2F0IHJvdGF0aW9uWCkgeworICAgICAgICBpZiAobVJvdGF0aW9uWCAh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EBzZWUgI2dldFBpdm90WSgpCisgICAgICogQHJldHVybiBUaGUgc2NhbGluZyBmYWN0b3IuCisgICAgICovCisgICAgcHVibGljIGZsb2F0IGdldFNjYWxlWSgpIHsKKyAgICAgICAgcmV0dXJuIG1TY2FsZVk7CisgICAgfQorCisgICAgLyoqCisgICAgICogU2V0cyB0aGUgYW1vdW50IHRoYXQgdGhlIHZpZXcgaXMgc2NhbGVkIGluIFkgYXJvdW5kIHRoZSBwaXZvdCBwb2ludCwgYXMgYSBwcm9wb3J0aW9uIG9mCisgICAgICogdGhlIHZpZXcncyB1bnNjYWxlZCB3aWR0aC4gQSB2YWx1ZSBvZiAxIG1lYW5zIHRoYXQgbm8gc2NhbGluZyBpcyBhcHBsaWVkLgorICAgICAqCisgICAgICogQHBhcmFtIHNjYWxlWSBUaGUgc2NhbGluZyBmYWN0b3IuCisgICAgICogQHNlZSAjZ2V0UGl2b3RYKCkKKyAgICAgKiBAc2VlICNnZXRQaXZvdFkoKQorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNldFNjYWxlWShmbG9hdCBzY2FsZVkpIHsKKyAgICAgICAgaWYgKG1TY2FsZVkgIT0gc2NhbGVZKSB7CisgICAgICAgICAgICAvLyBEb3VibGUtaW52YWxpZGF0aW9uIGlzIG5lY2Vzc2FyeSB0byBjYXB0dXJlIHZpZXcncyBvbGQgYW5kIG5ldyBhcmVhcworICAgICAgICAgICAgaW52YWxpZGF0ZSgpOworICAgICAgICAgICAgbVNjYWxlWSA9IHNjYWxlWTsKKyAgICAgICAgICAgIG1NYXRyaXhEaXJ0eSA9IHRydWU7CisgICAgICAgICAgICBtUHJpdmF0ZUZsYWdzIHw9IERSQVdOOyAvLyBmb3JjZSBhbm90aGVyIGludmFsaWRhdGlvbiB3aXRoIHRoZSBuZXcgb3JpZW50YXRpb24KKyAgICAgICAgICAgIGludmFsaWRhdGUoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIFRoZSB4IGxvY2F0a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lWCgpCisgICAgICogQHNlZSAjZ2V0U2NhbGVZKCkKKyAgICAgKiBAc2VlICNnZXRQaXZvdFkoKQorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNldFBpdm90WChmbG9hdCBwaXZvdFgpIHsKKyAgICAgICAgbVByaXZhdGVGbGFncyB8PSBQSVZPVF9FWFBMSUNJVExZX1NFVDsKKyAgICAgICAgaWYgKG1QaXZvdFggIT0gcGl2b3RYKSB7CisgICAgICAgICAgICAvLyBEb3VibGUtaW52YWxpZGF0aW9uIGlzIG5lY2Vzc2FyeSB0byBjYXB0dXJlIHZpZXcncyBvbGQgYW5kIG5ldyBhcmVhcworICAgICAgICAgICAgaW52YWxpZGF0ZSgpOworICAgICAgICAgICAgbVBpdm90WCA9IHBpdm90WDsKKyAgICAgICAgICAgIG1NYXRyaXhEaXJ0eSA9IHRydWU7CisgICAgICAgICAgICBtUHJpdmF0ZUZsYWdzIHw9IERSQVdOOyAvLyBmb3JjZSBhbm90aGVyIGludmFsaWRhdGlvbiB3aXRoIHRoZSBuZXcgb3JpZW50YXRpb24KKyAgICAgICAgICAgIGludmFsaWRhdGUoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIFRoZSB5IGxvY2F0aW9uIG9mIHRoZSBwb2ludCBhcm91bmQgd2hpY2ggdGhlIHZpZXcgaXMge0BsaW5rICNzZXRSb3RhdGlvbihmbG9hdCkgcm90YXRlZH0KKyAgICAgKiBhbmQge0BsaW5rICNzZXRTY2FsZVkoZmxvYXQpIHNjYWxlZH0uCisgICAgICoKKyAgICAgKiBAc2VlICNnZXRSb3RhdGlvbigpCisgICAgICogQHNlZSAjZ2V0U2NhbGVYKCkKKyAgICAgKiBAc2VlICNnZXRTY2FsZVkoKQorICAgICAqIEBzZWUgI2dldFBpdm90WSgpCisgICAgICogQHJldHVybiBUaGUgeSBsb2NhdGlvbiBvZiB0aGUgcGl2b3QgcG9pbnQuCisgICAgICovCisgICAgcHVibGljIGZsb2F0IG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hbHBoYSAqIDI1NSkpOworICAgICAgICBpbnZhbGlkYXRlKCk7CisgICAgfQorCisgICAgLyoqCiAgICAgICogVG9wIHBvc2l0aW9uIG9mIHRoaXMgdmlldyByZWxhdGl2ZSB0byBpdHMgcGFyZW50LgogICAgICAqCiAgICAgICogQHJldHVybiBUaGUgdG9wIG9mIHRoaXMgdmlldywgaW4gcGl4ZWxzLgpAQCAtNDc3MSw2ICs1MzEyLDQ1IEBACiAgICAgfQogCiAgICAgLyoqCisgICAgICogU2V0cyB0aGUgdG9wIHBvc2l0aW9uIG9mIHRoaXMgdmlldyByZWxhdGl2ZSB0byBpdHMgcGFyZW50LiBUaGlzIG1ldGhvZCBpcyBtZWFudCB0byBiZSBjYWxsZWQKKyAgICAgKiBieSB0aGUgbGF5b3V0IHN5c3RlbSBhbmQgc2hvdWxkIG5vdCBnZW5lcmFsbHkgYmUgY2FsbGVkIG90aGVyd2lzZSwgYmVjYXVzZSB0aGUgcHJvcGVydHkKKyAgICAgKiBtYXkgYmUgY2hhbmdlZCBhdCBhbnkgdGltZSBieSB0aGUgbGF5b3V0LgorICAgICAqCisgICAgICogQHBhcmFtIHRvcCBUaGUgdG9wIG9mIHRoaXMgdmlldywgaW4gcGl4ZWxzLgorICAgICAqLworICAgIHB1YmxpYyBmaW5hbCB2b2lkIHNldFRvcChpbnQgdG9wKSB7CisgICAgICAgIGlmICh0b3AgIT0gbVRvcCkgeworICAgICAgICAgICAgaWYgKGhhc0lkZW50aXR5TWF0cml4KCkpIHsKKyAgICAgICAgICAgICAgICBmaW5hbCBWaWV3UGFyZW50IHAgPSBtUGFyZW50OworICAgICAgICAgICAgICAgIGlmIChwICE9IG51bGwgJiYgbUF0dGFjaEluZm8gIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBmaW5hbCBSZWN0IHIgPSBtQXR0YWNoSW5mby5tVG1wSW52YWxSZWN0OworICAgICAgICAgICAgICAgICAgICBpbnQgbWluVG9wOworICAgICAgICAgICAgICAgICAgICBpbnQgeUxvYzsKKyAgICAgICAgICAgICAgICAgICAgaWYgKHRvcCA8IG1Ub3ApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1pblRvcCA9IHRvcDsKKyAgICAgICAgICAgICAgICAgICAgICAgIHlMb2MgPSB0b3AgLSBtVG9wOworICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgbWluVG9wID0gbVRvcDsKKyAgICAgICAgICAgICAgICAgICAgICAgIHlMb2MgPSAwOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIHIuc2V0KDAsIHlMb2MsIG1SaWdodCAtIG1MZWZ0LCBtQm90dG9tIC0gbWluVG9wKTsKKyAgICAgICAgICAgICAgICAgICAgcC5pbnZhbGlkYXRlQ2hpbGQodGhpcywgcik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAvLyBEb3VibGUtaW52YWxpZGF0aW9uIGlzIG5lY2Vzc2FyeSB0byBjYXB0dXJlIHZpZXcncyBvbGQgYW5kIG5ldyBhcmVhcworICAgICAgICAgICAgICAgIGludmFsaWRhdGUoKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgbVRvcCA9IHRvcDsKKworICAgICAgICAgICAgaWYgKCFtTWF0cml4SXNJZGVudGl0eSkgeworICAgICAgICAgICAgICAgIG1Qcml2YXRlRmxhZ3MgfD0gRFJBV047IC8vIGZvcmNlIGFub3RoZXIgaW52YWxpZGF0aW9uIHdpdGggdGhlIG5ldyBvcmllbnRhdGlvbgorICAgICAgICAgICAgICAgIGludmFsaWRhdGUoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgogICAgICAqIEJvdHRvbSBwb3NpdGlvbiBvZiB0aGlzIHZpZXcgcmVsYXRpdmUgdG8gaXRzIHBhcmVudC4KICAgICAgKgogICAgICAqIEByZXR1cm4gVGhlIGJvdHRvbSBvZiB0aGlzIHZpZXcsIGluIHBpeGVscy4KQEAgLTQ3ODEsNiArNTM2MSw0MiBAQAogICAgIH0KIAogICAgIC8qKgorICAgICAqIFNldHMgdGhlIGJvdHRvbSBwb3NpdGlvbiBvZiB0aGlzIHZpZXcgcmVsYXRpdmUgdG8gaXRzIHBhcmVudC4gVGhpcyBtZXRob2QgaXMgbWVhbnQgdG8gYmUKKyAgICAgKiBjYWxsZWQgYnkgdGhlIGxheW91dCBzeXN0ZW0gYW5kIHNob3VsZCBub3QgZ2VuZXJhbGx5IGJlIGNhbGxlZCBvdGhlcndpc2UsIGJlY2F1c2UgdGhlCisgICAgICogcHJvcGVydHkgbWF5IGJlIGNoYW5nZWQgYXQgYW55IHRpbWUgYnkgdGhlIGxheW91dC4KKyAgICAgKgorICAgICAqIEBwYXJhbSBib3R0b20gVGhlIGJvdHRvbSBvZiB0aGlzIHZpZXcsIGluIHBpeGVscy4KKyAgICAgKi8KKyAgICBwdWJsaWMgZmluYWwgdm9pZCBzZXRCb3R0b20oaW50IGJvdHRvbSkgeworICAgICAgICBpZiAoYm90dG9tICE9IG1Cb3R0b20pIHsKKyAgICAgICAgICAgIGlmIChoYXNJZGVudGl0eU1hdHJpeCgpKSB7CisgICAgICAgICAgICAgICAgZmluYWwgVmlld1BhcmVudCBwID0gbVBhcmVudDsKKyAgICAgICAgICAgICAgICBpZiAocCAhPSBudWxsICYmIG1BdHRhY2hJbmZvICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgZmluYWwgUmVjdCByID0gbUF0dGFjaEluZm8ubVRtcEludmFsUmVjdDsKKyAgICAgICAgICAgICAgICAgICAgaW50IG1heEJvdHRvbTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGJvdHRvbSA8IG1Cb3R0b20pIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1heEJvdHRvbSA9IG1Cb3R0b207CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtYXhCb3R0b20gPSBib3R0b207CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgci5zZXQoMCwgMCwgbVJpZ2h0IC0gbUxlZnQsIG1heEJvdHRvbSAtIG1Ub3ApOworICAgICAgICAgICAgICAgICAgICBwLmludmFsaWRhdGVDaGlsZCh0aGlzLCByKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIC8vIERvdWJsZS1pbnZhbGlkYXRpb24gaXMgbmVjZXNzYXJ5IHRvIGNhcHR1cmUgdmlldydzIG9sZCBhbmQgbmV3IGFyZWFzCisgICAgICAgICAgICAgICAgaW52YWxpZGF0ZSgpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBtQm90dG9tID0gYm90dG9tOworCisgICAgICAgICAgICBpZiAoIW1NYXRyaXhJc0lkZW50aXR5KSB7CisgICAgICAgICAgICAgICAgbVByaXZhdGVGbGFncyB8PSBEUkFXTjsgLy8gZm9yY2UgYW5vdGhlciBpbnZhbGlkYXRpb24gd2l0aCB0aGUgbmV3IG9yaWVudGF0aW9uCisgICAgICAgICAgICAgICAgaW52YWxpZGF0ZSgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgLyoqCiAgICAgICogTGVmdCBwb3NpdGlvbiBvZiB0aGlzIHZpZXcgcmVsYXRpdmUgdG8gaXRzIHBhcmVudC4KICAgICAgKgogICAgICAqIEByZXR1cm4gVGhlIGxlZnQgZWRnZSBvZiB0aGlzIHZpZXcsIGluIHBpeGVscy4KQEAgLTQ3OTEsNiArNTQwNyw0NiBAQAogICAgIH0KIAogICAgIC8qKgorICAgICAqIFNldHMgdGhlIGxlZnQgcG9zaXRpb24gb2YgdGhpcyB2aWV3IHJlbGF0aXZlIHRvIGl0cyBwYXJlbnQuIFRoaXMgbWV0aG9kIGlzIG1lYW50IHRvIGJlIGNhbGxlZAorICAgICAqIGJ5IHRoZSBsYXlvdXQgc3lzdGVtIGFuZCBzaG91bGQgbm90IGdlbmVyYWxseSBiZSBjYWxsZWQgb3RoZXJ3aXNlLCBiZWNhdXNlIHRoZSBwcm9wZXJ0eQorICAgICAqIG1heSBiZSBjaGFuZ2VkIGF0IGFueSB0aW1lIGJ5IHRoZSBsYXlvdXQuCisgICAgICoKKyAgICAgKiBAcGFyYW0gbGVmdCBUaGUgYm90dG9tIG9mIHRoaXMgdmlldywgaW4gcGl4ZWxzLgorICAgICAqLworICAgIHB1YmxpYyBmaW5hbCB2b2lkIHNldExlZnQoaW50IGxlZnQpIHsKKyAgICAgICAgaWYgKGxlZnQgIT0gbUxlZnQpIHsKKyAgICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigidmlldyAiICsgdGhpcyArICIgbGVmdCA9ICIgKyBsZWZ0KTsKKyAgICAgICAgICAgIGlmIChoYXNJZGVudGl0eU1hdHJpeCgpKSB7CisgICAgICAgICAgICAgICAgZmluYWwgVmlld1BhcmVudCBwID0gbVBhcmVudDsKKyAgICAgICAgICAgICAgICBpZiAocCAhPSBudWxsICYmIG1BdHRhY2hJbmZvICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgZmluYWwgUmVjdCByID0gbUF0dGFjaEluZm8ubVRtcEludmFsUmVjdDsKKyAgICAgICAgICAgICAgICAgICAgaW50IG1pbkxlZnQ7CisgICAgICAgICAgICAgICAgICAgIGludCB4TG9jOworICAgICAgICAgICAgICAgICAgICBpZiAobGVmdCA8IG1MZWZ0KSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtaW5MZWZ0ID0gbGVmdDsKKyAgICAgICAgICAgICAgICAgICAgICAgIHhMb2MgPSBsZWZ0IC0gbUxlZnQ7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtaW5MZWZ0ID0gbUxlZnQ7CisgICAgICAgICAgICAgICAgICAgICAgICB4TG9jID0gMDsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICByLnNldCh4TG9jLCAwLCBtUmlnaHQgLSBtaW5MZWZ0LCBtQm90dG9tIC0gbVRvcCk7CisgICAgICAgICAgICAgICAgICAgIHAuaW52YWxpZGF0ZUNoaWxkKHRoaXMsIHIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgLy8gRG91YmxlLWludmFsaWRhdGlvbiBpcyBuZWNlc3NhcnkgdG8gY2FwdHVyZSB2aWV3J3Mgb2xkIGFuZCBuZXcgYXJlYXMKKyAgICAgICAgICAgICAgICBpbnZhbGlkYXRlKCk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIG1MZWZ0ID0gbGVmdDsKKworICAgICAgICAgICAgaWYgKCFtTWF0cml4SXNJZGVudGl0eSkgeworICAgICAgICAgICAgICAgIG1Qcml2YXRlRmxhZ3MgfD0gRFJBV047IC8vIGZvcmNlIGFub3RoZXIgaW52YWxpZGF0aW9uIHdpdGggdGhlIG5ldyBvcmllbnRhdGlvbgorICAgICAgICAgICAgICAgIGludmFsaWRhdGUoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgogICAgICAqIFJpZ2h0IHBvc2l0aW9uIG9mIHRoaXMgdmlldyByZWxhdGl2ZSB0byBpdHMgcGFyZW50LgogICAgICAqCiAgICAgICogQHJldHVybiBUaGUgcmlnaHQgZWRnZSBvZiB0aGlzIHZpZXcsIGluIHBpeGVscy4KQEAgLTQ4MDEsMTIgKzU0NTcsMTc0IEBACiAgICAgfQogCiAgICAgLyoqCisgICAgICogU2V0cyB0aGUgcmlnaHQgcG9zaXRpb24gb2YgdGhpcyB2aWV3IHJlbGF0aXZlIHRvIGl0cyBwYXJlbnQuIFRoaXMgbWV0aG9kIGlzIG1lYW50IHRvIGJlIGNhbGxlZAorICAgICAqIGJ5IHRoZSBsYXlvdXQgc3lzdGVtIGFuZCBzaG91bGQgbm90IGdlbmVyYWxseSBiZSBjYWxsZWQgb3RoZXJ3aXNlLCBiZWNhdXNlIHRoZSBwcm9wZXJ0eQorICAgICAqIG1heSBiZSBjaGFuZ2VkIGF0IGFueSB0aW1lIGJ5IHRoZSBsYXlvdXQuCisgICAgICoKKyAgICAgKiBAcGFyYW0gcmlnaHQgVGhlIGJvdHRvbSBvZiB0aGlzIHZpZXcsIGluIHBpeGVscy4KKyAgICAgKi8KKyAgICBwdWJsaWMgZmluYWwgdm9pZCBzZXRSaWdodChpbnQgcmlnaHQpIHsKKyAgICAgICAgaWYgKHJpZ2h0ICE9IG1SaWdodCkgeworICAgICAgICAgICAgaWYgKGhhc0lkZW50aXR5TWF0cml4KCkpIHsKKyAgICAgICAgICAgICAgICBmaW5hbCBWaWV3UGFyZW50IHAgPSBtUGFyZW50OworICAgICAgICAgICAgICAgIGlmIChwICE9IG51bGwgJiYgbUF0dGFjaEluZm8gIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBmaW5hbCBSZWN0IHIgPSBtQXR0YWNoSW5mby5tVG1wSW52YWxSZWN0OworICAgICAgICAgICAgICAgICAgICBpbnQgbWF4UmlnaHQ7CisgICAgICAgICAgICAgICAgICAgIGlmIChyaWdodCA8IG1SaWdodCkgeworICAgICAgICAgICAgICAgICAgICAgICAgbWF4UmlnaHQgPSBtUmlnaHQ7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtYXhSaWdodCA9IHJpZ2h0OworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIHIuc2V0KDAsIDAsIG1heFJpZ2h0IC0gbUxlZnQsIG1Cb3R0b20gLSBtVG9wKTsKKyAgICAgICAgICAgICAgICAgICAgcC5pbnZhbGlkYXRlQ2hpbGQodGhpcywgcik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAvLyBEb3VibGUtaW52YWxpZGF0aW9uIGlzIG5lY2Vzc2FyeSB0byBjYXB0dXJlIHZpZXcncyBvbGQgYW5kIG5ldyBhcmVhcworICAgICAgICAgICAgICAgIGludmFsaWRhdGUoKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgbVJpZ2h0ID0gcmlnaHQ7CisKKyAgICAgICAgICAgIGlmICghbU1hdHJpeElzSWRlbnRpdHkpIHsKKyAgICAgICAgICAgICAgICBtUHJpdmF0ZUZsYWdzIHw9IERSQVdOOyAvLyBmb3JjZSBhbm90aGVyIGludmFsaWRhdGlvbiB3aXRoIHRoZSBuZXcgb3JpZW50YXRpb24KKyAgICAgICAgICAgICAgICBpbnZhbGlkYXRlKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBUaGUgdmlzdWFsIHggcG9zaXRpb24gb2YgdGhpcyB2aWV3LCBpbiBwaXhlbHMuIFRoaXMgaXMgZXF1aXZhbGVudCB0byB0aGUKKyAgICAgKiB7QGxpbmsgI3NldFRyYW5zbGF0aW9uWChmbG9hdCkgdHJhbnNsYXRpb25YfSBwcm9wZXJ0eSBwbHVzIHRoZSBjdXJyZW50CisgICAgICoge0BsaW5rICNnZXRMZWZ0KCkgbGVmdH0gcHJvcGVydHkuIAorICAgICAqCisgICAgICogQHJldHVybiBUaGUgdmlzdWFsIHggcG9zaXRpb24gb2YgdGhpcyB2aWV3LCBpbiBwaXhlbHMuCisgICAgICovCisgICAgcHVibGljIGZsb2F0IGdldFgoKSB7CisgICAgICAgIHJldHVybiBtTGVmdCArIG1UcmFuc2xhdGlvblg7CisgICAgfQorCisgICAgLyoqCisgICAgICogU2V0cyB0aGUgdmlzdWFsIHggcG9zaXRpb24gb2YgdGhpcyB2aWV3LCBpbiBwaXhlbHMuIFRoaXMgaXMgZXF1aXZhbGVudCB0byBzZXR0aW5nIHRoZQorICAgICAqIHtAbGluayAjc2V0VHJhbnNsYXRpb25YKGZsb2F0KSB0cmFuc2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Z3MgfD0gRFJBV047IC8vIGZvcmNlIGFub3RoZXIgaW52YWxpZGF0aW9uIHdpdGggdGhlIG5ldyBvcmllbnRhdGlvbgorICAgICAgICAgICAgaW52YWxpZGF0ZSgpOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCiAgICAgICogSGl0IHJlY3RhbmdsZSBpbiBwYXJlbnQncyBjb29yZGluYXRlcwogICAgICAqCiAgICAgICogQHBhcmFtIG91dFJlY3QgVGhlIGhpdCByZWN0YW5nbGUgb2YgdGhlIHZpZXcuCiAgICAgICovCiAgICAgcHVibGljIHZvaWQgZ2V0SGl0UmVjdChSZWN0IG91dFJlY3QpIHsKLSAgICAgICAgb3V0UmVjdC5zZXQobUxlZnQsIG1Ub3AsIG1SaWdodCwgbUJvdHRvbSk7CisgICAgICAgIGlmIChoYXNJZGVudGl0eU1hdHJpeCgpIHx8IG1BdHRhY2hJbmZvID09IG51bGwpIHsKKyAgICAgICAgICAgIG91dFJlY3Quc2V0KG1MZWZ0LCBtVG9wLCBtUmlnaHQsIG1Cb3R0b20pOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgTWF0cml4IG0gPSBnZXRNYXRyaXgoKTsKKyAgICAgICAgICAgIGZpbmFsIFJlY3RGIHRtcFJlY3QgPSBtQXR0YWNoSW5mby5tVG1wVHJhbnNmb3JtUmVjdDsKKyAgICAgICAgICAgIHRtcFJlY3Quc2V0KC1tUGl2b3RYLCAtbVBpdm90WSwgZ2V0V2lkdGgoKSAtIG1QaXZvdFgsIGdldEhlaWdodCgpIC0gbVBpdm90WSk7CisgICAgICAgICAgICBtLm1hcFJlY3QodG1wUmVjdCk7CisgICAgICAgICAgICBvdXRSZWN0LnNldCgoaW50KSB0bXBSZWN0LmxlZnQgKyBtTGVmdCwgKGludCkgdG1wUmVjdC50b3AgKyBtVG9wLAorICAgICAgICAgICAgICAgICAgICAoaW50KSB0bXBSZWN0LnJpZ2h0ICsgbUxlZnQsIChpbnQpIHRtcFJlY3QuYm90dG9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NJZGVudGl0eU1hdHJpeCgpKSB7CisgICAgICAgICAgICAgICAgZmluYWwgVmlld1BhcmVudCBwID0gbVBhcmVudDsKKyAgICAgICAgICAgICAgICBpZiAocCAhPSBudWxsICYmIG1BdHRhY2hJbmZvICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgZmluYWwgUmVjdCByID0gbUF0dGFjaEluZm8ubVRtcEludmFsUmVjdDsKKyAgICAgICAgICAgICAgICAgICAgaW50IG1pblRvcDsKKyAgICAgICAgICAgICAgICAgICAgaW50IG1heEJvdHRvbTsKKyAgICAgICAgICAgICAgICAgICAgaW50IHlMb2M7CisgICAgICAgICAgICAgICAgICAgIGlmIChvZmZzZXQgPCAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtaW5Ub3AgPSBtVG9wICsgb2Zmc2V0OworICAgICAgICAgICAgICAgICAgICAgICAgbWF4Qm90dG9tID0gbUJvdHRvbTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHlMb2MgPSBvZmZzZXQ7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtaW5Ub3AgPSBtVG9wOworICAgICAgICAgICAgICAgICAgICAgICAgbWF4Qm90dG9tID0gbUJvdHRvbSArIG9mZnNldDsKKyAgICAgICAgICAgICAgICAgICAgICAgIHlMb2MgPSAwOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIHIuc2V0KDAsIHlMb2MsIG1SaWdodCAtIG1MZWZ0LCBtYXhCb3R0b20gLSBtaW5Ub3ApOworICAgICAgICAgICAgICAgICAgICBwLmludmFsaWRhdGVDaGlsZCh0aGlzLCByKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGludmFsaWRhdGUoKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgbVRvcCArPSBvZmZzZXQ7CisgICAgICAgICAgICBtQm90dG9tICs9IG9mZnNldDsKKworICAgICAgICAgICAgaWYgKCFtTWF0cml4SXNJZGVudGl0eSkgeworICAgICAgICAgICAgICAgIG1Qcml2YXRlRmxhZ3MgfD0gRFJBV047IC8vIGZvcmNlIGFub3RoZXIgaW52YWxpZGF0aW9uIHdpdGggdGhlIG5ldyBvcmllbnRhdGlvbgorICAgICAgICAgICAgICAgIGludmFsaWRhdGUoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQogICAgIH0KIAogICAgIC8qKgpAQCAtNDg3OSw4ICs1NzI3LDM1IEBACiAgICAgICogQHBhcmFtIG9mZnNldCB0aGUgbnVtZXIgb2YgcGl4ZWxzIHRvIG9mZnNldCB0aGUgdmlldyBieQogICAgICAqLwogICAgIHB1YmxpYyB2b2lkIG9mZnNldExlZnRBbmRSaWdodChpbnQgb2Zmc2V0KSB7Ci0gICAgICAgIG1MZWZ0ICs9IG9mZnNldDsKLSAgICAgICAgbVJpZ2h0ICs9IG9mZnNldDsKKyAgICAgICAgaWYgKG9mZnNldCAhPSAwKSB7CisgICAgICAgICAgICBpZiAoaGFzSWRlbnRpdHlNYXRyaXgoKSkgeworICAgICAgICAgICAgICAgIGZpbmFsIFZpZXdQYXJlbnQgcCA9IG1QYXJlbnQ7CisgICAgICAgICAgICAgICAgaWYgKHAgIT0gbnVsbCAmJiBtQXR0YWNoSW5mbyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIGZpbmFsIFJlY3QgciA9IG1BdHRhY2hJbmZvLm1UbXBJbnZhbFJlY3Q7CisgICAgICAgICAgICAgICAgICAgIGludCBtaW5MZWZ0OworICAgICAgICAgICAgICAgICAgICBpbnQgbWF4UmlnaHQ7CisgICAgICAgICAgICAgICAgICAgIGlmIChvZmZzZXQgPCAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtaW5MZWZ0ID0gbUxlZnQgKyBvZmZzZXQ7CisgICAgICAgICAgICAgICAgICAgICAgICBtYXhSaWdodCA9IG1SaWdodDsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1pbkxlZnQgPSBtTGVmdDsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1heFJpZ2h0ID0gbVJpZ2h0ICsgb2Zmc2V0OworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIHIuc2V0KDAsIDAsIG1heFJpZ2h0IC0gbWluTGVmdCwgbUJvdHRvbSAtIG1Ub3ApOworICAgICAgICAgICAgICAgICAgICBwLmludmFsaWRhdGVDaGlsZCh0aGlzLCByKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGludmFsaWRhdGUoKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgbUxlZnQgKz0gb2Zmc2V0OworICAgICAgICAgICAgbVJpZ2h0ICs9IG9mZnNldDsKKworICAgICAgICAgICAgaWYgKCFtTWF0cml4SXNJZGVudGl0eSkgeworICAgICAgICAgICAgICAgIG1Qcml2YXRlRmxhZ3MgfD0gRFJBV047IC8vIGZvcmNlIGFub3RoZXIgaW52YWxpZGF0aW9uIHdpdGggdGhlIG5ldyBvcmllbnRhdGlvbgorICAgICAgICAgICAgICAgIGludmFsaWRhdGUoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQogICAgIH0KIAogICAgIC8qKgpAQCAtNTkxOSw5ICs2Nzk0LDggQEAKICAgICAgKiBAc2VlIGFuZHJvaWQud2lkZ2V0LlNjcm9sbEJhckRyYXdhYmxlCiAgICAgICogQGhpZGUKICAgICAgKi8KLSAgICBwcm90ZWN0ZWQgdm9pZCBvbkRyYXdIb3Jpem9udGFsU2Nyb2xsQmFyKENhbnZhcyBjYW52YXMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEcmF3YWJsZSBzY3JvbGxCYXIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgbCwgaW50IHQsIGludCByLCBpbnQgYikgeworICAgIHByb3RlY3RlZCB2b2lkIG9uRHJhd0hvcml6b250YWxTY3JvbGxCYXIoQ2FudmFzIGNhbnZhcywgRHJhd2FibGUgc2Nyb2xsQmFyLAorICAgICAgICAgICAgaW50IGwsIGludCB0LCBpbnQgciwgaW50IGIpIHsKICAgICAgICAgc2Nyb2xsQmFyLnNldEJvdW5kcyhsLCB0LCByLCBiKTsKICAgICAgICAgc2Nyb2xsQmFyLmRyYXcoY2FudmFzKTsKICAgICB9CkBAIC01OTQwLDkgKzY4MTQsOCBAQAogICAgICAqIEBzZWUgYW5kcm9pZC53aWRnZXQuU2Nyb2xsQmFyRHJhd2FibGUKICAgICAgKiBAaGlkZQogICAgICAqLwotICAgIHByb3RlY3RlZCB2b2lkIG9uRHJhd1ZlcnRpY2FsU2Nyb2xsQmFyKENhbnZhcyBjYW52YXMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRHJhd2FibGUgc2Nyb2xsQmFyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBsLCBpbnQgdCwgaW50IHIsIGludCBiKSB7CisgICAgcHJvdGVjdGVkIHZvaWQgb25EcmF3VmVydGljYWxTY3JvbGxCYXIoQ2FudmFzIGNhbnZhcywgRHJhd2FibGUgc2Nyb2xsQmFyLAorICAgICAgICAgICAgaW50IGwsIGludCB0LCBpbnQgciwgaW50IGIpIHsKICAgICAgICAgc2Nyb2xsQmFyLnNldEJvdW5kcyhsLCB0LCByLCBiKTsKICAgICAgICAgc2Nyb2xsQmFyLmRyYXcoY2FudmFzKTsKICAgICB9CkBAIC02MzQwLDggKzcyMTMsNyBAQAogICAgICAgICBpZiAoKG1WaWV3RmxhZ3MgJiBEUkFXSU5HX0NBQ0hFX0VOQUJMRUQpID09IERSQVdJTkdfQ0FDSEVfRU5BQkxFRCkgewogICAgICAgICAgICAgYnVpbGREcmF3aW5nQ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bDsKICAgICAgICAgfQogICAgIH0KQEAgLTY0MjMsMTUgKzcyOTMsMTEgQEAKICAgICAgKi8KICAgICBwdWJsaWMgdm9pZCBidWlsZERyYXdpbmdDYWNoZShib29sZWFuIGF1dG9TY2FsZSkgewogICAgICAgICBpZiAoKG1Qcml2YXRlRmxhZ3MgJiBEUkFXSU5HX0NBQ0hFX1ZBTElEKSA9PSAwIHx8IChhdXRvU2NhbGUgPwotICAgICAgICAgICAgICAgIChtRHJhd2luZ0NhY2hlID09IG51bGwgfHwgbURyYXdpbmdDYWNoZS5nZXQoKSA9PSBudWxsKSA6Ci0gICAgICAgICAgICAgICAgKG1VbnNjYWxlZERyYXdpbmdDYWNoZSA9PSBudWxsIHx8IG1VbnNjYWxlZERyYXdpbmdDYWNoZS5nZXQoKSA9PSBudWxsKSkpIHsKKyAgICAgICAgICAgICAgICBtRHJhd2luZ0NhY2hlID09IG51bGwgOiBtVW5zY2FsZWREcmF3aW5nQ2FjaGUgPT0gbnVsbCkpIHsKIAogICAgICAgICAgICAgaWYgKFZpZXdEZWJ1Zy5UUkFDRV9ISUVSQVJDSFkpIHsKICAgICAgICAgICAgICAgICBWaWV3RGVidWcudHJhY2UodGhpcywgVmlld0RlYnVnLkhpZXJhcmNoeVRyYWNlVHlwZS5CVUlMRF9DQUNIRSk7CiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAoQ29uZmlnLkRFQlVHICYmIFZpZXdEZWJ1Zy5wcm9maWxlRHJhd2luZykgewotICAgICAgICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoNjAwMDIsIGhhc2hDb2RlKCkpOwotICAgICAgICAgICAgfQogCiAgICAgICAgICAgICBpbnQgd2lkdGggPSBtUmlnaHQgLSBtTGVmdDsKICAgICAgICAgICAgIGludCBoZWlnaHQgPSBtQm90dG9tIC0gbVRvcDsKQEAgLTY0NTcsOCArNzMyMyw3IEBACiAgICAgICAgICAgICB9CiAKICAgICAgICAgICAgIGJvb2xlYW4gY2xlYXIgPSB0cnVlOwotICAgICAgICAgICAgQml0bWFwIGJpdG1hcCA9IGF1dG9TY2FsZSA/IChtRHJhd2luZ0NhY2hlID09IG51bGwgPyBudWxsIDogbURyYXdpbmdDYWNoZS5nZXQoKSkgOgotICAgICAgICAgICAgICAgICAgICAobVVuc2NhbGVkRHJhd2luZ0NhY2hlID09IG51bGwgPyBudWxsIDogbVVuc2NhbGVkRHJhd2luZ0NhY2hlLmdldCgpKTsKKyAgICAgICAgICAgIEJpdG1hcCBiaXRtYXAgPSBhdXRvU2NhbGUgPyBtRHJhd2luZ0NhY2hlIDogbVVuc2NhbGVkRHJhd2luZ0NhY2hlOwogCiAgICAgICAgICAgICBpZiAoYml0bWFwID09IG51bGwgfHwgYml0bWFwLmdldFdpZHRoKCkgIT0gd2lkdGggfHwgYml0bWFwLmdldEhlaWdodCgpICE9IGhlaWdodCkgewogICAgICAgICAgICAgICAgIEJpdG1hcC5Db25maWcgcXVhbGl0eTsKQEAgLTY0OTAsOSArNzM1NSw5IEBACiAgICAgICAgICAgICAgICAgICAgIGJpdG1hcCA9IEJpdG1hcC5jcmVhdGVCaXRtYXAod2lkdGgsIGhlaWdodCwgcXVhbGl0eSk7CiAgICAgICAgICAgICAgICAgICAgIGJpdG1hcC5zZXREZW5zaXR5KGdldFJlc291cmNlcygpLmdldERpc3BsYXlNZXRyaWNzKCkuZGVuc2l0eURwaSk7CiAgICAgICAgICAgICAgICAgICAgIGlmIChhdXRvU2NhbGUpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIG1EcmF3aW5nQ2FjaGUgPSBuZXcgU29mdFJlZmVyZW5jZTxCaXRtYXA+KGJpdG1hcCk7CisgICAgICAgICAgICAgICAgICAgICAgICBtRHJhd2luZ0NhY2hlID0gYml0bWFwOwogICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgbVVuc2NhbGVkRHJhd2luZ0NhY2hlID0gbmV3IFNvZnRSZWZlcmVuY2U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gICogY2FsbCBsYXlvdXQgb24gZWFjaCBvZiB0aGVpciBjaGlsZHJlbi4KICAgICAgKgogICAgICAqIEBwYXJhbSBsIExlZnQgcG9zaXRpb24sIHJlbGF0aXZlIHRvIHBhcmVudAogICAgICAqIEBwYXJhbSB0IFRvcCBwb3NpdGlvbiwgcmVsYXRpdmUgdG8gcGFyZW50CiAgICAgICogQHBhcmFtIHIgUmlnaHQgcG9zaXRpb24sIHJlbGF0aXZlIHRvIHBhcmVudAogICAgICAqIEBwYXJhbSBiIEJvdHRvbSBwb3NpdGlvbiwgcmVsYXRpdmUgdG8gcGFyZW50CiAgICAgICovCisgICAgQFN1cHByZXNzV2FybmluZ3MoeyJ1bmNoZWNrZWQifSkKICAgICBwdWJsaWMgZmluYWwgdm9pZCBsYXlvdXQoaW50IGwsIGludCB0LCBpbnQgciwgaW50IGIpIHsKKyAgICAgICAgaW50IG9sZEwgPSBtTGVmdDsKKyAgICAgICAgaW50IG9sZFQgPSBtVG9wOworICAgICAgICBpbnQgb2xkQiA9IG1Cb3R0b207CisgICAgICAgIGludCBvbGRSID0gbVJpZ2h0OwogICAgICAgICBib29sZWFuIGNoYW5nZWQgPSBzZXRGcmFtZShsLCB0LCByLCBiKTsKICAgICAgICAgaWYgKGNoYW5nZWQgfHwgKG1Qcml2YXRlRmxhZ3MgJiBMQVlPVVRfUkVRVUlSRUQpID09IExBWU9VVF9SRVFVSVJFRCkgewogICAgICAgICAgICAgaWYgKFZpZXdEZWJ1Zy5UUkFDRV9ISUVSQVJDSFkpIHsKQEAgLTcwODcsNiArNzk1OCwxNSBAQAogCiAgICAgICAgICAgICBvbkxheW91dChjaGFuZ2VkLCBsLCB0LCByLCBiKTsKICAgICAgICAgICAgIG1Qcml2YXRlRmxhZ3MgJj0gfkxBWU9VVF9SRVFVSVJFRDsKKworICAgICAgICAgICAgaWYgKG1PbkxheW91dENoYW5nZUxpc3RlbmVycyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgQXJyYXlMaXN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oYXR0ciwgZmFsc2UpKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBSLnN0eWxlYWJsZS5WaWV3R3JvdXBfYW5pbWF0ZUxheW91dENoYW5nZXM6CisgICAgICAgICAgICAgICAgICAgIGJvb2xlYW4gYW5pbWF0ZUxheW91dENoYW5nZXMgPSBhLmdldEJvb2xlYW4oYXR0ciwgZmFsc2UpOworICAgICAgICAgICAgICAgICAgICBpZiAoYW5pbWF0ZUxheW91dENoYW5nZXMpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHNldExheW91dFRyYW5zaXRpb24obmV3IExheW91dFRyYW5zaXRpb24oKSk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KIApAQCAtNDYxLDYgKzUwMCwxMyBAQAogICAgIH0KIAogICAgIC8qKgorICAgICAqIHtAaW5oZXJpdERvY30KKyAgICAgKi8KKyAgICBwdWJsaWMgQWN0aW9uTW9kZSBzdGFydEFjdGlvbk1vZGVGb3JDaGlsZChWaWV3IG9yaWdpbmFsVmlldywgQWN0aW9uTW9kZS5DYWxsYmFjayBjYWxsYmFjaykgeworICAgICAgICByZXR1cm4gbVBhcmVudCAhPSBudWxsID8gbVBhcmVudC5zdGFydEFjdGlvbk1vZGVGb3JDaGlsZChvcmlnaW5hbFZpZXcsIGNhbGxiYWNrKSA6IG51bGw7CisgICAgfQorCisgICAgLyoqCiAgICAgICogRmluZCB0aGUgbmVhcmVzdCB2aWV3IGluIHRoZSBzcGVjaWZpZWQgZGlyZWN0aW9uIHRoYXQgd2FudHMgdG8gdGFrZQogICAgICAqIGZvY3VzLgogICAgICAqCkBAIC04MjIsMTIgKzg2OCwxOCBAQAogICAgICAqLwogICAgIEBPdmVycmlkZQogICAgIHB1YmxpYyBib29sZWFuIGRpc3BhdGNoVG91Y2hFdmVudChNb3Rpb25FdmVudCBld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C1tb3N0IGNoaWxkLgotICAgICAgICAgICAgICAgIGZpbmFsIGludCBzY3JvbGxlZFhJbnQgPSAoaW50KSBzY3JvbGxlZFhGbG9hdDsKLSAgICAgICAgICAgICAgICBmaW5hbCBpbnQgc2Nyb2xsZWRZSW50ID0gKGludCkgc2Nyb2xsZWRZRmxvYXQ7CiAgICAgICAgICAgICAgICAgZmluYWwgVmlld1tdIGNoaWxkcmVuID0gbUNoaWxkcmVuOwogICAgICAgICAgICAgICAgIGZpbmFsIGludCBjb3VudCA9IG1DaGlsZHJlbkNvdW50OwogICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSBjb3VudCAtIDE7IGkgPj0gMDsgaS0tKSB7CiAgICAgICAgICAgICAgICAgICAgIGZpbmFsIFZpZXcgY2hpbGQgPSBjaGlsZHJlbltpXTsKICAgICAgICAgICAgICAgICAgICAgaWYgKChjaGlsZC5tVmlld0ZsYWdzICYgVklTSUJJTElUWV9NQVNLKSA9PSBWSVNJQkxFCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfHwgY2hpbGQuZ2V0QW5pbWF0aW9uKCkgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICAgICAgY2hpbGQuZ2V0SGl0UmVjdChmcmFtZSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZnJhbWUuY29udGFpbnMoc2Nyb2xsZWRYSW50LCBzY3JvbGxlZFlJbnQpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gb2Zmc2V0IHRoZSBldmVudCB0byB0aGUgdmlldydzIGNvb3JkaW5hdGUgc3lzdGVtCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZmluYWwgZmxvYXQgeGMgPSBzY3JvbGxlZFhGbG9hdCAtIGNoaWxkLm1MZWZ0OwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpbmFsIGZsb2F0IHljID0gc2Nyb2xsZWRZRmxvYXQgLSBjaGlsZC5tVG9wOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2LnNldExvY2F0aW9uKHhjLCB5Yyk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hpbGQubVByaXZhdGVGbGFncyAmPSB+Q0FOQ0VMX05FWFRfVVBfRVZFTlQ7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNoaWxkLmRpc3BhdGNoVG91Y2hFdmVudChldikpICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIEV2ZW50IGhhbmRsZWQsIHdlIGhhdmUgYSB0YXJnZXQgbm93LgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtTW90aW9uVGFyZ2V0ID0gY2hpbGQ7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBUaGUgZXZlbnQgZGlkbid0IGdldCBoYW5kbGVkLCB0cnkgdGhlIG5leHQgdmlldy4KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBEb24ndCByZXNldCB0aGUgZXZlbnQncyBsb2NhdGlvbiwgaXQncyBub3QKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBuZWNlc3NhcnkgaGVyZS4KKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIFNpbmdsZSBkaXNwYXRjaCBhbHdheXMgcGlja3MgaXRzIHRhcmdldCBiYXNlZCBvbiB0aGUgaW5pdGlhbCBkb3duCisgICAgICAgICAgICAgICAgICAgICAgICAvLyBldmVudCdzIHBvc2l0aW9uIC0gaW5kZXggMAorICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRpc3BhdGNoVG91Y2hFdmVudElmSW5WaWV3KGNoaWxkLCBldiwgMCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtTW90aW9uVGFyZ2V0ID0gY2hpbGQ7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICB9CkBAIC04OTgsMTEgKzkzOCwyMiBAQAogICAgICAgICAgICAgcmV0dXJuIHN1cGVyLmRpc3BhdGNoVG91Y2hFdmVudChldik7CiAgICAgICAgIH0KIAorICAgICAgICAvLyBDYWxjdWxhdGUgdGhlIG9mZnNldCBwb2ludCBpbnRvIHRoZSB0YXJnZXQncyBsb2NhbCBjb29yZGluYXRlcworICAgICAgICBmbG9hdCB4YyA9IHNjcm9sbGVkWEZsb2F0IC0gKGZsb2F0KSB0YXJnZXQubUxlZnQ7CisgICAgICAgIGZsb2F0IHljID0gc2Nyb2xsZWRZRmxvYXQgLSAoZmxvYXQpIHRhcmdldC5tVG9wOworICAgICAgICBpZiAoIXRhcmdldC5oYXNJZGVudGl0eU1hdHJpeCgpICYmIG1BdHRhY2hJbmZvICE9IG51bGwpIHsKKyAgICAgICAgICAgIC8vIG5vbi1pZGVudGl0eSBtYXRyaXg6IHRyYW5zZm9ybSB0aGUgcG9pbnQgaW50byB0aGUgdmlldydzIGNvb3JkaW5hdGVzCisgICAgICAgICAgICBmaW5hbCBmbG9hdFtdIGxvY2FsWFkgPSBtQXR0YWNoSW5mby5tVG1wVHJhbnNmb3JtTG9jYXRpb247CisgICAgICAgICAgICBsb2NhbFhZWzBdID0geGM7CisgICAgICAgICAgICBsb2NhbFhZWzFdID0geWM7CisgICAgICAgICAgICB0YXJnZXQuZ2V0SW52ZXJzZU1hdHJpeCgpLm1hcFBvaW50cyhsb2NhbFhZKTsKKyAgICAgICAgICAgIHhjID0gbG9jYWxYWVswXTsKKyAgICAgICAgICAgIHljID0gbG9jYWxYWVsxXTsKKyAgICAgICAgfQorCiAgICAgICAgIC8vIGlmIGhhdmUgYSB0YXJnZXQsIHNlZSBpZiB3ZSdyZSBhbGxvd2VkIHRvIGFuZCB3YW50IHRvIGludGVyY2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CisgICAgICAgIGZpbmFsIGZsb2F0IHggPSBldi5nZXRYKHBvaW50ZXJJbmRleCk7CisgICAgICAgIGZpbmFsIGZsb2F0IHkgPSBldi5nZXRZKHBvaW50ZXJJbmRleCk7CisgICAgICAgIGZpbmFsIGZsb2F0IHNjcm9sbGVkWCA9IHggKyBtU2Nyb2xsWDsKKyAgICAgICAgZmluYWwgZmxvYXQgc2Nyb2xsZWRZID0geSArIG1TY3JvbGxZOworICAgICAgICBmbG9hdCBsb2NhbFggPSBzY3JvbGxlZFggLSBjaGlsZC5tTGVmdDsKKyAgICAgICAgZmxvYXQgbG9jYWxZID0gc2Nyb2xsZWRZIC0gY2hpbGQubVRvcDsKKyAgICAgICAgaWYgKCFjaGlsZC5oYXNJZGVudGl0eU1hdHJpeCgpICYmIG1BdHRhY2hJbmZvICE9IG51bGwpIHsKKyAgICAgICAgICAgIC8vIG5vbi1pZGVudGl0eSBtYXRyaXg6IHRyYW5zZm9ybSB0aGUgcG9pbnQgaW50byB0aGUgdmlldydzIGNvb3JkaW5hdGVzCisgICAgICAgICAgICBmaW5hbCBmbG9hdFtdIGxvY2FsWFkgPSBtQXR0YWNoSW5mby5tVG1wVHJhbnNmb3JtTG9jYXRpb247CisgICAgICAgICAgICBsb2NhbFhZWzBdID0gbG9jYWxYOworICAgICAgICAgICAgbG9jYWxYWVsxXSA9IGxvY2FsWTsKKyAgICAgICAgICAgIGNoaWxkLmdldEludmVyc2VNYXRyaXgoKS5tYXBQb2ludHMobG9jYWxYWSk7CisgICAgICAgICAgICBsb2NhbFggPSBsb2NhbFhZWzBdOworICAgICAgICAgICAgbG9jYWxZID0gbG9jYWxYWVsxXTsKKyAgICAgICAgfQorICAgICAgICBpZiAobG9jYWxYID49IDAgJiYgbG9jYWxZID49IDAgJiYgbG9jYWxYIDwgKGNoaWxkLm1SaWdodCAtIGNoaWxkLm1MZWZ0KSAmJgorICAgICAgICAgICAgICAgIGxvY2FsWSA8IChjaGlsZC5tQm90dG9tIC0gY2hpbGQubVRvcCkpIHsKKyAgICAgICAgICAgIC8vIEl0IHdvdWxkIGJlIHNhZmVyIHRvIGNsb25lIHRoZSBldmVudCBoZXJlIGJ1dCB3ZSBkb24ndCBmb3IgcGVyZm9ybWFuY2UuCisgICAgICAgICAgICAvLyBUaGVyZSBhcmUgbWFueSBzdWJ0bGUgaW50ZXJhY3Rpb25zIGluIHRvdWNoIGV2ZW50IGRpc3BhdGNoOyBjaGFuZ2UgYXQgeW91ciBvd24gcmlzay4KKyAgICAgICAgICAgIGNoaWxkLm1Qcml2YXRlRmxhZ3MgJj0gfkNBTkNFTF9ORVhUX1VQX0VWRU5UOworICAgICAgICAgICAgZXYub2Zmc2V0TG9jYXRpb24obG9jYWxYIC0geCwgbG9jYWxZIC0geSk7CisgICAgICAgICAgICBpZiAoY2hpbGQuZGlzcGF0Y2hUb3VjaEV2ZW50KGV2KSkgeworICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBldi5vZmZzZXRMb2NhdGlvbih4IC0gbG9jYWxYLCB5IC0gbG9jYWxZKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIHByaXZhdGUgYm9vbGVhbiBkaXNwYXRjaFNwbGl0VG91Y2hFdmVudChNb3Rpb25FdmVudCBldikgeworICAgICAgICBmaW5hbCBTcGxpdE1vdGlvblRhcmdldHMgdGFyZ2V0cyA9IG1TcGxpdE1vdGlvblRhcmdldHM7CisgICAgICAgIGZpbmFsIGludCBhY3Rpb24gPSBldi5nZXRBY3Rpb24oKTsKKyAgICAgICAgZmluYWwgaW50IG1hc2tlZEFjdGlvbiA9IGV2LmdldEFjdGlvbk1hc2tlZCgpOworICAgICAgICBmbG9hdCB4ZiA9IGV2LmdldFgoKTsKKyAgICAgICAgZmxvYXQgeWYgPSBldi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gLy8gcmVzZXQgdGhpcyBldmVudCdzIGFjdGlvbiAoanVzdCB0byBwcm90ZWN0IG91cnNlbHZlcykKKyAgICAgICAgICAgICAgICBldi5zZXRBY3Rpb24oYWN0aW9uKTsKKyAgICAgICAgICAgICAgICAvLyBXZSBrbm93IHdlIHdhbnQgdG8gZGlzcGF0Y2ggdGhlIGV2ZW50IGRvd24sIHRyeSB0byBmaW5kIGEgY2hpbGQKKyAgICAgICAgICAgICAgICAvLyB3aG8gY2FuIGhhbmRsZSBpdCwgc3RhcnQgd2l0aCB0aGUgZnJvbnQtbW9zdCBjaGlsZC4KKyAgICAgICAgICAgICAgICBmaW5hbCBsb25nIGRvd25UaW1lID0gZXYuZ2V0RXZlbnRUaW1lKCk7CisgICAgICAgICAgICAgICAgZmluYWwgVmlld1tdIGNoaWxkcmVuID0gbUNoaWxkcmVuOworICAgICAgICAgICAgICAgIGZpbmFsIGludCBjb3VudCA9IG1DaGlsZHJlbkNvdW50OworICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSBjb3VudCAtIDE7IGkgPj0gMDsgaS0tKSB7CisgICAgICAgICAgICAgICAgICAgIGZpbmFsIFZpZXcgY2hpbGQgPSBjaGlsZHJlbltpXTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKChjaGlsZC5tVmlld0ZsYWdzICYgVklTSUJJTElUWV9NQVNLKSA9PSBWSVNJQkxFCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfHwgY2hpbGQuZ2V0QW5pbWF0aW9uKCkgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgZmluYWwgTW90aW9uRXZlbnQgY2hpbGRFdmVudCA9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRhcmdldHMuZmlsdGVyTW90aW9uRXZlbnRGb3JDaGlsZChldiwgY2hpbGQsIGRvd25UaW1lKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjaGlsZEV2ZW50ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaW5hbCBpbnQgY2hpbGRBY3Rpb25JbmRleCA9IGNoaWxkRXZlbnQuZmluZFBvaW50ZXJJbmRleChhY3Rpb25JZCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkaXNwYXRjaFRvdWNoRXZlbnRJZkluVmlldyhjaGlsZCwgY2hpbGRFdmVudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGlsZEFjdGlvbkluZGV4KSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGFyZ2V0cy5hZGQoYWN0aW9uSWQsIGNoaWxkLCBkb3duVGltZSk7CisKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hpbGRFdmVudC5yZWN5Y2xlKCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgLy8gRGlkbid0IGZpbmQgYSBuZXcgdGFyZ2V0LiBEbyB3ZSBoYXZlIGEgInByaW1hcnkiIHRhcmdldCB0byBzZW5kIHRvPworICAgICAgICAgICAgICAgIGZpbmFsIFNwbGl0TW90aW9uVGFyZ2V0cy5UYXJnZXRJbmZvIHByaW1hcnlUYXJnZXRJbmZvID0gdGFyZ2V0cy5nZXRQcmltYXJ5VGFyZ2V0KCk7CisgICAgICAgICAgICAgICAgaWYgKHByaW1hcnlUYXJnZXRJbmZvICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgZmluYWwgVmlldyBwcmltYXJ5VGFyZ2V0ID0gcHJpbWFyeVRhcmdldEluZm8udmlldzsKKyAgICAgICAgICAgICAgICAgICAgZmluYWwgTW90aW9uRXZlbnQgY2hpbGRFdmVudCA9IHRhcmdldHMuZmlsdGVyTW90aW9uRXZlbnRGb3JDaGlsZChldiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmltYXJ5VGFyZ2V0LCBwcmltYXJ5VGFyZ2V0SW5mby5kb3duVGltZSk7CisgICAgICAgICAgICAgICAgICAgIGlmIChjaGlsZEV2ZW50ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gQ2FsY3VsYXRlIHRoZSBvZmZzZXQgcG9pbnQgaW50byB0aGUgdGFyZ2V0J3MgbG9jYWwgY29vcmRpbmF0ZXMKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB4YyA9IHNjcm9sbGVkWEZsb2F0IC0gKGZsb2F0KSBwcmltYXJ5VGFyZ2V0Lm1MZWZ0OworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IHljID0gc2Nyb2xsZWRZRmxvYXQgLSAoZmxvYXQpIHByaW1hcnlUYXJnZXQubVRvcDsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXByaW1hcnlUYXJnZXQuaGFzSWRlbnRpdHlNYXRyaXgoKSAmJiBtQXR0YWNoSW5mbyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIG5vbi1pZGVudGl0eSBtYXRyaXg6IHRyYW5zZm9ybSB0aGUgcG9pbnQgaW50byB0aGUgdmlldydzCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGNvb3JkaW5hdGVzCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpbmFsIGZsb2F0W10gbG9jYWxYWSA9IG1BdHRhY2hJbmZvLm1UbXBUcmFuc2Zvcm1Mb2NhdGlvbjsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbG9jYWxYWVswXSA9IHhjOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb2NhbFhZWzFdID0geWM7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByaW1hcnlUYXJnZXQuZ2V0SW52ZXJzZU1hdHJpeCgpLm1hcFBvaW50cyhsb2NhbFhZKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeGMgPSBsb2NhbFhZWzBdOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB5YyA9IGxvY2FsWFlbMV07CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoaWxkRXZlbnQuc2V0TG9jYXRpb24oeGMsIHljKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocHJpbWFyeVRhcmdldC5kaXNwYXRjaFRvdWNoRXZlbnQoY2hpbGRFdmVudCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGFyZ2V0cy5hZGQoYWN0aW9uSWQsIHByaW1hcnlUYXJnZXQsIHByaW1hcnlUYXJnZXRJbmZvLmRvd25UaW1lKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGlsZEV2ZW50LnJlY3ljbGUoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGJvb2xlYW4gaXNVcE9yQ2FuY2VsID0gKGFjdGlvbiA9PSBNb3Rpb25FdmVudC5BQ1RJT05fV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AgICAgICBsb2NhbFhZWzBdID0geGM7CisgICAgICAgICAgICAgICAgICAgIGxvY2FsWFlbMV0gPSB5YzsKKyAgICAgICAgICAgICAgICAgICAgdGFyZ2V0LmdldEludmVyc2VNYXRyaXgoKS5tYXBQb2ludHMobG9jYWxYWSk7CisgICAgICAgICAgICAgICAgICAgIHhjID0gbG9jYWxYWVswXTsKKyAgICAgICAgICAgICAgICAgICAgeWMgPSBsb2NhbFhZWzFdOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIGV2LnNldEFjdGlvbihNb3Rpb25FdmVudC5BQ1RJT05fQ0FOQ0VMKTsKKyAgICAgICAgICAgICAgICBldi5zZXRMb2NhdGlvbih4YywgeWMpOworICAgICAgICAgICAgICAgIGlmICghdGFyZ2V0LmRpc3BhdGNoVG91Y2hFdmVudChldikpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gdGFyZ2V0IGRpZG4ndCBoYW5kbGUgQUNUSU9OX0NBTkNFTC4gbm90IG11Y2ggd2UgY2FuIGRvCisgICAgICAgICAgICAgICAgICAgIC8vIGJ1dCB0aGV5IHNob3VsZCBoYXZlLgorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHRhcmdldHMuY2xlYXIoKTsKKyAgICAgICAgICAgIC8vIERvbid0IGRpc3BhdGNoIHRoaXMgZXZlbnQgdG8gb3VyIG93biB2aWV3LCBiZWNhdXNlIHdlIGFscmVhZHkKKyAgICAgICAgICAgIC8vIHNhdyBpdCB3aGVuIGludGVyY2VwdGluZzsgd2UganVzdCB3YW50IHRvIGdpdmUgdGhlIGZvbGxvd2luZworICAgICAgICAgICAgLy8gZXZlbnQgdG8gdGhlIG5vcm1hbCBvblRvdWNoRXZlbnQoKS4KKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9CisKKyAgICAgICAgYm9vbGVhbiBoYW5kbGVkID0gZmFsc2U7CisgICAgICAgIGZvciAoaW50IHVuaXF1ZUluZGV4ID0gMDsgdW5pcXVlSW5kZXggPCB1bmlxdWVUYXJnZXRDb3VudDsgdW5pcXVlSW5kZXgrKykgeworICAgICAgICAgICAgZmluYWwgU3BsaXRNb3Rpb25UYXJnZXRzLlRhcmdldEluZm8gdGFyZ2V0SW5mbyA9IHRhcmdldHMuZ2V0VW5pcXVlVGFyZ2V0QXQodW5pcXVlSW5kZXgpOworICAgICAgICAgICAgZmluYWwgVmlldyB0YXJnZXQgPSB0YXJnZXRJbmZvLnZpZXc7CisKKyAgICAgICAgICAgIGZpbmFsIE1vdGlvbkV2ZW50IHRhcmdldEV2ZW50ID0KKyAgICAgICAgICAgICAgICAgICAgdGFyZ2V0cy5maWx0ZXJNb3Rpb25FdmVudEZvckNoaWxkKGV2LCB0YXJnZXQsIHRhcmdldEluZm8uZG93blRpbWUpOworICAgICAgICAgICAgaWYgKHRhcmdldEV2ZW50ID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAvLyBDYWxjdWxhdGUgdGhlIG9mZnNldCBwb2ludCBpbnRvIHRoZSB0YXJnZXQncyBsb2NhbCBjb29yZGluYXRlcworICAgICAgICAgICAgICAgIHhmID0gdGFyZ2V0RXZlbnQuZ2V0WCgpOworICAgICAgICAgICAgICAgIHlmID0gdGFyZ2V0RXZlbnQuZ2V0WSgpOworICAgICAgICAgICAgICAgIHNjcm9sbGVkWEZsb2F0ID0geGYgKyBtU2Nyb2xsWDsKKyAgICAgICAgICAgICAgICBzY3JvbGxlZFlGbG9hdCA9IHlmICsgbVNjcm9sbFk7CisgICAgICAgICAgICAgICAgZmxvYXQgeGMgPSBzY3JvbGxlZFhGbG9hdCAtIChmbG9hdCkgdGFyZ2V0Lm1MZWZ0OworICAgICAgICAgICAgICAgIGZsb2F0IHljID0gc2Nyb2xsZWRZRmxvYXQgLSAoZmxvYXQpIHRhcmdldC5tVG9wOworICAgICAgICAgICAgICAgIGlmICghdGFyZ2V0Lmhhc0lkZW50aXR5TWF0cml4KCkgJiYgbUF0dGFjaEluZm8gIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAvLyBub24taWRlbnRpdHkgbWF0cml4OiB0cmFuc2Zvcm0gdGhlIHBvaW50IGludG8gdGhlIHZpZXcncyBjb29yZGluYXRlcworICAgICAgICAgICAgICAgICAgICBmaW5hbCBmbG9hdFtdIGxvY2FsWFkgPSBtQXR0YWNoSW5mby5tVG1wVHJhbnNmb3JtTG9jYXRpb247CisgICAgICAgICAgICAgICAgICAgIGxvY2FsWFlbMF0gPSB4YzsKKyAgICAgICAgICAgICAgICAgICAgbG9jYWxYWVsxXSA9IHljOworICAgICAgICAgICAgICAgICAgICB0YXJnZXQuZ2V0SW52ZXJzZU1hdHJpeCgpLm1hcFBvaW50cyhsb2NhbFhZKTsKKyAgICAgICAgICAgICAgICAgICAgeGMgPSBsb2NhbFhZWzBdOworICAgICAgICAgICAgICAgICAgICB5YyA9IGxvY2FsWFlbMV07CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgLy8gZmluYWxseSBvZmZzZXQgdGhlIGV2ZW50IHRvIHRoZSB0YXJnZXQncyBjb29yZGluYXRlIHN5c3RlbSBhbmQKKyAgICAgICAgICAgICAgICAvLyBkaXNwYXRjaCB0aGUgZXZlbnQuCisgICAgICAgICAgICAgICAgdGFyZ2V0RXZlbnQuc2V0TG9jYXRpb24oeGMsIHljKTsKKworICAgICAgICAgICAgICAgIGlmICgodGFyZ2V0Lm1Qcml2YXRlRmxhZ3MgJiBDQU5DRUxfTkVYVF9VUF9FVkVOVCkgIT0gMCkgeworICAgICAgICAgICAgICAgICAgICB0YXJnZXRFdmVudC5zZXRBY3Rpb24oTW90aW9uRXZlbnQuQUNUSU9OX0NBTkNFTCk7CisgICAgICAgICAgICAgICAgICAgIHRhcmdldC5tUHJpdmF0ZUZsYWdzICY9IH5DQU5DRUxfTkVYVF9VUF9FVkVOVDsKKyAgICAgICAgICAgICAgICAgICAgdGFyZ2V0cy5yZW1vdmVWaWV3KHRhcmdldCk7CisgICAgICAgICAgICAgICAgICAgIHVuaXF1ZUluZGV4LS07CisgICAgICAgICAgICAgICAgICAgIHVuaXF1ZVRhcmdldENvdW50LS07CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgZmluYWwgYm9vbGVhbiBjaGlsZEhhbmRsZWQgPSB0YXJnZXQuZGlzcGF0Y2hUb3VjaEV2ZW50KHRhcmdldEV2ZW50KTsKKyAgICAgICAgICAgICAgICBoYW5kbGVkIHw9IGNoaWxkSGFuZGxlZDsKKyAgICAgICAgICAgICAgICBpZiAoIWNoaWxkSGFuZGxlZCkgeworICAgICAgICAgICAgICAgICAgICAvLyBDaGlsZCBkb2Vzbid0IHdhbnQgdGhlc2UgZXZlbnRzIGFueW1vcmUsIGJ1dCB3ZSdyZSBzdGlsbCBkaXNwYXRjaGluZworICAgICAgICAgICAgICAgICAgICAvLyBvdGhlciBzcGxpdCBldmVudHMgdG8gY2hpbGRyZW4uCisgICAgICAgICAgICAgICAgICAgIHRhcmdldHMucmVtb3ZlVmlldyh0YXJnZXQpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICAgICAgdGFyZ2V0RXZlbnQucmVjeWNsZSgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgaWYgKG1hc2tlZEFjdGlvbiA9PSBNb3Rpb25FdmVudC5BQ1RJT05fUE9JTlRFUl9VUCkgeworICAgICAgICAgICAgZmluYWwgaW50IHJlbW92ZUlkID0gZXYuZ2V0UG9pbnRlcklkKGV2LmdldEFjdGlvbkluZGV4KCkpOworICAgICAgICAgICAgdGFyZ2V0cy5yZW1vdmVCeUlkKHJlbW92ZUlkKTsKKyAgICAgICAgfQorCisgICAgICAgIGlmIChpc1VwT3JDYW5jZWwpIHsKKyAgICAgICAgICAgIHRhcmdld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AIC0xMTgyLDcgKzE1MTksMTAgQEAKICAgICAgICAgZmluYWwgaW50IGNvdW50ID0gbUNoaWxkcmVuQ291bnQ7CiAgICAgICAgIGZpbmFsIFZpZXdbXSBjaGlsZHJlbiA9IG1DaGlsZHJlbjsKICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBjb3VudDsgaSsrKSB7Ci0gICAgICAgICAgICBjaGlsZHJlbltpXS5kaXNwYXRjaFNhdmVJbnN0YW5jZVN0YXRlKGNvbnRhaW5lcik7CisgICAgICAgICAgICBWaWV3IGMgPSBjaGlsZHJlbltpXTsKKyAgICAgICAgICAgIGlmICgoYy5tVmlld0ZsYWdzICYgUEFSRU5UX1NBVkVfRElTQUJMRURfTUFTSykgIT0gUEFSRU5UX1NBVkVfRElTQUJMRUQpIHsKKyAgICAgICAgICAgICAgICBjLmRpc3BhdGNoU2F2ZUluc3RhbmNlU3RhdGUoY29udGFpbmVyKTsKKyAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgIH0KIApAQCAtMTIwNyw3ICsxNTQ3LDEwIEBACiAgICAgICAgIGZpbmFsIGludCBjb3VudCA9IG1DaGlsZHJlbkNvdW50OwogICAgICAgICBmaW5hbCBWaWV3W10gY2hpbGRyZW4gPSBtQ2hpbGRyZW47CiAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgY291bnQ7IGkrKykgewotICAgICAgICAgICAgY2hpbGRyZW5baV0uZGlzcGF0Y2hSZXN0b3JlSW5zdGFuY2VTdGF0ZShjb250YWluZXIpOworICAgICAgICAgICAgVmlldyBjID0gY2hpbGRyZW5baV07CisgICAgICAgICAgICBpZiAoKGMubVZpZXdGbGFncyAmIFBBUkVOVF9TQVZFX0RJU0FCTEVEX01BU0spICE9IFBBUkVOVF9TQVZFX0RJU0FCTEVEKSB7CisgICAgICAgICAgICAgICAgYy5kaXNwYXRjaFJlc3RvcmVJbnN0YW5jZVN0YXRlKGNvbnRhaW5lcik7CisgICAgICAgICAgICB9CiAgICAg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AgICAgICBzY2FsaW5nUmVxdWlyZWQgPyBtQXR0YWNoSW5mby5tQXBwbGljYXRpb25TY2FsZSA6IDFmKTsKKyAgICAgICAgICAgIGlmIChzY2FsaW5nUmVxdWlyZWQgJiYgbUF0dGFjaEluZm8ubUFwcGxpY2F0aW9uU2NhbGUgIT0gMWYpIHsKKyAgICAgICAgICAgICAgICBpZiAobUludmFsaWRhdGlvblRyYW5zZm9ybWF0aW9uID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgbUludmFsaWRhdGlvblRyYW5zZm9ybWF0aW9uID0gbmV3IFRyYW5zZm9ybWF0aW9uKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGludmFsaWRhdGlvblRyYW5zZm9ybSA9IG1JbnZhbGlkYXRpb25UcmFuc2Zvcm1hdGlvbjsKKyAgICAgICAgICAgICAgICBhLmdldFRyYW5zZm9ybWF0aW9uKGRyYXdpbmdUaW1lLCBpbnZhbGlkYXRpb25UcmFuc2Zvcm0sIDFmKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgaW52YWxpZGF0aW9uVHJhbnNmb3JtID0gbUNoaWxkVHJhbnNmb3JtYXRpb247CiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICBtb3JlID0gYS5nZXRUcmFuc2Zvcm1hdGlvbihkcmF3aW5nVGltZSwgbUNoaWxkVHJhbnNmb3JtYXRpb24pOwogICAgICAgICAgICAgdHJhbnNmb3JtVG9BcHBseSA9IG1DaGlsZFRyYW5zZm9ybWF0aW9uOwogCiAgICAgICAgICAgICBjb25jYXRNYXRyaXggPSBhLndpbGxDaGFuZ2VUcmFuc2Zvcm1hdGlvbk1hdHJpeCgpOwpAQCAtMTUyMCw3ICsxODczLDExIEBACiAgICAgICAgICAgICAgICAgICAgICAgICBpbnZhbGlkYXRlKGNsLCBjdCwgY3IsIGNiKTsKICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIGEuZ2V0SW52YWxpZGF0ZVJlZ2lvbigwLCAwLCBjciAtIGNsLCBjYiAtIGN0LCByZWdpb24sIHRyYW5zZm9ybVRvQXBwbHkpOworICAgICAgICAgICAgICAgICAgICBpZiAobUludmFsaWRhdGVSZWdpb24gPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgbUludmFsaWRhdGVSZWdpb24gPSBuZXcgUmVjdEYoKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBmaW5hbCBSZWN0RiByZWdpb24gPSBtSW52YWxpZGF0ZVJlZ2lvbjsKKyAgICAgICAgICAgICAgICAgICAgYS5nZXRJbnZhbGlkYXRlUmVnaW9uKDAsIDAsIGNyIC0gY2wsIGNiIC0gY3QsIHJlZ2lvbiwgaW52YWxpZGF0aW9uVHJhbnNmb3JtKTsKIAogICAgICAgICAgICAgICAgICAgICAvLyBUaGUgY2hpbGQgbmVlZCB0byBkcmF3IGFuIGFuaW1hdGlvbiwgcG90ZW50aWFsbHkgb2Zmc2NyZWVuLCBzbwogICAgICAgICAgICAgICAgICAgICAvLyBtYWtlIHN1cmUgd2UgZG8gbm90IGNhbmNlbCBpbnZhbGlkYXRlIHJlcXVlc3RzCkBAIC0xNTMzLDkgKzE4OTAsNiBAQAogICAgICAgICAgICAgfQogICAgICAgICB9IGVsc2UgaWYgKChmbGFncyAmIEZMQUdfU1VQUE9SVF9TVEFUSUNfVFJBTlNGT1JNQVRJT05TKSA9PQogICAgICAgICAgICAgICAgIEZMQUdfU1VQUE9SVF9TVEFUSUNfVFJBTlNGT1JNQVRJT05TKSB7Ci0gICAgICAgICAgICBpZiAobUNoaWxkVHJhbnNmb3JtYXRpb24gPT0gbnVsbCkgewotICAgICAgICAgICAgICAgIG1DaGlsZFRyYW5zZm9ybWF0aW9uID0gbmV3IFRyYW5zZm9ybWF0aW9uKCk7Ci0gICAgICAgICAgICB9CiAgICAgICAg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2xhdGUoLXRyYW5zWCwgLXRyYW5zWSk7Ci0gICAgICAgICAgICAgICAgY2FudmFzLmNvbmNhdCh0cmFuc2Zvcm1Ub0FwcGx5LmdldE1hdHJpeCgpKTsKLSAgICAgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKHRyYW5zWCwgdHJhbnNZKTsKLSAgICAgICAgICAgICAgICBtR3JvdXBGbGFncyB8PSBGTEFHX0NMRUFSX1RSQU5TRk9STUFUSU9OOworICAgICAgICBpZiAodHJhbnNmb3JtVG9BcHBseSAhPSBudWxsIHx8IGFscGhhIDwgMS4wZiB8fCAhY2hpbGQuaGFzSWRlbnRpdHlNYXRyaXgoKSkgeworICAgICAgICAgICAgaW50IHRyYW5zWCA9IDA7CisgICAgICAgICAgICBpbnQgdHJhbnNZID0gMDsKKworICAgICAgICAgICAgaWYgKGhhc05vQ2FjaGUpIHsKKyAgICAgICAgICAgICAgICB0cmFuc1ggPSAtc3g7CisgICAgICAgICAgICAgICAgdHJhbnNZID0gLXN5OwogICAgICAgICAgICAgfQogCi0gICAgICAgICAgICBhbHBoYSA9IHRyYW5zZm9ybVRvQXBwbHkuZ2V0QWxwaGEoKTsKKyAgICAgICAgICAgIGlmICh0cmFuc2Zvcm1Ub0FwcGx5ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBpZiAoY29uY2F0TWF0cml4KSB7CisgICAgICAgICAgICAgICAgICAgIC8vIFVuZG8gdGhlIHNjcm9sbCB0cmFuc2xhdGlvbiwgYXBwbHkgdGhlIHRyYW5zZm9ybWF0aW9uIG1hdHJpeCwKKyAgICAgICAgICAgICAgICAgICAgLy8gdGhlbiByZWRvIHRoZSBzY3JvbGwgdHJhbnNsYXRlIHRvIGdldCB0aGUgY29ycmVjdCByZXN1bHQuCisgICAgICAgICAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoLXRyYW5zWCwgLXRyYW5zWSk7CisgICAgICAgICAgICAgICAgICAgIGNhbnZhcy5jb25jYXQodHJhbnNmb3JtVG9BcHBseS5nZXRNYXRyaXgoKSk7CisgICAgICAgICAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUodHJhbnNYLCB0cmFuc1kpOworICAgICAgICAgICAgICAgICAgICBtR3JvdXBGbGFncyB8PSBGTEFHX0NMRUFSX1RSQU5TRk9STUFUSU9OOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIGZsb2F0IHRyYW5zZm9ybUFscGhhID0gdHJhbnNmb3JtVG9BcHBseS5nZXRBbHBoYSgpOworICAgICAgICAgICAgICAgIGlmICh0cmFuc2Zvcm1BbHBoYSA8IDEuMGYpIHsKKyAgICAgICAgICAgICAgICAgICAgYWxwaGEgKj0gdHJhbnNmb3JtVG9BcHBseS5nZXRBbHBoYSgpOworICAgICAgICAgICAgICAgICAgICBtR3JvdXBGbGFncyB8PSBGTEFHX0NMRUFSX1RSQU5TRk9STUFUSU9OOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKCFjaGlsZC5oYXNJZGVudGl0eU1hdHJpeCgpKSB7CisgICAgICAgICAgICAgICAgY2FudmFzLnRyYW5zbGF0ZSgtdHJhbnNYLCAtdHJhbnNZKTsKKyAgICAgICAgICAgICAgICBjYW52YXMuY29uY2F0KGNoaWxkLmdldE1hdHJpeCgpKTsKKyAgICAgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKHRyYW5zWCwgdHJhbnNZKTsKKyAgICAgICAgICAgIH0KKwogICAgICAgICAgICAgaWYgKGFscGhhIDwgMS4wZikgewogICAgICAgICAgICAgICAgIG1Hcm91cEZsYWdzIHw9IEZMQUdfQ0xFQVJfVFJBTlNGT1JNQVRJT047Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGlmIChhbHBoYSA8IDEuMGYgJiYgaGFzTm9DYWNoZSkgewotICAgICAgICAgICAgICAgIGZpbmFsIGludCBtdWx0aXBsaWVkQWxwaGEgPSAoaW50KSAoMjU1ICogYWxwaGEpOwotICAgICAgICAgICAgICAgIGlmICghY2hpbGQub25TZXRBbHBoYShtdWx0aXBsaWVkQWxwaGEpKSB7Ci0gICAgICAgICAgICAgICAgICAgIGNhbnZhcy5zYXZlTGF5ZXJBbHBoYShzeCwgc3ksIHN4ICsgY3IgLSBjbCwgc3kgKyBjYiAtIGN0LCBtdWx0aXBsaWVkQWxwaGEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgQ2FudmFzLkhBU19BTFBIQV9MQVlFUl9TQVZFX0ZMQUcgfCBDYW52YXMuQ0xJUF9UT19MQVlFUl9TQVZFX0ZMQUcpOwotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIGNoaWxkLm1Qcml2YXRlRmxhZ3MgfD0gQUxQSEFfU0VUOworICAgICAgICAgICAgCisgICAgICAgICAgICAgICAgaWYgKGhhc05vQ2FjaGUpIHsKKyAgICAgICAgICAgICAgICAgICAgZmluYWwgaW50IG11bHRpcGxpZWRBbHBoYSA9IChpbnQpICgyNTUgKiBhbHBoYSk7CisgICAgICAgICAgICAgICAgICAgIGlmICghY2hpbGQub25TZXRBbHBoYShtdWx0aXBsaWVkQWxwaGEpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBjYW52YXMuc2F2ZUxheWVyQWxwaGEoc3gsIHN5LCBzeCArIGNyIC0gY2wsIHN5ICsgY2IgLSBjdCwgbXVsdGlwbGllZEFscGhhLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDYW52YXMuSEFTX0FMUEhBX0xBWUVSX1NBVkVfRkxBRyB8IENhbnZhcy5DTElQX1RPX0xBWUVSX1NBVkVfRkxBRyk7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICBjaGlsZC5tUHJpdmF0ZUZsYWdzIHw9IEFMUEhBX1NFVDsKKyAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgfSBlbHNlIGlmICgoY2hpbGQubVByaXZhdGVGbGFncyAmIEFMUEhBX1NFVCkgPT0gQUxQSEFfU0VUKSB7CiAgICAgICAgICAgICBjaGlsZC5vblNldEFscGhhKDI1NSk7CisgICAgICAgICAgICBjaGlsZC5tUHJpdmF0ZUZsYWdzICY9IH5BTFBIQV9TRVQ7CiAgICAgICAgIH0KIAogICAgICAgICBpZiAoKGZsYWdzICYgRkxBR19DTElQX0NISUxEUkVOKSA9PSBGTEFHX0NMSVBfQ0hJTERSRU4pIHsKQEAgLTE2NDksOSArMjAxOCw2IEBACiAgICAgICAgICAgICAgICAgY2FjaGVQYWludC5zZXRBbHBoYSgyNTUpOwogICAgICAgICAgICAgICAgIG1Hcm91cEZsYWdzICY9IH5GTEFHX0FMUEhBX0xPV0VSX1RIQU5fT05FOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKENvbmZpZy5ERUJVRyAmJiBWaWV3RGVidWcucHJvZmlsZURyYXdpbmcpIHsKLSAgICAgICAgICAgICAgICBFdmVudExvZy53cml0ZUV2ZW50KDYwMDAzLCBoYXNoQ29kZSgpKTsKLSAgICAgICAgICAgIH0KICAgICAgICAgICAgIGNhbnZhcy5kcmF3Qml0bWFwKGNhY2hlLCAwLjBmLCAwLjBmLCBjYWNoZVBhaW50KTsKICAgICAgICAgfQogCkBAIC0xNjk3LDYgKzIwNjMsNyBAQAogICAgICAgICBmaW5hbCBWaWV3W10gY2hpbGRyZW4gPSBtQ2hpbGRyZW47CiAgICAgICAgIGZpbmFsIGludCBjb3VudCA9IG1DaGlsZHJlbkNvdW50OwogICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGNvdW50OyBpKyspIHsKKyAgICAgICAgICAgIAogICAgICAgICAgICAgY2hpbGRyZW5baV0uc2V0U2VsZWN0ZWQoc2VsZWN0ZWQpOwogICAgICAgICB9CiAgICAgfQpAQCAtMTk3Miw2ICsyMzM5LDEwIEBACiAgICAgICAgICAgICAgICAgICAgICJZb3UgbXVzdCBjYWxsIHJlbW92ZVZpZXcoKSBvbiB0aGUgY2hpbGQncyBwYXJlbnQgZmlyc3QuIik7CiAgICAgICAgIH0KIAorICAgICAgICBpZiAobVRyYW5zaXRpb24gIT0gbnVsbCkgeworICAgICAgICAgICAgbVRyYW5zaXRpb24uY2hpbGRBZGQodGhpcywgY2hpbGQpOworICAgICAgICB9CisKICAgICAgICAgaWYgKCFjaGVja0xheW91dFBhcmFtcyhwYXJhbXMpKSB7CiAgICAgICAgICAgICBwYXJhbXMgPSBnZW5lcmF0ZUxheW91dFBhcmFtcyhwYXJhbXMpOwogICAgICAgICB9CkBAIC0yMDQ5LDcgKzI0MjAsOSBAQAogICAgIC8vIFRoaXMgbWV0aG9kIGFsc28gc2V0cyB0aGUgY2hpbGQncyBtUGFyZW50IHRvIG51bGwKICAgICBwcml2YXRlIHZvaWQgcmVtb3ZlRnJvbUFycmF5KGludCBpbmRleCkgewogICAgICAgICBmaW5hbCBWaWV3W10gY2hpbGRyZW4gPSBtQ2hpbGRyZW47Ci0gICAgICAgIGNoaWxkcmVuW2luZGV4XS5tUGFyZW50ID0gbnVsbDsKKyAgICAgICAgaWYgKCEobVRyYW5zaXRpb25pbmdWaWV3cyAhPSBudWxsICYmIG1UcmFuc2l0aW9uaW5nVmlld3MuY29udGFpbnMoY2hpbGRyZW5baW5kZXhdKSkpIHsKKyAgICAgICAgICAgIGNoaWxkcmVuW2luZGV4XS5tUGFyZW50ID0gbnVsbDsKKyAgICAgICAgfQogICAgICAgICBmaW5hbCBpbnQgY291bnQgPSBtQ2hpbGRyZW5Db3VudDsKICAgICAgICAgaWYgKGluZGV4ID09IGNvdW50IC0gMSkgewogICAgICAgICAgICAgY2hpbGRyZW5bLS1tQ2hpbGRyZW5Db3VudF0gPSBudWxsOwpAQCAtMjE4NCwxMyArMjU1NywxOSBAQAogICAgIH0KIAogICAgIHByaXZhdGUgdm9pZCByZW1vdmVWaWV3SW50ZXJuYWwoaW50IGluZGV4LCBWaWV3IHZpZXcpIHsKKworICAgICAgICBpZiAobVRyYW5zaXRpb24gIT0gbnVsbCkgeworICAgICAgICAgICAgbVRyYW5zaXRpb24uY2hpbGRSZW1vdmUodGhpcywgdmlldyk7CisgICAgICAgIH0KKwogICAgICAgICBib29sZWFuIGNsZWFyQ2hpbGRGb2N1cyA9IGZhbHNlOwogICAgICAgICBpZiAodmlldyA9PSBtRm9jdXNlZCkgewogICAgICAgICAgICAgdmlldy5jbGVhckZvY3VzRm9yUmVtb3ZhbCgpOwogICAgICAgICAgICAgY2xlYXJDaGlsZEZvY3VzID0gdHJ1ZTsKICAgICAgICAgfQogCi0gICAgICAgIGlmICh2aWV3LmdldEFuaW1hdGlvbigpICE9IG51bGwpIHsKKyAgICAgICAgaWYgKHZpZXcuZ2V0QW5pbWF0aW9uKCkgIT0gbnVsbCB8fAorICAgICAgICAgICAgICAgIChtVHJhbnNpdGlvbmluZ1ZpZXdzICE9IG51bGwgJiYgbVRyYW5zaXRpb25pbmdWaWV3cy5jb250YWlucyh2aWV3KSkpIHsKICAgICAgICAgICAgIGFkZERpc2FwcGVhcmluZ1ZpZXcodmlldyk7CiAgICAgICAgIH0gZWxzZSBpZiAodmlldy5tQXR0YWNoSW5mbyAhPSBudWxsKSB7CiAgICAgICAgICAgIHZpZXcuZGlzcGF0Y2hEZXRhY2hlZEZyb21XaW5kb3coKTsKQEAgLTIyMDksNiArMjU4OCwzNiBAQAogICAgICAgICB9CiAgICAgfQogCisgICAgLyoqCisgICAgICogU2V0cyB0aGUgTGF5b3V0VHJhbnNpdGlvbiBvYmplY3QgZm9yIHRoaXMgVmlld0dyb3VwLiBJZiB0aGUgTGF5b3V0VHJhbnNpdGlvbiBvYmplY3QgaXMKKyAgICAgKiBub3QgbnVsbCwgY2hhbmdlcyBpbiBsYXlvdXQgd2hpY2ggb2NjdXIgYmVjYXVzZSBvZiBjaGlsZHJlbiBiZWluZyBhZGRlZCB0byBvciByZW1vdmVkIGZyb20KKyAg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gQEAKICAgICAgICAgZm9yIChpbnQgaSA9IHN0YXJ0OyBpIDwgZW5kOyBpKyspIHsKICAgICAgICAgICAgIGZpbmFsIFZpZXcgdmlldyA9IGNoaWxkcmVuW2ldOwogCisgICAgICAgICAgICBpZiAobVRyYW5zaXRpb24gIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIG1UcmFuc2l0aW9uLmNoaWxkUmVtb3ZlKHRoaXMsIHZpZXcpOworICAgICAgICAgICAgfQorCiAgICAgICAgICAgICBpZiAodmlldyA9PSBmb2N1c2VkKSB7CiAgICAgICAgICAgICAgICAgdmlldy5jbGVhckZvY3VzRm9yUmVtb3ZhbCgpOwogICAgICAgICAgICAgICAgIGNsZWFyQ2hpbGRGb2N1cyA9IHZpZXc7CiAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgIGlmICh2aWV3LmdldEFuaW1hdGlvbigpICE9IG51bGwpIHsKKyAgICAgICAgICAgIGlmICh2aWV3LmdldEFuaW1hdGlvbigpICE9IG51bGwgfHwKKyAgICAgICAgICAgICAgICAobVRyYW5zaXRpb25pbmdWaWV3cyAhPSBudWxsICYmIG1UcmFuc2l0aW9uaW5nVmlld3MuY29udGFpbnModmlldykpKSB7CiAgICAgICAgICAgICAgICAgYWRkRGlzYXBwZWFyaW5nVmlldyh2aWV3KTsKICAgICAgICAgICAgIH0gZWxzZSBpZiAoZGV0YWNoKSB7CiAgICAgICAgICAgICAgICB2aWV3LmRpc3BhdGNoRGV0YWNoZWRGcm9tV2luZG93KCk7CkBAIC0yMjg2LDEyICsyNzAwLDE3IEBACiAgICAgICAgIGZvciAoaW50IGkgPSBjb3VudCAtIDE7IGkgPj0gMDsgaS0tKSB7CiAgICAgICAgICAgICBmaW5hbCBWaWV3IHZpZXcgPSBjaGlsZHJlbltpXTsKIAorICAgICAgICAgICAgaWYgKG1UcmFuc2l0aW9uICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBtVHJhbnNpdGlvbi5jaGlsZFJlbW92ZSh0aGlzLCB2aWV3KTsKKyAgICAgICAgICAgIH0KKwogICAgICAgICAgICAgaWYgKHZpZXcgPT0gZm9jdXNlZCkgewogICAgICAgICAgICAgICAgIHZpZXcuY2xlYXJGb2N1c0ZvclJlbW92YWwoKTsKICAgICAgICAgICAgICAgICBjbGVhckNoaWxkRm9jdXMgPSB2aWV3OwogICAgICAgICAgICAgfQogCi0gICAgICAgICAgICBpZiAodmlldy5nZXRBbmltYXRpb24oKSAhPSBudWxsKSB7CisgICAgICAgICAgICBpZiAodmlldy5nZXRBbmltYXRpb24oKSAhPSBudWxsIHx8CisgICAgICAgICAgICAgICAgICAgIChtVHJhbnNpdGlvbmluZ1ZpZXdzICE9IG51bGwgJiYgbVRyYW5zaXRpb25pbmdWaWV3cy5jb250YWlucyh2aWV3KSkpIHsKICAgICAgICAgICAgICAgICBhZGREaXNhcHBlYXJpbmdWaWV3KHZpZXcpOwogICAgICAgICAgICAgfSBlbHNlIGlmIChkZXRhY2gpIHsKICAgICAgICAgICAgICAgIHZpZXcuZGlzcGF0Y2hEZXRhY2hlZEZyb21XaW5kb3coKTsKQEAgLTIzMjQsMTEgKzI3NDMsMTYgQEAKICAgICAgKiBAc2VlICNkZXRhY2hWaWV3RnJvbVBhcmVudChpbnQpCiAgICAgICovCiAgICAgcHJvdGVjdGVkIHZvaWQgcmVtb3ZlRGV0YWNoZWRWaWV3KFZpZXcgY2hpbGQsIGJvb2xlYW4gYW5pbWF0ZSkgeworICAgICAgICBpZiAobVRyYW5zaXRpb24gIT0gbnVsbCkgeworICAgICAgICAgICAgbVRyYW5zaXRpb24uY2hpbGRSZW1vdmUodGhpcywgY2hpbGQpOworICAgICAgICB9CisKICAgICAgICAgaWYgKGNoaWxkID09IG1Gb2N1c2VkKSB7CiAgICAgICAgICAgICBjaGlsZC5jbGVhckZvY3VzKCk7CiAgICAgICAgIH0KIAotICAgICAgICBpZiAoYW5pbWF0ZSAmJiBjaGlsZC5nZXRBbmltYXRpb24oKSAhPSBudWxsKSB7CisgICAgICAgIGlmICgoYW5pbWF0ZSAmJiBjaGlsZC5nZXRBbmltYXRpb24oKSAhPSBudWxsKSB8fAorICAgICAgICAgICAgICAgIChtVHJhbnNpdGlvbmluZ1ZpZXdzICE9IG51bGwgJiYgbVRyYW5zaXRpb25pbmdWaWV3cy5jb250YWlucyhjaGlsZCkpKSB7CiAgICAgICAgICAgICBhZGREaXNhcHBlYXJpbmdWaWV3KGNoaWxkKTsKICAgICAgICAgfSBlbHNlIGlmIChjaGlsZC5tQXR0YWNoSW5mbyAhPSBudWxsKSB7CiAgICAgICAgICAgICBjaGlsZC5kaXNwYXRjaERldGFjaGVkRnJvbVdpbmRvdygpOwpAQCAtMjQ3MCw2ICsyODk0LDE1IEBACiAgICAgICAgICAgICBmaW5hbCBpbnRbXSBsb2NhdGlvbiA9IGF0dGFjaEluZm8ubUludmFsaWRhdGVDaGlsZExvY2F0aW9uOwogICAgICAgICAgICAgbG9jYXRpb25bQ0hJTERfTEVGVF9JTkRFWF0gPSBjaGlsZC5tTGVmdDsKICAgICAgICAgICAgIGxvY2F0aW9uW0NISUxEX1RPUF9JTkRFWF0gPSBjaGlsZC5tVG9wOworICAgICAgICAgICAgTWF0cml4IGNoaWxkTWF0cml4ID0gY2hpbGQuZ2V0TWF0cml4KCk7CisgICAgICAgICAgICBpZiAoIWNoaWxkTWF0cml4LmlzSWRlbnRpdHkoKSkgeworICAgICAgICAgICAgICAgIFJlY3RGIGJvdW5kaW5nUmVjdCA9IGF0dGFjaEluZm8ubVRtcFRyYW5zZm9ybVJlY3Q7CisgICAgICAgICAgICAgICAgYm91bmRpbmdSZWN0LnNldChkaXJ0eSk7CisgICAgICAgICAgICAgICAgY2hpbGRNYXRyaXgubWFwUmVjdChib3VuZGluZ1JlY3QpOworICAgICAgICAgICAgICAgIGRpcnR5LnNldCgoaW50KSBib3VuZGluZ1JlY3QubGVmdCwgKGludCkgYm91bmRpbmdSZWN0LnRvcCwKKyAgICAgICAgICAgICAgICAgICAgICAgIChpbnQpIChib3VuZGluZ1JlY3QucmlnaHQgKyAwLjVmKSwKKyAgICAgICAgICAgICAgICAgICAgICAgIChpbnQpIChib3VuZGluZ1JlY3QuYm90dG9tICsgMC41ZikpOworICAgICAgICAgICAgfQogCiAgICAgICAgICAgICAvLyBJZiB0aGUgY2hpbGQgaXMgZHJhd2luZyBhbiBhbmltYXRpb24sIHdlIHdhbnQgdG8gY29weSB0aGlzIGZsYWcgb250bwogICAgICAgICAgICAgLy8gb3Vyc2VsdmVzIGFuZCB0aGUgcGFyZW50IHRvIG1ha2Ugc3VyZSB0aGUgaW52YWxpZGF0ZSByZXF1ZXN0IGdvZXMKQEAgLTI1MDQsNiArMjkzNywxOCBAQAogICAgICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgICAgIHBhcmVudCA9IHBhcmVudC5pbnZhbGlkYXRlQ2hpbGRJblBhcmVudChsb2NhdGlvbiwgZGlydHkpOworICAgICAgICAgICAgICAgIGlmICh2aWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gQWNjb3VudCBmb3IgdHJhbnNmb3JtIG9uIGN1cnJlbnQgcGFyZW50CisgICAgICAgICAgICAgICAgICAgIE1hdHJpeCBtID0gdmlldy5nZXRNYXRyaXgoKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKCFtLmlzSWRlbnRpdHkoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgUmVjdEYgYm91bmRpbmdSZWN0ID0gYXR0YWNoSW5mby5tVG1wVHJhbnNmb3JtUmVjdDsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJvdW5kaW5nUmVjdC5zZXQoZGlydHkpOworICAgICAgICAgICAgICAgICAgICAgICAgbS5tYXBSZWN0KGJvdW5kaW5nUmVjdCk7CisgICAgICAgICAgICAgICAgICAgICAgICBkaXJ0eS5zZXQoKGludCkgYm91bmRpbmdSZWN0LmxlZnQsIChpbnQpIGJvdW5kaW5nUmVjdC50b3AsCisgICAgICAgICAgICAgICAgICA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3V0VHJhbnNpdGlvbkxpc3RlbmVyID0KKyAgICAgICAgICAgIG5ldyBMYXlvdXRUcmFuc2l0aW9uLlRyYW5zaXRpb25MaXN0ZW5lcigpIHsKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIHN0YXJ0VHJhbnNpdGlvbihMYXlvdXRUcmFuc2l0aW9uIHRyYW5zaXRpb24sIFZpZXdHcm91cCBjb250YWluZXIsCisgICAgICAgICAgICAgICAgVmlldyB2aWV3LCBpbnQgdHJhbnNpdGlvblR5cGUpIHsKKyAgICAgICAgICAgIC8vIFdlIG9ubHkgY2FyZSBhYm91dCBkaXNhcHBlYXJpbmcgaXRlbXMsIHNpbmNlIHdlIG5lZWQgc3BlY2lhbCBsb2dpYyB0byBrZWVwCisgICAgICAgICAgICAvLyB0aG9zZSBpdGVtcyB2aXNpYmxlIGFmdGVyIHRoZXkndmUgYmVlbiAncmVtb3ZlZCcKKyAgICAgICAgICAgIGlmICh0cmFuc2l0aW9uVHlwZSA9PSBMYXlvdXRUcmFuc2l0aW9uLkRJU0FQUEVBUklORykgeworICAgICAgICAgICAgICAgIGlmIChtVHJhbnNpdGlvbmluZ1ZpZXdzID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgbVRyYW5zaXRpb25pbmdWaWV3cyA9IG5ldyBBcnJheUxpc3Q8Vmlldz4oKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgbVRyYW5zaXRpb25pbmdWaWV3cy5hZGQodmlldyk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgZW5kVHJhbnNpdGlvbihMYXlvdXRUcmFuc2l0aW9uIHRyYW5zaXRpb24sIFZpZXdHcm91cCBjb250YWluZXIsCisgICAgICAgICAgICAgICAgVmlldyB2aWV3LCBpbnQgdHJhbnNpdGlvblR5cGUpIHsKKyAgICAgICAgICAgIGlmICh0cmFuc2l0aW9uVHlwZSA9PSBMYXlvdXRUcmFuc2l0aW9uLkRJU0FQUEVBUklORyAmJiBtVHJhbnNpdGlvbmluZ1ZpZXdzICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBtVHJhbnNpdGlvbmluZ1ZpZXdzLnJlbW92ZSh2aWV3KTsKKyAgICAgICAgICAgICAgICBmaW5hbCBBcnJheUxpc3Q8Vmlldz4gZGlzYXBwZWFyaW5nQ2hpbGRyZW4gPSBtRGlzYXBwZWFyaW5nQ2hpbGRyZW47CisgICAgICAgICAgICAgICAgaWYgKGRpc2FwcGVhcmluZ0NoaWxkcmVuICE9IG51bGwgJiYgZGlzYXBwZWFyaW5nQ2hpbGRyZW4uY29udGFpbnModmlldykpIHsKKyAgICAgICAgICAgICAgICAgICAgZGlzYXBwZWFyaW5nQ2hpbGRyZW4ucmVtb3ZlKHZpZXcpOworICAgICAgICAgICAgICAgICAgICBpZiAodmlldy5tQXR0YWNoSW5mbyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICB2aWV3LmRpc3BhdGNoRGV0YWNoZWRGcm9tV2luZG93KCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgaWYgKHZpZXcubVBhcmVudCAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICB2aWV3Lm1QYXJlbnQgPSBudWxsOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIG1Hcm91cEZsYWdzIHw9IEZMQUdfSU5WQUxJREFURV9SRVFVSVJFRDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9OworCiAgICAgLyoqCiAgICAgICoge0Bpbmhlcml0RG9jfQogICAgICAqLwpAQCAtMzc0NCw0ICs0MjI0LDI5MiBAQAogICAgICAgICAgICAgYm90dG9tTWFyZ2luID0gYm90dG9tOwogICAgICAgICB9CiAgICAgfQorCisgICAgcHJpdmF0ZSB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Nvb3JkcygpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgY2xlYXIoKSB7CisgICAgICAgICAgICBtVGFyZ2V0cy5jbGVhcigpOworICAgICAgICAgICAgZmluYWwgaW50IGNvdW50ID0gbVVuaXF1ZVRhcmdldENvdW50OworICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBjb3VudDsgaSsrKSB7CisgICAgICAgICAgICAgICAgbVVuaXF1ZVRhcmdldHNbaV0ucmVjeWNsZSgpOworICAgICAgICAgICAgICAgIG1VbmlxdWVUYXJnZXRzW2ldID0gbnVsbDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1VbmlxdWVUYXJnZXRDb3VudCA9IDA7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBhZGQoaW50IHBvaW50ZXJJZCwgVmlldyB0YXJnZXQsIGxvbmcgZG93blRpbWUpIHsKKyAgICAgICAgICAgIG1UYXJnZXRzLnB1dChwb2ludGVySWQsIHRhcmdldCk7CisKKyAgICAgICAgICAgIGZpbmFsIGludCB1bmlxdWVDb3VudCA9IG1VbmlxdWVUYXJnZXRDb3VudDsKKyAgICAgICAgICAgIGJvb2xlYW4gYWRkVW5pcXVlID0gdHJ1ZTsKKyAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgdW5pcXVlQ291bnQ7IGkrKykgeworICAgICAgICAgICAgICAgIGlmIChtVW5pcXVlVGFyZ2V0c1tpXS52aWV3ID09IHRhcmdldCkgeworICAgICAgICAgICAgICAgICAgICBhZGRVbmlxdWUgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoYWRkVW5pcXVlKSB7CisgICAgICAgICAgICAgICAgaWYgKG1VbmlxdWVUYXJnZXRzLmxlbmd0aCA9PSB1bmlxdWVDb3VudCkgeworICAgICAgICAgICAgICAgICAgICBUYXJnZXRJbmZvW10gbmV3VGFyZ2V0cyA9CisgICAgICAgICAgICAgICAgICAgICAgICBuZXcgVGFyZ2V0SW5mb1t1bmlxdWVDb3VudCArIElOSVRJQUxfVU5JUVVFX01PVElPTl9UQVJHRVRTX1NJWkVdOworICAgICAgICAgICAgICAgICAgICBTeXN0ZW0uYXJyYXljb3B5KG1VbmlxdWVUYXJnZXRzLCAwLCBuZXdUYXJnZXRzLCAwLCB1bmlxdWVDb3VudCk7CisgICAgICAgICAgICAgICAgICAgIG1VbmlxdWVUYXJnZXRzID0gbmV3VGFyZ2V0czsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgbVVuaXF1ZVRhcmdldHNbdW5pcXVlQ291bnRdID0gVGFyZ2V0SW5mby5vYnRhaW4odGFyZ2V0LCBkb3duVGltZSk7CisgICAgICAgICAgICAgICAgbVVuaXF1ZVRhcmdldENvdW50Kys7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgaW50IGdldElkQ291bnQoKSB7CisgICAgICAgICAgICByZXR1cm4gbVRhcmdldHMuc2l6ZSgpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGludCBnZXRVbmlxdWVUYXJnZXRDb3VudCgpIHsKKyAgICAgICAgICAgIHJldHVybiBtVW5pcXVlVGFyZ2V0Q291bnQ7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgVGFyZ2V0SW5mbyBnZXRVbmlxdWVUYXJnZXRBdChpbnQgaW5kZXgpIHsKKyAgICAgICAgICAgIHJldHVybiBtVW5pcXVlVGFyZ2V0c1tpbmRleF07CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgVmlldyBnZXQoaW50IGlkKSB7CisgICAgICAgICAgICByZXR1cm4gbVRhcmdldHMuZ2V0KGlkKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBpbnQgaW5kZXhPZlRhcmdldChWaWV3IHRhcmdldCkgeworICAgICAgICAgICAgcmV0dXJuIG1UYXJnZXRzLmluZGV4T2ZWYWx1ZSh0YXJnZXQpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIFZpZXcgdGFyZ2V0QXQoaW50IGluZGV4KSB7CisgICAgICAgICAgICByZXR1cm4gbVRhcmdldHMudmFsdWVBdChpbmRleCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgVGFyZ2V0SW5mbyBnZXRQcmltYXJ5VGFyZ2V0KCkgeworICAgICAgICAgICAgaWYgKCFpc0VtcHR5KCkpIHsKKyAgICAgICAgICAgICAgICAvLyBGaW5kIHRoZSBsb25nZXN0LWxpdmVkIHRhcmdldAorICAgICAgICAgICAgICAgIGxvbmcgZmlyc3RUaW1lID0gTG9uZy5NQVhfVkFMVUU7CisgICAgICAgICAgICAgICAgaW50IGZpcnN0SW5kZXggPSAwOworICAgICAgICAgICAgICAgIGZpbmFsIGludCB1bmlxdWVDb3VudCA9IG1VbmlxdWVUYXJnZXRDb3VudDsKKyAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IHVuaXF1ZUNvdW50OyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgVGFyZ2V0SW5mbyBpbmZvID0gbVVuaXF1ZVRhcmdldHNbaV07CisgICAgICAgICAgICAgICAgICAgIGlmIChpbmZvLmRvd25UaW1lIDwgZmlyc3RUaW1lKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBmaXJzdFRpbWUgPSBpbmZvLmRvd25UaW1lOworICAgICAgICAgICAgICAgICAgICAgICAgZmlyc3RJbmRleCA9IGk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcmV0dXJuIG1VbmlxdWVUYXJnZXRzW2ZpcnN0SW5kZXhdOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgYm9vbGVhbiBpc0VtcHR5KCkgeworICAgICAgICAgICAgcmV0dXJuIG1VbmlxdWVUYXJnZXRDb3VudCA9PSAwOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgcmVtb3ZlQnlJZChpbnQgaWQpIHsKKyAgICAgICAgICAgIGZpbmFsIGludCBpbmRleCA9IG1UYXJnZXRzLmluZGV4T2ZLZXkoaWQpOworICAgICAgICAgICAgcmVtb3ZlQXQoaW5kZXgpOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICBwdWJsaWMgdm9pZCByZW1vdmVWaWV3KFZpZXcgdmlldykgeworICAgICAgICAgICAgaW50IGkgPSAwOworICAgICAgICAgICAgd2hpbGUgKGkgPCBtVGFyZ2V0cy5zaXplKCkpIHsKKyAgICAgICAgICAgICAgICBpZiAobVRhcmdldHMudmFsdWVBdChpKSA9PSB2aWV3KSB7CisgICAgICAgICAgICAgICAgICAgIG1UYXJnZXRzLnJlbW92ZUF0KGkpOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIGkrKzsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZW1vdmVVbmlxdWUodmlldyk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCByZW1vdmVBdChpbnQgaW5kZXgpIHsKKyAgICAgICAgICAgIGlmIChpbmRleCA8IDAgfHwgaW5kZXggPj0gbVRhcmdldHMuc2l6ZSgpKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBmaW5hbCBWaWV3IHJlbW92ZVZpZXcgPSBtVGFyZ2V0cy52YWx1ZUF0KGluZGV4KTsKKyAgICAgICAgICAgIG1UYXJnZXRzLnJlbW92ZUF0KGluZGV4KTsKKyAgICAgICAgICAgIGlmIChtVGFyZ2V0cy5pbmRleE9mVmFsdWUocmVtb3ZlVmlldykgPCAwKSB7CisgICAgICAgICAgICAgICAgcmVtb3ZlVW5pcXVlKHJlbW92ZVZpZXcpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSB2b2lkIHJlbW92ZVVuaXF1ZShWaWV3IHJlbW92ZVZpZXcpIHsKKyAgICAgICAgICAgIFRhcmdldEluZm9bXSB1bmlxdWUgPSBtVW5pcXVlVGFyZ2V0czsKKyAgICAgICAgICAgIGludCB1bmlxdWVDb3VudCA9IG1VbmlxdWVUYXJnZXRDb3VudDsKKyAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgdW5pcXVlQ291bnQ7IGkrKykgeworICAgICAgICAgICAgICAgIGlmICh1bmlxdWVbaV0udmlldyA9PSByZW1vdmVWaWV3KSB7CisgICAgICAgICAgICAgICAgICAgIHVuaXF1ZVtpXS5yZWN5Y2xlKCk7CisgICAgICAgICAgICAgICAgICAgIHVuaXF1ZVtpXSA9IHVuaXF1ZVstLXVuaXF1ZUNvdW50XTsKKyAgICAgICAgICAgICAgICAgICAgdW5pcXVlW3VuaXF1ZUNvdW50XSA9IG51bGw7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgbVVuaXF1ZVRhcmdldENvdW50ID0gdW5pcXVlQ291bnQ7CisgICAgICAgIH0KKworICAgICAgICAvKioKKyAgICAgICAgICogUmV0dXJuIGEgbmV3IChvYnRhaW4oKWVkKSBNb3Rpb25FdmVudCBjb250YWluaW5nIG9ubHkgZGF0YSBmb3IgcG9pbnRlcnMgdGhhdCBzaG91bGQKKyAgICAgICAgICogYmUgZGlzcGF0Y2hlZCB0byBjaGlsZC4gRG9uJ3QgZm9yZ2V0IHRvIHJlY3ljbGUgaXQhCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgTW90aW9uRXZlbnQgZmlsdGVyTW90aW9uRXZlbnRGb3JDaGlsZChNb3Rpb25FdmVudCBldiwgVmlldyBjaGlsZCwgbG9uZyBkb3duVGltZSkgeworICAgICAgICAgICAgaW50IGFjdGlvbiA9IGV2LmdldEFjdGlvbigpOworICAgICAgICAgICAgZmluYWwgaW50IG1hc2tlZEFjdGlvbiA9IGFjdGlvbiAmIE1vdGlvbkV2ZW50LkFDVElPTl9NQVNLOworCisgICAgICAgICAgICAvLyBPbmx5IHNlbmQgcG9pbnRlciB1cCBldmVudHMgaWYgdGhpcyBjaGlsZCB3YXMgdGhlIHRhcmdldC4gRHJvcCBpdCBvdGhlcndpc2UuCisgICAgICAgICAgICBpZiAobWFza2VkQWN0aW9uID09IE1vdGlvbkV2ZW50LkFDVElPTl9QT0lOVEVSX1VQICYmCisgICAgICAgICAgICAgICAgICAgIGdldChldi5nZXRQb2ludGVySWQoZXYuZ2V0QWN0aW9uSW5kZXgoKSkpICE9IGNoaWxkKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGludCBwb2ludGVyQ291bnQgPSAwOworICAgICAgICAgICAgZmluYWwgaW50IGlkQ291bnQgPSBnZXRJZENvdW50KCk7CisgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGlkQ291bnQ7IGkrKykgeworICAgICAgICAgICAgICAgIGlmICh0YXJnZXRBdChpKSA9PSBjaGlsZCkgeworICAgICAgICAgICAgICAgICAgICBwb2ludGVyQ291bnQrKzsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGludCBhY3Rpb25JZCA9IC0xOworICAgICAgICAgICAgYm9vbGVhbiBuZWVkc05ld0luZGV4ID0gZmFsc2U7IC8vIFRydWUgaWYgd2Ugc2hvdWxkIGZpbGwgaW4gdGhlIGFjdGlvbidzIG1hc2tlZCBpbmRleAorCisgICAgICAgICAgICAvLyBJZiB3ZSBoYXZlIGEgZG93biBldmVudCwgaXQgd2Fzbid0IGNvdW50ZWQgYWJvdmUuCisgICAgICAgICAgICBpZiAobWFza2VkQWN0aW9uID09IE1vdGlvbkV2ZW50LkFDVElPTl9ET1dOKSB7CisgICAgICAgICAgICAgICAgcG9pbnRlckNvdW50Kys7CisgICAgICAgICAgICAgICAgYWN0aW9uSWQgPSBldi5nZXRQb2ludGVySWQoMCk7CisgICAgICAgICAgICB9IGVsc2UgaWYgKG1hc2tlZEFjdGlvbiA9PSBNb3Rpb25FdmVudC5BQ1RJT05fUE9JTlRFUl9ET1dOKSB7CisgICAgICAgICAgICAgICAgcG9pbnRlckNvdW50Kys7CisKKyAgICAgICAgICAgICAgICBhY3Rpb25JZCA9IGV2LmdldFBvaW50ZXJJZChldi5nZXRBY3Rpb25JbmRleCgpKTsKKworICAgICAgICAgICAgICAgIGlmIChpbmRleE9mVGFyZ2V0KGNoaWxkKSA8IDApIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gVGhlIG5ldyBhY3Rpb24gc2hvdWxkIGJlIEFDVElPTl9ET1dOIGlmIHRoaXMgY2hpbGQgaXNuJ3QgY3VycmVudGx5IGdldHRpbmcKKyAgICAgICAgICAgICAgICAgICAgLy8gYW55IGV2ZW50cy4KKyAgICAgICAgICAgICAgICAgICAgYWN0aW9uID0gTW90aW9uRXZlbnQuQUNUSU9OX0RPV047CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gRmlsbCBpbiB0aGUgaW5kZXggcG9ydGlvbiBvZiB0aGUgYWN0aW9uIGxhdGVyLgorICAgICAgICAgICAgICAgICAgICBuZWVkc05ld0luZGV4ID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGVsc2UgaWYgKG1hc2tlZEFjdGlvbiA9PSBNb3Rpb25FdmVudC5BQ1RJT05fUE9JTlRFUl9VUCkgeworICAgICAgICAgICAgICAgIGFjdGlvbklkID0gZXYuZ2V0UG9pbnRlcklkKGV2LmdldEFjdGlvbkluZGV4KCkpOworICAgICAgICAgICAgICAgIGlmIChwb2ludGVyQ291bnQgPT0gMSkgeworICAgICAgICAgICAgICAgICAgICAvLyBUaGUgbmV3IGFjdGlvbiBzaG91bGQgYmUgQUNUSU9OX1VQIGlmIHRoZXJlJ3Mgb25seSBvbmUgcG9pbnRlciBsZWZ0IGZvcgorICAgICAgICAgICAgICAgICAgICAvLyB0aGlzIHRhcmdldC4KKyAgICAgICAgICAgICAgICAgICAgYWN0aW9uID0gTW90aW9uRXZlbnQuQUNUSU9OX1VQOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIC8vIEZpbGwgaW4gdGhlIGluZGV4IHBvcnRpb24gb2YgdGhlIGFjdGlvbiBsYXRlci4KKyAgICAgICAgICAgICAgICAgICAgbmVlZHNOZXdJbmRleCA9IHRydWU7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAocG9pbnRlckNvdW50ID09IDApIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLy8gRmlsbCB0aGUgYnVja2V0cyB3aXRoIHBvaW50ZXIgZGF0YSEKKyAgICAgICAgICAgIGZpbmFsIGludCBldmVudFBvaW50ZXJDb3VudCA9IGV2LmdldFBvaW50ZXJDb3VudCgpOworICAgICAgICAgICAgaW50IGJ1Y2tldEluZGV4ID0gMDsKKyAgICAgICAgICAgIGludCBuZXdBY3Rpb25JbmRleCA9IC0xOworICAgICAgICAgICAgZm9yIChpbnQgZXZwID0gMDsgZXZwIDwgZXZlbnRQb2ludGVyQ291bnQ7IGV2cCsrKSB7CisgICAgICAgICAgICAgICAgZmluYWwgaW50IGlkID0gZXYuZ2V0UG9pbnRlcklkKGV2cCk7CisKKyAgICAgICAgICAgICAgICAvLyBBZGQgdGhpcyBwb2ludGVyIHRvIHRoZSBidWNrZXQgaWYgaXQgaXMgbmV3IG9yIHRhcmdldGVkIGF0IGNoaWxkCisgICAgICAgICAgICAgICAgaWYgKGlkID09IGFjdGlvbklkIHx8IGdldChpZCkgPT0gY2hpbGQpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gRXhwYW5kIHNjcmF0Y2ggYXJyYXlzIGlmIG5lZWRlZAorICAgICAgICAgICAgICAgICAgICBpZiAobVBvaW50ZXJDb29yZHMubGVuZ3RoIDw9IGJ1Y2tldEluZGV4KSB7CisgICAgICAgICAgICAgICAgICAgICAgICBpbnRbXSBwb2ludGVySWRzID0gbmV3IGludFtwb2ludGVyQ291bnRdOworICAgICAgICAgICAgICAgICAgICAgICAgTW90aW9uRXZlbnQuUG9pbnRlckNvb3Jkc1tdIHBvaW50ZXJDb29yZHMgPQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXcgTW90aW9uRXZlbnQuUG9pbnRlckNvb3Jkc1twb2ludGVyQ291bnRdOworICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IG1Qb2ludGVyQ29vcmRzLmxlbmd0aDsgaSA8IHBvaW50ZXJDb29yZHMubGVuZ3RoOyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBwb2ludGVyQ29vcmRzW2ldID0gbmV3IE1vdGlvbkV2ZW50LlBvaW50ZXJDb29yZHMoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICAgICAgU3lzdGVtLmFycmF5Y29weShtUG9pbnRlckNvb3JkcywgMCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcG9pbnRlckNvb3JkcywgMCwgbVBvaW50ZXJDb29yZHMubGVuZ3RoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIFN5c3RlbS5hcnJheWNvcHkobVBvaW50ZXJJZHMsIDAsIHBvaW50ZXJJZHMsIDAsIG1Qb2ludGVySWRzLmxlbmd0aCk7CisKKyAgICAgICAgICAgICAgICAgICAgICAgIG1Qb2ludGVyQ29vcmRzID0gcG9pbnRlckNvb3JkczsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1Qb2ludGVySWRzID0gcG9pbnRlcklkczsKKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIG1Qb2ludGVySWRzW2J1Y2tldEluZGV4XSA9IGlkOworICAgICAgICAgICAgICAgICAgICBldi5nZXRQb2ludGVyQ29vcmRzKGV2cCwgbVBvaW50ZXJDb29yZHNbYnVja2V0SW5kZXhdKTsKKworICAgICAgICAgICAgICAgICAgICBpZiAobmVlZHNOZXdJbmRleCAmJiBpZCA9PSBhY3Rpb25JZCkgeworICAgICAgICAgICAgICAgICAgICAgICAgbmV3QWN0aW9uSW5kZXggPSBidWNrZXRJbmRleDsKKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIGJ1Y2tldEluZGV4Kys7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvLyBFbmNvZGUgdGhlIG5ldyBhY3Rpb24gaW5kZXggaWYgd2UgaGF2ZSBvbmUKKyAgICAgICAgICAgIGlmIChuZXdBY3Rpb25JbmRleCA+PSAwKSB7CisgICAgICAgICAgICAgICAgYWN0aW9uID0gKGFjdGlvbiAmIE1vdGlvbkV2ZW50LkFDVElPTl9NQVNLKSB8CisgICAgICAgICAgICAgICAgICAgICAgICAobmV3QWN0aW9uSW5kZXggPDwgTW90aW9uRXZlbnQuQUNUSU9OX1BPSU5URVJfSU5ERVhfU0hJRlQpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICByZXR1cm4gTW90aW9uRXZlbnQub2J0YWluKGRvd25UaW1lLCBldi5nZXRFdmVudFRpbWUoKSwKKyAgICAgICAgICAgICAgICAgICAgYWN0aW9uLCBwb2ludGVyQ291bnQsIG1Qb2ludGVySWRzLCBtUG9pbnRlckNvb3JkcywgZXYuZ2V0TWV0YVN0YXRlKCksCisgICAgICAgICAgICAgICAgICAgIGV2LmdldFhQcmVjaXNpb24oKSwgZXYuZ2V0WVByZWNpc2lvbigpLCBldi5nZXREZXZpY2VJZCgpLCBldi5nZXRFZGdlRmxhZ3MoKSwKKyAgICAgICAgICAgICAgICAgICAgZXYuZ2V0U291cmNlKCkpOworICAgICAgICB9CisKKyAgICAgICAgc3RhdGljIGNsYXNzIFRhcmdldEluZm8geworICAgICAgICAgICAgcHVibGljIFZpZXcgdmlldzsKKyAgICAgICAgICAgIHB1YmxpYyBsb25nIGRvd25UaW1lOworCisgICAgICAgICAgICBwcml2YXRlIFRhcmdldEluZm8gbU5leHRSZWN5Y2xlZDsKKworICAgICAgICAgICAgcHJpdmF0ZSBzdGF0aWMgVGFyZ2V0SW5mbyBzUmVjeWNsZUJpbjsKKyAgICAgICAgICAgIHByaXZhdGUgc3RhdGljIGludCBzUmVjeWNsZWRDb3VudDsKKworICAgICAgICAgICAgcHJpdmF0ZSBzdGF0aWMgaW50IE1BWF9SRUNZQ0xFRCA9IDE1OworCisgICAgICAgICAgICBwcml2YXRlIFRhcmdldEluZm8oKSB7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHB1YmxpYyBzdGF0aWMgVGFyZ2V0SW5mbyBvYnRhaW4oVmlldyB2LCBsb25nIHRpbWUpIHsKKyAgICAgICAgICAgICAgICBUYXJnZXRJbmZvIGluZm87CisgICAgICAgICAgICAgICAgaWYgKHNSZWN5Y2xlQmluID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgaW5mbyA9IG5ldyBUYXJnZXRJbmZvKCk7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgaW5mbyA9IHNSZWN5Y2xlQmluOworICAgICAgICAgICAgICAgICAgICBzUmVjeWNsZUJpbiA9IGluZm8ubU5leHRSZWN5Y2xlZDsKKyAgICAgICAgICAgICAgICAgICAgc1JlY3ljbGVkQ291bnQtLTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaW5mby52aWV3ID0gdjsKKyAgICAgICAgICAgICAgICBpbmZvLmRvd25UaW1lID0gdGltZTsKKyAgICAgICAgICAgICAgICByZXR1cm4gaW5mbzsKKyAgICAgICAgICAgIH0KKworICAgICAg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0aGUgZmlyc3QgY29uZmlndXJhdGlvbiB0aGF0IG1hdGNoZXMgaXMKLSAgICAgICAgICovCi0gICAgICAgIGZpbmFsIGludFtdIGNvbmZpZ1NwZWMgPSB7Ci0gICAgICAgICAgICAgICAgRUdMMTAuRUdMX1JFRF9TSVpFLCAgICAgIDUsCi0gICAgICAgICAgICAgICAgRUdMMTAuRUdMX0dSRUVOX1NJWkUsICAgIDYsCi0gICAgICAgICAgICAgICAgRUdMMTAuRUdMX0JMVUVfU0laRSwgICAgIDUsCi0gICAgICAgICAgICAgICAgRUdMMTAuRUdMX0RFUFRIX1NJWkUsICAgIDAsCi0gICAgICAgICAgICAgICAgRUdMMTAuRUdMX05PTkUKLSAgICAgICAgfTsKLSAgICAgICAgZmluYWwgRUdMQ29uZmlnW10gY29uZmlncyA9IG5ldyBFR0xDb25maWdbMV07Ci0gICAgICAgIGZpbmFsIGludFtdIG51bV9jb25maWcgPSBuZXcgaW50WzFdOwotICAgICAgICBlZ2wuZWdsQ2hvb3NlQ29uZmlnKGVnbERpc3BsYXksIGNvbmZpZ1NwZWMsIGNvbmZpZ3MsIDEsIG51bV9jb25maWcpOwotICAgICAgICBmaW5hbCBFR0xDb25maWcgY29uZmlnID0gY29uZmlnc1swXTsKLQotICAgICAgICAvKgotICAgICAgICAgKiBDcmVhdGUgYW4gT3BlbkdMIEVTIGNvbnRleHQuIFRoaXMgbXVzdCBiZSBkb25lIG9ubHkgb25jZSwgYW4KLSAgICAgICAgICogT3BlbkdMIGNvbnRleHQgaXMgYSBzb21ld2hhdCBoZWF2eSBvYmplY3QuCi0gICAgICAgICAqLwotICAgICAgICBmaW5hbCBFR0xDb250ZXh0IGNvbnRleHQgPSBlZ2wuZWdsQ3JlYXRlQ29udGV4dChlZ2xEaXNwbGF5LCBjb25maWcsCi0gICAgICAgICAgICAgICAgRUdMMTAuRUdMX05PX0NPTlRFWFQsIG51bGwpOwotICAgICAgICBtRWdsQ29udGV4dCA9IGNvbnRleHQ7Ci0KLS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gICAgICAgICAvLyB3ZSdsbCB0cnkgYWdhaW4gaWYgaXQgd2FzIGNvbnRleHQgbG9zdAotICAgICAgICAgICAgICAgICAgICBtR2xXYW50ZWQgPSBmYWxzZTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICB9Ci0KICAgICAvKioKICAgICAgKiBXZSBoYXZlIG9uZSBjaGlsZAogICAgICAqLwotICAgIHB1YmxpYyB2b2lkIHNldFZpZXcoVmlldyB2aWV3LCBXaW5kb3dNYW5hZ2VyLkxheW91dFBhcmFtcyBhdHRycywKLSAgICAgICAgICAgIFZpZXcgcGFuZWxQYXJlbnRWaWV3KSB7CisgICAgcHVibGljIHZvaWQgc2V0VmlldyhWaWV3IHZpZXcsIFdpbmRvd01hbmFnZXIuTGF5b3V0UGFyYW1zIGF0dHJzLCBWaWV3IHBhbmVsUGFyZW50VmlldykgewogICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKICAgICAgICAgICAgIGlmIChtVmlldyA9PSBudWxsKSB7CiAgICAgICAgICAgICAgICAgbVZpZXcgPSB2aWV3OwogICAgICAgICAgICAgICAgIG1XaW5kb3dBdHRyaWJ1dGVzLmNvcHlGcm9tKGF0dHJzKTsKICAgICAgICAgICAgICAgICBhdHRycyA9IG1XaW5kb3dBdHRyaWJ1dGVzOworICAgICAgICAgICAgICAgIAorICAgICAgICAgICAgICAgIGVuYWJsZUhhcmR3YXJlQWNjZWxlcmF0aW9uKGF0dHJzKTsKKwogICAgICAgICAgICAgICAgIGlmICh2aWV3IGluc3RhbmNlb2YgUm9vdFZpZXdTdXJmYWNlVGFrZXIpIHsKICAgICAgICAgICAgICAgICAgICAgbVN1cmZhY2VIb2xkZXJDYWxsYmFjayA9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKChSb290Vmlld1N1cmZhY2VUYWtlcil2aWV3KS53aWxsWW91VGFrZVRoZVN1cmZhY2UoKTsKQEAgLTU3NSw2ICs0ND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1JlbmRlcmVyID0gSGFyZHdhcmVSZW5kZXJlci5jcmVhdGVHbFJlbmRlcmVyKDIsIHRyYW5zbHVjZW50KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKwogICAgIHB1YmxpYyBWaWV3IGdldFZpZXcoKSB7CiAgICAgICAgIHJldHVybiBtVmlldzsKICAgICB9CkBAIC03MzEsOCArNjE1LDYgQEAKICAgICAgICAgYm9vbGVhbiB2aWV3VmlzaWJpbGl0eUNoYW5nZWQgPSBtVmlld1Zpc2liaWxpdHkgIT0gdmlld1Zpc2liaWxpdHkKICAgICAgICAgICAgICAgICB8fCBtTmV3U3VyZmFjZU5lZWRlZDsKIAotICAgICAgICBmbG9hdCBhcHBTY2FsZSA9IG1BdHRhY2hJbmZvLm1BcHBsaWNhdGlvblNjYWxlOwotCiAgICAgICAgIFdpbmRvd01hbmFnZXIuTGF5b3V0UGFyYW1zIHBhcmFtcyA9IG51bGw7CiAgICAgICAgIGlmIChtV2luZG93QXR0cmlidXRlc0NoYW5nZWQpIHsKICAgICAgICAgICAgIG1XaW5kb3dBdHRyaWJ1dGVzQ2hhbmdlZCA9IGZhbHNlOwpAQCAtNzgwLDkgKzY2Miw5IEBACiAgICAgICAgICAgICBhdHRhY2hJbmZvLm1XaW5kb3dWaXNpYmlsaXR5ID0gdmlld1Zpc2liaWxpdHk7CiAgICAgICAgICAgICBob3N0LmRpc3BhdGNoV2luZG93VmlzaWJpbGl0eUNoYW5nZWQodmlld1Zpc2liaWxpdHkpOwogICAgICAgICAgICAgaWYgKHZpZXdWaXNpYmlsaXR5ICE9IFZpZXcuVklTSUJMRSB8fCBtTmV3U3VyZmFjZU5lZWRlZCkgewotICAgICAgICAgICAgICAgIGlmIChtVXNlR0wpIHsKLSAgICAgICAgICAgICAgICAgICAgZGVzdHJveUdMKCk7Ci0gICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGlmIChtSHdSZW5kZXJlciAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIG1Id1JlbmRlcmVyLmRlc3Ryb3koZmFsc2UpOworICAgICAgICAgICAgICAgIH0gICAgICAgICAgICAgICAgCiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBpZiAodmlld1Zpc2liaWxpdHkgPT0gVmlldy5HT05FKSB7CiAgICAgICAgICAgICAgICAgLy8gQWZ0ZXIgbWFraW5nIGEgd2luZG93IGdvbmUsIHdlIHdpbGwgY291bnQgaXQgYXMgYmVpbmcKQEAgLTg5NywxMCArNzc5LDEyIEBACiAKICAgICAgICAgZmluYWwgYm9vbGVhbiBjb21wdXRlc0ludGVybmFsSW5zZXRzID0KICAgICAgICAgICAgICAgICBhdHRhY2hJbmZvLm1UcmVlT2JzZXJ2ZXIuaGFzQ29tcHV0ZUludGVybmFsSW5zZXRzTGlzdGVuZXJzKCk7CisKICAgICAgICAgYm9vbGVhbiBpbnNldHNQZW5kaW5nID0gZmFsc2U7CiAgICAgICAgIGludCByZWxheW91dFJlc3VsdCA9IDA7Ci0gICAgICAgIGlmIChtRmlyc3QgfHwgd2luZG93U2hvdWxkUmVzaXplIHx8IGluc2V0c0NoYW5nZWQKLSAgICAgICAgICAgICAgICB8fCB2aWV3VmlzaWJpbGl0eUNoYW5nZWQgfHwgcGFyYW1zICE9IG51bGwpIHsKKworICAgICAgICBpZiAobUZpcnN0IHx8IHdpbmRvd1Nob3VsZFJlc2l6ZSB8fCBpbnNldHNDaGFuZ2VkIHx8CisgICAgICAgICAgICAgICAgdmlld1Zpc2liaWxpdHlDaGFuZ2VkIHx8IHBhcmFtcyAhPSBudWxsKSB7CiAKICAgICAgICAgICAgIGlmICh2aWV3VmlzaWJpbGl0eSA9PSBWaWV3LlZJU0lCTEUpIHsKICAgICAgICAgICAgICAgICAvLyBJZiB0aGlzIHdpbmRvdyBpcyBnaXZpbmcgaW50ZXJuYWwgaW5zZXRzIHRvIHRoZSB3aW5kb3cKQEAgLTkxMiwyNiArNzk2LDE5IEBACiAgICAgICAgICAgICAgICAgLy8gd2luZG93LCB3YWl0aW5nIHVudGlsIHdlIGNhbiBmaW5pc2ggbGF5aW5nIG91dCB0aGlzIHdpbmRvdwogICAgICAgICAgICAgICAgIC8vIGFuZCBnZXQgYmFjayB0byB0aGUgd2luZG93IG1hbmFnZXIgd2l0aCB0aGUgdWx0aW1hdGVseQogICAgICAgICAgICAgICAgIC8vIGNvbXB1dGVkIGluc2V0cy4KLSAgICAgICAgICAgICAgICBpbnNldHNQZW5kaW5nID0gY29tcHV0ZXNJbnRlcm5hbEluc2V0cwotICAgICAgICAgICAgICAgICAgICAgICAgJiYgKG1GaXJzdCB8fCB2aWV3VmlzaWJpbGl0eUNoYW5nZWQpOwotCi0gICAgICAgICAgICAgICAgaWYgKG1XaW5kb3dBdHRyaWJ1dGVzLm1lbW9yeVR5cGUgPT0gV2luZG93TWFuYWdlci5MYXlvdXRQYXJhbXMuTUVNT1JZX1RZUEVfR1BVKSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChwYXJhbXMgPT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW1zID0gbVdpbmRvd0F0dHJpYnV0ZXM7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgbUdsV2FudGVkID0gdHJ1ZTsKLSAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaW5zZXRzUGVuZGluZyA9IGNvbXB1dGVzSW50ZXJuYWxJbnNldHMgJiYgKG1GaXJzdCB8fCB2aWV3VmlzaWJpbGl0eUNoYW5nZWQpOwogICAgICAgICAgICAgfQogCiAgICAgICAgICAgICBpZiAobVN1cmZhY2VIb2xkZXIgIT0gbnVsbCkgewogICAgICAgICAgICAgICAgIG1TdXJmYWNlSG9sZGVyLm1TdXJmYWNlTG9jay5sb2NrKCk7CiAgICAgICAgICAgICAgICAgbURyYXdpbmdBbGxvd2VkID0gdHJ1ZTsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIAotICAgICAgICAgICAgYm9vbGVhbiBpbml0aWFsaXplZCA9IGZhbHNlOworCisgICAgICAgICAgICBib29sZWFuIGh3SW50aWFsaXplZCA9IGZhbHNlOwogICAgICAgICAgICAgYm9vbGVhbiBjb250ZW50SW5zZXRzQ2hhbmdlZCA9IGZhbHNlOwogICAgICAgICAgICAgYm9vbGVhbiB2aXNpYmxlSW5zZXRzQ2hhbmdlZDsKICAgICAgICAgICAgIGJvb2xlYW4gaGFkU3VyZmFjZSA9IG1TdXJmYWNlLmlzVmFsaWQoKTsKKwogICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICBpbnQgZmwgPSAwOwogICAgICAgICAgICAgICAgIGlmIChwYXJhbXMgIT0gbnVsbCkgewpAQCAtOTkxLDkgKzg2OCw4IEBACiAgICAgICAgICAgICAgICAgICAgICAgICBmdWxsUmVkcmF3TmVlZGVkID0gdHJ1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgIG1QcmV2aW91c1RyYW5zcGFyZW50UmVnaW9uLnNldEVtcHR5KCk7CiAKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtR2xXYW50ZWQgJiYgIW1Vc2VHTCkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluaXRpYWxpemVHTCgpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluaXRpYWxpemVkID0gbUdsQ2FudmFzICE9IG51bGw7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAobUh3UmVuZGVyZXIgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGh3SW50aWFsaXplZCA9IG1Id1JlbmRlcmVyLmluaXRpYWxpemUobUhvbGRlcik7CiAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKCFtU3VyZmFjZS5pc1ZhbGlkKCkpIHsKQEAgLTEwNzAsMTAgKzk0Niw5IEBACiAgICAgICAgICAgICAgICAgICAgIG1TdXJmYWNlSG9sZGVyLm1TdXJmYWNlTG9jay51bmxvY2soKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAKLSAgICAgICAgICAgIGlmIChpbml0aWFsaXplZCkgewotICAgICAgICAgICAgICAgIG1HbENhbnZhcy5zZXRWaWV3cG9ydCgoaW50KSAobVdpZHRoICogYXBwU2NhbGUgKyAwLjVmKSwKLSAgICAgICAgICAgICAgICAgICAgICAgIChpbnQpIChtSGVpZ2h0ICogYXBwU2NhbGUgKyAwLjVmKSk7CisKKyAgICAgICAgICAgIGlmIChod0ludGlhbGl6ZWQgfHwgKHdpbmRvd1Nob3VsZFJlc2l6ZSAmJiBtSHdSZW5kZXJlciAhPSBudWxsKSkgeworICAgICAgICAgICAgICAgIG1Id1JlbmRlcmVyLnNldHVwKG1XaWR0aCwgbUhlaWdodCk7CiAgICAgICAgICAgICB9CiAKICAgICAgICAgICAgIGJvb2xlYW4gZm9jdXNDaGFuZ2VkRHVlVG9Ub3VjaE1vZGUgPSBlbnN1cmVUb3VjaE1vZGVMb2NhbGx5KApAQCAtMTEzMyw3ICsxMDA4LDcgQEAKICAgICAgICAgICAgICAgICBUQUcsICJMYXlpbmcgb3V0ICIgKyBob3N0ICsgIiB0byAoIiArCiAgICAgICAgICAgICAgICAgaG9zdC5tTWVhc3VyZWRXaWR0aCArICIsICIgKyBob3N0Lm1NZWFzdXJlZEhlaWdodCArICIpIik7CiAgICAgICAgICAgICBsb25nIHN0YXJ0VGltZSA9IDBMOwotICAgICAgICAgICAgaWYgKENvbmZpZy5ERUJVRyAmJiBWaWV3RGVidWcucHJvZmlsZUxheW91dCkgeworICAgICAgICAgICAgaWYgKFZpZXdEZWJ1Zy5ERUJVR19QUk9GSUxFX0xBWU9VVCkgewogICAgICAgICAgICAgICAgIHN0YXJ0VGltZSA9IFN5c3RlbUNsb2NrLmVsYXBzZWRSZWFsdGltZSgpOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgaG9zdC5sYXlvdXQoMCwgMCwgaG9zdC5tTWVhc3VyZWRXaWR0aCwgaG9zdC5tTWVhc3VyZWRIZWlnaHQpOwpAQCAtMTE0Niw3ICsxMDIxLDcgQEAKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgIGlmIChDb25maWcuREVCVUcgJiYgVmlld0RlYnVnLnByb2ZpbGVMYXlvdXQpIHsKKyAgICAgICAgICAgIGlmIChWaWV3RGVidWcuREVCVUdfUFJPRklMRV9MQVlPVVQpIHsKICAgICAgICAgICAgICAgICBFdmVudExvZy53cml0ZUV2ZW50KDYwMDAxLCBTeXN0ZW1DbG9jay5lbGFwc2VkUmVhbHRpbWUoKSAtIHN0YXJ0VGltZSk7CiAgICAgICAgICAgICB9CiAKQEAgLTEzNDYsNyArMTIyMSw4IEBACiAgICAgICAgIGlmICghc0ZpcnN0RHJhd0NvbXBsZXRlKSB7CiAgICAgICAgICAgICBzeW5jaHJvbml6ZWQgKHNGaXJzdERyYXdIYW5kbGVycykgewogICAgICAgICAgICAgICAgIHNGaXJzdERyYXdDb21wbGV0ZSA9IHRydWU7Ci0gICAgICAgICAgICAgICAgZm9yIChpbnQgaT0wOyBpPHNGaXJzdERyYXdIYW5kbGVycy5zaXplKCk7IGkrKykgeworICAgICAgICAgICAgICAgIGZpbmFsIGludCBjb3VudCA9IHNGaXJzdERyYXdIYW5kbGVycy5zaXplKCk7CisgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGk8IGNvdW50OyBpKyspIHsKICAgICAgICAgICAgICAgICAgICAgcG9zdChzRmlyc3REcmF3SGFuZGxlcnMuZ2V0KGkpKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CkBAIC0xMzgwLDUzICsxMjU2LDE2IEBACiAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgIH0KICAgICAgICAgCi0gICAgICAgIGlmIChtVXNlR0wpIHsKKyAgICAgICAgaWYgKG1Id1JlbmRlcmVyICE9IG51bGwgJiYgbUh3UmVuZGVyZXIuaXNFbmFibGVkKCkpIHsKICAgICAgICAgICAgIGlmICghZGlydHkuaXNFbXB0eSgpKSB7Ci0gICAgICAgICAgICAgICAgQ2FudmFzIGNhbnZhcyA9IG1HbENhbnZhczsKLSAgICAgICAgICAgICAgICBpZiAobUdMICE9IG51bGwgJiYgY2FudmFzICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgbUdMLmdsRGlzYWJsZShHTF9TQ0lTU09SX1RFU1QpOwotICAgICAgICAgICAgICAgICAgICBtR0wuZ2xDbGVhckNvbG9yKDAsIDAsIDAsIDApOwotICAgICAgICAgICAgICAgICAgICBtR0wuZ2xDbGVhcihHTF9DT0xPUl9CVUZGRVJfQklUKTsKLSAgICAgICAgICAgICAgICAgICAgbUdMLmdsRW5hYmxlKEdMX1NDSVNTT1JfVEVTVCk7Ci0KLSAgICAgICAgICAgICAgICAgICAgbUF0dGFjaEluZm8ubURyYXdpbmdUaW1lID0gU3lzdGVtQ2xvY2sudXB0aW1lTWlsbGlzKCk7Ci0gICAgICAgICAgICAgICAgICAgIG1BdHRhY2hJbmZvLm1JZ25vcmVEaXJ0eVN0YXRlID0gdHJ1ZTsKLSAgICAgICAgICAgICAgICAgICAgbVZpZXcubVByaXZhdGVGbGFncyB8PSBWaWV3LkRSQVdOOwotCi0gICAgICAgICAgICAgICAgICAgIGludCBzYXZlQ291bnQgPSBjYW52YXMuc2F2ZShDYW52YXMuTUFUUklYX1NBVkVfRkxBRyk7Ci0gICAgICAgICAgICAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDAsIC15b2ZmKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtVHJhbnNsYXRvciAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbVRyYW5zbGF0b3IudHJhbnNsYXRlQ2FudmFzKGNhbnZhcyk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICBjYW52YXMuc2V0U2NyZWVuRGVuc2l0eShzY2FsaW5nUmVxdWlyZWQKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPyBEaXNwbGF5TWV0cmljcy5ERU5TSVRZX0RFVklDRSA6IDApOwotICAgICAgICAgICAgICAgICAgICAgICAgbVZpZXcuZHJhdyhjYW52YXMpOwotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKENvbmZpZy5ERUJVRyAmJiBWaWV3RGVidWcuY29uc2lzdGVuY3lDaGVja0VuYWJsZWQpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBtVmlldy5kaXNwYXRjaENvbnNpc3RlbmN5Q2hlY2soVmlld0RlYnVnLkNPTlNJU1RFTkNZX0RSQVdJTkcpOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewotICAgICAgICAgICAgICAgICAgICAgICAgY2FudmFzLnJlc3RvcmVUb0NvdW50KHNhdmVDb3VudCk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgICAgICBtQXR0YWNoSW5mby5tSWdub3JlRGlydHlTdGF0ZSA9IGZhbHNlOwotCi0gICAgICAgICAgICAgICAgICAgIG1FZ2wuZWdsU3dhcEJ1ZmZlcnMobUVnbERpc3BsYXksIG1FZ2xTdXJmYWNlKTsKLSAgICAgICAgICAgICAgICAgICAgY2hlY2tFZ2xFcnJvcnMoKTsKLQotICAgICAgICAgICAgICAgICAgICBpZiAoU0hPV19GUFMgfHwgQ29uZmlnLkRFQlVHICYmIFZpZXdEZWJ1Zy5zaG93RnBzKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpbnQgbm93ID0gKGludClTeXN0ZW1DbG9jay5lbGFwc2VkUmVhbHRpbWUoKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzRHJhd1RpbWUgIT0gMCkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hdGl2ZVNob3dGUFMoY2FudmFzLCBub3cgLSBzRHJhd1RpbWUpOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgc0RyYXdUaW1lID0gbm93OwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIG1Id1JlbmRlcmVyLmRyYXcobVZpZXcsIG1BdHRhY2hJbmZvLCB5b2ZmKTsKICAgICAgICAgICAgIH0KKwogICAgICAgICAgICAgaWYgKHNjcm9sbGluZykgewogICAgICAgICAgICAgICAgIG1GdWxsUmVkcmF3TmVlZGVkID0gdHJ1ZTsKICAgICAgICAgICAgICAgICBzY2hlZHVsZVRyYXZlcnNhbHMoKTsKICAgICAgICAgICAgIH0KKwogICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICB9CiAKQEAgLTE0ODIsNyArMTMyMSw3IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAvL2NhbnZhcy5kcmF3QVJHQigyNTUsIDI1NSwgMCwgMCk7CiAgICAgICAgICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgICAgICAgICBpZiAoQ29uZmlnLkRFQlVHICYmIFZpZXdEZWJ1Zy5wcm9maWxlRHJhd2luZykgeworICAgICAgICAgICAgICAgICAgICBpZiAoVmlld0RlYnVnLkRFQlVHX1BST0ZJTEVfRFJBV0lORykgewogICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnRUaW1lID0gU3lzdGVtQ2xvY2suZWxhcHNlZFJlYWx0aW1lKCk7CiAgICAgICAgICAgICAgICAgICAgIH0KIApAQCAtMTUwOSw3ICsxMzQ4LDYgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIiwgbWV0cmljcz0iICsgY3h0LmdldFJlc291cmNlcygpLmdldERpc3BsYXlNZXRyaWNzKCkgKwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiLCBjb21wYXRpYmlsaXR5SW5mbz0iICsgY3h0LmdldFJlc291cmNlcygpLmdldENvbXBhdGliaWxpdHlJbmZvKCkpOwogICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIGludCBzYXZlQ291bnQgPSBjYW52YXMuc2F2ZShDYW52YXMuTUFUUklYX1NBVkVfRkxBRyk7CiAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDAsIC15b2ZmKTsKICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtVHJhbnNsYXRvciAhPSBudWxsKSB7CkBAIC0xNTIwLDE0ICsxMzU4LDEzIEBACiAgICAgICAgICAgICAgICAgICAgICAgICBtVmlldy5kcmF3KGNhbnZhcyk7CiAgICAgICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBtQXR0YWNoSW5mby5tSWdub3JlRGlydHlTdGF0ZSA9IGZhbHNlOwotICAgICAgICAgICAgICAgICAgICAgICAgY2FudmFzLnJlc3RvcmVUb0NvdW50KHNhdmVDb3VudCk7CiAgICAgICAgICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgICAgICAgICBpZiAoQ29uZmlnLkRFQlVHICYmIFZpZXdEZWJ1Zy5jb25zaXN0ZW5jeUNoZWNrRW5hYmxlZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgbVZpZXcuZGlzcGF0Y2hDb25zaXN0ZW5jeUNoZWNrKFZpZXdEZWJ1Zy5DT05TSVNURU5DWV9EUkFXSU5HKTsKICAgICAgICAgICAgICAgICAgICAgfQogCi0gICAgICAgICAgICAgICAgICAgIGlmIChTSE9XX0ZQUyB8fCBDb25maWcuREVCVUcgJiYgVmlld0RlYnVnLnNob3dGcHMpIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKFNIT1dfRlBTIHx8IFZpZXdEZWJ1Zy5ERUJVR19TSE9XX0ZQUykgewogICAgICAgICAgICAgICAgICAgICAgICAgaW50IG5vdyA9IChpbnQpU3lzdGVtQ2xvY2suZWxhcHNlZFJlYWx0aW1lKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoc0RyYXdUaW1lICE9IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYXRpdmVTaG93RlBTKGNhbnZhcywgbm93IC0gc0RyYXdUaW1lKTsKQEAgLTE1MzUsNyArMTM3Miw3IEBACiAgICAgICAgICAgICAgICAgICAgICAgICBzRHJhd1RpbWUgPSBub3c7CiAgICAgICAgICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgICAgICAgICBpZiAoQ29uZmlnLkRFQlVHICYmIFZpZXdEZWJ1Zy5wcm9maWxlRHJhd2luZykgeworICAgICAgICAgICAgICAgICAgICBpZiAoVmlld0RlYnVnLkRFQlVHX1BST0ZJTEVfRFJBV0lORykgewogICAgICAgICAgICAgICAgICAgICAgICAgRXZlbnRMb2cud3JpdGVFdmVudCg2MDAwMCwgU3lzdGVtQ2xvY2suZWxhcHNlZFJlYWx0aW1lKCkgLSBzdGFydFRpbWUpOwogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfQpAQCAtMTczOCw4ICsxNTc1LDYgQEAKICAgICB9CiAKICAgICB2b2lkIGRpc3BhdGNoRGV0YWNoZWRGcm9tV2luZG93KCkgewotICAgICAgICBpZiAoQ29uZmlnLkxPR1YpIExvZy52KFRBRywgIkRldGFjaGluZyBpbiAiICsgdGhpcyArICIgb2YgIiArIG1TdXJmYWNlKTsKLQogICAgICAgICBpZiAobVZpZXcgIT0gbnVsbCkgewogICAgICAgICAgICAgbVZpZXcuZGlzcGF0Y2hEZXRhY2hlZEZyb21XaW5kb3coKTsKICAgICAgICAgfQpAQCAtMTc0OCw5ICsxNTgzLDExIEBACiAgICAgICAgIG1BdHRhY2hJbmZvLm1Sb290VmlldyA9IG51bGw7CiAgICAgICAgIG1BdHRhY2hJbmZvLm1TdXJmYWNlID0gbnVsbDsKIAotICAgICAgICBpZiAobVVzZUdMKSB7Ci0gICAgICAgICAgICBkZXN0cm95R0woKTsKKyAgICAgICAgaWYgKG1Id1JlbmRlcmVyICE9IG51bGwpIHsKKyAgICAgICAgICAgIG1Id1JlbmRlcmVyLmRlc3Ryb3kodHJ1ZSk7CisgICAgICAgICAgICBtSHdSZW5kZXJlciA9IG51bGw7CiAgICAgICAgIH0KKwogICAgICAgICBtU3VyZmFjZS5yZWxlYXNlKCk7CiAKICAgICAgICAgaWYgKG1JbnB1dENoYW5uZWwgIT0gbnVsbCkgewpAQCAtMTkzMywxOCArMTc3MCw4IEBACiAgICAgICAgICAgICAgICAgICAgIGJvb2xlYW4gaW5Ub3VjaE1vZGUgPSBtc2cuYXJnMiAhPSAwOwogICAgICAgICAgICAgICAgICAgICBlbnN1cmVUb3VjaE1vZGVMb2NhbGx5KGluVG91Y2hNb2RlKTsKIAotICAgICAgICAgICAgICAgICAgICBpZiAobUdsV2FudGVkKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBjaGVja0VnbEVycm9ycygpOwotICAgICAgICAgICAgICAgICAgICAgICAgLy8gd2UgbG9zdCB0aGUgZ2wgY29udGV4dCwgc28gcmVjcmVhdGUgaXQuCi0gICAgICAgICAgICAgICAgICAgICAgICBpZiAobUdsV2FudGVkICYmICFtVXNlR0wpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbml0aWFsaXplR0woKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobUdsQ2FudmFzICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgYXBwU2NhbGUgPSBtQXR0YWNoSW5mby5tQXBwbGljYXRpb25TY2FsZTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUdsQ2FudmFzLnNldFZpZXdwb3J0KAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChpbnQpIChtV2lkdGggKiBhcHBTY2FsZSArIDAuNWYpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChpbnQpIChtSGVpZ2h0ICogYXBwU2NhbGUgKyAwLjVmKSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBpZiAobUh3UmVuZGVyZXIgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgbUh3UmVuZGVyZXIuaW5pdGlhbGl6ZUlmTmVlZGVkKG1XaWR0aCwgbUhlaWdodCwgbUF0dGFjaEluZm8sIG1Ib2xkZXIpOwogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfQogCkBAIC0xOTk0LDggKzE4MjEsNyBAQAogICAgICAgICAgICAgaWYgKChldmVudC5nZXRGbGFncygpJktleUV2ZW50LkZMQUdfRlJPTV9TWVNURU0pICE9IDApIHsKICAgICAgICAgICAgICAgICAvLyBUaGUgSU1FIGlzIHRyeWluZyB0byBzYXkgdGhpcyBldmVudCBpcyBmcm9tIHRoZQogICAgICAgICAgICAgICAgIC8vIHN5c3RlbSEgIEJhZCBiYWQgYmFkIQotICAgICAgICAgICAgICAgIGV2ZW50ID0gS2V5RXZlbnQuY2hhbmdlRmxhZ3MoZXZlbnQsCi0gICAgICAgICAgICAgICAgICAgICAgICBldmVudC5nZXRGbGFncygpJn5LZXlFdmVudC5GTEFHX0ZST01fU1lTVEVNKTsKKyAgICAgICAgICAgICAgICBldmVudCA9IEtleUV2ZW50LmNoYW5nZUZsYWdzKGV2ZW50LCBldmVudC5nZXRGbGFncygpICYgfktleUV2ZW50LkZMQUdfRlJPTV9TWVNURU0pOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgZGVsaXZlcktleUV2ZW50VG9WaWV3SGllcmFyY2h5KChLZXlFdmVudCltc2cub2JqLCBmYWxzZSk7CiAgICAgICAgIH0gYnJlYWs7CkBAIC0yNDgzLDggKzIzMDksNyBAQAogICAgIHByaXZhdGUgdm9pZCBkZWxpdmVyS2V5RXZlbnQoS2V5RXZlbnQgZXZlbnQsIGJvb2xlYW4gc2VuZERvbmUpIHsKICAgICAgICAgLy8gSWYgbVZpZXcgaXMgbnVsbCwgd2UganVzdCBjb25zdW1lIHRoZSBrZXkgZXZlbnQgYmVjYXVzZSBpdCBkb2Vzbid0CiAgICAgICAgIC8vIG1ha2Ugc2Vuc2UgdG8gZG8gYW55dGhpbmcgZWxzZSB3aXRoIGl0LgotICAgICAgICBib29sZWFuIGhhbmRsZWQgPSBtVmlldyAhPSBudWxsCi0gICAgICAgICAgICAgICAgPyBtVmlldy5kaXNwYXRjaEtleUV2ZW50UHJlSW1lKGV2ZW50KSA6IHRydWU7CisgICAgICAgIGJvb2xlYW4gaGFuZGxlZCA9IG1WaWV3ID09IG51bGwgfHwgbVZpZXcuZGlzcGF0Y2hLZXlFdmVudFByZUltZShldmVudCk7CiAgICAgICAgIGlmIChoYW5kbGVkKSB7CiAgICAgICAgICAgICBpZiAoc2VuZERvbmUpIHsKICAgICAgICAgICAgICAgICBmaW5pc2hLZXlFdmVudChldmVudCk7CkBAIC0yNTE2LDcgKzIzNDEsNiBAQAogICAgICAgICAgICAgZmluYWwgYm9vbGVhbiBzZW5kRG9uZSA9IHNlcSA+PSAwOwogICAgICAgICAgICAgaWYgKCFoYW5kbGVkKSB7CiAgICAgICAgICAgICAgICAgZGVsaXZlcktleUV2ZW50VG9WaWV3SGllcmFyY2h5KGV2ZW50LCBzZW5kRG9uZSk7Ci0gICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgfSBlbHNlIGlmIChzZW5kRG9uZSkgewogICAgICAgICAgICAgICAgIGZpbmlzaEtleUV2ZW50KGV2ZW50KTsKICAgICAgICAgICAgIH0gZWxzZSB7CkBAIC0yNzEzLDcgKzI1MzcsNyBAQAogCiAgICAgdm9pZCBkb0RpZSgpIHsKICAgICAgICAgY2hlY2tUaHJlYWQoKTsKLSAgICAgICAgaWYgKENvbmZpZy5MT0dWKSBMb2cudihUQUcsICJESUUgaW4gIiArIHRoaXMgKyAiIG9mICIgKyBtU3VyZmFjZSk7CisgICAgICAgIGlmIChMT0NBTF9MT0dWKSBMb2cudihUQUcsICJESUUgaW4gIiArIHRoaXMgKyAiIG9mICIgKyBtU3VyZmFjZSk7CiAgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgewogICAgICAgICAgICAgaWYgKG1BZGRlZCAmJiAhbUZpcnN0KSB7CiAgICAgICAgICAgICAgICAgaW50IHZpZXdWaXNpYmlsaXR5ID0gbVZpZXcuZ2V0VmlzaWJpbGl0eSgpOwpAQCAtMjc5OSwxMyArMjYyMywxMiBAQAogICAgICAgICAvL25vaW5zcGVjdGlvbiBDb25zdGFudENvbmRpdGlvbnMKICAgICAgICAgaWYgKGZhbHNlICYmIGV2ZW50LmdldEFjdGlvbigpID09IEtleUV2ZW50LkFDVElPTl9ET1dOKSB7CiAgICAgICAgICAgICBpZiAoZXZlbnQuZ2V0S2V5Q29kZSgpID09IEtleUV2ZW50LktFWUNPREVfQ0FNRVJBKSB7Ci0gICAgICAgICAgICAgICAgaWYgKENvbmZpZy5MT0dEKSBMb2cuZCgia2V5ZGlzcCIsCi0gICAgICAgICAgICAgICAgICAgICAgICAiPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Iik7Ci0gICAgICAgICAgICAgICAgaWYgKENvbmZpZy5MT0dEKSBMb2cuZCgia2V5ZGlzcCIsICJGb2N1c2VkIHZpZXcgSGllcmFyY2h5IGlzOiIpOworICAgICAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKCJrZXlkaXNwIiwgIj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PSIpOworICAgICAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKCJrZXlkaXNwIiwgIkZvY3VzZWQgdmlldyBIaWVyYXJjaHkgaXM6Iik7CisKICAgICAgICAgICAgICAgICBkZWJ1ZygpOwogCi0gICAgICAgICAgICAgICAgaWYgKENvbmZpZy5MT0dEKSBMb2cuZCgia2V5ZGlzcCIsCi0gICAgICAgICAgICAgICAgICAgICAgICAiPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Iik7CisgICAgICAgICAgICAgICAgaWYgKERCRykgTG9nLmQoImtleWRpc3AiLCAiPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Iik7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KIApAQCAtMjg4OCwxNiArMjcxMSwxNiBAQAogICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgfQogCisgICAgcHVibGljIEFjdGlvbk1vZGUgc3RhcnRBY3Rpb25Nb2RlRm9yQ2hpbGQoVmlldyBvcmlnaW5hbFZpZXcsIEFjdGlvbk1vZGUuQ2FsbGJhY2sgY2FsbGJhY2spIHsKKyAgICAgICAgcmV0dXJuIG51bGw7CisgICAgfQorCiAgICAgcHVibGljIHZvaWQgY3JlYXRlQ29udGV4dE1lbnUoQ29udGV4dE1lbnUgbWVudSkgewogICAgIH0KIAogICAgIHB1YmxpYyB2b2lkIGNoaWxkRHJhd2FibGVTdGF0ZUNoYW5nZWQoVmlldyBjaGlsZCkgewogICAgIH0KIAotICAgIHByb3RlY3RlZCBSZWN0IGdldFdpbmRvd0ZyYW1lKCkgewotICAgICAgICByZXR1cm4gbVdpbkZyYW1lOwotICAgIH0KLQogICAgIHZvaWQgY2hlY2tUaHJlYWQoKSB7CiAgICAgICAgIGlmIChtVGhyZWFkICE9IFRocmVhZC5jdXJyZW50VGhyZWFkKCkpIHsKICAgICAgICAgICAgIHRocm93IG5ldyBDYWxsZWRGcm9tV3JvbmdUaHJlYWRFeGNlcHRpb24oCkBAIC0yOTc2LDE2ICsyNzk5LDE1IEBACiAgICAgc3RhdGljIGNsYXNzIFcgZXh0ZW5kcyBJV2luZG93LlN0dWIgewogICAgICAgICBwcml2YXRlIGZpbmFsIFdlYWtSZWZlcmVuY2U8Vmlld1Jvb3Q+IG1WaWV3Um9vdDsKIAotICAgICAgICBwdWJsaWMgVyhWaWV3Um9vdCB2aWV3Um9vdCwgQ29udGV4dCBjb250ZXh0KSB7CisgICAgICAgIFcoVmlld1Jvb3Qgdmlld1Jvb3QpIHsKICAgICAgICAgICAgIG1WaWV3Um9vdCA9IG5ldyBXZWFrUmVmZXJlbmNlPFZpZXdSb290Pih2aWV3Um9vdCk7CiAgICAgICAgIH0KIAotICAgICAgICBwdWJsaWMgdm9pZCByZXNpemVkKGludCB3LCBpbnQgaCwgUmVjdCBjb3ZlcmVkSW5zZXRzLAotICAgICAgICAgICAgICAgIFJlY3QgdmlzaWJsZUluc2V0cywgYm9vbGVhbiByZXBvcnREcmF3LCBDb25maWd1cmF0aW9uIG5ld0NvbmZpZykgeworICAgICAgICBwdWJsaWMgdm9pZCByZXNpemVkKGludCB3LCBpbnQgaCwgUmVjdCBjb3ZlcmVkSW5zZXRzLCBSZWN0IHZpc2libGVJbnNldHMsCisgICAgICAgICAgICAgICAgYm9vbGVhbiByZXBvcnREcmF3LCBDb25maWd1cmF0aW9uIG5ld0NvbmZpZykgewogICAgICAgICAgICAgZmluYWwgVmlld1Jvb3Qgdmlld1Jvb3QgPSBtVmlld1Jvb3QuZ2V0KCk7CiAgICAgICAgICAgICBpZiAodmlld1Jvb3QgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIHZpZXdSb290LmRpc3BhdGNoUmVzaXplZCh3LCBoLCBjb3ZlcmVkSW5zZXRzLAotICAgICAgICAgICAgICAgICAgICAgICAgdmlzaWJsZUluc2V0cywgcmVwb3J0RHJhdywgbmV3Q29uZmlnKTsKKyAgICAgICAgICAgICAgICB2aWV3Um9vdC5kaXNwYXRjaFJlc2l6ZWQodywgaCwgY292ZXJlZEluc2V0cywgdmlzaWJsZUluc2V0cywgcmVwb3J0RHJhd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YXJlQWNjZWxlcmF0ZWQpIHsKICAgICAgICAgICAgIG1XaW5kb3dNYW5hZ2VyID0gd207CiAgICAgICAgICAgICBtRGVmYXVsdERpc3BsYXkgPSBtQ29udGV4dC5nZXRSZXNvdXJjZXMoKS5nZXREZWZhdWx0RGlzcGxheSgKICAgICAgICAgICAgICAgICAgICAgbVdpbmRvd01hbmFnZXIuZ2V0RGVmYXVsdERpc3BsYXkoKSk7CisgICAgICAgICAgICBtSGFyZHdhcmVBY2NlbGVyYXRlZCA9IGhhcmR3YXJlQWNjZWxlcmF0ZWQ7CiAgICAgICAgIH0KIAogICAgICAgICBwdWJsaWMgZmluYWwgdm9pZCBhZGRWaWV3KFZpZXcgdmlldywgVmlld0dyb3VwLkxheW91dFBhcmFtcyBwYXJhbXMpIHsKQEAgLTQyMSw2ICs0NzYsOSBAQAogICAgICAgICAgICAgaWYgKHdwLnBhY2thZ2VOYW1lID09IG51bGwpIHsKICAgICAgICAgICAgICAgICB3cC5wYWNrYWdlTmFtZSA9IG1Db250ZXh0LmdldFBhY2thZ2VOYW1lKCk7CiAgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAobUhhcmR3YXJlQWNjZWxlcmF0ZWQpIHsKKyAgICAgICAgICAgICAgICB3cC5mbGFncyB8PSBXaW5kb3dNYW5hZ2VyLkxheW91dFBhcmFtcy5GTEFHX0hBUkRXQVJFX0FDQ0VMRVJBVEVEOworICAgICAgICAgICAgfQogICAgICAgICAgICAgbVdpbmRvd01hbmFnZXIuYWRkVmlldyh2aWV3LCBwYXJhbXMpOwogICAgICAgICB9CiAKQEAgLTcxMyw2ICs3NzEsMTUgQEAKICAgICAgICAgcmV0dXJuIChtRmVhdHVyZXMmZmxhZykgIT0gMDsKICAgICB9CiAKKyAgICAvKioKKyAgICAgKiBAaGlkZSBVc2VkIGludGVybmFsbHkgdG8gaGVscCByZXNvbHZlIGNvbmZsaWN0aW5nIGZlYXR1cmVzLgorICAgICAqLworICAgIHByb3RlY3RlZCB2b2lkIHJlbW92ZUZlYXR1cmUoaW50IGZlYXR1cmVJZCkgeworICAgICAgICBmaW5hbCBpbnQgZmxhZyA9IDE8PGZlYXR1cmVJZDsKKyAgICAgICAgbUZlYXR1cmVzICY9IH5mbGFnOworICAgICAgICBtTG9jYWxGZWF0dXJlcyAmPSB+KG1Db250YWluZXIgIT0gbnVsbCA/IChmbGFnJn5tQ29udGFpbmVyLm1GZWF0dXJlcykgOiBmbGFnKTsKKyAgICB9CisKICAgICBwdWJsaWMgZmluYWwgdm9pZCBtYWtlQWN0aXZlKCkgewogICAgICAgICBpZiAobUNvbnRhaW5lciAhPSBudWxsKSB7CiAgICAgICAgICAgICBpZiAobUNvbnRhaW5lci5tQWN0aXZlQ2hpbGQgIT0gbnVsbCkgewpAQCAtODE3LDYgKzg4NCw4IEBACiAKICAgICBwdWJsaWMgYWJzdHJhY3Qgdm9pZCB0b2dnbGVQYW5lbChpbnQgZmVhdHVyZUlkLCBLZXlFdmVudCBldmVudCk7CiAKKyAgICBwdWJsaWMgYWJzdHJhY3Qgdm9pZCBpbnZhbGlkYXRlUGFuZWxNZW51KGludCBmZWF0dXJlSWQpOworICAgIAogICAgIHB1YmxpYyBhYnN0cmFjdCBib29sZWFuIHBlcmZvcm1QYW5lbFNob3J0Y3V0KGludCBmZWF0dXJlSWQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGtleUNvZGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgS2V5RXZlbnQgZXZlbnQsCkBAIC05OTYsNiArMTA2NSwxNiBAQAogICAgIHsKICAgICAgICAgcmV0dXJuIG1GZWF0dXJlczsKICAgICB9CisgICAgCisgICAgLyoqCisgICAgICogUXVlcnkgZm9yIHRoZSBhdmFpbGFiaWxpdHkgb2YgYSBjZXJ0YWluIGZlYXR1cmUuCisgICAgICogCisgICAgICogQHBhcmFtIGZlYXR1cmUgVGhlIGZlYXR1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ELAorICAgICAgICAgICAgICAgICAgICBlcXVhbHMgPSBGTEFHX0hBUkRXQVJFX0FDQ0VMRVJBVEVELCBuYW1lID0gIkZMQUdfSEFSRFdBUkVfQUNDRUxFUkFURUQiKQogICAgICAgICB9KQogICAgICAgICBwdWJsaWMgaW50IGZsYWdzOwogICAgICAgICAKQEAgLTYwMyw2ICs2MTAsMTIgQEAKICAgICAgICAgICogaXQgaXMgY3JlYXRlZC4KICAgICAgICAgICoge0BoaWRlfSAqLwogICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBGTEFHX1NZU1RFTV9FUlJPUiA9IDB4NDAwMDAwMDA7CisgICAgICAgIAorICAgICAgICAvKioKKyAgICAgICAgICogSW5kaWNhdGVzIHdoZXRoZXIgdGhpcyB3aW5kb3cgc2hvdWxkIGJlIGhhcmR3YXJlIGFjY2VsZXJhdGVkLgorICAgICAgICAgKiBSZXF1ZXN0aW5nIGhhcmR3YXJlIGFjY2VsZXJhdGlvbiBkb2VzIG5vdCBndWFyYW50ZWUgaXQgd2lsbCBoYXBwZW4uCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBGTEFHX0hBUkRXQVJFX0FDQ0VMRVJBVEVEID0gMHg4MDAwMDAwMDsgICAgICAgIAogCiAgICAgICAgIC8qKgogICAgICAgICAgKiBHaXZlbiBhIHBhcnRpY3VsYXIgc2V0IG9mIHdpbmRvdyBtYW5hZ2VyIGZsYWdzLCBkZXRlcm1pbmUgd2hldGhlcgpAQCAtMTA3NSw2ICsxMDg4LDcgQEAKICAgICAgICAgICAgICAgICBzY3JlZW5PcmllbnRhdGlvbiA9IG8uc2NyZWVuT3JpZW50YXRpb247CiAgICAgICAgICAgICAgICAgY2hhbmdlcyB8PSBTQ1JFRU5fT1JJRU5UQVRJT05fQ0hBTkdFRDsKICAgICAgICAgICAgIH0KKwogICAgICAgICAgICAgcmV0dXJuIGNoYW5nZXM7CiAgICAgICAgIH0KICAgICAKZGlm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GJ5IHRoZSBzdWJ0eXBlCisgICAgICAgICAqIEBwYXJhbSBleHRyYVZhbHVlIFRoZSBleHRyYSB2YWx1ZSBvZiB0aGUgc3VidHlwZQorICAgICAgICAgKi8KKyAgICAgICAgSW5wdXRNZXRob2RTdWJ0eXBlKFN0cmluZyBuYW1lLCBpbnQgaWNvbklkLCBTdHJpbmcgbG9jYWxlLCBTdHJpbmcgbW9kZSwKKyAgICAgICAgICAgICAgICBTdHJpbmcgZXh0cmFWYWx1ZSkgeworICAgICAgICAgICAgbVN1YnR5cGVOYW1lID0gbmFtZTsKKyAgICAgICAgICAgIG1TdWJ0eXBlSWNvbklkID0gaWNvbklkOworICAgICAgICAgICAgbVN1YnR5cGVMb2NhbGUgPSBsb2NhbGU7CisgICAgICAgICAgICBtU3VidHlwZU1vZGUgPSBtb2RlOworICAgICAgICAgICAgbVN1YnR5cGVFeHRyYVZhbHVlID0gZXh0cmFWYWx1ZTsKKyAgICAgICAgfQorCisgICAgICAgIElucHV0TWV0aG9kU3VidHlwZShQYXJjZWwgc291cmNlKSB7CisgICAgICAgICAgICBtU3VidHlwZU5hbWUgPSBzb3VyY2UucmVhZFN0cmluZygpOworICAgICAgICAgICAgbVN1YnR5cGVJY29uSWQgPSBzb3VyY2UucmVhZEludCgpOworICAgICAgICAgICAgbVN1YnR5cGVMb2NhbGUgPSBzb3VyY2UucmVhZFN0cmluZygpOworICAgICAgICAgICAgbVN1YnR5cGVNb2RlID0gc291cmNlLnJlYWRTdHJpbmcoKTsKKyAgICAgICAgICAgIG1TdWJ0eXBlRXh0cmFWYWx1ZSA9IHNvdXJjZS5yZWFkU3RyaW5nKCk7CisgICAgICAgIH0KKworICAgICAgICAvKioKKyAgICAgICAgICogQHJldHVybiB0aGUgbmFtZSBvZiB0aGUgc3VidHlwZQorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIFN0cmluZyBnZXROYW1lKCkgeworICAgICAgICAgICAgcmV0dXJuIG1TdWJ0eXBlTmFtZTsKKyAgICAgICAgfQorCisgICAgICAgIC8qKgorICAgICAgICAgKiBAcmV0dXJuIHRoZSBpY29uIG9mIHRoZSBzdWJ0eXBlCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgaW50IGdldEljb25JZCgpIHsKKyAgICAgICAgICAgIHJldHVybiBtU3VidHlwZUljb25JZDsKKyAgICAgICAgfQorCisgICAgICAgIC8qKgorICAgICAgICAgKiBAcmV0dXJuIHRoZSBsb2NhbGUgb2YgdGhlIHN1YnR5cGUKKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBTdHJpbmcgZ2V0TG9jYWxlKCkgeworICAgICAgICAgICAgcmV0dXJuIG1TdWJ0eXBlTG9jYWxlOworICAgICAgICB9CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIEByZXR1cm4gdGhlIG1vZGUgb2YgdGhlIHN1YnR5cGUKKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBTdHJpbmcgZ2V0TW9kZSgpIHsKKyAgICAgICAgICAgIHJldHVybiBtU3VidHlwZU1vZGU7CisgICAgICAgIH0KKworICAgICAgICAvKioKKyAgICAgICAgICogQHJldHVybiB0aGUgZXh0cmEgdmFsdWUgb2YgdGhlIHN1YnR5cGUKKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBTdHJpbmcgZ2V0RXh0cmFWYWx1ZSgpIHsKKyAgICAgICAgICAgIHJldHVybiBtU3VidHlwZUV4dHJhVmFsdWU7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgaW50IGRlc2NyaWJlQ29udGVudHMoKSB7CisgICAgICAgICAgICByZXR1cm4gMDsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyB2b2lkIHdyaXRlVG9QYXJjZWwoUGFyY2VsIGRlc3QsIGludCBwYXJjZWxhYmxlRmxhZ3MpIHsKKyAgICAgICAgICAgIGRlc3Qud3JpdGVTdHJpbmcobVN1YnR5cGVOYW1lKTsKKyAgICAgICAgICAgIGRlc3Qud3JpdGVJbnQobVN1YnR5cGVJY29uSWQpOworICAgICAgICAgICAgZGVzdC53cml0ZVN0cmluZyhtU3VidHlwZUxvY2FsZSk7CisgICAgICAgICAgICBkZXN0LndyaXRlU3RyaW5nKG1TdWJ0eXBlTW9kZSk7CisgICAgICAgICAgICBkZXN0LndyaXRlU3RyaW5nKG1TdWJ0eXBlRXh0cmFWYWx1ZSk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFBhcmNlbGFibGUuQ3JlYXRvcjxJbnB1dE1ldGhvZFN1YnR5cGU+IENSRUFUT1IKKyAgICAgICAgICAgICAgICA9IG5ldyBQYXJjZWxhYmxlLkNyZWF0b3I8SW5wdXRNZXRob2RTdWJ0eXBlPigpIHsKKyAgICAgICAgICAgIHB1YmxpYyBJbnB1dE1ldGhvZFN1YnR5cGUgY3JlYXRlRnJvbVBhcmNlbChQYXJjZWwgc291cmNlKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBJbnB1dE1ldGhvZFN1YnR5cGUoc291cmNlKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcHVibGljIElucHV0TWV0aG9kU3VidHlwZVtdIG5ld0FycmF5KGludCBzaXplKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBJbnB1dE1ldGhvZFN1YnR5cGVbc2l6ZV07CisgICAgICAgICAgICB9CisgICAgICAgIH07CisgICAgfQorCisgICAgLyoqCisgICAgICogVGhlIGFycmF5IG9mIHRoZSBzdWJ0eXBlcy4KKyAgICAgKi8KKyAgICBwcml2YXRlIGZpbmFsIEFycmF5TGlzdDxJbnB1dE1ldGhvZFN1YnR5cGU+IG1TdWJ0eXBlcyA9IG5ldyBBcnJheUxpc3Q8SW5wdXRNZXRob2RTdWJ0eXBlPigpOworCiAgICAgLyoqCiAgICAgICogQ29uc3RydWN0b3IuCiAgICAgICogCkBAIC04MSwxMSArMTgzLDExIEBACiAgICAgICAgIG1TZXJ2aWNlID0gc2VydmljZTsKICAgIC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NVTUVOVCkgeworICAgICAgICAgICAgICAgIG5vZGVOYW1lID0gcGFyc2VyLmdldE5hbWUoKTsKKyAgICAgICAgICAgICAgICBpZiAoISJzdWJ0eXBlIi5lcXVhbHMobm9kZU5hbWUpKSB7CisgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBYbWxQdWxsUGFyc2VyRXhjZXB0aW9uKAorICAgICAgICAgICAgICAgICAgICAgICAgIk1ldGEtZGF0YSBpbiBpbnB1dC1tZXRob2QgZG9lcyBub3Qgc3RhcnQgd2l0aCBzdWJ0eXBlIHRhZyIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBmaW5hbCBUeXBlZEFycmF5IGEgPSByZXMub2J0YWluQXR0cmlidXRlcygKKyAgICAgICAgICAgICAgICAgICAgICAgIGF0dHJzLCBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5JbnB1dE1ldGhvZF9TdWJ0eXBlKTsKKyAgICAgICAgICAgICAgICBJbnB1dE1ldGhvZFN1YnR5cGUgc3VidHlwZSA9IG5ldyBJbnB1dE1ldGhvZFN1YnR5cGUoCisgICAgICAgICAgICAgICAgICAgICAgICBhLmdldFN0cmluZyhjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5JbnB1dE1ldGhvZF9TdWJ0eXBlX2xhYmVsKSwKKyAgICAgICAgICAgICAgICAgICAgICAgIGEuZ2V0UmVzb3VyY2VJZCgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuSW5wdXRNZXRob2RfU3VidHlwZV9pY29uLCAwKSwKKyAgICAgICAgICAgICAgICAgICAgICAgIGEuZ2V0U3RyaW5nKGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5JbnB1dE1ldGhvZF9TdWJ0eXBlX2ltZVN1YnR5cGVMb2NhbGUpLAorICAgICAgICAgICAgICAgICAgICAgICAgYS5nZXRTdHJpbmcoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLklucHV0TWV0aG9kX1N1YnR5cGVfaW1lU3VidHlwZU1vZGUpLAorICAgICAgICAgICAgICAgICAgICAgICAgYS5nZXRTdHJpbmcoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLklucHV0TWV0aG9kX1N1YnR5cGVfaW1lU3VidHlwZUV4dHJhVmFsdWUpKTsKKyAgICAgICAgICAgICAgICBtU3VidHlwZXMuYWRkKHN1YnR5cGUpOworICAgICAgICAgICAgfQogICAgICAgICB9IGNhdGNoIChOYW1lTm90Rm91bmRFeGNlcHRpb24gZSkgewogICAgICAgICAgICAgdGhyb3cgbmV3IFhtbFB1bGxQYXJzZXJFeGNlcHRpb24oCiAgICAgICAgICAgICAgICAgICAgICJVbmFibGUgdG8gY3JlYXRlIGNvbnRleHQgZm9yOiAiICsgc2kucGFja2FnZU5hbWUpOwogICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgaWYgKHBhcnNlciAhPSBudWxsKSBwYXJzZXIuY2xvc2UoKTsKICAgICAgICAgfQotICAgICAgICAKICAgICAgICAgbVNldHRpbmdzQWN0aXZpdHlOYW1lID0gc2V0dGluZ3NBY3Rpdml0eUNvbXBvbmVudDsKICAgICAgICAgbUlzRGVmYXVsdFJlc0lkID0gaXNEZWZhdWx0UmVzSWQ7CiAgICAgfQpAQCAtMTMyLDggKzI1Nyw5IEBACiAgICAgICAgIG1TZXR0aW5nc0FjdGl2aXR5TmFtZSA9IHNvdXJjZS5yZWFkU3RyaW5nKCk7CiAgICAgICAgIG1Jc0RlZmF1bHRSZXNJZCA9IHNvdXJjZS5yZWFkSW50KCk7CiAgICAgICAgIG1TZXJ2aWNlID0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Z3NBY3Rpdml0eU5hbWU7CiAgICAgfQotICAgIAorCisgICAgLyoqCisgICAgICogUmV0dXJuIHRoZSBzdWJ0eXBlcyBvZiBJbnB1dCBNZXRob2QuCisgICAgICovCisgICAgcHVibGljIEFycmF5TGlzdDxJbnB1dE1ldGhvZFN1YnR5cGU+IGdldFN1YnR5cGVzKCkgeworICAgICAgICByZXR1cm4gbVN1YnR5cGVzOworICAgIH0KKwogICAgIC8qKgogICAgICAqIFJldHVybiB0aGUgcmVzb3VyY2UgaWRlbnRpZmllciBvZiBhIHJlc291cmNlIGluc2lkZSBvZiB0aGlzIGlucHV0CiAgICAgICogbWV0aG9kJ3MgLmFwayB0aGF0IGRldGVybWluZXMgd2hldGhlciBpdCBzaG91bGQgYmUgY29uc2lkZXJlZCBhCkBAIC0yMzksNyArMzcyLDcgQEAKICAgICBwdWJsaWMgaW50IGdldElzRGVmYXVsdFJlc291cmNlSWQoKSB7CiAgICAgICAgIHJldHVybiBtSXNEZWZhdWx0UmVzSWQ7CiAgICAgfQotICAgIAorCiAgICAgcHVibGljIHZvaWQgZHVtcChQcmludGVyIHB3LCBTdHJpbmcgcHJlZml4KSB7CiAgICAgICAgIHB3LnByaW50bG4ocHJlZml4ICsgIm1JZD0iICsgbUlkCiAgICAgICAgICAgICAgICAgKyAiIG1TZXR0aW5nc0FjdGl2aXR5TmFtZT0iICsgbVNldHRpbmdzQWN0aXZpdHlOYW1lKTsKQEAgLTI4NSwxMiArNDE4LDE0IEBACiAgICAgICAgIGRlc3Qud3JpdGVTdHJpbmcobVNldHRpbmdzQWN0aXZpdHlOYW1lKTsKICAgICAgICAgZGVzdC53cml0ZUludChtSXNEZWZhdWx0UmVzSWQpOwogICAgICAgICBtU2VydmljZS53cml0ZVRvUGFyY2VsKGRlc3QsIGZsYWdzKTsKKyAgICAgICAgZGVzdC53cml0ZVR5cGVkTGlzdChtU3VidHlwZXMpOwogICAgIH0KIAogICAgIC8qKgogICAgICAqIFVzZWQgdG8gbWFrZSB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mVhbSBpbnB1dFN0cmVhbUZvckFuZHJvaWRSZXNvdXJjZShTdHJpbmcgdXJsLCBpbnQgdHlwZSkgeworICAgICAgICBmaW5hbCBpbnQgUkVTT1VSQ0UgPSAxOworICAgICAgICBmaW5hbCBpbnQgQVNTRVQgPSAyOworICAgICAgICBmaW5hbCBpbnQgQ09OVEVOVCA9IDM7CisKKyAgICAgICAgaWYgKHR5cGUgPT0gUkVTT1VSQ0UpIHsKKyAgICAgICAgICAgIC8vIGZpbGU6Ly8vYW5kcm9pZF9yZXMKKyAgICAgICAgICAgIGlmICh1cmwgPT0gbnVsbCB8fCB1cmwubGVuZ3RoKCkgPT0gMCkgeworICAgICAgICAgICAgICAgIExvZy5lKExPR1RBRywgInVybCBoYXMgbGVuZ3RoIDAgIiArIHVybCk7CisgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpbnQgc2xhc2ggPSB1cmwuaW5kZXhPZignLycpOworICAgICAgICAgICAgaW50IGRvdCA9IHVybC5pbmRleE9mKCcuJywgc2xhc2gpOworICAgICAgICAgICAgaWYgKHNsYXNoID09IC0xIHx8IGRvdCA9PSAtMSkgeworICAgICAgICAgICAgICAgIExvZy5lKExPR1RBRywgIkluY29ycmVjdCByZXMgcGF0aDogIiArIHVybCk7CisgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBTdHJpbmcgc3ViQ2xhc3NOYW1lID0gdXJsLnN1YnN0cmluZygwLCBzbGFzaCk7CisgICAgICAgICAgICBTdHJpbmcgZmllbGROYW1lID0gdXJsLnN1YnN0cmluZyhzbGFzaCArIDEsIGRvdCk7CisgICAgICAgICAgICBTdHJpbmcgZXJyb3JNc2cgPSBudWxsOworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICBmaW5hbCBDbGFzczw/PiBkID0gbUNvbnRleHQuZ2V0QXBwbGljYXRpb25Db250ZXh0KCkKKyAgICAgICAgICAgICAgICAgICAgICAgIC5nZXRDbGFzc0xvYWRlcigpLmxvYWRDbGFzcygKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUNvbnRleHQuZ2V0UGFja2FnZU5hbWUoKSArICIuUiQiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyBzdWJDbGFzc05hbWUpOworICAgICAgICAgICAgICAgIGZpbmFsIGphdmEubGFuZy5yZWZsZWN0LkZpZWxkIGZpZWxkID0gZC5nZXRGaWVsZChmaWVsZE5hbWUpOworICAgICAgICAgICAgICAgIGZpbmFsIGludCBpZCA9IGZpZWxkLmdldEludChudWxsKTsKKyAgICAgICAgICAgICAgICBUeXBlZFZhbHVlIHZhbHVlID0gbmV3IFR5cGVkVmFsdWUoKTsKKyAgICAgICAgICAgICAgICBtQ29udGV4dC5nZXRSZXNvdXJjZXMoKS5nZXRWYWx1ZShpZCwgdmFsdWUsIHRydWUpOworICAgICAgICAgICAgICAgIGlmICh2YWx1ZS50eXBlID09IFR5cGVkVmFsdWUuVFlQRV9TVFJJTkcpIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG1Db250ZXh0LmdldEFzc2V0cygpLm9wZW5Ob25Bc3NldCgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZS5hc3NldENvb2tpZSwgdmFsdWUuc3RyaW5nLnRvU3RyaW5nKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgQXNzZXRNYW5hZ2VyLkFDQ0VTU19TVFJFQU1JTkcpOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIC8vIE9sZCBzdGFjayBvbmx5IHN1cHBvcnRzIFRZUEVfU1RSSU5HIGZvciByZXMgZmlsZXMKKyAgICAgICAgICAgICAgICAgICAgTG9nLmUoTE9HVEFHLCAibm90IG9mIHR5cGUgc3RyaW5nOiAiICsgdXJsKTsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSBjYXRjaCAoRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICBMb2cuZShMT0dUQUcsICJFeGNlcHRpb246ICIgKyB1cmwpOworICAgICAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICAgICAgfQorCisgICAgICAgIH0gZWxzZSBpZiAodHlwZSA9PSBBU1NFVCkgeworICAgICAgICAgICAgLy8gZmlsZTovLy9hbmRyb2lkX2Fzc2V0CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIEFzc2V0TWFuYWdlciBhc3NldHMgPSBtQ29udGV4dC5nZXRBc3NldHMoKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gYXNzZXRzLm9wZW4odXJsLCBBc3NldE1hbmFnZXIuQUNDRVNTX1NUUkVBTUlORyk7CisgICAgICAgICAgICB9IGNhdGNoIChJT0V4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSBpZiAodHlwZSA9PSBDT05URU5UKSB7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIFVyaSB1cmkgPSBVcmkucGFyc2UodXJsKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gbUNvbnRleHQuZ2V0Q29udGVudFJlc29sdmVyKCkub3BlbklucHV0U3RyZWFtKHVyaSk7CisgICAgICAgICAgICB9IGNhdGNoIChFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgIExvZy5lKExPR1RBRywgIkV4Y2VwdGlvbjogIiArIHVybCk7CisgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgogICAgICAqIFN0YXJ0IGxvYWRpbmcgYSByZXNvdXJjZS4K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zIGZvciBoYW5kbGluZyBXZWJDb3JlIC0+IFVJIHRocmVhZCBtZXNzYWdpbmcuIEFsbApAQCAtMTEyLDYgKzExNCw3IEBACiAgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IEFERF9ISVNUT1JZX0lURU0gICAgICAgICAgICAgICAgICAgID0gMTM1OwogICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBISVNUT1JZX0lOREVYX0NIQU5HRUQgICAgICAgICAgICAgICA9IDEzNjsKICAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgQVVUSF9DUkVERU5USUFMUyAgICAgICAgICAgICAgICAgICAgPSAxMzc7CisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IFNFVF9JTlNUQUxMQUJMRV9XRUJBUFAgICAgICAgICAgICAgID0gMTM4OwogCiAgICAgLy8gTWVzc2FnZSB0cmlnZ2VyZWQgYnkgdGhlIGNsaWVudCB0byByZXN1bWUgZXhlY3V0aW9uCiAgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IE5PVElGWSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgID0gMjAwOwpAQCAtNTAwLDE4ICs1MDMsMzIgQEAKICAgICAgICAgICAgICAgICAgICAgU3RyaW5nIHVybCA9IG1zZy5nZXREYXRhKCkuZ2V0U3RyaW5nKCJ1cmwiKTsKICAgICAgICAgICAgICAgICAgICAgaWYgKCFtV2ViQ2hyb21lQ2xpZW50Lm9uSnNBbGVydChtV2ViVmlldywgdXJsLCBtZXNzYWdlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcykpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIG9ubHkgZGlzcGxheSB0aGUgYWxlcnQgZGlhbG9nIGlmIHRoZSBtQ29udGV4dCBpcworICAgICAgICAgICAgICAgICAgICAgICAgLy8gQWN0aXZpdHkgYW5kIGl0cyB3aW5kb3cgaGFzIHRoZSBmb2N1cy4KKyAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKG1Db250ZXh0IGluc3RhbmNlb2YgQWN0aXZpdHkpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHx8ICEoKEFjdGl2aXR5KSBtQ29udGV4dCkuaGFzV2luZG93Rm9jdXMoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcy5jYW5jZWwoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXMuc2V0UmVhZHkoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBBbGVydERpYWxvZy5CdWlsZGVyKG1Db250ZXh0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAuc2V0VGl0bGUoZ2V0SnNEaWFsb2dUaXRsZSh1cmwpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAuc2V0TWVzc2FnZShtZXNzYWdlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAuc2V0UG9zaXRpdmVCdXR0b24oUi5zdHJpbmcub2ssCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3IEFsZXJ0RGlhbG9nLk9uQ2xpY2tMaXN0ZW5lcigpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXcgRGlhbG9nSW50ZXJmYWNlLk9uQ2xpY2tMaXN0ZW5lcigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHVibGljIHZvaWQgb25DbGljaygKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEaWFsb2dJbnRlcmZhY2UgZGlhbG9nLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCB3aGljaCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzLmNvbmZpcm0oKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5zZXRDYW5jZWxhYmxlKGZhbHNlKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAuc2V0T25DYW5jZWxMaXN0ZW5lcigKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXcgRGlhbG9nSW50ZXJmYWNlLk9uQ2FuY2VsTGlzdGVuZXIoKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIG9uQ2FuY2VsKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERpYWxvZ0ludGVyZmFjZSBkaWFsb2cpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcy5jYW5jZWwoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5zaG93KCk7CiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgcmVzLnNldFJlYWR5KCk7CkBAIC01MjUsNiArNTQyLDE0IEBACiAgICAgICAgICAgICAgICAgICAgIFN0cmluZyB1cmwgPSBtc2cuZ2V0RGF0YSgpLmdldFN0cmluZygidXJsIik7CiAgICAgICAgICAgICAgICAgICAgIGlmICghbVdlYkNocm9tZUNsaWVudC5vbkpzQ29uZmlybShtV2ViVmlldywgdXJsLCBtZXNzYWdlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcykpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIG9ubHkgZGlzcGxheSB0aGUgYWxlcnQgZGlhbG9nIGlmIHRoZSBtQ29udGV4dCBpcworICAgICAgICAgICAgICAgICAgICAgICAgLy8gQWN0aXZpdHkgYW5kIGl0cyB3aW5kb3cgaGFzIHRoZSBmb2N1cy4KKyAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKG1Db250ZXh0IGluc3RhbmNlb2YgQWN0aXZpdHkpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHx8ICEoKEFjdGl2aXR5KSBtQ29udGV4dCkuaGFzV2luZG93Rm9jdXMoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcy5jYW5jZWwoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXMuc2V0UmVhZHkoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBBbGVydERpYWxvZy5CdWlsZGVyKG1Db250ZXh0KQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAuc2V0VGl0bGUoZ2V0SnNEaWFsb2dUaXRsZSh1cmwpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAuc2V0TWVzc2FnZShtZXNzYWdlKQpAQCAtNTY1LDYgKzU5MCwxNCBAQAogICAgICAgICAgICAgICAgICAgICBTdHJpbmcgdXJsID0gbXNnLmdldERhdGEoKS5nZXRTdHJpbmcoInVybCIpOwogICAgICAgICAgICAgICAgICAgICBpZiAoIW1XZWJDaHJvbWVDbGllbnQub25Kc1Byb21wdChtV2ViVmlldywgdXJsLCBtZXNzYWdlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsLCByZXMpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAvLyBvbmx5IGRpc3BsYXkgdGhlIGFsZXJ0IGRpYWxvZyBpZiB0aGUgbUNvbnRleHQgaXMKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIEFjdGl2aXR5IGFuZCBpdHMgd2luZG93IGhhcyB0aGUgZm9jdXMuCisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIShtQ29udGV4dCBpbnN0YW5jZW9mIEFjdGl2aXR5KQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8fCAhKChBY3Rpdml0eSkgbUNvbnRleHQpLmhhc1dpbmRvd0ZvY3VzKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXMuY2FuY2VsKCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzLnNldFJlYWR5KCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICBmaW5hbCBMYXlvdXRJbmZsYXRlciBmYWN0b3J5ID0gTGF5b3V0SW5mbGF0ZXIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLmZyb20obUNvbnRleHQpOwogICAgICAgICAgICAgICAgICAgICAgICAgZmluYWwgVmlldyB2aWV3ID0gZmFjdG9yeS5pbmZsYXRlKFIubGF5b3V0LmpzX3Byb21wdCwKQEAgLTYxNiw2ICs2NDksMTQgQEAKICAgICAgICAgICAgICAgICAgICAgU3RyaW5nIHVybCA9IG1zZy5nZXREYXRhKCkuZ2V0U3RyaW5nKCJ1cmwiKTsKICAgICAgICAgICAgICAgICAgICAgaWYgKCFtV2ViQ2hyb21lQ2xpZW50Lm9uSnNCZWZvcmVVbmxvYWQobVdlYlZpZXcsIHVybCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLCByZXMpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAvLyBvbmx5IGRpc3BsYXkgdGhlIGFsZXJ0IGRpYWxvZyBpZiB0aGUgbUNvbnRleHQgaXMKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIEFjdGl2aXR5IGFuZCBpdHMgd2luZG93IGhhcyB0aGUgZm9jdXMuCisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIShtQ29udGV4dCBpbnN0YW5jZW9mIEFjdGl2aXR5KQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8fCAhKChBY3Rpdml0eSkgbUNvbnRleHQpLmhhc1dpbmRvd0ZvY3VzKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXMuY2FuY2VsKCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzLnNldFJlYWR5KCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICBmaW5hbCBTdHJpbmcgbSA9IG1Db250ZXh0LmdldFN0cmluZygKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUi5zdHJpbmcuanNfZGlhbG9nX2JlZm9yZV91bmxvYWQsIG1lc3NhZ2UpOwogICAgICAgICAgICAgICAgICAgICAgICAgbmV3IEFsZXJ0RGlhbG9nLkJ1aWxkZXIobUNvbnRleHQpCkBAIC03MjUsNyArNzY2LDggQEAKIAogICAgICAgICAgICAgY2FzZSBPUEVOX0ZJTEVfQ0hPT1NFUjoKICAgICAgICAgICAgICAgICBpZiAobVdlYkNocm9tZUNsaWVudCAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1XZWJDaHJvbWVDbGllbnQub3BlbkZpbGVDaG9vc2VyKChVcGxvYWRGaWxlKSBtc2cub2JqKTsKKyAgICAgICAgICAgICAgICAgICAgVXBsb2FkRmlsZU1lc3NhZ2VEYXRhIGRhdGEgPSAoVXBsb2FkRmlsZU1lc3NhZ2VEYXRhKW1zZy5vYmo7CisgICAgICAgICAgICAgICAgICAgIG1XZWJDaHJvbWVDbGllbnQub3BlbkZpbGVDaG9vc2VyKGRhdGEuZ2V0VXBsb2FkRmlsZSgpLCBkYXRhLmdldEFjY2VwdFR5cGUoKSk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGJyZWFrOwogCkBAIC03NTAsNiArNzkyLDkgQEAKICAgICAgICAgICAgICAgICBtV2ViVmlldy5zZXRIdHRwQXV0aFVzZXJuYW1lUGFzc3dvcmQoCiAgICAgICAgICAgICAgICAgICAgICAgICBob3N0LCByZWFsbSwgdXNlcm5hbWUsIHBhc3N3b3JkKTsKICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgU0VUX0lOU1RBTExBQkxFX1dFQkFQUDoKKyAgICAgICAgICAgICAgICBtV2ViQ2hyb21lQ2xpZW50LnNldEluc3RhbGxhYmxlV2ViQXBwKCk7CisgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgIH0KICAgICB9CiAKQEAgLTEwODcsMTAgKzExMzIsMTUgQEAKICAgICBwdWJsaWMgdm9pZCBvblByb2dyZXNzQ2hhbmdlZChpbnQgbmV3UHJvZ3Jlc3MpIHsKICAgICAgICAgLy8gU3luY2hyb25pemUgc28gdGhhdCBtTGF0ZXN0UHJvZ3Jlc3MgaXMgdXAtdG8tZGF0ZS4KICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7Ci0gICAgICAgICAgICBpZiAobVdlYkNocm9tZUNsaWVudCA9PSBudWxsIHx8IG1MYXRlc3RQcm9ncmVzcyA9PSBuZXdQcm9ncmVzcykgeworICAgICAgICAgICAgLy8gdXBkYXRlIG1MYXRlc3RQcm9ncmVzcyBldmVuIG1XZWJDaHJvbWVDbGllbnQgaXMgbnVsbCBhcworICAgICAgICAgICAgLy8gV2ViVmlldy5nZXRQcm9ncmVzcygpIG5lZWRzIGl0CisgICAgICAgICAgICBpZiAobUxhdGVzdFByb2dyZXNzID09IG5ld1Byb2dyZXNzKSB7CiAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgbUxhdGVzdFByb2dyZXNzID0gbmV3UHJvZ3Jlc3M7CisgICAgICAgICAgICBpZiAobVdlYkNocm9tZUNsaWVudCA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQogICAgICAgICAgICAgaWYgKCFtUHJvZ3Jlc3NVcGRhdGVQZW5kaW5nKSB7CiAgICAgICAgICAgICAgICAgc2VuZEVtcHR5TWVzc2FnZShQUk9HUkVTUyk7CiAgICAgICAgICAgICAgICAgbVByb2dyZXNzVXBkYXRlUGVuZGluZyA9IHRydWU7CkBAIC0xMTcyLDkgKzEyMjIsNyBAQAogICAgICAgICAvLyBmb3IgbnVsbC4KICAgICAgICAgV2ViSGlzdG9yeUl0ZW0gaSA9IG1CYWNrRm9yd2FyZExpc3QuZ2V0Q3VycmVudEl0ZW0oKTsKICAgICAgICAgaWYgKGkgIT0gbnVsbCkgewotICAgICAgICAgICAgaWYgKHByZWNvbXBvc2VkIHx8IGkuZ2V0VG91Y2hJY29uVXJsKCkgPT0gbnVsbCkgewotICAgICAgICAgICAgICAgIGkuc2V0VG91Y2hJY29uVXJsKHVybCk7Ci0gICAgICAgICAgICB9CisgICAgICAgICAgICBpLnNldFRvdWNoSWNvblVybCh1cmwsIHByZWNvbXBvc2VkKTsKICAgICAgICAgfQogICAgICAgICAvLyBEbyBhbiB1bnN5bmNocm9uaXplZCBxdWljayBjaGVjayB0byBhdm9pZCBwb3N0aW5nIGlmIG5vIGNhbGxiYWNrIGhhcwogICAgICAgICAvLyBiZWVuIHNldC4KQEAgLTE0MzIsNiArMTQ4MCwyNCBAQAogICAgICAgICBzZW5kTWVzc2FnZShtc2cpOwogICAgIH0KIAorICAgIHByaXZhdGUgc3RhdGljIGNsYXNzIFVwbG9hZEZpbGVNZXNzYWdlRGF0YSB7CisgICAgICAgIHByaXZhdGUgVXBsb2FkRmlsZSBtQ2FsbGJhY2s7CisgICAgICAgIHByaXZhdGUgU3RyaW5nIG1BY2NlcHRUeXBlOworCisgICAgICAgIHB1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AgICAgICAgYXNzZXJ0KG1Db250ZXh0ICE9IG51bGwpOworICAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBzdGFydCgpIHsKKyAgICAgICAgbUlzUnVubmluZyA9IHRydWU7CisgICAgICAgIHJlZ2lzdGVyRm9yU2Vuc29ycygpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHN0b3AoKSB7CisgICAgICAgIG1Jc1J1bm5pbmcgPSBmYWxzZTsKKyAgICAgICAgdW5yZWdpc3RlckZyb21TZW5zb3JzKCk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc3VzcGVuZCgpIHsKKyAgICAgICAgaWYgKG1Jc1J1bm5pbmcpIHsKKyAgICAgICAgICAgIHVucmVnaXN0ZXJGcm9tU2Vuc29ycygpOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgcmVzdW1lKCkgeworICAgICAgICBpZiAobUlzUnVubmluZykgeworICAgICAgICAgICAgcmVnaXN0ZXJGb3JTZW5zb3JzKCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgc2VuZEVycm9yRXZlbnQoKSB7CisgICAgICAgIGFzc2VydCBXZWJWaWV3Q29yZS5USFJFQURfTkFNRS5lcXVhbHMoVGhyZWFkLmN1cnJlbnRUaHJlYWQoKS5nZXROYW1lKCkpOworICAgICAgICBtSGFuZGxlci5wb3N0KG5ldyBSdW5uYWJsZSgpIHsKKyAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgcHVibGljIHZvaWQgcnVuKCkgeworICAgICAgICAgICAgICAgIGFzc2VydCBXZWJWaWV3Q29yZS5USFJFQURfTkFNRS5lcXVhbHMoVGhyZWFkLmN1cnJlbnRUaHJlYWQoKS5nZXROYW1lKCkpOworICAgICAgICAgICAgICAgIGlmIChtSXNSdW5uaW5nKSB7CisgICAgICAgICAgICAgICAgICAgIG1NYW5hZ2VyLm9uT3JpZW50YXRpb25DaGFuZ2UobnVsbCwgbnVsbCwgbnVsbCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9KTsKKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgcmVnaXN0ZXJGb3JTZW5zb3JzKCkgeworICAgICAgICBpZiAobUhhbmRsZXIgPT0gbnVsbCkgeworICAgICAgICAgICAgbUhhbmRsZXIgPSBuZXcgSGFuZGxlcigpOworICAgICAgICB9CisgICAgICAgIGlmICghcmVnaXN0ZXJGb3JBY2NlbGVyb21ldGVyU2Vuc29yKCkgfHwgIXJlZ2lzdGVyRm9yTWFnbmV0aWNGaWVsZFNlbnNvcigpKSB7CisgICAgICAgICAgICB1bnJlZ2lzdGVyRnJvbVNlbnNvcnMoKTsKKyAgICAgICAgICAgIHNlbmRFcnJvckV2ZW50KCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgZ2V0T3JpZW50YXRpb25Vc2luZ0dldFJvdGF0aW9uTWF0cml4KCkgeworICAgICAgICBpZiAobUdyYXZpdHlWZWN0b3IgPT0gbnVsbCB8fCBtTWFnbmV0aWNGaWVsZFZlY3RvciA9PSBudWxsKSB7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKworICAgICAgICAvLyBHZXQgdGhlIHJvdGF0aW9uIG1hdHJpeC4KKyAgICAgICAgLy8gVGhlIHJvdGF0aW9uIG1hdHJpeCB0aGF0IHRyYW5zZm9ybXMgZnJvbSB0aGUgYm9keSBmcmFtZSB0byB0aGUgZWFydGggZnJhbWUuCisgICAgICAgIGZsb2F0W10gZGV2aWNlUm90YXRpb25NYXRyaXggPSBuZXcgZmxvYXRbOV07CisgICAgICAgIGlmICghU2Vuc29yTWFuYWdlci5nZXRSb3RhdGlvbk1hdHJpeCgKKyAgICAgICAgICAgICAgICBkZXZpY2VSb3RhdGlvbk1hdHJpeCwgbnVsbCwgbUdyYXZpdHlWZWN0b3IsIG1NYWduZXRpY0ZpZWxkVmVjdG9yKSkgeworICAgICAgICAgICAgc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ICAgICAgICAgIHx8IE1hdGguYWJzKGFscGhhIC0gbUFscGhhKSA+IERFTFRBX0RFR1JFU1MKKyAgICAgICAgICAgICAgICB8fCBNYXRoLmFicyhiZXRhIC0gbUJldGEpID4gREVMVEFfREVHUkVTUworICAgICAgICAgICAgICAgIHx8IE1hdGguYWJzKGdhbW1hIC0gbUdhbW1hKSA+IERFTFRBX0RFR1JFU1MpIHsKKyAgICAgICAgICAgIG1BbHBoYSA9IGFscGhhOworICAgICAgICAgICAgbUJldGEgPSBiZXRhOworICAgICAgICAgICAgbUdhbW1hID0gZ2FtbWE7CisgICAgICAgICAgICBtTWFuYWdlci5vbk9yaWVudGF0aW9uQ2hhbmdlKG1BbHBoYSwgbUJldGEsIG1HYW1tYSk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBTZW5zb3JFdmVudExpc3RlbmVyIGltcGxlbWVudGF0aW9uLgorICAgICAqIENhbGxiYWNrcyBoYXBwZW4gb24gdGhlIHRocmVhZCBvbiB3aGljaCB3ZSByZWdpc3RlcmVkIC0gdGhlIFdlYkNvcmUgdGhyZWFkLgorICAgICAqLworICAgIHB1YmxpYyB2b2lkIG9uU2Vuc29yQ2hhbmdlZChTZW5zb3JFdmVudCBldmVudCkgeworICAgICAgICBhc3NlcnQoZXZlbnQudmFsdWVzLmxlbmd0aCA9PSAzKTsKKyAgICAgICAgYXNzZXJ0IFdlYlZpZXdDb3JlLlRIUkVBRF9OQU1FLmVxdWFscyhUaHJlYWQuY3VycmVudFRocmVhZCgpLmdldE5hbWUoKSk7CisKKyAgICAgICAgaWYgKCFtSXNSdW5uaW5nKSB7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKworICAgICAgICBzd2l0Y2ggKGV2ZW50LnNlbnNvci5nZXRUeXBlKCkpIHsKKyAgICAgICAgICBjYXNlIFNlbnNvci5UWVBFX0FDQ0VMRVJPTUVURVI6CisgICAgICAgICAgICBpZiAobUdyYXZpdHlWZWN0b3IgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIG1HcmF2aXR5VmVjdG9yID0gbmV3IGZsb2F0WzNdOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbUdyYXZpdHlWZWN0b3JbMF0gPSBldmVudC52YWx1ZXNbMF07CisgICAgICAgICAgICBtR3Jhdml0eVZlY3RvclsxXSA9IGV2ZW50LnZhbHVlc1sxXTsKKyAgICAgICAgICAgIG1HcmF2aXR5VmVjdG9yWzJdID0gZXZlbnQudmFsdWVzWzJdOworICAgICAgICAgICAgZ2V0T3JpZW50YXRpb25Vc2luZ0dldFJvdGF0aW9uTWF0cml4KCk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICBjYXNlIFNlbnNvci5UWVBFX01BR05FVElDX0ZJRUxEOgorICAgICAgICAgICAgaWYgKG1NYWduZXRpY0ZpZWxkVmVjdG9yID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICBtTWFnbmV0aWNGaWVsZFZlY3RvciA9IG5ldyBmbG9hdFszXTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1NYWduZXRpY0ZpZWxkVmVjdG9yWzBdID0gZXZlbnQudmFsdWVzWzBdOworICAgICAgICAgICAgbU1hZ25ldGljRmllbGRWZWN0b3JbMV0gPSBldmVudC52YWx1ZXNbMV07CisgICAgICAgICAgICBtTWFnbmV0aWNGaWVsZFZlY3RvclsyXSA9IGV2ZW50LnZhbHVlc1syXTsKKyAgICAgICAgICAgIGdldE9yaWVudGF0aW9uVXNpbmdHZXRSb3RhdGlvbk1hdHJpeCgpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgIGFzc2VydChmYWxzZSk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBvbkFjY3VyYWN5Q2hhbmdlZChTZW5zb3Igc2Vuc29yLCBpbnQgYWNjdXJhY3kpIHsKKyAgICAgICAgYXNzZXJ0IFdlYlZpZXdDb3Jl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maW5kTmV4dChib29sZWFuIG5leHQpIHsKKyAgICAgICAgaWYgKG1XZWJWaWV3ID09IG51bGwpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBBc3NlcnRpb25FcnJvcigKKyAgICAgICAgICAgICAgICAgICAgIk5vIFdlYlZpZXcgZm9yIEZpbmRBY3Rpb25Nb2RlQ2FsbGJhY2s6OmZpbmROZXh0Iik7CisgICAgICAgIH0KKyAgICAgICAgbVdlYlZpZXcuZmluZE5leHQobmV4dCk7CisgICAgfQorCisgICAgLyoKKyAgICAgKiBIaWdobGlnaHQgYWxsIHRoZSBpbnN0YW5jZXMgb2YgdGhlIHN0cmluZyBmcm9tIG1FZGl0VGV4dCBpbiBtV2ViVmlldy4KKyAgICAgKi8KKyAgICB2b2lkIGZpbmRBbGwoKSB7CisgICAgICAgIGlmIChtV2ViVmlldyA9PSBudWxsKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgQXNzZXJ0aW9uRXJyb3IoCisgICAgICAgICAgICAgICAgICAgICJObyBXZWJWaWV3IGZvciBGaW5kQWN0aW9uTW9kZUNhbGxiYWNrOjpmaW5kQWxsIik7CisgICAgICAgIH0KKyAgICAgICAgQ2hhclNlcXVlbmNlIGZpbmQgPSBtRWRpdFRleHQuZ2V0VGV4dCgpOworICAgICAgICBpZiAoMCA9PSBmaW5kLmxlbmd0aCgpKSB7CisgICAgICAgICAgICBtV2ViVmlldy5jbGVhck1hdGNoZXMoKTsKKyAgICAgICAgICAgIG1NYXRjaGVzLnNldFZpc2liaWxpdHkoVmlldy5HT05FKTsKKyAgICAgICAgICAgIG1NYXRjaGVzRm91bmQgPSBmYWxzZTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIG1NYXRjaGVzRm91bmQgPSB0cnVlOworICAgICAgICAgICAgbU1hdGNoZXMuc2V0VmlzaWJpbGl0eShWaWV3LlZJU0lCTEUpOworICAgICAgICAgICAgbU51bWJlck9mTWF0Y2hlcyA9IG1XZWJWaWV3LmZpbmRBbGwoZmluZC50b1N0cmluZygpKTsKKyAgICAgICAgICAgIGlmICgwID09IG1OdW1iZXJPZk1hdGNoZXMpIHsKKyAgICAgICAgICAgICAgICBtTWF0Y2hlcy5zZXRUZXh0KG1SZXNvdXJjZXMuZ2V0U3RyaW5nKAorICAgICAgICAgICAgICAgICAgICAgICAgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHJpbmcubm9fbWF0Y2hlcykpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICB1cGRhdGVNYXRjaGVzU3RyaW5nKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKgorICAgICAqIFVwZGF0ZSB0aGUgc3RyaW5nIHdoaWNoIHRlbGxzIHRoZSB1c2VyIGhvdyBtYW55IG1hdGNoZXMgd2VyZSBmb3VuZCwgYW5kCisgICAgICogd2hpY2ggbWF0Y2ggaXMgY3VycmVudGx5IGhpZ2hsaWdodGVkLgorICAgICAqLworICAgIHByaXZhdGUgdm9pZCB1cGRhdGVNYXRjaGVzU3RyaW5nKCkgeworICAgICAgICBTdHJpbmcgdGVtcGxhdGUgPSBtUmVzb3VyY2VzLmdldFF1YW50aXR5U3RyaW5nKAorICAgICAgICAgICAgICAgIGNvbS5hbmRyb2lkLmludGVybmFsLlIucGx1cmFscy5tYXRjaGVzX2ZvdW5kLCBtTnVtYmVyT2ZNYXRjaGVzLAorICAgICAgICAgICAgICAgIG1XZWJWaWV3LmZpbmRJbmRleCgpICsgMSwgbU51bWJlck9mTWF0Y2hlcyk7CisKKyAgICAgICAgbU1hdGNoZXMuc2V0VGV4dCh0ZW1wbGF0ZSk7CisgICAgfQorCisgICAgLy8gT25Mb25nQ2xpY2tMaXN0ZW5lciBpbXBsZW1lbnRhdGlvbgorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIGJvb2xlYW4gb25Mb25nQ2xpY2soVmlldyB2KSB7IHJldHVybiB0cnVlOyB9CisKKyAgICAv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XRXaW5kb3dUb2tlbigpLCAwKTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgYm9vbGVhbiBvblByZXBhcmVBY3Rpb25Nb2RlKEFjdGlvbk1vZGUgbW9kZSwgTWVudSBtZW51KSB7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgYm9vbGVhbiBvbkFjdGlvbkl0ZW1DbGlja2VkKEFjdGlvbk1vZGUgbW9kZSwgTWVudUl0ZW0gaXRlbSkgeworICAgICAgICBpZiAoIW1NYXRjaGVzRm91bmQpIHsKKyAgICAgICAgICAgIGZpbmRBbGwoKTsKKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9CisgICAgICAgIHN3aXRjaChpdGVtLmdldEl0ZW1JZCgpKSB7CisgICAgICAgICAgICBjYXNlIGNvbS5hbmRyb2lkLmludGVybmFsLlIuaWQuZmluZF9wcmV2OgorICAgICAgICAgICAgICAgIGZpbmROZXh0KGZhbHNlKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5pZC5maW5kX25leHQ6CisgICAgICAgICAgICAgICAgZmluZE5leHQodHJ1ZSk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorICAgICAgICB1cGRhdGVNYXRjaGVzU3RyaW5nKCk7CisgICAgICAgIHJldHVybiB0cnVlOworICAgIH0KKworICAgIC8vIFRleHRXYXRjaGVyIGltcGxlbWVudGF0aW9uCisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCBiZWZvcmVUZXh0Q2hhbmdlZChDaGFyU2VxdWVuY2UgcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgc3RhcnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGNvdW50LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBhZnRlcikgeworICAgICAgICAvLyBEb2VzIG5vdGhpbmcuICBOZWVkZWQgdG8gaW1wbGVtZW50IFRleHRXYXRjaGVyLgorICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIG9uVGV4dENoYW5nZWQoQ2hhclNlcXVlbmNlIHMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgc3RhcnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgYmVmb3JlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGNvdW50KSB7CisgICAgICAgIGZpbmRBbGwoKTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCBhZnRlclRleHRDaGFuZ2VkKEVkaXRhYmxlIHMpIHsKKyAgICAgICAgLy8gRG9lcyBub3RoaW5nLiAgTmVlZGVkIHRvIGltcGxlbWVudCBUZXh0V2F0Y2hlci4KKyAgICB9CisKK30KZGlmZiAtLWdpdCBhL2NvcmUvamF2YS9hbmRyb2lkL3dlYmtpdC9HZW9sb2NhdGlvblNlcnZpY2UuamF2YSBiL2NvcmUvamF2YS9hbmRyb2lkL3dlYmtpdC9HZW9sb2NhdGlvblNlcnZpY2UuamF2YQppbmRleCAyNDMwNmY0Li45MWRlMWQ4IDEwMDc1NQotLS0gYS9jb3JlL2phdmEvYW5kcm9pZC93ZWJraXQvR2VvbG9jYXRpb25TZXJ2aWNlLmphdmEKKysrIGIvY29yZS9qYXZhL2FuZHJvaWQvd2Via2l0L0dlb2xvY2F0aW9uU2VydmljZS5qYXZhCkBAIC00NSwxNCArNDUsMTMgQEAKIAogICAgIC8qKgogICAgICAqIENvbnN0cnVjdG9yCisgICAgICogQHBhcmFtIGNvbnRleHQgVGhlIGNvbnRleHQgZnJvbSB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XBvcnQgamF2YS51dGlsLlRpbWVyVGFzazsKKworLyoqCisgKiA8cD5IVE1MNSBzdXBwb3J0IGNsYXNzIGZvciBBdWRpby4KKyAqLworY2xhc3MgSFRNTDVBdWRpbyBleHRlbmRzIEhhbmRsZXIKKyAgICAgICAgICAgICAgICAgaW1wbGVtZW50cyBNZWRpYVBsYXllci5PbkJ1ZmZlcmluZ1VwZGF0ZUxpc3RlbmVyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1lZGlhUGxheWVyLk9uQ29tcGxldGlvbkxpc3RlbmVyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1lZGlhUGxheWVyLk9uRXJyb3JMaXN0ZW5lciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBNZWRpYVBsYXllci5PblByZXBhcmVkTGlzdGVuZXIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgTWVkaWFQbGF5ZXIuT25TZWVrQ29tcGxldGVMaXN0ZW5lciB7CisgICAgLy8gTG9nZ2luZyB0YWcuCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgU3RyaW5nIExPR1RBRyA9ICJIVE1MNUF1ZGlvIjsKKworICAgIHByaXZhdGUgTWVkaWFQbGF5ZXIgbU1lZGlhUGxheWVyOworCisgICAgLy8gVGhlIEMrKyBNZWRpYVBsYXllclByaXZhdGVBbmRyb2lkIG9iamVjdC4KKyAgICBwcml2YXRlIGludCBtTmF0aXZlUG9pbnRlcjsKKworICAgIHByaXZhdGUgc3RhdGljIGludCBJRExFICAgICAgICA9ICAwOworICAgIHByaXZhdGUgc3RhdGljIGludCBJTklUSUFMSVpFRCA9ICAxOworICAgIHByaXZhdGUgc3RhdGljIGludCBQUkVQQVJFRCAgICA9ICAyOworICAgIHByaXZhdGUgc3RhdGljIGludCBTVEFSVEVEICAgICA9ICA0OworICAgIHByaXZhdGUgc3RhdGljIGludCBDT01QTEVURSAgICA9ICA1OworICAgIHByaXZhdGUgc3RhdGljIGludCBQQVVTR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AgICAgICBjYXNlIFRJTUVVUERBVEU6IHsKKyAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICBpZiAobVN0YXRlICE9IEVSUk9SICYmIG1NZWRpYVBsYXllci5pc1BsYXlpbmcoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgaW50IHBvc2l0aW9uID0gbU1lZGlhUGxheWVyLmdldEN1cnJlbnRQb3NpdGlvbigpOworICAgICAgICAgICAgICAgICAgICAgICAgbmF0aXZlT25UaW1ldXBkYXRlKHBvc2l0aW9uLCBtTmF0aXZlUG9pbnRlcik7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9IGNhdGNoIChJbGxlZ2FsU3RhdGVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICBtU3RhdGUgPSBFUlJPUjsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvLyBldmVudCBsaXN0ZW5lcnMgZm9yIE1lZGlhUGxheWVyCisgICAgLy8gVGhvc2UgYXJlIGNhbGxlZCBmcm9tIHRoZSBzYW1lIHRocmVhZCB3ZSBjcmVhdGVkIHRoZSBNZWRpYVBsYXllcgorICAgIC8vIChpLmUuIHRoZSB3ZWJ2aWV3Y29yZSB0aHJlYWQgaGVyZSkKKworICAgIC8vIE1lZGlhUGxheWVyLk9uQnVmZmVyaW5nVXBkYXRlTGlzdGVuZXIKKyAgICBwdWJsaWMgdm9pZCBvbkJ1ZmZlcmluZ1VwZGF0ZShNZWRpYVBsYXllciBtcCwgaW50IHBlcmNlbnQpIHsKKyAgICAgICAgbmF0aXZlT25CdWZmZXJpbmcocGVyY2VudCwgbU5hdGl2ZVBvaW50ZXIpOworICAgIH0KKworICAgIC8vIE1lZGlhUGxheWVyLk9uQ29tcGxldGlvbkxpc3RlbmVyOworICAgIHB1YmxpYyB2b2lkIG9uQ29tcGxldGlvbihNZWRpYVBsYXllciBtcCkgeworICAgICAgICByZXNldE1lZGlhUGxheWVyKCk7CisgICAgICAgIG1TdGF0ZSA9IElETEU7CisgICAgICAgIG5hdGl2ZU9uRW5kZWQobU5hdGl2ZVBvaW50ZXIpOworICAgIH0KKworICAgIC8vIE1lZGlhUGxheWVyLk9uRXJyb3JMaXN0ZW5lcgorICAgIHB1YmxpYyBib29sZWFuIG9uRXJyb3IoTWVkaWFQbGF5ZXIgbXAsIGludCB3aGF0LCBpbnQgZXh0cmEpIHsKKyAgICAgICAgbVN0YXRlID0gRVJST1I7CisgICAgICAgIHJlc2V0TWVkaWFQbGF5ZXIoKTsKKyAgICAgICAgbVN0YXRlID0gSURMRTsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIC8vIE1lZGlhUGxheWVyLk9uUHJlcGFyZWRMaXN0ZW5lcgorICAgIHB1YmxpYyB2b2lkIG9uUHJlcGFyZWQoTWVkaWFQbGF5ZXIgbXApIHsKKyAgICAgICAgbVN0YXRlID0gUFJFUEFSRUQ7CisgICAgICAgIGlmIChtVGltZXIgIT0gbnVsbCkgeworICAgICAgICAgICAgbVRpbWVyLnNjaGVkdWxlKG5ldyBUaW1ldXBkYXRlVGFzaygpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRJTUVVUERBVEVfUEVSSU9ELCBUSU1FVVBEQVRFX1BFUklPRCk7CisgICAgICAgIH0KKyAgICAgICAgbmF0aXZlT25QcmVwYXJlZChtcC5nZXREdXJhdGlvbigpLCAwLCAwLCBtTmF0aXZlUG9pbnRlcik7CisgICAgICAgIGlmIChtQXNrVG9QbGF5KSB7CisgICAgICAgICAgICBtQXNrVG9QbGF5ID0gZmFsc2U7CisgICAgICAgICAgICBwbGF5KCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvLyBNZWRpYVBsYXllci5PblNlZWtDb21wbGV0ZUxpc3RlbmVyCisgICAgcHVibGljIHZvaWQgb25TZWVrQ29tcGxldGUoTWVkaWFQbGF5ZXIgbXApIHsKKy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gICAgICB9CisgICAgICAgIG1UaW1lciA9IG5ldyBUaW1lcigpOworICAgICAgICBtU3RhdGUgPSBJRExFOworICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBzZXREYXRhU291cmNlKFN0cmluZyB1cmwpIHsKKyAgICAgICAgbVVybCA9IHVybDsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIGlmIChtU3RhdGUgIT0gSURMRSkgeworICAgICAgICAgICAgICAgIHJlc2V0TWVkaWFQbGF5ZXIoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1NZWRpYVBsYXllci5zZXREYXRhU291cmNlKHVybCk7CisgICAgICAgICAgICBtU3RhdGUgPSBJTklUSUFMSVpFRDsKKyAgICAgICAgICAgIG1NZWRpYVBsYXllci5wcmVwYXJlQXN5bmMoKTsKKyAgICAgICAgfSBjYXRjaCAoSU9FeGNlcHRpb24gZSkgeworICAgICAgICAgICAgTG9nLmUoTE9HVEFHLCAiY291bGRuJ3QgbG9hZCB0aGUgcmVzb3VyY2U6ICIgKyB1cmwgKyAiIGV4YzogIiArIGUpOworICAgICAgICAgICAgcmVzZXRNZWRpYVBsYXllcigpOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIHBsYXkoKSB7CisgICAgICAgIGlmICgobVN0YXRlID09IEVSUk9SIHx8IG1TdGF0ZSA9PSBJRExFKSAmJiBtVXJsICE9IG51bGwpIHsKKyAgICAgICAgICAgIHJlc2V0TWVkaWFQbGF5ZXIoKTsKKyAgICAgICAgICAgIHNldERhdGFTb3VyY2UobVVybCk7CisgICAgICAgICAgICBtQXNrVG9QbGF5ID0gdHJ1ZTsKKyAgICAgICAgfQorCisgICAgICAgIGlmIChtU3RhdGUgPj0gUFJFUEFSRUQpIHsKKyAgICAgICAgICAgIG1NZWRpYVBsYXllci5zdGFydCgpOworICAgICAgICAgICAgbVN0YXRlID0gU1RBUlRFRDsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUg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CiAgICAgICAgICAgICAvLyB1cmwuCiAgICAgICAgICAgICByZXR1cm4gQ2VydFRvb2wuZ2V0U2lnbmVkUHVibGljS2V5KAotICAgICAgICAgICAgICAgICAgICBtQ3VycmVudE1haW5XZWJWaWV3LmdldENvbnRleHQoKSwgaW5kZXgsIGNoYWxsZW5nZSk7CisgICAgICAgICAgICAgICAgICAgIGN1cnJlbnQuZ2V0Q29udGV4dCgpLCBpbmRleCwgY2hhbGxlbmdlKTsKICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgIExvZy5lKExPR1RBRywgIlRoZXJlIGlzIG5vIGFjdGl2ZSBXZWJWaWV3IGZvciBnZXRTaWduZWRQdWJsaWNLZXkiKTsKICAgICAgICAgICAgIHJldHVybiAiIjsKICAgICAgICAgfQogICAgIH0KIAorICAgIC8vIENhbGxlZCBvbiB0aGUgV2ViQ29yZSB0aHJlYWQgdGhyb3VnaCBKTkkuCisgICAgcHJpdmF0ZSBTdHJpbmcgcmVzb2x2ZUZpbGVQYXRoRm9yQ29udGVudFVyaShTdHJpbmcgdXJpKSB7CisgICAgICAgIGlmIChtQ29udGVudFVyaVRvRmlsZVBhdGhNYXAgIT0gbnVsbCkgeworICAgICAgICAgICAgU3RyaW5nIGZpbGVOYW1lID0gbUNvbnRlbnRVcmlUb0ZpbGVQYXRoTWFwLmdldCh1cmkpOworICAgICAgICAgICAgaWYgKGZpbGVOYW1lICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gZmlsZU5hbWU7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICAvLyBGYWlsc2FmZSBmYWxsYmFjayB0byBqdXN0IHVzZSB0aGUgbGFzdCBwYXRoIHNlZ21lbnQuCisgICAgICAgIC8vIChTZWUgT3BlbmFibGVDb2x1bW5zIGRvY3VtZW50YXRpb24gaW4gdGhlIFNESykKKyAgICAgICAgVXJpIGpVcmkgPSBVcmkucGFyc2UodXJpKTsKKyAgICAgICAgcmV0dXJuIGpV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b24vb2dnIiwgIm9nZyIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24vcGRmIiwgInBkZiIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24vcGdwLWtleXMiLCAia2V5Iik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhcHBsaWNhdGlvbi9wZ3Atc2lnbmF0dXJlIiwgInBncCIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24vcGljcy1ydWxlcyIsICJwcmYiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImFwcGxpY2F0aW9uL3JhciIsICJyYXIiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImFwcGxpY2F0aW9uL3JkZit4bWwiLCAicmRmIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhcHBsaWNhdGlvbi9yc3MreG1sIiwgInJzcyIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24vemlwIiwgInppcCIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24vdm5kLmFuZHJvaWQucGFja2FnZS1hcmNoaXZlIiwgCi0gICAgICAgICAgICAgICAgICAgICJhcGsiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImFwcGxpY2F0aW9uL3ZuZC5jaW5kZXJlbGxhIiwgImNkeSIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24vdm5kLm1zLXBraS5zdGwiLCAic3RsIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KAotICAgICAgICAgICAgICAgICAgICAiYXBwbGljYXRpb24vdm5kLm9hc2lzLm9wZW5kb2N1bWVudC5kYXRhYmFzZSIsICJvZGIiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoCi0gICAgICAgICAgICAgICAgICAgICJhcHBsaWNhdGlvbi92bmQub2FzaXMub3BlbmRvY3VtZW50LmZvcm11bGEiLCAib2RmIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KAotICAgICAgICAgICAgICAgICAgICAiYXBwbGljYXRpb24vdm5kLm9hc2lzLm9wZW5kb2N1bWVudC5ncmFwaGljcyIsICJvZGciKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoCi0gICAgICAgICAgICAgICAgICAgICJhcHBsaWNhdGlvbi92bmQub2FzaXMub3BlbmRvY3VtZW50LmdyYXBoaWNzLXRlbXBsYXRlIiwKLSAgICAgICAgICAgICAgICAgICAgIm90ZyIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgKLSAgICAgICAgICAgICAgICAgICAgImFwcGxpY2F0aW9uL3ZuZC5vYXNpcy5vcGVuZG9jdW1lbnQuaW1hZ2UiLCAib2RpIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KAotICAgICAgICAgICAgICAgICAgICAiYXBwbGljYXRpb24vdm5kLm9hc2lzLm9wZW5kb2N1bWVudC5zcHJlYWRzaGVldCIsICJvZHMiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoCi0gICAgICAgICAgICAgICAgICAgICJhcHBsaWNhdGlvbi92bmQub2FzaXMub3BlbmRvY3VtZW50LnNwcmVhZHNoZWV0LXRlbXBsYXRlIiwKLSAgICAgICAgICAgICAgICAgICAgIm90cyIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgKLSAgICAgICAgICAgICAgICAgICAgImFwcGxpY2F0aW9uL3ZuZC5vYXNpcy5vcGVuZG9jdW1lbnQudGV4dCIsICJvZHQiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoCi0gICAgICAgICAgICAgICAgICAgICJhcHBsaWNhdGlvbi92bmQub2FzaXMub3BlbmRvY3VtZW50LnRleHQtbWFzdGVyIiwgIm9kbSIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgKLSAgICAgICAgICAgICAgICAgICAgImFwcGxpY2F0aW9uL3ZuZC5vYXNpcy5vcGVuZG9jdW1lbnQudGV4dC10ZW1wbGF0ZSIsICJvdHQiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoCi0gICAgICAgICAgICAgICAgICAgICJhcHBsaWNhdGlvbi92bmQub2FzaXMub3BlbmRvY3VtZW50LnRleHQtd2ViIiwgIm90aCIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24vbXN3b3JkIiwgImRvYyIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24vbXN3b3JkIiwgImRvdCIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgKLSAgICAgICAgICAgICAgICAgICAgImFwcGxpY2F0aW9uL3ZuZC5vcGVueG1sZm9ybWF0cy1vZmZpY2Vkb2N1bWVudC53b3JkcHJvY2Vzc2luZ21sLmRvY3VtZW50IiwKLSAgICAgICAgICAgICAgICAgICAgImRvY3giKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoCi0gICAgICAgICAgICAgICAgICAgICJhcHBsaWNhdGlvbi92bmQub3BlbnhtbGZvcm1hdHMtb2ZmaWNlZG9jdW1lbnQud29yZHByb2Nlc3NpbmdtbC50ZW1wbGF0ZSIsCi0gICAgICAgICAgICAgICAgICAgICJkb3R4Iik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhcHBsaWNhdGlvbi92bmQubXMtZXhjZWwiLCAieGxzIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhcHBsaWNhdGlvbi92bmQubXMtZXhjZWwiLCAieGx0Iik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KAotICAgICAgICAgICAgICAgICAgICAiYXBwbGljYXRpb24vdm5kLm9wZW54bWxmb3JtYXRzLW9mZmljZWRvY3VtZW50LnNwcmVhZHNoZWV0bWwuc2hlZXQiLAotICAgICAgICAgICAgICAgICAgICAieGxzeCIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgKLSAgICAgICAgICAgICAgICAgICAgImFwcGxpY2F0aW9uL3ZuZC5vcGVueG1sZm9ybWF0cy1vZmZpY2Vkb2N1bWVudC5zcHJlYWRzaGVldG1sLnRlbXBsYXRlIiwKLSAgICAgICAgICAgICAgICAgICAgInhsdHgiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImFwcGxpY2F0aW9uL3ZuZC5tcy1wb3dlcnBvaW50IiwgInBwdCIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24vdm5kLm1zLXBvd2VycG9pbnQiLCAicG90Iik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhcHBsaWNhdGlvbi92bmQubXMtcG93ZXJwb2ludCIsICJwcHMiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoCi0gICAgICAgICAgICAgICAgICAgICJhcHBsaWNhdGlvbi92bmQub3BlbnhtbGZvcm1hdHMtb2ZmaWNlZG9jdW1lbnQucHJlc2VudGF0aW9ubWwucHJlc2VudGF0aW9uIiwKLSAgICAgICAgICAgICAgICAgICAgInBwdHgiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoCi0gICAgICAgICAgICAgICAgICAgICJhcHBsaWNhdGlvbi92bmQub3BlbnhtbGZvcm1hdHMtb2ZmaWNlZG9jdW1lbnQucHJlc2VudGF0aW9ubWwudGVtcGxhdGUiLAotICAgICAgICAgICAgICAgICAgICAicG90eCIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgKLSAgICAgICAgICAgICAgICAgICAgImFwcGxpY2F0aW9uL3ZuZC5vcGVueG1sZm9ybWF0cy1vZmZpY2Vkb2N1bWVudC5wcmVzZW50YXRpb25tbC5zbGlkZXNob3ciLAotICAgICAgICAgICAgICAgICAgICAicHBzeCIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24vdm5kLnJpbS5jb2QiLCAiY29kIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhcHBsaWNhdGlvbi92bmQuc21hZiIsICJtbWYiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImFwcGxpY2F0aW9uL3ZuZC5zdGFyZGl2aXNpb24uY2FsYyIsICJzZGMiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImFwcGxpY2F0aW9uL3ZuZC5zdGFyZGl2aXNpb24uZHJhdyIsICJzZGEiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoCi0gICAgICAgICAgICAgICAgICAgICJhcHBsaWNhdGlvbi92bmQuc3RhcmRpdmlzaW9uLmltcHJlc3MiLCAic2RkIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KAotICAgICAgICAgICAgICAgICAgICAiYXBwbGljYXRpb24vdm5kLnN0YXJkaXZpc2lvbi5pbXByZXNzIiwgInNkcCIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24vdm5kLnN0YXJkaXZpc2lvbi5tYXRoIiwgInNtZiIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24vdm5kLnN0YXJkaXZpc2lvbi53cml0ZXIiLAotICAgICAgICAgICAgICAgICAgICAic2R3Iik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhcHBsaWNhdGlvbi92bmQuc3RhcmRpdmlzaW9uLndyaXRlciIsCi0gICAgICAgICAgICAgICAgICAgICJ2b3IiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoCi0gICAgICAgICAgICAgICAgICAgICJhcHBsaWNhdGlvbi92bmQuc3RhcmRpdmlzaW9uLndyaXRlci1nbG9iYWwiLCAic2dsIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhcHBsaWNhdGlvbi92bmQuc3VuLnhtbC5jYWxjIiwgInN4YyIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgKLSAgICAgICAgICAgICAgICAgICAgImFwcGxpY2F0aW9uL3ZuZC5zdW4ueG1sLmNhbGMudGVtcGxhdGUiLCAic3RjIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhcHBsaWNhdGlvbi92bmQuc3VuLnhtbC5kcmF3IiwgInN4ZCIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgKLSAgICAgICAgICAgICAgICAgICAgImFwcGxpY2F0aW9uL3ZuZC5zdW4ueG1sLmRyYXcudGVtcGxhdGUiLCAic3RkIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhcHBsaWNhdGlvbi92bmQuc3VuLnhtbC5pbXByZXNzIiwgInN4aSIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgKLSAgICAgICAgICAgICAgICAgICAgImFwcGxpY2F0aW9uL3ZuZC5zdW4ueG1sLmltcHJlc3MudGVtcGxhdGUiLCAic3RpIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhcHBsaWNhdGlvbi92bmQuc3VuLnhtbC5tYXRoIiwgInN4bSIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24vdm5kLnN1bi54bWwud3JpdGVyIiwgInN4dyIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgKLSAgICAgICAgICAgICAgICAgICAgImFwcGxpY2F0aW9uL3ZuZC5zdW4ueG1sLndyaXRlci5nbG9iYWwiLCAic3hnIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KAotICAgICAgICAgICAgICAgICAgICAiYXBwbGljYXRpb24vdm5kLnN1bi54bWwud3JpdGVyLnRlbXBsYXRlIiwgInN0dyIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24vdm5kLnZpc2lvIiwgInZzZCIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24veC1hYml3b3JkIiwgImFidyIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24veC1hcHBsZS1kaXNraW1hZ2UiLCAiZG1nIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhcHBsaWNhdGlvbi94LWJjcGlvIiwgImJjcGlvIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhcHBsaWNhdGlvbi94LWJpdHRvcnJlbnQiLCAidG9ycmVudCIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLm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BsaWNhdGlvbi94LWZsYWMiLCAiZmxhYyIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24veC1mb250IiwgInBmYSIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24veC1mb250IiwgInBmYiIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24veC1mb250IiwgImdzZiIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24veC1mb250IiwgInBjZiIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24veC1mb250IiwgInBjZi5aIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhcHBsaWNhdGlvbi94LWZyZWVtaW5kIiwgIm1tIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhcHBsaWNhdGlvbi94LWZ1dHVyZXNwbGFzaCIsICJzcGwiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImFwcGxpY2F0aW9uL3gtZ251bWVyaWMiLCAiZ251bWVyaWMiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImFwcGxpY2F0aW9uL3gtZ28tc2dmIiwgInNnZiIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24veC1ncmFwaGluZy1jYWxjdWxhdG9yIiwgImdjZiIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24veC1ndGFyIiwgImd0YXIiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImFwcGxpY2F0aW9uL3gtZ3RhciIsICJ0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LSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImFwcGxpY2F0aW9uL3gta29hbiIsICJza3QiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImFwcGxpY2F0aW9uL3gta29hbiIsICJza20iKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImFwcGxpY2F0aW9uL3gta3ByZXNlbnRlciIsICJrcHIiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImFwcGxpY2F0aW9uL3gta3ByZXNlbnRlciIsICJrcHQiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImFwcGxpY2F0aW9uL3gta3NwcmVhZCIsICJrc3AiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImFwcGxpY2F0aW9uL3gta3dvcmQiLCAia3dkIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhcHBsaWNhdGlvbi94LWt3b3JkIiwgImt3dCIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24veC1sYXRleCIsICJsYXRleCIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24veC1saGEiLCAibGhhIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhcHBsaWNhdGlvbi94LWx6aCIsICJsemgiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImFwcGxpY2F0aW9uL3gtbHp4IiwgImx6eCIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24veC1tYWtlciIsICJmcm0iKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImFwcGx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iLCAib3phIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhcHBsaWNhdGlvbi94LXBrY3MxMiIsICJwMTIiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImFwcGxpY2F0aW9uL3gtcGtjczctY2VydHJlcXJlc3AiLCAicDdyIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhcHBsaWNhdGlvbi94LXBrY3M3LWNybCIsICJjcmwiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImFwcGxpY2F0aW9uL3gtcXVpY2t0aW1lcGxheWVyIiwgInF0bCIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24veC1zaGFyIiwgInNoYXIiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImFwcGxpY2F0aW9uL3gtc2hvY2t3YXZlLWZsYXNoIiwgInN3ZiIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24veC1zdHVmZml0IiwgInNpdCIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24veC1zdjRjcGlvIiwgInN2NGNwaW8iKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImFwcGxpY2F0aW9uL3gtc3Y0Y3JjIiwgInN2NGNyYyIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYXRpb24veC10YXIiLCAidGFyIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhcHBsaWNhdGlvbi94LXRleGluZm8iLCAidGV4aW5mbyIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXBwbGljYX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WNhdGlvbi94aHRtbCt4bWwiLCAieGh0bWwiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImF1ZGlvLzNncHAiLCAiM2dwcCIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXVkaW8vYW1yIiwgImFtciIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXVkaW8vYmFzaWMiLCAic25kIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhdWRpby9taWRpIiwgIm1pZCIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXVkaW8vbWlkaSIsICJtaWRpIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhdWRpby9taWRpIiwgImthciIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXVkaW8vbWlkaSIsICJ4bWYiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImF1ZGlvL21vYmlsZS14bWYiLCAibXhtZiIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXVkaW8vbXBlZyIsICJtcGdhIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhdWRpby9tcGVnIiwgIm1wZWdhIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhdWRpby9tcGVnIiwgIm1wMiIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXVkaW8vbXBlZyIsICJtcDMiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImF1ZGlvL21wZWciLCAibTRhIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhdWRpby9tcGVndXJsIi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c01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiYXVkaW8veC1zZDIiLCAic2QyIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJhdWRpby94LXdhdiIsICJ3YXYiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImltYWdlL2JtcCIsICJibXAiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImltYWdlL2dpZiIsICJnaWYiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImltYWdlL2ljbyIsICJjdXIiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImltYWdlL2ljbyIsICJpY28iKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImltYWdlL2llZiIsICJpZWYiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImltYWdlL2pwZWciLCAianBlZyIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiaW1hZ2UvanBlZyIsICJqcGciKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoImltYWdlL2pwZWciLCAianBlIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJpbWFnZS9wY3giLCAicGN4Iik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJpbWFnZS9wbmciLCAicG5nIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJpbWFnZS9zdmcreG1sIiwgInN2ZyIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgiaW1hZ2Uvc3ZnK3htbCIsICJzdmd6Iik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJpbWFnZS90aWZm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QvcGxhaW4iLCAidGV4dCIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgidGV4dC9wbGFpbiIsICJkaWZmIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJ0ZXh0L3BsYWluIiwgInBvIik7ICAgICAvLyByZXNlcnZlICJwb3QiIGZvciB2bmQubXMtcG93ZXJwb2ludAotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgidGV4dC9yaWNodGV4dCIsICJydHgiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoInRleHQvcnRmIiwgInJ0ZiIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgidGV4dC90ZXhtYWNzIiwgInRzIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJ0ZXh0L3RleHQiLCAicGhwcyIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgidGV4dC90YWItc2VwYXJhdGVkLXZhbHVlcyIsICJ0c3YiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoInRleHQveG1sIiwgInhtbCIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgidGV4dC94LWJpYnRleCIsICJiaWIiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoInRleHQveC1ib28iLCAiYm9vIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJ0ZXh0L3gtYysraGRyIiwgImgrKyIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgidGV4dC94LWMrK2hkciIsICJocHAiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoInRleHQveC1jKytoZHIiLCAiaHh4Iik7Ci0gICAgICAgICAg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VHlwZU1hcC5sb2FkRW50cnkoInZpZGVvL2R2IiwgImRpZiIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgidmlkZW8vZHYiLCAiZHYiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoInZpZGVvL2ZsaSIsICJmbGkiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoInZpZGVvL200diIsICJtNHYiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoInZpZGVvL21wZWciLCAibXBlZyIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgidmlkZW8vbXBlZyIsICJtcGciKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoInZpZGVvL21wZWciLCAibXBlIik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJ2aWRlby9tcDQiLCAibXA0Iik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJ2aWRlby9tcGVnIiwgIlZPQiIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgidmlkZW8vcXVpY2t0aW1lIiwgInF0Iik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJ2aWRlby9xdWlja3RpbWUiLCAibW92Iik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KCJ2aWRlby92bmQubXBlZ3VybCIsICJteHUiKTsKLSAgICAgICAgICAgIHNNaW1lVHlwZU1hcC5sb2FkRW50cnkoInZpZGVvL3gtbGEtYXNmIiwgImxzZiIpOwotICAgICAgICAgICAgc01pbWVUeXBlTWFwLmxvYWRFbnRyeSgidmlkZW8veC1sYS1hc2YiLCAibHN4Iik7Ci0gICAgICAgICAgICBzTWltZVR5cGVNYXAubG9hZEVudHJ5KC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dGFuY2Ugb2YgdGhlIG5ldHdvcmsuCiAgICAgICovCkBAIC0xMDcsNiArMTI1LDcgQEAKICAgICAgICAgaWYgKCsrc1BsYXRmb3JtTm90aWZpY2F0aW9uRW5hYmxlUmVmQ291bnQgPT0gMSkgewogICAgICAgICAgICAgaWYgKHNOZXR3b3JrICE9IG51bGwpIHsKICAgICAgICAgICAgICAgICBzTmV0d29yay5tUmVxdWVzdFF1ZXVlLmVuYWJsZVBsYXRmb3JtTm90aWZpY2F0aW9ucygpOworICAgICAgICAgICAgICAgIHNOZXR3b3JrLm1vbml0b3JSb2FtaW5nKCk7CiAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgIHNQbGF0Zm9ybU5vdGlmaWNhdGlvbnMgPSB0cnVlOwogICAgICAgICAgICAgfQpAQCAtMTIxLDYgKzE0MCw3IEBACiAgICAgICAgIGlmICgtLXNQbGF0Zm9ybU5vdGlmaWNhdGlvbkVuYWJsZVJlZkNvdW50ID09IDApIHsKICAgICAgICAgICAgIGlmIChzTmV0d29yayAhPSBudWxsKSB7CiAgICAgICAgICAgICAgICAgc05ldHdvcmsubVJlcXVlc3RRdWV1ZS5kaXNhYmxlUGxhdGZvcm1Ob3RpZmljYXRpb25zKCk7CisgICAgICAgICAgICAgICAgc05ldHdvcmsuc3RvcE1vbml0b3JpbmdSb2FtaW5nKCk7CiAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgIHNQbGF0Zm9ybU5vdGlmaWNhdGlvbnMgPSBmYWxzZTsKICAgICAgICAgICAgIH0KQEAgLTEzNiwxMiArMTU2LDM5IEBACiAgICAgICAgICAgICBBc3NlcnQuYXNzZXJ0VHJ1ZShUaHJlYWQuY3VycmVudFRocmVhZCgpLgogICAgICAgICAgICAgICAgICAgICBnZXROYW1lKCkuZXF1YWxzKFdlYlZpZXdDb3JlLlRIUkVBRF9OQU1FKSk7CiAgICAgICAgIH0KKyAgICAgICAgbUNvbnRleHQgPSBjb250ZXh0OwogICAgICAgICBtU3NsRXJyb3JIYW5kbGVyID0gbmV3IFNzbEVycm9ySGFuZGxlcigpOwogICAgICAgICBtSHR0cEF1dGhIYW5kbGVyID0gbmV3IEh0dHBBdXRoSGFuZGxlcih0aGlzKTsKIAogICAgICAgICBtUmVxdWVzdFF1ZXVlID0gbmV3IFJlcXVlc3RRdWV1ZShjb250ZXh0KTsKICAgICB9CiAKKyAgICBwcml2YXRlIGNsYXNzIFJvYW1pbmdNb25pdG9yIGV4dGVuZHMgQnJvYWRjYXN0UmVjZWl2ZXIgeworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgb25SZWNlaXZlKENvbnRleHQgY29udGV4dCwgSW50ZW50IGludGVudCkgeworICAgICAgICAgICAgaWYgKCFDb25uZWN0aXZpdHlNYW5hZ2VyLkNPTk5FQ1RJVklUWV9BQ1RJT04uZXF1YWxzKGludGVudC5nZXRBY3Rpb24oKSkpCisgICAgICAgICAgICAgICAgcmV0dXJuOworCisgICAgICAgICAgICBOZXR3b3JrSW5mbyBpbmZvID0gKE5ldHdvcmtJbmZvKWludGVudC5nZXRQYXJjZWxhYmxlRXh0cmEoQ29ubmVjdGl2aXR5TWFuYWdlci5FWFRSQV9ORVRXT1JLX0lORk8pOworICAgICAgICAgICAgaWYgKGluZm8gIT0gbnVsbCkKKyAgICAgICAgICAgICAgICBtUm9hbWluZyA9IGluZm8uaXNSb2FtaW5nKCk7CisgICAgICAgIH07CisgICAgfTsKKworICAgIHByaXZhdGUgdm9pZCBtb25pdG9yUm9hbWluZygpIHsKKyAgICAgICAgbVJvYW1pbmdNb25pdG9yID0gbmV3IFJvYW1pbmdNb25pdG9yKCk7CisgICAgICAgIEludGVudEZpbHRlciBmaWx0ZXIgPSBuZXcgSW50ZW50RmlsdGVyKCk7CisgICAgICAgIGZpbHRlci5hZGRBY3Rpb24oQ29ubmVjdGl2aXR5TWFuYWdlci5DT05ORUNUSVZJVFlfQUNUSU9OKTsKKyAgICAgICA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Wdpbk1hbmFnZXIuamF2YSBiL2NvcmUvamF2YS9hbmRyb2lkL3dlYmtpdC9QbHVnaW5NYW5hZ2VyLmphdmEKaW5kZXggZTVlZWI4Yy4uYWIzYjZkNSAxMDA2NDQKLS0tIGEvY29yZS9qYXZhL2FuZHJvaWQvd2Via2l0L1BsdWdpbk1hbmFnZXIuamF2YQorKysgYi9jb3JlL2phdmEvYW5kcm9pZC93ZWJraXQvUGx1Z2luTWFuYWdlci5qYXZhCkBAIC0xNTksNDEgKzE1OSwxMSBAQAogICAgICAgICAgICAgICAgICAgICBkaXJlY3RvcnkgPSBQTFVHSU5fU1lTVEVNX0xJQiArIHBrZ0luZm8ucGFja2FnZU5hbWU7CiAgICAgICAgICAgICAgICAgfQogCi0gICAgICAgICAgICAgICAgLy8gY2hlY2sgaWYgdGhlIHBsdWdpbiBoYXMgdGhlIHJlcXVpcmVkIHBlcm1pc3Npb25zCi0gICAgICAgICAgICAgICAgU3RyaW5nIHBlcm1pc3Npb25zW10gPSBwa2dJbmZvLnJlcXVlc3RlZFBlcm1pc3Npb25zOwotICAgICAgICAgICAgICAgIGlmIChwZXJtaXNzaW9ucyA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgLy8gY2hlY2sgaWYgdGhlIHBsdWdpbiBoYXMgdGhlIHJlcXVpcmVkIHBlcm1pc3Npb25zIGFuZAorICAgICAgICAgICAgICAgIC8vIHNpZ25hdHVyZXMKKyAgICAgICAgICAgICAgICBpZiAoIWNvbnRhaW5zUGx1Z2luUGVybWlzc2lvbkFuZFNpZ25hdHVyZXMocGtnSW5mbykpIHsKICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGJvb2xlYW4gcGVybWlzc2lvbk9rID0gZmFsc2U7Ci0gICAgICAgICAgICAgICAgZm9yIChTdHJpbmcgcGVybWl0IDogcGVybWlzc2lvbnMpIHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKFBMVUdJTl9QRVJNSVNTSU9OLmVxdWFscyhwZXJtaXQpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBwZXJtaXNzaW9uT2sgPSB0cnVlOwotICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgaWYgKCFwZXJtaXNzaW9uT2spIHsKLSAgICAgICAgICAgICAgICAgICAgY29udGludWU7Ci0gICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgLy8gY2hlY2sgdG8gZW5zdXJlIHRoZSBwbHVnaW4gaXMgcHJvcGVybHkgc2lnbmVkCi0gICAgICAgICAgICAgICAgU2lnbmF0dXJlIHNpZ25hdHVyZXNbXSA9IHBrZ0luZm8uc2lnbmF0dXJlczsKLSAgICAgICAgICAgICAgICBpZiAoc2lnbmF0dXJlcyA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBpZiAoU3lzdGVtUHJvcGVydGllcy5nZXRCb29sZWFuKCJyby5zZWN1cmUiLCBmYWxzZSkpIHsKLSAgICAgICAgICAgICAgICAgICAgYm9vbGVhbiBzaWduYXR1cmVNYXRjaCA9IGZhbHNlOwotICAgICAgICAgICAgICAgICAgICBmb3IgKFNpZ25hdHVyZSBzaWduYXR1cmUgOiBzaWduYXR1cmVzKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IFNJR05BVFVSRVMubGVuZ3RoOyBpKyspIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoU0lHTkFUVVJFU1tpXS5lcXVhbHMoc2lnbmF0dXJlKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaWduYXR1cmVNYXRjaCA9IHRydWU7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBpZiAoIXNpZ25hdHVyZU1hdGNoKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgICAgIC8vIGRldGVybWluZSB0aGUgdHlwZSBvZiBwbHVnaW4gZnJvbSB0aGUgbWFuaWZlc3QKICAgICAgICAgICAgICAgICBpZiAoc2VydmljZUluZm8ubWV0YURhdGEgPT0gbnVsbCkgewpAQCAtMjM2LDYgKzIwNiw2NCBAQAogICAgIH0KIAogICAgIC8qIHBhY2thZ2UgKi8KKyAgICBib29sZWFuIGNvbnRhaW5zUGx1Z2luUGVybWlzc2lvbkFuZFNpZ25hdHVyZXMoU3RyaW5nIHBsdWdpbkFQS05hbWUpIHsKKyAgICAgICAgUGFja2FnZU1hbmFnZXIgcG0gPSBtQ29udGV4dC5nZXRQYWNrYWdlTWFuYWdlcigpOworCisgICAgICAgIC8vIHJldHJpZXZlIGluZm9ybWF0aW9uIGZyb20gdGhlIHBsdWdpbidzIG1hbmlmZXN0CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBQYWNrYWdlSW5mbyBwa2dJbmZvID0gcG0uZ2V0UGFja2FnZUluZm8ocGx1Z2luQVBLTmFtZSwgUGFja2FnZU1hbmFnZXIuR0VUX1BFUk1JU1NJT05TCisgICAgICAgICAgICAgICAgICAgIHwgUGFja2FnZU1hbmFnZXIuR0VUX1NJR05BVFVSRVMpOworICAgICAgICAgICAgaWYgKHBrZ0luZm8gIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIHJldHVybiBjb250YWluc1BsdWdpblBlcm1pc3Npb25BbmRTaWduYXR1cmVzKHBrZ0luZm8pOworICAgICAgICAgICAgfQorICAgICAgICB9IGNhdGNoIChOYW1lTm90Rm91bmRFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgTG9nLncoTE9HVEFHLCAiQ2FuJ3QgZmluZCBwbHVnaW46ICIgKyBwbHVnaW5BUEtOYW1lKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgcHJpdmF0ZSBzdGF0aWMgYm9vbGVhbiBjb250YWluc1BsdWdpblBlcm1pc3Npb25BbmRTaWduYXR1cmVzKFBhY2thZ2VJbmZvIHBrZ0luZm8pIHsKKworICAgICAgICAvLyBjaGVjayBpZiB0aGUgcGx1Z2luIGhhcyB0aGUgcmVxdWlyZWQgcGVybWlzc2lvbnMKKyAgICAgICAgU3RyaW5nIHBlcm1pc3Npb25zW10gPSBwa2dJbmZvLnJlcXVlc3RlZFBlcm1pc3Npb25zOworICAgICAgICBpZiAocGVybWlzc2lvbnMgPT0gbnVsbCkgeworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgICAgIGJvb2xlYW4gcGVybWlzc2lvbk9rID0gZmFsc2U7CisgICAgICAgIGZvciAoU3RyaW5nIHBlcm1pdCA6IHBlcm1pc3Npb25zKSB7CisgICAgICAgICAgICBpZiAoUExVR0lOX1BFUk1JU1NJT04uZXF1YWxzKHBlcm1pdCkpIHsKKyAgICAgICAgICAgICAgICBwZXJtaXNzaW9uT2sgPSB0cnVlOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGlmICghcGVybWlzc2lvbk9rKSB7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKworICAgICAgICAvLyBjaGVjayB0byBlbnN1cmUgdGhlIHBsdWdpbiBpcyBwcm9wZXJseSBzaWduZWQKKyAgICAgICAgU2lnbmF0dXJlIHNpZ25hdHVyZXNbXSA9IHBrZ0luZm8uc2lnbmF0dXJlczsKKyAgICAgICAgaWYgKHNpZ25hdHVyZXMgPT0gbnVsbCkgeworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgICAgIGlmIChTeXN0ZW1Qcm9wZXJ0aWVzLmdldEJvb2xlYW4oInJvLnNlY3VyZSIsIGZhbHNlKSkgeworICAgICAgICAgICAgYm9vbGVhbiBzaWduYXR1cmVNYXRjaCA9IGZhbHNlOworICAgICAgICAgICAgZm9yIChTaWduYXR1cmUgc2lnbmF0dXJlIDogc2lnbmF0dXJlcykgeworICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgU0lHTkFUVVJFUy5sZW5ndGg7IGkrKykgeworICAgICAgICAgICAgICAgICAgICBpZiAoU0lHTkFUVVJFU1tpXS5lcXVhbHMoc2lnbmF0dXJlKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgc2lnbmF0dXJlTWF0Y2ggPSB0cnVlOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoIXNpZ25hdHVyZU1hdGNoKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcmV0dXJuIHRydWU7CisgICAgfQorCisgICAgLyogcGFja2FnZSAqLwogICAgIFN0cmluZyBnZXRQbHVnaW5zQVBLTmFtZShTdHJpbmcgcGx1Z2luTGliKSB7CiAKICAgICAgICAgLy8gYmFzaWMgZXJyb3IgY2hlY2tpbmcgb24gaW5wdXQgcGFyYW1zCmRpZmYgLS1naXQgYS9jb3JlL2phdmEvYW5kcm9pZC93ZWJraXQvU2VsZWN0QWN0aW9uTW9kZUNhbGxiYWNrLmphdmEgYi9jb3JlL2phdmEvYW5kcm9pZC93ZWJraXQvU2VsZWN0QWN0aW9uTW9kZUNhbGxiYWNrLmphdmEKbmV3IGZpbGUgbW9kZSAxMDA2NDQKaW5kZX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IG1vZGU7CisgICAgICAgIHJldHVybiB0cnVlOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyBib29sZWFuIG9uUHJlcGFyZUFjdGlvbk1vZGUoQWN0aW9uTW9kZSBtb2RlLCBNZW51IG1lbnUpIHsKKyAgICAgICAgcmV0dXJuIHRydWU7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIGJvb2xlYW4gb25BY3Rpb25JdGVtQ2xpY2tlZChBY3Rpb25Nb2RlIG1vZGUsIE1lbnVJdGVtIGl0ZW0pIHsKKyAgICAgICAgc3dpdGNoKGl0ZW0uZ2V0SXRlbUlkKCkpIHsKKyAgICAgICAgICAgIGNhc2UgYW5kcm9pZC5SLmlkLmNvcHk6CisgICAgICAgICAgICAgICAgbVdlYlZpZXcuY29weVNlbGVjdGlvbigpOworICAgICAgICAgICAgICAgIG1vZGUuZmluaXNoKCk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgIGNhc2UgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5pZC5zaGFyZToKKyAgICAgICAgICAgICAgICBTdHJpbmcgc2VsZWN0aW9uID0gbVdlYlZpZXcuZ2V0U2VsZWN0aW9uKCk7CisgICAgICAgICAgICAgICAgQnJvd3Nlci5zZW5kU3RyaW5nKG1XZWJWaWV3LmdldENvbnRleHQoKSwgc2VsZWN0aW9uKTsKKyAgICAgICAgICAgICAgICBtb2RlLmZpbmlzaCgpOworICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICBjYXNlIGNvbS5hbmRyb2lkLmludGVybmFsLlIuaWQuc2VsZWN0X2FsbDoKKyAgICAgICAgICAgICAgICBtV2ViVmlldy5zZWxlY3RBbGwoKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgY2FzZSBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmlkLmZpbmQ6CisgICAgICAgICAgICAgICAgU3RyaW5nIHNlbD0gb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3YXlzCisgICAgICogdXNlZCBpbiBwcmVmZXJlbmNlIHRvIGFuIGljb24gc2F2ZWQgb24gdGhlIHNlcnZlci4KICAgICAgKiBAaGlkZQogICAgICAqLwogICAgIHB1YmxpYyBTdHJpbmcgZ2V0VG91Y2hJY29uVXJsKCkgewotICAgICAgICByZXR1cm4gbVRvdWNoSWNvblVybDsKKyAgICAgICAgaWYgKG1Ub3VjaEljb25VcmxGcm9tTGluayAhPSBudWxsKSB7CisgICAgICAgICAgICByZXR1cm4gbVRvdWNoSWNvblVybEZyb21MaW5rOworICAgICAgICB9IGVsc2UgaWYgKG1Ub3VjaEljb25VcmxTZXJ2ZXJEZWZhdWx0ICE9IG51bGwpIHsKKyAgICAgICAgICAgIHJldHVybiBtVG91Y2hJY29uVXJsU2VydmVyRGVmYXVsdDsKKyAgICAgICAgfQorCisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBVUkwgdXJsID0gbmV3IFVSTChtT3JpZ2luYWxVcmwpOworICAgICAgICAgICAgbVRvdWNoSWNvblVybFNlcnZlckRlZmF1bHQgPSBuZXcgVVJMKHVybC5nZXRQcm90b2NvbCgpLCB1cmwuZ2V0SG9zdCgpLCB1cmwuZ2V0UG9ydCgpLAorICAgICAgICAgICAgICAgICAgICAiL2FwcGxlLXRvdWNoLWljb24ucG5nIikudG9TdHJpbmcoKTsKKyAgICAgICAgfSBjYXRjaCAoTWFsZm9ybWVkVVJMRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICB9CisgICAgICAgIHJldHVybiBtVG91Y2hJY29uVXJsU2VydmVyRGVmYXVsdDsKICAgICB9CiAKICAgICAvKioKQEAgLTE3MSwxMSArMTk2LDE0IEBACiAgICAgfQogCiAgICAgLyoqCi0gICAgICogU2V0IHRoZSB0b3VjaCBpY29uIHVybC4KKyAgICAgKiBTZXQgdGhlIHRvdWNoIGljb24gdXJsLiBXaWxsIG5vdCBvdmVyd3JpdGUgYW4gaWNvbiB0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mICghTG9jYWxlLlVTLmVxdWFscyhsb2NhbGUpKSB7CisgICAgICAgICAgICBpZiAoYnVmZmVyLmxlbmd0aCgpID4gMCkgeworICAgICAgICAgICAgICAgIGJ1ZmZlci5hcHBlbmQoIiwgIik7CiAgICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICAgICAgaWYgKCFsb2NhbGUuZXF1YWxzKExvY2FsZS5VUykpIHsKLSAgICAgICAgICAgIGJ1ZmZlci5hcHBlbmQoIiwgIik7Ci0gICAgICAgICAgICBqYXZhLnV0aWwuTG9jYWxlIHVzID0gTG9jYWxlLlVTOwotICAgICAgICAgICAgaWYgKHVzLmdldExhbmd1YWdlKCkgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIGJ1ZmZlci5hcHBlbmQodXMuZ2V0TGFuZ3VhZ2UoKSk7Ci0gICAgICAgICAgICAgICAgZmluYWwgU3RyaW5nIGNvdW50cnkgPSB1cy5nZXRDb3VudHJ5KCk7Ci0gICAgICAgICAgICAgICAgaWYgKGNvdW50cnkgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICBidWZmZXIuYXBwZW5kKCItIik7Ci0gICAgICAgICAgICAgICAgICAgIGJ1ZmZlci5hcHBlbmQoY291bnRyeSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQorICAgICAgICAgICAgYnVmZmVyLmFwcGVuZChBQ0NFUFRfTEFOR19GT1JfVVNfTE9DQUxFKTsKICAgICAgICAgfQogCiAgICAgICAgIHJldHVybiBidWZmZXIudG9TdHJpbmcoKTsKICAgICB9Ci0gICAgCisKKyAgICAvKioKKyAgICAgKiBDb252ZXJ0IG9ic29sZXRlIGxhbmd1YWdlIGNvZGVzLCBpbmNsdWRpbmcgSGVicmV3L0luZG9uZXNpYW4vWWlkZGlzaCwKKyAgICAgKiB0byBuZXcgc3RhbmRhcmQuCisgICAgICovCisgICAgcHJpdmF0ZSBzdGF0aWMgU3RyaW5nIGNvbnZlcnRPYnNvbGV0ZUxhbmd1YWdlQ29kZVRvTmV3KFN0cmluZyBsYW5nQ29kZSkgeworICAgICAgICBpZiAobGFuZ0NvZGUgPT0gbnVsbCkgeworICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgIH0KKyAgICAgICAgaWYgKCJpdyIuZXF1YWxzKGxhbmdDb2RlKSkgeworICAgICAgICAgICAgLy8gSGVicmV3CisgICAgICAgICAgICByZXR1cm4gImhlIjsKKyAgICAgICAgfSBlbHNlIGlmICgiaW4iLmVxdWFscyhsYW5nQ29kZSkpIHsKKyAgICAgICAgICAgIC8vIEluZG9uZXNpYW4KKyAgICAgICAgICAgIHJldHVybiAiaWQiOworICAgICAgICB9IGVsc2UgaWYgKCJqaSIuZXF1YWxzKGxhbmdDb2RlKSkgeworICAgICAgICAgICAgLy8gWWlkZGlzaAorICAgICAgICAgICAgcmV0dXJuICJ5aSI7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGxhbmdDb2RlOworICAgIH0KKworICAgIHByaXZhdGUgc3RhdGljIHZvaWQgYWRkTG9jYWxlVG9IdHRwQWNjZXB0TGFuZ3VhZ2UoU3RyaW5nQnVpbGRlciBidWlsZGVyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTG9jYWxlIGxvY2FsZSkgeworICAgICAgICBTdHJpbmcgbGFuZ3VhZ2UgPSBjb252ZXJ0T2Jzb2xldGVMYW5ndWFnZUNvZGVUb05ldyhsb2NhbGUuZ2V0TGFuZ3VhZ2UoKSk7CisgICAgICAgIGlmIChsYW5ndWFnZSAhPSBudWxsKSB7CisgICAgICAgICAgICBidWlsZGVyLmFwcGVuZChsYW5ndWFnZSk7CisgICAgICAgICAgICBTdHJpbmcgY291bnRyeSA9IGxvY2FsZS5nZXRDb3VudHJ5KCk7CisgICAgICAgICAgICBpZiAoY291bnRyeSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQoIi0iKTsKKyAgICAgICAgICAgICAgICBidWlsZGVyLmFwcGVuZChjb3VudHJ5KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKwogICAgIC8qKgogICAgICAqIExvb2tzIGF0IHNMb2NhbGUgYW5kIG1Db250ZXh0IGFuZCByZXR1cm5zIGN1cnJlbnQgVXNlckFnZW50IFN0cmluZy4KICAgICAgKiBAcmV0dXJuIEN1cnJlbnQgVXNlckFnZW50IFN0cmluZy4KQEAgLTM4MCwxMSArNDE1LDExIEBACiAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAvLyBkZWZhdWx0IHRvICIxLjAiCiAgICAgICAgICAgICBidWZmZXIuYXBwZW5kKCIxLjAiKTsKLSAgICAgICAgfSAgCisgICAgICAgIH0KICAgICAgICAgYnVmZmVyLmFwcGVuZCgiOyAiKTsKICAgICAgICAgZmluYWwgU3RyaW5nIGxhbmd1YWdlID0gbG9jYWxlLmdldExhbmd1YWdlKCk7CiAgICAgICAgIGlmIChsYW5ndWFnZSAhPSBudWxsKSB7Ci0gICAgICAgICAgICBidWZmZXIuYXBwZW5kKGxhbmd1YWdlLnRvTG93ZXJDYXNlKCkpOworICAgICAgICAgICAgYnVmZmVyLmFwcGVuZChjb252ZXJ0T2Jzb2xldGVMYW5ndWFnZUNvZGVUb05ldyhsYW5ndWFnZSkpOwogICAgICAgICAgICAgZmluYWwgU3RyaW5nIGNvdW50cnkgPSBsb2NhbGUuZ2V0Q291bnRyeSgpOwogICAgICAgICAgICAgaWYgKGNvdW50cnkgIT0gbnVsbCkgewogICAgICAgICAgICAgICAgIGJ1ZmZlci5hcHBlbmQoIi0iKTsKQEAgLTQwNywxMSArNDQyLDEzIEBACiAgICAgICAgICAgICBidWZmZXIuYXBwZW5kKCIgQnVpbGQvIik7CiAgICAgICAgICAgICBidWZmZXIuYXBwZW5kKGlkKTsKICAgICAgICAgfQorICAgICAgICBTdHJpbmcgbW9iaWxlID0gbUNvbnRleHQuZ2V0UmVzb3VyY2Vz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ZyBvbmx5LCB1c2UgbUxpZ2h0VG91Y2hFbmFibGVkIGZvciBtU3VwcG9ydFRvdW5jaE9ubHkKKyAgICAgICAgcmV0dXJuIG1MaWdodFRvdWNoRW5hYmxlZDsKKyAgICB9CisKKyAgICAvKioKICAgICAgKiBTZXQgd2hldGhlciB0aGUgV2ViVmlldyBzdXBwb3J0cyB6b29tCiAgICAgICovCiAgICAgcHVibGljIHZvaWQgc2V0U3VwcG9ydFpvb20oYm9vbGVhbiBzdXBwb3J0KSB7CkBAIC00NDgsMTQgKzUwMCwzNCBAQAogICAgICAgICBtQnVpbHRJblpvb21Db250cm9scyA9IGVuYWJsZWQ7CiAgICAgICAgIG1XZWJWaWV3LnVwZGF0ZU11bHRpVG91Y2hTdXBwb3J0KG1Db250ZXh0KTsKICAgICB9Ci0gICAgCisKICAgICAvKioKICAgICAgKiBSZXR1cm5zIHRydWUgaWYgdGhlIHpvb20gbWVjaGFuaXNtIGJ1aWx0IGludG8gV2ViVmlldyBpcyBiZWluZyB1c2VkLgogICAgICAqLwogICAgIHB1YmxpYyBib29sZWFuIGdldEJ1aWx0SW5ab29tQ29udHJvbHMoKSB7CiAgICAgICAgIHJldHVybiBtQnVpbHRJblpvb21Db250cm9sczsKICAgICB9Ci0gICAgCisKKyAgICAvKioKKyAgICAgKiBTZXRzIHdoZXRoZXIgdGhlIG9uIHNjcmVlbiB6b29tIGJ1dHRvbnMgYXJlIHVzZWQuCisgICAgICogQSBjb21iaW5hdGlvbiBvZiBidWlsdCBpbiB6b29tIGNvbnRyb2xzIGVuYWJsZWQKKyAgICAgKiBhbmQgb24gc2NyZWVuIHpvb20gY29udHJvbHMgZGlzYWJsZWQgYWxsb3dzIGZvciBwaW5jaCB0byB6b29tCisgICAgICogdG8gd29yayB3aXRob3V0IHRoZSBvbiBzY3JlZW4gY29udHJvbHMKKyAgICAgKiBAaGlkZQorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNldERpc3BsYXlab29tQ29udHJvbHMoYm9vb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IGJvb2xlYW4gZW5hYmxlU21vb3RoVHJhbnNpdGlvbigpIHsKKyAgICAgICAgcmV0dXJuIG1FbmFibGVTbW9vdGhUcmFuc2l0aW9uOwogICAgIH0KIAogICAgIC8qKgpAQCAtMTAwMiw4ICsxMDc2LDggQEAKIAogICAgIHByaXZhdGUgdm9pZCB2ZXJpZnlOZXR3b3JrQWNjZXNzKCkgewogICAgICAgICBpZiAoIW1CbG9ja05ldHdvcmtMb2FkcykgewotICAgICAgICAgICAgaWYgKG1Db250ZXh0LmNoZWNrUGVybWlzc2lvbigiYW5kcm9pZC5wZXJtaXNzaW9uLklOVEVSTkVUIiwgCi0gICAgICAgICAgICAgICAgICAgIGFuZHJvaWQub3MuUHJvY2Vzcy5teVBpZCgpLCBhbmRyb2lkLm9zLlByb2Nlc3MubXlVaWQoKSkgIT0gCisgICAgICAgICAgICBpZiAobUNvbnRleHQuY2hlY2tQZXJtaXNzaW9uKCJhbmRyb2lkLnBlcm1pc3Npb24uSU5URVJORVQiLAorICAgICAgICAgICAgICAgICAgICBhbmRyb2lkLm9zLlByb2Nlc3MubXlQaWQoKSwgYW5kcm9pZC5vcy5Qcm9jZXNzLm15VWlkKCkpICE9CiAgICAgICAgICAgICAgICAgICAgICAgICBQYWNrYWdlTWFuYWdlci5QRVJNSVNTSU9OX0dSQU5URUQpIHsKICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgU2VjdXJpdHlFeGNlcHRpb24KICAgICAgICAgICAgICAgICAgICAgICAgICgiUGVybWlzc2lvbiBkZW5pZWQgLSAiICsKQEAgLTEwMjksNiArMTEwMyw3IEBACiAgICAgICogQGRlcHJlY2F0ZWQgVGhpcyBtZXRob2QgaGFzIGJlZW4gZGVwcmVjYXRlZCBpbiBmYXZvciBvZgogICAgICAqICAgICAgICAgICAgIHtAbGluayAjc2V0UGx1Z2luU3RhdGV9CiAgICAgICovCisgICAgQERlcHJlY2F0ZWQKICAgICBwdWJsaWMgc3luY2hyb25pemVkIHZvaWQgc2V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BsdWdpbnNFbmFibGVkKCkgewogICAgICAgICByZXR1cm4gbVBsdWdpblN0YXRlID09IFBsdWdpblN0YXRlLk9OOwogICAgIH0KQEAgLTEyODQsNyArMTM3Miw3IEBACiAgICAgcHVibGljIHN5bmNocm9uaXplZCB2b2lkIHNldFVzZXJBZ2VudFN0cmluZyhTdHJpbmcgdWEpIHsKICAgICAgICAgaWYgKHVhID09IG51bGwgfHwgdWEubGVuZ3RoKCkgPT0gMCkgewogICAgICAgICAgICAgc3luY2hyb25pemVkKHNMb2NrRm9yTG9jYWxlU2V0dGluZ3MpIHsKLSAgICAgICAgICAgICAgICBMb2NhbGUgY3VycmVudExvY2FsZSA9IExvY2FsZS5nZXREZWZhdWx0KCk7IAorICAgICAgICAgICAgICAgIExvY2FsZSBjdXJyZW50TG9jYWxlID0gTG9jYWxlLmdldERlZmF1bHQoKTsKICAgICAgICAgICAgICAgICBpZiAoIXNMb2NhbGUuZXF1YWxzKGN1cnJlbnRMb2NhbGUpKSB7CiAgICAgICAgICAgICAgICAgICAgIHNMb2NhbGUgPSBjdXJyZW50TG9jYWxlOwogICAgICAgICAgICAgICAgICAgICBtQWNjZXB0TGFuZ3VhZ2UgPSBnZXRDdXJyZW50QWNjZXB0TGFuZ3VhZ2UoKTsKQEAgLTEzMzksMTEgKzE0MjcsMTEgQEAKICAgICAgICAgfQogICAgICAgICByZXR1cm4gbUFjY2VwdExhbmd1YWdlOwogICAgIH0KLSAgICAKKwogICAgIC8qKgogICAgICAqIFRlbGwgdGhlIFdlYlZpZXcgd2hldGhlciBpdCBuZWVkcyB0byBzZXQgYSBub2RlIHRvIGhhdmUgZm9jdXMgd2hlbgogICAgICAqIHtAbGluayBXZWJWaWV3I3JlcXVlc3RGb2N1cyhpbnQsIGFuZHJvaWQuZ3JhcGhpY3MuUmVjdCl9IGlzIGNhbGxlZC4KLSAgICAgKiAKKyAgICAgKgogICAgICAqIEBwYXJhbSBmbGFnCiAgICAgICovCiAgICAgcHVibGljIHZvaWQg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MSBAQAogICAgICAgICB9CiAgICAgIH0KIAorICAgIC8qKgorICAgICAqIFNwZWNpZnkgdGhlIG1heGltdW0gZGVjb2RlZCBpbWFnZSBzaXplLiBUaGUgZGVmYXVsdCBpcworICAgICAqIDIgbWVncyBmb3Igc21hbGwgbWVtb3J5IGRldmljZXMgYW5kIDggbWVncyBmb3IgbGFyZ2UgbWVtb3J5IGRldmljZXMuCisgICAgICogQHBhcmFtIHNpemUgVGhlIG1heGltdW0gZGVjb2RlZCBzaXplLCBvciB6ZXJvIHRvIHNldCB0byB0aGUgZGVmYXVsdC4KKyAgICAgKiBAaGlkZSBwZW5kaW5nIGFwaSBjb3VuY2lsIGFwcHJvdmFsCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0TWF4aW11bURlY29kZWRJbWFnZVNpemUobG9uZyBzaXplKSB7CisgICAgICAgIGlmIChtTWF4aW11bURlY29kZWRJbWFnZVNpemUgIT0gc2l6ZSkgeworICAgICAgICAgICAgbU1heGltdW1EZWNvZGVkSW1hZ2VTaXplID0gc2l6ZTsKKyAgICAgICAgICAgIHBvc3RTeW5jKCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZXR1cm5zIHdoZXRoZXIgdG8gdXNlIGZpeGVkIHZpZXdwb3J0LgorICAgICAqLworICAgIC8qIHBhY2thZ2UgKi8gYm9vbGVhbiBnZXRVc2VGaXhlZFZpZXdwb3J0KCkgeworICAgICAgICByZXR1cm4gbVVzZUZpeGVkVmlld3BvcnQ7CisgICAgfQorCisgICAgLyoqCisgICAgICogUmV0dXJucyB3aGV0aGVyIHByaXZhdGUgYnJvd3NpbmcgaXMgZW5hYmxlZC4KKyAgICAgKi8KKyAgICAvKiBwYWNrYWdlICovIGJvb2xlYW4gaXNQcml2YXRlQnJvd3NpbmdFbmFibGVkKCkgeworICAgICAgICByZXR1cm4gbVByaXZhdGVCcm93c2luZ0VuYWJsZWQ7CisgICAgfQorCisgICAgLyoqCisgICAgICogU2V0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RhdGVDYWNoZWRUZXh0ZmllbGQoKTsKKyAgICAgICAgICAgICAgICBpZiAobUdvdERlbGV0ZSkgeworICAgICAgICAgICAgICAgICAgICBtR290RGVsZXRlID0gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgIGludCBvbGRFbmQgPSBzdGFydCArIGJlZm9yZTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKG1EZWxTZWxFbmQgPT0gb2xkRW5kCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgJiYgKG1EZWxTZWxTdGFydCA9PSBzdGFydAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHx8IChtRGVsU2VsU3RhcnQgPT0gb2xkRW5kICYmIGJlZm9yZSA9PSAxKSkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIElmIHRoZSBzZWxlY3Rpb24gaXMgc2V0IHVwIHByb3Blcmx5IGJlZm9yZSB0aGUKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIGRlbGV0ZSwgc2VuZCB0aGUgRE9NIGV2ZW50cy4KKyAgICAgICAgICAgICAgICAgICAgICAgIHNlbmREb21FdmVudChuZXcgS2V5RXZlbnQoS2V5RXZlbnQuQUNUSU9OX0RPV04sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEtleUV2ZW50LktFWUNPREVfREVMKSk7CisgICAgICAgICAgICAgICAgICAgICAgICBzZW5kRG9tRXZlbnQobmV3IEtleUV2ZW50KEtleUV2ZW50LkFDVElPTl9VUCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgS2V5RXZlbnQuS0VZQ09ERV9ERUwpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAvLyBUaGlzIHdhcyBzaW1wbHkgYSBkZWxldGUgb3IgYSBjdXQsIHNvIGp1c3QgZGVsZXRlIHRoZQogICAgICAgICAgICAgICAgIC8vIHNl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RlYnVnIG9ubHkKKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBib29sZWFuIERFQlVHX1RPVUNIX0hJR0hMSUdIVCA9IHRydWU7CisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IFRPVUNIX0hJR0hMSUdIVF9FTEFQU0VfVElNRSA9IDIwMDA7CisgICAgcHJpdmF0ZSBQYWludCBtVG91Y2hDcm9zc0hhaXJDb2xvcjsKKyAgICBwcml2YXRlIGludCBtVG91Y2hIaWdobGlnaHRYOworICAgIHByaXZhdGUgaW50IG1Ub3VjaEhpZ2hsaWdodFk7CiAKICAgICAvKgogICAgICAqIFByaXZhdGUgbWVzc2FnZSBpZHMKQEAgLTYxMyw3ICs1ODIsNyBAQAogICAgIHN0YXRpYyBmaW5hbCBpbnQgV0VCQ09SRV9JTklUSUFMSVpFRF9NU0dfSUQgICAgICAgICA9IDEwNzsKICAgICBzdGF0aWMgZmluYWwgaW50IFVQREFURV9URVhURklFTERfVEVYVF9NU0dfSUQgICAgICAgPSAxMDg7CiAgICAgc3RhdGljIGZpbmFsIGludCBVUERBVEVfWk9PTV9SQU5HRSAgICAgICAgICAgICAgICAgID0gMTA5OwotICAgIHN0YXRpYyBmaW5hbCBpbnQgTU9WRV9PVVRfT0ZfUExVR0lOICAgICAgICAgICAgICAgICA9IDExMDsKKyAgICBzdGF0aWMgZmluYWwgaW50IFVOSEFORExFRF9OQVZfS0VZICAgICAgICAgICAgICAgICAgPSAxMTA7CiAgICAgc3RhdGljIGZpbmFsIGludCBDTEVBUl9URVhUX0VOVFJZICAgICAgICAgICAgICAgICAgID0gMTExOwogICAgIHN0YXRpYyBmaW5hbCBpbnQgVVBEQVRFX1RFWFRfU0VMRUNUSU9OX01TR19JRCAgICAgICA9IDExMjsKICAgICBzdGF0aWMgZmluYWwgaW50IFNIT1dfUkVDVF9NU0dfSUQgICAgICAgICAgICAgICAgICAgPSAxMTM7CkBAIC02MjcsMTYgKzU5NiwxOSBAQAogICAgIHN0YXRpYyBmaW5hbCBpbnQgU0hPV19GVUxMU0NSRUVOICAgICAgICAgICAgICAgICAgICA9IDEyMDsKICAgICBzdGF0aWMgZmluYWwgaW50IEhJREVfRlVMTFNDUkVFTiAgICAgICAgICAgICAgICAgICAgPSAxMjE7CiAgICAgc3RhdGljIGZpbmFsIGludCBET01fRk9DVVNfQ0hBTkdFRCAgICAgICAgICAgICAgICAgID0gMTIyOwotICAgIHN0YXRpYyBmaW5hbCBpbnQgSU1NRURJQVRFX1JFUEFJTlRfTVNHX0lEICAgICAgICAgICA9IDEyMzsKLSAgICBzdGF0aWMgZmluYWwgaW50IFNFVF9ST09UX0xBWUVSX01TR19JRCAgICAgICAgICAgICAgPSAxMjQ7CisgICAgc3RhdGljIGZpbmFsIGludCBSRVBMQUNFX0JBU0VfQ09OVEVOVCAgICAgICAgICAgICAgID0gMTIzOworICAgIC8vIDEyNDsKICAgICBzdGF0aWMgZmluYWwgaW50IFJFVFVSTl9MQUJFTCAgICAgICAgICAgICAgICAgICAgICAgPSAxMjU7CiAgICAgc3RhdGljIGZpbmFsIGludCBGSU5EX0FHQUlOICAgICAgICAgICAgICAgICAgICAgICAgID0gMTI2OwogICAgIHN0YXRpYyBmaW5hbCBpbnQgQ0VOVEVSX0ZJVF9SRUNUICAgICAgICAgICAgICAgICAgICA9IDEyNzsKICAgICBzdGF0aWMgZmluYWwgaW50IFJFUVVFU1RfS0VZQk9BUkRfV0lUSF9TRUxFQ1RJT05fTVNHX0lEID0gMTI4OwogICAgIHN0YXRpYyBmaW5hbCBpbnQgU0VUX1NDUk9MTEJBUl9NT0RFUyAgICAgICAgICAgICAgICA9IDEyOTsKKyAgICBzdGF0aWMgZmluYWwgaW50IFNFTEVDVElPTl9TVFJJTkdfQ0hBTkdFRCAgICAgICAgICAgPSAxMzA7CisgICAgc3RhdGljIGZpbmFsIGludCBTRVRfVE9VQ0hfSElHSExJR0hUX1JFQ1RTICAgICAgICAgID0gMTMxOworICAgIHN0YXRpYyBmaW5h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EgQEAKICAgICAgICAgIlNIT1dfRlVMTFNDUkVFTiIsIC8vICAgICAgICAgICAgICAgID0gMTIwOwogICAgICAgICAiSElERV9GVUxMU0NSRUVOIiwgLy8gICAgICAgICAgICAgICAgPSAxMjE7CiAgICAgICAgICJET01fRk9DVVNfQ0hBTkdFRCIsIC8vICAgICAgICAgICAgICA9IDEyMjsKLSAgICAgICAgIklNTUVESUFURV9SRVBBSU5UX01TR19JRCIsIC8vICAgICAgID0gMTIzOwotICAgICAgICAiU0VUX1JPT1RfTEFZRVJfTVNHX0lEIiwgLy8gICAgICAgICAgPSAxMjQ7CisgICAgICAgICJSRVBMQUNFX0JBU0VfQ09OVEVOVCIsIC8vICAgICAgICAgICA9IDEyMzsKKyAgICAgICAgIjEyNCIsIC8vICAgICAgICAgICAgICAgICAgICAgICAgICAgID0gMTI0OwogICAgICAgICAiUkVUVVJOX0xBQkVMIiwgLy8gICAgICAgICAgICAgICAgICAgPSAxMjU7CiAgICAgICAgICJGSU5EX0FHQUlOIiwgLy8gICAgICAgICAgICAgICAgICAgICA9IDEyNjsKICAgICAgICAgIkNFTlRFUl9GSVRfUkVDVCIsIC8vICAgICAgICAgICAgICAgID0gMTI3OwogICAgICAgICAiUkVRVUVTVF9LRVlCT0FSRF9XSVRIX1NFTEVDVElPTl9NU0dfSUQiLCAvLyA9IDEyODsKLSAgICAgICAgIlNFVF9TQ1JPTExCQVJfTU9ERVMiIC8vICAgICAgICAgICAgID0gMTI5OworICAgICAgICAiU0VUX1NDUk9MTEJBUl9NT0RFUyIsIC8vICAgICAgICAgICAgPSAxMjk7CisgICAgICAgICJTRUxFQ1RJT05fU1RSSU5HX0NIQU5HRUQiLCAvLyAgICAgICA9IDEzMDsKKyAgICAgICAgIlNFVF9UT1VDSF9ISUdITElHSFRfUkVDVFMiLCAvLyAgICAgID0gMTMxOworICAgICAgICAiU0FWRV9XRUJBUkNISVZFX0ZJTklTSEVEIiAvLyAgICAgICAgPSAxMzI7CiAgICAgfTsKIAog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0gICAgICAgICAgICAgICAgc3dpdGNoT3V0RHJhd0hpc3RvcnkoKTsKLSAgICAgICAgICAgICAgICAvLyBCcmluZyBiYWNrIHRoZSBoaWRkZW4gem9vbSBjb250cm9scy4KLSAgICAgICAgICAgICAgICBtWm9vbUJ1dHRvbnNDb250cm9sbGVyLmdldFpvb21Db250cm9scygpLnNldFZpc2liaWxpdHkoCi0gICAgICAgICAgICAgICAgICAgICAgICBWaWV3LlZJU0lCTEUpOwotICAgICAgICAgICAgICAgIHVwZGF0ZVpvb21CdXR0b25zRW5hYmxlZCgpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIHZvaWQgb25ab29tKGJvb2xlYW4gem9vbUluKSB7Ci0gICAgICAgICAgICBpZiAoem9vbUluKSB7Ci0gICAgICAgICAgICAgICAgem9vbUluKCk7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIHpvb21PdXQoKTsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgdXBkYXRlWm9vbUJ1dHRvbnNFbmFibGVkKCk7Ci0gICAgICAgIH0KLSAgICB9OwotCiAgICAgLyoqCiAgICAgICogQ29uc3RydWN0IGEgbmV3IFdlYlZpZXcgd2l0aCBhIENvbnRleHQgb2JqZWN0LgogICAgICAqIEBwYXJhbSBjb250ZXh0IEEgQ29udGV4dCBvYmplY3QgdXNlZCB0byBhY2Nlc3MgYXBwbGljYXRpb24gYXNzZXRzLgpAQCAtOTQ1LDcgKzgzNSwxOCBAQAogICAgICAqIEBwYXJhbSBkZWZTdHlsZSBUaGUgZGVmYXVsdCBzdHlsZSByZXNvdXJjZSBJRC4KICAgICAgKi8KICAgICBwdWJsaWMgV2ViVmlldyhDb250ZXh0IGNvbnRleHQsIEF0dHJpYnV0ZVNldCBhdHRycywgaW50IGRlZlN0eWxlKSB7Ci0gICAgICAgIHRoaXMoY29udGV4dCwgYXR0cnMsIGRlZlN0eWxlLCBudWxsKTsKKyAgICAg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A9IG5ldyBWaWV3TWFuYWdlcih0aGlzKTsKICAgICAgICAgbVdlYlZpZXdDb3JlID0gbmV3IFdlYlZpZXdDb3JlKGNvbnRleHQsIHRoaXMsIG1DYWxsYmFja1Byb3h5LCBqYXZhc2NyaXB0SW50ZXJmYWNlcyk7CiAgICAgICAgIG1EYXRhYmFzZSA9IFdlYlZpZXdEYXRhYmFzZS5nZXRJbnN0YW5jZShjb250ZXh0KTsKLSAgICAgICAgbVNjcm9sbGVyID0gbmV3IE92ZXJTY3JvbGxlcihjb250ZXh0KTsKKyAgICAgICAgbVNjcm9sbGVyID0gbmV3IFNjcm9sbGVyKGNvbnRleHQpOworICAgICAgICBtWm9vbU1hbmFnZXIgPSBuZXcgWm9vbU1hbmFnZXIodGhpcywgbUNhbGxiYWNrUHJveHkpOwogCisgICAgICAgIC8qIFRoZSBpbml0IG1ldGhvZCBtdXN0IGZvbGxvdyB0aGUgY3JlYXRpb24gb2YgY2VydGFpbiBtZW1iZXIgdmFyaWFibGVzLAorICAgICAgICAgKiBzdWNoIGFzIHRoZSBtWm9vbU1hbmFnZXIuCisgICAgICAgICAqLworICAgICAgICBpbml0KCk7CisgICAgICAgIHNldHVwUGFja2FnZUxpc3RlbmVyKGNvbnRleHQpOwogICAgICAgICB1cGRhdGVNdWx0aVRvdWNoU3VwcG9ydChjb250ZXh0KTsKKworICAgICAgICBpZiAocHJpdmF0ZUJyb3dzaW5nKSB7CisgICAgICAgICAgICBzdGFydFByaXZhdGVCcm93c2luZygpOworICAgICAgICB9CisgICAgfQorCisgICAgLyoKKyAgICAgKiBUaGUgaW50ZW50IHJlY2VpdmVyIHRoYXQgbW9uaXRvcnMgZm9yIGNoYW5nZXMgdG8gcmVsZXZhbnQgcGFja2FnZXMgKGUuZy4sCisgICAgICogc0dvb2dsZUFwcHMpIGFuZCBub3RpZmllcyBXZWJWaWV3Q29yZSBvZiB0aGVpciBleGlzdGVuY2UuCisgICAgICovCisgICAgcHJpdmF0ZSBzdGF0aWMgQ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Rpb25SZWNlaXZlciAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBJbnRlbnRGaWx0ZXIgZmlsdGVyID0gbmV3IEludGVudEZpbHRlcihJbnRlbnQuQUNUSU9OX1BBQ0tBR0VfQURERUQpOworICAgICAgICAgICAgZmlsdGVyLmFkZEFjdGlvbihJbnRlbnQuQUNUSU9OX1BBQ0tBR0VfUkVNT1ZFRCk7CisgICAgICAgICAgICBmaWx0ZXIuYWRkRGF0YVNjaGVtZSgicGFja2FnZSIpOworICAgICAgICAgICAgc1BhY2thZ2VJbnN0YWxsYXRpb25SZWNlaXZlciA9IG5ldyBCcm9hZGNhc3RSZWNlaXZlcigpIHsKKworICAgICAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIG9uUmVjZWl2ZShDb250ZXh0IGNvbnRleHQsIEludGVudCBpbnRlbnQpIHsKKyAgICAgICAgICAgICAgICAgICAgZmluYWwgU3RyaW5nIGFjdGlvbiA9IGludGVudC5nZXRBY3Rpb24oKTsKKyAgICAgICAgICAgICAgICAgICAgZmluYWwgU3RyaW5nIHBhY2thZ2VOYW1lID0gaW50ZW50LmdldERhdGEoKS5nZXRTY2hlbWVTcGVjaWZpY1BhcnQoKTsKKyAgICAgICAgICAgICAgICAgICAgZmluYWwgYm9vbGVhbiByZXBsYWNpbmcgPSBpbnRlbnQuZ2V0Qm9vbGVhbkV4dHJhKEludGVudC5FWFRSQV9SRVBMQUNJTkcsIGZhbHNlKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKEludGVudC5BQ1RJT05fUEFDS0FHRV9SRU1PVkVELmVxdWFscyhhY3Rpb24pICYmIHJlcGxhY2luZykgeworICAgICAgICAgICAgICAgICAgICAgICAgLy8gaWYgaXQgaXMgcmVwbGFjaW5nLCByZWZyZXNoUGx1Z2lucygpIHdoZW4gYWRkaW5nCisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICBpZiAoc0dvb2dsZUFwcHMuY29udGFpbnMocGFja2FnZU5hbWUpICYmIG1XZWJWaWV3Q29yZSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoSW50ZW50LkFDVElPTl9QQUNLQUdFX0FEREVELmVxdWFscyhhY3Rpb24pKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVdlYlZpZXdDb3JlLnNlbmRNZXNzYWdlKEV2ZW50SHViLkFERF9QQUNLQUdFX05BTUUsIHBhY2thZ2VOYW1lKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVdlYlZpZXdDb3JlLnNlbmRNZXNzYWdlKEV2ZW50SHViLlJFTU9WRV9QQUNLQUdFX05BTUUsIHBhY2thZ2VOYW1lKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIFBsdWdpbk1hbmFnZXIgcG0gPSBQbHVnaW5NYW5hZ2VyLmdldEluc3RhbmNlKGNvbnRleHQpOworICAgICAgICAgICAgICAgICAgICBpZiAocG0uY29udGFpbnNQbHVnaW5QZXJtaXNzaW9uQW5kU2lnbmF0dXJlcyhwYWNrYWdlTmFtZSkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHBtLnJlZnJlc2hQbHVnaW5zKEludGVudC5BQ1RJT05fUEFDS0FHRV9BRERFRC5lcXVhbHMoYWN0aW9uKSk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9OworCisgICAgICAgICAgICBjb250ZXh0LmdldEFwcGxpY2F0aW9uQ29udGV4dCgpLnJlZ2lzdGVyUmVjZWl2ZXIoc1BhY2thZ2VJbnN0YWxsYXRpb25SZWNlaXZlciwgZmlsdGVyKTsKKyAgICAgICAgfQorCisgICAgICAgIC8vIGNoZWNrIGlmIGFueSBvZiB0aGUgbW9uaXRvcmVkIGFwcHMgYXJlIGFscmVhZHkgaW5zdGFsbGVkCisgICAgICAgIEFzeW5jVGFzazxWb2lkLCBWb2lkLCBTZXQ8U3RyaW5nPj4gdGFzayA9IG5ldyBBc3luY1Rhc2s8Vm9pZCwgVm9pZCwgU2V0PFN0cmluZz4+KCkgeworCisgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgIHByb3RlY3RlZCBTZXQ8U3RyaW5nPiBkb0luQmFja2dyb3VuZChWb2lkLi4uIHVudXNlZCkgeworICAgICAgICAgICAgICAgIFNldDxTdHJpbmc+IGluc3RhbGxlZFBhY2thZ2VzID0gbmV3IEhhc2hTZXQ8U3RyaW5nPigpOworICAgICAgICAgICAgICAgIFBhY2thZ2VNYW5hZ2VyIHBtID0gbUNvbnRleHQuZ2V0UGFja2FnZU1hbmFnZXIoKTsKKyAgICAgICAgICAgICAgICBMaXN0PFBhY2thZ2VJbmZvPiBwYWNrYWdlcyA9IHBtLmdldEluc3RhbGxlZFBhY2thZ2VzKDApOworICAgICAgICAgICAgICAgIGZvciAoUGFja2FnZUluZm8gcCA6IHBhY2thZ2VzKSB7CisgICAgICAgICAgICAgICAgICAgIGlmIChzR29vZ2xlQXBwcy5jb250YWlucyhwLnBhY2thZ2VOYW1lKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgaW5zdGFsbGVkUGFja2FnZXMuYWRkKHAucGFja2FnZU5hbWUpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHJldHVybiBpbnN0YWxsZWRQYWNrYWdlczsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLy8gRXhlY3V0ZXMgb24gdGhlIFVJIHRocmVhZAorICAgICAgICAgICAgQE92ZXJyaWRlCisgICAgICAgICAgICBwcm90ZWN0ZWQgdm9pZCB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ICAgICByZXR1cm5MaXN0LnNldEN1cnJlbnRJbmRleChpbmRleCk7CiAgICAgICAgICAgICB9CisgICAgICAgICAgICAvLyBSZXN0b3JlIHByaXZhdGUgYnJvd3Npbmcgc2V0dGluZy4KKyAgICAgICAgICAgIGlmIChpblN0YXRlLmdldEJvb2xlYW4oInByaXZhdGVCcm93c2luZ0VuYWJsZWQiKSkgeworICAgICAgICAgICAgICAgIGdldFNldHRpbmdzKCkuc2V0UHJpdmF0ZUJyb3dzaW5nRW5hYmxlZCh0cnVlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1ab29tTWFuYWdlci5yZXN0b3JlWm9vbVN0YXRlKGluU3RhdGUpOwogICAgICAgICAgICAgLy8gUmVtb3ZlIGFsbCBwZW5kaW5nIG1lc3NhZ2VzIGJlY2F1c2Ugd2UgYXJlIHJlc3RvcmluZyBwcmV2aW91cwogICAgICAgICAgICAgLy8gc3RhdGUuCiAgICAgICAgICAgICBtV2ViVmlld0NvcmUucmVtb3ZlTWVzc2FnZXMoKTsKQEAgLTE2MDEsNyArMTU2OCw3IEBACiAgICAgICAgIGFyZy5tVXJsID0gdXJsOwogICAgICAgICBhcmcubUV4dHJhSGVhZGVycyA9IGV4dHJhSGVhZGVyczsKICAgICAgICAgbVdlYlZpZXdDb3JlLnNlbmRNZXNzYWdlKEV2ZW50SHViLkxPQURfVVJMLCBhcmcpOwotICAgICAgICBjbGVhclRleHRFbnRyeShmYWxzZSk7CisgICAgICAgIGNsZWFyVGV4dEVudHJ5KCk7CiAgICAgfQogCiAgICAgLyoqCkBAIC0xNjMwLDcgKzE1OTcsNyBAQAogICAgICAgICAgICAgYXJnLm1VcmwgPSB1cmw7CiAgICAgICAgICAgICBhcmcubVBvc3REYXRhID0gcG9zdERhdGE7CiAgICAgICAgICAgICBtV2ViVmlld0NvcmUuc2VuZE1lc3NhZ2UoRXZlbnRIdWIuUE9TVF9VUkwsIGFyZyk7Ci0gICAgICAgICAgICBjbGVhclRleHRFbnRyeShmYWxzZSk7CisgICAgICAgICAgICBjbGVhclRleHRFbnRyeSgpOwogICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgbG9hZFVybCh1cmwpOwogICAgICAgICB9CkBAIC0xNjg2LDcgKzE2NTMsNDYgQEAKICAgICAgICAgYXJnLm1FbmNvZGluZyA9IGVuY29kaW5nOwogICAgICAgICBhcmcubUhpc3RvcnlVcmwgPSBoaXN0b3J5VXJsOwogICAgICAgICBtV2ViVmlld0NvcmUuc2VuZE1lc3NhZ2UoRXZlbnRIdWIuTE9BRF9EQVRBLCBhcmcpOwotICAgICAgICBjbGVhclRleHRFbnRyeShmYWxzZSk7CisgICAgICAgIGNsZWFyVGV4dEVudHJ5KCk7CisgICAgfQorCisgICAgLyoqCisgICAgICogU2F2ZXMgdGhlIGN1cnJlbnQgdmlldyBhcyBhIHdlYiBhcmNoaXZlLgorICAgICAqCisgICAgICogQHBhcmFtIGZpbGVuYW1lIFRoZSBmaWxlbmFtZSB3aGVyZSB0aGUgYXJjaGl2ZSBzaG91bGQgYmUgcGxhY2VkLgorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNhdmVXZWJBcmNoaXZlKFN0cmluZyBmaWxlbmFtZSkgeworICAgICAgICBzYXZlV2ViQXJjaGl2ZShmaWxlbmFtZSwgZmFsc2UsIG51bGwpOworICAgIH0KKworICAgIC8qIHBhY2thZ2UgKi8gc3RhdGljIGNsYXNzIFNhdmVXZWJBcmNoaXZlTWVzc2FnZSB7CisgICAgICAgIFNhdmVXZWJBcmNoaXZlTWVzc2FnZSAoU3RyaW5nIGJhc2VuYW1lLCBib29sZWFuIGF1dG9uYW1lLCBWYWx1ZUNhbGxiYWNrPFN0cmluZz4gY2FsbGJhY2spIHsKKyAgICAgICAgICAgIG1CYXNlbmFtZSA9IGJhc2VuYW1lOworICAgICAgICAgICAgbUF1dG9uYW1lID0gYXV0b25hbWU7CisgICAgICAgICAgICBtQ2FsbGJhY2sgPSBjYWxsYmFjazsKKyAgICAg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WMgdm9pZCBzZXRJbml0aWFsU2NhbGUoaW50IHNjYWxlSW5QZXJjZW50KSB7Ci0gICAgICAgIG1Jbml0aWFsU2NhbGVJblBlcmNlbnQgPSBzY2FsZUluUGVyY2VudDsKKyAgICAgICAgbVpvb21NYW5hZ2VyLnNldEluaXRpYWxTY2FsZUluUGVyY2VudChzY2FsZUluUGVyY2VudCk7CiAgICAgfQogCiAgICAgLyoqCkBAIC0xOTI2LDE0ICsxOTY2LDggQEAKICAgICAgICAgICAgIExvZy53KExPR1RBRywgIlRoaXMgV2ViVmlldyBkb2Vzbid0IHN1cHBvcnQgem9vbS4iKTsKICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgfQotICAgICAgICBjbGVhclRleHRFbnRyeShmYWxzZSk7Ci0gICAgICAgIGlmIChnZXRTZXR0aW5ncygpLmdldEJ1aWx0SW5ab29tQ29udHJvbHMoKSkgewotICAgICAgICAgICAgZ2V0Wm9vbUJ1dHRvbnNDb250cm9sbGVyKCkuc2V0VmlzaWJsZSh0cnVlKTsKLSAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgIG1Qcml2YXRlSGFuZGxlci5yZW1vdmVDYWxsYmFja3MobVpvb21Db250cm9sUnVubmFibGUpOwotICAgICAgICAgICAgbVByaXZhdGVIYW5kbGVyLnBvc3REZWxheWVkKG1ab29tQ29udHJvbFJ1bm5hYmxlLAotICAgICAgICAgICAgICAgICAgICBaT09NX0NPTlRST0xTX1RJTUVPVVQpOwotICAgICAgICB9CisgICAgICAgIGNsZWFyVGV4dEVudHJ5KCk7CisgICAgICAgIG1ab29tTWFuYWdlci5pbnZva2Vab29tUGlja2VyKCk7CiAgICAgfQogCiAgICAgLyoqCkBAIC0yMDQ4LDcgKzIwODIsNyBAQAogICAgICAgICBtc2cuc2VuZFRvVGFyZ2V0KCk7CiAgICAgfQogCi0gICAgcHJpdmF0ZSBzdGF0aWMgaW50IHBpbkxvYyhpbnQgeCwgaW50IHZpZXdNYXgsIGludCBkb2NN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VSZWFsVmVydGljYWxTY3JvbGxSYW5nZSgpICsgZ2V0VGl0bGVIZWlnaHQoKSk7CisgICAgICAgICAgICAgICAgICAgICAgY29tcHV0ZVZlcnRpY2FsU2Nyb2xsUmFuZ2UoKSArIGdldFRpdGxlSGVpZ2h0KCkpOwogICAgIH0KIAogICAgIC8qKgpAQCAtMjA5OSw2ICsyMTMxLDE1IEBACiAgICAgICogQGhpZGUKICAgICAgKi8KICAgICBwdWJsaWMgdm9pZCBzZXRFbWJlZGRlZFRpdGxlQmFyKFZpZXcgdikgeworICAgICAgICBpZiAobnVsbCA9PSB2KSB7CisgICAgICAgICAgICAvLyBJZiBvbmUgb2Ygb3VyIGNhbGxiYWNrcyBpcyBob2xkaW5nIG9udG8gdGhlIHRpdGxlYmFyIHRvIHJlcGxhY2UKKyAgICAgICAgICAgIC8vIGl0IHdoZW4gaXRzIEFjdGlvbk1vZGUgZW5kcywgcmVtb3ZlIGl0LgorICAgICAgICAgICAgaWYgKG1TZWxlY3RDYWxsYmFjayAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgbVNlbGVjdENhbGxiYWNrLnNldFRpdGxlQmFyKG51bGwpOworICAgICAgICAgICAgfSBlbHNlIGlmIChtRmluZENhbGxiYWNrICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBtRmluZENhbGxiYWNrLnNldFRpdGxlQmFyKG51bGwpOworICAgICAgICAgICAgfQorICAgICAgICB9CiAgICAgICAgIGlmIChtVGl0bGVCYXIgPT0gdikgcmV0dXJuOwogICAgICAgICBpZiAobVRpdGxlQmFyICE9IG51bGwpIHsKICAgICAgICAgICAgIHJlbW92ZVZpZXcobVRpdGxlQmFyKTsKQEAgLTIxMjIsNyArMjE2Myw3IEBACiAgICAgICogaGVpZ2h0LgogICAgICAqLwogICAgIHByaXZhdGUgaW50IHZpZXdUb0NvbnRlbnREaW1lbnNpb24oaW50IGQpIHsKLSAgICAgICAgcmV0dXJuIE1hdGgucm91bmQoZCAqIG1JbnZBY3R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lKSwKQEAgLTIyNTcsMTMgKzIyOTgsNyBAQAogICAgICAgICAgICAgLy8gdXBkYXRlZCB3aGVuIHdlIGdldCBvdXQgb2YgdGhhdCBtb2RlLgogICAgICAgICAgICAgaWYgKCFtRHJhd0hpc3RvcnkpIHsKICAgICAgICAgICAgICAgICAvLyByZXBpbiBvdXIgc2Nyb2xsLCB0YWtpbmcgaW50byBhY2NvdW50IHRoZSBuZXcgY29udGVudCBzaXplCi0gICAgICAgICAgICAgICAgaW50IG9sZFggPSBtU2Nyb2xsWDsKLSAgICAgICAgICAgICAgICBpbnQgb2xkWSA9IG1TY3JvbGxZOwotICAgICAgICAgICAgICAgIG1TY3JvbGxYID0gcGluTG9jWChtU2Nyb2xsWCk7Ci0gICAgICAgICAgICAgICAgbVNjcm9sbFkgPSBwaW5Mb2NZKG1TY3JvbGxZKTsKLSAgICAgICAgICAgICAgICBpZiAob2xkWCAhPSBtU2Nyb2xsWCB8fCBvbGRZICE9IG1TY3JvbGxZKSB7Ci0gICAgICAgICAgICAgICAgICAgIG9uU2Nyb2xsQ2hhbmdlZChtU2Nyb2xsWCwgbVNjcm9sbFksIG9sZFgsIG9sZFkpOwotICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB1cGRhdGVTY3JvbGxDb29yZGluYXRlcyhwaW5Mb2NYKG1TY3JvbGxYKSwgcGluTG9jWShtU2Nyb2xsWSkpOwogICAgICAgICAgICAgICAgIGlmICghbVNjcm9sbGVyLmlzRmluaXNoZWQoKSkgewogICAgICAgICAgICAgICAgICAgICAvLyBXZSBhcmUgaW4gdGhlIG1pZGRsZSBvZiBhIHNjcm9sbC4gIFJlcGluIHRoZSBmaW5hbCBzY3JvbGwKICAgICAgICAgICAgICAgICAgICAgLy8gcG9zaXRpb24uCkBAIC0yMjc1LDc3ICsyMzEwLDEyIEBACiAgICAgICAgIGNvbnRlbnRTaXplQ2hhbmdlZCh1cGRhdGVMYXlvdXQpOwogICAgIH0KIAotICAgIHByaXZhdGU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TY2FsZSAmJiAhbVByZXZpZXdab29tT25seSkgewotICAgICAgICAgICAgICAgICAgICBtQ2FsbGJhY2tQcm94eS5vblNjYWxlQ2hhbmdlZChtQWN0dWFsU2NhbGUsIHNjYWxlKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgbUFjdHVhbFNjYWxlID0gc2NhbGU7Ci0gICAgICAgICAgICAgICAgbUludkFjdHVhbFNjYWxlID0gMSAvIHNjYWxlOwotICAgICAgICAgICAgICAgIHNlbmRWaWV3U2l6ZVpvb20oKTsKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgLy8gdXBkYXRlIG91ciBzY3JvbGwgc28gd2UgZG9uJ3QgYXBwZWFyIHRvIGp1bXAKLSAgICAgICAgICAgICAgICAvLyBpLmUuIGtlZXAgdGhlIGNlbnRlciBvZiB0aGUgZG9jIGluIHRoZSBjZW50ZXIgb2YgdGhlIHZpZXcKLQotICAgICAgICAgICAgICAgIGludCBvbGRYID0gbVNjcm9sbFg7Ci0gICAgICAgICAgICAgICAgaW50IG9sZFkgPSBtU2Nyb2xsWTsKLSAgICAgICAgICAgICAgICBmbG9hdCByYXRpbyA9IHNjYWxlICogbUludkFjdHVhbFNjYWxlOyAgIC8vIG9sZCBpbnZlcnNlCi0gICAgICAgICAgICAgICAgZmxvYXQgc3ggPSByYXRpbyAqIG9sZFggKyAocmF0aW8gLSAxKSAqIG1ab29tQ2VudGVyWDsKLSAgICAgICAgICAgICAgICBmbG9hdCBzeSA9IHJhdGlvICogb2xkWSArIChyYXRpbyAtIDEpCi0gICAgICAgICAgICAgICAgICAgICAgICAqIChtWm9vbUNlbnRlclkgLSBnZXRUaXRsZUhlaWdodCgpKTsKLQotICAgICAgICAgICAgICAgIC8vIG5vdyB1cGRhdGUgb3VyIG5ldyBzY2FsZSBhbmQgaW52ZXJzZQotICAgICAgICAgICAgICAgIGlmIChzY2FsZSAhPSBtQWN0dWFsU2NhbGUgJiYgIW1QcmV2aWV3Wm9vbU9ubHkpIHsKLSAgICAgICAgICAgICAgICAgICAgbUNhbGxiYWNrUHJveHkub25TY2FsZUNoYW5nZWQobUFjdHVhbFNjYWxlLCBzY2FsZSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIG1BY3R1YWxTY2FsZSA9IHNjYWxlOwotICAgICAgICAgICAgICAgIG1JbnZBY3R1YWxTY2FsZSA9IDEgLyBzY2FsZTsKLQotICAgICAgICAgICAgICAgIC8vIFNjYWxlIGFsbCB0aGUgY2hpbGQgdmlld3MKLSAgICAgICAgICAgICAgICBtVmlld01hbmFnZXIuc2NhbGVBbGwoKTsKLQotICAgICAgICAgICAgICAgIC8vIGFzIHdlIGRvbid0IGhhdmUgYW5pbWF0aW9uIGZvciBzY2FsaW5nLCBkb24ndCBkbyBhbmltYXRpb24KLSAgICAgICAgICAgICAgICAvLyBmb3Igc2Nyb2xsaW5nLCBhcyBpdCBjYXVzZXMgd2VpcmQgaW50ZXJtZWRpYXRlIHN0YXRlCi0gICAgICAgICAgICAgICAgLy8gICAgICAgIHBpblNjcm9sbFRvKE1hdGgucm91bmQoc3gpLCBNYXRoLnJvdW5kKHN5KSk7Ci0gICAgICAgICAgICAgICAgbVNjcm9sbFggPSBwaW5Mb2NYKE1hdGgucm91bmQoc3gpKTsKLSAgICAgICAgICAgICAgICBtU2Nyb2xsWSA9IHBpbkxvY1koTWF0aC5yb3VuZChzeSkpOwotCi0gICAgICAgICAgICAgICAgLy8gdXBkYXRlIHdlYmtpdAotICAgICAgICAgICAgICAgIGlmIChvbGRYICE9IG1TY3JvbGxYIHx8IG9sZFkgIT0gbVNjcm9sbFkpIHsKLSAgICAgICAgICAgICAgICAgICAgb25TY3JvbGxDaGFuZ2VkKG1TY3JvbGxYLCBtU2Nyb2xsWSwgb2xkWCwgb2xkWSk7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgLy8gdGhlIHNjcm9sbCBwb3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ICAgZGF0YS5tQW5jaG9yWSA9IG1BbmNob3JZOworICAgICAgICAgICAgZGF0YS5tVGV4dFdyYXBXaWR0aCA9IE1hdGgucm91bmQodmlld1dpZHRoIC8gbVpvb21NYW5hZ2VyLmdldFRleHRXcmFwU2NhbGUoKSk7CisgICAgICAgICAgICBkYXRhLm1TY2FsZSA9IG1ab29tTWFuYWdlci5nZXRTY2FsZSgpOworICAgICAgICAgICAgZGF0YS5tSWdub3JlSGVpZ2h0ID0gbVpvb21NYW5hZ2VyLmlzRml4ZWRMZW5ndGhBbmltYXRpb25JblByb2dyZXNzKCkKKyAgICAgICAgICAgICAgICAgICAgJiYgIW1IZWlnaHRDYW5NZWFzdXJlOworICAgICAgICAgICAgZGF0YS5tQW5jaG9yWCA9IG1ab29tTWFuYWdlci5nZXREb2N1bWVudEFuY2hvclgoKTsKKyAgICAgICAgICAgIGRhdGEubUFuY2hvclkgPSBtWm9vbU1hbmFnZXIuZ2V0RG9jdW1lbnRBbmNob3JZKCk7CiAgICAgICAgICAgICBtV2ViVmlld0NvcmUuc2VuZE1lc3NhZ2UoRXZlbnRIdWIuVklFV19TSVpFX0NIQU5HRUQsIGRhdGEpOwogICAgICAgICAgICAgbUxhc3RXaWR0aFNlbnQgPSBuZXdXaWR0aDsKICAgICAgICAgICAgIG1MYXN0SGVpZ2h0U2VudCA9IG5ld0hlaWdodDsKLSAgICAgICAgICAgIG1BbmNob3JYID0gbUFuY2hvclkgPSAwOworICAgICAgICAgICAgbVpvb21NYW5hZ2VyLmNsZWFyRG9jdW1lbnRBbmNob3IoKTsKICAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgICB9CiAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICB9CiAKLSAgICBwcml2YXRlIGludCBjb21wdXRlUmVhbEhvcml6b250YWxTY3JvbGxSYW5nZSgpIHsKKyAgICBAT3ZlcnJpZGUKKyAgICBwcm90ZWN0ZWQgaW50IGNvbXB1dGVIb3Jpem9udGFsU2Nyb2x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gICAgJiYgIW1ab29tTWFuYWdlci5jYW5ab29tT3V0KCkpIHsKKyAgICAgICAgICAgIC8vIG9ubHkgaG9ub3IgdGhlIHNjcm9sbGJhciBtb2RlIHdoZW4gaXQgaXMgYXQgbWluaW11bSB6b29tIGxldmVsCisgICAgICAgICAgICByZXR1cm4gY29tcHV0ZVZlcnRpY2FsU2Nyb2xsRXh0ZW50KCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAvLyB0byBhdm9pZCByb3VuZGluZyBlcnJvciBjYXVzZWQgdW5uZWNlc3Nhcnkgc2Nyb2xsYmFyLCB1c2UgZmxvb3IKKyAgICAgICAgICAgIHJldHVybiAoaW50KSBNYXRoLmZsb29yKG1Db250ZW50SGVpZ2h0ICogbVpvb21NYW5hZ2VyLmdldFNjYWxlKCkpOwogICAgICAgICB9Ci0KLSAgICAgICAgcmV0dXJuIHJhbmdlOwogICAgIH0KIAogICAgIEBPdmVycmlkZQpAQCAtMjU0NSwzMSArMjQ4MSwxMCBAQAogICAgIHByb3RlY3RlZCB2b2lkIG9uRHJhd1ZlcnRpY2FsU2Nyb2xsQmFyKENhbnZhcyBjYW52YXMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRHJhd2FibGUgc2Nyb2xsQmFyLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBsLCBpbnQgdCwgaW50IHIsIGludCBiKSB7Ci0gICAgICAgIGlmIChtU2Nyb2xsWSA8IDApIHsKLSAgICAgICAgICAgIHQgLT0gbVNjcm9sbFk7Ci0gICAgICAgIH0KICAgICAgICAgc2Nyb2xsQmFyLnNldEJvdW5kcyhsLCB0ICsgZ2V0VmlzaWJsZVRpdGxlSGVpZ2h0KCksIHIsIGIpOwogICAgICAgICBzY3JvbGxCYXIuZHJhdyhjYW52YXMpOwogICAgIH0KIAotICAgIEBPdmVycmlkZQotICAgIHByb3RlY3RlZCB2b2lkIG9uT3ZlcnN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gpID09IE9WRVJTQ1JPTExfQUxXQVlTKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoeSA8IDAgJiYgb2xkWSA+PSAwKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbUVkZ2VHbG93VG9wLm9uQWJzb3JiKChpbnQpIG1TY3JvbGxlci5nZXRDdXJyVmVsb2NpdHkoKSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHkgPiByYW5nZVkgJiYgb2xkWSA8PSByYW5nZVkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBtRWRnZUdsb3dCb3R0b20ub25BYnNvcmIoKGludCkgbVNjcm9sbGVyLmdldEN1cnJWZWxvY2l0eSgpKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgICAgIGlmIChyYW5nZVggPiAwKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoeCA8IDAgJiYgb2xkWCA+PSAwKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbUVkZ2VHbG93TGVmdC5vbkFic29yYigoaW50KSBtU2Nyb2xsZXIuZ2V0Q3VyclZlbG9jaXR5KCkpOwotICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICh4ID4gcmFuZ2VYICYmIG9sZFggPD0gcmFuZ2VYKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbUVkZ2VHbG93UmlnaHQub25BYnNvcmIoKGludCkgbVNjcm9sbGVyLmdldEN1cnJWZWxvY2l0eSgpKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmIChtU2Nyb2xsZXIuaXNGaW5pc2hlZCgpKSB7Ci0gICAgICAgICAgICAgICAgbVByaXZhdGVIYW5kbGVy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IEBPdmVycmlkZQotICAgIHB1YmxpYyB2b2lkIGRyYXcoQ2FudmFzIGNhbnZhcykgewotICAgICAgICBzdXBlci5kcmF3KGNhbnZhcyk7Ci0gICAgICAgIGlmIChtRWRnZUdsb3dUb3AgIT0gbnVsbCAmJiBkcmF3RWRnZUdsb3dzKGNhbnZhcykpIHsKLSAgICAgICAgICAgIGludmFsaWRhdGUoKTsKKyAgICAgICAgLy8gcGFpbnQgdGhlIGhpZ2hsaWdodCBpbiB0aGUgZW5kCisgICAgICAgIGlmICghbVRvdWNoSGlnaGxpZ2h0UmVnaW9uLmlzRW1wdHkoKSkgeworICAgICAgICAgICAgaWYgKG1Ub3VjaEhpZ2h0bGlnaHRQYWludCA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgbVRvdWNoSGlnaHRsaWdodFBhaW50ID0gbmV3IFBhaW50KCk7CisgICAgICAgICAgICAgICAgbVRvdWNoSGlnaHRsaWdodFBhaW50LnNldENvbG9yKG1IaWdodGxpZ2h0Q29sb3IpOworICAgICAgICAgICAgICAgIG1Ub3VjaEhpZ2h0bGlnaHRQYWludC5zZXRBbnRpQWxpYXModHJ1ZSk7CisgICAgICAgICAgICAgICAgbVRvdWNoSGlnaHRsaWdodFBhaW50LnNldFBhdGhFZmZlY3QobmV3IENvcm5lclBhdGhFZmZlY3QoCisgICAgICAgICAgICAgICAgICAgICAgICBUT1VDSF9ISUdITElHSFRfQVJDKSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYW52YXMuZHJhd1BhdGgobVRvdWNoSGlnaGxpZ2h0UmVnaW9uLmdldEJvdW5kYXJ5UGF0aCgpLAorICAgICAgICAgICAgICAgICAgICBtVG91Y2hIaWdodGxpZ2h0UGFpbnQpOworICAgICAgICB9CisgICAgICAgIGlmIChERUJVR19UT1VDSF9ISUdITElHSFQpIHsKKyAgICAgICAgICAgIGlmIChnZXRTZXR0aW5ncygpLmdldE5hdkR1bXAoKSkgeworICAgICAgICAgICAgICAgIGlmICgobVRvdWNoSGlnaGxpZ2h0WCB8IG1Ub3VjaEhpZ2hsaWdodFkpICE9IDApIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKG1Ub3VjaENyb3NzSGFpckNvbG9yID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1Ub3VjaENyb3NzSGFpckNvbG9yID0gbmV3IFBhaW50KCk7CisgICAgICAgICAgICAgICAgICAgICAgICBtVG91Y2hDcm9zc0hhaXJDb2xvci5zZXRDb2xvcihDb2xvci5SRUQpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGNhbnZhcy5kcmF3TGluZShtVG91Y2hIaWdobGlnaHRYIC0gbU5hdlNsb3AsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVRvdWNoSGlnaGxpZ2h0WSAtIG1OYXZTbG9wLCBtVG91Y2hIaWdobGlnaHRYCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIG1OYXZTbG9wICsgMSwgbVRvdWNoSGlnaGxpZ2h0WSArIG1OYXZTbG9wCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIDEsIG1Ub3VjaENyb3NzSGFpckNvbG9yKTsKKyAgICAgICAgICAgICAgICAgICAgY2FudmFzLmRyYXdMaW5lKG1Ub3VjaEhpZ2hsaWdodFggKyBtTmF2U2xvcCArIDEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVRvdWNoSGlnaGxpZ2h0WSAtIG1OYXZTbG9wLCBtVG91Y2hIaWdobGlnaHRYCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtIG1OYXZTbG9wLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Ub3VjaEhpZ2hsaWdodFkgKyBtTmF2U2xvcCArIDEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVRvdWNoQ3Jvc3NIYWlyQ29sb3IpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KIC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3IEBACiAgICAgICAgICAgICBjZW50ZXJLZXlQcmVzc09uVGV4dEZpZWxkKCk7CiAgICAgICAgICAgICByZWJ1aWxkV2ViVGV4dFZpZXcoKTsKICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgIGNsZWFyVGV4dEVudHJ5KHRydWUpOworICAgICAgICAgICAgY2xlYXJUZXh0RW50cnkoKTsKICAgICAgICAgfQogICAgICAgICBpZiAoaW5FZGl0aW5nTW9kZSgpKSB7CiAgICAgICAgICAgICByZXR1cm4gbVdlYlRleHRWaWV3LnBlcmZvcm1Mb25nQ2xpY2soKTsKQEAgLTM1NjMsMjYgKzM0MTYsMTcgQEAKICAgICAgICAgc2V0VXBTZWxlY3QoKTsKICAgICAgICAgaWYgKG1OYXRpdmVDbGFzcyAhPSAwICYmIG5hdGl2ZVdvcmRTZWxlY3Rpb24oeCwgeSkpIHsKICAgICAgICAgICAgIG5hdGl2ZVNldEV4dGVuZFNlbGVjdGlvbigpOwotICAgICAgICAgICAgV2ViQ2hyb21lQ2xpZW50IGNsaWVudCA9IGdldFdlYkNocm9tZUNsaWVudCgpOwotICAgICAgICAgICAgaWYgKGNsaWVudCAhPSBudWxsKSBjbGllbnQub25TZWxlY3Rpb25TdGFydCh0aGlzKTsKICAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgICB9Ci0gICAgICAgIG5vdGlmeVNlbGVjdERpYWxvZ0Rpc21pc3NlZCgpOworICAgICAgICBzZWxlY3Rpb25Eb25lKCk7CiAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICB9CiAKLSAgICBib29sZWFuIGluQW5pbWF0ZVpvb20oKSB7Ci0gICAgICAgIHJldHVybiBtWm9vbVNjYWxlICE9IDA7Ci0gICAgfQotCiAgICAgLyoqCi0gICAgICogTmVlZCB0byBhZGp1c3QgdGhlIFdlYlRleHRWaWV3IGFmdGVyIGEgY2hhbmdlIGluIHpvb20sIHNpbmNlIG1BY3R1YWxTY2FsZQotICAgICAqIGhhcyBja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dGlvblN0YXJ0KCkgeworICAgICAgICBXZWJWaWV3Q29yZS5wYXVzZVVwZGF0ZVBpY3R1cmUoZ2V0V2ViVmlld0NvcmUoKSk7CisgICAgICAgIG9uWm9vbUFuaW1hdGlvblN0YXJ0KCk7CisgICAgfQorCisgICAgdm9pZCBvbkZpeGVkTGVuZ3RoWm9vbUFuaW1hdGlvbkVuZCgpIHsKKyAgICAgICAgV2ViVmlld0NvcmUucmVzdW1lVXBkYXRlUGljdHVyZShtV2ViVmlld0NvcmUpOworICAgICAgICBvblpvb21BbmltYXRpb25FbmQoKTsKKyAgICB9CisKKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgWk9PTV9CSVRTID0gUGFpbnQuRklMVEVSX0JJVE1BUF9GTEFHIHwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUGFpbnQuRElUSEVSX0ZMQUcgfAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQYWludC5TVUJQSVhFTF9URVhUX0ZMQUc7CisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IFNDUk9MTF9CSVRTID0gUGFpbnQuRklMVEVSX0JJVE1BUF9GTEFHIHwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQYWludC5ESVRIRVJfRkxBRzsKKworICAgIHByaXZhdGUgZmluYWwgRHJhd0ZpbHRlciBtWm9vbUZpbHRlciA9CisgICAgICAgICAgICBuZXcgUGFpbnRGbGFnc0RyYXdGaWx0ZXIoWk9PTV9CSVRTLCBQYWludC5MSU5FQVJfVEVYVF9GTEFHKTsKKyAgICAvLyBJZiB3ZSBuZWVkIHRvIHRyYWRlIGJldHRlciBxdWFsaXR5IGZvciBzcGVlZCwgc2V0IG1TY3JvbGxGaWx0ZXIgdG8gbnVsbAorICAgIHByaXZhdGUgZmluYWwgRHJhd0ZpbHRlciBtU2Nyb2xsRmlsdGVyID0KKyAgICAgICAgICAgIG5ldyBQYWludEZsYWdzRHJhd0ZpbHRlcihTQ1JPTExfQklUUywgMCk7CisKICAgICBwcml2YXRlIHZvaWQgZHJhd0NvcmVBbmRDdXJzb3JSaW5nKENhbnZhcyBjYW52YXMsIGludCBjb2xvciwKICAgICAgICAgYm9vbGVhbiBkcmF3Q3Vyc29yUmluZykgewogICAgICAgICBpZiAobURyYXdIaXN0b3J5KSB7Ci0gICAgICAgICAgICBjYW52YXMuc2NhbGUobUFjdHVhbFNjYWxlLCBtQWN0dWFsU2NhbGUpOworICAgICAgICAgICAgY2FudmFzLnNjYWxlKG1ab29tTWFuYWdlci5nZXRTY2FsZSgpLCBtWm9vbU1hbmFnZXIuZ2V0U2NhbGUoKSk7CiAgICAgICAgICAgICBjYW52YXMuZHJhd1BpY3R1cmUobUhpc3RvcnlQaWN0dXJlKTsKICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgfQorICAgICAgICBpZiAobU5hdGl2ZUNsYXNzID09IDApIHJldHVybjsKIAotICAgICAgICBib29sZWFuIGFuaW1hdGVab29tID0gbVpvb21TY2FsZSAhPSAwOworICAgICAgICBib29sZWFuIGFuaW1hdGVab29tID0gbVpvb21NYW5hZ2VyLmlzRml4ZWRMZW5ndGhBbmltYXRpb25JblByb2dyZXNzKCk7CiAgICAgICAgIGJvb2xlYW4gYW5pbWF0ZVNjcm9sbCA9ICgoIW1TY3JvbGxlci5pc0ZpbmlzaGVkKCkKICAgICAgICAgICAgICAgICB8fCBtVmVsb2NpdHlUcmFja2VyICE9IG51bGwpCiAgICAgICAgICAgICAgICAgJiYgKG1Ub3VjaE1vZGUgIT0gVE9VQ0hfRFJBR19NT0RFIHx8CkBAIC0zNjQ4LDU5ICszNTIxLDkgQEAKICAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgICAgICBpZiAoYW5pbWF0ZVpvb20pIHsKLSAgICAgICAgICAgIGZsb2F0IHpvb21TY2FsZTsKLSAgICAgICAgICAgIGludCBpbnRlcnZhbCA9IChpbnQpIChTeXN0ZW1DbG9jay51cHRpbWVNaWxsaXMoKSAtIG1ab29tU3RhcnQpOwotICAgICAgICAgICAgaWYgKGludGVydmFsIDwgWk9PTV9BTklNQVRJT05fTEVOR1RIKSB7Ci0gICAgICAgICAgICAgICAgZmxvYXQgcmF0aW8gPSAoZmxvYXQpIGludGVydmFsIC8gWk9PTV9BTklNQVRJT05fTEVOR1RIOwotICAgICAgICAgICAgICAgIHpvb21TY2FsZSA9IDEuMGYgLyAobUludkluaXRpYWxab29tU2NhbGUKLSAgICAgICAgICAgICAgICAgICAgICAgICsgKG1JbnZGaW5hbFpvb21TY2FsZSAtIG1JbnZJbml0aWFsWm9vbVNjYWxlKSAqIHJhdGlvKTsKLSAgICAgICAgICAgICAgICBpbnZhbGlkYXRlKCk7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIHpvb21TY2FsZSA9IG1ab29tU2NhbGU7Ci0gICAgICAgICAgICAgICAgLy8gc2V0IG1ab29tU2NhbGUgdG8gYmUgMCBhcyB3ZSBoYXZlIGRvbmUgYW5pbWF0aW9uCi0gICAgICAgICAgICAgICAgbVpvb21TY2FsZSA9IDA7Ci0gICAgICAgICAgICAgICAgV2ViVmlld0NvcmUucmVzdW1lVXBkYXRlUGljdHVyZShtV2ViVmlld0NvcmUpOwotICAgICAgICAgICAgICAgIC8vIGNhbGwgaW52YWxpZGF0ZSgpIGFnYWluIHRvIGRyYXcgd2l0aCB0aGUgZmluYWwgZmlsdGVycwotICAgICAgICAgICAgICAgIGludmFsaWRhdGUoKTsKLSAgICAgICAgICAgICAgICBpZiAobU5lZWRUb0FkanVzdFdlYlRleHRWaWV3KSB7Ci0gICAgICAgICAgICAgICAgICAgIG1OZWVkVG9BZGp1c3RXZWJUZXh0VmlldyA9IGZhbHNlOwotICAgICAgICAgICAgICAgICAgICBpZiAoZGlkVXBkYXRlVGV4dFZpZXdCb3VuZHMoZmFsc2UpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgJiYgbmF0aXZlRm9jdXNDYW5kaWRhdGVJc1Bhc3N3b3JkKCkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIElmIGl0IGlzIGEgcGFzc3dvcmQgZmllbGQsIHN0YXJ0IGRyYXdpbmcgdGhlCi0gICAgICAgICAgICAgICAgICAgICAgICAvLyBXZWJUZXh0VmlldyBvbmNlIGFnYWluLgotICAgICAgICAgICAgICAgICAgICAgICAgbVdlYlRleHRWaWV3LnNldEluUGFzc3dvcmQodHJ1ZSk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICAvLyBjYWxjdWxhdGUgdGhlIGludGVybWVkaWF0ZSBzY3JvbGwgcG9zaXRpb24uIEFzIHdlIG5lZWQgdG8gdXNlCi0gICAgICAgICAgICAvLyB6b29tU2NhbGUsIHdlIGNhbid0IHVzZSBwaW5Mb2NYL1kgZGlyZWN0bHkuIENvcHkgdGhlIGxvZ2ljIGhlcmUuCi0gICAgICAgICAgICBmbG9hdCBzY2FsZSA9IHpvb21TY2FsZSAqIG1JbnZJbml0aWFsWm9vbVNjYWxlOwotICAgICAgICAgICAgaW50IHR4ID0gTWF0aC5yb3VuZChzY2FsZSAqIChtSW5pdGlhbFNjcm9sbFggKyBtWm9vbUNlbnRlclgpCi0gICAgICAgICAgICAgICAgICAgIC0gbVpvb21DZW50ZXJYKTsKLSAgICAgICAgICAgIHR4ID0gLXBpbkxvYyh0eCwgZ2V0Vmlld1dpZHRoKCksIE1hdGgucm91bmQobUNvbnRlbnRXaWR0aAotICAgICAgICAgICAgICAgICAgICAqIHpvb21TY2FsZSkpICsgbVNjcm9sbFg7Ci0gICAgICAgICAgICBpbnQgdGl0bGVIZWlnaHQgPSBnZXRUaXRsZUhlaWdodCgpOwotICAgICAgICAgICAgaW50IHR5ID0gTWF0aC5yb3VuZChzY2FsZQotICAgICAgICAgICAgICAgICAgICAqIChtSW5pdGlhbFNjcm9sbFkgKyBtWm9vbUNlbnRlclkgLSB0aXRsZUhlaWdodCkKLSAgICAgICAgICAgICAgICAgICAgLSAobVpvb21DZW50ZXJZIC0gdGl0bGVIZWlnaHQpKTsKLSAgICAgICAgICAgIHR5ID0gLSh0eSA8PSB0aXRsZUhlaWdodCA/IE1hdGgubWF4KHR5LCAwKSA6IHBpbkxvYyh0eQotICAgICAgICAgICAgICAgICAgICAtIHRpdGxlSGVpZ2h0LCBnZXRWaWV3SGVpZ2h0KCksIE1hdGgucm91bmQobUNvbnRlbnRIZWlnaHQKLSAgICAgICAgICAgICAgICAgICAgKiB6b29tU2NhbGUpKSArIHRpdGxlSGVpZ2h0KSArIG1TY3JvbGxZOwotICAgICAgICAgICAgY2FudmFzLnRyYW5zbGF0ZSh0eCwgdHkpOwotICAgICAgICAgICAgY2FudmFzLnNjYWxlKHpvb21TY2FsZSwgem9vbVNjYWxlKTsKLSAgICAgICAgICAgIGlmIChpbkVkaXRpbmdNb2RlKCkgJiYgIW1OZWVkVG9BZGp1c3RXZWJUZXh0VmlldwotICAgICAgICAgICAgICAgICAgICAmJiBtWm9vbVNjYWxlICE9IDApIHsKLSAgICAgICAgICAgICAgICAvLyBUaGUgV2ViVGV4dFZpZXcgaXMgdXAuICBLZWVwIHRyYWNrIG9mIHRoaXMgc28gd2UgY2FuIGFkanVzdAotICAgICAgICAgICAgICAgIC8vIGl0cyBzaXplIGFuZCBwbGFjZW1lbnQgd2hlbiB3ZSBmaW5pc2ggem9vbWluZwotICAgICAgICAgICAgICAgIG1OZWVkVG9BZGp1c3RXZWJUZXh0VmlldyA9IHRydWU7Ci0gICAgICAgICAgICAgICAgLy8gSWYgaXQgaXMgaW4gcGFzc3dvcmQgbW9kZSwgdHVybiBpdCBvZmYgc28gaXQgZG9lcyBub3QgZHJhdwotICAgICAgICAgICAgICAgIC8vIG1pc3BsYWNlZC4KLSAgICAgICAgICAgICAgICBpZiAobmF0aXZlRm9jdXNDYW5kaWRhdGVJc1Bhc3N3b3JkKCkpIHsKLSAgICAgICAgICAgICAgICAgICAgbVdlYlRleHRWaWV3LnNldEluUGFzc3dvcmQoZmFsc2UpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1ab29tTWFuYWdlci5hbmltYXRlWm9vbShjYW52YXMpOwogICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgY2FudmFzLnNjYWxlKG1BY3R1YWxTY2FsZSwgbUFjdHVhbFNjYWxlKTsKKyAgICAgICAgICAgIGNhbnZhcy5zY2FsZShtWm9vbU1hbmFnZXIuZ2V0U2NhbGUoKSwgbVpvb21NYW5hZ2VyLmdldFNjYWxlKCkpOwogICAgICAgICB9CiAKICAgICAgICAgYm9vbGVhbiBVSUFuaW1hdGlvbnNSdW5uaW5nID0gZmFsc2U7CkBAIC0zNzEyLDIzICszNTM1LDM4IEBACiAgICAgICAgICAgICAvLyB3ZSBhc2sgZm9yIGEgcmVwYWludC4KICAgICAgICAgICAgIGludmFsaWRhdGUoKTsKICAgICAgICAgfQotICAgICAgICBtV2ViVmlld0NvcmUuZHJhd0NvbnRlbnRQaWN0dXJlKGNhbnZhcywgY29sb3IsCi0gICAgICAgICAgICAgICAgKGFuaW1hdGVab29tIHx8IG1QcmV2aWV3Wm9vbU9ubHkgfHwgVUlBbmltYXRpb25zUnVubmluZyksCi0gICAgICAgICAgICAgICAgYW5pbWF0ZVNjcm9sbCk7Ci0gICAgICAgIGlmIChtTmF0aXZlQ2xhc3MgPT0gMCkgcmV0dXJuOworCiAgICAgICAgIC8vIGRlY2lkZSB3aGljaCBhZG9ybm1lbnRzIHRvIGRyYXcKICAgICAgICAgaW50IGV4dHJhcyA9IERSQVdfRVhUUkFTX05PTkU7CisgICAgICAgIGlmIChEZWJ1Z0ZsYWdzLldFQl9WSUVXKSB7CisgICAgICAgICAgICBMb2cudihMT0dUQUcsICJtRmluZElzVXA9IiArIG1GaW5kSXNVcAorICAgICAgICAgICAgICAgICAgICArICIgbVNlbGVjdGluZ1RleHQ9IiArIG1TZWxlY3RpbmdUZXh0CisgICAgICAgICAgICAgICAgICAgICsgIiBuYXRpdmVQYWdlU2hvdWxkSGFuZGxlU2hpZnRBbmRBcnJvd3MoKT0iCisgICAgICAgICAgICAgICAgICAgICsgbmF0aXZlUGFnZVNob3VsZEhhbmRsZVNoaWZ0QW5kQXJyb3dzKCkKKyAgICAgICAgICAgICAgICAgICAgKyAiIGFuaW1hdGVab29tPSIgKyBhbmltYXRlWm9vbSk7CisgICAgICAgIH0KICAgICAgICAgaWYgKG1GaW5kSXNVcCkgewotICAgICAgICAgICAgICAgIGV4dHJhcyA9IERSQVdfRVhUUkFTX0ZJTkQ7CisgICAgICAgICAgICBleHRyYXMgPSBEUkFXX0VYVFJBU19GSU5EOwogICAgICAgICB9IGVsc2UgaWYgKG1TZWxlY3RpbmdUZXh0KSB7CiAgICAgICAgICAgICBleHRyYXMgPSBEUkFXX0VYVFJBU19TRUxFQ1RJT047CiAgICAgICAgICAgICBuYXRpdmVTZXRTZWxlY3Rpb25Qb2ludGVyKG1EcmF3U2VsZWN0aW9uUG9pbnRlciwKLSAgICAgICAgICAgICAgICAgICAgbUludkFjdHVhbFNjYWxlLAorICAgICAgICAgICAgICAgICAgICBtWm9vbU1hbmFnZXIuZ2V0SW52U2NhbGUoKSwKICAgICAgICAgICAgICAgICAgICAgbVNlbGVjdFgsIG1TZWxlY3RZIC0gZ2V0VGl0bGVIZWlnaHQoKSk7CiAgICAgICAgIH0gZWxzZSBpZiAoZHJhd0N1cnNvclJpbmcpIHsKICAgICAgICAgICAgIGV4dHJhcyA9IERSQVdfRVhUUkFTX0NVUlNPUl9SSU5HOwogICAgICAgICB9Ci0gICAgICAgIGRyYXdFeHRyYXMoY2FudmFzLCBleHRyYXMsIFVJQW5pbWF0aW9uc1J1bm5pbmcpOworICAgICAgICBEcmF3RmlsdGVyIGRmID0gbnVsbDsKKyAgICAgICAgaWYgKG1ab29tTWFuYWdlci5pc1pvb21BbmltYXRpbmcoKSB8fCBVSUFuaW1hdGlvbnNSdW5uaW5nKSB7CisgICAgICAgICAgICBkZiA9IG1ab29tRmlsdGVyOworICAgICAgICB9IGVsc2UgaWYgKGFuaW1hdGVTY3JvbGwpIHsKKyAgICAgICAgICAgIGRmID0gbVNjcm9sbEZpbHRlcjsKKyAgICAgICAgfQorICAgICAgICBjYW52YXMuc2V0RHJhd0ZpbHRlcihkZik7CisgICAgICAgIGludCBjb250ZW50ID0gbmF0aXZlRHJhdyhjYW52YXMsIGNvbG9yLCBleHRyYXMsIHRydWUpOworICAgICAgICBjYW52YXMuc2V0RHJhd0ZpbHRlcihudWxsKTsKKyAgICAgICAgaWYgKGNvbnRlbnQgIT0gMCkgeworICAgICAgICAgICAgbVdlYlZpZXdDb3JlLnNlbmRNZXNzYWdlKEV2ZW50SHViLlNQTElUX1BJQ1RVUkVfU0VULCBjb250ZW50LCAwKTsKKyAgICAgICAgfQogCiAgICAgICAgIGlmIChleHRyYXMgPT0gRFJBV19FWFRSQVNfQ1VSU09SX1JJTkcpIHsKICAgICAgICAgICAgIGlmIChtVG91Y2hNb2RlID09IFRPVUNIX1NIT1JUUFJFU1NfU1RBUlRfTU9ERSkgewpAQCAtMzc1NywxMCArMzU5NSwxNCBAQAogICAgICAgICByZXR1cm4gbURyYXdIaXN0b3J5OwogICAgIH0KIAorICAgIGludCBnZXRIaXN0b3J5UGljdHVyZVdpZHRoKCkgeworICAgICAgICByZXR1cm4gKG1IaXN0b3J5UGljdHVyZSAhPSBudWxsKSA/IG1IaXN0b3J5UGljdHVyZS5nZXRXaWR0aCgpIDogMDsKKyAgICB9CisKICAgICAvLyBTaG91bGQgb25seSBiZSBjYWxsZWQgaW4gVUkgdGhyZWFkCiAgICAgdm9pZCBzd2l0Y2hPdXREcmF3SGlzdG9yeSgpIHsKICAgICAgICAgaWYgKG51bGwgPT0gbVdlYlZpZXdDb3JlKSByZXR1cm47IC8vIENhbGxiYWNrUHJveHkgbWF5IHRyaWdnZXIgdG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ICAgICBnZXRDb250ZXh0KCkuZ2V0U3lzdGVtU2VydmljZShDb250ZXh0LklOUFVUX01FVEhPRF9TRVJWSUNFKTsKLQotICAgICAgICBpbW0uaGlkZVNvZnRJbnB1dEZyb21XaW5kb3codGhpcy5nZXRXaW5kb3dUb2tlbigpLCAwKTsKKyAgICAgICAgaWYgKGltbS5pc0FjdGl2ZSh0aGlzKQorICAgICAgICAgICAgICAgIHx8IChpbkVkaXRpbmdNb2RlKCkgJiYgaW1tLmlzQWN0aXZlKG1XZWJUZXh0VmlldykpKSB7CisgICAgICAgICAgICBpbW0uaGlkZVNvZnRJbnB1dEZyb21XaW5kb3codGhpcy5nZXRXaW5kb3dUb2tlbigpLCAwKTsKKyAgICAgICAgfQogICAgIH0KIAogICAgIC8qCkBAIC00MDI1LDYgKzM4NjgsMjYgQEAKICAgICB9CiAKICAgICAvKioKKyAgICAgKiBDYWxsZWQgYnkgRFJUIG9uIFVJIHRocmVhZCwgbmVlZCB0byBwcm94eSB0byBXZWJDb3JlIHRocmVhZC4KKyAgICAgKgorICAgICAqIEBoaWRlIGRlYnVnIG9ubHkKKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCB1c2VNb2NrRGV2aWNlT3JpZW50YXRpb24oKSB7CisgICAgICAgIG1XZWJWaWV3Q29yZS5zZW5kTWVzc2FnZShFdmVudEh1Yi5VU0VfTU9DS19ERVZJQ0VfT1JJRU5UQVRJT04pOworICAgIH0KKworICAgIC8qKgorICAgICAqIENhbGxlZCBieSBEUlQgb24gV2ViQ29yZSB0aHJlYWQuCisgICAgICoKKyAgICAgKiBAaGlkZSBkZWJ1ZyBvbmx5CisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0TW9ja0RldmljZU9yaWVudGF0aW9uKGJvb2xlYW4gY2FuUHJvdmlkZUFscGhhLCBkb3VibGUgYWxwaGEsCisgICAgICAgICAgICBib29sZWFuIGNhblByb3ZpZGVCZXRhLCBkb3VibGUgYmV0YSwgYm9vbGVhbiBjYW5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IHsKICAgICAgICAgICAgICAgICBtU2hpZnRJc1ByZXNzZWQgPSBmYWxzZTsKICAgICAgICAgICAgIH0gZWxzZSBpZiAoY29weVNlbGVjdGlvbigpKSB7CiAgICAgICAgICAgICAgICAgc2VsZWN0aW9uRG9uZSgpOwpAQCAtNDI0Myw4ICs0MTExLDggQEAKIAogICAgICAgICBpZiAoa2V5Q29kZSA+PSBLZXlFdmVudC5LRVlDT0RFX0RQQURfVVAKICAgICAgICAgICAgICAgICAmJiBrZXlDb2RlIDw9IEtleUV2ZW50LktFWUNPREVfRFBBRF9SSUdIVCkgewotICAgICAgICAgICAgaWYgKG5hdGl2ZUZvY3VzSXNQbHVnaW4oKSkgewotICAgICAgICAgICAgICAgIGxldFBsdWdpbkhhbmRsZU5hdktleShrZXlDb2RlLCBldmVudC5nZXRFdmVudFRpbWUoKSwgZmFsc2UpOworICAgICAgICAgICAgaWYgKG5hdGl2ZVBhZ2VTaG91bGRIYW5kbGVTaGlmdEFuZEFycm93cygpKSB7CisgICAgICAgICAgICAgICAgbGV0UGFnZUhhbmRsZU5hdktleShrZXlDb2RlLCBldmVudC5nZXRFdmVudFRpbWUoKSwgZmFsc2UpOwogICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgLy8gYWx3YXlzIGhhbmRsZSB0aGUgbmF2aWdhdGlvbiBrZXlzIGluIHRoZSBVSSB0aHJlYWQKQEAgLTQyODcsOCArNDE1NSw4IEBACiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgY2xlYXJUZXh0RW50cnkodHJ1ZSk7Ci0gICAgICAgICAgICBuYXRpdmVTZXRGb2xsb3dlZExpbmsodHJ1ZSk7CisgICAgICAgICAgICBjbGVhclRleHRFbnRyeSgpOworICAgICAgICAgICAgbmF0aXZlU2hvd0N1cnNvclRpbWVkKCk7CiAgICAgICAgICAgICBpZiAo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AgICAgICAgICAgTG9nLmUoTE9HVEFHLCAiQ2xpcGJvYXJkIGZhaWxlZCIsIGUpOwotICAgICAgICAgICAgfQorICAgICAgICAgICAgQ2xpcGJvYXJkTWFuYWdlciBjbSA9IChDbGlwYm9hcmRNYW5hZ2VyKWdldENvbnRleHQoKQorICAgICAgICAgICAgICAgICAgICAuZ2V0U3lzdGVtU2VydmljZShDb250ZXh0LkNMSVBCT0FSRF9TRVJWSUNFKTsKKyAgICAgICAgICAgIGNtLnNldFRleHQoc2VsZWN0aW9uKTsKICAgICAgICAgfQogICAgICAgICBpbnZhbGlkYXRlKCk7IC8vIHJlbW92ZSBzZWxlY3Rpb24gcmVnaW9uIGFuZCBwb2ludGVyCiAgICAgICAgIHJldHVybiBjb3BpZWRTb21ldGhpbmc7CiAgICAgfQogCiAgICAgLyoqCi0gICAgICogQGhpZGUgcGVuZGluZyBBUEkgY291bmNpbCBhcHByb3ZhbC4KKyAgICAgKiBSZXR1cm5zIHRoZSBjdXJyZW50bHkgaGlnaGxpZ2h0ZWQgdGV4dCBhcyBhIHN0cmluZy4KICAgICAgKi8KLSAgICBwdWJsaWMgU3RyaW5nIGdldFNlbGVjdGlvbigpIHsKKyAgICBTdHJpbmcgZ2V0U2VsZWN0aW9uKCkgewogICAgICAgICBpZiAobU5hdGl2ZUNsYXNzID09IDApIHJldHVybiAiIjsKICAgICAgICAgcmV0dXJuIG5hdGl2ZUdldFNlbGVjdGlvbigpOwogICAgIH0KQEAgLTQ0MjQsMTIgKzQyODIsMjIgQEAKIAogICAgIEBPdmVycmlkZQogICAgIHByb3RlY3RlZCB2b2lkIG9uRGV0YWNoZWRGcm9tV2luZG93KCkgewotICAgICAgICBjbGVhclRleHRFbnRyeShmYWxzZSk7Ci0gICAgICAgIGRpc21pc3Nab29tQ29udHJvbCgpOworICAgICAgICBjbGVhclRleHRFbnRyeSgpOworICAgICAgICBtWm9vbU1hbmFnZXIuZGlzbWlzc1pvb21QaWNrZXIoKTsKICAgICAgICAga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1cnNvciByaW5nCiAgICAgICAgICAgICAgICAgbURyYXdDdXJzb3JSaW5nID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICBzZXRGb2N1c0NvbnRyb2xsZXJBY3RpdmUodHJ1ZSk7CiAgICAgICAgICAgICAgICAgaWYgKG1OYXRpdmVDbGFzcyAhPSAwKSB7CiAgICAgICAgICAgICAgICAgICAgIG5hdGl2ZVJlY29yZEJ1dHRvbnModHJ1ZSwgZmFsc2UsIHRydWUpOwotICAgICAgICAgICAgICAgICAgICBpZiAoaW5FZGl0aW5nTW9kZSgpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBtV2ViVmlld0NvcmUuc2VuZE1lc3NhZ2UoRXZlbnRIdWIuU0VUX0FDVElWRSwgMSwgMCk7Ci0gICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIC8vIElmIG91ciB3aW5kb3cgZ2FpbmVkIGZvY3VzLCBidXQgd2UgZG8gbm90IGhhdmUgaXQsIGRvIG5vdAotICAgICAgICAgICAgICAgIC8vIGRyYXcgdGhlIGN1cnNvciByaW5nLgotICAgICAgICAgICAgICAgIG1EcmF3Q3Vyc29yUmluZyA9IGZhbHNlOworICAgICAgICAgICAgICAgIGlmICghaW5FZGl0aW5nTW9kZSgpKSB7CisgICAgICAgICAgICAgICAgICAgIC8vIElmIG91ciB3aW5kb3cgZ2FpbmVkIGZvY3VzLCBidXQgd2UgZG8gbm90IGhhdmUgaXQsIGRvIG5vdAorICAgICAgICAgICAgICAgICAgICAvLyBkcmF3IHRoZSBjdXJzb3IgcmluZy4KKyAgICAgICAgICAgICAgICAgICAgbURyYXdDdXJzb3JSaW5nID0gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgIHNldEZvY3VzQ29udHJvbGxlckFjdGl2ZShmYWxzZSk7CisgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIC8vIFdlIGRvIG5vdCBjYWxsIG5hdGl2ZVJlY29yZEJ1dHRvbnMgaGVyZSBiZWNhdXNlIHdlIGFzc3VtZQogICAgICAgICAgICAgICAgIC8vIHRoYXQgd2hlbiB3ZSBsb3N0IGZvY3VzLCBvciB3aW5kb3cgZm9jdXMsIGl0IGdvdCBjYWxsZWQgd2l0aAogICAgICAgICAgICAgICAgIC8vIGZhbHNlIGZvciB0aGUgZmlyc3QgcGFyYW1ldGVyCiAgICAgICAgICAgICB9CiAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICBpZiAobVdlYlZpZXdDb3JlICE9IG51bGwgJiYgZ2V0U2V0dGluZ3MoKS5nZXRCdWlsdEluWm9vbUNvbnRyb2xzKCkKLSAgICAgICAgICAgICAgICAgICAgJiYgKG1ab29tQnV0dG9uc0NvbnRyb2xsZXIgPT0gbnVsbCB8fAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICFtWm9vbUJ1dHRvbnNDb250cm9sbGVyLmlzVmlzaWJsZSgpKSkgeworICAgICAgICAgICAgaWYgKCFtWm9vbU1hbmFnZXIuaXNab29tUGlja2VyVmlzaWJsZSgpKSB7CiAgICAgICAgICAgICAgICAgLyoKLSAgICAgICAgICAgICAgICAgKiBUaGUgem9vbSBjb250cm9scyBjb21lIGluIHRoZWlyIG93biB3aW5kb3csIHNvIG91ciB3aW5kb3cKLSAgICAgICAgICAgICAgICAgKiBsb3NlcyBmb2N1cy4gT3VyIHBvbGljeSBpcyB0byBub3QgZHJhdyB0aGUgY3Vyc29yIHJpbmcgaWYKLSAgICAgICAgICAgICAgICAgKiBvdXIgd2luZG93IGlzIG5vdCBmb2N1c2VkLCBidXQgdGhpcyBpcyBhbiBleGNlcHRpb24gc2luY2UKKyAgICAgICAgICAgICAgICAgKiBUaGUgZXh0ZXJuYWwgem9vbSBjb250cm9scyBjb21lIGluIHRoZWlyIG93biB3aW5kb3csIHNvIG91cgorICAgICAgICAgICAgICAgICAqIHdpbmRvdyBsb3NlcyBmb2N1cy4gT3VyIHBvbGljeSBpcyB0byBub3QgZHJhdyB0aGUgY3Vyc29yIHJpbmcKKyAgICAgICAgICAgICAgICAgKiBpZiBvdXIgd2luZG93IGlzIG5vdCBmb2N1c2VkLCBidXQgdGhpcyBpcyBhbiBleGNlcHRpb24gc2luY2UKICAgICAgICAgICAgICAgICAgKiB0aGUgdXNlciBjYW4gc3RpbGwgbmF2aWdhdGUgdGhlIHdlYiBwYWdlIHdpdGggdGhlIHpvb20KICAgICAgICAgICAgICAgICAgKiBjb250cm9scyBzaG93aW5nLgogICAgICAgICAgICAgICAgICAqLwotICAgICAgICAgICAgICAgIC8vIElmIG91ciB3aW5kb3cgaGFzIGxvc3QgZm9jdXMsIHN0b3AgZHJhd2luZyB0aGUgY3Vyc29yIHJpbmcKICAgICAgICAgICAgICAgICBtRHJhd0N1cnNvclJpbmcgPSBmYWxzZTsKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIG1Hb3RLZXlEb3duID0gZmFsc2U7CkBAIC00NDk0LDcgKzQzNjAsNyBAQAogICAgICAgICAgICAgaWYgKG1OYXRpdmVDbGFzcyAhPSAwKSB7CiAgICAgICAgICAgICAgICAgbmF0aXZlUmVjb3JkQnV0dG9ucyhmYWxzZSwgZmFsc2UsIHRydWUpOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgc2V0Rm9jdXNDb250cm9sbGVySW5hY3RpdmUoKTsKKyAgICAgICAgICAgIHNldEZvY3VzQ29udHJvbGxlckFjdGl2ZShmYWxzZSk7CiAgICAgICAgIH0KICAgICAgICAgaW52YWxpZGF0ZSgpOwogICAgIH0KQEAgLTQ1MDUsOSArNDM3MSw5IEBACiAgICAgcHVibGljIHZvaWQgb25XaW5kb3dGb2N1c0NoYW5nZWQoYm9vbGVhbiBoYXNXaW5kb3dGb2N1cykgewogICAgICAgICBzZXRBY3RpdmUoaGFzV2luZG93Rm9jdXMpOwogICAgICAgICBpZiAoaGFzV2luZG93Rm9jdXMpIHsKLSAgICAgICAgICAgIEJyb3dz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2FnZSAqLyB2b2lkIHNldEZvY3VzQ29udHJvbGxlckFjdGl2ZShib29sZWFuIGFjdGl2ZSkgeworICAgICAgICBpZiAobVdlYlZpZXdDb3JlID09IG51bGwpIHJldHVybjsKKyAgICAgICAgbVdlYlZpZXdDb3JlLnNlbmRNZXNzYWdlKEV2ZW50SHViLlNFVF9BQ1RJVkUsIGFjdGl2ZSA/IDEgOiAwLCAwKTsKICAgICB9CiAKICAgICBAT3ZlcnJpZGUKQEAgLTQ1MzksNiArNDQwMyw3IEBACiAgICAgICAgICAgICAgICAgaWYgKG1OYXRpdmVDbGFzcyAhPSAwKSB7CiAgICAgICAgICAgICAgICAgICAgIG5hdGl2ZVJlY29yZEJ1dHRvbnModHJ1ZSwgZmFsc2UsIHRydWUpOwogICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBzZXRGb2N1c0NvbnRyb2xsZXJBY3RpdmUodHJ1ZSk7CiAgICAgICAgICAgICAvL30gZWxzZSB7CiAgICAgICAgICAgICAgICAgLy8gVGhlIFdlYlZpZXcgaGFzIGdhaW5lZCBmb2N1cyB3aGlsZSB3ZSBkbyBub3QgaGF2ZQogICAgICAgICAgICAgICAgIC8vIHdpbmRvd2ZvY3VzLiAgV2hlbiBvdXIgd2luZG93IGxvc3QgZm9jdXMsIHdlIHNob3VsZCBoYXZlCkBAIC00NTUyLDcgKzQ0MTcsNyBAQAogICAgICAgICAgICAgICAgIGlmIChtTmF0aXZlQ2xhc3MgIT0gMCkgewogICAgICAgICAgICAgICAgICAgICBuYXRpdmVSZWNvcmRCdXR0b25zKGZhbHNlLCBmYWxzZSwgdHJ1ZSk7CiAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIHNldEZvY3VzQ29udHJvbGxlckluYWN0aXZlKCk7CisgICAgICAgICAgICAgICAgc2V0Rm9jdXNDb250cm9sbGVyQWN0aXZlKGZhbHNlKTsKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIG1Hb3RLZXlEb3duID0gZ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biB0byB3aWRlIHNjcmVlbiwgdGhlIG5ldyB2aWV3V2lkdGgKLSAgICAgICAgICAgIC8vIGNhbiBiZSB3aWRlciB0aGFuIHRoZSBvbGQgY29udGVudCB3aWR0aC4gV2UgbGltaXQgdGhlIG1pbmltdW0KLSAgICAgICAgICAgIC8vIHNjYWxlIHRvIDEuMGYuIFRoZSBwcm9wZXIgbWluaW11bSBzY2FsZSB3aWxsIGJlIGNhbGN1bGF0ZWQgd2hlbgotICAgICAgICAgICAgLy8gdGhlIG5ldyBwaWN0dXJlIHNob3dzIHVwLgotICAgICAgICAgICAgbU1pblpvb21TY2FsZSA9IE1hdGgubWluKDEuMGYsIChmbG9hdCkgZ2V0Vmlld1dpZHRoKCkKLSAgICAgICAgICAgICAgICAgICAgLyAobURyYXdIaXN0b3J5ID8gbUhpc3RvcnlQaWN0dXJlLmdldFdpZHRoKCkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICA6IG1ab29tT3ZlcnZpZXdXaWR0aCkpOwotICAgICAgICAgICAgaWYgKG1Jbml0aWFsU2NhbGVJblBlcmNlbnQgPiAwKSB7Ci0gICAgICAgICAgICAgICAgLy8gbGltaXQgdGhlIG1pblpvb21TY2FsZSB0byB0aGUgaW5pdGlhbFNjYWxlIGlmIGl0IGlzIHNldAotICAgICAgICAgICAgICAgIGZsb2F0IGluaXRpYWxTY2FsZSA9IG1Jbml0aWFsU2NhbGVJblBlcmNlbnQgLyAxMDAuMGY7Ci0gICAgICAgICAgICAgICAgaWYgKG1NaW5ab29tU2NhbGUgPiBpbml0aWFsU2NhbGUpIHsKLSAgICAgICAgICAgICAgICAgICAgbU1pblpvb21TY2FsZSA9IGluaXRpYWxTY2FsZTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICBkaXNtaXNzWm9vbUNvbnRyb2woKTsKLQotICAgICAgICAvLyBvblNpemVDaGFuZ2VkKCkgaXMgY2FsbGVkIGR1cmluZyBXZ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sIHBsdWdpbnMsIGFuZCBjb250ZW50RWRpdGFibGUgbm9kZXMgbmVlZCB0byByZWNlaXZlIHRoZQorICAgICAgICAvLyBzaGlmdCB1cCBrZXkgZXZlbiBpZiBhbm90aGVyIGtleSB3YXMgcmVsZWFzZWQgd2hpbGUgdGhlIHNoaWZ0IGtleQorICAgICAgICAvLyB3YXMgaGVsZCBkb3duLgorICAgICAgICBpZiAoIWluRWRpdGluZ01vZGUoKSAmJiAobU5hdGl2ZUNsYXNzID09IDAKKyAgICAgICAgICAgICAgICB8fCAhbmF0aXZlUGFnZVNob3VsZEhhbmRsZVNoaWZ0QW5kQXJyb3dzKCkpKSB7CiAgICAgICAgICAgICBpZiAoZXZlbnQuZ2V0QWN0aW9uKCkgPT0gS2V5RXZlbnQuQUNUSU9OX0RPV04pIHsKICAgICAgICAgICAgICAgICBtR290S2V5RG93biA9IHRydWU7CiAgICAgICAgICAgICB9IGVsc2UgewpAQCAtNDczMCw3ICs0NTM4LDcgQEAKICAgICAgICAgcHVibGljIERyYWdUcmFja2VySGFuZGxlcihmbG9hdCB4LCBmbG9hdCB5LCBEcmFnVHJhY2tlciBwcm94eSkgewogICAgICAgICAgICAgbVByb3h5ID0gcHJveHk7CiAKLSAgICAgICAgICAgIGludCBkb2NCb3R0b20gPSBjb21wdXRlUmVhbFZlcnRpY2FsU2Nyb2xsUmFuZ2UoKSArIGdldFRpdGxlSGVpZ2h0KCk7CisgICAgICAgICAgICBpbnQgZG9jQm90dG9tID0gY29tcHV0ZVZlcnRpY2FsU2Nyb2xsUmFuZ2UoKSArIGdldFRpdGxlSGVpZ2h0KCk7CiAgICAgICAgICAgICBpbnQgdmlld1RvcCA9IGdldFNjcm9sbFkoKTsKICAgICAgICAgICAgIGludCB2aWV3Qm90dG9tID0gdmlld1RvcCArIGdldEhlaWdodCgpOwogCkBAIC00NzQzLDcgKzQ1NTEsNyBAQAogICAgICAgICAgICAgICAgICAgICAgICIgdXAvZG93bj0gIiArIG1NaW5EWSArICI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d29yZCBtb2RlLCB0dXJuIGl0IG9mZiBzbyBpdCBkb2VzIG5vdCBkcmF3Ci0gICAgICAgICAgICAvLyBtaXNwbGFjZWQuCi0gICAgICAgICAgICBpZiAoaW5FZGl0aW5nTW9kZSgpICYmIG5hdGl2ZUZvY3VzQ2FuZGlkYXRlSXNQYXNzd29yZCgpKSB7Ci0gICAgICAgICAgICAgICAgbVdlYlRleHRWaWV3LnNldEluUGFzc3dvcmQoZmFsc2UpOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBtVmlld01hbmFnZXIuc3RhcnRab29tKCk7Ci0KLSAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIHZvaWQgb25TY2FsZUVuZChTY2FsZUdlc3R1cmVEZXRlY3RvciBkZXRlY3RvcikgewotICAgICAgICAgICAgaWYgKG1QcmV2aWV3Wm9vbU9ubHkpIHsKLSAgICAgICAgICAgICAgICBtUHJldmlld1pvb21Pbmx5ID0gZmFsc2U7Ci0gICAgICAgICAgICAgICAgbUFuY2hvclggPSB2aWV3VG9Db250ZW50WCgoaW50KSBtWm9vbUNlbnRlclggKyBtU2Nyb2xsWCk7Ci0gICAgICAgICAgICAgICAgbUFuY2hvclkgPSB2aWV3VG9Db250ZW50WSgoaW50KSBtWm9vbUNlbnRlclkgKyBtU2Nyb2xsWSk7Ci0gICAgICAgICAgICAgICAgLy8gZG9uJ3QgcmVmbG93IHdoZW4gem9vbSBpbjsgd2hlbiB6b29tIG91dCwgZG8gcmVmbG93IGlmIHRoZQotICAgICAgICAgICAgICAgIC8vIG5ldyBzY2FsZSBpcyBhbG1vc3QgbWluaW11bSBzY2FsZTsKLSAgICAgICAgICAgICAgICBib29sZWFuIHJlZmxvd05vdyA9IChtQWN0dWFsU2NhbGUgLSBtTWluWm9vbVNjYWxlCi0gICAgICAgICAgICAgICAgICAgICAgICA8PSBNSU5JTVVNX1NDQUxFX0lOQ1JFTUVOVCkKLSAgICAgICAgIC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HsKLSAgICAgICAgICAgICAgICAgICAgc2NhbGUgPSBNYXRoLm1heChzY2FsZSwgbUFjdHVhbFNjYWxlICogMC44Zik7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIG1ab29tQ2VudGVyWCA9IGRldGVjdG9yLmdldEZvY3VzWCgpOwotICAgICAgICAgICAgICAgIG1ab29tQ2VudGVyWSA9IGRldGVjdG9yLmdldEZvY3VzWSgpOwotICAgICAgICAgICAgICAgIHNldE5ld1pvb21TY2FsZShzY2FsZSwgZmFsc2UsIGZhbHNlKTsKLSAgICAgICAgICAgICAgICBpbnZhbGlkYXRlKCk7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgIH0KLSAgICB9Ci0KICAgICBwcml2YXRlIGJvb2xlYW4gaGl0Rm9jdXNlZFBsdWdpbihpbnQgY29udGVudFgsIGludCBjb250ZW50WSkgewogICAgICAgICBpZiAoRGVidWdGbGFncy5XRUJfVklFVykgewogICAgICAgICAgICAgTG9nLnYoTE9HVEFHLCAibmF0aXZlRm9jdXNJc1BsdWdpbigpPSIgKyBuYXRpdmVGb2N1c0lzUGx1Z2luKCkpOwpAQCAtNTAwMCw2ICs0NzMzLDQxIEBACiAgICAgICAgIHJldHVybiBtRnVsbFNjcmVlbkhvbGRlciAhPSBudWxsOwogICAgIH0KIAorICAgIHZvaWQgb25QaW5jaFRvWm9vbUFuaW1hdGlvblN0YXJ0KCkgeworICAgICAgICAvLyBjYW5jZWwgdGhlIHNpbmdsZSB0b3VjaCBoYW5kbGluZworICAgICAgICBjYW5jZWxUb3VjaCgpOworICAgICAgICBvblpvb21BbmltYXRpb25TdGFydCgpOworICAgIH0KKworICAgIHZvaWQgb25QaW5jaFRvWm9vbUFuaW1hdGlvbkVuZChTY2FsZUdlc3R1cmVEZXRlY3RvciBkZXRlY3RvcikgeworICAgICAgICBvblpvb21Bbm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cmVEZXRlY3RvcigpOworICAgICAgICBib29sZWFuIHNraXBTY2FsZUdlc3R1cmUgPSBmYWxzZTsKKyAgICAgICAgLy8gU2V0IHRvIHRoZSBtaWQtcG9pbnQgb2YgYSB0d28tZmluZ2VyIGdlc3R1cmUgdXNlZCB0byBkZXRlY3QgaWYgdGhlCisgICAgICAgIC8vIHVzZXIgaGFzIHRvdWNoZWQgYSBsYXllci4KKyAgICAgICAgZmxvYXQgZ2VzdHVyZVggPSB4OworICAgICAgICBmbG9hdCBnZXN0dXJlWSA9IHk7CisgICAgICAgIGlmIChkZXRlY3RvciA9PSBudWxsIHx8ICFkZXRlY3Rvci5pc0luUHJvZ3Jlc3MoKSkgeworICAgICAgICAgICAgLy8gVGhlIGdlc3R1cmUgZm9yIHNjcm9sbGluZyBhIGxheWVyIGlzIHR3byBmaW5nZXJzIGNsb3NlIHRvZ2V0aGVyLgorICAgICAgICAgICAgLy8gRklYTUU6IHdlIG1heSBjb25zaWRlciBnaXZpbmcgV2ViS2l0IGFuIG9wdGlvbiB0byBoYW5kbGUKKyAgICAgICAgICAgIC8vIG11bHRpLXRvdWNoIGV2ZW50cyBsYXRlci4KKyAgICAgICAgICAgIGlmIChldi5nZXRQb2ludGVyQ291bnQoKSA+IDEpIHsKKyAgICAgICAgICAgICAgICBmbG9hdCBkeCA9IGV2LmdldFgoMSkgLSBldi5nZXRYKDApOworICAgICAgICAgICAgICAgIGZsb2F0IGR5ID0gZXYuZ2V0WSgxKSAtIGV2LmdldFkoMCk7CisgICAgICAgICAgICAgICAgZmxvYXQgZGlzdCA9IChkeCAqIGR4ICsgZHkgKiBkeSkgKgorICAgICAgICAgICAgICAgICAgICAgICAgRFJBR19MQVlFUl9JTlZFUlNFX0RFTlNJVFlfU1FVQVJFRDsKKyAgICAgICAgICAgICAgICAvLyBVc2UgdGhlIGFwcHJveGltYXRlIGNlbnRlciB0byBkZXRlcm1pbmUgaWYgdGhlIGdlc3R1cmUgaXMgaW4KKyAgICAgICAgICAgICAgICAvLyBhIGxheWVyLgorICAgICAgICAgICAgICAgIGdlc3R1cmVYID0gZXYuZ2V0WCgwKSArIChkeCAqIC41Zik7CisgICAgICAgICAgICAgICAgZ2VzdHVyZVkgPSBldi5nZXRZKDApICsgKGR5ICogLjVmKTsKKyAgICAgICAgICAgICAgICAvLyBOb3cgdXNlIGEgY29uc2lzdGVudCBwb2ludCBmb3IgdHJhY2tpbmcgbW92ZW1lbnQuCisgICAgICAgICAgICAgICAgaWYgKGV2LmdldFgoMCkgPCBldi5nZXRYKDEpKSB7CisgICAgICAgICAgICAgICAgICAgIHggPSBldi5nZXRYKDApOworICAgICAgICAgICAgICAgICAgICB5ID0gZXYuZ2V0WSgwKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICB4ID0gZXYuZ2V0WCgxKTsKKyAgICAgICAgICAgICAgICAgICAgeSA9IGV2LmdldFkoMSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGFjdGlvbiA9IGV2LmdldEFjdGlvbk1hc2tlZCgpOworICAgICAgICAgICAgICAgIGlmIChkaXN0IDwgRFJBR19MQVlFUl9GSU5HRVJfRElTVEFOQ0UpIHsKKyAgICAgICAgICAgICAgICAgICAgc2tpcFNjYWxlR2VzdHVyZSA9IHRydWU7CisgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChtVG91Y2hNb2RlID09IFRPVUNIX0RSQUdfTEFZRVJfTU9ERSkgeworICAgICAgICAgICAgICAgICAgICAvLyBGaW5nZXJzIG1vdmVkIHRvbyBmYXIgYXBhcnQgd2hpbGUgZHJhZ2dpbmcsIHRoZSB1c2VyCisgICAgICAgICAgICAgICAgICAgIC8vIG1pZ2h0IGJlIHRyeWluZyB0byB6b29tLgorICAgICAgICAgICAgICAgICAgICBtVG91Y2hNb2RlID0gVE9VQ0hfSU5JVF9NT0RFOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCiAgICAgICAgIC8vIEZJWE1FOiB3ZSBtYXkgY29uc2lkZXIgdG8gZ2l2ZSBXZWJLaXQgYW4gb3B0aW9uIHRvIGhhbmRsZSBtdWx0aS10b3VjaAogICAgICAgICAvLyBldmVudHMgbGF0ZXIuCi0gICAgICAgIGlmIChtU3VwcG9ydE11bHRpVG91Y2ggJiYgZXYuZ2V0UG9pbnRlckNvdW50KCkgPiAxKSB7Ci0gICAgICAgICAgICBpZiAobU1pblpvb21TY2FsZSA8IG1NYXhab29tU2NhbGUpIHsKLSAgICAgICAgICAgICAgICBtU2NhbGVEZXRlY3Rvci5vblRvdWNoRXZlbnQoZXYpOwotICAgICAgICAgICAgICAgIGlmIChtU2NhbGVEZXRlY3Rvci5pc0luUHJvZ3Jlc3MoKSkgewotICAgICAgICAgICAgICAgICAgICBtTGFzdFRvdWNoVGltZSA9IGV2ZW50VGltZTsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIHggPSBtU2NhbGVEZXRlY3Rvci5nZXRGb2N1c1goKTsKLSAgICAgICAgICAgICAgICB5ID0gbVNjYWxlRGV0ZWN0b3IuZ2V0Rm9jdXNZKCk7Ci0gICAgICAgICAgICAgICAgYWN0aW9uID0gZXYuZ2V0QWN0aW9uKCkgJiBNb3Rpb25FdmVudC5BQ1RJT05fTUFTSzsKLSAgICAgICAgICAgICAgICBpZiAoYWN0aW9uID09IE1vdGlvbkV2ZW50LkFDVElPTl9QT0lOVEVSX0RPV04pIHsKLSAgICAgICAgICAgICAgICAgICAgY2FuY2VsVG91Y2goKTsKLSAgICAgICAgICAgICAgICAgICAgYWN0aW9uID0gTW90aW9uRXZlbnQuQUNUSU9OX0RPV047Ci0gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChhY3Rpb24gPT0gTW90aW9uRXZlbnQuQUNUSU9OX1BPSU5URVJfVVApIHsKLSAgICAgICAgICAgICAgICAgICAgLy8gc2V0IG1MYXN0VG91Y2hYL1kgdG8gdGhlIHJlbWFpbmluZyBwb2ludAotICAgICAgICAgICAgICAgICAgICBtTGFzdFRvdWNoWCA9IHg7Ci0gICAgICAgICAgICAgICAgICAgIG1MYXN0VG91Y2hZID0geTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGFjdGlvbiA9PSBNb3Rpb25FdmVudC5BQ1RJT05fTU9WRSkgewotICAgICAgICAgICAgICAgICAgICAvLyBuZWdhdGl2ZSB4IG9yIHkgaW5kaWNhdGUgaXQgaXMgb24gdGhlIGVkZ2UsIHNraXAgaXQuCi0gICAgICAgICAgICAgICAgICAgIGlmICh4IDwgMCB8fCB5IDwgMCkgewotICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIC8vIGlmIHRoZSBwYWdlIGRpc2FsbG93IHpvb20sIHNraXAgbXVsdGktcG9pbnRlciBhY3Rpb24KKyAgICAgICAgaWYgKG1ab29tTWFuYWdlci5zdXBwb3J0c011bHRpVG91Y2hab29tKCkgJiYgZXYuZ2V0UG9pbnRlckNvdW50KCkgPiAxICYmCisgICAgICAgICAgICAgICAgbVRvdWNoTW9kZSAhPSBUT1VDSF9EUkFHX0xBWUVSX01PREUgJiYgIXNraXBTY2FsZUdlc3R1cmUpIHsKKworICAgICAgICAgICAgLy8gaWYgdGhlIHBhZ2UgZGlzYWxsb3dzIHpvb20sIHNraXAgbXVsdGktcG9pbnRlciBhY3Rpb24KKyAgICAgICAgICAgIGlmIChtWm9vbU1hbmFnZXIuaXNab29tU2NhbGVGaXhlZCgpKSB7CiAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgICB9Ci0gICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICBhY3Rpb24gPSBldi5nZXRBY3Rpb24oKTsKLSAgICAgICAgICAgIHggPSBldi5nZXRYKCk7Ci0gICAgICAgICAgICB5ID0gZXYuZ2V0WSgpOworCisgICAgICAgICAgICBpZiAoIWRldGVjdG9yLmlzSW5Qcm9ncmVzcygpICYmCisgICAgICAgICAgICAgICAgICAgIGV2LmdldEFjdGlvbk1hc2tlZCgpICE9IE1vdGlvbkV2ZW50LkFDVElPTl9QT0lOVEVSX0RPV04pIHsKKyAgICAgICAgICAgICAgICAvLyBJbnNlcnQgYSBmYWtlIHBvaW50ZXIgZG93biBldmVudCBpbiBvcmRlciB0byBzdGFydAorICAgICAgICAgICAgICAgIC8vIHRoZSB6b29tIHNjYWxlIGRldGVjdG9yLgorICAgICAgICAgICAgICAgIE1vdGlvbkV2ZW50IHRlbXAgPSBNb3Rpb25FdmVudC5vYnRhaW4oZXYpOworICAgICAgICAgICAgICAgIC8vIENsZWFyIHRoZSBvcmlnaW5hbCBldmVudCBhbmQgc2V0IGl0IHRvCisgICAgICAgICAgICAgICAgLy8gQUNUSU9OX1BPSU5URVJfRE9XTi4KKyAgICAgICAgICAgICAgICB0ZW1wLnNldEFjdGlvbih0ZW1wLmdldEFjdGlvbigpICYKKyAgICAgICAgICAgICAgICAgICAgICAgIH5Nb3Rpb25FdmVudC5BQ1RJT05fTUFTSyB8CisgICAgICAgICAgICAgICAgICAgICAgICBNb3Rpb25FdmVudC5BQ1RJT05fUE9JTlRFUl9ET1dOKTsKKyAgICAgICAgICAgICAgICBkZXRlY3Rvci5vblRvdWNoRXZlbnQodGVtcCk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGRldGVjdG9yLm9uVG91Y2hFdmVudChldik7CisKKyAgICAgICAgICAgIGlmIChkZXRlY3Rvci5pc0luUHJvZ3Jlc3MoKSkgeworICAgICAgICAgICAgICAgIG1MYXN0VG91Y2hUaW1lID0gZXZlbnRUaW1lOworICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB4ID0gZGV0ZWN0b3Iu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5zdXBwb3J0VG91Y2hPbmx5KCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJlbW92ZVRvdWNoSGlnaGxpZ2h0KHRydWUpOworICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIGlmIChkZWx0YVggKiBkZWx0YVggKyBkZWx0YVkgKiBkZWx0YVkgPCBtRG91YmxlVGFwU2xvcFNxdWFyZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgbVRvdWNoTW9kZSA9IFRPVUNIX0RPVUJMRV9UQVBfTU9ERTsKICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKQEAgLTUwOTMsMTMgKzQ5MTMsMzMgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudFgsIGNvbnRlbnRZKSA6IGZhbHNlOwogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfSBlbHNlIHsgLy8gdGhlIG5vcm1hbCBjYXNlCi0gICAgICAgICAgICAgICAgICAgIG1QcmV2aWV3Wm9vbU9ubHkgPSBmYWxzZTsKICAgICAgICAgICAgICAgICAgICAgbVRvdWNoTW9kZSA9IFRPVUNIX0lOSVRfTU9ERTsKICAgICAgICAgICAgICAgICAgICAgbURlZmVyVG91Y2hQcm9jZXNzID0gKCFpbkZ1bGxTY3JlZW5Nb2RlKCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmJiBtRm9yd2FyZFRvdWNoRXZlbnRzKSA/IGhpdEZvY3VzZWRQbHVnaW4oCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudFgsIGNvbnRlbnRZKSA6IGZhbHNlOwogICAgICAgICAgICAgICAgICAgICBtV2ViVmlld0NvcmUuc2VuZE1lc3NhZ2UoCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRXZlbnRIdWIuVVBEQVRFX0ZSQU1FX0NBQ0hFX0lGX0xPQURJTkcpOworICAgICAgICAgICAgICAgICAgICBpZiAoZ2V0U2V0dGluZ3MoKS5zdXBwb3J0VG91Y2hPbmx5KCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIFRvdWNoSGlnaGxpZ2h0RGF0YSBkYXRhID0gbmV3IFRvdWNoSGlnaGxpZ2h0RGF0YSgpOworICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS5tWCA9IGNvbnRlbnRYOworICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS5tWSA9IGNvbnRlbnRZOworICAgICAgICAgICAgICAgICAgICAgICAgZGF0YS5tU2xvcCA9IHZpZXdUb0NvbnRlbnREaW1lbnNpb24obU5hdlNsb3ApOworICAgICAgICAgICAgICAgICAgICAgICAgbVdlYlZpZXdDb3JlLnNlbmRNZXNzYWdlRGVsYXllZCgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRXZlbnRIdWIuR0VUX1RPVUNIX0hJR0hMSUdIVF9SRUNUUywgZGF0YSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVmlld0NvbmZpZ3VyYXRpb24uZ2V0VGFwVGltZW91dCgpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChERUJVR19UT1VDSF9ISUdITElHSFQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZ2V0U2V0dGluZ3MoKS5nZXROYXZEdW1wKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVRvdWNoSGlnaGxpZ2h0WCA9IChpbnQpIHggKyBtU2Nyb2xsWDsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVRvdWNoSGlnaGxpZ2h0WSA9IChpbnQpIHkgKyBtU2Nyb2xsWTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVByaXZhdGVIYW5kbGVyLnBvc3REZWxheWVkKG5ldyBSdW5uYWJsZSgpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIHJ1bigpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtVG91Y2hIaWdobGlnaHRYID0gbVRvdWNoSGlnaGxpZ2h0WSA9IDA7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW52YWxpZGF0ZSgpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBUT1VDSF9ISUdITElHSFRfRUxBUFNFX1RJTUUpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICBpZiAobUxvZ0V2ZW50ICYmIGV2ZW50VGltZSAtIG1MYXN0VG91Y2hVcFRpbWUgPCAxMDAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBFdmVudExvZy53cml0ZUV2ZW50KEV2ZW50TG9nVGFncy5CUk9XU0VSX0RPVUJMRV9UQVBfRFVSQVRJT04sCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChldmVudFRpbWUgLSBtTGFzdFRvdWNoVXBUaW1lKSwgZXZlbnRUaW1lKTsKQEAgLTUxMzUsMTcgKzQ5NzUsMTUgQEAKICAgICAgICAgICAgICAgICAgICAgICAgIHRlZC5tWSA9IGNvbnRlbnRZOwogICAgICAgICAgICAgICAgICAgICAgICAgdGVkLm1NZXRhU3RhdGUgPSBldi5nZXRNZXRhU3RhdGUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgIHRlZC5tUmVwcm9jZXNzID0gbURlZmVyVG91Y2hQcm9jZXNzOworICAgICAgICAgICAgICAgICAgICAgICAgbVdlYlZpZXdDb3JlLnNlbmRNZXNzYWdlKEV2ZW50SHViLlRPVUNIX0VWRU5ULCB0ZWQpOwogICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1EZWZlclRvdWNoUHJvY2VzcykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHN0aWxsIG5lZWRzIHRvIHNldCB0aGVtIGZvciBjb21wdXRlIGRlbHRhWC9ZCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUxhc3RUb3VjaFggPSB4OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1MYXN0VG91Y2hZID0geTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ZWQubVZpZXdYID0geDsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ZWQubVZpZXdZID0geTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBtV2ViVmlld0NvcmUuc2VuZE1lc3NhZ2UoRXZlbnRIdWIuVE9VQ0hfRVZFTlQsIHRlZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICBtV2ViVmlld0NvcmUuc2VuZE1lc3NhZ2UoRXZlbnRIdWIuVE9VQ0hfRVZFTlQsIHRlZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWluRnVsbFNjcmVlbk1vZGUoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Qcml2YXRlSGFuZGxlci5yZW1vdmVNZXNzYWdlcyhQUkVWRU5UX0RFRkFVTFRfVElNRU9VVCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVByaXZhdGVIYW5kbGVyLnNlbmRNZXNzYWdlRGVsYXllZChtUHJpdmF0ZUhhbmRsZXIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5vYnRhaW5NZXNzYWdlKFBSRVZFTlRfREVGQVVMVF9USU1FT1VULAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhY3Rpb24sIDApLCBUQVBfVElNRU9VVCk7CkBAIC01MTY2LDI0ICs1MDA0LDI0IEBACiAgICAgICAgICAgICAgICAgICAgIGlmIChtVG91Y2hNb2RlID09IFRPVUNIX0RPVUJMRV9UQVBfTU9ERSkgewogICAgICAgICAgICAgICAgICAgICAgICAgbVRvdWNoTW9kZSA9IFRPVUNIX0lOSVRfTU9ERTsKICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBpZiAoZ2V0U2V0dGluZ3MoKS5zdXBwb3J0VG91Y2hPbmx5KCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJlbW92ZVRvdWNoSGlnaGxpZ2h0KHRydWUpOworICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIC8vIHBhc3MgdGhlIHRvdWNoIGV2ZW50cyBmcm9tIFVJIHRocmVhZCB0byBXZWJDb3JlIHRocmVhZAogICAgICAgICAgICAgICAgIGlmIChzaG91bGRGb3J3YXJkVG91Y2hFdmVudCgpICYmIG1Db25maXJtTW92ZSAmJiAoZmlyc3RNb3ZlCiAgICAgICAgICAgICAgICAgICAgICAgICB8fCBldmVudFRpbWUgLSBtTGFzdFNlbnRUb3VjaFRpbWUgPiBtQ3VycmVudFRvdWNoSW50ZXJ2YWwpKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1MYXN0U2VudFRvdWNoVGltZSA9IGV2ZW50VGltZTsKICAgICAgICAgICAgICAgICAgICAgVG91Y2hFdmVudERhdGEgdGVkID0gbmV3IFRvdWNoRXZlbnREYXRhKCk7CiAgICAgICAgICAgICAgICAgICAgIHRlZC5tQWN0aW9uID0gYWN0aW9uOwogICAgICAgICAgICAgICAgICAgICB0ZWQubVggPSBjb250ZW50WDsKICAgICAgICAgICAgICAgICAgICAgdGVkLm1ZID0gY29udGVudFk7CiAgICAgICAgICAgICAgICAgICAgIHRlZC5tTWV0YVN0YXRlID0gZXYuZ2V0TWV0YVN0YXRlKCk7CiAgICAgICAgICAgICAgICAgICAgIHRlZC5tUmVwcm9jZXNzID0gbURlZmVyVG91Y2hQcm9jZXNzOworICAgICAgICAgICAgICAgICAgICBtV2ViVmlld0NvcmUuc2VuZE1lc3NhZ2UoRXZlbnRIdWIuVE9VQ0hfRVZFTlQsIHRlZCk7CisgICAgICAgICAgICAgICAgICAgIG1MYXN0U2VudFRvdWNoVGltZSA9IGV2ZW50VGltZTsKICAgICAgICAgICAgICAgICAgICAgaWYgKG1EZWZlclRvdWNoUHJvY2VzcykgewotICAgICAgICAgICAgICAgICAgICAgICAgdGVkLm1WaWV3WCA9IHg7Ci0gICAgICAgICAgICAgICAgICAgICAgICB0ZWQubVZpZXdZID0geTsKLSAgICAgICAgICAgICAgICAgICAgICAgIG1XZWJWaWV3Q29yZS5zZW5kTWVzc2FnZShFdmVudEh1Yi5UT1VDSF9FVkVOVCwgdGVkKTsKICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIG1XZWJWaWV3Q29yZS5zZW5kTWVzc2FnZShFdmVudEh1Yi5UT1VDSF9FVkVOVCwgdGVkKTsKICAgICAgICAgICAgICAgICAgICAgaWYgKGZpcnN0TW92ZSAmJiAhaW5GdWxsU2NyZWVuTW9kZSgpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBtUHJpdmF0ZUhhbmRsZXIuc2VuZE1lc3NhZ2VEZWxheWVkKG1Qcml2YXRlSGFuZGxlcgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAub2J0YWluTWVzc2FnZShQUkVWRU5UX0RFRkFVTFRfVElNRU9VVCwKQEAgLTUyMTIsMTEgKzUwNTAsMTMgQEAKICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgfQogCi0gICAgICAgICAgICAgICAgaWYgKG1Ub3VjaE1vZGUgIT0gVE9VQ0hfRFJBR19NT0RFKSB7CisgICAgICAgICAgICAgICAgaWYgKG1Ub3VjaE1vZGUgIT0gVE9VQ0hfRFJBR19NT0RFICYmCisgICAgICAgICAgICAgICAgICAgICAgICBtVG91Y2hNb2RlICE9IFRPVUNIX0RSQUdfTEFZRVJfTU9ERSkgewogCiAgICAgICAgICAgICAgICAgICAgIGlmICghbUNvbmZpcm1Nb3ZlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgfQorCiAgICAgICAgICAgICAgICAgICAgIGlmIChtUHJldmVudERlZmF1bHQgPT0gUFJFVkVOVF9ERUZBVUxUX01BWUJFX1lFUwogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHx8IG1QcmV2ZW50RGVmYXVsdCA9PSBQUkVWRU5UX0RFRkFVTFRfTk9fRlJPTV9UT1VDSF9ET1dOKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAvLyB0cmFjayBtTGFzdFRvdWNoVGltZSBhcyB3ZSBtYXkgbmVlZCB0byBkbyBmbGluZyBhdApAQCAtNTI0Myw2ICs1MDgzLDkgQEAKICAgICAgICAgICAgICAgICAgICAgZGVsdGFYID0gMDsKICAgICAgICAgICAgICAgICAgICAgZGVsdGFZID0gMDsKIAorICAgICAgICAgICAgICAgICAgICBpZiAoc2tpcFNjYWxlR2VzdHVyZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnRTY3JvbGxpbmdMYXllcihnZXN0dXJlWCwgZ2VzdHVyZVkpOworICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIHN0YXJ0RHJhZygpOwogICAgICAgICAgICAgICAgIH0KIApAQCAtNTI1MSw2ICs1MDk0LDIwIEBACiAgICAgICAgICAgICAgICAgfQogCiAgICAgICAgICAgICAgICAgLy8gZG8gcGFuCisgICAgICAgICAgICAgICAgaWYgKG1Ub3VjaE1vZGUgIT0gVE9VQ0hfRFJBR19MQVlFUl9NT0RFKSB7CisgICAgICAgICAgICAgICAgICAgIGludCBuZXdTY3JvbGxYID0gcGluTG9jWChtU2Nyb2xsWCArIGRlbHRhWCk7CisgICAgICAgICAgICAgICAgICAgIGludCBuZXdEZWx0YVggPSBuZXdTY3JvbGxYIC0gbVNjcm9sbFg7CisgICAgICAgICAgICAgICAgICAgIGlmIChkZWx0YVggIT0gbmV3RGVsdGFYKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBkZWx0YVggPSBuZXdEZWx0YVg7CisgICAgICAgICAgICAgICAgICAgICAgICBmRGVsdGFYID0gKGZsb2F0KSBuZXdEZWx0YVg7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgaW50IG5ld1Njcm9sbFkgPSBwaW5Mb2NZKG1TY3JvbGxZICsgZGVsdGFZKTsKKyAgICAgICAgICAgICAgICAgICAgaW50IG5ld0RlbHRhWSA9IG5ld1Njcm9sbFkgLSBtU2Nyb2xsWTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGRlbHRhWSAhPSBuZXdEZWx0YVkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGRlbHRhWSA9IG5ld0RlbHRhWTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZEZWx0YVkgPSAoZmxvYXQpIG5ld0RlbHRhWTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBib29sZWFuIGRvbmUgPSBmYWxzZTsKICAgICAgICAgICAgICAgICBib29sZWFuIGtlZXBTY3JvbGxCYXJzVmlzaWJsZSA9IGZhbHNlOwogICAgICAgICAgICAgICAgIGlmIChNYXRoLmFicyhmRGVsdGFYKSA8IDEuMGYgJiYgTWF0aC5hYnMoZkRlbHRhWSkgPCAxLjBmKSB7CkBAIC01MzE3LDcgKzUxNzQsOSBAQAogCiAgICAgICAgICAgICAgICAgZG9EcmFnKGRlbHRhWCwgZGVsdGFZKTsKIAotICAgICAgICAgICAgICAgIGlmIChrZWVwU2Nyb2xsQmFyc1Zpc2libGUpIHsKKyAgICAgICAgICAgICAgICAvLyBUdXJuIG9mZiBzY3JvbGxiYXJzIHdoZW4gZHJhZ2dpbmcgYSBsYXllci4KKyAgICAgICAgICAgICAgICBpZiAoa2VlcFNjcm9sbEJhcnNWaXNpYmxlICYmCisgICAgICAgICAgICAgICAgICAgICAgICBtVG91Y2hNb2RlICE9IFRPVUNIX0RSQUdfTEFZRVJfTU9ERSkgewogICAgICAgICAgICAgICAgICAgICBpZiAobUhlbGRNb3Rpb25sZXNzICE9IE1PVElPTkxFU1NfVFJVRSkgewogICAgICAgICAgICAgICAgICAgICAgICAgbUhlbGRNb3Rpb25sZXNzID0gTU9USU9OTEVTU19UUlVFOwogICAgICAgICAgICAgICAgICAgICAgICAgaW52YWxpZGF0ZSgpOwpAQCAtNTMzMiw2ICs1MTkxLDcgQEAKICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIGNhc2UgTW90aW9uRXZlbnQuQUNUSU9OX1VQOiB7CisgICAgICAgICAgICAgICAgaWYgKCFpc0ZvY3VzZWQoKSkgcmVxdWVzdEZvY3VzKCk7CiAgICAgICAgICAgICAgICAgLy8gcGFzcyB0aGUgdG91Y2ggZXZlbnRzIGZyb20gVUkgdGhyZWFkIHRvIFdlYkNvcmUgdGhyZWFkCiAgICAgICAgICAgICAgICAgaWYgKHNob3VsZEZvcndhcmRUb3VjaEV2ZW50KCkpIHsKICAgICAgICAgICAgICAgICAgICAgVG91Y2hFdmVudERhdGEgdGVkID0gbmV3IFRvdWNoRXZlbnREYXRhKCk7CkBAIC01MzQwLDEwICs1MjAwLDYgQEAKICAgICAgICAgICAgICAgICAgICAgdGVkLm1ZID0gY29udGVudFk7CiAgICAgICAgICAgICAgICAgICAgIHRlZC5tTWV0YVN0YXRlID0gZXYuZ2V0TWV0YVN0YXRlKCk7CiAgICAgICAgICAgICAgICAgICAgIHRlZC5tUmVwcm9jZXNzID0gbURlZmVyVG91Y2hQcm9jZXNzOwotICAgICAgICAgICAgICAgICAgICBpZiAobURlZmVyVG91Y2hQcm9jZXNzKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICB0ZWQubVZpZXdYID0geDsKLSAgICAgICAgICAgICAgICAgICAgICAgIHRlZC5tVmlld1kgPSB5OwotICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIG1XZWJWaWV3Q29yZS5zZW5kTWVzc2FnZShFdmVudEh1Yi5UT1VDSF9FVkVOVCwgdGVkKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgbUxhc3RUb3VjaFVwVGltZSA9IGV2ZW50VGltZTsKQEAgLTUzNTgsMTMgKzUyMTQsOSBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRlZC5tWSA9IGNvbnRlbnRZOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRlZC5tTWV0YVN0YXRlID0gZXYuZ2V0TWV0YVN0YXRlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGVkLm1SZXByb2Nlc3MgPSBtRGVmZXJUb3VjaFByb2Nlc3M7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1EZWZlclRvdWNoUHJvY2VzcykgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ZWQubVZpZXdYID0geDsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGVkLm1WaWV3WSA9IHk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1XZWJWaWV3Q29yZS5zZW5kTWVzc2FnZShFdmVudEh1Yi5UT1VDSF9FVkVOVCwgdGVkKTsKICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobVByZXZlbnREZWZhdWx0ICE9IFBSRVZFTlRfREVGQVVMVF9ZRVMpewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvRG91YmxlVGFwKCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVpvb21NYW5hZ2VyLmhhbmRsZURvdWJsZVRhcChtTGFzdFRvdWNoWCwgbUxhc3RUb3VjaFkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Ub3VjaE1vZGUgPSBUT1VDSF9ET05FX01PREU7CiAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKQEAgLTUzNzksOSArNTIzMSwxNyBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtUHJldmVudERlZmF1bHQgIT0gUFJFVkVOVF9ERUZBVUxUX1lFUwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJiYgKGNvbXB1dGVNYXhTY3JvbGxYKCkgPiAwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHx8IGNvbXB1dGVNYXhTY3JvbGxZKCkgPiAwKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBVSSB0YWtlcyBjb250cm9sIGJhY2ssIGNhbmNlbCBXZWJDb3JlIHRvdWNoCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhbmNlbFdlYkNvcmVUb3VjaEV2ZW50KGNvbnRlbnRYLCBjb250ZW50WSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnVlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gSWYgdGhlIHVzZXIgaGFzIHBlcmZvcm1lZCBhIHZlcnkgcXVpY2sgdG91Y2gKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gc2VxdWVuY2UgaXQgaXMgcG9zc2libGUgdGhhdCB3ZSBtYXkgZ2V0IGhlcmUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gYmVmb3JlIFdlYkNvcmUgaGFzIGhhZCBhIGNoYW5jZSB0byBwcm9jZXNzIHRoZSBldmVudHMuCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIEluIHRoaXMgY2FzZSwgYW55IGNhbGwgdG8gcHJldmVudERlZmF1bHQgaW4gdGhlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIEpTIHRvdWNoIGhhbmRsZXIgd2lsbCBub3QgaGF2ZSBiZWVuIGV4ZWN1dGVkIHlldC4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gSGVuY2Ugd2Ugd2lsbCBzZWUgYm90aCB0aGUgVUkgKG5vdykgYW5kIFdlYkNvcmUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gKHdoZW4gY29udGV4dCBzd2l0Y2hlcykgaGFuZGxpbmcgdGhlIGV2ZW50LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyByZWdhcmRsZXNzIG9mIHdoZXRoZXIgdGhlIHdlYiBkZXZlbG9wZXIgYWN0dWFsbHkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gZG9lc2VzIHByZXZlbnREZWZhdWx0IGluIHRoZWlyIHRvdWNoIGhhbmRsZXIuIFRoaXMKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gaXMgdGhlIG5hdHVyZSBvZiBvdXIgYXN5bmNocm9ub3VzIHRvdWNoIG1vZGVsLgorCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHdlIHdpbGwgbm90IHJld3JpdGUgZHJhZyBjb2RlIGhlcmUsIGJ1dCB3ZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyB3aWxsIHRyeSBmbGluZyBpZiBpdCBhcHBsaWVzLgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBXZWJWaWV3Q29yZS5yZWR1Y2VQcmlvcml0eSgpOwpAQCAtNTM5OSwxMyArNTI1OSwxNiBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1TZWxlY3RpbmdUZXh0KSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuYXRpdmVIaXRTZWxlY3Rpb24oY29udGVudFgsIGNvbnRlbnRZKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29weVNlbGVjdGlvbigpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyB0YXBwaW5nIG9uIHNlbGVjdGlvbiBvciBjb250cm9scyBkb2VzIG5vdGhpbmcKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFuYXRpdmVIaXRTZWxlY3Rpb24oY29udGVudFgsIGNvbnRlbnRZKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VsZWN0aW9uRG9uZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGVjdGlvbkRvbmUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtVG91Y2hNb2RlID09IFRPVUNIX0lOSVRfTU9ERSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIG9ubHkgdHJpZ2dlciBkb3VibGUgdGFwIGlmIHRoZSBXZWJWaWV3IGlzCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gc2NhbGFibGUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobVRvdWNoTW9kZSA9PSBUT1VDSF9JTklUX01PREUKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICYmIChjYW5ab29tSW4oKSB8fCBjYW5ab29tT3V0KCkpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Qcml2YXRlSGFuZGxlci5zZW5kRW1wdHlNZXNzYWdlRGVsYXllZCgKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBSRUxFQVNFX1NJTkdMRV9UQVAsIFZpZXdDb25maWd1cmF0aW9uCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAuZ2V0RG91YmxlVGFwVGltZW91dCgpKTsKQEAgLTU0MzQsMTggKzUyOTcsMTMgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtSGVsZE1vdGlvbmxlc3MgPSBNT1RJT05MRVNTX0lHTk9SRTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb0ZsaW5nKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtU2Nyb2xsZXIuc3ByaW5nYmFjayhtU2Nyb2xsWCwgbVNjcm9sbFksIDAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21wdXRlTWF4U2Nyb2xsWCgpLCAwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29tcHV0ZU1heFNjcm9sbFkoKSkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW52YWxpZGF0ZSgpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHJlZHJhdyBpbiBoaWdoLXF1YWxpdHksIGFzIHdlJ3JlIGRvbmUgZHJhZ2dpbmcKICAgICAgICAgICAgICAgICAgICAgICAgIG1IZWxkTW90aW9ubGVzcyA9IE1PVElPTkxFU1NfVFJVRTsKICAgICAgICAgICAgICAgICAgICAgICAgIGludmFsaWRhdGUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGZhbGwgdGhyb3VnaAogICAgICAgICAgICAgICAgICAgICBjYXNlIFRPVUNIX0RSQUdfU1RBUlRfTU9ERToKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBUT1VDSF9EUkFHX0xBWUVSX01PREU6CiAgICAgICAgICAgICAgICAgICAgICAgICAvLyBUT1VDSF9EUkFHX1NUQVJUX01PREUgc2hvdWxkIG5vdCBoYXBwZW4gZm9yIHRoZSByZWFsCiAgICAgICAgICAgICAgICAgICAgICAgICAvLyBkZXZpY2UgYXMgd2UgYWxtb3N0IGNlcnRhaW4gd2lsbCBnZXQgYSBNT1ZFLiBCdXQgdGhpcwogICAgICAgICAgICAgICAgICAgICAgICAgLy8gaXMgcG9zc2libGUgb24gZW11bGF0b3IuCkBAIC01NDU5LDggKzUzMTcsNiBAQAogICAgICAgICAgICAgfQogICAgICAgICAgICAgY2FzZSBNb3Rpb25FdmVudC5BQ1RJT05fQ0FOQ0VMOiB7CiAgICAgICAgICAgICAgICAgaWYgKG1Ub3VjaE1vZGUgPT0gVE9VQ0hfRFJBR19NT0RFKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1TY3JvbGxlci5zcHJpbmdiYWNrKG1TY3JvbGxYLCBtU2Nyb2xsWSwgMCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21wdXRlTWF4U2Nyb2xsWCgpLCAwLCBjb21wdXRlTWF4U2Nyb2xsWSgpKTsKICAgICAgICAgICAgICAgICAgICAgaW52YWxpZGF0ZSgpOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBjYW5jZWxXZWJDb3JlVG91Y2hFdmVudChjb250ZW50WCwgY29udGVudFksIGZhbHNlKTsKQEAgLTU1MDQsNjcgKzUzNjAsMjYgQEAKICAgICAgICAgaWYgKCFtRHJhZ0Zyb21UZXh0SW5wdXQpIHsKICAgICAgICAgICAgIG5hdGl2ZUhpZGVDdXJzb3IoKTsKICAgICAgICAgfQotICAgICAgICBXZWJTZXR0aW5ncyBzZXR0aW5ncyA9IGdldFNldHRpbmdzKCk7Ci0gICAgICAgIGlmIChzZXR0aW5ncy5zdXBwb3J0Wm9vbSgpCi0gICAgICAgICAgICAgICAgJiYgc2V0dGluZ3MuZ2V0QnVpbHRJblpvb21Db250cm9scygpCi0gICAgICAgICAgICAgICAgJiYgIWdldFpvb21CdXR0b25zQ29udHJvbGxlcigpLmlzVmlzaWJsZSgpCi0gICAgICAgICAgICAgICAgJiYgbU1pblpvb21TY2FsZSA8IG1NYXhab29tU2NhbGUKLSAgICAgICAgICAgICAgICAmJiAobUhvcml6b250YWxTY3JvbGxCYXJNb2RlICE9IFNDUk9MTEJBUl9BTFdBWVNPRkYKLSAgICAgICAgICAgICAgICAgICAgICAgIHx8IG1WZXJ0aWNhbFNjcm9sbEJhck1vZGUgIT0gU0NST0xMQkFSX0FMV0FZU09GRikpIHsKLSAgICAgICAgICAgIG1ab29tQnV0dG9uc0NvbnRyb2xsZXIuc2V0VmlzaWJsZSh0cnVlKTsKLSAgICAgICAgICAgIGludCBjb3VudCA9IHNldHRpbmdzLmdldERvdWJsZVRhcFRvYXN0Q291bnQoKTsKLSAgICAgICAgICAgIGlmIChtSW5ab29tT3ZlcnZpZXcgJiYgY291bnQgPiAwKSB7Ci0gICAgICAgICAgICAgICAgc2V0dGluZ3Muc2V0RG91YmxlVGFwVG9hc3RDb3VudCgtLWNvdW50KTsKLSAgICAgICAgICAgICAgICBUb2FzdC5tYWtlVGV4dChtQ29udGV4dCwKLSAgICAgICAgICAgICAgICAgICAgICAgIGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3RyaW5nLmRvdWJsZV90YXBfdG9hc3QsCi0gICAgICAgICAgICAgICAgICAgICAgICBUb2FzdC5MRU5HVEhfTE9ORykuc2hvdygpOwotICAgICAgICAgICAgfQorCisgICAgICAgIGlmIChtSG9yaXpvbnRhbFNjcm9sbEJhck1vZGUgIT0gU0NST0xMQkFSX0FMV0FZU09GRgorICAgICAgICAgICAgICAgIHx8IG1WZXJ0aWNhbFNjcm9sbEJhck1vZGUgIT0gU0NST0xMQkFSX0FMV0FZU09GRikgeworICAgICAgICAgICAgbVpvb21NYW5hZ2VyLmludm9rZVpvb21QaWNrZXIoKTsKICAgICAgICAgfQogICAgIH0KIAogICAgIHByaXZhdGUgdm9pZCBkb0RyYWcoaW50IGRlbHRhWCwgaW50IGRlbHRhWSkgewogICAgICAgICBpZiAoKGRlbHRhWCB8IGRlbHRhWSkgIT0gMCkgewotICAgICAgICAgICAgZmluYWwgaW50IG9sZFggPSBtU2Nyb2xsWDsKLSAgICAgICAgICAgIGZpbmFsIGludCBvbGRZID0gbVNjcm9sbFk7Ci0gICAgICAgICAgICBmaW5hbCBpbnQgcmFuZ2VYID0gY29tcHV0ZU1heFNjcm9sbFgoKTsKLSAgICAgICAgICAgIGZpbmFsIGludCByYW5nZVkgPSBjb21wdXRlTWF4U2Nyb2xsWSgpOwotICAgICAgICAgICAgb3ZlcnNjcm9sbEJ5KGRlbHRhWCwgZGVsdGFZLCBvbGRYLCBvbGRZLAotICAgICAgICAgICAgICAgICAgICByYW5nZVgsIHJhbmdlWSwKLSAgICAgICAgICAgICAgICAgICAgbU92ZXJzY3JvbGxEaXN0YW5jZSwgbU92ZXJzY3JvbGxEaXN0YW5jZSwgdHJ1ZSk7Ci0KLSAgICAgICAgICAgIGlmIChtRWRnZUdsb3dUb3AgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIC8vIERvbid0IHNob3cgbGVmdC9yaWdodCBnbG93cyBpZiB3ZSBmaXQgdGhlIHdob2xlIGNvbnRlbnQuCi0gICAgICAgICAgICAgICAgaWYgKHJhbmdlWCA+IDApIHsKLSAgICAgICAgICAgICAgICAgICAgZmluYWwgaW50IHB1bGxlZFRvWCA9IG9sZFggKyBkZWx0YVg7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChwdWxsZWRUb1ggPCAwKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBtRWRnZUdsb3dMZWZ0Lm9uUHVsbCgoZmxvYXQpIGRlbHRhWCAvIGdldFdpZHRoKCkpOwotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHB1bGxlZFRvWCA+IHJhbmdlWCkgewotICAgICAgICAgICAgICAgICAgICAgICAgbUVkZ2VHbG93UmlnaHQub25QdWxsKChmbG9hdCkgZGVsdGFYIC8gZ2V0V2lkdGgoKSk7Ci0gICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChtVG91Y2hNb2RlID09IFRPVUNIX0RSQUdfTEFZRVJfTU9ERSkgeworICAgICAgICAgICAgICAgIGRlbHRhWCA9IHZpZXdUb0NvbnRlbnREaW1lbnNpb24oZGVsdGFYKTsKKyAgICAgICAgICAgICAgICBkZWx0YVkgPSB2aWV3VG9Db250ZW50RGltZW5zaW9uKGRlbHRhWSk7CisgICAgICAgICAgICAgICAgaWYgKG5hdGl2ZVNjcm9sbExheWVyKG1TY3JvbGxpbmdMYXllciwgZGVsdGFYLCBkZWx0YVkpKSB7CisgICAgICAgICAgICAgICAgICAgIGludmFsaWRhdGUoKTsKICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBpZiAocmFuZ2VZID4gMCB8fCBnZXRPdmVyc2Nyb2xsTW9kZSgpID09IE9WRVJTQ1JPTExfQUxXQVlTKSB7Ci0gICAgICAgICAgICAgICAgICAgIGZpbmFsIGludCBwdWxsZWRUb1kgPSBvbGRZICsgZGVsdGFZOwotICAgICAgICAgICAgICAgICAgICBpZiAocHVsbGVkVG9ZIDwgMCkgewotICAgICAgICAgICAgICAgICAgICAgICAgbUVkZ2VHbG93VG9wLm9uUHVsbCgoZmxvYXQpIGRlbHRhWSAvIGdldEhlaWdodCgpKTsKLSAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChwdWxsZWRUb1kgPiByYW5nZVkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIG1FZGdlR2xvd0JvdHRvbS5vblB1bGwoKGZsb2F0KSBkZWx0YVkgLyBnZXRIZWlnaHQoKSk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgfQorICAgICAgICAgICAgc2Nyb2xsQnkoZGVsdGFYLCBkZWx0YVkpOwogICAgICAgICB9Ci0gICAgICAgIGlmICghZ2V0U2V0dGluZ3MoKS5nZXRCdWlsdEluWm9vbUNvbnRyb2xzKCkpIHsKLSAgICAgICAgICAgIGJvb2xlYW4gc2hvd1BsdXNNaW51cyA9IG1NaW5ab29tU2NhbGUgPCBtTWF4Wm9vbVNjYWxlOwotICAgICAgICAgICAgaWYgKG1ab29tQ29udHJvbHMgIT0gbnVsbCAmJiBzaG93UGx1c01pbnVzKSB7Ci0gICAgICAgICAgICAgICAgaWYgKG1ab29tQ29udHJvbHMuZ2V0VmlzaWJpbGl0eSgpID09IFZpZXcuVklTSUJMRSkgewotICAgICAgICAgICAgICAgICAgICBtUHJpdmF0ZUhhbmRsZXIucmVtb3ZlQ2FsbGJhY2tzKG1ab29tQ29udHJvbFJ1bm5hYmxlKTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBtWm9vbUNvbnRyb2xzLnNob3coc2hvd1BsdXNNaW51cywgZmFsc2UpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBtUHJpdmF0ZUhhbmRsZXIucG9zdERlbGF5ZWQobVpvb21Db250cm9sUnVubmFibGUsCi0gICAgICAgICAgICAgICAgICAgICAgICBaT09NX0NPTlRST0xTX1RJTUVPVVQpOwotICAgICAgICAgICAgfQotICAgICAgICB9CisgICAgICAgIG1ab29tTWFuYWdlci5rZWVwWm9vbVBpY2tlclZpc2libGUoKTsKICAgICB9CiAKICAgICBwcml2YXRlIHZvaWQgc3RvcFRvdWNoKCkgewpAQCAtNTU3OCwxNCArNTM5Myw2IEBACiAgICAgICAgICAgICBtVmVsb2NpdHlUcmFja2VyLnJlY3ljbGUoKTsKICAgICAgICAgICAgIG1WZWxvY2l0eVRyYWNrZXIgPSBudWxsOwogICAgICAgICB9Ci0KLSAgICAg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ldyBoaWVyYXJjaHkuIFRoaXMgdmlldyB3aWxsCkBAIC02MDYzLDgxICs1ODI3LDI5IEBACiAgICAgICAgICAgICBMb2cudyhMT0dUQUcsICJUaGlzIFdlYlZpZXcgZG9lc24ndCBzdXBwb3J0IHpvb20uIik7CiAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgfQotICAgICAgICBpZiAobVpvb21Db250cm9scyA9PSBudWxsKSB7Ci0gICAgICAgICAgICBtWm9vbUNvbnRyb2xzID0gY3JlYXRlWm9vbUNvbnRyb2xzKCk7Ci0KLSAgICAgICAgICAgIC8qCi0gICAgICAgICAgICAgKiBuZWVkIHRvIGJlIHNldCB0byBWSVNJQkxFIGZpcnN0IHNvIHRoYXQgZ2V0TWVhc3VyZWRIZWlnaHQoKSBpbgotICAgICAgICAgICAgICoge0BsaW5rICNvblNpemVDaGFuZ2VkKCl9IGNhbiByZXR1cm4gdGhlIG1lYXN1cmVkIHZhbHVlIGZvciBwcm9wZXIKLSAgICAgICAgICAgICAqIGxheW91dC4KLSAgICAgICAgICAgICAqLwotICAgICAgICAgICAgbVpvb21Db250cm9scy5zZXRWaXNpYmlsaXR5KFZpZXcuVklTSUJMRSk7Ci0gICAgICAgICAgICBtWm9vbUNvbnRyb2xSdW5uYWJsZSA9IG5ldyBSdW5uYWJsZSgpIHsKLSAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBydW4oKSB7Ci0KLSAgICAgICAgICAgICAgICAgICAgLyogRG9uJ3QgZGlzbWlzcyB0aGUgY29udHJvbHMgaWYgdGhlIHVzZXIgaGFzCi0gICAgICAgICAgICAgICAgICAgICAqIGZvY3VzIG9uIHRoZW0uIFdhaXQgYW5kIGNoZWNrIGFnYWluIGxhdGVyLgotICAgICAgICAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgICAgICAgICAgaWYgKCFtWm9vbUNvbnRyb2xzLmhhc0ZvY3VzKCkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIG1ab29tQ29udHJvbHMuaGlkZSgpOwotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgbVByaXZhdGVIYW5kbGVyLnJlbW92ZUNhbGxiYWNrcyhtWm9vbUNvbnRyb2xSdW5uYWJsZSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBtUHJpdmF0ZUhhbmRsZXIucG9zdERlbGF5ZWQobVpvb21Db250cm9sUnVubmFibGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFpPT01fQ09OVFJPTFNfVElNRU9VVCk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9OwotICAgICAgICB9Ci0gICAgICAgIHJldHVybiBtWm9vbUNvbnRyb2xzOworICAgICAgICByZXR1cm4gbVpvb21NYW5hZ2VyLmdldEV4dGVybmFsWm9vbVBpY2tlcigpOwogICAgIH0KIAotICAgIHByaXZhdGUgRXh0ZW5kZWRab29tQ29udHJvbHMgY3JlYXRlWm9vbUNvbnRyb2xzKCkgewotICAgICAgICBFeHRlbmRlZFpvb21Db250cm9scyB6b29tQ29udHJvbHMgPSBuZXcgRXh0ZW5kZWRab29tQ29udHJvbHMobUNvbnRleHQKLSAgICAgICAgICAgICwgbnVsbCk7Ci0gICAgICAgIHpvb21Db250cm9scy5zZXRPblpvb21JbkNsaWNrTGlzdGVuZXIobmV3IE9uQ2xpY2tMaXN0ZW5lcigpIHsKLSAgICAgICAgICAgIHB1YmxpYyB2b2lkIG9uQ2xpY2soVmlldyB2KSB7Ci0gICAgICAgICAgICAgICAgLy8gcmVzZXQgdGltZSBvdXQKLSAgICAgICAgICAgICAgICBtUHJpdmF0ZUhhbmRsZXIucmVtb3ZlQ2FsbGJhY2tzKG1ab29tQ29udHJvbFJ1bm5hYmxlKTsKLSAgICAgICAgICAgICAgICBtUHJpdmF0ZUhhbmRsZXIucG9zdERlbGF5ZWQobVpvb21Db250cm9sUnVubmFibGUsCi0gICAgICAgICAgICAgICAgICAgICAgICBaT09NX0NPTlRST0xTX1RJTUVPVVQpOwotICAgICAgICAgICAgICAgIHpvb21JbigpOwotICAgICAgICAgICAgfQotICAgICAgICB9KTsKLSAgICAgICAgem9vbUNvbnRyb2xzLnNldE9uWm9vbU91dENsaWNrTGlzdGVuZXIobmV3IE9uQ2xpY2tMaXN0ZW5lcigpIHsKLSAgICAgICAgICAgIHB1YmxpYyB2b2lkIG9uQ2xpY2soVmlldyB2KSB7Ci0gICAgICAgICAgICAgICAgLy8gcmVzZXQgdGltZSBvdXQKLSAgICAgICAgICAgICAgICBtUHJpdmF0ZUhhbmRsZXIucmVtb3ZlQ2FsbGJhY2tzKG1ab29tQ29udHJvbFJ1bm5hYmxlKTsKLSAgICAgICAgICAgICAgICBtUHJpdmF0ZUhhbmRsZXIucG9zdERlbGF5ZWQobVpvb21Db250cm9sUnVubmFibGUsCi0gICAgICAgICAgICAgICAgICAgICAgICBaT09NX0NPTlRST0xTX1RJTUVPVVQpOwotICAgICAgICAgICAgICAgIHpvb21PdXQoKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfSk7Ci0gICAgICAgIHJldHVybiB6b29tQ29udHJvbHM7CisgICAgdm9pZCBkaXNtaXNzWm9vbUNvbnRyb2woKSB7CisgICAgICAgIG1ab29tTWFuYWdlci5kaXNtaXNzWm9vbVBpY2tlcigpOworICAgIH0KKworICAgIGZsb2F0IGdldERlZmF1bHRab29tU2NhbGUoKSB7CisgICAgICAgIHJldHVybiBtWm9vbU1hbmFnZXIuZ2V0RGVmYXVsdFNjYWxlKCk7CiAgICAgfQogCiAgICAgLyoqCi0gICAgICogR2V0cyB0aGUge0BsaW5rIFpvb21CdXR0b25zQ29udHJvbGxlcn0gd2hpY2ggY2FuIGJlIHVzZWQgdG8gYWRkCi0gICAgICogYWRkaXRpb25hbCBidXR0b25zIHRvIHRoZSB6b29tIGNvbnRyb2xzIHdpbmRvdy4KLSAgICAgKgotICAgICAqIEByZXR1cm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otICAgICAgICAgICAgICAgIEZyYW1lTGF5b3V0LkxheW91dFBhcmFtcyBmcmFtZVBhcmFtcyA9IChGcmFtZUxheW91dC5MYXlvdXRQYXJhbXMpIHBhcmFtczsKLSAgICAgICAgICAgICAgICBmcmFtZVBhcmFtcy5ncmF2aXR5ID0gR3Jhdml0eS5SSUdIVDsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgICAgICByZXR1cm4gbVpvb21CdXR0b25zQ29udHJvbGxlcjsKKyAgICBwdWJsaWMgYm9vbGVhbiBjYW5ab29tSW4oKSB7CisgICAgICAgIHJldHVybiBtWm9vbU1hbmFnZXIuY2FuWm9vbUluKCk7CisgICAgfQorCisgICAgLyoqCisgICAgICogQHJldHVybiBUUlVFIGlmIHRoZSBXZWJWaWV3IGNhbiBiZSB6b29tZWQgb3V0LgorICAgICAqLworICAgIHB1YmxpYyBib29sZWFuIGNhblpvb21PdXQoKSB7CisgICAgICAgIHJldHVybiBtWm9vbU1hbmFnZXIuY2FuWm9vbU91dCgpOwogICAgIH0KIAogICAgIC8qKgpAQCAtNjE0NSwxNSArNTg1Nyw3IEBACiAgICAgICogQHJldHVybiBUUlVFIGlmIHpvb20gaW4gc3VjY2VlZHMuIEZBTFNFIGlmIG5vIHpvb20gY2hhbmdlcy4KICAgICAgKi8KICAgICBwdWJsaWMgYm9vbGVhbiB6b29tSW4oKSB7Ci0gICAgICAgIC8vIFRPRE86IGFsdGVybmF0aXZlbHkgd2UgY2FuIGRpc2FsbG93IHRoaXMgZHVyaW5nIGRyYXcgaGlzdG9yeSBtb2RlCi0gICAgICAgIHN3aXRjaE91dERyYXdIaXN0b3J5KCk7Ci0gICAgICAgIG1Jblpvb21PdmVydmlldyA9IGZhbHNlOwotICAgICAgICAvLyBDZW50ZXIgem9vbWluZyB0byB0aGUgY2VudGVyIG9mIHRoZSBzY3JlZW4uCi0gICAgICAgIG1ab29tQ2VudGVyWCA9IGdldFZpZXdXaWR0aCgpICogLjVmOwotICAgICAgICB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AgICAgICBzY2FsZSA9IG1NYXhab29tU2NhbGU7Ci0gICAgICAgIH0KLSAgICAgICAgaWYgKE1hdGguYWJzKHNjYWxlIC0gbUFjdHVhbFNjYWxlKSA8IE1JTklNVU1fU0NBTEVfSU5DUkVNRU5UKSB7Ci0gICAgICAgICAgICBpZiAoY29udGVudFRvVmlld1godmlldy54KSA+PSBtU2Nyb2xsWAotICAgICAgICAgICAgICAgICAgICAmJiBjb250ZW50VG9WaWV3WCh2aWV3LnggKyB2aWV3LndpZHRoKSA8PSBtU2Nyb2xsWAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgdmlld1dpZHRoCi0gICAgICAgICAgICAgICAgICAgICYmIGNvbnRlbnRUb1ZpZXdZKHZpZXcueSkgPj0gbVNjcm9sbFkKLSAgICAgICAgICAgICAgICAgICAgJiYgY29udGVudFRvVmlld1kodmlldy55ICsgdmlldy5oZWlnaHQpIDw9IG1TY3JvbGxZCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgKyB2aWV3SGVpZ2h0KSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIGJvb2xlYW4gaXNQbHVnaW5GaXRPblNjcmVlbihWaWV3TWFuYWdlci5DaGlsZFZpZXcgdmlldykgeworICAgICAgICBmaW5hbCBpbnQgdmlld1dpZHRoID0gZ2V0Vmlld1dpZHRoKCk7CisgICAgICAgIGZpbmFsIGludCB2aWV3SGVpZ2h0ID0gZ2V0Vmlld0hlaWdodFdpdGhUaXRsZSgpOworICAgICAgICBmbG9hdCBzY2FsZSA9IE1hdGgubWluKChmbG9hdCkgdmlld1dpZHRoIC8gdmlldy53aWR0aCwgKGZsb2F0KSB2aWV3SGVpZ2h0IC8gdmlldy5oZWlnaHQpOworICAgICAgICBzY2FsZSA9IG1ab29tTWFuYWdlci5jb21wdXRlU2NhbGVXaXRoTGltaXRzKHNjYW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LDEwOSArNjA1NiwxMCBAQAogICAgICAgICAgICAgfSBlbHNlIGlmIChuZXdTY3JlZW5ZID4gKG5ld01heEhlaWdodCAtIHJlY3RWaWV3WSAtIHJlY3RWaWV3SGVpZ2h0KSkgewogICAgICAgICAgICAgICAgIG5ld1NjcmVlblkgPSB2aWV3SGVpZ2h0IC0gKG5ld01heEhlaWdodCAtIHJlY3RWaWV3WSk7CiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICBtWm9vbUNlbnRlclkgPSAob2xkU2NyZWVuWSAqIHNjYWxlIC0gbmV3U2NyZWVuWSAqIG1BY3R1YWxTY2FsZSkKLSAgICAgICAgICAgICAgICAgICAgLyAoc2NhbGUgLSBtQWN0dWFsU2NhbGUpOwotICAgICAgICAgICAgem9vbVdpdGhQcmV2aWV3KHNjYWxlLCBmYWxzZSk7Ci0gICAgICAgIH0KLSAgICB9Ci0KLSAgICB2b2lkIGRpc21pc3Nab29tQ29udHJvbCgpIHsKLSAgICAgICAgaWYgKG1XZWJWaWV3Q29yZSA9PSBudWxsKSB7Ci0gICAgICAgICAgICAvLyBtYXliZSBjYWxsZWQgYWZ0ZXIgV2ViVmlldydzIGRlc3Ryb3koKS4gQXMgd2UgY2FuJ3QgZ2V0IHNldHRpbmdzLAotICAgICAgICAgICAgLy8ganVzdCBoaWRlIHpvb20gY29udHJvbCBmb3IgYm90aCBzdHlsZXMuCi0gICAgICAgICAgICBpZiAobVpvb21CdXR0b25zQ29udHJvbGxlciAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgbVpvb21CdXR0b25zQ29udHJvbGxlci5zZXRWaXNpYmxlKGZhbHNlKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmIChtWm9vbUNvbnRyb2xzICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICBtWm9vbUNvbnRyb2xzLmhpZGUoKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgfQotICAgICAgICBXZWJ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AgICAgICAgIGludCB2aWV3TGVmdCA9IGNvbnRlbnRUb1ZpZXdYKGxlZnQgPCA1ID8gMCA6IChsZWZ0IC0gNSkpCi0gICAgICAgICAgICAgICAgICAgICAgICAtIG1TY3JvbGxYOwotICAgICAgICAgICAgICAgIC8vIFJlLWNhbGN1bGF0ZSB0aGUgem9vbSBjZW50ZXIgc28gdGhhdCB0aGUgbmV3IHNjcm9sbCB4IHdpbGwgYmUKLSAgICAgICAgICAgICAgICAvLyBvbiB0aGUgbGVmdCBlZGdlLgotICAgICAgICAgICAgICAgIGlmICh2aWV3TGVmdCA+IDApIHsKLSAgICAgICAgICAgICAgICAgICAgbVpvb21DZW50ZXJYID0gdmlld0xlZnQgKiBtRGVmYXVsdFNjYWxlCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgLyAobURlZmF1bHRTY2FsZSAtIG1BY3R1YWxTY2FsZSk7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgc2Nyb2xsQnkodmlld0xlZnQsIDApOwotICAgICAgICAgICAgICAgICAgICBtWm9vbUNlbnRlclggPSAwOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHpvb21XaXRoUHJldmlldyhtRGVmYXVsdFNjYWxlLCB0cnVlKTsKKyAgICAgICAgICAgIGZsb2F0IHpvb21DZW50ZXJZID0gKG9sZFNjcmVlblkgKiBzY2FsZSAtIG5ld1NjcmVlblkgKiBhY3R1YWxTY2FsZSkKKyAgICAgICAgICAgICAgICAgICAgLyAoc2NhbGUgLSBhY3R1YWxTY2FsZSk7CisgICAgICAgICAgICBtWm9vbU1hbmFnZXIuc2V0Wm9vbUNlbnRlcih6b29tQ2VudGVyWCwgem9vbUNlbnRlclkpOworICAgICAgICAgICAgbVpvb21NYW5hZ2VyLnN0YXJ0Wm9vbUFuaW1hdGlvbihzY2FsZSwgZmFsc2UpOwogICAgICAgICB9CiAgICAgfQogCkBAIC02NDg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2dyZXNzKCkpIHsKKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorCiAgICAgICAgIHJlY3Qub2Zmc2V0KGNoaWxkLmdldExlZnQoKSAtIGNoaWxkLmdldFNjcm9sbFgoKSwKICAgICAgICAgICAgICAgICBjaGlsZC5nZXRUb3AoKSAtIGNoaWxkLmdldFNjcm9sbFkoKSk7CiAKQEAgLTY3MDksNyArNjMwOSw4IEBACiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGNhc2UgU1dJVENIX1RPX1NIT1JUUFJFU1M6IHsKICAgICAgICAgICAgICAgICAgICAgaWYgKG1Ub3VjaE1vZGUgPT0gVE9VQ0hfSU5JVF9NT0RFKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAobVByZXZlbnREZWZhdWx0ICE9IFBSRVZFTlRfREVGQVVMVF9ZRVMpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmICghZ2V0U2V0dGluZ3MoKS5zdXBwb3J0VG91Y2hPbmx5KCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJiYgbVByZXZlbnREZWZhdWx0ICE9IFBSRVZFTlRfREVGQVVMVF9ZRVMpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtVG91Y2hNb2RlID0gVE9VQ0hfU0hPUlRQUkVTU19TVEFSVF9NT0RFOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVwZGF0ZVNlbGVjdGlvbigpOwogICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKQEAgLTY3MjMsNiArNjMyNCw5IEBACiAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBjYXNlIFNXSVRDSF9UT19MT05HUFJFU1M6IHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGdldFNldHRpbmdzKCkuc3VwcG9ydFRvdWNoT25seSgpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICByZW1vdmVUb3VjaEhpZ2hsaWdodChmYWxzZSk7CisgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgaWYgKGluRnVsbFNjcmVlbk1vZGUoKSB8fCBtRGVmZXJUb3VjaFByb2Nlc3MpIHsKICAgICAgICAgICAgICAgICAgICAgICAgIFRvdWNoRXZlbnREYXRhIHRlZCA9IG5ldyBUb3VjaEV2ZW50RGF0YSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgdGVkLm1BY3Rpb24gPSBXZWJWaWV3Q29yZS5BQ1RJT05fTE9OR1BSRVNTOwpAQCAtNjczNCwxNSArNjMzOCwxMCBAQAogICAgICAgICAgICAgICAgICAgICAgICAgLy8gc2ltcGxpY2l0eSBmb3Igbm93LCB3ZSBkb24ndCBzZXQgaXQuCiAgICAgICAgICAgICAgICAgICAgICAgICB0ZWQubU1ldGFTdGF0ZSA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgICB0ZWQubVJlcHJvY2VzcyA9IG1EZWZlclRvdWNoUHJvY2VzczsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtRGVmZXJUb3VjaFByb2Nlc3MpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ZWQubVZpZXdYID0gbUxhc3RUb3VjaFg7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGVkLm1WaWV3WSA9IG1MYXN0VG91Y2hZOwotICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgbVdlYlZpZXdDb3JlLnNlbmRNZXNzYWdlKEV2ZW50SHViLlRPVUNIX0VWRU5ULCB0ZWQpOwogICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKG1QcmV2ZW50RGVmYXVsdCAhPSBQUkVWRU5UX0RFRkFVTFRfWUVTKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBtVG91Y2hNb2RlID0gVE9VQ0hfRE9ORV9NT0RFOwogICAgICAgICAgICAgICAgICAgICAgICAgcGVyZm9ybUxvbmdDbGljaygpOwotICAgICAgICAgICAgICAgICAgICAgICAgcmVidWlsZFdlYlRleHRWaWV3KCk7CiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgfQpAQCAtNjc3NSw3MCArNjM3NCwzNiBAQAogICAgICAgICAgICAgICAgICAgICBzcGF3bkNvbnRlbnRTY3JvbGxUbyhtc2cuYXJnMSwgbXNnLmFyZzIpOwogICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICBjYXNlIFVQREFURV9aT09NX1JBTkdFOiB7Ci0gICAgICAgICAgICAgICAgICAgIFdlYlZpZXdDb3JlLlJlc3RvcmVTdGF0ZSByZXN0b3JlU3RhdGUKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICA9IChXZWJWaWV3Q29yZS5SZXN0b3JlU3RhdGUpIG1zZy5vYmo7CisgICAgICAgICAgICAgICAgICAgIFdlYlZpZXdDb3JlLlZpZXdTdGF0ZSB2aWV3U3RhdGUgPSAoV2ViVmlld0NvcmUuVmlld1N0YXRlKSBtc2cub2JqOwogICAgICAgICAgICAgICAgICAgICAvLyBtU2Nyb2xsWCBjb250YWlucyB0aGUgbmV3IG1pblByZWZXaWR0aAotICAgICAgICAgICAgICAgICAgICB1cGRhdGVab29tUmFuZ2UocmVzdG9yZVN0YXRlLCBnZXRWaWV3V2lkdGgoKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXN0b3JlU3RhdGUubVNjcm9sbFgsIGZhbHNlKTsKKyAgICAgICAgICAgICAgICAgICAgbVpvb21NYW5hZ2VyLnVwZGF0ZVpvb21SYW5nZSh2aWV3U3RhdGUsIGdldFZpZXdXaWR0aCgpLCB2aWV3U3RhdGUubVNjcm9sbFgpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgY2FzZSBSRVBMQUNFX0JBU0VfQ09OVEVOVDogeworICAgICAgICAgICAgICAgICAgICBuYXRpdmVSZXBsYWNlQmFzZUNvbnRlbnQobXNnLmFyZzEpOwogICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgY2FzZSBORVdfUElDVFVSRV9NU0dfSUQ6IHsKLSAgICAgICAgICAgICAgICAgICAgLy8gSWYgd2UndmUgcHJldmlvdXNseSBkZWxheWVkIGRlbGV0aW5nIGEgcm9vdAotICAgICAgICAgICAgICAgICAgICAvLyBsYXllciwgZG8gaXQgbm93LgotICAgICAgICAgICAgICAgICAgICBpZiAobURlbGF5ZWREZWxldGVSb290TGF5ZXIpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIG1EZWxheWVkRGVsZXRlUm9vdExheWVyID0gZmFsc2U7Ci0gICAgICAgICAgICAgICAgICAgICAgICBuYXRpdmVTZXRSb290TGF5ZXIoMCk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgV2ViU2V0dGluZ3Mgc2V0dGluZ3MgPSBtV2ViVmlld0NvcmUuZ2V0U2V0dGluZ3MoKTsKICAgICAgICAgICAgICAgICAgICAgLy8gY2FsbGVkIGZvciBuZXcgY29udGVudAotICAgICAgICAgICAgICAgICAgICBmaW5hbCBpbnQgdmlld1dpZHRoID0gZ2V0Vmlld1dpZHRoKCk7Ci0gICAgICAgICAgICAgICAgICAgIGZpbmFsIFdlYlZpZXdDb3JlLkRyYXdEYXRhIGRyYXcgPQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIChXZWJWaWV3Q29yZS5EcmF3RGF0YSkgbXNnLm9iajsKKyAgICAgICAgICAgICAgICAgICAgZmluYWwgV2ViVmlld0NvcmUuRHJhd0RhdGEgZHJhdyA9IChXZWJWaWV3Q29yZS5EcmF3RGF0YSkgbXNnLm9iajsKKyAgICAgICAgICAgICAgICAgICAgbmF0aXZlU2V0QmFzZUxheWVyKGRyYXcubUJhc2VMYXllcik7CiAgICAgICAgICAgICAgICAgICAgIGZpbmFsIFBvaW50IHZpZXdTaXplID0gZHJhdy5tVmlld1BvaW50OwotICAgICAgICAgICAgICAgICAgICBib29sZWFuIHVzZVdpZGVWaWV3cG9ydCA9IHNldHRpbmdzLmdldFVzZVdpZGVWaWV3UG9ydCgpOwotICAgICAgICAgICAgICAgICAgICBXZWJWaWV3Q29yZS5SZXN0b3JlU3RhdGUgcmVzdG9yZVN0YXRlID0gZHJhdy5tUmVzdG9yZVN0YXRlOwotICAgICAgICAgICAgICAgICAgICBib29sZWFuIGhhc1Jlc3RvcmVTdGF0ZSA9IHJlc3RvcmVTdGF0ZSAhPSBudWxsOwotICAgICAgICAgICAgICAgICAgICBpZiAoaGFzUmVzdG9yZVN0YXRlKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICB1cGRhdGVab29tUmFuZ2UocmVzdG9yZVN0YXRlLCB2aWV3U2l6ZS54LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkcmF3Lm1NaW5QcmVmV2lkdGgsIHRydWUpOworICAgICAgICAgICAgICAgICAgICBXZWJWaWV3Q29yZS5WaWV3U3RhdGUgdmlld1N0YXRlID0gZHJhdy5tVmlld1N0YXRlOworICAgICAgICAgICAgICAgICAgICBib29sZWFuIGlzUGljdHVyZUFmdGVyRmlyc3RMYXlvdXQgPSB2aWV3U3RhdGUgIT0gbnVsbDsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGlzUGljdHVyZUFmdGVyRmlyc3RMYXlvdXQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIFJlc2V0IHRoZSBsYXN0IHNlbnQgZGF0YSBoZXJlIHNpbmNlIGRlYWxpbmcgd2l0aCBuZXcgcGFnZS4KKyAgICAgICAgICAgICAgICAgICAgICAgIG1MYXN0V2lkdGhTZW50ID0gMDsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1ab29tTWFuYWdlci5vbkZpcnN0TGF5b3V0KGRyYXcpOwogICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFtRHJhd0hpc3RvcnkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBtSW5ab29tT3ZlcnZpZXcgPSBmYWxzZTsKLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtSW5pdGlhbFNjYWxlSW5QZXJjZW50ID4gMCkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXROZXdab29tU2NhbGUobUluaXRpYWxTY2FsZUluUGVyY2VudCAvIDEwMC4wZiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Jbml0aWFsU2NhbGVJblBlcmNlbnQgIT0gbVRleHRXcmFwU2NhbGUgKiAxMDAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmYWxzZSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChyZXN0b3JlU3RhdGUubVZpZXdTY2FsZSA+IDApIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVRleHRXcmFwU2NhbGUgPSByZXN0b3JlU3RhdGUubVRleHRXcmFwU2NhbGU7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldE5ld1pvb21TY2FsZShyZXN0b3JlU3RhdGUubVZpZXdTY2FsZSwgZmFsc2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmYWxzZSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUluWm9vbU92ZXJ2aWV3ID0gdXNlV2lkZVZpZXdwb3J0Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmJiBzZXR0aW5ncy5nZXRMb2FkV2l0aE92ZXJ2aWV3TW9kZSgpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCBzY2FsZTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1Jblpvb21PdmVydmlldykgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NhbGUgPSAoZmxvYXQpIHZpZXdXaWR0aAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8gREVGQVVMVF9WSUVXUE9SVF9XSURUSDsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjYWxlID0gcmVzdG9yZVN0YXRlLm1UZXh0V3JhcFNjYWxlOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldE5ld1pvb21TY2FsZShzY2FsZSwgTWF0aC5hYnMoc2NhbGUKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0gbVRleHRXcmFwU2NhbGUpID49IE1JTklNVU1fU0NBTEVfSU5DUkVNRU5ULAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmFsc2UpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXRDb250ZW50U2Nyb2xsVG8ocmVzdG9yZVN0YXRlLm1TY3JvbGxYLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXN0b3JlU3RhdGUubVNjcm9sbFkpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldENvbnRlbnRTY3JvbGxUbyh2aWV3U3RhdGUubVNjcm9sbFgsIHZpZXdTdGF0ZS5tU2Nyb2xsWSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gQXMgd2UgYXJlIG9uIGEgbmV3IHBhZ2UsIHJlbW92ZSB0aGUgV2ViVGV4dFZpZXcuIFRoaXMKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBpcyBuZWNlc3NhcnkgZm9yIHBhZ2UgbG9hZHMgZHJpdmVuIGJ5IHdlYmtpdCwgYW5kIGluCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gcGFydGljdWxhciB3aGVuIHRoZSB1c2VyIHdhcyBvbiBhIHBhc3N3b3JkIGZpZWxkLCBzbwogICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHRoZSBXZWJUZXh0VmlldyB3YXMgdmlzaWJsZS4KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGVhclRleHRFbnRyeShmYWxzZSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gdXBkYXRlIHRoZSB6b29tIGJ1dHRvbnMgYXMgdGhlIHNjYWxlIGNhbiBiZSBjaGFuZ2VkCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGdldFNldHRpbmdzKCkuZ2V0QnVpbHRJblpvb21Db250cm9scygpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVwZGF0ZVpvb21CdXR0b25zRW5hYmxlZCgpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGVhclRleHRFbnRyeSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICB9CisKICAgICAgICAgICAgICAgICAgICAgLy8gV2UgdXBkYXRlIHRoZSBsYXlvdXQgKGkuZS4gcmVxdWVzdCBhIGxheW91dCBmcm9tIHRoZQogICAgICAgICAgICAgICAgICAgICAvLyB2aWV3IHN5c3RlbSkgaWYgdGhlIGxhc3QgdmlldyBzaXplIHRoYXQgd2Ugc2VudCB0bwogICAgICAgICAgICAgICAgICAgICAvLyBXZWJDb3JlIG1hdGNoZXMgdGhlIHZpZXcgc2l6ZSBvZiB0aGUgcGljdHVyZSB3ZSBqdXN0CkBAIC02ODQ2LDQ1ICs2NDExLDI1IEBACiAgICAgICAgICAgICAgICAgICAgIGZpbmFsIGJvb2xlYW4gdXBkYXRlTGF5b3V0ID0gdmlld1NpemUueCA9PSBtTGFzdFdpZHRoU2VudAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICYmIHZpZXdTaXplLnkgPT0gbUxhc3RIZWlnaHRTZW50OwogICAgICAgICAgICAgICAgICAgICByZWNvcmROZXdDb250ZW50U2l6ZShkcmF3Lm1XaWR0aEhlaWdodC54LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRyYXcubVdpZHRoSGVpZ2h0LnkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICArIChtRmluZElzVXAgPyBtRmluZEhlaWdodCA6IDApLCB1cGRhdGVMYXlvdXQpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRyYXcubVdpZHRoSGVpZ2h0LnksIHVwZGF0ZUxheW91dCk7CiAgICAgICAgICAgICAgICAgICAgIGlmIChEZWJ1Z0ZsYWdzLldFQl9WSUVXKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBSZWN0IGIgPSBkcmF3Lm1JbnZhbFJlZ2lvbi5nZXRCb3VuZHMoKTsKICAgICAgICAgICAgICAgICAgICAgICAgIExvZy52KExPR1RBRywgIk5FV19QSUNUVVJFX01TR19JRCB7IiArCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIubGVmdCsiLCIrYi50b3ArIiwiK2IucmlnaHQrIiwiK2IuYm90dG9tKyJ9Iik7CiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgaW52YWxpZGF0ZUNvbnRlbnRSZWN0KGRyYXcubUludmFsUmVnaW9uLmdldEJvdW5kcygpKTsKKwogICAgICAgICAgICAgICAgICAgICBpZiAobVBpY3R1cmVMaXN0ZW5lciAhPSBudWxsKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBtUGljdHVyZUxpc3RlbmVyLm9uTmV3UGljdHVyZShXZWJWaWV3LnRoaXMsIGNhcHR1cmVQaWN0dXJlKCkpOwogICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIGlmICh1c2VXaWRlVmlld3BvcnQpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIGxpbWl0IG1ab29tT3ZlcnZpZXdXaWR0aCB1cHBlciBib3VuZCB0bwotICAgICAgICAgICAgICAgICAgICAgICAgLy8gc01heFZpZXdwb3J0V2lkdGggc28gdGhhdCBpZiB0aGUgcGFnZSBkb2Vzbid0IGJlaGF2ZQotICAgICAgICAgICAgICAgICAgICAgICAgLy8gd2VsbCwgdGhlIFdlYlZpZXcgd29uJ3QgZ28gaW5zYW5lLiBsaW1pdCB0aGUgbG93ZXIKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIGJvdW5kIHRvIG1hdGNoIHRoZSBkZWZhdWx0IHNjYWxlIGZvciBtb2JpbGUgc2l0ZXMuCi0gICAgICAgICAgICAgICAgICAgICAgICBtWm9vbU92ZXJ2aWV3V2lkdGggPSBNYXRoLm1pbihzTWF4Vmlld3BvcnRXaWR0aCwgTWF0aAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAubWF4KChpbnQpICh2aWV3V2lkdGggLyBtRGVmYXVsdFNjYWxlKSwgTWF0aAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5tYXgoZHJhdy5tTWluUHJlZldpZHRoLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZHJhdy5tVmlld1BvaW50LngpKSk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgaWYgKCFtTWluWm9vbVNjYWxlRml4ZWQpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIG1NaW5ab29tU2NhbGUgPSAoZmxvYXQpIHZpZXdXaWR0aCAvIG1ab29tT3ZlcnZpZXdXaWR0aDsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBpZiAoIW1EcmF3SGlzdG9yeSAmJiBtSW5ab29tT3ZlcnZpZXcpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIGZpdCB0aGUgY29udGVudCB3aWR0aCB0byB0aGUgY3VycmVudCB2aWV3LiBJZ25vcmUKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIHRoZSByb3VuZGluZyBlcnJvciBjYXNlLgotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKE1hdGguYWJzKCh2aWV3V2lkdGggKiBtSW52QWN0dWFsU2NhbGUpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0gbVpvb21PdmVydmlld1dpZHRoKSA+IDEpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXROZXdab29tU2NhbGUoKGZsb2F0KSB2aWV3V2lkdGgKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8gbVpvb21PdmVydmlld1dpZHRoLCBNYXRoLmFicyhtQWN0dWFsU2NhbGUKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0gbVRleHRXcmFwU2NhbGUpIDwgTUlOSU1VTV9TQ0FMRV9JTkNSRU1FTlQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmYWxzZSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICAvLyB1cGRhdGUgdGhlIHpvb20gaW5mb3JtYXRpb24gYmFzZWQgb24gdGhlIG5ldyBwaWN0dXJlCisgICAgICAgICAgICAgICAgICAgIG1ab29tTWFuYWdlci5vbk5ld1BpY3R1cmUoZHJhdyk7CisKICAgICAgICAgICAgICAgICAgICAgaWYgKGRyYXcubUZvY3VzU2l6ZUNoYW5nZWQgJiYgaW5FZGl0aW5nTW9kZSgpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBtRm9jdXNTaXplQ2hhbmdlZCA9IHRydWU7CiAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgaWYgKGhhc1Jlc3RvcmVTdGF0ZSkgeworICAgICAgICAgICAgICAgICAgICBpZiAoaXNQaWN0dXJlQWZ0ZXJGaXJzdExheW91dCkgewogICAgICAgICAgICAgICAgICAgICAgICAgbVZpZXdNYW5hZ2VyLnBvc3RSZWFkeVRvRHJhd0FsbCgpOwogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwpAQCAtNjkxOCwxNCArNjQ2Myw4IEBACiAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgIGNhc2UgUkVRVUVTVF9LRVlCT0FSRF9XSVRIX1NFTEVDVElPTl9NU0dfSUQ6CiAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXlTb2Z0S2V5Ym9hcmQodHJ1ZSk7Ci0gICAgICAgICAgICAgICAgICAgIHVwZGF0ZVRleHRTZWxlY3Rpb25Gcm9tTWVzc2FnZShtc2cuYXJnMSwgbXNnLmFyZzIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgKFdlYlZpZXdDb3JlLlRleHRTZWxlY3Rpb25EYXRhKSBtc2cub2JqKTsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIC8vIGZhbGwgdGhyb3VnaCB0byBVUERBVEVfVEVYVF9TRUxFQ1RJT05fTVNHX0lECiAgICAgICAgICAgICAgICAgY2FzZSBVUERBVEVfVEVYVF9TRUxFQ1RJT05fTVNHX0lEOgotICAgICAgICAgICAgICAgICAgICAvLyBJZiBubyB0ZXh0ZmllbGQgd2FzIGluIGZvY3VzLCBhbmQgdGhlIHVzZXIgdG91Y2hlZCBvbmUsCi0gICAgICAgICAgICAgICAgICAgIC8vIGNhdXNpbmcgaXQgdG8gc2VuZCB0aGlzIG1lc3NhZ2UsIHRoZW4gV2ViVGV4dFZpZXcgaGFzIG5vdAotICAgICAgICAgICAgICAgICAgICAvLyBiZWVuIHNldCB1cCB5ZXQuICBSZWJ1aWxkIGl0IHNvIGl0IGNhbiBzZXQgaXRzIHNlbGVjdGlvbi4KLSAgICAgICAgICAgICAgICAgICAgcmVidWlsZFdlYlRleHRWaWV3KCk7CiAgICAgICAgICAgICAgICAgICAgIHVwZGF0ZVRleHRTZWxlY3Rpb25Gcm9tTWVzc2FnZShtc2cuYXJnMSwgbXNnLmFyZzIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKFdlYlZpZXdDb3JlLlRleHRTZWxlY3Rpb25EYXRhKSBtc2cub2JqKTsKICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CkBAIC02OTQzLDcgKzY0ODIsNyBAQAogICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgIGNhc2UgTU9WRV9PVVRfT0ZfUExVR0lOOgorICAgICAgICAgICAgICAgIGNhc2UgVU5IQU5ETEVEX05BVl9LRVk6CiAgICAgICAgICAgICAgICAgICAgIG5hdkhhbmRsZWRLZXkobXNnLmFyZzEsIDEsIGZhbHNlLCAwKTsKICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgY2FzZSBVUERBVEVfVEVYVF9FTlRSWV9NU0dfSUQ6CkBAIC02OTU1LDcgKzY0OTQsNyBAQAogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgIGNhc2UgQ0xFQVJfVEVYVF9FTlRSWToKLSAgICAgICAgICAgICAgICAgICAgY2xlYXJUZXh0RW50cnkoZmFsc2UpOworICAgICAgICAgICAgICAgICAgICBjbGVhclRleHRFbnRyeSgpOwogICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICBjYXNlIElOVkFMX1JFQ1RfTVNHX0lEOiB7CiAgICAgICAgICAgICAgICAgICAgIFJlY3QgciA9IChSZWN0KW1zZy5vYmo7CkBAIC02OTY4LDIzICs2NTA3LDYgQEAKICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgY2FzZSBJTU1FRElBVEVfUkVQQUlOVF9NU0dfSUQ6IHsKLSAgICAgICAgICAgICAgICAgICAgaW52YWxpZGF0ZSgpOwotICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgY2FzZSBTRVRfUk9PVF9MQVlFUl9NU0dfSUQ6IHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKDAgPT0gbXNnLmFyZzEpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIE51bGwgaW5kaWNhdGVzIGRlbGV0aW5nIHRoZSBvbGQgbGF5ZXIsIGJ1dAotICAgICAgICAgICAgICAgICAgICAgICAgLy8gZG9uJ3QgYWN0dWFsbHkgZG8gc28gdW50aWwgd2UndmUgZ290IHRoZQotICAgICAgICAgICAgICAgICAgICAgICAgLy8gbmV3IHBhZ2UgdG8gZGlzcGxheS4KLSAgICAgICAgICAgICAgICAgICAgICAgIG1EZWxheWVkRGVsZXRlUm9vdExheWVyID0gdHJ1ZTsKLSAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIG1EZWxheWVkRGVsZXRlUm9vdExheWVyID0gZmFsc2U7Ci0gICAgICAgICAgICAgICAgICAgICAgICBuYXRpdmVTZXRSb290TGF5ZXIobXNnLmFyZzEpOwotICAgICAgICAgICAgICAgICAgICAgICAgaW52YWxpZGF0ZSgpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBjYXNlIFJFUVVFU1RfRk9STV9EQVRBOgogICAgICAgICAgICAgICAgICAgICBBdXRvQ29tcGxldGVBZGFwdGVyIGFkYXB0ZXIgPSAoQXV0b0NvbXBsZXRlQWRhcHRlcikgbXNnLm9iajsKICAgICAgICAgICAgICAgICAgICAgaWYgKG1XZWJUZXh0Vmlldy5pc1NhbWVUZXh0RmllbGQobXNnLmFyZzEpKSB7CkBAIC03MDI4LDQzICs2NTUwLDQ2IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVByZXZlbnREZWZhdWx0ID0gbXNnLmFyZzIgPT0gMSA/IFBSRVZFTlRfREVGQVVMVF9ZRVMKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogUFJFVkVOVF9ERUZBVUxUX05POwogICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1QcmV2ZW50RGVmYXVsdCA9PSBQUkVWRU5UX0RFRkFVTFRfWUVTKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVRvdWNoSGlnaGxpZ2h0UmVnaW9uLnNldEVtcHR5KCk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobXNnLmFyZzIgPT0gMCkgewogICAgICAgICAgICAgICAgICAgICAgICAgLy8gcHJldmVudCBkZWZhdWx0IGlzIG5vdCBjYWxsZWQgaW4gV2ViQ29yZSwgc28gdGhlCiAgICAgICAgICAgICAgICAgICAgICAgICAvLyBtZXNzYWdlIG5lZWRzIHRvIGJlIHJlcHJvY2Vzc2VkIGluIFVJCiAgICAgICAgICAgICAgICAgICAgICAgICBUb3VjaEV2ZW50RGF0YSB0ZWQgPSAoVG91Y2hFdmVudERhdGEpIG1zZy5vYmo7CiAgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKHRlZC5tQWN0aW9uKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBNb3Rpb25FdmVudC5BQ1RJT05fRE9XTjoKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUxhc3REZWZlclRvdWNoWCA9IHRlZC5tVmlld1g7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1MYXN0RGVmZXJUb3VjaFkgPSB0ZWQubVZpZXdZOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtTGFzdERlZmVyVG91Y2hYID0gY29udGVudFRvVmlld1godGVkLm1YKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0gbVNjcm9sbFg7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1MYXN0RGVmZXJUb3VjaFkgPSBjb250ZW50VG9WaWV3WSh0ZWQubVkpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLSBtU2Nyb2xsWTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbURlZmVyVG91Y2hNb2RlID0gVE9VQ0hfSU5JVF9NT0RFOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIE1vdGlvbkV2ZW50LkFDVElPTl9NT1ZFOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIG5vIHNuYXBwaW5nIGluIGRlZmVyIHByb2Nlc3MKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHggPSBjb250ZW50VG9WaWV3WCh0ZWQubVgpIC0gbVNjcm9sbFg7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCB5ID0gY29udGVudFRvVmlld1kodGVkLm1ZKSAtIG1TY3JvbGxZOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobURlZmVyVG91Y2hNb2RlICE9IFRPVUNIX0RSQUdfTU9ERSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbURlZmVyVG91Y2hNb2RlID0gVE9VQ0hfRFJBR19NT0RFOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUxhc3REZWZlclRvdWNoWCA9IHRlZC5tVmlld1g7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtTGFzdERlZmVyVG91Y2hZID0gdGVkLm1WaWV3WTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1MYXN0RGVmZXJUb3VjaFggPSB4OworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUxhc3REZWZlclRvdWNoWSA9IHk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGFydERyYWcoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgZGVsdGFYID0gcGluTG9jWCgoaW50KSAobVNjcm9sbFgKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIG1MYXN0RGVmZXJUb3VjaFggLSB0ZWQubVZpZXdYKSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIG1MYXN0RGVmZXJUb3VjaFggLSB4KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtIG1TY3JvbGxYOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgZGVsdGFZID0gcGluTG9jWSgoaW50KSAobVNjcm9sbFkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIG1MYXN0RGVmZXJUb3VjaFkgLSB0ZWQubVZpZXdZKSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIG1MYXN0RGVmZXJUb3VjaFkgLSB5KSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtIG1TY3JvbGxZOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkb0RyYWcoZGVsdGFYLCBkZWx0YVkpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZGVsdGFYICE9IDApIG1MYXN0RGVmZXJUb3VjaFggPSB0ZWQubVZpZXdYOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZGVsdGFZICE9IDApIG1MYXN0RGVmZXJUb3VjaFkgPSB0ZWQubVZpZXdZOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZGVsdGFYICE9IDApIG1MYXN0RGVmZXJUb3VjaFggPSB4OworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZGVsdGFZICE9IDApIG1MYXN0RGVmZXJUb3VjaFkgPSB5OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBNb3Rpb25FdmVudC5BQ1RJT05fVVA6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBNb3Rpb25FdmVudC5BQ1RJT05fQ0FOQ0VMOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobURlZmVyVG91Y2hNb2RlID09IFRPVUNIX0RSQUdfTU9ERSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gbm8gZmxpbmcgaW4gZGVmZXIgcHJvY2VzcwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVNjcm9sbGVyLnNwcmluZ2JhY2sobVNjcm9sbFgsIG1TY3JvbGxZLCAwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21wdXRlTWF4U2Nyb2xsWCgpLCAwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21wdXRlTWF4U2Nyb2xsWSgpKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludmFsaWRhdGUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFdlYlZpZXdDb3JlLnJlc3VtZVByaW9yaXR5KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBXZWJWaWV3Q29yZS5yZXN1bWVVcGRhdGVQaWN0dXJlKG1XZWJWaWV3Q29yZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KQEAgLTcwNzIsOSArNjU5Nyw5IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgV2ViVmlld0NvcmUuQUNUSU9OX0RPVUJMRVRBUDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gZG9Eb3VibGVUYXAoKSBuZWVkcyBtTGFzdFRvdWNoWC9ZIGFzIGFuY2hvcgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtTGFzdFRvdWNoWCA9IHRlZC5tVmlld1g7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1MYXN0VG91Y2hZID0gdGVkLm1WaWV3WTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9Eb3VibGVUYXAoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUxhc3RUb3VjaFggPSBjb250ZW50VG9WaWV3WCh0ZWQubVgpIC0gbVNjcm9sbFg7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1MYXN0VG91Y2hZID0gY29udGVudFRvVmlld1kodGVkLm1ZKSAtIG1TY3JvbGxZOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtWm9vbU1hbmFnZXIuaGFuZGxlRG91YmxlVGFwKG1MYXN0VG91Y2hYLCBtTGFzdFRvdWNoWSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1EZWZlclRvdWNoTW9kZSA9IFRPVUNIX0RPTkVfTU9ERTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBXZWJWaWV3Q29yZS5BQ1RJT05fTE9OR1BSRVNTOgpAQCAtNzA4Miw3ICs2NjA3LDYgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGhpdFRlc3QgIT0gbnVsbCAmJiBoaXRUZXN0Lm1UeXBlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIT0gSGl0VGVzdFJlc3VsdC5VTktOT1dOX1RZUEUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlcmZvcm1Mb25nQ2xpY2soKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlYnVpbGRXZWJUZXh0VmlldygpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1EZWZlclRvdWNoTW9kZSA9IFRPVUNIX0RPTkVfTU9ERTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CkBAIC03MTAwLDggKzY2MjQsOCBAQAogCiAgICAgICAgICAgICAgICAgY2FzZSBGSU5EX0FHQUlOOgogICAgICAgICAgICAgICAgICAgICAvLyBJZ25vcmUgaWYgZmluZCBoYXMgYmVlbiBkaXNtaXNzZWQuCi0gICAgICAgICAgICAgICAgICAgIGlmIChtRmluZElzVXApIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGZpbmRBbGwobUxhc3RGaW5kKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKG1GaW5kSXNVcCAmJiBtRmluZENhbGxiYWNrICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1GaW5kQ2FsbGJhY2suZmluZEFsbCgpOwogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogCkBAIC03MjA2LDcgKzY3MzAsNiBAQAogCiAgICAgICAgICAgICAgICAgY2FzZSBDRU5URVJfRklUX1JFQ1Q6CiAgICAgICAgICAgICAgICAgICAgIFJlY3QgciA9IChSZWN0KW1zZy5vYmo7Ci0gICAgICAgICAgICAgICAgICAgIG1Jblpvb21PdmVydmlldyA9IGZhbHNlOwogICAgICAgICAgICAgICAgICAgICBjZW50ZXJGaXRSZWN0KHIubGVmdCwgci50b3AsIHIud2lkdGgoKSwgci5oZWlnaHQoKSk7CiAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogCkBAIC03MjE1LDYgKzY3MzgsNDMgQEAKICAgICAgICAgICAgICAgICAgICAgbVZlcnRpY2FsU2Nyb2xsQmFyTW9kZSA9IG1zZy5hcmcyOwogICAgICAgICAgICAgICAgICAgICBicmVhazsKIAorICAgICAgICAgICAgICAgIGNhc2UgU0VMRUNUSU9OX1NUUklOR19DSEFOR0VEOgorICAgICAgICAgICAgICAgICAgICBpZiAobUFjY2Vzc2liaWxpdHlJbmplY3RvciAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBTdHJpbmcgc2VsZWN0aW9uU3RyaW5nID0gKFN0cmluZykgbXNnLm9iajsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1BY2Nlc3NpYmlsaXR5SW5qZWN0b3Iub25TZWxlY3Rpb25TdHJpbmdDaGFuZ2Uoc2VsZWN0aW9uU3RyaW5nKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgICAgIGNhc2UgU0VUX1RPVUNIX0hJR0hMSUdIVF9SRUNUUzoKKyAgICAgICAgICAgICAgICAgICAgaW52YWxpZGF0ZShtVG91Y2hIaWdobGlnaHRSZWdpb24uZ2V0Qm91bmRzKCkpOworICAgICAgICAgICAgICAgICAgICBtVG91Y2hIaWdobGlnaHRSZWdpb24uc2V0RW1wdHkoKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKG1zZy5vYmogIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgQXJyYXlMaXN0PFJlY3Q+IHJlY3RzID0gKEFycmF5TGlzdDxSZWN0PikgbXNnLm9iajsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoUmVjdCByZWN0IDogcmVjdHMpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBSZWN0IHZpZXdSZWN0ID0gY29udGVudFRvVmlld1JlY3QocmVjdCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gc29tZSBzaXRlcywgbGlrZSBzdG9yaWVzIGluIG55dGltZXMuY29tLCBzZXQKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBtb3VzZSBldmVudCBoYW5kbGVyIGluIHRoZSB0b3AgZGl2LiBJdCBpcyBub3QKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyB1c2VyIGZyaWVuZGx5IHRvIGhpZ2hsaWdodCB0aGUgZGl2IGlmIGl0IGNvdmVycworICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIG1vcmUgdGhhbiBoYWxmIG9mIHRoZSBzY3JlZW4uCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHZpZXdSZWN0LndpZHRoKCkgPCBnZXRXaWR0aCgpID4+IDEKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHx8IHZpZXdSZWN0LmhlaWdodCgpIDwgZ2V0SGVpZ2h0KCkgPj4gMSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtVG91Y2hIaWdobGlnaHRSZWdpb24udW5pb24odmlld1JlY3QpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnZhbGlkYXRlKHZpZXdSZWN0KTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMb2cudyhMT0dUQUcsICJTa2lwIHRoZSBodWdlIHNlbGVjdGlvbiByZWN0OiIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIHZpZXdSZWN0KTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICBjYXNlIFNBVkVfV0VCQVJDSElWRV9GSU5JU0hFRDoKKyAgICAgICAgICAgICAgICAgICAgU2F2ZVdlYkFyY2hpdmVNZXNzYWdlIHNhdmVNZXNzYWdlID0gKFNhdmVXZWJBcmNoaXZlTWVzc2FnZSltc2cub2JqOworICAgICAgICAgICAgICAgICAgICBpZiAoc2F2ZU1lc3NhZ2UubUNhbGxiYWNrICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHNhdmVNZXNzYWdlLm1DYWxsYmFjay5vblJlY2VpdmVWYWx1ZShzYXZlTWVzc2FnZS5tUmVzdWx0RmlsZSk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICBzdXBlci5oYW5kbGVNZXNzYWdlKG1zZyk7CiAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwpAQCAtNzUyMiwzNyArNzA4Miw2IEBACiAgICAgICAgICAgICAgICAgbmV3IEludm9rZUxpc3RCb3goYXJyYXksIGVuYWJsZWRBcnJheSwgc2VsZWN0ZWRBcnJheSkpOwogICAgIH0KIAotICAgIHByaXZhdGUgdm9pZCB1cGRhdGVab29tUmFuZ2UoV2ViVmlld0NvcmUuUmVzdG9yZVN0YXRlIHJlc3RvcmVTdGF0ZSwKLSAgICAgICAgICAgIGludCB2aWV3V2lkdGgsIGludCBtaW5QcmVmV2lkdGgsIGJvb2xlYW4gdXBkYXRlWm9vbU92ZXJ2aWV3KSB7Ci0gICAgICAgIGlmIChyZXN0b3JlU3RhdGUubU1pblNjYWxlID09IDApIHsKLSAgICAgICAgICAgIGlmIChyZXN0b3JlU3RhdGUubU1vYmlsZVNpdGUpIHsKLSAgICAgICAgICAgICAgICBpZiAobWluUHJlZldpZHRoID4gTWF0aC5tYXgoMCwgdmlld1dpZHRoKSkgewotICAgICAgICAgICAgICAgICAgICBtTWluWm9vbVNjYWxlID0gKGZsb2F0KSB2aWV3V2lkdGggLyBtaW5QcmVmV2lkdGg7Ci0gICAgICAgICAgICAgICAgICAgIG1NaW5ab29tU2NhbGVGaXhlZCA9IGZhbHNlOwotICAgICAgICAgICAgICAgICAgICBpZiAodXBkYXRlWm9vbU92ZXJ2aWV3KSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBXZWJTZXR0aW5ncyBzZXR0aW5ncyA9IGdldFNldHRpbmdzKCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBtSW5ab29tT3ZlcnZpZXcgPSBzZXR0aW5ncy5nZXRVc2VXaWRlVmlld1BvcnQoKSAmJgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXR0aW5ncy5nZXRMb2FkV2l0aE92ZXJ2aWV3TW9kZSgpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgbU1pblpvb21TY2FsZSA9IHJlc3RvcmVTdGF0ZS5tRGVmYXVsdFNjYWxlOwotICAgICAgICAgICAgICAgICAgICBtTWluWm9vbVNjYWxlRml4ZWQgPSB0cnVlOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgbU1pblpvb21TY2FsZSA9IERFRkFVTFRfTUlOX1pPT01fU0NBTEU7Ci0gICAgICAgICAgICAgICAgbU1pblpvb21TY2FsZUZpeGVkID0gZmFsc2U7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICBtTWluWm9vbVNjYWxlID0gcmVzdG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gICAgIG51bGwsCi0gICAgICAgICAgICAgICAgbnVsbCk7Ci0gICAgICAgIFN0cmluZyBuYW1lID0gIiI7Ci0gICAgICAgIGlmIChjdXJzb3IgIT0gbnVsbCkgewotICAgICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgICBpZiAoY3Vyc29yLm1vdmVUb05leHQoKSkgewotICAgICAgICAgICAgICAgICAgICBuYW1lID0gY3Vyc29yLmdldFN0cmluZygwKTsKKyAgICBwcml2YXRlIFN0cmluZyBvcGVuRmlsZUNob29zZXIoU3RyaW5nIGFjY2VwdFR5cGUpIHsKKyAgICAgICAgVXJpIHVyaSA9IG1DYWxsYmFja1Byb3h5Lm9wZW5GaWxlQ2hvb3NlcihhY2NlcHRUeXBlKTsKKyAgICAgICAgaWYgKHVyaSAhPSBudWxsKSB7CisgICAgICAgICAgICBTdHJpbmcgZmlsZVBhdGggPSAiIjsKKyAgICAgICAgICAgIC8vIE5vdGUgLSBxdWVyeWluZyBmb3IgTWVkaWFTdG9yZS5JbWFnZXMuTWVkaWEuREFUQQorICAgICAgICAgICAgLy8gc2VlbXMgdG8gd29yayBmb3IgYWxsIGNvbnRlbnQgVVJJcywgbm90IGp1c3QgaW1hZ2VzCisgICAgICAgICAgICBDdXJzb3IgY3Vyc29yID0gbUNvbnRleHQuZ2V0Q29udGVudFJlc29sdmVyKCkucXVlcnkoCisgICAgICAgICAgICAgICAgICAgIHVyaSwKKyAgICAgICAgICAgICAgICAgICAgbmV3IFN0cmluZ1tdIHsgTWVkaWFTdG9yZS5JbWFnZXMuTWVkaWEuREFUQSB9LAorICAgICAgICAgICAgICAgICAgICBudWxsLCBudWxsLCBudWxsKTsKKyAgICAgICAgICAgIGlmIChjdXJzb3IgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgIGlmIChjdXJzb3IubW92ZVRvTmV4dCgpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBmaWxlUGF0aCA9IGN1cnNvci5nZXRTdHJpbmcoMCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9IGZpbmFsbHkgeworICAgICAgICAgICAgICAgICAgICBjdXJzb3IuY2xvc2UoKTsKICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9IGZpbmFsbHkgewotICAgICAgICAgICAgICAgIGN1cnNvci5jbG9zZSgpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBmaWxlUGF0aCA9IHVyaS5nZXRMYXN0UGF0aFNlZ21lbnQoKTsKICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIFN0cmluZyB1cmlTdHJpbmcgPSB1cmkudG9TdHJpbmcoKTsKKyAgICAgICAgICAgIEJyb3dzZXJGcmFtZS5zSmF2YUJyaWRnZS5zdG9yZUZpbGVQYXRoRm9yQ29udGVudFVyaShmaWxlUGF0aCwgdXJpU3RyaW5nKTsKKyAgICAgICAgICAgIHJldHVybiB1cmlTdHJpbmc7CiAgICAgICAgIH0KLSAgICAgICAgcmV0dXJuIHVyaS50b1N0cmluZygpICsgIi8iICsgbmFtZTsKKyAgICAgICAgcmV0dXJuICIiOwogICAgIH0KIAogICAgIC8qKgpAQCAtNDI0LDYgKzQyMywxMyBAQAogICAgICAgICByZXR1cm4gbUNhbGxiYWNrUHJveHkub25Kc1RpbWVvdXQoKTsKICAgICB9CiAKKyAgICAvKioKKyAgICAgKiBOb3RpZnkgdGhlIHdlYnZpZXcgdGhhdCB0aGlzIGlzIGFuIGluc3RhbGxhYmxlIHdlYiBhcHAuCisgICAgICovCisgICAgcHJvdGVjdGVkIHZvaWQgc2V0SW5zdGFsbGFibGVXZWJBcHAoKSB7CisgICAgICAgIG1DYWxsYmFja1Byb3h5LnNldEluc3RhbGxhYmxlV2ViQXBwKCk7CisgICAgfQorCiAgICAgLy8tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS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MgZmluYWwgaW50IFJFTU9WRV9UT1VDSF9ISUdITElHSFRfUkVDVFMgPSAxODg7CisKKyAgICAgICAgLy8gYWNjZXNzaWJpbGl0eSBzdXBwb3J0CisgICAgICAgIHN0YXRpYyBmaW5hbCBpbnQgTU9ESUZZX1NFTEVDVElPTiA9IDE5MDsKKworICAgICAgICBzdGF0aWMgZmluYWwgaW50IFVTRV9NT0NLX0RFVklDRV9PUklFTlRBVElPTiA9IDE5MTsKKwogICAgICAgICAvLyBwcml2YXRlIG1lc3NhZ2UgaWRzCiAgICAgICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBERVNUUk9ZID0gICAgIDIwMDsKIApAQCAtMTIzOCw2ICsxMjYwLDE5IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmF0aXZlU2V0U2VsZWN0aW9uKG1zZy5hcmcxLCBtc2cuYXJnMik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgTU9ESUZZX1NFTEVDVElPTjoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBNb2RpZnlTZWxlY3Rpb25EYXRhIG1vZGlmeVNlbGVjdGlvbkRhdGEgPQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTW9kaWZ5U2VsZWN0aW9uRGF0YSkgbXNnLm9iajsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBTdHJpbmcgc2VsZWN0aW9uU3RyaW5nID0gbmF0aXZlTW9kaWZ5U2VsZWN0aW9uKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kaWZ5U2VsZWN0aW9uRGF0YS5tQWx0ZXIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2RpZnlTZWxlY3Rpb25EYXRhLm1EaXJlY3Rpb24sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2RpZnlTZWxlY3Rpb25EYXRhLm1HcmFudWxhcml0eSk7CisKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtV2ViVmlldy5tUHJpdmF0ZUhhbmRsZXIub2J0YWluTWVzc2FnZSgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFdlYlZpZXcuU0VMRUNUSU9OX1NUUklOR19DSEFOR0VELCBzZWxlY3Rpb25TdHJpbmcpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAuc2VuZFRvVGFyZ2V0KCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgTElTVEJPWF9DSE9JQ0VTOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNwYXJzZUJvb2xlYW5BcnJheSBjaG9pY2VzID0gKFNwYXJzZUJvb2xlYW5BcnJheSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1zZy5vYmo7CkBAIC0xMjc4LDYgKzEzMTMsMTUgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYXRpdmVTZXRKc0ZsYWdzKChTdHJpbmcpbXNnLm9iaik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgU0FWRV9XRUJBUkNISVZFOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIFdlYlZpZXcuU2F2ZVdlYkFyY2hpdmVNZXNzYWdlIHNhdmVNZXNzYWdlID0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKFdlYlZpZXcuU2F2ZVdlYkFyY2hpdmVNZXNzYWdlKW1zZy5vYmo7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2F2ZU1lc3NhZ2UubVJlc3VsdEZpbGUgPQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzYXZlV2ViQXJjaGl2ZShzYXZlTWVzc2FnZS5tQmFzZW5hbWUsIHNhdmVNZXNzYWdlLm1BdXRvbmFtZSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVdlYlZpZXcubVByaXZhdGVIYW5kbGVyLm9idGFpbk1lc3NhZ2UoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFdlYlZpZXcuU0FWRV9XRUJBUkNISVZFX0ZJTklTSEVELCBzYXZlTWVzc2FnZSkuc2VuZFRvVGFyZ2V0KCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgR0VPTE9DQVRJT05fUEVSTUlTU0lPTlNfUFJPVklERToKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHZW9sb2NhdGlvblBlcm1pc3Npb25zRGF0YSBkYXRhID0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChHZW9sb2NhdGlvblBlcm1pc3Npb25zRGF0YSkgbXNnLm9iajsKQEAgLTEyOTEsNyArMTMzNSw5IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAKICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgU1BMSVRfUElDVFVSRV9TRVQ6Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbmF0aXZlU3BsaXRDb250ZW50KCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmF0aXZlU3BsaXRDb250ZW50KG1zZy5hcmcxKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtV2ViVmlldy5tUHJpdmF0ZUhhbmRsZXIub2J0YWluTWVzc2FnZSgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFdlYlZpZXcuUkVQTEFDRV9CQVNFX0NPTlRFTlQsIG1zZy5hcmcxLCAwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtU3BsaXRQaWN0dXJlSXNTY2hlZHVsZWQgPSBmYWxzZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKIApAQCAtMTM1Nyw2ICsxNDAzLDI1IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQnJvd3NlckZyYW1lLnNKYXZhQnJpZGdlLnJlbW92ZVBhY2thZ2VOYW1lKAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKFN0cmluZykgbXNnLm9iaik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgR0VUX1RPVUNIX0hJR0hMSUdIVF9SRUNUUzoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBUb3VjaEhpZ2hsaWdodERhdGEgZCA9IChUb3VjaEhpZ2hsaWdodERhdGEpIG1zZy5vYmo7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgQXJyYXlMaXN0PFJlY3Q+IHJlY3RzID0gbmF0aXZlR2V0VG91Y2hIaWdobGlnaHRSZWN0cworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGQubVgsIGQubVksIGQubVNsb3ApOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1XZWJWaWV3Lm1Qcml2YXRlSGFuZGxlci5vYnRhaW5NZXNzYWdlKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgV2ViVmlldy5TRVRfVE9VQ0hfSElHSExJR0hUX1JFQ1RTLCByZWN0cykKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5zZW5kVG9UYXJnZXQoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBSRU1PVkVfVE9VQ0hfSElHSExJR0hUX1JFQ1RTOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1XZWJWaWV3Lm1Qcml2YXRlSGFuZGxlci5vYnRhaW5NZXNzYWdlKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgV2ViVmlldy5TRVRfVE9VQ0hfSElHSExJR0hUX1JFQ1RTLCBudWxsKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLnNlbmRUb1RhcmdldCgpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFVTRV9NT0NLX0RFVklDRV9PUklFTlRBVElPTjoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB1c2VNb2NrRGV2aWNlT3JpZW50YXRpb24oKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH07CkBAIC0xNTYyLDYgKzE2MjcsMTMgQEAKICAgICAgICAgbUJyb3dzZXJGcmFtZS5sb2FkVXJsKHVybCwgZXh0cmFIZWFkZXJzKTsKICAgICB9CiAKKyAgICBwcml2YXRlIFN0cmluZyBzYXZlV2ViQXJjaGl2ZShTdHJpbmcgZmlsZW5hbWUsIGJvb2xlYW4gYXV0b25hbWUpIHsKKyAgICAgICAgaWYgKERlYnVnRmxhZ3MuV0VCX1ZJRVdfQ09SRSkgeworICAgICAgICAgICAgTG9nLnYoTE9HVEFHLCAiIENPUkUgc2F2ZVdlYkFyY2hpdmUgIiArIGZpbGVuYW1lICsgIiAiICsgYXV0b25hbWUpOworICAgICAgICB9CisgICAgICAgIHJldHVybiBtQnJvd3NlckZyYW1lLnNhdmVXZWJBcmNoaXZlKGZpbGVuYW1lLCBhdXRvbmFtZSk7CisgICAgfQorCiAgICAgcHJpdmF0ZSB2b2lkIGtleShLZXlFdmVudCBldnQsIGJvb2xlYW4gaXNEb3duKSB7CiAgICAgICAgIGlmIChEZWJ1Z0ZsYWdzLldFQl9WSUVXX0NPUkUpIHsKICAgICAgICAgICAgIExvZy52KExPR1RBRywgIkNPUkUga2V5IGF0ICIgKyBTeXN0ZW0uY3VycmVudFRpbWVNaWxsaXMoKSArICIsICIKQEAgLTE1ODIsMTEgKzE2NTQsMTIgQEAKICAgICAgICAgICAgIGlmIChrZXlDb2RlID49IEtleUV2ZW50LktFWUNPREVfRFBBRF9VUAogICAgICAgICAgICAgICAgICAgICAmJiBrZXlDb2RlIDw9IEtleUV2ZW50LktFWUNPREVfRFBBRF9SSUdIVCkgewogICAgICAgICAgICAgICAgIGlmIChEZWJ1Z0ZsYWdzLldFQl9WSUVXX0NPUkUpIHsKLSAgICAgICAgICAgICAgICAgICAgTG9nLnYoTE9HVEFHLCAia2V5OiBhcnJvdyB1bnVzZWQgYnkgcGx1Z2luOiAiICsga2V5Q29kZSk7CisgICAgICAgICAgICAgICAgICAgIExvZy52KExPR1RBRywgImtleTogYXJyb3cgdW51c2VkIGJ5IHBhZ2U6ICIgKyBrZXlDb2RlKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgaWYgKG1XZWJWaWV3ICE9IG51bGwgJiYgZXZ0LmlzRG93bigpKSB7CiAgICAgICAgICAgICAgICAgICAgIE1lc3NhZ2Uub2J0YWluKG1XZWJWaWV3Lm1Qcml2YXRlSGFuZGxlciwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBXZWJWaWV3Lk1PVkVfT1VUX09GX1BMVUdJTiwga2V5Q29kZSkuc2VuZFRvVGFyZ2V0KCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgV2ViVmlldy5VTkhBTkRMRURfTkFWX0tFWSwga2V5Q29kZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAwKS5zZW5kVG9UYXJnZXQoKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgfQpAQCAtMTYxNyw3ICsxNjkwLDcgQEAKICAgICAgICAgaWYgKG1TZXR0aW5ncy5nZXRVc2VXaWRlVmlld1BvcnQoKSkgewogICAgICAgICAgICAgaWYgKG1WaWV3cG9ydFdpZHRoID09IC0xKSB7CiAgICAgICAgICAgIC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JlU3RhdGUgbVJlc3RvcmVTdGF0ZTsgLy8gb25seSBub24tbnVsbCBpZiBpdCBpcyBmb3IgdGhlIGZpcnN0Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBwaWN0dXJlIHNldCBhZnRlciB0aGUgZmlyc3QgbGF5b3V0CisgICAgICAgIC8vIG9ubHkgbm9uLW51bGwgaWYgaXQgaXMgZm9yIHRoZSBmaXJzdCBwaWN0dXJlIHNldCBhZnRlciB0aGUgZmlyc3QgbGF5b3V0CisgICAgICAgIFZpZXdTdGF0ZSBtVmlld1N0YXRlOwogICAgICAgICBib29sZWFuIG1Gb2N1c1NpemVDaGFuZ2VkOwogICAgIH0KIApAQCAtMTcyNCw4ICsxODA3LDggQEAKICAgICAgICAgbURyYXdJc1NjaGVkdWxlZCA9IGZhbHNlOwogICAgICAgICBEcmF3RGF0YSBkcmF3ID0gbmV3IERyYXdEYXRhKCk7CiAgICAgICAgIGlmIChEZWJ1Z0ZsYWdzLldFQl9WSUVXX0NPUkUpIExvZy52KExPR1RBRywgIndlYmtpdERyYXcgc3RhcnQiKTsKLSAgICAgICAgaWYgKG5hdGl2ZVJlY29yZENvbnRlbnQoZHJhdy5tSW52YWxSZWdpb24sIGRyYXcubVdpZHRoSGVpZ2h0KQotICAgICAgICAgICAgICAgID09IGZhbHNlKSB7CisgICAgICAgIGRyYXcubUJhc2VMYXllciA9IG5hdGl2ZVJlY29yZENvbnRlbnQoZHJhdy5tSW52YWxSZWdpb24sIGRyYXcubVdpZHRoSGVpZ2h0KTsKKyAgICAgICAgaWYgKGRyYXcubUJhc2VMYXllciA9PSAwKSB7CiAgICAgICAgICAgICBpZiAoRGVidWdGbGFncy5XRUJfVklFV19DT1JFKSBMb2cudihMT0dUQUcsICJ3ZWJraXREcmF3IGFib3J0Iik7CiAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgIH0KQEAgLTE3NDEsOSArMTgyNCw5IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOiBtVmlld3BvcnRXaWR0aCksCiAgICAgICAgICAgICAgICAgICAgICAgICBuYXRpdmVHZXRDb250ZW50TWluUHJlZldpZHRoKCkpOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKG1SZXN0b3JlU3RhdGUgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIGRyYXcubVJlc3RvcmVTdGF0ZSA9IG1SZXN0b3JlU3RhdGU7Ci0gICAgICAgICAgICAgICAgbVJlc3RvcmVTdGF0ZSA9IG51bGw7CisgICAgICAgICAgICBpZiAobUluaXRpYWxWaWV3U3RhdGUgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGRyYXcubVZpZXdTdGF0ZSA9IG1Jbml0aWFsVmlld1N0YXRlOworICAgICAgICAgICAgICAgIG1Jbml0aWFsVmlld1N0YXRlID0gbnVsbDsKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIGlmIChEZWJ1Z0ZsYWdzLldFQl9WSUVXX0NPUkUpIExvZy52KExPR1RBRywgIndlYmtpdERyYXcgTkVXX1BJQ1RVUkVfTVNHX0lEIik7CiAgICAgICAgICAgICBNZXNzYWdlLm9idGFpbihtV2ViVmlldy5tUHJpdmF0ZUhhbmRsZXIsCkBAIC0xNzU4LDUxICsxODQxLDYgQEAKICAgICAgICAgfQogICAgIH0KIAotICAgIC8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLwotICAgIC8vIFRoZXNlIGFyZSBjYWxsZWQgZnJvbSB0aGUgVUkgdGhyZWFkLCBub3Qgb3VyIHRocmVhZAotCi0gICAgc3RhdGljIGZpbmFsIGludCBaT09NX0JJVFMgPSBQYWludC5GSUxURVJfQklUTUFQX0ZMQUcgfAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQYWludC5ESVRIRVJfRkxBRyB8Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBhaW50LlNVQlBJWEVMX1RFWFRfRkxBRzsKLSAgICBzdGF0aWMgZmluYWwgaW50IFNDUk9MTF9CSVRTID0gUGFpbnQuRklMVEVSX0JJVE1BUF9GTEFHIHwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQYWludC5ESVRIRVJfRkxBRzsKLQotICAgIGZpbmFsIERyYXdGaWx0ZXIgbVpvb21GaWx0ZXIgPQotICAgICAgICAgICAgICAgICAgICBuZXcgUGFpbnRGbGFnc0RyYXdGaWx0ZXIoWk9PTV9CSVRTLCBQYWludC5MSU5FQVJfVEVYVF9GTEFHKTsKLSAgICAvLyBJZiB3ZSBuZWVkIHRvIHRyYWRlIGJldHRlciBxdWFsaXR5IGZvciBzcGVlZCwgc2V0IG1TY3JvbGxGaWx0ZXIgdG8gbnVsbAotICAgIGZpbmFsIERyYXdGaWx0ZXIgbVNjcm9sbEZpbHRlciA9Ci0gICAgICAgICAgICAgICAgbmV3IFBhaW50RmxhZ3NEcmF3RmlsdGVyKFNDUk9MTF9CSVRTLCAwKTsKLQotICAgIC8qIHBhY2thZ2UgKi8gdm9pZCBkcmF3Q29udGVudFBpY3R1cmUoQ2FudmFzIGNhbnZhcywgaW50IGNvbG9yLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbGVhbiBhbmltYXRpbmdab29tLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbGVhbiBhbmltYXRpbmdTY3JvbGwpIHsKLSAgICAgICAgRHJhd0ZpbHRlciBkZiA9IG51bGw7Ci0gICAgICAgIGlmIChhbmltYXRpbmdab29tKSB7Ci0gICAgICAgICAgICBkZiA9IG1ab29tRmlsdGVyOwotICAgICAgICB9IGVsc2UgaWYgKGFuaW1hdGluZ1Njcm9sbCkgewotICAgICAgICAgICAgZGYgPSBtU2Nyb2xsRmlsdG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ZGxlci5yZW1vdmVNZXNzYWdlcyhXZWJDb3JlVGhyZWFkLlJFRFVDRV9QUklPUklUWSk7CkBAIC0xODI0LDYgKzE4NjIsOCBAQAogICAgICAgICAvLyBjYWxsZWQgZnJvbSBVSSB0aHJlYWQgd2hpbGUgV0VCS0lUX0RSQVcgaXMganVzdCBwdWxsZWQgb3V0IG9mIHRoZQogICAgICAgICAvLyBxdWV1ZSBpbiBXZWJDb3JlIHRocmVhZCB0byBiZSBleGVjdXRlZC4gVGhlbiB1cGRhdGUgd29uJ3QgYmUgYmxvY2tlZC4KICAgICAgICAgaWYgKGNvcmUgIT0gbnVsbCkgeworICAgICAgICAgICAgaWYgKCFjb3JlLmdldFNldHRpbmdzKCkuZW5hYmxlU21vb3RoVHJhbnNpdGlvbigpKSByZXR1cm47CisKICAgICAgICAgICAgIHN5bmNocm9uaXplZCAoY29yZSkgewogICAgICAgICAgICAgICAgIGNvcmUubURyYXdJc1BhdXNlZCA9IHRydWU7CiAgICAgICAgICAgICAgICAgaWYgKGNvcmUubURyYXdJc1NjaGVkdWxlZCkgewpAQCAtMTgzNiwxMiArMTg3NiwxNiBAQAogCiAgICAgc3RhdGljIHZvaWQgcmVzdW1lVXBkYXRlUGljdHVyZShXZWJWaWV3Q29yZSBjb3JlKSB7CiAgICAgICAgIGlmIChjb3JlICE9IG51bGwpIHsKKyAgICAgICAgICAgIC8vIGlmIG1EcmF3SXNQYXVzZWQgaXMgdHJ1ZSwgaWdub3JlIHRoZSBzZXR0aW5nLCBjb250aW51ZSB0byByZXN1bWUKKyAgICAgICAgICAgIGlmICghY29yZS5tRHJhd0lzUGF1c2VkCisgICAgICAgICAgICAgICAgICAgICYmICFjb3JlLmdldFNldHRpbmdzKCkuZW5hYmxlU21vb3RoVHJhbnNpdGlvbigpKSByZXR1cm47CisKICAgICAgICAgICAgIHN5bmNocm9uaXplZCAoY29yZSkgewogICAgICAgICAgICAgICAgIGNvcmUubURyYXdJc1BhdXNlZCA9IGZhbHNlOwotICAgICAgICAgICAgICAgIGlmIChjb3JlLm1EcmF3SXNTY2hlZHVsZWQpIHsKLSAgICAgICAgICAgICAgICAgICAgY29yZS5tRHJhd0lzU2NoZWR1bGVkID0gZmFsc2U7Ci0gICAgICAgICAgICAgICAgICAgIGNvcmUuY29udGVudERyYXcoKTsKLSAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgLy8gYWx3YXlzIHJlZHJhdyBvbiByZXN1bWUgdG8gcmVlbmFibGUgZ2lmIGFuaW1hdGlvbnMKKyAgICAgICAgICAgICAgICBjb3JlLm1EcmF3SXNTY2hlZHVsZWQgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICBjb3JlLm5hdGl2ZUNvbnRlbnRJbnZhbGlkYXRlQWxsKCk7CisgICAgICAgICAgICAgICAgY29yZS5jb250ZW50RHJhdygpOwogICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgfQpAQCAtMTk3OCwyNCArMjAyMiw2IEBACiAgICAgICAgIG1SZXBhaW50U2NoZWR1bGVkID0gZmFsc2U7CiAgICAgfQogCi0gICAgLy8gY2FsbGVkIGJ5IEpOSQotICAgIHByaXZhdGUgdm9pZCBzZW5kSW1tZWRpYXRlUmVwYWludCgpIHsKLSAgICAgICAgaWYgKG1XZWJWaWV3ICE9IG51bGwgJiYgIW1SZXBhaW50U2NoZWR1bGVkKSB7Ci0gICAgICAgICAgICBtUmVwYWludFNjaGVkdWxlZCA9IHRydWU7Ci0gICAgICAgICAgICBNZXNzYWdlLm9idGFpbihtV2ViVmlldy5tUHJpdmF0ZUhhbmRsZXIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICBXZWJWaWV3LklNTUVESUFURV9SRVBBSU5UX01TR19JRCkuc2VuZFRvVGFyZ2V0KCk7Ci0gICAgICAgIH0KLSAgICB9Ci0KLSAgICAvLyBjYWxsZWQgYnkgSk5JCi0gICAgcHJpdmF0ZSB2b2lkIHNldFJvb3RMYXllcihpbnQgbGF5ZXIpIHsKLSAgICAgICAg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ID09IDAKICAgICAgICAgICAgICAgICAgICAgICAgID8gKG1SZXN0b3JlZFNjYWxlID4gMCA/IG1SZXN0b3JlZFNjYWxlIC8gMTAwLjBmCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogbVJlc3RvcmVTdGF0ZS5tVGV4dFdyYXBTY2FsZSkKLSAgICAgICAgICAgICAgICAgICAgICAgIDogbVJlc3RvcmVTdGF0ZS5tVmlld1NjYWxlOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6IG1Jbml0aWFsVmlld1N0YXRlLm1UZXh0V3JhcFNjYWxlKQorICAgICAgICAgICAgICAgICAgICAgICAgOiBtSW5pdGlhbFZpZXdTdGF0ZS5tVmlld1NjYWxlOwogICAgICAgICAgICAgICAgIGlmIChEZWJ1Z0ZsYWdzLldFQl9WSUVXX0NPUkUpIHsKICAgICAgICAgICAgICAgICAgICAgTG9nLnYoTE9HVEFHLCAic2V0dXBWaWV3cG9ydCIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiIG1SZXN0b3JlZFNjYWxlPSIgKyBtUmVzdG9yZWRTY2FsZQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICArICIgbVZpZXdTY2FsZT0iICsgbVJlc3RvcmVTdGF0ZS5tVmlld1NjYWxlCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgIiBtVGV4dFdyYXBTY2FsZT0iICsgbVJlc3RvcmVTdGF0ZS5tVGV4dFdyYXBTY2FsZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICArICIgbVZpZXdTY2FsZT0iICsgbUluaXRpYWxWaWV3U3RhdGUubVZpZXdTY2FsZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICArICIgbVRleHRXcmFwU2NhbGU9IiArIG1Jbml0aWFsVmlld1N0YXRlLm1UZXh0V3JhcFNjYWxlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGRhdGEubVdpZHRoID0gTWF0aC5yb3VuZCh3ZWJWaWV3V2lkdGggLyBkYXRhLm1TY2FsZSk7CkBAIC0yMjA1LDcgKzIyMzgsNyBAQAogICAgICAgICAgICAgICAgICAgICAgICAgTWF0aC5yb3VuZChtV2ViVmlldy5nZXRWaWV3SGVpZ2h0KCkgLyBkYXRhLm1TY2FsZSkKICAgICAgICAgICAgICAgICAgICAgICAgIDogbUN1cnJlbnRWaWV3SGVpZ2h0ICogZGF0YS5tV2lkdGggLyB2aWV3cG9ydFdpZHRoOwogICAgICAgICAgICAgICAgIGRhdGEubVRleHRXcmFwV2lkdGggPSBNYXRoLnJvdW5kKHdlYlZpZXdXaWR0aAotICAgICAgICAgICAgICAgICAgICAgICAgLyBtUmVzdG9yZVN0YXRlLm1UZXh0V3JhcFNjYWxlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8gbUluaXRpYWxWaWV3U3RhdGUubVRleHRXcmFwU2NhbGUpOwogICAgICAgICAgICAgICAgIGRhdGEubUlnbm9yZUhlaWdodCA9IGZhbHNlOwogICAgICAgICAgICAgICAgIGRhdGEubUFuY2hvclggPSBkYXRhLm1BbmNob3JZID0gMDsKICAgICAgICAgICAgICAgICAvLyBzZW5kIFZJRVdfU0laRV9DSEFOR0VEIHRvIHRoZSBmcm9udCBvZiB0aGUgcXVldWUgc28gdGhhdCB3ZQpAQCAtMjIxOCwyMCArMjI1MSwxMiBAQAogICAgIH0KIAogICAgIC8vIGNhbGxlZCBieSBKTkkKLSAgICBwcml2YXRlIHZvaWQgcmVzdG9yZVNjYWxlKGludCBzY2FsZSkgeworICAgIHByaXZhdGUgdm9pZCByZXN0b3JlU2NhbGUoaW50IHNjYWxlLCBpbnQgdGV4dFdyYXBTY2FsZSkgewogICAgICAgICBpZiAobUJyb3dzZXJGcmFtZS5maXJzdExheW91dERvbmUoKSA9PSBmYWxzZSkgewogICAgICAgICAgICAgbVJlc3RvcmVkU2NhbGUgPSBzY2FsZTsKLSAgICAgICAgfQotICAgIH0KLQotICAgIC8vIGNhbGxlZCBieSBKTkkKLSAgICBwcml2YXRlIHZvaWQgcmVzdG9yZVNjcmVlbldpZHRoU2NhbGUoaW50IHNjYWxlKSB7Ci0gICAgICAgIGlmICghbVNldHRpbmdzLmdldFVzZVdpZGVWaWV3UG9ydCgpKSB7Ci0gICAgICAgICAgICByZXR1cm47Ci0gICAgICAgIH0KLQotICAgICAgICBpZiAobUJyb3dzZXJGcmFtZS5maXJzdExheW91dERvbmUoKSA9PSBmYWxzZSkgewotICAgICAgICAgICAgbVJlc3RvcmVkU2NyZWVuV2lkdGhTY2FsZSA9IHNjYWxlOworICAgICAgICAgICAgaWYgKG1TZXR0aW5ncy5nZXRVc2VXaWRlVmlld1BvcnQoKSkgeworICAgICAgICAgICAgICAgIG1SZXN0b3JlZFRleHRXcmFwU2NhbGUgPSB0ZXh0V3JhcFNjYWxlOworICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgfQogCkBAIC0yNDY5LDYgKzI0OTQsMjQgQEAKICAgICAgICAgICAgICAgICBoTW9kZSwgdk1vZGUpLnNlbmRUb1RhcmdldCgpOwogICAgIH0KIAorICAgIHByaXZhdGUgdm9pZCB1c2VNb2NrRGV2aWNlT3JpZW50YXRpb24oKSB7CisgICAgICAgIG1EZXZpY2VPcmllbnRhdGlvbk1hbmFnZXIudXNlTW9jaygpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHNldE1vY2tEZXZpY2VPcmllbnRhdGlvbihib29sZWFuIGNhblByb3ZpZGVBbHBoYSwgZG91YmxlIGFscGhhLAorICAgICAgICAgICAgYm9vbGVhbiBjYW5Qcm92aWRlQmV0YSwgZG91YmxlIGJldGEsIGJvb2xlYW4gY2FuUHJvdmlkZUdhbW1hLCBkb3VibGUgZ2FtbWEpIHsKKyAgICAgICAgbURldmljZU9yaWVudGF0aW9uTWFuYWdlci5zZXRNb2NrT3JpZW50YXRpb24oY2FuUHJvdmlkZUFscGhhLCBhbHBoYSwgY2FuUHJ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RGF0YWJhc2UuamF2YQppbmRleCA3YWNkOWJhLi5kN2I0NDUyIDEwMDY0NAotLS0gYS9jb3JlL2phdmEvYW5kcm9pZC93ZWJraXQvV2ViVmlld0RhdGFiYXNlLmphdmEKKysrIGIvY29yZS9qYXZhL2FuZHJvaWQvd2Via2l0L1dlYlZpZXdEYXRhYmFzZS5qYXZhCkBAIC0xNzMsMTEyICsxNzMsMTQwIEBACiAKICAgICBwcml2YXRlIHN0YXRpYyBpbnQgbUNhY2hlVHJhbnNhY3Rpb25SZWZjb3VudDsKIAotICAgIHByaXZhdGUgV2ViVmlld0RhdGFiYXNlKCkgeworICAgIC8vIEluaXRpYWxseSB0cnVlIHVudGlsIHRoZSBiYWNrZ3JvdW5kIHRocmVhZCBjb21wbGV0ZXMuCisgICAgcHJpdmF0ZSBib29sZWFuIG1Jbml0aWFsaXplZCA9IGZhbHNlOworCisgICAgcHJpdmF0ZSBXZWJWaWV3RGF0YWJhc2UoZmluYWwgQ29udGV4dCBjb250ZXh0KSB7CisgICAgICAgIG5ldyBUaHJlYWQoKSB7CisgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgIHB1YmxpYyB2b2lkIHJ1bigpIHsKKyAgICAgICAgICAgICAgICBpbml0KGNvbnRleHQpOworICAgICAgICAgICAgfQorICAgICAgICB9LnN0YXJ0KCk7CisKICAgICAgICAgLy8gU2luZ2xldG9uIG9ubHksIHVzZSBnZXRJbnN0YW5jZSgpCiAgICAgfQogCiAgICAgcHVibGljIHN0YXRpYyBzeW5jaHJvbml6ZWQgV2ViVmlld0RhdGFiYXNlIGdldEluc3RhbmNlKENvbnRleHQgY29udGV4dCkgewogICAgICAgICBpZiAobUluc3RhbmNlID09IG51bGwpIHsKLSAgICAgICAgICAgIG1JbnN0YW5jZSA9IG5ldyBXZWJWaWV3RGF0YWJhc2UoKTsKLSAgICAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICAgICAgbURhdGFiYXNlID0gY29udGV4dAotICAgICAgICAgICAgICAgICAgICAgICAgLm9wZW5PckNyZWF0ZURhdGFiYXNlKERBVEFCQVNFX0ZJTEUsIDAsIG51bGwpOwotICAgICAgICAgICAgfSBjYXRjaCAoU1FMaXRlRXhjZXB0aW9uIGUpIHsKLSAgICAgICAgICAgICAgICAvLyB0cnkgYWdhaW4gYnkgZGVsZXRpbmcgdGhlIG9sZCBkYiBhbmQgY3JlYXRlIGEgbmV3IG9uZQotICAgICAgICAgICAgICAgIGlmIChjb250ZXh0LmRlbGV0ZURhdGFiYXNlKERBVEFCQVNFX0ZJTEUpKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1EYXRhYmFzZSA9IGNvbnRleHQub3Blbk9yQ3JlYXRlRGF0YWJhc2UoREFUQUJBU0VfRklMRSwgMCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9CisgICAgICAgICAgICBtSW5zdGFuY2UgPSBuZXcgV2ViVmlld0RhdGFiYXNlKGNvbnRleHQpOworICAgICAgICB9CisgICAgICAgIHJldHVybiBtSW5zdGFuY2U7CisgICAgfQogCi0gICAgICAgICAgICAvLyBtRGF0YWJhc2Ugc2hvdWxkIG5vdCBiZSBudWxsLCAKLSAgICAgICAgICAgIC8vIHRoZSBvbmx5IGNhc2UgaXMgUmVxdWVzdEFQSSB0ZXN0IGhhcyBwcm9ibGVtIHRvIGNyZWF0ZSBkYiAKLSAgICAgICAgICAgIGlmIChtRGF0YWJhc2UgIT0gbnVsbCAmJiBtRGF0YWJhc2UuZ2V0VmVyc2lvbigpICE9IERBVEFCQVNFX1ZFUlNJT04pIHsKLSAgICAgICAgICAgICAgICBtRGF0YWJhc2UuYmVnaW5UcmFuc2FjdGlvbigpOwotICAgICAgICAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICAgICAgICAgIHVwZ3JhZGVEYXRhYmFzZSgpOwotICAgICAgICAgICAgICAgICAgICBtRGF0YWJhc2Uuc2V0VHJhbnNhY3Rpb25TdWNjZXNzZnVsKCk7Ci0gICAgICAgICAgICAgICAgfSBmaW5hbGx5IHsKLSAgICAgICAgICAgICAgICAgICAgbURhdGFiYXNlLmVuZFRyYW5zYWN0aW9uKCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQorICAgIHByaXZhdGUgc3luY2hyb25pemVkIHZvaWQgaW5pdChDb250ZXh0IGNvbnRleHQpIHsKKyAgICAgICAgaWYgKG1Jbml0aWFsaXplZCkgeworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CiAKLSAgICAgICAgICAgIGlmIChtRGF0YWJhc2UgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIC8vIHVzZSBwZXIgdGFibGUgTXV0ZXggbG9jaywgdHVybiBvZmYgZGF0YWJhc2UgbG9jaywgdGhpcwotICAgICAgICAgICAgICAgIC8vIGltcHJvdmVzIHBlcmZvcm1hbmNlIGFzIGRhdGFiYXNlJ3MgUmVlbnRyYW50TG9jayBpcyBleHBhbnNpdmUKLSAgICAgICAgICAgICAgICBtRGF0YWJhc2Uuc2V0TG9ja2luZ0VuYWJsZWQoZmFsc2UpOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICB0cnkgewotICAgICAgICAgICAgICAgIG1DYWNoZURhdGFiYXNlID0gY29udGV4dC5vcGVuT3JDcmVhdGVEYXRhYmFzZSgKLSAgICAgICAgICAgICAgICAgICAgICAgIENBQ0hFX0RBVEFCQVNFX0ZJTEUsIDAsIG51bGwpOwotICAgICAgICAgICAgfSBjYXRjaCAoU1FMaXRlRXhjZXB0aW9uIGUpIHsKLSAgICAgICAgICAgICAgICAvLyB0cnkgYWdhaW4gYnkgZGVsZXRpbmcgdGhlIG9sZCBkYiBhbmQgY3JlYXRlIGEgbmV3IG9uZQotICAgICAgICAgICAgICAgIGlmIChjb250ZXh0LmRlbGV0ZURhdGFiYXNlKENBQ0hFX0RBVEFCQVNFX0ZJTEUpKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1DYWNoZURhdGFiYXNlID0gY29udGV4dC5vcGVuT3JDcmVhdGVEYXRhYmFzZSgKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBDQUNIRV9EQVRBQkFTRV9GSUxFLCAwLCBudWxsKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIC8vIG1DYWNoZURhdGFiYXNlIHNob3VsZCBub3QgYmUgbnVsbCwgCi0gICAgICAgICAgICAvLyB0aGUgb25seSBjYXNlIGlzIFJlcXVlc3RBUEkgdGVzdCBoYXMgcHJvYmxlbSB0byBjcmVhdGUgZGIgCi0gICAgICAgICAgICBpZiAobUNhY2hlRGF0YWJhc2UgIT0gbnVsbAotICAgICAgICAgICAgICAgICAgICAmJiBtQ2FjaGVEYXRhYmFzZS5nZXRWZXJzaW9uKCkgIT0gQ0FDSEVfREFUQUJBU0VfVkVSU0lPTikgewotICAgICAgICAgICAgICAgIG1DYWNoZURhdGFiYXNlLmJlZ2luVHJhbnNhY3Rpb24oKTsKLSAgICAgICAgICAgICAgICB0cnkgewotICAgICAgICAgICAgICAgICAgICB1cGdyYWRlQ2FjaGVEYXRhYmFzZSgpOwotICAgICAgICAgICAgICAgICAgICBib290c3RyYXBDYWNoZURhdGFiYXNlKCk7Ci0gICAgICAgICAgICAgICAgICAgIG1DYWNoZURhdGFiYXNlLnNldFRyYW5zYWN0aW9uU3VjY2Vzc2Z1bCgpOwotICAgICAgICAgICAgICAgIH0gZmluYWxseSB7Ci0gICAgICAgICAgICAgICAgICAgIG1DYWNoZURhdGFiYXNlLmVuZFRyYW5zYWN0aW9uKCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIC8vIEVyYXNlIHRoZSBmaWxlcyBmcm9tIHRoZSBmaWxlIHN5c3RlbSBpbiB0aGUgCi0gICAgICAgICAgICAgICAgLy8gY2FzZSB0aGF0IHRoZSBkYXRhYmFzZSB3YXMgdXBkYXRlZCBhbmQgdGhlIAotICAgICAgICAgICAgICAgIC8vIHRoZXJlIHdlcmUgZXhpc3RpbmcgY2FjaGUgY29udGVudAotICAgICAgICAgICAgICAgIENhY2hlTWFuYWdlci5yZW1vdmVBbGxDYWNoZUZpbGVzKCk7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGlmIChtQ2FjaGVEYXRhYmFzZSAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgLy8gdXNlIHJlYWRfdW5jb21taXR0ZWQgdG8gc3BlZWQgdXAgUkVBRAotICAgICAgICAgICAgICAgIG1DYWNoZURhdGFiYXNlLmV4ZWNTUUwoIlBSQUdNQSByZWFkX3VuY29tbWl0dGVkID0gdHJ1ZTsiKTsKLSAgICAgICAgICAgICAgICAvLyBhcyBvbmx5IFJFQUQgY2FuIGJlIGNhbGxlZCBpbiB0aGUgbm9uLVdlYlZpZXdXb3JrZXJUaHJlYWQsCi0gICAgICAgICAgICAgICAgLy8gYW5kIHJlYWRfdW5jb21taXR0ZWQgaXMgdXNlZCwgd2UgY2FuIHR1cm4gb2ZmIGRhdGFiYXNlIGxvY2sKLSAgICAgICAgICAgICAgICAvLyB0byB1c2UgdHJhbnNhY3Rpb24uCi0gICAgICAgICAgICAgICAgbUNhY2hlRGF0YWJhc2Uuc2V0TG9ja2luZ0VuYWJsZWQoZmFsc2UpOwotCi0gICAgICAgICAgICAgICAgLy8gdXNlIEluc2VydEhlbHBlciBmb3IgZmFzdGVyIGluc2VydGlvbgotICAgICAgICAgICAgICAgIG1DYWNoZUluc2VydGVyID0gbmV3IERhdGFiYXNlVXRpbHMuSW5zZXJ0SGVscGVyKG1DYWNoZURhdGFiYXNlLAotICAgICAgICAgICAgICAgICAgICAgICAgImNhY2hlIik7Ci0gICAgICAgICAgICAgICAgbUNhY2hlVXJsQ29sSW5kZXggPSBtQ2FjaGVJbnNlcnRlcgotICAgICAgICAgICAgICAgICAgICAgICAgLmdldENvbHVtbkluZGV4KENBQ0hFX1VSTF9DT0wpOwotICAgICAgICAgICAgICAgIG1DYWNoZUZpbGVQYXRoQ29sSW5kZXggPSBtQ2FjaGVJbnNlcnRlcgotICAgICAgICAgICAgICAgICAgICAgICAgLmdldENvbHVtbkluZGV4KENBQ0hFX0ZJTEVfUEFUSF9DT0wpOwotICAgICAgICAgICAgICAgIG1DYWNoZUxhc3RNb2RpZnlDb2xJbmRleCA9IG1DYWNoZUluc2VydGVyCi0gICAgICAgICAgICAgICAgICAgICAgICAuZ2V0Q29sdW1uSW5kZXgoQ0FDSEVfTEFTVF9NT0RJRllfQ09MKTsKLSAgICAgICAgICAgICAgICBtQ2FjaGVFVGFnQ29sSW5kZXggPSBtQ2FjaGVJbnNlcnRlcgotICAgICAgICAgICAgICAgICAgICAgICAgLmdldENvbHVtbkluZGV4KENBQ0hFX0VUQUdfQ09MKTsKLSAgICAgICAgICAgICAgICBtQ2FjaGVFeHBpcmVzQ29sSW5kZXggPSBtQ2FjaGVJbnNlcnRlcgotICAgICAgICAgICAgICAgICAgICAgICAgLmdldENvbHVtbkluZGV4KENBQ0hFX0VYUElSRVNfQ09MKTsKLSAgICAgICAgICAgICAgICBtQ2FjaGVFeHBpcmVzU3RyaW5nQ29sSW5kZXggPSBtQ2FjaGVJbnNlcnRlcgotICAgICAgICAgICAgICAgICAgICAgICAgLmdldENvbHVtbkluZGV4KENBQ0hFX0VYUElSRVNfU1RSSU5HX0NPTCk7Ci0gICAgICAgICAgICAgICAgbUNhY2hlTWltZVR5cGVDb2xJbmRleCA9IG1DYWNoZUluc2VydGVyCi0gICAgICAgICAgICAgICAgICAgICAgICAuZ2V0Q29sdW1uSW5kZXgoQ0FDSEVfTUlNRVRZUEVfQ09MKTsKLSAgICAgICAgICAgICAgICBtQ2FjaGVFbmNvZGluZ0NvbEluZGV4ID0gbUNhY2hlSW5zZXJ0ZXIKLSAgICAgICAgICAgICAgICAgICAgICAgIC5nZXRDb2x1bW5JbmRleChDQUNIRV9FTkNPRElOR19DT0wpOwotICAgICAgICAgICAgIC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udGV4dC5kZWxldGVEYXRhYmFzZShEQVRBQkFTRV9GSUxFKSkgeworICAgICAgICAgICAgICAgIG1EYXRhYmFzZSA9IGNvbnRleHQub3Blbk9yQ3JlYXRlRGF0YWJhc2UoREFUQUJBU0VfRklMRSwgMCwKKyAgICAgICAgICAgICAgICAgICAgICAgIG51bGwpOwogICAgICAgICAgICAgfQogICAgICAgICB9CiAKLSAgICAgICAgcmV0dXJuIG1JbnN0YW5jZTsKKyAgICAgICAgLy8gbURhdGFiYXNlIHNob3VsZCBub3QgYmUgbnVsbCwKKyAgICAgICAgLy8gdGhlIG9ubHkgY2FzZSBpcyBSZXF1ZXN0QVBJIHRlc3QgaGFzIHByb2JsZW0gdG8gY3JlYXRlIGRiCisgICAgICAgIGlmIChtRGF0YWJhc2UgPT0gbnVsbCkgeworICAgICAgICAgICAgbUluaXRpYWxpemVkID0gdHJ1ZTsKKyAgICAgICAgICAgIG5vdGlmeSgpOworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisKKyAgICAgICAgaWYgKG1EYXRhYmFzZS5nZXRWZXJzaW9uKCkgIT0gREFUQUJBU0VfVkVSU0lPTikgeworICAgICAgICAgICAgbURhdGFiYXNlLmJlZ2luVHJhbnNhY3Rpb24oKTsKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgdXBncmFkZURhdGFiYXNlKCk7CisgICAgICAgICAgICAgICAgbURhdGFiYXNlLnNldFRyYW5zYWN0aW9uU3VjY2Vzc2Z1bCgpOworICAgICAgICAgICAgfSBmaW5hbGx5IHsKKyAgICAgICAgICAgICAgICBtRGF0YWJhc2UuZW5kVHJhbnNhY3Rpb24oKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIC8vIHVzZSBwZXIgdGFibGUgTXV0ZXggbG9jaywgdHVybiBvZmYgZGF0YWJhc2UgbG9jaywgdGhpcworICAgICAgICAvLyBpbXByb3ZlcyBwZXJmb3JtYW5jZSBhcyBkYXRhYmFzZ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7CisgICAgICAgIG5vdGlmeSgpOwogICAgIH0KIAogICAgIHByaXZhdGUgc3RhdGljIHZvaWQgdXBncmFkZURhdGFiYXNlKCkgewpAQCAtMzkxLDggKzQxOSwyNSBAQAogICAgICAgICB9CiAgICAgfQogCisgICAgLy8gV2FpdCBmb3IgdGhlIGJhY2tncm91bmQgaW5pdGlhbGl6YXRpb24gdGhyZWFkIHRvIGNvbXBsZXRlIGFuZCBjaGVjayB0aGUKKyAgICAvLyBkYXRhYmFzZSBjcmVhdGlvbiBzdGF0dXMuCisgICAgcHJpdmF0ZSBib29sZWFuIGNoZWNrSW5pdGlhbGl6ZWQoKSB7CisgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgeworICAgICAgICAgICAgd2hpbGUgKCFtSW5pdGlhbGl6ZWQpIHsKKyAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICB3YWl0KCk7CisgICAgICAgICAgICAgICAgfSBjYXRjaCAoSW50ZXJydXB0ZWRFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICBMb2cuZShMT0dUQUcsICJDYXVnaHQgZXhjZXB0aW9uIHdoaWxlIGNoZWNraW5nICIgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJpbml0aWFsaXphdGlvbiIpOworICAgICAgICAgICAgICAgICAgICBMb2cuZShMT0dUQUcsIExvZy5nZXRTdGFja1RyYWNlU3RyaW5nKGUpKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIG1EYXRhYmFzZSAhPSBudWxsOworICAgIH0KKwogICAgIHByaXZhdGUgYm9vbGVhbiBoYXNFbnRyaWVzKGludCB0YWJsZUlkKSB7Ci0gICAgICAgIGlmIChtRGF0YWJhc2UgPT0gbnVsbCkgeworICAgICAgICBpZiAoIWNoZWNrSW5pdGlhbGl6ZWQoKSkgewogICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICB9CiAKQEAgLTQyMiw3ICs0NjcsNyBAQAogICAgICAqLwogICAgIEFycmF5TGlzdDxDb29raWU+IGdldENvb2tpZXNGb3JEb21haW4oU3RyaW5nIGRvbWFpbikgewogICAgICAgICBBcnJheUxpc3Q8Q29va2llPiBsaXN0ID0gbmV3IEFycmF5TGlzdDxDb29raWU+KCk7Ci0gICAgICAgIGlmIChkb21haW4gPT0gbnVsbCB8fCBtRGF0YWJhc2UgPT0gbnVsbCkgeworICAgICAgICBpZiAoZG9tYWluID09IG51bGwgfHwgIWNoZWNrSW5pdGlhbGl6ZWQoKSkgewogICAgICAgICAgICAgcmV0dXJuIGxpc3Q7CiAgICAgICAgIH0KIApAQCAtNDgxLDcgKzUyNiw3IEBACiAgICAgICogICAgICAgICAgICBkZWxldGVkLgogICAgICAqLwogICAgIHZvaWQgZGVsZXRlQ29va2llcyhTdHJpbmcgZG9tYWluLCBTdHJpbmcgcGF0aCwgU3RyaW5nIG5hbWUpIHsKLSAgICAgICAgaWYgKGRvbWFpbiA9PSBudWxsIHx8IG1EYXRhYmFzZSA9PSBudWxsKSB7CisgICAgICAgIGlmIChkb21haW4gPT0gbnVsbCB8fCAhY2hlY2tJbml0aWFsaXplZCgpKSB7CiAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgIH0KIApAQCAtNTAxLDcgKzU0Niw3IEBACiAgICAgICovCiAgICAgdm9pZCBhZGRDb29raWUoQ29va2llIGNvb2tpZSkgewogICAgICAgICBpZiAoY29va2llLmRvbWFpbiA9PSBudWxsIHx8IGNvb2tpZS5wYXRoID09IG51bGwgfHwgY29va2llLm5hbWUgPT0gbnVsbAotICAgICAgICAgICAgICAgIHx8IG1EYXRhYmFzZSA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgfHwgIWNoZWNrSW5pdGlhbGl6ZWQoKSkgewogICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICB9CiAKQEAgLTUzNCw3ICs1NzksNyBAQAogICAgICAqIENsZWFyIGNvb2tpZSBkYXRhYmFzZQogICAgICAqLwogICAgIHZvaWQgY2xlYXJDb29raWVzKCkgewotICAgICAgICBpZiAobURhdGFiYXNlID09IG51bGwpIHsKKyAgICAgICAgaWYgKCFjaGVja0luaXRpYWxpemVkKCkpIHsKICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgfQogCkBAIC01NDcsNyArNTkyLDcgQEAKICAgICAgKiBDbGVhciBzZXNzaW9uIGNvb2tpZXMsIHdoaWNoIG1lYW5zIGNvb2tpZSBkb2Vzbid0IGhhdmUgRVhQSVJFUy4KICAgICAgKi8KICAgICB2b2lkIGNsZWFyU2Vzc2lvbkNvb2tpZXMoKSB7Ci0gICAgICAgIGlmIChtRGF0YWJhc2UgPT0gbnVsbCkgeworICAgICAgICBpZiAoIWNoZWNrSW5pdGlhbGl6ZWQoKSkgewogICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICB9CiAKQEAgLTU2NCw3ICs2MDksNyBAQAogICAgICAqIEBwYXJhbSBub3cgVGltZSBmb3Igbm93CiAgICAgICovCiAgICAgdm9pZCBjbGVhckV4cGlyZWRDb29raWVzKGxvbmcgbm93KSB7Ci0gICAgICAgIGlmIChtRGF0YWJhc2UgPT0gbnVsbCkgeworICAgICAgICBpZiAoIWNoZWNrSW5pdGlhbGl6ZWQoKSkgewogICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICB9CiAKQEAgLTYyMCw3ICs2NjUsNyBAQAogICAgICAqIEByZXR1cm4gQ2FjaGVSZXN1bHQgVGhlIENhY2hlTWFuYWdlci5DYWNoZVJlc3VsdAogICAgICAqLwogICAgIENhY2hlUmVzdWx0IGdldENhY2hlKFN0cmluZyB1cmwpIHsKLSAgICAgICAgaWYgKHVybCA9PSBudWxsIHx8IG1DYWNoZURhdGFiYXNlID09IG51bGwpIHsKKyAgICAgICAgaWYgKHVybCA9PSBudWxsIHx8ICFjaGVja0luaXRpYWxpemVkKCkpIHsKICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICB9CiAKQEAgLTY2MCw3ICs3MDUsNyBAQAogICAgICAqIEBwYXJhbSB1cmwgVGhlIHVybAogICAgICAqLwogICAgIHZvaWQgcmVtb3ZlQ2FjaGUoU3RyaW5nIHVybCkgewotICAgICAgICBpZiAodXJsID09IG51bGwgfHwgbUNhY2hlRGF0YWJhc2UgPT0gbnVsbCkgeworICAgICAgICBpZiAodXJsID09IG51bGwgfHwgIWNoZWNrSW5pdGlhbGl6ZWQoKSkgewogICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICB9CiAKQEAgLTY3NCw3ICs3MTksNyBAQAogICAgICAqIEBwYXJhbSBjIFRoZSBDYWNoZU1hbmFnZXIuQ2FjaGVSZXN1bHQKICAgICAgKi8KICAgICB2b2lkIGFkZENhY2hlKFN0cmluZyB1cmwsIENhY2hlUmVzdWx0IGMpIHsKLSAgICAgICAgaWYgKHVybCA9PSBudWxsIHx8IG1DYWNoZURhdGFiYXNlID09IG51bGwpIHsKKyAgICAgICAgaWYgKHVybCA9PSBudWxsIHx8ICFjaGVja0luaXRpYWxpemVkKCkpIHsKICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgfQogCkBAIC03MDAsNyArNzQ1LDcgQEAKICAgICAgKiBDbGVhciBjYWNoZSBkYXRhYmFzZQogICAgICAqLwogICAgIHZvaWQgY2xlYXJDYWNoZSgpIHsKLSAgICAgICAgaWYgKG1DYWNoZURhdGFiYXNlID09IG51bGwpIHsKKyAgICAgICAgaWYgKCFjaGVja0luaXRpYWxpemVkKCkpIHsKICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgfQogCkBAIC03MDgsNyArNzUzLDcgQEAKICAgICB9CiAKICAgICBib29sZWFuIGhhc0NhY2hlKCkgewotICAgICAgICBpZiAobUNhY2hlRGF0YWJhc2UgPT0gbnVsbCkgeworICAgICAgICBpZiAoIWNoZWNrSW5pdGlhbGl6ZWQoKSkgewogICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICB9CiAKQEAgLTgzNCw3ICs4NzksNyBAQAogICAgICAqLwogICAgIHZvaWQgc2V0VXNlcm5hbWVQYXNzd29yZChTdHJpbmcgc2NoZW1lUGx1c0hvc3QsIFN0cmluZyB1c2VybmFtZSwKICAgICAgICAgICAgICAgICBTdHJpbmcgcGFzc3dvcmQpIHsKLSAgICAgICAgaWYgKHNjaGVtZVBsdXNIb3N0ID09IG51bGwgfHwgbURhdGFiYXNlID09IG51bGwpIHsKKyAgICAgICAgaWYgKHNjaGVtZVBsdXNIb3N0ID09IG51bGwgfHwgIWNoZWNrSW5pdGlhbGl6ZWQoKSkgewogICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICB9CiAKQEAgLTg1Niw3ICs5MDEsNyBAQAogICAgICAqICAgICAgICAgU3RyaW5nWzFdIGlzIHBhc3N3b3JkLiBSZXR1cm4gbnVsbCBpZiBpdCBjYW4ndCBmaW5kIGFueXRoaW5nLgogICAgICAqLwogICAgIFN0cmluZ1tdIGdldFVzZXJuYW1lUGFzc3dvcmQoU3RyaW5nIHNjaGVtZVBsdXNIb3N0KSB7Ci0gICAgICAgIGlmIChzY2hlbWVQbHVzSG9zdCA9PSBudWxsIHx8IG1EYXRhYmFzZSA9PSBudWxsKSB7CisgICAgICAgIGlmIChzY2hlbWVQbHVzSG9zdCA9PSBudWxsIHx8ICFjaGVja0luaXRpYWxpemVkKCkpIHsKICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICB9CiAKQEAgLTkwMiw3ICs5NDcsNyBAQAogICAgICAqIENsZWFyIHBhc3N3b3JkIGRhdGFiYXNlCiAgICAgICovCiAgICAgcHVibGljIHZvaWQgY2xlYXJVc2VybmFtZVBhc3N3b3JkKCkgewotICAgICAgICBpZiAobURhdGFiYXNlID09IG51bGwpIHsKKyAgICAgICAgaWYgKCFjaGVja0luaXRpYWx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Q09ORElUSU9OUyBPRiBBTlkgS0lORCwgZWl0aGVyIGV4cHJlc3Mgb3IgaW1wbGllZC4KKyAqIFNlZSB0aGUgTGljZW5zZSBmb3IgdGhlIHNwZWNpZmljIGxhbmd1YWdlIGdvdmVybmluZyBwZXJtaXNzaW9ucyBhbmQKKyAqIGxpbWl0YXRpb25zIHVuZGVyIHRoZSBMaWNlbnNlLgorICovCitwYWNrYWdlIGFuZHJvaWQud2Via2l0OworCitpbnRlcmZhY2UgWm9vbUNvbnRyb2xCYXNlIHsKKworICAgIC8qKgorICAgICAqIENhdXNlcyB0aGUgb24tc2NyZWVuIHpvb20gY29udHJvbCB0byBiZSBtYWRlIHZpc2libGUKKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBzaG93KCk7CisKKyAgICAvKioKKyAgICAgKiBDYXVzZXMgdGhlIG9uLXNjcmVlbiB6b29tIGNvbnRyb2wgdG8gZGlzYXBwZWFyCisgICAgICovCisgICAgcHVibGljIHZvaWQgaGlkZSgpOworCisgICAgLyoqCisgICAgICogRW5hYmxlcyB0aGUgY29udHJvbCB0byB1cGRhdGUgaXRzIHN0YXRlIGlmIG5lY2Vzc2FyeSBpbiByZXNwb25zZSB0byBhCisgICAgICogY2hhbmdlIGluIHRoZSBwYWdlcyB6b29tIGxldmVsLiBGb3IgZXhhbXBsZSwgaWYgdGhlIG1heCB6b29tIGxldmVsIGlzCisgICAgICogcmVhY2hlZCB0aGVuIHRoZSBjb250cm9sIGNhbiBkaXNhYmxlIHRoZSBidXR0b24gZm9yIHpvb21pbmcgaW4uCisgICAgICovCisgICAgcHVibGljIHZvaWQgdXBkYXRlKCk7CisKKyAgICAvKioKKyAgICAgKiBDaGVja3MgdG8gc2VlIGlmIHRoZSBjb250cm9sIGlzIGN1cnJlbnRseSB2aXNpYmxlIHRvIHRoZSB1c2VyLgorICAgICAqLworICAgIHB1YmxpYyBib29sZWFuIGlzVmlzaWJsZSgpOworfQpkaWZmIC0tZ2l0IGEvY29yZS9q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bnMgYW5kCisgKiBsaW1pdGF0aW9ucyB1bmRlciB0aGUgTGljZW5zZS4KKyAqLworcGFja2FnZSBhbmRyb2lkLndlYmtpdDsKKworaW1wb3J0IGFuZHJvaWQudmlldy5HcmF2aXR5OworaW1wb3J0IGFuZHJvaWQudmlldy5WaWV3OworaW1wb3J0IGFuZHJvaWQudmlldy5WaWV3R3JvdXA7CitpbXBvcnQgYW5kcm9pZC53aWRnZXQuRnJhbWVMYXlvdXQ7CitpbXBvcnQgYW5kcm9pZC53aWRnZXQuVG9hc3Q7CitpbXBvcnQgYW5kcm9pZC53aWRnZXQuWm9vbUJ1dHRvbnNDb250cm9sbGVyOworCitjbGFzcyBab29tQ29udHJvbEVtYmVkZGVkIGltcGxlbWVudHMgWm9vbUNvbnRyb2xCYXNlIHsKKworICAgIHByaXZhdGUgZmluYWwgWm9vbU1hbmFnZXIgbVpvb21NYW5hZ2VyOworICAgIHByaXZhdGUgZmluYWwgV2ViVmlldyBtV2ViVmlldzsKKworICAgIC8vIFRoZSBjb250cm9sbGVyIGlzIGxhemlseSBpbml0aWFsaXplZCBpbiBnZXRDb250cm9scygpIGZvciBwZXJmb3JtYW5jZS4KKyAgICBwcml2YXRlIFpvb21CdXR0b25zQ29udHJvbGxlciBtWm9vbUJ1dHRvbnNDb250cm9sbGVyOworCisgICAgcHVibGljIFpvb21Db250cm9sRW1iZWRkZWQoWm9vbU1hbmFnZXIgem9vbU1hbmFnZXIsIFdlYlZpZXcgd2ViVmlldykgeworICAgICAgICBtWm9vbU1hbmFnZXIgPSB6b29tTWFuYWdlcjsKKyAgICAgICAgbVdlYlZpZXcgPSB3ZWJWaWV3OworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHNob3coKSB7CisgICAgICAgIGlmICghZ2V0Q29udHJvbHMoKS5pc1Zpc2libGUoKSAmJiAhbVpvb21NYW5hZ2VyLmlzWm9vbVNjYWxlRml4ZWQoKSkgeworCisgICAgICAgICAgICBtWm9vbUJ1dHRvbnNDb250cm9sbGVyLnNldFZpc2libGUodHJ1ZSk7CisKKyAgICAgICAgICAgIFdlYlNldHRpbmdzIHNldHRpbmdzID0gbVdlYlZpZXcuZ2V0U2V0dGluZ3MoKTsKKyAgICAgICAgICAgIGludCBjb3VudCA9IHNldHRpbmdzLmdldERvdWJsZVRhcFRvYXN0Q291bnQoKTsKKyAgICAgICAgICAgIGlmIChtWm9vbU1hbmFnZXIuaXNJblpvb21PdmVydmlldygpICYmIGNvdW50ID4gMCkgeworICAgICAgICAgICAgICAgIHNldHRpbmdzLnNldERvdWJsZVRhcFRvYXN0Q291bnQoLS1jb3VudCk7CisgICAgICAgICAgICAgICAgVG9hc3QubWFrZVRleHQobVdlYlZpZXcuZ2V0Q29udGV4dCgpLAorICAgICAgICAgICAgICAgICAgICAgICAgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHJpbmcuZG91YmxlX3RhcF90b2FzdCwKKyAgICAgICAgICAgICAgICAgICAgICAgIFRvYXN0LkxFTkdUSF9MT05HKS5zaG93KCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBoaWRlKCkgeworICAgICAgICBpZiAobVpvb21CdXR0b25zQ29udHJvbGxlciAhPSBudWxsKSB7CisgICAgICAgICAgICBtWm9vbUJ1dHRvbnNDb250cm9sbGVyLnNldFZpc2libGUoZmFsc2UpOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gaXNWaXNpYmxlKCkgeworICAgICAgICByZXR1cm4gbVpvb21CdXR0b25zQ29udHJvbGxlciAhPSBudWxsICYmIG1ab29tQnV0dG9uc0NvbnRyb2xsZXIuaXNWaXNpYmxlKCk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdXBkYXRlKCkgeworICAgICAgICBpZiAobVpvb21CdXR0b25zQ29udHJvbGxlciA9PSBudWxsKSB7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKworICAgICAgICBib29sZWFuIGNhblpvb21JbiA9IG1ab29tTWFuYWdlci5jYW5ab29tSW4oKTsKKyAgICAgICAgYm9vbGVhbiBjYW5ab29tT3V0ID0gbVpvb21NYW5hZ2VyLmNhblpvb21PdXQoKSAmJiAhbVpvb21NYW5hZ2VyLmlzSW5ab29tT3ZlcnZpZXcoKTsKKyAgICAgICAgaWYgKCFjYW5ab29tSW4gJiYgIWNhblpvb21PdXQpIHsKKyAgICAgICAgICAgIC8vIEhpZGUgdGhlIHpvb20gaW4gYW5kIG91dCBidXR0b25zIGlmIHRoZSBwYWdlIGNhbm5vdCB6b29tCisgICAgICAgICAgICBtWm9vbUJ1dHRvbnNDb250cm9sbGVyLmdldFpvb21Db250cm9scygpLnNldFZpc2liaWxpdHkoVmlldy5HT05FKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIC8vIFNldCBlYWNoIG9uZSBpbmRpdmlkdWFsbHksIGFzIGEgcGFnZSBtYXkgYmUgYWJsZSB0byB6b29tIGluIG9yIG91dAorICAgICAgICAgICAgbVpvb21CdXR0b25zQ29udHJvbGxlci5zZXRab29tSW5FbmFibGVkKGNhblpvb21Jbik7CisgICAgICAgICAgICBtWm9vbUJ1dHRvbnNDb250cm9sbGVyLnNldFpvb21PdXRFbmFibGVkKGNhblpvb21PdXQpOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSBab29tQnV0dG9uc0NvbnRyb2xsZXIgZ2V0Q29udHJvbHMoKSB7CisgICAgICAgIGlmIChtWm9vbUJ1dHRvbnNDb250cm9sbGVyID09IG51bGwpIHsKKyAgICAgICAgICAgIG1ab29tQnV0dG9uc0NvbnRyb2xsZXIgPSBuZXcgWm9vbUJ1dHRvbnNDb250cm9sbGVyKG1XZWJWaWV3KTsKKyAgICAgICAgICAgIG1ab29tQnV0dG9uc0NvbnRyb2xsZXIuc2V0T25ab29tTGlzdGVuZXIobmV3IFpvb21MaXN0ZW5lcigpKTsKKyAgICAgICAgICAgIC8vIFpvb21CdXR0b25zQ29udHJvbGxlciBwb3NpdGlvbnMgdGhlIGJ1dHRvbnMgYXQgdGhlIGJvdHRvbSwgYnV0IGluCisgICAgICAgICAgICAvLyB0aGUgbWlkZGxlLiBDaGFuZ2UgdGhlaXIgbGF5b3V0IHBhcmFtZXRlcnMgc28gdGhleSBhcHBlYXIgb24gdGhlCisgICAgICAgICAgICAvLyByaWdodC4KKyAgICAgICAgICAgIFZpZXcgY29udHJvbHMgPSBtWm9vbUJ1dHRvbnNDb250cm9sbGVyLmdldFpvb21Db250cm9scygpOworICAgICAgICAgICAgVmlld0dyb3VwLkxheW91dFBhcmFtcyBwYXJhbXMgPSBjb250cm9scy5nZXRMYXlvdXRQYXJhbXMoKTsKKyAgICAgICAgICAgIGlmIChwYXJhbXMgaW5zdGFuY2VvZiBGcmFtZUxheW91dC5MYXlvdXRQYXJhbXMpIHsKKyAgICAgICAgICAgICAgICAoKEZyYW1lTGF5b3V0LkxheW91dFBhcmFtcykgcGFyYW1zKS5ncmF2aXR5ID0gR3Jhdml0eS5SSUdIVDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbVpvb21CdXR0b25zQ29udHJvbGxlcjsKKyAgICB9CisKKyAgICBwcml2YXRlIGNsYXNzIFpvb21MaXN0ZW5lciBpbXBsZW1lbnRzIFpvb21CdXR0b25zQ29udHJvbGxlci5Pblpvb21MaXN0ZW5lciB7CisKKyAgICAgICAgcHVibGljIHZvaWQgb25WaXNpYmlsaXR5Q2hhbmdlZChib29sZWFuIHZpc2libGUpIHsKKyAgICAgICAgICAgIGlmICh2aXNpYmxlKSB7CisgICAgICAgICAgICAgICAgbVdlYlZpZXcuc3dpdGNoT3V0RHJhd0hpc3RvcnkoKTsKKyAgICAgICAgICAgICAgICAvLyBCcmluZyBiYWNrIHRoZSBoaWRkZW4gem9vbSBjb250cm9scy4KKyAgICAgICAgICAgICAgICBtWm9vbUJ1dHRvbnNDb250cm9sbGVyLmdldFpvb21Db250cm9scygpLnN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CisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgbG9uZyBaT09NX0NPTlRST0xTX1RJTUVPVVQgPQorICAgICAgICAgICAgVmlld0NvbmZpZ3VyYXRpb24uZ2V0Wm9vbUNvbnRyb2xzVGltZW91dCgpOworICAgIC8vIFRoZSB2aWV3IGNvbnRhaW5pbmcgdGhlIGV4dGVybmFsIHpvb20gY29udHJvbHMKKyAgICBwcml2YXRlIEV4dGVuZGVkWm9vbUNvbnRyb2xzIG1ab29tQ29udHJvbHM7CisgICAgcHJpdmF0ZSBSdW5uYWJsZSBtWm9vbUNvbnRyb2xSdW5uYWJsZTsKKyAgICBwcml2YXRlIGZpbmFsIEhhbmRsZXIgbVByaXZhdGVIYW5kbGVyID0gbmV3IEhhbmRsZXIoKTsKKworICAgIHByaXZhdGUgZmluYWwgV2ViVmlldyBtV2ViVmlldzsKKworICAgIHB1YmxpYyBab29tQ29udHJvbEV4dGVybmFsKFdlYlZpZXcgd2ViVmlldykgeworICAgICAgICBtV2ViVmlldyA9IHdlYlZpZXc7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc2hvdygpIHsKKyAgICAgICAgaWYobVpvb21Db250cm9sUnVubmFibGUgIT0gbnVsbCkgeworICAgICAgICAgICAgbVByaXZhdGVIYW5kbGVyLnJlbW92ZUNhbGxiYWNrcyhtWm9vbUNvbnRyb2xSdW5uYWJsZSk7CisgICAgICAgIH0KKyAgICAgICAgZ2V0Q29udHJvbHMoKS5zaG93KHRydWUpOworICAgICAgICBtUHJpdmF0ZUhhbmRsZXIucG9zdERlbGF5ZWQobVpvb21Db250cm9sUnVubmFibGUsIFpPT01fQ09OVFJPTFNfVElNRU9VVCk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgaGlkZSgpIHsKKyAgICAgICAgaWYgKG1ab29tQ29udHJvbFJ1bm5hYmxlICE9IG51bGwpIHsKKyAgICAgICAgICAgIG1Qcml2YXRlSGFuZGxlci5yZW1vdmVDYWxsYmFja3MobVpvb21Db250cm9sUnVubmFibGUpOworICAgICAgICB9CisgICAgICAgIGlmIChtWm9vbUNvbnRyb2xzICE9IG51bGwpIHsKKyAgICAgICAgICAgIG1ab29tQ29udHJvbHMuaGlkZSgpOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gaXNWaXNpYmxlKCkgeworICAgICAgICByZXR1cm4gbVpvb21Db250cm9scyAhPSBudWxsICYmIG1ab29tQ29udHJvbHMuaXNTaG93bigpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHVwZGF0ZSgpIHsgfQorCisgICAgcHVibGljIEV4dGVuZGVkWm9vbUNvbnRyb2xzIGdldENvbnRyb2xzKCkgeworICAgICAgICBpZiAobVpvb21Db250cm9scyA9PSBudWxsKSB7CisgICAgICAgICAgICBtWm9vbUNvbnRyb2xzID0gY3JlYXRlWm9vbUNvbnRyb2xzKCk7CisKKyAgICAgICAgICAgIC8qCisgICAgICAgICAgICAgKiBuZWVkIHRvIGJlIHNldCB0byBWSVNJQkxFIGZpcnN0IHNvIHRoYXQgZ2V0TWVhc3VyZWRIZWlnaHQoKSBpbgorICAgICAgICAgICAgICoge0BsaW5rICNvblNpemVDaGFuZ2VkKCl9IGNhbiByZXR1cm4gdGhlIG1lYXN1cmVkIHZhbHVlIGZvciBwcm9wZXIKKyAgICAgICAgICAgICAqIGxheW91dC4KKyAgICAgICAgICAgICAqLworICAgICAgICAgICAgbVpvb21Db250cm9scy5zZXRWaXNpYmlsaXR5KFZpZXcuVklTSUJMRSk7CisgICAgICAgICAgICBtWm9vbUNvbnRyb2xSdW5uYWJsZSA9IG5ldyBSdW5uYWJsZSgpIHsKKyAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgICAgICAgICAgICAgIC8qIERvbid0IGRpc21pc3MgdGhlIGNvbnRyb2xzIGlmIHRoZSB1c2VyIGhhcworICAgICAgICAgICAgICAgICAgICAgKiBmb2N1cyBvbiB0aGVtLiBXYWl0IGFuZCBjaGVjayBhZ2FpbiBsYXRlci4KKyAgICAgICAgICAgICAgICAgICAgICovCisgICAgICAgICAgICAgICAgICAgIGlmICghbVpvb21Db250cm9scy5oYXNGb2N1cygpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtWm9vbUNvbnRyb2xzLmhpZGUoKTsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1Qcml2YXRlSGFuZGxlci5yZW1vdmVDYWxsYmFja3MobVpvb21Db250cm9sUnVubmFibGUpOworICAgICAgICAgICAgICAgICAgICAgICAgbVByaXZhdGVIYW5kbGVyLnBvc3REZWxheWVkKG1ab29tQ29udHJvbFJ1bm5hYmxlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBaT09NX0NPTlRST0xTX1RJTUVPVVQpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbVpvb21Db250cm9sczsKKyAgICB9CisKKyAgICBwcml2YXRlIEV4dGVuZGVkWm9vbUNvbnRyb2xzIGNyZWF0ZVpvb21Db250cm9scygpIHsKKyAgICAgICAgRXh0ZW5kZWRab29tQ29udHJvbHMgem9vbUNvbnRyb2xzID0gbmV3IEV4dGVuZGVkWm9vbUNvbnRyb2xzKG1XZWJWaWV3LmdldENvbnRleHQoKSk7CisgICAgICAgIHpvb21Db250cm9scy5zZXRPblpvb21JbkNsaWNrTGlzdGVuZXIobmV3IE9uQ2xpY2tMaXN0ZW5lcigpIHsKKyAgICAgICAgICAgIHB1YmxpYyB2b2lkIG9uQ2xpY2soVmlldyB2KSB7CisgICAgICAgICAgICAgICAgLy8gcmVzZXQgdGltZSBvdXQKKyAgICAgICAgICAgICAgICBtUHJpdmF0ZUhhbmRsZXIucmVtb3ZlQ2FsbGJhY2tzKG1ab29tQ29udHJvbFJ1bm5hYmxlKTsKKyAgICAgICAgICAgICAgICBtUHJpdmF0ZUhhbmRsZXIucG9zdERlbGF5ZWQobVpvb21Db250cm9sUnVubmFibGUsIFpPT01fQ09OVFJPTFNfVElNRU9VVCk7CisgICAgICAgICAgICAgICAgbVdlYlZpZXcuem9vbUluKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0pOworICAgICAgICB6b29tQ29udHJvbHMuc2V0T25ab29tT3V0Q2xpY2tMaXN0ZW5lcihuZXcgT25DbGlja0xpc3RlbmVyKCkgeworICAgICAgICAgICAgcHVibGljIHZvaWQgb25DbGljayhWaWV3IHYpIHsKKyAgICAgICAgICAgICAgICAvLyByZXNldCB0aW1lIG91dAorICAgICAgICAgICAgICAgIG1Qcml2YXRlSGFuZGxlci5yZW1vdmVDYWxsYmFja3MobVpvb21Db250cm9sUnVubmFibGUpOworICAgICAgICAgICAgICAgIG1Qcml2YXRlSGFuZGxlci5wb3N0RGVsYXllZChtWm9vbUNvbnRyb2xSdW5uYWJsZSwgWk9PTV9DT05UUk9MU19USU1FT1VUKTsKKyAgICAgICAgICAgICAgICBtV2ViVmlldy56b29tT3V0KCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0pOworICAgICAgICByZXR1cm4gem9vbUNvbnRyb2xzOworICAgIH0KKworICAgIHByaXZhdGUgc3RhdGljIGNsYXNzIEV4dGVuZGVkWm9vbUNvbnRyb2xzIGV4dGVuZHMgRnJhbWVMYXlvdXQgeworCisgICAgICAgIHByaXZhdGUgYW5kcm9pZC53aWRnZXQuWm9vbUNvbnRyb2xzIG1QbHVzTWludXNab29tQ29udHJvbHM7CisKKyAgICAgICAgcHVibGljIEV4dGVuZGVkWm9vbUNvbnRyb2xzKENvbnRleHQgY29udGV4dCkgeworICAgICAgICAgICAgc3VwZXIoY29udGV4dCwgbnVsbCk7CisgICAgICAgICAgICBMYXlvdXRJbmZsYXRlciBpbmZsYXRlciA9IChMYXlvdXRJbmZsYXRlcikKKyAgICAgICAgICAgICAgICAgICAgY29udGV4dC5nZXRTeXN0ZW1TZXJ2aWNlKENvbnRleHQuTEFZT1VUX0lORkxBVEVSX1NFUlZJQ0UpOworICAgICAgICAgICAgaW5mbGF0ZXIuaW5mbGF0ZShjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmxheW91dC56b29tX21hZ25pZnksIHRoaXMsIHRydWUpOworICAgICAgICAgICAgbVBsdXNNaW51c1pvb21Db250cm9scyA9IChhbmRyb2lkLndpZGdldC5ab29tQ29udHJvbHMpIGZpbmRWaWV3QnlJZCgKKyAgICAgICAgICAgICAgICAgICAgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5pZC56b29tQ29udHJvbHMpOworICAgICAgICAgICAgZmluZFZpZXdCeUlkKGNvbS5hbmRyb2lkLmludGVybmFsLlIuaWQuem9vbU1hZ25pZnkpLnNldFZpc2liaWxpdHkoCisgICAgICAgICAgICAgICAgICAgIFZpZXcuR09ORSk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBzaG93KGJvb2xlYW4gc2hvd1pvb20pIHsKKyAgICAgICAgICAgIG1QbHVzTWludXNab29tQ29udHJvbHMuc2V0VmlzaWJpbGl0eShzaG93Wm9vbSA/IFZpZXcuVklTSUJMRSA6IFZpZXcuR09ORSk7CisgICAgICAgICAgICBmYWRlKFZpZXcuVklTSUJMRSwgMC4wZiwgMS4wZik7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBoaWRlKCkgeworICAgICAgICAgICAgZmFkZShWaWV3LkdPTkUsIDEuMGYsIDAuMGYpOworICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSB2b2lkIGZhZGUoaW50IHZpc2liaWxpdHksIGZsb2F0IHN0YXJ0QWxwaGEsIGZsb2F0IGVuZEFscGhhKSB7CisgICAgICAgICAgICBBbHBoYUFuaW1hdGlvbiBhbmltID0gbmV3IEFscGhhQW5pbWF0aW9uKHN0YXJ0QWxwaGEsIGVuZEFscGhhKTsKKyAgICAgICAgICAgIGFuaW0uc2V0RHVyYXRpb24oNTAwKTs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ICAgIH0KKworICAgIHB1YmxpYyBmaW5hbCBmbG9hdCBnZXRSZWFkaW5nTGV2ZWxTY2FsZSgpIHsKKyAgICAgIHJldHVybiBNYXRoLm1heChtRGVmYXVsdFNjYWxlLCBNSU5fUkVBRElOR19MRVZFTF9TQ0FMRSk7CisgICAgfQorCisgICAgcHVibGljIGZpbmFsIGZsb2F0IGdldEludkRlZmF1bHRTY2FsZSgpIHsKKyAgICAgICAgcmV0dXJuIG1JbnZEZWZhdWx0U2NhbGU7CisgICAgfQorCisgICAgcHVibGljIGZpbmFsIGZsb2F0IGdldERlZmF1bHRNYXhab29tU2NhbGUoKSB7CisgICAgICAgIHJldHVybiBtRGVmYXVsdE1heFpvb21TY2FsZTsKKyAgICB9CisKKyAgICBwdWJsaWMgZmluYWwgZmxvYXQgZ2V0RGVmYXVsdE1pblpvb21TY2FsZSgpIHsKKyAgICAgICAgcmV0dXJuIG1EZWZhdWx0TWluWm9vbVNjYWxlOworICAgIH0KKworICAgIHB1YmxpYyBmaW5hbCBpbnQgZ2V0RG9jdW1lbnRBbmNob3JYKCkgeworICAgICAgICByZXR1cm4gbUFuY2hvclg7CisgICAgfQorCisgICAgcHVibGljIGZpbmFsIGludCBnZXREb2N1bWVudEFuY2hvclkoKSB7CisgICAgICAgIHJldHVybiBtQW5jaG9yWTsKKyAgICB9CisKKyAgICBwdWJsaWMgZmluYWwgdm9pZCBjbGVhckRvY3VtZW50QW5jaG9yKCkgeworICAgICAgICBtQW5jaG9yWCA9IG1BbmNob3JZID0gMDsKKyAgICB9CisKKyAgICBwdWJsaWMgZmluYWwgdm9pZCBzZXRab29tQ2VudGVyKGZsb2F0IHgsIGZsb2F0IHkpIHsKKyAgICAgICAgbVpvb21DZW50ZXJYID0geDsKKyAgICAgICAgbVpvb21DZW50ZXJZID0geTsKKyAgICB9CisKKyAgICBwdWJsaWMgZmluYWwgdm9pZCBzZXRJbml0aWFsU2NhbGVJblBlcmNlbnQoaW50IHNjYWxlSW5QZXJjZW50KSB7CisgICAgICAgIG1Jbml0aWFsU2NhbGUgPSBzY2FsZUluUGVyY2VudCAqIDAuMDFmOworICAgIH0KKworICAgIHB1YmxpYyBmaW5hbCBmbG9hdCBjb21wdXRlU2NhbGVXaXRoTGltaXRzKGZsb2F0IHNjYWxlKSB7CisgICAgICAgIGlmIChzY2FsZSA8IG1NaW5ab29tU2NhbGUpIHsKKyAgICAgICAgICAgIHNjYWxlID0gbU1pblpvb21TY2FsZTsKKyAgICAgICAgfSBlbHNlIGlmIChzY2FsZSA+IG1NYXhab29tU2NhbGUpIHsKKyAgICAgICAgICAgIHNjYWxlID0gbU1heFpvb21TY2FsZTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gc2NhbGU7CisgICAgfQorCisgICAgcHVibGljIGZpbmFsIGJvb2xlYW4gaXNab29tU2NhbGVGaXhlZCgpIHsKKyAgICAgICAgcmV0dXJuIG1NaW5ab29tU2NhbGUgPj0gbU1heFpvb21TY2FsZTsKKyAgICB9CisKKyAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGJvb2xlYW4gZXhjZWVkc01pblNjYWxlSW5jcmVtZW50KGZsb2F0IHNjYWxlQSwgZmxvYXQgc2NhbGVCKSB7CisgICAgICAgIHJldHVybiBNYXRoLmFicyhzY2FsZUEgLSBzY2FsZUIpID49IE1JTklNVU1fU0NBTEVfSU5DUkVNRU5UOworICAgIH0KKworICAgIHB1YmxpYyBib29sZWFuIHdpbGxTY2FsZVRyaWdnZXJab29tKGZsb2F0IHNjYWxlKSB7CisgICAgICAgIHJldHVybiBleGNlZWRzTWluU2NhbGVJbmNyZW1lbnQoc2NhbGUsIG1BY3R1YWxTY2FsZSk7CisgICAgfQorCisgICAgcHVibGljIGZpbmFsIGJvb2xlYW4gY2FuWm9vbUluKCkgeworICAgICAgICByZXR1cm4gbU1heFpvb21TY2FsZSAtIG1BY3R1YWxTY2FsZSA+IE1JTklNVU1fU0NBTEVfSU5DUkVNRU5UOworICAgIH0KKworICAgIHB1YmxpYy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XMgCisgICAgICogcmVzcG9uc2libGUgZm9yIGdlbmVyYXRpbmcgdGhlIGFuaW1hdGlvbi4KKyAgICAgKgorICAgICAqIEFkZGl0aW9uYWxseSwgdGhlIFdlYlZpZXcgY2FuIGNoZWNrIHRvIHNlZSBpZiBzdWNoIGFuIGFuaW1hdGlvbiBpcyBjdXJyZW50bHkKKyAgICAgKiBpbiBwcm9ncmVzcyBieSBjYWxsaW5nIGlzRml4ZWRMZW5ndGhBbmltYXRpb25JblByb2dyZXNzKCkuCisgICAgICovCisgICAgcHVibGljIHZvaWQgYW5pbWF0ZVpvb20oQ2FudmFzIGNhbnZhcykgeworICAgICAgICBpZiAobVpvb21TY2FsZSA9PSAwKSB7CisgICAgICAgICAgICBMb2cudyhMT0dUQUcsICJBIFdlYlZpZXcgaXMgYXR0ZW1wdGluZyB0byBwZXJmb3JtIGEgZml4ZWQgbGVuZ3RoICIKKyAgICAgICAgICAgICAgICAgICAgKyAiem9vbSBhbmltYXRpb24gd2hlbiBubyB6b29tIGlzIGluIHByb2dyZXNzIik7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKworICAgICAgICBmbG9hdCB6b29tU2NhbGU7CisgICAgICAgIGludCBpbnRlcnZhbCA9IChpbnQpIChTeXN0ZW1DbG9jay51cHRpbWVNaWxsaXMoKSAtIG1ab29tU3RhcnQpOworICAgICAgICBpZiAoaW50ZXJ2YWwgPCBaT09NX0FOSU1BVElPTl9MRU5HVEgpIHsKKyAgICAgICAgICAgIGZsb2F0IHJhdGlvID0gKGZsb2F0KSBpbnRlcnZhbCAvIFpPT01fQU5JTUFUSU9OX0xFTkdUSDsKKyAgICAgICAgICAgIHpvb21TY2FsZSA9IDEuMGYgLyAobUludkluaXRpYWxab29tU2NhbGUKKyAgICAgICAgICAgICAgICAgICAgKyAobUludkZpbmFsWm9vbVNjYWxlIC0gbUludkluaXRpYWxab29tU2NhbGUpICogcmF0aW8pOworICAgICAgICAgICAgbVdlYlZpZXcuaW52YWxpZG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orICAgICAgICAgICAgICAgIC0gKG1ab29tQ2VudGVyWSAtIHRpdGxlSGVpZ2h0KSk7CisgICAgICAgIHR5ID0gLSh0eSA8PSB0aXRsZUhlaWdodCA/IE1hdGgubWF4KHR5LCAwKSA6IFdlYlZpZXcucGluTG9jKHR5CisgICAgICAgICAgICAgICAgLSB0aXRsZUhlaWdodCwgbVdlYlZpZXcuZ2V0Vmlld0hlaWdodCgpLCBNYXRoLnJvdW5kKG1XZWJWaWV3LmdldENvbnRlbnRIZWlnaHQoKQorICAgICAgICAgICAgICAgICogem9vbVNjYWxlKSkgKyB0aXRsZUhlaWdodCkgKyBtV2ViVmlldy5nZXRTY3JvbGxZKCk7CisKKyAgICAgICAgY2FudmFzLnRyYW5zbGF0ZSh0eCwgdHkpOworICAgICAgICBjYW52YXMuc2NhbGUoem9vbVNjYWxlLCB6b29tU2NhbGUpOworICAgIH0KKworICAgIHB1YmxpYyBib29sZWFuIGlzWm9vbUFuaW1hdGluZygpIHsKKyAgICAgICAgcmV0dXJuIGlzRml4ZWRMZW5ndGhBbmltYXRpb25JblByb2dyZXNzKCkgfHwgbVBpbmNoVG9ab29tQW5pbWF0aW5nOworICAgIH0KKworICAgIHB1YmxpYyBib29sZWFuIGlzRml4ZWRMZW5ndGhBbmltYXRpb25JblByb2dyZXNzKCkgeworICAgICAgICByZXR1cm4gbVpvb21TY2FsZSAhPSAwOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHJlZnJlc2hab29tU2NhbGUoYm9vbGVhbiByZWZsb3dUZXh0KSB7CisgICAgICAgIHNldFpvb21TY2FsZShtQWN0dWFsU2NhbGUsIHJlZmxvd1RleHQsIHRydWUpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHNldFpvb21TY2FsZShmbG9hdCBzY2FsZSwgYm9vbGVhbiByZWZsb3dUZXh0KSB7CisgICAgICAgIHNldFpvb21TY2FsZShzY2FsZSwgcmVmbG93VGV4dCwgZmFsc2UpOworICAgIH0KKworICAgIHByaXZ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wgc2NhbGUpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBtQWN0dWFsU2NhbGUgPSBzY2FsZTsKKyAgICAgICAgICAgIG1JbnZBY3R1YWxTY2FsZSA9IDEgLyBzY2FsZTsKKworICAgICAgICAgICAgaWYgKCFtV2ViVmlldy5kcmF3SGlzdG9yeSgpKSB7CisKKyAgICAgICAgICAgICAgICAvLyBJZiBoaXN0b3J5IFBpY3R1cmUgaXMgZHJhd24sIGRvbid0IHVwZGF0ZSBzY3JvbGwuIFRoZXkgd2lsbAorICAgICAgICAgICAgICAgIC8vIGJlIHVwZGF0ZWQgd2hlbiB3ZSBnZXQgb3V0IG9mIHRoYXQgbW9kZS4KKyAgICAgICAgICAgICAgICAvLyB1cGRhdGUgb3VyIHNjcm9sbCBzbyB3ZSBkb24ndCBhcHBlYXIgdG8ganVtcAorICAgICAgICAgICAgICAgIC8vIGkuZS4ga2VlcCB0aGUgY2VudGVyIG9mIHRoZSBkb2MgaW4gdGhlIGNlbnRlciBvZiB0aGUgdmlldworICAgICAgICAgICAgICAgIGludCBvbGRYID0gbVdlYlZpZXcuZ2V0U2Nyb2xsWCgpOworICAgICAgICAgICAgICAgIGludCBvbGRZID0gbVdlYlZpZXcuZ2V0U2Nyb2xsWSgpOworICAgICAgICAgICAgICAgIGZsb2F0IHJhdGlvID0gc2NhbGUgKiBvbGRJbnZTY2FsZTsKKyAgICAgICAgICAgICAgICBmbG9hdCBzeCA9IHJhdGlvICogb2xkWCArIChyYXRpbyAtIDEpICogbVpvb21DZW50ZXJYOworICAgICAgICAgICAgICAgIGZsb2F0IHN5ID0gcmF0aW8gKiBvbGRZICsgKHJhdGlvIC0gMSkKKyAgICAgICAgICAgICAgICAgICAgICAgICogKG1ab29tQ2VudGVyWSAtIG1XZWJWaWV3LmdldFRpdGxlSGVpZ2h0KCkpOworCisgICAgICAgICAgICAgICAgLy8gU2NhbGUgYWxsIHRoZSBjaGlsZCB2aWV3cworICAgICAgICAgICAgICAgIG1XZWJ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bVdlYlZpZXcubVZpZXdNYW5hZ2VyLmhpdFRlc3QobUFuY2hvclgsIG1BbmNob3JZKTsKKyAgICAgICAgaWYgKHBsdWdpbiAhPSBudWxsKSB7CisgICAgICAgICAgICBpZiAobVdlYlZpZXcuaXNQbHVnaW5GaXRPblNjcmVlbihwbHVnaW4pKSB7CisgICAgICAgICAgICAgICAgem9vbVRvT3ZlcnZpZXcoKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgbVdlYlZpZXcuY2VudGVyRml0UmVjdChwbHVnaW4ueCwgcGx1Z2luLnksIHBsdWdpbi53aWR0aCwgcGx1Z2luLmhlaWdodCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKworICAgICAgICBpZiAoc2V0dGluZ3MuZ2V0TGF5b3V0QWxnb3JpdGhtKCkgPT0gV2ViU2V0dGluZ3MuTGF5b3V0QWxnb3JpdGhtLk5BUlJPV19DT0xVTU5TCisgICAgICAgICAgICAgICAgJiYgd2lsbFNjYWxlVHJpZ2dlclpvb20obVRleHRXcmFwU2NhbGUpCisgICAgICAgICAgICAgICAgLy8gRm9yIHRhYmxldCwgbm90IG11Y2ggbmVlZCB0byByZWZsb3cgdGV4dCB3L28gZG91YmxlIHRhcHBpbmcuCisgICAgICAgICAgICAgICAgJiYgIXNldHRpbmdzLmdldFVzZUZpeGVkVmlld3BvcnQoKSkgeworICAgICAgICAgICAgcmVmcmVzaFpvb21TY2FsZSh0cnVlKTsKKyAgICAgICAgfSBlbHNlIGlmICghbUluWm9vbU92ZXJ2aWV3KSB7CisgICAgICAgICAgICB6b29tVG9PdmVydmlldygpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgem9vbVRvUmVhZGluZ0xldmVsKCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgc2V0Wm9vbU92ZXJ2aWV3V2lkdGgoaW50IHdpZHRoKSB7CisgICAgICAgIG1ab29t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vY2tMZWZ0RWRnZShtQW5jaG9yWCwgbUFuY2hvclksIG1BY3R1YWxTY2FsZSk7CisgICAgICAgIGlmIChsZWZ0ICE9IFdlYlZpZXcuTk9fTEVGVEVER0UpIHsKKyAgICAgICAgICAgIC8vIGFkZCBhIDVwdCBwYWRkaW5nIHRvIHRoZSBsZWZ0IGVkZ2UuCisgICAgICAgICAgICBpbnQgdmlld0xlZnQgPSBtV2ViVmlldy5jb250ZW50VG9WaWV3WChsZWZ0IDwgNSA/IDAgOiAobGVmdCAtIDUpKQorICAgICAgICAgICAgICAgICAgICAtIG1XZWJWaWV3LmdldFNjcm9sbFgoKTsKKyAgICAgICAgICAgIC8vIFJlLWNhbGN1bGF0ZSB0aGUgem9vbSBjZW50ZXIgc28gdGhhdCB0aGUgbmV3IHNjcm9sbCB4IHdpbGwgYmUKKyAgICAgICAgICAgIC8vIG9uIHRoZSBsZWZ0IGVkZ2UuCisgICAgICAgICAgICBpZiAodmlld0xlZnQgPiAwKSB7CisgICAgICAgICAgICAgICAgbVpvb21DZW50ZXJYID0gdmlld0xlZnQgKiByZWFkaW5nU2NhbGUgLyAocmVhZGluZ1NjYWxlIC0gbUFjdHVhbFNjYWxlKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgbVdlYlZpZXcuc2Nyb2xsQnkodmlld0xlZnQsIDApOworICAgICAgICAgICAgICAgIG1ab29tQ2VudGVyWCA9IDA7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgc3RhcnRab29tQW5pbWF0aW9uKHJlYWRpbmdTY2FsZSwgdHJ1ZSk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdXBkYXRlTXVsdGlUb3VjaFN1cHBvcnQoQ29udGV4dCBjb250ZXh0KSB7CisgICAgICAgIC8vIGNoZWNrIHRoZSBwcmVjb25kaXRpb25zCisgICAgICAgIGFzc2VydCBtV2ViVmlldy5nZXRTZXR0aW5ncygpICE9IG51bGw7CisKKyAgICAgIC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LnN0YXJ0Wm9vbSgpOworICAgICAgICAgICAgbVdlYlZpZXcub25QaW5jaFRvWm9vbUFuaW1hdGlvblN0YXJ0KCk7CisgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBib29sZWFuIG9uU2NhbGUoU2NhbGVHZXN0dXJlRGV0ZWN0b3IgZGV0ZWN0b3IpIHsKKyAgICAgICAgICAgIGZsb2F0IHNjYWxlID0gTWF0aC5yb3VuZChkZXRlY3Rvci5nZXRTY2FsZUZhY3RvcigpICogbUFjdHVhbFNjYWxlICogMTAwKSAqIDAuMDFmOworICAgICAgICAgICAgaWYgKHdpbGxTY2FsZVRyaWdnZXJab29tKHNjYWxlKSkgeworICAgICAgICAgICAgICAgIG1QaW5jaFRvWm9vbUFuaW1hdGluZyA9IHRydWU7CisgICAgICAgICAgICAgICAgLy8gbGltaXQgdGhlIHNjYWxlIGNoYW5nZSBwZXIgc3RlcAorICAgICAgICAgICAgICAgIGlmIChzY2FsZSA+IG1BY3R1YWxTY2FsZSkgeworICAgICAgICAgICAgICAgICAgICBzY2FsZSA9IE1hdGgubWluKHNjYWxlLCBtQWN0dWFsU2NhbGUgKiAxLjI1Zik7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgc2NhbGUgPSBNYXRoLm1heChzY2FsZSwgbUFjdHVhbFNjYWxlICogMC44Zik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHNldFpvb21DZW50ZXIoZGV0ZWN0b3IuZ2V0Rm9jdXNYKCksIGRldGVjdG9yLmdldEZvY3VzWSgpKTsKKyAgICAgICAgICAgICAgICBzZXRab29tU2NhbGUoc2NhbGUsIGZhbHNlKTsKKyAgICAgICAgICAgICAgICBtV2ViVmlldy5pbnZhbGlkYXRlKCk7CisgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBvblNjYWxlRW5kKFNjYWxlR2VzdHVyZURldGVjdG9yIGRldGVjdG9yKSB7CisgICAgICAgICAgICBpZiAobVBpbmNoVG9ab29tQW5pbWF0aW5nKSB7CisgICAgICAgICAgICAgICAgbVBpbmNoVG9ab29tQW5pbWF0aW5nID0gZmFsc2U7CisgICAgICAgICAgICAgICAgbUFuY2hvclggPSBtV2ViVmlldy52aWV3VG9Db250ZW50WCgoaW50KSBtWm9vbUNlbnRlclggKyBtV2ViVmlldy5nZXRTY3JvbGxYKCkpOworICAgICAgICAgICAgICAgIG1BbmNob3JZID0gbVdlYlZpZXcudmlld1RvQ29udGVudFkoKGludCkgbVpvb21DZW50ZXJZICsgbVdlYlZpZXcuZ2V0U2Nyb2xsWSgpKTsKKyAgICAgICAgICAgICAgICAvLyBkb24ndCByZWZsb3cgd2hlbiB6b29tIGluOyB3aGVuIHpvb20gb3V0LCBkbyByZWZsb3cgaWYgdGhlCisgICAgICAgICAgICAgICAgLy8gbmV3IHNjYWxlIGlzIGFsbW9zdCBtaW5pbXVtIHNjYWxlOworICAgICAgICAgICAgICAgIGJvb2xlYW4gcmVmbG93Tm93ID0gIWNhblpvb21PdXQoKSB8fCAobUFjdHVhbFNjYWxlIDw9IDAuOCAqIG1UZXh0V3JhcFNjYWxlKTsKKyAgICAgICAgICAgICAgICAvLyBmb3JjZSB6b29tIGFmdGVyIG1QcmV2aWV3Wm9vbU9ubHkgaXMgc2V0IHRvIGZhbHNlIHNvIHRoYXQgdGhlCisgICAgICAgICAgICAgICAgLy8gbmV3IHZpZXcgc2l6ZSB3aWxsIGJlIHBhc3NlZCB0byB0aGUgV2ViS2l0CisgICAgICAgICAgICAgICAgcmVmcmVzaFpvb21TY2FsZShyZWZsb3dOb3cpOworICAgICAgICAgICAgICAgIC8vIGNhbGwgaW52YWxpZGF0ZSgpIHRvIGRyYXcgd2l0aG91dCB6b29tIGZpbHRlcgorICAgICAgICAgICAgICAgIG1XZWJWaWV3LmludmFsaWRhdGUoKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgbVdlYlZpZXcubVZpZXdNYW5hZ2VyLmVuZFpvb20oKTsKKyAgICAgICAgICAgIG1XZWJWaWV3Lm9uUGluY2hUb1pvb21BbmltYXRpb25FbmQoZGV0ZWN0b3IpOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgb25TaXplQ2hhbmdlZChpbnQgdywgaW50IGgsIGludCBvdywgaW50IG9oKSB7CisgICAgICAgIC8vIHJlc2V0IHpvb20gYW5kIGFuY2hvciB0byB0aGUgdG9wIGxlZnQgY29ybmVyIG9mIHRoZSBzY3JlZW4KKyAgICAgICAgLy8gdW5sZXNzIHdlIGFyZSBhbHJlYWR5IHpvb21pbmcKKyAgICAgICAgaWYgKCFpc0ZpeGVkTGVuZ3RoQW5pbWF0aW9uSW5Qcm9ncmVzcygpKSB7CisgICAgICAgICAgICBpbnQgdmlzaWJsZVRpdGxlSGVpZ2h0ID0gbVdlYlZpZXcuZ2V0VmlzaWJsZVRpdGxlSGVpZ2h0KCk7CisgICAgICAgICAgICBtWm9vbUNlbnRlclggPSAwOworICAgICAgICAgICAgbVpvb21DZW50ZXJZID0gdmlzaWJsZVRpdGxlSGVpZ2h0OworICAgICAgICAgICAgbUFuY2hvclggPSBtV2ViVmlldy52aWV3VG9Db250ZW50WChtV2ViVmlldy5nZXRTY3JvbGxYKCkpOworICAgICAgICAgICAgbUFuY2hvclkgPSBtV2ViVmlldy52aWV3VG9Db250ZW50WSh2aXNpYmxlVGl0bGVIZWlnaHQgKyBtV2ViVmlldy5nZXRTY3JvbGxZKCkpOworICAgICAgICB9CisKKyAgICAgICAgLy8gdXBkYXRlIG1NaW5ab29tU2NhbGUgaWYgdGhlIG1pbmltdW0gem9vbSBzY2FsZSBpcyBub3QgZml4ZWQKKyAgICAgICAgaWYgKCFtTWluWm9vbVNjYWxlRml4ZWQpIHsKKyAgICA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FsZSwgZ2V0Wm9vbU92ZXJ2aWV3U2NhbGUoKSksCisgICAgICAgICAgICAgICAgICAgIG1VcGRhdGVUZXh0V3JhcCwgdHJ1ZSk7CisgICAgICAgICAgICAgICAgLy8gdXBkYXRlIHRoZSB6b29tIGJ1dHRvbnMgYXMgdGhlIHNjYWxlIGNhbiBiZSBjaGFuZ2VkCisgICAgICAgICAgICAgICAgdXBkYXRlWm9vbVBpY2tlcigpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdXBkYXRlWm9vbVJhbmdlKFdlYlZpZXdDb3JlLlZpZXdTdGF0ZSB2aWV3U3RhdGUsCisgICAgICAgICAgICBpbnQgdmlld1dpZHRoLCBpbnQgbWluUHJlZldpZHRoKSB7CisgICAgICAgIGlmICh2aWV3U3RhdGUubU1pblNjYWxlID09IDApIHsKKyAgICAgICAgICAgIGlmICh2aWV3U3RhdGUubU1vYmlsZVNpdGUpIHsKKyAgICAgICAgICAgICAgICBpZiAobWluUHJlZldpZHRoID4gTWF0aC5tYXgoMCwgdmlld1dpZHRoKSkgeworICAgICAgICAgICAgICAgICAgICBtTWluWm9vbVNjYWxlID0gKGZsb2F0KSB2aWV3V2lkdGggLyBtaW5QcmVmV2lkdGg7CisgICAgICAgICAgICAgICAgICAgIG1NaW5ab29tU2NhbGVGaXhlZCA9IGZhbHNlOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIG1NaW5ab29tU2NhbGUgPSB2aWV3U3RhdGUubURlZmF1bHRTY2FsZTsKKyAgICAgICAgICAgICAgICAgICAgbU1pblpvb21TY2FsZUZpeGVkID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIG1NaW5ab29tU2NhbGUgPSBtRGVmYXVsdE1pblpvb21TY2FsZTsKKyAgICAgICAgICAgICAgICBtTWluWm9vbVNjYWxlRml4ZWQgPSB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3QgYmVoYXZlCisgICAgICAgICAgICAvLyB3ZWxsLCB0aGUgV2ViVmlldyB3b24ndCBnbyBpbnNhbmUuIGxpbWl0IHRoZSBsb3dlcgorICAgICAgICAgICAgLy8gYm91bmQgdG8gbWF0Y2ggdGhlIGRlZmF1bHQgc2NhbGUgZm9yIG1vYmlsZSBzaXRlcy4KKyAgICAgICAgICAgIHNldFpvb21PdmVydmlld1dpZHRoKE1hdGgubWluKFdlYlZpZXcuc01heFZpZXdwb3J0V2lkdGgsCisgICAgICAgICAgICAgICAgICAgIE1hdGgubWF4KChpbnQpICh2aWV3V2lkdGggKiBtSW52RGVmYXVsdFNjYWxlKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBNYXRoLm1heChkcmF3RGF0YS5tTWluUHJlZldpZHRoLCBkcmF3RGF0YS5tVmlld1BvaW50LngpKSkpOworICAgICAgICB9CisKKyAgICAgICAgZmluYWwgZmxvYXQgem9vbU92ZXJ2aWV3U2NhbGUgPSBnZXRab29tT3ZlcnZpZXdTY2FsZSgpOworICAgICAgICBpZiAoIW1NaW5ab29tU2NhbGVGaXhlZCkgeworICAgICAgICAgICAgbU1pblpvb21TY2FsZSA9IHpvb21PdmVydmlld1NjYWxlOworICAgICAgICB9CisgICAgICAgIC8vIGZpdCB0aGUgY29udGVudCB3aWR0aCB0byB0aGUgY3VycmVudCB2aWV3LiBJZ25vcmUgdGhlIHJvdW5kaW5nIGVycm9yIGNhc2UuCisgICAgICAgIGlmICghbVdlYlZpZXcuZHJhd0hpc3RvcnkoKSAmJiAobUluaXRpYWxab29tT3ZlcnZpZXcgfHwgKG1Jblpvb21PdmVydmlldworICAgICAgICAgICAgICAgICYmIE1hdGguYWJzKCh2aWV3V2lkdGggKiBtSW52QWN0dWFsU2NhbGUpIC0gbVpvb21PdmVydmlld1dpZHRoKSA+IDEpKSkgeworICAgICAgICAgICAgbUluaXRpYWxab29tT3ZlcnZpZXcgPSBmYWxzZTsKKyAgICAgICAgICAgIHNldFpvb21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yAgICAgICAgdXBkYXRlWm9vbVJhbmdlKHZpZXdTdGF0ZSwgdmlld1NpemUueCwgZHJhd0RhdGEubU1pblByZWZXaWR0aCk7CisKKyAgICAgICAgaWYgKCFtV2ViVmlldy5kcmF3SGlzdG9yeSgpKSB7CisgICAgICAgICAgICBmaW5hbCBmbG9hdCBzY2FsZTsKKyAgICAgICAgICAgIGZpbmFsIGJvb2xlYW4gcmVmbG93VGV4dDsKKworICAgICAgICAgICAgaWYgKG1Jbml0aWFsU2NhbGUgPiAwKSB7CisgICAgICAgICAgICAgICAgc2NhbGUgPSBtSW5pdGlhbFNjYWxlOworICAgICAgICAgICAgICAgIHJlZmxvd1RleHQgPSBleGNlZWRzTWluU2NhbGVJbmNyZW1lbnQobVRleHRXcmFwU2NhbGUsIHNjYWxlKTsKKyAgICAgICAgICAgIH0gZWxzZSBpZiAodmlld1N0YXRlLm1WaWV3U2NhbGUgPiAwKSB7CisgICAgICAgICAgICAgICAgbVRleHRXcmFwU2NhbGUgPSB2aWV3U3RhdGUubVRleHRXcmFwU2NhbGU7CisgICAgICAgICAgICAgICAgc2NhbGUgPSB2aWV3U3RhdGUubVZpZXdTY2FsZTsKKyAgICAgICAgICAgICAgICByZWZsb3dUZXh0ID0gZmFsc2U7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIFdlYlNldHRpbmdzIHNldHRpbmdzID0gbVdlYlZpZXcuZ2V0U2V0dGluZ3MoKTsKKyAgICAgICAgICAgICAgICBpZiAoc2V0dGluZ3MuZ2V0VXNlV2lkZVZpZXdQb3J0KCkKKyAgICAgICAgICAgICAgICAgICAgJiYgKHNldHRpbmdzLmdldExvYWRXaXRoT3ZlcnZpZXdNb2RlKCkgfHwgc2V0dGluZ3MuZ2V0VXNlRml4ZWRWaWV3cG9ydCgpKSkgeworICAgICAgICAgICAgICAgICAgICBtSW5pdGlhbFpvb21PdmVydmlldyA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgIHNjYWxlID0gKG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bAorICAgICAgICAvLyBiZSBzZXQgY29ycmVjdGx5CisgICAgICAgIG1BY3R1YWxTY2FsZSA9IGIuZ2V0RmxvYXQoInNjYWxlIiwgMS4wZik7CisgICAgICAgIG1JbnZBY3R1YWxTY2FsZSA9IDEgLyBtQWN0dWFsU2NhbGU7CisgICAgICAgIG1UZXh0V3JhcFNjYWxlID0gYi5nZXRGbG9hdCgidGV4dHdyYXBTY2FsZSIsIG1BY3R1YWxTY2FsZSk7CisgICAgICAgIG1Jblpvb21PdmVydmlldyA9IGIuZ2V0Qm9vbGVhbigib3ZlcnZpZXciKTsKKyAgICB9CisKKyAgICBwcml2YXRlIFpvb21Db250cm9sQmFzZSBnZXRDdXJyZW50Wm9vbUNvbnRyb2woKSB7CisgICAgICAgIGlmIChtV2ViVmlldy5nZXRTZXR0aW5ncygpICE9IG51bGwgJiYgbVdlYlZpZXcuZ2V0U2V0dGluZ3MoKS5zdXBwb3J0Wm9vbSgpKSB7CisgICAgICAgICAgICBpZiAobVdlYlZpZXcuZ2V0U2V0dGluZ3MoKS5nZXRCdWlsdEluWm9vbUNvbnRyb2xzKCkpIHsKKyAgICAgICAgICAgICAgICBpZiAoKG1FbWJlZGRlZFpvb21Db250cm9sID09IG51bGwpCisgICAgICAgICAgICAgICAgICAgICAgICAmJiBtV2ViVmlldy5nZXRTZXR0aW5ncygpLmdldERpc3BsYXlab29tQ29udHJvbHMoKSkgeworICAgICAgICAgICAgICAgICAgICBtRW1iZWRkZWRab29tQ29udHJvbCA9IG5ldyBab29tQ29udHJvbEVtYmVkZGVkKHRoaXMsIG1XZWJWaWV3KTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcmV0dXJuIG1FbWJlZGRlZFpvb21Db250cm9sOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBpZiAobUV4dGVybmFsWm9vbUNvbnRyb2wgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBtRXh0ZXJuYWxab29tQ29udHJvbCA9IG5ldyBab29tQ29udHJvbEV4dGVybmFsKG1XZWJWaWV3KTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcmV0dXJuIG1FeHRlcm5hbFpvb21Db250cm9sOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiBudWxsOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGludm9rZVpvb21QaWNrZXIoKSB7CisgICAgICAgIFpvb21Db250cm9sQmFzZSBjb250cm9sID0gZ2V0Q3VycmVudFpvb21Db250cm9sKCk7CisgICAgICAgIGlmIChjb250cm9sICE9IG51bGwpIHsKKyAgICAgICAgICAgIGNvbnRyb2wuc2hvdygpOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgZGlzbWlzc1pvb21QaWNrZXIoKSB7CisgICAgICAgIFpvb21Db250cm9sQmFzZSBjb250cm9sID0gZ2V0Q3VycmVudFpvb21Db250cm9sKCk7CisgICAgICAgIGlmIChjb250cm9sICE9IG51bGwpIHsKKyAgICAgICAgICAgIGNvbnRyb2wuaGlkZSgpOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gaXNab29tUGlja2VyVmlzaWJsZSgpIHsKKyAgICAgICAgWm9vbUNvbnRyb2xCYXNlIGNvbnRyb2wgPSBnZXRDdXJyZW50Wm9vbUNvbnRyb2woKTsKKyAgICAgICAgcmV0dXJuIChjb250cm9sICE9IG51bGwpID8gY29udHJvbC5pc1Zpc2libGUoKSA6IGZhbHNlOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHVwZGF0ZVpvb21QaWNrZXIoKSB7CisgICAgICAgIFpvb21Db250cm9sQmFzZSBjb250cm9sID0gZ2V0Q3VycmVudFpvb21Db250cm9sKCk7CisgICAgICAgIGlmIChjb250cm9sICE9IG51bGwpIHsKKyAgICAgICAgICAgIGNvbnRyb2wudXBkYXRlKCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBUaGUgZW1iZWRkZWQgem9vbSBjb250cm9sIGludGVyY2VwdHMgdG91Y2ggZXZlbnRzIGFuZCBhdXRvbWF0aWNhbGx5IHN0YXlzCisgICAgICogdmlzaWJsZS4gVGhlIGV4dGVybmFsIGNvbnRyb2wgbmVlZHMgdG8gY29uc3RhbnRseSByZWZyZXNoIGl0cyBpbnRlcm5hbAorICAgICAqIHRpbWVyIHRvIHN0YXkgdmlzaWJsZS4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBrZWVwWm9vbVBpY2tlclZpc2libGUoKSB7CisgICAgICAgIFpvb21Db250cm9sQmFzZSBjb250cm9sID0gZ2V0Q3VycmVudFpvb21Db250cm9sKCk7CisgICAgICAgIGlmIChjb250cm9sICE9IG51bGwgJiYgY29udHJvbCA9PSBtRXh0ZXJuYWxab29tQ29udHJvbCkgeworICAgICAgICAgICAgY29udHJvbC5zaG93KCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgVmlldyBnZXRFeHRlcm5hbFpvb21QaWNrZXIoKSB7CisgICAgICAgIFpvb21Db250cm9sQmFzZSBjb250cm9sID0gZ2V0Q3VycmVudFpvb21Db250cm9sKCk7CisgICAgICAgIGlmIChjb250cm9sICE9IG51bGwgJiYgY29udHJvbCA9PSBtRXh0ZXJuYWxab29tQ29udHJvbCkgeworICAgICAgICAgICAgcmV0dXJuIG1FeHRlcm5hbFpvb21Db250cm9sLmdldENvbnRyb2xzKCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgfQorICAgIH0KK30KZGlmZiAtLWdpdCBhL2NvcmUvamF2YS9hbmRyb2lkL3dlYnJ1bnRpbWUvV2ViUnVudGltZUFjdGl2aXR5LmphdmEgYi9jb3JlL2phdmEvYW5kcm9pZC93ZWJydW50aW1lL1dlYlJ1bnRpbWVBY3Rpdml0eS5qYXZhCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4I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0eUluZm8ubWV0YURhdGE7CisgICAgICAgIGlmIChtZXRhRGF0YSA9PSBudWxsKSB7CisgICAgICAgICAgICBMb2cuZChMT0dUQUcsICJObyBtZXRhIGRhdGEiKTsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorCisgICAgICAgIFN0cmluZyB1cmwgPSBtZXRhRGF0YS5nZXRTdHJpbmcoImFuZHJvaWQud2VicnVudGltZS51cmwiKTsKKyAgICAgICAgaWYgKHVybCA9PSBudWxsKSB7CisgICAgICAgICAgICBMb2cuZChMT0dUQUcsICJObyBVUkwiKTsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorCisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBtQmFzZVVybCA9IG5ldyBVUkwodXJsKTsKKyAgICAgICAgfSBjYXRjaCAoTWFsZm9ybWVkVVJMRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIExvZy5kKExPR1RBRywgIkludmFsaWQgVVJMIik7CisgICAgICAgIH0KKworICAgICAgICAvLyBBbGwgZmFsc2UgYnkgZGVmYXVsdCwgYW5kIHJlYWRpbmcgbm9uLWV4aXN0ZW50IGJ1bmRsZSBwcm9wZXJ0aWVzIGdpdmVzIGZhbHNlIHRvby4KKyAgICAgICAgZmluYWwgU2Vuc2l0aXZlRmVhdHVyZXMgc2Vuc2l0aXZlRmVhdHVyZXMgPSBuZXcgU2Vuc2l0aXZlRmVhdHVyZXMoKTsKKyAgICAgICAgc2Vuc2l0aXZlRmVhdHVyZXMuc2V0R2VvbG9jYXRpb24obWV0YURhdGEuZ2V0Qm9vbGVhbigiYW5kcm9pZC53ZWJydW50aW1lLlNlbnNpdGl2ZUZlYXR1cmVzR2VvbG9jYXRpb24iKSk7CisKKyAgICAgICAgZ2V0V2luZG93KCkucmVxdWVzdEZlYXR1cmUoV2luZG93LkZFQVRVUkVfTk9fVElUTEUpOworICAgICAgICBzZXRDb250ZW50VmlldyhSLmxheW91dC53ZWJfcnVudGltZSk7CisgICAgICAgIG1XZWJWaWV3ID0gKFdlYlZpZXcpIGZpbmRWaWV3QnlJZChSLmlkLndlYnZpZXcpOworICAgICAgICBtU3BsYXNoU2NyZWVuID0gKEltYWdlVmlldykgZmluZFZpZXdCeUlkKFIuaWQuc3BsYXNoc2NyZWVuKTsKKyAgICAgICAgbVNwbGFzaFNjcmVlbi5zZXRJbWFnZVJlc291cmNlKAorICAgICAgICAgICAgICAgIGdldFJlc291cmNlcygpLmdldElkZW50aWZpZXIoInNwbGFzaF9zY3JlZW4iLCAiZHJhd2FibGUiLCBnZXRQYWNrYWdlTmFtZSgpKSk7CisgICAgICAgIG1XZWJWaWV3LmdldFNldHRpbmdzKCkuc2V0SmF2YVNjcmlwdEVuYWJsZWQodHJ1ZSk7CisgICAgICAgIG1XZWJWaWV3LnNldFdlYlZpZXdDbGllbnQobmV3IFdlYlZpZXdDbGllbnQoKSB7CisgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgIHB1YmxpYyBib29sZWFuIHNob3VsZE92ZXJyaWRlVXJsTG9hZGluZyhXZWJWaWV3IHZpZXcsIFN0cmluZyB1cmwpIHsKKyAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICBVUkwgbmV3T3JpZ2luID0gbmV3IFVSTCh1cmwpOworICAgICAgICAgICAgICAgICAgICBpZiAoYXJlU2FtZU9yaWdpbihtQmFzZVVybCwgbmV3T3JpZ2luKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgLy8gSWYgc2ltcGxlIHNhbWUgb3JpZ2luIHRlc3QgcGFzc2VzLCBsb2FkIGluIHRoZSB3ZWJ2aWV3LgorICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfSBjYXRjaChNYWxmb3JtZWRVUkxFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICAvLyBEb24ndCBsb2FkIGFueXRoaW5nIGlmIHRoaXMgd2Fzbid0IGEgcHJvcGVyIFVSTC4KKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgLy8gT3RoZXJ3aXNlIHRoaXMgaXMgYSBVUkwgdGhhdCBpcyBub3Qgc2FtZSBvcmlnaW4gc28gcGFzcyBpdCB0byB0aGUKKyAgICAgICAgICAgICAgICAvLyBCcm93c2VyIHRvIGxvYWQuCisgICAgICAgICAgICAgICAgc3RhcnRBY3Rpdml0eShuZXcgSW50ZW50KEludGVudC5BQ1RJT05fVklFVywgVXJpLnBhcnNlKHVybCkpKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgQE92ZXJyaWRlCisgICAgICAgICAgICBwdWJsaWMgdm9pZCBvblBhZ2VGaW5pc2hlZChXZWJWaWV3IHZpZXcsIFN0cmluZyB1cmwpIHsKKyAgICAgICAgICAgICAgICBpZiAobVNwbGFzaFNjcmVlbiAhPSBudWxsICYmIG1TcGxhc2hTY3JlZW4uZ2V0VmlzaWJpbGl0eSgpID09IFZpZXcuVklTSUJMRSkgeworICAgICAgICAgICAgICAgICAgICBtU3BsYXNoU2NyZWVuLnNldFZpc2liaWxpdHkoVmlldy5HT05FKTsKKyAgICAgICAgICAgICAgICAgICAgbVNwbGFzaFNjcmVlbiA9IG51bGw7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9KTsKKworICAgICAgICAvLyBVc2UgYSBjdXN0b20gV2ViQ2hyb21lQ2xpZW50IHdpdGggZ2VvbG9jYXRpb24gcGVybWlzc2lvbnMgaGFuZGxpbmcuCisgICAgICAgIG1XZWJWaWV3LnNldFdlYkNocm9tZUNsaWVudChuZXcgV2ViQ2hyb21lQ2xpZW50KCkgeworICAgICAgICAgICAgcHVibGljIHZvaWQgb25HZW9sb2NhdGlvblBlcm1pc3Npb25zU2hvd1Byb21wdCgKKyAgICAgICAgICAgICAgICAgICAgICAgIFN0cmluZyBvcmlnaW4sIEdlb2xvY2F0aW9uUGVybWlzc2lvbnMuQ2FsbGJhY2sgY2FsbGJhY2spIHsKKyAgICAgICAgICAgICAgICAvLyBBbGxvdyB0aGlzIG9yaWdpbiBpZiBpdCBoYXMgR2VvbG9jYXRpb24gcGVybWlzc2lvbnMsIG90aGVyd2lzZSBkZW55LgorICAgICAgICAgICAgICAgIGJvb2xlYW4gYWxsb3dlZCA9IGZhbHNlOworICAgICAgICAgICAgICAgIGlmIChzZW5zaXRpdmVGZWF0dXJlcy5nZXRHZW9sb2NhdGlvbigpKSB7CisgICAgICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgICAgICBVUkwgb3JpZ2luVXJsID0gbmV3IFVSTChvcmlnaW4pOworICAgICAgICAgICAgICAgICAgICAgICAgYWxsb3dlZCA9IGFyZVNhbWVPcmlnaW4obUJhc2VVcmwsIG9yaWdpblVybCk7CisgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2goTWFsZm9ybWVkVVJMRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBjYWxsYmFjay5pbnZva2Uob3JpZ2luLCBhbGxvd2VkLCBmYWxzZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0pOworCisgICAgICAgIC8vIFNldCB0aGUgREIgbG9jYXRpb24uIE9wdGlvbmFsLiBHZW9sb2NhdGlvbiB3b3JrcyB3aXRob3V0IERCcy4KKyAgICAgICAgbVdlYlZpZXcuZ2V0U2V0dGluZ3MoKS5zZXRHZW9sb2NhdGlvbkRhdGFiYXNlUGF0aCgKKyAgICAgICAgICAgICAgICBnZXREaXIoImdlb2xvY2F0aW9uIiwgTU9ERV9QUklWQVRFKS5nZXRQYXRoKCkpOworCisgICAgICAgIFN0cmluZyB0aXRsZSA9IG1ldGFEYXRhLmdldFN0cmluZygiYW5kcm9pZC53ZWJydW50aW1lLnRpdGxlIik7CisgICAgICAgIC8vIFdlIHR1cm5lZCBvZmYgdGhlIHRpdGxlIGJhciB0byBnbyBmdWxsIHNjcmVlbiBzbyBkaXNwbGF5IHRoZQorICAgICAgICAvLyB3ZWJhcHAncyB0aXRsZSBhcyBhIHRvYXN0LgorICAgICAgICBpZiAodGl0bGUgIT0gbnVsbCkgeworICAgICAgICAgICAgVG9hc3QubWFrZVRleHQodGhpcywgdGl0bGUsIFRvYXN0LkxFTkdUSF9TSE9SVCkuc2hvdygpOworICAgICAgICB9CisKKyAgICAgICAgLy8gTG9hZCB0aGUgd2ViYXBwJ3MgYmFzZSBVUkwuCisgICAgICAgIG1XZWJWaWV3LmxvYWRVcmwodXJsKTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgYm9vbGVhbiBvbktleURvd24oaW50IGtleUNvZGUsIEtleUV2ZW50IGV2ZW50KSB7CisgICAgICAgIGlmIChrZXlDb2RlID09IEtleUV2ZW50LktFWUNPREVfQkFDSyAmJiBtV2ViVmlldy5jYW5Hb0JhY2soKSkgeworICAgICAgICAgICAgbVdlYlZpZXcuZ29CYWNrKCk7CisgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gc3VwZXIub25LZXlEb3duKGtleUNvZGUsIGV2ZW50KTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgYm9vbGVhbiBvbkNyZWF0ZU9wdGlvbnNNZW51KE1lbnUgbWVudSkgeworICAgICAgICBtZW51LmFkZCgwLCAwLCAwLCAiTWVudSBpdGVtIDEiKTsKKyAgICAgICAgbWVudS5hZGQoMCwgMSwgMCwgIk1lbnUgaXRlbSAyIik7CisgICAgICAgIHJldHVybiB0cnVlOworICAgIH0KKworICAgIHByaXZhdGUgc3RhdGljIGJvb2xlYW4gYXJlU2FtZU9yaWdpbihVUkwgYSwgVV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SBsYXN0IHBvc2l0aW9uIGluIHRoZSBhZGFwdGVyLCBiYXNlZCBvbiB0aGUgbGFzdCB0aW1lCi0gICAgICogd2Ugc2F3IGl0LiBVc2VkIHRvIGhpbnQgd2hlcmUgdG8gZHJhdyBlZGdlIGdsb3dzLgotICAgICAqLwotICAgIHByaXZhdGUgaW50IG1MYXN0UG9zaXRpb25EaXN0YW5jZUd1ZXNzOwotCi0gICAgLyoqCiAgICAgICogSW50ZXJmYWNlIGRlZmluaXRpb24gZm9yIGEgY2FsbGJhY2sgdG8gYmUgaW52b2tlZCB3aGVuIHRoZSBsaXN0IG9yIGdyaWQKICAgICAgKiBoYXMgYmVlbiBzY3JvbGxlZC4KICAgICAgKi8KQEAgLTYxOSw2ICs2MjQsMTggQEAKIAogICAgICAgICBib29sZWFuIHNtb290aFNjcm9sbGJhciA9IGEuZ2V0Qm9vbGVhbihSLnN0eWxlYWJsZS5BYnNMaXN0Vmlld19zbW9vdGhTY3JvbGxiYXIsIHRydWUpOwogICAgICAgICBzZXRTbW9vdGhTY3JvbGxiYXJFbmFibGVkKHNtb290aFNjcm9sbGJhcik7CisgICAgICAgIAorICAgICAgICBmaW5hbCBpbnQgYWRhcHRlcklkID0gYS5nZXRSZXNvdXJjZUlkKFIuc3R5bGVhYmxlLkFic0xpc3RWaWV3X2FkYXB0ZXIsIDApOworICAgICAgICBpZiAoYWRhcHRlcklkICE9IDApIHsKKyAgICAgICAgICAgIGZpbmFsIENvbnRleHQgYyA9IGNvbnRleHQ7CisgICAgICAgICAgICBwb3N0KG5ldyBSdW5uYWJsZSgpIHsKKyAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgICAgICAgICAgICAgIHNldEFkYXB0ZXIoQWRhcHRlcnMubG9hZEFkYXB0ZXIoYywgYWRhcHRlcklkKSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSk7CisgICAgICAgIH0KKworICAgICAgICBzZXRDaG9pY2VNb2RlKGEu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PSBudWxsKSB7CisgICAgICAgICAgICBtQ2hlY2tlZElkU3RhdGVzLmNsZWFyKCk7CisgICAgICAgIH0KICAgICB9CiAKICAgICAvKioKLSAgICAgKiBAcmV0dXJuIHRydWUgaWYgYWxsIGxpc3QgY29udGVudCBjdXJyZW50bHkgZml0cyB3aXRoaW4gdGhlIHZpZXcgYm91bmRhcmllcworICAgICAqIFJldHVybnMgdGhlIG51bWJlciBvZiBpdGVtcyBjdXJyZW50bHkgc2VsZWN0ZWQuIFRoaXMgd2lsbCBvbmx5IGJlIHZhbGlkCisgICAgICogaWYgdGhlIGNob2ljZSBtb2RlIGlzIG5vdCB7QGxpbmsgI0NIT0lDRV9NT0RFX05PTkV9IChkZWZhdWx0KS4KKyAgICAgKgorICAgICAqIDxwPlRvIGRldGVybWluZSB0aGUgc3BlY2lmaWMgaXRlbXMgdGhhdCBhcmUgY3VycmVudGx5IHNlbGVjdGVkLCB1c2Ugb25lIG9mCisgICAgICogdGhlIDxjb2RlPmdldENoZWNrZWQqPC9jb2RlPiBtZXRob2RzLgorICAgICAqCisgICAgICogQHJldHVybiBUaGUgbnVtYmVyIG9mIGl0ZW1zIGN1cnJlbnRseSBzZWxlY3RlZAorICAgICAqCisgICAgICogQHNlZSAjZ2V0Q2hlY2tlZEl0ZW1Qb3NpdGlvbigpCisgICAgICogQHNlZSAjZ2V0Q2hlY2tlZEl0ZW1Qb3NpdGlvbnMoKQorICAgICAqIEBzZWUgI2dldENoZWNrZWRJdGVtSWRzKCkKICAgICAgKi8KLSAgICBwcml2YXRlIGJvb2xlYW4gY29udGVudEZpdHMoKSB7Ci0gICAgICAgIGZpbmFsIGludCBjaGlsZENvdW50ID0gZ2V0Q2hpbGRDb3VudCgpOwotICAgICAgICBpZiAoY2hpbGRDb3VudCAhPSBtSXRlbUNvdW50KSB7Ci0gICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgcHVibGljIGludCBnZXRDaGVja2VkSXRlbUNvdW50KCkgeworICAgICAgICByZXR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CisgICAgICAgIH0KKworICAgICAgICBmaW5hbCBMb25nU3BhcnNlQXJyYXk8Qm9vbGVhbj4gaWRTdGF0ZXMgPSBtQ2hlY2tlZElkU3RhdGVzOworICAgICAgICBmaW5hbCBpbnQgY291bnQgPSBpZFN0YXRlcy5zaXplKCk7CisgICAgICAgIGZpbmFsIGxvbmdbXSBpZHMgPSBuZXcgbG9uZ1tjb3VudF07CisKKyAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBjb3VudDsgaSsrKSB7CisgICAgICAgICAgICBpZHNbaV0gPSBpZFN0YXRlcy5rZXlBdChpKTsKKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiBpZHM7CisgICAgfQorCisgICAgLyoqCisgICAgICogQ2xlYXIgYW55IGNob2ljZXMgcHJldmlvdXNseSBzZXQKKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBjbGVhckNob2ljZXMoKSB7CisgICAgICAgIGlmIChtQ2hlY2tTdGF0ZXMgIT0gbnVsbCkgeworICAgICAgICAgICAgbUNoZWNrU3RhdGVzLmNsZWFyKCk7CisgICAgICAgIH0KKyAgICAgICAgaWYgKG1DaGVja2VkSWRTdGF0ZXMgIT0gbnVsbCkgeworICAgICAgICAgICAgbUNoZWNrZWRJZFN0YXRlcy5jbGVhcigpOworICAgICAgICB9CisgICAgICAgIG1DaGVja2VkSXRlbUNvdW50ID0gMDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBTZXRzIHRoZSBjaGVja2VkIHN0YXRlIG9mIHRoZSBzcGVjaWZpZWQgcG9zaXRpb24uIFRoZSBpcyBvbmx5IHZhbGlkIGlmCisgICAgICogdGhlIGNob2ljZSBtb2RlIGhhcyBiZWVuIHNldCB0byB7QGxpbmsgI0NIT0lDRV9NT0RFX1NJTkdMRX0gb3IKKyAgICAgKiB7QGxpbmsgI0NIT0lDRV9NT0RFX01VTFRJUExFfS4KKyAgICAgKgorICAgICAqIEBwYXJhbSBwb3NpdGlvbiBUaGUgaXRlb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AgICAgICAgICAgICAgICAgICBtQ2hlY2tlZElkU3RhdGVzLnB1dChtQWRhcHRlci5nZXRJdGVtSWQocG9zaXRpb24pLCBCb29sZWFuLlRSVUUpOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIG1DaGVja2VkSWRTdGF0ZXMuZGVsZXRlKG1BZGFwdGVyLmdldEl0ZW1JZChwb3NpdGlvbikpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChvbGRWYWx1ZSAhPSB2YWx1ZSkgeworICAgICAgICAgICAgICAgIGlmICh2YWx1ZSkgeworICAgICAgICAgICAgICAgICAgICBtQ2hlY2tlZEl0ZW1Db3VudCsrOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIG1DaGVja2VkSXRlbUNvdW50LS07CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKG1DaG9pY2VBY3Rpb25Nb2RlICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBmaW5hbCBsb25nIGlkID0gbUFkYXB0ZXIuZ2V0SXRlbUlkKHBvc2l0aW9uKTsKKyAgICAgICAgICAgICAgICBtTXVsdGlDaG9pY2VNb2RlQ2FsbGJhY2sub25JdGVtQ2hlY2tlZFN0YXRlQ2hhbmdlZChtQ2hvaWNlQWN0aW9uTW9kZSwKKyAgICAgICAgICAgICAgICAgICAgICAgIHBvc2l0aW9uLCBpZCwgdmFsdWUpOworICAgICAgICAgICAgfQorICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgYm9vbGVhbiB1cGRhdGVJZHMgPSBtQ2hlY2tlZElkU3RhdGVzICE9IG51bGwgJiYgbUFkYXB0ZXIuaGFzU3RhYmxlSWRzKCk7CisgICAgICAgICAgICAvLyBDbGVhciBhbGwgdmFsdWVzIGlmIHdlJ3JlIGNoZWNraW5nIHNvbWV0aGluZywgb3IgdW5jaGVja2luZyB0aGUgY3VycmVudGx5CisgICAgICAgICAgICAvLyBzZWxlY3RlZCBpdGVtCisgICAgICAgICAgICBpZiAodmFsdWUgfHwgaXNJdGVtQ2hlY2tlZChwb3NpdGlvbikpIHsKKyAgICAgICAgICAgICAgICBtQ2hlY2tTdGF0ZXMuY2xlYXIoKTsKKyAgICAgICAgICAgICAgICBpZiAodXBkYXRlSWRzKSB7CisgICAgICAgICAgICAgICAgICAgIG1DaGVja2VkSWRTdGF0ZXMuY2xlYXIoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICAvLyB0aGlzIG1heSBlbmQgdXAgc2VsZWN0aW5nIHRoZSB2YWx1ZSB3ZSBqdXN0IGNsZWFyZWQgYnV0IHRoaXMgd2F5CisgICAgICAgICAgICAvLyB3ZSBlbnN1cmUgbGVuZ3RoIG9mIG1DaGVja1N0YXRlcyBpcyAxLCBhIGZhY3QgZ2V0Q2hlY2tlZEl0ZW1Qb3NpdGlvbiByZWxpZXMgb24KKyAgICAgICAgICAgIGlmICh2YWx1ZSkgeworICAgICAgICAgICAgICAgIG1DaGVja1N0YXRlcy5wdXQocG9zaXRpb24sIHRydWUpOworICAgICAgICAgICAgICAgIGlmICh1cGRhdGVJZHMpIHsKKyAgICAgICAgICAgICAgICAgICAgbUNoZWNrZWRJZFN0YXRlcy5wdXQobUFkYXB0ZXIuZ2V0SXRlbUlkKHBvc2l0aW9uKSwgQm9vbGVhbi5UUlVFKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgbUNoZWNrZWRJdGVtQ291bnQgPSAxOworICAgICAgICAgICAgfSBlbHNlIGlmIChtQ2hlY2tTdGF0ZXMuc2l6ZSgpID09IDAgfHwgIW1DaGVja1N0YXRlcy52YWx1ZUF0KDApKSB7CisgICAgICAgICAgICAgICAgbUNoZWNrZWRJdGVtQ291bnQgPSAwOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgLy8gRG8gbm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AgICAgICBtQ2hlY2tlZElkU3RhdGVzLnB1dChtQWRhcHRlci5nZXRJdGVtSWQocG9zaXRpb24pLCBCb29sZWFuLlRSVUUpOworICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgbUNoZWNrZWRJZFN0YXRlcy5kZWxldGUobUFkYXB0ZXIuZ2V0SXRlbUlkKHBvc2l0aW9uKSk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKG5ld1ZhbHVlKSB7CisgICAgICAgICAgICAgICAgICAgIG1DaGVja2VkSXRlbUNvdW50Kys7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgbUNoZWNrZWRJdGVtQ291bnQtLTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKG1DaG9pY2VBY3Rpb25Nb2RlICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgbU11bHRpQ2hvaWNlTW9kZUNhbGxiYWNrLm9uSXRlbUNoZWNrZWRTdGF0ZUNoYW5nZWQobUNob2ljZUFjdGlvbk1vZGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcG9zaXRpb24sIGlkLCBuZXdWYWx1ZSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSBlbHNlIGlmIChtQ2hvaWNlTW9kZSA9PSBDSE9JQ0VfTU9ERV9TSU5HTEUpIHsKKyAgICAgICAgICAgICAgICBib29sZWFuIG5ld1ZhbHVlID0gIW1DaGVja1N0YXRlcy5nZXQocG9zaXRpb24sIGZhbHNlKTsKKyAgICAgICAgICAgICAgICBpZiAobmV3VmFsdWUpIHsKKyAgICAgICAgICAgICAgICAgICAgbUNoZWNrU3RhdGVzLmNsZWFyKCk7CisgICAgICAgICAgICAgICAgICAgIG1DaGVja1N0YXRlcy5wdXQocG9zaXRpb24sIHRydWUpOworICAgICAgICAgICAgICAgICAgICBpZiAobUNoZWNrZWRJZFN0YXRlcyAhPSBudWxsICYmIG1BZGFwdGVyLmhhc1N0YWJsZUlkcygpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtQ2hlY2tlZElkU3RhdGVzLmNsZWFyKCk7CisgICAgICAgICAgICAgICAgICAgICAgICBtQ2hlY2tlZElkU3RhdGVzLnB1dChtQWRhcHRlci5nZXRJdGVtSWQocG9zaXRpb24pLCBCb29sZWFuLlRSVUUpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIG1DaGVja2VkSXRlbUNvdW50ID0gMTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKG1DaGVja1N0YXRlcy5zaXplKCkgPT0gMCB8fCAhbUNoZWNrU3RhdGVzLnZhbHVlQXQoMCkpIHsKKyAgICAgICAgICAgICAgICAgICAgbUNoZWNrZWRJdGVtQ291bnQgPSAwOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgbURhdGFDaGFuZ2VkID0gdHJ1ZTsKKyAgICAgICAgICAgIHJlbWVtYmVyU3luY1N0YXRlKCk7CisgICAgICAgICAgICByZXF1ZXN0TGF5b3V0KCk7CisgICAgICAgIH0KKworICAgICAgICBoYW5kbGVkIHw9IHN1cGVyLnBlcmZvcm1JdGVtQ2xpY2sodmlldywgcG9zaXRpb24sIGlkKTsKKworICAgICAgICByZXR1cm4gaGFuZGxlZDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBAc2VlICNzZXRDaG9pY2VNb2RlKGludCkKKyAgICAgKgorICAgICAqIEByZXR1cm4gVGhlIGN1cnJlbnQgY2hvaWNlIG1vZGUKKyAgICAgKi8KKyAgICBwdWJsaWMgaW50IGdldENob2ljZU1vZGUoKSB7CisgICAgICAgIHJldHVybiBtQ2hvaWNlTW9kZTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBEZWZpbmVzIHRoZSBjaG9pY2UgYmVoYXZp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AgICAgICAgICAgIGNoZWNrSWRTdGF0ZSA9IG5ldyBMb25nU3BhcnNlQXJyYXk8Qm9vbGVhbj4oKTsKKyAgICAgICAgICAgICAgICBjaGVja0lkU3RhdGUuc2V0VmFsdWVzKGlkU3RhdGUsIEJvb2xlYW4uVFJVRSk7CisgICAgICAgICAgICB9CiAgICAgICAgIH0KIAogICAgICAgICBAT3ZlcnJpZGUKQEAgLTkxOCw2ICsxMjE3LDggQEAKICAgICAgICAgICAgIG91dC53cml0ZUludChwb3NpdGlvbik7CiAgICAgICAgICAgICBvdXQud3JpdGVJbnQoaGVpZ2h0KTsKICAgICAgICAgICAgIG91dC53cml0ZVN0cmluZyhmaWx0ZXIpOworICAgICAgICAgICAgb3V0LndyaXRlU3BhcnNlQm9vbGVhbkFycmF5KGNoZWNrU3RhdGUpOworICAgICAgICAgICAgb3V0LndyaXRlTG9uZ0FycmF5KGNoZWNrSWRTdGF0ZSAhPSBudWxsID8gY2hlY2tJZFN0YXRlLmdldEtleXMoKSA6IG5ldyBsb25nWzBdKTsKICAgICAgICAgfQogCiAgICAgICAgIEBPdmVycmlkZQpAQCAtOTI5LDcgKzEyMzAsOCBAQAogICAgICAgICAgICAgICAgICAgICArICIgdmlld1RvcD0iICsgdmlld1RvcAogICAgICAgICAgICAgICAgICAgICArICIgcG9zaXRpb249IiArIHBvc2l0aW9uCiAgICAgICAgICAgICAgICAgICAgICsgIiBoZWlnaHQ9IiArIGhlaWdodAotICAgICAgICAgICAgICAgICAgICArICIgZmlsdGVyPSIgKyBmaWx0ZXIgKyAifSI7CisgICAgICAgICAgICAgICAgICAgICsgIiBmaWx0ZXI9IiArIGZpbHRlcgorICAgICAgICAgICAgICAgICAgICArICIgY2hlY2tTdGF0ZT0iICsgY2hlY2tTdGF0ZSArICJ9IjsKICAgICAgICAgfQogCiAgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgUGFyY2VsYWJsZS5DcmVhdG9yPFNhdmVkU3RhdGU+IENSRUFUT1IKQEAgLTk5Myw2ICsxMjk1LDkgQEAKICAgICAgICAgICAgIH0KICAgICAgICAgfQogCisgICAgICAgIHNzLmNoZWNrU3RhdGUgPSBtQ2hlY2tTdGF0ZXM7CisgICAgICAgIHNzLmNoZWNrSWRTdGF0ZSA9IG1DaGVja2VkSWRTdGF0ZXM7CisKICAgICAgICAgcmV0dXJuIHNzOwogICAgIH0KIApAQCAtMTAyNCw2ICsxMzI5LDE0IEBACiAKICAgICAgICAgc2V0RmlsdGVyVGV4dChzcy5maWx0ZXIpOwogCisgICAgICAgIGlmIChzcy5jaGVja1N0YXRlICE9IG51bGwpIHsKKyAgICAgICAgICAgIG1DaGVja1N0YXRlcyA9IHNzLmNoZWNrU3RhdGU7CisgICAgICAgIH0KKworICAgICAgICBpZiAoc3MuY2hlY2tJZFN0YXRlICE9IG51bGwpIHsKKyAgICAgICAgICAgIG1DaGVja2VkSWRTdGF0ZXMgPSBzcy5jaGVja0lkU3RhdGU7CisgICAgICAgIH0KKwogICAgICAgICByZXF1ZXN0TGF5b3V0KCk7CiAgICAgfQogCkBAIC0xMTY2LDEwICsxNDc5LDYgQEAKICAgICAgICAgaW50IHJlc3VsdDsKICAgICAgICAgaWYgKG1TbW9vdGhTY3JvbGxiYXJFbmFibGVkKSB7CiAgICAgICAgICAgICByZXN1bHQgPSBNYXRoLm1heChtSXRlbUNvdW50ICogMTAwLCAwKTsKLSAgICAgICAgICAgIGlmIChtU2Nyb2xsWSAhPSAwKSB7Ci0gICAgICAgICAgICAgICAgLy8gQ29tcGVuc2F0ZSBmb3Igb3ZlcnNjcm9sbAotICAgICAgICAgICAgICAgIHJlc3VsdCArPSBNYXRoLmFicygoaW50KSAoKGZsb2F0KSBtU2Nyb2xsWSAvIGdldEhlaWdodCgpICogbUl0ZW1Db3VudCAqIDEwMCkpOwotICAgICAgICAgICAgfQogICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgcmVzdWx0ID0gbUl0ZW1Db3VudDsKICAgICAgICAgfQpAQCAtMTI0Miw4ICsxNTUxLDYgQEAKIAogICAgICAgICBsYXlvdXRDaGlsZHJlbigpOwogICAgICAgICBtSW5MYXlvdXQgPSBmYWxzZTsKLQotICAgICAgICBtT3ZlcnNjcm9sbE1heCA9IChiIC0gdCkgLyBPVkVSU0NST0xMX0xJTUlUX0RJVklTT1I7CiAgICAgfQogCiAgICAgLyoqCkBAIC0xNjczLDYgKzE5ODAsMTEgQEAKICAgICAgICAgICAgICAgICB0cmVlT2JzZXJ2ZXIuYWRkT25HbG9iYWxMYXlvdXRMaXN0ZW5lcih0aGlzKTsKICAgICAgICAgICAgIH0KICAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgaWYgKG1BZGFwdGVyICE9IG51bGwgJiYgbURhdGFTZXRPYnNlcnZlciA9PSBudWxsKSB7CisgICAgICAgICAgICBtRGF0YVNldE9ic2VydmVyID0gbmV3IEFkYXB0ZXJEYXRhU2V0T2JzZXJ2ZXIoKTsKKyAgICAgICAgICAgIG1BZGFwdGVyLnJlZ2lzdGVyRGF0YVNldE9ic2VydmVyKG1EYXRhU2V0T2JzZXJ2ZXIpOworICAgICAgICB9CiAgICAgfQogCiAgICAgQE92ZXJyaWRlCkBAIC0xNjkzLDYgKzIwMDUsMTEgQEAKICAgICAgICAgICAgICAgICBtR2xvYmFsTGF5b3V0TGlzdGVuZXJBZGRlZEZpbHRlciA9IGZhbHNlOwogICAgICAgICAgICAgfQogICAgICAgICB9CisKKyAgICAgICAgaWYgKG1BZGFwdGVyICE9IG51bGwpIHsKKyAgICAgICAgICAgIG1BZGFwdGVyLnVucmVnaXN0ZXJEYXRhU2V0T2JzZXJ2ZXIobURhdGFTZXRPYnNlcnZlcik7CisgICAgICAgICAgICBtRGF0YVNldE9ic2VydmVyID0gbnVsbDsKKyAgICAgICAgfQogICAgIH0KIAogICAgIEBPdmVycmlkZQpAQCAtMTcxMCw3ICsyMDI3LDYgQEAKICAgICAgICAgICAgICAgICBtRmxpbmdSdW5uYWJsZS5lbmRGbGluZygpOwogICAgICAgICAgICAgICAgIGlmIChtU2Nyb2xsWSAhPSAwKSB7CiAgICAgICAgICAgICAgICAgICAgIG1TY3JvbGxZID0gMDsKLSAgICAgICAgICAgICAgICAgICAgZmluaXNoR2xvd3MoKTsKICAgICAgICAgICAgICAgICAgICAgaW52YWxpZGF0ZSgpOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KQEAgLTE4NDQsMTAgKzIxNjAsMjEgQEAKICAgICAgICAgfQogICAgIH0KIAotICAgIHByaXZhdGUgYm9vbGVhbiBwZXJmb3JtTG9uZ1ByZXNzKGZpbmFsIFZpZXcgY2hpbGQsCisgICAgYm9vbGVhbiBwZXJmb3JtTG9uZ1ByZXNzKGZpbmFsIFZpZXcgY2hpbGQsCiAgICAgICAgICAgICBmaW5hbCBpbnQgbG9uZ1ByZXNzUG9zaXRpb24sIGZpbmFsIGxvbmcgbG9uZ1ByZXNzSWQpIHsKLSAgICAgICAgYm9vbGVhbiBoYW5kbGVkID0gZmFsc2U7CisgICAgICAgIC8vIENIT0lDRV9NT0RFX01VTFRJUExFX01PREFMIHRha2VzIG92ZXIgbG9uZyBwcmVzcy4KKyAgICAgICAgaWYgKG1DaG9pY2VNb2RlID09IENIT0lDRV9NT0RFX01VTFRJUExFX01PREFMKSB7CisgICAgICAgICAgICBpZiAobUNob2ljZUFjdGlvbk1vZGUgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIG1DaG9pY2VBY3Rpb25Nb2RlID0gc3RhcnRBY3Rpb25Nb2RlKG1NdWx0aUNob2ljZU1vZGVDYWxsYmFjayk7CisgICAgICAgICAgICAgICAgc2V0SXRlbUNoZWNrZWQobG9uZ1ByZXNzUG9zaXRpb24sIHRydWUpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgLy8gVE9ETyBTaG91bGQgd2Ugc2VsZWN0IHRoZSBsb25nIHByZXNzZWQgaXRlbSBpZiB3ZSB3ZXJlIGFscmVhZHkgaW4KKyAgICAgICAgICAgIC8vIH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TEw7CisgICAgICAgICAgICBtVG91Y2hNb2RlID0gVE9VQ0hfTU9ERV9TQ1JPTEw7CiAgICAgICAgICAgICBtTW90aW9uQ29ycmVjdGlvbiA9IGRlbHRhWTsKICAgICAgICAgICAgIGZpbmFsIEhhbmRsZXIgaGFuZGxlciA9IGdldEhhbmRsZXIoKTsKICAgICAgICAgICAgIC8vIEhhbmRsZXIgc2hvdWxkIG5vdCBiZSBudWxsIHVubGVzcyB0aGUgQWJzTGlzdFZpZXcgaXMgbm90IGF0dGFjaGVkIHRvIGEKQEAgLTIwNTksMTkgKzIzODUsNiBAQAogICAgICAgICAgICAgICAgIC8vIHRvdWNoIG1vZGUpLiBGb3JjZSBhbiBpbml0aWFsIGxheW91dCB0byBnZXQgcmlkIG9mIHRoZSBzZWxlY3Rpb24uCiAgICAgICAgICAgICAgICAgbGF5b3V0Q2hpbGRyZW4oKTsKICAgICAgICAgICAgIH0KLSAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgIGludCB0b3VjaE1vZGUgPSBtVG91Y2hNb2RlOwotICAgICAgICAgICAgaWYgKHRvdWNoTW9kZSA9PSBUT1VDSF9NT0RFX09WRVJTQ1JPTEwgfHwgdG91Y2hNb2RlID09IFRPVUNIX01PREVfT1ZFUkZMSU5HKSB7Ci0gICAgICAgICAgICAgICAgaWYgKG1GbGluZ1J1bm5hYmxlICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgbUZsaW5nUnVubmFibGUuZW5kRmxpbmcoKTsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBpZiAobVNjcm9sbFkgIT0gMCkgewotICAgICAgICAgICAgICAgICAgICBtU2Nyb2xsWSA9IDA7Ci0gICAgICAgICAgICAgICAgICAgIGZpbmlzaEdsb3dzKCk7Ci0gICAgICAgICAgICAgICAgICAgIGludmFsaWRhdGUoKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICB9CiAKQEAgLTIxMDIsNjMgKzI0MTUsNDkgQEAKIAogICAgICAgICBzd2l0Y2ggKGFjdGlvbiAmIE1vdGlvbkV2ZW50LkFDVElPTl9NQVNLKSB7CiAgICAgICAgIGNhc2UgTW90aW9uRXZlbnQuQUNUSU9OX0RPV046IHsKLSAgICAgICAgICAgIHN3aXRjaCAobVRvdWNoTW9kZSkgewotICAgICAgICAgICAgY2FzZSBUT1VDSF9NT0RFX09WRVJGTElORzogewotICAgICAgICAgICAgICAgIG1GbGluZ1J1bm5hYmxlLmVuZEZsaW5nKCk7Ci0gICAgICAgICAgICAgICAgbVRvdWNoTW9kZSA9IFRPVUNIX01PREVfT1ZFUlNDUk9MTDsKLSAgICAgICAgICAgICAgICBtTW90aW9uWSA9IG1MYXN0WSA9IChpbnQpIGV2LmdldFkoKTsKLSAgICAgICAgICAgICAgICBtTW90aW9uQ29ycmVjdGlvbiA9IDA7Ci0gICAgICAgICAgICAgICAgbUFjdGl2ZVBvaW50ZXJJZCA9IGV2LmdldFBvaW50ZXJJZCgwKTsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1BY3RpdmVQb2ludGVySWQgPSBldi5nZXRQb2ludGVySWQoMCk7CisgICAgICAgICAgICBmaW5hbCBpbnQgeCA9IChpbnQpIGV2LmdldFgoKTsKKyAgICAgICAgICAgIGZpbmFsIGludCB5ID0gKGludCkgZXYuZ2V0WSgpOworICAgICAgICAgICAgaW50IG1vdGlvblBvc2l0aW9uID0gcG9pbnRUb1Bvc2l0aW9uKHgsIHkpOworICAgICAgICAgICAgaWYgKCFtRGF0YUNoYW5nZWQpIHsKKyAgICAgICAgICAgICAgICBpZiAoKG1Ub3VjaE1vZGUgIT0gVE9VQ0hfTU9ERV9GTElORykgJiYgKG1vdGlvblBvc2l0aW9uID49IDApCisgICAgICAgICAgICAgICAgICAgICAgICAmJiAoZ2V0QWRhcHRlcigpLmlzRW5hYmxlZChtb3Rpb25Qb3NpdGlvbikpKSB7CisgICAgICAgICAgICAgICAgICAgIC8vIFVzZXIgY2xpY2tlZCBvbiBhbiBhY3R1YWwgdmlldyAoYW5kIHdhcyBub3Qgc3RvcHBpbmcgYSBmbGluZykuIEl0IG1pZ2h0IGJlIGEKKyAgICAgICAgICAgICAgICAgICAgLy8gY2xpY2sgb3IgYSBzY3JvbGwuIEFzc3VtZSBpdCBpcyBhIGNsaWNrIHVudGlsIHByb3ZlbiBvdGhlcndpc2UKKyAgICAgICAgICAgICAgICAgICAgbVRvdWNoTW9kZSA9IFRPVUNIX01PREVfRE9XTjsKKyAgICAgICAgICAgICAgICAgICAgLy8gRklYTUUgRGVib3VuY2UKKyAgICAgICAgICAgICAgICAgICAgaWYgKG1QZW5kaW5nQ2hlY2tGb3JUYXAgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgbVBlbmRpbmdDaGVja0ZvclRhcCA9IG5ldyBDaGVja0ZvclRhcCgpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIHBvc3REZWxheWVkKG1QZW5kaW5nQ2hlY2tGb3JUYXAsIFZpZXdDb25maWd1cmF0aW9uLmdldFRhcFRpbWVvdXQoKSk7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGV2LmdldEVkZ2VGbGFncygpICE9IDAgJiYgbW90aW9uUG9zaXRpb24gPCAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAvLyBJZiB3ZSBjb3VsZG4ndCBmaW5kIGEgdmlldyB0byBjbGljayBvbiwgYnV0IHRoZSBkb3duIGV2ZW50IHdhcyB0b3VjaGluZworICAgICAgICAgICAgICAgICAgICAgICAgLy8gdGhlIGVkZ2UsIHdlIHdpbGwgYmFpbCBvdXQgYW5kIHRyeSBhZ2Fpbi4gVGhpcyBhbGxvd3MgdGhlIGVkZ2UgY29ycmVjdGluZworICAgICAgICAgICAgICAgICAgICAgICAgLy8gY29kZSBpbiBWaWV3Um9vdCB0byB0cnkgdG8gZmluZCBhIG5lYXJieSB2aWV3IHRvIHNlbGVjdAorICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgIGRlZmF1bHQ6IHsKLSAgICAgICAgICAgICAgICBtQWN0aXZlUG9pbnRlcklkID0gZXYuZ2V0UG9pbnRlcklkKDApOwotICAgICAgICAgICAgICAgIGZpbmFsIGludCB4ID0gKGludCkgZXYuZ2V0WCgpOwotICAgICAgICAgICAgICAgIGZpbmFsIGludCB5ID0gKGludCkgZXYuZ2V0WSgpOwotICAgICAgICAgICAgICAgIGludCBtb3Rpb25Qb3NpdGlvbiA9IHBvaW50VG9Qb3NpdGlvbih4LCB5KTsKLSAgICAgICAgICAgICAgICBpZiAoIW1EYXRhQ2hhbmdlZCkgewotICAgICAgICAgICAgICAgICAgICBpZiAoKG1Ub3VjaE1vZGUgIT0gVE9VQ0hfTU9ERV9GTElORykgJiYgKG1vdGlvblBvc2l0aW9uID49IDApCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgJiYgKGdldEFkYXB0ZXIoKS5pc0VuYWJsZWQobW90aW9uUG9zaXRpb24pKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgLy8gVXNlciBjbGlja2VkIG9uIGFuIGFjdHVhbCB2aWV3IChhbmQgd2FzIG5vdCBzdG9wcGluZyBhIGZsaW5nKS4gSXQgbWlnaHQgYmUgYQotICAgICAgICAgICAgICAgICAgICAgICAgLy8gY2xpY2sgb3IgYSBzY3JvbGwuIEFzc3VtZSBpdCBpcyBhIGNsaWNrIHVudGlsIHByb3ZlbiBvdGhlcndpc2UKLSAgICAgICAgICAgICAgICAgICAgICAgIG1Ub3VjaE1vZGUgPSBUT1VDSF9NT0RFX0RPV047Ci0gICAgICAgICAgICAgICAgICAgICAgICAvLyBGSVhNRSBEZWJvdW5jZQotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1QZW5kaW5nQ2hlY2tGb3JUYXAgPT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1QZW5kaW5nQ2hlY2tGb3JUYXAgPSBuZXcgQ2hlY2tGb3JUYXAoKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIHBvc3REZWxheWVkKG1QZW5kaW5nQ2hlY2tGb3JUYXAsIFZpZXdDb25maWd1cmF0aW9uLmdldFRhcFRpbWVvdXQoKSk7Ci0gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZXYuZ2V0RWRnZUZsYWdzKCkgIT0gMCAmJiBtb3Rpb25Qb3NpdGlvbiA8IDApIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBJZiB3ZSBjb3VsZG4ndCBmaW5kIGEgdmlldyB0byBjbGljayBvbiwgYnV0IHRoZSBkb3duIGV2ZW50IHdhcyB0b3VjaGluZwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHRoZSBlZGdlLCB3ZSB3aWxsIGJhaWwgb3V0IGFuZCB0cnkgYWdhaW4uIFRoaXMgYWxsb3dzIHRoZSBlZGdlIGNvcnJlY3RpbmcKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBjb2RlIGluIFZpZXdSb290IHRvIHRyeSB0byBmaW5kIGEgbmVhcmJ5IHZpZXcgdG8gc2VsZWN0Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgICAgICAgICBpZiAobVRvdWNoTW9kZSA9PSBUT1VDSF9NT0RFX0ZMSU5HKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gU3RvcHBlZCBhIGZsaW5nLiBJdCBpcyBhIHNjcm9sbC4KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBjcmVhdGVTY3JvbGxpbmdDYWNoZSgpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Ub3VjaE1vZGUgPSBUT1VDSF9NT0RFX1NDUk9MTDsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBtTW90aW9uQ29ycmVjdGlvbiA9IDA7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbW90aW9uUG9zaXRpb24gPSBmaW5kTW90aW9uUm93KHkpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcG9ydFNjcm9sbFN0YXRlQ2hhbmdlKE9uU2Nyb2xsTGlzdGVuZXIuU0NST0xMX1NUQVRFX1RPVUNIX1NDUk9MTCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGlmIChtVG91Y2hNb2RlID09IFRPVUNIX01PREVfRkxJTkcpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIFN0b3BwZWQgYSBmbGluZy4gSXQgaXMgYSBzY3JvbGwuCisgICAgICAgICAgICAgICAgICAgICAgICBjcmVhdGVTY3JvbGxpbmdDYWNoZSgpOworICAgICAgICAgICAgICAgICAgICAgICAgbVRvdWNoTW9kZSA9IFRPVUNIX01PREVfU0NST0xMOworICAgICAgICAgICAgICAgICAgICAgICAgbU1vdGlvbkNvcnJlY3Rpb24gPSAwOworICAgICAgICAgICAgICAgICAgICAgICAgbW90aW9uUG9zaXRpb24gPSBmaW5kTW90aW9uUm93KHkpOworICAgICAgICAgICAgICAgICAgICAgICAgcmVwb3J0U2Nyb2xsU3RhdGVDaGFuZ2UoT25TY3JvbGxMaXN0ZW5lci5TQ1JPTExfU1RBVEVfVE9VQ0hfU0NST0xMKTsKICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgICAgIGlmIChtb3Rpb25Qb3NpdGlvbiA+PSAwKSB7Ci0gICAgICAgICAgICAgICAgICAgIC8vIFJlbWVtYmVyIHdoZXJlIHRoZSBtb3Rpb24gZXZlbnQgc3RhcnRlZAotICAgICAgICAgICAgICAgICAgICB2ID0gZ2V0Q2hpbGRBdChtb3Rpb25Qb3NpdGlvbiAtIG1GaXJzdFBvc2l0aW9uKTsKLSAgICAgICAgICAgICAgICAgICAgbU1vdGlvblZpZXdPcmlnaW5hbFRvcCA9IHYuZ2V0VG9wKCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIG1Nb3Rpb25YID0geDsKLSAgICAgICAgICAgICAgICBtTW90aW9uWSA9IHk7Ci0gICAgICAgICAgICAgICAgbU1vdGlvblBvc2l0aW9uID0gbW90aW9uUG9zaXRpb247Ci0gICAgICAgICAgICAgICAgbUxhc3RZID0gSW50ZWdlci5NSU5fVkFMVUU7Ci0gICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBpZiAobW90aW9uUG9zaXRpb24gPj0gMCkgeworICAgICAgICAgICAgICAgIC8vIFJlbWVtYmVyIHdoZXJlIHRoZSBtb3Rpb24gZXZlbnQgc3RhcnRlZAorICAgICAgICAgICAgICAgIHYgPSBnZXRDaGlsZEF0KG1vdGlvblBvc2l0aW9uIC0gbUZpcnN0UG9zaXRpb24pOworICAgICAgICAgICAgICAgIG1Nb3Rpb25WaWV3T3JpZ2luYWxUb3AgPSB2LmdldFRvcCgpOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgfQorICAgICAgICAgICAgbU1vdGlvblggPSB4OworICAgICAgICAgICAgbU1vdGlvblkgPSB5OworICAgICAgICAgICAgbU1vdGlvblBvc2l0aW9uID0gbW90aW9uUG9zaXRpb247CisgICAgICAgICAgICBtTGFzdFkgPSBJbnRlZ2VyLk1JTl9WQUxVRTsKICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICB9CiAKQEAgLTIxOTEsMjUgKzI0OTAsOSBAQAogICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWVzdERpc2FsbG93SW50ZXJjZXB0VG91Y2hFdmVudCh0cnVlKTsKICAgICAgICAgICAgICAgICAgICAgfQogCi0gICAgICAgICAgICAgICAgICAgIGZpbmFsIGludCByYXdEZWx0YVkgPSBkZWx0YVk7CiAgICAgICAgICAgICAgICAgICAgIGRlbHRhWSAtPSBtTW90aW9uQ29ycmVjdGlvbjsKICAgICAgICAgICAgICAgICAgICAgaW50IGluY3JlbWVudGFsRGVsdGFZID0gbUxhc3RZICE9IEludGVnZXIuTUlOX1ZBTFVFID8geSAtIG1MYXN0WSA6IGRlbHRhWTsKICAgICAgICAgICAgICAgICAgICAgCi0gICAgICAgICAgICAgICAgICAgIGZpbmFsIGludCBtb3Rpb25JbmRleDsKLSAgICAgICAgICAgICAgICAgICAgaWYgKG1Nb3Rpb25Qb3NpdGlvbiA+PSAwKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBtb3Rpb25JbmRleCA9IG1Nb3Rpb25Qb3NpdGlvbiAtIG1GaXJzdFBvc2l0aW9uOwotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgLy8gSWYgd2UgZG9uJ3QgaGF2ZSBhIG1vdGlvbiBwb3NpdGlvbiB0aGF0IHdlIGNhbiByZWxpYWJseSB0cmFjaywKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIHBpY2sgc29tZXRoaW5nIGluIHRoZSBtaWRkbGUgdG8gbWFrZSBhIGJlc3QgZ3Vlc3MgYXQgdGhpbmdzIGJlbG93LgotICAgICAgICAgICAgICAgICAgICAgICAgbW90aW9uSW5kZXggPSBnZXRDaGlsZENvdW50KCkgLyAyOwotICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgaW50IG1vdGlvblZpZXdQcmV2VG9wID0gMDsKLSAgICAgICAgICAgICAgICAgICAgVmlldyBtb3Rpb25WaWV3ID0gdGhpcy5nZXRDaGlsZEF0KG1vdGlvbkluZGV4KTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKG1vdGlvblZpZXcgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICAgICAgbW90aW9uVmlld1ByZXZUb3AgPSBtb3Rpb25WaWV3LmdldFRvcCgpOwotICAgICAgICAgICAgICAgICAgICB9Ci0KICAgICAgICAgICAgICAgICAgICAgLy8gTm8gbmVlZCB0byBkbyBhbGwgdGhpcyB3b3JrIGlmIHdlJ3JlIG5vdCBnb2luZyB0byBtb3ZlIGFueXdheQogICAgICAgICAgICAgICAgICAgICBib29sZWFuIGF0RWRnZSA9IGZhbHNlOwogICAgICAgICAgICAgICAgICAgICBpZiAoaW5jcmVtZW50YWxEZWx0YVkgIT0gMCkgewpAQCAtMjIxNyw5OSArMjUwMCwyMyBAQAogICAgICAgICAgICAgICAgICAgICB9CiAKICAgICAgICAgICAgICAgICAgICAgLy8gQ2hlY2sgdG8gc2VlIGlmIHdlIGhhdmUgYnVtcGVkIGludG8gdGhlIHNjcm9sbCBsaW1pdAotICAgICAgICAgICAgICAgICAgICBtb3Rpb25WaWV3ID0gdGhpcy5nZXRDaGlsZEF0KG1vdGlvbkluZGV4KTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKG1vdGlvblZpZXcgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICAgICAgLy8gQ2hlY2sgaWYgdGhlIHRvcCBvZiB0aGUgbW90aW9uIHZpZXcgaXMgd2hlcmUgaXQgaXMKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIHN1cHBvc2VkIHRvIGJlCi0gICAgICAgICAgICAgICAgICAgICAgICBmaW5hbCBpbnQgbW90aW9uVmlld1JlYWxUb3AgPSBtb3Rpb25WaWV3LmdldFRvcCgpOwotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGF0RWRnZSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIEFwcGx5IG92ZXJzY3JvbGwKLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBvdmVyc2Nyb2xsID0gLWluY3JlbWVudGFsRGVsdGFZIC0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChtb3Rpb25WaWV3UmVhbFRvcCAtIG1vdGlvblZpZXdQcmV2VG9wKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdmVyc2Nyb2xsQnkoMCwgb3ZlcnNjcm9sbCwgMCwgbVNjcm9sbFksIDAsIDAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLCBtT3ZlcnNjcm9sbERpc3RhbmNlLCB0cnVlKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoTWF0aC5hYnMobU92ZXJzY3JvbGxEaXN0YW5jZSkgPT0gTWF0aC5hYnMobVNjcm9sbFkpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIERvbid0IGFsbG93IG92ZXJmbGluZyBpZiB3ZSdyZSBhdCB0aGUgZWRnZS4KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVZlbG9jaXR5VHJhY2tlci5jbGVhcigpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpbmFsIGludCBvdmVyc2Nyb2xsTW9kZSA9IGdldE92ZXJzY3JvbGxNb2RlKCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG92ZXJzY3JvbGxNb2RlID09IE9WRVJTQ1JPTExfQUxXQVlTIHx8Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAob3ZlcnNjcm9sbE1vZGUgPT0gT1ZFUlNDUk9MTF9JRl9DT05URU5UX1NDUk9MTFMgJiYKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIWNvbnRlbnRGaXRzKCkpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Ub3VjaE1vZGUgPSBUT1VDSF9NT0RFX09WRVJTQ1JPTEw7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyYXdEZWx0YVkgPiAwKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtRWRnZUdsb3dUb3Aub25QdWxsKChmbG9hdCkgb3ZlcnNjcm9sbCAvIGdldEhlaWdodCgpKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChyYXdEZWx0YVkgPCAwKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtRWRnZUdsb3dCb3R0b20ub25QdWxsKChmbG9hdCkgb3ZlcnNjcm9sbCAvIGdldEhlaWdodCgpKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgaWYgKGF0RWRnZSAmJiBnZXRDaGlsZENvdW50KCkgPiAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAvLyBUcmVhdCB0aGlzIGxpa2Ugd2UncmUgc3RhcnRpbmcgYSBuZXcgc2Nyb2xsIGZyb20gdGhlIGN1cnJlbnQKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIHBvc2l0aW9uLiBUaGlzIHdpbGwgbGV0IHRoZSB1c2VyIHN0YXJ0IHNjcm9sbGluZyBiYWNrIGludG8KKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIGNvbnRlbnQgaW1tZWRpYXRlbHkgcmF0aGVyIHRoYW4gbmVlZGluZyB0byBzY3JvbGwgYmFjayB0byB0aGUKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIHBvaW50IHdoZXJlIHRoZXkgaGl0IHRoZSBsaW1pdCBmaXJzdC4KKyAgICAgICAgICAgICAgICAgICAgICAgIGludCBtb3Rpb25Qb3NpdGlvbiA9IGZpbmRNb3Rpb25Sb3coeSk7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAobW90aW9uUG9zaXRpb24gPj0gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpbmFsIFZpZXcgbW90aW9uVmlldyA9IGdldENoaWxkQXQobW90aW9uUG9zaXRpb24gLSBtRmlyc3RQb3NpdGlvbik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbU1vdGlvblZpZXdPcmlnaW5hbFRvcCA9IG1vdGlvblZpZXcuZ2V0VG9wKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICBtTW90aW9uWSA9IHk7CisgICAgICAgICAgICAgICAgICAgICAgICBtTW90aW9uUG9zaXRpb24gPSBtb3Rpb25Qb3NpdGlvbjsKICAgICAgICAgICAgICAgICAgICAgICAgIGludmFsaWRhdGUoKTsKICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICBtTGFzdFkgPSB5OwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBicmVhazsKLQotICAgICAgICAgICAgY2FzZSBUT1VDSF9NT0RFX09WRVJTQ1JPTEw6Ci0gICAgICAgICAgICAgICAgaWYgKHkgIT0gbUxhc3RZKSB7Ci0gICAgICAgICAgICAgICAgICAgIGZpbmFsIGludCByYXdEZWx0YVkgPSBkZWx0YVk7Ci0gICAgICAgICAgICAgICAgICAgIGRlbHRhWSAtPSBtTW90aW9uQ29ycmVjdGlvbjsKLSAgICAgICAgICAgICAgICAgICAgaW50IGluY3JlbWVudGFsRGVsdGFZID0gbUxhc3RZICE9IEludGVnZXIuTUlOX1ZBTFVFID8geSAtIG1MYXN0WSA6IGRlbHRhWTsKLQotICAgICAgICAgICAgICAgICAgICBmaW5hbCBpbnQgb2xkU2Nyb2xsID0gbVNjcm9sbFk7Ci0gICAgICAgICAgICAgICAgICAgIGZpbmFsIGludCBuZXdTY3JvbGwgPSBvbGRTY3JvbGwgLSBpbmNyZW1lbnRhbERlbHRhWTsKLQotICAgICAgICAgICAgICAgICAgICBpZiAoKG9sZFNjcm9sbCA+PSAwICYmIG5ld1Njcm9sbCA8PSAwKSB8fAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIChvbGRTY3JvbGwgPD0gMCAmJiBuZXdTY3JvbGwgPj0gMCkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIENvbWluZyBiYWNrIHRvICdyZWFsJyBsaXN0IHNjcm9sbGluZwotICAgICAgICAgICAgICAgICAgICAgICAgaW5jcmVtZW50YWxEZWx0YVkgPSAtbmV3U2Nyb2xsOwotICAgICAgICAgICAgICAgICAgICAgICAgbVNjcm9sbFkgPSAwOwotCi0gICAgICAgICAgICAgICAgICAgICAgICAvLyBObyBuZWVkIHRvIGRvIGFsbCB0aGlzIHdvcmsgaWYgd2UncmUgbm90IGdvaW5nIHRvIG1vdmUgYW55d2F5Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoaW5jcmVtZW50YWxEZWx0YVkgIT0gMCkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYWNrTW90aW9uU2Nyb2xsKGluY3JlbWVudGFsRGVsdGFZLCBpbmNyZW1lbnRhbERlbHRhWSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIENoZWNrIHRvIHNlZSBpZiB3ZSBhcmUgYmFjayBpbgotICAgICAgICAgICAgICAgICAgICAgICAgVmlldyBtb3Rpb25WaWV3ID0gdGhpcy5nZXRDaGlsZEF0KG1Nb3Rpb25Qb3NpdGlvbiAtIG1GaXJzdFBvc2l0aW9uKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtb3Rpb25WaWV3ICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBtVG91Y2hNb2RlID0gVE9VQ0hfTU9ERV9TQ1JPTEw7Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBXZSBkaWQgbm90IHNjcm9sbCB0aGUgZnVsbCBhbW91bnQuIFRyZWF0IHRoaXMgZXNzZW50aWFsbHkgbGlrZSB0aGUKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBzdGFydCBvZiBhIG5ldyB0b3VjaCBzY3JvbGwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaW5hbCBpbnQgbW90aW9uUG9zaXRpb24gPSBmaW5kQ2xvc2VzdE1vdGlvblJvdyh5KTsKLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Nb3Rpb25Db3JyZWN0aW9uID0gMDsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb3Rpb25WaWV3ID0gZ2V0Q2hpbGRBdChtb3Rpb25Qb3NpdGlvbiAtIG1GaXJzdFBvc2l0aW9uKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBtTW90aW9uVmlld09yaWdpbmFsVG9wID0gbW90aW9uVmlldy5nZXRUb3AoKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBtTW90aW9uWSA9IHk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbU1vdGlvblBvc2l0aW9uID0gbW90aW9uUG9zaXRpb247Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBvdmVyc2Nyb2xsQnkoMCwgLWluY3JlbWVudGFsRGVsdGFZLCAwLCBtU2Nyb2xsWSwgMCwgMCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCwgbU92ZXJzY3JvbGxEaXN0YW5jZSwgdHJ1ZSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBmaW5hbCBpbnQgb3ZlcnNjcm9sbE1vZGUgPSBnZXRPdmVyc2Nyb2xsTW9kZSgpOwotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG92ZXJzY3JvbGxNb2RlID09IE9WRVJTQ1JPTExfQUxXQVlTIHx8Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChvdmVyc2Nyb2xsTW9kZSA9PSBPVkVSU0NST0xMX0lGX0NPTlRFTlRfU0NST0xMUyAmJgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICFjb250ZW50Rml0cygpKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyYXdEZWx0YVkgPiAwKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1FZGdlR2xvd1RvcC5vblB1bGwoKGZsb2F0KSAtaW5jcmVtZW50YWxEZWx0YVkgLyBnZXRIZWlnaHQoKSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChyYXdEZWx0YVkgPCAwKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1FZGdlR2xvd0JvdHRvbS5vblB1bGwoKGZsb2F0KSAtaW5jcmVtZW50YWxEZWx0YVkgLyBnZXRIZWlnaHQoKSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludmFsaWRhdGUoKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChNYXRoLmFicyhtT3ZlcnNjcm9sbERpc3RhbmNlKSA9PSBNYXRoLmFicyhtU2Nyb2xsWSkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBEb24ndCBhbGxvdyBvdmVyZmxpbmcgaWYgd2UncmUgYXQgdGhlIGVkZ2UuCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbVZlbG9jaXR5VHJhY2tlci5jbGVhcigpOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIG1MYXN0WSA9IHk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgfQogCiAgICAgICAgICAgICBicmVhazsKQEAgLTIzODEsMjkgKzI1ODgsMTggQEAKICAgICAgICAgICAgIGNhc2UgVE9VQ0hfTU9ERV9TQ1JPTEw6CiAgICAgICAgICAgICAgICAgZmluYWwgaW50IGNoaWxkQ291bnQgPSBnZXRDaGlsZENvdW50KCk7CiAgICAgICAgICAgICAgICAgaWYgKGNoaWxkQ291bnQgPiAwKSB7Ci0gICAgICAgICAgICAgICAgICAgIGZpbmFsIGludCBmaXJzdENoaWxkVG9wID0gZ2V0Q2hpbGRBdCgwKS5nZXRUb3AoKTsKLSAgICAgICAgICAgICAgICAgICAgZmluYWwgaW50IGxhc3RDaGlsZEJvdHRvbSA9IGdldENoaWxkQXQoY2hpbGRDb3VudCAtIDEpLmdldEJvdHRvbSgpOwotICAgICAgICAgICAgICAgICAgICBmaW5hbCBpbnQgY29udGVudFRvcCA9IG1MaXN0UGFkZGluZy50b3A7Ci0gICAgICAgICAgICAgICAgICAgIGZpbmFsIGludCBjb250ZW50Qm90dG9tID0gZ2V0SGVpZ2h0KCkgLSBtTGlzdFBhZGRpbmcuYm90dG9tOwotICAgICAgICAgICAgICAgICAgICBpZiAobUZpcnN0UG9zaXRpb24gPT0gMCAmJiBmaXJzdENoaWxkVG9wID49IGNvbnRlbnRUb3AgJiYKKyAgICAgICAgICAgICAgICAgICAgaWYgKG1GaXJzdFBvc2l0aW9uID09IDAgJiYgZ2V0Q2hpbGRBdCgwKS5nZXRUb3AoKSA+PSBtTGlzdFBhZGRpbmcudG9wICYmCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUZpcnN0UG9zaXRpb24gKyBjaGlsZENvdW50IDwgbUl0ZW1Db3VudCAmJgotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhc3RDaGlsZEJvdHRvbSA8PSBnZXRIZWlnaHQoKSAtIGNvbnRlbnRCb3R0b20pIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRDaGlsZEF0KGNoaWxkQ291bnQgLSAxKS5nZXRCb3R0b20oKSA8PQorICAgICAgICAgICAgICA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AgICAgICAgICAgICAgICAgIGlmIChNYXRoLmFicyhpbml0aWFsVmVsb2NpdHkpID4gbU1pbmltdW1WZWxvY2l0eSAmJgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAhKChtRmlyc3RQb3NpdGlvbiA9PSAwICYmCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmlyc3RDaGlsZFRvcCA9PSBjb250ZW50VG9wIC0gbU92ZXJzY3JvbGxEaXN0YW5jZSkgfHwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAobUZpcnN0UG9zaXRpb24gKyBjaGlsZENvdW50ID09IG1JdGVtQ291bnQgJiYKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsYXN0Q2hpbGRCb3R0b20gPT0gY29udGVudEJvdHRvbSArIG1PdmVyc2Nyb2xsRGlzdGFuY2UpKSkgeworICAgIAorICAgICAgICAgICAgICAgICAgICAgICAgaWYgKE1hdGguYWJzKGluaXRpYWxWZWxvY2l0eSkgPiBtTWluaW11bVZlbG9jaXR5KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1GbGluZ1J1bm5hYmxlID09IG51bGwpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUZsaW5nUnVubmFibGUgPSBuZXcgRmxpbmdSdW5uYWJsZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KQEAgLTI0MjAsMzIgKzI2MTYsMTAgQEAKICAgICAgICAgICAgICAgICAgICAgcmVwb3J0U2Nyb2xsU3RhdGVDaGFuZ2UoT25TY3JvbGxMaXN0ZW5lci5TQ1JPTExfU1RBVEVfSURMRSk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGJyZWFrOwotCi0gICAgICAgICAgICBjYXNlIFRPVUNIX01PREVfT1ZFUlNDUk9MTDoKLSAgICAgICAgICAgICAgICBpZiAobUZsaW5nUnVubmFibGUgPT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICBtRmxpbmdSdW5uYWJsZSA9IG5ldyBGbGluZ1J1bm5hYmxlKCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGZpbmFsIFZlbG9jaXR5VHJhY2tlciB2ZWxvY2l0eVRyYWNrZXIgPSBtVmVsb2NpdHlUcmFja2VyOwotICAgICAgICAgICAgICAgIHZlbG9jaXR5VHJhY2tlci5jb21wdXRlQ3VycmVudFZlbG9jaXR5KDEwMDAsIG1NYXhpbXVtVmVsb2NpdHkpOwotICAgICAgICAgICAgICAgIGZpbmFsIGludCBpbml0aWFsVmVsb2NpdHkgPSAoaW50KSB2ZWxvY2l0eVRyYWNrZXIuZ2V0WVZlbG9jaXR5KG1BY3RpdmVQb2ludGVySWQpOwotCi0gICAgICAgICAgICAgICAgcmVwb3J0U2Nyb2xsU3RhdGVDaGFuZ2UoT25TY3JvbGxMaXN0ZW5lci5TQ1JPTExfU1RBVEVfRkxJTkcpOwotICAgICAgICAgICAgICAgIGlmIChNYXRoLmFicyhpbml0aWFsVmVsb2NpdHkpID4gbU1pbmltdW1WZWxvY2l0eSkgewotICAgICAgICAgICAgICAgICAgICBtRmxpbmdSdW5uYWJsZS5zdGFydE92ZXJmbGluZygtaW5pdGlhbFZlbG9jaXR5KTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBtRmxpbmdSdW5uYWJsZS5zdGFydFNwcmluZ2JhY2soKTsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgc2V0UHJlc3NlZChmYWxzZSk7CiAKLSAgICAgICAgICAgIGlmIChtRWRnZUdsb3dUb3AgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIG1FZGdlR2xvd1RvcC5vblJlbGVhc2UoKTsKLSAgICAgICAgICAgICAgICBtRWRnZUdsb3dCb3R0b20ub25SZWxlYXNlKCk7Ci0gICAgICAgICAgICB9Ci0KICAgICAgICAgICAgIC8vIE5lZWQgdG8gcmVkcmF3IHNpbmNlIHdlIHByb2JhYmx5IGFyZW4ndCBkcmF3aW5nIHRoZSBzZWxlY3RvciBhbnltb3JlCiAgICAgICAgICAgICBpbnZhbGlkYXRlKCk7CiAKQEAgLTI0NzEsNDIgKzI2NDUsMjQgQEAKICAgICAgICAgfQogCiAgICAgICAgIGNhc2UgTW90aW9uRXZlbnQuQUNUSU9OX0NBTkNFTDogewotICAgICAgICAgICAgc3dpdGNoIChtVG91Y2hNb2RlKSB7Ci0gICAgICAgICAgICBjYXNlIFRPVUNIX01PREVfT1ZFUlNDUk9MTDoKLSAgICAgICAgICAgICAgICBpZiAobUZsaW5nUnVubmFibGUgPT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICBtRmxpbmdSdW5uYWJsZSA9IG5ldyBGbGluZ1J1bm5hYmxlKCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIG1GbGluZ1J1bm5hYmxlLnN0YXJ0U3ByaW5nYmFjaygpOwotICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgbVRvdWNoTW9kZSA9IFRPVUNIX01PREVfUkVTVDsKKyAgICAgICAgICAgIHNldFByZXNzZWQoZmFsc2UpOworICAgICAgICAgICAgVmlldyBtb3Rpb25WaWV3ID0gdGhpcy5nZXRDaGlsZEF0KG1Nb3Rpb25Qb3NpdGlvbiAtIG1GaXJzdFBvc2l0aW9uKTsKKyAgICAgICAgICAgIGlmIChtb3Rpb25WaWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBtb3Rpb25WaWV3LnNldFByZXNzZWQoZmFsc2UpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2xlYXJTY3JvbGxpbmdDYWNoZSgpOwogCi0gICAgICAgICAgICBjYXNlIFRPVUNIX01PREVfT1ZFUkZMSU5HOgotICAgICAgICAgICAgICAgIC8vIERvIG5vdGhpbmcgLSBsZXQgaXQgcGxheSBvdXQuCi0gICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBmaW5hbCBIYW5kbGVyIGhhbmRsZXIgPSBnZXRIYW5kbGVyKCk7CisgICAgICAgICAgICBpZiAoaGFuZGxlciAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgaGFuZGxlci5yZW1vdmVDYWxsYmFja3MobVBlbmRpbmdDaGVja0ZvckxvbmdQcmVzcyk7CisgICAgICAgICAgICB9CiAKLSAgICAgICAgICAgIGRlZmF1bHQ6Ci0gICAgICAgICAgICAgICAgbVRvdWNoTW9kZSA9IFRPVUNIX01PREVfUkVTVDsKLSAgICAgICAgICAgICAgICBzZXRQcmVzc2VkKGZhbHNlKTsKLSAgICAgICAgICAgICAgICBWaWV3IG1vdGlvblZpZXcgPSB0aGlzLmdldENoaWxkQXQobU1vdGlvblBvc2l0aW9uIC0gbUZpcnN0UG9zaXRpb24pOwotICAgICAgICAgICAgICAgIGlmIChtb3Rpb25WaWV3ICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgbW90aW9uVmlldy5zZXRQcmVzc2VkKGZhbHNlKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgY2xlYXJTY3JvbGxpbmdDYWNoZSgpOwotCi0gICAgICAgICAgICAgICAgZmluYWwgSGFuZGxlciBoYW5kbGVyID0gZ2V0SGFuZGxlcigpOwotICAgICAgICAgICAgICAgIGlmIChoYW5kbGVyICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgaGFuZGxlci5yZW1vdmVDYWxsYmFja3MobVBlbmRpbmdDaGVja0ZvckxvbmdQcmVzcyk7Ci0gICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgaWYgKG1WZWxvY2l0eVRyYWNrZXIgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICBtVmVsb2NpdHlUcmFja2VyLnJlY3ljbGUoKTsKLSAgICAgICAgICAgICAgICAgICAgbVZlbG9jaXR5VHJhY2tlciA9IG51bGw7Ci0gICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKG1WZWxvY2l0eVRyYWNrZXIgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIG1WZWxvY2l0eVRyYWNrZXIucmVjeWNsZSgpOworICAgICAgICAgICAgICAgIG1WZWxvY2l0eVRyYWNrZXIgPSBudWxsOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgCi0gICAgICAgICAgICBpZiAobUVkZ2VHbG93VG9wICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICBtRWRnZUdsb3dUb3Aub25SZWxlYXNlKCk7Ci0gICAgICAgICAgICAgICAgbUVkZ2VHbG93Qm90dG9tLm9uUmVsZWFzZSgpOwotICAgICAgICAgICAgfQogICAgICAgICAgICAgbUFjdGl2ZVBvaW50ZXJJZCA9IElOVkFMSURfUE9JTlRFUjsKICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICB9CkBAIC0yNTMxLDYxICsyNjg3LDEwIEBACiAgICAgfQogCiAgICAgQE92ZXJyaWRlCi0gICAgcHJvdGVjdGVkIHZvaWQgb25PdmVyc2Nyb2xsZWQoaW50IHNjcm9sbFgsIGludCBzY3JvbGxZLAotICAgICAgICAgICAgYm9vbGVhbiBjbGFtcGVkWCwgYm9vbGVhbiBjbGFtcGVkWSkgewotICAgICAgICBtU2Nyb2xsWSA9IHNjcm9sbFk7Ci0KLSAgICAgICAgaWYgKGNsYW1wZWRZKSB7Ci0gICAgICAgICAgICAvLyBWZWxvY2l0eSBpcyBicm9rZW4gYnkgaGl0dGluZyB0aGUgbGltaXQ7IGRvbid0IHN0YXJ0IGEgZmxpbmcgb2ZmIG9mIHRoaXMuCi0gICAgICAgICAgICBpZiAobVZlbG9jaXR5VHJhY2tlciAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgbVZlbG9jaXR5VHJhY2tlci5jbGVhcigpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgICAgIGF3YWtlblNjcm9sbEJhcnMoKTsKLSAgICB9Ci0KLSAgICBAT3ZlcnJpZGUKICAgICBwdWJsaWMgdm9pZCBkcmF3KENhbnZhcyBjYW52YXMpIHsKICAgICAgICAgc3VwZXIuZHJhdyhjYW52YXMpOwotICAgICAgICBpZiAobUVkZ2VHbG93VG9wICE9IG51bGwpIHsKLSAgICAgICAgICAgIGZpbmFsIGludCBzY3JvbGxZID0gbVNjcm9sbFk7Ci0gICAgICAgICAgICBpZiAoIW1FZGdlR2xvd1RvcC5pc0ZpbmlzaGVkKCkpIHsKLSAgICAgICAgICAgICAgICBmaW5hbCBpbnQgcmVzdG9yZUNvdW50ID0gY2FudmFzLnNhdmUoKTsKLSAgICAgICAgICAgICAgICBmaW5hbCBpbnQgd2lkdGggPSBnZXRXaWR0aCgpOwotCi0gICAgICAgICAgICAgICAgY2FudmFzLnRyYW5zbGF0ZSgtd2lkdGggLyAyLCBNYXRoLm1pbigwLCBzY3JvbGxZICsgbUZpcnN0UG9zaXRpb25EaXN0YW5jZUd1ZXNzKSk7Ci0gICAgICAgICAgICAgICAgbUVkZ2VHbG93VG9wLnNldFNpemUod2lkdGggKiAyLCBnZXRIZWlnaHQoKSk7Ci0gICAgICAgICAgICAgICAgaWYgKG1FZGdlR2xvd1RvcC5kcmF3KGNhbnZhcykpIHsKLSAgICAgICAgICAgICAgICAgICAgaW52YWxpZGF0ZSgpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBjYW52YXMucmVzdG9yZVRvQ291bnQocmVzdG9yZUNvdW50KTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmICghbUVkZ2VHbG93Qm90dG9tLmlzRmluaXNoZWQoKSkgewotICAgICAgICAgICAgICAgIGZpbmFsIGludCByZXN0b3JlQ291bnQgPSBjYW52YXMuc2F2ZSgpOwotICAgICAgICAgICAgICAgIGZpbmFsIGludCB3aWR0aCA9IGdldFdpZHRoKCk7Ci0gICAgICAgICAgICAgICAgZmluYWwgaW50IGhlaWdodCA9IGdldEhlaWdodCgpOwotCi0gICAgICAgICAgICAgICAgY2FudmFzLnRyYW5zbGF0ZSgtd2lkdGggLyAyLAotICAgICAgICAgICAgICAgICAgICAgICAgTWF0aC5tYXgoaGVpZ2h0LCBzY3JvbGxZICsgbUxhc3RQb3NpdGlvbkRpc3RhbmNlR3Vlc3MpKTsKLSAgICAgICAgICAgICAgICBjYW52YXMucm90YXRlKDE4MCwgd2lkdGgsIDApOwotICAgICAgICAgICAgICAgIG1FZGdlR2xvd0JvdHRvbS5zZXRTaXplKHdpZHRoICogMiwgaGVpZ2h0KTsKLSAgICAgICAgICAgICAgICBpZiAobUVkZ2VHbG93Qm90dG9tLmRyYXcoY2FudmFzKSkgewotICAgICAgICAgICAgICAgICAgICBpbnZhbGlkYXRlKCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGNhbnZhcy5yZXN0b3JlVG9Db3VudChyZXN0b3JlQ291bnQpOwotICAgICAgICAgICAgfQotICAgICAgICB9CiAgICAgICAgIGlmIChtRmFzdFNjcm9sbGVyICE9IG51bGwpIHsKLSAgICAgICAgICAgIGZpbmFsIGludCBzY3JvbGxZID0gbVNjcm9sbFk7Ci0gICAgICAgICAgICBpZiAoc2Nyb2xsWSAhPSAwKSB7Ci0gICAgICAgICAgICAgICAgLy8gUGluIHRvIHRoZSB0b3AvYm90dG9tIGR1cmluZyBvdmVyc2Nyb2xsCi0gICAgICAgICAgICAgICAgaW50IHJlc3RvcmVDb3VudCA9IGNhbnZhcy5zYXZlKCk7Ci0gICAgICAgICAgICAgICAgY2FudmFzLnRyYW5zbGF0ZSgwLCAoZmxvYXQpIHNjcm9sbFkpOwotICAgICAgICAgICAgICAgIG1GYXN0U2Nyb2xsZXIuZHJhdyhjYW52YXMpOwotICAgICAgICAgICAgICAgIGNhbnZhcy5yZXN0b3JlVG9Db3VudChyZXN0b3JlQ291bnQpOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBtRmFzdFNjcm9sbGVyLmRyYXcoY2FudmFzKTsKLSAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1GYXN0U2Nyb2xsZXIuZHJhdyhjYW52YXMpOwogICAgICAgICB9CiAgICAgfQogCkBAIC0yNjA0LDEwICsyNzA5LDYgQEAKICAgICAgICAgc3dpdGNoIChhY3Rpb24gJiBNb3Rpb25FdmVudC5BQ1RJT05fTUFTSykgewogICAgICAgICBjYXNlIE1vdGlvbkV2ZW50LkFDVElPTl9ET1dOOiB7CiAgICAgICAgICAgICBpbnQgdG91Y2hNb2RlID0gbVRvdWNoTW9kZTsKLSAgICAgICAgICAgIGlmICh0b3VjaE1vZGUgPT0gVE9VQ0hfTU9ERV9PVkVSRkxJTkcgfHwgdG91Y2hNb2RlID09IFRPVUNIX01PREVfT1ZFUlNDUk9MTCkgewotICAgICAgICAgICAgICAgIG1Nb3Rpb25Db3JyZWN0aW9uID0gMDsKLSAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKLSAgICAgICAgICAgIH0KICAgICAgICAgICAgIAogICAgICAgICAgICAgZmluYWwgaW50IHggPSAoaW50KSBldi5nZXRYKCk7CiAgICAgICAgICAgICBmaW5hbCBpbnQgeSA9IChpbnQpIGV2LmdldFkoKTsKQEAgLTI2NzIsNyArMjc3Myw2IEBACiAgICAgICAgICAgICBmaW5hbCBpbnQgbmV3UG9pbnRlckluZGV4ID0gcG9pbnRlckluZGV4ID09IDAgPyAxIDogMDsKICAgICAgICAgICAgIG1Nb3Rpb25YID0gKGludCkgZXYuZ2V0WChuZXdQb2ludGVySW5kZXgpOwogICAgICAgICAgICAgbU1vdGlvblkgPSAoaW50KSBldi5nZXRZKG5ld1BvaW50ZXJJbmRleCk7Ci0gICAgICAgICAgICBtTW90aW9uQ29ycmVjdGlvbiA9IDA7CiAgICAgICAgICAgICBtQWN0aXZlUG9pbnRlcklkID0gZXYuZ2V0UG9pbnRlcklkKG5ld1BvaW50ZXJJbmRle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udEZpdHMoKSkpIHsKLSAgICAgICAgICAgICAgICBtVG91Y2hNb2RlID0gVE9VQ0hfTU9ERV9PVkVSRkxJTkc7Ci0gICAgICAgICAgICAgICAgZmluYWwgaW50IHZlbCA9IChpbnQpIG1TY3JvbGxlci5nZXRDdXJyVmVsb2NpdHkoKTsKLSAgICAgICAgICAgICAgICBpZiAoZGVsdGEgPiAwKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1FZGdlR2xvd1RvcC5vbkFic29yYih2ZWwpOwotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIG1FZGdlR2xvd0JvdHRvbS5vbkFic29yYih2ZWwpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGludmFsaWRhdGUoKTsKLSAgICAgICAgICAgIHBvc3QodGhpcyk7Ci0gICAgICAgIH0KLQogICAgICAgICB2b2lkIHN0YXJ0U2Nyb2xsKGludCBkaXN0YW5jZSwgaW50IGR1cmF0aW9uKSB7CiAgICAgICAgICAgICBpbnQgaW5pdGlhbFkgPSBkaXN0YW5jZSA8IDAgPyBJbnRlZ2VyLk1BWF9WQUxVRSA6IDA7CiAgICAgICAgICAgICBtTGFzdEZsaW5nWSA9IGluaXRpYWxZOwpAQCAtMjgyMyw3ICsyODg3LDcgQEAKICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgICAgIGZpbmFsIE92ZXJTY3JvbGxlciBzY3JvbGxlciA9IG1TY3JvbGxlcjsKKyAgICAgICAgICAgICAgICBmaW5hbCBTY3JvbGxlciBzY3JvbGxlciA9IG1TY3JvbGxlcjsKICAgICAgICAgICAgICAgICBib29sZWFuIG1vcmUgPSBzY3JvbGxlci5jb21wdXRlU2Nyb2xsT2Zmc2V0KCk7CiAgICAgICAgICAgICAgICAgZmluYWwgaW50IHkgPSBzY3JvbGxlci5nZXRDdXJyWSgpOwogCkBAIC0yODUyLDI0ICsyOTE2LDcgQEAKICAgICAgICAgICAgICAgICAgICAgZGVsdGEgPSBNYXRoLm1heCgtKGdldEhlaWdodCgpIC0gbVBhZGRpbmdCb3R0b20gLSBtUGFkZGluZ1RvcCAtIDEpLCBkZWx0YSk7CiAgICAgICAgICAgICAgICAgfQogCi0gICAgICAgICAgICAgICAgLy8gQ2hlY2sgdG8gc2VlIGlmIHdlIGhhdmUgYnVtcGVkIGludG8gdGhlIHNjcm9sbCBsaW1pdAotICAgICAgICAgICAgICAgIFZpZXcgbW90aW9uVmlldyA9IGdldENoaWxkQXQobU1vdGlvblBvc2l0aW9uIC0gbUZpcnN0UG9zaXRpb24pOwotICAgICAgICAgICAgICAgIGludCBvbGRUb3AgPSAwOwotICAgICAgICAgICAgICAgIGlmIChtb3Rpb25WaWV3ICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgb2xkVG9wID0gbW90aW9uVmlldy5nZXRUb3AoKTsKLSAgICAgICAgICAgICAgICB9Ci0KICAgICAgICAgICAgICAgICBmaW5hbCBib29sZWFuIGF0RW5kID0gdHJhY2tNb3Rpb25TY3JvbGwoZGVsdGEsIGRlbHRhKTsKLSAgICAgICAgICAgICAgICBpZiAoYXRFbmQpIHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKG1vdGlvblZpZXcgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICAgICAgLy8gVHdlYWsgdGhlIHNjcm9sbCBmb3IgaG93IGZhciB3ZSBvdmVyc2hvdAotICAgICAgICAgICAgICAgICAgICAgICAgaW50IG92ZXJzaG9vdCA9IC0oZGVsdGEgLSAobW90aW9uVmlldy5nZXRUb3AoKSAtIG9sZFRvcCkpOwotICAgICAgICAgICAgICAgICAgICAgICAgb3ZlcnNjcm9sbEJ5KDAsIG92ZXJzaG9vdCwgMCwgbVNjcm9sbFksIDAsIDAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAsIG1PdmVyZmxpbmdEaXN0YW5jZSwgZmFsc2UpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIGVkZ2VSZWFjaGVkKGRlbHRhKTsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgfQogCiAgICAgICAgICAgICAgICAgaWYgKG1vcmUgJiYgIWF0RW5kKSB7CiAgICAgICAgICAgICAgICAgICAgIGludmFsaWRhdGUoKTsKQEAgLTI4ODcsMjQgKzI5MzQsNiBAQAogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgY2FzZSBUT1VDSF9NT0RFX09WRVJGTElORzogewotICAgICAgICAgICAgICAgIGZpbmFsIE92ZXJTY3JvbGxlciBzY3JvbGxlciA9IG1TY3JvbGxlcjsKLSAgICAgICAgICAgICAgICBpZiAoc2Nyb2xsZXIuY29tcHV0ZVNjcm9sbE9mZnNldCgpKSB7Ci0gICAgICAgICAgICAgICAgICAgIGZpbmFsIGludCBzY3JvbGxZID0gbVNjcm9sbFk7Ci0gICAgICAgICAgICAgICAgICAgIGZpbmFsIGludCBkZWx0YVkgPSBzY3JvbGxlci5nZXRDdXJyWSgpIC0gc2Nyb2xsWTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKG92ZXJzY3JvbGxCeSgwLCBkZWx0YVksIDAsIHNjcm9sbFksIDAsIDAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgMCwgbU92ZXJmbGluZ0Rpc3RhbmNlLCBmYWxzZSkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHN0YXJ0U3ByaW5nYmFjaygpOwotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgaW52YWxpZGF0ZSgpOwotICAgICAgICAgICAgICAgICAgICAgICAgcG9zdCh0aGlzKTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIGVuZEZsaW5nKCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogCiAgICAgICAgIH0KQEAgLTI5MTgsNiArMjk0Nyw3IEBACiAgICAgICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBNT1ZFX1VQX1BPUyA9IDI7CiAgICAgICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBNT1ZFX0RPV05fQk9VTkQgPSAzOwogICAgICAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgTU9WRV9VUF9CT1VORCA9IDQ7CisgICAgICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBNT1ZFX09GRlNFVCA9IDU7CiAgICAgICAgIAogICAgICAgICBwcml2YXRlIGludCBtTW9kZTsKICAgICAgICAgcHJpdmF0ZSBpbnQgbVRhcmdldFBvczsKQEAgLTI5MjUsNiArMjk1NSw4IEBACiAgICAgICAgIHByaXZhdGUgaW50IG1MYXN0U2VlblBvczsKICAgICAgICAgcHJpdmF0ZSBpbnQgbVNjcm9sbER1cmF0aW9uOwogICAgICAgICBwcml2YXRlIGZpbmFsIGludCBtRXh0cmFTY3JvbGw7CisKKyAgICAgICAgcHJpdmF0ZSBpbnQgbU9mZnNldEZyb21Ub3A7CiAgICAgICAgIAogICAgICAgICBQb3NpdGlvblNjcm9sbGVyKCkgewogICAgICAgICAgICAgbUV4dHJhU2Nyb2xsID0gVmlld0NvbmZpZ3VyYXRpb24uZ2V0KG1Db250ZXh0KS5nZXRTY2FsZWRGYWRpbmdFZGdlTGVuZ3RoKCk7CkBAIC0zMDE2LDEyICszMDQ4LDQ2IEBACiAgICAgICAgICAgICAKICAgICAgICAgICAgIHBvc3QodGhpcyk7CiAgICAgICAgIH0KLSAgICAgICAgCisKKyAgICAgICAgdm9pZCBzdGFydFdpdGhPZmZzZXQoaW50IHBvc2l0aW9uLCBpbnQgb2Zmc2V0KSB7CisgICAgICAgICAgICBtVGFyZ2V0UG9zID0gcG9zaXRpb247CisgICAgICAgICAgICBtT2Zmc2V0RnJvbVRvcCA9IG9mZnNldDsKKyAgICAgICAgICAgIG1Cb3VuZFBvcyA9IElOVkFMSURfUE9TSVRJT047CisgICAgICAgICAgICBtTGFzdFNlZW5Qb3MgPSBJTlZBTElEX1BPU0lUSU9OOworICAgICAgICAgICAgbU1vZGUgPSBNT1ZFX09GRlNFVDsKKworICAgICAgICAgICAgZmluYWwgaW50IGZpcnN0UG9zID0gbUZpcnN0UG9zaXRpb247CisgICAgICAgICAgICBmaW5hbCBpbnQgY2hpbGRDb3VudCA9IGdldENoaWxkQ291bnQoKTsKKyAgICAgICAgICAgIGZpbmFsIGludCBsYXN0UG9zID0gZmlyc3RQb3MgKyBjaGlsZENvdW50IC0gMTsKKworICAgICAgICAgICAgaW50IHZpZXdUcmF2ZWxDb3VudCA9IDA7CisgICAgICAgICAgICBpZiAocG9zaXRpb24gPCBmaXJzdFBvcykgeworICAgICAgICAgICAgICAgIHZpZXdUcmF2ZWxDb3VudCA9IGZpcnN0UG9zIC0gcG9zaXRpb247CisgICAgICAgICAgICB9IGVsc2UgaWYgKHBvc2l0aW9uID4gbGFzdFBvcykgeworICAgICAgICAgICAgICAgIHZpZXdUcmF2ZWxDb3VudCA9IHBvc2l0aW9uIC0gbGFzdFBvczsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgLy8gT24tc2NyZWVuLCBqdXN0IHNjcm9sbC4KKyAgICAgICAgICAgICAgICBmaW5hbCBpbnQgdGFyZ2V0VG9wID0gZ2V0Q2hpbGRBdChwb3NpdGlvbiAtIGZpcnN0UG9zKS5nZXRUb3AoKTsKKyAgICAgICAgICAgICAgICBzbW9vdGhTY3JvbGxCeSh0YXJnZXRUb3AgLSBvZmZzZXQsIFNDUk9MTF9EVVJBVElPTik7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvLyBFc3RpbWF0ZSBob3cgbWFueSBzY3JlZW5zIHdlIHNob3VsZCB0cmF2ZWwKKyAgICAgICAgICAgIGZpbmFsIGZsb2F0IHNjcmVlblRyYXZlbENvdW50ID0gKGZsb2F0KSB2aWV3VHJhdmVsQ291bnQgLyBjaGlsZENvdW50OworICAgICAgICAgICAgbVNjcm9sbER1cmF0aW9uID0gKGludCkgKFNDUk9MTF9EVVJBVElPTiAvIHNjcmVlblRyYXZlbENvdW50KTsKKyAgICAgICAgICAgIG1MYXN0U2VlblBvcyA9IElOVkFMSURfUE9TSVRJT047CisgICAgICAgICAgICBwb3N0KHRoaXMpOworICAgICAgICB9CisKICAgICAgICAgdm9pZCBzdG9wKCkgewogICAgICAgICAgICAgcmVtb3ZlQ2FsbGJhY2tzKHRoaXMpOwogICAgICAgICB9Ci0gICAgICAgIAorCiAgICAgICAgIHB1YmxpYyB2b2lkIHJ1bigpIHsKKyAgICAgICAgICAgIGlmIChtVG91Y2hNb2RlICE9IFRPVUNIX01PREVfRkxJTkcgJiYgbUxhc3RTZWVuUG9zICE9IElOVkFMSURfUE9TSVRJT04pIHsKKyAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICB9CisKICAgICAgICAgICAgIGZpbmFsIGludCBsaXN0SGVpZ2h0ID0gZ2V0SGVpZ2h0KCk7CiAgICAgICAgICAgICBmaW5hbCBpbnQgZmlyc3RQb3MgPSBtRmlyc3RQb3NpdGlvbjsKICAgICAgICAgICAgIApAQCAtMzE0Niw2ICszMjEyLDI3IEBACiAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICB9CiAKKyAgICAgICAgICAgIGNhc2UgTU9WRV9PRkZTRVQ6IHsKKyAgICAgICAgICAgICAgICBmaW5hbCBpbnQgY2hpbGRDb3VudCA9IGdldENoaWxkQ291bnQoKTsKKworICAgICAgICAgICAgICAgIG1MYXN0U2VlblBvcyA9IGZpcnN0UG9zOworICAgICAgICAgICAgICAgIGZpbmFsIGludCBwb3NpdGlvbiA9IG1UYXJnZXRQb3M7CisgICAgICAgICAgICAgICAgZmluYWwgaW50IGxhc3RQb3MgPSBmaXJzdFBvcyArIGNoaWxkQ291bnQgLSAxOworCisgICAgICAgICAgICAgICAgaWYgKHBvc2l0aW9uIDwgZmlyc3RQb3MpIHsKKyAgICAgICAgICAgICAgICAgICAgc21vb3RoU2Nyb2xsQnkoLWdldEhlaWdodCgpLCBtU2Nyb2xsRHVyYXRpb24pOworICAgICAgICAgICAgICAgICAgICBwb3N0KHRoaXMpOworICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAocG9zaXRpb24gPiBsYXN0UG9zKSB7CisgICAgICAgICAgICAgICAgICAgIHNtb290aFNjcm9sbEJ5KGdldEhlaWdodCgpLCBtU2Nyb2xsRHVyYXRpb24pOworICAgICAgICAgICAgICAgICAgICBwb3N0KHRoaXMpOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIC8vIE9uLXNjcmVlbiwganVzdCBzY3JvbGwuCisgICAgICAgICAgICAgICAgICAgIGZpbmFsIGludCB0YXJnZXRUb3AgPSBnZXRDaGlsZEF0KHBvc2l0aW9uIC0gZmlyc3RQb3MpLmdldFRvcCgpOworICAgICAgICAgICAgICAgICAgICBzbW9vdGhTY3JvbGxCeSh0YXJnZXRUb3AgLSBtT2Zmc2V0RnJvbVRvcCwgbVNjcm9sbER1cmF0aW9uKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisKICAgICAgICAgICAgIGRlZmF1bHQ6CiAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICB9CkBAIC0zMTY1LDYgKzMyNTIsMjQgQEAKICAgICB9CiAgICAgCiAgICAgLyoqCisgICAgICogU21vb3RobHkgc2Nyb2xsIHRvIHRoZSBzcGVjaWZpZWQgYWRhcHRlciBwb3NpdGlvbi4gV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hcHRlciBwb3NpdGlvbi4gVGhlIHZpZXcgd2lsbAogICAgICAqIHNjcm9sbCBzdWNoIHRoYXQgdGhlIGluZGljYXRlZCBwb3NpdGlvbiBpcyBkaXNwbGF5ZWQsIGJ1dCBpdCB3aWxsCiAgICAgICogc3RvcCBlYXJseSBpZiBzY3JvbGxpbmcgZnVydGhlciB3b3VsZCBzY3JvbGwgYm91bmRQb3NpdGlvbiBvdXQgb2YKQEAgLTMxOTQsNiArMzI5OSw0MiBAQAogICAgICAgICBtRmxpbmdSdW5uYWJsZS5zdGFydFNjcm9sbChkaXN0YW5jZSwgZHVyYXRpb24pOwogICAgIH0KIAorICAgIC8qKgorICAgICAqIEFsbG93cyBSZW1vdGVWaWV3cyB0byBzY3JvbGwgcmVsYXRpdmVseSB0byBhIHBvc2l0aW9uLgorICAgICAqLworICAgIHZvaWQgc21vb3RoU2Nyb2xsQnlPZmZzZXQoaW50IHBvc2l0aW9uKSB7CisgICAgICAgIGludCBpbmRleCA9IC0xOworICAgICAgICBpZiAocG9zaXRpb24gPCAwKSB7CisgICAgICAgICAgICBpbmRleCA9IGdldEZpcnN0VmlzaWJsZVBvc2l0aW9uKCk7CisgICAgICAgIH0gZWxzZSBpZiAocG9zaXRpb24gPiAwKSB7CisgICAgICAgICAgICBpbmRleCA9IGdldExhc3RWaXNpYmxlUG9zaXRpb24oKTsKKyAgICAgICAgfQorCisgICAgICAgIGlmIChpbmRleCA+IC0xKSB7CisgICAgICAgICAgICBWaWV3IGNoaWxkID0gZ2V0Q2hpbGRBdChpbmRleCAtIGdldEZpcnN0VmlzaWJsZVBvc2l0aW9uKCkpOworICAgICAgICAgICAgaWYgKGNoaWxkICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBSZWN0IHZpc2libGVSZWN0ID0gbmV3IFJlY3QoKTsKKyAgICAgICAgICAgICAgICBpZiAoY2hpbGQuZ2V0R2xvYmFsVmlzaWJsZVJlY3QodmlzaWJsZVJlY3QpKSB7CisgICAgICAgICAgICAgICAgICAgIC8vIHRoZSBjaGlsZCBpcyBwYXJ0aWFsbHkgdmlzaWJsZQorICAgICAgICAgICAgICAgICAgICBpbnQgY2hpbGRSZWN0QXJlYSA9IGNoaWxkLmdldFdpZHRoKCkgKiBjaGlsZC5nZXRIZWlnaHQoKTsKKyAgICAgICAgICAgICAgICAgICAgaW50IHZpc2libGVSZWN0QXJlYSA9IHZpc2libGVSZWN0LndpZHRoKCkgKiB2aXNpYmxlUmVjdC5oZWlnaHQoKTsKKyAgICAgICAgICAgICAgICAgICAgZmxvYXQgdmlzaWJsZUFyZWEgPSAodmlzaWJsZVJlY3RBcmVhIC8gKGZsb2F0KSBjaGlsZFJlY3RBcmVhKTsKKyAgICAgICAgICAgICAgICAgICAgZmluYWwgZmxvYXQgdmlzaWJsZVRocmVzaG9sZCA9IDAuNzVmOworICAgICAgICAgICAgICAgICAgICBpZiAoKHBvc2l0aW9uIDwgMCkgJiYgKHZpc2libGVBcmVhIDwgdmlzaWJsZVRocmVzaG9sZCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIHRoZSB0b3AgaW5kZXggaXMgbm90IHBlcmNlaXZhYmx5IHZpc2libGUgc28gb2Zmc2V0CisgICAgICAgICAgICAgICAgICAgICAgICAvLyB0byBhY2NvdW50IGZvciBzaG93aW5nIHRoYXQgdG9wIGluZGV4IGFzIHdlbGwKKyAgICAgICAgICAgICAgICAgICAgICAgICsraW5kZXg7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoKHBvc2l0aW9uID4gMCkgJiYgKHZpc2libGVBcmVhIDwgdmlzaWJsZVRocmVzaG9sZCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIHRoZSBib3R0b20gaW5kZXggaXMgbm90IHBlcmNlaXZhYmx5IHZpc2libGUgc28gb2Zmc2V0CisgICAgICAgICAgICAgICAgICAgICAgICAvLyB0byBhY2NvdW50IGZvciBzaG93aW5nIHRoYXQgYm90dG9tIGluZGV4IGFzIHdl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BzZXRXcmFwcGVkKE11bHRpQ2hvaWNlTW9kZUxpc3RlbmVyIHdyYXBwZWQpIHsKKyAgICAgICAgICAgIG1XcmFwcGVkID0gd3JhcHBlZDsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBib29sZWFuIG9uQ3JlYXRlQWN0aW9uTW9kZShBY3Rpb25Nb2RlIG1vZGUsIE1lbnUgbWVudSkgeworICAgICAgICAgICAgaWYgKG1XcmFwcGVkLm9uQ3JlYXRlQWN0aW9uTW9kZShtb2RlLCBtZW51KSkgeworICAgICAgICAgICAgICAgIC8vIEluaXRpYWxpemUgY2hlY2tlZCBncmFwaGljIHN0YXRlPworICAgICAgICAgICAgICAgIHNldExvbmdDbGlja2FibGUoZmFsc2UpOworICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGJvb2xlYW4gb25QcmVwYXJlQWN0aW9uTW9kZShBY3Rpb25Nb2RlIG1vZGUsIE1lbnUgbWVudSkgeworICAgICAgICAgICAgcmV0dXJuIG1XcmFwcGVkLm9uUHJlcGFyZUFjdGlvbk1vZGUobW9kZSwgbWVudSk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgYm9vbGVhbiBvbkFjdGlvbkl0ZW1DbGlja2VkKEFjdGlvbk1vZGUgbW9kZSwgTWVudUl0ZW0gaXRlbSkgeworICAgICAgICAgICAgcmV0dXJuIG1XcmFwcGVkLm9uQWN0aW9uSXRlbUNsaWNrZWQobW9kZSwgaXRlbSk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBvbkRlc3Ryb3lBY3Rpb25Nb2RlKEFjdGlvbk1vZGUgbW9kZSkgeworICAgICAgICAgICAgbVdyYXBwZWQub25EZXN0cm95QWN0aW9uTW9kZShtb2RlKTsKKyAgICAgICAgICAgIG1DaG9pY2VBY3Rpb25Nb2RlID0gbnVsb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yArNDgzMCw3IEBACiAgICAgICAgICAgICAgICAgICAgIGZpbmFsIEFycmF5TGlzdDxWaWV3PiBzY3JhcCA9IG1TY3JhcFZpZXdzW2ldOwogICAgICAgICAgICAgICAgICAgICBmaW5hbCBpbnQgc2NyYXBDb3VudCA9IHNjcmFwLnNpemUoKTsKICAgICAgICAgICAgICAgICAgICAgZm9yIChpbnQgaiA9IDA7IGogPCBzY3JhcENvdW50OyBqKyspIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHNjcmFwLmdldChpKS5zZXREcmF3aW5nQ2FjaGVCYWNrZ3JvdW5kQ29sb3IoY29sb3IpOworICAgICAgICAgICAgICAgICAgICAgICAgc2NyYXAuZ2V0KGopLnNldERyYXdpbmdDYWNoZUJhY2tncm91bmRDb2xvcihjb2xvcik7CiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CmRpZmYgLS1naXQgYS9jb3JlL2phdmEvYW5kcm9pZC93aWRnZXQvQWRhcHRlclZpZXcuamF2YSBiL2NvcmUvamF2YS9hbmRyb2lkL3dpZGdldC9BZGFwdGVyVmlldy5qYXZhCmluZGV4IDhmY2MyZTguLmFiNzU0MjAgMTAwNjQ0Ci0tLSBhL2NvcmUvamF2YS9hbmRyb2lkL3dpZGdldC9BZGFwdGVyVmlldy5qYXZhCisrKyBiL2NvcmUvamF2YS9hbmRyb2lkL3dpZGdldC9BZGFwdGVyVmlldy5qYXZhCkBAIC0yMjgsNyArMjI4LDYgQEAKICAgICAgICAgc3VwZXIoY29udGV4dCwgYXR0cnMsIGRlZlN0eWxlKTsKICAgICB9CiAKLQogICAgIC8qKgogICAgICAqIEludGVyZmFjZSBkZWZpbml0aW9uIGZvciBhIGNhbGxiYWNrIHRvIGJlIGludm9rZWQgd2hlbiBhbiBpdGVtIGluIHRoaXMKICAgICAgKiBBZGFwdGVyVmlldyBoYXMgYmVlbiBjbGlja2VkLgpAQCAtNjI5LDYgKzYyOCw3IEBAC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MaXN0PFZpZXc+IG1WaWV3c1RvQnJpbmdUb0Zyb250OworCisgICAgcHVibGljIEFkYXB0ZXJWaWV3QW5pbWF0b3IoQ29udGV4dCBjb250ZXh0KSB7CisgICAgICAgIHN1cGVyKGNvbnRleHQpOworICAgICAgICBpbml0Vmlld0FuaW1hdG9yKCk7CisgICAgfQorCisgICAgcHVibGljIEFkYXB0ZXJWaWV3QW5pbWF0b3IoQ29udGV4dCBjb250ZXh0LCBBdHRyaWJ1dGVTZXQgYXR0cnMpIHsKKyAgICAgICAgc3VwZXIoY29udGV4dCwgYXR0cnMpOworCisgICAgICAgIFR5cGVkQXJyYXkgYSA9IGNvbnRleHQub2J0YWluU3R5bGVkQXR0cmlidXRlcyhhdHRycywKKyAgICAgICAgICAgICAgICBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5WaWV3QW5pbWF0b3IpOworICAgICAgICBpbnQgcmVzb3VyY2UgPSBhLmdldFJlc291cmNlSWQoCisgICAgICAgICAgICAgICAgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuVmlld0FuaW1hdG9yX2luQW5pbWF0aW9uLCAwKTsKKyAgICAgICAgaWYgKHJlc291cmNlID4gMCkgeworICAgICAgICAgICAgc2V0SW5BbmltYXRpb24oY29udGV4dCwgcmVzb3VyY2UpOworICAgICAgICB9CisKKyAgICAgICAgcmVzb3VyY2UgPSBhLmdldFJlc291cmNlSWQoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuVmlld0FuaW1hdG9yX291dEFuaW1hdGlvbiwgMCk7CisgICAgICAgIGlmIChyZXNvdXJjZSA+IDApIHsKKyAgICAgICAgICAgIHNldE91dEFuaW1hdGlvbihjb250ZXh0LCByZXNvdXJjZSk7CisgICAgICAgIH0KKworICAgICAgICBib29sZWFuIGZsYWcgPSBhLmdldEJvb2xlYW4oCisgICAgICAgICAgICAgICAgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zd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oMC4wZik7CisgICAgICAgICAgICBwYSA9IG5ldyBQcm9wZXJ0eUFuaW1hdG9yKDQwMCwgdmlldywgImFscGhhIiwgMC4wZiwgMS4wZik7CisgICAgICAgICAgICBwYS5zdGFydCgpOworICAgICAgICB9IGVsc2UgaWYgKHRvSW5kZXggPT0gLTEpIHsKKyAgICAgICAgICAgIHBhID0gbmV3IFByb3BlcnR5QW5pbWF0b3IoNDAwLCB2aWV3LCAiYWxwaGEiLCAxLjBmLCAwLjBmKTsKKyAgICAgICAgICAgIHBhLnN0YXJ0KCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBTZXRzIHdoaWNoIGNoaWxkIHZpZXcgd2lsbCBiZSBkaXNwbGF5ZWQuCisgICAgICoKKyAgICAgKiBAcGFyYW0gd2hpY2hDaGlsZCB0aGUgaW5kZXggb2YgdGhlIGNoaWxkIHZpZXcgdG8gZGlzcGxheQorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNldERpc3BsYXllZENoaWxkKGludCB3aGljaENoaWxkKSB7CisgICAgICAgIGlmIChtQWRhcHRlciAhPSBudWxsKSB7CisgICAgICAgICAgICBtV2hpY2hDaGlsZCA9IHdoaWNoQ2hpbGQ7CisgICAgICAgICAgICBpZiAod2hpY2hDaGlsZCA+PSBtQWRhcHRlci5nZXRDb3VudCgpKSB7CisgICAgICAgICAgICAgICAgbVdoaWNoQ2hpbGQgPSBtU2hvdWxkTG9vcCA/IDAgOiBtQWRhcHRlci5nZXRDb3VudCgpIC0gMTsKKyAgICAgICAgICAgIH0gZWxzZSBpZiAod2hpY2hDaGlsZCA8IDApIHsKKyAgICAgICAgICAgICAgICBtV2hpY2hDaGlsZCA9IG1TaG91bGRMb29wID8gbUFkYXB0ZXIuZ2V0Q291bnQoKSAtIDEgOiAwOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBib29sZWFuIGhhc0ZvY3VzID0gZ2V0Rm9jdXNlZENoaWxkKCkgIT0gbnVsbDsKKyAgICAgICAgICAgIC8vIFRoaXMgd2lsbCBjbGVhciBvbGQgZm9jdXMgaWYgd2UgaGFkIGl0CisgICAgICAgICAgICBzaG93T25seShtV2hpY2hDaGlsZCk7CisgICAgICAgICAgICBpZiAoaGFzRm9jdXMpIHsKKyAgICAgICAgICAgICAgICAvLyBUcnkgdG8gcmV0YWtlIGZvY3VzIGlmIHdlIGhhZCBpdAorICAgICAgICAgICAgICAgIHJlcXVlc3RGb2N1cyhGT0NVU19GT1JXQVJEKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIFJldHVybiBkZWZhdWx0IGluQW5pbWF0aW9uLiBUbyBiZSBvdmVycmlkZW4gYnkgc3ViY2xhc3Nlcy4KKyAgICAgKi8KKyAgICBBbmltYXRpb24gZ2V0RGVmYXVsdEluQW5pbWF0aW9uKCkgeworICAgICAgICByZXR1cm4gbnVsbDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZXR1cm4gZGVmYXVsdCBvdXRBbmltYXRpb24uIFRvIGJlIG92ZXJyaWRkZW4gYnkgc3ViY2xhc3Nlcy4KKyAgICAgKi8KKyAgICBBbmltYXRpb24gZ2V0RGVmYXVsdE91dEFuaW1hdGlvbigpIHsKKyAgICAgICAgcmV0dXJuIG51bGw7CisgICAgfQorCisgICAgLyoqCisgICAgICogVG8gYmUgb3ZlcnJpZGRlbiBieSBzdWJjbGFzc2VzLiBUaGlzIG1ldGhvZCBhcHBsaWVzIGEgdmlldyAvIGluZGV4IHNwZWNpZmljCisgICAgICogdHJhbnNmb3JtIHRvIHRoZSBjaGlsZCB2aWV3LgorICAgICAqCisgICAgICogQHBhcmFtIGNoaWxkCisgICAgICogQHBhcmFtIHJlbGF0aXZlSW5kZXgKKyAgICAgKi8KKyAgICB2b2lkIGFwcGx5VHJhbnNmb3JtRm9yQ2hpbGRBdEluZGV4KFZpZXcgY2hpbGQsIGludCByZWxhdGl2ZUluZGV4KSB7CisgICAgfQorCisgICAgLyoqCisgICAgICogUmV0dXJucyB0aGUgaW5kZXggb2YgdGhlIGN1cnJlbnRseSBkaXNwbGF5ZWQgY2hpbGQgdmlldy4KKyAgICAgKi8KKyAgICBwdWJsaWMgaW50IGdldERpc3BsYXllZENoaWxkKCkgeworICAgICAgICByZXR1cm4gbVdoaWNoQ2hpbGQ7CisgICAgfQorCisgICAgLyoqCisgICAgICogTWFudWFsbHkgc2hvd3MgdGhlIG5leHQgY2hpbGQuCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2hvd05leHQoKSB7CisgICAgICAgIHNldERpc3BsYXllZENoaWxkKG1XaGljaENoaWxkICsgMSk7CisgICAgfQorCisgICAgLyoqCisgICAgICogTWFudWFsbHkgc2hvd3MgdGhlIHByZXZpb3VzIGNoaWxkLgorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNob3dQcmV2aW91cygpIHsKKyAgICAgICAgc2V0RGlzcGxheWVkQ2hpbGQobVdoaWNoQ2hpbGQgLSAxKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBTaG93cyBvbmx5IHRoZSBzcGVjaWZpZWQgY2hpbGQuIFRoZSBvdGhlciBkaXNwbGF5cyBWaWV3cyBleGl0IHRoZSBzY3JlZW4sCisgICAgICogb3B0aW9uYWxseSB3aXRoIHRoZSB3aXRoIHRoZSB7QGxpbmsgI2dldE91dEFuaW1hdGlvbigpIG91dCBhbmltYXRpb259IGFuZAorICAgICAqIHRoZSBzcGVjaWZpZWQgY2hpbGQgZW50ZXJzIHRoZSBzY3JlZW4sIG9wdGlvbmFsbHkgd2l0aCB0aGUKKyAgICAgKiB7QGxpbmsgI2dldEluQW5pbWF0aW9uKCkgaW4gYW5pbWF0aW9ufS4KKyAgICAgKgorICAgICAqIEBwYXJhbSBjaGlsZEluZGV4IFRoZSBpbmRleCBvZiB0aGUgY2hpbGQgdG8gYmUgc2hvd24uCisgICAgICogQHBhcmFtIGFuaW1hdGUgV2hldGhlciBvciBub3QgdG8gdXNlIHRoZSBpbiBhbmQgb3V0IGFuaW1hdGlvbnMsIGRlZmF1bHRzCisgICAgICogICAgICAgICAgICB0byB0cnVlLgorICAgICAqLworICAgIHZvaWQgc2hvd09ubHkoaW50IGNoaWxkSW5kZXgsIGJvb2xlYW4gYW5pbWF0ZSkgeworICAgICAgICBzaG93T25seShjaGlsZEluZGV4LCBhbmltYXRlLCBmYWxzZSk7CisgICAgfQorCisgICAgcHJpdmF0ZSBpbnQgbW9kdWxvKGludCBwb3MsIGludCBzaXplKSB7CisgICAgICAgIHJldHVybiAoc2l6ZSArIChwb3MgJSBzaXplKSkgJSBzaXplOworICAgIH0KKworICAgIC8qKgorICAgICAqIEdldCB0aGUgdmlldyBhdCB0aGlzIGluZGV4IHJlbGF0aXZlIHRvIHRoZSBjdXJyZW50IHdpbmRvdydzIHN0YXJ0CisgICAgICoKKyAgICAgKiBAcGFyYW0gcmVsYXRpdmVJbmRleCBQb3NpdGlvbiByZWxhdGl2ZSB0byB0aGUgY3VycmVudCB3aW5kb3cncyBzdGFydAorICAgICAqIEByZXR1cm4gVmlldyBhdCB0aGlzIGluZGV4LCBudWxsIGlmIHRoZSBpbmRleCBpcyBvdXRzaWRlIHRoZSBib3VuZHMKKyAgICAgKi8KKyAgICBWaWV3IGdldFZpZXdBdFJlbGF0aXZlSW5kZXgoaW50IHJlbGF0aXZlSW5kZXgpIHsKKyAgICAgICAgaWYgKHJlbGF0aXZlSW5kZXggPj0gMCAmJiByZWxhdGl2ZUluZGV4IDw9IG1OdW1BY3RpdmVWaWV3cyAtIDEpIHsKKyAgICAgICAgICAgIGludCBpbmRleCA9IG1DdXJyZW50V2luZG93U3RhcnRVbmJvdW5kZWQgKyByZWxhdGl2ZUluZGV4OworICAgICAgICAgICAgcmV0dXJuIG1BY3RpdmVWaWV3c1ttb2R1bG8oaW5kZXgsIG1OdW1BY3RpdmVWaWV3cyldOworICAgICAgICB9CisgICAgICAgIHJldHVybiBudWxsOworICAgIH0KKworICAgIExheW91dFBhcmFt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ZWQgPiBtQWRhcHRlci5nZXRDb3VudCgpIC0gMQorICAgICAgICBmb3IgKGludCBpID0gbmV3V2luZG93U3RhcnRVbmJvdW5kZWQ7IGkgPCBuZXdXaW5kb3dFbmRVbmJvdW5kZWQ7IGkrKykgeworICAgICAgICAgICAgaWYgKGkgPCBuZXdXaW5kb3dTdGFydCB8fCBpID4gbmV3V2luZG93RW5kKSB7CisgICAgICAgICAgICAgICAgaW50IGluZGV4ID0gbW9kdWxvKGksIG1OdW1BY3RpdmVWaWV3cyk7CisgICAgICAgICAgICAgICAgaWYgKG1BY3RpdmVWaWV3c1tpbmRleF0gIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBWaWV3IHByZXZpb3VzVmlldyA9IG1BY3RpdmVWaWV3c1tpbmRleF07CisgICAgICAgICAgICAgICAgICAgIG1QcmV2aW91c1ZpZXdzLmFkZChwcmV2aW91c1ZpZXcpOworICAgICAgICAgICAgICAgICAgICBpbnQgcHJldmlvdXNWaWV3UmVsYXRpdmVJbmRleCA9IG1vZHVsbyhpbmRleCAtIG1DdXJyZW50V2luZG93U3RhcnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbU51bUFjdGl2ZVZpZXdzKTsKKyAgICAgICAgICAgICAgICAgICAgYW5pbWF0ZVZpZXdGb3JUcmFuc2l0aW9uKHByZXZpb3VzVmlld1JlbGF0aXZlSW5kZXgsIC0xLCBwcmV2aW91c1ZpZXcpOworICAgICAgICAgICAgICAgICAgICBtQWN0aXZlVmlld3NbaW5kZXhdID0gbnVsbDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICAvLyBJZiB0aGUgd2luZG93IGhhcyBjaGFuZ2VkCisgICAgICAgIGlmICghIChuZXdXaW5kb3dTdGFydCA9PSBtQ3VycmVudFdpbmRvd1N0YXJ0ICYmIG5ld1dpbmRvd0VuZCA9PSBtQ3VycmVudFdpbmRvd0VuZCkpIHsKKyAgICAgICAgICAgIC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mVJbmRleCwgdmlldyk7CisKKyAgICAgICAgICAgICAgICAvLyBPdGhlcndpc2UgdGhpcyB2aWV3IGlzIG5ldywgc28gZmlyc3Qgd2UgaGF2ZSB0byBkaXNwbGFjZSB0aGUgdmlldyB0aGF0J3MKKyAgICAgICAgICAgICAgICAvLyB0YWtpbmcgdGhlIG5ldyB2aWV3J3MgcGxhY2Ugd2l0aGluIG91ciBjYWNoZSAoYSBjaXJjdWxhciBhcnJheSkKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICBpZiAobUFjdGl2ZVZpZXdzW2luZGV4XSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBWaWV3IHByZXZpb3VzVmlldyA9IG1BY3RpdmVWaWV3c1tpbmRleF07CisgICAgICAgICAgICAgICAgICAgICAgICBtUHJldmlvdXNWaWV3cy5hZGQocHJldmlvdXNWaWV3KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGludCBwcmV2aW91c1ZpZXdSZWxhdGl2ZUluZGV4ID0gbW9kdWxvKGluZGV4IC0gbUN1cnJlbnRXaW5kb3dTdGFydCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbU51bUFjdGl2ZVZpZXdzKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGFuaW1hdGVWaWV3Rm9yVHJhbnNpdGlvbihwcmV2aW91c1ZpZXdSZWxhdGl2ZUluZGV4LCAtMSwgcHJldmlvdXNWaWV3KTsKKworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1DdXJyZW50V2luZG93U3RhcnQgPiBuZXdXaW5kb3dTdGFydCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1WaWV3c1RvQnJpbmdUb0Zyb250LmFkZChwcmV2aW91c1ZpZXcpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgLy8gV2UndmUgY2xlYXJlZCBhIHNwb3QgZm9yIHRoZSBuZXcgdmlldy4gR2V0IGl0IGZyb20gdGhlIGFkYXB0ZXIsIGFkZCBpdAorICAgICAgICAgICAgICAgICAgICAvLyBhbmQgYXBwbHkgYW55IHRyYW5zZm9ybSAvIGFuaW1hdGlvbgorICAgICAgICAgICAgICAgICAgICBWaWV3IG5ld1ZpZXcgPSBtQWRhcHRlci5nZXRWaWV3KGksIG51bGwsIHRoaXMpOworICAgICAgICAgICAgICAgICAgICBpZiAobmV3VmlldyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAvLyBXZSB3cmFwIHRoZSBuZXcgdmlldyBpbiBhIEZyYW1lTGF5b3V0IHNvIGFzIHRvIHJlc3BlY3QgdGhlIGNvbnRyYWN0CisgICAgICAgICAgICAgICAgICAgICAgICAvLyB3aXRoIHRoZSBhZGFwdGVyLCB0aGF0IGlzLCB0aGF0IHdlIGRvbid0IG1vZGlmeSB0aGlzIHZpZXcgZGlyZWN0bHkKKyAgICAgICAgICAgICAgICAgICAgICAgIEZyYW1lTGF5b3V0IGZsID0gbmV3IEZyYW1lTGF5b3V0KG1Db250ZXh0KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZsLmFkZFZpZXcobmV3Vmlldyk7CisgICAgICAgICAgICAgICAgICAgICAgICBtQWN0aXZlVmlld3NbaW5kZXhdID0gZmw7CisgICAgICAgICAgICAgICAgICAgICAgICBhZGRDaGlsZChmbCk7CisgICAgICAgICAgICAgICAgICAgICAgICBhcHBseVRyYW5zZm9ybUZvckNoaWxkQXRJbmRleChmbCwgbmV3UmVsYXRpdmVJbmRleCk7CisgICAgICAgICAgICAgICAgICAgICAgICBhbmltYXRlVmlld0ZvclRyYW5zaXRpb24oLTEsIG5ld1JlbGF0aXZlSW5kZXgsIGZsKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBtQWN0aXZlVmlld3NbaW5kZXhdLmJyaW5nVG9Gcm9udCgpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IG1WaWV3c1RvQnJpbmdUb0Zyb250LnNpemUoKTsgaSsrKSB7CisgICAgICAgICAgICAgICAgVmlldyB2ID0gbVZpZXdzVG9CcmluZ1RvRnJvbnQuZ2V0KGkpOworICAgICAgICAgICAgICAgIHYuYnJpbmdUb0Zyb250KCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBtVmlld3NUb0JyaW5nVG9Gcm9udC5jbGVhcigpOworCisgICAgICAgICAgICBtQ3VycmVudFdpbmRvd1N0YXJ0ID0gbmV3V2luZG93U3RhcnQ7CisgICAgICAgICAgICBtQ3VycmVudFdpbmRvd0VuZCA9IG5ld1dpbmRvd0VuZDsKKyAgICAgICAgICAgIG1DdXJyZW50V2luZG93U3RhcnRVbmJvdW5kZWQgPSBuZXdXaW5kb3dTdGFydFVuYm91bmRlZDsKKyAgICAgICAgfQorCisgICAgICAgIG1GaXJzdFRpbWUgPSBmYWxzZTsKKyAgICAgICAgaWYgKCFvbkxheW91dCkgeworICAgICAgICAgICAgcmVxdWVzdExheW91dCgpOworICAgICAgICAgICAgaW52YWxpZGF0ZSgpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgLy8gSWYgdGhlIEFkYXB0ZXIgdHJpZXMgdG8gbGF5b3V0IHRoZSBjdXJyZW50IHZpZXcgd2hlbiB3ZSBnZXQgaXQgdXNpbmcgZ2V0VmlldworICAgICAgICAgICAgLy8gYWJvdmUgdGhlIGxheW91dCB3aWxsIGVuZCB1cCBiZWluZyBpZ25vcmVkIHNpbmNlIHdlIGFyZSBjdXJyZW50bHkgbGF5aW5nIG91dCwgc28KKyAgICAgICAgICAgIC8vIHdlIHBvc3QgYSBkZWxheWVkIHJlcXVlc3RMYXlvdXQgYW5kIGludmFsaWRhdGUKKyAgICAgICAgICAgIG1NYWluUXVldWUucG9zdChuZXcgUnVubmFibGUoKSB7CisgICAgICAgICAgICAgICAgQE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RlcgorICAgICAgICAgICAgLy8gaW4gdGhpcyBjYXNlLCB3ZSByZXNldCBtV2hpY2hDaGlsZCB0byB0aGUgYmVnaW5uaW5nCisgICAgICAgICAgICBpZiAobVdoaWNoQ2hpbGQgPj0gbUFkYXB0ZXIuZ2V0Q291bnQoKSkKKyAgICAgICAgICAgICAgICBtV2hpY2hDaGlsZCA9IDA7CisKKyAgICAgICAgICAgIHNob3dPbmx5KG1XaGljaENoaWxkLCB0cnVlLCB0cnVlKTsKKyAgICAgICAgfQorCisgICAgICAgIGZpbmFsIGludCBjaGlsZENvdW50ID0gZ2V0Q2hpbGRDb3VudCgpOworICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGNoaWxkQ291bnQ7IGkrKykgeworICAgICAgICAgICAgZmluYWwgVmlldyBjaGlsZCA9IGdldENoaWxkQXQoaSk7CisKKyAgICAgICAgICAgIGludCBjaGlsZFJpZ2h0ID0gbVBhZGRpbmdMZWZ0ICsgY2hpbGQuZ2V0TWVhc3VyZWRXaWR0aCgpOworICAgICAgICAgICAgaW50IGNoaWxkQm90dG9tID0gbVBhZGRpbmdUb3AgKyBjaGlsZC5nZXRNZWFzdXJlZEhlaWdodCgpOworCisgICAgICAgICAgICBjaGlsZC5sYXlvdXQobVBhZGRpbmdMZWZ0LCBtUGFkZGluZ1RvcCwgY2hpbGRSaWdodCwgY2hpbGRCb3R0b20pOworICAgICAgICB9CisgICAgICAgIG1EYXRhQ2hhbmdlZCA9IGZhbHNlOworICAgIH0KKworICAgIHN0YXRpYyBjbGFzcyBTYXZlZFN0YXRlIGV4dGVuZHMgQmFzZVNhdmVkU3RhdGUgeworICAgICAgICBpbnQgd2hpY2hDaGlsZDsKKworICAgICAgICAvKioKKyAgICAgICAgICogQ29uc3RydWN0b3IgY2FsbGVkIGZyb20ge0BsaW5rIEFkYXB0ZXJWaWV3QW5pbWF0b3Ijb25TYXZlSW5zdGFuY2VTdGF0ZSgpfQorICAgICAgICAgKi8KKyAgICAgICAgU2F2ZWRTdGF0ZShQYXJjZWxhYmxlIHN1cGVyU3RhdGUsIGludCB3aGljaENoaWxkKSB7CisgICAgICAgICAgICBzdXBlcihzdXBlclN0YXRlKTsKKyAgICAgICAgICAgIHRoaXMud2hpY2hDaGlsZCA9IHdoaWNoQ2hpbGQ7CisgICAgICAgIH0KKworICAgICAgICAvKioKKyAgICAgICAgICogQ29uc3RydWN0b3IgY2FsbGVkIGZyb20ge0BsaW5rICNDUkVBVE9SfQorICAgICAgICAgKi8KKyAgICAgICAgcHJpdmF0ZSBTYXZlZFN0YXRlKFBhcmNlbCBpbikgeworICAgICAgICAgICAgc3VwZXIoaW4pOworICAgICAgICAgICAgd2hpY2hDaGlsZCA9IGluLnJlYWRJbnQoKTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgdm9pZCB3cml0ZVRvUGFyY2VsKFBhcmNlbCBvdXQsIGludCBmbGFncykgeworICAgICAgICAgICAgc3VwZXIud3JpdGVUb1BhcmNlbChvdXQsIGZsYWdzKTsKKyAgICAgICAgICAgIG91dC53cml0ZUludCh3aGljaENoaWxkKTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgU3RyaW5nIHRvU3RyaW5nKCkgeworICAgICAgICAgICAgcmV0dXJuICJBZGFwdGVyVmlld0FuaW1hdG9yLlNhdmVkU3RhdGV7IHdoaWNoQ2hpbGQgPSAiICsgd2hpY2hDaGlsZCArICIgfSI7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFBhcmNlbGFibGUuQ3JlYXRvcjxTYXZlZFN0YXRlPiBDUkVBVE9SCisgICAgICAgICAgICAgICAgPSBuZXcgUGFyY2VsYWJsZS5DcmVhdG9yPFNhdmVkU3RhdGU+KCkgeworICAgICAgICAgICAgcHVibGljIFNhdmVkU3RhdGUgY3JlYXRlRnJvbVBhcmNlbChQYXJjZWwgaW4pIHsKKyAgICAgICA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isgICAgICoKKyAgICAgKiBAc2VlICNzZXRPdXRBbmltYXRpb24oYW5kcm9pZC52aWV3LmFuaW1hdGlvbi5BbmltYXRpb24pCisgICAgICogQHNlZSAjc2V0T3V0QW5pbWF0aW9uKGFuZHJvaWQuY29udGVudC5Db250ZXh0LCBpbnQpCisgICAgICovCisgICAgcHVibGljIEFuaW1hdGlvbiBnZXRPdXRBbmltYXRpb24oKSB7CisgICAgICAgIHJldHVybiBtT3V0QW5pbWF0aW9uOworICAgIH0KKworICAgIC8qKgorICAgICAqIFNwZWNpZmllcyB0aGUgYW5pbWF0aW9uIHVzZWQgdG8gYW5pbWF0ZSBhIFZpZXcgdGhhdCBleGl0IHRoZSBzY3JlZW4uCisgICAgICoKKyAgICAgKiBAcGFyYW0gb3V0QW5pbWF0aW9uIFRoZSBhbmltYXRpb24gc3RhcnRlZCB3aGVuIGEgVmlldyBleGl0IHRoZSBzY3JlZW4uCisgICAgICoKKyAgICAgKiBAc2VlICNnZXRPdXRBbmltYXRpb24oKQorICAgICAqIEBzZWUgI3NldE91dEFuaW1hdGlvbihhbmRyb2lkLmNvbnRlbnQuQ29udGV4dCwgaW50KQorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNldE91dEFuaW1hdGlvbihBbmltYXRpb24gb3V0QW5pbWF0aW9uKSB7CisgICAgICAgIG1PdXRBbmltYXRpb24gPSBvdXRBbmltYXRpb247CisgICAgfQorCisgICAgLyoqCisgICAgICogU3BlY2lmaWVzIHRoZSBhbmltYXRpb24gdXNlZCB0byBhbmltYXRlIGEgVmlldyB0aGF0IGVudGVycyB0aGUgc2NyZWVuLgorICAgICAqCisgICAgICogQHBhcmFtIGNvbnRleHQgVGhlIGFwcGxpY2F0aW9uJ3MgZW52aXJvbm1lbnQuCisgICAgICogQHBhcmFtIHJlc291cmNlSUQgVGhlIHJlc291cmNlIGlkIG9mIHRoZSBhbmltYXRpb24uCisgICAgICoKKyAgICAgKiBAc2VlICNnZXRJbkFuaW1hdGlvbigpCis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Bwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgREVGQVVMVF9BTklNQVRJT05fRFVSQVRJT04gPSAyMDA7CisKKyAgICBwcml2YXRlIGludCBtRmxpcEludGVydmFsID0gREVGQVVMVF9JTlRFUlZBTDsKKyAgICBwcml2YXRlIGludCBtQW5pbWF0aW9uRHVyYXRpb24gPSBERUZBVUxUX0FOSU1BVElPTl9EVVJBVElPTjsKKyAgICBwcml2YXRlIGJvb2xlYW4gbUF1dG9TdGFydCA9IGZhbHNlOworCisgICAgcHJpdmF0ZSBib29sZWFuIG1SdW5uaW5nID0gZmFsc2U7CisgICAgcHJpdmF0ZSBib29sZWFuIG1TdGFydGVkID0gZmFsc2U7CisgICAgcHJpdmF0ZSBib29sZWFuIG1WaXNpYmxlID0gZmFsc2U7CisgICAgcHJpdmF0ZSBib29sZWFuIG1Vc2VyUHJlc2VudCA9IHRydWU7CisKKyAgICBwdWJsaWMgQWRhcHRlclZpZXdGbGlwcGVyKENvbnRleHQgY29udGV4dCkgeworICAgICAgICBzdXBlcihjb250ZXh0KTsKKyAgICAgICAgaW5pdERlZmF1bHRBbmltYXRpb25zKCk7CisgICAgfQorCisgICAgcHVibGljIEFkYXB0ZXJWaWV3RmxpcHBlcihDb250ZXh0IGNvbnRleHQsIEF0dHJpYnV0ZVNldCBhdHRycykgeworICAgICAgICBzdXBlcihjb250ZXh0LCBhdHRycyk7CisKKyAgICAgICAgVHlwZWRBcnJheSBhID0gY29udGV4dC5vYnRhaW5TdHlsZWRBdHRyaWJ1dGVzKGF0dHJzLAorICAgICAgICAgICAgICAgIGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLlZpZXdGbGlwcGVyKTsKKyAgICAgICAgbUZsaXBJbnRlcnZhbCA9IGEuZ2V0SW50KAorICAgICAgICAgICAgICAgIGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLlZpZXdGbGlwcGVyX2ZsaXBJbnRlcnZhbCwgREVGQVVMVF9JTlRFUlZBTCk7CisgICAgICAgIG1BdXRvU3RhcnQgPSBhLmdldEJvb2xlYW4oCisgICAgICAgICAgICAgICAgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuVmlld0ZsaXBwZXJfYXV0b1N0YXJ0LCBmYWxzZSk7CisgICAgICAgIGEucmVjeWNsZSgpOworICAgICAgICBpbml0RGVmYXVsdEFuaW1hdGlvbnMoKTsKKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgaW5pdERlZmF1bHRBbmltYXRpb25zKCkgeworICAgICAgICAvLyBTZXQgdGhlIGRlZmF1bHQgYW5pbWF0aW9ucyB0byBiZSBmYWRlIGluL291dAorICAgICAgICBpZiAobUluQW5pbWF0aW9uID09IG51bGwpIHsKKyAgICAgICAgICAgIG1JbkFuaW1hdGlvbiA9IG5ldyBBbHBoYUFuaW1hdGlvbigwLjBmLCAxLjBmKTsKKyAgICAgICAgICAgIG1JbkFuaW1hdGlvbi5zZXREdXJhdGlvbihtQW5pbWF0aW9uRHVyYXRpb24pOworICAgICAgICB9CisgICAgICAgIGlmIChtT3V0QW5pbWF0aW9uID09IG51bGwpIHsKKyAgICAgICAgICAgIG1PdXRBbmltYXRpb24gPSBuZXcgQWxwaGFBbmltYXRpb24oMS4wZiwgMC4wZik7CisgICAgICAgICAgICBtT3V0QW5pbWF0aW9uLnNldER1cmF0aW9uKG1BbmltYXRpb25EdXJhdGlvbik7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIGZpbmFsIEJyb2FkY2FzdFJlY2VpdmVyIG1SZWNlaXZlciA9IG5ldyBCcm9hZGNhc3RSZWNlaXZlcigpIHsKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIG9uUmVjZWl2ZShDb250ZXh0IGNvbnRleHQsIEludGVudCBpbnRlbnQpIHsKKyAgICAgICAgICAgIGZpbmFsIFN0cmluZyBhY3Rpb24gPSBpbnRlbnQuZ2V0QWN0aW9uKCk7CisgICAgICAgICAgICBpZiAoSW50ZW50LkFDVElPTl9TQ1JFRU5fT0ZGLmVxdWFscyhhY3Rpb24pKSB7CisgICAgICAgICAgICAgICAgbVVzZXJQcmVzZW50ID0gZmFsc2U7CisgICAgICAgICAgICAgICAgdXBkYXRlUnVubmluZygpOworICAgICAgICAgICAgfSBlbHNlIGlmIChJbnRlbnQuQUNUSU9OX1VTRVJfUFJFU0VOVC5lcXVhbHMoYWN0aW9uKSkgeworICAgICAgICAgICAgICAgIG1Vc2VyUHJlc2VudCA9IHRydWU7CisgICAgICAgICAgICAgICAgdXBkYXRlUnVubmluZyhmYWxzZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9OworCisgICAgQE92ZXJyaWRlCisgICAgcHJvdGVjdGVkIHZvaWQgb25BdHRhY2hlZFRvV2luZG93KCkgeworICAgICAgICBzdXBlci5vbkF0dGFjaGVkVG9XaW5kb3coKTsKKworICAgICAgICAvLyBMaXN0ZW4gZm9yIGJyb2FkY2FzdHMgcmVsYXRlZCB0byB1c2VyLXByZXNlbmNlCisgICAgICAgIGZpbmFsIEludGVudEZpbHRlciBmaWx0ZXIgPSBuZXcgSW50ZW50RmlsdGVyKCk7CisgICAgICAgIGZpbHRlci5hZGRBY3Rpb24oSW50ZW50LkFDVElPTl9TQ1JFRU5fT0ZGKTsKKyAgICAgICAgZmlsdGVyLmFkZEFjdGlvbihJbnRlbnQuQUNUSU9OX1VTRVJfUFJFU0VOVCk7CisgICAgICAgIGdldENvbnRleHQoKS5yZWdpc3RlclJlY2VpdmVyKG1SZWNlaXZlciwgZmlsdGVyKTsKKworICAgICAgICBpZiAobUF1dG9TdGFydCkgeworICAgICAgICAgICAgLy8gQXV0b21hdGljYWxseSBzdGFydCB3aGVuIHJlcXVlc3RlZAorICAgICAgICAgICAgc3RhcnRGbGlwcGluZygpOworICAgICAgICB9CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHJvdGVjdGVkIHZvaWQgb25EZXRhY2hlZEZyb21XaW5kb3coKSB7CisgICAgICAgIHN1cGVyLm9uRGV0YWNoZWRGcm9tV2luZG93KCk7CisgICAgICAgIG1WaXNpYmxlID0gZmFsc2U7CisKKyAgICAgICAgZ2V0Q29udGV4dCgpLnVucmVnaXN0ZXJSZWNlaXZlcihtUmVjZWl2ZXIpOworICAgICAgICB1cGRhdGVSdW5uaW5nKCk7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHJvdGVjdGVkIHZvaWQgb25XaW5kb3dWaXNpYmlsaXR5Q2hhbmdlZChpbnQgdmlzaWJpbGl0eSkgeworICAgICAgICBzdXBlci5vbldpbmRvd1Zpc2liaWxpdHlDaGFuZ2VkKHZpc2liaWxpdHkpOworICAgICAgICBtVmlzaWJsZSA9ICh2aXNpYmlsaXR5ID09IFZJU0lCTEUpOworICAgICAgICB1cGRhdGVSdW5uaW5nKGZhbHNlKTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCBzZXRBZGFwdGVyKEFkYXB0ZXIgYWRhcHRlcikgeworICAgICAgICBzdXBlci5zZXRBZGFwdGVyKGFkYXB0ZXIpOworICAgICAgICB1cGRhdGVSdW5uaW5nKCk7CisgICAgfQorCisgICAgLyoqCisgICAgICogSG93IGxvbmcgdG8gd2FpdCBiZWZvcmUgZmxpcHBpbmcgdG8gdGhlIG5leHQgdmlldworICAgICAqCisgICAgICogQHBhcmFtIG1pbGxpc2Vjb25kcworICAgICAqICAgICAgICAgICAgdGltZSBpbiBtaWxsaXNlY29uZHMKKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBzZXRGbGlwSW50ZXJ2YWwoaW50IG1pbGxpc2Vjb25kcykgeworICAgICAgICBtRmxpcEludGVydmFsID0gbWlsbGlzZWNvbmRzOworICAgIH0KKworICAgIC8qKgorICAgICAqIFN0YXJ0IGEgdGltZXIgdG8gY3ljbGUgdGhyb3VnaCBjaGlsZCB2aWV3cworICAgICAqLworICAgIHB1YmxpYyB2b2lkIHN0YXJ0RmxpcHBpbmcoKSB7CisgICAgICAgIG1TdGFydGVkID0gdHJ1ZTsKKyAgICAgICAgdXBkYXRlUnVubmluZygpOworICAgIH0KKworICAgIC8qKgorICAgICAqIE5vIG1vcmUgZmxpcHMKKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBzdG9wRmxpcHBpbmcoKSB7CisgICAgICAgIG1TdGFydGVkID0gZmFsc2U7CisgICAgICAgIHVwZGF0ZVJ1bm5pbmcoKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAqIHtAaW5oZXJpdERvY30KKyAgICAqLworICAgQE92ZXJyaWRlCisgICBAUmVtb3RhYmxlVmlld01ldGhvZAorICAgcHVibGljIHZvaWQgc2hvd05leHQoKSB7CisgICAgICAgLy8gaWYgdGhlIGZsaXBwZXIgaXMgY3VycmVudGx5IGZsaXBwaW5nIGF1dG9tYXRpY2FsbHksIGFuZCBzaG93TmV4dCgpIGlzIGNhbGxlZAorICAgICAgIC8vIHdlIHNob3VsZCB3ZSBzaG91bGQgbWFrZSBzdXJlIHRvIHJlc2V0IHRoZSB0aW1lcgorICAgICAgIGlmIChtUnVubmluZykgeworICAgICAgICAgICBtSGFuZGxlci5yZW1vdmVNZXNzYWdlcyhGTElQX01TRyk7CisgICAgICAgICAgIE1lc3NhZ2UgbXNnID0gbUhhbmRsZXIub2J0YWluTWVzc2FnZShGTElQX01TRyk7CisgICAgICAgICAgIG1IYW5kbGVyLnNlbmRNZXNzYWdlRGVsYXllZChtc2csIG1GbGlwSW50ZXJ2YWwpOworICAgICAgIH0KKyAgICAgICBzdXBlci5zaG93TmV4dCgpOworICAgfQorCisgICAvKioKKyAgICAqIHtAaW5oZXJpdERvY30KKyAgICAqLworICAgQE92ZXJyaWRlCisgICBAUmVtb3RhYmxlVmlld01ldGhvZAorICAgcHVibGljIHZvaWQgc2hvd1ByZXZpb3VzKCkgeworICAgICAgIC8vIGlmIHRoZSBmbGlwcGVyIGlzIGN1cnJ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ZX0gc3RhdGUuCisgICAgICoKKyAgICAgKiBAcGFyYW0gZmxpcE5vdyBEZXRlcm1pbmVzIHdoZXRoZXIgb3Igbm90IHRvIGV4ZWN1dGUgdGhlIGFuaW1hdGlvbiBub3csIGluCisgICAgICogICAgICAgICAgICBhZGRpdGlvbiB0byBxdWV1aW5nIGZ1dHVyZSBmbGlwcy4gSWYgb21pdHRlZCwgZGVmYXVsdHMgdG8KKyAgICAgKiAgICAgICAgICAgIHRydWUuCisgICAgICovCisgICAgcHJpdmF0ZSB2b2lkIHVwZGF0ZVJ1bm5pbmcoYm9vbGVhbiBmbGlwTm93KSB7CisgICAgICAgIGJvb2xlYW4gcnVubmluZyA9IG1WaXNpYmxlICYmIG1TdGFydGVkICYmIG1Vc2VyUHJlc2VudCAmJiBtQWRhcHRlciAhPSBudWxsOworICAgICAgICBpZiAocnVubmluZyAhPSBtUnVubmluZykgeworICAgICAgICAgICAgaWYgKHJ1bm5pbmcpIHsKKyAgICAgICAgICAgICAgICBzaG93T25seShtV2hpY2hDaGlsZCwgZmxpcE5vdyk7CisgICAgICAgICAgICAgICAgTWVzc2FnZSBtc2cgPSBtSGFuZGxlci5vYnRhaW5NZXNzYWdlKEZMSVBfTVNHKTsKKyAgICAgICAgICAgICAgICBtSGFuZGxlci5zZW5kTWVzc2FnZURlbGF5ZWQobXNnLCBtRmxpcEludGVydmFsKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgbUhhbmRsZXIucmVtb3ZlTWVzc2FnZXMoRkxJUF9NU0cpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbVJ1bm5pbmcgPSBydW5uaW5nOworICAgICAgICB9CisgICAgICAgIGlmIChMT0dEKSB7CisgICAgICAgICAgICBMb2cuZChUQUcsICJ1cGRhdGVSdW5uaW5nKCkgbVZpc2libGU9IiArIG1WaXNpYmxlICsgIiwgbVN0YXJ0ZWQ9IiArIG1TdGFydGVkCisgICAgICAgICAgICAgICAgICAgICsgIiwgbVVzZXJQcmVzZW50PSIgKyBtVXNlclByZXNlbnQgKyAiLCBtUnVubmluZz0iICsgbVJ1bm5pbmcpOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogUmV0dXJucyB0cnVlIGlmIHRoZSBjaGlsZCB2aWV3cyBhcmUgZmxpcHBpbmcuCisgICAgICovCisgICAgcHVibGljIGJvb2xlYW4gaXNGbGlwcGluZygpIHsKKyAgICAgICAgcmV0dXJuIG1TdGFydGVkOworICAgIH0KKworICAgIC8qKgorICAgICAqIFNldCBpZiB0aGlzIHZpZXcgYXV0b21hdGljYWxseSBjYWxscyB7QGxpbmsgI3N0YXJ0RmxpcHBpbmcoKX0gd2hlbiBpdAorICAgICAqIGJlY29tZXMgYXR0YWNoZWQgdG8gYSB3aW5kb3cuCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0QXV0b1N0YXJ0KGJvb2xlYW4gYXV0b1N0YXJ0KSB7CisgICAgICAgIG1BdXRvU3RhcnQgPSBhdXRvU3RhcnQ7CisgICAgfQorCisgICAgLyoqCisgICAgICogUmV0dXJucyB0cnVlIGlmIHRoaXMgdmlldyBhdXRvbWF0aWNhbGx5IGNhbGxzIHtAbGluayAjc3RhcnRGbGlwcGluZygpfQorICAgICAqIHdoZW4gaXQgYmVjb21lcyBhdHRhY2hlZCB0byBhIHdpbmRvdy4KKyAgICAgKi8KKyAgICBwdWJsaWMgYm9vbGVhbiBpc0F1dG9TdGFydCgpIHsKKyAgICAgICAgcmV0dXJuIG1BdXRvU3RhcnQ7CisgICAgfQorCisgICAgcHJpdmF0ZSBmaW5hbCBpbnQgRkxJUF9NU0cgPSAxOworCisgICAgcHJpdmF0ZSBmaW5hbCBIYW5kbGVyIG1IYW5kbGVyID0gbmV3IEhhbmRsZXIoKSB7CisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgdm9pZCBoYW5kbGVNZXNzYWdlKE1lc3NhZ2UgbXNnKSB7CisgICAgICAgICAgICBpZiAobX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mFudGVlZAorICAgICAgICAgKiAgICAgICAgdG8gbm90IGJlIG51bGwuCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgQ3Vyc29yQmluZGVyKENvbnRleHQgY29udGV4dCwgQ3Vyc29yVHJhbnNmb3JtYXRpb24gdHJhbnNmb3JtYXRpb24pIHsKKyAgICAgICAgICAgIG1Db250ZXh0ID0gY29udGV4dDsKKyAgICAgICAgICAgIG1UcmFuc2Zvcm1hdGlvbiA9IHRyYW5zZm9ybWF0aW9uOworICAgICAgICB9CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIDxwPkJpbmRzIHRoZSBzcGVjaWZpZWQgQ3Vyc29yIGNvbHVtbiB0byB0aGUgc3VwcGxpZWQgVmlldy4gVGhlIGJpbmRpbmcgb3BlcmF0aW9uCisgICAgICAgICAqIGNhbiBxdWVyeSBvdGhlciBDdXJzb3IgY29sdW1ucyBhcyBuZWVkZWQuIER1cmluZyB0aGUgYmluZGluZyBvcGVyYXRpb24sIHZhbHVlcworICAgICAgICAgKiByZXRyaWV2ZWQgZnJvbSB0aGUgQ3Vyc29yIG1heSBvciBtYXkgbm90IGJlIHRyYW5zZm9ybWVkIHVzaW5nIHRoaXMgYmluZGVyJ3MKKyAgICAgICAgICogY3Vyc29yIHRyYW5zZm9ybWF0aW9uLjwvcD4KKyAgICAgICAgICogCisgICAgICAgICAqIEBwYXJhbSB2aWV3IFRoZSB2aWV3IHRvIGJpbmQgZGF0YSB0by4KKyAgICAgICAgICogQHBhcmFtIGN1cnNvciBUaGUgY3Vyc29yIHRvIGJpbmQgZGF0YSBmcm9tLgorICAgICAgICAgKiBAcGFyYW0gY29sdW1uSW5kZXggVGhlIGNvbHVtbiBpbmRleCBpbiB0aGUgY3Vyc29yIHdoZXJlIHRoZSBkYXRhIHRvIGJpbmQgcmVzaWRlcy4KKyAgICAgICAgICogCisgICAgICAgICAqIEBzZWUgI21UcmFuc2Zvcm1hdGlvbgorICAgICAgICAgKiAKKyAgICAgICAgICogQHJld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CisgICAgICAgICAqLworICAgICAgICBwcm90ZWN0ZWQgZmluYWwgQ29udGV4dCBtQ29udGV4dDsKKworICAgICAgICAvKioKKyAgICAgICAgICogPHA+Q3JlYXRlcyBhIG5ldyBDdXJzb3IgdHJhbnNmb3JtYXRpb24uPC9wPgorICAgICAgICAgKiAKKyAgICAgICAgICogQHBhcmFtIGNvbnRleHQgVGhlIGNvbnRleHQgYXNzb2NpYXRlZCB3aXRoIHRoaXMgdHJhbnNmb3JtYXRpb24uCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgQ3Vyc29yVHJhbnNmb3JtYXRpb24oQ29udGV4dCBjb250ZXh0KSB7CisgICAgICAgICAgICBtQ29udGV4dCA9IGNvbnRleHQ7CisgICAgICAgIH0KKworICAgICAgICAvKioKKyAgICAgICAgICogPHA+VHJhbnNmb3JtcyB0aGUgc3BlY2lmaWVkIEN1cnNvciBjb2x1bW4gaW50byBhIFN0cmluZy4gVGhlIHRyYW5zZm9ybWF0aW9uCisgICAgICAgICAqIGNhbiBzaW1wbHkgcmV0dXJuIHRoZSBjb250ZW50IG9mIHRoZSBjb2x1bW4gYXMgYSBTdHJpbmcgKHRoaXMgaXMga25vd24KKyAgICAgICAgICogYXMgdGhlIGlkZW50aXR5IHRyYW5zZm9ybWF0aW9uKSBvciBtYW5pcHVsYXRlIHRoZSBjb250ZW50LiBGb3IgaW5zdGFuY2UsCisgICAgICAgICAqIGEgdHJhbnNmb3JtYXRpb24gY2FuIHBlcmZvcm0gdGV4dCBzdWJzdGl0dXRpb25zIG9yIGNvbmNhdGVuYXRlIG90aGVyCisgICAgICAgICAqIGNvbHVtbnMgd2l0aCB0aGUgc3BlY2lmaWVkIGNvbHVtbi48L3A+CisgICAgICAgICAqIAorICAgICAgICAgKiBAcGFyYW0gY3Vyc29yIFRoZSBjdXJzb3IgdGhhdCBjb250YWlucyB0aGUgZGF0YSB0byB0cmFuc2Zvcm0uIAorICAgICAgICAgKiBAcGFyYW0gY29sdW1uSW5kZXggVGhlIGluZGV4IG9mIHRoZSBjb2x1bW4gdG8gdHJhbnNmb3JtLgorICAgICAgICAgKiAKKyAgICAgICAgICogQHJldHVybiBBIFN0cmluZyBjb250YWluaW5nIHRoZSB0cmFuc2Zvcm1lZCB2YWx1ZSBvZiB0aGUgY29sdW1uLgorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIGFic3RyYWN0IFN0cmluZyB0cmFuc2Zvcm0oQ3Vyc29yIGN1cnNvciwgaW50IGNvbHVtbkluZGV4KTsKKworICAgICAgICAvKioKKyAgICAgICAgICogPHA+VHJhbnNmb3JtcyB0aGUgc3BlY2lmaWVkIEN1cnNvciBjb2x1bW4gaW50byBhIHJlc291cmNlIGlkZW50aWZpZXIuCisgICAgICAgICAqIFRoZSBkZWZhdWx0IGltcGxlbWVudGF0aW9uIHNpbXBseSBpbnRlcnByZXRzIHRoZSBjb250ZW50IG9mIHRoZSBjb2x1bW4KKyAgICAgICAgICogYXMgYW4gaW50ZWdlci48L3A+CisgICAgICAgICAqIAorICAgICAgICAgKiBAcGFyYW0gY3Vyc29yIFRoZSBjdXJzb3IgdGhhdCBjb250YWlucyB0aGUgZGF0YSB0byB0cmFuc2Zvcm0uIAorICAgICAgICAgKiBAcGFyYW0gY29sdW1uSW5kZXggVGhlIGluZGV4IG9mIHRoZSBjb2x1bW4gdG8gdHJhbnNmb3JtLgorICAgICAgICAgKiAKKyAgICAgICAgICogQHJldHVybiBBIHJlc291cmNlIGlkZW50aWZpZXIuCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgaW50IHRyYW5zZm9ybVRvUmVzb3VyY2UoQ3Vyc29yIGN1cnNvciwgaW50IGNvbHVtbkluZGV4KSB7CisgICAgICAgICAgICByZXR1cm4gY3Vyc29yLmdldEludChjb2x1bW5JbmRleCk7CisgICAgICAgIH0gICAgICAgIAorICAgIH0KKworICAgIC8qKgorICAgICAqIDxwPkxvYWRzIHRoZSB7QGxpbmsgYW5kcm9pZC53aWRnZXQuQ3Vyc29y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yYW1ldGVycyB0byBwYXNzIHRvIHRoZSBDdXJzb3JBZGFwdGVyLCB1c2VkCisgICAgICogICAgICAgIHRvIHN1YnN0aXR1dGUgdmFsdWVzIGluIHRoZSBzZWxlY3Rpb24gZXhwcmVzc2lvbi4KKyAgICAgKiAKKyAgICAgKiBAcmV0dXJuIEEge0BsaW5rIGFuZHJvaWQud2lkZ2V0LkN1cnNvckFkYXB0ZXJ9CisgICAgICogCisgICAgICogQHRocm93cyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24gSWYgdGhlIFhNTCByZXNvdXJjZSBkb2VzIG5vdCBjb250YWluCisgICAgICogICAgICAgICBhIHZhbGlkICZsdDtjdXJzb3ItYWRhcHRlciAvJmd0OyBkZWZpbml0aW9uLgorICAgICAqIAorICAgICAqIEBzZWUgYW5kcm9pZC5jb250ZW50LkNvbnRlbnRQcm92aWRlcgorICAgICAqIEBzZWUgYW5kcm9pZC53aWRnZXQuQ3Vyc29yQWRhcHRlcgorICAgICAqIEBzZWUgI2xvYWRBZGFwdGVyKGFuZHJvaWQuY29udGVudC5Db250ZXh0LCBpbnQsIE9iamVjdFtdKSAKKyAgICAgKi8KKyAgICBwdWJsaWMgc3RhdGljIEN1cnNvckFkYXB0ZXIgbG9hZEN1cnNvckFkYXB0ZXIoQ29udGV4dCBjb250ZXh0LCBpbnQgaWQsIFN0cmluZyB1cmksCisgICAgICAgICAgICBPYmplY3QuLi4gcGFyYW1ldGVycykgeworCisgICAgICAgIFhtbEN1cnNvckFkYXB0ZXIgYWRhcHRlciA9IChYbWxDdXJzb3JBZGFwdGVyKSBsb2FkQWRhcHRlcihjb250ZXh0LCBpZCwgQURBUFRFUl9DVVJTT1IsCisgICAgICAgICAgICAgICAgcGFyYW1ldGVycyk7CisKKyAgICAgICAgaWYgKHVyaSAhPSBudWxsKSB7CisgICAgICAgICAgICBhZGFwdGVyLnNldFVyaSh1cmkpOworICAgICAgICB9CisgICAgICAgIGFkYXB0ZXIubG9hZCgpOworCisg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hbEFyZ3VtZW50RXhjZXB0aW9uKCJUaGUgYWRhcHRlciBkZWZpbmVkIGluICIgKworICAgICAgICAgICAgICAgICAgICAgICAgYy5nZXRSZXNvdXJjZXMoKS5nZXRSZXNvdXJjZUVudHJ5TmFtZShpZCkgKyAiIG11c3QgYmUgYSA8IiArIG5hbWUgKyAiIC8+Iik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmIChBREFQVEVSX0NVUlNPUi5lcXVhbHMobmFtZSkpIHsKKyAgICAgICAgICAgICAgICBhZGFwdGVyID0gY3JlYXRlQ3Vyc29yQWRhcHRlcihjLCBwYXJzZXIsIGF0dHJzLCBpZCwgcGFyYW1ldGVycyk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oIlVua25vd24gYWRhcHRlciBuYW1lICIgKyBwYXJzZXIuZ2V0TmFtZSgpICsKKyAgICAgICAgICAgICAgICAgICAgICAgICIgaW4gIiArIGMuZ2V0UmVzb3VyY2VzKCkuZ2V0UmVzb3VyY2VFbnRyeU5hbWUoaWQpKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiBhZGFwdGVyOworCisgICAgfQorCisgICAgLyoqCisgICAgICogQ3JlYXRlcyBhbiBYbWxDdXJzb3JBZGFwdGVyIHVzaW5nIGFuIFhtbEN1cnNvckFkYXB0ZXJQYXJzZXIuCisgICAgICovCisgICAgcHJpdmF0ZSBzdGF0aWMgWG1sQ3Vyc29yQWRhcHRlciBjcmVhdGVDdXJzb3JBZGFwdGVyKENvbnRleHQgYywgWG1sUHVsbFBhcnNlciBwYXJzZXIsCisgICAgICAgICAgICBBdHRyaWJ1dGVTZXQgYXR0cnMsIGludCBpZCwgT2JqZWN0W10gcGFyYW1ldGVycykKKyAgICAgICAgICAgIHRocm93cyBJT0V4Y2VwdGlvbiwgWG1sUHVsbFBhcnNlckV4Y2Vw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FRFUl9DVVJTT1JfQVNfRFJBV0FCTEUgPSAiZHJhd2FibGUiOworICAgICAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBTdHJpbmcgQURBUFRFUl9DVVJTT1JfTUFQID0gIm1hcCI7CisgICAgICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIFN0cmluZyBBREFQVEVSX0NVUlNPUl9UUkFOU0ZPUk0gPSAidHJhbnNmb3JtIjsKKworICAgICAgICBwcml2YXRlIGZpbmFsIENvbnRleHQgbUNvbnRleHQ7CisgICAgICAgIHByaXZhdGUgZmluYWwgWG1sUHVsbFBhcnNlciBtUGFyc2VyOworICAgICAgICBwcml2YXRlIGZpbmFsIEF0dHJpYnV0ZVNldCBtQXR0cnM7CisgICAgICAgIHByaXZhdGUgZmluYWwgaW50IG1JZDsKKworICAgICAgICBwcml2YXRlIGZpbmFsIEhhc2hNYXA8U3RyaW5nLCBDdXJzb3JCaW5kZXI+IG1CaW5kZXJzOworICAgICAgICBwcml2YXRlIGZpbmFsIEFycmF5TGlzdDxTdHJpbmc+IG1Gcm9tOworICAgICAgICBwcml2YXRlIGZpbmFsIEFycmF5TGlzdDxJbnRlZ2VyPiBtVG87CisgICAgICAgIHByaXZhdGUgZmluYWwgQ3Vyc29yVHJhbnNmb3JtYXRpb24gbUlkZW50aXR5OworICAgICAgICBwcml2YXRlIGZpbmFsIFJlc291cmNlcyBtUmVzb3VyY2VzOworCisgICAgICAgIHB1YmxpYyBYbWxDdXJzb3JBZGFwdGVyUGFyc2VyKENvbnRleHQgYywgWG1sUHVsbFBhcnNlciBwYXJzZXIsIEF0dHJpYnV0ZVNldCBhdHRycywgaW50IGlkKSB7CisgICAgICAgICAgICBtQ29udGV4dCA9IGM7CisgICAgICAgICAgICBtUGFyc2VyID0gcGFyc2VyOworICAgICAgICAgICAgbUF0dHJzID0gYXR0cnM7CisgICAgICAgICAgICBtSWQgPSBpZDsKKworICAgICAgICAgICAgbVJlc291cmNlcyA9IG1Db250ZXh0LmdldF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lYWJsZS5DdXJzb3JBZGFwdGVyX2xheW91dCwgMCk7CisgICAgICAgICAgICBpZiAobGF5b3V0ID09IDApIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJUaGUgbGF5b3V0IHNwZWNpZmllZCBpbiAiICsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJlc291cmNlcy5nZXRSZXNvdXJjZUVudHJ5TmFtZShtSWQpICsgIiBkb2VzIG5vdCBleGlzdCIpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBhLnJlY3ljbGUoKTsKKworICAgICAgICAgICAgWG1sUHVsbFBhcnNlciBwYXJzZXIgPSBtUGFyc2VyOworICAgICAgICAgICAgaW50IHR5cGU7CisgICAgICAgICAgICBpbnQgZGVwdGggPSBwYXJzZXIuZ2V0RGVwdGgoKTsKKworICAgICAgICAgICAgd2hpbGUgKCgodHlwZSA9IHBhcnNlci5uZXh0KCkpICE9IFhtbFB1bGxQYXJzZXIuRU5EX1RBRyB8fCBwYXJzZXIuZ2V0RGVwdGgoKSA+IGRlcHRoKSAmJgorICAgICAgICAgICAgICAgICAgICB0eXBlICE9IFhtbFB1bGxQYXJzZXIuRU5EX0RPQ1VNRU5UKSB7CisKKyAgICAgICAgICAgICAgICBpZiAodHlwZSAhPSBYbWxQdWxsUGFyc2VyLlNUQVJUX1RBRykgeworICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBTdHJpbmcgbmFtZSA9IHBhcnNlci5nZXROYW1lKCk7CisKKyAgICAgICAgICAgICAgICBpZiAoQURBUFRFUl9DVVJTT1JfQklORC5lcXVhbHMobmFtZSkpIHsKKyAgICAgICAgICAgICAgICAgICAgcGFyc2VCaW5kVGFnKCk7CisgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChBREFQVEVSX0NVUlNPUl9TRUxFQ1QuZXF1YWxzKG5hbWUpKSB7CisgICAgICAgICAgICAgICAgICAgIHBhcnNlU2VsZWN0VGFnKCk7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFJ1bnRpbWVFeGNlcHRpb24oIlVua25vd24gdGFnIG5hbWUgIiArIHBhcnNlci5nZXROYW1lKCkgKyAiIGluICIgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc291cmNlcy5nZXRSZXNvdXJjZUVudHJ5TmFtZShtSWQpKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIFN0cmluZ1tdIGZyb21BcnJheSA9IG1Gcm9tLnRvQXJyYXkobmV3IFN0cmluZ1ttRnJvbS5zaXplKCldKTsKKyAgICAgICAgICAgIGludFtdIHRvQXJyYXkgPSBuZXcgaW50W21Uby5zaXplKCldOworICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCB0b0FycmF5Lmxlbmd0aDsgaSsrKSB7CisgICAgICAgICAgICAgICAgdG9BcnJheVtpXSA9IG1Uby5nZXQoaSk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIFN0cmluZ1tdIHNlbGVjdGlvbkFyZ3MgPSBudWxsOworICAgICAgICAgICAgaWYgKHBhcmFtZXRlcnMgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIHNlbGVjdGlvbkFyZ3MgPSBuZXcgU3RyaW5nW3BhcmFtZXRlcnMubGVuZ3RoXTsKKyAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IHNlbGVjdGlvbkFyZ3MubGVuZ3RoOyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgc2VsZWN0aW9uQXJnc1tpXSA9IChTdHJpbmcpIHBhcmFtZXRlcnNbaV07CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCisgICAgICAgICAgICByZXR1cm4gbmV3IFhtbEN1cnNvckFkYXB0ZXIobUNvbnRleHQsIGxheW91dCwgdXJpLCBmcm9tQXJyYXksIHRvQXJyYXksIHNlbGVjdGlvbiwKKyAgICAgICAgICAgICAgICAgICAgc2VsZWN0aW9uQXJncywgc29ydE9yZGVyLCBtQmluZGVycyk7CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIHZvaWQgcGFyc2VTZWxlY3RUYWcoKSB7CisgICAgICAgICAgICBUeXBlZEFycmF5IGEgPSBtUmVzb3VyY2VzLm9idGFpbkF0dHJpYnV0ZXMobUF0dHJzLAorICAgICAgICAgICAgICAgICAgICBhbmRyb2lkLlIuc3R5bGVhYmxlLkN1cnNvckFkYXB0ZXJfU2VsZWN0SXRlbSk7CisKKyAgICAgICAgICAgIFN0cmluZyBmcm9tTmFtZSA9IGEuZ2V0U3RyaW5nKGFuZHJvaWQuUi5zdHlsZWFibGUuQ3Vyc29yQWRhcHRlcl9TZWxlY3RJdGVtX2NvbHVtbik7CisgICAgICAgICAgICBpZiAoZnJvbU5hbWUgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oIkEgc2VsZWN0IGl0ZW0gaW4gIiArCisgICAgICAgICAgICAgICAgICAgICAgICBtUmVzb3VyY2VzLmdldFJlc291cmNlRW50cnlOYW1lKG1JZCkgKworICAgICAgICAgICAgICAgICAgICAgICAgIiBkb2VzIG5vdCBoYXZlIGEgJ2NvbHVtbicgYXR0cmlidXRlIik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGEucmVjeWNsZSgpOworCisgICAgICAgICAgICBtRnJvbS5hZGQoZnJvbU5hbWUpOworICAgICAgICAgICAgbVRvLmFkZChWaWV3Lk5PX0lEKTsKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgdm9pZCBwYXJzZUJpbmRUYWcoKSB0aHJvd3MgSU9FeGNlcHRpb24sIFhtbFB1bGxQYXJzZXJFeGNlcHRpb24geworICAgICAgICAgICAgUmVzb3VyY2VzIHJl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mxlLkN1cnNvckFkYXB0ZXJfQmluZEl0ZW1fYXMpOworICAgICAgICAgICAgaWYgKGFzVHlwZSA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiQSBiaW5kIGl0ZW0gaW4gIiArCisgICAgICAgICAgICAgICAgICAgICAgICByZXNvdXJjZXMuZ2V0UmVzb3VyY2VFbnRyeU5hbWUobUlkKSArICIgZG9lcyBub3QgaGF2ZSBhbiAnYXMnIGF0dHJpYnV0ZSIpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBtRnJvbS5hZGQoZnJvbU5hbWUpOworICAgICAgICAgICAgbVRvLmFkZCh0b05hbWUpOworICAgICAgICAgICAgbUJpbmRlcnMucHV0KGZyb21OYW1lLCBmaW5kQmluZGVyKGFzVHlwZSkpOworCisgICAgICAgICAgICBhLnJlY3ljbGUoKTsKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgQ3Vyc29yQmluZGVyIGZpbmRCaW5kZXIoU3RyaW5nIHR5cGUpIHRocm93cyBJT0V4Y2VwdGlvbiwgWG1sUHVsbFBhcnNlckV4Y2VwdGlvbiB7CisgICAgICAgICAgICBmaW5hbCBYbWxQdWxsUGFyc2VyIHBhcnNlciA9IG1QYXJzZXI7CisgICAgICAgICAgICBmaW5hbCBDb250ZXh0IGNvbnRleHQgPSBtQ29udGV4dDsKKyAgICAgICAgICAgIEN1cnNvclRyYW5zZm9ybWF0aW9uIHRyYW5zZm9ybWF0aW9uID0gbUlkZW50aXR5OworCisgICAgICAgICAgICBpbnQgdGFnVHlwZTsKKyAgICAgICAgICAgIGludCBkZXB0aCA9IHBhcnNlci5nZXREZXB0aCgpOworCisgICAgICAgICAgICBmaW5hbCBib29sZWFuIGlzRHJhd2FibGUgPSBBREFQVEVSX0NVUlNPUl9BU19EUkFXQUJMRS5lcXVhbHModHlwZSk7ICAgICAgICAgICAgCisKKyAgICAgICAgICAgIHdoaWxlICgoKHRhZ1R5cGUgPSBwYXJzZXIubmV4dCgpKSAhPSBYbWxQdWxsUGFyc2VyLkVORF9UQUcgfHwgcGFyc2VyLmdldERlcHRoKCkgPiBkZXB0aCkKKyAgICAgICAgICAgICAgICAgICAgJiYgdGFnVHlwZSAhPSBYbWxQdWxsUGFyc2VyLkVORF9ET0NVTUVOVCkgeworCisgICAgICAgICAgICAgICAgaWYgKHRhZ1R5cGUgIT0gWG1sUHVsbFBhcnNlci5TVEFSVF9UQUcpIHsKKyAgICAgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgU3RyaW5nIG5hbWUgPSBwYXJzZXIuZ2V0TmFtZSgpOworCisgICAgICAgICAgICAgICAgaWYgKEFEQVBURVJfQ1VSU09SX1RSQU5TRk9STS5lcXVhbHMobmFtZSkpIHsKKyAgICAgICAgICAgICAgICAgICAgdHJhbnNmb3JtYXRpb24gPSBmaW5kVHJhbnNmb3JtYXRpb24oKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKEFEQVBURVJfQ1VSU09SX01BUC5lcXVhbHMobmFtZSkpIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKCEodHJhbnNmb3JtYXRpb24gaW5zdGFuY2VvZiBNYXBUcmFuc2Zvcm1hdGlvbikpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHRyYW5zZm9ybWF0aW9uID0gbmV3IE1hcFRyYW5zZm9ybWF0aW9uKGNvbnRleHQpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGZpbmRNYXAoKChNYXBUcmFuc2Zvcm1hdGlvbikgdHJhbnNmb3JtYXRpb24pLCBpc0RyYXdhYmxlKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgUnVudGltZUV4Y2VwdGlvbigiVW5rbm93biB0YWcgbmFtZSAiICsgcGFyc2VyLmdldE5hbWUoKSArICIgaW4gIiArCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGV4dC5nZXRSZXNvdXJjZXMoKS5nZXRSZXNvdXJjZUVudHJ5TmFtZShtSWQpKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmIChBREFQVEVSX0NVUlNPUl9BU19TVFJJTkcuZXF1YWxzKHR5cGUpKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBTdHJpbmdCaW5kZXIoY29udGV4dCwgdHJhbnNmb3JtYXRpb24pOworICAgICAgICAgICAgfSBlbHNlIGlmIChBREFQVEVSX0NVUlNPUl9BU19UQUcuZXF1YWxzKHR5cGUpKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBUYWdCaW5kZXIoY29udGV4dCwgdHJhbnNmb3JtYXRpb24pOworICAgICAgICAgICAgfSBlbHNlIGlmIChBREFQVEVSX0NVUlNPUl9BU19JTUFHRS5lcXVhbHModHlwZSkpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gbmV3IEltYWdlQmluZGVyKGNvbnRleHQsIHRyYW5zZm9ybWF0aW9uKTsgICAgICAgICAgICAKKyAgICAgICAgICAgIH0gZWxzZSBpZiAoQURBUFRFUl9DVVJTT1JfQVNfSU1BR0VfVVJJLmVxdWFscyh0eXBlKSkgeworICAgICAgICAgICAgICAgIHJldHVybiBuZXcgSW1hZ2VVcmlCaW5kZXIoY29udGV4dCwgdHJhbnNmb3JtYXRpb24pOworICAgICAgICAgICAgfSBlbHNlIGlmIChpc0RyYXdhYmxlKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBEcmF3YWJsZUJpbmRlcihjb250ZXh0LCB0cmFuc2Zvcm1hdGlvbik7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHJldHVybiBjcmVhdGVCaW5kZXIodHlwZSwgdHJhbnNmb3JtYXRpb24pOworICAgICAgICAgICAgfQorICAgICAg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0gY2F0Y2ggKE5vU3VjaE1ldGhvZEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiQ2Fubm90IGluc3RhbmNpYXRlIGJpbmRlciB0eXBlIGluICIgKworICAgICAgICAgICAgICAgICAgICAgICAgbUNvbnRleHQuZ2V0UmVzb3VyY2VzKCkuZ2V0UmVzb3VyY2VFbnRyeU5hbWUobUlkKSArICI6ICIgKyB0eXBlLCBlKTsKKyAgICAgICAgICAgIH0gY2F0Y2ggKEludm9jYXRpb25UYXJnZXRFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oIkNhbm5vdCBpbnN0YW5jaWF0ZSBiaW5kZXIgdHlwZSBpbiAiICsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1Db250ZXh0LmdldFJlc291cmNlcygpLmdldFJlc291cmNlRW50cnlOYW1lKG1JZCkgKyAiOiAiICsgdHlwZSwgZSk7CisgICAgICAgICAgICB9IGNhdGNoIChJbnN0YW50aWF0aW9uRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJDYW5ub3QgaW5zdGFuY2lhdGUgYmluZGVyIHR5cGUgaW4gIiArCisgICAgICAgICAgICAgICAgICAgICAgICBtQ29udGV4dC5nZXRSZXNvdXJjZXMoKS5nZXRSZXNvdXJjZUVudHJ5TmFtZShtSWQpICsgIjogIiArIHR5cGUsIGUpOworICAgICAgICAgICAgfSBjYXRjaCAoSWxsZWdhbEFjY2Vzc0V4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiQ2Fubm90IGluc3RhbmNpYXRlIGJpbmRlciB0eXBlIGluICIgKworICAgICAgICAgICAgICAgICAgICAgICAgbUNvbnRleHQuZ2V0UmVzb3VyY2VzKCkuZ2V0UmVzb3VyY2VFbnRyeU5hbWUobUlkKSArICI6ICIgKyB0eXBlLCBlKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIHZvaWQgZmluZE1hcChNYXBUcmFuc2Zvcm1hdGlvbiB0cmFuc2Zvcm1hdGlvbiwgYm9vbGVhbiBkcmF3YWJsZSkgeworICAgICAgICAgICAgUmVzb3VyY2VzIHJlc291cmNlcyA9IG1SZXNvdXJjZXM7CisKKyAgICAgICAgICAgIFR5cGVkQXJyYXkgYSA9IHJlc291cmNlcy5vYnRhaW5BdHRyaWJ1dGVzKG1BdHRycywKKyAgICAgICAgICAgICAgICAgICAgYW5kcm9pZC5SLnN0eWxlYWJsZS5DdXJzb3JBZGFwdGVyX01hcEl0ZW0pOworCisgICAgICAgICAgICBTdHJpbmcgZnJvbSA9IGEuZ2V0U3RyaW5nKGFuZHJvaWQuUi5zdHlsZWFibGUuQ3Vyc29yQWRhcHRlcl9NYXBJdGVtX2Zyb21WYWx1ZSk7CisgICAgICAgICAgICBpZiAoZnJvbSA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiQSBtYXAgaXRlbSBpbiAiICsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJlc291cmNlcy5nZXRSZXNvdXJjZUVudHJ5TmFtZShtSWQpICsKKyAgICAgICAgICAgICAgICAgICAgICAgICIgZG9lcyBub3QgaGF2ZSBhICdmcm9tVmFsdWUnIGF0dHJpYnV0ZSIpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAoIWRyYXdhYmxlKSB7CisgICAgICAgICAgICAgICAgU3RyaW5nIHRvID0gYS5nZXRTdHJpbmcoYW5kcm9pZC5SLnN0eWxlYWJsZS5DdXJzb3JBZGFwdGVyX01hcEl0ZW1fdG9WYWx1ZSk7CisgICAgICAgICAgICAgICAgaWYgKHRvID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiQSBtYXAgaXRlbSBpbiAiICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXNvdXJjZXMuZ2V0UmVzb3VyY2VFbnRyeU5hbWUobUlkKSArCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIiBkb2VzIG5vdCBoYXZlIGEgJ3RvVmFsdWUnIGF0dHJpYnV0ZSIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB0cmFuc2Zvcm1hdGlvbi5hZGRTdHJpbmdNYXBwaW5nKGZyb20sIHRvKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgaW50IHRvID0gYS5nZXRSZXNvdXJjZUlkKGFuZHJvaWQuUi5zdHlsZWFibGUuQ3Vyc29yQWRhcHRlcl9NYXBJdGVtX3RvVmFsdWUsIDApOworICAgICAgICAgICAgICAgIGlmICh0byA9PSAwKSB7CisgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oIkEgbWFwIGl0ZW0gaW4gIiArCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzb3VyY2VzLmdldFJlc291cmNlRW50cnlOYW1lKG1JZCkgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICIgZG9lcyBub3QgaGF2ZSBhICd0b1ZhbHVlJyBhdHRyaWJ1dGUiKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgdHJhbnNmb3JtYXRpb24uYWRkUmVzb3VyY2VNYXBwaW5nKGZyb20sIHRvKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgYS5yZWN5Y2xlKCk7CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIEN1c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gaWYgKEN1cnNvclRyYW5zZm9ybWF0aW9uLmNsYXNzLmlzQXNzaWduYWJsZUZyb20oa2xhcykpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZpbmFsIENvbnN0cnVjdG9yPD8+IGMgPSBrbGFzLmdldERlY2xhcmVkQ29uc3RydWN0b3IoQ29udGV4dC5jbGFzcyk7CisgICAgICAgICAgICAgICAgICAgICAgICB0cmFuc2Zvcm1hdGlvbiA9IChDdXJzb3JUcmFuc2Zvcm1hdGlvbikgYy5uZXdJbnN0YW5jZShtQ29udGV4dCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9IGNhdGNoIChDbGFzc05vdEZvdW5kRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiQ2Fubm90IGluc3RhbmNpYXRlIHRyYW5zZm9ybSB0eXBlIGluICIgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgbUNvbnRleHQuZ2V0UmVzb3VyY2VzKCkuZ2V0UmVzb3VyY2VFbnRyeU5hbWUobUlkKSArICI6ICIgKyBjbGFzc05hbWUsIGUpOworICAgICAgICAgICAgICAgIH0gY2F0Y2ggKE5vU3VjaE1ldGhvZEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oIkNhbm5vdCBpbnN0YW5jaWF0ZSB0cmFuc2Zvcm0gdHlwZSBpbiAiICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Db250ZXh0LmdldFJlc291cmNlcygpLmdldFJlc291cmNlRW50cnlOYW1lKG1JZCkgKyAiOiAiICsgY2xhc3NOYW1lLCBlKTsKKyAgICAgICAgICAgICAgICB9IGNhdGNoIChJbnZvY2F0aW9uVGFyZ2V0RXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiQ2Fubm90IGluc3RhbmNpYXRlIHRyYW5zZm9ybSB0eXBlIGluICIgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgbUNvbnRleHQuZ2V0UmVzb3VyY2VzKCkuZ2V0UmVzb3VyY2VFbnRyeU5hbWUobUlkKSArICI6ICIgKyBjbGFzc05hbWUsIGUpOworICAgICAgICAgICAgICAgIH0gY2F0Y2ggKEluc3RhbnRpYXRpb25FeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJDYW5ub3QgaW5zdGFuY2lhdGUgdHJhbnNmb3JtIHR5cGUgaW4gIiArCisgICAgICAgICAgICAgICAgICAgICAgICAgICBtQ29udGV4dC5nZXRSZXNvdXJjZXMoKS5nZXRSZXNvdXJjZUVudHJ5TmFtZShtSWQpICsgIjogIiArIGNsYXNzTmFtZSwgZSk7CisgICAgICAgICAgICAgICAgfSBjYXRjaCAoSWxsZWdhbEFjY2Vzc0V4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oIkNhbm5vdCBpbnN0YW5jaWF0ZSB0cmFuc2Zvcm0gdHlwZSBpbiAiICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Db250ZXh0LmdldFJlc291cmNlcygpLmdldFJlc291cmNlRW50cnlOYW1lKG1JZCkgKyAiOiAiICsgY2xhc3NOYW1lLCBlKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGEucmVjeWNsZSgpOworCisgICAgICAgICAgICBpZiAodHJhbnNmb3JtYXRpb24gPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oIkEgdHJhbnNmb3JtIGl0ZW0gaW4gIiArCisgICAgICAgICAgICAgICAgICAgIHJlc291cmNlcy5nZXRSZXNvdXJjZUVudHJ5TmFtZShtSWQpICsgIiBtdXN0IGhhdmUgYSAnd2l0aENsYXNzJyBvciAiICsKKyAgICAgICAgICAgICAgICAgICAgIid3aXRoRXhwcmVzc2lvbicgYXR0cmlidXRlIik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHJldHVybiB0cmFuc2Zvcm1hdGlvbjsKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgQ3Vyc29yVHJhbnNmb3JtYXRpb24gY3JlYXRlRXhwcmVzc2lvblRyYW5zZm9ybWF0aW9uKFN0cmluZyBleHByZXNzaW9uKSB7CisgICAgICAgICAgICByZXR1cm4gbmV3IEV4cHJlc3Npb25UcmFuc2Zvcm1hdGlvbihtQ29udGV4dCwgZXhwcmVzc2lvbik7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBJbnRlcmZhY2UgdXNlZCBieSBhZGFwdGVycyB0aGF0IHJlcXVpcmUgdG8gYmUgbG9hZGVkIGFmdGVyIGNyZWF0aW9uLgorICAgICAqLworICAgIHByaXZhdGUgc3RhdGljIGludGVyZmFjZSBNYW5hZ2VkQWRhcHRlciB7CisgICAgICAgIC8qKgorICAgICAgICAgKiBMb2FkcyB0aGUgY29udGVudCBvZiB0aGUgYWRhcHRlciwgYXN5bmNocm9ub3VzbHkuCisgICAgICAgICAqLworICAgICAgICB2b2lkIGxvYWQoKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBJbXBsZW1lbnRhdGlvbiBvZiBhIEN1cnNvciBhZGFwdGVyIGRlZmluZWQgaW4gWE1MLiBUaGlzIGNsYXNzIGlzIGEgdGhpbiB3cmFwcGVyCisgICAgICogb2YgYSBTaW1wbGVDdXJzb3JBZGFwdGVyLiBUaGUgbWFpbiBkaWZmZXJlbmNlIGlzIHRoZSBhYmlsaXR5IHRvIGhhbmRsZSBDdXJzb3JCaW5kZXJzLgorICAgICAqLworICAgIHByaXZhdGUgc3RhdGljIGNsYXNzIFhtbEN1cnNvckFkYXB0ZXIgZXh0ZW5kcyBTaW1wbGVDdXJzb3JBZGFwdGVyIGltcGxlbWVudHMgTWFuYWdlZEFkYXB0ZXIgeworICAgICAgICBwcml2YXRlIFN0cmluZyBtVXJpOworICAgICAgICBwcml2YXRlIGZpbmFsIFN0cmluZyBtU2VsZWN0aW9uOworICAgICAgICBwcml2YXRlIGZpbmFsIFN0cmluZ1tdIG1TZWxlY3Rpb25BcmdzOworICAgICAgICBwcml2YXRlIGZpbmFsIFN0cmluZyBtU29ydE9yZGVyOworICAgICAgICBwcml2YXRlIGZpbmFsIFN0cmluZ1tdIG1Db2x1bW5zOworICAgICAgICBwcml2YXRlIGZpbmFsIEN1cnNvckJpbmRlcltdIG1CaW5kZXJzOworICAgICAgICBwcml2YXRlIEFzeW5jVGFzazxWb2lkLFZvaWQsQ3Vyc29yPiBtTG9hZFRhc2s7CisKKyAgICAgICAgWG1sQ3Vyc29yQWRhcHRlcihDb250ZXh0IGNvbnRleHQsIGludCBsYXlvdXQsIFN0cmluZyB1cmksIFN0cmluZ1tdIGZyb20sIGludFtdIHRvLAorICAgICAgICAgICAgICAgIFN0cmluZyBzZWxlY3Rpb24sIFN0cmluZ1tdIHNlbGVjdGlvbkFyZ3MsIFN0cmluZyBzb3J0T3JkZXIsCisgICAgICAgICAgICAgICAgSGFzaE1hcDxTdHJpbmcsIEN1cnNvckJpbmRlcj4gYmluZGVycykgeworCisgICAgICAgICAgICBzdXBlcihjb250ZXh0LCBsYXlvdXQsIG51bGwsIGZyb20sIHRvKTsKKyAgICAgICAgICAgIG1Db250ZXh0ID0gY29udGV4dDsKKyAgICAgICAgICAgIG1VcmkgPSB1cmk7CisgICAgICAgICAgICBtU2VsZWN0aW9uID0gc2VsZWN0aW9uOworICAgICAgICAgICAgbVNlbGVjdGlvbkFyZ3MgPSBzZWxlY3Rpb25BcmdzOworICAgICAgICAgICAgbVNvcnRPcmRlciA9IHNvcnRPcmRlcjsKKyAgICAgICAgICAgIG1Db2x1bW5zID0gbmV3IFN0cmluZ1tmcm9tLmxlbmd0aCArIDFdOworICAgICAgICAgICAgLy8gVGhpcyBpcyBtYW5kYXRvcnkgaW4gQ3Vyc29yQWRhcHRlcgorICAgICAgICAgICAgbUNvbHVtbnNbMF0gPSAiX2lkIjsKKyAgICAgICAgICAgIFN5c3RlbS5hcnJheWNvcHkoZnJvbSwgMCwgbUNvbHVtbnMsIDEsIGZyb20ubGVuZ3RoKTsKKworICAgICAgICAgICAgQ3Vyc29yQmluZGVyIGJhc2ljID0gbmV3IFN0cmluZ0JpbmRlcihjb250ZXh0LCBuZXcgSWRlbnRpdHlUcmFuc2Zvcm1hdGlvbihjb250ZXh0KSk7CisgICAgICAgICAgICBmaW5hbCBpbnQgY291bnQgPSBmcm9tLmxlbmd0aDsKKyAgICAgICAgICAgIG1CaW5kZXJzID0gbmV3IEN1cnNvckJpbmRlcltjb3VudF07CisKKyAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgY291bnQ7IGkrKykgeworICAgICAgICAgICAgICAgIEN1cnNvckJpbmRlciBiaW5kZXIgPSBiaW5kZXJzLmdldChmcm9tW2ldKTsKKyAgICAgICAgICAgICAgICBpZiAoYmluZGVyID09IG51bGwpIGJpbmRlciA9IGJhc2ljOworICAgICAgICAgICAgICAgIG1CaW5kZXJzW2ldID0gYmluZGVyOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIGJpbmRWaWV3KFZpZXcgdmlldywgQ29udGV4dCBjb250ZXh0LCBDdXJzb3IgY3Vyc29yKSB7CisgICAgICAgICAgICBmaW5hbCBpbnQgY291bnQgPSBtVG8ubGVuZ3RoOworICAgICAgICAgICAgZmluYWwgaW50W10gZnJvbSA9IG1Gcm9tOworICAgICAgICAgICAgZmluYWwgaW50W10gdG8gPSBtVG87CisgICAgICAgICAgICBmaW5hbCBDdXJzb3JCaW5kZXJbXSBiaW5kZXJzID0gbUJpbmRlcnM7CisKKyAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgY291bnQ7IGkrKykgeworICAgICAgICAgICAgICAgIGZpbmFsIFZpZXcgdiA9IHZpZXcuZmluZFZpZXdCeUlkKHRvW2ldKTsKKyAgICAgICAgICAgICAgICBpZiAodiAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIGJpbmRlcnNbaV0uYmluZCh2LCBjdXJzb3IsIGZyb21baV0pOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyB2b2lkIGxvYWQoKSB7CisgICAgICAgICAgICBpZiAobVVyaSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgbUxvYWRUYXNrID0gbmV3IFF1ZXJ5VGFzaygpLmV4ZWN1dGUoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHZvaWQgc2V0VXJpKFN0cmluZyB1cmkpIHsKKyAgICAgICAgICAgIG1VcmkgPSB1cmk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgY2hhbmdlQ3Vyc29yKEN1cnNvciBjKSB7CisgICAgICAgICAgICBpZiAobUxvYWRUYXNrICE9IG51bGwgJiYgbUxvYWRUYXNrLmdldFN0YXR1cygpICE9IFF1ZXJ5VGFzay5TdGF0dXMuRklOSVNIRUQpIHsKKyAgICAgICAgICAgICAgICBtTG9hZFRhc2suY2FuY2VsKHRydWUpOworICAgICAgICAgICAgICAgIG1Mb2FkVGFzayA9IG51bGw7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBzdXBlci5jaGFuZ2VDdXJzb3IoYyk7CisgICAgICAgIH0KKworICAgICAgICBjbGFzcyBRdWVyeVRhc2sgZXh0ZW5kcyBBc3luY1Rhc2s8Vm9pZCwgVm9pZCwgQ3Vyc29yPiB7CisgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgIHByb3RlY3RlZCBDdXJzb3IgZG9JbkJhY2tncm91bmQoVm9pZC4uLiBwYXJhbXMpIHsKKyAgICAgICAgICAgICAgICBpZiAobUNvbnRleHQgaW5zdGFuY2VvZiBBY3Rpdml0eSkgeworICAgICAgICAgICAgICAgICAgICByZXR1cm4gKChBY3Rpdml0eSkgbUNvbnRleHQpLm1hbmFnZWRRdWVyeSgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBVcmkucGFyc2UobVVyaSksIG1Db2x1bW5zLCBtU2VsZWN0aW9uLCBtU2VsZWN0aW9uQXJncywgbVNvcnRPcmRlcik7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG1Db250ZXh0LmdldENvbnRlbnRSZXNvbHZlcigpLnF1ZXJ5KAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIFVyaS5wYXJzZShtVXJpKSwgbUNvbHVtbnMsIG1TZWxlY3Rpb24sIG1TZWxlY3Rpb25BcmdzLCBtU29ydE9yZGVyKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgcHJvdGVjdGVkIHZvaWQgb25Qb3N0RXhlY3V0ZShDdXJzb3IgY3Vyc29yKSB7CisgICAgICAgICAgICAgICAgaWYgKCFpc0NhbmNlbGxlZCgpKSB7CisgICAgICAgICAgICAgICAgICAgIFhtbEN1cnNvckFkYXB0ZXIuc3VwZXIuY2hhbmdlQ3Vyc29yKGN1cnNvcik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogSWRlbnRpdHkgdHJhbnNmb3JtYXRpb24sIHJldHVybnMgdGhlIGNvbnRlbnQgb2YgdGhlIHNwZWNpZmllZCBjb2x1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bnN0YW50RXhwcmVzc2lvbk5vZGUoIiIpOworICAgICAgICBwcml2YXRlIGZpbmFsIFN0cmluZ0J1aWxkZXIgbUJ1aWxkZXIgPSBuZXcgU3RyaW5nQnVpbGRlcigpOworCisgICAgICAgIHB1YmxpYyBFeHByZXNzaW9uVHJhbnNmb3JtYXRpb24oQ29udGV4dCBjb250ZXh0LCBTdHJpbmcgZXhwcmVzc2lvbikgeworICAgICAgICAgICAgc3VwZXIoY29udGV4dCk7CisKKyAgICAgICAgICAgIHBhcnNlKGV4cHJlc3Npb24pOworICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSB2b2lkIHBhcnNlKFN0cmluZyBleHByZXNzaW9uKSB7CisgICAgICAgICAgICBFeHByZXNzaW9uTm9kZSBub2RlID0gbUZpcnN0Tm9kZTsKKyAgICAgICAgICAgIGludCBzZWdtZW50U3RhcnQ7CisgICAgICAgICAgICBpbnQgY291bnQgPSBleHByZXNzaW9uLmxlbmd0aCgpOworCisgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGNvdW50OyBpKyspIHsKKyAgICAgICAgICAgICAgICBjaGFyIGMgPSBleHByZXNzaW9uLmNoYXJBdChpKTsKKyAgICAgICAgICAgICAgICAvLyBTdGFydCBhIGNvbHVtbiBuYW1lIHNlZ21lbnQKKyAgICAgICAgICAgICAgICBzZWdtZW50U3RhcnQgPSBpOworICAgICAgICAgICAgICAgIGlmIChjID09ICd7JykgeworICAgICAgICAgICAgICAgICAgICB3aGlsZSAoaSA8IGNvdW50ICYmIChjID0gZXhwcmVzc2lvbi5jaGFyQXQoaSkpICE9ICd9JykgeworICAgICAgICAgICAgICAgICAgICAgICAgaSsrOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIC8vIFdlJ3ZlIHJlYWNoZWQgdGhlIGVuZCwgYnV0IHRoZSBleHByZXNzaW9uIGRpZG4ndCBjbG9zZQorICAgICAgICAgICAgICAgICAgICBpZiAoYyAhPSAnfScpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oIlRoZSB0cmFuc2Zvcm0gZXhwcmVzc2lvbiBjb250YWlucyBhICIgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAibm9uLWNsb3NlZCBjb2x1bW4gbmFtZTogIiArCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4cHJlc3Npb24uc3Vic3RyaW5nKHNlZ21lbnRTdGFydCArIDEsIGkpKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBub2RlLm5leHQgPSBuZXcgQ29sdW1uRXhwcmVzc2lvbk5vZGUoZXhwcmVzc2lvbi5zdWJzdHJpbmcoc2VnbWVudFN0YXJ0ICsgMSwgaSkpOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIHdoaWxlIChpIDwgY291bnQgJiYgKGMgPSBleHByZXNzaW9uLmNoYXJBdChpKSkgIT0gJ3snKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBpKys7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgbm9kZS5uZXh0ID0gbmV3IENvbnN0YW50RXhwcmVzc2lvbk5vZGUoZXhwcmVzc2lvbi5zdWJzdHJpbmcoc2VnbWVudFN0YXJ0LCBpKSk7CisgICAgICAgICAgICAgICAgICAgIC8vIFJld2luZCBpZiB3ZSd2ZSByZWFjaGVkIGEgY29sdW1uIGV4cHJlc3Npb24KKyAgICAgICAgICAgICAgICAgICAgaWYgKGMgPT0gJ3snKSBpLS07CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIG5vZGUgPSBub2RlLm5leHQ7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIFN0cmluZyB0cmFuc2Zvcm0oQ3Vyc29yIGN1cnNvciwgaW50IGNvbHVtbkluZGV4KSB7CisgICAgICAgICAgICBmaW5hbCBTdHJpbmdCdWlsZGVyIGJ1aWxkZXIgPSBtQnVpbGRlcjsKKyAgICAgICAgICAgIGJ1aWxkZXIuZGVsZXRlKDAsIGJ1aWxkZXIubGVuZ3RoKCkpOworCisgICAgICAgICAgICBFeHByZXNzaW9uTm9kZSBub2RlID0gbUZpcnN0Tm9kZTsKKyAgICAgICAgICAgIC8vIFNraXAgdGhlIGZpcnN0IG5vZGUKKyAgICAgICAgICAgIHdoaWxlICgobm9kZSA9IG5vZGUubmV4dCkgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kKG5vZGUuYXNTdHJpbmcoY3Vyc29yKSk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHJldHVybiBidWlsZGVyLnRvU3RyaW5nKCk7CisgICAgICAgIH0KKworICAgICAgICBzdGF0aWMgYWJzdHJhY3QgY2xhc3MgRXhwcmVzc2lvbk5vZGUgeworICAgICAgICAgICAgcHVibGljIEV4cHJlc3Npb25Ob2RlIG5leHQ7CisKKyAgICAgICAgICAgIHB1YmxpYyBhYnN0cmFjdCBTdHJpbmcgYXNTdHJpbmcoQ3Vyc29yIGN1cnNvcik7CisgICAgICAgIH0KKworICAgICAgICBzdGF0aWMgY2xhc3MgQ29uc3RhbnRFeHByZXNzaW9uTm9kZSBleHRlbmRzIEV4cHJlc3Npb25Ob2RlIHsKKyAgICAgICAgICAgIHByaXZhdGUgZmluYWwgU3RyaW5nIG1Db25zdGFudDsKKworICAgICAgICAgICAgQ29uc3RhbnRFeHByZXNzaW9uTm9kZShTdHJpbmcgY29uc3RhbnQpIHsKKyAgICAgICAgICAgICAgICBtQ29uc3RhbnQgPSBjb25zdGFudDsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgQE92ZXJyaWRlCisgICAgICAgICAgICBwdWJsaWMgU3RyaW5nIGFzU3RyaW5nKEN1cnNvciBjdXJzb3IpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gbUNvbnN0YW50OworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgc3RhdGljIGNsYXNzIENvbHVtbkV4cHJlc3Npb25Ob2RlIGV4dGVuZHMgRXhwcmVzc2lvbk5vZGUgeworICAgICAgICAgICAgcHJpdmF0ZSBmaW5hbCBTdHJpbmcgbUNvbHVtbk5hbWU7CisgICAgICAgICAgICBwcml2YXRlIEN1cnNvciBtU2lnbmF0dXJlOworICAgICAgICAgICAgcHJpdmF0ZSBpbnQgbUNvbHVtbkluZGV4ID0gLTE7CisKKyAgICAgICAgICAgIENvbHVtbkV4cHJlc3Npb25Ob2RlKFN0cmluZyBjb2x1bW5OYW1lKSB7CisgICAgICAgICAgICAgICAgbUNvbHVtbk5hbWUgPSBjb2x1bW5OYW1lOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgIHB1YmxpYyBTdHJpbmcgYXNTdHJpbmcoQ3Vyc29yIGN1cnNvcikgeworICAgICAgICAgICAgICAgIGlmIChjdXJzb3IgIT0gbVNpZ25hdHVyZSB8fCBtQ29sdW1uSW5kZXggPT0gLTEpIHsKKyAgICAgICAgICAgICAgICAgICAgbUNvbHVtbkluZGV4ID0gY3Vyc29yLmdldENvbHVtbkluZGV4KG1Db2x1bW5OYW1lKTsKKyAgICAgICAgICAgICAgICAgICAgbVNpZ25hdHVyZSA9IGN1cnNvcjsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICByZXR1cm4gY3Vyc29yLmdldFN0cmluZyhtQ29sdW1uSW5kZXgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogQSBtYXAgdHJhbnNmb3JtYXRpb24gb2ZmZXJzIGEgc2ltcGxlIG1hcHBpbmcgYmV0d2VlbiBzcGVjaWZpZWQgU3RyaW5nIHZhbHVlcworICAgICAqIHRvIFN0cmluZ3Mgb3IgaW50ZWdlcnMuCisgICAgICovCisgICAgcHJpdmF0ZSBzdGF0aWMgY2xhc3MgTWFwVHJhbnNmb3JtYXRpb24gZXh0ZW5kcyBDdXJzb3JUcmFuc2Zvcm1hdGlvbiB7CisgICAgICAgIHByaXZhdGUgZmluYWwgSGFzaE1hcDxTdHJpbmcsIFN0cmluZz4gbVN0cmluZ01hcHBpbmdzOworICAgICAgICBwcml2YXRlIGZpbmFsIEhhc2hNYXA8U3RyaW5nLCBJbnRlZ2VyPiBtUmVzb3VyY2VNYXBwaW5nczsKKworICAgICAgICBwdWJsaWMgTWFwVHJhbnNmb3JtYXRpb24oQ29udGV4dCBjb250ZXh0KSB7CisgICAgICAgICAgICBzdXBlcihjb250ZXh0KTsKKyAgICAgICAgICAgIG1TdHJpbmdNYXBwaW5ncyA9IG5ldyBIYXNoTWFwPFN0cmluZywgU3RyaW5nPigpOworICAgICAgICAgICAgbVJlc291cmNlTWFwcGluZ3MgPSBuZXcgSGFzaE1hcDxTdHJpbmcsIEludGVnZXI+KCk7CisgICAgICAgIH0KKworICAgICAgICB2b2lkIGFkZFN0cmluZ01hcHBpbmcoU3RyaW5nIGZyb20sIFN0cmluZyB0bykgeworICAgICAgICAgICAgbVN0cmluZ01hcHBpbmdzLnB1dChmcm9tLCB0byk7CisgICAgICAgIH0KKworICAgICAgICB2b2lkIGFkZFJlc291cmNlTWFwcGluZyhTdHJpbmcgZnJvbSwgaW50IHRvKSB7CisgICAgICAgICAgICBtUmVzb3VyY2VNYXBwaW5ncy5wdXQoZnJvbSwgdG8pOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBTdHJpbmcgdHJhbnNmb3JtKEN1cnNvciBjdXJzb3IsIGludCBjb2x1bW5JbmRleCkgeworICAgICAgICAgICAgZmluYWwgU3RyaW5nIHZhbHVlID0gY3Vyc29yLmdldFN0cmluZyhjb2x1bW5JbmRleCk7CisgICAgICAgICAgICBmaW5hbCBTdHJpbmcgdHJhbnNmb3JtZWQgPSBtU3RyaW5nTWFwcGluZ3MuZ2V0KHZhbHVlKTsKKyAgICAgICAgICAgIHJldHVybiB0cmFuc2Zvcm1lZCA9PSBudWxsID8gdmFsdWUgOiB0cmFuc2Zvcm1lZDsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgaW50IHRyYW5zZm9ybVRvUmVzb3VyY2UoQ3Vyc29yIGN1cnNvciwgaW50IGNvbHVtbkluZGV4KSB7CisgICAgICAgICAgICBmaW5hbCBTdHJpbmcgdmFsdWUgPSBjdXJzb3IuZ2V0U3RyaW5nKGNvbHVtbkluZGV4KTsKKyAgICAgICAgICAgIGZpbmFsIEludGVnZXIgdHJhbnNmb3JtZWQgPSBtUmVzb3VyY2VNYXBwaW5ncy5nZXQodmFsdWUpOworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICByZXR1cm4gdHJhbnNmb3JtZWQgPT0gbnVsbCA/IEludGVnZXIucGFyc2VJbnQodmFsdWUpIDogdHJhbnNmb3JtZWQ7CisgICAgICAgICAgICB9IGNhdGNoIChOdW1iZXJGb3JtYXRFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgIHJldHVybiAwOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogQmluZHMgYSBTdHJpbmcgdG8gYSBUZXh0Vmlldy4KKyAgICAgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBjbGFzcyBTdHJpbmdCaW5kZXIgZXh0ZW5kcyBDdXJzb3JCaW5kZXIgeworICAgICAgICBwdWJsaWMgU3RyaW5nQmluZGVyKENvbnRleHQgY29udGV4dCwgQ3Vyc29yVHJhbnNmb3JtYXRpb24gdHJhbnNmb3JtYXRpb24pIHsKKyAgICAgICAgICAgIHN1cGVyKGNvbnRleHQsIHRyYW5zZm9ybWF0aW9uKTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgYm9vbGVhbiBiaW5kKFZpZXcgdmlldywgQ3Vyc29yIGN1cnNvciwgaW50IGNvbHVtbkluZGV4KSB7CisgICAgICAgICAgICBpZiAodmlldyBpbnN0YW5jZW9mIFRleHRWaWV3KSB7CisgICAgICAgICAgICAgICAgZmluYWwgU3RyaW5nIHRleHQgPSBtVHJhbnNmb3JtYXRpb24udHJhbnNmb3JtKGN1cnNvciwgY29sdW1uSW5kZXgpOworICAgICAgICAgICAgICAgICgoVGV4dFZpZXcpIHZpZXcpLnNldFRleHQodGV4dCk7CisgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBCaW5kcyBhbiBpbWFnZSBibG9iIHRvIGFuIEltYWdlVmlldy4KKyAgICAgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBjbGFzcyBJbWFnZUJpbmRlciBleHRlbmRzIEN1cnNvckJpbmRlciB7CisgICAgICAgIHB1YmxpYyBJbWFnZUJpbmRlcihDb250ZXh0IGNvbnRleHQsIEN1cnNvclRyYW5zZm9ybWF0aW9uIHRyYW5zZm9ybWF0aW9uKSB7CisgICAgICAgICAgICBzdXBlcihjb250ZXh0LCB0cmFuc2Zvcm1hdGlvbik7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIGJvb2xlYW4gYmluZChWaWV3IHZpZXcsIEN1cnNvciBjdXJzb3IsIGludCBjb2x1bW5JbmRleCkgeworICAgICAgICAgICAgaWYgKHZpZXcgaW5zdGFuY2VvZiBJbWFnZVZpZXcpIHsKKyAgICAgICAgICAgICAgICBmaW5hbCBieXRlW10gZGF0YSA9IGN1cnNvci5nZXRCbG9iKGNvbHVtbkluZGV4KTsKKyAgICAgICAgICAgICAgICAoKEltYWdlVmlldykgdmlldykuc2V0SW1hZ2VCaXRtYXAoQml0bWFwRmFjdG9yeS5kZWNvZGVCeXRlQXJyYXkoZGF0YSwgMCwKKyAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEubGVuZ3RoKSk7CisgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIHN0YXRpYyBjbGFzcyBUYWdCaW5kZXIgZXh0ZW5kcyBDdXJzb3JCaW5kZXIgeworICAgICAgICBwdWJsaWMgVGFnQmluZGVyKENvbnRleHQgY29udGV4dCwgQ3Vyc29yVHJhbnNmb3JtYXRpb24gdHJhbnNmb3JtYXRpb24pIHsKKyAgICAgICAgICAgIHN1cGVyKGNvbnRleHQsIHRyYW5zZm9ybWF0aW9uKTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgYm9vbGVhbiBiaW5kKFZpZXcgdmlldywgQ3Vyc29yIGN1cnNvciwgaW50IGNvbHVtbkluZGV4KSB7CisgICAgICAgICAgICBmaW5hbCBTdHJpbmcgdGV4dCA9IG1UcmFuc2Zvcm1hdGlvbi50cmFuc2Zvcm0oY3Vyc29yLCBjb2x1bW5JbmRleCk7CisgICAgICAgICAgICB2aWV3LnNldFRhZyh0ZXh0KTsKKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogQmluZHMgYW4gaW1hZ2UgVVJJIHRvIGFuIEltYWdlVmlldy4KKyAgICAgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBjbGFzcyBJbWFnZVVyaUJpbmRlciBleHRlbmRzIEN1cnNvckJpbmRlciB7CisgICAgICAgIHB1YmxpYyBJbWFnZVVyaUJpbmRlcihDb250ZXh0IGNvbnRleHQsIEN1cnNvclRyYW5zZm9ybWF0aW9uIHRyYW5zZm9ybWF0aW9uKSB7CisgICAgICAgICAgICBzdXBlcihjb250ZXh0LCB0cmFuc2Zvcm1hdGlvbik7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIGJvb2xlYW4gYmluZChWaWV3IHZpZXcsIEN1cnNvciBjdXJzb3IsIGludCBjb2x1bW5JbmRleCkgeworICAgICAgICAgICAgaWYgKHZpZXcgaW5zdGFuY2VvZiBJbWFnZVZpZXcpIHsKKyAgICAgICAgICAgICAgICAoKEltYWdlVmlldykgdmlldykuc2V0SW1hZ2VVUkkoVXJpLnBhcnNlKAorICAgICAgICAgICAgICAgICAgICAgICAgbVRyYW5zZm9ybWF0aW9uLnRyYW5zZm9ybShjdXJzb3IsIGNvbHVtbkluZGV4KSkpOworICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogQmluZHMgYSBkcmF3YWJsZSByZXNvdXJjZSBpZGVudGlmaWVyIHRvIGFuIEltYWdlVmlldy4KKyAgICAgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBjbGFzcyBEcmF3YWJsZUJpbmRlciBleHRlbmRzIEN1cnNvckJpbmRlciB7CisgICAgICAgIHB1YmxpYyBEcmF3YWJsZUJpbmRlcihDb250ZXh0IGNvbnRleHQsIEN1cnNvclRyYW5zZm9ybWF0aW9uIHRyYW5zZm9ybWF0aW9uKSB7CisgICAgICAgICAgICBzdXBlcihjb250ZXh0LCB0cmFuc2Zvcm1hdGlvbik7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIGJvb2xlYW4gYmluZChWaWV3IHZpZXcsIEN1cnNvciBjdXJzb3IsIGludCBjb2x1bW5JbmRleCkgeworICAgICAgICAgICAgaWYgKHZpZXcgaW5zdGFuY2VvZiBJbWFnZVZpZXcpIHsKKyAgICAgICAgICAgICAgICBmaW5hbCBpbnQgcmVzb3VyY2UgP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hdXRvIGNvbXBsZXRlIGlucHV0IHR5cGUgZmxhZywgc2luY2UgaXQKICAgICAgICAgLy8gbWFrZXMgbm8gc2Vuc2UgdG8gdXNlIHRoaXMgd2lkZ2V0IHdpdGhvdXQgaXQuCkBAIC0yNDEsNiArMjE1LDIwIEBACiAgICAgICovCiAgICAgcHVibGljIHZvaWQgc2V0Q29tcGxldGlvbkhpbnQoQ2hhclNlcXVlbmNlIGhpbnQpIHsKICAgICAgICAgbUhpbnRUZXh0ID0gaGludDsKKyAgICAgICAgaWYgKGhpbnQgIT0gbnVsbCkgeworICAgICAgICAgICAgaWYgKG1IaW50VmlldyA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgZmluYWwgVGV4dFZpZXcgaGludFZpZXcgPSAoVGV4dFZpZXcpIExheW91dEluZmxhdGVyLmZyb20oZ2V0Q29udGV4dCgpKS5pbmZsYXRlKAorICAgICAgICAgICAgICAgICAgICAgICAgbUhpbnRSZXNvdXJjZSwgbnVsbCkuZmluZFZpZXdCeUlkKGNvbS5hbmRyb2lkLmludGVybmFsLlIuaWQudGV4dDEpOworICAgICAgICAgICAgICAgIGhpbnRWaWV3LnNldFRleHQobUhpbnRUZXh0KTsKKyAgICAgICAgICAgICAgICBtSGludFZpZXcgPSBoaW50VmlldzsKKyAgICAgICAgICAgICAgICBtUG9wdXAuc2V0UHJvbXB0VmlldyhoaW50Vmlldyk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIG1IaW50Vmlldy5zZXRUZXh0KGhpbnQpOworICAgICAgICAgICAgfQorICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgbVBvcHVwLnNldFByb21wdFZpZXcobnVsbCk7CisgICAgICAgICAgICBtSGludFZpZXcgPSBudWxsOworICAgICAgICB9CiAgICAgfQogICAgIAogICAgIC8qKgpAQCAtMjUzLDcgKzI0MSw3IEBACiAgICAgICogQGF0dHIgcmVmIGFuZHJvaWQuUi5zdHlsZWFibGUjQXV0b0NvbXBsZX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mc2V0ID0gb2Zmc2V0OworICAgICAgICBtUG9wdXAuc2V0SG9yaXpvbnRhbE9mZnNldChvZmZzZXQpOwogICAgIH0KICAgICAKICAgICAvKioKQEAgLTM4OCw3ICszNzYsNyBAQAogICAgICAqIEByZXR1cm4gdGhlIGhvcml6b250YWwgb2Zmc2V0CiAgICAgICovCiAgICAgcHVibGljIGludCBnZXREcm9wRG93bkhvcml6b250YWxPZmZzZXQoKSB7Ci0gICAgICAgIHJldHVybiBtRHJvcERvd25Ib3Jpem9udGFsT2Zmc2V0OworICAgICAgICByZXR1cm4gbVBvcHVwLmdldEhvcml6b250YWxPZmZzZXQoKTsKICAgICB9CiAKICAgICAgLyoqCkBAIC00MjUsNyArNDEzLDcgQEAKICAgICAgKiBAaGlkZSBQZW5kaW5nIEFQSSBjb3VuY2lsIGFwcHJvdmFsCiAgICAgICovCiAgICAgcHVibGljIGJvb2xlYW4gaXNEcm9wRG93bkFsd2F5c1Zpc2libGUoKSB7Ci0gICAgICAgIHJldHVybiBtRHJvcERvd25BbHdheXNWaXNpYmxlOworICAgICAgICByZXR1cm4gbVBvcHVwLmlzRHJvcERvd25BbHdheXNWaXNpYmxlKCk7CiAgICAgfQogCiAgICAgLyoqCkBAIC00NDIsNyArNDMwLDcgQEAKICAgICAgKiBAaGlkZSBQZW5kaW5nIEFQSSBjb3VuY2lsIGFwcHJvdmFsCiAgICAgICovCiAgICAgcHVibGljIHZvaWQgc2V0RHJvcERvd25BbHdheXNWaXNpYmxlKGJvb2xlYW4gZHJvcERvd25BbHdheXNWaXNpYmxlKSB7Ci0gICAgICAgIG1Ecm9wRG93bkFsd2F5c1Zpc2libGUgPSBkcm9wRG93bkFsd2F5c1Zpc2libGU7CisgICAgICAgIG1Qb3B1cC5zZXREcm9wRG93bkFsd2F5c1Zpc2libGUoZHJvcERvd25BbHdheXNWaXNpYmxlKTsKICAgICB9CiAgICAKICAgICAvKioKQEAgLTYwOSwxNSArNTk3LDEzIEBACiAgICAgICAgICAgICBt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SB7Ci0gICAgICAgICAgICBib29sZWFuIGNvbnN1bWVkID0gbURyb3BEb3duTGlzdC5vbktleVVwKGtleUNvZGUsIGV2ZW50KTsKLSAgICAgICAgICAgIGlmIChjb25zdW1lZCkgewotICAgICAgICAgICAgICAgIHN3aXRjaCAoa2V5Q29kZSkgewotICAgICAgICAgICAgICAgICAgICAvLyBpZiB0aGUgbGlzdCBhY2NlcHRzIHRoZSBrZXkgZXZlbnRzIGFuZCB0aGUga2V5IGV2ZW50Ci0gICAgICAgICAgICAgICAgICAgIC8vIHdhcyBhIGNsaWNrLCB0aGUgdGV4dCB2aWV3IGdldHMgdGhlIHNlbGVjdGVkIGl0ZW0KLSAgICAgICAgICAgICAgICAgICAgLy8gZnJvbSB0aGUgZHJvcCBkb3duIGFzIGl0cyBjb250ZW50Ci0gICAgICAgICAgICAgICAgICAgIGNhc2UgS2V5RXZlbnQuS0VZQ09ERV9FTlRFUjoKLSAgICAgICAgICAgICAgICAgICAgY2FzZSBLZXlFdmVudC5LRVlDT0RFX0RQQURfQ0VOVEVSOgotICAgICAgICAgICAgICAgICAgICAgICAgcGVyZm9ybUNvbXBsZXRpb24oKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICAgICAgICAgIH0KKyAgICAgICAgYm9vbGVhbiBjb25zdW1lZCA9IG1Qb3B1cC5vbktleVVwKGtleUNvZGUsIGV2ZW50KTsKKyAgICAgICAgaWYgKGNvbnN1bWVkKSB7CisgICAgICAgICAgICBzd2l0Y2ggKGtleUNvZGUpIHsKKyAgICAgICAgICAgIC8vIGlmIHRoZSBsaXN0IGFjY2VwdHMgdGhlIGtleSBldmVudHMgYW5kIHRoZSBrZXkgZXZlbnQKKyAgICAgICAgICAgIC8vIHdhcyBhIGNsaWNrLCB0aGUgdGV4dCB2aWV3IGdldHMgdGhlIHNlbGVjdGVkIGl0ZW0KKyAgICAgICAgICAgIC8vIGZyb20gdGhlIGRyb3AgZG93biBhcyBpdHMg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V9TUEFDRQotICAgICAgICAgICAgICAgICAgICAmJiAobURyb3BEb3duTGlzdC5nZXRTZWxlY3RlZEl0ZW1Qb3NpdGlvbigpID49IDAKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB8fCAoa2V5Q29kZSAhPSBLZXlFdmVudC5LRVlDT0RFX0VOVEVSCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmJiBrZXlDb2RlICE9IEtleUV2ZW50LktFWUNPREVfRFBBRF9DRU5URVIpKSkgewotICAgICAgICAgICAgICAgIGludCBjdXJJbmRleCA9IG1Ecm9wRG93bkxpc3QuZ2V0U2VsZWN0ZWRJdGVtUG9zaXRpb24oKTsKLSAgICAgICAgICAgICAgICBib29sZWFuIGNvbnN1bWVkOwotCi0gICAgICAgICAgICAgICAgZmluYWwgYm9vbGVhbiBiZWxvdyA9ICFtUG9wdXAuaXNBYm92ZUFuY2hvcigpOwotCi0gICAgICAgICAgICAgICAgZmluYWwgTGlzdEFkYXB0ZXIgYWRhcHRlciA9IG1BZGFwdGVyOwotICAgICAgICAgICAgICAgIAotICAgICAgICAgICAgICAgIGJvb2xlYW4gYWxsRW5hYmxlZDsKLSAgICAgICAgICAgICAgICBpbnQgZmlyc3RJdGVtID0gSW50ZWdlci5NQVhfVkFMVUU7Ci0gICAgICAgICAgICAgICAgaW50IGxhc3RJdGVtID0gSW50ZWdlci5NSU5fVkFMVUU7Ci0KLSAgICAgICAgICAgICAgICBpZiAoYWRhcHRlciAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIGFsbEVuYWJsZWQgPSBhZGFwdGVyLmFyZUFsbEl0ZW1zRW5hYmxlZCgpOwotICAgICAgICAgICAgICAgICAgICBmaXJzdEl0ZW0gPSBhbGxFbmFibGVkID8gMCA6Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbURyb3BEb3duTGlzdC5sb29rRm9yU2VsZWN0YWJsZVBvc2l0aW9uKDAsIHRydWUpOwotICAgICAgICAgICAgICAgICAgICBsYXN0SXRlbSA9IGFsbEVuYWJsZWQgPyBhZGFwdGVyLmdldENvdW50KCkgLSAxIDoKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBtRHJvcERvd25MaXN0Lmxvb2tGb3JTZWxlY3RhYmxlUG9zaXRpb24oYWRhcHRlci5nZXRDb3VudCgpIC0gMSwgZmFsc2UpOyAgICAgICAgICAgICAgICAgICAgCi0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIAotICAgICAgICAgICAgICAgIGlmICgoYmVsb3cgJiYga2V5Q29kZSA9PSBLZXlFdmVudC5LRVlDT0RFX0RQQURfVVAgJiYgY3VySW5kZXggPD0gZmlyc3RJdGVtKSB8fAotICAgICAgICAgICAgICAgICAgICAgICAgKCFiZWxvdyAmJiBrZXlDb2RlID09IEtleUV2ZW50LktFWUNPREVfRFBBRF9ET1dOICYmIGN1ckluZGV4ID49IGxhc3RJdGVtKSkgewotICAgICAgICAgICAgICAgICAgICAvLyBXaGVuIHRoZSBzZWxlY3Rpb24gaXMgYXQgdGhlIHRvcCwgd2UgYmxvY2sgdGhlIGtleQotICAgICAgICAgICAgICAgICAgICAvLyBldmVudCB0byBwcmV2ZW50IGZvY3VzIGZyb20gbW92aW5nLgotICAgICAgICAgICAgICAgICAgICBjbGVhckxpc3RTZWxlY3Rpb24oKTsKLSAgICAgICAgICAgICAgICAgICAgbVBvcHVwLnNldElucHV0TWV0aG9kTW9kZShQb3B1cFdpbmRvdy5JTlBVVF9NRVRIT0RfTkVFREVEKTsKLSAgICAgICAgICAgICAgICAgICAgc2hvd0Ryb3BEb3duKCk7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIC8vIFdBUk5JTkc6IFBsZWFzZSByZWFkIHRoZSBjb21tZW50IHdoZXJlIG1MaXN0U2VsZWN0aW9uSGlkZGVuCi0gICAgICAgICAgICAgICAgICAgIC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9wRG93bkxpc3QucmVxdWVzdEZvY3VzRnJvbVRvdWNoKCk7Ci0gICAgICAgICAgICAgICAgICAgIHNob3dEcm9wRG93bigpOwotCi0gICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoa2V5Q29kZSkgewotICAgICAgICAgICAgICAgICAgICAgICAgLy8gYXZvaWQgcGFzc2luZyB0aGUgZm9jdXMgZnJvbSB0aGUgdGV4dCB2aWV3IHRvIHRoZQotICAgICAgICAgICAgICAgICAgICAgICAgLy8gbmV4dCBjb21wb25lbnQKLSAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgS2V5RXZlbnQuS0VZQ09ERV9FTlRFUjoKLSAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgS2V5RXZlbnQuS0VZQ09ERV9EUEFEX0NFTlRFUjoKLSAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgS2V5RXZlbnQuS0VZQ09ERV9EUEFEX0RPV046Ci0gICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEtleUV2ZW50LktFWUNPREVfRFBBRF9VUDoKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChiZWxvdyAmJiBrZXlDb2RlID09IEtleUV2ZW50LktFWUNPREVfRFBBRF9ET1dOKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAvLyB3aGVuIHRoZSBzZWxlY3Rpb24gaXMgYXQgdGhlIGJvdHRvbSwgd2UgYmxvY2sgdGhlCi0gICAgICAgICAgICAgICAgICAgICAgICAvLyBldmVudCB0byBhdm9pZCBnb2luZyB0byB0aGUgbmV4dCBmb2N1c2FibGUgd2lkZ2V0Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoY3VySW5kZXggPT0gbGFzdEl0ZW0pIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICghYmVsb3cgJiYga2V5Q29kZSA9PSBLZXlFdmVudC5LRVlDT0RFX0RQQURfVVAgJiYKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBjdXJJbmRleCA9PSBmaXJzdEl0ZW0pIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICB9IGVsc2UgeworICAgICAgICBpZiAobVBvcHVwLm9uS2V5RG93bihrZXlDb2RlLCBldmVudCkpIHsKKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICBpZiAoIWlzUG9wdXBTaG93aW5nKCkpIHsKICAgICAgICAgICAgIHN3aXRjaChrZXlDb2RlKSB7CiAgICAgICAgICAgICBjYXNlIEtleUV2ZW50LktFWUNPREVfRFBBRF9ET1dOOgogICAgICAgICAgICAgICAgIHBlcmZvcm1WYWxpZGF0aW9uKCk7CkBAIC03NDYsNyArNjU0LDcgQEAKICAgICAgICAgYm9vbGVhbiBoYW5kbGVkID0gc3VwZXIub25LZXlEb3duKGtleUNvZGUsIGV2ZW50KTsKICAgICAgICAgbUxhc3RLZXlDb2RlID0gS2V5RXZlbnQuS0VZQ09ERV9VTktOT1dOOwogCi0gICAgICAgIGlmIChoYW5kbGVkICYmIGlzUG9wdXBTaG93aW5nKCkgJiYgbURyb3BEb3duTGlzdCAhPSBudWxsKSB7CisgICAgICAgIGlmIChoYW5kbGVkICYmIGlzUG9wdXBTaG93aW5nKCkpIHsKICAgICAgICAgICAgIGNsZWFyTGlzdFNlbGVjdGlvbigpOwogICAgICAgICB9CiAKQEAgLTgwNywxMSArNzE1LDEyIEBACiAgICAgICAgIGlmIChlbm91Z2hUb0ZpbHRlcigpKSB7CiAgICAgICAgICAgICBpZiAobUZpbHRlciAhPSBudWxsKSB7CiAgICAgICAgICAgICAgICAgcGVyZm9ybUZpbHRlcmluZyhnZXRUZXh0KCksIG1MYXN0S2V5Q29kZSk7CisgICAgICAgICAgICAgICAgYnVpbGRJbWVDb21wbGV0aW9ucygpOwogICAgICAgICAgICAgfQogICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgLy8gZHJvcCBkb3duIGlzIGF1dG9tYXRpY2FsbHkgZGlzbWlzc2VkIHdoZW4gZW5vdWdoIGNoYXJhY3RlcnMKICAgICAgICAgICAgIC8vIGFyZSBkZWxldGVkIGZyb20gdGhlIHRleHQgdmlldwotICAgICAgICAgICAgaWYgKCFtRHJvcERvd25BbHdheXNWaXNpYmxlKSBkaXNtaXNzRHJvcERvd24oKTsKKyAgICAgICAgICAgIGlmICghbVBvcHVwLmlzRHJvcERvd25BbHdheXNWaXNpYmxlKCkpIGRpc21pc3NEcm9wRG93bigpOwogICAgICAgICAgICAgaWYgKG1GaWx0ZXIgIT0gbnVsbCkgewogICAgICAgICAgICAgICAgIG1GaWx0ZXIuZmlsdGVyKG51bGwpOwogICAgICAgICAgICAgfQpAQCAtODQ0LDEzICs3NTMsNyBAQAogICAgICAqIGl0IGJhY2suCiAgICAgICovCiAgICAgcHVibGljIHZvaWQgY2xlYXJMaXN0U2VsZWN0aW9uKCkgewotICAgICAgICBmaW5hbCBEcm9wRG93bkxpc3RWaWV3IGxpc3QgPSBtRHJvcERvd25MaXN0OwotICAgICAgICBpZiAobGlzdCAhPSBudWxsKSB7Ci0gICAgICAgICAgICAvLyBXQVJOSU5HOiBQbGVhc2UgcmVhZCB0aGUgY29tbWVudCB3aGVyZSBtTGlzdFNlbGVjdGlvbkhpZGRlbiBpcyBkZWNsYXJlZAotICAgICAgICAgICAgbGlzdC5tTGlzdFNlbGVjdGlvbkhpZGRlbiA9IHRydWU7Ci0gICAgICAgICAgICBsaXN0LmhpZGVTZWxlY3RvcigpOwotICAgICAgICAgICAgb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T047CisgICAgICAgIHJldHVybiBtUG9wdXAuZ2V0U2VsZWN0ZWRJdGVtUG9zaXRpb24oKTsKICAgICB9CiAKICAgICAvKioKQEAgLTkxNCwxMyArODEwLDcgQEAKICAgICAgICAgICAgIHJlcGxhY2VUZXh0KGNvbXBsZXRpb24uZ2V0VGV4dCgpKTsKICAgICAgICAgICAgIG1CbG9ja0NvbXBsZXRpb24gPSBmYWxzZTsKIAotICAgICAgICAgICAgaWYgKG1JdGVtQ2xpY2tMaXN0ZW5lciAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgZmluYWwgRHJvcERvd25MaXN0VmlldyBsaXN0ID0gbURyb3BEb3duTGlzdDsKLSAgICAgICAgICAgICAgICAvLyBOb3RlIHRoYXQgd2UgZG9uJ3QgaGF2ZSBhIFZpZXcgaGVyZSwgc28gd2Ugd2lsbCBuZWVkIHRvCi0gICAgICAgICAgICAgICAgLy8gc3VwcGx5IG51bGwuICBIb3BlZnVsbHkgbm8gZXhpc3RpbmcgYXBwcyBjcmFzaC4uLgotICAgICAgICAgICAgICAgIG1JdGVtQ2xpY2tMaXN0ZW5lci5vbkl0ZW1DbGljayhsaXN0LCBudWxsLCBjb21wbGV0aW9uLmdldFBvc2l0aW9uKCksCi0gICAgICAgICAgICAgICAgICAgICAgICBjb21wbGV0aW9uLmdldElkKCkpOwotICAgICAgICAgICAgfQorICAgICAgICAgICAgbVBvcHVwLnBlcmZvcm1JdGVtQ2xpY2soY29tcGxldGlvbi5nZXRQb3NpdGlvbigpKTsKICAgICAgICAgfQogICAgIH0KIApAQCAtOTI4LDcgKzgxOCw3IEBACiAgICAgICAgIGlmIChpc1BvcHVwU2hvd2luZygpKSB7CiAgICAgICAgICAgICBPYmplY3Qgc2VsZWN0ZWRJdGVtOwogICAgICAgICAgICAgaWYgKHBvc2l0aW9uIDwgMCkgewotICAgICAgICAgICAgICAgIHNlbGVjdGVkSXRlbSA9IG1Ecm9wRG93bkxpc3QuZ2V0U2VsZWN0ZWRJdGVtKCk7CisgICAgICAgICAgICAgICAgc2VsZWN0ZWRJdGVtID0gbVBvcHVwLmdldFNlbGVjdGVkSXRlbSgpOwogICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICBzZWxlY3RlZEl0ZW0gPSBtQWRhcHRlci5nZXRJdGVtKHBvc2l0aW9uKTsKICAgICAgICAgICAgIH0KQEAgLTk0MiwxOCArODMyLDE4IEBACiAgICAgICAgICAgICBtQmxvY2tDb21wbGV0aW9uID0gZmFsc2U7ICAgICAgICAgICAgCiAKICAgICAgICAgICAgIGlmIChtSXRlbUNsaWNrTGlzdGVuZXIgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIGZpbmFsIERyb3BEb3duTGlzdFZpZXcgbGlzdCA9IG1Ecm9wRG93bkxpc3Q7CisgICAgICAgICAgICAgICAgZmluYWwgTGlzdFBvcHVwV2luZG93IGxpc3QgPSBtUG9wdXA7CiAKICAgICAgICAgICAgICAgICBpZiAoc2VsZWN0ZWRWaWV3ID09IG51bGwgfHwgcG9zaXRpb24gPCAwKSB7CiAgICAgICAgICAgICAgICAgICAgIHNlbGVjdGVkVmlldyA9IGxpc3QuZ2V0U2VsZWN0ZWRWaWV3KCk7CiAgICAgICAgICAgICAgICAgICAgIHBvc2l0aW9uID0gbGlzdC5nZXRTZWxlY3RlZEl0ZW1Qb3NpdGlvbigpOwogICAgICAgICAgICAgICAgICAgICBpZCA9IGxpc3QuZ2V0U2VsZWN0ZWRJdGVtSWQoKTsKICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgbUl0ZW1DbGlja0xpc3RlbmVyLm9uSXRlbUNsaWNrKGxpc3QsIHNlbGVjdGVkVmlldywgcG9zaXRpb24sIGlkKTsKKyAgICAgICAgICAgICAgICBtSXRlbUNsaWNrTGlzdGVuZXIub25JdGVtQ2xpY2sobGlzdC5nZXRMaXN0VmlldygpLCBzZWxlY3RlZFZpZXcsIHBvc2l0aW9uLCBpZCk7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KIAotICAgICAgICBpZiAobURyb3BEb3duRGlzbWlzc2VkT25Db21wbGV0aW9uICYmICFtRHJvcERvd25BbHdheXNWaXNpYmxlKSB7CisgICAgICAgIGlmIChtRHJvcERvd25EaXNtaXNzZWRPbkNvbXBsZXRpb24gJiYgIW1Qb3B1cC5pc0Ryb3BEb3duQWx3YXlzVmlzaWJsZSgpKSB7CiAgICAgICAgICAgICBkaXNtaXNzRHJvcERvd24oKTsKICAgICAgICAgfQogICAgIH0KQEAgLTEwMDMsNyArODkzLDYgQEAKICAgICAvKioge0Bpbmhlcml0RG9jfSAqLwogICAgIHB1YmxpYyB2b2lkIG9uRmlsdGVyQ29tcGxldGUoaW50IGNvdW50KSB7CiAgICAgICAgIHVwZGF0ZURyb3BEb3duRm9yRmlsdGVyKGNvdW50KTsKLQogICAgIH0KIAogICAgIHByaXZhdGUgdm9pZCB1cGRhdGVEcm9wRG93bkZvckZpbHRlcihpbnQgY291bnQpIHsKQEAgLTEwMTcsMTEgKzkwNiwxMiBAQAogICAgICAgICAgKiB0byBmaWx0ZXIuCiAgICAgICAgICAqLwogCi0gICAgICAgIGlmICgoY291bnQgPiAwIHx8IG1Ecm9wRG93bkFsd2F5c1Zpc2libGUpICYmIGVub3VnaFRvRmlsdGVyKCkpIHsKKyAgICAgICAgZmluYWwgYm9vbGVhbiBkcm9wRG93bkFsd2F5c1Zpc2libGUgPSBtUG9wdXAuaXNEcm9wRG93bkFsd2F5c1Zpc2libGUoKTsKKyAgICAgICAgaWYgKChjb3VudCA+IDAgfHwgZHJvcERvd25BbHdheXNWaXNpYmxlKSAmJiBlbm91Z2hUb0ZpbHRlcigpKSB7CiAgICAgICAgICAgICBpZiAoaGFzRm9jdXMoKSAmJiBoYXNXaW5kb3dGb2N1cygpKSB7CiAgICAgICAgICAgICAgICAgc2hvd0Ryb3BEb3duKCk7CiAgICAgICAgICAgICB9Ci0gICAgICAgIH0gZWxzZSBpZiAoIW1Ecm9wRG93bkFsd2F5c1Zpc2libGUpIHsKKyAgICAgICAgfSBlbHNlIGlmICghZHJvcERvd25BbHdheXNWaXNpYmxlKSB7CiAgICAgICAgICAgICBkaXNtaXNzRHJvcERvd24oKTsKICAgICAgICAgfQogICAgIH0KQEAgLTEwMjksNyArOTE5LDcgQEAKICAgICBAT3ZlcnJpZGUKICAgICBwdWJsaWMgdm9pZCBvbldpbmRvd0ZvY3VzQ2hhbmdlZChib29sZWFuIGhhc1dpbmRvd0ZvY3VzKSB7CiAgICAgICAgIHN1cGVyLm9uV2luZG93Rm9jdXNDaGFuZ2VkKGhhc1dpbmRvd0ZvY3VzKTsKLSAgICAgICAgaWYgKCFoYXNXaW5kb3dGb2N1cyAmJiAhbURyb3BEb3duQWx3YXlzVmlzaWJsZSkgeworICAgICAgICBpZiAoIWhhc1dpbmRvd0ZvY3VzICYmICFtUG9wdXAuaXNEcm9wRG93bkFsd2F5c1Zpc2libGUoKSkgewogICAgICAgICAgICAgZGlzbWlzc0Ryb3BEb3duKCk7CiAgICAgICAgIH0KICAgICB9CkBAIC0xMDM5LDcgKzkyOSw3IEBACiAgICAgICAgIHN1cGVyLm9uRGlzcGxheUhpbnQoaGludCk7CiAgICAgICAgIHN3aXRjaCAoaGludCkgewogICAgICAgICAgICAgY2FzZSBJTlZJU0lCTEU6Ci0gICAgICAgICAgICAgICAgaWYgKCFtRHJvcERvd25BbHdheXNWaXNpYmxlKSB7CisgICAgICAgICAgICAgICAgaWYgKCFtUG9wdXAuaXNEcm9wRG93bkFsd2F5c1Zpc2libGUoKSkgewogICAgICAgICAgICAgICAgICAgICBkaXNtaXNzRHJvcERvd24oKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgYnJlYWs7CkBAIC0xMDUzLDcgKzk0Myw3IEBACiAgICAgICAgIGlmICghZm9jdXNlZCkgewogICAgICAgICAgICAgcGVyZm9ybVZhbGlkYXRpb24oKTsKICAgICAgICAgfQotICAgICAgICBpZiAoIWZvY3VzZWQgJiYg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vd25BbmNob3JJZCk7Ci0gICAgICAgIH0KLSAgICAgICAgcmV0dXJuIG1Ecm9wRG93bkFuY2hvclZpZXcgPT0gbnVsbCA/IHRoaXMgOiBtRHJvcERvd25BbmNob3JWaWV3OwotICAgIH0KIAogICAgIC8qKgogICAgICAqIElzc3VlcyBhIHJ1bm5hYmxlIHRvIHNob3cgdGhlIGRyb3Bkb3duIGFzIHNvb24gYXMgcG9zc2libGUuCkBAIC0xMTExLDcgKzk4Nyw3IEBACiAgICAgICogQGhpZGUgaW50ZXJuYWwgdXNlZCBvbmx5IGJ5IFNlYXJjaERpYWxvZwogICAgICAqLwogICAgIHB1YmxpYyB2b2lkIHNob3dEcm9wRG93bkFmdGVyTGF5b3V0KCkgewotICAgICAgICBwb3N0KG1TaG93RHJvcERvd25SdW5uYWJsZSk7CisgICAgICAgIG1Qb3B1cC5wb3N0U2hvdygpOwogICAgIH0KICAgICAKICAgICAvKioKQEAgLTExMjIsNyArOTk4LDcgQEAKICAgICAgKi8KICAgICBwdWJsaWMgdm9pZCBlbnN1cmVJbWVWaXNpYmxlKGJvb2xlYW4gdmlzaWJsZSkgewogICAgICAgICBtUG9wdXAuc2V0SW5wdXRNZXRob2RNb2RlKHZpc2libGUKLSAgICAgICAgICAgICAgICA/IFBvcHVwV2luZG93LklOUFVUX01FVEhPRF9ORUVERUQgOiBQb3B1cFdpbmRvdy5JTlBVVF9NRVRIT0RfTk9UX05FRURFRCk7CisgICAgICAgICAgICAgICAgPyBMaXN0UG9wdXBXaW5kb3cuSU5QVVRfTUVUSE9EX05FRURFRCA6IExpc3RQb3B1cFdpbmRvdy5JTlBVVF9NRVRIT0RfTk9UX05FRURFRCk7CiAgICAgICAgIHNob3dEcm9wRG93bigpOwogICAgIH0KIApAQCAtMTEzMCw4OSArMTAwNiwyMSBAQAogICAgICAqIEBoaWRlIGludGVybmFsIHVzZWQgb25seSBoZXJlIGFuZCBTZWFyY2hEaWFsb2cKICAgICAgKi8KICAgICBwdWJsaWMgYm9vbGVhbiBpc0lucHV0TWV0aG9kTm90TmVlZGVkKCkgewotICAgICAgICByZXR1cm4gbVBvcHVwLmdldElucHV0TWV0aG9kTW9kZSgpID09IFBvcHVwV2luZG93LklOUFVUX01FVEhPRF9OT1RfTkVFREVEOworICAgICAgICByZXR1cm4gbVBvcHVwLmdldElucHV0TWV0aG9kTW9kZSgpID09IExpc3RQb3B1cFdpbmRvdy5JTlBVVF9NRVRIT0RfTk9UX05FRURFRDsKICAgICB9CiAKICAgICAvKioKICAgICAgKiA8cD5EaXNwbGF5cyB0aGUgZHJvcCBkb3duIG9uIHNjcmVlbi48L3A+CiAgICAgICovCiAgICAgcHVibGljIHZvaWQgc2hvd0Ryb3BEb3duKCkgewotICAgICAgICBpbnQgaGVpZ2h0ID0gYnVpbGREcm9wRG93bigpOwotCi0gICAgICAgIGludCB3aWR0aFNwZWMgPSAwOwotICAgICAgICBpbnQgaGVpZ2h0U3BlYyA9IDA7Ci0KLSAgICAgICAgYm9vbGVhbiBub0lucHV0TWV0aG9kID0gaXNJbnB1dE1ldGhvZE5vdE5lZWRlZCgpOwotCi0gICAgICAgIGlmIChtUG9wdXAuaXNTaG93aW5nKCkpIHsKLSAgICAgICAgICAgIGlmIChtRHJvcERvd25XaWR0aCA9PSBWaWV3R3JvdXAuTGF5b3V0UGFyYW1zLk1BVENIX1BBUkVOVCkgewotICAgICAgICAgICAgICAgIC8vIFRoZSBjYWxsIHRvIFBvcHVwV2luZG93J3MgdXBkYXRlIG1ldGhvZCBiZWxvdyBjYW4gYWNjZXB0IC0xIGZvciBhbnkKLSAgICAgICAgICAgICAgICAvLyB2YWx1ZSB5b3UgZG8gbm90IHdhbnQgdG8gdXBkYXRlLgotICAgICAgICAgICAgICAgIHdpZHRoU3BlYyA9IC0xOwotICAgICAgICAgICAgfSBlbHNlIGlmIChtRHJvcERvd25XaWR0aCA9PSBWaWV3R3JvdXAuTGF5b3V0UGFyYW1zLldSQVBfQ09OVEVOVCkgewotICAgICAgICAgICAgICAgIHdpZHRoU3BlYyA9IGdldERyb3BEb3duQW5jaG9yVmlldygpLmdldFdpZHRoKCk7CisgICAgICAgIGlmIChtUG9wdXAuZ2V0QW5jaG9yVmlldygpID09IG51bGwpIHsKKyAgICAgICAgICAgIGlmIChtRHJvcERvd25BbmNob3JJZCAhPSBWaWV3Lk5PX0lEKSB7CisgICAgICAgICAgICAgICAgbVBvcHVwLnNldEFuY2hvclZpZXcoZ2V0Um9vdFZpZXcoKS5maW5kVmlld0J5SWQobURyb3BEb3duQW5jaG9ySWQpKTsKICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgd2lkdGhTcGVjID0gbURyb3BEb3duV2lkdGg7CisgICAgICAgICAgICAgICAgbVBvcHVwLnNldEFuY2hvclZpZXcodGhpcyk7CiAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGlmIChtRHJvcERvd25IZWlnaHQgPT0gVmlld0dyb3VwLkxheW91dFBhcmFtcy5NQVRDSF9QQVJFTlQpIHsKLSAgICAgICAgICAgICAgICAvLyBUaGUgY2FsbCB0byBQb3B1cFdpbmRvdydzIHVwZGF0ZSBtZXRob2QgYmVsb3cgY2FuIGFjY2VwdCAtMSBmb3IgYW55Ci0gICAgICAgICAgICAgICAgLy8gdmFsdWUgeW91IGRvIG5vdCB3YW50IHRvIHVwZGF0ZS4KLSAgICAgICAgICAgICAgICBoZWlnaHRTcGVjID0gbm9JbnB1dE1ldGhvZCA/IGhlaWdodCA6IFZpZXdHcm91cC5MYXlvdXRQYXJhbXMuTUFUQ0hfUEFSRU5UOwotICAgICAgICAgICAgICAgIGlmIChub0lucHV0TWV0aG9kKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1Qb3B1cC5zZXRXaW5kb3dMYXlvdXRNb2RlKAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Ecm9wRG93bldpZHRoID09IFZpZXdHcm91cC5MYXlvdXRQYXJhbXMuTUFUQ0hfUEFSRU5UID8KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFZpZXdHcm91cC5MYXlvdXRQYXJhbXMuTUFUQ0hfUEFSRU5UIDogMCwgMCk7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgbVBvcHVwLnNldFdpbmRvd0xheW91dE1vZGUoCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbURyb3BEb3duV2lkdGggPT0gVmlld0dyb3VwLkxheW91dFBhcmFtcy5NQVRDSF9QQVJFTlQgPwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVmlld0dyb3VwLkxheW91dFBhcmFtcy5NQVRDSF9QQVJFTlQgOiAwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIFZpZXdHcm91cC5MYXlvdXRQYXJhbXMuTUFUQ0hfUEFSRU5UKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9IGVsc2UgaWYgKG1Ecm9wRG93bkhlaWdodCA9PSBWaWV3R3JvdXAuTGF5b3V0UGFyYW1zLldSQVBfQ09OVEVOVCkgewotICAgICAgICAgICAgICAgIGhlaWdodFNwZWMgPSBoZWlnaHQ7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIGhlaWdodFNwZWMgPSBtRHJvcERvd25IZWlnaHQ7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIG1Qb3B1cC5zZXRPdXRzaWRlVG91Y2hhYmxlKCFtRm9yY2VJZ25vcmVPdXRzaWRlVG91Y2ggJiYgIW1Ecm9wRG93bkFsd2F5c1Zpc2libGUpOwotCi0gICAgICAgICAgICBtUG9wdXAudXBkYXRlKGdldERyb3BEb3duQW5jaG9yVmlldygpLCBtRHJvcERvd25Ib3Jpem9udGFsT2Zmc2V0LAotICAgICAgICAgICAgICAgICAgICBtRHJvcERvd25WZXJ0aWNhbE9mZnNldCwgd2lkdGhTcGVjLCBoZWlnaHRTcGVjKTsKLSAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgIGlmIChtRHJvcERvd25XaWR0aCA9PSBWaWV3R3JvdXAuTGF5b3V0UGFyYW1zLk1BVENIX1BBUkVOVCkgewotICAgICAgICAgICAgICAgIHdpZHRoU3BlYyA9IFZpZXdHcm91cC5MYXlvdXRQYXJhbXMuTUFUQ0hfUEFSRU5UOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBpZiAobURyb3BEb3duV2lkdGggPT0gVmlld0dyb3VwLkxheW91dFBhcmFtcy5XUkFQX0NPTlRFTlQpIHsKLSAgICAgICAgICAgICAgICAgICAgbVBvcHVwLnNldFdpZHRoKGdldERyb3BEb3duQW5jaG9yVmlldygpLmdldFdpZHRoKCkpOwotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIG1Qb3B1cC5zZXRXaWR0aChtRHJvcERvd25XaWR0aCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBpZiAobURyb3BEb3duSGVpZ2h0ID09IFZpZXdHcm91cC5MYXlvdXRQYXJhbXMuTUFUQ0hfUEFSRU5UKSB7Ci0gICAgICAgICAgICAgICAgaGVpZ2h0U3BlYyA9IFZpZXdHcm91cC5MYXlvdXRQYXJhbXMuTUFUQ0hfUEFSRU5UOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBpZiAobURyb3BEb3duSGVpZ2h0ID09IFZpZXdHcm91cC5MYXlvdXRQYXJhbXMuV1JBUF9DT05URU5UKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1Qb3B1cC5zZXRIZWlnaHQoaGVpZ2h0KTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBtUG9wdXAuc2V0SGVpZ2h0KG1Ecm9wRG93bkhlaWdodCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBt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heUNvbXBsZXRpb25zKHRoaXMsIGNvbXBsZXRpb25zKTsKICAgICAgICAgICAgIH0KICAgICAgICAgfQotCi0gICAgICAgIGlmIChtRHJvcERvd25MaXN0ID09IG51bGwpIHsKLSAgICAgICAgICAgIENvbnRleHQgY29udGV4dCA9IGdldENvbnRleHQoKTsKLQotICAgICAgICAgICAgbUhpZGVTZWxlY3RvciA9IG5ldyBMaXN0U2VsZWN0b3JIaWRlcigpOwotCi0gICAgICAgICAgICAvKioKLSAgICAgICAgICAgICAqIFRoaXMgUnVubmFibGUgZXhpc3RzIGZvciB0aGUgc29sZSBwdXJwb3NlIG9mIGNoZWNraW5nIGlmIHRoZSB2aWV3IGxheW91dCBoYXMgZ290Ci0gICAgICAgICAgICAgKiBjb21wbGV0ZWQgYW5kIGlmIHNvIGNhbGwgc2hvd0Ryb3BEb3duIHRvIGRpc3BsYXkgdGhlIGRyb3AgZG93bi4gVGhpcyBpcyB1c2VkIHRvIHNob3cKLSAgICAgICAgICAgICAqIHRoZSBkcm9wIGRvd24gYXMgc29vbiBhcyBwb3NzaWJsZSBhZnRlciB1c2VyIG9wZW5zIHVwIHRoZSBzZWFyY2ggZGlhbG9nLCB3aXRob3V0Ci0gICAgICAgICAgICAgKiB3YWl0aW5nIGZvciB0aGUgbm9ybWFsIFVJIHBpcGVsaW5lIHRvIGRvIGl0J3Mgam9iIHdoaWNoIGlzIHNsb3dlciB0aGFuIHRoaXMgbWV0aG9kLgotICAgICAgICAgICAgICovCi0gICAgICAgICAgICBtU2hvd0Ryb3BEb3duUnVubmFibGUgPSBuZXcgUnVubmFibGUoKSB7Ci0gICAgICAgICAgICAgICAgcHVibGljIHZvaWQgcnVuKCkgewotICAgICAgICAgICAgICAgICAgICAvLyBWaWV3IGxheW91dCBzaG91bGQgYmUgYWxsIGRvbmUgYmVmb3JlIGRpc3BsYXlpbmcgdGhlIGRyb3AgZG93bi4KLSAgICAgICAgICAgICAgICAgICAgVmlldyB2aWV3ID0gZ2V0RHJvcER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ICAgICAgICAgICAgICBpZiAocG9zaXRpb24gIT0gLTEpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIERyb3BEb3duTGlzdFZpZXcgZHJvcERvd25MaXN0ID0gbURyb3BEb3duTGlzdDsKLQotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRyb3BEb3duTGlzdCAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZHJvcERvd25MaXN0Lm1MaXN0U2VsZWN0aW9uSGlkZGVuID0gZmFsc2U7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBvbk5vdGhpbmdTZWxlY3RlZChBZGFwdGVyVmlldzw/PiBwYXJlbnQpIHsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9KTsKLSAgICAgICAgICAgIG1Ecm9wRG93bkxpc3Quc2V0T25TY3JvbGxMaXN0ZW5lcihuZXcgUG9wdXBTY3JvbGxMaXN0ZW5lcigpKTsKLQotICAgICAgICAgICAgaWYgKG1JdGVtU2VsZWN0ZWRMaXN0ZW5lciAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgbURyb3BEb3duTGlzdC5zZXRPbkl0ZW1TZWxlY3RlZExpc3RlbmVyKG1JdGVtU2VsZWN0ZWRMaXN0ZW5lcik7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGRyb3BEb3duVmlldyA9IG1Ecm9wRG93bkxpc3Q7Ci0KLSAgICAgICAgICAgIFZpZXcgaGludFZpZXcgPSBnZXRIaW50Vmlldyhjb250ZXh0KTsKLSAgICAgICAgICAgIGlmIChoaW50VmlldyAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgLy8gaWYgYW4gaGludCBoYXMgYmVlbiBzcGVjaWZpZWQsIHdlIGFjY29tb2RhdGUgbW9yZSBzcGFjZSBmb3IgaXQgYW5kCi0gICAgICAgICAgICAgICAgLy8gYWRkIGEgdGV4dCB2aWV3IGluIHRoZSBkcm9wIGRvd24gbWVudSwgYXQgdGhlIGJvdHRvbSBvZiB0aGUgbGlzdAotICAgICAgICAgICAgICAgIExpbmVhckxheW91dCBoaW50Q29udGFpbmVyID0gbmV3IExpbmVhckxheW91dChjb250ZXh0KTsKLSAgICAgICAgICAgICAgICBoaW50Q29udGFpbmVyLnNldE9yaWVudGF0aW9uKExpbmVhckxheW91dC5WRVJUSUNBTCk7Ci0KLSAgICAgICAgICAgICAgICBMaW5lYXJMYXlvdXQuTGF5b3V0UGFyYW1zIGhpbnRQYXJhbXMgPSBuZXcgTGluZWFyTGF5b3V0LkxheW91dFBhcmFtcygKLSAgICAgICAgICAgICAgICAgICAgICAgIFZpZXdHcm91cC5MYXlvdXRQYXJhbXMuTUFUQ0hfUEFSRU5ULCAwLCAxLjBmCi0gICAgICAgICAgICAgICAgKTsKLSAgICAgICAgICAgICAgICBoaW50Q29udGFpbmVyLmFkZFZpZXcoZHJvcERvd25WaWV3LCBoaW50UGFyYW1zKTsKLSAgICAgICAgICAgICAgICBoaW50Q29udGFpbmVyLmFkZFZpZXcoaGludFZpZXcpOwotCi0gICAgICAgICAgICAgICAgLy8gbWVhc3VyZSB0aGUgaGludCdzIGhlaWdodCB0byBmaW5kIGhvdyBtdWNoIG1vcmUgdmVydGljYWwgc3BhY2UKLSAgICAgICAgICAgICAgICAvLyB3ZSBuZWVkIHRvIGFkZCB0byB0aGUgZHJvcCBkb3duJ3MgaGVpZ2h0Ci0gICAgICAgICAgICAgICAgaW50IHdpZHRoU3BlYyA9IE1lYXN1cmVTcGVjLm1ha2VNZWFzdXJlU3BlYyhnZXRXaWR0aCgpLCBNZWFzdXJlU3BlYy5BVF9NT1NUKTsKLSAgICAgICAgICAgICAgICBpbnQgaGVpZ2h0U3BlYyA9IE1lYXN1cmVTcGVjLlVOU1BFQ0lGSUVEOwotICAgICAgICAgICAgICAgIGhpbnRWaWV3Lm1lYXN1cmUod2lkdGhTcGVjLCBoZWlnaHRTcGVjKTsKLQotICAgICAgICAgICAgICAgIGhpbnRQYXJhbXMgPSAoTGluZWFyTGF5b3V0LkxheW91dFBhcmFtcykgaGludFZpZXcuZ2V0TGF5b3V0UGFyYW1zKCk7Ci0gICAgICAgICAgICAgICAgb3RoZXJIZWlnaHRzID0gaGludFZpZXcuZ2V0TWVhc3VyZWRIZWlnaHQoKSArIGhpbnRQYXJhbXMudG9wTWFyZ2luCi0gICAgICAgICAgICAgICAgICAgICAgICArIGhpbnRQYXJhbXMuYm90dG9tTWFyZ2luOwotCi0gICAgICAgICAgICAgICAgZHJvcERvd25WaWV3ID0gaGludENvbnRhaW5lcjsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgbVBvcHVwLnNldENvbnRlbnRWaWV3KGRyb3BEb3duVmlldyk7Ci0gICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICBkcm9wRG93blZpZXcgPSAoVmlld0dyb3VwKSBtUG9wdXAuZ2V0Q29udGVudFZpZXcoKTsKLSAgICAgICAgICAgIGZpbmFsIFZpZXcgdmlldyA9IGRyb3BEb3duVmlldy5maW5kVmlld0J5SWQoSElOVF9WSUVXX0lEKTsKLSAgICAgICAgICAgIGlmICh2aWV3ICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICBMaW5lYXJMYXlvdXQuTGF5b3V0UGFyYW1zIGhpbnRQYXJhbXMgPQotICAgICAgICAgICAgICAgICAgICAgICAgKExpbmVhckxheW91dC5MYXlvdXRQYXJhbXMpIHZpZXcuZ2V0TGF5b3V0UGFyYW1zKCk7Ci0gICAgICAgICAgICAgICAgb3RoZXJIZWlnaHRzID0gdmlldy5nZXRNZWFzdXJlZEhlaWdodCgpICsgaGludFBhcmFtcy50b3BNYXJnaW4KLSAgICAgICAgICAgICAgICAgICAgICAgICsgaGludFBhcmFtcy5ib3R0b21NYXJnaW47Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0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heEhlaWdodCArIHBhZGRpbmc7Ci0gICAgICAgIH0KLQotICAgICAgICBmaW5hbCBpbnQgbGlzdENvbnRlbnQgPSBtRHJvcERvd25MaXN0Lm1lYXN1cmVIZWlnaHRPZkNoaWxkcmVuKE1lYXN1cmVTcGVjLlVOU1BFQ0lGSUVELAotICAgICAgICAgICAgICAgIDAsIExpc3RWaWV3Lk5PX1BPU0lUSU9OLCBtYXhIZWlnaHQgLSBvdGhlckhlaWdodHMsIDIpOwotICAgICAgICAvLyBhZGQgcGFkZGluZyBvbmx5IGlmIHRoZSBsaXN0IGhhcyBpdGVtcyBpbiBpdCwgdGhhdCB3YXkgd2UgZG9uJ3Qgc2hvdwotICAgICAgICAvLyB0aGUgcG9wdXAgaWYgaXQgaXMgbm90IG5lZWRlZAotICAgICAgICBpZiAobGlzdENvbnRlbnQgPiAwKSBvdGhlckhlaWdodHMgKz0gcGFkZGluZzsKLQotICAgICAgICByZXR1cm4gbGlzdENvbnRlbnQgKyBvdGhlckhlaWdodHM7Ci0gICAgfQotCi0gICAgcHJpdmF0ZSBWaWV3IGdldEhpbnRWaWV3KENvbnRleHQgY29udGV4dCkgewotICAgICAgICBpZiAobUhpbnRUZXh0ICE9IG51bGwgJiYgbUhpbnRUZXh0Lmxlbmd0aCgpID4gMCkgewotICAgICAgICAgICAgZmluYWwgVGV4dFZpZXcgaGludFZpZXcgPSAoVGV4dFZpZXcpIExheW91dEluZmxhdGVyLmZyb20oY29udGV4dCkuaW5mbGF0ZSgKLSAgICAgICAgICAgICAgICAgICAgbUhpbnRSZXNvdXJjZSwgbnVsbCkuZmluZFZpZXdCeUlkKGNvbS5hbmRyb2lkLmludGVybmFsLlIuaWQudGV4dDEpOwotICAgICAgICAgICAgaGludFZpZXcuc2V0VGV4dChtSGludFRleHQpOwotICAgICAgICAgICAgaGludFZpZXcuc2V0SWQoSElOVF9WSUVXX0lEKTsKLSAgICAgICAgICAgIHJldHVybiBoaW50VmlldzsKLSAgICAgICAgfSBlbHNlI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iA8cD5SZXR1cm5zIHRoZSBmb2N1cyBzdGF0ZSBpbiB0aGUgZHJvcCBkb3duLjwvcD4KLSAgICAgICAgICoKLSAgICAgICAgICogQHJldHVybiB0cnVlIGFsd2F5cwotICAgICAgICAgKi8KLSAgICAgICAgQE92ZXJyaWRlCi0gICAgICAgIHB1YmxpYyBib29sZWFuIGhhc1dpbmRvd0ZvY3VzKCkgewotICAgICAgICAgICAgcmV0dXJuIHRydWU7Ci0gICAgICAgIH0KLQotICAgICAgICAvKioKLSAgICAgICAgICogPHA+UmV0dXJucyB0aGUgZm9jdXMgc3RhdGUgaW4gdGhlIGRyb3AgZG93bi48L3A+Ci0gICAgICAgICAqCi0gICAgICAgICAqIEByZXR1cm4gdHJ1ZSBhbHdheXMKLSAgICAgICAgICovCi0gICAgICAgIEBPdmVycmlkZQotICAgICAgICBwdWJsaWMgYm9vbGVhbiBpc0ZvY3VzZWQoKSB7Ci0gICAgICAgICAgICByZXR1cm4gdHJ1ZTsKLSAgICAgICAgfQotCi0gICAgICAgIC8qKgotICAgICAgICAgKiA8cD5SZXR1cm5zIHRoZSBmb2N1cyBzdGF0ZSBpbiB0aGUgZHJvcCBkb3duLjwvcD4KLSAgICAgICAgICoKLSAgICAgICAgICogQHJldHVybiB0cnVlIGFsd2F5cwotICAgICAgICAgKi8KLSAgICAgICAgQE92ZXJyaWRlCi0gICAgICAgIHB1YmxpYyBib29sZWFuIGhhc0ZvY3VzKCkgewotICAgICAgICAgICAgcmV0dXJuIHRydWU7Ci0gICAgICAgIH0KLSAgICAgICAgCi0gICAgICAgIHByb3RlY3RlZCBpbnRbXSBvbkNyZWF0ZURyYXdhYmxlU3RhdGUoaW50IGV4dHJhU3BhY2UpIHsKLSAgICAgICAgICAgIGludFtdIHJlcyA9IHN1cGVyLm9uQ3JlYXRlRHJhd2FibGVTdGF0ZShleHRyYVNwYWNlKTsKLSAgICAgICAgICAgIC8vbm9pbnNwZWN0aW9uIENvbnN0YW50SWZTdGF0ZW1lbnQKLSAgICAgICAgICAgIGlmIChmYWxzZSkgewotICAgICAgICAgICAgICAgIFN0cmluZ0J1aWxkZXIgc2IgPSBuZXcgU3RyaW5nQnVpbGRlcigiQ3JlYXRlZCBkcmF3YWJsZSBzdGF0ZTogWyIpOwotICAgICAgICAgICAgICAgIGZvciAoaW50IGk9MDsgaTxyZXMubGVuZ3RoOyBpKyspIHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKGkgPiAwKSBzYi5hcHBlbmQoIiwgIik7Ci0gICAgICAgICAgICAgICAgICAgIHNiLmFwcGVuZCgiMHgiKTsKLSAgICAgICAgICAgICAgICAgICAgc2IuYXBwZW5kKEludGVnZXIudG9IZXhTdHJpbmcocmVzW2ldKSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIHNiLmFwcGVuZCgiXSIpOwotICAgICAgICAgICAgICAgIExvZy5pKFRBRywgc2IudG9TdHJpbmcoKSk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICByZXR1cm4gcmVzOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgLyoqCiAgICAgICogVGhpcyBpbnRlcmZhY2UgaXMgdXNlZCB0byBtYWtlIHN1cmUgdGhhdCB0aGUgdGV4dCBlbnRlcmVkIGluIHRoaXMgVGV4dFZpZXcgY29tcGxpZXMgdG8KICAgICAgKiBhIGNlcnRhaW4gZm9ybWF0LiAgU2luY2UgdGhlcmUgaXMgbm8gZm9vbHByb29mIHdheSB0byBwcmV2ZW50IHRoZSB1c2VyIGZyb20gbGVhdmluZwogICAgICAqIHRoaXMgVmlldyB3aXRoIGFuIGluY29ycmVjdCB2YWx1ZSBpbiBpdCwgYWxsIHdlIGNhbiBkbyBpcyB0cnkgdG8gZml4IGl0IG91cnNlbHZlcwpAQCAtMTY1NSwxMCArMTE2Nyw3IEBACiAgICAgcHJpdmF0ZSBjbGFzcyBQb3B1cERhdGFTZXRPYnNlcnZlciBleHRlbmRzIERhdGFTZXRPYnNlcnZlciB7CiAgICAgICAgIEBPdmVycmlkZQogICAgICAgICBwdWJsaWMgdm9pZCBvbkNoYW5nZWQoKSB7Ci0gICAgICAgICAgICBpZiAoaXNQb3B1cFNob3dpbmcoKSkgewotICAgICAgICAgICAgICAgIC8vIFRoaXMgd2lsbCByZXNpemUgdGhlIHBvcHVwIHRvIGZpdCB0aGUgbmV3IGFkYXB0ZXIncyBjb250ZW50Ci0gICAgICAgICAgICAgICAgc2hvd0Ryb3BEb3duKCk7Ci0gICAgICAgICAgICB9IGVsc2UgaWYgKG1BZGFwdGVyICE9IG51bGwpIHsKKyAgICAgICAgICAgIGlmIChtQWRhcHRlciAhPSBudWxsKSB7CiAgICAgICAgICAgICAgICAgLy8gSWYgdGhlIHBvcHVwIGlzIG5vdCBzaG93aW5nIGFscmVhZHksIHNob3dpbmcgaXQgd2lsbCBjYXVzZQogICAgICAgICAgICAgICAgIC8vIHRoZSBsaXN0IG9mIGRhdGEgc2V0IG9ic2VydmVycyBhdHRhY2hlZCB0byB0aGUgYWRhcHRlciB0bwogICAgICAgICAgICAgICAgIC8vIGNoYW5nZS4gV2UgY2FuJ3QgZG8gaXQgZnJvbSBoZXJlLCBiZWNhdXNlIHdlIGFyZSBpbiB0aGUgbWlkZGxlCkBAIC0xNjczLDE0ICsxMTgyLDUgQEAKICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgIH0KICAgICAgICAgfQotCi0gICAgICAgIEBPdmVycmlkZQotICAgICAgICBwdWJsaWMgdm9pZCBvbkludmFsaWRhdGVkKCkgewotICAgICAgICAgICAgaWYgKCFtRHJvcERvd25BbHdheXNWaXNpYmxlKSB7Ci0gICAgICAgICAgICAgICAgLy8gVGhlcmUncyBubyBkYXRhIHRvIGRpc3BsYXkgc28gbWFrZSBzdXJlIHdlJ3JlIG5vdCBzaG93aW5nCi0gICAgICAgICAgICAgICAgLy8gdGhlIGRyb3AgZG93biBhbmQgaXRzIGxpc3QKLSAgICAgICAgICAgICAgICBkaXNtaXNzRHJvcERvd24o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hU3RhcnQgPSBtRWRnZUFscGhhOwotICAgICAgICAgICAgICAgICAgICBtRWRnZVNjYWxlWVN0YXJ0ID0gbUVkZ2VTY2FsZVk7Ci0gICAgICAgICAgICAgICAgICAgIG1HbG93QWxwaGFTdGFydCA9IG1HbG93QWxwaGE7Ci0gICAgICAgICAgICAgICAgICAgIG1HbG93U2NhbGVZU3RhcnQgPSBtR2xvd1NjYWxlWTsKLQotICAgICAgICAgICAgICAgICAgICBtRWRnZUFscGhhRmluaXNoID0gMC5mOwotICAgICAgICAgICAgICAgICAgICBtRWRnZVNjYWxlWUZpbmlzaCA9IDAuMWY7Ci0gICAgICAgICAgICAgICAgICAgIG1HbG93QWxwaGFGaW5pc2ggPSAwLmY7Ci0gICAgICAgICAgICAgICAgICAgIG1HbG93U2NhbGVZRmluaXNoID0gbUdsb3dTY2FsZVk7Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgIGNhc2UgU1RBVEVfUFVMTDoKLSAgICAgICAgICAgICAgICAgICAgbVN0YXRlID0gU1RBVEVfUFVMTF9ERUNBWTsKLSAgICAgICAgICAgICAgICAgICAgbVN0YXJ0VGltZSA9IEFuaW1hdGlvblV0aWxzLmN1cnJlbnRBbmltYXRpb25UaW1lTWlsbGlzKCk7Ci0gICAgICAgICAgICAgICAgICAgIG1EdXJhdGlvbiA9IFBVTExfREVDQVlfVElNRTsKLQotICAgICAgICAgICAgICAgICAgICBtRWRnZUFscGhhU3RhcnQgPSBtRWRnZUFscGhhOwotICAgICAgICAgICAgICAgICAgICBtRWRnZVNjYWxlWVN0YXJ0ID0gbUVkZ2VTY2FsZVk7Ci0gICAgICAgICAgICAgICAgICAgIG1HbG93QWxwaGFTdGFydCA9IG1HbG93QWxwaGE7Ci0gICAgICAgICAgICAgICAgICAgIG1HbG93U2NhbGVZU3RhcnQgPSBtR2xvd1NjYWxlWTsKLQotICAgICAgICAgICAgICAgICAgICBtRWRnZUFscGhhRmluaXNoID0gTWF0a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pIHsKLSAgICAgICAgICAgICAgICAgICAgaW52YWxpZGF0ZSgpOwotICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIGNhc2UgTW90aW9uRXZlbnQuQUNUSU9OX1BPSU5URVJfVVA6CiAgICAgICAgICAgICAgICAgb25TZWNvbmRhcnlQb2ludGVyVXAoZXYpOwpAQCAtNTI4LDI2ICs1MjAsNyBAQAogICAgICAgICAgICAgICAgICAgICBmaW5hbCBpbnQgZGVsdGFYID0gKGludCkgKG1MYXN0TW90aW9uWCAtIHgpOwogICAgICAgICAgICAgICAgICAgICBtTGFzdE1vdGlvblggPSB4OwogCi0gICAgICAgICAgICAgICAgICAgIGZpbmFsIGludCBvbGRYID0gbVNjcm9sbFg7Ci0gICAgICAgICAgICAgICAgICAgIGZpbmFsIGludCBvbGRZID0gbVNjcm9sbFk7Ci0gICAgICAgICAgICAgICAgICAgIGZpbmFsIGludCByYW5nZSA9IGdldFNjcm9sbFJhbmdlKCk7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChvdmVyc2Nyb2xsQnkoZGVsdGFYLCAwLCBtU2Nyb2xsWCwgMCwgcmFuZ2UsIDAsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbU92ZXJzY3JvbGxEaXN0YW5jZSwgMCwgdHJ1ZSkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIEJyZWFrIG91ciB2ZWxvY2l0eSBpZiB3ZSBoaXQgYSBzY3JvbGwgYmFycmllci4KLSAgICAgICAgICAgICAgICAgICAgICAgIG1WZWxvY2l0eVRyYWNrZXIuY2xlYXIoKTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBvblNjcm9sbENoYW5nZWQobVNjcm9sbFgsIG1TY3JvbGxZLCBvbGRYLCBvbGRZKTsKLQotICAgICAgICAgICAgICAgICAgICBmaW5hbCBpbnQgb3ZlcnNjcm9sbE1vZGUgPSBnZXRPdmVyc2Nyb2xsTW9kZSgpOwotICAgICAgICAgICAgICAgICAgICBpZiAob3ZlcnNjcm9sbE1vZGUgPT0gT1ZFUlNDUk9MTF9BTFdBWVMgfHwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAob3ZlcnNjcm9sbE1vZGUgPT0gT1ZFUlNDUk9MTF9JRl9DT05URU5UX1NDUk9MTFMgJiYgcmFuZ2UgPiAwKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgZmluYWwgaW50IHB1bGxlZFRvWCA9IG9sZFggKyBkZWx0YVg7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAocHVsbGVkVG9YIDwgMCkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1FZGdlR2xvd0xlZnQub25QdWxsKChmbG9hdCkgZGVsdGFYIC8gZ2V0V2lkdGgoKSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHB1bGxlZFRvWCA+IHJhbmdlKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbUVkZ2VHbG93UmlnaHQub25QdWxsKChmbG9hdCkgZGVsdGFYIC8gZ2V0V2lkdGgoKSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgc2Nyb2xsQnkoZGVsdGFYLCAwKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICBjYXNlIE1vdGlvbkV2ZW50LkFDVElPTl9VUDoKQEAgLTU1NiwxNSArNTI5LDggQEAKICAgICAgICAgICAgICAgICAgICAgdmVsb2NpdHlUcmFja2VyLmNvbXB1dGVDdXJyZW50VmVsb2NpdHkoMTAwMCwgbU1heGltdW1WZWxvY2l0eSk7CiAgICAgICAgICAgICAgICAgICAgIGludCBpbml0aWFsVmVsb2NpdHkgPSAoaW50KSB2ZWxvY2l0eVRyYWNrZXIuZ2V0WFZlbG9jaXR5KG1BY3RpdmVQb2ludGVySWQpOwogCi0gICAgICAgICAgICAgICAgICAgIGlmIChnZXRDaGlsZENvdW50KCkgPiAwKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoKE1hdGguYWJzKGluaXRpYWxWZWxvY2l0eSkgPiBtTWluaW11bVZlbG9jaXR5KSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsaW5nKC1pbml0aWFsVmVsb2NpdHkpOwotICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaW5hbCBpbnQgcmlnaHQgPSBnZXRTY3JvbGxSYW5nZSgpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtU2Nyb2xsZXIuc3ByaW5nYmFjayhtU2Nyb2xsWCwgbVNjcm9sbFksIDAsIHJpZ2h0LCAwLCAwKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnZhbGlkYXRlKCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBpZiAoZ2V0Q2hpbGRDb3VudCgpID4gMCAmJiBNYXRoLmFicyhpbml0aWFsVmVsb2NpdHkpID4gbU1pbmltdW1WZWxvY2l0eSkgeworICAgICAgICAgICAgICAgICAgICAgICAgZmxpbmcoLWluaXRpYWxWZWxvY2l0eSk7CiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgIG1BY3RpdmVQb2ludGVySWQgPSBJTlZBTElEX1BPSU5URVI7CkBAIC01NzQsMjcgKzU0MCwxNiBAQAogICAgICAgICAgICAgICAgICAgICAgICAgbVZlbG9jaXR5VHJhY2tlci5yZWN5Y2xlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICBtVmVsb2NpdHlUcmFja2VyID0gbnVsbDsKICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBpZiAobUVkZ2VHbG93TGVmdCAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBtRWRnZUdsb3dMZWZ0Lm9uUmVsZWFzZSgpOwotICAgICAgICAgICAgICAgICAgICAgICAgbUVkZ2VHbG93UmlnaHQub25SZWxlYXNlKCk7Ci0gICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICBjYXNlIE1vdGlvbkV2ZW50LkFDVElPTl9DQU5DRUw6CiAgICAgICAgICAgICAgICAgaWYgKG1Jc0JlaW5nRHJhZ2dlZCAmJiBnZXRDaGlsZENvdW50KCkgPiAwKSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChtU2Nyb2xsZXIuc3ByaW5nYmFjayhtU2Nyb2xsWCwgbVNjcm9sbFksIDAsIGdldFNjcm9sbFJhbmdlKCksIDAsIDApKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpbnZhbGlkYXRlKCk7Ci0gICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgbUFjdGl2ZVBvaW50ZXJJZCA9IElOVkFMSURfUE9JTlRFUjsKICAgICAgICAgICAgICAgICAgICAgbUlzQmVpbmdEcmFnZ2VkID0gZmFsc2U7CiAgICAgICAgICAgICAgICAgICAgIGlmIChtVmVsb2NpdHlUcmFja2VyICE9IG51bGwpIHsKICAgICAgICAgICAgICAgICAgICAgICAgIG1WZWxvY2l0eVRyYWNrZXIucmVjeWNsZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgbVZlbG9jaXR5VHJhY2tlciA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgaWYgKG1FZGdlR2xvd0xlZnQgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICAgICAgbUVkZ2VHbG93TGVmdC5vblJlbGVhc2UoKTsKLS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ZmluYWwgaW50IGhlaWdodCA9IGdldEhlaWdodCgpOwotCi0gICAgICAgICAgICAgICAgY2FudmFzLnJvdGF0ZSgyNzApOwotICAgICAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoLWhlaWdodCAqIDEuNWYsIE1hdGgubWluKDAsIHNjcm9sbFgpKTsKLSAgICAgICAgICAgICAgICBtRWRnZUdsb3dMZWZ0LnNldFNpemUoZ2V0SGVpZ2h0KCkgKiAyLCBnZXRXaWR0aCgpKTsKLSAgICAgICAgICAgICAgICBpZiAobUVkZ2VHbG93TGVmdC5kcmF3KGNhbnZhcykpIHsKLSAgICAgICAgICAgICAgICAgICAgaW52YWxpZGF0ZSgpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBjYW52YXMucmVzdG9yZVRvQ291bnQocmVzdG9yZUNvdW50KTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmICghbUVkZ2VHbG93UmlnaHQuaXNGaW5pc2hlZCgpKSB7Ci0gICAgICAgICAgICAgICAgZmluYWwgaW50IHJlc3RvcmVDb3VudCA9IGNhbnZhcy5zYXZlKCk7Ci0gICAgICAgICAgICAgICAgZmluYWwgaW50IHdpZHRoID0gZ2V0V2lkdGgoKTsKLSAgICAgICAgICAgICAgICBmaW5hbCBpbnQgaGVpZ2h0ID0gZ2V0SGVpZ2h0KCk7Ci0KLSAgICAgICAgICAgICAgICBjYW52YXMucm90YXRlKDkwKTsKLSAgICAgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKC1oZWlnaHQgLyAyLCAtKE1hdGgubWF4KGdldFNjcm9sbFJhbmdlKCksIHNjcm9sbFgpICsgd2lkdGgpKTsKLSAgICAgICAgICAgICAgICBtRWRnZUdsb3dSaWdodC5zZXRTaXplKGhlaWdodCAqIDIsIHdpZHRoKTsKLSAgICAgICAgICAgICAgICBpZiAobUVkZ2VHbG93UmlnaHQuZHJhdyhjYW52YXMpKSB7Ci0gICAgICAgICAgICAgICAgICAg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IHRvIHVzZSB0byBjcmVhdGUgdGhpcyB3aW5kb3cncyBjb250ZW50LgorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNldEFkYXB0ZXIoTGlzdEFkYXB0ZXIgYWRhcHRlcikgeworICAgICAgICBpZiAobU9ic2VydmVyID09IG51bGwpIHsKKyAgICAgICAgICAgIG1PYnNlcnZlciA9IG5ldyBQb3B1cERhdGFTZXRPYnNlcnZlcigpOworICAgICAgICB9IGVsc2UgaWYgKG1BZGFwdGVyICE9IG51bGwpIHsKKyAgICAgICAgICAgIG1BZGFwdGVyLnVucmVnaXN0ZXJEYXRhU2V0T2JzZXJ2ZXIobU9ic2VydmVyKTsKKyAgICAgICAgfQorICAgICAgICBtQWRhcHRlciA9IGFkYXB0ZXI7CisgICAgICAgIGlmIChtQWRhcHRlciAhPSBudWxsKSB7CisgICAgICAgICAgICBhZGFwdGVyLnJlZ2lzdGVyRGF0YVNldE9ic2VydmVyKG1PYnNlcnZlcik7CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIGlmIChtRHJvcERvd25MaXN0ICE9IG51bGwpIHsKKyAgICAgICAgICAgIG1Ecm9wRG93bkxpc3Quc2V0QWRhcHRlcihtQWRhcHRlcik7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBTZXQgd2hlcmUgdGhlIG9wdGlvbmFsIHByb21wdCB2aWV3IHNob3VsZCBhcHBlYXIuIFRoZSBkZWZhdWx0IGlzCisgICAgICoge0BsaW5rICNQT1NJVElPTl9QUk9NUFRfQUJPVkV9LgorICAgICAqIAorICAgICAqIEBwYXJhbSBwb3NpdGlvbiBBIHBvc2l0aW9uIGNvbnN0YW50IGRlY2xhcmluZyB3aGVyZSB0aGUgcHJvbXB0IHNob3VsZCBiZSBkaXNwbGF5ZWQuCisgICAgICogCisgICAgICogQHNlZSAjUE9TSVRJT05fUFJPTVBUX0FCT1ZFCisgICAgICogQHNlZSAjUE9TSVRJT05fUFJPTVBUX0JFTE9XCis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xkIHJlbWFpbiB2aXNpYmxlIHVuZGVyIGNlcnRhaW4gY29uZGl0aW9ucy4KKyAgICAgKgorICAgICAqIFRoZSBkcm9wLWRvd24gd2lsbCBvY2N1cHkgdGhlIGVudGlyZSBzY3JlZW4gYmVsb3cge0BsaW5rICNnZXRBbmNob3JWaWV3fSByZWdhcmRsZXNzCisgICAgICogb2YgdGhlIHNpemUgb3IgY29udGVudCBvZiB0aGUgbGlzdC4gIHtAbGluayAjZ2V0QmFja2dyb3VuZCgpfSB3aWxsIGZpbGwgYW55IHNwYWNlCisgICAgICogdGhhdCBpcyBub3QgdXNlZCBieSB0aGUgbGlzdC4KKyAgICAgKgorICAgICAqIEBwYXJhbSBkcm9wRG93bkFsd2F5c1Zpc2libGUgV2hldGhlciB0byBrZWVwIHRoZSBkcm9wLWRvd24gdmlzaWJsZS4KKyAgICAgKgorICAgICAqIEBoaWRlIE9ubHkgdXNlZCBieSBBdXRvQ29tcGxldGVUZXh0VmlldyB1bmRlciBzcGVjaWFsIGNvbmRpdGlvbnMuCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0RHJvcERvd25BbHdheXNWaXNpYmxlKGJvb2xlYW4gZHJvcERvd25BbHdheXNWaXNpYmxlKSB7CisgICAgICAgIG1Ecm9wRG93bkFsd2F5c1Zpc2libGUgPSBkcm9wRG93bkFsd2F5c1Zpc2libGU7CisgICAgfQorCisgICAgLyoqCisgICAgICogQHJldHVybiBXaGV0aGVyIHRoZSBkcm9wLWRvd24gaXMgdmlzaWJsZSB1bmRlciBzcGVjaWFsIGNvbmRpdGlvbnMuCisgICAgICoKKyAgICAgKiBAaGlkZSBPbmx5IHVzZWQgYnkgQXV0b0NvbXBsZXRlVGV4dFZpZXcgdW5kZXIgc3BlY2lhbCBjb25kaXRpb25zLgorICAgICAqLworICAgIHB1YmxpYyBib29sZWFuIGlzRHJvcERvd25BbHdheXNWaXNpYmxlKCkgeworICAgICAgICByZXR1cm4gbURyb3BEb3duQWx3YXlzVmlzaWJsZTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBTZXRzIHRoZSBvcGVyYXRpbmcgbW9kZSBmb3IgdGhlIHNvZnQgaW5wdXQgYXJlYS4KKyAgICAgKgorICAgICAqIEBwYXJhbSBtb2RlIFRoZSBkZXNpcmVkIG1vZGUsIHNlZQorICAgICAqICAgICAgICB7QGxpbmsgYW5kcm9pZC52aWV3LldpbmRvd01hbmFnZXIuTGF5b3V0UGFyYW1zI3NvZnRJbnB1dE1vZGV9CisgICAgICogICAgICAgIGZvciB0aGUgZnVsbCBsaXN0CisgICAgICoKKyAgICAgKiBAc2VlIGFuZHJvaWQudmlldy5XaW5kb3dNYW5hZ2VyLkxheW91dFBhcmFtcyNzb2Z0SW5wdXRNb2RlCisgICAgICogQHNlZSAjZ2V0U29mdElucHV0TW9kZSgpCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0U29mdElucHV0TW9kZShpbnQgbW9kZSkgeworICAgICAgICBtUG9wdXAuc2V0U29mdElucHV0TW9kZShtb2RlKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZXR1cm5zIHRoZSBjdXJyZW50IHZhbHVlIGluIHtAbGluayAjc2V0U29mdElucHV0TW9kZShpbnQpfS4KKyAgICAgKgorICAgICAqIEBzZWUgI3NldFNvZnRJbnB1dE1vZGUoaW50KQorICAgICAqIEBzZWUgYW5kcm9pZC52aWV3LldpbmRvd01hbmFnZXIuTGF5b3V0UGFyYW1zI3NvZnRJbnB1dE1vZGUKKyAgICAgKi8KKyAgICBwdWJsaWMgaW50IGdldFNvZnRJbnB1dE1vZGUoKSB7CisgICAgICAgIHJldHVybiBtUG9wdXAuZ2V0U29mdElucHV0TW9kZSgpOworICAgIH0KKworICAgIC8qKgorICAgICAqIFNldHMgYSBkcmF3YWJsZSB0byB1c2UgYXMgdGhlIGxpc3QgaXRlbSBzZWxlY3Rvci4KKyAgICAgKiAKKyAgICAgKiBAcGFyYW0gc2VsZWN0b3IgTGlzdCBzZWxlY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gb2Zmc2V0IG9mIHRoZSBwb3B1cCBmcm9tIGl0cyBhbmNob3IgaW4gcGl4ZWxzLgorICAgICAqLworICAgIHB1YmxpYyBpbnQgZ2V0SG9yaXpvbnRhbE9mZnNldCgpIHsKKyAgICAgICAgcmV0dXJuIG1Ecm9wRG93bkhvcml6b250YWxPZmZzZXQ7CisgICAgfQorCisgICAgLyoqCisgICAgICogU2V0IHRoZSBob3Jpem9udGFsIG9mZnNldCBvZiB0aGlzIHBvcHVwIGZyb20gaXRzIGFuY2hvciB2aWV3IGluIHBpeGVscy4KKyAgICAgKiAKKyAgICAgKiBAcGFyYW0gb2Zmc2V0IFRoZSBob3Jpem9udGFsIG9mZnNldCBvZiB0aGUgcG9wdXAgZnJvbSBpdHMgYW5jaG9yLgorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNldEhvcml6b250YWxPZmZzZXQoaW50IG9mZnNldCkgeworICAgICAgICBtRHJvcERvd25Ib3Jpem9udGFsT2Zmc2V0ID0gb2Zmc2V0OworICAgIH0KKworICAgIC8qKgorICAgICAqIEByZXR1cm4gVGhlIHZlcnRpY2FsIG9mZnNldCBvZiB0aGUgcG9wdXAgZnJvbSBpdHMgYW5jaG9yIGluIHBpeGVscy4KKyAgICAgKi8KKyAgICBwdWJsaWMgaW50IGdldFZlcnRpY2FsT2Zmc2V0KCkgeworICAgICAgICByZXR1cm4gbURyb3BEb3duVmVydGljYWxPZmZzZXQ7CisgICAgfQorCisgICAgLyoqCisgICAgICogU2V0IHRoZSB2ZXJ0aWNhbCBvZmZzZXQgb2YgdGhpcyBwb3B1cCBmcm9tIGl0cyBhbmNob3IgdmlldyBpbiBwaXhlbHMuCisgICAgICogCisgICAgICogQHBhcmFtIG9mZnNldCBUaGUgdmVydGljYWwgb2Zmc2V0IG9mIHRoZSBwb3B1cCBmcm9tIGl0cyBhbmNob3IuCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0VmVydGljYWxPZmZzZXQoaW50IG9mZnNldCkgeworICAgIC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ICAgICAgICAgICByZW1vdmVQcm9tcHRWaWV3KCk7CisgICAgICAgIH0KKyAgICAgICAgbVByb21wdFZpZXcgPSBwcm9tcHQ7CisgICAgICAgIGlmIChzaG93aW5nKSB7CisgICAgICAgICAgICBzaG93KCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBQb3N0IGEge0BsaW5rICNzaG93KCl9IGNhbGwgdG8gdGhlIFVJIHRocmVhZC4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBwb3N0U2hvdygpIHsKKyAgICAgICAgbUhhbmRsZXIucG9zdChtU2hvd0Ryb3BEb3duUnVubmFibGUpOworICAgIH0KKworICAgIC8qKgorICAgICAqIFNob3cgdGhlIHBvcHVwIGxpc3QuIElmIHRoZSBsaXN0IGlzIGFscmVhZHkgc2hvd2luZywgdGhpcyBtZXRob2QKKyAgICAgKiB3aWxsIHJlY2FsY3VsYXRlIHRoZSBwb3B1cCdzIHNpemUgYW5kIHBvc2l0aW9uLgorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNob3coKSB7CisgICAgICAgIGludCBoZWlnaHQgPSBidWlsZERyb3BEb3duKCk7CisKKyAgICAgICAgaW50IHdpZHRoU3BlYyA9IDA7CisgICAgICAgIGludCBoZWlnaHRTcGVjID0gMDsKKworICAgICAgICBib29sZWFuIG5vSW5wdXRNZXRob2QgPSBpc0lucHV0TWV0aG9kTm90TmVlZGVkKCk7CisKKyAgICAgICAgaWYgKG1Qb3B1cC5pc1Nob3dpbmcoKSkgeworICAgICAgICAgICAgaWYgKG1Ecm9wRG93bldpZHRoID09IFZpZXdHcm91cC5MYXlvdXRQYXJhbXMuTUFUQ0hfUEFSRU5UKSB7CisgICAgICAgICAgICAgICAgLy8gVGhlIGNhbGwgdG8gUG9wdXBXaW5kb3cncyB1cGRhdGUgbWV0aG9kIGJlbG93IGNhbiBhY2NlcHQgLTEgZm9yIGFueQorICAgICAgICAgICAgICAgIC8vIHZhbHVlIHlvdSBkbyBub3Qgd2FudCB0byB1cGRhdGUuCisgICAgICAgICAgICAgICAgd2lkdGhTcGVjID0gLTE7CisgICAgICAgICAgICB9IGVsc2UgaWYgKG1Ecm9wRG93bldpZHRoID09IFZpZXdHcm91cC5MYXlvdXRQYXJhbXMuV1JBUF9DT05URU5UKSB7CisgICAgICAgICAgICAgICAgd2lkdGhTcGVjID0gZ2V0QW5jaG9yVmlldygpLmdldFdpZHRoKCk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHdpZHRoU3BlYyA9IG1Ecm9wRG93bldpZHRoOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAobURyb3BEb3duSGVpZ2h0ID09IFZpZXdHcm91cC5MYXlvdXRQYXJhbXMuTUFUQ0hfUEFSRU5UKSB7CisgICAgICAgICAgICAgICAgLy8gVGhlIGNhbGwgdG8gUG9wdXBXaW5kb3cncyB1cGRhdGUgbWV0aG9kIGJlbG93IGNhbiBhY2NlcHQgLTEgZm9yIGFueQorICAgICAgICAgICAgICAgIC8vIHZhbHVlIHlvdSBkbyBub3Qgd2FudCB0byB1cGRhdGUuCisgICAgICAgICAgICAgICAgaGVpZ2h0U3BlYyA9IG5vSW5wdXRNZXRob2QgPyBoZWlnaHQgOiBWaWV3R3JvdXAuTGF5b3V0UGFyYW1zLk1BVENIX1BBUkVOVDsKKyAgICAgICAgICAgICAgICBpZiAobm9JbnB1dE1ldGhvZCkgeworICAgICAgICAgICAgICAgICAgICBtUG9wdXAuc2V0V2luZG93TGF5b3V0TW9kZSgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtRHJvcERvd25XaWR0aCA9PSBWaWV3R3JvdXAuTGF5b3V0UGFyYW1zLk1BVENIX1BBUkVOVCA/CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBWaWV3R3JvdXAuTGF5b3V0UGFyYW1zLk1BVENIX1BBUkVOVCA6IDAsIDApOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIG1Qb3B1cC5zZXRXaW5kb3dMYXlvdXRNb2RlKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Ecm9wRG93bldpZHRoID09IFZpZXdHcm91cC5MYXlvdXRQYXJhbXMuTUFUQ0hfUEFSRU5UID8KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFZpZXdHcm91cC5MYXlvdXRQYXJhbXMuTUFUQ0hfUEFSRU5UIDogMCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBWaWV3R3JvdXAuTGF5b3V0UGFyYW1zLk1BVENIX1BBUkVOVCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSBlbHNlIGlmIChtRHJvcERvd25IZWlnaHQgPT0gVmlld0dyb3VwLkxheW91dFBhcmFtcy5XUkFQX0NPTlRFTlQpIHsKKyAgICAgICAgICAgICAgICBoZWlnaHRTcGVjID0gaGVpZ2h0OworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBoZWlnaHRTcGVjID0gbURyb3BEb3duSGVpZ2h0OworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBtUG9wdXAuc2V0T3V0c2lkZVRvdWNoYWJsZSghbUZvcmNlSWdub3JlT3V0c2lkZVRvdWNoICYmICFtRHJvcERvd25BbHdheXNWaXNpYmxlKTsKKworICAgICAgICAgICAgbVBvcHVwLnVwZGF0ZShnZXRBbmNob3JWaWV3KCksIG1Ecm9wRG93bkhvcml6b250YWxPZmZzZXQsCisgICAgICAgICAgICAgICAgICAgIG1Ecm9wRG93blZlcnRpY2FsT2Zmc2V0LCB3aWR0aFNwZWMsIGhlaWdodFNwZWMpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgaWYgKG1Ecm9wRG93bldpZHRoID09IFZpZXdHcm91cC5MYXlvdXRQYXJhbXMuTUFUQ0hfUEFSRU5UKSB7CisgICAgICAgICAgICAgICAgd2lkdGhTcGVjID0gVmlld0dyb3VwLkxheW91dFBhcmFtcy5NQVRDSF9QQVJFTlQ7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGlmIChtRHJvcERvd25XaWR0aCA9PSBWaWV3R3JvdXAuTGF5b3V0UGFyYW1zLldSQVBfQ09OVEVOVCkgeworICAgICAgICAgICAgICAgICAgICBtUG9wdXAuc2V0V2lkdGgoZ2V0QW5jaG9yVmlldygpLmdldFdpZHRoKCkpOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIG1Qb3B1cC5zZXRXaWR0aChtRHJvcERvd25XaWR0aCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAobURyb3BEb3duSGVpZ2h0ID09IFZpZXdHcm91cC5MYXlvdXRQYXJhbXMuTUFUQ0hfUEFSRU5UKSB7CisgICAgICAgICAgICAgICAgaGVpZ2h0U3BlYyA9IFZpZXdHcm91cC5MYXlvdXRQYXJhbXMuTUFUQ0hfUEFSRU5UOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBpZiAobURyb3BEb3duSGVpZ2h0ID09IFZpZXdHcm91cC5MYXlvdXRQYXJhbXMuV1JBUF9DT05URU5UKSB7CisgICAgICAgICAgICAgICAgICAgIG1Qb3B1cC5zZXRIZWlnaHQoaGVpZ2h0KTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICBtUG9wdXAuc2V0SGVpZ2h0KG1Ecm9wRG93bkhlaWdodCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCisgICAgICAgICAgICBtUG9wdXAuc2V0V2luZG93TGF5b3V0TW9kZSh3aWR0aFNwZWMsIGhlaWdodFNwZWMpOworICAgICAgICAgICAgbVBvcHVwLnNldElucHV0TWV0aG9kTW9kZShQb3B1cFdpbmRvdy5JTlBVVF9NRVRIT0RfTkVFREVEKTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgLy8gdXNlIG91dHNpZGUgdG91Y2hhYmxlIHRvIGRpc21pc3MgZHJvcCBkb3duIHdoZW4gdG91Y2hpbmcgb3V0c2lkZSBvZiBpdCwgc28KKyAgICAgICAgICAgIC8vIG9ubHkgc2V0IHRoaXMgaWYgdGhlIGRyb3Bkb3duIGlzIG5vdCBhbHdheXMgdmlzaWJsZQorICAgICAgICAgICAgbVBvcHVwLnNldE91dHNpZGVUb3VjaGFibGUoIW1Gb3JjZUlnbm9yZU91dHNpZGVUb3VjaCAmJiAhbURyb3BEb3duQWx3YXlzVmlzaWJsZSk7CisgICAgICAgICAgICBtUG9wdXAuc2V0VG91Y2hJbnRlcmNlcHRvcihtVG91Y2hJbnRlcmNlcHRvcik7CisgICAgICAgICAgICBtUG9wdXAuc2hvd0FzRHJvcERvd24oZ2V0QW5jaG9yVmlldygpLAorICAgICAgICAgICAgICAgICAgICBtRHJvcERvd25Ib3Jpem9udGFsT2Zmc2V0LCBtRHJvcERvd25WZXJ0aWNhbE9mZnNldCk7CisgICAgICAgICAgICBtRHJvcERvd25MaXN0LnNldFNlbGVjdGlvbihMaXN0Vmlldy5JTlZBTElEX1BPU0lUSU9OKTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgaWYgKCFtTW9kYWwgfHwgbURyb3BEb3duTGlzdC5pc0luVG91Y2hNb2RlKCkpIHsKKyAgICAgICAgICAgICAgICBjbGVhckxpc3RTZWxlY3Rpb24oKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmICghbU1vZGFsKSB7CisgICAgICAgICAgICAgICAgbUhhbmRsZXIucG9zdChtSGlkZVNlbGVjdG9yKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIERpc21pc3MgdGhlIHBvcHVwIHdpbmRvdy4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBkaXNtaXNzKCkgeworICAgICAgICBtUG9wdXAuZGlzbWlzcygpOworICAgICAgICByZW1vdmVQcm9tcHRWaWV3KCk7CisgICAgICAgIG1Qb3B1cC5zZXRDb250ZW50VmlldyhudWxsKTsKKyAgICAgICAgbURyb3BEb3duTGlzdCA9IG51bGw7CisgICAgfQorCisgICAgLyoqCisgICAgICogU2V0IGEgbGlzdGVuZXIgdG8gcmVjZWl2ZSBhIGNhbGxiYWNrIHdoZW4gdGhlIHBvcHVwIGlzIGRpc21pc3NlZC4KKyAgICAgKgorICAgICAqIEBwYXJhbSBsaXN0ZW5lciBMaXN0ZW5lciB0aGF0IHdpbGwgYmUgbm90aWZpZWQgd2hlbiB0aGUgcG9wdXAgaXMgZGlzbWlzc2VkLgorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNldE9uRGlzbWlzc0xpc3RlbmVyKFBvcHVwV2luZG93Lk9uRGlzbWlzc0xpc3RlbmVyIGxpc3RlbmVyKSB7CisgICAgICAgIG1Qb3B1cC5zZXRPbkRpc21pc3NMaXN0ZW5lcihsaXN0ZW5lcik7CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIHJlbW92ZVByb21wdFZpZXcoKSB7CisgICAgICAgIGlmIChtUHJvbXB0VmlldyAhPSBudWxsKSB7CisgICAgICAgICAgICBmaW5hbCBWaWV3UGFyZW50IHBhcmVudCA9IG1Qcm9tcHRWaWV3LmdldFBhcmVudCgpOworICAgICAgICAgICAgaWYgKHBhcmVudCBpbnN0YW5jZW9mIFZpZXdHcm91cCkgeworICAgICAgICAgICAgICAgIGZpbmFsIFZpZXdHcm91cCBncm91cCA9IChWaWV3R3JvdXApIHBhcmVudDsKKyAgICAgICAgICAgICAgICBncm91cC5yZW1vdmVWaWV3KG1Qcm9tcHRWaWV3KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIENvbnRyb2wgaG93IHRoZSBwb3B1cCBvcGVyYXRlcyB3aXRoIGFuIGlucHV0IG1ldGhvZDogb25lIG9mCisgICAgICoge0BsaW5rICNJTlBVVF9NRVRIT0RfRlJPTV9GT0NVU0FCTEV9LCB7QGxpbmsgI0lOUFVUX01FVEhPRF9ORUVERUR9LAorICAgICAqIG9yIHtAbGluayAjSU5QVVRfTUVUSE9EX05PVF9ORUVERUR9LgorICAgICAqIAorICAgICAqIDxwPklmIHRoZSBwb3B1cCBpcyBzaG93aW5nLCBjYWxsaW5nIHRoaXMgbWV0aG9kIHdpbGwgdGFrZSBlZmZlY3Qgb25seQorICAgICAqIHRoZSBuZXh0IHRpbWUgdGhlIHBvcHVwIGlzIHNob3duIG9yIHRocm91Z2ggYSBtYW51YWwgY2FsbCB0byB0aGUge0BsaW5rICNzaG93KCl9CisgICAgICogbWV0aG9kLjwvcD4KKyAgICAgKiAKKyAgICAgKiBAc2VlICNnZXRJbnB1dE1ldGhvZE1vZGUoKQorICAgICAqIEBzZWUgI3Nob3coKQorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNldElucHV0TWV0aG9kTW9kZShpbnQgbW9kZSkgeworICAgICAgICBtUG9wdXAuc2V0SW5wdXRNZXRob2RNb2RlKG1vZGUpOworICAgIH0KKworICAgIC8qKgorICAgICAqIFJldHVybiB0aGUgY3VycmVudCB2YWx1ZSBpbiB7QGxpbmsgI3NldElucHV0TWV0aG9kTW9kZShpbnQpfS4KKyAgICAgKiAKKyAgICAgKiBAc2VlICNzZXRJbnB1dE1ldGhvZE1vZGUoaW50KQorICAgICAqLworICAgIHB1YmxpYyBpbnQgZ2V0SW5wdXRNZXRob2RNb2RlKCkgeworICAgICAgICByZXR1cm4gbVBvcHVwLmdldElucHV0TWV0aG9kTW9kZSgpOworICAgIH0KKworICAgIC8qKgorICAgICAqIFNldCB0aGUgc2VsZWN0ZWQgcG9zaXRpb24gb2YgdGhlIGxpc3QuCisgICAgICogT25seSB2YWxpZCB3aGVuIHtAbGluayAjaXNTaG93aW5nKCl9ID09IHtAY29kZSB0cnVlfS4KKyAgICAgKiAKKyAgICAgKiBAcGFyYW0gcG9zaXRpb24gTGlzdCBwb3NpdGlvbiB0byBzZXQgYXMgc2VsZWN0ZWQuCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0U2VsZWN0aW9uKGludCBwb3NpdGlvbikgeworICAgICAgICBEcm9wRG93bkxpc3RWaWV3IGxpc3QgPSBtRHJvcERvd25MaXN0OworICAgICAgICBpZiAoaXNTaG93aW5nKCkgJiYgbGlzdCAhPSBudWxsKSB7CisgICAgICAgICAgICBsaXN0Lm1MaXN0U2VsZWN0aW9uSGlkZGVuID0gZmFsc2U7CisgICAgICAgICAgICBsaXN0LnNldFNlbGVjdGlvbihwb3NpdGlvbik7CisgICAgICAgICAgICBpZiAobGlzdC5nZXRDaG9pY2VNb2RlKCkgIT0gTGlzdFZpZXcuQ0hPSUNFX01PREVfTk9ORSkgeworICAgICAgICAgICAgICAgIGxpc3Quc2V0SXRlbUNoZWNrZWQocG9zaXRpb24sIHRydWUpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogQ2xlYXIgYW55IGN1cnJlbnQgbGlzdCBzZWxlY3Rpb24uCisgICAgICogT25seSB2YWxpZCB3aGVuIHtAbGluayAjaXNTaG93aW5nKCl9ID09IHtAY29kZSB0cnVlfS4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBjbGVhckxpc3RTZWxlY3Rpb24oKSB7CisgICAgICAgIGZpbmFsIERyb3BEb3duTGlzdFZpZXcgbGlzdCA9IG1Ecm9wRG93bkxpc3Q7CisgICAgICAgIGlmIChsaXN0ICE9IG51bGwpIHsKKyAgICAgICAgICAgIC8vIFdBUk5JTkc6IFBsZWFzZSByZWFkIHRoZSBjb21tZW50IHdoZXJlIG1MaXN0U2VsZWN0aW9uSGlkZGVuIGlzIGRlY2xhcmVkCisgICAgICAgICAgICBsaXN0Lm1MaXN0U2VsZWN0aW9uSGlkZGVuID0gdHJ1ZTsKKyAgICAgICAgICAgIGxpc3QuaGlkZVNlbGVjdG9yKCk7CisgICAgICAgICAgICBsaXN0LnJlcXVlc3RMYXlvdXQoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIEByZXR1cm4ge0Bjb2RlIHRydWV9IGlmIHRoZSBwb3B1cCBpcyBjdXJyZW50bHkgc2hvd2luZywge0Bjb2RlIGZhbHNlfSBvdGhlcndpc2UuCisgICAgICovCisgICAgcHVibGljIGJvb2xlYW4gaXNTaG93aW5nKCkgeworICAgICAgICByZXR1cm4gbVBvcHVwLmlzU2hvd2luZygpOworICAgIH0KKworICAgIC8qKgorICAgICAqIEByZXR1cm4ge0Bjb2RlIHRydWV9IGlmIHRoaXMgcG9wdXAgaXMgY29uZmlndXJlZCB0byBhc3N1bWUgdGhlIHVzZXIgZG9lcyBub3QgbmVlZAorICAgICAqIHRvIGludGVyYWN0IHdpdGggdGhlIElNRSB3aGlsZSBpdCBpcyBzaG93aW5nLCB7QGNvZGUgZmFsc2V9IG90aGVyd2lzZS4KKyAgICAgKi8KKyAgICBwdWJsaWMgYm9vbGVhbiBpc0lucHV0TWV0aG9kTm90TmVlZGVkKCkgeworICAgICAgICByZXR1cm4gbVBvcHVwLmdldElucHV0TWV0aG9kTW9kZSgpID09IElOUFVUX01FVEhPRF9OT1RfTkVFREVEOworICAgIH0KKworICAgIC8qKgorICAgICAqIFBlcmZvcm0gYW4gaXRlbSBjbGljayBvcGVyYXRpb24gb24gdGhlIHNwZWNpZmllZCBsaXN0IGFkYXB0ZXIgcG9zaXRpb24uCisgICAgICogCisgICAgICogQHBhcmFtIHBvc2l0aW9uIEFkYXB0ZXIgcG9zaXRpb24gZm9yIHBlcmZvcm1pbmcgdGhlIGNsaWNrCisgICAgICogQHJldHVybiB0cnVlIGlmIHRoZSBjbGljayBhY3Rpb24gY291bGQgYmUgcGVyZm9ybWVkLCBmYWxzZSBpZiBub3QuCisgICAgICogICAgICAgICAoZS5nLiBpZiB0aGUgcG9wdXAgd2FzIG5vdCBzaG93aW5nLCB0aGlzIG1ldGhvZCB3b3VsZCByZXR1cm4gZmFsc2UuKQorICAgICAqLworICAgIHB1YmxpYyBib29sZWFuIHBlcmZvcm1JdGVtQ2xpY2soaW50IHBvc2l0aW9uKSB7CisgICAgICAgIGlmIChpc1Nob3dpbmcoKSkgeworICAgICAgICAgICAgaWYgKG1JdGVtQ2xpY2tMaXN0ZW5lciAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgZmluYWwgRHJvcERvd25MaXN0VmlldyBsaXN0ID0gbURyb3BEb3duTGlzdDsKKyAgICAgICAgICAgICAgICBmaW5hbCBWaWV3IGNoaWxkID0gbGlzdC5nZXRDaGlsZEF0KHBvc2l0aW9uIC0gbGlzdC5nZXRGaXJzdFZpc2libGVQb3NpdGlvbigpKTsKKyAgICAgICAgICAgICAgICBmaW5hbCBMaXN0QWRhcHRlciBhZGFwdGVyID0gbGlzdC5nZXRBZGFwdGVyKCk7CisgICAgICAgICAgICAgICAgbUl0ZW1DbGlja0xpc3RlbmVyLm9uSXRlbUNsaWNrKGxpc3QsIGNoaWxkLCBwb3NpdGlvbiwgYWRhcHRlci5nZXRJdGVtSWQocG9zaXRpb24pKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBAcmV0dXJuIFRoZSBjdXJyZW50bHkgc2VsZWN0ZWQgaXRlbSBvciBudWxsIGlmIHRoZSBwb3B1cCBpcyBub3Qgc2hvd2luZy4KKyAgICAgKi8KKyAgICBwdWJsaWMgT2JqZWN0IGdldFNlbGVjdGVkSXRlbSgpIHsKKyAgICAgICAgaWYgKCFpc1Nob3dpbmcoKSkgeworICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIG1Ecm9wRG93bkxpc3QuZ2V0U2VsZWN0ZWRJdGVtKCk7CisgICAgfQorCisgICAgLyoqCisgICAgICogQHJldHVybiBUaGUgcG9zaXRpb24gb2YgdGhlIGN1cnJlbnRseSBzZWxlY3RlZCBpdGVtIG9yIHtAbGluayBMaXN0VmlldyNJTlZBTElEX1BPU0lUSU9OfQorICAgICAqIGlmIHtAbGluayAjaXNTaG93aW5nKCl9ID09IHtAY29kZSBmYWxzZX0uCisgICAgICogCisgICAgICogQHNlZSBMaXN0VmlldyNnZXRTZWxlY3RlZEl0ZW1Qb3NpdGlvbigpCisgICAgICovCisgICAgcHVibGljIGludCBnZXRTZWxlY3RlZEl0ZW1Qb3NpdGlvbigpIHsKKyAgICAgICAgaWYgKCFpc1Nob3dpbmcoKSkgeworICAgICAgICAgICAgcmV0dXJuIExpc3RWaWV3LklOVkFMSURfUE9TSVRJT047CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIG1Ecm9wRG93bkxpc3QuZ2V0U2VsZWN0ZWRJdGVtUG9zaXRpb24oKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBAcmV0dXJuIFRoZSBJRCBvZiB0aGUgY3VycmVudGx5IHNlbGVjdGVkIGl0ZW0gb3Ige0BsaW5rIExpc3RWaWV3I0lOVkFMSURfUk9XX0lEfQorICAgICAqIGlmIHtAbGluayAjaXNTaG93aW5nKCl9ID09IHtAY29kZSBmYWxzZX0uCisgICAgICogCisgICAgICogQHNlZSBMaXN0VmlldyNnZXRTZWxlY3RlZEl0ZW1JZCgpCisgICAgICovCisgICAgcHVibGljIGxvbmcgZ2V0U2VsZWN0ZWRJdGVtSWQoKSB7CisgICAgICAgIGlmICghaXNTaG93aW5nKCkpIHsKKyAgICAgICAgICAgIHJldHVybiBMaXN0Vmlldy5JTlZBTElEX1JPV19JRDsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbURyb3BEb3duTGlzdC5nZXRTZWxlY3RlZEl0ZW1JZCgpOworICAgIH0KKworICAgIC8qKgorICAgICAqIEByZXR1cm4gVGhlIFZpZXcgZm9yIHRoZSBjdXJyZW50bHkgc2VsZWN0ZWQgaXRlbSBvciBudWxsI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gdHJ1ZSBpZiB0aGUgZXZlbnQgd2FzIGhhbmRsZWQsIGZhbHNlIGlmIGl0IHdhcyBpZ25vcmVkLgorICAgICAqIAorICAgICAqIEBzZWUgI3NldE1vZGFsKGJvb2xlYW4pCisgICAgICovCisgICAgcHVibGljIGJvb2xlYW4gb25LZXlEb3duKGludCBrZXlDb2RlLCBLZXlFdmVudCBldmVudCkgeworICAgICAgICAvLyB3aGVuIHRoZSBkcm9wIGRvd24gaXMgc2hvd24sIHdlIGRyaXZlIGl0IGRpcmVjdGx5CisgICAgICAgIGlmIChpc1Nob3dpbmcoKSkgeworICAgICAgICAgICAgLy8gdGhlIGtleSBldmVudHMgYXJlIGZvcndhcmRlZCB0byB0aGUgbGlzdCBpbiB0aGUgZHJvcCBkb3duIHZpZXcKKyAgICAgICAgICAgIC8vIG5vdGUgdGhhdCBMaXN0VmlldyBoYW5kbGVzIHNwYWNlIGJ1dCB3ZSBkb24ndCB3YW50IHRoYXQgdG8gaGFwcGVuCisgICAgICAgICAgICAvLyBhbHNvIGlmIHNlbGVjdGlvbiBpcyBub3QgY3VycmVudGx5IGluIHRoZSBkcm9wIGRvd24sIHRoZW4gZG9uJ3QKKyAgICAgICAgICAgIC8vIGxldCBjZW50ZXIgb3IgZW50ZXIgcHJlc3NlcyBnbyB0aGVyZSBzaW5jZSB0aGF0IHdvdWxkIGNhdXNlIGl0CisgICAgICAgICAgICAvLyB0byBzZWxlY3Qgb25lIG9mIGl0cyBpdGVtcworICAgICAgICAgICAgaWYgKGtleUNvZGUgIT0gS2V5RXZlbnQuS0VZQ09ERV9TUEFDRQorICAgICAgICAgICAgICAgICAgICAmJiAobURyb3BEb3duTGlzdC5nZXRTZWxlY3RlZEl0ZW1Qb3NpdGlvbigpID49IDAKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB8fCAoa2V5Q29kZSAhPSBLZXlFdmVudC5LRVlDT0RFX0VOVEVSCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmJiBrZXlDb2RlICE9IEtleUV2ZW50LktFWUNPREVfRFBBRF9DRU5URVIpKSkgeworICAgICAgICAgICAgICAgIGludCBjdXJJbmRleCA9IG1Ecm9wRG93bkxpc3QuZ2V0U2VsZWN0ZWRJdGVtUG9zaXRpb24oKTsKKyAgICAgICAgICAgICAgICBib29sZWFuIGNvbnN1bWVkOworCisgICAgICAgICAgICAgICAgZmluYWwgYm9vbGVhbiBiZWxvdyA9ICFtUG9wdXAuaXNBYm92ZUFuY2hvcigpOworCisgICAgICAgICAgICAgICAgZmluYWwgTGlzdEFkYXB0ZXIgYWRhcHRlciA9IG1BZGFwdGVyOworICAgICAgICAgICAgICAgIAorICAgICAgICAgICAgICAgIGJvb2xlYW4gYWxsRW5hYmxlZDsKKyAgICAgICAgICAgICAgICBpbnQgZmlyc3RJdGVtID0gSW50ZWdlci5NQVhfVkFMVUU7CisgICAgICAgICAgICAgICAgaW50IGxhc3RJdGVtID0gSW50ZWdlci5NSU5fVkFMVUU7CisKKyAgICAgICAgICAgICAgICBpZiAoYWRhcHRlciAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIGFsbEVuYWJsZWQgPSBhZGFwdGVyLmFyZUFsbEl0ZW1zRW5hYmxlZCgpOworICAgICAgICAgICAgICAgICAgICBmaXJzdEl0ZW0gPSBhbGxFbmFibGVkID8gMCA6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbURyb3BEb3duTGlzdC5sb29rRm9yU2VsZWN0YWJsZVBvc2l0aW9uKDAsIHRydWUpOworICAgICAgICAgICAgICAgICAgICBsYXN0SXRlbSA9IGFsbEVuYWJsZWQgPyBhZGFwdGVyLmdldENvdW50KCkgLSAxIDoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtRHJvcERvd25MaXN0Lmxvb2tGb3JTZWxlY3RhYmxlUG9zaXRpb24oYWRhcHRlci5nZXRDb3VudCgpIC0gMSwgZmFsc2UpOyAgICAgICAgICAgICAgICAgICAgCisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIAorICAgICAgICAgICAgICAgIGlmICgoYmVsb3cgJiYga2V5Q29kZSA9PSBLZXlFdmVudC5LRVlDT0RFX0RQQURfVVAgJiYgY3VySW5kZXggPD0gZmlyc3RJdGVtKSB8fAorICAgICAgICAgICAgICAgICAgICAgICAgKCFiZWxvdyAmJiBrZXlDb2RlID09IEtleUV2ZW50LktFWUNPREVfRFBBRF9ET1dOICYmIGN1ckluZGV4ID49IGxhc3RJdGVtKSkgeworICAgICAgICAgICAgICAgICAgICAvLyBXaGVuIHRoZSBzZWxlY3Rpb24gaXMgYXQgdGhlIHRvcCwgd2UgYmxvY2sgdGhlIGtleQorICAgICAgICAgICAgICAgICAgICAvLyBldmVudCB0byBwcmV2ZW50IGZvY3VzIGZyb20gbW92aW5nLgorICAgICAgICAgICAgICAgICAgICBjbGVhckxpc3RTZWxlY3Rpb24oKTsKKyAgICAgICAgICAgICAgICAgICAgbVBvcHVwLnNldElucHV0TWV0aG9kTW9kZShQb3B1cFdpbmRvdy5JTlBVVF9NRVRIT0RfTkVFREVEKTsKKyAgICAgICAgICAgICAgICAgICAgc2hvdygpOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAvLyBXQVJOSU5HOiBQbGVhc2UgcmVhZCB0aGUgY29tbWVudCB3aGVyZSBtTGlzdFNlbGVjdGlvbkhpZGRlbgorICAgICAgICAgICAgICAgICAgICAvLyAgICAgICAgICBpcyBkZWNsYXJlZAorICAgICAgICAgICAgICAgICAgICBtRHJvcERvd25MaXN0Lm1MaXN0U2VsZWN0aW9uSGlkZGVuID0gZmFsc2U7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgY29uc3VtZWQgPSBtRHJvcERvd25MaXN0Lm9uS2V5RG93bihrZXlDb2RlLCBldmVudCk7CisgICAgICAgICAgICAgICAgaWYgKERFQlVHKSBMb2cudihUQUcsICJLZXkgZG93bjogY29kZT0iICsga2V5Q29kZSArICIgbGlzdCBjb25zdW1lZD0iICsgY29uc3VtZWQpOworCisgICAgICAgICAgICAgICAgaWYgKGNvbnN1bWVkKSB7CisgICAgICAgICAgICAgICAgICAgIC8vIElmIGl0IGhhbmRsZWQgdGhlIGtleSBldmVudCwgdGhlbiB0aGUgdXNlciBpcworICAgICAgICAgICAgICAgICAgICAvLyBuYXZpZ2F0aW5nIGluIHRoZSBsaXN0LCBzbyB3ZSBzaG91bGQgcHV0IGl0IGluIGZyb250LgorICAgICAgICAgICAgICAgICAgICBtUG9wdXAuc2V0SW5wdXRNZXRob2RNb2RlKFBvcHVwV2luZG93LklOUFVUX01FVEhPRF9OT1RfTkVFREVEKTsKKyAgICAgICAgICAgICAgICAgICAgLy8gSGVyZSdzIGEgbGl0dGxlIHRyaWNrIHdlIG5lZWQgdG8gZG8gdG8gbWFrZSBzdXJlIHRoYXQKKyAgICAgICAgICAgICAgICAgICAgLy8gdGhlIGxpc3QgdmlldyBpcyBhY3R1YWxseSBzaG93aW5nIGl0cyBmb2N1cyBpbmRpY2F0b3IsCisgICAgICAgICAgICAgICAgICAgIC8vIGJ5IGVuc3VyaW5nIGl0IGhhcyBmb2N1cyBhbmQgZ2V0dGluZyBpdHMgd2luZG93IG91dAorICAgICAgICAgICAgICAgICAgICAvLyBvZiB0b3VjaCBtb2RlLgorICAgICAgICAgICAgICAgICAgICBtRHJvcERvd25MaXN0LnJlcXVlc3RGb2N1c0Zyb21Ub3VjaCgpOworICAgICAgICAgICAgICAgICAgICBzaG93KCk7CisKKyAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChrZXlDb2RlKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAvLyBhdm9pZCBwYXNzaW5nIHRoZSBmb2N1cyBmcm9tIHRoZSB0ZXh0IHZpZXcgdG8gdGhlCisgICAgICAgICAgICAgICAgICAgICAgICAvLyBuZXh0IGNvbXBvbmVudAorICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBLZXlFdmVudC5LRVlDT0RFX0VOVEVSOgorICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBLZXlFdmVudC5LRVlDT0RFX0RQQURfQ0VOVEVSOgorICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBLZXlFdmVudC5LRVlDT0RFX0RQQURfRE9XTjoKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgS2V5RXZlbnQuS0VZQ09ERV9EUEFEX1VQOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGJlbG93ICYmIGtleUNvZGUgPT0gS2V5RXZlbnQuS0VZQ09ERV9EUEFEX0RPV04pIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIHdoZW4gdGhlIHNlbGVjdGlvbiBpcyBhdCB0aGUgYm90dG9tLCB3ZSBibG9jayB0aGUKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIGV2ZW50IHRvIGF2b2lkIGdvaW5nIHRvIHRoZSBuZXh0IGZvY3VzYWJsZSB3aWRnZXQKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjdXJJbmRleCA9PSBsYXN0SXRlbSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKCFiZWxvdyAmJiBrZXlDb2RlID09IEtleUV2ZW50LktFWUNPREVfRFBBRF9VUCAmJgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGN1ckluZGV4ID09IGZpcnN0SXRlbSkgeworICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgLyoqCisgICAgICogRmlsdGVyIGtleSBkb3duIGV2ZW50cy4gQnkgZm9yd2FyZGluZyBrZXkgdXAgZXZlbnRzIHRvIHRoaXMgZnVuY3Rpb24sCisgICAgICogdmlld3MgdXNpbmcgbm9uLW1vZGFsIExpc3RQb3B1cFdpbmRvdyBjYW4gaGF2ZSBpdCBoYW5kbGUga2V5IHNlbGVjdGlvbiBvZiBpdGVtcy4KKyAgICAgKiAgCisgICAgICogQHBhcmFtIGtleUNvZGUga2V5Q29kZSBwYXJhbSBwYXNzZWQgdG8gdGhlIGhvc3QgdmlldydzIG9uS2V5VXAKKyAgICAgKiBAcGFyYW0gZXZlbnQgZXZlbnQgcGFyYW0gcGFzc2VkIHRvIHRoZSBob3N0IHZpZXcncyBvbktleVVwCisgICAgICogQHJldHVybiB0cnVlIGlmIHRoZSBldmVudCB3YXMgaGFuZGxlZCwgZmFsc2UgaWYgaXQgd2FzIGlnbm9yZWQuCisgICAgICogCisgICAgICogQHNlZSAjc2V0TW9kYWwoYm9vbGVhbikKKyAgICAgKi8KKyAgICBwdWJsaWMgYm9vbGVhbiBvbktleVVwKGludCBrZXlDb2RlLCBLZXlFdmVudCBldmVudCkgeworICAgICAgICBpZiAoaXNTaG93aW5nKCkgJiYgbURyb3BEb3duTGlzdC5nZXRTZWxlY3RlZEl0ZW1Qb3NpdGlvbigpID49IDApIHsKKyAgICAgICAgICAgIGJvb2xlYW4gY29uc3VtZWQgPSBtRHJvcERvd25MaXN0Lm9uS2V5VXAoa2V5Q29kZSwgZXZlbnQpOworICAgICAgICAgICAgaWYgKGNvbnN1bWVkKSB7CisgICAgICAgICAgICAgICAgc3dpdGNoIChrZXlDb2RlKSB7CisgICAgICAgICAgICAgICAgICAgIC8vIGlmIHRoZSBsaXN0IGFjY2VwdHMgdGhlIGtleSBldmVudHMgYW5kIHRoZSBrZXkgZXZlbnQKKyAgICAgICAgICAgICAgICAgICAgLy8gd2FzIGEgY2xpY2ssIHRoZSB0ZXh0IHZpZXcgZ2V0cyB0aGUgc2VsZWN0ZWQgaXRlbQorICAgICAgICAgICAgICAgICAgICAvLyBmcm9tIHRoZSBkcm9wIGRvd24gYXMgaXRzIGNvbnRlbnQKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBLZXlFdmVudC5LRVlDT0RFX0VOVEVSOgorICAgICAgICAgICAgICAgICAgICBjYXNlIEtleUV2ZW50LktFWUNPREVfRFBBRF9DRU5URVI6CisgICAgICAgICAgICAgICAgICAgICAgICBkaXNtaXNzKCk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gY29uc3VtZWQ7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIC8qKgorICAgICAqIEZpbHRlciBwcmUtSU1FIGtleSBldmVudHMuIEJ5IGZvcndhcmRpbmcge0BsaW5rIFZpZXcjb25LZXlQcmVJbWUoaW50LCBLZXlFdmVudCl9CisgICAgICogZXZlbnRzIHRvIHRoaXMgZnVuY3Rpb24sIHZpZXdzIHVzaW5nIExpc3RQb3B1cFdpbmRvdyBjYW4gaGF2ZSBpdCBkaXNtaXNzIHRoZSBwb3B1cAorICAgICAqIHdoZW4gdGhlIGJhY2sga2V5IGlzIHByZXNzZWQuCisgICAgICogIAorICAgICAqIEBwYXJhbSBrZXlDb2RlIGtleUNvZGUgcGFyYW0gcGFzc2VkIHRvIHRoZSBob3N0IHZpZXcncyBvbktleVByZUltZQorICAgICAqIEBwYXJhbSBldmVudCBldmVudCBwYXJhbSBwYXNzZWQgdG8gdGhlIGhvc3QgdmlldydzIG9uS2V5UHJlSW1lCisgICAgICogQHJldHVybiB0cnVlIGlmIHRoZSBldmVudCB3YXMgaGFuZGxlZCwgZmFsc2UgaWYgaXQgd2FzIGlnbm9yZWQuCisgICAgICogCisgICAgICogQHNlZSAjc2V0TW9kYWwoYm9vbGVhbikKKyAgICAgKi8KKyAgICBwdWJsaWMgYm9vbGVhbiBvbktleVByZUltZShpbnQga2V5Q29kZSwgS2V5RXZlbnQgZXZlbnQpIHsKKyAgICAgICAgaWYgKGtleUNvZGUgPT0gS2V5RXZlbnQuS0VZQ09ERV9CQUNLICYmIGlzU2hvd2luZygpKSB7CisgICAgICAgICAgICAvLyBzcGVjaWFsIGNhc2UgZm9yIHRoZSBiYWNrIGtleSwgd2UgZG8gbm90IGV2ZW4gdHJ5IHRvIHNlbmQgaXQKKyAgICAgICAgICAgIC8vIHRvIHRoZSBkcm9wIGRvd24gbGlzdCBidXQgaW5zdGVhZCwgY29uc3VtZSBpdCBpbW1lZGlhdGVseQorICAgICAgICAgICAgZmluYWwgVmlldyBhbmNob3JWaWV3ID0gbURyb3BEb3duQW5jaG9yVmlldzsKKyAgICAgICAgICAgIGlmIChldmVudC5nZXRBY3Rpb24oKSA9PSBLZXlFdmVudC5BQ1RJT05fRE9XTiAmJiBldmVudC5nZXRSZXBlYXRDb3VudCgpID09IDApIHsKKyAgICAgICAgICAgICAgICBhbmNob3JWaWV3LmdldEtleURpc3BhdGNoZXJTdGF0ZSgpLnN0YXJ0VHJhY2tpbmcoZXZlbnQsIHRoaXMpOworICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgfSBlbHNlIGlmIChldmVudC5nZXRBY3Rpb24oKSA9PSBLZXlFdmVudC5BQ1RJT05fVVApIHsKKyAgICAgICAgICAgICAgICBhbmNob3JWaWV3LmdldEtleURpc3BhdGNoZXJTdGF0ZSgpLmhhbmRsZVVwRXZlbnQoZXZlbnQpOworICAgICAgICAgICAgICAgIGlmIChldmVudC5pc1RyYWNraW5nKCkgJiYgIWV2ZW50LmlzQ2FuY2VsZWQoKSkgeworICAgICAgICAgICAgICAgICAgICBkaXNtaXNzKCk7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgLyoqCisgICAgICogPHA+QnVpbGRzIHRoZSBwb3B1cCB3aW5kb3cncyBjb250ZW50IGFuZCByZXR1cm5zIHRoZSBoZWlnaHQgdGhlIHBvcHVwCisgICAgICogc2hvdWxkIGhhdmUuIFJldHVybnMgLTEgd2hlbiB0aGUgY29udGVudCBhbHJlYWR5IGV4aXN0cy48L3A+CisgICAgICoKKyAgICAgKiBAcmV0dXJuIHRoZSBjb250ZW50J3MgaGVpZ2h0IG9yIC0xIGlmIGNvbnRlbnQgYWxyZWFkeSBleGlzdHMKKyAgICAgKi8KKyAgICBwcml2YXRlIGludCBidWlsZERyb3BEb3duKCkgeworICAgICAgICBWaWV3R3JvdXAgZHJvcERvd25WaWV3OworICAgICAgICBpbnQgb3RoZXJIZWlnaHRzID0gMDsKKworICAgICAgICBpZiAobURyb3BEb3duTGlzdCA9PSBudWxsKSB7CisgICAgICAgICAgICBDb250ZXh0IGNvbnRleHQgPSBtQ29udGV4dDsKKworICAgICAgICAgICAgLyoqCisgICAgICAgICAgICAgKiBUaGlzIFJ1bm5hYmxlIGV4aXN0cyBmb3IgdGhlIHNvbGUgcHVycG9zZSBvZiBjaGVja2luZyBpZiB0aGUgdmlldyBsYXlvdXQgaGFzIGdvdAorICAgICAgICAgICAgICogY29tcGxldGVkIGFuZCBpZiBzbyBjYWxsIHNob3dEcm9wRG93biB0byBkaXNwbGF5IHRoZSBkcm9wIGRvd24uIFRoaXMgaXMgdXNlZCB0byBzaG93CisgICAgICAgICAgICAgKiB0aGUgZHJvcCBkb3duIGFzIHNvb24gYXMgcG9zc2libGUgYWZ0ZXIgdXNlciBvcGVucyB1cCB0aGUgc2VhcmNoIGRpYWxvZywgd2l0aG91dAorICAgICAgICAgICAgICogd2FpdGluZyBmb3IgdGhlIG5vcm1hbCBVSSBwaXBlbGluZSB0byBkbyBpdCdzIGpvYiB3aGljaCBpcyBzbG93ZXIgdGhhbiB0aGlzIG1ldGhvZC4KKyAgICAgICAgICAgICAqLworICAgICAgICAgICAgbVNob3dEcm9wRG93blJ1bm5hYmxlID0gbmV3IFJ1bm5hYmxlKCkgeworICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIHJ1bigpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gVmlldyBsYXlvdXQgc2hvdWxkIGJlIGFsbCBkb25lIGJlZm9yZSBkaXNwbGF5aW5nIHRoZSBkcm9wIGRvd24uCisgICAgICAgICAgICAgICAgICAgIFZpZXcgdmlldyA9IGdldEFuY2hvclZpZXcoKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKHZpZXcgIT0gbnVsbCAmJiB2aWV3LmdldFdpbmRvd1Rva2VuKCkgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgc2hvdygpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfTsKKworICAgICAgICAgICAgbURyb3BEb3duTGlzdCA9IG5ldyBEcm9wRG93bkxpc3RWaWV3KGNvbnRleHQsICFtTW9kYWwpOworICAgICAgICAgICAgaWYgKG1Ecm9wRG93bkxpc3RIaWdobGlnaHQgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIG1Ecm9wRG93bkxpc3Quc2V0U2VsZWN0b3IobURyb3BEb3duTGlzdEhpZ2hsaWdodCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBtRHJvcERvd25MaXN0LnNldEFkYXB0ZXIobUFkYXB0ZXIpOworICAgICAgICAgICAgbURyb3BEb3duTGlzdC5zZXRWZXJ0aWNhbEZhZGluZ0VkZ2VFbmFibGVkKHRydWUpOworICAgICAgICAgICAgbURyb3BEb3duTGlzdC5zZXRPbkl0ZW1DbGlja0xpc3RlbmVyKG1JdGVtQ2xpY2tMaXN0ZW5lcik7CisgICAgICAgICAgICBtRHJvcERvd25MaXN0LnNldEZvY3VzYWJsZSh0cnVlKTsKKyAgICAgICAgICAgIG1Ecm9wRG93bkxpc3Quc2V0Rm9jdXNhYmxlSW5Ub3VjaE1vZGUodHJ1ZSk7CisgICAgICAgICAgICBtRHJvcERvd25MaXN0LnNldE9uSXRlbVNlbGVjdGVkTGlzdGVuZXIobmV3IEFkYXB0ZXJWaWV3Lk9uSXRlbVNlbGVjdGVkTGlzdGVuZXIoKSB7CisgICAgICAgICAgICAgICAgcHVibGljIHZvaWQgb25JdGVtU2VsZWN0ZWQoQWRhcHRlclZpZXc8Pz4gcGFyZW50LCBWaWV3IHZpZXcsCisgICAgICAgICAgICAgICAgICAgICAgICBpbnQgcG9zaXRpb24sIGxvbmcgaWQpIHsKKworICAgICAgICAgICAgICAgICAgICBpZiAocG9zaXRpb24gIT0gLTEpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIERyb3BEb3duTGlzdFZpZXcgZHJvcERvd25MaXN0ID0gbURyb3BEb3duTGlzdDsKKworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRyb3BEb3duTGlzdCAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZHJvcERvd25MaXN0Lm1MaXN0U2VsZWN0aW9uSGlkZGVuID0gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBvbk5vdGhpbmdTZWxlY3RlZChBZGFwdGVyVmlldzw/PiBwYXJlbnQpIHsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9KTsKKyAgICAgICAgICAgIG1Ecm9wRG93bkxpc3Quc2V0T25TY3JvbGxMaXN0ZW5lcihtU2Nyb2xsTGlzdGVuZXIpOworCisgICAgICAgICAgICBpZiAobUl0ZW1TZWxlY3RlZExpc3RlbmVyICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBtRHJvcERvd25MaXN0LnNldE9uSXRlbVNlbGVjdGVkTGlzdGVuZXIobUl0ZW1TZWxlY3RlZExpc3RlbmVyKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgZHJvcERvd25WaWV3ID0gbURyb3BEb3duTGlzdDsKKworICAgICAgICAgICAgVmlldyBoaW50VmlldyA9IG1Qcm9tcHRWaWV3OworICAgICAgICAgICAgaWYgKGhpbnRWaWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAvLyBpZiBhbiBoaW50IGhhcyBiZWVuIHNwZWNpZmllZCwgd2UgYWNjb21vZGF0ZSBtb3JlIHNwYWNlIGZvciBpdCBhbmQKKyAgICAgICAgICAgICAgICAvLyBhZGQgYSB0ZXh0IHZpZXcgaW4gdGhlIGRyb3AgZG93biBtZW51LCBhdCB0aGUgYm90dG9tIG9mIHRoZSBsaXN0CisgICAgICAgICAgICAgICAgTGluZWFyTGF5b3V0IGhpbnRDb250YWluZXIgPSBuZXcgTGluZWFyTGF5b3V0KGNvbnRleHQpOworICAgICAgICAgICAgICAgIGhpbnRDb250YWluZXIuc2V0T3JpZW50YXRpb24oTGluZWFyTGF5b3V0LlZFUlRJQ0FMKTsKKworICAgICAgICAgICAgICAgIExpbmVhckxheW91dC5MYXlvdXRQYXJhbXMgaGludFBhcmFtcyA9IG5ldyBMaW5lYXJMYXlvdXQuTGF5b3V0UGFyYW1zKAorICAgICAgICAgICAgICAgICAgICAgICAgVmlld0dyb3VwLkxheW91dFBhcmFtcy5NQVRDSF9QQVJFTlQsIDAsIDEuMGYKKyAgICAgICAgICAgICAgICApOworICAgICAgICAgICAgICAgIAorICAgICAgICAgICAgICAgIHN3aXRjaCAobVByb21wdFBvc2l0aW9uKSB7CisgICAgICAgICAgICAgICAgY2FzZSBQT1NJVElPTl9QUk9NUFRfQkVMT1c6CisgICAgICAgICAgICAgICAgICAgIGhpbnRDb250YWluZXIuYWRkVmlldyhkcm9wRG93blZpZXcsIGhpbnRQYXJhbXMpOworICAgICAgICAgICAgICAgICAgICBoaW50Q29udGFpbmVyLmFkZFZpZXcoaGludFZpZXcpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgCisgICAgICAgICAgICAgICAgY2FzZSBQT1NJVElPTl9QUk9NUFRfQUJPVkU6CisgICAgICAgICAgICAgICAgICAgIGhpbnRDb250YWluZXIuYWRkVmlldyhoaW50Vmlldyk7CisgICAgICAgICAgICAgICAgICAgIGhpbnRDb250YWluZXIuYWRkVmlldyhkcm9wRG93blZpZXcsIGhpbnRQYXJhbXMpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgCisgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgTG9nLmUoVEFHLCAiSW52YWxpZCBoaW50IHBvc2l0aW9uICIgKyBtUHJvbXB0UG9zaXRpb24pOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAvLyBtZWFzdXJlIHRoZSBoaW50J3MgaGVpZ2h0IHRvIGZpbmQgaG93IG11Y2ggbW9yZSB2ZXJ0aWNhbCBzcGFjZQorICAgICAgICAgICAgICAgIC8vIHdlIG5lZWQgdG8gYWRkIHRvIHRoZSBkcm9wIGRvd24ncyBoZWlnaHQKKyAgICAgICAgICAgICAgICBpbnQgd2lkdGhTcGVjID0gTWVhc3VyZVNwZWMubWFrZU1lYXN1cmVTcGVjKG1Ecm9wRG93bldpZHRoLCBNZWFzdXJlU3BlYy5BVF9NT1NUKTsKKyAgICAgICAgICAgICAgICBpbnQgaGVpZ2h0U3BlYyA9IE1lYXN1cmVTcGVjLlVOU1BFQ0lGSUVEOworICAgICAgICAgICAgICAgIGhpbnRWaWV3Lm1lYXN1cmUod2lkdGhTcGVjLCBoZWlnaHRTcGVjKTsKKworICAgICAgICAgICAgICAgIGhpbnRQYXJhbXMgPSAoTGluZWFyTGF5b3V0LkxheW91dFBhcmFtcykgaGludFZpZXcuZ2V0TGF5b3V0UGFyYW1zKCk7CisgICAgICAgICAgICAgICAgb3RoZXJIZWlnaHRzID0gaGludFZpZXcuZ2V0TWVhc3VyZWRIZWlnaHQoKSArIGhpbnRQYXJhbXMudG9wTWFyZ2luCisgICAgICAgICAgICAgICAgICAgICAgICArIGhpbnRQYXJhbXMuYm90dG9tTWFyZ2luOworCisgICAgICAgICAgICAgICAgZHJvcERvd25WaWV3ID0gaGludENvbnRhaW5lcjsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgbVBvcHVwLnNldENvbnRlbnRWaWV3KGRyb3BEb3duVmlldyk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBkcm9wRG93blZpZXcgPSAoVmlld0dyb3VwKSBtUG9wdXAuZ2V0Q29udGVudFZpZXcoKTsKKyAgICAgICAgICAgIGZpbmFsIFZpZXcgdmlldyA9IG1Qcm9tcHRWaWV3OworICAgICAgICAgICAgaWYgKHZpZXcgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIExpbmVhckxheW91dC5MYXlvdXRQYXJhbXMgaGludFBhcmFtcyA9CisgICAgICAgICAgICAgICAgICAgICAgICAoTGluZWFyTGF5b3V0LkxheW91dFBhcmFtcykgdmlldy5nZXRMYXlvdXRQYXJhbXMoKTsKKyAgICAgICAgICAgICAgICBvdGhlckhlaWdodHMgPSB2aWV3LmdldE1lYXN1cmVkSGVpZ2h0KCkgKyBoaW50UGFyYW1zLnRvcE1hcmdpbgorICAgICAgICAgICAgICAgICAgICAgICAgKyBoaW50UGFyYW1zLmJvdHRvbU1hcmdpbjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIC8vIE1heCBoZWlnaHQgYXZhaWxhYmxlIG9uIHRoZSBzY3JlZW4gZm9yIGEgcG9wdXAuCisgICAgICAgIGJvb2xlYW4gaWdub3JlQm90dG9tRGVjb3JhdGlvbnMgPQorICAgICAgICAgICAgICAgIG1Qb3B1cC5nZXRJbnB1dE1ldGhvZE1vZGUoKSA9PSBQb3B1cFdpbmRvdy5JTlBVVF9NRVRIT0RfTk9UX05FRURFRDsKKyAgICAgICAgZmluYWwgaW50IG1heEhlaWdodCA9IG1Qb3B1cC5nZXRNYXhBdmFpbGFibGVIZWlnaHQoCisgICAgICAgICAgICAgICAgZ2V0QW5jaG9yVmlldygpLCBtRHJvcERvd25WZXJ0aWNhbE9mZnNldCwgaWdub3JlQm90dG9tRGVjb3JhdGlvbnMpOworCisgICAgICAgIC8vIGdldE1heEF2YWlsYWJsZUhlaWdodCgpIHN1YnRyYWN0cyB0aGUgcGFkZGluZywgc28gd2UgcHV0IGl0IGJhY2ssCisgICAgICAgIC8vIHRvIGdldCB0aGUgYXZhaWxhYmxlIGhlaWdodCBmb3IgdGhlIHdob2xlIHdpbmRvdworICAgICAgICBpbnQgcGFkZGluZyA9IDA7CisgICAgICAgIERyYXdhYmxlIGJhY2tncm91bmQgPSBtUG9wdXAuZ2V0QmFja2dyb3VuZCgpOworICAgICAgICBpZiAoYmFja2dyb3VuZCAhPSBudWxsKSB7CisgICAgICAgICAgICBiYWNrZ3JvdW5kLmdldFBhZGRpbmcobVRlbXBSZWN0KTsKKyAgICAgICAgICAgIHBhZGRpbmcgPSBtVGVtcFJlY3QudG9wICsgbVRlbXBSZWN0LmJvdHRvbTsKKyAgICAgICAgfQorCisgICAgICAgIGlmIChtRHJvcERvd25BbHdheXNWaXNpYmxlIHx8IG1Ecm9wRG93bkhlaWdodCA9PSBWaWV3R3JvdXAuTGF5b3V0UGFyYW1zLk1BVENIX1BBUkVOVCkgeworICAgICAgICAgICAgcmV0dXJuIG1heEhlaWdodCArIHBhZGRpbmc7CisgICAgICAgIH0KKworICAgICAgICBmaW5hbCBpbnQgbGlzdENvbnRlbnQgPSBtRHJvcERvd25MaXN0Lm1lYXN1cmVIZWlnaHRPZkNoaWxkcmVuKE1lYXN1cmVTcGVjLlVOU1BFQ0lGSUVELAorICAgICAgICAgICAgICAgIDAsIExpc3RWaWV3Lk5P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ICogPHA+Q3JlYXRlcyBhIG5ldyBsaXN0IHZpZXcgd3JhcHBlci48L3A+CisgICAgICAgICAqCisgICAgICAgICAqIEBwYXJhbSBjb250ZXh0IHRoaXMgdmlldydzIGNvbnRleHQKKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBEcm9wRG93bkxpc3RWaWV3KENvbnRleHQgY29udGV4dCwgYm9vbGVhbiBoaWphY2tGb2N1cykgeworICAgICAgICAgICAgc3VwZXIoY29udGV4dCwgbnVsbCwgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5hdHRyLmRyb3BEb3duTGlzdFZpZXdTdHlsZSk7CisgICAgICAgICAgICBtSGlqYWNrRm9jdXMgPSBoaWphY2tGb2N1czsKKyAgICAgICAgfQorCisgICAgICAgIC8qKgorICAgICAgICAgKiA8cD5Bdm9pZHMgamFycmluZyBzY3JvbGxpbmcgZWZmZWN0IGJ5IGVuc3VyaW5nIHRoYXQgbGlzdCBlbGVtZW50cworICAgICAgICAgKiBtYWRlIG9mIGEgdGV4dCB2aWV3IGZpdCBvbiBhIHNpbmdsZSBsaW5lLjwvcD4KKyAgICAgICAgICoKKyAgICAgICAgICogQHBhcmFtIHBvc2l0aW9uIHRoZSBpdGVtIGluZGV4IGluIHRoZSBsaXN0IHRvIGdldCBhIHZpZXcgZm9yCisgICAgICAgICAqIEByZXR1cm4gdGhlIHZpZXcgZm9yIHRoZSBzcGVjaWZpZWQgaXRlbQorICAgICAgICAgKi8KKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIFZpZXcgb2J0YWluVmlldyhpbnQgcG9zaXRpb24sIGJvb2xlYW5bXSBpc1NjcmFwKSB7CisgICAgICAgICAgICBWaWV3IHZpZXcgPSBzdXBlci5vYnRhaW5WaWV3KHBvc2l0aW9uLCBpc1NjcmFwKTsKKworICAgICAgICAgICAgaWYgKHZpZXcgaW5zdGFuY2VvZiBUZXh0VmlldykgeworICAgICAgICAgICAgICAgICgoVGV4dFZpZXcpIHZpZXcpLnNldEhvcml6b250YWxseVNjcm9sbGluZyh0cnVlKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcmV0dXJuIHZpZXc7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIGJvb2xlYW4gaXNJblRvdWNoTW9kZSgpIHsKKyAgICAgICAgICAgIC8vIFdBUk5JTkc6IFBsZWFzZSByZWFkIHRoZSBjb21tZW50IHdoZXJlIG1MaXN0U2VsZWN0aW9uSGlkZGVuIGlzIGRlY2xhcmVkCisgICAgICAgICAgICByZXR1cm4gKG1IaWphY2tGb2N1cyAmJiBtTGlzdFNlbGVjdGlvbkhpZGRlbikgfHwgc3VwZXIuaXNJblRvdWNoTW9kZSgpOworICAgICAgICB9CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIDxwPlJldHVybnMgdGhlIGZvY3VzIHN0YXRlIGluIHRoZSBkcm9wIGRvd24uPC9wPgorICAgICAgICAgKgorICAgICAgICAgKiBAcmV0dXJuIHRydWUgYWx3YXlzIGlmIGhpamFja2luZyBmb2N1cworICAgICAgICAgKi8KKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBib29sZWFuIGhhc1dpbmRvd0ZvY3VzKCkgeworICAgICAgICAgICAgcmV0dXJuIG1IaWphY2tGb2N1cyB8fCBzdXBlci5oYXNXaW5kb3dGb2N1cygpOworICAgICAgICB9CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIDxwPlJldHVybnMgdGhlIGZvY3VzIHN0YXRlIGluIHRoZSBkcm9wIGRvd24uPC9wPgorICAgICAgICAgKgorICAgICAgICAgKiBAcmV0dXJuIHRydWUgYWx3YXlzIGlmIGhpamFja2luZyBmb2N1cworICAgICAgICAgKi8KKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBib29sZWFuIGlzRm9jdXNlZCgpIHsKKyAgICAgICAgICAgIHJldHVybiBtSGlqYWNrRm9jdXMgfHwgc3VwZXIuaXNGb2N1c2VkKCk7CisgICAgICAgIH0KKworICAgICAgICAvKioKKyAgICAgICAgICogPHA+UmV0dXJucyB0aGUgZm9jdXMgc3RhdGUgaW4gdGhlIGRyb3AgZG93bi48L3A+CisgICAgICAgICAqCisgICAgICAgICAqIEByZXR1cm4gdHJ1ZSBhbHdheXMgaWYgaGlqYWNraW5nIGZvY3VzCisgICAgICAgICAqLworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIGJvb2xlYW4gaGFzRm9jdXMoKSB7CisgICAgICAgICAgICByZXR1cm4gbUhpamFja0ZvY3VzIHx8IHN1cGVyLmhhc0ZvY3VzKCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIGNsYXNzIFBvcHVwRGF0YVNldE9ic2VydmVyIGV4dGVuZHMgRGF0YVNldE9ic2VydmVyIHsKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIG9uQ2hhbmdlZCgpIHsKKyAgICAgICAgICAgIGlmIChpc1Nob3dpbmcoKSkgeworICAgICAgICAgICAgICAgIC8vIFJlc2l6ZSB0aGUgcG9wdXAgdG8gZml0IG5ldyBjb250ZW50CisgICAgICAgICAgICAgICAgc2hvdygpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIAorICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgb25JbnZhbGlkYXRlZCgpIHsKKyAgICAgICAgICAgIGRpc21pc3MoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgY2xhc3MgTGlzdFNlbGVjdG9ySGlkZXIgaW1wbGVtZW50cyBSdW5uYWJsZSB7CisgICAgICAgIHB1YmxpYyB2b2lkIHJ1bigpIHsKKyAgICAgICAgICAgIGNsZWFyTGlzdFNlbGVjdGlvbigpOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSBjbGFzcyBSZXNpemVQb3B1cFJ1bm5hYmxlIGltcGxlbWVudHMgUnVubmFibGUgeworICAgICAgICBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgICAgICBtUG9wdXAuc2V0SW5wdXRNZXRob2RNb2RlKFBvcHVwV2luZG93LklOUFVUX01FVEhPRF9OT1RfTkVFREVEKTsKKyAgICAgICAgICAgIHNob3coKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgY2xhc3MgUG9wdXBUb3VjaEludGVyY2VwdG9yIGltcGxlbWVudHMgT25Ub3VjaExpc3RlbmVyIHsKKyAgICAgICAgcHVibGljIGJvb2xlYW4gb25Ub3VjaChWaWV3IHYsIE1vdGlvbkV2ZW50IGV2ZW50KSB7CisgICAgICAgICAgICBmaW5hbCBpbnQgYWN0aW9uID0gZXZlbnQuZ2V0QWN0aW9uKCk7CisgICAgICAgICAgICBmaW5hbCBpbnQgeCA9IChpbnQpIGV2ZW50LmdldFgoKTsKKyAgICAgICAgICAgIGZpbmFsIGludCB5ID0gKGludCkgZXZlbnQuZ2V0WSgpOworICAgICAgICAgICAgCisgICAgICAgICAgICBpZiAoYWN0aW9uID09IE1vdGlvbkV2ZW50LkFDVElPTl9ET1dOICYmCisgICAgICAgICAgICAgICAgICAgIG1Qb3B1cCAhPSBudWxsICYmIG1Qb3B1cC5pc1Nob3dpbmcoKSAmJgorICAgICAgICAgICAgICAgICAgICAoeCA+PSAwICYmIHggPCBnZXRXaWR0aCgpICYmIHkgPj0gMCAmJiB5IDwgZ2V0SGVpZ2h0KCkpKSB7CisgICAgICAgICAgICAgICAgbUhhbmRsZXIucG9zdERlbGF5ZWQobVJlc2l6ZVBvcHVwUnVubmFibGUsIEVYUEFORF9MSVNUX1RJTUVPVVQpOworICAgICAgICAgICAgfSBlbHNlIGlmIChhY3Rpb24gPT0gTW90aW9uRXZlbnQuQUNUSU9OX1VQKSB7CisgICAgICAgICAgICAgICAgbUhhbmRsZXIucmVtb3ZlQ2FsbGJhY2tzKG1SZXNpemVQb3B1cFJ1bm5hYmxlKTsKKyA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dGFibGUgPSBtQWRhcHRlci5hcmVBbGxJdGVtc0VuYWJsZWQoKTsKICAgICAgICAgICAgIG1PbGRJdGVtQ291bnQgPSBtSXRlbUNvdW50OwpAQCAtNDcwLDEzICs0NDgsNiBAQAogICAgICAgICAgICAgICAgIC8vIE5vdGhpbmcgc2VsZWN0ZWQKICAgICAgICAgICAgICAgICBjaGVja1NlbGVjdGlvbkNoYW5nZWQoKTsKICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgaWYgKG1DaG9pY2VNb2RlICE9IENIT0lDRV9NT0RFX05PTkUgJiYKLSAgICAgICAgICAgICAgICAgICAgbUFkYXB0ZXIuaGFzU3RhYmxlSWRzKCkgJiYKLSAgICAgICAgICAgICAgICAgICAgbUNoZWNrZWRJZFN0YXRlcyA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgbUNoZWNrZWRJZFN0YXRlcyA9IG5ldyBMb25nU3BhcnNlQXJyYXk8Qm9vbGVhbj4oKTsKLSAgICAgICAgICAgIH0KLQogICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgbUFyZUFsbEl0ZW1zU2VsZWN0YWJsZSA9IHRydWU7CiAgICAgICAgICAgICBjaGVja0ZvY3VzKCk7CkBAIC00ODQsMTQgKzQ1NSw2IEBACiAgICAgICAgICAgICBjaGVja1NlbGVjdGlvbkNoYW5nZWQoKTsKICAgICAgICAgfQogCi0gICAgICAgIGlmIChtQ2hlY2tTdGF0ZXMgIT0gbnVsbCkgewotICAgICAgICAgICAgbUNoZWNrU3RhdGVzLmNsZWFyKCk7Ci0gICAgICAgIH0KLSAgICAgICAgCi0gICAgICAgIGlmIChtQ2hlY2tlZElkU3RhdGVzICE9IG51bGwpIHsKLSAgICAgICAgICAgIG1DaGVja2VkSWRTdGF0ZXMuY2xlYXIoKTsKLSAgICAgICAgfQotCiAgICAgICAgIHJlcXVlc3RMYXlvdXQoKTsKICAgICB9CiAKQEAgLTg3OSw2ICs4NDIsMjUgQEAKICAgICAgICAgcmV0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9IG1Cb3R0b20gLSBtVG9wIC0gbUxpc3RQYWRkaW5nLmJvdHRvbSArIG1TY3JvbGxZOwogICAgICAgICAgICAgaWYgKCFtU3RhY2tGcm9tQm90dG9tKSB7Ci0gICAgICAgICAgICAgICAgaW50IGJvdHRvbSA9IDA7CisgICAgICAgICAgICAgICAgaW50IGJvdHRvbTsKICAgICAgICAgICAgICAgICAKLSAgICAgICAgICAgICAgICAvLyBEcmF3IHRvcCBkaXZpZGVyIG9yIGhlYWRlciBmb3Igb3ZlcnNjcm9sbAogICAgICAgICAgICAgICAgIGZpbmFsIGludCBzY3JvbGxZID0gbVNjcm9sbFk7Ci0gICAgICAgICAgICAgICAgaWYgKGNvdW50ID4gMCAmJiBzY3JvbGxZIDwgMCkgewotICAgICAgICAgICAgICAgICAgICBpZiAoZHJhd092ZXJzY3JvbGxIZWFkZXIpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGJvdW5kcy5ib3R0b20gPSAwOwotICAgICAgICAgICAgICAgICAgICAgICAgYm91bmRzLnRvcCA9IHNjcm9sbFk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBkcmF3T3ZlcnNjcm9sbEhlYWRlcihjYW52YXMsIG92ZXJzY3JvbGxIZWFkZXIsIGJvdW5kcyk7Ci0gICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoZHJhd0RpdmlkZXJzKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBib3VuZHMuYm90dG9tID0gMDsKLSAgICAgICAgICAgICAgICAgICAgICAgIGJvdW5kcy50b3AgPSAtZGl2aWRlckhlaWdodDsKLSAgICAgICAgICAgICAgICAgICAgICAgIGRyYXdEaXZpZGVyKGNhbnZhcywgYm91bmRzLCAtMSk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0KICAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGNvdW50OyBpKyspIHsKICAgICAgICAgICAgICAgICAgICAgaWYgKChoZWFkZXJEaXZpZGVycyB8fCBmaXJzdCArIGkgPj0gaGVhZGVyQ291bnQpICYmCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGZvb3RlckRpdmlkZXJzIHx8IGZpcnN0ICsgaSA8IGZvb3RlckxpbWl0KSkgewogICAgICAgICAgICAgICAgICAgICAgICAgVmlldyBjaGlsZCA9IGdldENoaWxkQXQoaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICBib3R0b20gPSBjaGlsZC5nZXRCb3R0b20oKTsKICAgICAgICAgICAgICAgICAgICAgICAgIC8vIERvbid0IGRyYXcgZGl2aWRlcnMgbmV4dCB0byBpdGVtcyB0aGF0IGFyZSBub3QgZW5hYmxlZAotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRyYXdEaXZpZGVycyAmJgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoYm90dG9tIDwgbGlzdEJvdHRvbSAmJiAhKGRyYXdPdmVyc2Nyb2xsRm9vdGVyICYmIGkgPT0gY291bnQgLSAxKSkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoKGFyZUFsbEl0ZW1zU2VsZWN0YWJsZSB8fAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGFkYXB0ZXIuaXNFbmFibGVkKGZpcnN0ICsgaSkgJiYgKGkgPT0gY291bnQgLSAxIHx8Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkYXB0ZXIuaXNFbmFibGVkKGZpcnN0ICsgaSArIDEpKSkpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvdW5kcy50b3AgPSBib3R0b207Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvdW5kcy5ib3R0b20gPSBib3R0b20gKyBkaXZpZGVySGVpZ2h0OwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkcmF3RGl2aWRlcihjYW52YXMsIGJvdW5kcywgaSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChmaWxsRm9yTWlzc2luZ0RpdmlkZXJzKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvdW5kcy50b3AgPSBib3R0b207Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvdW5kcy5ib3R0b20gPSBib3R0b20gKyBkaXZpZGVySGVpZ2h0OwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYW52YXMuZHJhd1JlY3QoYm91bmRzLCBwYWludCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgaWYgKChhcmVBbGxJdGVtc1NlbGVjdGFibGUgfHwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGFkYXB0ZXIuaXNFbmFibGVkKGZpcnN0ICsgaSkgJiYgKGkgPT0gY291bnQgLSAxIHx8CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWRhcHRlci5pc0VuYWJsZWQoZmlyc3QgKyBpICsgMSkpKSkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBib3VuZHMudG9wID0gYm90dG9tOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvdW5kcy5ib3R0b20gPSBib3R0b20gKyBkaXZpZGVySGVpZ2h0OworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRyYXdEaXZpZGVyKGNhbnZhcywgYm91bmRzLCBpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoZmlsbEZvck1pc3NpbmdEaXZpZGVycykgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvdW5kcy50b3AgPSBib3R0b207CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm91bmRzLmJvdHRvbSA9IGJvdHRvbSArIGRpdmlkZXJIZWlnaHQ7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FudmFzLmRyYXdSZWN0KGJvdW5kcywgcGFpbnQpOwogICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgZmluYWwgaW50IG92ZXJGb290ZXJCb3R0b20gPSBtQm90dG9tICsgbVNjcm9sbFk7Ci0gICAgICAgICAgICAgICAgaWYgKGRyYXdPdmVyc2Nyb2xsRm9vdGVyICYmIGZpcnN0ICsgY291bnQgPT0gaXRlbUNvdW50ICYmCi0gICAgICAgICAgICAgICAgICAgICAgICBvdmVyRm9vdGVyQm90dG9tID4gYm90dG9tKSB7Ci0gICAgICAgICAgICAgICAgICAgIGJvdW5kcy50b3AgPSBib3R0b207Ci0gICAgICAgICAgICAgICAgICAgIGJvdW5kcy5ib3R0b20gPSBvdmVyRm9vdGVyQm90dG9tOwotICAgICAgICAgICAgICAgICAgICBkcmF3T3ZlcnNjcm9sbEZvb3RlcihjYW52YXMsIG92ZXJzY3JvbGxGb290ZXIsIGJvdW5kcyk7Ci0gICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICBpbnQgdG9wOwogICAgICAgICAgICAgICAgIGludCBsaXN0VG9wID0gbUxpc3RQYWRkaW5nLnRvcDsKIAogICAgICAgICAgICAgICAgIGZpbmFsIGludCBzY3JvbGxZID0gbVNjcm9sbFk7CiAKLSAgICAgICAgICAgICAgICBpZiAoY291bnQgPiAwICYmIGRyYXdPdmVyc2Nyb2xsSGVhZGVyKSB7Ci0gICAgICAgICAgICAgICAgICAgIGJvdW5kcy50b3AgPSBzY3JvbGxZOwotICAgICAgICAgICAgICAgICAgICBib3VuZHMuYm90dG9tID0gZ2V0Q2hpbGRBdCgwKS5nZXRUb3AoKTsKLSAgICAgICAgICAgICAgICAgICAgZHJhd092ZXJzY3JvbGxIZWFkZXIoY2FudmFzLCBvdmVyc2Nyb2xsSGVhZGVyLCBib3VuZHMpOwotICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgIGZpbmFsIGludCBzdGFydCA9IGRyYXdPdmVyc2Nyb2xsSGVhZGVyID8gMSA6IDA7Ci0gICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IHN0YXJ0OyBpIDwgY291bnQ7IGkrKykgeworICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgY291bnQ7IGkrKykgewogICAgICAgICAgICAgICAgICAgICBpZiAoKGhlYWRlckRpdmlkZXJzIHx8IGZpcnN0ICsgaSA+PSBoZWFkZXJDb3VudCkgJiYKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZm9vdGVyRGl2aWRlcnMgfHwgZmlyc3QgKyBpIDwgZm9vdGVyTGltaXQpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBWaWV3IGNoaWxkID0gZ2V0Q2hpbGRBdChpKTsKICAgICAgICAgICAgICAgICAgICAgICAgIHRvcCA9IGNoaWxkLmdldFRvcCgpOwogICAgICAgICAgICAgICAgICAgICAgICAgLy8gRG9uJ3QgZHJhdyBkaXZpZGVycyBuZXh0IHRvIGl0ZW1zIHRoYXQgYXJlIG5vdCBlbmFibGVkCi0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZHJhd0RpdmlkZXJzICYmIHRvcCA+IGxpc3RUb3ApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0b3AgPiBsaXN0VG9wKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKChhcmVBbGxJdGVtc1NlbGVjdGFibGUgfHwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChhZGFwdGVyLmlzRW5hYmxlZChmaXJzdCArIGkpICYmIChpID09IGNvdW50IC0gMSB8fAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhZGFwdGVyLmlzRW5hYmxlZChmaXJzdCArIGkgKyAxKSkpKSkgewpAQCAtMzExOCwxNiArMzAzMSw5IEBACiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgIGlmIChjb3VudCA+IDAgJiYgc2Nyb2xsWSA+IDApIHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKGRyYXdPdmVyc2Nyb2xsRm9vdGVyKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBmaW5hbCBpbnQgYWJzTGlzdEJvdHRvbSA9IG1Cb3R0b207Ci0gICAgICAgICAgICAgICAgICAgICAgICBib3VuZHMudG9wID0gYWJzTGlzdEJvdHRvbTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGJvdW5kcy5ib3R0b20gPSBhYnNMaXN0Qm90dG9tICsgc2Nyb2xsWTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGRyYXdPdmVyc2Nyb2xsRm9vdGVyKGNhbnZhcywgb3ZlcnNjcm9sbEZvb3RlciwgYm91bmRzKTsKLSAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChkcmF3RGl2aWRlcnMpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGJvdW5kcy50b3AgPSBsaXN0Qm90dG9tOwotICAgICAgICAgICAgICAgICAgICAgICAgYm91bmRzLmJvdHRvbSA9IGxpc3RCb3R0b20gKyBkaXZpZGVySGVpZ2h0OwotICAgICAgICAgICAgICAgICAgICAgICAgZHJhd0RpdmlkZXIoY2FudmFzLCBib3VuZHMsIC0xKTsKLSAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBib3VuZHMudG9wID0gbGlzdEJvdHRvbTsKKyAgICAgICAgICAgICAgICAgICAgYm91bmRzLmJvdHRvbSA9IGxpc3RCb3R0b20gKyBkaXZpZGVySGVpZ2h0OworICAgICAgICAgICAgICAgICAgICBkcmF3RGl2aWRlcihjYW52YXMsIGJvdW5kcywgLTEpOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgfQpAQCAtMzIzNiw0NSArMzE0Miw2IEBAC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AgICAgICAgICAgICAgICBtQ2hlY2tlZElkU3RhdGVzID0gbmV3IExvbmdTcGFyc2VBcnJheTxCb29sZWFuPigpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgfQotCi0gICAgQE92ZXJyaWRlCi0gICAgcHVibGljIGJvb2xlYW4gcGVyZm9ybUl0ZW1DbGljayhWaWV3IHZpZXcsIGludCBwb3NpdGlvbiwgbG9uZyBpZCkgewotICAgICAgICBib29sZWFuIGhhbmRsZWQgPSBmYWxzZTsKLQotICAgICAgICBpZiAobUNob2ljZU1vZGUgIT0gQ0hPSUNFX01PREVfTk9ORSkgewotICAgICAgICAgICAgaGFuZGxlZCA9IHRydWU7Ci0KLSAgICAgICAgICAgIGlmIChtQ2hvaWNlTW9kZSA9PSBDSE9JQ0VfTU9ERV9NVUxUSVBMRSkgewotICAgICAgICAgICAgICAgIGJvb2xlYW4gbmV3VmFsdWUgPSAhbUNoZWNrU3RhdGVzLmdldChwb3NpdGlvbiwgZmFsc2UpOwotICAgICAgICAgICAgICAgIG1DaGVja1N0YXRlcy5wdXQocG9zaXRpb24sIG5ld1ZhbHVlKTsKLSAgICAgICAgICAgICAgICBpZiAobUNoZWNrZWRJZFN0YXRlcyAhPSBudWxsICYmIG1BZGFwdGVyLmhhc1N0YWJsZUlkcygpKSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChuZXdWYWx1ZSkgewotICAgICAgICAgICAgICAgICAgICAgICAgbUNoZWNrZWRJZFN0YXRlcy5wdXQobUFkYXB0ZXIuZ2V0SXRlbUlkKHBvc2l0aW9uKSwgQm9vbGVhbi5UUlVFKTsKLSAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIG1DaGVja2VkSWRTdGF0ZXMuZGVsZXRlKG1BZGFwdGVyLmdldEl0ZW1JZChwb3NpdGlvbikpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBib29sZWFuIG5ld1ZhbHVlID0gIW1DaGVja1N0YXRlcy5nZXQocG9zaXRpb24sIGZhbHNlKTsKLSAgICAgICAgICAgICAgICBpZiAobmV3VmFsdWUpIHsKLSAgICAgICAgICAgICAgICAgICAgbUNoZWNrU3RhdGVzLmNsZWFyKCk7Ci0gICAgICAgICAgICAgICAgICAgIG1DaGVja1N0YXRlcy5wdXQocG9zaXRpb24sIHRydWUpOwotICAgICAgICAgICAgICAgICAgICBpZiAobUNoZWNrZWRJZFN0YXRlcyAhPSBudWxsICYmIG1BZGFwdGVyLmhhc1N0YWJsZUlkcygpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBtQ2hlY2tlZElkU3RhdGVzLmNsZWFyKCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBtQ2hlY2tlZElkU3RhdGVzLnB1dChtQWRhcHRlci5nZXRJdGVtSWQocG9zaXRpb24pLCBCb29sZWFuLlRSVUUpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfSAKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgbURhdGFDaGFuZ2VkID0gdHJ1ZTsKLSAgICAgICAgICAgIHJlbWVtYmVyU3luY1N0YXRlKCk7Ci0gICAgICAgICAgICByZXF1ZXN0TGF5b3V0KCk7Ci0gICAgICAgIH0KLQotICAgICAgICBoYW5kbGVkIHw9IHN1cGVyLnBlcmZvcm1JdGVtQ2xpY2sodmlldywgcG9zaXRpb24sIGlkKTsKLQotICAgICAgICByZXR1cm4gaGFuZGxlZDsKLSAgICB9Ci0KLSAgICAvKioKLSAgICAgKiBTZXRzIHRoZSBjaGVja2VkIHN0YXRlIG9mIHRoZSBzcGVjaWZpZWQgcG9zaXRpb24uIFRoZSBpcyBvbmx5IHZhbGlkIGlmCi0gICAgICogdGhlIGNob2ljZSBtb2RlIGhhcyBiZWVuIHNldCB0byB7QGxpbmsgI0NIT0lDRV9NT0RFX1N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lvbi4gSWYgaXQgcmV0dXJucyB0cnVlLCB0aGUKLSAgICAgKiBhbmltYXRpb24gaXMgbm90IHlldCBmaW5pc2hlZC4KLSAgICAgKi8KLSAgICBwdWJsaWMgYm9vbGVhbiBjb21wdXRlU2Nyb2xsT2Zmc2V0KCkgewotICAgICAgICBpZiAoaXNGaW5pc2hlZCgpKSB7Ci0gICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgIH0KLQotICAgICAgICBzd2l0Y2ggKG1Nb2RlKSB7Ci0gICAgICAgICAgICBjYXNlIFNDUk9MTF9NT0RFOgotICAgICAgICAgICAgICAgIGxvbmcgdGltZSA9IEFuaW1hdGlvblV0aWxzLmN1cnJlbnRBbmltYXRpb25UaW1lTWlsbGlzKCk7Ci0gICAgICAgICAgICAgICAgLy8gQW55IHNjcm9sbGVyIGNhbiBiZSB1c2VkIGZvciB0aW1lLCBzaW5jZSB0aGV5IHdlcmUgc3RhcnRlZAotICAgICAgICAgICAgICAgIC8vIHRvZ2V0aGVyIGluIHNjcm9sbCBtb2RlLiBXZSB1c2UgWCBoZXJlLgotICAgICAgICAgICAgICAgIGZpbmFsIGxvbmcgZWxhcHNlZFRpbWUgPSB0aW1lIC0gbVNjcm9sbGVyWC5tU3RhcnRUaW1lOwotCi0gICAgICAgICAgICAgICAgZmluYWwgaW50IGR1cmF0aW9uID0gbVNjcm9sbGVyWC5tRHVyYXRpb247Ci0gICAgICAgICAgICAgICAgaWYgKGVsYXBzZWRUaW1lIDwgZHVyYXRpb24pIHsKLSAgICAgICAgICAgICAgICAgICAgZmxvYXQgcSA9IChmbG9hdCkgKGVsYXBzZWRUaW1lKSAvIGR1cmF0aW9uOwotCi0gICAgICAgICAgICAgICAgICAgIGlmIChtSW50ZXJwb2xhdG9yID09IG51bGwpCi0gICAgICAgICAgICAgICAgICAgICAgICBxID0gU2Nyb2xsZXIudmlzY291c0ZsdWlkKHEpOwotICAgICAgICAgICAgICAgICAgICBlbHNlCi0gICAgICAgICAgICAgICAgICAgICAgICBxID0gbUludGVycG9sYXRvci5nZXRJbnRlcnBvbGF0aW9uKHEpOwotCi0gICAgICAgICAgICAgICAgICAgIG1TY3JvbGxlclgudXBkYXRlU2Nyb2xsKHEpOwotICAgICAgICAgICAgICAgICAgICBtU2Nyb2xsZXJZLnVwZGF0ZVNjcm9sbChxKTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBhYm9ydEFuaW1hdGlvbigpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBicmVhazsKLQotICAgICAgICAgICAgY2FzZSBGTElOR19NT0RFOgotICAgICAgICAgICAgICAgIGlmICghbVNjcm9sbGVyWC5tRmluaXNoZWQpIHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKCFtU2Nyb2xsZXJYLnVwZGF0ZSgpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIW1TY3JvbGxlclguY29udGludWVXaGVuRmluaXNoZWQoKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1TY3JvbGxlclguZmluaXNoKCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBpZiAoIW1TY3JvbGxlclkubUZpbmlzaGVkKSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmICghbVNjcm9sbGVyWS51cGRhdGUoKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFtU2Nyb2xsZXJZLmNvbnRpbnVlV2hlbkZpbmlzaGVkKCkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBtU2Nyb2xsZXJZLmZpbmlzaCgpOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgIH0KLQotICAgICA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xvY2l0eSkgewotICAgICAgICAgICAgcmV0dXJuIHZlbG9jaXR5ID4gMCA/IC1HUkFWSVRZIDogR1JBVklUWTsKLSAgICAgICAgfQotCi0gICAgICAgIC8qCi0gICAgICAgICAqIFJldHVybnMgdGhlIHRpbWUgKGluIG1pbGxpc2Vjb25kcykgaXQgd2lsbCB0YWtlIHRvIGdvIGZyb20gc3RhcnQgdG8gZW5kLgotICAgICAgICAgKi8KLSAgICAgICAgc3RhdGljIGludCBjb21wdXRlRHVyYXRpb24oaW50IHN0YXJ0LCBpbnQgZW5kLCBmbG9hdCBpbml0aWFsVmVsb2NpdHksIGZsb2F0IGRlY2VsZXJhdGlvbikgewotICAgICAgICAgICAgZmluYWwgaW50IGRpc3RhbmNlID0gc3RhcnQgLSBlbmQ7Ci0gICAgICAgICAgICBmaW5hbCBmbG9hdCBkaXNjcmltaW5hbnQgPSBpbml0aWFsVmVsb2NpdHkgKiBpbml0aWFsVmVsb2NpdHkgLSAyLjBmICogZGVjZWxlcmF0aW9uCi0gICAgICAgICAgICAgICAgICAgICogZGlzdGFuY2U7Ci0gICAgICAgICAgICBpZiAoZGlzY3JpbWluYW50ID49IDAuMGYpIHsKLSAgICAgICAgICAgICAgICBmbG9hdCBkZWx0YSA9IChmbG9hdCkgTWF0aC5zcXJ0KGRpc2NyaW1pbmFudCk7Ci0gICAgICAgICAgICAgICAgaWYgKGRlY2VsZXJhdGlvbiA8IDAuMGYpIHsKLSAgICAgICAgICAgICAgICAgICAgZGVsdGEgPSAtZGVsdGE7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIHJldHVybiAoaW50KSAoMTAwMC4wZiAqICgtaW5pdGlhbFZlbG9jaXR5IC0gZGVsdGEpIC8gZGVjZWxlcmF0aW9uKTsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgLy8gRW5kIHBvc2l0aW9uIGNhbiBub3QgYmUgcmVhY2hlZAotICAgICAgICAgICAgcmV0dXJuIDA7Ci0gICAgICAgIH0KLQotICAgICAgICB2b2lkIHN0YXJ0U2Nyb2xsKGludCBzdGFydCwgaW50IGRpc3RhbmNlLCBpbnQgZHVyYXRpb24pIHsKLSAgICAgICAgICAgIG1GaW5pc2hlZCA9IGZhbHNlOwotCi0gICAgICAgICAgICBtU3RhcnQgPSBzdGFydDsKLSAgICAgICAgICAgIG1GaW5hbCA9IHN0YXJ0ICsgZGlzdGFuY2U7Ci0KLSAgICAgICAgICAgIG1TdGFydFRpbWUgPSBBbmltYXRpb25VdGlscy5jdXJyZW50QW5pbWF0aW9uVGltZU1pbGxpcygpOwotICAgICAgICAgICAgbUR1cmF0aW9uID0gZHVyYXRpb247Ci0KLSAgICAgICAgICAgIC8vIFVudXNlZAotICAgICAgICAgICAgbURlY2VsZXJhdGlvbiA9IDAuMGY7Ci0gICAgICAgICAgICBtVmVsb2NpdHkgPSAwOwotICAgICAgICB9Ci0KLSAgICAgICAgdm9pZCBmbGluZyhpbnQgc3RhcnQsIGludCB2ZWxvY2l0eSwgaW50IG1pbiwgaW50IG1heCkgewotICAgICAgICAgICAgbUZpbmlzaGVkID0gZmFsc2U7Ci0KLSAgICAgICAgICAgIG1TdGFydCA9IHN0YXJ0OwotICAgICAgICAgICAgbVN0YXJ0VGltZSA9IEFuaW1hdGlvblV0aWxzLmN1cnJlbnRBbmltYXRpb25UaW1lTWlsbGlzKCk7Ci0KLSAgICAgICAgICAgIG1WZWxvY2l0eSA9IHZlbG9jaXR5OwotCi0gICAgICAgICAgICBtRGVjZWxlcmF0aW9uID0gZ2V0RGVjZWxlcmF0aW9uKHZlbG9jaXR5KTsKLQotICAgICAgICAgICAgLy8gQSBzdGFydCBmcm9tIGFuIGludmFsaWQgcG9zaXRpb24gaW1tZWRpYXRlbHkgYnJpbmdzIGJhY2sgdG8gYSB2YWxpZCBwb3NpdGlvbgotICAgICAgICAgICAgaWYgKG1TdGFydCA8IG1pbikgewotICAgICAgICAgICAgICAgIG1EdXJhdGlvbiA9IDA7Ci0gICAgICAgICAgICAgICAgbUZpbmFsID0gbWluOwotICAgICAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgaWYgKG1TdGFydCA+IG1heCkgewotICAgICAgICAgICAgICAgIG1EdXJhdGlvbiA9IDA7Ci0gICAgICAgICAgICAgICAgbUZpbmFsID0gbWF4OwotICAgICAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgLy8gRHVyYXRpb24gYXJlIGV4cHJlc3NlZCBpbiBtaWxsaXNlY29uZHMKLSAgICAgICAgICAgIG1EdXJhdGlvbiA9IChpbnQpICgtMTAwMC4wZiAqIHZlbG9jaXR5IC8gbURlY2VsZXJhdGlvbik7Ci0KLSAgICAgICAgICAgIG1GaW5hbCA9IHN0YXJ0IC0gTWF0aC5yb3VuZCgodmVsb2NpdHkgKiB2ZWxvY2l0eSkgLyAoMi4wZiAqIG1EZWNlbGVyYXRpb24pKTsKLQotICAgICAgICAgICAgLy8gQ2xhbXAgdG8gYSB2YWxpZCBmaW5hbCBwb3NpdGlvbgotICAgICAgICAgICAgaWYgKG1GaW5hbCA8IG1pbikgewotICAgICAgICAgICAgICAgIG1GaW5hbCA9IG1pbjsKLSAgICAgICAgICAgICAgICBtRHVyYXRpb24gPSBjb21wdXRlRHVyYXRpb24obVN0YXJ0LCBtaW4sIG1WZWxvY2l0eSwgbURlY2VsZXJhdGlvbik7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGlmIChtRmluYWwgPiBtYXgpIHsKLSAgICAgICAgICAgICAgICBtRmluYWwgPSBtYXg7Ci0gICAgICAgICAgICAgICAgbUR1cmF0aW9uID0gY29tcHV0ZUR1cmF0aW9uKG1TdGFydCwgbWF4LCBtVmVsb2NpdHksIG1EZWNlbGVyYXRpb24pOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgdm9pZCBmaW5pc2goKSB7Ci0gICAgICAgICAgICBtQ3VycmVudFBvc2l0aW9uID0gbUZpbmFsOwotICAgICAgICAgICAgLy8gTm90IHJlc2V0IHNpbmNlIFdlYlZpZXcgcmVsaWVzIG9uIHRoaXMgdmFsdWUgZm9yIGZhc3QgZmxpbmcuCi0gICAgICAgICAgICAvLyBtQ3VyclZlbG9jaXR5ID0gMC4wZjsKLSAgICAgICAgICAgIG1GaW5pc2hlZCA9IHRydWU7Ci0gICAgICAgIH0KLQotICAgICAgICB2b2lkIHNldEZpbmFsUG9zaXRpb24oaW50IHBvc2l0aW9uKSB7Ci0gICAgICAgICAgICBtRmluYWwgPSBwb3NpdGlvbjsKLSAgICAgICAgICAgIG1GaW5pc2hlZCA9IGZhbHNlOwotICAgICAgICB9Ci0KLSAgICAgICAgdm9pZCBleHRlbmREdXJhdGlvbihpbnQgZXh0ZW5kKSB7Ci0gICAgICAgICAgICBmaW5hbCBsb25nIHRpbWUgPSBBbmltYXRpb25VdGlscy5jdXJyZW50QW5pbWF0aW9uVGltZU1pbGxpcygpOwotICAgICAgICAgICAgZmluYWwgaW50IGVsYXBzZWRUaW1lID0gKGludCkgKHRpbWUgLSBtU3RhcnRUaW1lKTsKLSAgICAgICAgICAgIG1EdXJhdGlvbiA9IGVsYXBzZWRUaW1lICsgZXh0ZW5kOwotICAgICAgICAgICAgbUZpbmlzaGVkID0gZmFsc2U7Ci0gICAgICAgIH0KLQotICAgICAgICB2b2lkIHNldEJvdW5jZUNvZWZmaWNpZW50KGZsb2F0IGNvZWZmaWNpZW50KSB7Ci0gICAgICAgICAgICBtQm91bmNlQ29lZmZpY2llbnQgPSBjb2VmZmljaWVudDsKLSAgICAgICAgfQotCi0gICAgICAgIGJvb2xlYW4gc3ByaW5nYmFjayhpbnQgc3RhcnQsIGludCBtaW4sIGludCBtYXgpIHsKLSAgICAgICAgICAgIG1GaW5pc2hlZCA9IHRydWU7Ci0KLSAgICAgICAgICAgIG1TdGFydCA9IHN0YXJ0OwotICAgICAgICAgICAgbVZlbG9jaXR5ID0gMDsKLQotICAgICAgICAgICAgbVN0YXJ0VGltZSA9IEFuaW1hdGlvblV0aWxzLmN1cnJlbnRBbmltYXRpb25UaW1lTWlsbGlzKCk7Ci0gICAgICAgICAgICBtRHVyYXRpb24gPSAwOwotCi0gICAgICAgICAgICBpZiAoc3RhcnQgPCBtaW4pIHsKLSAgICAgICAgICAgICAgICBzdGFydFNwcmluZ2JhY2soc3RhcnQsIG1pbiwgZmFsc2UpOwotICAgICAgICAgICAgfSBlbHNlIGlmIChzdGFydCA+IG1heCkgewotICAgICAgICAgICAgICAgIHN0YXJ0U3ByaW5nYmFjayhzdGFydCwgbWF4LCB0cnVlKTsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgcmV0dXJuICFtRmluaXNoZWQ7Ci0gICAgICAgIH0KLQotICAgICAgICBwcml2YXRlIHZvaWQgc3RhcnRTcHJpbmdiYWNrKGludCBzdGFydCwgaW50IGVuZCwgYm9vbGVhbiBwb3NpdGl2ZSkgewotICAgICAgICAgICAgbUZpbmlzaGVkID0gZmFsc2U7Ci0gICAgICAgICAgICBtU3RhdGUgPSBUT19CT1VOQ0U7Ci0gICAgICAgICAgICBtU3RhcnQgPSBtRmluYWwgPSBlbmQ7Ci0gICAgICAgICAgICBtRHVyYXRpb24gPSBPVkVSU0NST0xMX1NQUklOR0JBQ0tfRFVSQVRJT047Ci0gICAgICAgICAgICBtU3RhcnRUaW1lIC09IE9WRVJTQ1JPTExfU1BSSU5HQkFDS19EVVJBVElPTiAvIDI7Ci0gICAgICAgICAgICBtVmVsb2NpdHkgPSAoaW50KSAoTWF0aC5hYnMoZW5kIC0gc3RhcnQpICogVElNRV9DT0VGICogKHBvc2l0aXZlID8gMS4wIDogLTEuMGYpKTsKLSAgICAgICAgfQotCi0gICAgICAgIHZvaWQgZmxpbmcoaW50IHN0YXJ0LCBpbnQgdmVsb2NpdHksIGludCBtaW4sIGludCBtYXgsIGludCBvdmVyKSB7Ci0gICAgICAgICAgICBtU3RhdGUgPSBUT19FREdFOwotICAgICAgICAgICAgbU92ZXIgPSBvdmVyOwotCi0gICAgICAgICAgICBtRmluaXNoZWQgPSBmYWxzZTsKLQotICAgICAgICAgICAgbVN0YXJ0ID0gc3RhcnQ7Ci0gICAgICAgICAgICBtU3RhcnRUaW1lID0gQW5pbWF0aW9uVXRpbHMuY3VycmVudEFuaW1hdGlvblRpbWVNaWxsaXMoKTsKLQotICAgICAgICAgICAgbVZlbG9jaXR5ID0gdmVsb2NpdHk7Ci0KLSAgICAgICAgICAgIG1EZWNlbGVyYXRpb24gPSBnZXREZWNlbGVyYXRpb24odmVsb2NpdHkpOwotCi0gICAgICAgICAgICAvLyBEdXJhdGlvbiBhcmUgZXhwcmVzc2VkIGluIG1pbGxpc2Vjb25kcwotICAgICAgICAgICAgbUR1cmF0aW9uID0gKGludCkgKC0xMDAwLjBmICogdmVsb2NpdHkgLyBtRGVjZWxlcmF0aW9uKTsKLQotICAgICAgICAgICAgbUZpbmFsID0gc3RhcnQgLSBNYXRoLnJvdW5kKCh2ZWxvY2l0eSAqIHZlbG9jaXR5KSAvICgyLjBmICogbURlY2VsZXJhdGlvbikpOwotCi0gICAgICAgICAgICAvLyBDbGFtcCB0byBhIHZhbGlkIGZpbmFsIHBvc2l0aW9uCi0gICAgICAgICAgICBpZiAobUZpbmFsIDwgbWluKSB7Ci0gICAgICAgICAgICAgICAgbUZpbmFsID0gbWluOwotICAgICAgICAgICAgICAgIG1EdXJhdGlvbiA9IGNvbXB1dGVEdXJhdGlvbihtU3RhcnQsIG1pbiwgbVZlbG9jaXR5LCBtRGVjZWxlcmF0aW9uKTsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgaWYgKG1GaW5hbCA+IG1heCkgewotICAgICAgICAgICAgICAgIG1GaW5hbCA9IG1heDsKLSAgICAgICAgICAgICAgICBtRHVyYXRpb24gPSBjb21wdXRlRHVyYXRpb24obVN0YXJ0LCBtYXgsIG1WZWxvY2l0eSwgbURlY2VsZXJhdGlvbik7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGlmIChzdGFydCA+IG1heCkgewotICAgICAgICAgICAgICAgIGlmIChzdGFydCA+PSBtYXggKyBvdmVyKSB7Ci0gICAgICAgICAgICAgICAgICAgIHNwcmluZ2JhY2sobWF4ICsgb3ZlciwgbWluLCBtYXgpOwotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmICh2ZWxvY2l0eSA8PSAwKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBzcHJpbmdiYWNrKHN0YXJ0LCBtaW4sIG1heCk7Ci0gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBsb25nIHRpbWUgPSBBbmltYXRpb25VdGlscy5jdXJyZW50QW5pbWF0aW9uVGltZU1pbGxpcygpOwotICAgICAgICAgICAgICAgICAgICAgICAgZmluYWwgZG91YmxlIGR1cmF0aW9uU2luY2VFZGdlID0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBNYXRoLmF0YW4oKHN0YXJ0LW1heCkgKiBUSU1FX0NPRUYgLyB2ZWxvY2l0eSkgLyBUSU1FX0NPRUY7Ci0gICAgICAgICAgICAgICAgICAgICAgICBtU3RhcnRUaW1lID0gKGludCkgKHRpbWUgLSAxMDAwLjBmICogZHVyYXRpb25TaW5jZUVkZ2UpOwotCi0gICAgICAgICAgICAgICAgICAgICAgICAvLyBTaW11bGF0ZSBhIGJvdW5jZSB0aGF0IHN0YXJ0ZWQgZnJvbSBlZGdlCi0gICAgICAgICAgICAgICAgICAgICAgICBtU3RhcnQgPSBtYXg7Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgIG1WZWxvY2l0eSA9IChpbnQpICh2ZWxvY2l0eSAvIE1hdGguY29zKGR1cmF0aW9uU2luY2VFZGdlICogVElNRV9DT0VGKSk7Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgIG9uRWRnZVJlYWNoZWQoKTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgaWYgKHN0YXJ0IDwgbWluKSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChzdGFydCA8PSBtaW4gLSBvdmVyKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBzcHJpbmdiYWNrKG1pbiAtIG92ZXIsIG1pbiwgbWF4KTsKLSAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2ZWxvY2l0eSA+PSAwKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgc3ByaW5nYmFjayhzdGFydCwgbWluLCBtYXgpOwotICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb25nIHRpbWUgPSBBbmltYXRpb25VdGlscy5jdXJyZW50QW5pbWF0aW9uVGltZU1pbGxpcygpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZpbmFsIGRvdWJsZSBkdXJhdGlvblNpbmNlRWRnZSA9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE1hdGguYXRhbigoc3RhcnQtbWluKSAqIFRJTUVfQ09FRiAvIHZlbG9jaXR5KSAvIFRJTUVfQ09FRjsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBtU3RhcnRUaW1lID0gKGludCkgKHRpbWUgLSAxMDAwLjBmICogZHVyYXRpb25TaW5jZUVkZ2UpOwotCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gU2ltdWxhdGUgYSBib3VuY2UgdGhhdCBzdGFydGVkIGZyb20gZWRnZQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1TdGFydCA9IG1pbjsKLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1WZWxvY2l0eSA9IChpbnQpICh2ZWxvY2l0eSAvIE1hdGguY29zKGR1cmF0aW9uU2lu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ICAgIG1EdXJhdGlvbiA9IChpbnQpICgxMDAwLjBmICogTWF0aC5hc2luKG92ZXIgLyBkaXN0YW5jZSkgLyBUSU1FX0NPRUYpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgYm9vbGVhbiBjb250aW51ZVdoZW5GaW5pc2hlZCgpIHsKLSAgICAgICAgICAgIHN3aXRjaCAobVN0YXRlKSB7Ci0gICAgICAgICAgICAgICAgY2FzZSBUT19FREdFOgotICAgICAgICAgICAgICAgICAgICAvLyBEdXJhdGlvbiBmcm9tIHN0YXJ0IHRvIG51bGwgdmVsb2NpdHkKLSAgICAgICAgICAgICAgICAgICAgaW50IGR1cmF0aW9uID0gKGludCkgKC0xMDAwLjBmICogbVZlbG9jaXR5IC8gbURlY2VsZXJhdGlvbik7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChtRHVyYXRpb24gPCBkdXJhdGlvbikgewotICAgICAgICAgICAgICAgICAgICAgICAgLy8gSWYgdGhlIGFuaW1hdGlvbiB3YXMgY2xhbXBlZCwgd2UgcmVhY2hlZCB0aGUgZWRnZQotICAgICAgICAgICAgICAgICAgICAgICAgbVN0YXJ0ID0gbUZpbmFsOwotICAgICAgICAgICAgICAgICAgICAgICAgLy8gU3BlZWQgd2hlbiBlZGdlIHdhcyByZWFjaGVkCi0gICAgICAgICAgICAgICAgICAgICAgICBtVmVsb2NpdHkgPSAoaW50KSAobVZlbG9jaXR5ICsgbURlY2VsZXJhdGlvbiAqIG1EdXJhdGlvbiAvIDEwMDAuMGYpOwotICAgICAgICAgICAgICAgICAgICAgICAgbVN0YXJ0VGltZSArPSBtRHVyYXRpb247Ci0gICAgICAgICAgICAgICAgICAgICAgICBvbkVkZ2VSZWFjaGVkKCk7Ci0gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAvLyBOb3JtYWwgc3RvcCwgbm8gbmVlZCB0byBjb250aW51ZQotICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgIGNhc2UgVE9fQk9VTkRBUlk6Ci0gICAgICAgICAgICAgICAgICAgIG1TdGFydFRpbWUgKz0gbUR1cmF0aW9uOwotICAgICAgICAgICAgICAgICAgICBzdGFydFNwcmluZ2JhY2sobUZpbmFsLCBtRmluYWwgLSAobVZlbG9jaXR5ID4gMCA/IG1PdmVyOi1tT3ZlciksIG1WZWxvY2l0eSA+IDApOwotICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICBjYXNlIFRPX0JPVU5DRToKLSAgICAgICAgICAgICAgICAgICAgLy9tVmVsb2NpdHkgPSAoaW50KSAobVZlbG9jaXR5ICogQk9VTkNFX0NPRUZGSUNJRU5UKTsKLSAgICAgICAgICAgICAgICAgICAgbVZlbG9jaXR5ID0gKGludCkgKG1WZWxvY2l0eSAqIG1Cb3VuY2VDb2VmZmljaWVudCk7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChNYXRoLmFicyhtVmVsb2NpdHkpIDwgTUlOSU1VTV9WRUxPQ0lUWV9GT1JfQk9VTkNFKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgbVN0YXJ0VGltZSArPSBtRHVyYXRpb247Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICB1cGRhdGUoKTsKLSAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICB9Ci0KLSAgICAgICAgLyoKLSAgICAgICAgICogVXBkYXRlIHRoZSBjdXJyZW50IHBvc2l0aW9uIGFuZCB2ZWxvY2l0eSBmb3IgY3VycmVudCB0aW1lLiBSZXR1cm5zCi0gICAgICAgICAqIHRydWUgaWYgdXBkYXR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B0aGUgcmV0dXJuZWQgTWVudSB3aXRoCisgICAgICogaXRlbXMgYmVmb3JlIGNhbGxpbmcge0BsaW5rICNzaG93KCl9LgorICAgICAqCisgICAgICogQHNlZSAjc2hvdygpCisgICAgICogQHNlZSAjZ2V0TWVudUluZmxhdGVyKCkKKyAgICAgKi8KKyAgICBwdWJsaWMgTWVudSBnZXRNZW51KCkgeworICAgICAgICByZXR1cm4gbU1lbnU7CisgICAgfQorCisgICAgLyoqCisgICAgICogQHJldHVybiBhIHtAbGluayBNZW51SW5mbGF0ZXJ9IHRoYXQgY2FuIGJlIHVzZWQgdG8gaW5mbGF0ZSBtZW51IGl0ZW1zIGZyb20gWE1MIGludG8gdGhlCisgICAgICogbWVudSByZXR1cm5lZCBieSB7QGxpbmsgI2dldE1lbnUoKX0uCisgICAgICoKKyAgICAgKiBAc2VlICNnZXRNZW51KCkKKyAgICAgKi8KKyAgICBwdWJsaWMgTWVudUluZmxhdGVyIGdldE1lbnVJbmZsYXRlcigpIHsKKyAgICAgICAgcmV0dXJuIG5ldyBNZW51SW5mbGF0ZXIobUNvbnRleHQpOworICAgIH0KKworICAgIC8qKgorICAgICAqIFNob3cgdGhlIG1lbnUgcG9wdXAgYW5jaG9yZWQgdG8gdGhlIHZpZXcgc3BlY2lmaWVkIGR1cmluZyBjb25zdHJ1Y3Rpb24uCisgICAgICogQHNlZSAjZGlzbWlzcygpCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2hvdygpIHsKKyAgICAgICAgbVBvcHVwLnNob3coKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBEaXNtaXNzIHRoZSBtZW51IHBvcHVwLgorICAgICAqIEBzZWUgI3Nob3coKQorICAgICAqLworICAgIHB1YmxpYyB2b2lkIGRpc21pc3MoKSB7CisgICAgICAgIG1Qb3B1cC5kaXNtaXNzKCk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc2V0T25NZW51SXRlbUNsaWNrTGlzdGVuZXIoT25NZW51SXRlbUNsaWNrTGlzdGVuZXIgbGlzdGVuZXIpIHsKKyAgICAgICAgbU1lbnVJdGVtQ2xpY2tMaXN0ZW5lciA9IGxpc3RlbmVyOworICAgIH0KKworICAgIC8qKgorICAgICAqIEBoaWRlCisgICAgICovCisgICAgcHVibGljIGJvb2xlYW4gb25NZW51SXRlbVNlbGVjdGVkKE1lbnVCdWlsZGVyIG1lbnUsIE1lbnVJdGVtIGl0ZW0pIHsKKyAgICAgICAgaWYgKG1NZW51SXRlbUNsaWNrTGlzdGVuZXIgIT0gbnVsbCkgeworICAgICAgICAgICAgcmV0dXJuIG1NZW51SXRlbUNsaWNrTGlzdGVuZXIub25NZW51SXRlbUNsaWNrKGl0ZW0pOworICAgICAgICB9CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBAaGlkZQorICAgICAqLworICAgIHB1YmxpYyB2b2lkIG9uQ2xvc2VNZW51KE1lbnVCdWlsZGVyIG1lbnUsIGJvb2xlYW4gYWxsTWVudXNBcmVDbG9zaW5nKSB7CisgICAgfQorCisgICAgLyoqCisgICAgICogQGhpZGUKKyAgICAgKi8KKyAgICBwdWJsaWMgYm9vbGVhbiBvblN1Yk1lbnVTZWxlY3RlZChTdWJNZW51QnVpbGRlciBzdWJNZW51KSB7CisgICAgICAgIGlmICghc3ViTWVudS5oYXNWaXNpYmxlSXRlbXMoKSkgeworICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgIH0KKworICAgICAgICAvLyBDdXJyZW50IG1lbnUgd2lsbCBiZSBkaXNtaXNzZWQgYnkgdGhlIG5vcm1hbCBoZWxwZXIsIHN1Ym1lbnUgd2lsbCBiZSBzaG93biBpbiBpdHMgcGxhY2UuCisgICAgICAgIG5ldyBNZW51UG9wdXBIZWxwZXIobUNvbnRleHQsIHN1Yk1lbnUsIG1BbmNob3IpLnNob3coKTsKKyAgICAgICAgcmV0dXJuIHRydWU7CisgICAgfQorCisgICAgLyoqCisgICAgICogQGhp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T0gbnVsbCAmJiBtUG9wdXBWaWV3ICE9IG51bGwpIHsKICAgICAgICAgICAgICAgICAgICAgV2luZG93TWFuYWdlci5MYXlvdXRQYXJhbXMgcCA9IChXaW5kb3dNYW5hZ2VyLkxheW91dFBhcmFtcykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtUG9wdXBWaWV3LmdldExheW91dFBhcmFtcygpOwpAQCAtMTU3LDEyICsxNTksMjEgQEAKICAgICAgKiA8cD5UaGUgcG9wdXAgZG9lcyBwcm92aWRlIGEgYmFja2dyb3VuZC48L3A+CiAgICAgICovCiAgICAgcHVibGljIFBvcHVwV2luZG93KENvbnRleHQgY29udGV4dCwgQXR0cmlidXRlU2V0IGF0dHJzLCBpbnQgZGVmU3R5bGUpIHsKKyAgICAgICAgdGhpcyhjb250ZXh0LCBhdHRycywgZGVmU3R5bGUsIDApOworICAgIH0KKyAgICAKKyAgICAvKioKKyAgICAgKiA8cD5DcmVhdGUgYSBuZXcsIGVtcHR5LCBub24gZm9jdXNhYmxlIHBvcHVwIHdpbmRvdyBvZiBkaW1lbnNpb24gKDAsMCkuPC9wPgorICAgICAqIAorICAgICAqIDxwPlRoZSBwb3B1cCBkb2VzIG5vdCBwcm92aWRlIGEgYmFja2dyb3VuZC48L3A+CisgICAgICovCisgICAgcHVibGljIFBvcHVwV2luZG93KENvbnRleHQgY29udGV4dCwgQXR0cmlidXRlU2V0IGF0dHJzLCBpbnQgZGVmU3R5bGVBdHRyLCBpbnQgZGVmU3R5bGVSZXMpIHsKICAgICAgICAgbUNvbnRleHQgPSBjb250ZXh0OwogICAgICAgICBtV2luZG93TWFuYWdlciA9IChXaW5kb3dNYW5hZ2VyKWNvbnRleHQuZ2V0U3lzdGVtU2VydmljZShDb250ZXh0LldJTkRPV19TRVJWSUNFKTsKIAogICAgICAgICBUeXBlZEFycmF5IGEgPQogICAgICAgICAgICAgY29udGV4dC5vYnRhaW5TdHlsZWRBdHRyaWJ1dGVzKAotICAgICAgICAgICAgICAgI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RoZSBsYXlvdXQgCiAgICAgICogcmVzb3VyY2UuIChBZGRlZCB0byB0aGUgcGFyY2VsKQogICAgICAqLwotICAgIHByaXZhdGUgU3RyaW5nIG1QYWNrYWdlOworICAgIHByaXZhdGUgZmluYWwgU3RyaW5nIG1QYWNrYWdlOwogICAgIAogICAgIC8qKgogICAgICAqIFRoZSByZXNvdXJjZSBJRCBvZiB0aGUgbGF5b3V0IGZpbGUuIChBZGRlZCB0byB0aGUgcGFyY2VsKQogICAgICAqLwotICAgIHByaXZhdGUgaW50IG1MYXlvdXRJZDsKKyAgICBwcml2YXRlIGZpbmFsIGludCBtTGF5b3V0SWQ7CiAKICAgICAvKioKICAgICAgKiBBbiBhcnJheSBvZiBhY3Rpb25zIHRvIHBlcmZvcm0gb24gdGhlIHZpZXcgdHJlZSBvbmNlIGl0IGhhcyBiZWVuCkBAIC0xMTAsNiArMTExLDQyIEBACiAgICAgICAgIH0KICAgICB9CiAKKyAgICBwcml2YXRlIGNsYXNzIFNldEVtcHR5VmlldyBleHRlbmRzIEFjdGlvbiB7CisgICAgICAgIGludCB2aWV3SWQ7CisgICAgICAgIGludCBlbXB0eVZpZXdJZDsKKworICAgICAgICBwdWJsaWMgZmluYWwgc3RhdGljIGludCBUQUcgPSA2OworCisgICAgICAgIFNldEVtcHR5VmlldyhpbnQgdmlld0lkLCBpbnQgZW1wdHlWaWV3SWQpIHsKKyAgICAgICAgICAgIHRoaXMudmlld0lkID0gdmlld0lkOworICAgICAgICAgICAgdGhpcy5lbXB0eVZpZXdJZCA9IGVtcHR5Vmlld0lkOworICAgICAgICB9CisKKyAgICAgICAgU2V0RW1wdHlWaWV3KFBhcmNlbCBpbikgeworICAgICAgICAgICAgdGhpcy52aWV3SWQgPSBpbi5yZWFkSW50KCk7CisgICAgICAgICAgICB0aGlzLmVtcHR5Vmlld0lkID0gaW4ucmVhZEludCgpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgd3JpdGVUb1BhcmNlbChQYXJjZWwgb3V0LCBpbnQgZmxhZ3MpIHsKKyAgICAgICAgICAgIG91dC53cml0ZUludChUQUcpOworICAgICAgICAgICAgb3V0LndyaXRlSW50KHRoaXMudmlld0lkKTsKKyAgICAgICAgICAgIG91dC53cml0ZUludCh0aGlzLmVtcHR5Vmlld0lkKTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgdm9pZCBhcHBseShWaWV3IHJvb3QpIHsKKyAgICAgICAgICAgIGZpbmFsIFZpZXcgdmlldyA9IHJvb3QuZmluZFZpZXdCeUlkKHZpZXdJZCk7CisgICAgICAgICAgICBpZiAoISh2aWV3IGluc3RhbmNlb2YgQWRhcHRlclZpZXc8Pz4pKSByZXR1cm47CisKKyAgICAgICAgICAgIEFkYXB0ZXJWaWV3PD8+IGFkYXB0ZXJWaWV3ID0gKEFkYXB0ZXJWaWV3PD8+KSB2aWV3OworCisgICAgICAgICAgICBmaW5hbCBWaWV3IGVtcHR5VmlldyA9IHJvb3QuZmluZFZpZXdCeUlkKGVtcHR5Vmlld0lkKTsKKyAgICAgICAgICAgIGlmIChlbXB0eVZpZXcgPT0gbnVsbCkgcmV0dXJuOworCisgICAgICAgICAgICBhZGFwdGVyVmlldy5zZXRFbXB0eVZpZXcoZW1wdHlWaWV3KTsKKyAgICAgICAgfQorICAgIH0KKwogICAgIC8qKgogICAgICAqIEVxdWl2YWxlbnQgdG8gY2FsbGluZwogICAgICAqIHtAbGluayBhbmRyb2lkLnZpZXcuVmlldyNzZXRPbkNsaWNrTGlzdGVuZXIoYW5kcm9pZC52aWV3LlZpZXcuT25DbGlja0xpc3RlbmVyKX0KQEAgLTI2Niw2ICszMDMsNjMgQEAKICAgICAgICAgcHVibGljIGZpbmFsIHN0YXRpYyBpbnQgVEFHID0gMzsKICAgICB9CiAgICAgCisgICAgcHJpdmF0ZSBjbGFzcyBSZWZsZWN0aW9uQWN0aW9uV2l0aG91dFBhcmFtcyBleHRlbmRzIEFjdGlvbiB7CisgICAgICAgIGludCB2aWV3SWQ7CisgICAgICAgIFN0cmluZyBtZXRob2ROYW1lOworCisgICAgICAgIHB1YmxpYyBmaW5hbCBzdGF0aWMgaW50IFRBRyA9IDU7CisKKyAgICAgICAgUmVmbGVjdGlvbkFjdGlvbldpdGhvdXRQYXJhbXMoaW50IHZpZXdJZCwgU3RyaW5nIG1ldGhvZE5hbWUpIHsKKyAgICAgICAgICAgIHRoaXMudmlld0lkID0gdmlld0lkOworICAgICAgICAgICAgdGhpcy5tZXRob2ROYW1lID0gbWV0aG9kTmFtZTsKKyAgICAgICAgfQorCisgICAgICAgIFJlZmxlY3Rpb25BY3Rpb25XaXRob3V0UGFyYW1zKFBhcmNlbCBpbikgeworICAgICAgICAgICAgdGhpcy52aWV3SWQgPSBpbi5yZWFkSW50KCk7CisgICAgICAgICAgICB0aGlzLm1ldGhvZE5hbWUgPSBpbi5yZWFkU3RyaW5nKCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCB3cml0ZVRvUGFyY2VsKFBhcmNlbCBvdXQsIGludCBmbGFncykgeworICAgICAgICAgICAgb3V0LndyaXRlSW50KFRBRyk7CisgICAgICAgICAgICBvdXQud3JpdGVJbnQodGhpcy52aWV3SWQpOworICAgICAgICAgICAgb3V0LndyaXRlU3RyaW5nKHRoaXMubWV0aG9kTmFtZSk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgYXBwbHkoVmlldyByb290KSB7CisgICAgICAgICAgICBmaW5hbCBWaWV3IHZpZXcgPSByb290LmZpbmRWaWV3QnlJZCh2aWV3SWQpOworICAgICAgICAgICAgaWYgKHZpZXcgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBBY3Rpb25FeGNlcHRpb24oImNhbid0IGZpbmQgdmlldzogMHgiICsgSW50ZWdlci50b0hleFN0cmluZyh2aWV3SWQpKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgQ2xhc3Mga2xhc3MgPSB2aWV3LmdldENsYXNzKCk7CisgICAgICAgICAgICBNZXRob2QgbWV0aG9kOworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICBtZXRob2QgPSBrbGFzcy5nZXRNZXRob2QodGhpcy5tZXRob2ROYW1lKTsKKyAgICAgICAgICAgIH0gY2F0Y2ggKE5vU3VjaE1ldGhvZEV4Y2VwdGlvbiBleCkgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBBY3Rpb25FeGNlcHRpb24oInZpZXc6ICIgKyBrbGFzcy5nZXROYW1lKCkgKyAiIGRvZXNuJ3QgaGF2ZSBtZXRob2Q6ICIKKyAgICAgICAgICAgICAgICAgICAgICAgICsgdGhpcy5tZXRob2ROYW1lICsgIigpIik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmICghbWV0aG9kLmlzQW5ub3RhdGlvblByZXNlbnQoUmVtb3RhYmxlVmlld01ldGhvZC5jbGFzcykpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgQWN0aW9uRXhjZXB0aW9uKCJ2aWV3OiAiICsga2xhc3MuZ2V0TmFtZSgpCisgICAgICAgICAgICAgICAgICAgICAgICArICIgY2FuJ3QgdXNlIG1ldGhvZCB3aXRoIFJlbW90ZVZpZXdzOiAiCisgICAgICAgICAgICAgICAgICAgICAgICArIHRoaXMubWV0aG9kTmFtZSArICIoKSIpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIC8vbm9pbnNwZWN0aW9uIENvbnN0YW50SWZTdGF0ZW1lbnQKKyAgICAgICAgICAgICAgICBpZiAoZmFsc2UpIHsKKyAgICAgICAgICAgICAgICAgICAgTG9nLmQoIlJlbW90ZVZpZXdzIiwgInZpZXc6ICIgKyBrbGFzcy5nZXROYW1lKCkgKyAiIGNhbGxpbmcgbWV0aG9kOiAiCisgICAgICAgICAgICAgICAgICAgICAgICArIHRoaXMubWV0aG9kTmFtZSArICIoKSIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBtZXRob2QuaW52b2tlKHZpZXcpOworICAgICAgICAgICAgfSBjYXRjaCAoRXhjZXB0aW9uIGV4KSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEFjdGlvbkV4Y2VwdGlvbihleCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKICAgICAvKioKICAgICAgKiBCYXNlIGNsYXNzIGZvciB0aGUgcmVmbGVjdGlvbiBhY3Rpb25zLgogICAgICAqLwpAQCAtMjg1LDYgKzM3OSw3IEBACiAgICAgICAgIHN0YXRpYyBmaW5hbCBpbnQgVVJJID0gMTE7CiAgICAgICAgIHN0YXRpYyBmaW5hbCBpbnQgQklUTUFQID0gMTI7CiAgICAgICAgIHN0YXRpYyBmaW5hbCBpbnQgQlVORExFID0gMTM7CisgICAgICAgIHN0YXRpYyBmaW5hbCBpbnQgSU5URU5UID0gMTQ7CiAKICAgICAgICAgaW50IHZpZXdJZDsKICAgICAgICAgU3RyaW5nIG1ldGhvZE5hbWU7CkBAIC0zNDcsNiArNDQyLDkgQEAKICAgICAgICAgICAgICAgICBjYXNlIEJVTkRMRToKICAgICAgICAgICAgICAgICAgICAgdGhpcy52YWx1ZSA9IGluLnJlYWRCdW5kbGUoKTsKICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBJTlRFTlQ6CisgICAgICAgICAgICAgICAgICAgIHRoaXMudmFsdWUgPSBJbnRlbnQuQ1JFQVRPUi5jcmVhdGVGcm9tUGFyY2VsKGluKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICB9CkBAIC00MDIsNiArNTAwLDkgQEAKICAgICAgICAgICAgICAgICBjYXNlIEJVTkRMRToKICAgICAgICAgICAgICAgICAgICAgb3V0LndyaXRlQnVuZGxlKChCdW5kbGUpIHRoaXMudmFsdWUpOwogICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIElOVEVOVDoKKyAgICAgICAgICAgICAgICAgICAgKChJbnRlbnQpdGhpcy52YWx1ZSkud3JpdGVUb1BhcmNlbChvdXQsIGZsYWdzKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICB9CkBAIC00MzUsNiArNTM2LDggQEAKICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEJpdG1hcC5jbGFzczsKICAgICAgICAgICAgICAgICBjYXNlIEJVTkRMRToKICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEJ1bmRsZS5jbGFzczsKKyAgICAgICAgICAgICAgICBjYXNlIElOVEVOVDoKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEludGVudC5jbGFzczsKICAgICAgICAgICAgICAgICBkZWZhdWx0OgogICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKICAgICAgICAgICAgIH0KQEAgLTU2Miw2ICs2NjUsMTIgQEAKICAgICAgICAgICAgICAgICBjYXNlIFZpZXdHcm91cEFjdGlvbi5UQUc6CiAgICAgICAgICAgICAgICAgICAgIG1BY3Rpb25zLmFkZChuZXcgVmlld0dyb3VwQWN0aW9uKHBhcmNlbCkpOwogICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIFJlZmxlY3Rpb25BY3Rpb25XaXRob3V0UGFyYW1zLlRBRzoKKyAgICAgICAgICAgICAgICAgICAgbUFjdGlvbnMuYWRkKG5ldyBSZWZsZWN0aW9uQWN0aW9uV2l0aG91dFBhcmFtcyhwYXJjZWwpKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBTZXRFbXB0eVZpZXcuVEFHOgorICAgICAgICAgICAgICAgICAgICBtQWN0aW9ucy5hZGQobmV3IFNldEVtcHR5VmlldyhwYXJjZWwpKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEFjdGlvbkV4Y2VwdGlvbigiVGFnICIgKyB0YWcgKyAiIG5vdCBmb3VuZCIpOwogICAgICAgICAgICAgICAgIH0KQEAgLTU2OSw2ICs2NzgsNyBAQAogICAgICAgICB9CiAgICAgfQogCisgICAgQE92ZXJyaWRlCiAgICAgcHVibGljIFJlbW90ZVZpZXdzIGNsb25lKCkgewogICAgICAgICBmaW5hbCBSZW1vdGVWaWV3cyB0aGF0ID0gbmV3IFJlbW90ZVZpZXdzKG1QYWNrYWdlLCBtTGF5b3V0SWQpOwogICAgICAgICBpZiAobUFjdGlvbnMgIT0gbnVsbCkgewpAQCAtNjIyLDYgKzczMiwyNCBAQAogICAgIH0KIAogICAgIC8qKgorICAgICAqIEVxdWl2YWxlbnQgdG8gY2FsbGluZyB7QGxpbmsgQWRhcHRlclZpZXdGbGlwcGVyI3Nob3dOZXh0KCl9CisgICAgICoKKyAgICAgKiBAcGFyYW0gdmlld0lkIFRoZSBpZCBvZiB0aGUgdmlldyBvbiB3aGljaCB0byBjYWxsIHtAbGluayBBZGFwdGVyVmlld0ZsaXBwZXIjc2hvd05leHQoKX0KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBzaG93TmV4dChpbnQgdmlld0lkKSB7CisgICAgICAgIGFkZEFjdGlvbihuZXcgUmVmbGVjdGlvbkFjdGlvbldpdGhvdXRQYXJhbXModmlld0lkLCAic2hvd05leHQiKSk7CisgICAgfQorCisgICAgLyoqCisgICAgICogRXF1aXZhbGVudCB0byBjYWxsaW5nIHtAbGluayBBZGFwdGVyVmlld0ZsaXBwZXIjc2hvd1ByZXZpb3VzKCl9CisgICAgIC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GFkYXRhCisgICAgICAgICAgICAgICAgICAgIG1WaWV3Q2FjaGUucmVxdWVzdE1ldGFEYXRhKCk7CisKKyAgICAgICAgICAgICAgICAgICAgLy8gcG9zdCBhIHJ1bm5hYmxlIHRvIGNhbGwgdGhlIGNhbGxiYWNrIG9uIHRoZSBtYWluIHRocmVhZAorICAgICAgICAgICAgICAgICAgICBtTWFpblByaW9yaXR5UXVldWUucG9zdChuZXcgUnVubmFibGUoKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIHJ1bigpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobUNhbGxiYWNrICE9IG51bGwpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1DYWxsYmFjay5vblJlbW90ZUFkYXB0ZXJDb25uZWN0ZWQoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSk7CisKKyAgICAgICAgICAgIC8vIHN0YXJ0IHRoZSBiYWNrZ3JvdW5kIGxvYWRlcgorICAgICAgICAgICAgbVZpZXdDYWNoZS5zdGFydEJhY2tncm91bmRMb2FkZXIoKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyB2b2lkIG9uU2VydmljZURpc2Nvbm5lY3RlZChDb21wb25lbnROYW1lIG5hbWUpIHsKKyAgICAgICAgICAgIG1SZW1vdGVWaWV3c0ZhY3RvcnkgPSBudWxsOworICAgICAgICAgICAgbUNvbm5lY3RlZCA9IGZhbHNlOworCisgICAgICAgICAgICAvLyBjbGVhciB0aGUgbWFpbi93b3JrZXIgcXVldWVzCisgICAgICAgICAgICBtTWFpblF1ZXVlLnJlbW92ZU1lc3NhZ2VzKDApOworICAgICAgICAgICAgCisgICAgICAgICAgICAvLyBzdG9wIHRoZSBiYWNrZ3JvdW5kIGxvYWRlcgorICAgICAgICAgICAgbVZpZXdDYWNoZS5zdG9wQmFja2dyb3VuZExvYWRlcigpOworCisgICAgICAgICAgICBpZiAobUNhbGxiYWNrICE9IG51bGwpCisgICAgICAgICAgICAgICAgbUNhbGxiYWNrLm9uUmVtb3RlQWRhcHRlckRpc2Nvbm5lY3RlZCgpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIElSZW1vdGVWaWV3c0ZhY3RvcnkgZ2V0UmVtb3RlVmlld3NGYWN0b3J5KCkgeworICAgICAgICAgICAgcmV0dXJuIG1SZW1vdGVWaWV3c0ZhY3Rvcnk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgYm9vbGVhbiBpc0Nvbm5lY3RlZCgpIHsKKyAgICAgICAgICAgIHJldHVybiBtQ29ubmVjdGVkOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogQW4gaW50ZXJuYWwgY2FjaGUgb2YgcmVtb3RlIHZpZXdzLgorICAgICAqLworICAgIHByaXZhdGUgY2xhc3MgUmVtb3RlVmlld3NDYWNoZSB7CisgICAgICAgIHByaXZhdGUgUmVtb3RlVmlld3NJbmZvIG1WaWV3Q2FjaGVJbmZvOworICAgICAgICBwcml2YXRlIFJlbW90ZVZpZXdzSW5kZXhJbmZvW10gbVZpZXdDYWNoZTsKKyAgICAgICAgcHJpdmF0ZSBpbnRbXSBtVG1wVmlld0NhY2hlTG9hZEluZGljZXM7CisgICAgICAgIHByaXZhdGUgTGlua2VkTGlzdDxJbnRlZ2VyPiBtVmlld0NhY2hlTG9hZEluZGljZXM7CisgICAgICAgIHByaXZhdGUgYm9vbGVhbiBtQmFja2dyb3VuZExvYWRlckVuYWJsZWQ7CisKKyAgICAgICAgLy8gaWYgYSB1c2VyIGxvYWRpbmcgdmlldyBpcyBub3QgcHJvdmlkZWQsIHRoZW4gd2UgY3JlYXRlIGEgdGVtcG9yYXJ5IG9uZQorICAgICAgICAvLyBmb3IgdGhlIHVzZXIgdXNpbmcgdG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ICAgICAgICAgICAgaW50IHR5cGVJZDsKKworICAgICAgICAgICAgUmVtb3RlVmlld3NJbmRleEluZm8oKSB7CisgICAgICAgICAgICAgICAgaW52YWxpZGF0ZSgpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB2b2lkIHNldChSZW1vdGVWaWV3cyB2LCBsb25nIGlkKSB7CisgICAgICAgICAgICAgICAgdmlldyA9IHY7CisgICAgICAgICAgICAgICAgaXRlbUlkID0gaWQ7CisgICAgICAgICAgICAgICAgaWYgKHYgIT0gbnVsbCkKKyAgICAgICAgICAgICAgICAgICAgdHlwZUlkID0gdi5nZXRMYXlvdXRJZCgpOworICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICAgICAgdHlwZUlkID0gMDsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgdm9pZCBpbnZhbGlkYXRlKCkgeworICAgICAgICAgICAgICAgIHZpZXcgPSBudWxsOworICAgICAgICAgICAgICAgIGl0ZW1JZCA9IDA7CisgICAgICAgICAgICAgICAgdHlwZUlkID0gMDsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgZmluYWwgYm9vbGVhbiBpc1ZhbGlkKCkgeworICAgICAgICAgICAgICAgIHJldHVybiAodmlldyAhPSBudWxsKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIC8qKgorICAgICAgICAgKiBSZW1vdGUgYWRhcHRlciBtZXRhZGF0YS4gVXNlZnVsIGZvciB3aGVuIHdlIGhhdmUgdG8gbG9jayBvbiBzb21ldGhpbmcKKyAgICAgICAgICogYmVmb3JlIHVwZGF0aW5nIHRoZSBtZXRhZGF0YS4KKyAgICAgICAgICovCisgICAgICAgIHByaXZhdGUgY2xhc3MgUmVtb3RlVmlld3NJbmZvIHsKKyAgICAgICAgICAgIGludCBjb3VudDsKKyAgICAgICAgICAgIGludCB2aWV3VHlwZUNvdW50OworICAgICAgICAgICAgYm9vbGVhbiBoYXNTdGFibGVJZHM7CisgICAgICAgICAgICBib29sZWFuIGlzRGF0YURpcnR5OworICAgICAgICAgICAgTWFwPEludGVnZXIsIEludGVnZXI+IG1UeXBlSWRJbmRleE1hcDsKKworICAgICAgICAgICAgUmVtb3RlVmlld3NJbmZvKCkgeworICAgICAgICAgICAgICAgIGNvdW50ID0gMDsKKyAgICAgICAgICAgICAgICAvLyBieSBkZWZhdWx0IHRoZXJlIGlzIGF0IGxlYXN0IG9uZSBkdW1teSB2aWV3IHR5cGUKKyAgICAgICAgICAgICAgICB2aWV3VHlwZUNvdW50ID0gMTsKKyAgICAgICAgICAgICAgICBoYXNTdGFibGVJZHMgPSB0cnVlOworICAgICAgICAgICAgICAgIGlzRGF0YURpcnR5ID0gZmFsc2U7CisgICAgICAgICAgICAgICAgbVR5cGVJZEluZGV4TWFwID0gbmV3IEhhc2hNYXA8SW50ZWdlciwgSW50ZWdlcj4oKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBSZW1vdGVWaWV3c0NhY2hlKGludCBoYWxmQ2FjaGVTaXplKSB7CisgICAgICAgICAgICBtSGFsZkNhY2hlU2l6ZSA9IGhhbGZDYWNoZVNpemU7CisgICAgICAgICAgICBtQ2FjaGVTbGFjayA9IE1hdGgucm91bmQobUNhY2hlU2xhY2tQZXJjZW50YWdlICogbUhhbGZDYWNoZVNpemUpOworICAgICAgICAgICAgbVZpZXdDYWNoZVN0YXJ0UG9zaXRpb24gPSAwOworICAgICAgICAgICAgbVZpZXdDYWNoZUVuZFBvc2l0aW9uID0gLTE7CisgICAgICAgICAgICBtQmFja2dyb3VuZExvYWRlckVuYWJsZWQgPSBmYWxzZTsKKworICAgICAgICAgICAgLy8gaW5pdGlhbGl6ZSB0aGUgY2FjaGUKKyAgICAgICAgICAgIGludCBjYWNoZVNpemUgPSAyICogbUhhbGZDYWNoZVNpemUgKyAxOworICAgICAgICAgICAgbVZpZXdDYWNoZUluZm8gPSBuZXcgUmVtb3RlVmlld3NJbmZvKCk7CisgICAgICAgICAgICBtVmlld0NhY2hlID0gbmV3IFJlbW90ZVZpZXdzSW5kZXhJbmZvW2NhY2hlU2l6ZV07CisgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IG1WaWV3Q2FjaGUubGVuZ3RoOyArK2kpIHsKKyAgICAgICAgICAgICAgICBtVmlld0NhY2hlW2ldID0gbmV3IFJlbW90ZVZpZXdzSW5kZXhJbmZvKCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBtVG1wVmlld0NhY2hlTG9hZEluZGljZXMgPSBuZXcgaW50W2NhY2hlU2l6ZV07CisgICAgICAgICAgICBtVmlld0NhY2hlTG9hZEluZGljZXMgPSBuZXcgTGlua2VkTGlzdDxJbnRlZ2VyPigpOworICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSBmaW5hbCBib29sZWFuIGNvbnRhaW5zKGludCBwb3NpdGlvbikgeworICAgICAgICAgICAgcmV0dXJuIChtVmlld0NhY2hlU3RhcnRQb3NpdGlvbiA8PSBwb3NpdGlvbikgJiYgKHBvc2l0aW9uIDw9IG1WaWV3Q2FjaGVFbmRQb3NpdGlvbik7CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIGZpbmFsIGJvb2xlYW4gY29udGFpbnNBbmRJc1ZhbGlkKGludCBwb3NpdGlvbikgeworICAgICAgICAgICAgaWYgKGNvbnRhaW5zKHBvc2l0aW9uKSkgeworICAgICAgICAgICAgICAgIFJlbW90ZVZpZXdzSW5kZXhJbmZvIGluZGV4SW5mbyA9IG1WaWV3Q2FjaGVbZ2V0Q2FjaGVJbmRleChwb3NpdGlvbildOworICAgICAgICAgICAgICAgIGlmIChpbmRleEluZm8uaXNWYWxpZCgpKSB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgZmluYWwgaW50IGdldENhY2hlSW5kZXgoaW50IHBvc2l0aW9uKSB7CisgICAgICAgICAgICAvLyB0YWtlIHRoZSBtb2R1bG8gb2YgdGhlIHBvc2l0aW9uCisgICAgICAgICAgICByZXR1cm4gKG1WaWV3Q2FjaGUubGVuZ3RoICsgKHBvc2l0aW9uICUgbVZpZXdDYWNoZS5sZW5ndGgpKSAlIG1WaWV3Q2FjaGUubGVuZ3RoOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgcmVxdWVzdE1ldGFEYXRhKCkgeworICAgICAgICAgICAgaWYgKG1TZXJ2aWNlQ29ubmVjdGlvbi5pc0Nvbm5lY3RlZCgpKSB7CisgICAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAgICAgSVJlbW90ZVZpZXdzRmFjdG9yeSBmYWN0b3J5ID0gbVNlcnZpY2VDb25uZWN0aW9uLmdldFJlbW90ZVZpZXdzRmFjdG9yeSgpOworCisgICAgICAgICAgICAgICAgICAgIC8vIGdldCB0aGUgcHJvcGVydGllcy9maXJzdCB2aWV3IChzbyB0aGF0IHdlIGNhbiB1c2UgaXQgdG8KKyAgICAgICAgICAgICAgICAgICAgLy8gbWVhc3VyZSBvdXIgZHVtbXkgdmlld3MpCisgICAgICAgICAgICAgICAgICAgIGJvb2xlYW4gaGFzU3RhYmxlSWRzID0gZmFjdG9yeS5oYXNTdGFibGVJZHMoKTsKKyAgICAgICAgICAgICAgICAgICAgaW50IHZpZXdUeXBlQ291bnQgPSBmYWN0b3J5LmdldFZpZXdUeXBlQ291bnQoKTsKKyAgICAgICAgICAgICAgICAgICAgaW50IGNvdW50ID0gZmFjdG9yeS5nZXRDb3VudCgpOworICAgICAgICAgICAgICAgICAgICBSZW1vdGVWaWV3cyBsb2FkaW5nVmlldyA9IGZhY3RvcnkuZ2V0TG9hZGluZ1ZpZXcoKTsKKyAgICAgICAgICAgICAgICAgICAgUmVtb3RlVmlld3MgZmlyc3RWaWV3ID0gbnVsbDsKKyAgICAgICAgICAgICAgICAgICAgaWYgKChjb3VudCA+IDApICYmIChsb2FkaW5nVmlldyA9PSBudWxsKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgZmlyc3RWaWV3ID0gZmFjdG9yeS5nZXRWaWV3QXQoMCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgc3luY2hyb25pemVkIChtVmlld0NhY2hlSW5mbykgeworICAgICAgICAgICAgICAgICAgICAgICAgUmVtb3RlVmlld3NJbmZvIGluZm8gPSBtVmlld0NhY2hlSW5mbzsKKyAgICAgICAgICAgICAgICAgICAgICAgIGluZm8uaGFzU3RhYmxlSWRzID0gaGFzU3RhYmxlSWRzOworICAgICAgICAgICAgICAgICAgICAgICAgaW5mby52aWV3VHlwZUNvdW50ID0gdmlld1R5cGVDb3VudCArIDE7CisgICAgICAgICAgICAgICAgICAgICAgICBpbmZvLmNvdW50ID0gY291bnQ7CisgICAgICAgICAgICAgICAgICAgICAgICBtVXNlckxvYWRpbmdWaWV3ID0gbG9hZGluZ1ZpZXc7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZmlyc3RWaWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtRmlyc3RWaWV3ID0gZmlyc3RWaWV3OworICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1GaXJzdFZpZXdIZWlnaHQgPSAtMTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgICAgIGUucHJpbnRTdGFja1RyYWNlKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHJvdGVjdGVkIHZvaWQgb25Ob3RpZnlEYXRhU2V0Q2hhbmdlZCgpIHsKKyAgICAgICAgICAgIC8vIHdlIG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YXRhKCk7CisKKyAgICAgICAgICAgIC8vIHBvc3QgYSBuZXcgcnVubmFibGUgb24gdGhlIG1haW4gdGhyZWFkIHRvIHByb3BhZ2F0ZSB0aGUgbm90aWZpY2F0aW9uIGJhY2sKKyAgICAgICAgICAgIC8vIHRvIHRoZSBiYXNlIGFkYXB0ZXIKKyAgICAgICAgICAgIG1NYWluUXVldWUucG9zdChuZXcgUnVubmFibGUoKSB7CisgICAgICAgICAgICAgICAgQE92ZXJyaWRlCisgICAgICAgICAgICAgICAgcHVibGljIHZvaWQgcnVuKCkgeworICAgICAgICAgICAgICAgICAgIGNvbXBsZXRlTm90aWZ5RGF0YVNldENoYW5nZWQoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9KTsKKyAgICAgICAgfQorCisgICAgICAgIHByb3RlY3RlZCB2b2lkIHVwZGF0ZVJlbW90ZVZpZXdzSW5mbyhpbnQgcG9zaXRpb24pIHsKKyAgICAgICAgICAgIGlmIChtU2VydmljZUNvbm5lY3Rpb24uaXNDb25uZWN0ZWQoKSkgeworICAgICAgICAgICAgICAgIElSZW1vdGVWaWV3c0ZhY3RvcnkgZmFjdG9yeSA9IG1TZXJ2aWNlQ29ubmVjdGlvbi5nZXRSZW1vdGVWaWV3c0ZhY3RvcnkoKTsKKworICAgICAgICAgICAgICAgIC8vIGxvYWQgdGhlIGl0ZW0gaW5mb3JtYXRpb24KKyAgICAgICAgICAgICAgICBSZW1vdGVWaWV3cyByZW1vdGVWaWV3ID0gbnVsbDsKKyAgICAgICAgICAgICAgICBsb25nIGl0ZW1JZCA9IDA7CisgICAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAgICAgcmVtb3RlVmlldyA9IGZhY3RvcnkuZ2V0Vmlld0F0KHBvc2l0aW9uKTsKKyAgICAgICAgICAgICAgICAgICAgaXRlbUlkID0gZmFjdG9yeS5nZXRJdGVtSWQocG9zaXRpb24pOworICAgICAgICAgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgICAgIGUucHJpbnRTdGFja1RyYWNlKCk7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgc3luY2hyb25pemVkIChtVmlld0NhY2hlKSB7CisgICAgICAgICAgICAgICAgICAgIC8vIHNraXAgaWYgdGhlIHdpbmRvdyBoYXMgbW92ZWQKKyAgICAgICAgICAgICAgICAgICAgaWYgKHBvc2l0aW9uIDwgbVZpZXdDYWNoZVN0YXJ0UG9zaXRpb24gfHwgcG9zaXRpb24gPiBtVmlld0NhY2hlRW5kUG9zaXRpb24pCisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CisKKyAgICAgICAgICAgICAgICAgICAgZmluYWwgaW50IHBvc2l0aW9uSW5kZXggPSBwb3NpdGlvbjsKKyAgICAgICAgICAgICAgICAgICAgZmluYWwgaW50IGNhY2hlSW5kZXggPSBnZXRDYWNoZUluZGV4KHBvc2l0aW9uKTsKKyAgICAgICAgICAgICAgICAgICAgbVZpZXdDYWNoZVtjYWNoZUluZGV4XS5zZXQocmVtb3RlVmlldywgaXRlbUlkKTsKKworICAgICAgICAgICAgICAgICAgICAvLyBub3RpZnkgdGhlIG1haW4gdGhyZWFkIHdoZW4gZG9uZSBsb2FkaW5nCisgICAgICAgICAgICAgICAgICAgIC8vIGZsdXNoIHBlbmRpbmcgdXBkYXRlcworICAgICAgICAgICAgICAgICAgICBtTWFpblF1ZXVlLnBvc3QobmV3IFJ1bm5hYmxlKCkgeworICAgICAgICAgICAgICAgICAgICAgICAgQE92ZXJyaWRlCisgICAgICAgICAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gc3dhcCB0aGUgbG9hZGVyIHZpZXcgZm9yIHRoaXMgdmlldworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN5bmNocm9uaXplZCAobVZpZXdDYWNoZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY29udGFpbnNBbmRJc1ZhbGlkKHBvc2l0aW9uSW5kZXgpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBSZW1vdGVWaWV3c0luZGV4SW5mbyBpbmRleEluZm8gPSBtVmlld0NhY2hlW2NhY2hlSW5kZXhdOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRnJhbWVMYXlvdXQgZmxpcHBlciA9IGluZGV4SW5mby5mbGlwcGVyOworCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyB1cGRhdGUgdGhlIGZsaXBwZXIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsaXBwZXIuZ2V0Q2hpbGRBdCgwKS5zZXRWaXNpYmlsaXR5KFZpZXcuR09ORSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib29sZWFuIGFkZE5ld1ZpZXcgPSB0cnVlOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGZsaXBwZXIuZ2V0Q2hpbGRDb3VudCgpID4gMSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFZpZXcgdiA9IGZsaXBwZXIuZ2V0Q2hpbGRBdCgxKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgdHlwZUlkID0gKChJbnRlZ2VyKSB2LmdldFRhZygpKS5pbnRWYWx1ZSgpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0eXBlSWQgPT0gaW5kZXhJbmZvLnR5cGVJZCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyB3ZSBjYW4gcmVhcHBseSBzaW5jZSBpdCBpcyB0aGUgc2FtZSB0eXBlCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluZGV4SW5mby52aWV3LnJlYXBwbHkobUNvbnRleHQsIHYpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2LnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHYuZ2V0QW5pbWF0aW9uKCkgIT0gbnVsbCkgCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2LmJ1aWxkRHJhd2luZ0NhY2hlKCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkZE5ld1ZpZXcgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbGlwcGVyLnJlbW92ZVZpZXdBdCgxKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYWRkTmV3VmlldykgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFZpZXcgdiA9IGluZGV4SW5mby52aWV3LmFwcGx5KG1Db250ZXh0LCBmbGlwcGVyKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2LnNldFRhZyhuZXcgSW50ZWdlcihpbmRleEluZm8udHlwZUlkKSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxpcHBlci5hZGRWaWV3KHYpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9KTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIFJlbW90ZVZpZXdzSW5kZXhJbmZvIHJlcXVlc3RDYWNoZWRJbmRleEluZm8oZmluYWwgaW50IHBvc2l0aW9uKSB7CisgICAgICAgICAgICBpbnQgaW5kaWNlc1RvTG9hZENvdW50ID0gMDsKKworICAgICAgICAgICAgc3luY2hyb25pemVkIChtVmlld0NhY2hlKSB7CisgICAgICAgICAgICAgICAgaWYgKGNvbnRhaW5zQW5kSXNWYWxpZChwb3NpdGlvbikpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gcmV0dXJuIHRoZSBpbmZvIGlmIGl0IGV4aXN0cyBpbiB0aGUgd2luZG93IGFuZCBpcyBsb2FkZWQKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG1WaWV3Q2FjaGVbZ2V0Q2FjaGVJbmRleChwb3NpdGlvbildOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIC8vIGlmIG5lY2Vzc2FyeSB1cGRhdGUgdGhlIHdpbmRvdyBhbmQgbG9hZCB0aGUgbmV3IGluZm9ybWF0aW9uCisgICAgICAgICAgICAgICAgaW50IGNlbnRlclBvc2l0aW9uID0gKG1WaWV3Q2FjaGVFbmRQb3NpdGlvbiArIG1WaWV3Q2FjaGVTdGFydFBvc2l0aW9uKSAvIDI7CisgICAgICAgICAgICAgICAgaWYgKChtVmlld0NhY2hlRW5kUG9zaXRpb24gPD0gbVZpZXdDYWNoZVN0YXJ0UG9zaXRpb24pIHx8IChNYXRoLmFicyhwb3NpdGlvbiAtIGNlbnRlclBvc2l0aW9uKSA+IG1DYWNoZVNsYWNrKSkgeworICAgICAgICAgICAgICAgICAgICBpbnQgbmV3U3RhcnRQb3NpdGlvbiA9IHBvc2l0aW9uIC0gbUhhbGZDYWNoZVNpemU7CisgICAgICAgICAgICAgICAgICAgIGludCBuZXdFbmRQb3NpdGlvbiA9IHBvc2l0aW9uICsgbUhhbGZDYWNoZVNpemU7CisgICAgICAgICAgICAgICAgICAgIGludCBmcmFtZVNpemUgPSBtSGFsZkNhY2hlU2l6ZSAvIDQ7CisgICAgICAgICAgICAgICAgICAgIGludCBmcmFtZUNvdW50ID0gKGludCkgTWF0aC5jZWlsKG1WaWV3Q2FjaGUubGVuZ3RoIC8gKGZsb2F0KSBmcmFtZVNpemUpOworCisgICAgICAgICAgICAgICAgICAgIC8vIHBydW5lL2FkZCBiZWZvcmUgdGhlIGN1cnJlbnQgc3RhcnQgcG9zaXRpb24KKyAgICAgICAgICAgICAgICAgICAgaW50IGVmZmVjdGl2ZVN0YXJ0ID0gTWF0aC5tYXgobmV3U3RhcnRQb3NpdGlvbiwgMCk7CisgICAgICAgICAgICAgICAgICAgIGludCBlZmZlY3RpdmVFbmQgPSBNYXRoLm1pbihuZXdFbmRQb3NpdGlvbiwgZ2V0Q291bnQoKSAtIDEpOworCisgICAgICAgICAgICAgICAgICAgIC8vIGludmFsaWRhdGUgaXRlbXMgaW4gdGhlIHF1ZXVlCisgICAgICAgICAgICAgICAgICAgIGludCBvdmVybGFwU3RhcnQgPSBNYXRoLm1heChtVmlld0NhY2hlU3RhcnRQb3NpdGlvbiwgZWZmZWN0aXZlU3RhcnQpOworICAgICAgICAgICAgICAgICAgICBpbnQgb3ZlcmxhcEVuZCA9IE1hdGgubWluKE1hdGgubWF4KG1WaWV3Q2FjaGVTdGFydFBvc2l0aW9uLCBtVmlld0NhY2hlRW5kUG9zaXRpb24pLCBlZmZlY3RpdmVFbmQpOworICAgICAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IChmcmFtZVNpemUgKiBmcmFtZUNvdW50KTsgKytpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBpbnQgaW5kZXggPSBuZXdTdGFydFBvc2l0aW9uICsgKChpICUgZnJhbWVTaXplKSAqIGZyYW1lQ291bnQgKyAoaSAvIGZyYW1lU2l6ZSkpOworICAgICAgICAgICAgICAgICAgICAgICAgCisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaW5kZXggPD0gbmV3RW5kUG9zaXRpb24pIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoKG92ZXJsYXBTdGFydCA8PSBpbmRleCkgJiYgKGluZGV4IDw9IG92ZXJsYXBFbmQpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGxvYWQgdGhlIHN0dWZmIGluIHRoZSBtaWRkbGUgdGhhdCBoYXMgbm90IGFscmVhZHkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gYmVlbiBsb2FkZWQKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFtVmlld0NhY2hlW2dldENhY2hlSW5kZXgoaW5kZXgpXS5pc1ZhbGlkKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1UbXBWaWV3Q2FjaGVMb2FkSW5kaWNlc1tpbmRpY2VzVG9Mb2FkQ291bnQrK10gPSBpbmRleDsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoKGVmZmVjdGl2ZVN0YXJ0IDw9IGluZGV4KSAmJiAoaW5kZXggPD0gZWZmZWN0aXZlRW5kKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBpbnZhbGlkYXRlIGFuZCBsb2FkIGFsbCBuZXcgZWZmZWN0aXZlIGl0ZW1zCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1WaWV3Q2FjaGVbZ2V0Q2FjaGVJbmRleChpbmRleCldLmludmFsaWRhdGUoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVRtcFZpZXdDYWNoZUxvYWRJbmRpY2VzW2luZGljZXNUb0xvYWRDb3VudCsrXSA9IGluZGV4OworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGludmFsaWRhdGUgYWxsIG90aGVyIGNhY2hlIGluZGljZXMgKG91dHNpZGUgdGhlIGVmZmVjdGl2ZSBzdGFydC9lbmQpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGJ1dCBkb24ndCBsb2FkCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1WaWV3Q2FjaGVbZ2V0Q2FjaGVJbmRleChpbmRleCldLmludmFsaWRhdGUoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICBtVmlld0NhY2hlU3RhcnRQb3NpdGlvbiA9IG5ld1N0YXJ0UG9zaXRpb247CisgICAgICAgICAgICAgICAgICAgIG1WaWV3Q2FjaGVFbmRQb3NpdGlvbiA9IG5ld0VuZFBvc2l0aW9uOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLy8gcG9zdCBpdGVtcyB0byBiZSBsb2FkZWQKKyAgICAgICAgICAgIGludCBsZW5ndGggPSAwOworICAgICAgICAgICAgc3luY2hyb25pemVkIChtVmlld0NhY2hlSW5mbykgeworICAgICAgICAgICAgICAgIGxlbmd0aCA9IG1WaWV3Q2FjaGVJbmZvLmNvdW50OworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKGluZGljZXNUb0xvYWRDb3VudCA+IDApIHsKKyAgICAgICAgICAgICAgICBzeW5jaHJvbml6ZWQgKG1WaWV3Q2FjaGVMb2FkSW5kaWNlcykgeworICAgICAgICAgICAgICAgICAgICBtVmlld0NhY2hlTG9hZEluZGljZXMuY2xlYXIoKTsKKyAgICAgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBpbmRpY2VzVG9Mb2FkQ291bnQ7ICsraSkgeworICAgICAgICAgICAgICAgICAgICAgICAgZmluYWwgaW50IGluZGV4ID0gbVRtcFZpZXdDYWNoZUxvYWRJbmRpY2VzW2ldOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKDAgPD0gaW5kZXggJiYgaW5kZXggPCBsZW5ndGgpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtVmlld0NhY2hlTG9hZEluZGljZXMuYWRkTGFzdChpbmRleCk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIHJldHVybiBudWxsIHNvIHRoYXQgYSBkdW1teSB2aWV3IGNhbiBiZSByZXRyaWV2ZWQKKyAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIFZpZXcgZ2V0VmlldyhpbnQgcG9zaXRpb24sIFZpZXcgY29udmVydFZpZXcsIFZpZXdHcm91cCBwYXJlbnQpIHsKKyAgICAgICAgICAgIGlmIChtU2VydmljZUNvbm5lY3Rpb24uaXNDb25uZWN0ZWQoKSkgeworICAgICAgICAgICAgICAgIC8vIGNyZWF0ZSB0aGUgZmxpcHBlciB2aWV3cyBpZiBuZWNlc3NhcnkgKHdlIGhhdmUgdG8gZG8gdGhpcyBub3cKKyAgICAgICAgICAgICAgICAvLyBmb3IgYWxsIHRoZSBmbGlwcGVycyB3aGlsZSB3ZSBoYXZlIHRoZSByZWZlcmVuY2UgdG8gdGhlIHBhcmVudCkKKyAgICAgICAgICAgICAgICBpbml0aWFsaXplTG9hZGluZ1ZpZXdzKHBhcmVudCk7CisKKyAgICAgICAgICAgICAgICAvLyByZXF1ZXN0IHRoZSBpdGVtIGZyb20gdGhlIGNhY2hlIChxdWV1ZWluZyBpdCB0byBsb2FkIGlmIG5vdAorICAgICAgICAgICAgICAgIC8vIGluIHRoZSBjYWNoZSBhbHJlYWR5KQorICAgICAgICAgICAgICAgIFJlbW90ZVZpZXdzSW5kZXhJbmZvIGluZGV4SW5mbyA9IHJlcXVlc3RDYWNoZWRJbmRleEluZm8ocG9zaXRpb24pOworCisgICAgICAgICAgICAgICAgLy8gdXBkYXRlIHRoZSBmbGlwcGVyIGFwcHJvcHJpYXRlbHkKKyAgICAgICAgICAgICAgICBzeW5jaHJvbml6ZWQgKG1WaWV3Q2FjaGUpIHsKKyAgICAgICAgICAgICAgICAgICAgaW50IGNhY2hlSW5kZXggPSBnZXRDYWNoZUluZGV4KHBvc2l0aW9uKTsKKyAgICAgICAgICAgICAgICAgICAgRnJhbWVMYXlvdXQgZmxpcHBlciA9IG1WaWV3Q2FjaGVbY2FjaGVJbmRleF0uZmxpcHBlcjsKKyAgICAgICAgICAgICAgICAgICAgZmxpcHBlci5zZXRWaXNpYmlsaXR5KFZpZXcuVklTSUJMRSk7CisgICAgICAgICAgICAgICAgICAgIGZsaXBwZXIuc2V0QWxwaGEoMS4wZik7CisKKyAgICAgICAgICAgICAgICAgICAgaWYgKGluZGV4SW5mbyA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAvLyBoaWRlIHRoZSBpdGVtIHZpZXcgYW5kIHNob3cgdGhlIGxvYWRpbmcgdmlldworICAgICAgICAgICAgICAgICAgICAgICAgZmxpcHBlci5nZXRDaGlsZEF0KDApLnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAxOyBpIDwgZmxpcHBlci5nZXRDaGlsZENvdW50KCk7ICsraSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsaXBwZXIuZ2V0Q2hpbGRBdChpKS5zZXRWaXNpYmlsaXR5KFZpZXcuR09ORSk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAvLyBoaWRlIHRoZSBsb2FkaW5nIHZpZXcgYW5kIHNob3cgdGhlIGl0ZW0gdmlldworICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBmbGlwcGVyLmdldENoaWxkQ291bnQoKSAtIDE7ICsraSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsaXBwZXIuZ2V0Q2hpbGRBdChpKS5zZXRWaXNpYmlsaXR5KFZpZXcuR09ORSk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBmbGlwcGVyLmdldENoaWxkQXQoZmxpcHBlci5nZXRDaGlsZENvdW50KCkgLSAxKS5zZXRWaXNpYmlsaXR5KFZpZXcuVklTSUJMRSk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZsaXBwZXI7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIG5ldyBWaWV3KG1Db250ZXh0KTsKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgdm9pZCBpbml0aWFsaXplTG9hZGluZ1ZpZXdzKFZpZXdHcm91cCBwYXJlbnQpIHsKKyAgICAgICAgICAgIC8vIGVuc3VyZSB0aGF0IHRoZSBjYWNoZSBoYXMgdGhlIGFwcHJvcHJpYXRlIGluaXRpYWwgZmxpcHBlcgorICAgICAgICAgICAgc3luY2hyb25pemVkIChtVmlld0NhY2hlKSB7CisgICAgICAgICAgICAgICAgaWYgKG1WaWV3Q2FjaGVbMF0uZmxpcHBlciA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbVZpZXdDYWNoZS5sZW5ndGg7ICsraSkgeworICAgICAgICAgICAgICAgICAgICAgICAgRnJhbWVMYXlvdXQgZmxpcHBlciA9IG5ldyBGcmFtZUxheW91dChtQ29udGV4dCk7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAobVVzZXJMb2FkaW5nVmlldyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gdXNlIHRoZSB1c2VyLXNwZWNpZmllZCBsb2FkaW5nIHZpZXcKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbGlwcGVyLmFkZFZpZXcobVVzZXJMb2FkaW5nVmlldy5hcHBseShtQ29udGV4dCwgcGFyZW50KSk7CisgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGNhbGN1bGF0ZSB0aGUgb3JpZ2luYWwgc2l6ZSBvZiB0aGUgZmlyc3Qgcm93IGZvciB0aGUgbG9hZGVyIHZpZXcKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzeW5jaHJvbml6ZWQgKG1WaWV3Q2FjaGVJbmZvKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtRmlyc3RWaWV3SGVpZ2h0IDwgMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVmlldyBmaXJzdFZpZXcgPSBtRmlyc3RWaWV3LmFwcGx5KG1Db250ZXh0LCBwYXJlbnQpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmlyc3RWaWV3Lm1lYXN1cmUoTWVhc3VyZVNwZWMubWFrZU1lYXN1cmVTcGVjKDAsIE1lYXN1cmVTcGVjLlVOU1BFQ0lGSUVEKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTWVhc3VyZVNwZWMubWFrZU1lYXN1cmVTcGVjKDAsIE1lYXN1cmVTcGVjLlVOU1BFQ0lGSUVEKSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtRmlyc3RWaWV3SGVpZ2h0ID0gZmlyc3RWaWV3LmdldE1lYXN1cmVkSGVpZ2h0KCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBjb25zdHJ1Y3QgYSBuZXcgbG9hZGVyIGFuZCBhZGQgaXQgdG8gdGhlIGZsaXBwZXIgYXMgdGhlIGZhbGxiYWNrCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gZGVmYXVsdCB2aWV3CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGV4dFZpZXcgdGV4dFZpZXcgPSBuZXcgVGV4dFZpZXcobUNvbnRleHQpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRleHRWaWV3LnNldFRleHQoIkxvYWRpbmcuLi4iKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ZXh0Vmlldy5zZXRIZWlnaHQobUZpcnN0Vmlld0hlaWdodCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGV4dFZpZXcuc2V0R3Jhdml0eShHcmF2aXR5LkNFTlRFUl9IT1JJWk9OVEFMIHwgR3Jhdml0eS5DRU5URVJfVkVSVElDQUwpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRleHRWaWV3LnNldFRleHRTaXplKDE4LjBmKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ZXh0Vmlldy5zZXRUZXh0Q29sb3IoQ29sb3IuYXJnYig5NiwgMjU1LCAyNTUsIDI1NSkpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRleHRWaWV3LnNldFNoYWRvd0xheWVyKDIuMGYsIDAuMGYsIDEuMGYsIENvbG9yLkJMQUNLKTsKKworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsaXBwZXIuYWRkVmlldyh0ZXh0Vmlldyk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBtVmlld0NhY2hlW2ldLmZsaXBwZXIgPSBmbGlwcGVyOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgc3RhcnRCYWNrZ3JvdW5kTG9hZGVyKCkgeworICAgICAgICAgICAgLy8gaW5pdGlhbGl6ZSB0aGUgd29ya2VyIHJ1bm5hYmxlCisgICAgICAgICAgICBtQmFja2dyb3VuZExvYWRlckVuYWJsZWQgPSB0cnVlOworICAgICAgICAgICAgbVdvcmtlclF1ZXVlLnBvc3QobmV3IFJ1bm5hYmxlKCkgeworICAgICAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIHJ1bigpIHsKKyAgICAgICAgICAgICAgICAgICAgd2hpbGUgKG1CYWNrZ3JvdW5kTG9hZGVyRW5hYmxlZCkgeworICAgICAgICAgICAgICAgICAgICAgICAgLy8gbm90aWZ5IHRoZSBSZW1vdGVWaWV3cyBmYWN0b3J5IGlmIG5lY2Vzc2FyeQorICAgICAgICAgICAgICAgICAgICAgICAgYm9vbGVhbiBpc0RhdGFEaXJ0eSA9IGZhbHNlOworICAgICAgICAgICAgICAgICAgICAgICAgc3luY2hyb25pemVkIChtVmlld0NhY2hlSW5mbykgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlzRGF0YURpcnR5ID0gbVZpZXdDYWNoZUluZm8uaXNEYXRhRGlydHk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVZpZXdDYWNoZUluZm8uaXNEYXRhRGlydHkgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpc0RhdGFEaXJ0eSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVwZGF0ZU5vdGlmeURhdGFTZXRDaGFuZ2VkKCk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgICAgIGludCBpbmRleCA9IC0xOworICAgICAgICAgICAgICAgICAgICAgICAgc3luY2hyb25pemVkIChtVmlld0NhY2hlTG9hZEluZGljZXMpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIW1WaWV3Q2FjaGVMb2FkSW5kaWNlcy5pc0VtcHR5KCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5kZXggPSBtVmlld0NhY2hlTG9hZEluZGljZXMucmVtb3ZlRmlyc3QoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaW5kZXggPCAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gdGhlcmUgd2VyZSBubyBpdGVtcyB0byBsb2FkLCBzbyBzbGVlcCBmb3IgYSBiaXQKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUaHJlYWQuc2xlZXAoMTApOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKEludGVycnVwdGVkRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5wcmludFN0YWNrVHJhY2UoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIG90aGVyd2lzZSwgdHJ5IGFuZCBsb2FkIHRoZSBpdGVtCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlUmVtb3RlVmlld3NJbmZvKGluZGV4KTsKKworICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHNsZWVwIGZvciBhIGJpdCB0byBhbGxvdyB0aGluZ3MgdG8gY2F0Y2ggdXAgYWZ0ZXIgdGhlIGxvYWQKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBUaHJlYWQuc2xlZXAoNTApOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKEludGVycnVwdGVkRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZS5wcmludFN0YWNrVHJhY2UoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9KTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyB2b2lkIHN0b3BCYWNrZ3JvdW5kTG9hZGVyKCkgeworICAgICAgICAgICAgLy8gY2xlYXIgdGhlIGl0ZW1zIHRvIGJlIGxvYWRlZAorICAgICAgICAgICAgbUJhY2tncm91bmRMb2FkZXJFbmFibGVkID0gZmFsc2U7CisgICAgICAgICAgICBzeW5jaHJvbml6ZWQgKG1WaWV3Q2FjaGVMb2FkSW5kaWNlcykgeworICAgICAgICAgICAgICAgIG1WaWV3Q2FjaGVMb2FkSW5kaWNlcy5jbGVhcigpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGxvbmcgZ2V0SXRlbUlkKGludCBwb3NpdGlvbikgeworICAgICAgICAgICAgc3luY2hyb25pemVkIChtVmlld0NhY2hlKSB7CisgICAgICAgICAgICAgICAgaWYgKGNvbnRhaW5zQW5kSXNWYWxpZChwb3NpdGlvbikpIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG1WaWV3Q2FjaGVbZ2V0Q2FjaGVJbmRleChwb3NpdGlvbildLml0ZW1JZDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gMDsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBpbnQgZ2V0SXRlbVZpZXdUeXBlKGludCBwb3NpdGlvbikgeworICAgICAgICAgICAgLy8gc3luY2hyb25pemUgdG8gZW5zdXJlIHRoYXQgdGhlIHR5cGUgaWQvaW5kZXggbWFwIGlzIHVwZGF0ZWQgc3luY2hyb25vdXNseQorICAgICAgICAgICAgc3luY2hyb25pemVkIChtVmlld0NhY2hlKSB7CisgICAgICAgICAgICAgICAgaWYgKGNvbnRhaW5zQW5kSXNWYWxpZChwb3NpdGlvbikpIHsKKyAgICAgICAgICAgICAgICAgICAgaW50IHZpZXdJZCA9IG1WaWV3Q2FjaGVbZ2V0Q2FjaGVJbmRleChwb3NpdGlvbildLnR5cGVJZDsKKyAgICAgICAgICAgICAgICAgICAgTWFwPEludGVnZXIsIEludGVnZXI+IHR5cGVNYXAgPSBtVmlld0NhY2hlSW5mby5tVHlwZUlkSW5kZXhNYXA7CisgICAgICAgICAgICAgICAgICAgIC8vIHdlICsxIGJlY2F1c2UgdGhlIGRlZmF1bHQgZHVtbXkgdmlldyBnZXQgdmlldyB0eXBlIDAKKyAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVNYXAuY29udGFpbnNLZXkodmlld0lkKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHR5cGVNYXAuZ2V0KHZpZXdJZCk7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICBpbnQgbmV3SW5kZXggPSB0eXBlTWFwLnNpemUoKSArIDE7CisgICAgICAgICAgICAgICAgICAgICAgICB0eXBlTWFwLnB1dCh2aWV3SWQsIG5ld0luZGV4KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXdJbmRleDsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIC8vIHJldHVybiB0aGUgdHlwZSBvZiB0aGUgZGVmYXVsdCBpdGVtCisgICAgICAgICAgICByZXR1cm4gMDsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBpbnQgZ2V0Q291bnQoKSB7CisgICAgICAgICAgICBzeW5jaHJvbml6ZWQgKG1WaWV3Q2FjaGVJbmZvKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIG1WaWV3Q2FjaGVJbmZvLmNvdW50OworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGludCBnZXRWaWV3VHlwZUNvdW50KCkgeworICAgICAgICAgICAgc3luY2hyb25pemVkIChtVmlld0NhY2hlSW5mbykgeworICAgICAgICAgICAgICAgIHJldHVybiBtVmlld0NhY2hlSW5mby52aWV3VHlwZUNvdW50OworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGJvb2xlYW4gaGFzU3RhYmxlSWRzKCkgeworICAgICAgICAgICAgc3luY2hyb25pemVkIChtVmlld0NhY2hlSW5mbykgeworICAgICAgICAgICAgICAgIHJldHVybiBtVmlld0NhY2hlSW5mby5oYXNTdGFibGVJZHM7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBmbHVzaENhY2hlKCkgeworICAgICAgICAgICAgLy8gY2xlYXIgdGhlIGl0ZW1zIHRvIGJlIGxvYWRlZAorICAgICAgICAgICAgc3luY2hyb25pemVkIChtVmlld0NhY2hlTG9hZEluZGljZXMpIHsKKyAgICAgICAgICAgICAgICBtVmlld0NhY2hlTG9hZEluZGljZXMuY2xlYXIoKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgc3luY2hyb25pemVkIChtVmlld0NhY2hlKSB7CisgICAgICAgICAgICAgICAgLy8gZmx1c2ggdGhlIGludGVybmFsIGNhY2hlIGFuZCBpbnZhbGlkYXRlIHRoZSBhZGFwdGVyIGZvciBmdXR1cmUgbG9hZHMKKyAgICAgICAgICAgICAgICBtTWFpblF1ZXVlLnJlbW92ZU1lc3NhZ2VzKDApOworCisgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBtVmlld0NhY2hlLmxlbmd0aDsgKytpKSB7CisgICAgICAgICAgICAgICAgICAgIG1WaWV3Q2FjaGVbaV0uaW52YWxpZGF0ZSgpOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIG1WaWV3Q2FjaGVTdGFydFBvc2l0aW9uID0gMDsKKyAgICAgICAgICAgICAgICBtVmlld0NhY2hlRW5kUG9zaXRpb24gPSAtMTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyBSZW1vdGVWaWV3c0FkYXB0ZXIoQ29udGV4dCBjb250ZXh0LCBJbnRlbnQgaW50ZW50LCBSZW1vdGVBZGFwdGVyQ29ubmVjdGlvbkNhbGxiYWNrIGNhbGxiYWNrKSB7CisgICAgICAgIG1Db250ZXh0ID0gY29udGV4dDsKKyAgICAgICAgbUludGVudCA9IGludGVudDsKKworICAgICAgICAvLyBpbml0aWFsaXplIHRoZSB3b3JrZXIgdGhyZWFkCisgICAgICAgIG1Xb3JrZXJUaHJlYWQgPSBuZXcgSGFuZGxlclRocmVhZCgiUmVtb3RlVmlld3NDYWNoZS1sb2FkZXIiKTsKKyAgICAgICAgbVdvcmtlclRocmVhZC5zdGFydCgpOworICAgICAgICBtV29ya2VyUXVldWUgPSBuZXcgSGFuZGxlcihtV29ya2VyVGhyZWFkLmdldExvb3BlcigpKTsKKyAgICAgICAgbVdvcmtlclByaW9yaXR5UXVldWUgPSBuZXcgSGFuZGxlcihtV29ya2VyVGhyZWFkLmdldExvb3BlcigpKTsKKyAgICAgICAgbU1haW5RdWV1ZSA9IG5ldyBIYW5kbGVyKExvb3Blci5teUxvb3BlcigpKTsKKyAgICAgICAgbU1haW5Qcmlvcml0eVF1ZXVlID0gbmV3IEhhbmRsZXIoTG9vcGVyLm15TG9vcGVyKCkpOworCisgICAgICAgIC8vIGluaXRpYWxpemUgdGhlIGNhY2hlIGFuZCB0aGUgc2VydmljZSBjb25uZWN0aW9uIG9uIHN0YXJ0dXAKKyAgICAgICAgbVZpZXdDYWNoZSA9IG5ldyBSZW1vdGVWaWV3c0NhY2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Z2V0Q291bnQoKSB7CisgICAgICAgICAgICByZXR1cm4gbUZhY3RvcnkuZ2V0Q291bnQoKTsKKyAgICAgICAgfQorICAgICAgICBwdWJsaWMgUmVtb3RlVmlld3MgZ2V0Vmlld0F0KGludCBwb3NpdGlvbikgeworICAgICAgICAgICAgcmV0dXJuIG1GYWN0b3J5LmdldFZpZXdBdChwb3NpdGlvbik7CisgICAgICAgIH0KKyAgICAgICAgcHVibGljIFJlbW90ZVZpZXdzIGdldExvYWRpbmdWaWV3KCkgeworICAgICAgICAgICAgcmV0dXJuIG1GYWN0b3J5LmdldExvYWRpbmdWaWV3KCk7CisgICAgICAgIH0KKyAgICAgICAgcHVibGljIGludCBnZXRWaWV3VHlwZUNvdW50KCkgeworICAgICAgICAgICAgcmV0dXJuIG1GYWN0b3J5LmdldFZpZXdUeXBlQ291bnQoKTsKKyAgICAgICAgfQorICAgICAgICBwdWJsaWMgbG9uZyBnZXRJdGVtSWQoaW50IHBvc2l0aW9uKSB7CisgICAgICAgICAgICByZXR1cm4gbUZhY3RvcnkuZ2V0SXRlbUlkKHBvc2l0aW9uKTsKKyAgICAgICAgfQorICAgICAgICBwdWJsaWMgYm9vbGVhbiBoYXNTdGFibGVJZHMoKSB7CisgICAgICAgICAgICByZXR1cm4gbUZhY3RvcnkuaGFzU3RhYmxlSWRzKCk7CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIFJlbW90ZVZpZXdzRmFjdG9yeSBtRmFjdG9yeTsKKyAgICB9CisKKyAgICBwdWJsaWMgUmVtb3RlVmlld3NTZXJ2aWNlKCkgeworICAgICAgICBtUmVtb3RlVmlld0ZhY3RvcmllcyA9IG5ldyBIYXNoTWFwPEludGVudCwgUGFpcjxSZW1vdGVWaWV3c0ZhY3RvcnksIEludGVnZXI+PigpOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyBJQmluZGVyIG9uQmluZChJbnRlbnQgaW50ZW50KSB7CisgICAgICAgIHN5bmNocm9uaXplZC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N0b3J5UmVmLmZpcnN0LCBuZXdSZWZDb3VudCk7CisgICAgICAgICAgICAgICAgbVJlbW90ZVZpZXdGYWN0b3JpZXMucHV0KGludGVudCwgZmFjdG9yeVJlZik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gbmV3IFJlbW90ZVZpZXdzRmFjdG9yeUFkYXB0ZXIoZmFjdG9yeSk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgYm9vbGVhbiBvblVuYmluZChJbnRlbnQgaW50ZW50KSB7CisgICAgICAgIHN5bmNocm9uaXplZCAobUxvY2spIHsKKyAgICAgICAgICAgIGlmIChtUmVtb3RlVmlld0ZhY3Rvcmllcy5jb250YWluc0tleShpbnRlbnQpKSB7CisgICAgICAgICAgICAgICAgLy8gdGhpcyBhbGxldmlhdGVzIHRoZSB1c2VyJ3MgcmVzcG9uc2liaWxpdHkgb2YgaGF2aW5nIHRvIGNsZWFyIGFsbCBmYWN0b3JpZXMKKyAgICAgICAgICAgICAgICBQYWlyPFJlbW90ZVZpZXdzRmFjdG9yeSwgSW50ZWdlcj4gb2xkRmFjdG9yeVJlZiA9IG1SZW1vdGVWaWV3RmFjdG9yaWVzLmdldChpbnRlbnQpOworICAgICAgICAgICAgICAgIGludCBuZXdSZWZDb3VudCA9IG9sZEZhY3RvcnlSZWYuc2Vjb25kLmludFZhbHVlKCkgLSAxOworICAgICAgICAgICAgICAgIGlmIChuZXdSZWZDb3VudCA8PSAwKSB7CisgICAgICAgICAgICAgICAgICAgIG9sZEZhY3RvcnlSZWYuZmlyc3Qub25EZXN0cm95KCk7CisgICAgICAgICAgICAgICAgICAgIG1SZW1vdGVWaWV3RmFjdG9yaWVzLnJlbW92ZShpbnRlbnQpOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIFBhaXI8UmVtb3RlVmlld3NGYWN0b3J5LCBJbnRlZ2VyPiBmYWN0b3J5UmVm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9IChpbnQpIChtTGFzdE1vdGlvblkgLSB5KTsKICAgICAgICAgICAgICAgICAgICAgbUxhc3RNb3Rpb25ZID0geTsKIAotICAgICAgICAgICAgICAgICAgICBmaW5hbCBpbnQgb2xkWCA9IG1TY3JvbGxYOwotICAgICAgICAgICAgICAgICAgICBmaW5hbCBpbnQgb2xkWSA9IG1TY3JvbGxZOwotICAgICAgICAgICAgICAgICAgICBmaW5hbCBpbnQgcmFuZ2UgPSBnZXRTY3JvbGxSYW5nZSgpOwotICAgICAgICAgICAgICAgICAgICBpZiAob3ZlcnNjcm9sbEJ5KDAsIGRlbHRhWSwgMCwgbVNjcm9sbFksIDAsIHJhbmdlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAsIG1PdmVyc2Nyb2xsRGlzdGFuY2UsIHRydWUpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAvLyBCcmVhayBvdXIgdmVsb2NpdHkgaWYgd2UgaGl0IGEgc2Nyb2xsIGJhcnJpZXIuCi0gICAgICAgICAgICAgICAgICAgICAgICBtVmVsb2NpdHlUcmFja2VyLmNsZWFyKCk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgb25TY3JvbGxDaGFuZ2VkKG1TY3JvbGxYLCBtU2Nyb2xsWSwgb2xkWCwgb2xkWSk7Ci0KLSAgICAgICAgICAgICAgICAgICAgZmluYWwgaW50IG92ZXJzY3JvbGxNb2RlID0gZ2V0T3ZlcnNjcm9sbE1vZGUoKTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKG92ZXJzY3JvbGxNb2RlID09IE9WRVJTQ1JPTExfQUxXQVlTIHx8Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgKG92ZXJzY3JvbGxNb2RlID09IE9WRVJTQ1JPTExfSUZfQ09OVEVOVF9TQ1JPTExTICYmIHJhbmdlID4gMCkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGZpbmFsIGludCBwdWxsZWRUb1kgPSBvbGRZICsgZGVsdGFZOwotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHB1bGxlZFRvWSA8IDApIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBtRWRnZUdsb3dUb3Aub25QdWxsKChmbG9hdCkgZGVsdGFZIC8gZ2V0SGVpZ2h0KCkpOwotICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChwdWxsZWRUb1kgPiByYW5nZSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1FZGdlR2xvd0JvdHRvbS5vblB1bGwoKGZsb2F0KSBkZWx0YVkgLyBnZXRIZWlnaHQoKSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgc2Nyb2xsQnkoMCwgZGVsdGFZKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICBjYXNlIE1vdGlvbkV2ZW50LkFDVElPTl9VUDogCkBAIC01NTEsMTUgKzUyNSw4IEBACiAgICAgICAgICAgICAgICAgICAgIHZlbG9jaXR5VHJhY2tlci5jb21wdXRlQ3VycmVudFZlbG9jaXR5KDEwMDAsIG1NYXhpbXVtVmVsb2NpdHkpOwogICAgICAgICAgICAgICAgICAgICBpbnQgaW5pdGlhbFZlbG9jaXR5ID0gKGludCkgdmVsb2NpdHlUcmFja2VyLmdldFlWZWxvY2l0eShtQWN0aXZlUG9pbnRlcklkKTsKIAotICAgICAgICAgICAgICAgICAgICBpZiAoZ2V0Q2hpbGRDb3VudCgpID4gMCkgewotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKChNYXRoLmFicyhpbml0aWFsVmVsb2NpdHkpID4gbU1pbmltdW1WZWxvY2l0eSkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbGluZygtaW5pdGlhbFZlbG9jaXR5KTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZmluYWwgaW50IGJvdHRvbSA9IGdldFNjcm9sbFJhbmdlKCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1TY3JvbGxlci5zcHJpbmdiYWNrKG1TY3JvbGxYLCBtU2Nyb2xsWSwgMCwgMCwgMCwgYm90dG9tKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnZhbGlkYXRlKCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBpZiAoZ2V0Q2hpbGRDb3VudCgpID4gMCAmJiBNYXRoLmFicyhpbml0aWFsVmVsb2NpdHkpID4gbU1pbmltdW1WZWxvY2l0eSkgeworICAgICAgICAgICAgICAgICAgICAgICAgZmxpbmcoLWluaXRpYWxWZWxvY2l0eSk7CiAgICAgICAgICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgICAgICAgICBtQWN0aXZlUG9pbnRlcklkID0gSU5WQUxJRF9QT0lOVEVSOwpAQCAtNTY5LDI3ICs1MzYsMTYgQEAKICAgICAgICAgICAgICAgICAgICAgICAgIG1WZWxvY2l0eVRyYWNrZXIucmVjeWNsZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgbVZlbG9jaXR5VHJhY2tlciA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgaWYgKG1FZGdlR2xvd1RvcCAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBtRWRnZUdsb3dUb3Aub25SZWxlYXNlKCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBtRWRnZUdsb3dCb3R0b20ub25SZWxlYXNlKCk7Ci0gICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICBjYXNlIE1vdGlvbkV2ZW50LkFDVElPTl9DQU5DRUw6CiAgICAgICAgICAgICAgICAgaWYgKG1Jc0JlaW5nRHJhZ2dlZCAmJiBnZXRDaGlsZENvdW50KCkgPiAwKSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChtU2Nyb2xsZXIuc3ByaW5nYmFjayhtU2Nyb2xsWCwgbVNjcm9sbFksIDAsIDAsIDAsIGdldFNjcm9sbFJhbmdlKCkpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpbnZhbGlkYXRlKCk7Ci0gICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgbUFjdGl2ZVBvaW50ZXJJZCA9IElOVkFMSURfUE9JTlRFUjsKICAgICAgICAgICAgICAgICAgICAgbUlzQmVpbmdEcmFnZ2VkID0gZmFsc2U7CiAgICAgICAgICAgICAgICAgICAgIGlmIChtVmVsb2NpdHlUcmFja2VyICE9IG51bGwpIHsKICAgICAgICAgICAgICAgICAgICAgICAgIG1WZWxvY2l0eVRyYWNrZXIucmVjeWNsZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgbVZlbG9jaXR5VHJhY2tlciA9IG51bGw7CiAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgaWYgKG1FZGdlR2xvd1RvcCAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBtRWRnZUdsb3dUb3Aub25SZWxlYXNlKCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBtRWRnZUdsb3dCb3R0b20ub25SZWxlYXNlKCk7Ci0gICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICBjYXNlIE1vdGlvbkV2ZW50LkFDVElPTl9QT0lOVEVSX1VQOgpAQCAtNjE2LDMyICs1NzIsNiBAQAogICAgICAgICB9CiAgICAgfQogICAgIAotICAgIEBPdmVycmlkZQotICAgIHByb3RlY3RlZCB2b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4LCBnZXRXaWR0aCgpIC0gbVBhZGRpbmdSaWdodCAtIG1QYWRkaW5nTGVmdCwgY2hpbGQuZ2V0V2lkdGgoKSk7CisgICAgICAgICAgICAgICAgeSA9IGNsYW1wKHksIGdldEhlaWdodCgpIC0gbVBhZGRpbmdCb3R0b20gLSBtUGFkZGluZ1RvcCwgY2hpbGQuZ2V0SGVpZ2h0KCkpOworICAgICAgICAgICAgICAgIGlmICh4ICE9IG9sZFggfHwgeSAhPSBvbGRZKSB7CisgICAgICAgICAgICAgICAgICAgIG1TY3JvbGxYID0geDsKKyAgICAgICAgICAgICAgICAgICAgbVNjcm9sbFkgPSB5OworICAgICAgICAgICAgICAgICAgICBvblNjcm9sbENoYW5nZWQoeCwgeSwgb2xkWCwgb2xkWSk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICAgICAgYXdha2VuU2Nyb2xsQmFycygpOwpAQCAtMTMzOSw3ICsxMjU0LDcgQEAKICAgICAgICAgICAgIGludCBib3R0b20gPSBnZXRDaGlsZEF0KDApLmdldEhlaWdodCgpOwogICAgIAogICAgICAgICAgICAgbVNjcm9sbGVyLmZsaW5nKG1TY3JvbGxYLCBtU2Nyb2xsWSwgMCwgdmVsb2NpdHlZLCAwLCAwLCAwLCAKLSAgICAgICAgICAgICAgICAgICAgTWF0aC5tYXgoMCwgYm90dG9tIC0gaGVpZ2h0KSwgMCwgaGVpZ2h0LzIpOworICAgICAgICAgICAgICAgICAgICBNYXRoLm1heCgwLCBib3R0b20gLSBoZWlnaHQpKTsKICAgICAKICAgICAgICAgICAgIGZpbmFsIGJvb2xlYW4gbW92aW5nRG93biA9IHZlbG9jaXR5WSA+IDA7CiAgICAgCkBAIC0xMzc3LDU1ICsxMjkyLDYgQEAKICAgICAgICAgfQogICAgIH0KIAotICAgIEBPdmVycmlkZQotICAgIHB1YmxpYyB2b2lkIHNldE92ZXJzY3JvbGxNb2RlKGludCBtb2RlKSB7Ci0gICAgICAgIGlmIChtb2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uc2F2ZSgpOwotICAgICAgICAgICAgICAgIGZpbmFsIGludCB3aWR0aCA9IGdldFdpZHRoKCk7Ci0KLSAgICAgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKC13aWR0aCAvIDIsIE1hdGgubWluKDAsIHNjcm9sbFkpKTsKLSAgICAgICAgICAgICAgICBtRWRnZUdsb3dUb3Auc2V0U2l6ZSh3aWR0aCAqIDIsIGdldEhlaWdodCgpKTsKLSAgICAgICAgICAgICAgICBpZiAobUVkZ2VHbG93VG9wLmRyYXcoY2FudmFzKSkgewotICAgICAgICAgICAgICAgICAgICBpbnZhbGlkYXRlKCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGNhbnZhcy5yZXN0b3JlVG9Db3VudChyZXN0b3JlQ291bnQpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKCFtRWRnZUdsb3dCb3R0b20uaXNGaW5pc2hlZCgpKSB7Ci0gICAgICAgICAgICAgICAgZmluYWwgaW50IHJlc3RvcmVDb3VudCA9IGNhbnZhcy5zYXZlKCk7Ci0gICAgICAgICAgICAgICAgZmluYWwgaW50IHdpZHRoID0gZ2V0V2lkdGgoKTsKLSAgICAgICAgICAgICAgICBmaW5hbCBpbnQgaGVpZ2h0ID0gZ2V0SGVpZ2h0KCk7Ci0KLSAgICAgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKC13aWR0aCAvIDIsIE1hdGgubWF4KGdldFNjcm9sbFJhbmdlKCksIHNjcm9sbFkpICsgaGVpZ2h0KTsKLSAgICAgICAgICAgICAgICBjYW52YXMucm90YXRlKDE4MCwgd2lkdGgsIDApOwotICAgICAgICAgICAgICAgIG1FZGdlR2xvd0JvdHRvbS5zZXRTaXplKHdpZHRoICogMiwgaGVpZ2h0KTsKLSAgICAgICAgICAgICAgICBpZiAobUVkZ2VHbG93Qm90dG9tLmRyYXcoY2FudmFzKSkgewotICAgICAgICAgICAgICAgICAgICBpbnZhbGlkYXRlKCk7Ci0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ciB7CisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgU3RyaW5nIFRBRyA9ICJTcGlubmVyIjsKICAgICAKLSAgICBwcml2YXRlIENoYXJTZXF1ZW5jZSBtUHJvbXB0OwotICAgIHByaXZhdGUgQWxlcnREaWFsb2cgbVBvcHVwOworICAgIC8qKgorICAgICAqIFVzZSBhIGRpYWxvZyB3aW5kb3cgZm9yIHNlbGVjdGluZyBzcGlubmVyIG9wdGlvbnMuCisgICAgICovCisgICAgcHVibGljIHN0YXRpYyBmaW5hbCBpbnQgTU9ERV9ESUFMT0cgPSAwOworICAgIAorICAgIC8qKgorICAgICAqIFVzZSBhIGRyb3Bkb3duIGFuY2hvcmVkIHRvIHRoZSBTcGlubmVyIGZvciBzZWxlY3Rpbmcgc3Bpbm5lciBvcHRpb25zLgorICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IE1PREVfRFJPUERPV04gPSAxOworICAgIAorICAgIC8qKgorICAgICAqIFVzZSB0aGUgdGhlbWUtc3VwcGxpZWQgdmFsdWUgdG8gc2VsZWN0IHRoZSBkcm9wZG93biBtb2RlLgorICAgICAqLworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBNT0RFX1RIRU1FID0gLTE7CisgICAgCisgICAgcHJpdmF0ZSBTcGlubmVyUG9wdXAgbVBvcHVwOworICAgIHByaXZhdGUgRHJvcERvd25BZGFwdGVyIG1UZW1wQWRhcHRlcjsKIAorICAgIC8qKgorICAgICAqIENvbnN0cnVjdCBhIG5ldyBzcGlubmVyIHdpdGggdGhlIGdpdmVuIGNvbnRleHQncyB0aGVtZS4KKyAgICAgKgorICAgICAqIEBwYXJhbSBjb250ZXh0IFRoZSBDb250ZXh0IHRoZSB2aWV3IGlzIHJ1bm5pbmcgaW4sIHRocm91Z2ggd2hpY2ggaXQgY2FuCisgICAgICogICAgICAgIGFjY2VzcyB0aGUgY3VycmVudCB0aGVtZSwgcmVzb3VyY2VzLCBldGMuCisgICAgICovC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VybmFsLlIuc3R5bGVhYmxlLlNwaW5uZXJfc3Bpbm5lck1vZGUsIE1PREVfRElBTE9HKTsKKyAgICAgICAgfQogICAgICAgICAKLSAgICAgICAgbVByb21wdCA9IGEuZ2V0U3RyaW5nKGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLlNwaW5uZXJfcHJvbXB0KTsKKyAgICAgICAgc3dpdGNoIChtb2RlKSB7CisgICAgICAgIGNhc2UgTU9ERV9ESUFMT0c6IHsKKyAgICAgICAgICAgIG1Qb3B1cCA9IG5ldyBEaWFsb2dQb3B1cCgpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKworICAgICAgICBjYXNlIE1PREVfRFJPUERPV046IHsKKyAgICAgICAgICAgIGZpbmFsIGludCBoaW50UmVzb3VyY2UgPSBhLmdldFJlc291cmNlSWQoCisgICAgICAgICAgICAgICAgICAgIGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLlNwaW5uZXJfcG9wdXBQcm9tcHRWaWV3LCAwKTsKKworICAgICAgICAgICAgRHJvcGRvd25Qb3B1cCBwb3B1cCA9IG5ldyBEcm9wZG93blBvcHVwKGNvbnRleHQsIGF0dHJzLCBkZWZTdHlsZSwgaGludFJlc291cmNlKTsKKworICAgICAgICAgICAgcG9wdXAuc2V0QmFja2dyb3VuZERyYXdhYmxlKGEuZ2V0RHJhd2FibGUoCisgICAgICAgICAgICAgICAgICAgIGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLlNwaW5uZXJfcG9wdXBCYWNrZ3JvdW5kKSk7CisgICAgICAgICAgICBwb3B1cC5zZXRWZXJ0aWNhbE9mZnNldChhLmdldERpbWVuc2lvblBpeGVsT2Zmc2V0KAorICAgICAgICAgICAgICAgICAgICBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5TcGlubmVyX2Ryb3BEb3duVmVydGljYWxPZmZzZXQsIDApKTsKKyAgICAgICAgICAgIHBvcHVwLnNldEhvcml6b250YWxPZmZzZXQoYS5nZXREaW1lbnNpb25QaXhlbE9mZnNldCgKKyAgICAgICAgICAgICAgICAgICAgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuU3Bpbm5lcl9kcm9wRG93bkhvcml6b250YWxPZmZzZXQsIDApKTsKKworICAgICAgICAgICAgbVBvcHVwID0gcG9wdXA7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIAorICAgICAgICBtUG9wdXAuc2V0UHJvbXB0VGV4dChhLmdldFN0cmluZyhjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5TcGlubmVyX3Byb21wdCkpOwogCiAgICAgICAgIGEucmVjeWNsZSgpOworCisgICAgICAgIC8vIEJhc2UgY29uc3RydWN0b3IgY2FuIGNhbGwgc2V0QWRhcHRlciBiZWZvcmUgd2UgaW5pdGlhbGl6ZSBtUG9wdXAuCisgICAgICAgIC8vIEZpbmlzaCBzZXR0aW5nIHRoaW5ncyB1cCBpZiB0aGlzIGhhcHBlbmVkLgorICAgICAgICBpZiAobVRlbXBBZGFwdGVyICE9IG51bGwpIHsKKyAgICAgICAgICAgIG1Qb3B1cC5zZXRBZGFwdGVyKG1UZW1wQWRhcHRlcik7CisgICAgICAgICAgICBtVGVtcEFkYXB0ZXIgPSBudWxsOworICAgICAgICB9CisgICAgfQorICAgIAorICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIHNldEFkYXB0ZXIoU3Bpbm5lckFkYXB0ZXIgYWRhcHRlcikgeworICAgICAgICBzdXBlci5zZXRBZGFwdGVyKGFkYXB0ZXIpOworCisgICAgICAgIGlmIChtUG9wdXAgIT0gbnVsbCkgeworICAgICAgICAgICAgbVBvcHVwLnNldEFkYXB0ZXIobmV3IERyb3BEb3duQWRhcHRlcihhZGFwdGVyKSk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBtVGVtcEFkYXB0ZXIgPSBuZXcgRHJvcERvd25BZGFwdGVyKGFkYXB0ZXIpOworICAgICAgICB9CiAgICAgfQogCiAgICAgQE92ZXJyaWRlCkBAIC04Nyw3ICsyMTIsNiBAQAogICAgICAgICAKICAgICAgICAgaWYgKG1Qb3B1cCAhPSBudWxsICYmIG1Qb3B1cC5pc1Nob3dpbmcoKSkgewogICAgICAgICAgICAgbVBvcHVwLmRpc21pc3MoKTsKLSAgICAgICAgICAgIG1Qb3B1cCA9IG51bGw7CiAgICAgICAgIH0KICAgICB9CiAKQEAgLTE5Nyw4ICszMjEsNiBAQAogICAgICAgICByZXR1cm4gY2hpbGQ7CiAgICAgfQogCi0KLQogICAgIC8qKgogICAgICAqIEhlbHBlciBmb3IgbWFrZUFuZEFkZFZpZXcgdG8gc2V0IHRoZSBwb3NpdGlvbiBvZiBhIHZpZXcKICAgICAgKiBhbmQgZmlsbCBvdXQgaXRzIGxheW91dCBwYXJhbXRlcnMuCkBAIC0yNDksMTUgKzM3MSwxMCBAQAogICAgICAgICAKICAgICAgICAgaWYgKCFoYW5kbGVkKSB7CiAgICAgICAgICAgICBoYW5kbGVkID0gdHJ1ZTsKLSAgICAgICAgICAgIENvbnRleHQgY29udGV4dCA9IGdldENvbnRleHQoKTsKLSAgICAgICAgICAgIAotICAgICAgICAgICAgZmluYWwgRHJvcERvd25BZGFwdGVyIGFkYXB0ZXIgPSBuZXcgRHJvcERvd25BZGFwdGVyKGdldEFkYXB0ZXIoKSk7CiAKLSAgICAgICAgICAgIEFsZXJ0RGlhbG9nLkJ1aWxkZXIgYnVpbGRlciA9IG5ldyBBbGVydERpYWxvZy5CdWlsZGVyKGNvbnRleHQpOwotICAgICAgICAgICAgaWYgKG1Qcm9tcHQgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIGJ1aWxkZXIuc2V0VGl0bGUobVByb21wdCk7CisgICAgICAgICAgICBpZiAoIW1Qb3B1cC5pc1Nob3dpbmcoKSkgeworICAgICAgICAgICAgICAgIG1Qb3B1cC5zaG93KCk7CiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICBtUG9wdXAgPSBidWlsZGVyLnNldFNpbmdsZUNob2ljZUl0ZW1zKGFkYXB0ZXIsIGdldFNlbGVjdGVkSXRlbVBvc2l0aW9uKCksIHRoaXMpLnNob3coKTsKICAgICAgICAgfQogCiAgICAgICAgIHJldHVybiBoYW5kbGVkOwpAQCAtMjY2LDcgKzM4Myw2IEBACiAgICAgcHVibGljIHZvaWQgb25DbGljayhEaWFsb2dJbnRlcmZhY2UgZGlhbG9nLCBpbnQgd2hpY2gpIHsKICAgICAgICAgc2V0U2VsZWN0aW9uKHdoaWNoKTsKICAgICAgICAgZGlhbG9nLmRpc21pc3MoKTsKLSAgICAgICAgbVBvcHVwID0gbnVsbDsKICAgICB9CiAKICAgICAvKioKQEAgLTI3NCw3ICszOTAsNyBAQAogICAgICAqIEBwYXJhbSBwcm9tcHQgdGhlIHByb21wdCB0byBzZXQKICAgICAgKi8KICAgICBwdWJsaWMgdm9pZCBzZXRQcm9tcHQoQ2hhclNlcXVlbmNlIHByb21wdCkgewotICAgICAgICBtUHJvbXB0ID0gcHJvbXB0OworICAgICAgICBtUG9wdXAuc2V0UHJvbXB0VGV4dChwcm9tcHQpOwogICAgIH0KIAogICAgIC8qKgpAQCAtMjgyLDE0ICszOTgsMTQgQEAKICAgICAgKiBAcGFyYW0gcHJvbXB0SWQgdGhlIHJlc291cmNlIElEIG9mIHRoZSBwcm9tcHQgdG8gZGlzcGxheSB3aGVuIHRoZSBkaWFsb2cgaXMgc2hvd24KICAgICAgKi8KICAgICBwdWJsaWMgdm9pZCBzZXRQcm9tcHRJZChpbnQgcHJvbXB0SWQpIHsKLSAgICAgICAgbVByb21wdCA9IGdldENvbnRleHQoKS5nZXRUZXh0KHByb21wdElkKTsKKyAgICAgICAgc2V0UHJvbXB0KGdldENvbnRleHQoKS5nZXRUZXh0KHByb21wdElkKSk7CiAgICAgfQogCiAgICAgLyoqCiAgICAgICogQHJldHVybiBUaGUgcHJvbXB0IHRvIGRpc3BsYXkgd2hlbiB0aGUgZGlhbG9nIGlzIHNob3duCiAgICAgICovCiAgICAgcHVibGljIENoYXJTZXF1ZW5jZSBnZXRQcm9tcHQoKSB7Ci0gICAgICAgIHJldHVybiBtUHJvbXB0OworICAgICAgICByZXR1cm4gbVBvcHVwLmdldEhpbnRUZXh0KCk7CiAgICAgfQogICAgIAogICAgIC8qKgpAQCAtMzg3LDQgKzUwMywxMjQgQEAKICAgICAgICAgICAgIHJldHVybiBnZXRDb3VudCgpID09IDA7CiAgICAgICAgIH0KICAgICB9CisgICAgCisgICAgLyoqCisgICAgICogSW1wbGVtZW50cyBzb21lIHNvcnQgb2YgcG9wdXAgc2VsZWN0aW9uIGludGVyZmFjZSBmb3Igc2VsZWN0aW5nIGEgc3Bpbm5lciBvcHRpb24uCisgICAgICogQWxsb3dzIGZvciBkaWZmZXJlbnQgc3Bpbm5lciBtb2Rlcy4KKyAgICAgKi8KKyAgICBwcml2YXRlIGludGVyZmFjZSBTcGlubmVyUG9wdXAgeworICAgICAgICBwdWJsaWMgdm9pZCBzZXRBZGFwdGVyKExpc3RBZGFwdGVyIGFkYXB0ZXIpOworICAgICAgICAKKyAgICAgICAgLyoqCisgICAgICAgICAqIFNob3cgdGhlIHBvcHVwCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgdm9pZCBzaG93KCk7CisgICAgICAgIAorICAgICAgICAvKioKKyAgICAgICAgICogRGlzbWlzcyB0aGUgcG9wdXAKKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyB2b2lkIGRpc21pc3MoKTsKKyAgICAgICAgCisgICAgICAgIC8qKgorICAgICAgICAgKiBAcmV0dXJuIHRydWUgaWYgdGhlIHBvcHVwIGlzIHNob3dpbmcsIGZhbHNlIG90aGVyd2lzZS4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBib29sZWFuIGlzU2hvd2luZygpOworICAgICAgICAKKyAgICAgICAgLyoqCisgICAgICAgICAqIFNldCBoaW50IHRleHQgdG8gYmUgZGlzcGxheWVkIHRvIHRoZSB1c2VyLiBUaGlzIHNob3VsZCBwcm92aWRlCisgICAgICAgICAqIGEgZGVzY3JpcHRpb24gb2YgdGhlIGNob2ljZSBiZWluZyBtYWRlLgorICAgICAgICAgKiBAcGFyYW0gaGludFRleHQgSGludCB0ZXh0IHRvIHNldC4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyB2b2lkIHNldFByb21wdFRleHQoQ2hhclNlcXVlbmNlIGhpbnRUZXh0KTsKKyAgICAgICAgcHVibGljIENoYXJTZXF1ZW5jZSBnZXRIaW50VGV4dCgpOworICAgIH0KKyAgICAKKyAgICBwcml2YXRlIGNsYXNzIERpYWxvZ1BvcHVwIGltcGxlbWVudHMgU3Bpbm5lclBvcHVwLCBEaWFsb2dJbnRlcmZhY2UuT25DbGlja0xpc3RlbmVyIHsKKyAgICAgICAgcHJpdmF0ZSBBbGVydERpYWxvZyBtUG9wdXA7CisgICAgICAgIHByaXZhdGUgTGlzdEFkYXB0ZXIgbUxpc3RBZGFwdGVyOworICAgICAgICBwcml2YXRlIENoYXJTZXF1ZW5jZSBtUHJvbXB0OworCisgICAgICAgIHB1YmxpYyB2b2lkIGRpc21pc3MoKSB7CisgICAgICAgICAgICBtUG9wdXAuZGlzbWlzcygpOworICAgICAgICAgICAgbVBvcHVwID0gbnVsbDsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBib29sZWFuIGlzU2hvd2luZygpIHsKKyAgICAgICAgICAgIHJldHVybiBtUG9wdXAgIT0gbnVsbCA/IG1Qb3B1cC5pc1Nob3dpbmcoKSA6IGZhbHNlOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgc2V0QWRhcHRlcihMaXN0QWRhcHRlciBhZGFwdGVyKSB7CisgICAgICAgICAgICBtTGlzdEFkYXB0ZXIgPSBhZGFwdGVyOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgc2V0UHJvbXB0VGV4dChDaGFyU2VxdWVuY2UgaGludFRleHQpIHsKKyAgICAgICAgICAgIG1Qcm9tcHQgPSBoaW50VGV4dDsKKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgcHVibGljIENoYXJTZXF1ZW5jZSBnZXRIaW50VGV4dCgpIHsKKyAgICAgICAgICAgIHJldHVybiBtUHJvbXB0OworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgc2hvdygpIHsKKyAgICAgICAgICAgIEFsZXJ0RGlhbG9nLkJ1aWxkZXIgYnVpbGRlciA9IG5ldyBBbGVydERpYWxvZy5CdWlsZGVyKGdldENvbnRleHQoKSk7CisgICAgICAgICAgICBpZiAobVByb21wdCAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgYnVpbGRlci5zZXRUaXRsZShtUHJvbXB0KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1Qb3B1cCA9IGJ1aWxkZXIuc2V0U2luZ2xlQ2hvaWNlSXRlbXMobUxpc3RBZGFwdGVyLAorICAgICAgICAgICAgICAgICAgICBnZXRTZWxlY3RlZEl0ZW1Qb3NpdGlvbigpLCB0aGlzKS5zaG93KCk7CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIHB1YmxpYyB2b2lkIG9uQ2xpY2soRGlhbG9nSW50ZXJmYWNlIGRpYWxvZywgaW50IHdoaWNoKSB7CisgICAgICAgICAgICBzZXRTZWxlY3Rpb24od2hpY2gpOworICAgICAgICAgICAgZGlzbWlzcygpOworICAgICAgICB9CisgICAgfQorICAgIAorICAgIHByaXZhdGUgY2xhc3MgRHJvcGRvd25Qb3B1cCBleHRlbmRzIExpc3RQb3B1cFdpbmRvdyBpbXBsZW1lbnRzIFNwaW5uZXJQb3B1cCB7CisgICAgICAgIHByaXZhdGUgQ2hhclNlcXVlbmNlIG1IaW50VGV4dDsKKyAgICAgICAgcHJpdmF0ZSBUZXh0VmlldyBtSGludFZpZXc7CisgICAgICAgIHByaXZhdGUgaW50IG1IaW50UmVzb3VyY2U7CisgICAgICAgIAorICAgICAgICBwdWJsaWMgRHJvcGRvd25Qb3B1cChDb250ZXh0IGNvbnRleHQsIEF0dHJpYnV0ZVNldCBhdHRycywKKyAgICAgICAgICAgICAgICBpbnQgZGVmU3R5bGVSZXMsIGludCBoaW50UmVzb3VyY2UpIHsKKyAgICAgICAgICAgIHN1cGVyKGNvbnRleHQsIGF0dHJzLCAwLCBkZWZTdHlsZVJlcyk7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIG1IaW50UmVzb3VyY2UgPSBoaW50UmVzb3VyY2U7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIHNldEFuY2hvclZpZXcoU3Bpbm5lci50aGlzKTsKKyAgICAgICAgICAgIHNldE1vZGFsKHRydWUpOworICAgICAgICAgICAgc2V0UHJvbXB0UG9zaXRpb24oUE9TSVRJT05fUFJPTVBUX0JFTE9XKTsKKyAgICAgICAgICAgIHNldE9uSXRlbUNsaWNrTGlzdGVuZXIobmV3IE9uSXRlbUNsaWNrTGlzdGVuZXIoKSB7CisgICAgICAgICAgICAgICAgcHVibGljIHZvaWQgb25JdGVtQ2xpY2soQWRhcHRlclZpZXcgcGFyZW50LCBWaWV3IHYsIGludCBwb3NpdGlvbiwgbG9uZyBpZCkgeworICAgICAgICAgICAgICAgICAgICBTcGlubmVyLnRoaXMuc2V0U2VsZWN0aW9uKHBvc2l0aW9uKTsKKyAgICAgICAgICAgICAgICAgICAgZGlzbWlzcygpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0pOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICBwdWJsaWMgQ2hhclNlcXVlbmNlIGdldEhpbnRUZXh0KCkgeworICAgICAgICAgICAgcmV0dXJuIG1IaW50VGV4dDsKKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgcHVibGljIHZvaWQgc2V0UHJvbXB0VGV4dChDaGFyU2VxdWVuY2UgaGludFRleHQpIHsKKyAgICAgICAgICAgIG1IaW50VGV4dCA9IGhpbnRUZXh0OworICAgICAgICAgICAgaWYgKG1IaW50VmlldyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgbUhpbnRWaWV3LnNldFRleHQoaGludFRleHQpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIHNob3coKSB7CisgICAgICAgICAgICBpZiAobUhpbnRWaWV3ID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICBmaW5hbCBUZXh0VmlldyB0ZXh0VmlldyA9IChUZXh0VmlldykgTGF5b3V0SW5mbGF0ZXIuZnJvbShnZXRDb250ZXh0KCkpLmluZmxhdGUoCisgICAgICAgICAgICAgICAgICAgICAgICBtSGludFJlc291cmNlLCBudWxsKS5maW5kVmlld0J5SWQoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5pZC50ZXh0MSk7CisgICAgICAgICAgICAgICAgdGV4dFZpZXcuc2V0VGV4dChtSGludFRleHQpOworICAgICAgICAgICAgICAgIHNldFByb21wdFZpZXcodGV4dFZpZXcpOworICAgICAgICAgICAgICAgIG1IaW50VmlldyA9IHRleHRWaWV3OworICAgICAgICAgICAgfQorICAgICAgICAgICAgc3VwZXIuc2hvdygpOworICAgICAgICAgICAgZ2V0TGlzdFZpZXcoKS5zZXRDaG9pY2VNb2RlKExpc3RWaWV3LkNIT0lDRV9NT0RFX1NJTkdMRSk7CisgICAgICAgICAgICBzZXRTZWxlY3Rpb24oU3Bpbm5lci50aGlzLmdldFNlbGVjdGVkSXRlbVBvc2l0aW9uKCkpOworICAgICAgICB9CisgICAgfQogfQpkaWZmIC0tZ2l0IGEvY29yZS9qYXZhL2FuZHJvaWQvd2lkZ2V0L1N0YWNrVmlldy5qYXZhIGIvY29yZS9qYXZhL2FuZHJvaWQvd2lkZ2V0L1N0YWNrVmlldy5qYXZhCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLjkwMjViODMK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aW5rIEFkYXB0ZXJWaWV3QW5pbWF0b3J9CisgICAgICovCisgICAgdm9pZCBhbmltYXRlVmlld0ZvclRyYW5zaXRpb24oaW50IGZyb21JbmRleCwgaW50IHRvSW5kZXgsIFZpZXcgdmlldykgeworICAgICAgICBpZiAoZnJvbUluZGV4ID09IC0xICYmIHRvSW5kZXggPT0gMCkgeworICAgICAgICAgICAgLy8gRmFkZSBpdGVtIGluCisgICAgICAgICAgICBpZiAodmlldy5nZXRBbHBoYSgpID09IDEpIHsKKyAgICAgICAgICAgICAgICB2aWV3LnNldEFscGhhKDApOworICAgICAgICAgICAgfQorICAgICAgICAgICAgdmlldy5zZXRWaXNpYmlsaXR5KFZJU0lCTEUpOworCisgICAgICAgICAgICBQcm9wZXJ0eUFuaW1hdG9yPEZsb2F0PiBmYWRlSW4gPSBuZXcgUHJvcGVydHlBbmltYXRvcjxGbG9hdD4oREVGQVVMVF9BTklNQVRJT05fRFVSQVRJT04sCisgICAgICAgICAgICAgICAgICAgIHZpZXcsICJhbHBoYSIsIHZpZXcuZ2V0QWxwaGEoKSwgMS4wZik7CisgICAgICAgICAgICBmYWRlSW4uc3RhcnQoKTsKKyAgICAgICAgfSBlbHNlIGlmIChmcm9tSW5kZXggPT0gbU51bUFjdGl2ZVZpZXdzIC0gMSAmJiB0b0luZGV4ID09IG1OdW1BY3RpdmVWaWV3cyAtIDIpIHsKKyAgICAgICAgICAgIC8vIFNsaWRlIGl0ZW0gaW4KKyAgICAgICAgICAgIHZpZXcuc2V0VmlzaWJpbGl0eShWSVNJQkxFKTsKKworICAgICAgICAgICAgTGF5b3V0UGFyYW1zIGxwID0gKExheW91dFBhcmFtcykgdmlldy5nZXRMYXlvdXRQYXJhbXMoKTsKKyAgICAgICAgICAgIGludCBkdXJhdGlvbiA9IE1hdGgucm91bmQobVN0YWNrU2xpZGVyLmdldER1cmF0aW9uRm9yTmV1dHJhbFBvc2l0aW9uKG1ZVmVsb2NpdHkpKTsKKworICAgICAgICAgICAgU3R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JlYWs7CisgICAgICAgICAgICAgICAgdmcgPSAoVmlld0dyb3VwKSB2Zy5nZXRQYXJlbnQoKTsKKyAgICAgICAgICAgICAgICB2Zy5zZXRDbGlwQ2hpbGRyZW4oZmFsc2UpOworICAgICAgICAgICAgICAgIHZnLnNldENsaXBUb1BhZGRpbmcoZmFsc2UpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIG9uTGF5b3V0KCkgeworICAgICAgICBpZiAoIW1GaXJzdExheW91dEhhcHBlbmVkKSB7CisgICAgICAgICAgICBtVmlld0hlaWdodCA9IE1hdGgucm91bmQoU0xJREVfVVBfUkFUSU8gKiBnZXRNZWFzdXJlZEhlaWdodCgpKTsKKyAgICAgICAgICAgIG1Td2lwZVRocmVzaG9sZCA9IE1hdGgucm91bmQoU1dJUEVfVEhSRVNIT0xEX1JBVElPICogbVZpZXdIZWlnaHQpOworICAgICAgICAgICAgbUZpcnN0TGF5b3V0SGFwcGVuZWQgPSB0cnVlOworICAgICAgICB9CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIGJvb2xlYW4gb25JbnRlcmNlcHRUb3VjaEV2ZW50KE1vdGlvbkV2ZW50IGV2KSB7CisgICAgICAgIGludCBhY3Rpb24gPSBldi5nZXRBY3Rpb24oKTsKKyAgICAgICAgc3dpdGNoKGFjdGlvbiAmIE1vdGlvbkV2ZW50LkFDVElPTl9NQVNLKSB7CisgICAgICAgICAgICBjYXNlIE1vdGlvbkV2ZW50LkFDVElPTl9ET1dOOiB7CisgICAgICAgICAgICAgICAgaWYgKG1BY3RpdmVQb2ludGVySWQgPT0gSU5WQUxJRF9QT0lOVEVSKSB7CisgICAgICAgICAgICAgICAgICAgIG1Jbml0aWFsWCA9IGV2LmdldFgoKTsKKyAgICAgICAgICAgICAgICAgICAgbUluaXRpYWxZID0gZXYuZ2V0WSgpOworICAgICAgICAgICAgICAgICAgICBtQWN0aXZlUG9pbnRlcklkID0gZXYuZ2V0UG9pbnRlcklkKDApOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhc2UgTW90aW9uRXZlbnQuQUNUSU9OX01PVkU6IHsKKyAgICAgICAgICAgICAgICBpbnQgcG9pbnRlckluZGV4ID0gZXYuZmluZFBvaW50ZXJJbmRleChtQWN0aXZlUG9pbnRlcklkKTsKKyAgICAgICAgICAgICAgICBpZiAocG9pbnRlckluZGV4ID09IElOVkFMSURfUE9JTlRFUikgeworICAgICAgICAgICAgICAgICAgICAvLyBubyBkYXRhIGZvciBvdXIgcHJpbWFyeSBwb2ludGVyLCB0aGlzIHNob3VsZG4ndCBoYXBwZW4sIGxvZyBpdAorICAgICAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJFcnJvcjogTm8gZGF0YSBmb3Igb3VyIHByaW1hcnkgcG9pbnRlci4iKTsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBmbG9hdCBuZXdZID0gZXYuZ2V0WShwb2ludGVySW5kZXgpOworICAgICAgICAgICAgICAgIGZsb2F0IGRlbHRhWSA9IG5ld1kgLSBtSW5pdGlhbFk7CisKKyAgICAgICAgICAgICAgICBiZWdpbkdlc3R1cmVJZk5lZWRlZChkZWx0YVkpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSBNb3Rpb25FdmVudC5BQ1RJT05fUE9JTlRFUl9VUDogeworICAgICAgICAgICAgICAgIG9uU2Vjb25kYXJ5UG9pbnRlclVwKGV2KTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhc2UgTW90aW9uRXZlbnQuQUNUSU9OX1VQOgorICAgICAgICAgICAgY2FzZSBNb3Rpb25FdmVudC5BQ1RJT05fQ0FOQ0VMOiB7CisgICAgICAgICAgICAgICAgbUFjdGl2ZVBvaW50ZXJJZCA9IElOVkFMSURfUE9JTlRFUjsKKyAgICAgICAgICAgICAgICBtU3dpcGVHZXN0dXJlVHlwZSA9IEdFU1RVUkVfTk9ORTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiBtU3dpcGVHZXN0dXJlVHlwZSAhPSBHRVNUVVJFX05PTkU7CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIGJlZ2luR2VzdHVyZUlmTmVlZGVkKGZsb2F0IGRlbHRhWSkgeworICAgICAgICBpZiAoKGludCkgTWF0aC5hYnMoZGVsdGFZKSA+IG1Ub3VjaFNsb3AgJiYgbVN3aXBlR2VzdHVyZVR5cGUgPT0gR0VTVFVSRV9OT05FKSB7CisgICAgICAgICAgICBpbnQgc3dpcGVHZXN0dXJlVHlwZSA9IGRlbHRhWSA8IDAgPyBHRVNUVVJFX1NMSURFX1VQIDogR0VTVFVSRV9TTElERV9ET1dOOworICAgICAgICAgICAgY2FuY2VsTG9uZ1ByZXNzKCk7CisgICAgICAgICAgICByZXF1ZXN0RGlzYWxsb3dJbnRlcmNlcHRUb3VjaEV2ZW50KHRydWUpOworCisgICAgICAgICAgICBpbnQgYWN0aXZlSW5kZXg7CisgICAgICAgICAgICBpZiAobVN0YWNrTW9kZSA9PSBJVEVNU19TTElERV9VUCkgeworICAgICAgICAgICAgICAgIGFjdGl2ZUluZGV4ID0gKHN3aXBlR2VzdHVyZVR5cGUgPT0gR0VTVFVSRV9TTElERV9ET1dOKSA/CisgICAgICAgICAgICAgICAgICAgICAgICBtTnVtQWN0aXZlVmlld3MgLSAxIDogbU51bUFjdGl2ZVZpZXdzIC0gMjsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgYWN0aXZlSW5kZXggPSAoc3dpcGVHZXN0dXJlVHlwZSA9PSBHRVNUVVJFX1NMSURFX0RPV04pID8KKyAgICAgICAgICAgICAgICAgICAgICAgIG1OdW1BY3RpdmVWaWV3cyAtIDIgOiBtTnVtQWN0aXZlVmlld3MgLSAxOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAobUFkYXB0ZXIgPT0gbnVsbCkgcmV0dXJuOworCisgICAgICAgICAgICBpZiAobUN1cnJlbnRXaW5kb3dTdGFydFVuYm91bmRlZCArIGFjdGl2ZUluZGV4ID09IDApIHsKKyAgICAgICAgICAgICAgICBtU3RhY2tTbGlkZXIuc2V0TW9kZShTdGFja1NsaWRlci5CRUdJTk5JTkdfT0ZfU1RBQ0tfTU9ERSk7CisgICAgICAgICAgICB9IGVsc2UgaWYgKG1DdXJyZW50V2luZG93U3RhcnRVbmJvdW5kZWQgKyBhY3RpdmVJbmRleCA9PSBtQWRhcHRlci5nZXRDb3VudCgpKSB7CisgICAgICAgICAgICAgICAgYWN0aXZlSW5kZXgtLTsKKyAgICAgICAgICAgICAgICBtU3RhY2tTbGlkZXIuc2V0TW9kZShTdGFja1NsaWRlci5FTkRfT0ZfU1RBQ0tfTU9ERSk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIG1TdGFja1NsaWRlci5zZXRNb2RlKFN0YWNrU2xpZGVyLk5PUk1BTF9NT0RFKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgVmlldyB2ID0gZ2V0Vmlld0F0UmVsYXRpdmVJbmRleChhY3RpdmVJbmRleCk7CisgICAgICAgICAgICBpZiAodiA9PSBudWxsKSByZXR1cm47CisKKyAgICAgICAgICAgIG1IaWdobGlnaHQuc2V0SW1hZ2VCaXRtYXAoc0hvbG9ncmFwaGljSGVscGVyLmNyZWF0ZU91dGxpbmUodikpOworICAgICAgICAgICAgbUhpZ2hsaWdodC5zZXRSb3RhdGlvbih2LmdldFJvdGF0aW9uKCkpOworICAgICAgICAgICAgbUhpZ2hsaWdodC5zZXRUcmFuc2xhdGlvblkodi5nZXRUcmFuc2xhdGlvblkoKSk7CisgICAgICAgICAgICBtSGl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BvaW50ZXJJbmRleCk7CisgICAgICAgIGZsb2F0IGRlbHRhWSA9IG5ld1kgLSBtSW5pdGlhbFk7CisgICAgICAgIGZsb2F0IGRlbHRhWCA9IG5ld1ggLSBtSW5pdGlhbFg7CisgICAgICAgIGlmIChtVmVsb2NpdHlUcmFja2VyID09IG51bGwpIHsKKyAgICAgICAgICAgIG1WZWxvY2l0eVRyYWNrZXIgPSBWZWxvY2l0eVRyYWNrZXIub2J0YWluKCk7CisgICAgICAgIH0KKyAgICAgICAgbVZlbG9jaXR5VHJhY2tlci5hZGRNb3ZlbWVudChldik7CisKKyAgICAgICAgc3dpdGNoIChhY3Rpb24gJiBNb3Rpb25FdmVudC5BQ1RJT05fTUFTSykgeworICAgICAgICAgICAgY2FzZSBNb3Rpb25FdmVudC5BQ1RJT05fTU9WRTogeworICAgICAgICAgICAgICAgIGJlZ2luR2VzdHVyZUlmTmVlZGVkKGRlbHRhWSk7CisKKyAgICAgICAgICAgICAgICBmbG9hdCByeCA9IGRlbHRhWCAvIChtVmlld0hlaWdodCAqIDEuMGYpOworICAgICAgICAgICAgICAgIGlmIChtU3dpcGVHZXN0dXJlVHlwZSA9PSBHRVNUVVJFX1NMSURFX0RPV04pIHsKKyAgICAgICAgICAgICAgICAgICAgZmxvYXQgciA9IChkZWx0YVkgLSBtVG91Y2hTbG9wICogMS4wZikgLyBtVmlld0hlaWdodCAqIDEuMGY7CisgICAgICAgICAgICAgICAgICAgIGlmIChtU3RhY2tNb2RlID09IElURU1TX1NMSURFX0RPV04pIHIgPSAxIC0gcjsKKyAgICAgICAgICAgICAgICAgICAgbVN0YWNrU2xpZGVyLnNldFlQcm9ncmVzcygxIC0gcik7CisgICAgICAgICAgICAgICAgICAgIG1TdGFja1NsaWRlci5zZXRYUHJvZ3Jlc3MocngpOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKG1Td2lwZUdlc3R1cmVUeXBlID09IEdFU1RVUkVfU0xJREVfVVApIHsKKyAgICAgICAgICAgICAgICAgICAgZmxvYXQgciA9IC0oZGVsdGFZICsgbVRvdWNoU2xvcCAqIDEuMGYpIC8gbVZpZXdIZWlnaHQgKiAxLjBmOworICAgICAgICAgICAgICAgICAgICBpZiAobVN0YWNrTW9kZSA9PSBJVEVNU19TTElERV9ET1dOKSByID0gMSAtIHI7CisgICAgICAgICAgICAgICAgICAgIG1TdGFja1NsaWRlci5zZXRZUHJvZ3Jlc3Mocik7CisgICAgICAgICAgICAgICAgICAgIG1TdGFja1NsaWRlci5zZXRYUHJvZ3Jlc3MocngpOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXNlIE1vdGlvbkV2ZW50LkFDVElPTl9VUDogeworICAgICAgICAgICAgICAgIGhhbmRsZVBvaW50ZXJVcChldik7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXNlIE1vdGlvbkV2ZW50LkFDVElPTl9QT0lOVEVSX1VQOiB7CisgICAgICAgICAgICAgICAgb25TZWNvbmRhcnlQb2ludGVyVXAoZXYpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSBNb3Rpb25FdmVudC5BQ1RJT05fQ0FOQ0VMOiB7CisgICAgICAgICAgICAgICAgbUFjdGl2ZVBvaW50ZXJJZCA9IElOVkFMSURfUE9JTlRFUjsKKyAgICAgICAgICAgICAgICBtU3dpcGVHZXN0dXJlVHlwZSA9IEdFU1RVUkVfTk9ORTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICB9CisKKyAgICBwcml2YXRlIGZpbmFsIFJlY3QgdG91Y2hSZWN0ID0gbmV3IFJlY3QoKTsKKyAgICBwcml2YXRlIHZvaWQgb25TZWNvbmRhcnlQb2ludGVyVXAoTW90aW9uRXZlbnQgZXYpIHsKKyAgICAgICAgZmluYWwgaW50IGFjdGl2ZVBvaW50ZXJJbmRleCA9IGV2LmdldEFjdGlvbkluZGV4KCk7CisgICAgICAgIGZpbmFsIGludCBwb2ludGVySWQgPSBldi5nZXRQb2ludGVySWQoYWN0aXZlUG9pbnRlckluZGV4KTsKKyAgICAgICAgaWYgKHBvaW50ZXJJZCA9PSBtQWN0aXZlUG9pbnRlcklkKSB7CisKKyAgICAgICAgICAgIGludCBhY3RpdmVWaWV3SW5kZXggPSAobVN3aXBlR2VzdHVyZVR5cGUgPT0gR0VTVFVSRV9TTElERV9ET1dOKSA/IG1OdW1BY3RpdmVWaWV3cyAtIDEKKyAgICAgICAgICAgICAgICAgICAgOiBtTnVtQWN0aXZlVmlld3MgLSAyOworCisgICAgICAgICAgICBWaWV3IHYgPSBnZXRWaWV3QXRSZWxhdGl2ZUluZGV4KGFjdGl2ZVZpZXdJbmRleCk7CisgICAgICAgICAgICBpZiAodiA9PSBudWxsKSByZXR1cm47CisKKyAgICAgICAgICAgIC8vIE91ciBwcmltYXJ5IHBvaW50ZXIgaGFzIGdvbmUgdXAgLS0gbGV0J3Mgc2VlIGlmIHdlIGNhbiBmaW5kCisgICAgICAgICAgICAvLyBhbm90aGVyIHBvaW50ZXIgb24gdGhlIHZpZXcuIElmIHNvLCB0aGVuIHdlIHNob3VsZCByZXBsYWNlCisgICAgICAgICAgICAvLyBvdXIgcHJpbWFyeSBwb2ludGVyIHdpdGggdGhpcyBuZXcgcG9pbnRlciBhbmQgYWRqdXN0IHRoaW5ncworICAgICAgICAgICAgLy8gc28gdGhhdCB0aGUgdmlldyBkb2Vzbid0IGp1bXAKKyAgICAgICAgICAgIGZvciAoaW50IGluZGV4ID0gMDsgaW5kZXggPCBldi5nZXRQb2ludGVyQ291bnQoKTsgaW5kZXgrKykgeworICAgICAgICAgICAgICAgIGlmIChpbmRleCAhPSBhY3RpdmVQb2ludGVySW5kZXgpIHsKKworICAgICAgICAgICAgICAgICAgICBmbG9hdCB4ID0gZXYuZ2V0WChpbmRleCk7CisgICAgICAgICAgICAgICAgICAgIGZsb2F0IHkgPSBldi5nZXRZKGluZGV4KTsKKworICAgICAgICAgICAgICAgICAgICB0b3VjaFJlY3Quc2V0KHYuZ2V0TGVmdCgpLCB2LmdldFRvcCgpLCB2LmdldFJpZ2h0KCksIHYuZ2V0Qm90dG9tKCkpOworICAgICAgICAgICAgICAgICAgICBpZiAodG91Y2hSZWN0LmNvbnRhaW5zKE1hdGgucm91bmQoeCksIE1hdGgucm91bmQoeSkpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCBvbGRYID0gZXYuZ2V0WChhY3RpdmVQb2ludGVySW5kZXgpOworICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgb2xkWSA9IGV2LmdldFkoYWN0aXZlUG9pbnRlckluZGV4KTsKKworICAgICAgICAgICAgICAgICAgICAgICAgLy8gYWRqdXN0IG91ciBmcmFtZSBvZiByZWZlcmVuY2UgdG8gYXZvaWQgYSBqdW1wCisgICAgICAgICAgICAgICAgICAgICAgICBtSW5pdGlhbFkgKz0gKHkgLSBvbGRZKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1Jbml0aWFsWCArPSAoeCAtIG9sZFgpOworCisgICAgICAgICAgICAgICAgICAgICAgICBtQWN0aXZlUG9pbnRlcklkID0gZXYuZ2V0UG9pbnRlcklkKGluZGV4KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtVmVsb2NpdHlUcmFja2VyICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtVmVsb2NpdHlUcmFja2VyLmNsZWFyKCk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICAvLyBvaywgd2UncmUgZ29vZCwgd2UgZm91bmQgYSBuZXcgcG9pbnRlciB3aGljaCBpcyB0b3VjaGluZyB0aGUgYWN0aXZlIHZpZXcKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIC8vIGlmIHdlIG1hZGUgaXQgdGhpcyBmYXIsIGl0IG1lYW5zIHdlIGRpZG4ndCBmaW5kIGEgc2F0aXNmYWN0b3J5IG5ldyBwb2ludGVyIDooLAorICAgICAgICAgICAgLy8gc28gZW5kIHRoZSBnZXN0dXJlCisgICAgICAgICAgICBoYW5kbGVQb2ludGVyVXAoZXYpOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIGhhbmRsZVBvaW50ZXJVcChNb3Rpb25FdmVudCBldikgeworICAgICAgICBpbnQgcG9pbnRlckluZGV4ID0gZXYuZmluZFBvaW50ZXJJbmRleChtQWN0aXZlUG9pbnRlcklkKTsKKyAgICAgICAgZmxvYXQgbmV3WSA9IGV2LmdldFkocG9pbnRlckluZGV4KTsKKyAgICAgICAgaW50IGRlbHRhWSA9IChpbnQpIChuZXdZIC0gbUluaXRpYWxZKTsKKworICAgICAgICBpZiAobVZlbG9jaXR5VHJhY2tlciAhPSBudWxsKSB7CisgICAgICAgICAgICBtVmVsb2NpdHlUcmFja2VyLmNvbXB1dGVDdXJyZW50VmVsb2NpdHkoMTAwMCwgbU1heGltdW1WZWxvY2l0eSk7CisgICAgICAgICAgICBtWVZlbG9jaXR5ID0gKGludCkgbVZlbG9jaXR5VHJhY2tlci5nZXRZVmVsb2NpdHkobUFjdGl2ZVBvaW50ZXJJZCk7CisgICAgICAgIH0KKworICAgICAgICBpZiAobVZlbG9jaXR5VHJhY2tlciAhPSBudWxsKSB7CisgICAgICAgICAgICBtVmVsb2NpdHlUcmFja2VyLnJlY3ljbGUoKTsKKyAgICAgICAgICAgIG1WZWxvY2l0eVRyYWNrZXIgPSBudWxsOworICAgICAgICB9CisKKyAgICAgICAgaWYgKGRlbHRhWSA+IG1Td2lwZVRocmVzaG9sZCAmJiBtU3dpcGVHZXN0dXJlVHlwZSA9PSBHRVNUVVJFX1NMSURFX0RPV04KKyAgICAgICAgICAgICAgICAmJiBtU3RhY2tTbGlkZXIubU1vZGUgPT0gU3RhY2tTbGlkZXIuTk9STUFMX01PREUpIHsKKyAgICAgICAgICAgIC8vIFN3aXBlIHRocmVzaG9sZCBleGNlZWRlZCwgc3dpcGUgZG93bgorICAgICAgICAgICAgaWYgKG1TdGFja01vZGUgPT0gSVRFTVNfU0xJREVfVVApIHsKKyAgICAgICAgICAgICAgICBzaG93TmV4dCgpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBzaG93UHJldmlvdXMoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1IaWdobGlnaHQuYnJpbmdUb0Zyb250KCk7CisgICAgICAgIH0gZWxzZSBpZiAoZGVsdGFZIDwgLW1Td2lwZVRocmVzaG9sZCAmJiBtU3dpcGVHZXN0dXJlVHlwZSA9PSBHRVNUVVJFX1NMSURFX1VQCisgICAgICAgICAgICAgICAgJiYgbVN0YWNrU2xpZGVyLm1Nb2RlID09IFN0YWNrU2xpZGVyLk5PUk1BTF9NT0RFKSB7CisgICAgICAgICAgICAvLyBTd2lwZSB0aHJlc2hvbGQgZXhjZWVkZWQsIHN3aXBlIHVwCisgICAgICAgICAgICBpZiAobVN0YWNrTW9kZSA9PSBJVEVNU19TTElERV9VUCkgeworICAgICAgICAgICAgICAgIHNob3dQcmV2aW91cygpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBzaG93TmV4dCgpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBtSGlnaGxpZ2h0LmJyaW5nVG9Gcm9udCgpOworICAgICAgICB9IGVsc2UgaWYgKG1Td2lwZUdlc3R1cmVUeXBlID09IEdFU1RVUkVfU0xJREVfVVAgKSB7Cisg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G5ldyBQcm9wZXJ0eUFuaW1hdG9yKGR1cmF0aW9uLCBhbmltYXRpb25TbGlkZXIsCisgICAgICAgICAgICAgICAgICAgIHNuYXBCYWNrWCwgc25hcEJhY2tZKTsKKyAgICAgICAgICAgIHBhLnNldEludGVycG9sYXRvcihuZXcgTGluZWFySW50ZXJwb2xhdG9yKCkpOworICAgICAgICAgICAgcGEuc3RhcnQoKTsKKyAgICAgICAgfSBlbHNlIGlmIChtU3dpcGVHZXN0dXJlVHlwZSA9PSBHRVNUVVJFX1NMSURFX0RPV04pIHsKKyAgICAgICAgICAgIC8vIERpZG4ndCBzd2lwZSBkb3duIGZhciBlbm91Z2gsIHNuYXAgYmFjayB1cAorICAgICAgICAgICAgZmxvYXQgZmluYWxZUHJvZ3Jlc3MgPSAobVN0YWNrTW9kZSA9PSBJVEVNU19TTElERV9ET1dOKSA/IDAgOiAxOworICAgICAgICAgICAgaW50IGR1cmF0aW9uOworICAgICAgICAgICAgaWYgKG1TdGFja01vZGUgPT0gSVRFTVNfU0xJREVfRE9XTiB8fCBtU3RhY2tTbGlkZXIubU1vZGUgIT0gU3RhY2tTbGlkZXIuTk9STUFMX01PREUpIHsKKyAgICAgICAgICAgICAgICBkdXJhdGlvbiA9IE1hdGgucm91bmQobVN0YWNrU2xpZGVyLmdldER1cmF0aW9uRm9yTmV1dHJhbFBvc2l0aW9uKCkpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBkdXJhdGlvbiA9IE1hdGgucm91bmQobVN0YWNrU2xpZGVyLmdldER1cmF0aW9uRm9yT2Zmc2NyZWVuUG9zaXRpb24oKSk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIFN0YWNrU2xpZGVyIGFuaW1hdGlvblNsaWRlciA9IG5ldyBTdGFja1NsaWRlcihtU3RhY2tTbGlkZXIpOworICAgICAgICAgICAgUHJvcGVydHlWYWx1ZXNIb2xkZXI8RmxvYXQ+IHNuYXBCYWNrWSA9CisgICAgICAgIC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Y29weSkgeworICAgICAgICAgICAgbVZpZXcgPSBjb3B5Lm1WaWV3OworICAgICAgICAgICAgbVlQcm9ncmVzcyA9IGNvcHkubVlQcm9ncmVzczsKKyAgICAgICAgICAgIG1YUHJvZ3Jlc3MgPSBjb3B5Lm1YUHJvZ3Jlc3M7CisgICAgICAgICAgICBtTW9kZSA9IGNvcHkubU1vZGU7CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIGZsb2F0IGN1YmljKGZsb2F0IHIpIHsKKyAgICAgICAgICAgIHJldHVybiAoZmxvYXQpIChNYXRoLnBvdygyICogciAtIDEsIDMpICsgMSkgLyAyLjBmOworICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSBmbG9hdCBoaWdobGlnaHRBbHBoYUludGVycG9sYXRvcihmbG9hdCByKSB7CisgICAgICAgICAgICBmbG9hdCBwaXZvdCA9IDAuNGY7CisgICAgICAgICAgICBpZiAociA8IHBpdm90KSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIDAuODVmICogY3ViaWMociAvIHBpdm90KTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIDAuODVmICogY3ViaWMoMSAtIChyIC0gcGl2b3QpIC8gKDEgLSBwaXZvdCkpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSBmbG9hdCB2aWV3QWxwaGFJbnRlcnBvbGF0b3IoZmxvYXQgcikgeworICAgICAgICAgICAgZmxvYXQgcGl2b3QgPSAwLjNmOworICAgICAgICAgICAgaWYgKHIgPiBwaXZvdCkgeworICAgICAgICAgICAgICAgIHJldHVybiAociAtIHBpdm90KSAvICgxIC0gcGl2b3QpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gMDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgZmxvYXQgcm90YXRpb25JbnRlcnBvbGF0b3IoZmxvYXQgcikgeworICAgICAgICAgICAgZmxvYXQgcGl2b3QgPSAwLjJmOworICAgICAgICAgICAgaWYgKHIgPCBwaXZvdCkgeworICAgICAgICAgICAgICAgIHJldHVybiAwOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gKHIgLSBwaXZvdCkgLyAoMSAtIHBpdm90KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHZvaWQgc2V0VmlldyhWaWV3IHYpIHsKKyAgICAgICAgICAgIG1WaWV3ID0gdjsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyB2b2lkIHNldFlQcm9ncmVzcyhmbG9hdCByKSB7CisgICAgICAgICAgICAvLyBlbmZvcmNlIHIgYmV0d2VlbiAwIGFuZCAxCisgICAgICAgICAgICByID0gTWF0aC5taW4oMS4wZiwgcik7CisgICAgICAgICAgICByID0gTWF0aC5tYXgoMCwgcik7CisKKyAgICAgICAgICAgIG1ZUHJvZ3Jlc3MgPSByOworICAgICAgICAgICAgZmluYWwgTGF5b3V0UGFyYW1zIHZpZXdMcCA9IChMYXlvdXRQYXJhbXMpIG1WaWV3LmdldExheW91dFBhcmFtcygpOworICAgICAgICAgICAgZmluYWwgTGF5b3V0UGFyYW1zIGhpZ2hsaWdodExwID0gKExheW91dFBhcmFtcykgbUhpZ2hsaWdodC5nZXRMYXlvdXRQYXJhbXMoKTsKKworICAgICAgICAgICAgaW50IHN0YWNrRGlyZWN0aW9uID0gKG1TdGFja01vZGUgPT0gSVRFTVNfU0xJREVfVVApID8gMSA6IC0xOworCisgICAgICAgICAgICBzd2l0Y2ggKG1Nb2RlKSB7CisgICAgICAgICAgICAgICAgY2FzZSBOT1JNQUxfTU9ERToKKyAgICAgICAgICAgICAgICAgICAgdmlld0xwLnNldFZlcnRpY2FsT2Zmc2V0KE1hdGgucm91bmQoLXIgKiBzdGFja0RpcmVjdGlvbiAqIG1WaWV3SGVpZ2h0KSk7CisgICAgICAgICAgICAgICAgICAgIGhpZ2hsaWdodExwLnNldFZlcnRpY2FsT2Zmc2V0KE1hdGgucm91bmQoLXIgKiBzdGFja0RpcmVjdGlvbiAqIG1WaWV3SGVpZ2h0KSk7CisgICAgICAgICAgICAgICAgICAgIG1IaWdobGlnaHQuc2V0QWxwaGEoaGlnaGxpZ2h0QWxwaGFJbnRlcnBvbGF0b3IocikpOworCisgICAgICAgICAgICAgICAgICAgIGZsb2F0IGFscGhhID0gdmlld0FscGhhSW50ZXJwb2xhdG9yKDEgLSByKTsKKworICAgICAgICAgICAgICAgICAgICAvLyBXZSBtYWtlIHN1cmUgdGhhdCB2aWV3cyB3aGljaCBjYW4ndCBiZSBzZWVuIChoYXZlIDAgYWxwaGEpIGFyZSBhbHNvIGludmlzaWJsZQorICAgICAgICAgICAgICAgICAgICAvLyBzbyB0aGF0IHRoZXkgZG9uJ3QgaW50ZXJmZXJlIHdpdGggY2xpY2sgZXZlbnRzLgorICAgICAgICAgICAgICAgICAgICBpZiAobVZpZXcuZ2V0QWxwaGEoKSA9PSAwICYmIGFscGhhICE9IDAgJiYgbVZpZXcuZ2V0VmlzaWJpbGl0eSgpICE9IFZJU0lCTEUpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1WaWV3LnNldFZpc2liaWxpdHkoVklTSUJMRSk7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoYWxwaGEgPT0gMCAmJiBtVmlldy5nZXRBbHBoYSgpICE9IDAKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAmJiBtVmlldy5nZXRWaXNpYmlsaXR5KCkgPT0gVklTSUJMRSkgeworICAgICAgICAgICAgICAgICAgICAgICAgbVZpZXcuc2V0VmlzaWJpbGl0eShJTlZJU0lCTEUpOworICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgbVZpZXcuc2V0QWxwaGEoYWxwaGEpOworICAgICAgICAgICAgICAgICAgICBtVmlldy5zZXRSb3RhdGlvblgoc3RhY2tEaXJlY3Rpb24gKiA5MC4wZiAqIHJvdGF0aW9uSW50ZXJwb2xhdG9yKHIpKTsKKyAgICAgICAgICAgICAgICAgICAgbUhpZ2hsaWdodC5zZXRSb3RhdGlvblgoc3RhY2tEaXJlY3Rpb24gKiA5MC4wZiAqIHJvdGF0aW9uSW50ZXJwb2xhdG9yKHIpKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBCRUdJTk5JTkdfT0ZfU1RBQ0tfTU9ERToKKyAgICAgICAgICAgICAgICAgICAgciA9IHIgKiAwLjJmOworICAgICAgICAgICAgICAgICAgICB2aWV3THAuc2V0VmVydGljYWxPZmZzZXQoTWF0aC5yb3VuZCgtc3RhY2tEaXJlY3Rpb24gKiByICogbVZpZXdIZWlnaHQpKTsKKyAgICAgICAgICAgICAgICAgICAgaGlnaGxpZ2h0THAuc2V0VmVydGljYWxPZmZzZXQoTWF0aC5yb3VuZCgtc3RhY2tEaXJlY3Rpb24gKiByICogbVZpZXdIZWlnaHQpKTsKKyAgICAgICAgICAgICAgICAgICAgbUhpZ2hsaWdodC5zZXRBbHBoYShoaWdobGlnaHRBbHBoYUludGVycG9sYXRvcihyKSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgRU5EX09GX1NUQUNLX01PREU6CisgICAgICAgICAgICAgICAgICAgIHIgPSAoMS1yKSAqIDAuMmY7CisgICAgICAgICAgICAgICAgICAgIHZpZXdMcC5zZXRWZXJ0aWNhbE9mZnNldChNYXRoLnJvdW5kKHN0YWNrRGlyZWN0aW9uICogciAqIG1WaWV3SGVpZ2h0KSk7CisgICAgICAgICAgICAgICAgICAgIGhpZ2hsaWdodExwLnNldFZlcnRpY2FsT2Zmc2V0KE1hdGgucm91bmQoc3RhY2tEaXJlY3Rpb24gKiByICogbVZpZXdIZWlnaHQpKTsKKyAgICAgICAgICAgICAgICAgICAgbUhpZ2hsaWdodC5zZXRBbHBoYShoaWdobGlnaHRBbHBoYUludGVycG9sYXRvcihyKSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgc2V0WFByb2dyZXNzKGZsb2F0IHIpIHsKKyAgICAgICAgICAgIC8vIGVuZm9yY2UgciBiZXR3ZWVuIDAgYW5kIDEKKyAgICAgICAgICAgIHIgPSBNYXRoLm1pbigyLjBmLCByKTsKKyAgICAgICAgICAgIHIgPSBNYXRoLm1heCgtMi4wZiwgcik7CisKKyAgICAgICAgICAgIG1YUHJvZ3Jlc3MgPSByOworCisgICAgICAgICAgICBmaW5hbCBMYXlvdXRQYXJhbXMgdmlld0xwID0gKExheW91dFBhcmFtcykgbVZpZXcuZ2V0TGF5b3V0UGFyYW1zKCk7CisgICAgICAgICAgICBmaW5hbCBMYXlvdXRQYXJhbXMgaGlnaGxpZ2h0THAgPSAoTGF5b3V0UGFyYW1zKSBtSGlnaGxpZ2h0LmdldExheW91dFBhcmFtcygpOworCisgICAgICAgICAgICByICo9IDAuMmY7CisgICAgICAgICAgICB2aWV3THAuc2V0SG9yaXpvbnRhbE9mZnNldChNYXRoLnJvdW5kKHIgKiBtVmlld0hlaWdodCkpOworICAgICAgICAgICAgaGlnaGxpZ2h0THAuc2V0SG9yaXpvbnRhbE9mZnNldChNYXRoLnJvdW5kKHIgKiBtVmlld0hlaWdodCkpOworICAgICAgICB9CisKKyAgICAgICAgdm9pZCBzZXRNb2RlKGludCBtb2RlKSB7CisgICAgICAgICAgICBtTW9kZSA9IG1vZGU7CisgICAgICAgIH0KKworICAgICAgICBmbG9hdCBnZXREdXJhdGlvbkZvck5ldXRyYWxQb3NpdGlvbigpIHsKKyAgICAgICAgICAgIHJldHVybiBnZXREdXJhdGlvbihmYWxzZSwgMCk7CisgICAgICAgIH0KKworICAgICAgICBmbG9hdCBnZXREdXJhdGlvbkZvck9mZnNjcmVlblBvc2l0aW9uKCkgeworICAgICAgICAgICAgcmV0dXJuIGdldER1cmF0aW9uKHRydWUsIDApOworICAgICAgICB9CisKKyAgICAgICAgZmxvYXQgZ2V0RHVyYXRpb25Gb3JOZXV0cmFsUG9zaXRpb24oZmxvYXQgdmVsb2NpdHkpIHsKKyAgICAgICAgICAgIHJldHVybiBnZXREdXJhdGlvbihmYWxzZSwgdmVsb2NpdHkpOworICAgICAgICB9CisKKyAgICAgICAgZmxvYXQgZ2V0RHVyYXRpb25Gb3JPZmZzY3JlZW5Qb3NpdGlvbihmbG9hdCB2ZWxvY2l0eSkgeworICAgICAgICAgICAgcmV0dXJuIGdldER1cmF0aW9uKHRydWUsIHZlbG9jaXR5KTsKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgZmxvYXQgZ2V0RHVyYXRpb24oYm9vbGVhbiBpbnZlcnQsIGZsb2F0IHZlbG9jaXR5KSB7CisgICAgICAgICAgICBpZiAobVZpZXcgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGZpbmFsIExheW91dFBhcmFtcyB2aWV3THAgPSAoTGF5b3V0UGFyYW1zKSBtVmlldy5nZXRMYXlvdXRQYXJhbXMoKTsKKworICAgICAgICAgICAgICAgIGZsb2F0IGQgPSAoZmxvYXQpIE1hdGguc3FydChNYXRoLnBvdyh2aWV3THAuaG9yaXpvbnRhbE9mZnNldCwgMikgKworICAgICAgICAgICAgICAgICAgICAgICAgTWF0aC5wb3codmlld0xwLnZlcnRpY2FsT2Zmc2V0LCAyKSk7CisgICAgICAgICAgICAgICAgZmxvYXQgbWF4ZCA9IChmbG9hdCkgTWF0aC5zcXJ0KE1hdGgucG93KG1WaWV3SGVpZ2h0LCAyKSArCisgICAgICAgICAgICAgICAgICAgICAgICBNYXRoLnBvdygwLjRmICogbVZpZXdIZWlnaHQsIDIpKTsKKworICAgICAgICAgICAgICAgIGlmICh2ZWxvY2l0eSA9PSAwKSB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiAoaW52ZXJ0ID8gKDEgLSBkIC8gbWF4ZCkgOiBkIC8gbWF4ZCkgKiBERUZBVUxUX0FOSU1BVElPTl9EVVJBVElPTjsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICBmbG9hdCBkdXJhdGlvbiA9IGludmVydCA/IGQgLyBNYXRoLmFicyh2ZWxvY2l0eSkgOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIChtYXhkIC0gZCkgLyBNYXRoLmFicyh2ZWxvY2l0eSk7CisgICAgICAgICAgICAgICAgICAgIGlmIChkdXJhdGlvbiA8IE1JTklNVU1fQU5JTUFUSU9OX0RVUkFUSU9OIHx8CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZHVyYXRpb24gPiBERUZBVUxUX0FOSU1BVElPTl9EVVJBVElPTikgeworICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGdldER1cmF0aW9uKGludmVydCwgMCk7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZHVyYXRpb247CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gMDsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBmbG9hdCBnZXRZUHJvZ3Jlc3MoKSB7CisgICAgICAgICAgICByZXR1cm4gbVlQcm9ncmVzczsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBmbG9hdCBnZXRYUHJvZ3Jlc3MoKSB7CisgICAgICAgICAgICByZXR1cm4gbVhQcm9ncmVzczsKKyAgICAgICAgfQorICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIG9uUmVtb3RlQWRhcHRlckNvbm5lY3RlZCgpIHsKKyAgICAgICAgc3VwZXIub25SZW1vdGVBZGFwdGVyQ29ubmVjdGVkKCk7CisgICAgICAgIC8vIE9uIGZpcnN0IHJ1biwgd2Ugd2FudCB0byBzZXQgdGhlIHN0YWNrIHRvIHRoZSBlbmQuCisgICAgICAgIGlmIChtQWRhcHRlciAhPSBudWxsICYmIG1XaGljaENoaWxkID09IC0xKSB7CisgICAgICAgICAgICBtV2hpY2hDaGlsZCA9IG1BZGFwdGVyLmdldENvdW50KCkgLSAxOworICAgICAgICB9CisgICAgICAgIHNldERpc3BsYXllZENoaWxkKG1XaGljaENoaWxkKTsKKyAgICB9CisKKyAgICBMYXlvdXRQYXJhbXMgY3JlYXRlT3JSZXVzZUxheW91dFBhcmFtcyhWaWV3IHYpIHsKKyAgICAgICAgZmluYWwgVmlld0dyb3VwLkxheW91dFBhcmFtcyBjdXJyZW50THAgPSB2LmdldExheW91dFBhcmFtcygpOworICAgICAgICBpZiAoY3VycmVudExwIGluc3RhbmNlb2YgTGF5b3V0UGFyYW1zKSB7CisgICAgICAgICAgICBMYXlvdXRQYXJhbXMgbHAgPSAoTGF5b3V0UGFyYW1zKSBjdXJyZW50THA7CisgICAgICAgICAgICBscC5zZXRIb3Jpem9udGFsT2Zmc2V0KDApOworICAgICAgICAgICAgbHAuc2V0VmVydGljYWxPZmZzZXQoMCk7CisgICAgICAgICAgICBscC53aWR0aCA9IDA7CisgICAgICAgICAgICBscC53aWR0aCA9IDA7CisgICAgICAgICAgICByZXR1cm4gbHA7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIG5ldyBMYXlvdXRQYXJhbXModik7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHJvdGVjdGVkIHZvaWQgb25MYXlvdXQoYm9vbGVhbiBjaGFuZ2VkLCBpbnQgbGVmdCwgaW50IHRvcCwgaW50IHJpZ2h0LCBpbnQgYm90dG9tKSB7CisgICAgICAgIGJvb2xlYW4gZGF0YUNoYW5nZWQgPSBtRGF0YUNoYW5nZWQ7CisgICAgICAgIGlmIChkYXRhQ2hhbmdlZCkgeworICAgICAgICAgICAgaGFuZGxlRGF0YUNoYW5nZWQoKTsKKworICAgICAgICAgICAgLy8gaWYgdGhlIGRhdGEgY2hhbmdlcywgbVdoaWNoQ2hpbGQgbWlnaHQgYmUgb3V0IG9mIHRoZSBib3VuZHMgb2YgdGhlIGFkYXB0ZXIKKyAgICAgICAgICAgIC8vIGluIHRoaXMgY2FzZSwgd2UgcmVzZXQgbVdoaWNoQ2hpbGQgdG8gdGhlIGJlZ2lubmluZworICAgICAgICAgICAgaWYgKG1XaGljaENoaWxkID49IG1BZGFwdGVyLmdldENvdW50KCkpCisgICAgICAgICAgICAgICAgbVdoaWNoQ2hpbGQgPSAwOworCisgICAgICAgICAgICBzaG93T25seShtV2hpY2hDaGlsZCwgdHJ1ZSwgdHJ1ZSk7CisgICAgICAgIH0KKworICAgICAgICBmaW5hbCBpbnQgY2hpbGRDb3VudCA9IGdldENoaWxkQ291bnQoKTsKKyAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBjaGlsZENvdW50OyBpKyspIHsKKyAgICAgICAgICAgIGZpbmFsIFZpZXcgY2hpbGQgPSBnZXRDaGlsZEF0KGkpOworCisgICAgICAgICAgICBpbnQgY2hpbGRSaWdodCA9IG1QYWRkaW5nTGVmdCArIGNoaWxkLmdldE1lYXN1cmVkV2lkdGgoKTsKKyAgICAgICAgICAgIGludCBjaGlsZEJvdHRvbSA9IG1QYWRkaW5nVG9wICsgY2hpbGQuZ2V0TWVhc3VyZWRIZWlnaHQoKTsKKyAgICAgICAgICAgIExheW91dFBhcmFtcyBscCA9IChMYXlvdXRQYXJhbXMpIGNoaWxkLmdldExheW91dFBhcmFtcygpOworCisgICAgICAgICAgICBjaGlsZC5sYXlvdXQobVBhZGRpbmdMZWZ0ICsgbHAuaG9yaXpvbnRhbE9mZnNldCwgbVBhZGRpbmdUb3AgKyBscC52ZXJ0aWNhbE9mZnNldCwKKyAgICAgICAgICAgICAgICAgICAgY2hpbGRSaWdodCArIGxwLmhvcml6b250YWxPZmZzZXQsIGNoaWxkQm90dG9tICsgbHAudmVydGljYWxPZmZzZXQpOworCisgICAgICAgIH0K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WV3KSB7CisgICAgICAgICAgICBzdXBlcigwLCAwKTsKKyAgICAgICAgICAgIHdpZHRoID0gMDsKKyAgICAgICAgICAgIGhlaWdodCA9IDA7CisgICAgICAgICAgICBob3Jpem9udGFsT2Zmc2V0ID0gMDsKKyAgICAgICAgICAgIHZlcnRpY2FsT2Zmc2V0ID0gMDsKKyAgICAgICAgICAgIG1WaWV3ID0gdmlldzsKKyAgICAgICAgfQorCisgICAgICAgIExheW91dFBhcmFtcyhDb250ZXh0IGMsIEF0dHJpYnV0ZVNldCBhdHRycykgeworICAgICAgICAgICAgc3VwZXIoYywgYXR0cnMpOworICAgICAgICAgICAgaG9yaXpvbnRhbE9mZnNldCA9IDA7CisgICAgICAgICAgICB2ZXJ0aWNhbE9mZnNldCA9IDA7CisgICAgICAgICAgICB3aWR0aCA9IDA7CisgICAgICAgICAgICBoZWlnaHQgPSAwOworICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSBSZWN0IHBhcmVudFJlY3QgPSBuZXcgUmVjdCgpOworICAgICAgICB2b2lkIGludmFsaWRhdGVHbG9iYWxSZWdpb24oVmlldyB2LCBSZWN0IHIpIHsKKyAgICAgICAgICAgIFZpZXcgcCA9IHY7CisgICAgICAgICAgICBpZiAoISh2LmdldFBhcmVudCgpICE9IG51bGwgJiYgdi5nZXRQYXJlbnQoKSBpbnN0YW5jZW9mIFZpZXcpKSByZXR1cm47CisKKyAgICAgICAgICAgIFZpZXcgZ3AgPSAoVmlldykgdi5nZXRQYXJlbnQoKTsKKyAgICAgICAgICAgIGJvb2xlYW4gZmlyc3RQYXNzID0gdHJ1ZTsKKyAgICAgICAgICAgIHBhcmVudFJlY3Quc2V0KDAsIDAsIDAsIDApOworICAgICAgICAgICAgaW50IGRlcHRoID0gMDsKKyAgICAgICAgICAgIHdoaWxlIChncC5nZXRQYXJlbnQoKSAhPSBudWxsICYmIGdwLmdldFBhcmVudCgpIGluc3RhbmNlb2YgVmlldworICAgICAgICAgICAgICAgICAgICAmJiAhcGFyZW50UmVjdC5jb250YWlucyhyKSkgeworICAgICAgICAgICAgICAgIGlmICghZmlyc3RQYXNzKSB7CisgICAgICAgICAgICAgICAgICAgIHIub2Zmc2V0KHAuZ2V0TGVmdCgpIC0gZ3AuZ2V0U2Nyb2xsWCgpLCBwLmdldFRvcCgpIC0gZ3AuZ2V0U2Nyb2xsWSgpKTsKKyAgICAgICAgICAgICAgICAgICAgZGVwdGgrKzsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZmlyc3RQYXNzID0gZmFsc2U7CisgICAgICAgICAgICAgICAgcCA9IChWaWV3KSBwLmdldFBhcmVudCgpOworICAgICAgICAgICAgICAgIGdwID0gKFZpZXcpIHAuZ2V0UGFyZW50KCk7CisgICAgICAgICAgICAgICAgcGFyZW50UmVjdC5zZXQocC5nZXRMZWZ0KCkgLSBncC5nZXRTY3JvbGxYKCksIHAuZ2V0VG9wKCkgLSBncC5nZXRTY3JvbGxZKCksCisgICAgICAgICAgICAgICAgICAgICAgICBwLmdldFJpZ2h0KCkgLSBncC5nZXRTY3JvbGxYKCksIHAuZ2V0Qm90dG9tKCkgLSBncC5nZXRTY3JvbGxZKCkpOworCisgICAgICAgICAgICAgICAgLy8gVE9ETzogd2UgbmVlZCB0byBzdG9wIGVhcmx5IGhlcmUgaWYgd2UndmUgaGl0IHRoZSBlZGdlIG9mIHRoZSBzY3JlZW4KKyAgICAgICAgICAgICAgICAvLyBzbyBhcyB0byBwcmV2ZW50IHVzIGZyb20gd2Fsa2luZyB0b28gaGlnaCBpbiB0aGUgaGllcmFyY2h5LiBBIGxvdCBvZiB0aGlzCisgICAgICAgICAgICAgICAgLy8gY29kZSBtaWdodCBiZWNvbWUgYSBsb3QgbW9yZSBzdHJhaWdodGZvcndhcmQuCisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmIChkZXB0aCA+IG1BbmNlc3RvckhlaWdodCkgeworICAgICAgICAgICAgICAgIG1BbmNlc3RvckNvbnRhaW5pbmdBbGxDaGlsZHJlbiA9IChWaWV3R3JvdXApIHA7CisgICAgICAgICAgICAgICAgbUFuY2VzdG9ySGVpZ2h0ID0gZGVwdGg7CisgICAgICAgICAgICAgICAgZGlzYWJsZVBhcmVudGFsQ2xpcHBpbmcoKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcC5pbnZhbGlkYXRlKHIubGVmdCwgci50b3AsIHIucmlnaHQsIHIuYm90dG9tKTsKKyAgICAgICAgfQorCisgICAgICAgIHByaXZhdGUgUmVjdCBpbnZhbGlkYXRlUmVjdCA9IG5ldyBSZWN0KCk7CisgICAgICAgIHByaXZhdGUgUmVjdEYgaW52YWxpZGF0ZVJlY3RmID0gbmV3IFJlY3RGKCk7CisgICAgICAgIC8vIFRoaXMgaXMgcHVibGljIHNvIHRoYXQgUHJvcGVydHlBbmltYXRvciBjYW4gYWNjZXNzIGl0CisgICAgICAgIHB1YmxpYyB2b2lkIHNldFZlcnRpY2FsT2Zmc2V0KGludCBuZXdWZXJ0aWNhbE9mZnNldCkgeworICAgICAgICAgICAgaW50IG9mZnNldERlbHRhID0gbmV3VmVydGljYWxPZmZzZXQgLSB2ZXJ0aWNhbE9mZnNldDsKKyAgICAgICAgICAgIHZlcnRpY2FsT2Zmc2V0ID0gbmV3VmVydGljYWxPZmZzZXQ7CisKKyAgICAgICAgICAgIGlmIChtVmlldyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgbVZpZXcucmVxdWVzdExheW91dCgpOworICAgICAgICAgICAgICAgIGludCB0b3AgPSBNYXRoLm1pbihtVmlldy5nZXRUb3AoKSArIG9mZnNldERlbHRhLCBtVmlldy5nZXRUb3AoKSk7CisgICAgICAgICAgICAgICAgaW50IGJvdHRvbSA9IE1hdGgubWF4KG1WaWV3LmdldEJvdHRvbSgpICsgb2Zmc2V0RGVsdGEsIG1WaWV3LmdldEJvdHRvbSgpKTsKKworICAgICAgICAgICAgICAgIGludmFsaWRhdGVSZWN0Zi5zZXQobVZpZXcuZ2V0TGVmdCgpLCAgdG9wLCBtVmlldy5nZXRSaWdodCgpLCBib3R0b20pOworCisgICAgICAgICAgICAgICAgZmxvYXQgeG9mZnNldCA9IC1pbnZhbGlkYXRlUmVjdGYubGVmdDsKKyAgICAgICAgICAgICAgICBmbG9hdCB5b2Zmc2V0ID0gLWludmFsaWRhdGVSZWN0Zi50b3A7CisgICAgICAgICAgICAgICAgaW52YWxpZGF0ZVJlY3RmLm9mZnNldCh4b2Zmc2V0LCB5b2Zmc2V0KTsKKyAgICAgICAgICAgICAgICBtVmlldy5nZXRNYXRyaXgoKS5tYXBSZWN0KGludmFsaWRhdGVSZWN0Zik7CisgICAgICAgICAgICAgICAgaW52YWxpZGF0ZVJlY3RmLm9mZnNldCgteG9mZnNldCwgLXlvZmZzZXQpOworICAgICAgICAgICAgICAgIGludmFsaWRhdGVSZWN0LnNldCgoaW50KSBNYXRoLmZsb29yKGludmFsaWRhdGVSZWN0Zi5sZWZ0KSwKKyAgICAgICAgICAgICAgICAgICAgICAgIChpbnQpIE1hdGguZmxvb3IoaW52YWxpZGF0ZVJlY3RmLnRvcCksCisgICAgICAgICAgICAgICAgICAgICAgICAoaW50KSBNYXRoLmNlaWwoaW52YWxpZGF0ZVJlY3RmLnJpZ2h0KSwKKyAgICAgICAgICAgICAgICAgICAgICAgIChpbnQpIE1hdGguY2VpbChpbnZhbGlkYXRlUmVjdGYuYm90dG9tKSk7CisKKyAgICAgICAgICAgICAgICBpbnZhbGlkYXRlR2xvYmFsUmVnaW9uKG1WaWV3LCBpbnZhbGlkYXRlUmVjdCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBzZXRIb3Jpem9udGFsT2Zmc2V0KGludCBuZXdIb3Jpem9udGFsT2Zmc2V0KSB7CisgICAgICAgICAgICBpbnQgb2Zmc2V0RGVsdGEgPSBuZXdIb3Jpem9udGFsT2Zmc2V0IC0gaG9yaXpvbnRhbE9mZnNldDsKKyAgICAgICAgICAgIGhvcml6b250YWxPZmZzZXQgPSBuZXdIb3Jpem9udGFsT2Zmc2V0OworCisgICAgICAgICAgICBpZiAobVZpZXcgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIG1WaWV3LnJlcXVlc3RMYXlvdXQoKTsKKyAgICAgICAgICAgICAgICBpbnQgbGVmdCA9IE1hdGgubWluKG1WaWV3LmdldExlZnQoKSArIG9mZnNldERlbHRhLCBtVmlldy5nZXRMZWZ0KCkpOworICAgICAgICAgICAgICAgIGludCByaWdodCA9IE1hdGgubWF4KG1WaWV3LmdldFJpZ2h0KCkgKyBvZmZzZXREZWx0YSwgbVZpZXcuZ2V0UmlnaHQoKSk7CisgICAgICAgICAgICAgICAgaW52YWxpZGF0ZVJlY3RmLnNldChsZWZ0LCAgbVZpZXcuZ2V0VG9wKCksIHJpZ2h0LCBtVmlldy5nZXRCb3R0b20oKSk7CisKKyAgICAgICAgICAgICAgICBmbG9hdCB4b2Zmc2V0ID0gLWludmFsaWRhdGVSZWN0Zi5sZWZ0OworICAgICAgICAgICAgICAgIGZsb2F0IHlvZmZzZXQgPSAtaW52YWxpZGF0ZVJlY3RmLnRvcDsKKyAgICAgICAgICAgICAgICBpbnZhbGlkYXRlUmVjdGYub2Zmc2V0KHhvZmZzZXQsIHlvZmZzZXQpOworICAgICAgICAgICAgICAgIG1WaWV3LmdldE1hdHJpeCgpLm1hcFJlY3QoaW52YWxpZGF0ZVJlY3RmKTsKKyAgICAgICAgICAgICAgICBpbnZhbGlkYXRlUmVjdGYub2Zmc2V0KC14b2Zmc2V0LCAteW9mZnNldCk7CisKKyAgICAgICAgICAgICAgICBpbnZhbGlkYXRlUmVjdC5zZXQoKGludCkgTWF0aC5mbG9vcihpbnZhbGlkYXRlUmVjdGYubGVmdCksCisgICAgICAgICAgICAgICAgICAgICAgICAoaW50KSBNYXRoLmZsb29yKGludmFsaWRhdGVSZWN0Zi50b3ApLAorICAgICAgICAgICAgICAgICAgICAgICAgKGludCkgTWF0aC5jZWlsKGludmFsaWRhdGVSZWN0Zi5yaWdodCksCisgICAgICAgICAgICAgICAgICAgICAgICAoaW50KSBNYXRoLmNlaWwoaW52YWxpZGF0ZVJlY3RmLmJvdHRvbSkpOworCisgICAgICAgICAgICAgICAgaW52YWxpZGF0ZUdsb2JhbFJlZ2lvbihtVmlldywgaW52YWxpZGF0ZVJlY3QpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSBzdGF0aWMgY2xhc3MgSG9sb2dyYXBoaWNIZWxwZXIgeworICAgICAgICBwcml2YXRlIGZpbmFsIFBhaW50IG1Ib2xvZ3JhcGhpY1BhaW50ID0gbmV3IFBhaW50KCk7CisgICAgICAgIHByaXZhdGUgZmluYWwgUGFpbnQgbUVyYXNlUGFpbnQgPSBuZXcgUGFpbnQoKTsKKyAgICAgICAgcHJpdmF0ZSBmaW5hbCBQYWludCBtQmx1clBhaW50ID0gbmV3IFBhaW50KCk7CisKKyAgICAgICAgSG9sb2dyYXBoaWNIZWxwZXIoKSB7CisgICAgICAgICAgICBpbml0aWFsaXplUGFpbnRzKCk7CisgICAgICAgIH0KKworICAgICAgICB2b2lkIGluaXRpYWxpemVQYWludHMoKSB7CisgICAgICAgICAgICBtSG9sb2dyYXBoaWNQYWludC5zZXRDb2xvcigweGZmNjY5OWZmKTsKKyAgICAgICAgICAgIG1Ib2xvZ3JhcGhpY1BhaW50LnNldEZpbHRlckJpdG1hcCh0cnVlKTsKKyAgICAgICAgICAgIG1Ib2xvZ3JhcGhpY1BhaW50LnNldE1hc2tGaWx0ZXIoVGFibGVNYXNrRmlsdGVyLkNyZWF0ZUNsaXBUYWJsZSgwLCAzMCkpOworICAgICAgICAgICAgbUVyYXNlUGFpbnQuc2V0WGZlcm1vZGUobmV3IFBvcnRlckR1ZmZYZmVybW9kZShQb3J0ZXJEdWZmLk1vZGUuRFNUX09VVCkpOworICAgICAgICAgICAgbUVyYXNlUGFpbnQuc2V0RmlsdGVyQml0bWFwKHRydWUpOworICAgICAgICAgICAgbUJsdXJQYWludC5zZXRNYXNrRmlsdGVyKG5ldyBCbHVyTWFza0ZpbHRlcigyLCBCbHVyTWFza0ZpbHRlci5CbHVyLk5PUk1BTCkpOworICAgICAgICB9CisKKyAgICAgICAgQml0bWFwIGNyZWF0ZU91dGxpbmUoVmlldyB2KSB7CisgICAgICAgICAgICBpZiAodi5nZXRNZWFzdXJlZFdpZHRoKCkgPT0gMCB8fCB2LmdldE1lYXN1cmVkSGVpZ2h0KCkgPT0gMCkgeworICAgICAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBCaXRtYXAgYml0bWFwID0gQml0bWFwLmNyZWF0ZUJpdG1hcCh2LmdldE1lYXN1cmVkV2lkdGgoKSwgdi5nZXRNZWFzdXJlZEhlaWdodCgpLAorICAgICAgICAgICAgICAgICAgICBCaXRtYXAuQ29uZmlnLkFSR0JfODg4OCk7CisgICAgICAgICAgICBDYW52YXMgY2FudmFzID0gbmV3IENhbnZhcyhiaXRtYXApOworCisgICAgICAgICAgICBmbG9hdCByb3RhdGlvblggPSB2LmdldFJvdGF0aW9uWCgpOworICAgICAgICAgICAgZmxvYXQgcm90YXRpb24gPSB2LmdldFJvdGF0aW9uKCk7CisgICAgICAgICAgICBmbG9hdCB0cmFuc2xhdGlvblkgPSB2LmdldFRyYW5zbGF0aW9uWSgpOworICAgICAgICAgICAgdi5zZXRSb3RhdGlvblgoMCk7CisgICAgICAgICAgICB2LnNldFJvdGF0aW9uKDApOworICAgICAgICAgICAgdi5zZXRUcmFuc2xhdGlvblkoMCk7CisgICAgICAgICAgICBjYW52YXMuY29uY2F0KHYuZ2V0TWF0cml4KCkpOworICAgICAgICAgICAgdi5kcmF3KGNhbnZhcyk7CisgICAgICAgICAgICB2LnNldFJvdGF0aW9uWChyb3RhdGlvblgpOworICAgICAgICAgICAgdi5zZXRSb3RhdGlvbihyb3RhdGlvbik7CisgICAgICAgICAgICB2LnNldFRyYW5zbGF0aW9uWSh0cmFuc2xhdGlvblkpOworICAgICAgICAgICAgY2FudmFzLnNldE1hdHJpeChpZCk7CisKKyAgICAgICAgICAgIGRyYXdPdXRsaW5lKGNhbnZhcywgYml0bWFwKTsKKyAgICAgICAgICAgIHJldHVybiBiaXRtYXA7CisgICAgICAgIH0KKworICAgICAgICBmaW5hbCBNYXRyaXggaWQgPSBuZXcgTWF0cml4KCk7CisgICAgICAgIHZvaWQgZHJhd091dGxpbmUoQ2FudmFzIGRlc3QsIEJpdG1hcCBzcmMpIHsKKyAgICAgICAgICAgIGludFtdIHh5ID0gbmV3IGludFsyXTsKKyAgICAgICAgICAgIEJpdG1hcCBtYXNrID0gc3JjLmV4dHJhY3RBbHBoYShtQmx1clBhaW50LCB4eSk7CisgICAgICAgICAgICBDYW52YXMgbWFza0NhbnZhcyA9IG5ldyBDYW52YXMobWFzayk7CisgICAgICAgICAgICBtYXNrQ2FudmFzLmRyYXdCaXRtYXAoc3JjLCAteHlbMF0sIC14eVsxXSwgbUVyYXNlUGFpbnQpOworICAgICAgICAgICAgZGVzdC5kcmF3Q29sb3IoMCwgUG9ydGVyRHVmZi5Nb2RlLkNMRUFSKTsKKyAgICAgICAgICAgIGRlc3Quc2V0TWF0cml4KGlkKTsKKyAgICAgICAgICAgIGRlc3QuZHJhd0JpdG1hcChtYXNrLCB4eVswXSwgeHlbMV0sIG1Ib2xvZ3JhcGhpY1BhaW50KTsKKyAgICAgICAgICAgIG1hc2sucmVjeWNsZSgpOworICAgICAgICB9CisgICAgfQorfQpkaWZmIC0tZ2l0IGEvY29yZS9qYXZhL2FuZHJvaWQvd2lkZ2V0L1RleHRWaWV3LmphdmEgYi9jb3JlL2phdmEvYW5kcm9pZC93aWRnZXQvVGV4dFZpZXcuamF2YQppbmRleCA5M2Y2NGI0Li45OTYxNDM4IDEwMDY0NAotLS0gYS9jb3JlL2phdmEvYW5kcm9pZC93aWRnZXQvVGV4dFZpZXcuamF2YQorKysgYi9jb3JlL2phdmEvY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29sb3I7CiAgICAgcHJpdmF0ZSBDb2xvclN0YXRlTGlzdCBtSGludFRleHRDb2xvcjsKQEAgLTI3OTYsNiArMjgwMSwxNCBAQAogICAgICAgICAgICAgYy5kcmF3VGV4dChtQ2hhcnMsIHN0YXJ0ICsgbVN0YXJ0LCBlbmQgLSBzdGFydCwgeCwgeSwgcCk7CiAgICAgICAgIH0KIAorICAgICAgICBwdWJsaWMgdm9pZCBkcmF3VGV4dFJ1bihDYW52YXMgYywgaW50IHN0YXJ0LCBpbnQgZW5kLAorICAgICAgICAgICAgICAgIGludCBjb250ZXh0U3RhcnQsIGludCBjb250ZXh0RW5kLCBmbG9hdCB4LCBmbG9hdCB5LCBpbnQgZmxhZ3MsIFBhaW50IHApIHsKKyAgICAgICAgICAgIGludCBjb3VudCA9IGVuZCAtIHN0YXJ0OworICAgICAgICAgICAgaW50IGNvbnRleHRDb3VudCA9IGNvbnRleHRFbmQgLSBjb250ZXh0U3RhcnQ7CisgICAgICAgICAgICBjLmRyYXdUZXh0UnVuKG1DaGFycywgc3RhcnQgKyBtU3RhcnQsIGNvdW50LCBjb250ZXh0U3RhcnQgKyBtU3RhcnQsCisgICAgICAgICAgICAgICAgICAgIGNvbnRleHRDb3VudCwgeCwgeSwgZmxhZ3MsIHApOworICAgICAgICB9CisKICAgICAgICAgcHVibGljIGZsb2F0IG1lYXN1cmVUZXh0KGludCBzdGFydCwgaW50IGVuZCwgUGFpbnQgcCkgewogICAgICAgICAgICAgcmV0dXJuIHAubWVhc3VyZVRleHQobUNoYXJzLCBzdGFydCArIG1TdGFydCwgZW5kIC0gc3RhcnQpOwogICAgICAgICB9CkBAIC0yODAzLDYgKzI4MTYsMjMgQEAKICAgICAgICAgcHVibGljIGludCBnZXRUZXh0V2lkdGhzKGludCBzdGFydCwgaW50IGVuZCwgZmxvYXRbXSB3aWR0aHMsIFBhaW50IHApIHsKICAgICAgICAgICAgIHJldHVybiBwLmdldFRleHRXaWR0aHMobUNoYXJzLCBzdGFydCArIG1TdGFydCwgZW5kIC0gc3RhcnQsIHdpZHRocyk7CiAgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgZmxvYXQgZ2V0VGV4dFJ1bkFkdmFuY2VzKGludCBzdGFydCwgaW50IGVuZCwgaW50IGNvbnRleHRTdGFydCwKKyAgICAgICAgICAgICAgICBpbnQgY29udGV4dEVuZCwgaW50IGZsYWdzLCBmbG9hdFtdIGFkdmFuY2VzLCBpbnQgYWR2YW5jZXNJbmRleCwKKyAgICAgICAgICAgICAgICBQYWludCBwKSB7CisgICAgICAgICAgICBpbnQgY291bnQgPSBlbmQgLSBzdGFydDsKKyAgICAgICAgICAgIGludCBjb250ZXh0Q291bnQgPSBjb250ZXh0RW5kIC0gY29udGV4dFN0YXJ0OworICAgICAgICAgICAgcmV0dXJuIHAuZ2V0VGV4dFJ1bkFkdmFuY2VzKG1DaGFycywgc3RhcnQgKyBtU3RhcnQsIGNvdW50LAorICAgICAgICAgICAgICAgICAgICBjb250ZXh0U3RhcnQgKyBtU3RhcnQsIGNvbnRleHRDb3VudCwgZmxhZ3MsIGFkdmFuY2VzLAorICAgICAgICAgICAgICAgICAgICBhZHZhbmNlc0luZGV4KTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBpbnQgZ2V0VGV4dFJ1bkN1cnNvcihpbnQgY29udGV4dFN0YXJ0LCBpbnQgY29udGV4dEVuZCwgaW50IGZsYWdzLAorICAgICAgICAgICAgICAgIGludCBvZmZzZXQsIGludCBjdXJzb3JPcHQsIFBhaW50IHApIHsKKyAgICAgICAgICAgIGludCBjb250ZXh0Q291bnQgPSBjb250ZXh0RW5kIC0gY29udGV4dFN0YXJ0OworICAgICAgICAgICAgcmV0dXJuIHAuZ2V0VGV4dFJ1bkN1cnNvcihtQ2hhcnMsIGNvbnRleHRTdGFydCArIG1TdGFydCwKKyAgICAgICAgICAgICAgICAgICAgY29udGV4dENvdW50LCBmbGFncywgb2Zmc2V0ICsgbVN0YXJ0LCBjdXJzb3JPcHQpOworICAgICAgICB9CiAgICAgfQogCiAgICAgLyoqCkBAIC0zNzA1LDkgKzM3MzUsOSBAQAogICAgICAgICAgICAgY2hhbmdlZCA9IGJyaW5nVGV4dEludG9WaWV3KCk7CiAgICAgICAgIH0KIAotICAgICAgICBpZiAobVNob3VsZFN0YXJ0VGV4dFNlbGVjdGlvbk1vZGUpIHsKLSAgICAgICAgICAgIHN0YXJ0VGV4dFNlbGVjdGlvbk1vZGUoKTsKLSAgICAgICAgICAgIG1TaG91bGRTdGFydFRleHRTZWxlY3Rpb25Nb2RlID0gZmFsc2U7CisgICAgICAgIGlmIChtU2hvdWxkU3RhcnRTZWxlY3Rpb25BY3Rpb25Nb2RlKSB7CisgICAgICAgICAgICBzdGFydFNlbGVjdGlvbkFjdGlvbk1vZGUoKTsKKyAgICAgICAgICAgIG1TaG91bGRTdGFydFNlbGVjdGlvbkFjdGlvbk1vZGUgPSBmYWxzZTsKICAgICAgICAgfQogICAgICAgICBtUHJlRHJhd1N0YXRlID0gUFJFRFJBV19ET05FOwogICAgICAgICByZXR1cm4gIWNoYW5nZWQ7CkBAIC0zODI4LDYgKzM4NTgsMjIgQEAKICAgICB9CiAKICAgICBAT3ZlcnJpZGUKKyAgICBwcm90ZWN0ZWQgYm9vbGVhbiBvblNldEFscGhhKGludCBhbHBoYSkgeworICAgICAgICBpZiAobU1vdmVtZW50ID09IG51bGwgJiYgZ2V0QmFja2dyb3VuZCgpID09IG51bGwpIHsKKyAgICAgICAgICAgIG1DdXJyZW50QWxwaGEgPSBhbHBoYTsKKyAgICAgICAgICAgIGZpbmFsIERyYXdhYmxlcyBkciA9IG1EcmF3YWJsZXM7CisgICAgICAgICAgICBpZiAoZHIgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGlmIChkci5tRHJhd2FibGVMZWZ0ICE9IG51bGwpIGRyLm1EcmF3YWJsZUxlZnQuc2V0QWxwaGEoYWxwaGEpOworICAgICAgICAgICAgICAgIGlmIChkci5tRHJhd2FibGVUb3AgIT0gbnVsbCkgZHIubURyYXdhYmxlVG9wLnNldEFscGhhKGFscGhhKTsKKyAgICAgICAgICAgICAgICBpZiAoZHIubURyYXdhYmxlUmlnaHQgIT0gbnVsbCkgZHIubURyYXdhYmxlUmlnaHQuc2V0QWxwaGEoYWxwaGEpOworICAgICAgICAgICAgICAgIGlmIChkci5tRHJhd2FibGVCb3R0b20gIT0gbnVsbCkgZHIubURyYXdhYmxlQm90dG9tLnNldEFscGhhKGFscGhhKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKICAgICBwcm90ZWN0ZWQgdm9pZCBvbkRyYXcoQ2FudmFzIGNhbnZhcykgewogICAgICAgICByZXN0YXJ0TWFycXVlZUlmTmVlZGVkKCk7CiAKQEAgLTM5MjQsNiArMzk3MCw3IEBACiAgICAgICAgIH0KIAogICAgICAgICBtVGV4dFBhaW50LnNldENvbG9yKGNvbG9yKTsKKyAgICAgICAgbVRleHRQYWludC5zZXRBbHBoYShtQ3VycmVudEFscGhhKTsKICAgICAgICAgbVRleHRQYWludC5kcmF3YWJsZVN0YXRlID0gZ2V0RHJhd2FibGVTdGF0ZSgpOwogCiAgICAgICAgIGNhbnZhcy5zYXZlKCk7CkBAIC00MzAzLDE1ICs0MzUwLDYgQEAKICAgICAgICAgICAgICAgICBpZiAoc2hvdWxkQWR2YW5jZUZvY3VzT25FbnRlcigpKSB7CiAgICAgICAgICAgICAgICAgICAgIHJldHVybiAwOwogICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBicmVhazsKLQotICAgICAgICAgICAgICAgIC8vIEhhcyB0byBiZSBkb25lIG9uIGtleSBkb3duIChhbmQgbm90IG9uIGtleSB1cCkgdG8gY29ycmVjdGx5IGJlIGludGVyY2VwdGVkLgotICAgICAgICAgICAgY2FzZSBLZXlFdmVudC5LRVlDT0RFX0JBQ0s6Ci0gICAgICAgICAgICAgICAgaWYgKG1Jc0luVGV4dFNlbGVjdGlvbk1vZGUpIHsKLSAgICAgICAgICAgICAgICAgICAgc3RvcFRleHRTZWxlY3Rpb25Nb2RlKCk7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiAtMTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgIH0KIAogICAgICAgICBpZiAobUlucHV0ICE9IG51bGwpIHsKQEAgLTQzOTEsNyArNDQyOSw3IEBACiAgICAgICAgIH0KIAogICAgICAgICBoaWRlQ29udHJvbGxlcnMoKTsKLQorICAgICAgICAKICAgICAgICAgc3dpdGNoIChrZXlDb2RlKSB7CiAgICAgICAgICAgICBjYXNlIEtleUV2ZW50LktFWUNPREVfRFBBRF9DRU5URVI6CiAgICAgICAgICAgICAgICAgLyoKQEAgLTQ0NjUsNyArNDUwMyw2IEBACiAKICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHN1cGVyLm9uS2V5VXAoa2V5Q29kZSwgZXZlbnQpOwogICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgfQogCiAgICAgICAgIGlmIChtSW5wdXQgIT0gbnVsbCkKQEAgLTQ4MDQsNyArNDg0MSw3IEBACiAgICAgICAgICAgICAgICAgbWFrZUJsaW5rKCk7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KLSAgICAgICAgCisKICAgICAgICAgY2hlY2tGb3JSZXNpemUoKTsKICAgICB9CiAgICAgCkBAIC00ODk1LDYgKzQ5MzIsOCBAQAogICAgICAgICAgICAgICAgIGJyZWFrOwogCiAgICAgICAgICAgICBjYXNlIEdyYXZpdHkuUklHSFQ6CisgICAgICAgICAgICAgICAgLy8gTm90ZSwgTGF5b3V0IHJlc29sdmVzIEFMSUdOX09QUE9TSVRFIHRvIGxlZnQgb3IKKyAgICAgICAgICAgICAgICAvLyByaWdodCBiYXNlZCBvbiB0aG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AgICAgICAgICAgdGhpcy5tTmV3U3RhcnQgPSBtTmV3U3RhcnQ7CiAgICAgICAgICAgICB0aGlzLm1OZXdFbmQgPSBtTmV3RW5kOwogICAgICAgICB9Ci0gICAgICAgIAorCiAgICAgICAgIEBPdmVycmlkZQogICAgICAgICBwcm90ZWN0ZWQgdm9pZCBvblJlY2VpdmVSZXN1bHQoaW50IHJlc3VsdENvZGUsIEJ1bmRsZSByZXN1bHREYXRhKSB7CiAgICAgICAgICAgICBpbnQgc3RhcnQgPSBtTmV3U3RhcnQ7CkBAIC02NjMzLDE0ICs2NjgxLDEzIEBACiAgICAgICAgICAgICAgICAgZW5kID0gbVByZXZFbmQ7CiAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgIGlmICgobVByZXZTdGFydCAhPSBtUHJldkVuZCkgJiYgKHN0YXJ0ID09IGVuZCkpIHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKChzdGFydCA+PSBtUHJldlN0YXJ0KSAmJiAoc3RhcnQgPCBtUHJldkVuZCkpIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKChzdGFydCA+PSBtUHJldlN0YXJ0KSAmJiAoc3RhcnQgPD0gbVByZXZFbmQpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAvLyBUYXBwaW5nIGluc2lkZSB0aGUgc2VsZWN0aW9uIGRvZXMgbm90aGluZwogICAgICAgICAgICAgICAgICAgICAgICAgU2VsZWN0aW9uLnNldFNlbGVjdGlvbigoU3Bhbm5hYmxlKSBtVGV4dCwgbVByZXZTdGFydCwgbVByZXZFbmQpOwotICAgICAgICAgICAgICAgICAgICAgICAgc2hvd0NvbnRleHRNZW51KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAvLyBUYXBwaW5nIG91dHNpZGUgc3RvcHMgc2VsZWN0aW9uIG1vZGUsIGlmIGFueQotICAgICAgICAgICAgICAgICAgICAgICAgc3RvcFRleHRTZWxlY3Rpb25Nb2RlKCk7CisgICAgICAgICAgICAgICAgICAgICAgICBzdG9wU2VsZWN0aW9uQWN0aW9uTW9kZSgpOwogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfQogCkBAIC02NjgyLDExICs2NzI5LDEyIEBACiAgICAgICAgICAgICByZXR1cm4gc3VwZXJSZXN1bHQ7CiAgICAgICAgIH0KIAotICAgICAgICBpZiAoKG1Nb3ZlbWVudCAhPSBudWxsIHx8IG9uQ2hlY2tJc1RleHRFZGl0b3IoKSkgJiYgbVRleHQgaW5zdGFuY2VvZiBTcGFubmFibGUgJiYgbUxheW91dCAhPSBudWxsKSB7CisgICAgICAgIGlmICgobU1vdmVtZW50ICE9IG51bGwgfHwgb25DaGVja0lzVGV4dEVkaXRvcigpKSAmJgorICAgICAgICAgICAgICAgIG1UZXh0IGluc3RhbmNlb2YgU3Bhbm5hYmxlICYmIG1MYXlvdXQgIT0gbnVsbCkgewogICAgICAgICAgICAgCiAgICAgICAgICAgICBpbnQgb2xkU2VsU3RhcnQgPSBnZXRTZWxlY3Rpb25TdGFydCgpOwogICAgICAgICAgICAgaW50IG9sZFNlbEVuZCA9IGdldFNlbGVjdGlvbkVuZCgpOwotICAgICAgICAgICAgCisKICAgICAgICAgICAgIGlmIChtSW5zZXJ0aW9uUG9pbnRDdXJzb3JDb250cm9sbGVyICE9IG51bGwpIHsKICAgICAgICAgICAgICAgICBtSW5zZXJ0aW9uUG9pbnRDdXJzb3JDb250cm9sbGVyLm9uVG91Y2hFdmVudChldmVudCk7CiAgICAgICAgICAgICB9CkBAIC02Njk1LDcgKzY3NDMsNyBAQAogICAgICAgICAgICAgfQogCiAgICAgICAgICAgICBib29sZWFuIGhhbmRsZWQgPSBmYWxzZTsKLSAgICAgICAgICAgIAorCiAgICAgICAgICAgICBpZiAobU1vdmVtZW50ICE9IG51bGwpIHsKICAgICAgICAgICAgICAgICBoYW5kbGVkIHw9IG1Nb3ZlbWVudC5vblRvdWNoRXZlbnQodGhpcywgKFNwYW5uYWJsZSkgbVRleHQsIGV2ZW50KTsKICAgICAgICAgICAgIH0KQEAgLTY3MDQsMTcgKzY3NTIsMTcgQEAKICAgICAgICAgICAgICAgICBpZiAoYWN0aW9uID09IE1vdGlvbkV2ZW50LkFDVElPTl9VUCAmJiBpc0ZvY3VzZWQoKSAmJiAhbVNjcm9sbGVkKSB7CiAgICAgICAgICAgICAgICAgICAgIElucHV0TWV0aG9kTWFuYWdlciBpbW0gPSAoSW5wdXRNZXRob2RNYW5hZ2VyKQogICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRDb250ZXh0KCkuZ2V0U3lzdGVtU2VydmljZShDb250ZXh0LklOUFVUX01FVEhPRF9TRVJWSUNFKTsKLSAgICAgICAgICAgICAgICAgICAgCisKICAgICAgICAgICAgICAgICAgICAgZmluYWwgaW50IG5ld1NlbFN0YXJ0ID0gZ2V0U2VsZWN0aW9uU3RhcnQoKTsKICAgICAgICAgICAgICAgICAgICAgZmluYWwgaW50IG5ld1NlbEVuZCA9IGdldFNlbGVjdGlvbkVuZCgpOwotICAgICAgICAgICAgICAgICAgICAKKwogICAgICAgICAgICAgICAgICAgICBDb21taXRTZWxlY3Rpb25SZWNlaXZlciBjc3IgPSBudWxsOwogICAgICAgICAgICAgICAgICAgICBpZiAobmV3U2VsU3RhcnQgIT0gb2xkU2VsU3RhcnQgfHwgbmV3U2VsRW5kICE9IG9sZFNlbEVuZCB8fAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpZFRvdWNoRm9jdXNTZWxlY3QoKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgY3NyID0gbmV3IENvbW1pdFNlbGVjdGlvblJlY2VpdmVyKG9sZFNlbFN0YXJ0LCBvbGRTZWxFbmQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ld1NlbFN0YXJ0LCBuZXdTZWxFbmQpOwogICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIAorCiAgICAgICAgICAgICAgICAgICAgIGhhbmRsZWQgfD0gaW1tLnNob3dTb2Z0SW5wdXQodGhpcywgMCwgY3NyKSAmJiAoY3NyICE9IG51bGwpOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KQEAgLTY3NDMsNyArNjc5MSw3IEBACiAgICAgICAgICAgICB9CiAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAvLyBTdG9wIHNlbGVjdGlvbiBtb2RlIGlmIHRoZSBjb250cm9sbGVyIGJlY29tZXMgdW5hdmFpbGFibGUuCi0gICAgICAgICAgICBzdG9wVGV4dFNlbGVjdGlvbk1vZGUoKTsKKyAgICAgICAgICAgIHN0b3BTZWxlY3Rpb25BY3Rpb25Nb2RlKCk7CiAgICAgICAgICAgICBtU2VsZWN0aW9uTW9kaWZpZXJDdXJzb3JDb250cm9sbGVyID0gbnVsbDsKICAgICAgICAgfQogICAgIH0KQEAgLTY4ODMsOCArNjkzMSwxMCBAQAogCiAgICAgQE92ZXJyaWRlCiAgICAgcHJvdGVjdGVkIGludCBjb21wdXRlSG9yaXpvbnRhbFNjcm9sbFJhbmdlKCkgewotICAgICAgICBpZiAobUxheW91dCAhPSBudWxsKQotICAgICAgICAgICAgcmV0dXJuIG1MYXlvdXQuZ2V0V2lkdGgoKTsKKyAgICAgICAgaWYgKG1MYXlvdXQgIT0gbnVsbCkgeworICAgICAgICAgICAgcmV0dXJuIG1TaW5nbGVMaW5lICYmIChtR3Jhdml0eSAmIEdyYXZpdHkuSE9SSVpPTlRBTF9HUkFWSVRZX01BU0spID09IEdyYXZpdHkuTEVGVCA/CisgICAgICAgICAgICAgICAgICAgIChpbnQpIG1MYXlvdXQuZ2V0TGluZVdpZHRoKDApIDogbUxheW91dC5nZXRXaWR0aCgpOworICAgICAgICB9CiAKICAgICAgICAgcmV0dXJuIHN1cGVyLmNvbXB1dGVIb3Jpem9udGFsU2Nyb2xsUmF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bCkgewotICAgICAgICAgICAgcmV0dXJuIG51bGw7Ci0gICAgICAgIH0KIAotICAgICAgICBpbnQgb2Zmc2V0ID0gKChTZWxlY3Rpb25Nb2RpZmllckN1cnNvckNvbnRyb2xsZXIpIG1TZWxlY3Rpb25Nb2RpZmllckN1cnNvckNvbnRyb2xsZXIpLgotICAgICAgICAgICAgICAgICAgICAgZ2V0TWluVG91Y2hPZmZzZXQoKTsKLQotICAgICAgICBsb25nIHdvcmRMaW1pdHMgPSBnZXRXb3JkTGltaXRzQXQob2Zmc2V0KTsKLSAgICAgICAgaWYgKHdvcmRMaW1pdHMgPj0gMCkgewotICAgICAgICAgICAgaW50IHN0YXJ0ID0gKGludCkgKHdvcmRMaW1pdHMgPj4+IDMyKTsKLSAgICAgICAgICAgIGludCBlbmQgPSAoaW50KSAod29yZExpbWl0cyAmIDB4MDAwMDAwMDBGRkZGRkZGRkwpOwotICAgICAgICAgICAgcmV0dXJuIG1UcmFuc2Zvcm1lZC5zdWJTZXF1ZW5jZShzdGFydCwgZW5kKS50b1N0cmluZygpOwotICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgcmV0dXJuIG51bGw7Ci0gICAgICAgIH0KLSAgICAgICAgCi0gICAgfQotICAgIAogICAgIEBPdmVycmlkZQogICAgIHB1YmxpYyBib29sZWFuIGRpc3BhdGNoUG9wdWxhdGVBY2Nlc3NpYmlsaXR5RXZlbnQoQWNjZXNzaWJpbGl0eUV2ZW50IGV2ZW50KSB7CiAgICAgICAgIGlmICghaXNTaG93bigpKSB7CkBAIC03MjE2LDk3ICs3MjQ3LDM0IEBACiAgICAgICAgIHN1cGVyLm9uQ3JlYXRlQ29udGV4dE1lbnUobWVudSk7CiAgICAgICAgIGJvb2xlYW4gYWRkZWQgPSBmYWxzZTsKIAotICAgICAgICBpZiAobUlzSW5UZXh0U2VsZWN0aW9uTW9kZSkgewotICAgICAgICAgICAgTWVudUhhbmRsZXIgaGFuZGxlciA9IG5ldyBNZW51SGFuZGxlcigpOwotICAgICAgICAgICAgCi0gICAgICAgICAgICBpZiAoY2FuQ3V0KCkpIHsKLSAgICAgICAgICAgICAgICBtZW51LmFkZCgwLCBJRF9DVVQsIDAsIGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3RyaW5nLmN1dCkuCi0gICAgICAgICAgICAgICAgICAgICBzZXRPbk1lbnVJdGVtQ2xpY2tMaXN0ZW5lcihoYW5kbGVyKS4KLSAgICAgICAgICAgICAgICAgICAgIHNldEFscGhhYmV0aWNTaG9ydGN1dCgneCcpOwotICAgICAgICAgICAgfQorICAgICAgICBNZW51SGFuZGxlciBoYW5kbGVyID0gbmV3IE1lbnVIYW5kbGVyKCk7CiAKLSAgICAgICAgICAgIGlmIChjYW5Db3B5KCkpIHsKLSAgICAgICAgICAgICAgICBtZW51LmFkZCgwLCBJRF9DT1BZLCAwLCBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0cmluZy5jb3B5KS4KLSAgICAgICAgICAgICAgICAgICAgIHNldE9uTWVudUl0ZW1DbGlja0xpc3RlbmVyKGhhbmRsZXIpLgotICAgICAgICAgICAgICAgICAgICAgc2V0QWxwaGFiZXRpY1Nob3J0Y3V0KCdjJyk7Ci0gICAgICAgICAgICB9CisgICAgICAgIGlmIChtVGV4dCBpbnN0YW5jZW9mIFNwYW5uZWQpIHsKKyAgICAgICAgICAgIGludCBzZWxTdGFydCA9IGdldFNlbGVjdGlvblN0YXJ0KCk7CisgICAgICAgICAgICBpbnQgc2VsRW5kID0gZ2V0U2VsZWN0aW9uRW5kKCk7CiAKLSAgICAgICAgICAgIGlmIChjYW5QYXN0ZSgpKSB7Ci0gICAgICAgICAgICAgICAgbWVudS5hZGQoMCwgSURfUEFTVEUsIDAsIGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3RyaW5nLnBhc3RlKS4KLSAgICAgICAgICAgICAgICAgICAgIHNldE9uTWVudUl0ZW1DbGlja0xpc3RlbmVyKGhhbmRsZXIpLgotICAgICAgICAgICAgICAgICAgICAgc2V0QWxwaGFiZXRpY1Nob3J0Y3V0KCd2Jyk7Ci0gICAgICAgICAgICB9CisgICAgICAgICAgICBpbnQgbWluID0gTWF0aC5taW4oc2VsU3RhcnQsIHNlbEVuZCk7CisgICAgICAgICAgICBpbnQgbWF4ID0gTWF0aC5tYXgoc2VsU3RhcnQsIHNlbEVuZCk7CiAKKyAgICAgICAgICAgIFVSTFNwYW5bXSB1cmxzID0gKChTcGFubmVkKSBtVGV4dCkuZ2V0U3BhbnMobWluLCBtYXgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFVSTFNwYW4uY2xhc3MpOworICAgICAgICAgICAgaWYgKHVybHMubGVuZ3RoID09IDEpIHsKKyAgICAgICAgICAgICAgICBtZW51LmFkZCgwLCBJRF9DT1BZX1VSTCwgMCwKKyAgICAgICAgICAgICAgICAgICAgICAgICBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0cmluZy5jb3B5VXJsKS4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXRPbk1lbnVJdGVtQ2xpY2tMaXN0ZW5lcihoYW5kbGVyKTsKKworICAgICAgICAgICAgICAgIGFkZGVkID0gdHJ1ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgLy8gVGhlIGNvbnRleHQgbWVudSBpcyBub3QgZW1wdHksIHdoaWNoIHdpbGwgcHJldmVudCB0aGUgc2VsZWN0aW9uIG1vZGUgZnJvbSBzdGFydGluZy4KKyAgICAgICAgLy8gQWRkIGEgZW50cnkgdG8gc3RhcnQgaXQgaW4gdGhlIGNvbnRleHQgbWVudS4KKyAgICAgICAgLy8gVE9ETyBEb2VzIG5vdCBoYW5kbGUgdGhlIGNhc2Ugd2hlcmUgYSBzdWJjbGFzcyBkb2VzIG5vdCBjYWxsIHN1cGVyLnRoaXNNZXRob2Qgb3IKKyAgICAgICAgLy8gcG9wdWxhdGVzIHRoZSBtZW51IEFGVEVSIHRoaXMgY2FsbC4KKyAgICAgICAgaWYgKG1lbnUuc2l6ZSgpID4gMCkgeworICAgICAgICAgICAgbWVudS5hZGQoMCwgSURfU0VMRUNUSU9OX01PREUsIDAsIGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3RyaW5nLnNlbGVjdFRleHRNb2RlKS4KKyAgICAgICAgICAgIHNldE9uTWVudUl0ZW1DbGlja0xpc3RlbmVyKGhhbmRsZXIpOwogICAgICAgICAgICAgYWRkZWQgPSB0cnVlOwotICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgLyoKLSAgICAgICAgICAgIGlmICghaXNGb2N1c2VkKCkpIHsKLSAgICAgICAgICAgICAgICBpZiAoaXNGb2N1c2FibGUoKSAmJiBtSW5wdXQgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICBpZiAoY2FuQ29weSgpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBNZW51SGFuZGxlciBoYW5kbGVyID0gbmV3IE1lbnVIYW5kbGVyKCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBtZW51LmFkZCgwLCBJRF9DT1BZLCAwLCBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0cmluZy5jb3B5KS4KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0T25NZW51SXRlbUNsaWNrTGlzdGVuZXIoaGFuZGxlcikuCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldEFscGhhYmV0aWNTaG9ydGN1dCgnYycpOwotICAgICAgICAgICAgICAgICAgICAgICAgbWVudS5zZXRIZWFkZXJUaXRsZShjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0cmluZy5lZGl0VGV4dE1lbnVUaXRsZSk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAvL3JldHVybjsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAqLwotICAgICAgICAgICAgTWVudUhhbmRsZXIgaGFuZGxlciA9IG5ldyBNZW51SGFuZGxlcigpOwotCi0gICAgICAgICAgICBpZiAoY2FuU2VsZWN0VGV4dCgpKSB7Ci0gICAgICAgICAgICAgICAgbWVudS5hZGQoMCwgSURfU1RBUlRfU0VMRUNUSU5HX1RFWFQsIDAsIGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3RyaW5nLnNlbGVjdFRleHQpLgotICAgICAgICAgICAgICAgIHNldE9uTWVudUl0ZW1DbGlja0xpc3RlbmVyKGhhbmRsZXIpOwotICAgICAgICAgICAgICAgIGFkZGVkID0gdHJ1ZTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIAotICAgICAgICAgICAgaWYgKGNhblNlbGVjdEFsbCgpKSB7Ci0gICAgICAgICAgICAgICAgbWVudS5hZGQoMCwgSURfU0VMRUNUX0FMTCwgMCwgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHJpbmcuc2VsZWN0QWxsKS4KLSAgICAgICAgICAgICAgICAgICAgIHNldE9uTWVudUl0ZW1DbGlja0xpc3RlbmVyKGhhbmRsZXIpLgotICAgICAgICAgICAgICAgICAgICAgc2V0QWxwaGFiZXRpY1Nob3J0Y3V0KCdhJyk7Ci0gICAgICAgICAgICAgICAgYWRkZWQgPSB0cnVlOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBpZiAobVRleHQgaW5zdGFuY2VvZiBTcGFubmVkKSB7Ci0gICAgICAgICAgICAgICAgaW50IHNlbFN0YXJ0ID0gZ2V0U2VsZWN0aW9uU3RhcnQoKTsKLSAgICAgICAgICAgICAgICBpbnQgc2VsRW5kID0gZ2V0U2VsZWN0aW9uRW5kKCk7Ci0KLSAgICAgICAgICAgICAgICBpbnQgbWluID0gTWF0aC5taW4oc2VsU3RhcnQsIHNlbEVuZCk7Ci0gICAgICAgICAgICAgICAgaW50IG1heCA9IE1hdGgubWF4KHNlbFN0YXJ0LCBzZWxFbmQpOwotCi0gICAgICAgICAgICAgICAgVVJMU3BhbltdIHVybHMgPSAoKFNwYW5uZWQpIG1UZXh0KS5nZXRTcGFucyhtaW4sIG1heCwKLSAgICAgICAgICAgICAgICAgICAgICAgIFVSTFNwYW4uY2xhc3MpOwotICAgICAgICAgICAgICAgIGlmICh1cmxzLmxlbmd0aCA9PSAxKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1lbnUuYWRkKDAsIElEX0NPUFlfVVJMLCAwLCBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0cmluZy5jb3B5VXJsKS4KLSAgICAgICAgICAgICAgICAgICAgICAgICBzZXRPbk1lbnVJdGVtQ2xpY2tMaXN0ZW5lcihoYW5kbGVyKTsKLSAgICAgICAgICAgICAgICAgICAgYWRkZWQgPSB0cnVlOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIAotICAgICAgICAgICAgLy8gUGFzdGUgbG9jYXRpb24gaXMgdG9vIGltcHJlY2lzZS4gT25seSBhbGxvdyBvbiBlbXB0eSB0ZXh0IGZpZWxkcy4KLSAgICAgICAgICAgIGlmIChjYW5QYXN0ZSgpICYmIHRleHRJc09ubHlTcGFjZXMoKSkgewotICAgICAgICAgICAgICAgIG1lbnUuYWRkKDAsIElEX1BBU1RFLCAwLCBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0cmluZy5wYXN0ZSkuCi0gICAgICAgICAgICAgICAgICAgICBzZXRPbk1lbnVJdGVtQ2xpY2tMaXN0ZW5lcihoYW5kbGVyKS4KLSAgICAgICAgICAgICAgICAgICAgIHNldEFscGhhYmV0aWNTaG9ydGN1dCgndicpOwotICAgICAgICAgICAgICAgIGFkZGVkID0gdHJ1ZTsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgaWYgKGlzSW5wdXRNZXRob2RUYXJnZXQoKSkgewotICAgICAgICAgICAgICAgIG1lbnUuYWRkKDEsIElEX1NXSVRDSF9JTlBVVF9NRVRIT0QsIDAsIGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3RyaW5nLmlucHV0TWV0aG9kKS4KLSAgICAgICAgICAgICAgICAgICAgIHNldE9uTWVudUl0ZW1DbGlja0xpc3RlbmVyKGhhbmRsZXIpOwotICAgICAgICAgICAgICAgIGFkZGVkID0gdHJ1ZTsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgU3RyaW5nIHdvcmQgPSBnZXRXb3JkRm9yRGljdGlvbmFyeSgpOwotICAgICAgICAgICAgaWYgKHdvcmQgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIG1lbnUuYWRkKDEsIElEX0FERF9UT19ESUNUSU9OQVJZLCAwLAotICAgICAgICAgICAgICAgICAgICAgZ2V0Q29udGV4dCgpLmdldFN0cmluZyhjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0cmluZy5hZGRUb0RpY3Rpb25hcnksIHdvcmQpKS4KLSAgICAgICAgICAgICAgICAgICAgIHNldE9uTWVudUl0ZW1DbGlja0xpc3RlbmVyKGhhbmRsZXIpOwotICAgICAgICAgICAgICAgIGFkZGVkID0gdHJ1ZTsKLQotICAgICAgICAgICAgfQogICAgICAgICB9CiAKICAgICAgICAgaWYgKGFkZGVkKSB7CkBAIC03MzE0LDE3ICs3MjgyLDYgQEAKICAgICAgICAgfQogICAgIH0KIAotICAgIHByaXZhdGUgYm9vbGVhbiB0ZXh0SXNPbmx5U3BhY2VzKCkgewotICAgICAgICBmaW5hbCBpbnQgbGVuZ3RoID0gbVRyYW5zZm9ybWVkLmxlbmd0aCgpOwotICAgICAgICBmb3IgKGludCBpPTA7IGk8bGVuZ3RoOyBpKyspIHsKLSAgICAgICAgICAgIGZpbmFsIGNoYXIgYyA9IG1UcmFuc2Zvcm1lZC5jaGFyQXQoaSk7Ci0gICAgICAgICAgICBmaW5hbCBpbnQgdHlwZSA9IENoYXJhY3Rlci5nZXRUeXBlKGMpOwotICAgICAgICAgICAgaWYgKHR5cGUgIT0gQ2hhcmFjdGVyLlNQQUNFX1NFUEFSQVRPUikKLS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UNUX0FMTDoKLSAgICAgICAgICAgICAgICBTZWxlY3Rpb24uc2V0U2VsZWN0aW9uKChTcGFubmFibGUpIG1UZXh0LCAwLCBtVGV4dC5sZW5ndGgoKSk7Ci0gICAgICAgICAgICAgICAgc3RhcnRUZXh0U2VsZWN0aW9uTW9kZSgpOwotICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwotCi0gICAgICAgICAgICBjYXNlIElEX1NUQVJUX1NFTEVDVElOR19URVhUOgotICAgICAgICAgICAgICAgIHN0YXJ0VGV4dFNlbGVjdGlvbk1vZGUoKTsKLSAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKLQotICAgICAgICAgICAgY2FzZSBJRF9DVVQ6ICAgICAgICAgICAgICAgIAotICAgICAgICAgICAgICAgIGNsaXAuc2V0VGV4dChtVHJhbnNmb3JtZWQuc3ViU2VxdWVuY2UobWluLCBtYXgpKTsKLSAgICAgICAgICAgICAgICAoKEVkaXRhYmxlKSBtVGV4dCkuZGVsZXRlKG1pbiwgbWF4KTsKLSAgICAgICAgICAgICAgICBzdG9wVGV4dFNlbGVjdGlvbk1vZGUoKTsKLSAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKLQotICAgICAgICAgICAgY2FzZSBJRF9DT1BZOgotICAgICAgICAgICAgICAgIGNsaXAuc2V0VGV4dChtVHJhbnNmb3JtZWQuc3ViU2VxdWVuY2UobWluLCBtYXgpKTsKLSAgICAgICAgICAgICAgICBzdG9wVGV4dFNlbGVjdGlvbk1vZGUoKTsKLSAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKLQotICAgICAgICAgICAgY2FzZSBJRF9QQVNURToKLSAgICAgICAgICAgICAgICBDaGFyU2VxdWVuY2UgcGFzdGUgPSBjbGlwLmdldFRleHQoKTsKLQotICAgICAgICAgICAgICAgIGlmIChwYXN0ZSAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIFNlbGVjdGlvbi5zZXRTZWxlY3Rpb24oKFNwYW5uYWJsZSkgbVRleHQsIG1heCk7Ci0gICAgICAgICAgICAgICAgICAgICgoRWRpdGFibGUpIG1UZXh0KS5yZXBsYWNlKG1pbiwgbWF4LCBwYXN0ZSk7Ci0gICAgICAgICAgICAgICAgICAgIHN0b3BUZXh0U2VsZWN0aW9uTW9kZSgpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKLQogICAgICAgICAgICAgY2FzZSBJRF9DT1BZX1VSTDoKKyAgICAgICAgICAgICAgICBNZXRhS2V5S2V5TGlzdGVuZXIuc3RvcFNlbGVjdGluZyh0aGlzLCAoU3Bhbm5hYmxlKSBtVGV4dCk7CisKICAgICAgICAgICAgICAgICBVUkxTcGFuW10gdXJscyA9ICgoU3Bhbm5lZCkgbVRleHQpLmdldFNwYW5zKG1pbiwgbWF4LCBVUkxTcGFuLmNsYXNzKTsKLSAgICAgICAgICAgICAgICBpZiAodXJscy5sZW5ndGggPT0gMSkgewotICAgICAgICAgICAgICAgICAgICBjbGlwLnNldFRleHQodXJsc1swXS5nZXRVUkwoKSk7CisgICAgICAgICAgICAgICAgaWYgKHVybHMubGVuZ3RoID49IDEpIHsKKyAgICAgICAgICAgICAgICAgICAgQ2xpcERhdGEgY2xpcCA9IG51bGw7CisgICAgICAgICAgICAgICAgICAgIGZvciAoaW50IGk9MDsgaTx1cmxzLmxlbmd0aDsgaSsrKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBVcmkgdXJpID0gVXJpLnBhcnNlKHVybHNbMF0uZ2V0VVJMKCkpOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNsaXAgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsaXAgPSBDbGlwRGF0YS5uZXdSYXdVcmkobnVsbCwgbnVsbCwgdXJpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xpcC5hZGRJdGVtKG5ldyBDbGlwRGF0YS5JdGVtKHVyaSkpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGlmIChjbGlwICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNsaXBib2FyZC5zZXRQcmltYXJ5Q2xpcChjbGlwKTsKKyAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKIAotICAgICAgICAgICAgY2FzZSBJRF9TV0lUQ0hfSU5QVVRfTUVUSE9EOgotICAgICAgICAgICAgICAgIElucHV0TWV0aG9kTWFuYWdlciBpbW0gPSBJbnB1dE1ldGhvZE1hbmFnZXIucGVla0luc3RhbmNlKCk7Ci0gICAgICAgICAgICAgICAgaWYgKGltbSAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIGltbS5zaG93SW5wdXRNZXRob2RQaWNrZXIoKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7Ci0KLSAgICAgICAgICAgIGNhc2UgSURfQUREX1RPX0RJQ1RJT05BUlk6Ci0gICAgICAgICAgICAgICAgU3RyaW5nIHdvcmQgPSBnZXRXb3JkRm9yRGljdGlvbmFyeSgpOwotCi0gICAgICAgICAgICAgICAgaWYgKHdvcmQgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICBJbnRlbnQgaSA9IG5ldyBJbnRlbnQoImNvbS5hbmRyb2lkLnNldHRpbmdzLlVTRVJfRElDVElPTkFSWV9JTlNFUlQiKTsKLSAgICAgICAgICAgICAgICAgICAgaS5wdXRFeHRyYSgid29yZCIsIHdvcmQpOwotICAgICAgICAgICAgICAgICAgICBpLnNldEZsYWdzKGkuZ2V0RmxhZ3MoKSB8IEludGVudC5GTEFHX0FDVElWSVRZX05FV19UQVNLKTsKLSAgICAgICAgICAgICAgICAgICAgZ2V0Q29udGV4dCgpLnN0YXJ0QWN0aXZpdHkoaSk7Ci0gICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgY2FzZSBJRF9TRUxFQ1RJT05fTU9ERToKKyAgICAgICAgICAgICAgICBzdGFydFNlbGVjdGlvbkFjdGlvbk1vZGUoKTsKICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgICAgIH0KIApAQCAtNzQzOSwzMyArNzM1OSw4MSBAQAogICAgICAgICAgICAgbUVhdFRvdWNoUmVsZWFzZSA9IHRydWU7CiAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgaWYgKHN0YXJ0U2VsZWN0aW9uQWN0aW9uTW9kZSgpKSB7CisgICAgICAgICAgICBwZXJmb3JtSGFwdGljRmVlZGJhY2soSGFwdGljRmVlZGJhY2tDb25zdGFudHMuTE9OR19QUkVTUyk7CisgICAgICAgICAgICBtRWF0VG91Y2hSZWxlYXNlID0gdHJ1ZTsKKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9CiAKICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgIH0KIAotICAgIHByaXZhdGUgdm9pZCBzdGFydFRleHRTZWxlY3Rpb25Nb2RlKCkgewotICAgICAgICBpZiAobVNlbGVjdGlvbk1vZGlmaWVyQ3Vyc29yQ29udHJvbGxlciA9PSBudWxsKSB7Ci0gICAgICAgICAgICBMb2cudyhMT0dfVEFHLCAiVGV4dFZpZXcgaGFzIG5vIHNlbGVjdGlvbiBjb250cm9sbGVyLiBBY3Rpb24gbW9kZSBjYW5jZWxsZWQuIik7Ci0gICAgICAgICAgICByZXR1cm47CisgICAgcHJpdmF0ZSBib29sZWFuIHRvdWNoUG9zaXRpb25Jc0luU2VsZWN0aW9uKCkgeworICAgICAgICBpbnQgc2VsZWN0aW9uU3RhcnQgPSBnZXRTZWxlY3Rpb25TdGFydCgpOworICAgICAgICBpbnQgc2VsZWN0aW9uR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Y3Rpb25BY3Rpb25Nb2RlQ2FsbGJhY2sgaW1wbGVtZW50cyBBY3Rpb25Nb2RlLkNhbGxiYWNrIHsKKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIGJvb2xlYW4gb25DcmVhdGVBY3Rpb25Nb2RlKEFjdGlvbk1vZGUgbW9kZSwgTWVudSBtZW51KSB7CisgICAgICAgICAgICBpZiAobVNlbGVjdGlvbk1vZGlmaWVyQ3Vyc29yQ29udHJvbGxlciA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgTG9nLncoTE9HX1RBRywgIlRleHRWaWV3IGhhcyBubyBzZWxlY3Rpb24gY29udHJvbGxlci4gQWN0aW9uIG1vZGUgY2FuY2VsbGVkLiIpOworICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKCFyZXF1ZXN0Rm9jdXMoKSkgeworICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgbW9kZS5zZXRUaXRsZShtQ29udGV4dC5nZXRTdHJpbmcoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHJpbmcudGV4dFNlbGVjdGlvbkNBQlRpdGxlKSk7CisgICAgICAgICAgICBtb2RlLnNldFN1YnRpdGxlKG51bGwpOworCisgICAgICAgICAgICBzZWxlY3RDdXJyZW50V29yZCgpOworCisgICAgICAgICAgICBib29sZWFuIGF0TGVhc3RPbmUgPSBmYWxzZTsKKworICAgICAgICAgICAgaWYgKGNhblNlbGVjdEFsbCgpKSB7CisgICAgICAgICAgICAgICAgbWVudS5hZGQoMCwgSURfU0VMRUNUX0FMTCwgMCwgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHJpbmcuc2VsZWN0QWxsKS4KKyAgICAgICAgICAgICAgICAgICAgc2V0SWNvbihjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmRyYXdhYmxlLmljX21lbnVfY2hhdF9kYXNoYm9hcmQpLgorICAgICAgICAgICAgICAgICAgICBzZXRBbHBoYWJldGljU2hvcnRjdXQoJ2EnKTsKKyAgICAgICAgICAgICAgICBhdExlYXN0T25lID0gdHJ1ZTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKGNhbkN1dCgpKSB7CisgICAgICAgICAgICAgICAgbWVudS5hZGQoMCwgSURfQ1VULCAwLCBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0cmluZy5jdXQpLgorICAgICAgICAgICAgICAgICAgICBzZXRJY29uKGNvbS5hbmRyb2lkLmludGVybmFsLlIuZHJhd2FibGUuaWNfbWVudV9jb21wb3NlKS4KKyAgICAgICAgICAgICAgICAgICAgc2V0QWxwaGFiZXRpY1Nob3J0Y3V0KCd4Jyk7CisgICAgICAgICAgICAgICAgYXRMZWFzdE9uZSA9IHRydWU7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmIChjYW5Db3B5KCkpIHsKKyAgICAgICAgICAgICAgICBtZW51LmFkZCgwLCBJRF9DT1BZLCAwLCBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0cmluZy5jb3B5KS4KKyAgICAgICAgICAgICAgICAgICAgc2V0SWNvbihjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmRyYXdhYmxlLmljX21lbnVfYXR0YWNobWVudCkuCisgICAgICAgICAgICAgICAgICAgIHNldEFscGhhYmV0aWNTaG9ydGN1dCgnYycpOworICAgICAgICAgICAgICAgIGF0TGVhc3RPbmUgPSB0cnVlOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAoY2FuUGFzdGUoKSkgeworICAgICAgICAgICAgICAgIG1lbnUuYWRkKDAsIElEX1BBU1RFLCAwLCBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0cmluZy5wYXN0ZSkuCisgICAgICAgICAgICAgICAgICAgICAgICBzZXRJY29uKGNvbS5hbmRyb2lkLmludGVybmFsLlIuZHJhd2FibGUuaWNfbWVudV9jYW1lcmEpLgorICAgICAgICAgICAgICAgICAgICAgICAgc2V0QWxwaGFiZXRpY1Nob3J0Y3V0KCd2Jyk7CisgICAgICAgICAgICAgICAgYXRMZWFzdE9uZSA9IHRydWU7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmIChhdExlYXN0T25lKSB7CisgICAgICAgICAgICAgICAgbVNlbGVjdGlvbk1vZGlmaWVyQ3Vyc29yQ29udHJvbGxlci5zaG93KCk7CisgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgYm9vbGVhbiBvblByZXBhcmVBY3Rpb25Nb2RlKEFjdGlvbk1vZGUgbW9kZSwgTWVudSBtZW51KSB7CisgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgYm9vbGVhbiBvbkFjdGlvbkl0ZW1DbGlja2VkKEFjdGlvbk1vZGUgbW9kZSwgTWVudUl0ZW0gaXRlbSkgeworICAgICAgICAgICAgZmluYWwgaW50IGl0ZW1JZCA9IGl0ZW0uZ2V0SXRlbUlkKCk7CisKKyAgICAgICAgICAgIGlmIChpdGVtSWQgPT0gSURfU0VMRUNUX0FMTCkgeworICAgICAgICAgICAgICAgIFNlbGVjdGlvbi5zZXRTZWxlY3Rpb24oKFNwYW5uYWJsZSkgbVRleHQsIDAsIG1UZXh0Lmxlbmd0aCgpKTsKKyAgICAgICAgICAgICAgICAvLyBVcGRhdGUgY29udHJvbGxlciBwb3NpdGlvbnMgYWZ0ZXIgc2VsZWN0aW9uIGNoYW5nZS4KKyAgICAgICAgICAgICAgICBpZiAobVNlbGVjdGlvbk1vZGlmaWVyQ3Vyc29yQ29udHJvbGxlciAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIG1TZWxlY3Rpb25Nb2RpZmllckN1cnNvckNvbnRyb2xsZXIuc2hvdygpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgQ2xpcGJvYXJkTWFuYWdlciBjbGlwYm9hcmQgPSAoQ2xpcGJvYXJkTWFuYWdlcikgZ2V0Q29udGV4dCgpLgorICAgICAgICAgICAgICAgICAgICBnZXRTeXN0ZW1TZXJ2aWNlKENvbnRleHQuQ0xJUEJPQVJEX1NFUlZJQ0UpOworCisgICAgICAgICAgICBpbnQgbWluID0gMDsKKyAgICAgICAgICAgIGludCBtYXggPSBtVGV4dC5sZW5ndGgoKTsKKworICAgICAgICAgICAgaWYgKGlzRm9jdXNlZCgpKSB7CisgICAgICAgICAgICAgICAgZmluYWwgaW50IHNlbFN0YXJ0ID0gZ2V0U2VsZWN0aW9uU3RhcnQoKTsKKyAgICAgICAgICAgICAgICBmaW5hbCBpbnQgc2VsRW5kID0gZ2V0U2VsZWN0aW9uRW5kKCk7CisKKyAgICAgICAgICAgICAgICBtaW4gPSBNYXRoLm1heCgwLCBNYXRoLm1pbihzZWxTdGFydCwgc2VsRW5kKSk7CisgICAgICAgICAgICAgICAgbWF4ID0gTWF0aC5tYXgoMCwgTWF0aC5tYXgoc2VsU3RhcnQsIHNlbEVuZCkpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBzd2l0Y2ggKGl0ZW0uZ2V0SXRlbUlkKCkpIHsKKyAgICAgICAgICAgICAgICBjYXNlIElEX1BBU1RFOgorICAgICAgICAgICAgICAgICAgICBDbGlwRGF0YSBjbGlwID0gY2xpcGJvYXJkLmdldFByaW1hcnlDbGlwKCk7CisgICAgICAgICAgICAgICAgICAgIGlmIChjbGlwICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJvb2xlYW4gZGlkZmlyc3QgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoaW50IGk9MDsgaTxjbGlwLmdldEl0ZW1Db3VudCgpOyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBDaGFyU2VxdWVuY2UgcGFzdGUgPSBjbGlwLmdldEl0ZW0oaSkuY29lcmNlVG9UZXh0KGdldENvbnRleHQoKSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHBhc3RlICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFkaWRmaXJzdCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU2VsZWN0aW9uLnNldFNlbGVjdGlvbigoU3Bhbm5hYmxlKSBtVGV4dCwgbWF4KTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICgoRWRpdGFibGUpIG1UZXh0KS5yZXBsYWNlKG1pbiwgbWF4LCBwYXN0ZSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoKEVkaXRhYmxlKSBtVGV4dCkuaW5zZXJ0KGdldFNlbGVjdGlvbkVuZCgpLCAiXG4iKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICgoRWRpdGFibGUpIG1UZXh0KS5pbnNlcnQoZ2V0U2VsZWN0aW9uRW5kKCksIHBhc3RlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIHN0b3BTZWxlY3Rpb25BY3Rpb25Nb2RlKCk7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKworICAgICAgICAgICAgICAgIGNhc2UgSURfQ1VUOgorICAgICAgICAgICAgICAgICAgICBjbGlwYm9hcmQuc2V0UHJpbWFyeUNsaXAoQ2xpcERhdGEubmV3UGxhaW5UZXh0KG51bGwsIG51bGwsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVRyYW5zZm9ybWVkLnN1YlNlcXVlbmNlKG1pbiwgbWF4KSkpOworICAgICAgICAgICAgICAgICAgICAoKEVkaXRhYmxlKSBtVGV4dCkuZGVsZXRlKG1pbiwgbWF4KTsKKyAgICAgICAgICAgICAgICAgICAgc3RvcFNlbGVjdGlvbkFjdGlvbk1vZGUoKTsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisKKyAgICAgICAgICAgICAgICBjYXNlIElEX0NPUFk6CisgICAgICAgICAgICAgICAgICAgIGNsaXBib2FyZC5zZXRQcmltYXJ5Q2xpcChDbGlwRGF0YS5uZXdQbGFpblRleHQobnVsbCwgbnVsbCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtVHJhbnNmb3JtZWQuc3ViU2VxdWVuY2UobWluLCBtYXgpKSk7CisgICAgICAgICAgICAgICAgICAgIHN0b3BTZWxlY3Rpb25BY3Rpb25Nb2RlKCk7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgb25EZXN0cm95QWN0aW9uTW9kZShBY3Rpb25Nb2RlIG1vZGUpIHsKKyAgICAgICAgICAgIFNlbGVjdGlvbi5zZXRTZWxlY3Rpb24oKFNwYW5uYWJsZSkgbVRleHQsIGdldFNlbGVjdGlvblN0YXJ0KCkpOwogICAgICAgICAgICAgaWYgKG1TZWxlY3Rpb25Nb2RpZmllckN1cnNvckNvbnRyb2xsZXIgIT0gbnVsbCkgewogICAgICAgICAgICAgICAgIG1TZWxlY3Rpb25Nb2RpZmllckN1cnNvckNvbnRyb2xsZXIuaGlkZSgpOwogICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBtSXNJblRleHRTZWxlY3Rpb25Nb2RlID0gZmFsc2U7CisgICAgICAgICAgICBtU2VsZWN0aW9uQWN0aW9uTW9kZSA9IG51bGw7CiAgICAgICAgIH0KICAgICB9CiAKQEAgLTc1NDksNyArNzY0OSw3IEBACiAgICAgICAgIEhhbmRsZShEcmF3YWJsZSBkcmF3YWJsZSkgewogICAgICAgICAgICAgbURyYXdhYmxlID0gZHJhd2FibGU7CiAgICAgICAgIH0KLQorICAgICAgICAKICAgICAgICAgdm9pZCBwb3NpdGlvbkF0Q3Vyc29yKGZpbmFsIGludCBvZmZzZXQsIGJvb2xlYW4gYm90dG9tKSB7CiAgICAgICAgICAgICBmaW5hbCBpbnQgZHJhd2FibGVXaWR0aCA9IG1EcmF3YWJsZS5nZXRJbnRyaW5zaWNXaWR0aCgpOwogICAgICAgICAgICAgZmluYWwgaW50IGRyYXdhYmxlSGVpZ2h0ID0gbURyYXdhYmxlLmdldEludHJpbnNpY0hlaWdodCgpOwpAQCAtNzU2OSw3ICs3NjY5LDcgQEAKICAgICAgICAgICAgIC8vIEV4dGVuZCB0b3VjaCByZWdpb24gdXAgd2hlbiBlZGl0aW5nIHRoZSBsYXN0IGxpbmUgb2YgdGV4dCAob3IgYSBzaW5nbGUgbGluZSkgc28gdGhhdAogICAgICAgICAgICAgLy8gaXQgaXMgZWFzaWVyIHRvIGdyYWIuCiAgICAgICAgICAgICBpZiAobGluZSA9PSBtTGF5b3V0LmdldExpbmVDb3VudCgpIC0gMSkgewotICAgICAgICAgICAgICAgIG1Ub3BFeHRlbnNpb24gPSAobGluZUJvdHRvbSAtIGxpbmVUb3ApIC0gZHJhd2FibGVIZWlnaHQgLyAyOworICAgICAgICAgICAgICAgICAgbVRvcEV4dGVuc2lvbiA9IChsaW5lQm90dG9tIC0gbGluZVRvcCkgLSBkcmF3YWJsZUhlaWdodCAvIDI7CiAgICAgICAg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ZWN0aW9uRW5kKTsKICAgICAgICAgICAgIG1TdGFydEhhbmRsZS5wb3NpdGlvbkF0Q3Vyc29yKHNlbGVjdGlvblN0YXJ0LCBvbmVMaW5lU2VsZWN0aW9uKTsKICAgICAgICAgICAgIG1FbmRIYW5kbGUucG9zaXRpb25BdEN1cnNvcihzZWxlY3Rpb25FbmQsIHRydWUpOwogCkBAIC03OTA3LDIyICs4MDA2LDEyIEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtT2Zmc2V0WCA9IChib3VuZHMubGVmdCArIGJvdW5kcy5yaWdodCkgLyAyLjBmIC0geDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1PZmZzZXRZID0gZHJhZ2dlZEhhbmRsZS5tSG90U3BvdFZlcnRpY2FsUG9zaXRpb24gLSB5OwogCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtT25Eb3duVGltZXJTdGFydCA9IGV2ZW50LmdldEV2ZW50VGltZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKChBcnJvd0tleU1vdmVtZW50TWV0aG9kKW1Nb3ZlbWVudCkuc2V0Q3Vyc29yQ29udHJvbGxlcih0aGlzKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogCi0gICAgICAgICAgICAgICAgICAgIGNhc2UgTW90aW9uRXZlbnQuQUNUSU9OX1VQOgotICAgICAgICAgICAgICAgICAgICAgICAgaW50IHRpbWUgPSAoaW50KSAoZXZlbnQuZ2V0RXZlbnRUaW1lKCkgLSBtT25Eb3duVGltZXJTdGFydCk7Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0aW1lIDw9IFZpZXdDb25maWd1cmF0aW9uLmdldFRhcFRpbWVvdXQoKSkgewotICAg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vb2xlYW4oY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuVmlld0FuaW1hdG9yX2FuaW1hdGVGaXJzdFZpZXcsIHRydWUpOworICAgICAgICBzZXRBbmltYXRlRmlyc3RWaWV3KGZsYWcpOworCiAgICAgICAgIGEucmVjeWNsZSgpOwogCiAgICAgICAgIGluaXRWaWV3QW5pbWF0b3IoY29udGV4dCwgYXR0cnMpOwpAQCAtODQsMTAgKzkwLDEwIEBACiAgICAgICAgIHNldE1lYXN1cmVBbGxDaGlsZHJlbihtZWFzdXJlQWxsQ2hpbGRyZW4pOwogICAgICAgICBhLnJlY3ljbGUoKTsKICAgICB9Ci0gICAgCisKICAgICAvKioKICAgICAgKiBTZXRzIHdoaWNoIGNoaWxkIHZpZXcgd2lsbCBiZSBkaXNwbGF5ZWQuCi0gICAgICogCisgICAgICoKICAgICAgKiBAcGFyYW0gd2hpY2hDaGlsZCB0aGUgaW5kZXggb2YgdGhlIGNoaWxkIHZpZXcgdG8gZGlzcGxheQogICAgICAqLwogICAgIHB1YmxpYyB2b2lkIHNldERpc3BsYXllZENoaWxkKGludCB3aGljaENoaWxkKSB7CkBAIC0xMDUsMTQgKzExMSwxNCBAQAogICAgICAgICAgICAgcmVxdWVzdEZvY3VzKEZPQ1VTX0ZPUldBUkQpOwogICAgICAgICB9CiAgICAgfQotICAgIAorCiAgICAgLyoqCiAgICAgICogUmV0dXJucyB0aGUgaW5kZXggb2YgdGhlIGN1cnJlbnRseSBkaXNwbGF5ZWQgY2hpbGQgdmlldy4KICAgICAgKi8KICAgICBwdWJsaWMgaW50IGdldERpc3BsYXllZENoaWxkKCkgewogICAgICAgICByZXR1cm4gbVdoaWNoQ2hpbGQ7CiAgICAgfQotICAgIAorCiAgICAgLyoqCiAgICAgICogTWFudWFsbHkgc2hvd3MgdGhlIG5leHQgY2hpbGQuCiAgICAgICovCkBAIC0xMjgsNiArMTM0LDM1IEBACiAgICAgfQogCiAgICAgLyoqCisgICAgICogU2hvd3Mgb25seSB0aGUgc3BlY2lmaWVkIGNoaWxkLiBUaGUgb3RoZXIgZGlzcGxheXMgVmlld3MgZXhpdCB0aGUgc2NyZWVuLAorICAgICAqIG9wdGlvbmFsbHkgd2l0aCB0aGUgd2l0aCB0aGUge0BsaW5rICNnZXRPdXRBbmltYXRpb24oKSBvdXQgYW5pbWF0aW9ufSBhbmQKKyAgICAgKiB0aGUgc3BlY2lmaWVkIGNoaWxkIGVudGVycyB0aGUgc2NyZWVuLCBvcHRpb25hbGx5IHdpdGggdGhlCisgICAgICoge0BsaW5rICNnZXRJbkFuaW1hdGlvbigpIGluIGFuaW1hdGlvbn0uCisgICAgICoKKyAgICAgKiBAcGFyYW0gY2hpbGRJbmRleCBUaGUgaW5kZXggb2YgdGhlIGNoaWxkIHRvIGJlIHNob3duLgorICAgICAqIEBwYXJhbSBhbmltYXRlIFdoZXRoZXIgb3Igbm90IHRvIHVzZSB0aGUgaW4gYW5kIG91dCBhbmltYXRpb25zLCBkZWZhdWx0cworICAgICAqICAgICAgICAgICAgdG8gdHJ1ZS4KKyAgICAgKi8KKyAgICB2b2lkIHNob3dPbmx5KGludCBjaGlsZEluZGV4LCBib29sZWFuIGFuaW1hdGUpIHsKKyAgICAgICAgZmluYWwgaW50IGNvdW50ID0gZ2V0Q2hpbGRDb3VudCgpOworICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGNvdW50OyBpKyspIHsKKyAgICAgICAgICAgIGZpbmFsIFZpZXcgY2hpbGQgPSBnZXRDaGlsZEF0KGkpOworICAgICAgICAgICAgaWYgKGkgPT0gY2hpbGRJbmRleCkgeworICAgICAgICAgICAgICAgIGlmIChhbmltYXRlICYmIG1JbkFuaW1hdGlvbiAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIGNoaWxkLnN0YXJ0QW5pbWF0aW9uKG1JbkFuaW1hdGlvbik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGNoaWxkLnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKKyAgICAgICAgICAgICAgICBtRmlyc3RUaW1lID0gZmFsc2U7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGlmIChhbmltYXRlICYmIG1PdXRBbmltYXRpb24gIT0gbnVsbCAmJiBjaGlsZC5nZXRWaXNpYmlsaXR5KCkgPT0gVmlldy5WSVNJQkxFKSB7CisgICAgICAgICAgICAgICAgICAgIGNoaWxkLnN0YXJ0QW5pbWF0aW9uKG1PdXRBbmltYXRpb24pOworICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoY2hpbGQuZ2V0QW5pbWF0aW9uKCkgPT0gbUluQW5pbWF0aW9uKQorICAgICAgICAgICAgICAgICAgICBjaGlsZC5jbGVhckFuaW1hdGlvbigpOworICAgICAgICAgICAgICAgIGNoaWxkLnNldFZpc2liaWxpdHkoVmlldy5HT05FKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKyAgICAvKioKICAgICAgKiBTaG93cyBvbmx5IHRoZSBzcGVjaWZpZWQgY2hpbGQuIFRoZSBvdGhlciBkaXNwbGF5cyBWaWV3cyBleGl0IHRoZSBzY3JlZW4KICAgICAgKiB3aXRoIHRoZSB7QGxpbmsgI2dldE91dEFuaW1hdGlvbigpIG91dCBhbmltYXRpb259IGFuZCB0aGUgc3BlY2lmaWVkIGNoaWxkCiAgICAgICogZW50ZXJzIHRoZSBzY3JlZW4gd2l0aCB0aGUge0BsaW5rICNnZXRJbkFuaW1hdGlvbigpIGluIGFuaW1hdGlvbn0uCkBAIC0xMzUsMjQgKzE3MCw4IEBACiAgICAgICogQHBhcmFtIGNoaWxkSW5kZXggVGhlIGluZGV4IG9mIHRoZSBjaGlsZCB0byBiZSBzaG93bi4KICAgICAgKi8KICAgICB2b2lkIHNob3dPbmx5KGludCBjaGlsZEluZGV4KSB7Ci0gICAgICAgIGZpbmFsIGludCBjb3VudCA9IGdldENoaWxkQ291bnQoKTsKLSAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBjb3VudDsgaSsrKSB7Ci0gICAgICAgICAgICBmaW5hbCBWaWV3IGNoaWxkID0gZ2V0Q2hpbGRBdChpKTsKLSAgICAgICAgICAgIGZpbmFsIGJvb2xlYW4gY2hlY2tGb3JGaXJzdCA9ICghbUZpcnN0VGltZSB8fCBtQW5pbWF0ZUZpcnN0VGltZSk7Ci0gICAgICAgICAgICBpZiAoaSA9PSBjaGlsZEluZGV4KSB7Ci0gICAgICAgICAgICAgICAgaWYgKGNoZWNrRm9yRmlyc3QgJiYgbUluQW5pbWF0aW9uICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgY2hpbGQuc3RhcnRBbmltYXRpb24obUluQW5pbWF0aW9uKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgY2hpbGQuc2V0VmlzaWJpbGl0eShWaWV3LlZJU0lCTEUpOwotICAgICAgICAgICAgICAgIG1GaXJzdFRpbWUgPSBmYWxzZTsKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgaWYgKGNoZWNrRm9yRmlyc3QgJiYgbU91dEFuaW1hdGlvbiAhPSBudWxsICYmIGNoaWxkLmdldFZpc2liaWxpdHkoKSA9PSBWaWV3LlZJU0lCTEUpIHsKLSAgICAgICAgICAgICAgICAgICAgY2hpbGQuc3RhcnRBbmltYXRpb24obU91dEFuaW1hdGlvbik7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChjaGlsZC5nZXRBbmltYXRpb24oKSA9PSBtSW5BbmltYXRpb24pCi0gICAgICAgICAgICAgICAgICAgIGNoaWxkLmNsZWFyQW5pbWF0aW9uKCk7Ci0gICAgICAgICAgICAgICAgY2hpbGQuc2V0VmlzaWJpbGl0eShWaWV3LkdPTkUpOwotICAgICAgICAgICAgfQotICAgICAgICB9CisgICAgICAgIGZpbmFsIGJvb2xlYW4gYW5pbWF0ZSA9ICghbUZpcnN0VGltZSB8fCBtQW5pb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ZSBtQ2xvc2VDb250ZXh0ID0gbmV3IFJ1bm5hYmxlKCkgeworICAgICAgICBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgICAgICBtVXBwZXJDb250ZXh0Vmlldy5jbG9zZU1vZGUoKTsKKyAgICAgICAgICAgIGlmIChtTG93ZXJDb250ZXh0VmlldyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgbUxvd2VyQ29udGV4dFZpZXcucmVtb3ZlQWxsVmlld3MoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1DbG9zaW5nQ29udGV4dCA9IGZhbHNlOworICAgICAgICB9CisgICAgfTsKKworICAgIHB1YmxpYyBBY3Rpb25CYXJJbXBsKEFjdGl2aXR5IGFjdGl2aXR5KSB7CisgICAgICAgIG1BY3Rpdml0eSA9IGFjdGl2aXR5OworICAgICAgICBpbml0KGFjdGl2aXR5LmdldFdpbmRvdygpLmdldERlY29yVmlldygpKTsKKyAgICB9CisKKyAgICBwdWJsaWMgQWN0aW9uQmFySW1wbChEaWFsb2cgZGlhbG9nKSB7CisgICAgICAgIG1EaWFsb2cgPSBkaWFsb2c7CisgICAgICAgIGluaXQoZGlhbG9nLmdldFdpbmRvdygpLmdldERlY29yVmlldygpKTsKKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgaW5pdChWaWV3IGRlY29yKSB7CisgICAgICAgIG1Db250ZXh0ID0gZGVjb3IuZ2V0Q29udGV4dCgpOworICAgICAgICBtQWN0aW9uVmlldyA9IChBY3Rpb25CYXJWaWV3KSBkZWNvci5maW5kVmlld0J5SWQoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5pZC5hY3Rpb25fYmFyKTsKKyAgICAgICAgbVVwcGVyQ29udGV4dFZpZXcgPSAoQWN0aW9uQmFyQ29udGV4dFZpZXcpIGRlY29yLmZpbmRWaWV3QnlJZCgKKyAgICAgICAgICAgICAgICBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmlkLmFjdGlvbl9jb250ZXh0X2Jhcik7CisgICAgICAgIG1Mb3dlckNvbnRleHRWaWV3ID0gKExpbmVhckxheW91dCkgZGVjb3IuZmluZFZpZXdCeUlkKAorICAgICAgICAgICAgICAgIGNvbS5hbmRyb2lkLmludGVybmFsLlIuaWQubG93ZXJfYWN0aW9uX2NvbnRleHRfYmFyKTsKKyAgICAgICAgbUFuaW1hdG9yVmlldyA9IChWaWV3QW5pbWF0b3IpIGRlY29yLmZpbmRWaWV3QnlJZCgKKyAgICAgICAgICAgICAgICBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmlkLmFjdGlvbl9iYXJfYW5pbWF0b3IpOworCisgICAgICAgIGlmIChtQWN0aW9uVmlldyA9PSBudWxsIHx8IG1VcHBlckNvbnRleHRWaWV3ID09IG51bGwgfHwgbUFuaW1hdG9yVmlldyA9PSBudWxsKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKGdldENsYXNzKCkuZ2V0U2ltcGxlTmFtZSgpICsgIiBjYW4gb25seSBiZSB1c2VkICIgKworICAgICAgICAgICAgICAgICAgICAid2l0aCBhIGNvbXBhdGlibGUgd2luZG93IGRlY29yIGxheW91dCIpOworICAgICAgICB9CisKKyAgICAgICAgbUFjdGlvblZpZXcuc2V0Q29udGV4dFZpZXcobVVwcGVyQ29udGV4dFZpZXcpOworICAgICAgICBtQ29udGV4dERpc3BsYXlNb2RlID0gbUxvd2VyQ29udGV4dFZpZXcgPT0gbnVsbCA/CisgICAgICAgICAgICAgICAgQ09OVEVYVF9ESVNQTEFZX05PUk1BTCA6IENPTlRFWFRfRElTUExBWV9TUExJVDsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCBzZXRTdGFuZGFyZE5hdmlnYXRpb25Nb2RlKGludCB0aXRsZVJlc0lkLCBpbnQgc3VidGl0bGVSZXNJZCkgeworICAgICAgICBzZXRTdGFuZGFyZE5hdmlnYXRpb25Nb2RlKG1Db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SwgQ2hhclNlcXVlbmNlIHN1YnRpdGxlKSB7CisgICAgICAgIGNsZWFudXBUYWJzKCk7CisgICAgICAgIG1BY3Rpb25WaWV3LnNldE5hdmlnYXRpb25Nb2RlKE5BVklHQVRJT05fTU9ERV9TVEFOREFSRCk7CisgICAgICAgIG1BY3Rpb25WaWV3LnNldFRpdGxlKHRpdGxlKTsKKyAgICAgICAgbUFjdGlvblZpZXcuc2V0U3VidGl0bGUoc3VidGl0bGUpOworICAgICAgICBtQWN0aW9uVmlldy5zZXRDYWxsYmFjayhudWxsKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBzZXRTZWxlY3RlZE5hdmlnYXRpb25JdGVtKGludCBwb3NpdGlvbikgeworICAgICAgICBzd2l0Y2ggKG1BY3Rpb25WaWV3LmdldE5hdmlnYXRpb25Nb2RlKCkpIHsKKyAgICAgICAgY2FzZSBOQVZJR0FUSU9OX01PREVfVEFCUzoKKyAgICAgICAgICAgIHNlbGVjdFRhYihtVGFicy5nZXQocG9zaXRpb24pKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIE5BVklHQVRJT05fTU9ERV9EUk9QRE9XTl9MSVNUOgorICAgICAgICAgICAgbUFjdGlvblZpZXcuc2V0RHJvcGRvd25TZWxlY3RlZFBvc2l0aW9uKHBvc2l0aW9uKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigKKyAgICAgICAgICAgICAgICAgICAgInNldFNlbGVjdGVkTmF2aWdhdGlvbkl0ZW0gbm90IHZhbGlkIGZvciBjdXJyZW50IG5hdmlnYXRpb24gbW9kZSIpOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIGludCBnZXRTZWxlY3RlZE5hdmlnYXRpb25JdGVtKCkgeworICAgICAgICBzd2l0Y2ggKG1BY3Rpb25WaWV3LmdldE5hdmlnYXRpb25Nb2RlKCkpIHsKKyAgICAgICAgY2FzZSBOQVZJR0FUSU9OX01PREVfVEFCUzoKKyAgICAgICAgICAgIHJldHVybiBtU2VsZWN0ZWRUYWIuZ2V0UG9zaXRpb24oKTsKKyAgICAgICAgY2FzZSBOQVZJR0FUSU9OX01PREVfRFJPUERPV05fTElTVDoKKyAgICAgICAgICAgIHJldHVybiBtQWN0aW9uVmlldy5nZXREcm9wZG93blNlbGVjdGVkUG9zaXRpb24oKTsKKyAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgIHJldHVybiAtMTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBjbGVhbnVwVGFicygpIHsKKyAgICAgICAgaWYgKG1TZWxlY3RlZFRhYiAhPSBudWxsKSB7CisgICAgICAgICAgICBzZWxlY3RUYWIobnVsbCk7CisgICAgICAgIH0KKyAgICAgICAgaWYgKCFtVGFicy5pc0VtcHR5KCkpIHsKKyAgICAgICAgICAgIGlmIChtVGFiU3dpdGNoTW9kZSA9PSBUQUJfU1dJVENIX1NIT1dfSElERSkgeworICAgICAgICAgICAgICAgIGZpbmFsIEZyYWdtZW50VHJhbnNhY3Rpb24gdHJhbnMgPSBtQWN0aXZpdHkub3BlbkZyYWdtZW50VHJhbnNhY3Rpb24oKTsKKyAgICAgICAgICAgICAgICBmaW5hbCBpbnQgdGFiQ291bnQgPSBtVGFicy5zaXplKCk7CisgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCB0YWJDb3VudDsgaSsrKSB7CisgICAgICAgICAgICAgICAgICAgIHRyYW5zLnJlbW92ZShtVGFicy5nZXQoaSkuZ2V0RnJhZ21lbnQoKSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHRyYW5zLmNvbW1pdCgpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbVRhYnMuY2xlYXIoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHNldFRpdGxlKEN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7CisgICAgICAgIHJldHVybiBtQWN0aW9uVmlldy5nZXRTdWJ0aXRsZSgpOworICAgIH0KKworICAgIHB1YmxpYyBpbnQgZ2V0TmF2aWdhdGlvbk1vZGUoKSB7CisgICAgICAgIHJldHVybiBtQWN0aW9uVmlldy5nZXROYXZpZ2F0aW9uTW9kZSgpOworICAgIH0KKworICAgIHB1YmxpYyBpbnQgZ2V0RGlzcGxheU9wdGlvbnMoKSB7CisgICAgICAgIHJldHVybiBtQWN0aW9uVmlldy5nZXREaXNwbGF5T3B0aW9ucygpOworICAgIH0KKworICAgIHB1YmxpYyBBY3Rpb25Nb2RlIHN0YXJ0QWN0aW9uTW9kZShBY3Rpb25Nb2RlLkNhbGxiYWNrIGNhbGxiYWNrKSB7CisgICAgICAgIGlmIChtQWN0aW9uTW9kZSAhPSBudWxsKSB7CisgICAgICAgICAgICBtQWN0aW9uTW9kZS5maW5pc2goKTsKKyAgICAgICAgfQorCisgICAgICAgIC8vIERvbid0IHdhaXQgZm9yIHRoZSBjbG9zZSBjb250ZXh0IG1vZGUgYW5pbWF0aW9uIHRvIGZpbmlzaC4KKyAgICAgICAgaWYgKG1DbG9zaW5nQ29udGV4dCkgeworICAgICAgICAgICAgbUFuaW1hdG9yVmlldy5jbGVhckFuaW1hdGlvbigpOworICAgICAgICAgICAgbUhhbmRsZXIucmVtb3ZlQ2FsbGJhY2tzKG1DbG9zZUNvbnRleHQpOworICAgICAgICAgICAgbUNsb3NlQ29udGV4dC5ydW4oKTsKKyAgICAgICAgfQorCisgICAgICAgIEFjdGlvbk1vZGUgbW9kZSA9IG5ldyBBY3Rpb25Nb2RlSW1wbChjYWxsYmFjayk7CisgICAgICAgIGlmIChjYWxsYmFjay5vbkNyZWF0ZUFjdGlvbk1vZGUobW9kZSwgbW9kZS5nZXRNZW51KCkpKSB7CisgICAgICAgICAgICBtb2RlLmludmFsaWRhdGUoKTsKKyAgICAgICAgICAgIG1VcHBlckNvbnRleHRWaWV3LmluaXRGb3JNb2RlKG1vZGUpOworICAgICAgICAgICAgbUFuaW1hdG9yVmlldy5zZXREaXNwbGF5ZWRDaGlsZChDT05URVhUX1ZJRVcpOworICAgICAgICAgICAgaWYgKG1Mb3dlckNvbnRleHRWaWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAvLyBUT0RPIGFuaW1hdGUgdGhpcworICAgICAgICAgICAgICAgIG1Mb3dlckNvbnRleHRWaWV3LnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1BY3Rpb25Nb2RlID0gbW9kZTsKKyAgICAgICAgICAgIHJldHVybiBtb2RlOworICAgICAgICB9CisgICAgICAgIHJldHVybiBudWxsOworICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBjb25maWd1cmVUYWIoVGFiIHRhYiwgaW50IHBvc2l0aW9uKSB7CisgICAgICAgIGZpbmFsIFRhYkltcGwgdGFiaSA9IChUYWJJbXBsKSB0YWI7CisgICAgICAgIGZpbmFsIGJvb2xlYW4gaXNGaXJzdFRhYiA9IG1UYWJzLmlzRW1wdHkoKTsKKyAgICAgICAgZmluYWwgRnJhZ21lbnRUcmFuc2FjdGlvbiB0cmFucyA9IG1BY3Rpdml0eS5vcGVuRnJhZ21lbnRUcmFuc2FjdGlvbigpOworICAgICAgICBmaW5hbCBGcmFnbWVudCBmcmFnID0gdGFiaS5nZXRGcmFnbWVudCgpOworCisgICAgICAgIHRhYmkuc2V0UG9zaXRpb24ocG9zaXRpb24pOworICAgICAgICBtVGFicy5hZGQocG9zaXRpb24sIHRhYmkpOworCisgICAgICAgIGlmIChtVGFiU3dpdGNoTW9kZSA9PSBUQUJfU1dJVENIX1NIT1dfSElERSkgeworICAgICAgICAgICAgaWYgKCFmcmFnLmlzQWRkZWQoKSkgeworICAgICAgICAgICAgICAgIHRyYW5zLmFkZChtVGFiQ29udGFpbmVyVmlld0lkLCBmcmFnKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGlmIChpc0ZpcnN0VGFiKSB7CisgICAgICAgICAgICBpZiAobVRhYlN3aXRjaE1vZGUgPT0gVEFCX1NXSVRDSF9TSE9XX0hJREUpIHsKKyAgICAgICAgICAgICAgICB0cmFucy5zaG93KGZyYWcpOworICAgICAgICAgICAgfSBlbHNlIGlmIChtVGFiU3dpdGNoTW9kZSA9PSBUQUJfU1dJVENIX0FERF9SRU1PVkUpIHsKKyAgICAgICAgICAgICAgICB0cmFucy5hZGQobVRhYkNvbnRhaW5lclZpZXdJZCwgZnJhZyk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBtU2VsZWN0ZWRUYWIgPSB0YWJpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgaWYgKG1UYWJTd2l0Y2hNb2RlID09IFRBQl9TV0lUQ0hfU0hPV19ISURFKSB7CisgICAgICAgICAgICAgICAgdHJhbnMuaGlkZShmcmFnKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICB0cmFucy5jb21taXQoKTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCBhZGRUYWIoVGFiIHRhYikgeworICAgICAgICBtQWN0aW9uVmlldy5hZGRUYWIodGFiKTsKKyAgICAgICAgY29uZmlndXJlVGFiKHRhYiwgbVRhYnMuc2l6ZSgpKTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCBpbnNlcnRUYWIoVGFiIHRhYiwgaW50IHBvc2l0aW9uKSB7CisgICAgICAgIG1BY3Rpb25WaWV3Lmluc2VydFRhYih0YWIsIHBvc2l0aW9uKTsKKyAgICAgICAgY29uZmlndXJlVGFiKHRhYiwgcG9zaXRpb24pOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyBUYWIgbmV3VGFiKCkgeworICAgICAgICByZXR1cm4gbmV3IFRhYkltcGwoKTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKy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YWluZXJWaWV3SWQpIHsKKyAgICAgICAgbVRhYkNvbnRhaW5lclZpZXdJZCA9IGNvbnRhaW5lclZpZXdJZDsKKyAgICAgICAgc2V0VGFiTmF2aWdhdGlvbk1vZGUoKTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCBzZWxlY3RUYWIoVGFiIHRhYikgeworICAgICAgICBpZiAobVNlbGVjdGVkVGFiID09IHRhYikgeworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisKKyAgICAgICAgbUFjdGlvblZpZXcuc2V0VGFiU2VsZWN0ZWQodGFiICE9IG51bGwgPyB0YWIuZ2V0UG9zaXRpb24oKSA6IFRhYi5JTlZBTElEX1BPU0lUSU9OKTsKKyAgICAgICAgZmluYWwgRnJhZ21lbnRUcmFuc2FjdGlvbiB0cmFucyA9IG1BY3Rpdml0eS5vcGVuRnJhZ21lbnRUcmFuc2FjdGlvbigpOworICAgICAgICBpZiAobVNlbGVjdGVkVGFiICE9IG51bGwpIHsKKyAgICAgICAgICAgIGlmIChtVGFiU3dpdGNoTW9kZSA9PSBUQUJfU1dJVENIX1NIT1dfSElERSkgeworICAgICAgICAgICAgICAgIHRyYW5zLmhpZGUobVNlbGVjdGVkVGFiLmdldEZyYWdtZW50KCkpOworICAgICAgICAgICAgfSBlbHNlIGlmIChtVGFiU3dpdGNoTW9kZSA9PSBUQUJfU1dJVENIX0FERF9SRU1PVkUpIHsKKyAgICAgICAgICAgICAgICB0cmFucy5yZW1vdmUobVNlbGVjdGVkVGFiLmdldEZyYWdtZW50KCkpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGlmICh0YWIgIT0gbnVsbCkgeworICAgICAgICAgICAgaWYgKG1UYWJTd2l0Y2hNb2RlID09IFRBQl9TV0lUQ0hfU0hPV19ISURFKSB7CisgICAgICAgICAgICAgICAgdHJhbnMuc2hvdyh0YWIuZ2V0RnJhZ21lbnQoKSk7CisgICAgICAgICAgICB9IGVsc2UgaWYgKG1UYWJTd2l0Y2hNb2RlID09IFRBQl9TV0lUQ0hfQUREX1JFTU9WRSkgeworICAgICAgICAgICAgICAgIHRyYW5zLmFkZChtVGFiQ29udGFpbmVyVmlld0lkLCB0YWIuZ2V0RnJhZ21lbnQoKSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgbVNlbGVjdGVkVGFiID0gKFRhYkltcGwpIHRhYjsKKyAgICAgICAgdHJhbnMuY29tbWl0KCk7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIGludCBnZXRIZWlnaHQoKSB7CisgICAgICAgIHJldHVybiBtQWN0aW9uVmlldy5nZXRIZWlnaHQoKTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCBzaG93KCkgeworICAgICAgICAvLyBUT0RPIGFuaW1hdGUhCisgICAgICAgIG1BbmltYXRvclZpZXcuc2V0VmlzaWJpbGl0eShWaWV3LlZJU0lCTEUpOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIGhpZGUoKSB7CisgICAgICAgIC8vIFRPRE8gYW5pbWF0ZSEKKyAgICAgICAgbUFuaW1hdG9yVmlldy5zZXRWaXNpYmlsaXR5KFZpZXcuR09ORSk7CisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gaXNTaG93aW5nKCkgeworICAgICAgICByZXR1cm4gbUFuaW1hdG9yVmlldy5nZXRWaXNpYmlsaXR5KCkgPT0gVmlldy5WSVNJQkxFOworICAgIH0KKworICAgIC8qKgorICAgICAqIEBoaWRlIAorICAgICAqLworICAgIHB1YmxpYyBjbGFzcyBBY3Rpb25Nb2RlSW1wbCBleHRlbmRzIEFjdGlvbk1vZGUgaW1wbGVtZW50cyBNZW51QnVpbGRlci5DYWxsYmFjayB7CisgICAgICAgIHByaXZhdGUgQWN0aW9uTW9kZS5DYWxsYmFjayBtQ2FsbGJhY2s7CisgICAgICAgIHByaXZhdGUgTWVudUJ1aWxkZXIgbU1lbnU7CisgICAgICAgIHByaXZhdGUgV2Vha1JlZmVyZW5jZTxWaWV3PiBtQ3VzdG9tVmlldzsKKyAgICAgICAgCisgICAgICAgIHB1YmxpYyBBY3Rpb25Nb2RlSW1wbChBY3Rpb25Nb2RlLkNhbGxiYWNrIGNhbGxiYWNrKSB7CisgICAgICAgICAgICBtQ2FsbGJhY2sgPSBjYWxsYmFjazsKKyAgICAgICAgICAgIG1NZW51ID0gbmV3IE1lbnVCdWlsZGVyKG1BY3Rpb25WaWV3LmdldENvbnRleHQoKSkKKyAgICAgICAgICAgICAgICAgICAgLnNldERlZmF1bHRTaG93QXNBY3Rpb24oTWVudUl0ZW0uU0hPV19BU19BQ1RJT05fSUZfUk9PTSk7CisgICAgICAgICAgICBtTWVudS5zZXRDYWxsYmFjayh0aGlzKTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgTWVudUluZmxhdGVyIGdldE1lbnVJbmZsYXRlcigpIHsKKyAgICAgICAgICAgIHJldHVybiBuZXcgTWVudUluZmxhdGVyKG1Db250ZXh0KTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgTWVudSBnZXRNZW51KCkgeworICAgICAgICAgICAgcmV0dXJuIG1NZW51OworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIGZpbmlzaCgpIHsKKyAgICAgICAgICAgIGlmIChtQWN0aW9uTW9kZSAhPSB0aGlzKSB7CisgICAgICAgICAgICAgICAgLy8gTm90IHRoZSBhY3RpdmUgYWN0aW9uIG1vZGUgLSBuby1vcAorICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgbUNhbGxiYWNrLm9uRGVzdHJveUFjdGlvbk1vZGUodGhpcyk7CisgICAgICAgICAgICBtQW5pbWF0b3JWaWV3LnNldERpc3BsYXllZENoaWxkKE5PUk1BTF9WSUVXKTsKKworICAgICAgICAgICAgLy8gQ2xlYXIgb3V0IHRoZSBjb250ZXh0IG1vZGUgdmlld3MgYWZ0ZXIgdGhlIGFuaW1hdGlvbiBmaW5pc2hlcworICAgICAgICAgICAgbUNsb3NpbmdDb250ZXh0ID0gdHJ1ZTsKKyAgICAgICAgICAgIG1IYW5kbGVyLnBvc3REZWxheWVkKG1DbG9zZUNvbnRleHQsIG1BbmltYXRvclZpZXcuZ2V0T3V0QW5pbWF0aW9uKCkuZ2V0RHVyYXRpb24oKSk7CisKKyAgICAgICAgICAgIGlmIChtTG93ZXJDb250ZXh0VmlldyAhPSBudWxsICYmIG1Mb3dlckNvbnRleHRWaWV3LmdldFZpc2liaWxpdHkoKSAhPSBWaWV3LkdPTkUpIHsKKyAgICAgICAgICAgICAgICAvLyBUT0RPIEFuaW1hdGUgdGhpcworICAgICAgICAgICAgICAgIG1Mb3dlckNvbnRleHRWaWV3LnNldFZpc2liaWxpdHkoVmlldy5HT05FKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1BY3Rpb25Nb2RlID0gbnVsbDsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgdm9pZCBpbnZhbGlkYXRlKCkgeworICAgICAgICAgICAgaWYgKG1DYWxsYmFjay5vblByZXBhcmVBY3Rpb25Nb2RlKHRoaXMsIG1NZW51KSkgeworICAgICAgICAgICAgICAgIC8vIFJlZnJlc2ggY29udGVudCBpbiBib3RoIGNvbnRleHQgdmlld3MKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgdm9pZCBzZXRDdXN0b21WaWV3KFZpZXcgdmlldykgeworICAgICAgICAgICAgbVVwcGVyQ29udGV4dFZpZXcuc2V0Q3VzdG9tVmlldyh2aWV3KTsKKyAgICAgICAgICAgIG1DdXN0b21WaWV3ID0gbmV3IFdlYWtSZWZlcmVuY2U8Vmlldz4odmlldyk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgc2V0U3VidGl0bGUoQ2hhclNlcXVlbmNlIHN1YnRpdGxlKSB7CisgICAgICAgICAgICBtVXBwZXJDb250ZXh0Vmlldy5zZXRTdWJ0aXRsZShzdWJ0aXRsZSk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgc2V0VGl0bGUoQ2hhclNlcXVlbmNlIHRpdGxlKSB7CisgICAgICAgICAgICBtVXBwZXJDb250ZXh0Vmlldy5zZXRUaXRsZSh0aXRsZSk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgc2V0VGl0bGUoaW50IHJlc0lkKSB7CisgICAgICAgICAgICBzZXRUaXRsZShtQWN0aXZpdHkuZ2V0U3RyaW5nKHJlc0lkKSk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgc2V0U3VidGl0bGUoaW50IHJlc0lkKSB7CisgICAgICAgICAgICBzZXRTdWJ0aXRsZShtQWN0aXZpdHkuZ2V0U3RyaW5nKHJlc0lkKSk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIENoYXJTZXF1ZW5jZSBnZXRUaXRsZSgpIHsKKyAgICAgICAgICAgIHJldHVybiBtVXBwZXJDb250ZXh0Vmlldy5nZXRUaXRsZSgpOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBDaGFyU2VxdWVuY2UgZ2V0U3VidGl0bGUoKSB7CisgICAgICAgICAgICByZXR1cm4gbVVwcGVyQ29udGV4dFZpZXcuZ2V0U3VidGl0bGUoKTsKKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBWaWV3IGdldEN1c3RvbVZpZXcoKSB7CisgICAgICAgICAgICByZXR1cm4gbUN1c3RvbVZpZXcgIT0gbnVsbCA/IG1DdXN0b21WaWV3LmdldCgpIDogbnVsbDsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBib29sZWFuIG9uTWVudUl0ZW1TZWxlY3RlZChNZW51QnVpbGRlciBtZW51LCBNZW51SXRlbSBpdGVtKSB7CisgICAgICAgICAgICByZXR1cm4gbUNhbGxiYWNrLm9uQWN0aW9uSXRlbUNsaWNrZWQodGhpcywgaXRlbSk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBvbkNsb3NlTWVudShNZW51QnVpbGRlciBtZW51LCBib29sZWFuIGFsbE1lbnVzQXJlQ2xvc2luZykgeworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGJvb2xlYW4gb25TdWJNZW51U2VsZWN0ZWQoU3ViTWVudUJ1aWxkZXIgc3ViTWVudSkgeworICAgICAgICAgICAgaWYgKCFzdWJNZW51Lmhhc1Zpc2libGVJdGVtcygpKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIG5ldyBNZW51UG9wdXBIZWxwZXIobUNvbnRleHQsIHN1Yk1lbnUpLnNob3coKTsKKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgb25DbG9zZVN1Yk1lbnUoU3ViTWVudUJ1aWxkZXIgbWVudSkgeworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgb25NZW51TW9kZUNoYW5nZShNZW51QnVpbGRlciBtZW51KSB7CisgICAgICAgICAgICBpbnZhbGlkYXRlKCk7CisgICAgICAgICAgICBtVXBwZXJDb250ZXh0Vmlldy5zaG93T3ZlcmZsb3dNZW51KCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBAaGlkZQorICAgICAqLworICAgIHB1YmxpYyBjbGFzcyBUYWJJbXBsIGV4dGVuZHMgQWN0aW9uQmFyLlRhYiB7CisgICAgICAgIHByaXZhdGUgRnJhZ21lbnQgbUZyYWdtZW50OworICAgICAgICBwcml2YXRlIERyYXdhYmxlIG1JY29uOworICAgICAgICBwcml2YXRlIENoYXJTZXF1ZW5jZSBtVGV4dDsKKyAgICAgICAgcHJpdmF0ZSBpbnQgbVBvc2l0aW9uOworCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgRnJhZ21lbnQgZ2V0RnJhZ21lbnQoKSB7CisgICAgICAgICAgICByZXR1cm4gbUZyYWdtZW50OworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBEcmF3YWJsZSBnZXRJY29uKCkgeworICAgICAgICAgICAgcmV0dXJuIG1JY29uOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBpbnQgZ2V0UG9zaXRpb24oKSB7CisgICAgICAgICAgICByZXR1cm4gbVBvc2l0aW9uOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgc2V0UG9zaXRpb24oaW50IHBvc2l0aW9uKSB7CisgICAgICAgICAgICBtUG9zaXRpb24gPSBwb3NpdGlvbjsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgQ2hhclNlcXVlbmNlIGdldFRleHQoKSB7CisgICAgICAgICAgICByZXR1cm4gbVRleHQ7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgc2V0RnJhZ21lbnQoRnJhZ21lbnQgZnJhZ21lbnQpIHsKKyAgICAgICAgICAgIG1GcmFnbWVudCA9IGZyYWdtZW50OworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIHNldEljb24oRHJhd2FibGU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KSB7CisgICAgICAgICAgICB0aGlzLmxhYmVsID0gbGFiZWw7CisgICAgICAgICAgICB0aGlzLmxvY2FsZSA9IGxvY2FsZTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgU3RyaW5nIHRvU3RyaW5nKCkgeworICAgICAgICAgICAgcmV0dXJuIHRoaXMubGFiZWw7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIGludCBjb21wYXJlVG8oTG9jIGFub3RoZXIpIHsKKyAgICAgICAgICAgIHJldHVybiBzQ29sbGF0b3IuY29tcGFyZSh0aGlzLmxhYmVsLCBhbm90aGVyLmxhYmVsKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBzZXRVcExvY2FsZUxpc3QoKSB7CisgICAgICAgIGZpbmFsIEFjdGl2aXR5IGFjdGl2aXR5ID0gZ2V0QWN0aXZpdHkoKTsKKyAgICAgICAgZmluYWwgUmVzb3VyY2VzIHJlc291cmNlcyA9IGFjdGl2aXR5LmdldFJlc291cmNlcygpOworICAgICAgICBtU3BlY2lhbExvY2FsZUNvZGVzID0gcmVzb3VyY2VzLmdldFN0cmluZ0FycmF5KFIuYXJyYXkuc3BlY2lhbF9sb2NhbGVfY29kZXMpOworICAgICAgICBtU3BlY2lhbExvY2FsZU5hbWVzID0gcmVzb3VyY2VzLmdldFN0cmluZ0FycmF5KFIuYXJyYXkuc3BlY2lhbF9sb2NhbGVfbmFtZXMpOworCisgICAgICAgIGZpbmFsIFN0cmluZ1tdIGxvY2FsZXMgPSBhY3Rpdml0eS5nZXRBc3NldHMoKS5nZXRMb2NhbGVzKCk7CisgICAgICAgIEFycmF5cy5zb3J0KGxvY2FsZXMpOworICAgICAgICBmaW5hbCBpbnQgb3JpZ1NpemUgPSBsb2NhbGVzLmxlbmd0aDsKKyAgICAgICAgTG9jW10gcHJlcHJvY2VzcyA9IG5ldyBMb2Nbb3JpZ1NpemVdOworICAgICAgICBpbnQgZmluYWxTaXplID0gMDsKKyAgICAgICAgZm9yIChpbnQgaSA9IDAgOyBpIDwgb3JpZ1NpemU7IGkrKyApIHsKKyAgICAgICAgICAgIFN0cmluZyBzID0gbG9jYWxlc1tpXTsKKyAgICAgICAgICAgIGludCBsZW4gPSBzLmxlbmd0aCgpOworICAgICAgICAgICAgaWYgKGxlbiA9PSA1KSB7CisgICAgICAgICAgICAgICAgU3RyaW5nIGxhbmd1YWdlID0gcy5zdWJzdHJpbmcoMCwgMik7CisgICAgICAgICAgICAgICAgU3RyaW5nIGNvdW50cnkgPSBzLnN1YnN0cmluZygzLCA1KTsKKyAgICAgICAgICAgICAgICBMb2NhbGUgbCA9IG5ldyBMb2NhbGUobGFuZ3VhZ2UsIGNvdW50cnkpOworCisgICAgICAgICAgICAgICAgaWYgKGZpbmFsU2l6ZSA9PSAwKSB7CisgICAgICAgICAgICAgICAgICAgIGlmIChERUJVRykgeworICAgICAgICAgICAgICAgICAgICAgICAgTG9nLnYoVEFHLCAiYWRkaW5nIGluaXRpYWwgIisgdG9UaXRsZUNhc2UobC5nZXREaXNwbGF5TGFuZ3VhZ2UobCkpKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBwcmVwcm9jZXNzW2ZpbmFsU2l6ZSsrXSA9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3IExvYyh0b1RpdGxlQ2FzZShsLmdldERpc3BsYXlMYW5ndWFnZShsKSksIGwpOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIC8vIGNoZWNrIHByZXZpb3VzIGVudHJ5OgorICAgICAgICAgICAgICAgICAgICAvLyAgc2FtZSBsYW5nIGFuZCBhIGNvdW50cnkgLT4gdXBncmFkZSB0byBmdWxsIG5hbWUgYW5kCisgICAgICAgICAgICAgICAgICAgIC8vICAgIGluc2VydCBvdXJzIHdpdGggZnVsbCBuYW1lCisgICAgICAgICAgICAgICAgICAgIC8vICBkaWZmIGxhbmcgLT4gaW5zZXJ0IG91cnMgd2l0aCBsYW5nLW9ubHkgbmFtZQorICAgICAgICAgICAgICAgICAgICBpZiAocHJlcHJvY2Vzc1tmaW5hbFNpemUtMV0ubG9jYWxlLmdldExhbmd1YWdlKCkuZXF1YWxzKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKERFQlVHKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgTG9nLnYoVEFHLCAiYmFja2luZyB1cCBhbmQgZml4aW5nICIrCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmVwcm9jZXNzW2ZpbmFsU2l6ZS0xXS5sYWJlbCsiIHRvICIrCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXREaXNwbGF5TmFtZShwcmVwcm9jZXNzW2ZpbmFsU2l6ZS0xXS5sb2NhbGUpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIHByZXByb2Nlc3NbZmluYWxTaXplLTFdLmxhYmVsID0gdG9UaXRsZUNhc2UoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldERpc3BsYXlOYW1lKHByZXByb2Nlc3NbZmluYWxTaXplLTFdLmxvY2FsZSkpOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKERFQlVHKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgTG9nLnYoVEFHLCAiICBhbmQgYWRkaW5nICIrIHRvVGl0bGVDYXNlKGdldERpc3BsYXlOYW1lKGwpKSk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBwcmVwcm9jZXNzW2ZpbmFsU2l6ZSsrXSA9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBMb2ModG9UaXRsZUNhc2UoZ2V0RGlzcGxheU5hbWUobCkpLCBsKTsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIFN0cmluZyBkaXNwbGF5TmFtZTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzLmVxdWFscygienpfWloiKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXlOYW1lID0gIlBzZXVkby4uLiI7CisgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXlOYW1lID0gdG9UaXRsZUNhc2UobC5nZXREaXNwbGF5TGFuZ3VhZ2UobCkpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgaWYgKERFQlVHKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgTG9nLnYoVEFHLCAiYWRkaW5nICIrZGlzcGxheU5hbWUpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgcHJlcHJvY2Vzc1tmaW5hbFNpemUrK10gPSBuZXcgTG9jKGRpc3BsYXlOYW1lLCBsKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBtTG9jYWxlcyA9IG5ldyBMb2NbZmluYWxTaXplXTsKKyAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBmaW5hbFNpemUgOyBpKyspIHsKKyAgICAgICAgICAgIG1Mb2NhbGVzW2ldID0gcHJlcHJvY2Vzc1tpXTsKKyAgICAgICAgfQorICAgICAgICBBcnJheXMuc29ydChtTG9jYWxlcyk7CisgICAgICAgIGZpbmFsIGludCBsYXlvdXRJZCA9IFIubGF5b3V0LmxvY2FsZV9waWNrZXJfaXRlbTsKKyAgICAgICAgZmluYWwgaW50IGZpZWxkSWQgPSBSLmlkLmxvY2FsZTsKKyAgICA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Db2Rlc1tpXS5lcXVhbHMoY29kZSkpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gbVNwZWNpYWxMb2NhbGVOYW1lc1tpXTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiBsLmdldERpc3BsYXlOYW1lKGwpOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIG9uUmVzdW1lKCkgeworICAgICAgICBzdXBlci5vblJlc3VtZSgpOworICAgICAgICBnZXRMaXN0VmlldygpLnJlcXVlc3RGb2N1cygpOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIG9uTGlzdEl0ZW1DbGljayhMaXN0VmlldyBsLCBWaWV3IHYsIGludCBwb3NpdGlvbiwgbG9uZyBpZCkgeworICAgICAgICB0cnkgeworICAgICAgICAgICAgSUFjdGl2aXR5TWFuYWdlciBhbSA9IEFjdGl2aXR5TWFuYWdlck5hdGl2ZS5nZXREZWZhdWx0KCk7CisgICAgICAgICAgICBDb25maWd1cmF0aW9uIGNvbmZpZyA9IGFtLmdldENvbmZpZ3VyYXRpb24oKTsKKworICAgICAgICAgICAgTG9jIGxvYyA9IG1Mb2NhbGVzW3Bvc2l0aW9uXTsKKyAgICAgICAgICAgIGNvbmZpZy5sb2NhbGUgPSBsb2MubG9jYWxlOworCisgICAgICAgICAgICAvLyBpbmRpY2F0ZSB0aGlzIGlzbid0IHNvbWUgcGFzc2luZyBkZWZhdWx0IC0gdGhlIHVzZXIgd2FudHMgdGhpcyByZW1lbWJlcmVkCisgICAgICAgICAgICBjb25maWcudXNlclNldExvY2FsZSA9IHRydWU7CisKKyAgICAgICAgICAgIGFtLnVwZGF0ZUNvbmZpZ3VyYXRpb24oY29uZmlnKTsKKyAgICAgICAgICAgIC8vIFRyaWdnZXIgdGhlIGRpcnR5IGJpdCBmb3IgdGhlIFNldHRpbmdzIFByb3ZpZGVyLgorICAgICAgICAgICAgQmFja3VwTWFuY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mcgYSBzbmFwc2hvdCwgZG9uJ3QgYm90aGVyIGVucXVldWVpbmcgYW5vdGhlcgogICAgICAgICAgKiByZXF1ZXN0IHJpZ2h0IG5vdy4gVGhpcyB3aWxsIHJlZHVjZSB0aGUgbnVtYmVyIG9mIGluZGl2aWR1YWwKICAgICAgICAgICogc25hcHNob3RzIGFuZCBpbiB0dXJuIHRoZSB0b3RhbCBhbW91bnQgb2YgbWVtb3J5IGNvbnN1bWVkIChvbmUgYmlnCiAgICAgICAgICAqIHNuYXBzaG90IGlzIHNtYWxsZXIgdGhhbiBOIHN1YnNldCBzbmFwc2hvdHMpLgogICAgICAgICAgKi8KLSAgICAgICAgaWYgKCFwZW5kaW5nKSB7Ci0gICAgICAgICAgICBwZW5kaW5nID0gdHJ1ZTsKKyAgICAgICAgaWYgKHBlbmRpbmcuY29tcGFyZUFuZFNldChmYWxzZSwgdHJ1ZSkpIHsKICAgICAgICAgICAgIHNuYXBzaG90V3JpdGVyLmV4ZWN1dGUobmV3IFJ1bm5hYmxlKCkgewogICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIHJ1bigpIHsKLSAgICAgICAgICAgICAgICAgICAgU3RyaW5nIGRpciA9Ci0gICAgICAgICAgICAgICAgICAgICAgICBFbnZpcm9ubWVudC5nZXRFeHRlcm5hbFN0b3JhZ2VEaXJlY3RvcnkoKS5nZXRQYXRoKCkgKyAiL3NuYXBzaG90cyI7CiAgICAgICAgICAgICAgICAgICAgIGlmICghZGlyTWFkZSkgewotICAgICAgICAgICAgICAgICAgICAgICAgbmV3IEZpbGUoZGlyKS5ta2RpcnMoKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuZXcgRmlsZShkaXIpLmlzRGlyZWN0b3J5KCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIEZpbGUgZGlyID0gbmV3IEZpbGUoU05BUFNIT1RfRElSKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGRpci5ta2RpcnMoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIHRoZSBkaXJlY3RvcnkgbmVlZHMgdG8gYmUgd3JpdGFibGUgdG8gYW55Ym9keQorICAgICAgICAgICAgICAgICAgICAgICAgZGlyLnNldFdyaXRhYmxlKHRydWUsIGZhbHNlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIHRoZSBkaXJlY3RvcnkgbmVlZHMgdG8gYmUgZXhlY3V0YWJsZSB0byBhbnlib2R5CisgICAgICAgICAgICAgICAgICAgICAgICAvLyBkb24ndCBrbm93IHdoeSB5ZXQsIGJ1dCBtb2RlIDcyMyB3b3VsZCB3b3JrLCB3aGlsZQorICAgICAgICAgICAgICAgICAgICAgICAgLy8gbW9kZSA3MjIgdGhyb3dzIEZpbGVOb3RGb3VuZEV4ZWNwdGlvbiBhdCBsaW5lIDE1MQorICAgICAgICAgICAgICAgICAgICAgICAgZGlyLnNldEV4ZWN1dGFibGUodHJ1ZSwgZmFsc2UpOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG5ldyBGaWxlKFNOQVBTSE9UX0RJUikuaXNEaXJlY3RvcnkoKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpck1hZGUgPSB0cnVlOwogICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBMb2cudyhUQUcsICJDcmVhdGlvbiBvZiAiICsgZGlyICsgIiBmYWlsZWQuIik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgTG9nLncoVEFHLCAiQ3JlYXRpb24gb2YgIiArIFNOQVBTSE9UX0RJUiArICIgZmFpbGVkLiIpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBlbmRpbmcuc2V0KGZhbHNlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHdyaXRlU25hcHNob3QoZGlyLCBuYW1lKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHdyaXRlU25hcHNob3QoU05BUFNIT1RfRElSLCBwcm9jZXNzTmFtZSwgcGFja2FnZUluZm8pOwogICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgewotICAgICAgICAgICAgICAgICAgICAgICAgcGVuZGluZyA9IGZhbHNlOworICAgICAgICAgICAgICAgICAgICAgICAgcGVuZGluZy5zZXQoZmFsc2UpOwogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfSk7CkBAIC0xMjQsMTUgKzEzNywxNSBAQAogICAgICAgICBpZiAoIWVuYWJsZWQpIHsKICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgfQotCi0gICAgICAgIFN0cmluZyBkaXIgPSAiL2RhdGEvenlnb3RlL3NuYXBzaG90cyI7Ci0gICAgICAgIG5ldyBGaWxlKGRpcikubWtkaXJzKCk7Ci0gICAgICAgIHdyaXRlU25hcHNob3QoZGlyLCAienlnb3RlIik7CisgICAgICAgIHdyaXRlU25hcHNob3QoInp5Z290ZSIsIG51bGwpOwogICAgICAgICBJTlNUQU5DRS5zaHV0ZG93bigpOwogICAgICAgICBJTlNUQU5DRSA9IG51bGw7CiAgICAgfQogCi0gICAgcHJpdmF0ZSBzdGF0aWMgdm9pZCB3cml0ZVNuYXBzaG90KFN0cmluZyBkaXIsIFN0cmluZyBuYW1lKSB7CisgICAgLyoqCisgICAgICogcGFzcyBpbiBQYWNrYWdlSW5mbyB0byByZXRyaWV2ZSB2YXJpb3VzIHZhbHVlcyBmb3Igc25hcHNob3QgaGVhZGVyCisgICAgICovCisgICAgcHJpdmF0ZSBzdGF0aWMgdm9pZCB3cml0ZVNuYXBzaG90KFN0cmluZyBkaXIsIFN0cmluZyBwcm9jZXNzTmFtZSwgUGFja2FnZUluZm8gcGFja2FnZUluZm8pIHsKICAgICAgICAgaWYgKCFlbmFibGVkKSB7CiAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgIH0KQEAgLTE0NCw0MCArMTU3LDU1IEBACiAgICAgICAgICAqIHdlIGNhcHR1cmUgdHdvIHNuYXBzaG90cyBpbiByYXBpZCBzdWNjZXNzaW9uLgogICAgICAgICAgKi8KICAgICAgICAgbG9uZyBzdGFydCA9IFN5c3RlbS5jdXJyZW50VGltZU1pbGxpcygpOwotICAgICAgICBTdHJpbmcgcGF0aCA9IGRpciArICIvIiArIG5hbWUucmVwbGFjZSgnOicsICcuJykgKyAiLSIKLSAgICAgICAgICAgICAgICArIFN5c3RlbS5jdXJyZW50VGltZU1pbGxpcygpICsgIi5zbmFwc2hvdCI7Ci0KLSAgICAgICAgLy8gVHJ5IHRvIG9wZW4gdGhlIGZpbGUgYSBmZXcgdGltZXMuIFRoZSBTRCBjYXJkIG1heSBub3QgYmUgbW91bnRlZC4KLSAgICAgICAgUHJpbnRTdHJlYW0gb3V0OwotICAgICAgICBpbnQgY291bnQgPSAwOwotICAgICAgICB3aGlsZSAodHJ1ZSkgewotICAgICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgICBvdXQgPSBuZXcgUHJpbnRTdHJlYW0obmV3IEJ1ZmZlcmVkT3V0cHV0U3RyZWFtKG5ldyBGaWxlT3V0cHV0U3RyZWFtKHBhdGgpKSk7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICB9IGNhdGNoIChGaWxlTm90Rm91bmRFeGNlcHRpb24gZSkgewotICAgICAgICAgICAgICAgIGlmICgrK2NvdW50ID4gMykgewotICAgICAgICAgICAgICAgICAgICBMb2cuZShUQUcsICJDb3VsZCBub3Qgb3BlbiAiICsgcGF0aCArICIuIik7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAvLyBTbGVlcCBmb3IgYSBiaXQgYW5kIHRoZW4gdHJ5IGFnYWluLgotICAgICAgICAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICAgICAgICAgIFRocmVhZC5zbGVlcCgyNTAwKTsKLSAgICAgICAgICAgICAgICB9IGNhdGNoIChJbnRlcnJ1cHRlZEV4Y2VwdGlvbiBlMSkgeyAvKiBpZ25vcmUgKi8gfQotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KKyAgICAgICAgU3RyaW5nIG5hbWUgPSBwcm9jZXNzTmFtZS5yZXBsYWNlQWxsKCI6IiwgIi4iKTsKKyAgICAgICAgU3RyaW5nIHBhdGggPSBkaXIgKyAiLyIgKyBuYW1lICsgIi0iICtTeXN0ZW0uY3VycmVudFRpbWVNaWxsaXMoKSArICIuc25hcHNob3QiOworICAgICAgICBQcmludFN0cmVhbSBvdXQgPSBudWxsOwogICAgICAgICB0cnkgeworICAgICAgICAgICAgb3V0ID0gbmV3IFByaW50U3RyZWFtKG5ldyBCdWZmZXJlZE91dHB1dFN0cmVhbShuZXcgRmlsZU91dHB1dFN0cmVhbShwYXRoKSkpOworICAgICAgICB9IGNhdGNoIChJT0V4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICBMb2cuZShUQUcsICJDb3VsZCBub3Qgb3BlbiAiICsgcGF0aCArICI6IiArIGUpOworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBnZW5lcmF0ZVNuYXBzaG90SGVhZGVyKG5hbWUsIHBhY2thZ2VJbmZvLCBvdXQpOwogICAgICAgICAgICAgSU5TVEFOQ0Uud3JpdGVIcHJvZkRhdGEob3V0KTsKICAgICAgICAgfSBmaW5hbGx5IHsKICAgICAgICAgICAgIG91dC5jbG9zZSgpOwogICAgICAgICB9CiAgICAgICAgIGlmIChvdXQuY2hlY2tFcnJvcigpKSB7CiAgICAgICAgICAgICBMb2cuZShUQUcsICJFcnJvciB3cml0aW5nIHNuYXBzaG90LiIpOwotICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgb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NiwxNyBAQAogICAgICAgICAgICAgfQogICAgICAgICAgICAgcmV0dXJuIHJldFZhbDsKICAgICAgICAgfQotICAgICAgICBAT3ZlcnJpZGUgcHVibGljIHZvaWQgZXhpdCgpIHsKKyAgICAgICAgXEBPdmVycmlkZSBwdWJsaWMgdm9pZCBleGl0KCkgewogICAgICAgICAgICAgTG9nLmQoVEFHLCAibVMyLmV4aXQiKTsKICAgICAgICAgfQogICAgIH0KIAogICAgIGNsYXNzIFAyIGV4dGVuZHMgSGllcmFyY2hpY2FsU3RhdGUgewotICAgICAgICBAT3ZlcnJpZGUgcHVibGljIHZvaWQgZW50ZXIoKSB7CisgICAgICAgIFxAT3ZlcnJpZGUgcHVibGljIHZvaWQgZW50ZXIoKSB7CiAgICAgICAgICAgICBMb2cuZChUQUcsICJtUDIuZW50ZXIiKTsKICAgICAgICAgICAgIHNlbmRNZXNzYWdlKG9idGFpbk1lc3NhZ2UoQ01EXzUpKTsKICAgICAgICAgfQotICAgICAgICBAT3ZlcnJpZGUgcHVibGljIGJvb2xlYW4gcHJvY2Vzc01lc3NhZ2UoTWVzc2FnZSBtZXNzYWdlKSB7CisgICAgICAgIFxAT3ZlcnJpZGUgcHVibGljIGJvb2xlYW4gcHJvY2Vzc01lc3NhZ2UoTWVzc2FnZSBtZXNzYWdlKSB7CiAgICAgICAgICAgICBMb2cuZChUQUcsICJQMi5wcm9jZXNzTWVzc2FnZSB3aGF0PSIgKyBtZXNzYWdlLndoYXQpOwogICAgICAgICAgICAgc3dpdGNoKG1lc3NhZ2Uud2hhdCkgewogICAgICAgICAgICAgY2FzZShDTURfMyk6CkBAIC0zNDksMTIgKzM0OSwxMiBAQAogICAgICAgICAgICAgfQogICAgICAgICAgICAgcmV0dXJuIEhBTkRMRUQ7CiAgICAgICAgIH0KLSAgICAgICAgQE92ZXJyaWRlIHB1YmxpYyB2b2lkIGV4aXQoKSB7CisgICAgICAgIFxAT3ZlcnJpZGUgcHVibGljIHZvaWQgZXhpdCgpIHsKIC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bGwsICJsaXN0Iik7CiAgICAgfQorICAgIAorICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgdm9pZCB3cml0ZVNldFhtbChTZXQgdmFsLCBTdHJpbmcgbmFtZSwgWG1sU2VyaWFsaXplciBvdXQpCisgICAgICAgICAgICB0aHJvd3MgWG1sUHVsbFBhcnNlckV4Y2VwdGlvbiwgamF2YS5pby5JT0V4Y2VwdGlvbiB7CisgICAgICAgIGlmICh2YWwgPT0gbnVsbCkgeworICAgICAgICAgICAgb3V0LnN0YXJ0VGFnKG51bGwsICJudWxsIik7CisgICAgICAgICAgICBvdXQuZW5kVGFnKG51bGwsICJudWxsIik7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIG91dC5zdGFydFRhZyhudWxsLCAic2V0Iik7CisgICAgICAgIGlmIChuYW1lICE9IG51bGwpIHsKKyAgICAgICAgICAgIG91dC5hdHRyaWJ1dGUobnVsbCwgIm5hbWUiLCBuYW1lKTsKKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgZm9yIChPYmplY3QgdiA6IHZhbCkgeworICAgICAgICAgICAgd3JpdGVWYWx1ZVhtbCh2LCBudWxsLCBvdXQpOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICBvdXQuZW5kVGFnKG51bGwsICJzZXQiKTsKKyAgICB9CiAKICAgICAvKioKICAgICAgKiBGbGF0dGVuIGEgYnl0ZVtdIGludG8gYW4gWG1sU2VyaWFsaXplci4gIFRoZSBsaXN0IGNhbiBsYXRlciBiZSByZWFkIGJhY2sKQEAgLTQyNiw2ICs0NDcsOSBAQAogICAgICAgICB9IGVsc2UgaWYgKHYgaW5zdGFuY2VvZiBMaXN0KSB7CiAgICAgICAgICAgICB3cml0ZUxpc3RYbWwoKExpc3QpdiwgbmFtZSwgb3V0KTsKICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfSBlbHNlIGlmICh2IGluc3RhbmNlb2YgU2V0KSB7CisgICAgICAgICAg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hZC4KKyAgICAgKiAKKyAgICAgKiBAcmV0dXJuIEhhc2hTZXQgVGhlIHJlc3VsdGluZyBzZXQuCisgICAgICogCisgICAgICogQHRocm93cyBYbWxQdWxsUGFyc2VyRXhjZXB0aW9uCisgICAgICogQHRocm93cyBqYXZhLmlvLklPRXhjZXB0aW9uCisgICAgICogCisgICAgICogQHNlZSAjcmVhZFZhbHVlWG1sCisgICAgICogQHNlZSAjcmVhZFRoaXNTZXRYbWwKKyAgICAgKiBAc2VlICN3cml0ZVNldFhtbAorICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgSGFzaFNldCByZWFkU2V0WG1sKElucHV0U3RyZWFtIGluKQorICAgICAgICAgICAgdGhyb3dzIFhtbFB1bGxQYXJzZXJFeGNlcHRpb24sIGphdmEuaW8uSU9FeGNlcHRpb24geworICAgICAgICBYbWxQdWxsUGFyc2VyIHBhcnNlciA9IFhtbC5uZXdQdWxsUGFyc2VyKCk7CisgICAgICAgIHBhcnNlci5zZXRJbnB1dChpbiwgbnVsbCk7CisgICAgICAgIHJldHVybiAoSGFzaFNldCkgcmVhZFZhbHVlWG1sKHBhcnNlciwgbmV3IFN0cmluZ1sxXSk7CisgICAgfQogCiAgICAgLyoqCiAgICAgICogUmVhZCBhIEhhc2hNYXAgb2JqZWN0IGZyb20gYW4gWG1sUHVsbFBhcnNlci4gIFRoZSBYTUwgZGF0YSBjb3VsZApAQCAtNTczLDYgKzYyMCw0NyBAQAogICAgICAgICB0aHJvdyBuZXcgWG1sUHVsbFBhcnNlckV4Y2VwdGlvbigKICAgICAgICAgICAgICJEb2N1bWVudCBlbmRlZCBiZWZvcmUgIiArIGVuZFRhZyArICIgZW5kIHRhZyIpOwogICAgIH0KKyAgICAKKyAgICAvKioKKyAgICAgKiBSZWFkIGEgSGFzaFNldCBvYmplY3QgZnJvbSBhbiBYbWxQdWxsUGFyc2VyLiBUaGUgWE1MIGRhdGEgY291bGQgcHJldmlvdXNseQorICAgICAqIGhhdmUgY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EV2ZW50VHlwZSgpOworICAgICAgICBkbyB7CisgICAgICAgICAgICBpZiAoZXZlbnRUeXBlID09IHBhcnNlci5TVEFSVF9UQUcpIHsKKyAgICAgICAgICAgICAgICBPYmplY3QgdmFsID0gcmVhZFRoaXNWYWx1ZVhtbChwYXJzZXIsIG5hbWUpOworICAgICAgICAgICAgICAgIHNldC5hZGQodmFsKTsKKyAgICAgICAgICAgICAgICAvL1N5c3RlbS5vdXQucHJpbnRsbigiQWRkaW5nIHRvIHNldDogIiArIHZhbCk7CisgICAgICAgICAgICB9IGVsc2UgaWYgKGV2ZW50VHlwZSA9PSBwYXJzZXIuRU5EX1RBRykgeworICAgICAgICAgICAgICAgIGlmIChwYXJzZXIuZ2V0TmFtZSgpLmVxdWFscyhlbmRUYWcpKSB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBzZXQ7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHRocm93IG5ldyBYbWxQdWxsUGFyc2VyRXhjZXB0aW9uKAorICAgICAgICAgICAgICAgICAgICAgICAgIkV4cGVjdGVkICIgKyBlbmRUYWcgKyAiIGVuZCB0YWcgYXQ6ICIgKyBwYXJzZXIuZ2V0TmFtZSgpKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGV2ZW50VHlwZSA9IHBhcnNlci5uZXh0KCk7CisgICAgICAgIH0gd2hpbGUgKGV2ZW50VHlwZSAhPSBwYXJzZXIuRU5EX0RPQ1VNRU5UKTsKKyAgICAgICAgCisgICAgICAgIHRocm93IG5ldyBYbWxQdWxsUGFyc2VyRXhjZXB0aW9uKAorICAgICAgICAgICAgICAgICJEb2N1bWVudCBlbmRlZCBiZWZvcmUgIiArIGVuZFRhZyArICIgZW5kIHRhZyIpOworICAgIH0KIAogICAgIC8qKgogICAgICAqIFJlYWQgYW4gaW50W10gb2JqZWN0IGZyb20gYW4gWG1sUHVsbFBhcnNlci4gIFRoZSBYTUwgZGF0YSBjb3VsZApAQCAtNzQwLDYg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Glvbk1vZGUodGhpcywgbU1lbnUpOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIGZpbmlzaCgpIHsKKyAgICAgICAgaWYgKG1GaW5pc2hlZCkgeworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisgICAgICAgIG1GaW5pc2hlZCA9IHRydWU7CisKKyAgICAgICAgbUNhbGxiYWNrLm9uRGVzdHJveUFjdGlvbk1vZGUodGhpcyk7CisgICAgICAgIG1Db250ZXh0Vmlldy5zZXRWaXNpYmlsaXR5KFZpZXcuR09ORSk7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIE1lbnUgZ2V0TWVudSgpIHsKKyAgICAgICAgcmV0dXJuIG1NZW51OworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyBDaGFyU2VxdWVuY2UgZ2V0VGl0bGUoKSB7CisgICAgICAgIHJldHVybiBtQ29udGV4dFZpZXcuZ2V0VGl0bGUoKTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgQ2hhclNlcXVlbmNlIGdldFN1YnRpdGxlKCkgeworICAgICAgICByZXR1cm4gbUNvbnRleHRWaWV3LmdldFN1YnRpdGxlKCk7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIFZpZXcgZ2V0Q3VzdG9tVmlldygpIHsKKyAgICAgICAgcmV0dXJuIG1DdXN0b21WaWV3ICE9IG51bGwgPyBtQ3VzdG9tVmlldy5nZXQoKSA6IG51bGw7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIE1lbnVJbmZsYXRlciBnZXRNZW51SW5mbGF0ZXIoKSB7CisgICAgICAgIHJldHVybiBuZXcgTWVudUluZmxhdGVyKG1Db250ZXh0KTsKKyAgICB9CisKKyAgICBwdWJsaWMgYm9vbGVhbiBvbk1lbnVJdGVtU2VsZWN0ZWQoTWVudUJ1aWxkZXIgbWVudSwgTWVudUl0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0ZW0gYWRkKGludCBncm91cElkLCBpbnQgaXRlbUlkLCBpbnQgb3JkZXIsIGludCB0aXRsZVJlcykgeworICAgICAgICByZXR1cm4gYWRkKGdyb3VwSWQsIGl0ZW1JZCwgb3JkZXIsIG1Db250ZXh0LmdldFJlc291cmNlcygpLmdldFN0cmluZyh0aXRsZVJlcykpOworICAgIH0KKyAgICAKKyAgICBwdWJsaWMgTWVudUl0ZW0gYWRkKGludCBncm91cElkLCBpbnQgaXRlbUlkLCBpbnQgb3JkZXIsIENoYXJTZXF1ZW5jZSB0aXRsZSkgeworICAgICAgICBBY3Rpb25NZW51SXRlbSBpdGVtID0gbmV3IEFjdGlvbk1lbnVJdGVtKGdldENvbnRleHQoKSwKKyAgICAgICAgICAgICAgICBncm91cElkLCBpdGVtSWQsIDAsIG9yZGVyLCB0aXRsZSk7CisgICAgICAgIG1JdGVtcy5hZGQob3JkZXIsIGl0ZW0pOworICAgICAgICByZXR1cm4gaXRlbTsKKyAgICB9CisKKyAgICBwdWJsaWMgaW50IGFkZEludGVudE9wdGlvbnMoaW50IGdyb3VwSWQsIGludCBpdGVtSWQsIGludCBvcmRlciwKKyAgICAgICAgICAgIENvbXBvbmVudE5hbWUgY2FsbGVyLCBJbnRlbnRbXSBzcGVjaWZpY3MsIEludGVudCBpbnRlbnQsIGludCBmbGFncywKKyAgICAgICAgICAgIE1lbnVJdGVtW10gb3V0U3BlY2lmaWNJdGVtcykgeworICAgICAgICBQYWNrYWdlTWFuYWdlciBwbSA9IG1Db250ZXh0LmdldFBhY2thZ2VNYW5hZ2VyKCk7CisgICAgICAgIGZpbmFsIExpc3Q8UmVzb2x2ZUluZm8+IGxyaSA9CisgICAgICAgICAgICAgICAgcG0ucXVlcnlJbnRlbnRBY3Rpdml0eU9wdGlvbnMoY2FsbGVyLCBzcGVjaWZpY3MsIGludGVudCwgMCk7CisgICAgICAgIGZpbmFsIGludCBOID0gbHJpICE9IG51bGwgPyBscmkuc2l6ZSgpIDogMDsKKworICAgICAgICBpZiAoKGZsYWdzICYgRkxBR19BUFBFTkRfVE9fR1JPVVApID09IDApIHsKKyAgICAgICAgICAgIHJlbW92ZUdyb3VwKGdyb3VwSWQpOworICAgICAgICB9CisKKyAgICAgICAgZm9yIChpbnQgaT0wOyBpPE47IGkrKykgeworICAgICAgICAgICAgZmluYWwgUmVzb2x2ZUluZm8gcmkgPSBscmkuZ2V0KGkpOworICAgICAgICAgICAgSW50ZW50IHJpbnRlbnQgPSBuZXcgSW50ZW50KAorICAgICAgICAgICAgICAgIHJpLnNwZWNpZmljSW5kZXggPCAwID8gaW50ZW50IDogc3BlY2lmaWNzW3JpLnNwZWNpZmljSW5kZXhdKTsKKyAgICAgICAgICAgIHJpbnRlbnQuc2V0Q29tcG9uZW50KG5ldyBDb21wb25lbnROYW1lKAorICAgICAgICAgICAgICAgICAgICByaS5hY3Rpdml0eUluZm8uYXBwbGljYXRpb25JbmZvLnBhY2thZ2VOYW1lLAorICAgICAgICAgICAgICAgICAgICByaS5hY3Rpdml0eUluZm8ubmFtZSkpOworICAgICAgICAgICAgZmluYWwgTWVudUl0ZW0gaXRlbSA9IGFkZChncm91cElkLCBpdGVtSWQsIG9yZGVyLCByaS5sb2FkTGFiZWwocG0pKQorICAgICAgICAgICAgICAgICAgICAuc2V0SWNvbihyaS5sb2FkSWNvbihwbSkpCisgICAgICAgICAgICAgICAgICAgIC5zZXRJbnRlbnQocmludGVudCk7CisgICAgICAgICAgICBpZiAob3V0U3BlY2lmaWNJdGVtcyAhPSBudWxsICYmIHJpLnNwZWNpZmljSW5kZXggPj0gMCkgeworICAgICAgICAgICAgICAgIG91dFNwZWNpZmljSXRlbXNbcmkuc3BlY2lmaWNJbmRleF0gPSBpdGVtOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcmV0dXJuIE47CisgICAgfQorCisgICAgcHVibGljIFN1Yk1lbnUgYWRkU3ViTWVudShDaGFyU2VxdWVuY2UgdGl0bGUpIHsKKyAgICAgICAgLy8gVE9ETyBJbXBsZW1lbnQgc3VibWVudXMKKyAgICAgICAgcmV0dXJuIG51bGw7CisgICAgfQorCisgICAgcHVibGljIFN1Yk1lbnUgYWRkU3ViTWVudShpbnQgdGl0bGVSZXMpIHsKKyAgICAgICAgLy8gVE9ETyBJbXBsZW1lbnQgc3VibWVudXMKKyAgICAgICAgcmV0dXJuIG51bGw7CisgICAgfQorCisgICAgcHVibGljIFN1Yk1lbnUgYWRkU3ViTWVudShpbnQgZ3JvdXBJZCwgaW50IGl0ZW1JZCwgaW50IG9yZGVyLAorICAgICAgICAgICAgQ2hhclNlcXVlbmNlIHRpdGxlKSB7CisgICAgICAgIC8vIFRPRE8gSW1wbGVtZW50IHN1Ym1lbnVzCisgICAgICAgIHJldHVybiBudWxsOworICAgIH0KKworICAgIHB1YmxpYyBTdWJNZW51IGFkZFN1Yk1lbnUoaW50IGdyb3VwSWQsIGludCBpdGVtSWQsIGludCBvcmRlciwgaW50IHRpdGxlUmVzKSB7CisgICAgICAgIC8vIFRPRE8gSW1wbGVtZW50IHN1Ym1lbnVzCisgICAgICAgIHJldHVybiBudWxsOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGNsZWFyKCkgeworICAgICAgICBtSXRlbXMuY2xlYXIoKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBjbG9zZSgpIHsKKyAgICB9CisgICAgCisgICAgcHJpdmF0ZSBpbnQgZmluZEl0ZW1JbmRleChpbnQgaWQpIHsKKyAgICAgICAgZmluYWwgQXJyYXlMaXN0PEFjdGlvbk1lbnVJdGVtPiBpdGVtcyA9IG1JdGVtczsKKyAgICAgICAgZmluYWwgaW50IGl0ZW1Db3VudCA9IGl0ZW1zLnNpemUoKTsKKyAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBpdGVtQ291bnQ7IGkrKykgeworICAgICAgICAgICAgaWYgKGl0ZW1zLmdldChpKS5nZXRJdGVtSWQoKSA9PSBpZCkgeworICAgICAgICAgICAgICAgIHJldHVybiBpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIAorICAgICAgICByZXR1cm4gLTE7CisgICAgfQorCisgICAgcHVibGljIE1lbnVJdGVtIGZpbmRJdGVtKGludCBpZCkgeworICAgICAgICByZXR1cm4gbUl0ZW1zLmdldChmaW5kSXRlbUluZGV4KGlkKSk7CisgICAgfQorCisgICAgcHVibGljIE1lbnVJdGVtIGdldEl0ZW0oaW50IGluZGV4KSB7CisgICAgICAgIHJldHVybiBtSXRlbXMuZ2V0KGluZGV4KTsKKyAgICB9CisKKyAgICBwdWJsaWMgYm9vbGVhbiBoYXNWaXNpYmxlSXRlbXMoKSB7CisgICAgICAgIGZpbmFsIEFycmF5TGlzdDxBY3Rpb25NZW51SXRlbT4gaXRlbXMgPSBtSXRlbXM7CisgICAgICAgIGZpbmFsIGludCBpdGVtQ291bnQgPSBpdGVtcy5zaXplKCk7CisgICAgICAgIAorICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGl0ZW1Db3VudDsgaSsrKSB7CisgICAgICAgICAgICBpZiAoaXRlbXMuZ2V0KGkpLmlzVmlzaWJsZSgpKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisgICAgCisgICAgcHJpdmF0ZSBBY3Rpb25NZW51SXRlbSBmaW5kSXRlbVdpdGhTaG9ydGN1dChpbnQga2V5Q29kZSwgS2V5RXZlbnQgZXZlbnQpIHsKKyAgICAgICAgLy8gVE9ETyBNYWtlIHRoaXMgc21hcnRlci4KKyAgICAgICAgZmluYWwgYm9vbGVhbiBxd2VydHkgPSBtSXNRd2VydHk7CisgICAgICAgIGZpbmFsIEFycmF5TGlzdDxBY3Rpb25NZW51SXRlbT4gaXRlbXMgPSBtSXRlbXM7CisgICAgICAgIGZpbmFsIGludCBpdGVtQ291bnQgPSBpdGVtcy5zaXplKCk7CisgICAgICAgIAorICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGl0ZW1Db3VudDsgaSsrKSB7CisgICAgICAgICAgICBBY3Rpb25NZW51SXRlbSBpdGVtID0gaXRlbXMuZ2V0KGkpOworICAgICAgICAgICAgZmluYWwgY2hhciBzaG9ydGN1dCA9IHF3ZXJ0eSA/IGl0ZW0uZ2V0QWxwaGFiZXRpY1Nob3J0Y3V0KCkgOgorICAgICAgICAgICAgICAgICAgICBpdGVtLmdldE51bWVyaWNTaG9ydGN1dCgpOworICAgICAgICAgICAgaWYgKGtleUNvZGUgPT0gc2hvcnRjdXQpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gaXRlbTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbnVsbDsKKyAgICB9CisKKyAgICBwdWJsaWMgYm9vbGVhbiBpc1Nob3J0Y3V0S2V5KGludCBrZXlDb2RlLCBLZXlFdmVudCBldmVudCkgeworICAgICAgICByZXR1cm4gZmluZEl0ZW1XaXRoU2hvcnRjdXQoa2V5Q29kZSwgZXZlbnQpICE9IG51bGw7CisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gcGVyZm9ybUlkZW50aWZpZXJBY3Rpb24oaW50IGlkLCBpbnQgZmxhZ3MpIHsKKyAgICAgICAgZmluYWwgaW50IGluZGV4ID0gZmluZEl0ZW1JbmRleChpZCk7CisgICAgICAgIGlmIChpbmRleCA8IDApIHsKKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiBtSXRlbXMuZ2V0KGluZGV4KS5pbnZva2UoKTsKKyAgICB9CisKKyAgICBwdWJsaWMgYm9vbGVhbiBwZXJmb3JtU2hvcnRjdXQoaW50IGtleUNvZGUsIEtleUV2ZW50IGV2ZW50LCBpbnQgZmxhZ3MpIHsKKyAgICAgICAgQWN0aW9uTWVudUl0ZW0gaXRlbSA9IGZpbmRJdGVtV2l0aFNob3J0Y3V0KGtleUNvZGUsIGV2ZW50KTsKKyAgICAgICAgaWYgKGl0ZW0gPT0gbnVsbCkgeworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICByZXR1cm4gaXRlbS5pbnZva2UoKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCByZW1vdmVHcm91cChpbnQgZ3JvdXBJZCkgeworICAgICAgICBmaW5hbCBBcnJheUxpc3Q8QWN0aW9uTWVudUl0ZW0+IGl0ZW1zID0gbUl0ZW1zOworICAgICAgICBpbnQgaXRlbUNvdW50ID0gaXRlbXMuc2l6ZSgpOworICAgICAgICBpbnQgaSA9IDA7CisgICAgICAgIHdoaWxlIChpIDwgaXRlbUNvdW50KSB7CisgICAgICAgICAgICBpZiAoaXRlbXMuZ2V0KGkpLmdldEdyb3VwSWQoKSA9PSBncm91cElkKSB7CisgICAgICAgICAgICAgICAgaXRlbXMucmVtb3ZlKGkpOworICAgICAgICAgICAgICAgIGl0ZW1Db3VudC0tOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBpKys7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCByZW1vdmVJdGVtKGludCBpZCkgeworICAgICAgICBtSXRlbXMucmVtb3ZlKGZpbmRJdGVtSW5kZXgoaWQpKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBzZXRHcm91cENoZWNrYWJsZShpbnQgZ3JvdXAsIGJvb2xlYW4gY2hlY2thYmxlLAorICAgICAgICAgICAgYm9vbGVhbiBleGNsdXNpdmUpIHsKKyAgICAgICAgZmluYWwgQXJyYXlMaXN0PEFjdGlvbk1lbnVJdGVtPiBpdGVtcyA9IG1JdGVtczsKKyAgICAgICAgZmluYWwgaW50IGl0ZW1Db3VudCA9IGl0ZW1zLnNpemUoKTsKKyAgICAgICAgCisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgaXRlbUNvdW50OyBpKyspIHsKKyAgICAgICAgICAgIEFjdGlvbk1lbnVJdGVtIGl0ZW0gPSBpdGVtcy5nZXQoaSk7CisgICAgICAgICAgICBpZiAoaXRlbS5nZXRHcm91cElkKCkgPT0gZ3JvdXApIHsKKyAgICAgICAgICAgICAgICBpdGVtLnNldENoZWNrYWJsZShjaGVja2FibGUpOworICAgICAgICAgICAgICAgIGl0ZW0uc2V0RXhjbHVzaXZlQ2hlY2thYmxlKGV4Y2x1c2l2ZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBzZXRHcm91cEVuYWJsZWQoaW50IGdyb3VwLCBib29sZWFuIGVuYWJsZWQpIHsKKyAgICAgICAgZmluYWwgQXJyYXlMaXN0PEFjdGlvbk1lbnVJdGVtPiBpdGVtcyA9IG1JdGVtczsKKyAgICAgICAgZmluYWwgaW50IGl0ZW1Db3VudCA9IGl0ZW1zLnNpemUoKTsKKyAgICAgICAgCisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgaXRlbUNvdW50OyBpKyspIHsKKyAgICAgICAgICAgIEFjdGlvbk1lbnVJdGVtIGl0ZW0gPSBpdGVtcy5nZXQoaSk7CisgICAgICAgICAgICBpZiAoaXRlbS5nZXRHcm91cElkKCkgPT0gZ3JvdXApIHsKKyAgICAgICAgICAgICAgICBpdGVtLnNldEVuYWJsZWQoZW5hYmxlZCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBzZXRHcm91cFZpc2libGUoaW50IGdyb3VwLCBib29sZWFuIHZpc2libGUpIHsKKyAgICAgICAgZmluYWwgQXJyYXlMaXN0PEFjdGlvbk1lbnVJdGVtPiBpdGVtcyA9IG1JdGVtczsKKyAgICAgICAgZmluYWwgaW50IGl0ZW1Db3VudCA9IGl0ZW1zLnNpemUoKTsKKyAgICAgICAgCisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgaXRlb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AweDAwMDAwMDEwOworICAgIAorICAgIHB1YmxpYyBBY3Rpb25NZW51SXRlbShDb250ZXh0IGNvbnRleHQsIGludCBncm91cCwgaW50IGlkLCBpbnQgY2F0ZWdvcnlPcmRlciwgaW50IG9yZGVyaW5nLAorICAgICAgICAgICAgQ2hhclNlcXVlbmNlIHRpdGxlKSB7CisgICAgICAgIG1Db250ZXh0ID0gY29udGV4dDsKKyAgICAgICAgbUlkID0gaWQ7CisgICAgICAgIG1Hcm91cCA9IGdyb3VwOworICAgICAgICBtQ2F0ZWdvcnlPcmRlciA9IGNhdGVnb3J5T3JkZXI7CisgICAgICAgIG1PcmRlcmluZyA9IG9yZGVyaW5nOworICAgICAgICBtVGl0bGUgPSB0aXRsZTsKKyAgICB9CisgICAgCisgICAgcHVibGljIGNoYXIgZ2V0QWxwaGFiZXRpY1Nob3J0Y3V0KCkgeworICAgICAgICByZXR1cm4gbVNob3J0Y3V0QWxwaGFiZXRpY0NoYXI7CisgICAgfQorCisgICAgcHVibGljIGludCBnZXRHcm91cElkKCkgeworICAgICAgICByZXR1cm4gbUdyb3VwOworICAgIH0KKworICAgIHB1YmxpYyBEcmF3YWJsZSBnZXRJY29uKCkgeworICAgICAgICByZXR1cm4gbUljb25EcmF3YWJsZTsKKyAgICB9CisKKyAgICBwdWJsaWMgSW50ZW50IGdldEludGVudCgpIHsKKyAgICAgICAgcmV0dXJuIG1JbnRlbnQ7CisgICAgfQorCisgICAgcHVibGljIGludCBnZXRJdGVtSWQoKSB7CisgICAgICAgIHJldHVybiBtSWQ7CisgICAgfQorCisgICAgcHVibGljIENvbnRleHRNZW51SW5mbyBnZXRNZW51SW5mbygpIHsKKyAgICAgICAgcmV0dXJuIG51bGw7CisgICAgfQorCisgICAgcHVibGljIGNoYXIgZ2V0TnVtZXJpY1Nob3J0Y3V0KCkgeworICAgICAgICByZXR1cm4gbVNob3J0Y3V0TnVtZXJpY0NoYXI7CisgICAgfQorCisgICAgcHVibGljIGludCBnZXRPcmRlcigpIHsKKyAgICAgICAgcmV0dXJuIG1PcmRlcmluZzsKKyAgICB9CisKKyAgICBwdWJsaWMgU3ViTWVudSBnZXRTdWJNZW51KCkgeworICAgICAgICByZXR1cm4gbnVsbDsKKyAgICB9CisKKyAgICBwdWJsaWMgQ2hhclNlcXVlbmNlIGdldFRpdGxlKCkgeworICAgICAgICByZXR1cm4gbVRpdGxlOworICAgIH0KKworICAgIHB1YmxpYyBDaGFyU2VxdWVuY2UgZ2V0VGl0bGVDb25kZW5zZWQoKSB7CisgICAgICAgIHJldHVybiBtVGl0bGVDb25kZW5zZWQ7CisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gaGFzU3ViTWVudSgpIHsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIHB1YmxpYyBib29sZWFuIGlzQ2hlY2thYmxlKCkgeworICAgICAgICByZXR1cm4gKG1GbGFncyAmIENIRUNLQUJMRSkgIT0gMDsgCisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gaXNDaGVja2VkKCkgeworICAgICAgICByZXR1cm4gKG1GbGFncyAmIENIRUNLRUQpICE9IDA7CisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gaXNFbmFibGVkKCkgeworICAgICAgICByZXR1cm4gKG1GbGFncyAmIEVOQUJMRUQpICE9IDA7CisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gaXNWaXNpYmxlKCkgeworICAgICAgICByZXR1cm4gKG1GbGFncyAmIEhJRERFTikgPT0gMDsKKyAgICB9CisKKyAgICBwdWJsaWMgTWVudUl0ZW0gc2V0QWxwaGFiZXRpY1Nob3J0Y3V0KGNoYXIgYWxwaGFDaGFyKSB7CisgICAgICAgIG1TaG9ydGN1dEFscGhhYmV0aWNDaGFyID0gYWxwaGFDaGFyOworICAgICAgICByZXR1cm4gdGhpczsKKyAgICB9CisKKyAgICBwdWJsaWMgTWVudUl0ZW0gc2V0Q2hlY2thYmxlKGJvb2xlYW4gY2hlY2thYmxlKSB7CisgICAgICAgIG1GbGFncyA9IChtRmxhZ3MgJiB+Q0hFQ0tBQkxFKSB8IChjaGVja2FibGUgPyBDSEVDS0FCTEUgOiAwKTsKKyAgICAgICAgcmV0dXJuIHRoaXM7CisgICAgfQorICAgIAorICAgIHB1YmxpYyBBY3Rpb25NZW51SXRlbSBzZXRFeGNsdXNpdmVDaGVja2FibGUoYm9vbGVhbiBleGNsdXNpdmUpIHsKKyAgICAgICAgbUZsYWdzID0gKG1GbGFncyAmIH5FWENMVVNJVkUpIHwgKGV4Y2x1c2l2ZSA/IEVYQ0xVU0lWRSA6IDApOworICAgICAgICByZXR1cm4gdGhpczsKKyAgICB9CisKKyAgICBwdWJsaWMgTWVudUl0ZW0gc2V0Q2hlY2tlZChib29sZWFuIGNoZWNrZWQpIHsKKyAgICAgICAgbUZsYWdzID0gKG1GbGFncyAmIH5DSEVDS0VEKSB8IChjaGVja2VkID8gQ0hFQ0tFRCA6IDApOworICAgICAgICByZXR1cm4gdGhpczsKKyAgICB9CisKKyAgICBwdWJsaWMgTWVudUl0ZW0gc2V0RW5hYmxlZChib29sZWFuIGVuYWJsZWQpIHsKKyAgICAgICAgbUZsYWdzID0gKG1GbGFncyAmIH5FTkFCTEVEKSB8IChlbmFibGVkID8gRU5BQkxFRCA6IDApOworICAgICAgICByZXR1cm4gdGhpczsKKyAgICB9CisKKyAgICBwdWJsaWMgTWVudUl0ZW0gc2V0SWNvbihEcmF3YWJsZSBpY29uKSB7CisgICAgICAgIG1JY29uRHJhd2FibGUgPSBpY29uOworICAgICAgICBtSWNvblJlc0lkID0gTk9fSUNPTjsKKyAgICAgICAgcmV0dXJuIHRoaXM7CisgICAgfQorCisgICAgcHVibGljIE1lbnVJdGVtIHNldEljb24oaW50IGljb25SZXMpIHsKKyAgICAgICAgbUljb25SZXNJZCA9IGljb25SZXM7CisgICAgICAgIG1JY29uRHJhd2FibGUgPSBtQ29udGV4dC5nZXRSZXNvdXJjZXMoKS5nZXREcmF3YWJsZShpY29uUmVzKTsKKyAgICAgICAgcmV0dXJuIHRoaXM7CisgICAgfQorCisgICAgcHVibGljIE1lbnVJdGVtIHNldEludGVudChJbnRlbnQgaW50ZW50KSB7CisgICAgICAgIG1JbnRlbnQgPSBpbnRlbnQ7CisgICAgICAgIHJldHVybiB0aGlzOworICAgIH0KKworICAgIHB1YmxpYyBNZW51SXRlbSBzZXROdW1lcmljU2hvcnRjdXQoY2hhciBudW1lcmljQ2hhcikgeworICAgICAgICBtU2hvcnRjdXROdW1lcmljQ2hhciA9IG51bWVyaWNDaGFyOworICAgICAgICByZXR1cm4gdGhpczsKKyAgICB9CisKKyAgICBwdWJsaWMgTWVudUl0ZW0gc2V0T25NZW51SXRlbUNsaWNrTGlzdGVuZXIoT25NZW51SXRlbUNsaWNrTGlzdGVuZXIgbWVudUl0ZW1DbGlja0xpc3RlbmVyKSB7CisgICAgICAgIG1DbGlja0xpc3RlbmVyID0gbWVudUl0ZW1DbGlja0xpc3RlbmVyOworICAgICAgICByZXR1cm4gdGhpczsKKyAgICB9CisKKyAgICBwdWJsaWMgTWVudUl0ZW0gc2V0U2hvcnRjdXQoY2hhciBudW1lcmljQ2hhciwgY2hhciBhbHBoYUNoYXIpIHsKKyAgICAgICAgbVNob3J0Y3V0TnVtZXJpY0NoYXIgPSBudW1lcmljQ2hhcjsKKyAgICAgICAgbVNob3J0Y3V0QWxwaGFiZXRpY0NoYXIgPSBhbHBoYUNoYXI7CisgICAgICAgIHJldHVybiB0aGlzOworICAgIH0KKworICAgIHB1YmxpYyBNZW51SXRlbSBzZXRUaXRsZShDaGFyU2VxdWVuY2UgdGl0bGUpIHsKKyAgICAgICAgbVRpdGxlID0gdGl0bGU7CisgICAgICAgIHJldHVybiB0aGlzOworICAgIH0KKworICAgIHB1YmxpYyBNZW51SXRlbSBzZXRUaXRsZShpbnQgdGl0bGUpIHsKKyAgICAgICAgbVRpdGxlID0gbUNvbnRleHQuZ2V0UmVzb3VyY2VzKCkuZ2V0U3RyaW5nKHRpdGxlKTsKKyAgICAgICAgcmV0dXJuIHRoaXM7CisgICAgfQorCisgICAgcHVibGljIE1lbnVJdGVtIHNldFRpdGxlQ29uZGVuc2VkKENoYXJTZXF1ZW5jZSB0aXRsZSkgeworICAgICAgICBtVGl0bGVDb25kZW5zZWQgPSB0aXRsZTsKKyAgICAgICAgcmV0dXJuIHRoaXM7CisgICAgfQorCisgICAgcHVibGljIE1lbnVJdGVtIHNldFZpc2libGUoYm9vbGVhbiB2aXNpYmxlKSB7CisgICAgICAgIG1GbGFncyA9IChtRmxhZ3MgJiBISURERU4pIHwgKHZpc2libGUgPyAwIDogSElEREVOKTsKKyAgICAgICAgcmV0dXJuIHRoaXM7CisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gaW52b2tlKCkgeworICAgICAgICBpZiAobUNsaWNrTGlzdGVuZXIgIT0gbnVsbCAmJiBtQ2xpY2tMaXN0ZW5lci5vbk1lbnVJdGVtQ2xpY2sodGhpcykpIHsKKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICBpZiAobUludGVudCAhPSBudWxsKSB7CisgICAgICAgICAgICBtQ29udGV4dC5zdGFydEFjdGl2aXR5KG1JbnRlbnQpOworICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisgICAgCisgICAgcHVibGljIHZvaWQgc2V0U2hvd0FzQWN0aW9uKGludCBzaG93KSB7CisgICAgICAgIC8vIERvIG5vdGhpbmcuIEFjdGlvbk1lbnVJdGVtcyBhbHdheXMgc2hvdyBhcyBhY3Rpb24gYnV0dG9ucy4KKyAgICB9Cit9CmRpZmYgLS1naXQgYS9jb3JlL2phdmEvY29tL2FuZHJvaWQvaW50ZXJuYWwvdmlldy9tZW51L0FjdGlvbk1lbnVJdGVtVmlldy5qYXZhIGIvY29yZS9qYXZhL2NvbS9hbmRyb2lkL2ludGVybmFsL3ZpZ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2V0SWNvbigpKTsKKyAgICAgICAgc2V0VGl0bGUoaXRlbURhdGEuZ2V0VGl0bGUoKSk7IC8vIFRpdGxlIG9ubHkgdGFrZXMgZWZmZWN0IGlmIHRoZXJlIGlzIG5vIGljb24KKyAgICAgICAgc2V0SWQoaXRlbURhdGEuZ2V0SXRlbUlkKCkpOworCisgICAgICAgIHNldFZpc2liaWxpdHkoaXRlbURhdGEuaXNWaXNpYmxlKCkgPyBWaWV3LlZJU0lCTEUgOiBWaWV3LkdPTkUpOworICAgICAgICBzZXRFbmFibGVkKGl0ZW1EYXRhLmlzRW5hYmxlZCgpKTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCBzZXRFbmFibGVkKGJvb2xlYW4gZW5hYmxlZCkgeworICAgICAgICBzdXBlci5zZXRFbmFibGVkKGVuYWJsZWQpOworICAgICAgICBtSW1hZ2VCdXR0b24uc2V0RW5hYmxlZChlbmFibGVkKTsKKyAgICAgICAgbVRleHRCdXR0b24uc2V0RW5hYmxlZChlbmFibGVkKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBvbkNsaWNrKFZpZXcgdikgeworICAgICAgICBpZiAobUl0ZW1JbnZva2VyICE9IG51bGwpIHsKKyAgICAgICAgICAgIG1JdGVtSW52b2tlci5pbnZva2VJdGVtKG1JdGVtRGF0YSk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBzZXRJdGVtSW52b2tlcihNZW51QnVpbGRlci5JdGVtSW52b2tlciBpbnZva2VyKSB7CisgICAgICAgIG1JdGVtSW52b2tlciA9IGludm9rZXI7CisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gcHJlZmVyc0NvbmRlbnNlZFRpdGxlKCkgeworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc2V0Q2hlY2thYmxlKGJvb2xlYW4gY2hlY2thYmxlKSB7CisgICAgICAgIC8vIFR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CisgICAgCisgICAgcHJpdmF0ZSBNZW51QnVpbGRlciBtTWVudTsKKworICAgIHByaXZhdGUgaW50IG1JdGVtUGFkZGluZzsKKyAgICBwcml2YXRlIGludCBtSXRlbU1hcmdpbjsKKyAgICBwcml2YXRlIGludCBtTWF4SXRlbXM7CisgICAgcHJpdmF0ZSBib29sZWFuIG1SZXNlcnZlT3ZlcmZsb3c7CisgICAgcHJpdmF0ZSBPdmVyZmxvd01lbnVCdXR0b24gbU92ZXJmbG93QnV0dG9uOworICAgIHByaXZhdGUgTWVudVBvcHVwSGVscGVyIG1PdmVyZmxvd1BvcHVwOworCisgICAgcHJpdmF0ZSBSdW5uYWJsZSBtU2hvd092ZXJmbG93ID0gbmV3IFJ1bm5hYmxlKCkgeworICAgICAgICBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgICAgICBzaG93T3ZlcmZsb3dNZW51KCk7CisgICAgICAgIH0KKyAgICB9OworICAgIAorICAgIHB1YmxpYyBBY3Rpb25NZW51VmlldyhDb250ZXh0IGNvbnRleHQpIHsKKyAgICAgICAgdGhpcyhjb250ZXh0LCBudWxsKTsKKyAgICB9CisgICAgCisgICAgcHVibGljIEFjdGlvbk1lbnVWaWV3KENvbnRleHQgY29udGV4dCwgQXR0cmlidXRlU2V0IGF0dHJzKSB7CisgICAgICAgIHN1cGVyKGNvbnRleHQsIGF0dHJzKTsKKyAgICAgICAgCisgICAgICAgIFR5cGVkQXJyYXkgYSA9IGNvbnRleHQub2J0YWluU3R5bGVkQXR0cmlidXRlcyhhdHRycywKKyAgICAgICAgICAgICAgICBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5UaGVtZSk7CisgICAgICAgIG1JdGVtUGFkZGluZyA9IGEuZ2V0RGltZW5zaW9uUGl4ZWxPZmZzZXQoCisgICAgICAgICAgICAgICAgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuVGhlbWVfYWN0aW9uQnV0dG9uUGFkZGluZyw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W1zKHJlc2VydmVPdmVyZmxvdyk7CisgICAgICAgIGZpbmFsIGludCBpdGVtQ291bnQgPSBpdGVtc1RvU2hvdy5zaXplKCk7CisgICAgICAgIAorICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGl0ZW1Db3VudDsgaSsrKSB7CisgICAgICAgICAgICBmaW5hbCBNZW51SXRlbUltcGwgaXRlbURhdGEgPSBpdGVtc1RvU2hvdy5nZXQoaSk7CisgICAgICAgICAgICBhZGRJdGVtVmlldygoQWN0aW9uTWVudUl0ZW1WaWV3KSBpdGVtRGF0YS5nZXRJdGVtVmlldyhNZW51QnVpbGRlci5UWVBFX0FDVElPTl9CVVRUT04sCisgICAgICAgICAgICAgICAgICAgIHRoaXMpKTsKKyAgICAgICAgfQorCisgICAgICAgIGlmIChyZXNlcnZlT3ZlcmZsb3cpIHsKKyAgICAgICAgICAgIGlmIChtTWVudS5nZXROb25BY3Rpb25JdGVtcyh0cnVlKS5zaXplKCkgPiAwKSB7CisgICAgICAgICAgICAgICAgT3ZlcmZsb3dNZW51QnV0dG9uIGJ1dHRvbiA9IG5ldyBPdmVyZmxvd01lbnVCdXR0b24obUNvbnRleHQpOworICAgICAgICAgICAgICAgIGFkZFZpZXcoYnV0dG9uKTsKKyAgICAgICAgICAgICAgICBtT3ZlcmZsb3dCdXR0b24gPSBidXR0b247CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIG1PdmVyZmxvd0J1dHRvbiA9IG51bGw7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgYm9vbGVhbiBzaG93T3ZlcmZsb3dNZW51KCkgeworICAgICAgICBpZiAobU92ZXJmbG93QnV0dG9uICE9IG51bGwpIHsKKyAgICAgICAgICAgIGZpbmFsIE1lbnVQb3B1cEhlbHBlciBwb3B1cCA9CisgICAgICAgICAgICAgICAgICAgIG5ldyBNZW51UG9wdXBIZWxwZXIoZ2V0Q29udGV4dCgpLCBtTWVudSwgbU92ZXJmbG93QnV0dG9uLCB0cnVlKTsKKyAgICAgICAgICAgIC8vIFBvc3QgdGhpcyBmb3IgbGF0ZXI7IHdlIG1pZ2h0IHN0aWxsIG5lZWQgYSBsYXlvdXQgZm9yIHRoZSBhbmNob3IgdG8gYmUgcmlnaHQuCisgICAgICAgICAgICBwb3N0KG5ldyBSdW5uYWJsZSgpIHsKKyAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgICAgICAgICAgICAgIHBvcHVwLnNob3coKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9KTsKKyAgICAgICAgICAgIG1PdmVyZmxvd1BvcHVwID0gcG9wdXA7CisgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gaXNPdmVyZmxvd01lbnVTaG93aW5nKCkgeworICAgICAgICBNZW51UG9wdXBIZWxwZXIgcG9wdXAgPSBtT3ZlcmZsb3dQb3B1cDsKKyAgICAgICAgaWYgKHBvcHVwICE9IG51bGwpIHsKKyAgICAgICAgICAgIHJldHVybiBwb3B1cC5pc1Nob3dpbmcoKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gaGlkZU92ZXJmbG93TWVudSgpIHsKKyAgICAgICAgTWVudVBvcHVwSGVscGVyIHBvcHVwID0gbU92ZXJmbG93UG9wdXA7CisgICAgICAgIGlmIChwb3B1cCAhPSBudWxsKSB7CisgICAgICAgICAgICBwb3B1cC5kaXNtaXNzKCk7CisgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIGFkZEl0ZW1WaWV3KEFjdGlvbk1lbnVJdGVtVmlldyB2aWV3KSB7CisgICAgICAgIHZpZXcuc2V0SXRlbUludm9rZXIodGhpcyk7CisgICAgICAgIGFkZFZpZXcodmlldyk7CisgICAgfQorCisgICAgcHJpdmF0ZSBjbGFzcyBPdmVyZmxvd01lbnVCdXR0b24gZXh0ZW5kcyBJbWFnZUJ1dHRvbiB7CisgICAgICAgIHB1YmxpYyBPdmVyZmxvd01lbnVCdXR0b24oQ29udGV4dCBjb250ZXh0KSB7CisgICAgICAgICAgICBzdXBlcihjb250ZXh0LCBudWxsLCBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmF0dHIuYWN0aW9uQnV0dG9uU3R5bGUpOworCisgICAgICAgICAgICBmaW5hbCBSZXNvdXJjZXMgcmVzID0gY29udGV4dC5nZXRSZXNvdXJjZXMoKTsKKyAgICAgICAgICAgIHNldENsaWNrYWJsZSh0cnVlKTsKKyAgICAgICAgICAgIHNldEZvY3VzYWJsZSh0cnVlKTsKKyAgICAgICAgICAgIHNldENvbnRlbnREZXNjcmlwdGlvbihyZXMuZ2V0U3RyaW5nKGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3RyaW5nLm1vcmVfaXRlbV9sYWJlbCkpOworICAgICAgICAgICAgc2V0SW1hZ2VEcmF3YWJsZShyZXMuZ2V0RHJhd2FibGUoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5kcmF3YWJsZS5pY19tZW51X21vcmUpKTsKKyAgICAgICAgICAgIHNldFZpc2liaWxpdHkoVklTSUJMRSk7CisgICAgICAgICAgICBzZXRFbmFibGVkKHRydWUpOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBib29sZWFuIHBlcmZvcm1DbGljaygpIHsKKyAgICAgICAgICAgIGlmIChzdXBlci5wZXJmb3JtQ2xpY2soKSkgeworICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvLyBDaGFuZ2UgdG8gb3ZlcmZsb3cgbW9kZQorICAgICAgICAgICAgbU1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gICByZXF1aXJlZEl0ZW1zKys7CisgICAgICAgICAgICB9IGVsc2UgaWYgKGl0ZW0ucmVxdWVzdHNBY3Rpb25CdXR0b24oKSkgeworICAgICAgICAgICAgICAgIHJlcXVlc3RlZEl0ZW1zKys7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGhhc092ZXJmbG93ID0gdHJ1ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIC8vIFJlc2VydmUgYSBzcG90IGZvciB0aGUgb3ZlcmZsb3cgaXRlbSBpZiBuZWVkZWQuCisgICAgICAgIGlmIChyZXNlcnZlQWN0aW9uT3ZlcmZsb3cgJiYKKyAgICAgICAgICAgICAgICAoaGFzT3ZlcmZsb3cgfHwgcmVxdWlyZWRJdGVtcyArIHJlcXVlc3RlZEl0ZW1zID4gbWF4QWN0aW9ucykpIHsKKyAgICAgICAgICAgIG1heEFjdGlvbnMtLTsKKyAgICAgICAgfQorICAgICAgICBtYXhBY3Rpb25zIC09IHJlcXVpcmVkSXRlbXM7CisKKyAgICAgICAgLy8gRmxhZyBhcyBtYW55IG1vcmUgcmVxdWVzdGVkIGl0ZW1zIGFzIHdpbGwgZml0LgorICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGl0ZW1zU2l6ZTsgaSsrKSB7CisgICAgICAgICAgICBNZW51SXRlbUltcGwgaXRlbSA9IHZpc2libGVJdGVtcy5nZXQoaSk7CisgICAgICAgICAgICBpZiAoaXRlbS5yZXF1ZXN0c0FjdGlvbkJ1dHRvbigpKSB7CisgICAgICAgICAgICAgICAgaXRlbS5zZXRJc0FjdGlvbkJ1dHRvbihtYXhBY3Rpb25zID4gMCk7CisgICAgICAgICAgICAgICAgbWF4QWN0aW9ucy0tOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgbUFjdGlvbkl0ZW1zLmNsZWFyKCk7CisgICAgICAgIG1Ob25BY3Rpb25JdGVtcy5jbGVhcigpOworICAgICAgICBm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gICAgICBNZW51Vmlldy5JdGVtVmlldyBpdGVtVmlldyA9IChNZW51Vmlldy5JdGVtVmlldykgY29udmVydFZpZXc7CisgICAgICAgICAgICAgICAgaXRlbVZpZXcuZ2V0SXRlbURhdGEoKS5zZXRJdGVtVmlldyhtTWVudVR5cGUsIG51bGwpOworCisgICAgICAgICAgICAgICAgTWVudUl0ZW1JbXBsIGl0ZW0gPSAoTWVudUl0ZW1JbXBsKSBnZXRJdGVtKHBvc2l0aW9uKTsKKyAgICAgICAgICAgICAgICBpdGVtVmlldy5pbml0aWFsaXplKGl0ZW0sIG1NZW51VHlwZSk7CisgICAgICAgICAgICAgICAgaXRlbS5zZXRJdGVtVmlldyhtTWVudVR5cGUsIGl0ZW1WaWV3KTsKKyAgICAgICAgICAgICAgICByZXR1cm4gY29udmVydFZpZXc7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIE1lbnVJdGVtSW1wbCBpdGVtID0gKE1lbnVJdGVtSW1wbCkgZ2V0SXRlbShwb3NpdGlvbik7CisgICAgICAgICAgICAgICAgaXRlbS5zZXRJdGVtVmlldyhtTWVudVR5cGUsIG51bGwpOworICAgICAgICAgICAgICAgIHJldHVybiBpdGVtLmdldEl0ZW1WaWV3KG1NZW51VHlwZSwgcGFyZW50KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIEFuIGFkYXB0ZXIgdGhhdCBhbGxvd3MgYW4ge0BsaW5rIEFkYXB0ZXJWaWV3fSB0byB1c2UgdGhpcyB7QGxpbmsgTWVudUJ1aWxkZXJ9IGFzIGEgZGF0YQorICAgICAqIHNvdXJjZSBmb3Igb3ZlcmZsb3cgbWVudSBpdGVtcyB0aGF0IGRvIG5vdCBmaXQgaW4gdGhlIGxpc3Qgb2YgYWN0aW9uIGl0ZW1zLgorICAgICAqLworICAgIHByaXZhdGUgY2xhc3MgT3ZlcmZsb3dNZW51QWRhcHRlciBleHRlbmRzIE1lbn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KKyAgICAgICAgICAgICAgICBtZW51VHlwZSA9PSBNZW51QnVpbGRlci5UWVBFX1BPUFVQIHx8CisgICAgICAgICAgICAgICAgbU1lbnUuZ2V0T3B0aW9uYWxJY29uc1Zpc2libGUoKTsKKyAgICB9CisgICAgCisgICAgcHVibGljIGJvb2xlYW4gaXNBY3Rpb25CdXR0b24oKSB7CisgICAgICAgIHJldHVybiAobUZsYWdzICYgSVNfQUNUSU9OKSA9PSBJU19BQ1RJT04gfHwgcmVxdWlyZXNBY3Rpb25CdXR0b24oKTsKKyAgICB9CisgICAgCisgICAgcHVibGljIGJvb2xlYW4gcmVxdWVzdHNBY3Rpb25CdXR0b24oKSB7CisgICAgICAgIHJldHVybiBtU2hvd0FzQWN0aW9uID09IFNIT1dfQVNfQUNUSU9OX0lGX1JPT007CisgICAgfQorICAgIAorICAgIHB1YmxpYyBib29sZWFuIHJlcXVpcmVzQWN0aW9uQnV0dG9uKCkgeworICAgICAgICByZXR1cm4gbVNob3dBc0FjdGlvbiA9PSBTSE9XX0FTX0FDVElPTl9BTFdBWVM7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc2V0SXNBY3Rpb25CdXR0b24oYm9vbGVhbiBpc0FjdGlvbkJ1dHRvbikgeworICAgICAgICBpZiAoaXNBY3Rpb25CdXR0b24pIHsKKyAgICAgICAgICAgIG1GbGFncyB8PSBJU19BQ1RJT047CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBtRmxhZ3MgJj0gfklTX0FDVElPTjsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHNldFNob3dBc0FjdGlvbihpbnQgYWN0aW9uRW51bSkgeworICAgICAgICBtU2hvd0FzQWN0aW9uID0gYWN0aW9uRW51bTsKKyAgICAgICAgbU1lbnUub25JdGVtQWN0aW9uUmVxdWVzdENoYW5nZWQodGhpcyk7CiAgICAgfQogfQpkaWZmIC0tZ2l0IGEvY29yZS9qYXZhL2NvbS9hbmRyb2lkL2ludGVyb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Gg7CisgICAgcHJpdmF0ZSBXZWFrUmVmZXJlbmNlPFZpZXc+IG1BbmNob3JWaWV3OworICAgIHByaXZhdGUgYm9vbGVhbiBtT3ZlcmZsb3dPbmx5OworCisgICAgcHJpdmF0ZSBQb3B1cFdpbmRvdy5PbkRpc21pc3NMaXN0ZW5lciBtRGlzbWlzc0xpc3RlbmVyID0gbmV3IFBvcHVwV2luZG93Lk9uRGlzbWlzc0xpc3RlbmVyKCkgeworICAgICAgICBwdWJsaWMgdm9pZCBvbkRpc21pc3MoKSB7CisgICAgICAgICAgICBtUG9wdXAgPSBudWxsOworICAgICAgICB9CisgICAgfTsKKworICAgIHB1YmxpYyBNZW51UG9wdXBIZWxwZXIoQ29udGV4dCBjb250ZXh0LCBNZW51QnVpbGRlciBtZW51KSB7CisgICAgICAgIHRoaXMoY29udGV4dCwgbWVudSwgbnVsbCwgZmFsc2UpOworICAgIH0KKworICAgIHB1YmxpYyBNZW51UG9wdXBIZWxwZXIoQ29udGV4dCBjb250ZXh0LCBNZW51QnVpbGRlciBtZW51LCBWaWV3IGFuY2hvclZpZXcpIHsKKyAgICAgICAgdGhpcyhjb250ZXh0LCBtZW51LCBhbmNob3JWaWV3LCBmYWxzZSk7CisgICAgfQorCisgICAgcHVibGljIE1lbnVQb3B1cEhlbHBlcihDb250ZXh0IGNvbnRleHQsIE1lbnVCdWlsZGVyIG1lbnUsCisgICAgICAgICAgICBWaWV3IGFuY2hvclZpZXcsIGJvb2xlYW4gb3ZlcmZsb3dPbmx5KSB7CisgICAgICAgIG1Db250ZXh0ID0gY29udGV4dDsKKyAgICAgICAgbU1lbnUgPSBtZW51OworICAgICAgICBtT3ZlcmZsb3dPbmx5ID0gb3ZlcmZsb3dPbmx5OworCisgICAgICAgIGZpbmFsIERpc3BsYXlNZXRyaWNzIG1ldHJpY3MgPSBjb250ZXh0LmdldFJlc291cmNlcygpLmdldERpc3BsYXlNZXRyaWNzKCk7CisgICAgICAgIG1Qb3B1cE1heFdpZHRoID0g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ICAgIE1lbnVJdGVtIGl0ZW0gPSBudWxsOworICAgICAgICBpZiAobU92ZXJmbG93T25seSkgeworICAgICAgICAgICAgaXRlbSA9IG1NZW51LmdldE92ZXJmbG93SXRlbShwb3NpdGlvbik7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBpdGVtID0gbU1lbnUuZ2V0SXRlbShwb3NpdGlvbik7CisgICAgICAgIH0KKyAgICAgICAgbU1lbnUucGVyZm9ybUl0ZW1BY3Rpb24oaXRlbSwgMCk7CisgICAgICAgIG1Qb3B1cC5kaXNtaXNzKCk7CisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gb25LZXkoVmlldyB2LCBpbnQga2V5Q29kZSwgS2V5RXZlbnQgZXZlbnQpIHsKKyAgICAgICAgaWYgKGV2ZW50LmdldEFjdGlvbigpID09IEtleUV2ZW50LkFDVElPTl9VUCAmJiBrZXlDb2RlID09IEtleUV2ZW50LktFWUNPREVfTUVOVSkgeworICAgICAgICAgICAgZGlzbWlzcygpOworICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIHByaXZhdGUgaW50IG1lYXN1cmVDb250ZW50V2lkdGgoTWVudUFkYXB0ZXIgYWRhcHRlcikgeworICAgICAgICAvLyBNZW51cyBkb24ndCB0ZW5kIHRvIGJlIGxvbmcsIHNvIHRoaXMgaXMgbW9yZSBzYW5lIHRoYW4gaXQgbG9va3MuCisgICAgICAgIGludCB3aWR0aCA9IDA7CisgICAgICAgIFZpZXcgaXRlbVZpZXcgPSBudWxsOworICAgICAgICBmaW5hbCBpbnQgd2lkdGhNZWFzdXJlU3BlYyA9CisgICAgICAgICAgICBNZWFzdXJlU3BlYy5tYWtlTWVhc3VyZVNwZWMoMCwgTWVhc3VyZVNwZWMuVU5TUEVDSUZJRUQpOworICAgICAgICBmaW5hbCBpbnQgaGVpZ2h0TWVhc3VyZVNwZWMgPQorICAgICAgICAgIC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IAorICAgIHB1YmxpYyBBY3Rpb25CYXJDb250ZXh0VmlldyhDb250ZXh0IGNvbnRleHQpIHsKKyAgICAgICAgdGhpcyhjb250ZXh0LCBudWxsLCAwKTsKKyAgICB9CisgICAgCisgICAgcHVibGljIEFjdGlvbkJhckNvbnRleHRWaWV3KENvbnRleHQgY29udGV4dCwgQXR0cmlidXRlU2V0IGF0dHJzKSB7CisgICAgICAgIHRoaXMoY29udGV4dCwgYXR0cnMsIDApOworICAgIH0KKyAgICAKKyAgICBwdWJsaWMgQWN0aW9uQmFyQ29udGV4dFZpZXcoQ29udGV4dCBjb250ZXh0LCBBdHRyaWJ1dGVTZXQgYXR0cnMsIGludCBkZWZTdHlsZSkgeworICAgICAgICBzdXBlcihjb250ZXh0LCBhdHRycywgZGVmU3R5bGUpOworICAgICAgICAKKyAgICAgICAgVHlwZWRBcnJheSBhID0gY29udGV4dC5vYnRhaW5TdHlsZWRBdHRyaWJ1dGVzKGF0dHJzLAorICAgICAgICAgICAgICAgIGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLlRoZW1lKTsKKyAgICAgICAgbUl0ZW1QYWRkaW5nID0gYS5nZXREaW1lbnNpb25QaXhlbE9mZnNldCgKKyAgICAgICAgICAgICAgICBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5UaGVtZV9hY3Rpb25CdXR0b25QYWRkaW5nLCAwKTsKKyAgICAgICAgc2V0QmFja2dyb3VuZERyYXdhYmxlKGEuZ2V0RHJhd2FibGUoCisgICAgICAgICAgICAgICAgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuVGhlbWVfYWN0aW9uTW9kZUJhY2tncm91bmQpKTsKKyAgICAgICAgbUNsb3NlRHJhd2FibGUgPSBhLmdldERyYXdhYmxlKAorICAgICAgICAgICAgICAgIGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLlRoZW1lX2FjdGlvbk1vZGVDbG9zZURy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KyAgICAgICAgICAgIGFkZFZpZXcodmlldyk7CisgICAgICAgIH0KKyAgICAgICAgcmVxdWVzdExheW91dCgpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHNldFRpdGxlKENoYXJTZXF1ZW5jZSB0aXRsZSkgeworICAgICAgICBtVGl0bGUgPSB0aXRsZTsKKyAgICAgICAgaW5pdFRpdGxlKCk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc2V0U3VidGl0bGUoQ2hhclNlcXVlbmNlIHN1YnRpdGxlKSB7CisgICAgICAgIG1TdWJ0aXRsZSA9IHN1YnRpdGxlOworICAgICAgICBpbml0VGl0bGUoKTsKKyAgICB9CisKKyAgICBwdWJsaWMgQ2hhclNlcXVlbmNlIGdldFRpdGxlKCkgeworICAgICAgICByZXR1cm4gbVRpdGxlOworICAgIH0KKworICAgIHB1YmxpYyBDaGFyU2VxdWVuY2UgZ2V0U3VidGl0bGUoKSB7CisgICAgICAgIHJldHVybiBtU3VidGl0bGU7CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIGluaXRUaXRsZSgpIHsKKyAgICAgICAgaWYgKG1UaXRsZUxheW91dCA9PSBudWxsKSB7CisgICAgICAgICAgICBMYXlvdXRJbmZsYXRlciBpbmZsYXRlciA9IExheW91dEluZmxhdGVyLmZyb20oZ2V0Q29udGV4dCgpKTsKKyAgICAgICAgICAgIG1UaXRsZUxheW91dCA9IChMaW5lYXJMYXlvdXQpIGluZmxhdGVyLmluZmxhdGUoUi5sYXlvdXQuYWN0aW9uX2Jhcl90aXRsZV9pdGVtLCBudWxsKTsKKyAgICAgICAgICAgIG1UaXRsZVZpZXcgPSAoVGV4dFZpZXcpIG1UaXRsZUxheW91dC5maW5kVmlld0J5SWQoUi5pZC5hY3Rpb25fYmFyX3RpdGxlKTsKKyAgICAgICAgICAgIG1TdWJ0aXRsZVZpZXcgPSAoVGV4dFZpZXcpIG1UaXRsZUxheW91dC5maW5kVmlld0J5SWQoUi5pZC5hY3Rpb25fYmFyX3N1YnRpdGxlKTsKKyAgICAgICAgICAgIGlmIChtVGl0bGUgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIG1UaXRsZVZpZXcuc2V0VGV4dChtVGl0bGUpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKG1TdWJ0aXRsZSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgbVN1YnRpdGxlVmlldy5zZXRUZXh0KG1TdWJ0aXRsZSk7CisgICAgICAgICAgICAgICAgbVN1YnRpdGxlVmlldy5zZXRWaXNpYmlsaXR5KFZJU0lCTEUpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYWRkVmlldyhtVGl0bGVMYXlvdXQpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgbVRpdGxlVmlldy5zZXRUZXh0KG1UaXRsZSk7CisgICAgICAgICAgICBtU3VidGl0bGVWaWV3LnNldFRleHQobVN1YnRpdGxlKTsKKyAgICAgICAgICAgIG1TdWJ0aXRsZVZpZXcuc2V0VmlzaWJpbGl0eShtU3VidGl0bGUgIT0gbnVsbCA/IFZJU0lCTEUgOiBHT05FKTsKKyAgICAgICAgICAgIGlmIChtVGl0bGVMYXlvdXQuZ2V0UGFyZW50KCkgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGFkZFZpZXcobVRpdGxlTGF5b3V0KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGluaXRGb3JNb2RlKGZpbmFsIEFjdGlvbk1vZGUgbW9kZSkgeworICAgICAgICBpZiAobUNsb3NlQnV0dG9uID09IG51bGwpIHsKKyAgICAgICAgICAgIG1DbG9zZUJ1dHRvbiA9IG5ldyBJbWFnZUJ1dHRvbihnZXRDb250ZXh0KCkpOworICAgICAgICAgICAgbUNsb3NlQnV0dG9uLnNldEltYWdlRHJhd2FibGUobUNsb3NlRHJhd2FibGUpOworICAgICAgICAgICAgbUNsb3NlQnV0dG9uLnNldEJhY2tncm91bmREcmF3YWJsZShudWxsKTsKKyAgICAgICAgfQorICAgICAgICBtQ2xvc2VCdXR0b24uc2V0T25DbGlja0xpc3RlbmVyKG5ldyBPbkNsaWNrTGlzdGVuZXIoKSB7CisgICAgICAgICAgICBwdWJsaWMgdm9pZCBvbkNsaWNrKFZpZXcgdikgeworICAgICAgICAgICAgICAgIG1vZGUuZmluaXNoKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0pOworICAgICAgICBhZGRWaWV3KG1DbG9zZUJ1dHRvbik7CisKKyAgICAgICAgZmluYWwgTWVudUJ1aWxkZXIgbWVudSA9IChNZW51QnVpbGRlcikgbW9kZS5nZXRNZW51KCk7CisgICAgICAgIG1NZW51VmlldyA9IChBY3Rpb25NZW51VmlldykgbWVudS5nZXRNZW51VmlldyhNZW51QnVpbGRlci5UWVBFX0FDVElPTl9CVVRUT04sIHRoaXMpOworICAgICAgICBtTWVudVZpZXcuc2V0T3ZlcmZsb3dSZXNlcnZlZCh0cnVlKTsKKyAgICAgICAgbU1lbnVWaWV3LnVwZGF0ZUNoaWxkcmVuKGZhbHNlKTsKKyAgICAgICAgYWRkVmlldyhtTWVudVZpZXcpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGNsb3NlTW9kZSgpIHsKKyAgICAgICAgcmVtb3ZlQWxsVmlld3MoKTsKKyAgICAgICAgbUN1c3RvbVZpZXcgPSBudWxsOworICAgICAgICBtTWVudVZpZXcgPSBudWxsOworICAgIH0KKworICAgIHB1YmxpYyBib29sZWFuIHNob3dPdmVyZmxvd01lbnUoKSB7CisgICAgICAgIGlmIChtTWVudVZpZXcgIT0gbnVsbCkgeworICAgICAgICAgICAgcmV0dXJuIG1NZW51Vmlldy5zaG93T3ZlcmZsb3dNZW51KCk7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIHB1YmxpYyBib29sZWFuIGhpZGVPdmVyZmxvd01lbnUoKSB7CisgICAgICAgIGlmIChtTWVudVZpZXc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AgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIAorICAgICAgICAgICAgYXZhaWxhYmxlV2lkdGggPSBtZWFzdXJlQ2hpbGRWaWV3KGNoaWxkLCBhdmFpbGFibGVXaWR0aCwgY2hpbGRTcGVjSGVpZ2h0LCBpdGVtTWFyZ2luKTsKKyAgICAgICAgfQorCisgICAgICAgIGlmIChtQ3VzdG9tVmlldyAhPSBudWxsKSB7CisgICAgICAgICAgICBMYXlvdXRQYXJhbXMgbHAgPSBtQ3VzdG9tVmlldy5nZXRMYXlvdXRQYXJhbXMoKTsKKyAgICAgICAgICAgIGZpbmFsIGludCBjdXN0b21XaWR0aE1vZGUgPSBscC53aWR0aCAhPSBMYXlvdXRQYXJhbXMuV1JBUF9DT05URU5UID8KKyAgICAgICAgICAgICAgICAgICAgTWVhc3VyZVNwZWMuRVhBQ1RMWSA6IE1lYXN1cmVTcGVjLkFUX01PU1Q7CisgICAgICAgICAgICBmaW5hbCBpbnQgY3VzdG9tV2lkdGggPSBscC53aWR0aCA+PSAwID8KKyAgICAgICAgICAgICAgICAgICAgTWF0aC5taW4obHAud2lkdGgsIGF2YWlsYWJsZVdpZHRoKSA6IGF2YWlsYWJsZVdpZHRoOworICAgICAgICAgICAgZmluYWwgaW50IGN1c3RvbUhlaWdodE1vZGUgPSBscC5oZWlnaHQgIT0gTGF5b3V0UGFyYW1zLldSQVBfQ09OVEVOVCA/CisgICAgICAgICAgICAgICAgICAgIE1lYXN1cmVTcGVjLkVYQUNUTFkgOiBNZWFzdXJlU3BlYy5BVF9NT1NUOworICAgICAgICAgICAgZmluYWwgaW50IGN1c3RvbUhlaWdodCA9IGxwLmhlaWdodCA+PSAwID8KKyAgICAgICAgICAgICAgICAgICAgTWF0aC5taW4obHAuaGVpZ2h0LCBoZWlnaHQpIDogaGVpZ2h0OworICAgICAgICAgICAgbUN1c3RvbVZpZXcubWVhc3VyZShNZWFzdXJlU3BlYy5tYWtlTWVhc3VyZVNwZWMoY3VzdG9tV2lkdGgsIGN1c3RvbVdpZHRoTW9kZSksCisgICAgICAgICAgICAgICAgICAgIE1lYXN1cmVTcGVjLm1ha2VNZWFzdXJlU3BlYyhjdXN0b21IZWlnaHQsIGN1c3RvbUhlaWdodE1vZGUpKTsKKyAgICAgICAgfQorCisgICAgICAgIGlmIChtQ29udGVudEhlaWdodCA8PSAwKSB7CisgICAgICAgICAgICBpbnQgbWVhc3VyZWRIZWlnaHQgPSAwOworICAgICAgICAgICAgZmluYWwgaW50IGNvdW50ID0gZ2V0Q2hpbGRDb3VudCgpOworICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBjb3VudDsgaSsrKSB7CisgICAgICAgICAgICAgICAgVmlldyB2ID0gZ2V0Q2hpbGRBdChpKTsKKyAgICAgICAgICAgICAgICBpbnQgcGFkZGVkVmlld0hlaWdodCA9IHYuZ2V0TWVhc3VyZWRIZWlnaHQoKSArIHZlcnRpY2FsUGFkZGluZzsKKyAgICAgICAgICAgICAgICBpZiAocGFkZGVkVmlld0hlaWdodCA+IG1lYXN1cmVkSGVpZ2h0KSB7CisgICAgICAgICAgICAgICAgICAgIG1lYXN1cmVkSGVpZ2h0ID0gcGFkZGVkVmlld0hlaWdodDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBzZXRNZWFzdXJlZERpbWVuc2lvbihjb250ZW50V2lkdGgsIG1lYXN1cmVkSGVpZ2h0KTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIHNldE1lYXN1cmVkRGltZW5zaW9uKGNvbnRlbnRXaWR0aCwgbWF4SGVpZ2h0KTsKKyAgICAgICAgfQorICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHByb3RlY3RlZCB2b2lkIG9uTGF5b3V0KGJvb2xlYW4gY2hhbmdlZCwgaW50IGwsIGludCB0LCBpbnQgciwgaW50IGIpIHsKKyAgICAgICAgaW50IHggPSBnZXRQYWRkaW5nTGVmdCgpOworICAgICAgICBmaW5hbCBpbnQgeSA9IGdldFBhZGRpbmdUb3AoKTsKKyAgICAgICAgZmluYWwgaW50IGNvbnRlbnRIZWlnaHQgPSBiIC0gdCAtIGdldFBhZGRpbmdUb3AoKSAtIGdldFBhZGRpbmdCb3R0b20oKTsKKyAgICAgICAgZmluYWwgaW50IGl0ZW1NYXJnaW4gPSBtSXRlbVBhZGRpbmc7CisgICAgICAgIAorICAgICAgICBpZiAobUNsb3NlQnV0dG9uICE9IG51bGwgJiYgbUNsb3NlQnV0dG9uLmdldFZpc2liaWxpdHkoKSAhPSBHT05FKSB7CisgICAgICAgICAgICB4ICs9IHBvc2l0aW9uQ2hpbGQobUNsb3NlQnV0dG9uLCB4LCB5LCBjb250ZW50SGVpZ2h0KTsKKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgaWYgKG1UaXRsZUxheW91dCAhPSBudWxsICYmIG1DdXN0b21WaWV3ID09IG51bGwpIHsKKyAgICAgICAgICAgIHggKz0gcG9zaXRpb25DaGlsZChtVGl0bGVMYXlvdXQsIHgsIHksIGNvbnRlbnRIZWlnaHQpICsgaXRlbU1hcmdpbjsKKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgaWYgKG1DdXN0b21WaWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgIHggKz0gcG9zaXRpb25DaGlsZChtQ3VzdG9tVmlldywgeCwgeSwgY29udGVudEhlaWdodCkgKyBpdGVtTWFyZ2luOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICB4ID0gciAtIGwgLSBnZXRQYWRkaW5nUmlnaHQoKTsKKworICAgICAgICBpZiAobU1lbnVWaWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgIHggLT0gcG9zaXRpb25DaGlsZEludmVyc2UobU1lbnVWaWV3LCB4ICsgbUFjdGlvblNwYWNpbmcsIHksIGNvbnRlbnRIZWlnaHQpCisgICAgICAgICAgICAgICAgICAgIC0gbUFjdGlvblNwYWNpbmc7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIGludCBtZWFzdXJlQ2hpbGRWaWV3KFZpZXcgY2hpbGQsIGludCBhdmFpbGFibGVXaWR0aCwgaW50IGNoaWxkU3BlY0hlaWdodCwgaW50IHNwYWNpbmcpIHsKKyAgICAgICAgY2hpbGQubWVhc3VyZShNZWFzdXJlU3BlYy5tYWtlTWVhc3VyZVNwZWMoYXZhaWxhYmxlV2lkdGgsIE1lYXN1cmVTcGVjLkFUX01PU1QpLAorICAgICAgICAgICAgICAgIGNoaWxkU3BlY0hlaWdodCk7CisKKyAgICAgICAgYXZhaWxhYmxlV2lkdGggLT0gY2hpbGQuZ2V0TWVhc3VyZWRXaWR0aCgpOworICAgICAgICBhdmFpbGFibGVXaWR0aCAtPSBzcGFjaW5nOworCisgICAgICAgIHJldHVybiBhdmFpbGFibGVXaWR0aDsKKyAgICB9CisgICAgCisgICAgcHJpdmF0ZSBpbnQgcG9zaXRpb25DaGlsZChWaWV3IGNoaWxkLCBpbnQgeCwgaW50IHksIGludCBjb250ZW50SGVpZ2h0KSB7CisgICAgICAgIGludCBjaGlsZFdpZHRoID0gY2hpbGQuZ2V0TWVhc3VyZWRXaWR0aCgpOworICAgICAgICBpbnQgY2hpbGRIZWlnaHQgPSBjaGlsZC5nZXRNZWFzdXJlZEhlaWdodCgpOworICAgICAgICBpbnQgY2hpbGRUb3AgPSB5ICsgKGNvbnRlbnRIZWlnaHQgLSBjaGlsZEhlaWdodCkgLyAyOworCisgICAgICAgIGNoaWxkLmxheW91dCh4LCBjaGlsZFRvcCwgeCArIGNoaWxkV2lkdGgsIGNoaWxkVG9wICsgY2hpbGRIZWlnaHQpOworCisgICAgICAgIHJldHVybiBjaGlsZFdpZHRoOworICAgIH0KKyAgICAKKyAgICBwcml2YXRlIGludCBwb3NpdGlvbkNoaWxkSW52ZXJzZShWaWV3IGNoaWxkLCBpbnQgeCwgaW50IHksIGludCBjb250ZW50SGVpZ2h0KSB7CisgICAgICAgIG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IG5ldyBBZGFwdGVyVmlldy5Pbkl0ZW1TZWxlY3RlZExpc3RlbmVyKCkgeworICAgICAgICBwdWJsaWMgdm9pZCBvbkl0ZW1TZWxlY3RlZChBZGFwdGVyVmlldyBwYXJlbnQsIFZpZXcgdmlldywgaW50IHBvc2l0aW9uLCBsb25nIGlkKSB7CisgICAgICAgICAgICBpZiAobUNhbGxiYWNrICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBtQ2FsbGJhY2sub25OYXZpZ2F0aW9uSXRlbVNlbGVjdGVkKHBvc2l0aW9uLCBpZCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcHVibGljIHZvaWQgb25Ob3RoaW5nU2VsZWN0ZWQoQWRhcHRlclZpZXcgcGFyZW50KSB7CisgICAgICAgICAgICAvLyBEbyBub3RoaW5nCisgICAgICAgIH0KKyAgICB9OworCisgICAgcHJpdmF0ZSBPbkNsaWNrTGlzdGVuZXIgbUhvbWVDbGlja0xpc3RlbmVyID0gbnVsbDsKKworICAgIHB1YmxpYyBBY3Rpb25CYXJWaWV3KENvbnRleHQgY29udGV4dCwgQXR0cmlidXRlU2V0IGF0dHJzKSB7CisgICAgICAgIHN1cGVyKGNvbnRleHQsIGF0dHJzKTsKKworICAgICAgICBmaW5hbCBEaXNwbGF5TWV0cmljcyBtZXRyaWNzID0gY29udGV4dC5nZXRSZXNvdXJjZXMoKS5nZXREaXNwbGF5TWV0cmljcygpOworCisgICAgICAgIFR5cGVkQXJyYXkgYSA9IGNvbnRleHQub2J0YWluU3R5bGVkQXR0cmlidXRlcyhhdHRycywgUi5zdHlsZWFibGUuQWN0aW9uQmFyKTsKKworICAgICAgICBmaW5hbCBpbnQgY29sb3JGaWx0ZXIgPSBhLmdldENvbG9yKFIuc3R5bGVhYmxlLkFjdGlvbkJhcl9jb2xvckZpbHRlciwgMCk7CisKKyAgICAgICAgaWYgKGNvbG9yRmlsdGVyICE9IDApIHsKKyAgICAgICAgICAgIGZpbmFsIERyY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9uQmFyX2ljb24pOworICAgICAgICBpZiAobUljb24gPT0gbnVsbCkgeworICAgICAgICAgICAgbUljb24gPSBpbmZvLmxvYWRJY29uKHBtKTsKKyAgICAgICAgfQorICAgICAgICAKKyAgICAgICAgRHJhd2FibGUgYmFja2dyb3VuZCA9IGEuZ2V0RHJhd2FibGUoUi5zdHlsZWFibGUuQWN0aW9uQmFyX2JhY2tncm91bmQpOworICAgICAgICBpZiAoYmFja2dyb3VuZCAhPSBudWxsKSB7CisgICAgICAgICAgICBzZXRCYWNrZ3JvdW5kRHJhd2FibGUoYmFja2dyb3VuZCk7CisgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIG1UaXRsZVN0eWxlUmVzID0gYS5nZXRSZXNvdXJjZUlkKFIuc3R5bGVhYmxlLkFjdGlvbkJhcl90aXRsZVRleHRTdHlsZSwgMCk7CisgICAgICAgIG1TdWJ0aXRsZVN0eWxlUmVzID0gYS5nZXRSZXNvdXJjZUlkKFIuc3R5bGVhYmxlLkFjdGlvbkJhcl9zdWJ0aXRsZVRleHRTdHlsZSwgMCk7CisKKyAgICAgICAgZmluYWwgaW50IGN1c3RvbU5hdklkID0gYS5nZXRSZXNvdXJjZUlkKFIuc3R5bGVhYmxlLkFjdGlvbkJhcl9jdXN0b21OYXZpZ2F0aW9uTGF5b3V0LCAwKTsKKyAgICAgICAgaWYgKGN1c3RvbU5hdklkICE9IDApIHsKKyAgICAgICAgICAgIExheW91dEluZmxhdGVyIGluZmxhdGVyID0gTGF5b3V0SW5mbGF0ZXIuZnJvbShjb250ZXh0KTsKKyAgICAgICAgICAgIG1DdXN0b21OYXZWaWV3ID0gKFZpZXcpIGluZmxhdGVyLmluZmxhdGUoY3VzdG9tTmF2SWQsIG51bGwpOworICAgICAgICAgICAgbU5hdmlnYXRpb25Nb2RlID0gQWN0aW9uQmFyLk5BVklHQVRJT05fTU9ERV9DVVNUT007CisgICAgICAgIH0KKworICAgICAgICBtQ29udGVudEhlaWdodCA9IGEuZ2V0TGF5b3V0RGltZW5zaW9uKFIuc3R5bGVhYmxlLkFjdGlvbkJhcl9oZWlnaHQsIDApOworCisgICAgICAgIGEucmVjeWNsZSgpOworCisgICAgICAgIC8vIFRPRE86IFNldCB0aGlzIGluIHRoZSB0aGVtZQorICAgICAgICBtU3BhY2luZyA9IChpbnQpIChDT05URU5UX1NQQUNJTkdfRElQICogbWV0cmljcy5kZW5zaXR5ICsgMC41Zik7CisgICAgICAgIG1BY3Rpb25TcGFjaW5nID0gKGludCkgKENPTlRFTlRfQUNUSU9OX1NQQUNJTkdfRElQICogbWV0cmljcy5kZW5zaXR5ICsgMC41Zik7CisgICAgICAgIAorICAgICAgICBpZiAobUxvZ28gIT0gbnVsbCB8fCBtSWNvbiAhPSBudWxsIHx8IG1UaXRsZSAhPSBudWxsKSB7CisgICAgICAgICAgICBtTG9nb05hdkl0ZW0gPSBuZXcgQWN0aW9uTWVudUl0ZW0oY29udGV4dCwgMCwgYW5kcm9pZC5SLmlkLmhvbWUsIDAsIDAsIG1UaXRsZSk7CisgICAgICAgICAgICBtSG9tZUNsaWNrTGlzdGVuZXIgPSBuZXcgT25DbGlja0xpc3RlbmVyKCkgeworICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIG9uQ2xpY2soVmlldyB2KSB7CisgICAgICAgICAgICAgICAgICAgIENvbnRleHQgY29udGV4dCA9IGdldENvbnRleHQoKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGNvbnRleHQgaW5zdGFuY2VvZiBBY3Rpdml0eSkgeworICAgICAgICAgICAgICAgICAgICAgICAgQWN0aXZpdHkgYWN0aXZpdHkgPSAoQWN0aXZpdHkpIGNvbnRleHQ7CisgICAgICAgICAgICAgICAgICAgICAgICBhY3Rpdml0eS5vbk9wdGlvbnNJdGVtU2VsZWN0ZWQobUxvZ29OYXZJdGVtKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH07CisgICAgICAgIH0KKyAgICB9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1BVENIX1BBUkVOVCk7CisgICAgICAgIG1lbnVWaWV3LnNldExheW91dFBhcmFtcyhsYXlvdXRQYXJhbXMpOworICAgICAgICBhZGRWaWV3KG1lbnVWaWV3KTsKKyAgICAgICAgbU1lbnVWaWV3ID0gbWVudVZpZXc7CisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gc2hvd092ZXJmbG93TWVudSgpIHsKKyAgICAgICAgaWYgKG1NZW51VmlldyAhPSBudWxsKSB7CisgICAgICAgICAgICByZXR1cm4gbU1lbnVWaWV3LnNob3dPdmVyZmxvd01lbnUoKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgcG9zdFNob3dPdmVyZmxvd01lbnUoKSB7CisgICAgICAgIHBvc3QobmV3IFJ1bm5hYmxlKCkgeworICAgICAgICAgICAgcHVibGljIHZvaWQgcnVuKCkgeworICAgICAgICAgICAgICAgIHNob3dPdmVyZmxvd01lbnUoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSk7CisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gaGlkZU92ZXJmbG93TWVudSgpIHsKKyAgICAgICAgaWYgKG1NZW51VmlldyAhPSBudWxsKSB7CisgICAgICAgICAgICByZXR1cm4gbU1lbnVWaWV3LmhpZGVPdmVyZmxvd01lbnUoKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gaXNPdmVyZmxvd01lbnVTaG93aW5nKCkgeworICAgICAgICBpZiAobU1lbnVWaWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgIHJldHVybiBtTWVudVZpZXcuaXNPdmVyZmxvd01lbnVTaG93aW5nKCk7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIHB1YmxpYyBib29sZWFuIGlzT3ZlcmZsb3dSZXNlcnZlZCgpIHsKKyAgICAgICAgcmV0dXJuIG1NZW51VmlldyAhPSBudWxsICYmIG1NZW51Vmlldy5pc092ZXJmbG93UmVzZXJ2ZWQoKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBzZXRDdXN0b21OYXZpZ2F0aW9uVmlldyhWaWV3IHZpZXcpIHsKKyAgICAgICAgbUN1c3RvbU5hdlZpZXcgPSB2aWV3OworICAgICAgICBpZiAodmlldyAhPSBudWxsKSB7CisgICAgICAgICAgICBzZXROYXZpZ2F0aW9uTW9kZShBY3Rpb25CYXIuTkFWSUdBVElPTl9NT0RFX0NVU1RPTSk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgQ2hhclNlcXVlbmNlIGdldFRpdGxlKCkgeworICAgICAgICByZXR1cm4gbVRpdGxlOworICAgIH0KKworICAgIC8qKgorICAgICAqIFNldCB0aGUgYWN0aW9uIGJhciB0aXRsZS4gVGhpcyB3aWxsIGFsd2F5cyByZXBsYWNlIG9yIG92ZXJyaWRlIHdpbmRvdyB0aXRsZXMuCisgICAgICogQHBhcmFtIHRpdGxlIFRpdGxlIHRvIHNldAorICAgICAqCisgICAgICogQHNlZSAjc2V0V2luZG93VGl0bGUoQ2hhclNlcXVlbmNlKQorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNldFRpdGxlKENoYXJTZXF1ZW5jZSB0aXRsZSkgeworICAgICAgICBtVXNlclRpdGxlID0gdHJ1ZTsKKyAgICAgICAgc2V0VGl0bGVJbXBsKHRpdGxlKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBTZXQgdGhlIHdpbmRvdyB0aXRsZS4gQSB3aW5kb3cgdGl0bGUgd2lsbCBhbHdheXMgYmUgcmVwbGFjZWQgb3Igb3ZlcnJpZGRlbiBieSBhIHVzZXIgdGl0bGUuCisgICAgICogQHBhcmFtIHRpdGxlIFRpdGxlIHRvIHNldAorICAgICAqCisgICAgICogQHNlZSAjc2V0VGl0bGUoQ2hhclNlcXVlbmNlKQorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNldFdpbmRvd1RpdGxlKENoYXJTZXF1ZW5jZSB0aXRsZSkgeworICAgICAgICBpZiAoIW1Vc2VyVGl0bGUpIHsKKyAgICAgICAgICAgIHNldFRpdGxlSW1wbCh0aXRsZSk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgc2V0VGl0bGVJbXBsKENoYXJTZXF1ZW5jZSB0aXRsZSkgeworICAgICAgICBtVGl0bGUgPSB0aXRsZTsKKyAgICAgICAgaWYgKG1UaXRsZVZpZXcgIT0gbnVsbCkgeworICAgICAgICAgICAgbVRpdGxlVmlldy5zZXRUZXh0KHRpdGxlKTsKKyAgICAgICAgfQorICAgICAgICBpZiAobUxvZ29OYXZJdGVtICE9IG51bGwpIHsKKyAgICAgICAgICAgIG1Mb2dvTmF2SXRlbS5zZXRUaXRsZSh0aXRsZSk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgQ2hhclNlcXVlbmNlIGdldFN1YnRpdGxlKCkgeworICAgICAgICByZXR1cm4gbVN1YnRpdGxlOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHNldFN1YnRpdGxlKENoYXJTZXF1ZW5jZSBzdWJ0aXRsZSkgeworICAgICAgICBtU3VidGl0bGUgPSBzdWJ0aXRsZTsKKyAgICAgICAgaWYgKG1TdWJ0aXRsZVZpZXcgIT0gbnVsbCkgeworICAgICAgICAgICAgbVN1YnRpdGxlVmlldy5zZXRUZXh0KHN1YnRpdGxlKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHNldERpc3BsYXlPcHRpb25zKGludCBvcHRpb25zKSB7CisgICAgICAgIGZpbmFsIGludCBmbGFnc0NoYW5nZWQgPSBvcHRpb25zIF4gbURpc3BsYXlPcHRpb25zOworICAgICAgICBtRGlzcGxheU9wdGlvbnMgPSBvcHRpb25zOworICAgICAgICBpZiAoKGZsYWdzQ2hhbmdlZCAmIERJU1BMQVlfUkVMQVlPVVRfTUFTSykgIT0gMCkgeworICAgICAgICAgICAgZmluYWwgaW50IHZpcyA9IChvcHRpb25zICYgQWN0aW9uQmFyLkRJU1BMQVlfSElERV9IT01FKSAhPSAwID8gR09ORSA6IFZJU0lCTEU7CisgICAgICAgICAgICBpZiAobUxvZ29WaWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBtTG9nb1ZpZXcuc2V0VmlzaWJpbGl0eSh2aXMpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKG1JY29uVmlldyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgbUljb25WaWV3LnNldFZpc2liaWxpdHkodmlzKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIAorICAgICAgICAgICAgcmVxdWVzdExheW91dCgpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgaW52YWxpZGF0ZSgpOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc2V0TmF2aWdhdGlvbk1vZGUoaW50IG1vZGUpIHsKKyAgICAgICAgZmluYWwgaW50IG9sZE1vZGUgPSBtTmF2aWdhdGlvbk1vZGU7CisgICAgICAgIGlmIChtb2RlICE9IG9sZE1vZGUpIHsKKyAgICAgICAgICAgIHN3aXRjaCAob2xkTW9kZSkgeworICAgICAgICAgICAgY2FzZSBBY3Rpb25CYXIuTkFWSUdBVElPTl9NT0RFX1NUQU5EQVJEOgorICAgICAgICAgICAgICAgIGlmIChtVGl0bGVMYXlvdXQgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICByZW1vdmVWaWV3KG1UaXRsZUxheW91dCk7CisgICAgICAgICAgICAgICAgICAgIG1UaXRsZUxheW91dCA9IG51bGw7CisgICAgICAgICAgICAgICAgICAgIG1UaXRsZVZpZXcgPSBudWxsOworICAgICAgICAgICAgICAgICAgICBtU3VidGl0bGVWaWV3ID0gbnVsbDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIEFjdGlvbkJhci5OQVZJR0FUSU9OX01PREVfRFJPUERPV05fTElTVDoKKyAgICAgICAgICAgICAgICBpZiAobVNwaW5uZXIgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICByZW1vdmVWaWV3KG1TcGlubmVyKTsKKyAgICAgICAgICAgICAgICAgICAgbVNwaW5uZXIgPSBudWxsOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgQWN0aW9uQmFyLk5BVklHQVRJT05fTU9ERV9DVVNUT006CisgICAgICAgICAgICAgICAgaWYgKG1DdXN0b21OYXZWaWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgcmVtb3ZlVmlldyhtQ3VzdG9tTmF2Vmlldyk7CisgICAgICAgICAgICAgICAgICAgIG1DdXN0b21OYXZWaWV3ID0gbnVsbDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIEFjdGlvbkJhci5OQVZJR0FUSU9OX01PREVfVEFCUzoKKyAgICAgICAgICAgICAgICBpZiAobVRhYkxheW91dCAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIHJlbW92ZVZpZXcobVRhYkxheW91dCk7CisgICAgICAgICAgICAgICAgICAgIG1UYWJMYXlvdXQgPSBudWxsOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIAorICAgICAgICAgICAgc3dpdGNoIChtb2RlKSB7CisgICAgICAgICAgICBjYXNlIEFjdGlvbkJhci5OQVZJR0FUSU9OX01PREVfU1RBTkRBUkQ6CisgICAgICAgICAgICAgICAgaW5pdFRpdGxlKCk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIEFjdGlvbkJhci5OQVZJR0FUSU9OX01PREVfRFJPUERPV05fTElTVDoKKyAgICAgICAgICAgICAgICBtU3Bpbm5lciA9IG5ldyBTcGlubmVyKG1Db250ZXh0LCBudWxsLAorICAgICAgICAgICAgICAgICAgICAgICAgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5hdHRyLmRyb3BEb3duU3Bpbm5lclN0eWxlKTsKKyAgICAgICAgICAgICAgICBtU3Bpbm5lci5zZXRPbkl0ZW1TZWxlY3RlZExpc3RlbmVyKG1OYXZJdGVtU2VsZWN0ZWRMaXN0ZW5lcik7CisgICAgICAgICAgICAgICAgYWRkVmlldyhtU3Bpbm5lcik7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIEFjdGlvbkJhci5OQVZJR0FUSU9OX01PREVfQ1VTVE9NOgorICAgICAgICAgICAgICAgIGFkZFZpZXcobUN1c3RvbU5hdlZpZXcpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBBY3Rpb25CYXIuTkFWSUdBVElPTl9NT0RFX1RBQlM6CisgICAgICAgICAgICAgICAgbVRhYkxheW91dCA9IG5ldyBMaW5lYXJMYXlvdXQoZ2V0Q29udGV4dCgpKTsKKyAgICAgICAgICAgICAgICBhZGRWaWV3KG1UYWJMYXlvdXQpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbU5hdmlnYXRpb25Nb2RlID0gbW9kZTsKKyAgICAgICAgICAgIHJlcXVlc3RMYXlvdXQoKTsKKyAgICAgICAgfQorICAgIH0KKyAgICAKKyAgICBwdWJsaWMgdm9pZCBzZXREcm9wZG93bkFkYXB0ZXIoU3Bpbm5lckFkYXB0ZXIgYWRhcHRlcikgeworICAgICAgICBtU3Bpbm5lci5zZXRBZGFwdGVyKGFkYXB0ZXIpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHNldERyb3Bkb3duU2VsZWN0ZWRQb3NpdGlvbihpbnQgcG9zaXRpb24pIHsKKyAgICAgICAgbVNwaW5uZXIuc2V0U2VsZWN0aW9uKHBvc2l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GUKKyAgICBwcm90ZWN0ZWQgdm9pZCBvbkZpbmlzaEluZmxhdGUoKSB7CisgICAgICAgIHN1cGVyLm9uRmluaXNoSW5mbGF0ZSgpOworCisgICAgICAgIGlmICgobURpc3BsYXlPcHRpb25zICYgQWN0aW9uQmFyLkRJU1BMQVlfSElERV9IT01FKSA9PSAwKSB7CisgICAgICAgICAgICBpZiAobUxvZ28gIT0gbnVsbCAmJiAobURpc3BsYXlPcHRpb25zICYgQWN0aW9uQmFyLkRJU1BMQVlfVVNFX0xPR08pICE9IDApIHsKKyAgICAgICAgICAgICAgICBtTG9nb1ZpZXcgPSBuZXcgSW1hZ2VWaWV3KGdldENvbnRleHQoKSk7CisgICAgICAgICAgICAgICAgbUxvZ29WaWV3LnNldEFkanVzdFZpZXdCb3VuZHModHJ1ZSk7CisgICAgICAgICAgICAgICAgbUxvZ29WaWV3LnNldExheW91dFBhcmFtcyhuZXcgTGF5b3V0UGFyYW1zKExheW91dFBhcmFtcy5XUkFQX0NPTlRFTlQsCisgICAgICAgICAgICAgICAgICAgICAgICBMYXlvdXRQYXJhbXMuTUFUQ0hfUEFSRU5UKSk7CisgICAgICAgICAgICAgICAgbUxvZ29WaWV3LnNldEltYWdlRHJhd2FibGUobUxvZ28pOworICAgICAgICAgICAgICAgIG1Mb2dvVmlldy5zZXRDbGlja2FibGUodHJ1ZSk7CisgICAgICAgICAgICAgICAgbUxvZ29WaWV3LnNldEZvY3VzYWJsZSh0cnVlKTsKKyAgICAgICAgICAgICAgICBtTG9nb1ZpZXcuc2V0T25DbGlja0xpc3RlbmVyKG1Ib21lQ2xpY2tMaXN0ZW5lcik7CisgICAgICAgICAgICAgICAgYWRkVmlldyhtTG9nb1ZpZXcpOworICAgICAgICAgICAgfSBlbHNlIGlmIChtSWNvbiAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgbUljb25WaWV3ID0gbmV3IEltYWdlVmlldyhnZXRDb250ZXh0KCkpOworICAgICAgICAgICAgICAgIG1JY29uVmlldy5zZXRBZGp1c3RWaWV3Qm91bmRzKHRydWUpOworICAgICAgICAgICAgICAgIG1JY29uVmlldy5zZXRMYXlvdXRQYXJhbXMobmV3IExheW91dFBhcmFtcyhMYXlvdXRQYXJhbXMuV1JBUF9DT05URU5ULAorICAgICAgICAgICAgICAgICAgICAgICAgTGF5b3V0UGFyYW1zLk1BVENIX1BBUkVOVCkpOworICAgICAgICAgICAgICAgIG1JY29uVmlldy5zZXRJbWFnZURyYXdhYmxlKG1JY29uKTsKKyAgICAgICAgICAgICAgICBtSWNvblZpZXcuc2V0Q2xpY2thYmxlKHRydWUpOworICAgICAgICAgICAgICAgIG1JY29uVmlldy5zZXRGb2N1c2FibGUodHJ1ZSk7CisgICAgICAgICAgICAgICAgbUljb25WaWV3LnNldE9uQ2xpY2tMaXN0ZW5lcihtSG9tZUNsaWNrTGlzdGVuZXIpOworICAgICAgICAgICAgICAgIGFkZFZpZXcobUljb25WaWV3KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHN3aXRjaCAobU5hdmlnYXRpb25Nb2RlKSB7CisgICAgICAgIGNhc2UgQWN0aW9uQmFyLk5BVklHQVRJT05fTU9ERV9TVEFOREFSRDoKKyAgICAgICAgICAgIGlmIChtTG9nb1ZpZXcgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGluaXRUaXRsZSgpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAKKyAgICAgICAgY2FzZSBBY3Rpb25CYXIuTkFWSUdBVElPTl9NT0RFX0RST1BET1dOX0xJU1Q6CisgICAgICAgICAgICB0aHJvdyBuZXcgVW5zdXBwb3J0ZWRPcGVyYXRpb25FeGNlcHRpb24oCisgICAgICAgICAgICAgICAgICAgICJJbmZsYXRpbmcgZHJvcGRvd24gbGlzdCBuYXZpZ2F0aW9uIGlzbid0IHN1cHBvcnRlZCB5ZXQhIik7CisgICAgICAgICAgICAKKyAgICAgICAgY2FzZSBBY3Rpb25CYXIuTkFWSUdBVElPTl9NT0RFX1RBQlM6CisgICAgICAgICAgICB0aHJvdyBuZXcgVW5zdXBwb3J0ZWRPcGVyYXRpb25FeGNlcHRpb24oCisgICAgICAgICAgICAgICAgICAgICJJbmZsYXRpbmcgdGFiIG5hdmlnYXRpb24gaXNuJ3Qgc3VwcG9ydGVkIHlldCEiKTsKKyAgICAgICAgICAgIAorICAgICAgICBjYXNlIEFjdGlvbkJhci5OQVZJR0FUSU9OX01PREVfQ1VTVE9NOgorICAgICAgICAgICAgaWYgKG1DdXN0b21OYXZWaWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBhZGRWaWV3KG1DdXN0b21OYXZWaWV3KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgfQorICAgIAorICAgIHByaXZhdGUgdm9pZCBpbml0VGl0bGUoKSB7CisgICAgICAgIExheW91dEluZmxhdGVyIGluZmxhdGVyID0gTGF5b3V0SW5mbGF0ZXIuZnJvbShnZXRDb250ZXh0KCkpOworICAgICAgICBtVGl0bGVMYXlvdXQgPSAoTGluZWFyTGF5b3V0KSBpbmZsYXRlci5pbmZsYXRlKFIubGF5b3V0LmFjdGlvbl9iYXJfdGl0bGVfaXRlbSwgbnVsbCk7CisgICAgICAgIG1UaXRsZVZpZXcgPSAoVGV4dFZpZXcpIG1UaXRsZUxheW91dC5maW5kVmlld0J5SWQoUi5pZC5hY3Rpb25fYmFyX3RpdGxlKTsKKyAgICAgICAgbVN1YnRpdGxlVmlldyA9IChUZXh0VmlldykgbVRpdGxlTGF5b3V0LmZpbmRWaWV3QnlJZChSLmlkLmFjdGlvbl9iYXJfc3VidGl0bGUpOworCisgICAgICAgIGlmIChtVGl0bGVTdHlsZVJlcyAhPSAwKSB7CisgICAgICAgICAgICBtVGl0bGVWaWV3LnNldFRleHRBcHBlYXJhbmNlKG1Db250ZXh0LCBtVGl0bGVTdHlsZVJlcyk7CisgICAgICAgIH0KKyAgICAgICAgaWYgKG1UaXRsZSAhPSBudWxsKSB7CisgICAgICAgICAgICBtVGl0bGVWaWV3LnNldFRleHQobVRpdGxlKTsKKyAgICAgICAgfQorCisgICAgICAgIGlmIChtU3VidGl0bGVTdHlsZVJlcyAhPSAwKSB7CisgICAgICAgICAgICBtU3VidGl0bGVWaWV3LnNldFRleHRBcHBlYXJhbmNlKG1Db250ZXh0LCBtU3VidGl0bGVTdHlsZVJlcyk7CisgICAgICAgIH0KKyAgICAgICAgaWYgKG1TdWJ0aXRsZSAhPSBudWxsKSB7CisgICAgICAgICAgICBtU3VidGl0bGVWaWV3LnNldFRleHQobVN1YnRpdGxlKTsKKyAgICAgICAgICAgIG1TdWJ0aXRsZVZpZXcuc2V0VmlzaWJpbGl0eShWSVNJQkxFKTsKKyAgICAgICAgfQorCisgICAgICAgIGFkZFZpZXcobVRpdGxlTGF5b3V0KTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBzZXRUYWJTZWxlY3RlZChpbnQgcG9zaXRpb24pIHsKKyAgICAgICAgZmluYWwgaW50IHRhYkNvdW50ID0gbVRhYkxheW91dC5nZXRDaGlsZENvdW50KCk7CisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgdGFiQ291bnQ7IGkrKykgeworICAgICAgICAgICAgZmluYWwgVmlldyBjaGlsZCA9IG1UYWJMYXlvdXQuZ2V0Q2hpbGRBdChpKTsKKyAgICAgICAgICAgIGNoaWxkLnNldFNlbGVjdGVkKGkgPT0gcG9zaXRpb24pOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc2V0Q29udGV4dFZpZXcoQWN0aW9uQmFyQ29udGV4dFZpZXcgdmlldykgeworICAgICAgICBtQ29udGV4dFZpZXcgPSB2aWV3OworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHByb3RlY3RlZCB2b2lkIG9uTWVhc3VyZShpbnQgd2lkdGhNZWFzdXJlU3BlYywgaW50IGhlaWdodE1lYXN1cmVTcGVjK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ICAgICAgCisgICAgICAgIHN3aXRjaCAobU5hdmlnYXRpb25Nb2RlKSB7CisgICAgICAgIGNhc2UgQWN0aW9uQmFyLk5BVklHQVRJT05fTU9ERV9TVEFOREFSRDoKKyAgICAgICAgICAgIGlmIChtVGl0bGVMYXlvdXQgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIG1lYXN1cmVDaGlsZFZpZXcobVRpdGxlTGF5b3V0LCBhdmFpbGFibGVXaWR0aCwgY2hpbGRTcGVjSGVpZ2h0LCBtU3BhY2luZyk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBBY3Rpb25CYXIuTkFWSUdBVElPTl9NT0RFX0RST1BET1dOX0xJU1Q6CisgICAgICAgICAgICBpZiAobVNwaW5uZXIgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIG1TcGlubmVyLm1lYXN1cmUoCisgICAgICAgICAgICAgICAgICAgICAgICBNZWFzdXJlU3BlYy5tYWtlTWVhc3VyZVNwZWMoYXZhaWxhYmxlV2lkdGgsIE1lYXN1cmVTcGVjLkFUX01PU1QpLAorICAgICAgICAgICAgICAgICAgICAgICAgTWVhc3VyZVNwZWMubWFrZU1lYXN1cmVTcGVjKGhlaWdodCwgTWVhc3VyZVNwZWMuQVRfTU9TVCkpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgQWN0aW9uQmFyLk5BVklHQVRJT05fTU9ERV9DVVNUT006CisgICAgICAgICAgICBpZiAobUN1c3RvbU5hdlZpZXcgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIExheW91dFBhcmFtcyBscCA9IG1DdXN0b21OYXZWaWV3LmdldExheW91dFBhcmFtcygpOworICAgICAgICAgICAgICAgIGZpbmFsIGludCBjdXN0b21OYXZXaWR0aE1vZGUgPSBscC53aWR0aCAhPSBMYXlvdXRQYXJhbXMuV1JBUF9DT05URU5UID8KKyAgICAgICAgICAgICAgICAgICAgICAgIE1lYXN1cmVTcGVjLkVYQUNUTFkgOiBNZWFzdXJlU3BlYy5BVF9NT1NUOworICAgICAgICAgICAgICAgIGZpbmFsIGludCBjdXN0b21OYXZXaWR0aCA9IGxwLndpZHRoID49IDAgPworICAgICAgICAgICAgICAgICAgICAgICAgTWF0aC5taW4obHAud2lkdGgsIGF2YWlsYWJsZVdpZHRoKSA6IGF2YWlsYWJsZVdpZHRoOworCisgICAgICAgICAgICAgICAgLy8gSWYgdGhlIGFjdGlvbiBiYXIgaXMgd3JhcHBpbmcgdG8gaXRzIGNvbnRlbnQgaGVpZ2h0LCBkb24ndCBhbGxvdyBhIGN1c3RvbQorICAgICAgICAgICAgICAgIC8vIHZpZXcgdG8gTUFUQ0hfUEFSRU5ULgorICAgICAgICAgICAgICAgIGludCBjdXN0b21OYXZIZWlnaHRNb2RlOworICAgICAgICAgICAgICAgIGlmIChtQ29udGVudEhlaWdodCA8PSAwKSB7CisgICAgICAgICAgICAgICAgICAgIGN1c3RvbU5hdkhlaWdodE1vZGUgPSBNZWFzdXJlU3BlYy5BVF9NT1NUOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIGN1c3RvbU5hdkhlaWdodE1vZGUgPSBscC5oZWlnaHQgIT0gTGF5b3V0UGFyYW1zLldSQVBfQ09OVEVOVCA/CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgTWVhc3VyZVNwZWMuRVhBQ1RMWSA6IE1lYXN1cmVTcGVjLkFUX01PU1Q7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGZpbmFsIGludCBjdXN0b21OYXZIZWlnaHQgPSBscC5oZWlnaHQgPj0gMCA/CisgICAgICAgICAgICAgICAgICAgICAgICBNYXRoLm1pbihscC5oZWlnaHQsIGhlaWdodCkgOiBoZWlnaHQ7CisgICAgICAgICAgICAgICAgbUN1c3RvbU5hdlZpZXcubWVhc3VyZSgKKyAgICAgICAgICAgICAgICAgICAgICAgIE1lYXN1cmVTcGVjLm1ha2VNZWFzdXJlU3BlYyhjdXN0b21OYXZXaWR0aCwgY3VzdG9tTmF2V2lkdGhNb2RlKSwKKyAgICAgICAgICAgICAgICAgICAgICAgIE1lYXN1cmVTcGVjLm1ha2VNZWFzdXJlU3BlYyhjdXN0b21OYXZIZWlnaHQsIGN1c3RvbU5hdkhlaWdodE1vZGUpKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIEFjdGlvbkJhci5OQVZJR0FUSU9OX01PREVfVEFCUzoKKyAgICAgICAgICAgIGlmIChtVGFiTGF5b3V0ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBtVGFiTGF5b3V0Lm1lYXN1cmUoCisgICAgICAgICAgICAgICAgICAgICAgICBNZWFzdXJlU3BlYy5tYWtlTWVhc3VyZVNwZWMoYXZhaWxhYmxlV2lkdGgsIE1lYXN1cmVTcGVjLkFUX01PU1QpLAorICAgICAgICAgICAgICAgICAgICAgICAgTWVhc3VyZVNwZWMubWFrZU1lYXN1cmVTcGVjKGhlaWdodCwgTWVhc3VyZVNwZWMuQVRfTU9TVCkpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKworICAgICAgICBpZiAobUNvbnRlbnRIZWlnaHQgPD0gMCkgeworICAgICAgICAgICAgaW50IG1lYXN1cmVkSGVpZ2h0ID0gMDsKKyAgICAgICAgICAgIGZpbmFsIGludCBjb3VudCA9IGdldENoaWxkQ291bnQoKTsKKyAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgY291bnQ7IGkrKykgeworICAgICAgICAgICAgICAgIFZpZXcgdiA9IGdldENoaWxkQXQoaSk7CisgICAgICAgICAgICAgICAgaW50IHBhZGRlZFZpZXdIZWlnaHQgPSB2LmdldE1lYXN1cmVkSGVpZ2h0KCkgKyB2ZXJ0aWNhbFBhZGRpbmc7CisgICAgICAgICAgICAgICAgaWYgKHBhZGRlZFZpZXdIZWlnaHQgPiBtZWFzdXJlZEhlaWdodCkgeworICAgICAgICAgICAgICAgICAgICBtZWFzdXJlZEhlaWdodCA9IHBhZGRlZFZpZXdIZWlnaHQ7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgc2V0TWVhc3VyZWREaW1lbnNpb24oY29udGVudFdpZHRoLCBtZWFzdXJlZEhlaWdodCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBzZXRNZWFzdXJlZERpbWVuc2lvbihjb250ZW50V2lkdGgsIG1heEhlaWdodCk7CisgICAgICAgIH0KKworICAgICAgICBpZiAobUNvbnRleHRWaWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgIG1Db250ZXh0Vmlldy5zZXRIZWlnaHQoZ2V0TWVhc3VyZWRIZWlnaHQoKSk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIGludCBtZWFzdXJlQ2hpbGRWaWV3KFZpZXcgY2hpbGQsIGludCBhdmFpbGFibGVXaWR0aCwgaW50IGNoaWxkU3BlY0hlaWdodCwgaW50IHNwYWNpbmcpIHsKKyAgICAgICAgY2hpbGQubWVhc3VyZShNZWFzdXJlU3BlYy5tYWtlTWVhc3VyZVNwZWMoYXZhaWxhYmxlV2lkdGgsIE1lYXN1cmVTcGVjLkFUX01PU1QpLAorICAgICAgICAgICAgICAgIGNoaWxkU3BlY0hlaWdodCk7CisKKyAgICAgICAgYXZhaWxhYmxlV2lkdGggLT0gY2hpbGQuZ2V0TWVhc3VyZWRXaWR0aCgpOworICAgICAgICBhdmFpbGFibGVXaWR0aCAtPSBzcGFjaW5nOworCisgICAgICAgIHJldHVybiBhdmFpbGFibGVXaWR0aDsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwcm90ZWN0ZWQgdm9pZCBvbkxheW91dChib29sZWFuIGNoYW5nZWQsIGludCBsLCBpbnQgdCwgaW50IHIsIGludCBiKSB7CisgICAgICAgIGludCB4ID0gZ2V0UGFkZGluZ0xlZnQoKTsKKyAgICAgICAgZmluYWwgaW50IHkgPSBnZXRQYWRkaW5nVG9wKCk7CisgICAgICAgIGZpbmFsIGludCBjb250ZW50SGVpZ2h0ID0gYiAtIHQgLSBnZXRQYWRkaW5nVG9wKCkgLSBnZXRQYWRkaW5nQm90dG9tKCk7CisKKyAgICAgICAgaWYgKG1Mb2dvVmlldyAhPSBudWxsICYmIG1Mb2dvVmlldy5nZXRWaXNpYmlsaXR5KCkgIT0gR09ORSkgeworICAgICAgICAgICAgeCArPSBwb3NpdGlvbkNoaWxkKG1Mb2dvVmlldywgeCwgeSwgY29udGVudEhlaWdodCkgKyBtU3BhY2luZzsKKyAgICAgICAgfQorICAgICAgICBpZiAobUljb25WaWV3ICE9IG51bGwgJiYgbUljb25WaWV3LmdldFZpc2liaWxpdHkoKSAhPSBHT05FKSB7CisgICAgICAgICAgICB4ICs9IHBvc2l0aW9uQ2hpbGQobUljb25WaWV3LCB4LCB5LCBjb250ZW50SGVpZ2h0KSArIG1TcGFjaW5nOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICBzd2l0Y2ggKG1OYXZpZ2F0aW9uTW9kZSkgeworICAgICAgICBjYXNlIEFjdGlvbkJhci5OQVZJR0FUSU9OX01PREVfU1RBTkRBUkQ6CisgICAgICAgICAgICBpZiAobVRpdGxlTGF5b3V0ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICB4ICs9IHBvc2l0aW9uQ2hpbGQobVRpdGxlTGF5b3V0LCB4LCB5LCBjb250ZW50SGVpZ2h0KSArIG1TcGFjaW5nOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgQWN0aW9uQmFyLk5BVklHQVRJT05fTU9ERV9EUk9QRE9XTl9MSVNUOgorICAgICAgICAgICAgaWYgKG1TcGlubmVyICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICB4ICs9IHBvc2l0aW9uQ2hpbGQobVNwaW5uZXIsIHgsIHksIGNvbnRlbnRIZWlnaHQpICsgbVNwYWNpbmc7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBBY3Rpb25CYXIuTkFWSUdBVElPTl9NT0RFX0NVU1RPTToKKyAgICAgICAgICAgIGlmIChtQ3VzdG9tTmF2VmlldyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgeCArPSBwb3NpdGlvbkNoaWxkKG1DdXN0b21OYXZWaWV3LCB4LCB5LCBjb250ZW50SGVpZ2h0KSArIG1TcGFjaW5nOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgQWN0aW9uQmFyLk5BVklHQVRJT05fTU9ERV9UQUJTOgorICAgICAgICAgICAgaWYgKG1UYWJMYXlvdXQgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIHggKz0gcG9zaXRpb25DaGlsZChtVGFiTGF5b3V0LCB4LCB5LCBjb250ZW50SGVpZ2h0KSArIG1TcGFjaW5nOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgeCA9IHIgLSBsIC0gZ2V0UGFkZGluZ1JpZ2h0KCk7CisKKyAgICAgICAgaWYgKG1NZW51VmlldyAhPSBudWxsKSB7CisgICAgICAgICAgICB4IC09IHBvc2l0aW9uQ2hpbGRJbnZlcnNlKG1NZW51VmlldywgeCArIG1BY3Rpb25TcGFjaW5nLCB5LCBjb250ZW50SGVpZ2h0KQorICAgICAgICAgICAgICAgICAgICAtIG1BY3Rpb25TcGFjaW5nOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSBpbnQgcG9zaXRpb25DaGlsZChWaWV3IGNoaWxkLCBpbnQgeCwgaW50IHksIGludCBjb250ZW50SGVpZ2h0KSB7CisgICAgICAgIGludCBjaGlsZFdpZHRoID0gY2hpbGQuZ2V0TWVhc3VyZWRXaWR0aCgpOworICAgICAgICBpbnQgY2hpbGRIZWlnaHQgPSBjaGlsZC5nZXRNZWFzdXJlZEhlaWdodCgpOworICAgICAgICBpbnQgY2hpbGRUb3AgPSB5ICsgKGNvbnRlbnRIZWlnaHQgLSBjaGlsZEhlaWdodCkgLyAyOworCisgICAgICAgIGNoaWxkLmxheW91dCh4LCBjaGlsZFRvcCwgeCArIGNoaWxkV2lkdGgsIGNoaWxkVG9wICsgY2hpbGRIZWlnaHQpOworCisgICAgICAgIHJldHVybiBjaGlsZFdpZHRoOworICAgIH0KKyAgICAKKyAgICBwcml2YXRlIGludCBwb3NpdGlvbkNoaWxkSW52ZXJzZShWaWV3IGNoaWxkLCBpbnQgeCwgaW50IHksIGludCBjb250ZW50SGVpZ2h0KSB7CisgICAgICAgIGludCBjaGlsZFdpZHRoID0gY2hpbGQuZ2V0TWVhc3VyZWRXaWR0aCgpOworICAgICAgICBpbnQgY2hpbGRIZWlnaHQgPSBjaGlsZC5nZXRNZWFzdXJlZEhlaWdodCgpOworICAgICAgICBpbnQgY2hpbGRUb3AgPSB5ICsgKGNvbnRlbnRIZWlnaHQgLSBjaGlsZEhlaWdodCkgLyAyOworCisgICAgICAgIGNoaWxkLmxheW91dCh4IC0gY2hpbGRXaWR0aCwgY2hpbGRUb3AsIHgsIGNoaWxkVG9wICsgY2hpbGRIZWlnaHQpOworCisgICAgICAgIHJldHVybiBjaGlsZFdpZHRoOworICAgIH0KKworICAgIHByaXZhdGUgc3RhdGljIGNsYXNzIFRhYlZpZXcgZXh0ZW5kcyBMaW5lYXJMYXlvdXQgeworICAgICAgICBwcml2YXRlIEFjdGlvbkJhci5UYWIgbVRhYjsKKworICAgICAgICBwdWJsaWMgVGFiVmlldyhDb250ZXh0IGNvbnRleHQsIEFjdGlvbkJhci5UYWIgdGFiKSB7CisgICAgICAgICAgICBzdXBlcihjb250ZXh0KTsKKyAgICAgICAgICAgIG1UYWIgPSB0YWI7CisKKyAgICAgICAgICAgIC8vIFRPRE8gU3R5bGUgdGFicyBiYXNlZCBvbiB0aGUgdGhlbWUKKworICAgICAgICAgICAgZmluYWwgRHJhd2FibGUgaWNvbiA9IHRhYi5nZXRJY29uKCk7CisgICAgICAgICAgICBmaW5hbCBDaGFyU2VxdWVuY2UgdGV4dCA9IHRhYi5nZXRUZXh0KCk7CisKKyAgICAgICAgICAgIGlmIChpY29uICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBJbWFnZVZpZXcgaWNvblZpZXcgPSBuZXcgSW1hZ2VWaWV3KGNvbnRleHQpOworICAgICAgICAgICAgICAgIGljb25WaWV3LnNldEltYWdlRHJhd2FibGUoaWNvbik7CisgICAgICAgICAgICAgICAgTGF5b3V0UGFyYW1zIGxwID0gbmV3IExheW91dFBhcmFtcyhMYXlvdXRQYXJhbXMuV1JBUF9DT05URU5ULAorICAgICAgICAgICAgICAgICAgICAgICAgTGF5b3V0UGFyYW1zLldSQVBfQ09OVEVOVCk7CisgICAgICAgICAgICAgICAgbHAuZ3Jhdml0eSA9IEdyYXZpdHkuQ0VOVEVSX1ZFUlRJQ0FMOworICAgICAgICAgICAgICAgIGljb25WaWV3LnNldExheW91dFBhcmFtcyhscCk7CisgICAgICAgICAgICAgICAgYWRkVmlldyhpY29uVmlldyk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmICh0ZXh0ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBUZXh0VmlldyB0ZXh0VmlldyA9IG5ldyBUZXh0Vmlldyhjb250ZXh0KTsKKyAgICAgICAgICAgICAgICB0ZXh0Vmlldy5zZXRUZXh0KHRleHQpOworICAgICAgICAgICAgICAgIHRleHRWaWV3LnNldFNpbmdsZUxpbmUoKTsKKyAgICAgICAgICAgICAgICB0ZXh0Vmlldy5zZXRFbGxpcHNpemUoVHJ1bmNhdGVBdC5FTkQpOworICAgICAgICAgICAgICAgIExheW91dFBhcmFtcyBscCA9IG5ldyBMYXlvdXRQYXJhbXMoTGF5b3V0UGFyYW1zLldSQVBfQ09OVEVOVCwKKyAgICAgICAgICAgICAgICAgICAgICAgIExheW91dFBhcmFtcy5XUkFQX0NPTlRFTlQpOworICAgICAgICAgICAgICAgIGxwLmdyYXZpdHkgPSBHcmF2aXR5LkNFTlRFUl9WRVJUSUNBTDsKKyAgICAgICAgICAgICAgICB0ZXh0Vmlldy5zZXRMYXlvdXRQYXJhbXMobHApOworICAgICAgICAgICAgICAgIGFkZFZpZXcodGV4dFZpZXcpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBzZXRMYXlvdXRQYXJhbXMobmV3IExheW91dFBhcmFtcyhMYXlvdXRQYXJhbXMuV1JBUF9DT05URU5ULAorICAgICAgICAgICAgICAgICAgICBMYXlvdXRQYXJhbXMuTUFUQ0hfUEFSRU5ULCAxKSk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgQWN0aW9uQmFyLlRhYiBnZXRUYWIoKSB7CisgICAgICAgICAgICByZXR1cm4gbVRhYjsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgY2xhc3MgVGFiQ2xpY2tMaXN0ZW5lciBpbXBsZW1lbnRzIE9uQ2xpY2tMaXN0ZW5lciB7CisgICAgICAgIHB1YmxpYyB2b2lkIG9uQ2xpY2soVmlldyB2aWV3KSB7CisgICAgICAgICAgICBUYWJWaWV3IHRhYlZpZXcgPSAoVGFiVmlldykgdmlldzsKKyAgICAgICAgICAgIHRhYlZpZXcuZ2V0VGFiKCkuc2VsZWN0KCk7CisgICAgICAgICAgICBmaW5hbCBpbnQgdGFiQ291bnQgPSBtVGFiTGF5b3V0LmdldENoaWxkQ291bnQoKTsKKyAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgdGFiQ291bnQ7IGkrKykgeworICAgICAgICAgICAgICAgIGZpbmFsIFZpZXcgY2hpbGQgPSBtVGFiTGF5b3V0LmdldENoaWxkQXQoaSk7CisgICAgICAgICAgICAgICAgY2hpbGQuc2V0U2VsZWN0ZWQoY2hpbGQgPT0gdmlldyk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9Cit9CmRpZmYgLS1naXQgYS9jb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2lkIHBlcmZvcm1QaG90b0NsaWNrKCkgewotICAgICAgICBpZiAobUxpc3RlbmVyICE9IG51bGwpIHsKLSAgICAgICAgICAgIG1MaXN0ZW5lci5vblBob3RvQ2xpY2sobVBob3RvVmlldyk7Ci0gICAgICAgIH0KLSAgICB9Ci0KLSAgICBwcml2YXRlIHZvaWQgcGVyZm9ybURpc3BsYXlOYW1lQ2xpY2soKSB7Ci0gICAgICAgIGlmIChtTGlzdGVuZXIgIT0gbnVsbCkgewotICAgICAgICAgICAgbUxpc3RlbmVyLm9uRGlzcGxheU5hbWVDbGljayhtRGlzcGxheU5hbWVWaWV3KTsKLSAgICAgICAgfQotICAgIH0KLQotICAgIHByaXZhdGUgY2xhc3MgUXVlcnlIYW5kbGVyIGV4dGVuZHMgQXN5bmNRdWVyeUhhbmRsZXIgewotCi0gICAgICAgIHB1YmxpYyBRdWVyeUhhbmRsZXIoQ29udGVudFJlc29sdmVyIGNyKSB7Ci0gICAgICAgICAgICBzdXBlcihjcik7Ci0gICAgICAgIH0KLQotICAgICAgICBAT3ZlcnJpZGUKLSAgICAgICAgcHJvdGVjdGVkIHZvaWQgb25RdWVyeUNvbXBsZXRlKGludCB0b2tlbiwgT2JqZWN0IGNvb2tpZSwgQ3Vyc29yIGN1cnNvcikgewotICAgICAgICAgICAgdHJ5ewotICAgICAgICAgICAgICAgIGlmICh0aGlzICE9IG1RdWVyeUhhbmRsZXIpIHsKLSAgICAgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAib25RdWVyeUNvbXBsZXRlOiBkaXNjYXJkIHJlc3VsdCwgdGhlIHF1ZXJ5IGhhbmRsZXIgaXMgcmVzZXQhIik7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBzd2l0Y2ggKHRva2VuKSB7Ci0gICAgICAgICAgICAgICAgICAgIGNhc2UgVE9LRU5fUEhPVE9fUVVFUlk6IHsKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vU2V0IHRoZSBwaG90bwotICAgICAgICAgICAgICAgICAgICAgICAgQml0bWFwIHBob3RvQml0bWFwID0gbnVsbDsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjdXJzb3IgIT0gbnVsbCAmJiBjdXJzb3IubW92ZVRvRmlyc3QoKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmJiAhY3Vyc29yLmlzTnVsbChQaG90b1F1ZXJ5LlBIT1RPKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ5dGVbXSBwaG90b0RhdGEgPSBjdXJzb3IuZ2V0QmxvYihQaG90b1F1ZXJ5LlBIT1RPKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaG90b0JpdG1hcCA9IEJpdG1hcEZhY3RvcnkuZGVjb2RlQnl0ZUFycmF5KHBob3RvRGF0YSwgMCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBob3RvRGF0YS5sZW5ndGgsIG51bGwpOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgICAgICAgICBpZiAocGhvdG9CaXRtYXAgPT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBob3RvQml0bWFwID0gbG9hZFBsYWNlaG9sZGVyUGhvdG8obnVsbCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICBtUGhvdG9WaWV3LnNldEltYWdlQml0bWFwKHBob3RvQml0bWFwKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjb29raWUgIT0gbnVsbCAmJiBjb29raWUgaW5zdGFuY2VvZiBVcmkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBtUGhvdG9WaWV3LmFzc2lnbkNvbnRhY3RVcmkoKFVyaSkgY29va2llKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIGludmFsaWRhdGUoKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIGNhc2UgVE9LRU5fQ09OVEFDVF9JTkZPOiB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoY3Vyc29yICE9IG51bGwgJiYgY3Vyc29yLm1vdmVUb0ZpcnN0KCkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBiaW5kQ29udGFjdEluZm8oY3Vyc29yKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBVcmkgbG9va3VwVXJpID0gQ29udGFjdHMuZ2V0TG9va3VwVXJpKGN1cnNvci5nZXRMb25nKENvbnRhY3RRdWVyeS5fSUQpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY3Vyc29yLmdldFN0cmluZyhDb250YWN0UXVlcnkuTE9PS1VQX0tFWSkpOwotCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZmluYWwgbG9uZyBwaG90b0lkID0gY3Vyc29yLmdldExvbmcoQ29udGFjdFF1ZXJ5LlBIT1RPX0lEKTsKLQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChwaG90b0lkID09IDApIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVBob3RvVmlldy5zZXRJbWFnZUJpdG1hcChsb2FkUGxhY2Vob2xkZXJQaG90byhudWxsKSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjb29raWUgIT0gbnVsbCAmJiBjb29raWUgaW5zdGFuY2VvZiBVcmkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1QaG90b1ZpZXcuYXNzaWduQ29udGFjdFVyaSgoVXJpKSBjb29raWUpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludmFsaWRhdGUoKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGFydFBob3RvUXVlcnkocGhvdG9JZCwgbG9va3VwVXJpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZhbHNlIC8qIGRvbid0IHJlc2V0IHF1ZXJ5IGhhbmRsZXIgKi8pOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gc2hvdWxkbid0IHJlYWxseSBoYXBwZW4KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXREaXNwbGF5TmFtZShudWxsLCBudWxsKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXRTb2NpYWxTbmlwcGV0KG51bGwpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldFBob3RvKGxvYWRQbGFjZWhvbGRlclBob3RvKG51bGwpKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIGNhc2UgVE9LRU5fUEhPTkVfTE9PS1VQOiB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoY3Vyc29yICE9IG51bGwgJiYgY3Vyc29yLm1vdmVUb0ZpcnN0KCkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb25nIGNvbnRhY3RJZCA9IGN1cnNvci5nZXRMb25nKFBIT05FX0xPT0tVUF9DT05UQUNUX0lEX0NPTFVNTl9JTkRFWCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgU3RyaW5nIGxvb2t1cEtleSA9IGN1cnNvci5nZXRTdHJpbmcoCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQSE9ORV9MT09LVVBfQ09OVEFDVF9MT09LVVBfS0VZX0NPTFVNTl9JTkRFWCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgYmluZEZyb21Db250YWN0VXJpSW50ZXJuYWwoQ29udGFjdHMuZ2V0TG9va3VwVXJpKGNvbnRhY3RJZCwgbG9va3VwS2V5KSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZhbHNlIC8qIGRvbid0IHJlc2V0IHF1ZXJ5IGhhbmRsZXIgKi8pOwotICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBTdHJpbmcgcGhvbmVOdW1iZXIgPSAoU3RyaW5nKSBjb29raWU7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0RGlzcGxheU5hbWUocGhvbmVOdW1iZXIsIG51bGwpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldFNvY2lhbFNuaXBwZXQobnVsbCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0UGhvdG8obG9hZFBsYWNlaG9sZGVyUGhvdG8obnVsbCkpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1QaG90b1ZpZXcuYXNzaWduQ29udGFjdEZyb21QaG9uZShwaG9uZU51bWJlciwgdHJ1ZSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBjYXNlIFRPS0VOX0VNQUlMX0xPT0tVUDogewotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGN1cnNvciAhPSBudWxsICYmIGN1cnNvci5tb3ZlVG9GaXJzdCgpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbG9uZyBjb250YWN0SWQgPSBjdXJzb3IuZ2V0TG9uZyhFTUFJTF9MT09LVVBfQ09OVEFDVF9JRF9DT0xVTU5fSU5ERVgpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIFN0cmluZyBsb29rdXBLZXkgPSBjdXJzb3IuZ2V0U3RyaW5nKAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRU1BSUxfTE9PS1VQX0NPTlRBQ1RfTE9PS1VQX0tFWV9DT0xVTU5fSU5ERVgpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJpbmRGcm9tQ29udGFjdFVyaUludGVybmFsKENvbnRhY3RzLmdldExvb2t1cFVyaShjb250YWN0SWQsIGxvb2t1cEtleSksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmYWxzZSAvKiBkb24ndCByZXNldCBxdWVyeSBoYW5kbGVyICovKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgU3RyaW5nIGVtYWlsQWRkcmVzcyA9IChTdHJpbmcpIGNvb2tpZTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXREaXNwbGF5TmFtZShlbWFpbEFkZHJlc3MsIG51bGwpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldFNvY2lhbFNuaXBwZXQobnVsbCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0UGhvdG8obG9hZFBsYWNlaG9sZGVyUGhvdG8obnVsbCkpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1QaG90b1ZpZXcuYXNzaWduQ29udGFjdEZyb21FbWFpbChlbWFpbEFkZHJlc3MsIHRydWUpOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9IGZpbmFsbHkgewotICAgICAgICAgICAgICAgIGlmIChjdXJzb3IgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICBjdXJzb3Iu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4KLSAgICAgKiBUaGlzIGRvZXNuJ3QgY2hhbmdlIHRoZSB1bmRlcmx5aW5nIHtAbGluayBDb250YWN0c30sIG9ubHkgdGhlIFVJIHN0YXRlLgotICAgICAqLwotICAgIHB1YmxpYyB2b2lkIHNldERpc3BsYXlOYW1lKENoYXJTZXF1ZW5jZSBkaXNwbGF5TmFtZSwgQ2hhclNlcXVlbmNlIHBob25ldGljTmFtZSkgewotICAgICAgICBtRGlzcGxheU5hbWVWaWV3LnNldFRleHQoZGlzcGxheU5hbWUpOwotICAgICAgICBpZiAoIVRleHRVdGlscy5pc0VtcHR5KHBob25ldGljTmFtZSkpIHsKLSAgICAgICAgICAgIG1QaG9uZXRpY05hbWVWaWV3LnNldFRleHQocGhvbmV0aWNOYW1lKTsKLSAgICAgICAgICAgIG1QaG9uZXRpY05hbWVWaWV3LnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKLSAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgIG1QaG9uZXRpY05hbWVWaWV3LnNldFZpc2liaWxpdHkoVmlldy5HT05FKTsKLSAgICAgICAgfQotICAgIH0KLQotICAgIC8qKgotICAgICAqIE1hbnVhbGx5IHNldCB0aGUgc29jaWFsIHNuaXBwZXQgdGV4dCB0byBkaXNwbGF5IGluIHRoZSBoZWFkZXIuCi0gICAgICovCi0gICAgcHVibGljIHZvaWQgc2V0U29jaWFsU25pcHBldChDaGFyU2VxdWVuY2Ugc25pcHBldCkgewotICAgICAgICBpZiAoc25pcHBldCA9PSBudWxsKSB7Ci0gICAgICAgICAgICBtU3RhdHVzVmlldy5zZXRWaXNpYmlsaXR5KFZpZXcuR09ORSk7Ci0gICAgICAgICAgICBtU3RhdHVzQXR0cmlidXRpb25WaWV3LnNldFZpc2liaWxpdHkoVmlldy5HT05FKTsKLSAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgIG1TdGF0dXNWaWV3LnNldFRleHQoc25pcHBldCk7Ci0gICAgICAgICAgICBtU3Rhd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ICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHJlc291cmNlcyA9IHBtLmdldFJlc291cmNlc0ZvckFwcGxpY2F0aW9uKHJlc1BhY2thZ2UpOwotICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChOYW1lTm90Rm91bmRFeGNlcHRpb24gZSkgewotICAgICAgICAgICAgICAgICAgICAgICAgTG9nLncoVEFHLCAiQ29udGFjdCBzdGF0dXMgdXBkYXRlIHJlc291cmNlIHBhY2thZ2Ugbm90IGZvdW5kOiAiCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgcmVzUGFja2FnZSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICByZXNvdXJjZXMgPSBudWxsOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgaWYgKHJlc291cmNlcyAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBsYWJlbCA9IHJlc291cmNlcy5nZXRTdHJpbmcobGFiZWxSZXNvdXJjZSk7Ci0gICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKE5vdEZvdW5kRXhjZXB0aW9uIGUpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIExvZy53KFRBRywgIkNvbnRhY3Qgc3RhdHVzIHVwZGF0ZSByZXNvdXJjZSBub3QgZm91bmQ6ICIgKyByZXNQYWNrYWdlICsgIkAiCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgbGFiZWxSZXNvdXJjZSk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIENoYXJTZXF1ZW5jZSBhdHRyaWJ1dGlvbjsKLSAgICAgICAgICAgIGlmICh0aW1lc3RhbXAgIT0gbnVsbCAmJiBsYWJlbCAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgYXR0cmlidXRpb24gPSBnZXRDb250ZXh0KCkuZ2V0U3RyaW5nKAotICAgICAgICAgICAgICAgICAgICAgICAgUi5zdHJpbmcuY29udGFjdF9zdGF0dXNfdXBkYXRlX2F0dHJpYnV0aW9uX3dpdGhfZGF0ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgIHRpbWVzdGFtcCwgbGFiZWwpOwotICAgICAgICAgICAgfSBlbHNlIGlmICh0aW1lc3RhbXAgPT0gbnVsbCAmJiBsYWJlbCAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgYXR0cmlidXRpb24gPSBnZXRDb250ZXh0KCkuZ2V0U3RyaW5nKAotICAgICAgICAgICAgICAgICAgICAgICAgUi5zdHJpbmcuY29udGFjdF9zdGF0dXNfdXBkYXRlX2F0dHJpYnV0aW9uLAotICAgICAgICAgICAgICAgICAgICAgICAgbGFiZWwpOwotICAgICAgICAgICAgfSBlbHNlIGlmICh0aW1lc3RhbXAgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIGF0dHJpYnV0aW9uID0gdGltZXN0YW1wOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBhdHRyaWJ1dGlvbiA9IG51bGw7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAoYXR0cmlidXRpb24gIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIG1TdGF0dXNBdHRyaWJ1dGlvblZpZXcuc2V0VGV4dChhdHRyaWJ1dGlvbik7Ci0gICAgICAgICAgICAgICAgbVN0YXR1c0F0dHJpYnV0aW9uVmlldy5zZXRWaXNpYmlsaXR5KFZpZXcuVklTSUJMRSk7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIG1TdGF0dXNBdHRyaWJ1dGlvblZpZXcuc2V0VmlzaWJpbGl0eShWaWV3LkdPTkUpOwotICAgICAgICAgICAgfQotICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgbVN0YXR1c1ZpZXcuc2V0VmlzaWJpbGl0eShWaWV3LkdPTkUpOwotICAgICAgICAgICAgbVN0YXR1c0F0dHJpYnV0aW9uVmlldy5zZXRWaXNpYmlsaXR5KFZpZXcuR09ORSk7Ci0gICAgICAgIH0KLSAgICB9Ci0KLSAgICBwdWJsaWMgdm9pZCBvbkNsaWNrKFZpZXcgdmlldykgewotICAgICAgICBzd2l0Y2ggKHZpZXcuZ2V0SWQoKSkgewotICAgICAgICAgICAgY2FzZSBSLmlkLnN0YXI6IHsKLSAgICAgICAgICAgICAgICAvLyBUb2dnbGUgInN0YXJyZWQiIHN0YXRlCi0gICAgICAgICAgICAgICAgLy8gTWFrZSBzdXJlIHRoZXJlIGlzIGEgY29udGFjdAotICAgICAgICAgICAgICAgIGlmIChtQ29udGFjdFVyaSAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIGZpbmFsIENvbnRlbnRWYWx1ZXMgdmFsdWVzID0gbmV3IENvbnRlbnRWYWx1ZXMoMSk7Ci0gICAgICAgICAgICAgICAgICAgIHZhbHVlcy5wdXQoQ29udGFjdHMuU1RBUlJFRCwgbVN0YXJyZWRWaWV3LmlzQ2hlY2tlZCgpKTsKLSAgICAgICAgICAgICAgICAgICAgbUNvbnRlbnRSZXNvbHZlci51cGRhdGUobUNvbnRhY3RVcmksIHZhbHVlcywgbnVsbCwgbnVsbCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgY2FzZSBSLmlkLnBob3RvOiB7Ci0gICAgICAgICAgICAgICAgcGVyZm9ybVBob3RvQ2xpY2soKTsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGNhc2UgUi5pZC5uYW1lOiB7Ci0gICAgICAgICAgICAgICAgcGVyZm9ybURpc3BsYXlOYW1lQ2xpY2soKTsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAg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nkgdXNpbmcgcmVzb3VyY2UgSUQKLSAgICAgKiAKLSAgICAgKiBAcGFyYW0gcmVzSWQKLSAgICAgKiAgICAgICAgICAgIFJlc291cmNlIElEIG9mIHRoZSBpYW1nZSBpbnNlcnRlZCB0byBUZXh0Vmlldy4KLSAgICAgKi8KLSAgICBwdWJsaWMgdm9pZCBvbkluc2VydEltYWdlKGludCByZXNJZCkgewotICAgICAgICBtTWFuYWdlci5vbkluc2VydEltYWdlKHJlc0lkKTsKLSAgICB9Ci0KLSAgICBwdWJsaWMgdm9pZCBvbkluc2VydEhvcml6b250YWxMaW5lKCkgewotICAgICAgICBtTWFuYWdlci5vbkluc2VydEhvcml6b250YWxMaW5lKCk7Ci0gICAgfQotCi0gICAgcHVibGljIHZvaWQgb25DbGVhclN0eWxlcygpIHsKLSAgICAgICAgbU1hbmFnZXIub25DbGVhclN0eWxlcygpOwotICAgIH0KLSAgICAvKioKLSAgICAgKiBTZXQgU2l6ZSBvZiB0aGUgSXRlbS4KLSAgICAgKiAKLSAgICAgKiBAcGFyYW0gc2l6ZQotICAgICAqICAgICAgICAgICAgVGhlIHNpemUgb2YgdGhlIEl0ZW0uCi0gICAgICovCi0gICAgcHVibGljIHZvaWQgc2V0SXRlbVNpemUoaW50IHNpemUpIHsKLSAgICAgICAgbU1hbmFnZXIuc2V0SXRlbVNpemUoc2l6ZSk7Ci0gICAgfQotCi0gICAgLyoqCi0gICAgICogU2V0IENvbG9yIG9mIHRoZSBJdGVtLgotICAgICAqIAotICAgICAqIEBwYXJhbSBjb2xvcgotICAgICAqICAgICAgICAgICAgVGhlIGNvbG9yIG9mIHRoZSBJdGVtLgotICAgICAqLwotICAgIHB1YmxpYyB2b2lkIHNldEl0ZW1Db2xvcihpbnQgY29sb3IpIHsKLSAgICAgICAgbU1hbmFnZXIuc2V0SXRlbUNvbG9yKGNvbG9yKTsKLSAgICB9Ci0KLSAgICAvKioKLSAgICAgKiBTZXQgQWxpZ25tZW50IG9mIHRoZSBJdGVtLgotICAgICAqIAotICAgICAqIEBwYXJhbSBjb2xvcgotICAgICAqICAgICAgICAgICAgVGhlIGNvbG9yIG9mIHRoZSBJdGVtLgotICAgICAqLwotICAgIHB1YmxpYyB2b2lkIHNldEFsaWdubWVudChMYXlvdXQuQWxpZ25tZW50IGFsaWduKSB7Ci0gICAgICAgIG1NYW5hZ2VyLnNldEFsaWdubWVudChhbGlnbik7Ci0gICAgfQotCi0gICAgLyoqCi0gICAgICogU2V0IEJhY2tncm91bmQgY29sb3Igb2YgVmlldy4KLSAgICAgKiAKLSAgICAgKiBAcGFyYW0gY29sb3IKLSAgICAgKiAgICAgICAgICAgIFRoZSBiYWNrZ3JvdW5kIGNvbG9yIG9mIHZpZXcuCi0gICAgICovCi0gICAgQE92ZXJyaWRlCi0gICAgcHVibGljIHZvaWQgc2V0QmFja2dyb3VuZENvbG9yKGludCBjb2xvcikgewotICAgICAgICBzdXBlci5zZXRCYWNrZ3JvdW5kQ29sb3IoY29sb3IpOwotICAgICAgICBtQmFja2dyb3VuZENvbG9yID0gY29sb3I7Ci0gICAgfQotCi0gICAgLyoqCi0gICAgICogU2V0IGh0bWwgdG8gRWRpdFN0eWxlZFRleHQuCi0gICAgICogCi0gICAgICogQHBhcmFtIGh0bWwKLSAgICAgKiAgICAgICAgICAgIFRoZSBodG1sIHRvIGJlIHNldC4KLSAgICAgKi8KLSAgICBwdWJsaWMgdm9pZCBzZXRIdG1sKFN0cmluZyBodG1sKSB7Ci0gICAgICAgIG1Db252ZXJ0ZXIuU2V0SHRtbChodG1sKTsKLSAgICB9Ci0gICAgLyoqCi0gICAgICogQ2hlY2sgd2hldGhlciBlZGl0aW5nIGlzIHN0YXJ0ZWQgb3Igbm90LgotICAgICAqIAotICAgICAqIEByZXR1cm4gV2hldGhlciBlZGl0aW5nIGlzIHN0YXJ0ZWQgb3Igbm90LgotICAgICAqLwotICAgIHB1YmxpYyBib29sZWFuIGlzRWRpdHRpbmcoKSB7Ci0gICAgICAgIHJldHVybiBtT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zBdLmdldEZvcmVncm91bmRDb2xvcigpOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gREVGQVVMVF9CQUNLR1JPVU5EX0NPTE9SOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgfQotCi0gICAgLyoqCi0gICAgICogSW5pdGlhbGl6ZSBtZW1iZXJzLgotICAgICAqLwotICAgIHByaXZhdGUgdm9pZCBpbml0KCkgewotICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIGluaXQiKTsKLSAgICAgICAgfQotICAgICAgICByZXF1ZXN0Rm9jdXMoKTsKLSAgICAgICAgbURlZmF1bHRCYWNrZ3JvdW5kID0gZ2V0QmFja2dyb3VuZCgpOwotICAgICAgICBtQmFja2dyb3VuZENvbG9yID0gREVGQVVMVF9CQUNLR1JPVU5EX0NPTE9SOwotICAgICAgICBtTWFuYWdlciA9IG5ldyBFZGl0b3JNYW5hZ2VyKHRoaXMpOwotICAgICAgICBtQ29udmVydGVyID0gbmV3IFN0eWxlZFRleHRDb252ZXJ0ZXIodGhpcyk7Ci0gICAgICAgIG1EaWFsb2cgPSBuZXcgU3R5bGVkVGV4dERpYWxvZyh0aGlzKTsKLSAgICAgICAgc2V0TW92ZW1lbnRNZXRob2QobmV3IFN0eWxlZFRleHRBcnJvd0tleU1ldGhvZChtTWFuYWdlcikpOwotICAgICAgICBtTWFuYWdlci5ibG9ja1NvZnRLZXkoKTsKLSAgICAgICAgbU1hbmFnZXIudW5ibG9ja1NvZnRLZXkoKTsKLSAgICB9Ci0KLSAgICAvKioKLSAgICAgKiBTaG93IEZvcmVncm91bmQgQ29sb3IgU2VsZWN0aW5nIERpYWxvZy4KLSAgICAgKi8KLSAgICBwcml2YXRlIHZvaWQgb25TaG93Rm9yZWdyb3VuZENvbG9yQWxlcnQoKSB7Ci0gICAgICAgIG1EaWFsb2cub25TaG93Rm9yZWdyb3VuZENvbG9yQWxlcnREaWFsb2coKTsKLSAgICB9Ci0KLSAgICAvKioKLSAgICAgKiBTaG93IEJhY2tncm91bmQgQ29sb3IgU2VsZWN0aW5nIERpYWxvZy4KLSAgICAgKi8KLSAgICBwcml2YXRlIHZvaWQgb25TaG93QmFja2dyb3VuZENvbG9yQWxlcnQoKSB7Ci0gICAgICAgIG1EaWFsb2cub25TaG93QmFja2dyb3VuZENvbG9yQWxlcnREaWFsb2coKTsKLSAgICB9Ci0KLSAgICAvKioKLSAgICAgKiBTaG93IFNpemUgU2VsZWN0aW5nIERpYWxvZy4KLSAgICAgKi8KLSAgICBwcml2YXRlIHZvaWQgb25TaG93U2l6ZUFsZXJ0KCkgewotICAgICAgICBtRGlhbG9nLm9uU2hvd1NpemVBbGVydERpYWxvZygpOwotICAgIH0KLQotICAgIC8qKgotICAgICAqIFNob3cgQWxpZ25tZW50IFNlbGVjdGluZyBEaWFsb2cuCi0gICAgICovCi0gICAgcHJpdmF0ZSB2b2lkIG9uU2hvd0FsaWduQWxlcnQoKSB7Ci0gICAgICAgIG1EaWFsb2cub25TaG93QWxpZ25BbGVydERpYWxvZygpOwotICAgIH0KLQotICAgIC8qKgotICAgICAqIE5vdGlmeSBoaW50IG1lc3NhZ2VzIHdoYXQgYWN0aW9uIGlzIGV4cGVjdGVkIHRvIGNhbGxpbmcgY2xhc3MuCi0gICAgICogCi0gICAgICogQHBhcmFtIG1zZ0lkCi0gICAgICogICAgICAgICAgICBJZCBvZiB0aGUgaGludCBtZXNzYWdlLgotICAgICAqLwotICAgIHByaXZhdGUgdm9pZCBzZXRIaW50TWVzc2FnZShpbnQgbXNnSWQpIHsKLSAgICAgICAgaWYgKG1FU1RJbnRlcmZhY2UgIT0gbnVsbCkgewotICAgICAgICAgICAgbUVTVEludGVyZmFjZS5ub3RpZnlIaW50TXNnKG1zZ0lkKTsKLSAgICAgICAgfQotICAgIH0KLQotICAgIC8qKgotICAgICAqIE5vdGlmeSB0aGUgZXZlbnQgdGhhdCB0aGUgb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ICAgICB9Ci0gICAgICAgICAgICBoYW5kbGVDdXQoKTsKLSAgICAgICAgICAgIG1FU1Qubm90aWZ5U3RhdGVDaGFuZ2VkKG1Nb2RlLCBtU3RhdGUpOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIHZvaWQgb25TdGFydFBhc3RlKCkgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gb25TdGFydFBhc3RlIik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBoYW5kbGVQYXN0ZSgpOwotICAgICAgICAgICAgbUVTVC5ub3RpZnlTdGF0ZUNoYW5nZWQobU1vZGUsIG1TdGF0ZSk7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgdm9pZCBvblN0YXJ0U2l6ZSgpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIG9uU3RhcnRTaXplIik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBoYW5kbGVTaXplKCk7Ci0gICAgICAgICAgICBtRVNULm5vdGlmeVN0YXRlQ2hhbmdlZChtTW9kZSwgbVN0YXRlKTsKLSAgICAgICAgfQotCi0gICAgICAgIHB1YmxpYyB2b2lkIG9uU3RhcnRBbGlnbigpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIG9uU3RhcnRBbGlnblJpZ2h0Iik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBoYW5kbGVBbGlnbigpOwotICAgICAgICAgICAgbUVTVC5ub3RpZnlTdGF0ZUNoYW5nZWQobU1vZGUsIG1TdGF0ZSk7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgdm9pZCBvblN0YXJ0Q29sb3IoKSB7Ci0gICAgICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgTG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ICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gb25JbnNlcnRJbWFnZSBieSBVUkk6ICIgKyB1cmkuZ2V0UGF0aCgpCi0gICAgICAgICAgICAgICAgICAgICAgICArICIsIiArIHVyaS50b1N0cmluZygpKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGluc2VydEltYWdlU3BhbihuZXcgSW1hZ2VTcGFuKG1FU1QuZ2V0Q29udGV4dCgpLCB1cmkpKTsKLSAgICAgICAgICAgIG1FU1Qubm90aWZ5U3RhdGVDaGFuZ2VkKG1Nb2RlLCBtU3RhdGUpOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIHZvaWQgb25JbnNlcnRJbWFnZShpbnQgcmVzSUQpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIG9uSW5zZXJ0SW1hZ2UgYnkgcmVzSUQiKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGluc2VydEltYWdlU3BhbihuZXcgSW1hZ2VTcGFuKG1FU1QuZ2V0Q29udGV4dCgpLCByZXNJRCkpOwotICAgICAgICAgICAgbUVTVC5ub3RpZnlTdGF0ZUNoYW5nZWQobU1vZGUsIG1TdGF0ZSk7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgdm9pZCBvbkluc2VydEhvcml6b250YWxMaW5lKCkgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gb25JbnNlcnRIb3Jpem9udGFsTGluZToiKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGluc2VydEltYWdlU3BhbihuZXcgSG9yaXpvbnRhbExpbmVTcGFuKDB4RkYwMDAwMDAsIG1FU1QpKTsKLSAgICAgICAgICAgIG1FU1Qubm90aWZ5U3RhdGVDaGFuZ2VkKG1Nb2RlLCBtU3RhdGUpOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIHZvaWQgb25DbGVhclN0eWxlcygpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIG9uQ2xlYXJTdHlsZXMiKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIEVkaXRhYmxlIHR4dCA9IG1FU1QuZ2V0VGV4dCgpOwotICAgICAgICAgICAgaW50IGxlbiA9IHR4dC5sZW5ndGgoKTsKLSAgICAgICAgICAgIE9iamVjdFtdIHN0eWxlcyA9IHR4dC5nZXRTcGFucygwLCBsZW4sIE9iamVjdC5jbGFzcyk7Ci0gICAgICAgICAgICBmb3IgKE9iamVjdCBzdHlsZSA6IHN0eWxlcykgewotICAgICAgICAgICAgICAgIGlmIChzdHlsZSBpbnN0YW5jZW9mIFBhcmFncmFwaFN0eWxlIHx8Ci0gICAgICAgICAgICAgICAgICAgICAgICBzdHlsZSBpbnN0YW5jZW9mIFF1b3RlU3BhbiB8fAotICAgICAgICAgICAgICAgICAgICAgICAgc3R5bGUgaW5zdGFuY2VvZiBDaGFyYWN0ZXJTdHlsZSkgewotICAgICAgICAgICAgICAgICAgICBpZiAoc3R5bGUgaW5zdGFuY2VvZiBJbWFnZVNwYW4pIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGludCBzdGFydCA9IHR4dC5nZXRTcGFuU3RhcnQoc3R5bGUpOwotICAgICAgICAgICAgICAgICAgICAgICAgaW50IGVuZCA9IHR4dC5nZXRTcGFuRW5kKHN0eWxlKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIHR4dC5yZXBsYWNlKHN0YXJ0LCBlbmQsICIiKTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICB0eHQucmVtb3ZlU3BhbihzdHlsZSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICAgICAgbUVTVC5zZXRCYWNrZ3JvdW5kRHJhd2FibGUobUVTVC5tRGVmYXVsdEJhY2tncm91bmQpOwotICAgICAgICAgICAgbUVTVC5tQmFja2dyb3VuZENvbG9yID0gREVGQVVMVF9CQUNLR1JPVU5EX0NPTE9SOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIHZvaWQgc2V0SXRlbVNpemUoaW50IHNpemUpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIG9uQ2xpY2tTaXplSXRlbSIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKG1TdGF0ZSA9PSBTVEFURV9TRUxFQ1RFRCB8fCBtU3RhdGUgPT0gU1RBVEVfU0VMRUNUX0ZJWCkgewotICAgICAgICAgICAgICAgIGNoYW5nZVNpemVTZWxlY3RlZFRleHQoc2l6ZSk7Ci0gICAgICAgICAgICAgICAgaGFuZGxlUmVzZXRFZGl0KCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgdm9pZCBzZXRJdGVtQ29sb3IoaW50IGNvbG9yKSB7Ci0gICAgICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIi0tLSBvbkNsaWNrQ29sb3JJdGVtIik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAobVN0YXRlID09IFNUQVRFX1NFTEVDVEVEIHx8IG1TdGF0ZSA9PSBTVEFURV9TRUxFQ1RfRklYKSB7Ci0gICAgICAgICAgICAgICAgY2hhbmdlQ29sb3JTZWxlY3RlZFRleHQoY29sb3IpOwotICAgICAgICAgICAgICAgIGhhbmRsZVJlc2V0RWRpdCgpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIHZvaWQgc2V0QWxpZ25tZW50KExheW91dC5BbGlnbm1lbnQgYWxpZ24pIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICA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AgICAgICAgcmV0dXJuIHRydWU7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgYm9vbGVhbiBpc1NvZnRLZXlCbG9ja2VkKCkgewotICAgICAgICAgICAgcmV0dXJuIG1Tb2Z0S2V5QmxvY2tGbGFnOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIGludCBnZXRFZGl0TW9kZSgpIHsKLSAgICAgICAgICAgIHJldHVybiBtTW9kZTsKLSAgICAgICAgfQotCi0gICAgICAgIHB1YmxpYyBpbnQgZ2V0U2VsZWN0U3RhdGUoKSB7Ci0gICAgICAgICAgICByZXR1cm4gbVN0YXRlOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIGludCBnZXRTZWxlY3Rpb25TdGFydCgpIHsKLSAgICAgICAgICAgIHJldHVybiBtQ3VyU3RhcnQ7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgaW50IGdldFNlbGVjdGlvbkVuZCgpIHsKLSAgICAgICAgICAgIHJldHVybiBtQ3VyRW5kOwotICAgICAgICB9Ci0KLSAgICAgICAgcHJpdmF0ZSB2b2lkIGRvTmV4dEhhbmRsZSgpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIGRvTmV4dEhhbmRsZTogIiArIG1Nb2RlICsgIiwiICsgbVN0YXRlKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHN3aXRjaCAobU1vZGUpIHsKLSAgICAgICAgICAgIGNhc2UgTU9ERV9DT1BZOgotICAgICAgICAgICAgICAgIGhhbmRsZUNvcHkoKTsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIGNhc2UgTU9ERV9DVVQ6Ci0gICAgICAgICAgICAgICAgaGFuZGxlQ3V0KCk7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICBjYXNlIE1PREVfUEFTVEU6Ci0gICAgICAgICAgICAgICAgaGFuZGxlUGFzdGUoKTsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIGNhc2UgTU9ERV9TSVpFOgotICAgICAgICAgICAgICAgIGhhbmRsZVNpemUoKTsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIGNhc2UgTU9ERV9DT0xPUjoKLSAgICAgICAgICAgICAgICBoYW5kbGVDb2xvcigpOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgY2FzZSBNT0RFX0FMSUdOOgotICAgICAgICAgICAgICAgIGhhbmRsZUFsaWduKCk7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICBkZWZhdWx0OgotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgcHJpdmF0ZSB2b2lkIGhhbmRsZUNhbmNlbCgpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIGhhbmRsZUNhbmNlbCIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgbU1vZGUgPSBNT0RFX05PVEhJTkc7Ci0gICAgICAgICAgICBtU3RhdGUgPSBTVEFURV9TRUxFQ1RfT0ZGOwotICAgICAgICAgICAgbUVkaXRGbGFnID0gZmFsc2U7Ci0gICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIGhhbmRsZUNhbmNlbDoiICsgbUVTVC5nZXRJbnB1dFR5cGUoKSk7Ci0gICAgICAgICAgICB1bmJsb2NrU29mdEtleSgpOwotICAgICAgICAgICAgdW5zZXRTZWxlY3QoKTsKLSAgICAgICAgfQotCi0gICAgICAgIHByaXZhdGUgdm9pZCBoYW5kbGVDb21wbGV0ZSgpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIGhhbmRsZUNvbXBsZXRlIik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAoIW1FZGl0RmxhZykgewotICAgICAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmIChtU3RhdGUgPT0gU1RBVEVfU0VMRUNURUQpIHsKLSAgICAgICAgICAgICAgICBtU3RhdGUgPSBTVEFURV9TRUxFQ1RfRklYOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZG9OZXh0SGFuZGxlKCk7Ci0gICAgICAgIH0KLQotICAgICAgICBwcml2YXRlIHZvaWQgaGFuZGxlVGV4dFZpZXdGdW5jKGludCBtb2RlLCBpbnQgaWQpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIGhhbmRsZVRleHRWaWV3OiAiICsgbU1vZGUgKyAiLCIgKyBtU3RhdGUgKwotICAgICAgICAgICAgICAgICAgICAgICAgIiwiICsgaWQpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKCFtRWRpdEZsYWcpIHsKLSAgICAgICAgICAgICAgICByZXR1cm47Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAobU1vZGUgPT0gTU9ERV9OT1RISU5HIHx8IG1Nb2RlID09IE1PREVfU0VMRUNUKSB7Ci0gICAgICAgICAgICAgICAgbU1vZGUgPSBtb2RlOwotICAgICAgICAgICAgICAgIGlmIChtU3RhdGUgPT0gU1RBVEVfU0VMRUNURUQpIHsKLSAgICAgICAgICAgICAgICAgICAgbVN0YXRlID0gU1RBVEVfU0VMRUNUX0ZJWDsKLSAgICAgICAgICAgICAgICAgICAgaGFuZGxlVGV4dFZpZXdGdW5jKG1vZGUsIGlkKTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBoYW5kbGVTZWxlY3QoKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9IGVsc2UgaWYgKG1Nb2RlICE9IG1vZGUpIHsKLSAgICAgICAgICAgICAgICBoYW5kbGVDYW5jZWwoKTsKLSAgICAgICAgICAgICAgICBtTW9kZSA9IG1vZGU7Ci0gICAgICAgICAgICAgICAgaGFuZGxlVGV4dFZpZXdGdW5jKG1vZGUsIGlkKTsKLSAgICAgICAgICAgIH0gZWxzZSBpZiAobVN0YXRlID09IFNUQVRFX1NFTEVDVF9GSVgpIHsKLSAgICAgICAgICAgICAgICBtRVNULm9uVGV4dENvbnRleHRNZW51SXRlbShpZCk7Ci0gICAgICAgICAgICAgICAgaGFuZGxlUmVzZXRFZGl0KCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICBwcml2YXRlIHZvaWQgaGFuZGxlQ29weSgpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIGhhbmRsZUNvcHk6ICIgKyBtTW9kZSArICIsIiArIG1TdGF0ZSk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBoYW5kbGVUZXh0Vmlld0Z1bmMoTU9ERV9DT1BZLCBhbmRyb2lkLlIuaWQuY29weSk7Ci0gICAgICAgIH0KLQotICAgICAgICBwcml2YXRlIHZvaWQgaGFuZGxlQ3V0KCkgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gaGFuZGxlQ29weTogIiArIG1Nb2RlICsgIiwiICsgbVN0YXRlKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGhhbmRsZVRleHRWaWV3RnVuYyhNT0RFX0NVVCwgYW5kcm9pZC5SLmlkLmN1dCk7Ci0gICAgICAgIH0KLQotICAgICAgICBwcml2YXRlIHZvaWQgaGFuZGxlUGFzdGUoKSB7Ci0gICAgICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIi0tLSBoYW5kbGVQYXN0ZSIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKCFtRWRpdEZsYWcpIHsKLSAgICAgICAgICAgICAgICByZXR1cm47Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBtRVNULm9uVGV4dENvbnRleHRNZW51SXRlbShhbmRyb2lkLlIuaWQucGFzdGUpOwotICAgICAgICB9Ci0KLSAgICAgICAgcHJpdmF0ZSB2b2lkIGhhbmRsZVNldFNwYW4oaW50IG1vZGUpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIGhhbmRsZVNldFNwYW46IiArIG1FZGl0RmxhZyArICIsIgotICAgICAgICAgICAgICAgICAgICAgICAgKyBtU3RhdGUgKyAnLCcgKyBtTW9kZSk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAoIW1FZGl0RmxhZykgewotICAgICAgICAgICAgICAgIExvZy5lKExPR19UQUcsICItLS0gaGFuZGxlU2V0U3BhbjogRWRpdGluZyBpcyBub3Qgc3RhcnRlZC4iKTsKLSAgICAgICAgICAgICAgICByZXR1cm47Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAobU1vZGUgPT0gTU9ERV9OT1RISU5HIHx8IG1Nb2RlID09IE1PREVfU0VMRUNUKSB7Ci0gICAgICAgICAgICAgICAgbU1vZGUgPSBtb2RlOwotICAgICAgICAgICAgICAgIGlmIChtU3RhdGUgPT0gU1RBVEVfU0VMRUNURUQpIHsKLSAgICAgICAgICAgICAgICAgICAgbVN0YXRlID0gU1RBVEVfU0VMRUNUX0ZJWDsKLSAgICAgICAgICAgICAgICAgICAgaGFuZGxlU2V0U3Bhbihtb2RlKTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBoYW5kbGVTZWxlY3QoKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9IGVsc2UgaWYgKG1Nb2RlICE9IG1vZGUpIHsKLSAgICAgICAgICAgICAgICBoYW5kbGVDYW5jZWwoKTsKLSAgICAgICAgICAgICAgICBtTW9kZSA9IG1vZGU7Ci0gICAgICAgICAgICAgICAgaGFuZGxlU2V0U3Bhbihtb2RlKTsKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgaWYgKG1TdGF0ZSA9PSBTVEFURV9TRUxFQ1RfRklYKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1FU1Quc2V0SGludE1lc3NhZ2UoSElOVF9NU0dfTlVMTCk7Ci0gICAgICAgICAgICAgICAgICAgIHN3aXRjaCAobW9kZSkgewotICAgICAgICAgICAgICAgICAgICBjYXNlIE1PREVfQ09MT1I6Ci0gICAgICAgICAgICAgICAgICAgICAgICBtRVNULm9uU2hvd0ZvcmVncm91bmRDb2xvckFsZXJ0KCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICAgICAgY2FzZSBNT0RFX1NJWkU6Ci0gICAgICAgICAgICAgICAgICAgICAgICBtRVNULm9uU2hvd1NpemVBbGVydCgpOwotICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgIGNhc2UgTU9ERV9BTElHTjoKLSAgICAgICAgICAgICAgICAgICAgICAgIG1FU1Qub25TaG93QWxpZ25BbGVydCgpOwotICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6Ci0gICAgICAgICAgICAgICAgICAgICAgICBMb2cuZShMT0dfVEFHLCAiLS0tIGhhbmRsZVNldFNwYW46IGludmFsaWQgbW9kZS4iKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIi0tLSBoYW5kbGVTZXRTcGFuOiBkbyBub3RoaW5nLiIpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIHByaXZhdGUgdm9pZCBoYW5kbGVTaXplKCkgewotICAgICAgICAgICAgaGFuZGxlU2V0U3BhbihNT0RFX1NJWkUpOwotICAgICAgICB9Ci0KLSAgICAgICAgcHJpdmF0ZSB2b2lkIGhhbmRsZUNvbG9yKCkgewotICAgICAgICAgICAgaGFuZGxlU2V0U3BhbihNT0RFX0NPTE9SKTsKLSAgICAgICAgfQotCi0gICAgICAgIHByaXZhdGUgdm9pZCBoYW5kbGVBbGlnbigpIHsKLSAgICAgICAgICAgIGhhbmRsZVNldFNwYW4oTU9ERV9BTElHTik7Ci0gICAgICAgIH0KLQotICAgICAgICBwcml2YXRlIHZvaWQgaGFuZGxlU2VsZWN0KCkgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gaGFuZGxlU2VsZWN0OiIgKyBtRWRpdEZsYWcgKyAiLCIgKyBtU3RhdGUpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKCFtRWRpdEZsYWcpIHsKLSAgICAgICAgICAgICAgICByZXR1cm47Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAobVN0YXRlID09IFNUQVRFX1NFTEVDVF9PRkYpIHsKLSAgICAgICAgICAgICAgICBpZiAoaXNUZXh0U2VsZWN0ZWQoKSkgewotICAgICAgICAgICAgICAgICAgICBMb2cuZShMT0dfVEFHLCAiU2VsZWN0aW9uIGlzIG9mZiwgYnV0IHNlbGVjdGVkIik7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIHNldFNlbGVjdFN0YXJ0UG9zKCk7Ci0gICAgICAgICAgICAgICAgYmxvY2tTb2Z0S2V5KCk7Ci0gICAgICAgICAgICAgICAgbUVTVC5zZXRIaW50TWVzc2FnZShISU5UX01TR19TRUxFQ1RfRU5EKTsKLSAgICAgICAgICAgIH0gZWxzZSBpZiAobVN0YXRlID09IFNUQVRFX1NFTEVDVF9PTikgewotICAgICAgICAgICAgICAgIGlmIChpc1RleHRTZWxlY3RlZCgpKSB7Ci0gICAgICAgICAgICAgICAgICAgIExvZy5lKExPR19UQUcsICJTZWxlY3Rpb24gbm93IHN0YXJ0LCBidXQgc2VsZWN0ZWQiKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgc2V0U2VsZWN0ZWRFbmRQb3MoKTsKLSAgICAgICAgICAgICAgICBtRVNULnNldEhpbnRNZXNzYWdlKEhJTlRfTVNHX1BVU0hfQ09NUEVURSk7Ci0gICAgICAgICAgICAgICAgZG9OZXh0SGFuZGxlKCk7Ci0gICAgICAgICAgICB9IGVsc2UgaWYgKG1TdGF0ZSA9PSBTVEFURV9TRUxFQ1RFRCkgewotICAgICAgICAgICAgICAgIGlmICghaXNUZXh0U2VsZWN0ZWQoKSkgewotICAgICAgICAgICAgICAgICAgICBMb2cuZShMT0dfVEFHLCAiU2VsZWN0aW9uIGlzIGRvbmUsIGJ1dCBub3Qgc2VsZWN0ZWQiKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgc2V0U2VsZWN0ZWRFbmRQb3MoKTsKLSAgICAgICAgICAgICAgICBkb05leHRIYW5kbGUoKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIHByaXZhdGUgdm9pZCBoYW5kbGVTZWxlY3RBbGwoKSB7Ci0gICAgICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIi0tLSBoYW5kbGVTZWxlY3RBbGwiKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmICghbUVkaXRGbGFnKSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuOwotICAgICAgICA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NlbGVjdGlvbihtQ3VyRW5kLCBtQ3VyU3RhcnQpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBtU3RhdGUgPSBTVEFURV9TRUxFQ1RFRDsKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgTG9nLmUoTE9HX1RBRywKLSAgICAgICAgICAgICAgICAgICAgICAgICJTZWxlY3QgaXMgb24sIGJ1dCBjdXJzb3IgcG9zaXRpb25zIGFyZSBpbGxpZ2FsLjoiCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgbUVTVC5nZXRUZXh0KCkubGVuZ3RoKCkgKyAiLCIgKyBtQ3VyU3RhcnQKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiLCIgKyBtQ3VyRW5kKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIHByaXZhdGUgdm9pZCB1bnNldFNlbGVjdCgpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIG9mZlNlbGVjdCIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaW50IGN1cnJwb3MgPSBtRVNULmdldFNlbGVjdGlvblN0YXJ0KCk7Ci0gICAgICAgICAgICBtRVNULnNldFNlbGVjdGlvbihjdXJycG9zLCBjdXJycG9zKTsKLSAgICAgICAgICAgIG1TdGF0ZSA9IFNUQVRFX1NFTEVDVF9PRkY7Ci0gICAgICAgIH0KLQotICAgICAgICBwcml2YXRlIHZvaWQgc2V0U2VsZWN0U3RhcnRQb3MoKSB7Ci0gICAgICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIi0tLSBzZXRTZWxlY3RTdGFydFBvcyIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgbUN1clN0YXJ0ID0gbUVTVC5nZXRTZWxlY3Rpb25TdGFydCgpOwotICAgICAgICAgICAgbVN0YXRlID0gU1RBVEVfU0VMRUNUX09OOwotICAgICAgICB9Ci0KLSAgICAgICAgcHJpdmF0ZSB2b2lkIHNldFNlbGVjdGVkRW5kUG9zKCkgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gc2V0U2VsZWN0RW5kUG9zOiIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKG1FU1QuZ2V0U2VsZWN0aW9uU3RhcnQoKSA9PSBtQ3VyU3RhcnQpIHsKLSAgICAgICAgICAgICAgICBzZXRTZWxlY3RlZEVuZFBvcyhtRVNULmdldFNlbGVjdGlvbkVuZCgpKTsKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgc2V0U2VsZWN0ZWRFbmRQb3MobUVTVC5nZXRTZWxlY3Rpb25TdGFydCgpKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIHB1YmxpYyB2b2lkIHNldFNlbGVjdGVkRW5kUG9zKGludCBwb3MpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIHNldFNlbGVjdGVkRW5kUG9zOiIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgbUN1ckVuZCA9IHBvczsKLSAgICAgICAgICAgIHNldFNlbGVjdGlvbigpOwotICAgICAgICB9Ci0KLSAgICAgICAgcHJpdmF0ZSBib29sZWFuIGlzVGV4dFNlbGVjdGVkKCkgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gaXNUZXh0U2VsZWN0ZWQ6IiArIG1DdXJTdGFydCArICIsIgotICAgICAgICAgICAgICAgICAgICAgICAgKyBtQ3VyRW5kKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJldHVybiAobUN1clN0YXJ0ICE9IG1DdXJFbmQpCi0gICAgICAgICAgICAgICAgICAgICYmIChtU3RhdGUgPT0gU1RBVEVfU0VMRUNURUQgfHwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBtU3RhdGUgPT0gU1RBVEVfU0VMRUNUX0ZJWCk7Ci0gICAgICAgIH0KLQotICAgICAgICBwcml2YXRlIHZvaWQgc2V0U3R5bGVkVGV4dFNwYW4oT2JqZWN0IHNwYW4sIGludCBzdGFydCwgaW50IGVuZCkgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gc2V0U3R5bGVkVGV4dFNwYW46IiArIG1Nb2RlICsgIiwiCi0gICAgICAgICAgICAgICAgICAgICAgICArIHN0YXJ0ICsgIiwiICsgZW5kKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmIChzdGFydCA8IGVuZCkgewotICAgICAgICAgICAgICAgIG1FU1QuZ2V0VGV4dCgpLnNldFNwYW4oc3Bhbiwgc3RhcnQsIGVuZCwKLSAgICAgICAgICAgICAgICAgICAgICAgIFNwYW5uYWJsZS5TUEFOX0VYQ0xVU0lWRV9FWENMVVNJVkUpOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBtRVNULmdldFRleHQoKS5zZXRTcGFuKHNwYW4sIGVuZCwgc3RhcnQsCi0gICAgICAgICAgICAgICAgICAgICAgICBTcGFubmFibGUuU1BBTl9FWENMVVNJVkVfRVhDTFVTSVZFKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIHByaXZhdGUgdm9pZCBjaGFuZ2VTaXplU2VsZWN0ZWRUZXh0KGludCBzaXplKSB7Ci0gICAgICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIi0tLSBjaGFuZ2VTaXplOiIgKyBzaXplKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHNldFN0eWxlZFRleHRTcGFuKG5ldyBBYnNvbHV0ZVNpemVTcGFuKHNpemUpLAotICAgICAgICAgICAgICAgIG1DdXJTdGFydCwgbUN1ckVuZCk7Ci0gICAgICAgIH0KLQotICAgICAgICBwcml2YXRlIHZvaWQgY2hhbmdlQ29sb3JTZWxlY3RlZFRleHQoaW50IGNvbG9yKSB7Ci0gICAgICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIi0tLSBjaGFuZ2VDb2xvcjoiICsgY29sb3IpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgc2V0U3R5bGVkVGV4dFNwYW4obmV3IEZvcmVncm91bmRDb2xvclNwYW4oY29sb3IpLAotICAgICAgICAgICAgICAgIG1DdXJTdGFydCwgbUN1ckVuZCk7Ci0gICAgICAgIH0KLQotICAgICAgICBwcml2YXRlIHZvaWQgY2hhbmdlQWxpZ24oTGF5b3V0LkFsaWdubWVudCBhbGlnbikgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gY2hhbmdlQWxpZ246IiArIGFsaWduKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHNldFN0eWxlZFRleHRTcGFuKG5ldyBBbGlnbm1lbnRTcGFuLlN0YW5kYXJkKGFsaWduKSwKLSAgICAgICAgICAgICAgICAgICAgZmluZExpbmVTdGFydChtRVNULmdldFRleHQoKSwgbUN1clN0YXJ0KSwKLSAgICAgICAgICAgICAgICAgICAgZmluZExpbmVFbmQobUVTVC5nZXRUZXh0KCksIG1DdXJFbmQpKTsKLSAgICAgICAgfQotCi0gICAgICAgIHByaXZhdGUgaW50IGZpbmRMaW5lU3RhcnQoRWRpdGFibGUgdGV4dCwgaW50IGN1cnJlbnQpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIGZpbmRMaW5lU3RhcnQ6IGN1cnI6IiArIGN1cnJlbnQgKwotICAgICAgICAgICAgICAgICAgICAgICAgIiwgbGVuZ3RoOiIgKyB0ZXh0Lmxlbmd0aCgpKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGludCBwb3MgPSBjdXJyZW50OwotICAgICAgICAgICAgZm9yICg7IHBvcyA+IDA7IHBvcy0tKSB7Ci0gICAgICAgICAgICAgICAgaWYgKHRleHQuY2hhckF0KHBvcyAtIDEpID09ICdcbicpIHsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICAgICAgcmV0dXJuIHBvczsKLSAgICAgICAgfQotCi0gICAgICAgIHByaXZhdGUgdm9pZCBpbnNlcnRJbWFnZVNwYW4oSW1hZ2VTcGFuIHNwYW4pIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIGluc2VydEltYWdlU3BhbiIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKHNwYW4gIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gaW5zZXJ0aW1hZ2VzcGFuOiIgKyBzcGFuLmdldERyYXdhYmxlKCkuZ2V0SW50cmluc2ljSGVpZ2h0KCkgKyAiLCIgKyBzcGFuLmdldERyYXdhYmxlKCkuZ2V0SW50cmluc2ljV2lkdGgoKSk7Ci0gICAgICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIi0tLSBpbnNlcnRpbWFnZXNwYW46IiArIHNwYW4uZ2V0RHJhd2FibGUoKS5nZXRDbGFzcygpKTsKLSAgICAgICAgICAgICAgICBpbnQgY3VycG9zID0gbUVTVC5nZXRTZWxlY3Rpb25TdGFydCgpOwotICAgICAgICAgICAgICAgIG1FU1QuZ2V0VGV4dCgpLmluc2VydChjdXJwb3MsICJcdUZGRkMiKTsKLSAgICAgICAgICAgICAgICBtRVNULmdldFRleHQoKS5zZXRTcGFuKHNwYW4sIGN1cnBvcywgY3VycG9zICsgMSwKLSAgICAgICAgICAgICAgICAgICAgICAgIFNwYW5uYWJsZS5TUEFOX0VYQ0xVU0lWRV9FWENMVVNJVkUpOwotICAgICAgICAgICAgICAgIG1FU1Qubm90aWZ5U3RhdGVDaGFuZ2VkKG1Nb2RlLCBtU3RhdGUpOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBMb2cuZShMT0dfVEFHLCAiLS0tIGluc2VydEltYWdlU3BhbjogbnVsbCBzcGFuIHdhcyBpbnNlcnRlZCIpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgcHJpdmF0ZSBpbnQgZmluZExpbmVFbmQoRWRpdGFibGUgdGV4dCwgaW50IGN1cnJlbnQpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIGZpbmRMaW5lRW5kOiBjdXJyOiIgKyBjdXJyZW50ICsKLSAgICAgICAgICAgICAgICAgICAgICAgICIsIGxlbmd0aDoiICsgdGV4dC5sZW5ndGgoKSk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpbnQgcG9zID0gY3VycmVudDsKLSAgICAgICAgICAgIGZvciAoOyBwb3MgPCB0ZXh0Lmxlbmd0aCgpOyBwb3MrKykgewotICAgICAgICAgICAgICAgIGlmIChwb3MgPiAwICYmIHRleHQuY2hhckF0KHBvcyAtIDEpID09ICdcbicpIHsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICAgICAgcmV0dXJuIHBvczsKLSAgICAgICAgfQotCi0gICAgICAgIHByaXZhdGUgdm9pZCBibG9ja1NvZnRLZXkoKSB7Ci0gICAgICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIi0tLSBibG9ja1NvZnRLZXk6Iik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBJbnB1dE1ldGhvZE1hbmFnZXIgaW1tID0gKElucHV0TWV0aG9kTWFuYWdlcikgbUVTVC5nZXRDb250ZXh0KCkuCi0gICAgICAgICAgICBnZXRTeXN0ZW1TZXJ2aWNlKENvbnRleHQuSU5QVVRfTUVUSE9EX1NFUlZJQ0UpOwotICAgICAgICAgICAgaW1tLmhpZGVTb2Z0SW5wdXRGcm9tV2luZG93KG1FU1QuZ2V0V2luZG93VG9rZW4oKSwgMCk7Ci0gICAgICAgICAgICBtRVNULnNldE9uQ2xpY2tMaXN0ZW5lcigKLSAgICAgICAgICAgICAgICAgICAgbmV3IE9uQ2xpY2tMaXN0ZW5lcigpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIG9uQ2xpY2soVmlldyB2KSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIi0tLSBvbnRyYWNrYmFsbGNsaWNrOiIpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9uRml4U2VsZWN0ZWRJdGVtKCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9KTsKLSAgICAgICAgICAgIG1Tb2Z0S2V5QmxvY2tGbGFnID0gdHJ1ZTsKLSAgICAgICAgfQotCi0gICAgICAgIHByaXZhdGUgdm9pZCB1bmJsb2NrU29mdEtleSgpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIHVuYmxvY2tTb2Z0S2V5OiIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgbUVTVC5zZXRPbkNsaWNrTGlzdGVuZXIobnVsbCk7Ci0gICAgICAgICAgICBtU29mdEtleUJsb2NrRmxhZyA9IGZhbHNlOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgcHJpdmF0ZSBjbGFzcyBTdHlsZWRUZXh0Q29udmVydGVyIHsKLSAgICAgICAgcHJpdmF0ZSBFZGl0U3R5bGVkVGV4dCBtRVNUOwotCi0gICAgICAgIHB1YmxpYyBTdHlsZWRUZXh0Q29udmVydGVyKEVkaXRTdHlsZWRUZXh0IGVzdCkgewotICAgICAgICAgICAgbUVTVCA9IGVzdDsKLSAgICAgICAgfQotCi0gICAgICAgIHB1YmxpYyBTdHJpbmcgZ2V0SHRtbCgpIHsKLSAgICAgICAgICAgIFN0cmluZyBodG1sQm9keSA9IEh0bWwudG9IdG1sKG1FU1QuZ2V0VGV4dCgpKTsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIGdldENvbnZlcnRlZEJvZHk6IiArIGh0bWxCb2R5KTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJldHVybiBodG1sQm9keTsKLSAgICAgICAgfQotCi0gICAgICAgIHB1YmxpYyB2b2lkIGdldFVyaUFycmF5KEFycmF5TGlzdDxVcmk+IHVyaXMsIEVkaXRhYmxlIHRleHQpIHsKLSAgICAgICAgICAgIHVyaXMuY2xlYXIoKTsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIGdldFVyaUFycmF5OiIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaW50IGxlbiA9IHRleHQubGVuZ3RoKCk7Ci0gICAgICAgICAgICBpbnQgbmV4dDsKLSAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgdGV4dC5sZW5ndGgoKTsgaSA9IG5leHQpIHsKLSAgICAgICAgICAgICAgICBuZXh0ID0gdGV4dC5uZXh0U3BhblRyYW5zaXRpb24oaSwgbGVuLCBJbWFnZVNwYW4uY2xhc3MpOwotICAgICAgICAgICAgICAgIEltYWdlU3BhbltdIGltYWdlcyA9IHRleHQuZ2V0U3BhbnMoaSwgbmV4dCwgSW1hZ2VTcGFuLmNsYXNzKTsKLSAgICAgICAgICAgICAgICBmb3IgKGludCBqID0gMDsgaiA8IGltYWdlcy5sZW5ndGg7IGorKykgewotICAgICAgICAgICAgICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIGdldFVyaUFycmF5OiBmb3VuZEFycmF5IiArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICgoSW1hZ2VTcGFuKSBpbWFnZXNbal0pLmdldFNvdXJjZSgpKTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICB1cmlzLmFkZChVcmkucGFyc2UoCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgKChJbWFnZVNwYW4pIGltYWdlc1tqXSkuZ2V0U291cmNlKCkpKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgdm9pZCBTZXRIdG1sIChTdHJpbmcgaHRtbCkgewotICAgICAgICAgICAgZmluYWwgU3Bhbm5lZCBzcGFubmVkID0gSHRtbC5mcm9tSHRtbChodG1sLCBuZXcgSHRtbC5JbWFnZUdldHRlcigpIHsKLSAgICAgICAgICAgICAgICBwdWJsaWMgRHJhd2FibGUgZ2V0RHJhd2FibGUoU3RyaW5nIHNyYykgewotICAgICAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIHNldGh0bWw6IHNyYz0iK3NyYyk7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChzcmMuc3RhcnRzV2l0aCgiY29udGVudDovLyIpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBVcmkgdXJpID0gVXJpLnBhcnNlKHNyYyk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB0cnkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIElucHV0U3RyZWFtIGlzID0gbUVTVC5nZXRDb250ZXh0KCkuZ2V0Q29udGVudFJlc29sdmVyKCkub3BlbklucHV0U3RyZWFtKHVyaSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgQml0bWFwIGJpdG1hcCA9IEJpdG1hcEZhY3RvcnkuZGVjb2RlU3RyZWFtKGlzKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBEcmF3YWJsZSBkcmF3YWJsZSA9IG5ldyBCaXRtYXBEcmF3YWJsZSgKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldENvbnRleHQoKS5nZXRSZXNvdXJjZXMoKSwgYml0bWFwKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBkcmF3YWJsZS5zZXRCb3VuZHMoMCwgMCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRyYXdhYmxlLmdldEludHJpbnNpY1dpZHRoKCksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkcmF3YWJsZS5nZXRJbnRyaW5zaWNIZWlnaHQoKSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaXMuY2xvc2UoKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZHJhd2FibGU7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChFeGNlcHRpb24gZSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIExvZy5lKExPR19UQUcsICItLS0gc2V0IGh0bWw6IEZhaWxlZCB0byBsb2FkZWQgY29udGVudCAiICsgdXJpLCBlKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiICB1bmtub3duIHNyYz0iK3NyYyk7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICA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3JUaXRsZSA9IGNvbG9ydGl0bGU7Ci0gICAgICAgICAgICBtQ29sb3JOYW1lcyA9IGNvbG9ybmFtZXM7Ci0gICAgICAgICAgICBtQ29sb3JJbnRzID0gY29sb3JpbnRzOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIHZvaWQgc2V0U2l6ZUFsZXJ0UGFyYW1zKENoYXJTZXF1ZW5jZSBzaXpldGl0bGUsCi0gICAgICAgICAgICAgICAgQ2hhclNlcXVlbmNlW10gc2l6ZW5hbWVzLCBDaGFyU2VxdWVuY2VbXSBzaXplZGlzcGxheWludHMsCi0gICAgICAgICAgICAgICAgQ2hhclNlcXVlbmNlW10gc2l6ZXNlbmRpbnRzKSB7Ci0gICAgICAgICAgICBtU2l6ZVRpdGxlID0gc2l6ZXRpdGxlOwotICAgICAgICAgICAgbVNpemVOYW1lcyA9IHNpemVuYW1lczsKLSAgICAgICAgICAgIG1TaXplRGlzcGxheUludHMgPSBzaXplZGlzcGxheWludHM7Ci0gICAgICAgICAgICBtU2l6ZVNlbmRJbnRzID0gc2l6ZXNlbmRpbnRzOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIHZvaWQgc2V0QWxpZ25BbGVydFBhcmFtcyhDaGFyU2VxdWVuY2UgYWxpZ250aXRsZSwKLSAgICAgICAgICAgICAgICBDaGFyU2VxdWVuY2VbXSBhbGlnbm5hbWVzKSB7Ci0gICAgICAgICAgICBtQWxpZ25UaXRsZSA9IGFsaWdudGl0bGU7Ci0gICAgICAgICAgICBtQWxpZ25OYW1lcyA9IGFsaWdubmFtZXM7Ci0gICAgICAgIH0KLQotICAgICAgICBwcml2YXRlIGJvb2xlYW4gY2hlY2tDb2xvckFsZXJ0UGFyYW1zKCkgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gY2hlY2tQYXJhbXMiKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmIChtQnVpbGRlciA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgTG9nLmUoTE9HX1RBRywgIi0tLSBidWlsZGVyIGlzIG51bGwuIik7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICAgICAgfSBlbHNlIGlmIChtQ29sb3JUaXRsZSA9PSBudWxsIHx8IG1Db2xvck5hbWVzID09IG51bGwKLSAgICAgICAgICAgICAgICAgICAgfHwgbUNvbG9ySW50cyA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgTG9nLmUoTE9HX1RBRywgIi0tLSBjb2xvciBhbGVydCBwYXJhbXMgYXJlIG51bGwuIik7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICAgICAgfSBlbHNlIGlmIChtQ29sb3JOYW1lcy5sZW5ndGggIT0gbUNvbG9ySW50cy5sZW5ndGgpIHsKLSAgICAgICAgICAgICAgICBMb2cuZShMT0dfVEFHLCAiLS0tIHRoZSBsZW5ndGggb2YgY29sb3IgYWxlcnQgcGFyYW1zIGFyZSAiCi0gICAgICAgICAgICAgICAgICAgICAgICArICJkaWZmZXJlbnQuIik7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgcmV0dXJuIHRydWU7Ci0gICAgICAgIH0KLQotICAgICAgICBwcml2YXRlIGJvb2xlYW4gY2hlY2tTaXplQWxlcnRQYXJhbXMoKSB7Ci0gICAgICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIi0tLSBjaGVja1BhcmFtcyIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKG1CdWlsZGVyID09IG51bGwpIHsKLSAgICAgICAgICAgICAgICBMb2cuZShMT0dfVEFHLCAiLS0tIGJ1aWxkZXIgaXMgbnVsbC4iKTsKLSAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgICAgICB9IGVsc2UgaWYgKG1TaXplVGl0bGUgPT0gbnVsbCB8fCBtU2l6ZU5hbWVzID09IG51bGwKLSAgICAgICAgICAgICAgICAgICAgfHwgbVNpemVEaXNwbGF5SW50cyA9PSBudWxsIHx8IG1TaXplU2VuZEludHMgPT0gbnVsbCkgewotICAgICAgICAgICAgICAgIExvZy5lKExPR19UQUcsICItLS0gc2l6ZSBhbGVydCBwYXJhbXMgYXJlIG51bGwuIik7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICAgICAgfSBlbHNlIGlmIChtU2l6ZU5hbWVzLmxlbmd0aCAhPSBtU2l6ZURpc3BsYXlJbnRzLmxlbmd0aAotICAgICAgICAgICAgICAgICAgICAmJiBtU2l6ZVNlbmRJbnRzLmxlbmd0aCAhPSBtU2l6ZURpc3BsYXlJbnRzLmxlbmd0aCkgewotICAgICAgICAgICAgICAgIExvZy5lKExPR19UQUcsICItLS0gdGhlIGxlbmd0aCBvZiBzaXplIGFsZXJ0IHBhcmFtcyBhcmUgIgotICAgICAgICAgICAgICAgICAgICAgICAgKyAiZGlmZmVyZW50LiIpOwotICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICB9Ci0KLSAgICAgICAgcHJpdmF0ZSBib29sZWFuIGNoZWNrQWxpZ25BbGVydFBhcmFtcygpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIGNoZWNrQWxpZ25BbGVydFBhcmFtcyIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKG1CdWlsZGVyID09IG51bGwpIHsKLSAgICAgICAgICAgICAgICBMb2cuZShMT0dfVEFHLCAiLS0tIGJ1aWxkZXIgaXMgbnVsbC4iKTsKLSAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgICAgICB9IGVsc2UgaWYgKG1BbGlnblRpdGxlID09IG51bGwpIHsKLSAgICAgICAgICAgICAgICBMb2cuZShMT0dfVEFHLCAiLS0tIGFsaWduIGFsZXJ0IHBhcmFtcyBhcmUgbnVsbC4iKTsKLSAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICByZXR1cm4gdHJ1ZTsKLSAgICAgICAgfQotCi0gICAgICAgIHByaXZhdGUgdm9pZCBvblNob3dGb3JlZ3JvdW5kQ29sb3JBbGVydERpYWxvZygpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIG9uU2hvd0ZvcmVncm91bmRDb2xvckFsZXJ0RGlhbG9nIik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAoIWNoZWNrQ29sb3JBbGVydFBhcmFtcygpKSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgbUJ1aWxkZXIuc2V0VGl0bGUobUNvbG9yVGl0bGUpOwotICAgICAgICAgICAgbUJ1aWxkZXIuc2V0SWNvbigwKTsKLSAgICAgICAgICAgIG1CdWlsZGVyLgotICAgICAgICAgICAgc2V0SXRlbXMobUNvbG9yTmFtZXMsCi0gICAgICAgICAgICAgICAgICAgIG5ldyBEaWFsb2dJbnRlcmZhY2UuT25DbGlja0xpc3RlbmVyKCkgewotICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIG9uQ2xpY2soRGlhbG9nSW50ZXJmYWNlIGRpYWxvZywgaW50IHdoaWNoKSB7Ci0gICAgICAgICAgICAgICAgICAgIExvZy5kKCJFRVRWTSIsICJtQnVpbGRlci5vbmNsaWNrOiIgKyB3aGljaCk7Ci0gICAgICAgICAgICAgICAgICAgIGludCBjb2xvciA9IEludGVnZXIucGFyc2VJbnQoCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgKFN0cmluZykgbUNvbG9ySW50c1t3aGljaF0sIDE2KSAtIDB4MDEwMDAwMDA7Ci0gICAgICAgICAgICAgICAgICAgIG1FU1Quc2V0SXRlbUNvbG9yKGNvbG9yKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9KTsKLSAgICAgICAgICAgIG1CdWlsZGVyLnNob3coKTsKLSAgICAgICAgfQotCi0gICAgICAgIHByaXZhdGUgdm9pZCBvblNob3dCYWNrZ3JvdW5kQ29sb3JBbGVydERpYWxvZygpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIG9uU2hvd0JhY2tncm91bmRDb2xvckFsZXJ0RGlhbG9nIik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAoIWNoZWNrQ29sb3JBbGVydFBhcmFtcygpKSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgbUJ1aWxkZXIuc2V0VGl0bGUobUNvbG9yVGl0bGUpOwotICAgICAgICAgICAgbUJ1aWxkZXIuc2V0SWNvbigwKTsKLSAgICAgICAgICAgIG1CdWlsZGVyLgotICAgICAgICAgICAgc2V0SXRlbXMobUNvbG9yTmFtZXMsCi0gICAgICAgICAgICAgICAgICAgIG5ldyBEaWFsb2dJbnRlcmZhY2UuT25DbGlja0xpc3RlbmVyKCkgewotICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIG9uQ2xpY2soRGlhbG9nSW50ZXJmYWNlIGRpYWxvZywgaW50IHdoaWNoKSB7Ci0gICAgICAgICAgICAgICAgICAgIExvZy5kKCJFRVRWTSIsICJtQnVpbGRlci5vbmNsaWNrOiIgKyB3aGljaCk7Ci0gICAgICAgICAgICAgICAgICAgIGludCBjb2xvciA9IEludGVnZXIucGFyc2VJbnQoCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgKFN0cmluZykgbUNvbG9ySW50c1t3aGljaF0sIDE2KSAtIDB4MDEwMDAwMDA7Ci0gICAgICAgICAgICAgICAgICAgIG1FU1Quc2V0QmFja2dyb3VuZENvbG9yKGNvbG9yKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9KTsKLSAgICAgICAgICAgIG1CdWlsZGVyLnNob3coKTsKLSAgICAgICAgfQotCi0gICAgICAgIHByaXZhdGUgdm9pZCBvblNob3dTaXplQWxlcnREaWFsb2coKSB7Ci0gICAgICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIi0tLSBvblNob3dTaXplQWxlcnREaWFsb2ciKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmICghY2hlY2tTaXplQWxlcnRQYXJhbXMoKSkgewotICAgICAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIG1CdWlsZGVyLnNldFRpdGxlKG1TaXplVGl0bGUpOwotICAgICAgICAgICAgbUJ1aWxkZXIuc2V0SWNvbigwKTsKLSAgICAgICAgICAgIG1CdWlsZGVyLgotICAgICAgICAgICAgc2V0SXRlbXMobVNpemVOYW1lcywKLSAgICAgICAgICAgICAgICAgICAgbmV3IERpYWxvZ0ludGVyZmFjZS5PbkNsaWNrTGlzdGVuZXIoKSB7Ci0gICAgICAgICAgICAgICAgcHVibGljIHZvaWQgb25DbGljayhEaWFsb2dJbnRlcmZhY2UgZGlhbG9nLCBpbnQgd2hpY2gpIHsKLSAgICAgICAgICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIm1CdWlsZGVyLm9uY2xpY2s6IiArIHdoaWNoKTsKLSAgICAgICAgICAgICAgICAgICAgaW50IHNpemUgPSBJbnRlZ2VyCi0gICAgICAgICAgICAgICAgICAgIC5wYXJzZUludCgoU3RyaW5nKSBtU2l6ZURpc3BsYXlJbnRzW3doaWNoXSk7Ci0gICAgICAgICAgICAgICAgICAgIG1FU1Quc2V0SXRlbVNpemUoc2l6ZSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfSk7Ci0gICAgICAgICAgICBtQnVpbGRlci5zaG93KCk7Ci0gICAgICAgIH0KLQotICAgICAgICBwcml2YXRlIHZvaWQgb25TaG93QWxpZ25BbGVydERpYWxvZygpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIG9uU2hvd0FsaWduQWxlcnREaWFsb2ciKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGlmICghY2hlY2tBbGlnbkFsZXJ0UGFyYW1zKCkpIHsKLSAgICAgICAgICAgICAgICByZXR1cm47Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBtQnVpbGRlci5zZXRUaXRsZShtQWxpZ25UaXRsZSk7Ci0gICAgICAgICAgICBtQnVpbGRlci5zZXRJY29uKDApOwotICAgICAgICAgICAgbUJ1aWxkZXIuCi0gICAgICAgICAgICBzZXRJdGVtcyhtQWxpZ25OYW1lcywKLSAgICAgICAgICAgICAgICAgICAgbmV3IERpYWxvZ0ludGVyZmFjZS5PbkNsaWNrTGlzdGVuZXIoKSB7Ci0gICAgICAgICAgICAgICAgcHVibGljIHZvaWQgb25DbGljayhEaWFsb2dJbnRlcmZhY2UgZGlhbG9nLCBpbnQgd2hpY2gpIHsKLSAgICAgICAgICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIm1CdWlsZGVyLm9uY2xpY2s6IiArIHdoaWNoKTsKLSAgICAgICAgICAgICAgICAgICAgTGF5b3V0LkFsaWdubWVudCBhbGlnbiA9IExheW91dC5BbGlnbm1lbnQuQUxJR05fTk9STUFMOwotICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKHdoaWNoKSB7Ci0gICAgICAgICAgICAgICAgICAgIGNhc2UgMDoKLSAgICAgICAgICAgICAgICAgICAgICAgIGFsaWduID0gTGF5b3V0LkFsaWdubWVudC5BTElHTl9OT1JNQUw7Ci0gICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICAgICAgY2FzZSAxOgotICAgICAgICAgICAgICAgICAgICAgICAgYWxpZ24gPSBMYXlvdXQuQWxpZ25tZW50LkFMSUdOX0NFTlRFUjsKLSAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgICAgICBjYXNlIDI6Ci0gICAgICAgICAgICAgICAgICAgICAgICBhbGlnbiA9IExheW91dC5BbGlnbm1lbnQuQUxJR05fT1BQT1NJVEU7Ci0gICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKLSAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIG1FU1Quc2V0QWxpZ25tZW50KGFsaWduKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9KTsKLSAgICAgICAgICAgIG1CdWlsZGVyLnNob3coKTsKLSAgICAgICAgfQotICAgIH0KLQotICAgIHByaXZhdGUgY2xhc3MgU3R5bGVkVGV4dEFycm93S2V5TWV0aG9kIGV4dGVuZHMgQXJyb3dLZXlNb3ZlbWVudE1ldGhvZCB7Ci0gICAgICAgIEVkaXRvck1hbmFnZXIgbU1hbmFnZXI7Ci0gICAgICAgIFN0eWxlZFRleHRBcnJvd0tleU1ldGhvZChFZGl0b3JNYW5hZ2VyIG1hbmFnZXIpIHsKLSAgICAgICAgICAgIHN1cGVyKCk7Ci0gICAgICAgICAgICBtTWFuYWdlciA9IG1hbmFnZXI7Ci0gICAgICAgIH0KLQotICAgICAgICBAT3ZlcnJpZGUKLSAgICAgICAgcHVibGljIGJvb2xlYW4gb25LZXlEb3duKFRleHRWaWV3IHdpZGdldCwgU3Bhbm5hYmxlIGJ1ZmZlciwKLSAgICAgICAgICAgICAgICBpbnQga2V5Q29kZSwgS2V5RXZlbnQgZXZlbnQpIHsKLSAgICAgICAgICAgIGlmICghbU1hbmFnZXIuaXNTb2Z0S2V5QmxvY2tlZCgpKSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIHN1cGVyLm9uS2V5RG93bih3aWRnZXQsIGJ1ZmZlciwga2V5Q29kZSwgZXZlbnQpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKGV4ZWN1dGVEb3duKHdpZGdldCwgYnVmZmVyLCBrZXlDb2RlKSkgewotICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICB9Ci0KLSAgICAgICAgcHJpdmF0ZSBpbnQgZ2V0RW5kUG9zKFRleHRWaWV3IHdpZGdldCkgewotICAgICAgICAgICAgaW50IGVuZDsKLSAgICAgICAgICAgIGlmICh3aWRnZXQuZ2V0U2VsZWN0aW9uU3RhcnQoKSA9PSBtTWFuYWdlci5nZXRTZWxlY3Rpb25TdGFydCgpKSB7Ci0gICAgICAgICAgICAgICAgZW5kID0gd2lkZ2V0LmdldFNlbGVjdGlvbkVuZCgpOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBlbmQgPSB3aWRnZXQuZ2V0U2VsZWN0aW9uU3RhcnQoKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJldHVybiBlbmQ7Ci0gICAgICAgIH0KLQotICAgICAgICBwcml2YXRlIGJvb2xlYW4gdXAoVGV4dFZpZXcgd2lkZ2V0LCBTcGFubmFibGUgYnVmZmVyKSB7Ci0gICAgICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIi0tLSB1cDoiKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIExheW91dCBsYXlvdXQgPSB3aWRnZXQuZ2V0TGF5b3V0KCk7Ci0gICAgICAgICAgICBpbnQgZW5kID0gZ2V0RW5kUG9zKHdpZGdldCk7Ci0gICAgICAgICAgICBpbnQgbGluZSA9IGxheW91dC5nZXRMaW5lRm9yT2Zmc2V0KGVuZCk7Ci0gICAgICAgICAgICBpZiAobGluZSA+IDApIHsKLSAgICAgICAgICAgICAgICBpbnQgdG87Ci0gICAgICAgICAgICAgICAgaWYgKGxheW91dC5nZXRQYXJhZ3JhcGhEaXJlY3Rpb24obGluZSkgPT0KLSAgICAgICAgICAgICAgICAgICAgbGF5b3V0LmdldFBhcmFncmFwaERpcmVjdGlvbihsaW5lIC0gMSkpIHsKLSAgICAgICAgICAgICAgICAgICAgZmxvYXQgaCA9IGxheW91dC5nZXRQcmltYXJ5SG9yaXpvbnRhbChlbmQpOwotICAgICAgICAgICAgICAgICAgICB0byA9IGxheW91dC5nZXRPZmZzZXRGb3JIb3Jpem9udGFsKGxpbmUgLSAxLCBoKTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICB0byA9IGxheW91dC5nZXRMaW5lU3RhcnQobGluZSAtIDEpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBtTWFuYWdlci5zZXRTZWxlY3RlZEVuZFBvcyh0byk7Ci0gICAgICAgICAgICAgICAgbU1hbmFnZXIub25DdXJzb3JNb3ZlZCgpOwotICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICB9Ci0KLSAgICAgICAgcHJpdmF0ZSBib29sZWFuIGRvd24oVGV4dFZpZXcgd2lkZ2V0LCBTcGFubmFibGUgYnVmZmVyKSB7Ci0gICAgICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIi0tLSBkb3duOiIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgTGF5b3V0IGxheW91dCA9IHdpZGdldC5nZXRMYXlvdXQoKTsKLSAgICAgICAgICAgIGludCBlbmQgPSBnZXRFbmRQb3Mod2lkZ2V0KTsKLSAgICAgICAgICAgIGludCBsaW5lID0gbGF5b3V0LmdldExpbmVGb3JPZmZzZXQoZW5kKTsKLSAgICAgICAgICAgIGlmIChsaW5lIDwgbGF5b3V0LmdldExpbmVDb3VudCgpIC0gMSkgewotICAgICAgICAgICAgICAgIGludCB0bzsKLSAgICAgICAgICAgICAgICBpZiAobGF5b3V0LmdldFBhcmFncmFwaERpcmVjdGlvbihsaW5lKSA9PQotICAgICAgICAgICAgICAgICAgICBsYXlvdXQuZ2V0UGFyYWdyYXBoRGlyZWN0aW9uKGxpbmUgKyAxKSkgewotICAgICAgICAgICAgICAgICAgICBmbG9hdCBoID0gbGF5b3V0LmdldFByaW1hcnlIb3Jpem9udGFsKGVuZCk7Ci0gICAgICAgICAgICAgICAgICAgIHRvID0gbGF5b3V0LmdldE9mZnNldEZvckhvcml6b250YWwobGluZSArIDEsIGgpOwotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIHRvID0gbGF5b3V0LmdldExpbmVTdGFydChsaW5lICsgMSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIG1NYW5hZ2VyLnNldFNlbGVjdGVkRW5kUG9zKHRvKTsKLSAgICAgICAgICAgICAgICBtTWFuYWdlci5vbkN1cnNvck1vdmVkKCk7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgIH0KLQotICAgICAgICBwcml2YXRlIGJvb2xlYW4gbGVmdChUZXh0VmlldyB3aWRnZXQsIFNwYW5uYWJsZSBidWZmZXIpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIGxlZnQ6Iik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBMYXlvdXQgbGF5b3V0ID0gd2lkZ2V0LmdldExheW91dCgpOwotICAgICAgICAgICAgaW50IHRvID0gbGF5b3V0LmdldE9mZnNldFRvTGVmdE9mKGdldEVuZFBvcyh3aWRnZXQpKTsKLSAgICAgICAgICAgIG1NYW5hZ2VyLnNldFNlbGVjdGVkRW5kUG9zKHRvKTsKLSAgICAgICAgICAgIG1NYW5hZ2VyLm9uQ3Vyc29yTW92ZWQoKTsKLSAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICB9Ci0KLSAgICAgICAgcHJpdmF0ZSBib29sZWFuIHJpZ2h0KFRleHRWaWV3IHdpZGdldCwgU3Bhbm5hYmxlIGJ1ZmZlcikgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gcmlnaHQ6Iik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBMYXlvdXQgbGF5b3V0ID0gd2lkZ2V0LmdldExheW91dCgpOwotICAgICAgICAgICAgaW50IHRvID0gbGF5b3V0LmdldE9mZnNldFRvUmlnaHRPZihnZXRFbmRQb3Mod2lkZ2V0KSk7Ci0gICAgICAgICAgICBtTWFuYWdlci5zZXRTZWxlY3RlZEVuZFBvcyh0byk7Ci0gICAgICAgICAgICBtTWFuYWdlci5vbkN1cnNvck1vdmVkKCk7Ci0gICAgICAgICAgICByZXR1cm4gdHJ1ZTsKLSAgICAgICAgfQotCi0gICAgICAgIHByaXZhdGUgYm9vbGVhbiBleGVjdXRlRG93bihUZXh0VmlldyB3aWRnZXQsIFNwYW5uYWJsZSBidWZmZXIsCi0gICAgICAgICAgICAgICAgaW50IGtleUNvZGUpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIGV4ZWN1dGVEb3duOiAiICsga2V5Q29kZSk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBib29sZWFuIGhhbmRsZWQgPSBmYWxzZTsKLQotICAgICAgICAgICAgc3dpdGNoIChrZXlDb2RlKSB7Ci0gICAgICAgICAgICBjYXNlIEtleUV2ZW50LktFWUNPREVfRFBBRF9VUDoKLSAgICAgICAgICAgICAgICBoYW5kbGVkIHw9IHVwKHdpZGdldCwgYnVmZmVyKTsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIGNhc2UgS2V5RXZlbnQuS0VZQ09ERV9EUEFEX0RPV046Ci0gICAgICAgICAgICAgICAgaGFuZGxlZCB8PSBkb3duKHdpZGdldCwgYnVmZmVyKTsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIGNhc2UgS2V5RXZlbnQuS0VZQ09ERV9EUEFEX0xFRlQ6Ci0gICAgICAgICAgICAgICAgaGFuZGxlZCB8PSBsZWZ0KHdpZGdldCwgYnVmZmVyKTsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIGNhc2UgS2V5RXZlbnQuS0VZQ09ERV9EUEFEX1JJR0hUOgotICAgICAgICAgICAgICAgIGhhbmRsZWQgfD0gcmlnaHQod2lkZ2V0LCBidWZmZXIpOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgIGNhc2UgS2V5RXZlbnQuS0VZQ09ERV9EUEFEX0NFTlRFUjoKLSAgICAgICAgICAgICAgICAgICAgbU1hbmFnZXIub25GaXhTZWxlY3RlZEl0ZW0oKTsKLSAgICAgICAgICAgICAgICAgICAgaGFuZGxlZCA9IHRydWU7Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgcmV0dXJuIGhhbmRsZWQ7Ci0gICAgICAgIH0KLSAgICB9Ci0KLSAgICBwdWJsaWMgY2xhc3MgSG9yaXpvbnRhbExpbmVTcGFuIGV4dGVuZHMgSW1hZ2VTcGFuIHsKLSAgICAgICAgcHVibGljIEhvcml6b250YWxMaW5lU3BhbihpbnQgY29sb3IsIFZpZXcgdmlldykgewotICAgICAgICAgICAgc3VwZXIobmV3IEhvcml6b250YWxMaW5lRHJhd2FibGUoY29sb3IsIHZpZXcpKTsKLSAgICAgICAgfQotICAgIH0KLSAgICBwdWJsaWMgY2xhc3MgSG9yaXpvbnRhbExpbmVEcmF3YWJsZSBleHRlbmRzIFNoYXBlRHJhd2FibGUgewotICAgICAgICBwcml2YXRlIFZpZXcgbVZpZXc7Ci0gICAgICAgIHB1YmxpYyBIb3Jpem9udGFsTGluZURyYXdhYmxlKGludCBjb2xvciwgVmlldyB2aWV3KSB7Ci0gICAgICAgICAgICBzdXBlcihuZXcgUmVjdFNoYXBlKCkpOwotICAgICAgICAgICAgbVZpZXcgPSB2aWV3OwotICAgICAgICAgICAgcmVuZXdDb2xvcihjb2xvcik7Ci0gICAgICAgICAgICByZW5ld0JvdW5kcyh2aWV3KTsKLSAgICAgICAgfQotICAgICAgICBAT3ZlcnJpZGUKLSAgICAgICAgcHVibGljIHZvaWQgZHJhdyhDYW52YXMgY2FudmFzKSB7Ci0gICAgICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIi0tLSBkcmF3OiIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgcmVuZXdDb2xvcigpOwotICAgICAgICAgICAgcmVuZXdCb3VuZHMobVZpZXcpOwotICAgICAgICAgICAgc3VwZXIuZHJhdyhjYW52YXMpOwotICAgICAgICB9Ci0KLSAgICAgICAgcHJpdmF0ZSB2b2lkIHJlbmV3Qm91bmRzKFZpZXcgdmlldykgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIGludCB3aWR0aCA9IG1WaWV3LmdldEJhY2tncm91bmQoKS5nZXRCb3VuZHMoKS53aWR0aCgpOwotICAgICAgICAgICAgICAgIGludCBoZWlnaHQgPSBtVmlldy5nZXRCYWNrZ3JvdW5kKCkuZ2V0Qm91bmRzKCkuaGVpZ2h0KCk7Ci0gICAgICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIi0tLSByZW5ld0JvdW5kczoiICsgd2lkdGggKyAiLCIgKyBoZWlnaHQpOwotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gcmVuZXdCb3VuZHM6IiArIG1WaWV3LmdldENsYXNzKCkpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaW50IHdpZHRoID0gbVZpZXcuZ2V0V2lkdGgoKTsKLSAgICAgICAgICAgIGlmICh3aWR0aCA+IDIwKSB7Ci0gICAgICAgICAgICAgICAgd2lkdGggLT0gMjA7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBzZXRCb3VuZHMoMCwgMCwgd2lkdGgsIDIpOwotICAgICAgICB9Ci0gICAgICAgIHByaXZhdGUgdm9pZCByZW5ld0NvbG9yKGludCBjb2xvcikgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIExvZy5kKExPR19UQUcsICItLS0gcmVuZXdDb2xvcjoiICsgY29sb3IpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZ2V0UGFpbnQoKS5zZXRDb2xvcihjb2xvcik7Ci0gICAgICAgIH0KLSAgICAgICAgcHJpdmF0ZSB2b2lkIHJlbmV3Q29sb3IoKSB7Ci0gICAgICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIi0tLSByZW5ld0NvbG9yOiIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKG1WaWV3IGluc3RhbmNlb2YgVmlldykgewotICAgICAgICAgICAgICAgIEltYWdlU3BhbiBwYXJlbnQgPSBnZXRQYXJlbnRTcGFuKCk7Ci0gICAgICAgICAgICAgICAgRWRpdGFibGUgdGV4dCA9ICgoRWRpdFN0eWxlZFRleHQpbVZpZXcpLmdldFRleHQoKTsKLSAgICAgICAgICAgICAgICBpbnQgc3RhcnQgPSB0ZXh0LmdldFNwYW5TdGFydChwYXJlbnQpOwotICAgICAgICAgICAgICAgIEZvcmVncm91bmRDb2xvclNwYW5bXSBzcGFucyA9IHRleHQuZ2V0U3BhbnMoc3RhcnQsIHN0YXJ0LCBGb3JlZ3JvdW5kQ29sb3JTcGFuLmNsYXNzKTsKLSAgICAgICAgICAgICAgICBpZiAoc3BhbnMubGVuZ3RoID4gMCkgewotICAgICAgICAgICAgICAgICAgICByZW5ld0NvbG9yKHNwYW5zW3NwYW5zLmxlbmd0aCAtIDFdLmdldEZvcmVncm91bmRDb2xvcigpKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICAgICAgcHJpdmF0ZSBJbWFnZVNwYW4gZ2V0UGFyZW50U3BhbigpIHsKLSAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiLS0tIGdldFBhcmVudFNwYW46Iik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAobVZpZXcgaW5zdGFuY2VvZiBFZGl0U3R5bGVkVGV4dCkgewotICAgICAgICAgICAgICAgIEVkaXRhYmxlIHRleHQgPSAoKEVkaXRTdHlsZWRUZXh0KW1WaWV3KS5nZXRUZXh0KCk7Ci0gICAgICAgICAgICAgICAgSW1hZ2VTcGFuW10gaW1hZ2VzID0gdGV4dC5nZXRTcGFucygwLCB0ZXh0Lmxlbmd0aCgpLCBJbWFnZVNwYW4uY2xhc3MpOwotICAgICAgICAgICAgICAgIGlmIChpbWFnZXMubGVuZ3RoID4gMCkgewotICAgICAgICAgICAgICAgICAgICBmb3IgKEltYWdlU3BhbiBpbWFnZTogaW1hZ2VzKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoaW1hZ2UuZ2V0RHJhd2FibGUoKSA9PSB0aGlzKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGltYWdlOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgIC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vcmRIYXNoTGVuZ3RoICogcGFzc3dvcmRIaXN0b3J5TGVuZ3RoCisgICAgICAgICAgICAgICAgKyBwYXNzd29yZEhpc3RvcnlMZW5ndGggLSAxOworICAgICAgICBpZiAocGFzc3dvcmRIaXN0b3J5Lmxlbmd0aCgpID4gbmVlZGVkUGFzc3dvcmRIaXN0b3J5TGVuZ3RoKSB7CisgICAgICAgICAgICBwYXNzd29yZEhpc3RvcnkgPSBwYXNzd29yZEhpc3Rvcnkuc3Vic3RyaW5nKDAsIG5lZWRlZFBhc3N3b3JkSGlzdG9yeUxlbmd0aCk7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHBhc3N3b3JkSGlzdG9yeS5jb250YWlucyhwYXNzd29yZEhhc2hTdHJpbmcpOworICAgIH0KKworICAgIC8qKgogICAgICAqIENoZWNrIHRvIHNlZSBpZiB0aGUgdXNlciBoYXMgc3RvcmVkIGEgbG9jayBwYXR0ZXJuLgogICAgICAqIEByZXR1cm4gV2hldGhlciBhIHNhdmVkIHBhdHRlcm4gZXhpc3RzLgogICAgICAqLwpAQCAtMjc5LDYgKzMzNSwxMSBAQAogICAgICAgICAgICAgICAgICAgICBhY3RpdmVQYXNzd29yZFF1YWxpdHkgPSBEZXZpY2VQb2xpY3lNYW5hZ2VyLlBBU1NXT1JEX1FVQUxJVFlfQUxQSEFOVU1FUklDOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgRGV2aWNlUG9saWN5TWFuYWdlci5QQVNTV09SRF9RVUFMSVRZX0NPTVBMRVg6CisgICAgICAgICAgICAgICAgaWYgKGlzTG9ja1Bhc3N3b3JkRW5hYmxlZCgpKSB7CisgICAgICAgICAgICAgICAgICAgIGFjdGl2ZVBhc3N3b3JkUXVhbGl0eSA9IERldmljZVBvbGljeU1hbmFnZXIuUEFTU1dPUkRfUVVBTElUWV9DT01QTEVYOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICA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xlKHNMb2NrUGF0dGVybkZpbGVuYW1lLCAicnciKTsKQEAgLTMxNiwxNCArMzc1LDE1IEBACiAgICAgICAgICAgICBpZiAocGF0dGVybiAhPSBudWxsKSB7CiAgICAgICAgICAgICAgICAgc2V0Qm9vbGVhbihQQVRURVJOX0VWRVJfQ0hPU0VOX0tFWSwgdHJ1ZSk7CiAgICAgICAgICAgICAgICAgc2V0TG9uZyhQQVNTV09SRF9UWVBFX0tFWSwgRGV2aWNlUG9saWN5TWFuYWdlci5QQVNTV09SRF9RVUFMSVRZX1NPTUVUSElORyk7Ci0gICAgICAgICAgICAgICAgZHBtLnNldEFjdGl2ZVBhc3N3b3JkU3RhdGUoCi0gICAgICAgICAgICAgICAgICAgICAgICBEZXZpY2VQb2xpY3lNYW5hZ2VyLlBBU1NXT1JEX1FVQUxJVFlfU09NRVRISU5HLCBwYXR0ZXJuLnNpemUoKSk7CisgICAgICAgICAgICAgICAgZHBtLnNldEFjdGl2ZVBhc3N3b3JkU3RhdGUoRGV2aWNlUG9saWN5TWFuYWdlci5QQVNTV09SRF9RVUFMSVRZX1NPTUVUSElORywgcGF0dGVybgorICAgICAgICAgICAgICAgICAgICAgICAgLnNpemUoKSwgMCwgMCwgMCwgMCwgMCwgMCk7CiAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIGRwbS5zZXRBY3RpdmVQYXNzd29yZFN0YXRlKAotICAgICAgICAgICAgICAgICAgICAgICAgRGV2aWNlUG9saWN5TWFuYWdlci5QQVNTV09SRF9RVUFMSVRZX1VOU1BFQ0lGSUVELCAwKTsKKyAgICAgICAgICAgICAgICBkcG0uc2V0QWN0aXZlUGFzc3dvcmRTdGF0ZShEZXZpY2VQb2xpY3lNYW5hZ2VyLlBBU1NXT1JEX1FVQUxJVFlfVU5TUEVDSUZJRUQsIDAsIDAsCisgICAgICAgICAgICAgICAgICAgICAgICAwLCAwLCAwLCAwLCAwKTsKICAgICAgICAgICAgIH0KICAgICAgICAgfSBjYXRj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ZXRBY3RpdmVQYXNzd29yZFN0YXRlKGNvbXB1dGVkUXVhbGl0eSwgcGFzc3dvcmQubGVuZ3RoKCkpOworICAgICAgICAgICAgICAgICAgICBpbnQgbGV0dGVycyA9IDA7CisgICAgICAgICAgICAgICAgICAgIGludCB1cHBlcmNhc2UgPSAwOworICAgICAgICAgICAgICAgICAgICBpbnQgbG93ZXJjYXNlID0gMDsKKyAgICAgICAgICAgICAgICAgICAgaW50IG51bWJlcnMgPSAwOworICAgICAgICAgICAgICAgICAgICBpbnQgc3ltYm9scyA9IDA7CisgICAgICAgICAgICAgICAgICAgIGludCBub25sZXR0ZXIgPSAwOworICAgICAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IHBhc3N3b3JkLmxlbmd0aCgpOyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNoYXIgYyA9IHBhc3N3b3JkLmNoYXJBdChpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjID49ICdBJyAmJiBjIDw9ICdaJykgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldHRlcnMrKzsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cHBlcmNhc2UrKzsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoYyA+PSAnYScgJiYgYyA8PSAneicpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXR0ZXJzKys7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbG93ZXJjYXNlKys7CisgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGMgPj0gJzAnICYmIGMgPD0gJzknKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVtYmVycysrOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5vbmxldHRlcisrOworICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzeW1ib2xzKys7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbm9ubGV0dGVyKys7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgZHBtLnNldEFjdGl2ZVBhc3N3b3JkU3RhdGUoTWF0aC5tYXgocXVhbGl0eSwgY29tcHV0ZWRRdWFsaXR5KSwgcGFzc3dvcmQKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAubGVuZ3RoKCksIGxldHRlcnMsIHVwcGVyY2FzZSwgbG93ZXJjYXNlLCBudW1iZXJzLCBzeW1ib2xzLCBub25sZXR0ZXIpOwogICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgIC8vIFRoZSBwYXNzd29yZCBpcyBub3QgYW55dGhpbmcuCiAgICAgICAgICAgICAgICAgICAgIGRwbS5zZXRBY3RpdmVQYXNzd29yZFN0YXRlKAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIERldmljZVBvbGljeU1hbmFnZXIuUEFTU1dPUkRfUVVBTElUWV9VTlNQRUNJRklFRCwgMCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgRGV2aWNlUG9saWN5TWFuYWdlci5QQVNTV09SRF9RVUFMSVRZX1VOU1BFQ0lGSUVELCAwLCAwLCAwLCAwLCAwLCAwLCAwKTsKICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgLy8gQWRkIHRoZSBwYXNzd29yZCB0byB0aGUgcGFzc3dvcmQgaGlzdG9yeS4gV2UgYXNzdW1lIGFsbAorICAgICAgICAgICAgICAgIC8vIHBhc3N3b3JkCisgICAgICAgICAgICAgICAgLy8gaGFzaGVzIGhhdmUgdGhlIHNhbWUgbGVuZ3RoIGZvciBzaW1wbGljaXR5IG9mIGltcGxlbWVudGF0aW9uLgorICAgICAgICAgICAgICAgIFN0cmluZyBwYXNzd29yZEhpc3RvcnkgPSBnZXRTdHJpbmcoUEFTU1dPUkRfSElTVE9SWV9LRVkpOworICAgICAgICAgICAgICAgIGlmIChwYXNzd29yZEhpc3RvcnkgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBwYXNzd29yZEhpc3RvcnkgPSBuZXcgU3RyaW5nKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGludCBwYXNzd29yZEhpc3RvcnlMZW5ndGggPSBnZXRSZXF1ZXN0ZWRQYXNzd29yZEhpc3RvcnlMZW5ndGgoKTsKKyAgICAgICAgICAgICAgICBpZiAocGFzc3dvcmRIaXN0b3J5TGVuZ3RoID09IDApIHsKKyAgICAgICAgICAgICAgICAgICAgcGFzc3dvcmRIaXN0b3J5ID0gIiI7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgcGFzc3dvcmRIaXN0b3J5ID0gbmV3IFN0cmluZyhoYXNoKSArICIsIiArIHBhc3N3b3JkSGlzdG9yeTsKKyAgICAgICAgICAgICAgICAgICAgLy8gQ3V0IGl0IHRvIGNvbnRhaW4gcGFzc3dvcmRIaXN0b3J5TGVuZ3RoIGhhc2hlcworICAgICAgICAgICAgICAgICAgICAvLyBhbmQgcGFzc3dvcmRIaXN0b3J5TGVuZ3RoIC0xIGNvbW1hcy4KKyAgICAgICAgICAgICAgICAgICAgcGFzc3dvcmRIaXN0b3J5ID0gcGFzc3dvcmRIaXN0b3J5LnN1YnN0cmluZygwLCBNYXRoLm1pbihoYXNoLmxlbmd0aAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICogcGFzc3dvcmRIaXN0b3J5TGVuZ3RoICsgcGFzc3dvcmRIaXN0b3J5TGVuZ3RoIC0gMSwgcGFzc3dvcmRIaXN0b3J5CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLmxlbmd0aCgpKSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHNldFN0cmluZyhQQVNTV09SRF9ISVNUT1JZX0tFWSwgcGFzc3dvcmRIaXN0b3J5KTsKICAgICAgICAgIC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isgICAgcHVibGljIFBhc3N3b3JkRW50cnlLZXlib2FyZChDb250ZXh0IGNvbnRleHQsIGludCB4bWxMYXlvdXRSZXNJZCwgaW50IHdpZHRoLCBpbnQgaGVpZ2h0KSB7CisgICAgICAgIHRoaXMoY29udGV4dCwgeG1sTGF5b3V0UmVzSWQsIDAsIHdpZHRoLCBoZWlnaHQpOworICAgIH0KKwogICAgIHB1YmxpYyBQYXNzd29yZEVudHJ5S2V5Ym9hcmQoQ29udGV4dCBjb250ZXh0LCBpbnQgeG1sTGF5b3V0UmVzSWQsIGludCBtb2RlKSB7CiAgICAgICAgIHN1cGVyKGNvbnRleHQsIHhtbExheW91dFJlc0lkLCBtb2RlKTsKKyAgICAgICAgaW5pdChjb250ZXh0KTsKKyAgICB9CisKKyAgICBwdWJsaWMgUGFzc3dvcmRFbnRyeUtleWJvYXJkKENvbnRleHQgY29udGV4dCwgaW50IHhtbExheW91dFJlc0lkLCBpbnQgbW9kZSwKKyAgICAgICAgICAgIGludCB3aWR0aCwgaW50IGhlaWdodCkgeworICAgICAgICBzdXBlcihjb250ZXh0LCB4bWxMYXlvdXRSZXNJZCwgbW9kZSwgd2lkdGgsIGhlaWdodCk7CisgICAgICAgIGluaXQoY29udGV4dCk7CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIGluaXQoQ29udGV4dCBjb250ZXh0KSB7CiAgICAgICAgIGZpbmFsIFJlc291cmNlcyByZXMgPSBjb250ZXh0LmdldFJlc291cmNlcygpOwogICAgICAgICBtUmVzID0gcmVzOwogICAgICAgICBtU2hpZnRJY29uID0gcmVzLmdldERyYXdhYmxlKFIuZHJhd2FibGUuc3ltX2tleWJvYXJkX3NoaWZ0KTsKZGlmZiAtLWdpdCBhL2NvcmUvamF2YS9jb20vYW5kcm9pZC9pbnRlcm5hbC93aWRnZXQvUGFzc3dvcmRFbnRyeUtleWJvYXJkSGVscGVyLmphdmEgYi9jb3JlL2phdmEvY29tL2FuZHJvaWQvaW50ZXJuYWwvd2lk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kaW5nVGFiIGNhbm5vdCBoYXZlIFVOU1BFQ0lGSUVEIE1lYXN1cmVTcGVjIgorICAgICAgICAgICAgICAgICAgICAgICAgKyIod3NwZWM9IiArIHdpZHRoU3BlY01vZGUgKyAiLCBoc3BlYz0iICsgaGVpZ2h0U3BlY01vZGUgKyAiKSIsCisgICAgICAgICAgICAgICAgICAgICAgICBuZXcgUnVudGltZUV4Y2VwdGlvbihMT0dfVEFHICsgInN0YWNrOiIpKTsKKyAgICAgICAgICAgIH0KICAgICAgICAgfQogCiAgICAgICAgIG1MZWZ0U2xpZGVyLm1lYXN1cmUoKTsKQEAgLTYwOCwxNCArNjEwLDcgQEAKIAogICAgICAgICAgICAgICAgIGNhc2UgTW90aW9uRXZlbnQuQUNUSU9OX1VQOgogICAgICAgICAgICAgICAgIGNhc2UgTW90aW9uRXZlbnQuQUNUSU9OX0NBTkNFTDoKLSAgICAgICAgICAgICAgICAgICAgbVRyYWNraW5nID0gZmFsc2U7Ci0gICAgICAgICAgICAgICAgICAgIG1UcmlnZ2VyZWQgPSBmYWxzZTsKLSAgICAgICAgICAgICAgICAgICAgbU90aGVyU2xpZGVyLnNob3codHJ1ZSk7Ci0gICAgICAgICAgICAgICAgICAgIG1DdXJyZW50U2xpZGVyLnJlc2V0KGZhbHNlKTsKLSAgICAgICAgICAgICAgICAgICAgbUN1cnJlbnRTbGlkZXIuaGlkZVRhcmdldCgpOwotICAgICAgICAgICAgICAgICAgICBtQ3VycmVudFNsaWRlciA9IG51bGw7Ci0gICAgICAgICAgICAgICAgICAgIG1PdGhlclNsaWRlciA9IG51bGw7Ci0gICAgICAgICAgICAgICAgICAgIHNldEdyYWJiZWRTdGF0ZShPblRyaWdnZXJMaXN0ZW5lci5OT19IQU5ETEUpOworICAgICAgICAgICAgICAgICAgICBjYW5jZWxHcmFiKCk7CiAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgfQogICAgICAgICB9CkBAIC02MjMsNiArNjE4LDE3IEBACi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0ID0gc2l6ZW9mKHdpbmRvd19oZWFkZXJfdCkgKyBST1dfU0xPVF9DSFVOS19TSVpFIC0gc2l6ZW9mKHVpbnQzMl90KTsKLSAgICB1aW50OF90ICogcm93Q2h1bmsgPSBtRGF0YSArIHNpemVvZih3aW5kb3dfaGVhZGVyX3QpOwotTE9HX1dJTkRPVygiQWxsb2NhdGluZyByb3cgc2xvdCwgbUhlYWRlci0+bnVtUm93cyBpcyAlZCwgY2h1bmtOdW0gaXMgJWQsIGNodW5rUG9zIGlzICVkIiwgbUhlYWRlci0+bnVtUm93cywgY2h1bmtOdW0sIGNodW5rUG9zKTsKLSAgICBmb3IgKGludCBpID0gMDsgaSA8IGNodW5rTnVtOyBpKyspIHsKLSAgICAgICAgdWludDMyX3QgbmV4dENodW5rT2Zmc2V0ID0gKigodWludDMyX3QgKikobURhdGEgKyBjaHVua1B0ck9mZnNldCkpOwotTE9HX1dJTkRPVygibmV4dENodW5rT2Zmc2V0IGlzICVkIiwgbmV4dENodW5rT2Zmc2V0KTsKLSAgICAgICAgaWYgKG5leHRDaHVua09mZnNldCA9PSAwKSB7Ci0gICAgICAgICAgICAvLyBBbGxvY2F0ZSBhIG5ldyByb3cgY2h1bmsKLSAgICAgICAgICAgIG5leHRDaHVua09mZnNldCA9IGFsbG9jKFJPV19TTE9UX0NIVU5LX1NJWkUsIHRydWUpOwotICAgICAgICAgICAgaWYgKG5leHRDaHVua09mZnNldCA9PSAwKSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIE5VTEw7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICByb3dDaHVuayA9IG9mZnNldFRvUHRyKG5leHRDaHVua09mZnNldCk7Ci1MT0dfV0lORE9XKCJhbGxvY2F0ZWQgbmV3IGNodW5rIGF0ICVkLCByb3dDaHVuayA9ICVwIiwgbmV4dENodW5rT2Zmc2V0LCByb3dDaHVuayk7Ci0gICAgICAgICAgICAqKCh1aW50MzJfdCAqKShtRGF0YSArIGNodW5rUHRyT2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AgICAgICBnZXROdW1Sb3dzKCkge3JldHVybiBtSGVhZGVyLT5udW1Sb3dzO30KLSAgICB1aW50MzJfdCAgICAgICAgICAgIGdldE51bUNvbHVtbnMoKSB7cmV0dXJuIG1IZWFkZXItPm51bUNvbHVtbnM7fQotICAgIHZvaWQgICAgICAgICAgICAgICAgZnJlZUxhc3RSb3coKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1IZWFkZXItPm51bVJvd3MgPiAwKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1IZWFkZXItPm51bVJvd3MtLTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgYm9vbCAgICAgICAgICAgICAgICBzZXROdW1Db2x1bW5zKHVpbnQzMl90IG51bUNvbHVtbnMpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCBjdXIgPSBtSGVhZGVyLT5udW1Db2x1bW5zOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY3VyID4gMCAmJiBjdXIgIT0gbnVtQ29sdW1ucykgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTE9HRSgiVHJ5aW5nIHRvIGdvIGZyb20gJWQgY29sdW1ucyB0byAlZCIsIGN1ciwgbnVtQ29sdW1ucyk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUhlYWRlci0+bnVtQ29sdW1ucyA9IG51bUNvbHVtbnM7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLQotICAgIGludDMyX3QgICAgICAgICAgICAgZnJlZVNwYWNlKCk7Ci0KLSAgICB2b2lkICAgICAgICAgICAgICAgIGNsZWFyKCk7Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgIC8qKgotICAgICAgICAgICAgICAgICAgICAgICAgICogQWxsb2NhdGUgYSByb3cgc2xvdCBhbmQgaXRzIGRpcmVjdG9yeS4gVGhlIHJldHVybmVkCi0gICAgICAgICAgICAgICAgICAgICAgICAgKiBwb2ludGVyIHBvaW50cyB0byB0aGUgYmVnaW5pbmcgb2YgdGhlIHJvdydzIGRpcmVjdG9yeQotICAgICAgICAgICAgICAgICAgICAgICAgICogb3IgTlVMTCBpZiB0aGVyZSB3YXNuJ3Qgcm9vbS4gVGhlIGRpcmVjdG9yeSBpcwotICAgICAgICAgICAgICAgICAgICAgICAgICogaW5pdGlhbGllZCB3aXRoIE5VTEwgZW50cmllcyBmb3IgZWFjaCBmaWVsZC4KLSAgICAgICAgICAgICAgICAgICAgICAgICAqLwotICAgIGZpZWxkX3Nsb3RfdCAqICAgICAgYWxsb2NSb3coKTsKLQotICAgICAgICAgICAgICAgICAgICAgICAgLyoqCi0gICAgICAgICAgICAgICAgICAgICAgICAgKiBBbGxvY2F0ZSBhIHBvcnRpb24gb2YgdGhlIHdpbmRvdy4gUmV0dXJucyB0aGUgb2Zmc2V0Ci0gICAgICAgICAgICAgICAgICAgICAgICAgKiBvZiB0aGUgYWxsb2NhdGlvbiwgb3IgMCBpZiB0aGVyZSBpc24ndCBlbm91Z2ggc3BhY2UuCi0gICAgICAgICAgICAgICAgICAgICAgICAgKiBJZiBhbGlnbmVkIGlzIHRydWUsIHRoZSBhbGxvY2F0aW9uIGdldHMgNCBieXRlIGFsaWdubWVudC4KLSAgICAgICAgICAgICAgICAgICAgICAgICAqLwotICAgIHVpbnQzMl90ICAgICAgICAgICAgYWxsb2Moc2l6ZV90IHNpemUsIGJvb2wgYWxpZ25lZCA9IGZhbHNlKTsKLQotICAgIHVpbnQzMl90ICAgICAgICAgICAgcmVhZF9maWVsZF9zbG90KGludCByb3csIGludCBjb2x1bW4sIGZpZWxkX3Nsb3RfdCAqIHNsb3QpOwotCi0gICAgICAgICAgICAgICAgICAgICAgICAvKioKLSAgICAgICAgICAgICAgICAgICAgICAgICAqIENvcHkgZGF0YSBpbnRvIHRoZSB3aW5kb3cgYXQgdGhlIGdpdmVuIG9mZnNldC4KLSAgICAgICAgICAgICAgICAgICAgICAgICAqLwotICAgIHZvaWQgICAgICAgICAgICAgICAgY29weUluKHVpbnQzMl90IG9mZnNldCwgdWludDhfdCBjb25zdCAqIGRhdGEsIHNpemVfdCBzaXplKTsKLSAgICB2b2lkICAgICAgICAgICAgICAgIGNvcHlJbih1aW50MzJfdCBvZmZzZXQsIGludDY0X3QgZGF0YSk7Ci0gICAgdm9pZCAgICAgICAgICAgICAgICBjb3B5SW4odWludDMyX3Qgb2Zmc2V0LCBkb3VibGUgZGF0YSk7Ci0KLSAgICB2b2lkICAgICAgICAgICAgICAgIGNvcHlPdXQodWludDMyX3Qgb2Zmc2V0LCB1aW50OF90ICogZGF0YSwgc2l6ZV90IHNpemUpOwotICAgIGludDY0X3QgICAgICAgICAgICAgY29weU91dExvbmcodWludDMyX3Qgb2Zmc2V0KTsKLSAgICBkb3VibGUgICAgICAgICAgICAgIGNvcHlPdXREb3VibGUodWludDMyX3Qgb2Zmc2V0KTsKLQotICAgIGJvb2wgICAgICAgICAgICAgICAgcHV0TG9uZyh1bnNpZ25lZCBpbnQgcm93LCB1bnNpZ25lZCBpbnQgY29sLCBpbnQ2NF90IHZhbHVlKTsKLSAgICBib29sICAgICAgICAgICAgICAgIHB1dERvdWJsZSh1bnNpZ25lZCBpbnQgcm93LCB1bnNpZ25lZCBpbnQgY29sLCBkb3VibGUgdmFsdWUpOwotICAgIGJvb2wgICAgICAgICAgICAgICAgcHV0TnVsbCh1bnNpZ25lZCBpbnQgcm93LCB1bnNpZ25lZCBpbnQgY29sKTsKLQotICAgIGJvb2wgICAgICAgICAgICAgICAgZ2V0TG9uZyh1bnNpZ25lZCBpbnQgcm93LCB1bnNpZ25lZCBpbnQgY29sLCBpbnQ2NF90ICogdmFsdWVPdXQpOwotICAgIGJvb2wgICAgICAgICAgICAgICAgZ2V0RG91YmxlKHVuc2lnbmVkIGludCByb3csIHVuc2lnbmVkIGludCBjb2wsIGRvdWJsZSAqIHZhbHVlT3V0KTsKLSAgICBib29sICAgICAgICAgICAgICAgIGdldE51bGwodW5zaWduZWQgaW50IHJvdywgdW5zaWduZWQgaW50IGNvbCwgYm9vbCAqIHZhbHVlT3V0KTsKLQotICAgIHVpbnQ4X3QgKiAgICAgICAgICAgb2Zmc2V0VG9QdHIodWludDMyX3Qgb2Zmc2V0KSB7cmV0dXJuIG1EYXRhICsgb2Zmc2V0O30KLQotICAgIHJvd19zbG90X3QgKiAgICAgICAgYWxsb2NSb3dTbG90KCk7Ci0KLSAgICByb3dfc2xvdF90ICogICAgICAgIGdldFJvd1Nsb3QoaW50IHJvdyk7Ci0gICAgCi0gICAgICAgICAgICAgICAgICAgICAgICAvKioKLSAgICAgICAgICAgICAgICAgICAgICAgICAqIHJldHVybiBOVUxMIGlmIEZhaWxlZCB0byBmaW5kIHJvd1Nsb3Qgb3IKLSAgICAgICAgICAgICAgICAgICAgICAgICAqIEludmFsaWQgcm93U2xvdAotICAgICAgICAgICAgICAgICAgICAgICAgICovCi0gICAgZmllbGRfc2xvdF90ICogICAgICBnZXRGaWVsZFNsb3RXaXRoQ2hlY2soaW50IHJvdywgaW50IGNvbHVtbik7Ci0gICAgZmllbGRfc2xvdF90ICogICAgICBnZXRGaWVsZFNsb3QoaW50IHJvdywgaW50IGNvbHVtbikKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBmaWVsZERpck9mZnNldCA9IGdldFJvd1Nsb3Qocm93KS0+b2Zmc2V0OwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gKChmaWVsZF9zbG90X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JpdG1hcChmYWxzZSkuaGVpZ2h0KCk7CiAgICAgfQogCi0gICAgc3RhdGljIHZvaWQgc2V0Vmlld3BvcnQoSk5JRW52KiBlbnYsIGpvYmplY3QsIFNrQ2FudmFzKiBjYW52YXMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHdpZHRoLCBpbnQgaGVpZ2h0KSB7Ci0gICAgICAgIGNhbnZhcy0+c2V0Vmlld3BvcnQod2lkdGgsIGhlaWdodCk7Ci0gICAgfQotICAgIAogICAgIHN0YXRpYyB2b2lkIHNldEJpdG1hcChKTklFbnYqIGVudiwgam9iamVjdCwgU2tDYW52YXMqIGNhbnZhcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgU2tCaXRtYXAqIGJpdG1hcCkgewogICAgICAgICBjYW52YXMtPnNldEJpdG1hcERldmljZSgqYml0bWFwKTsKQEAgLTc0Myw0NSArNzM5LDQ5IEBACiAgICAgICAgIGNhbnZhcy0+ZHJhd1ZlcnRpY2VzKG1vZGUsIHB0Q291bnQsIHZlcnRzLCB0ZXhzLCBjb2xvcnMsIE5VTEwsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluZGljZXMsIGluZGV4Q291bnQsICpwYWludCk7CiAgICAgfQotICAgIAotICAgIHN0YXRpYyB2b2lkIGRyYXdUZXh0X19fQ0lJRkZQYWludChKTklFbnYqIGVudiwgam9iamVjdCwgU2tDYW52YXMqIGNhbnZhcywKKworCisgICAgc3RhdGljIHZvaWQgZHJhd1RleHRfX19DSUlGRklQYWludChKTklFbnYqIGVudiwgam9iamVjdCwgU2tDYW52YXMqIGNhbnZhcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgamNoYXJBcnJheSB0ZXh0LCBpbnQgaW5kZXgsIGludCBjb3VudCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgamZsb2F0IHgsIGpmbG9hdCB5LCBTa1BhaW50KiBwYWludCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqZmxvYXQgeCwgamZsb2F0IHksIGludCBmbGFncywgU2tQYWludCogcGFpbnQpIHsKICAgICAgICAgamNoYXIqIHRleHRBcnJheSA9IGVudi0+R2V0Q2hhckFycmF5RWxlbWVudHModGV4dCwgTlVMTCk7Ci0gICAgICAgIGpzaXplIHRleHRDb3VudCA9IGVudi0+R2V0QXJyYXlMZW5ndGgodGV4dCk7Ci0gICAgICAgIFNrU2NhbGFyIHhfID0gU2tGbG9hdFRvU2NhbGFyKHgpOwotICAgICAgICBTa1NjYWxhciB5XyA9IFNrRmxvYXRUb1NjYWxhcih5KTsKLSAgICAgICAgY2FudmFzLT5kcmF3VGV4dCh0ZXh0QXJyYXkgKyBpbmRleCwgY291bnQgPDwgMSwgeF8sIHlfLCAqcGFpbnQpOwotICAgICAgICBlbnYtPlJlbGVhc2VDaGFyQXJyYXlFbGVtZW50cyh0ZXh0LCB0ZXh0QXJyYXksIDApOworICAgICAgICBUZXh0TGF5b3V0OjpkcmF3VGV4dChwYWludCwgdGV4dEFycmF5ICsgaW5kZXgsIGNvdW50LCBmbGFncywgeCwgeSwgY2FudmFzKTsKKyAgICAgICAgZW52LT5SZWxlYXNlQ2hhckFycmF5RWxlbWVudHModGV4dCwgdGV4dEFycmF5LCBKTklfQUJPUlQpOwogICAgIH0KLSAKLSAgICBzdGF0aWMgdm9pZCBkcmF3VGV4dF9fU3RyaW5nSUlGRlBhaW50KEpOSUVudiogZW52LCBqb2JqZWN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNrQ2FudmFzKiBjYW52YXMsIGpzdHJpbmcgdGV4dCwgaW50IHN0YXJ0LCBpbnQgZW5kLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgamZsb2F0IHgsIGpmbG9hdCB5LCBTa1BhaW50KiBwYWludCkgewotICAgICAgICBjb25zdCB2b2lkKiB0ZXh0XyA9IGVudi0+R2V0U3RyaW5nQ2hhcnModGV4dCwgTlVMTCk7Ci0gICAgICAgIFNrU2NhbGFyIHhfID0gU2tGbG9hdFRvU2NhbGFyKHgpOwotICAgICAgICBTa1NjYWxhciB5XyA9IFNrRmxvYXRUb1NjYWxhcih5KTsKLSAgICAgICAgY2FudmFzLT5kcmF3VGV4dCgoY29uc3QgdWludDE2X3QqKXRleHRfICsgc3RhcnQsIChlbmQgLSBzdGFydCkgPDwgMSwKLSAgICAgICAgICAgICAgICAgICAgICAgICB4XywgeV8sICpwYWludCk7Ci0gICAgICAgIGVudi0+UmVsZWFzZVN0cmluZ0NoYXJzKHRleHQsIChjb25zdCBqY2hhciopIHRleHRfKTsKKworICAgIHN0YXRpYyB2b2lkIGRyYXdUZXh0X19TdHJpbmdJSUZGSVBhaW50KEpOSUVudiogZW52LCBqb2JqZWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU2tDYW52YXMqIGNhbnZhcywganN0cmluZyB0ZXh0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHN0YXJ0LCBpbnQgZW5kLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgamZsb2F0IHgsIGpmbG9hdCB5LCBpbnQgZmxhZ3MsIFNrUGFpbnQqIHBhaW50KSB7CisgICAgICAgIGNvbnN0IGpjaGFyKiB0ZXh0QXJyYXkgPSBlbnYtPkdldFN0cmluZ0NoYXJzKHRleHQsIE5VTEwpOworICAgICAgICBUZXh0TGF5b3V0OjpkcmF3VGV4dChwYWludCwgdGV4dEFycmF5ICsgc3RhcnQsIGVuZCAtIHN0YXJ0LCBmbGFncywgeCwgeSwgY2FudmFzKTsKKyAgICAgICAgZW52LT5SZWxlYXNlU3RyaW5nQ2hhcnModGV4dCwgdGV4dEFycmF5KTsKICAgICB9Ci0gICAgCi0gICAgc3RhdGljIHZvaWQgZHJhd1N0cmluZyhKTklFbnYqIGVudiwgam9iamVjdCBjYW52YXMsIGpzdHJpbmcgdGV4dCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgIGpmbG9hdCB4LCBqZmxvYXQgeSwgam9iamVjdCBwYWludCkgewotICAgICAgICBOUEVfQ0hFQ0tfUkVUVVJOX1ZPSUQoZW52LCBjYW52YXMpOwotICAgICAgICBOUEVfQ0hFQ0tfUkVUVVJOX1ZPSUQoZW52LCBwYWludCk7Ci0gICAgICAgIE5QRV9DSEVDS19SRVRVUk5fVk9JRChlbnYsIHRleHQpOwotICAgICAgICBzaXplX3QgY291bnQgPSBlbnYtPkdldFN0cmluZ0xlbmd0aCh0ZXh0KTsKLSAgICAgICAgaWYgKDAgPT0gY291bnQpIHsKLSAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgfQotICAgICAgICBjb25zdCBqY2hhciogdGV4dF8gPSBlbnYtPkdldFN0cmluZ0NoYXJzKHRleHQsIE5VTEwpOwotICAgICAgICBTa0NhbnZhcyogYyA9IEdyYXBoaWNzSk5JOjpnZXROYXRpdmVDYW52YXMoZW52LCBjYW52YXMpOwotICAgICAgICBjLT5kcmF3VGV4dCh0ZXh0XywgY291bnQgPDwgMSwgU2tGbG9hdFRvU2NhbGFyKHgpLCBTa0Zsb2F0VG9TY2FsYXIoeSksCi0gICAgICAgICAgICAgICAgICAgICpHcmFwaGljc0pOSTo6Z2V0TmF0aXZlUGFpbnQoZW52LCBwYWludCkpOwotICAgICAgICBlbnYtPlJlbGVhc2VTdHJpbmdDaGFycyh0ZXh0LCB0ZXh0Xyk7CisKKyAgICBzdGF0aWMgdm9pZCBkcmF3VGV4dFJ1bl9fX0NJSUlJRkZJUGFpbnQoCisgICAgICAgIEpOSUVudiogZW52LCBqb2JqZWN0LCBTa0NhbnZhcyogY2FudmFzLCBqY2hhckFycmF5IHRleHQsIGludCBpbmRleCwKKyAgICAgICAgaW50IGNvdW50LCBpbnQgY29udGV4dEluZGV4LCBpbnQgY29udGV4dENvdW50LAorICAgICAgICBqZmxvYXQgeCwgamZsb2F0IHksIGludCBkaXJGbGFncywgU2tQYWludCogcGFpbnQpIHsKKworICAgICAgICBqY2hhciogY2hhcnMgPSBlbnYtPkdldENoYXJBcnJheUVsZW1lbnRzKHRleHQsIE5VTEwpOworICAgICAgICBUZXh0TGF5b3V0OjpkcmF3VGV4dFJ1bihwYWludCwgY2hhcnMgKyBjb250ZXh0SW5kZXgsIGluZGV4IC0gY29udGV4dEluZGV4LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb3VudCwgY29udGV4dENvdW50LCBkaXJGbGFncywgeCwgeSwgY2FudmFzKTsKKyAgICAgICAgZW52LT5SZWxlYXNlQ2hhckFycmF5RWxlbWVudHModGV4dCwgY2hhcnMsIEpOSV9BQk9SVCk7CiAgICAgfQotICAgIAorCisgICAgc3RhdGljIHZvaWQgZHJhd1RleHRSdW5fX1N0cmluZ0lJSUlGRklQYWludCgKKyAgICAgICAgSk5JRW52KiBlbnYsIGpvYmplY3Qgb2JqLCBTa0NhbnZhcyogY2FudmFzLCBqc3RyaW5nIHRleHQsIGppbnQgc3RhcnQsCisgICAgICAgIGppbnQgZW5kLCBqaW50IGNvbnRleHRTdGFydCwgamludCBjb250ZXh0RW5kLAorICAgICAgICBqZmxvYXQgeCwgamZsb2F0IHksIGppbnQgZGlyRmxhZ3MsIFNrUGFpbnQqIHBhaW50KSB7CisKKyAgICAgICAgamludCBjb3VudCA9IGVuZCAtIHN0YXJ0OworICAgICAgICBqaW50IGNvbnRleHRDb3VudCA9IGNvbnRleHRFbmQgLSBjb250ZXh0U3RhcnQ7CisgICAgICAgIGNvbnN0IGpjaGFyKiBjaGFycyA9IGVudi0+R2V0U3RyaW5nQ2hhcnModGV4dCwgTlVMTCk7CisgICAgICAgIFRleHRMYXlvdXQ6OmRyYXdUZXh0UnVuKHBhaW50LCBjaGFycyArIGNvbnRleHRTdGFydCwgc3RhcnQgLSBjb250ZXh0U3RhcnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvdW50LCBjb250ZXh0Q291bnQsIGRpckZsYWdzLCB4LCB5LCBjYW52YXMpOworICAgICAgICBlbnYtPlJlbGVhc2VTdHJpbmdDaGFycyh0ZXh0LCBjaGFycyk7CisgICAgfQorCiAgICAgc3RhdGljIHZvaWQgZHJhd1Bvc1RleHRfX19DSUlfRlBhaW50KEpOSUVudiogZW52LCBqb2JqZWN0LCBTa0NhbnZhcyogY2FudmFzLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqY2hhckFycmF5IHRleHQsIGludCBpbmRleCwgaW50IGNvdW50LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqZmxvYXRBcnJheSBwb3MsIFNrUGFpbnQqIHBhaW50KSB7CkBAIC04MDQsMTAgKzgwNCwxMSBAQAogICAgICAgICB9CiAgICAgICAgIGRlbGV0ZVtdIHBvc1B0cjsKICAgICB9Ci0gCisKICAgICBzdGF0aWMgdm9pZCBkcmF3UG9zVGV4dF9fU3RyaW5nX0ZQYWludChKTklFbnYqIGVudiwgam9iamVjdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTa0NhbnZhcyogY2FudmFzLCBqc3RyaW5nIHRleHQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgamZsb2F0QXJyYXkgcG9zLCBTa1BhaW50KiBwYWludCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpmbG9hdEFycmF5IHBvcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTa1BhaW50KiBwYWludCkgewogICAgICAgICBjb25zdCB2b2lkKiB0ZXh0XyA9IHRleHQgPyBlbnYtPkdldFN0cmluZ0NoYXJzKHRleHQsIE5VTEwpIDogTlVMTDsKICAgICAgICAgaW50IGJ5dGVMZW5ndGggPSB0ZXh0ID8gZW52LT5HZXRTdHJpbmdMZW5ndGgodGV4dCkgOiAwOwogICAgICAgICBmbG9hdCogcG9zQXJyYXkgPSBwb3MgPyBlbnYtPkdldEZsb2F0QXJyYXlFbGVtZW50cyhwb3MsIE5VTEwpIDogTlVMTDsKQEAgLTgyNywyNyArODI4LDI3IEBACiAgICAgICAgIH0KICAgICAgICAgZGVsZXRlW10gcG9zUHRyOwogICAgIH0KLSAKKwogICAgIHN0YXRpYyB2b2lkIGRyYXdUZXh0T25QYXRoX19fQ0lJUGF0aEZGUGFpbnQoSk5JRW52KiBlbnYsIGpvYmplY3QsCi0gICAgICAgICAgICAgICAgICAgICAgICBTa0NhbnZhcyogY2FudmFzLCBqY2hhckFycmF5IHRleHQsIGludCBpbmRleCwgaW50IGNvdW50LAotICAgICAgICAgICAgICAgIFNrUGF0aCogcGF0aCwgamZsb2F0IGhPZmZzZXQsIGpmbG9hdCB2T2Zmc2V0LCBTa1BhaW50KiBwYWludCkgeworICAgICAgICAgICAgU2tDYW52YXMqIGNhbnZhcywgamNoYXJBcnJheSB0ZXh0LCBpbnQgaW5kZXgsIGludCBjb3VudCwKKyAgICAgICAgICAgIFNrUGF0aCogcGF0aCwgamZsb2F0IGhPZmZzZXQsIGpmbG9hdCB2T2Zmc2V0LCBqaW50IGJpZGlGbGFncywgU2tQYWludCogcGFpbnQpIHsKIAogICAgICAgICBqY2hhciogdGV4dEFycmF5ID0gZW52LT5HZXRDaGFyQXJyYXlFbGVtZW50cyh0ZXh0LCBOVUxMKTsKLSAgICAgICAgY2FudmFzLT5kcmF3VGV4dE9uUGF0aEhWKHRleHRBcnJheSArIGluZGV4LCBjb3VudCA8PCAxLCAqcGF0aCwKLSAgICAgICAgICAgICAgICAgICAgU2tGbG9hdFRvU2NhbGFyKGhPZmZzZXQpLCBTa0Zsb2F0VG9TY2FsYXIodk9mZnNldCksICpwYWludCk7CisgICAgICAgIFRleHRMYXlvdXQ6OmRyYXdUZXh0T25QYXRoKHBhaW50LCB0ZXh0QXJyYXksIGNvdW50LCBiaWRpRmxhZ3MsIGhPZmZzZXQsIHZPZmZzZXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhdGgsIGNhbnZhcyk7CiAgICAgICAgIGVudi0+UmVsZWFzZUNoYXJBcnJheUVsZW1lbnRzKHRleHQsIHRleHRBcnJheSwgMCk7CiAgICAgfQotIAorCiAgICAgc3RhdGljIHZvaWQgZHJhd1RleHRPblBhdGhfX1N0cmluZ1BhdGhGRlBhaW50KEpOSUVudiogZW52LCBqb2JqZWN0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNrQ2FudmFzKiBjYW52YXMsIGpzdHJpbmcgdGV4dCwgU2tQYXRoKiBwYXRoLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpmbG9hdCBoT2Zmc2V0LCBqZmxvYXQgdk9mZnNldCwgU2tQYWludCogcGFpbnQpIHsKKyAgICAgICAgICAgIFNrQ2FudmFzKiBjYW52YXMsIGpzdHJpbmcgdGV4dCwgU2tQYXRoKiBwYXRoLAorICAgICAgICAgICAgamZsb2F0IGhPZmZzZXQsIGpmbG9hdCB2T2Zmc2V0LCBqaW50IGJpZGlGbGFncywgU2tQYWludCogcGFpbnQpIHsKICAgICAgICAgY29uc3QgamNoYXIqIHRleHRfID0gZW52LT5HZXRTdHJpbmdDaGFycyh0ZXh0LCBOVUxMKTsKLSAgICAgICAgaW50IGJ5dGVMZW5ndGggPSBlbnYtPkdldFN0cmluZ0xlbmd0aCh0ZXh0KSA8PCAxOwotICAgICAgICBjYW52YXMtPmRyYXdUZXh0T25QYXRoSFYodGV4dF8sIGJ5dGVMZW5ndGgsICpwYXRoLAotICAgICAgICAgICAgICAgICAgICBTa0Zsb2F0VG9TY2FsYXIoaE9mZnNldCksIFNrRmxvYXRUb1NjYWxhcih2T2Zmc2V0KSwgKnBhaW50KTsKKyAgICAgICAgaW50IGNvdW50ID0gZW52LT5HZXRTdHJpbmdMZW5ndGgodGV4dCk7CisgICAgICAgIFRleHRMYXlvdXQ6OmRyYXdUZXh0T25QYXRoKHBhaW50LCB0ZXh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yRmlsdGVyKiBDcmVhdGVMaWdodGluZ0ZpbHRlcihKTklFbnYqIGVudiwgam9iamVjdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgamludCBtdWwsIGppbnQgYWRkKSB7CisKKyAgICBzdGF0aWMgU2tpYUNvbG9yRmlsdGVyKiBnbENyZWF0ZUxpZ2h0aW5nRmlsdGVyKEpOSUVudiogZW52LCBqb2JqZWN0LCBqaW50IG11bCwgamludCBhZGQpIHsKKyNpZmRlZiBVU0VfT1BFTkdMX1JFTkRFUkVSCisgICAgICAgIHJldHVybiBuZXcgU2tpYUxpZ2h0aW5nRmlsdGVyKG11bCwgYWRkKTsKKyNlbHNlCisgICAgICAgIHJldHVybiBOVUxMOworI2VuZGlmCisgICAgfQorCisgICAgc3RhdGljIFNraWFDb2xvckZpbHRlciogZ2xDcmVhdGVDb2xvck1hdHJpeEZpbHRlcihKTklFbnYqIGVudiwgam9iamVjdCwgamZsb2F0QXJyYXkgamFycmF5KSB7CisjaWZkZWYgVVNFX09QRU5HTF9SRU5ERVJFUgorICAgICAgICBBdXRvSmF2YUZsb2F0QXJyYXkgYXV0b0FycmF5KGVudiwgamFycmF5LCAyMCk7CisgICAgICAgIGNvbnN0IGZsb2F0KiBzcmMgPSBhdXRvQXJyYXkucHRyKCk7CisKKyAgICAgICAgZmxvYXQqIGNvbG9yTWF0cml4ID0gbmV3IGZsb2F0WzE2XTsKKyAgICAgICAgbWVtY3B5KGNvbG9yTWF0cml4LCBzcmMsIDQgKiBzaXplb2YoZmxvYXQpKTsKKyAgICAgICAgbWVtY3B5KCZjb2xvck1hdHJpeFs0XSwgJnNyY1s1XSwgNCAqIHNpemVvZihmbG9hdCkpOworICAgICAgICBtZW1jcHkoJmNvbG9yTWF0cml4WzhdLCAmc3JjWzEwXSwgNCAqIHNpemVvZihmbG9hdCkpOworICAgICAgICBtZW1jcHkoJmNvbG9yTWF0cml4WzEyXSwgJnNyY1sxNV0sIDQgKiB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U2tQYWludCogb2JqKSB7CiAgICAgICAgIGRlbGV0ZSBvYmo7CkBAIC0zOTUsMjAgKzQwMywxNjEgQEAKICAgICAgICAgZW52LT5SZWxlYXNlU3RyaW5nQ2hhcnModGV4dCwgdGV4dEFycmF5KTsKICAgICAgICAgcmV0dXJuIGNvdW50OwogICAgIH0KLSAgICAKLSAgICBzdGF0aWMgdm9pZCBnZXRUZXh0UGF0aF9fX0NJSUZGUGF0aChKTklFbnYqIGVudiwgam9iamVjdCBjbGF6eiwgU2tQYWludCogcGFpbnQsIGpjaGFyQXJyYXkgdGV4dCwgaW50IGluZGV4LCBpbnQgY291bnQsIGpmbG9hdCB4LCBqZmxvYXQgeSwgU2tQYXRoKiBwYXRoKSB7Ci0gICAgICAgIGNvbnN0IGpjaGFyKiB0ZXh0QXJyYXkgPSBlbnYtPkdldENoYXJBcnJheUVsZW1lbnRzKHRleHQsIE5VTEwpOwotICAgICAgICBwYWludC0+Z2V0VGV4dFBhdGgodGV4dEFycmF5ICsgaW5kZXgsIGNvdW50IDw8IDEsIFNrRmxvYXRUb1NjYWxhcih4KSwgU2tGbG9hdFRvU2NhbGFyKHkpLCBwYXRoKTsKLSAgICAgICAgZW52LT5SZWxlYXNlQ2hhckFycmF5RWxlbWVudHModGV4dCwgY29uc3RfY2FzdDxqY2hhcio+KHRleHRBcnJheSksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEpOSV9BQk9SVCk7CisKKyAgICBzdGF0aWMgamZsb2F0IGRvVGV4dFJ1bkFkdmFuY2VzKEpOSUVudiAqZW52LCBTa1BhaW50ICpwYWludCwgY29uc3QgamNoYXIgKnRleHQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqaW50IHN0YXJ0LCBqaW50IGNvdW50LCBqaW50IGNvbnRleHRDb3VudCwgamludCBmbGFncywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpmbG9hdEFycmF5IGFkdmFuY2VzLCBqaW50IGFkdmFuY2VzSW5kZXgpIHsKKyAgICAgICAgamZsb2F0IGFkdmFuY2VzQXJyYXlbY291bnRdOworICAgICAgICBqZmxvYXQgdG90YWxBZHZhbmNlOworCisgICAgICAgIFRleHRMYXlvdXQ6OmdldFRleHRSdW5BZHZhbmNlcyhwYWludCwgdGV4dCwgc3RhcnQsIGNvdW50LCBjb250ZXh0Q291bnQsIGZsYWdzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWR2YW5jZXNBcnJheSwgdG90YWxBZHZhbmNlKTsKKworICAgICAgICBpZiAoYWR2YW5jZXMgIT0gTlVMTCkgeworICAgICAgICAgICAgZW52LT5TZXRGbG9hdEFycmF5UmVnaW9uKGFkdmFuY2VzLCBhZHZhbmNlc0luZGV4LCBjb3VudCwgYWR2YW5jZXNBcnJheSk7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHRvdGFsQWR2YW5jZTsKICAgICB9Ci0gCi0gICAgc3RhdGljIHZvaWQgZ2V0VGV4dFBhdGhfX1N0cmluZ0lJRkZQYXRoKEpOSUVudiogZW52LCBqb2JqZWN0IGNsYXp6LCBTa1BhaW50KiBwYWludCwganN0cmluZyB0ZXh0LCBpbnQgc3RhcnQsIGludCBlbmQsIGpmbG9hdCB4LCBqZmxvYXQgeSwgU2tQYXRoKiBwYXRoKSB7CisKKyAgICBzdGF0aWMgZmxvYXQgZ2V0VGV4dFJ1bkFkdmFuY2VzX19fQ0lJSUlJX0ZJKEpOSUVudiogZW52LCBqb2JqZWN0IGNsYXp6LCBTa1BhaW50KiBwYWludCwKKyAgICAgICAgICAgIGpjaGFyQXJyYXkgdGV4dCwgamludCBpbmRleCwgamludCBjb3VudCwgamludCBjb250ZXh0SW5kZXgsIGppbnQgY29udGV4dENvdW50LAorICAgICAgICAgICAgamludCBmbGFncywgamZsb2F0QXJyYXkgYWR2YW5jZXMsIGppbnQgYWR2YW5jZXNJbmRleCkgeworICAgICAgICBqY2hhciogdGV4dEF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ICAgICBzdGFydCAtIGNvbnRleHRTdGFydCwgZW5kIC0gc3RhcnQsIGNvbnRleHRFbmQgLSBjb250ZXh0U3RhcnQsIGZsYWdzLCBhZHZhbmNlcywKKyAgICAgICAgICAgIGFkdmFuY2VzSW5kZXgpOworICAgICAgICBlbnYtPlJlbGVhc2VTdHJpbmdDaGFycyh0ZXh0LCB0ZXh0QXJyYXkpOworICAgICAgICByZXR1cm4gcmVzdWx0OworICAgIH0KKworICAgIHN0YXRpYyBqaW50IGRvVGV4dFJ1bkN1cnNvcihKTklFbnYgKmVudiwgU2tQYWludCogcGFpbnQsIGNvbnN0IGpjaGFyICp0ZXh0LCBqaW50IHN0YXJ0LAorICAgICAgICAgICAgamludCBjb3VudCwgamludCBmbGFncywgamludCBvZmZzZXQsIGppbnQgb3B0KSB7CisgICAgICAgIFNrU2NhbGFyIHNjYWxhckFycmF5W2NvdW50XTsKKyAgICAgICAgamNoYXIgYnVmZmVyW2NvdW50XTsKKworICAgICAgICAvLyB0aGlzIGlzIHdoZXJlIHdlJ2QgY2FsbCBoYXJmYnV6egorICAgICAgICAvLyBmb3Igbm93IHdlIGp1c3QgdXNlIHVzaGFwZS5jIGFuZCB3aWR0aHMgcmV0dXJuZWQgZnJvbSBza2lhCisKKyAgICAgICAgaW50IHdpZHRoczsKKyAgICAgICAgaWYgKGZsYWdzICYgMHgxKSB7IC8vIHJ0bCwgY2FsbCBhcmFiaWMgc2hhcGluZyBpbiBjYXNlCisgICAgICAgICAgICBVRXJyb3JDb2RlIHN0YXR1cyA9IFVfWkVST19FUlJPUjsKKyAgICAgICAgICAgIC8vIFVzZSBmaXhlZCBsZW5ndGggc2luY2Ugd2UgbmVlZCB0byBrZWVwIHN0YXJ0IGFuZCBjb3VudCB2YWxpZAorICAgICAgICAgICAgdV9zaGFwZUFyYWJpYyh0ZXh0ICsgc3RhcnQsIGNvdW50LCBidWZmZXIsIGNvdW50LAorICAgICAgICAgICAgICAgICAgICBVX1NIQVBFX0xFTkdUSF9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iBjb2RlIHVuaXQuCisKKyAgICAgICAgICAgIC8vIE5vdGUsIHNraWEncyBnZXRUZXh0V2lkdGggZ2V0cyBjb25mdXNlZCBpZiBpdCBlbmNvdW50ZXJzIGEgc3Vycm9nYXRlIHBhaXIsCisgICAgICAgICAgICAvLyBsZWF2aW5nIHRoZSByZW1haW5pbmcgd2lkdGhzIHplcm8uICBOb3QgbmljZS4KKyAgICAgICAgICAgIGNvbnN0IGpjaGFyICpjaGFycyA9IHRleHQgKyBzdGFydDsKKyAgICAgICAgICAgIGZvciAoaW50IGkgPSBjb3VudCwgcCA9IHdpZHRocyAtIDE7IC0taSA+IHA7KSB7CisgICAgICAgICAgICAgICAgaWYgKGNoYXJzW2ldID49IDB4ZGMwMCAmJiBjaGFyc1tpXSA8IDB4ZTAwMCAmJgorICAgICAgICAgICAgICAgICAgICAgICAgY2hhcnNbaS0xXSA+PSAweGQ4MDAgJiYgY2hhcnNbaS0xXSA8IDB4ZGMwMCkgeworICAgICAgICAgICAgICAgICAgICBzY2FsYXJBcnJheVtpXSA9IDA7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgIHNjYWxhckFycmF5W2ldID0gc2NhbGFyQXJyYXlbLS1wXTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBqaW50IHBvcyA9IG9mZnNldCAtIHN0YXJ0OworICAgICAgICBzd2l0Y2ggKG9wdCkgeworICAgICAgICBjYXNlIEFGVEVSOgorICAgICAgICAgIGlmIChwb3MgPCBjb3VudCkgeworICAgICAgICAgICAgcG9zICs9IDE7CisgICAgICAgICAgfQorICAgICAgICAgIC8vIGZhbGwgdGhyb3VnaAorICAgICAgICBjYXNlIEFUX09SX0FGVEVSOgorICAgICAgICAgIHdoaWxlIChwb3MgPCBjb3VudCAmJiBzY2FsYXJBcnJheVtwb3NdID09IDApIHsKKyAgICAgICAgICAgICsrcG9zOworICAgICAgICAgIH0KKyAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBCRUZPUkU6CisgICAgICAgICAgaWYgKHBvcyA+IDApIHsKKyAgICAgICAgICAgIC0tcG9zOworICAgICAgICAgIH0KKyAgICAgICAgICAvLyBmYWxsIHRocm91Z2gKKyAgICAgICAgY2FzZSBBVF9PUl9CRUZPUkU6CisgICAgICAgICAgd2hpbGUgKHBvcyA+IDAgJiYgc2NhbGFyQXJyYXlbcG9zXSA9PSAwKSB7CisgICAgICAgICAgICAtLXBvczsKKyAgICAgICAgICB9CisgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgQVQ6CisgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgaWYgKHNjYWxhckFycmF5W3Bvc10gPT0gMCkgeworICAgICAgICAgICAgcG9zID0gLTE7CisgICAgICAgICAgfQorICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisKKyAgICAgICAgaWYgKHBvcyAhPSAtMSkgeworICAgICAgICAgIHBvcyArPSBzdGFydDsKKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiBwb3M7CisgICAgfQorCisgICAgc3RhdGljIGppbnQgZ2V0VGV4dFJ1bkN1cnNvcl9fX0MoSk5JRW52KiBlbnYsIGpvYmplY3QgY2xhenosIFNrUGFpbnQqIHBhaW50LCBqY2hhckFycmF5IHRleHQsCisgICAgICAgICAgICBqaW50IGNvbnRleHRTdGFydCwgamludCBjb250ZXh0Q291bnQsIGppbnQgZmxhZ3MsIGppbnQgb2Zmc2V0LCBqaW50IGN1cnNvck9wdCkgeworICAgICAgICBqY2hhciogdGV4dEFycmF5ID0gZW52LT5HZXRDaGFyQXJyYXlFbGVtZW50cyh0ZXh0LCBOVUxMKTsKKyAgICAgICAgamludCByZXN1bHQgPSBkb1RleHRSdW5DdXJzb3IoZW52LCBwYWludCwgdGV4dEFycmF5LCBjb250ZXh0U3RhcnQsIGNvbnRleHRDb3VudCwgZmxhZ3MsCisgICAgICAgICAgICAgICAgb2Zmc2V0LCBjdXJzb3JPcHQpOworICAgICAgICBlbnYtPlJlbGVhc2VDaGFyQXJyYXlFbGVtZW50cyh0ZXh0LCB0ZXh0QXJyYXksIEpOSV9BQk9SVCk7CisgICAgICAgIHJldHVybiByZXN1bHQ7CisgICAgfQorCisgICAgc3RhdGljIGppbnQgZ2V0VGV4dFJ1bkN1cnNvcl9fU3RyaW5nKEpOSUVudiogZW52LCBqb2JqZWN0IGNsYXp6LCBTa1BhaW50KiBwYWludCwganN0cmluZyB0ZXh0LAorICAgICAgICAgICAgamludCBjb250ZXh0U3RhcnQsIGppbnQgY29udGV4dEVuZCwgamludCBmbGFncywgamludCBvZmZzZXQsIGppbnQgY3Vyc29yT3B0KSB7CisgICAgICAgIGNvbnN0IGpjaGFyKiB0ZXh0QXJyYXkgPSBlbnYtPkdldFN0cmluZ0NoYXJzKHRleHQsIE5VTEwpOworICAgICAgICBqaW50IHJlc3VsdCA9IGRvVGV4dFJ1bkN1cnNvcihlbnYsIHBhaW50LCB0ZXh0QXJyYXksIGNvbnRleHRTdGFydCwKKyAgICAgICAgICAgICAgICBjb250ZXh0RW5kIC0gY29udGV4dFN0YXJ0LCBmbGFncywgb2Zmc2V0LCBjdXJzb3JPcHQpOworICAgICAgICBlbnYtPlJlbGVhc2VTdHJpbmdDaGFycyh0ZXh0LCB0ZXh0QXJyYXkpOworICAgICAgICByZXR1cm4gcmVzdWx0OworICAgIH0KKworICAgIHN0YXRpYyB2b2lkIGdldFRleHRQYXRoKEpOSUVudiogZW52LCBTa1BhaW50KiBwYWludCwgY29uc3QgamNoYXIqIHRleHQsIGppbnQgY291bnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgamludCBiaWRpRmxhZ3MsIGpmbG9hdCB4LCBqZmxvYXQgeSwgU2tQYXRoICpwYXRoKSB7CisgICAgICAgIFRleHRMYXlvdXQ6OmdldFRleHRQYXRoKHBhaW50LCB0ZXh0LCBjb3VudCwgYmlkaUZsYWdzLCB4LCB5LCBwYXRoKTsKKyAgICB9C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HZXRBcnJheUxlbmd0aChjb2xvckFycmF5KTsKKyAgICBzaXplX3QgY291bnQgPSBlbnYtPkdldEFycmF5TGVuZ3RoKGNvbG9yQXJyYXkpOwogICAgIGNvbnN0IGppbnQqIGNvbG9yVmFsdWVzID0gZW52LT5HZXRJbnRBcnJheUVsZW1lbnRzKGNvbG9yQXJyYXksIE5VTEwpOwogCiAgICAgU2tBdXRvU1RNYWxsb2M8OCwgU2tTY2FsYXI+IHN0b3JhZ2UocG9zQXJyYXkgPyBjb3VudCA6IDApOwogICAgIFNrU2NhbGFyKiAgICAgICAgICAgICAgICAgICBwb3MgPSBOVUxMOwotICAgIAorCiAgICAgaWYgKHBvc0FycmF5KSB7CiAgICAgICAgIEF1dG9KYXZhRmxvYXRBcnJheSBhdXRvUG9zKGVudiwgcG9zQXJyYXksIGNvdW50KTsKICAgICAgICAgY29uc3QgZmxvYXQqIHBvc1ZhbHVlcyA9IGF1dG9Qb3MucHRyKCk7CiAgICAgICAgIHBvcyA9IChTa1NjYWxhciopc3RvcmFnZS5nZXQoKTsKLSAgICAgICAgZm9yIChzaXplX3QgaSA9IDA7IGkgPCBjb3VudDsgaSsrKQorICAgICAgICBmb3IgKHNpemVfdCBpID0gMDsgaSA8IGNvdW50OyBpKyspIHsKICAgICAgICAgICAgIHBvc1tpXSA9IFNrRmxvYXRUb1NjYWxhcihwb3NWYWx1ZXNbaV0pOworICAgICAgICB9CiAgICAgfQotCisgICAgCiAgICAgU2tTaGFkZXIqIHNoYWRlciA9IFNrR3JhZGllbnRTaGFkZXI6OkNyZWF0ZUxpbmVhcihwdHMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlaW50ZXJwcmV0X2Nhc3Q8Y29uc3QgU2tDb2xvcio+KGNvbG9yVmFsdWVzKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcG9zLCBjb3VudCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGljX2Nhc3Q8U2tTaG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BFX0xFVFRFUlNfU0hBUEUgfAorICAgICAgICAgICAgICAgICAgIFVfU0hBUEVfWF9MQU1BTEVGX1NVQl9BTFRFUk5BVEUsICZzdGF0dXMpOworCisgICAgaWYgKFVfU1VDQ0VTUyhzdGF0dXMpKSB7CisgICAgICAgIC8vIHRyaW0gb3V0IDB4ZmZmZiBmb2xsb3dpbmcgbGlnYXR1cmVzLCBpZiBhbnkKKyAgICAgICAgaW50IGVuZCA9IDA7CisgICAgICAgIGZvciAoaW50IGkgPSBzdGFydCwgZSA9IHN0YXJ0ICsgY291bnQ7IGkgPCBlOyArK2kpIHsKKyAgICAgICAgICAgIGlmIChidWZmZXJbaV0gIT0gMHhmZmZmKSB7CisgICAgICAgICAgICAgICAgYnVmZmVyW2VuZCsrXSA9IGJ1ZmZlcltpXTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBjb3VudCA9IGVuZDsKKyAgICAgICAgLy8gTE9HKExPR19JTkZPLCAiQ1NSVEwiLCAic3RhcnQgJWQgY291bnQgJWQgY2NvdW50ICVkXG4iLCBzdGFydCwgY291bnQsIGNvbnRleHRDb3VudCk7CisgICAgICAgIHViaWRpX3dyaXRlUmV2ZXJzZShidWZmZXIsIGNvdW50LCBzaGFwZWQsIGNvdW50LCBVQklESV9ET19NSVJST1JJTkcgfCBVQklESV9PVVRQVVRfUkVWRVJTRQorICAgICAgICAgICAgICAgICAgICAgICAgICAgfCBVQklESV9LRUVQX0JBU0VfQ09NQklOSU5HLCAmc3RhdHVzKTsKKyAgICAgICAgaWYgKFVfU1VDQ0VTUyhzdGF0dXMpKSB7CisgICAgICAgICAgICByZXR1cm4gY291bnQ7CisgICAgICAgIH0KKyAgICB9CisKKyAgICByZXR1cm4gLTE7Cit9CisKKy8qKgorICogQmFzaWMgY2hhcmFjdGVyLWJhc2VkIGxheW91dCBzdXBwb3J0aW5nIHJ0bCBhbmQgYXJhYmljIHNoYXBpbmcuCisgKiBSdW5zIGJpZGkgb24gdGhlIH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MzJfdCBzbGVuID0gMDsKKyAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IHJjOyArK2kpIHsKKyAgICAgICAgICAgICAgICAgICAgaW50MzJfdCBzdGFydDsKKyAgICAgICAgICAgICAgICAgICAgaW50MzJfdCBsZW5ndGg7CisgICAgICAgICAgICAgICAgICAgIFVCaURpRGlyZWN0aW9uIHJ1bkRpciA9IHViaWRpX2dldFZpc3VhbFJ1bihiaWRpLCBpLCAmc3RhcnQsICZsZW5ndGgpOworCisgICAgICAgICAgICAgICAgICAgIGlmIChydW5EaXIgPT0gVUJJRElfUlRMKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBzbGVuICs9IHNoYXBlUnRsVGV4dCh0ZXh0ICsgc3RhcnQsIDAsIGxlbmd0aCwgbGVuZ3RoLCBidWZmZXIgKyBzbGVuLCBzdGF0dXMpOworICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgbWVtY3B5KGJ1ZmZlciArIHNsZW4sIHRleHQgKyBzdGFydCwgbGVuZ3RoICogc2l6ZW9mKGpjaGFyKSk7CisgICAgICAgICAgICAgICAgICAgICAgICBzbGVuICs9IGxlbmd0aDsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBpZiAoVV9TVUNDRVNTKHN0YXR1cykpIHsKKyAgICAgICAgICAgICAgICAgICAgcmVzdWx0ID0gc2xlbjsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgdWJpZGlfY2xvc2UoYmlkaSk7CisgICAgfQorCisgICAgcmV0dXJuIHJlc3VsdDsKK30KKworYm9vbCBUZXh0TGF5b3V0OjpwcmVwYXJlVGV4dChTa1BhaW50ICpwYWludCwgY29uc3QgamNoYXIqIHRleHQsIGpzaXplIGxlbiwgamludCBiaWRpRmxhZ3MsCisgICAgICAgIGNvbnN0IGpjaGFyKiogb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hhciogc2hhcGVkKSB7CisgICAgVUVycm9yQ29kZSBzdGF0dXMgPSBVX1pFUk9fRVJST1I7CisgICAgY291bnQgPSBzaGFwZVJ0bFRleHQoY29udGV4dCwgc3RhcnQsIGNvdW50LCBjb250ZXh0Q291bnQsIHNoYXBlZCwgc3RhdHVzKTsKKyAgICBpZiAoVV9TVUNDRVNTKHN0YXR1cykpIHsKKyAgICAgICAgcmV0dXJuIHRydWU7CisgICAgfSBlbHNlIHsKKyAgICAgICAgTE9HKExPR19XQVJOLCAiTEFZT1VUIiwgImRyYXdUZXh0UnVuIGVycm9yICVkXG4iLCBzdGF0dXMpOworICAgIH0KKyAgICByZXR1cm4gZmFsc2U7Cit9CisKK3ZvaWQgVGV4dExheW91dDo6ZHJhd1RleHRSdW4oU2tQYWludCogcGFpbnQsIGNvbnN0IGpjaGFyKiBjaGFycywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgamludCBzdGFydCwgamludCBjb3VudCwgamludCBjb250ZXh0Q291bnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBkaXJGbGFncywgamZsb2F0IHgsIGpmbG9hdCB5LCBTa0NhbnZhcyogY2FudmFzKSB7CisKKyAgICAgU2tTY2FsYXIgeF8gPSBTa0Zsb2F0VG9TY2FsYXIoeCk7CisgICAgIFNrU2NhbGFyIHlfID0gU2tGbG9hdFRvU2NhbGFyKHkpOworCisgICAgIHVpbnQ4X3QgcnRsID0gZGlyRmxhZ3MgJiAweDE7CisgICAgIGlmIChydGwpIHsKKyAgICAgICAgIFNrQXV0b1NUTWFsbG9jPDgwLCBqY2hhcj4gYnVmZmVyKGNvbnRleHRDb3VudCk7CisgICAgICAgICBpZiAocHJlcGFyZVJ0bFRleHRSdW4oY2hhcnMsIHN0YXJ0LCBjb3VudCwgY29udGV4dENvdW50LCBidWZmZXIuZ2V0KCkpKSB7CisgICAgICAgICAgICAgY2FudmFzLT5kcmF3VGV4dChidWZmZXIuZ2V0KCksIGNvdW50IDw8IDEsIHhfLCB5XywgKnBhaW50KTsKKyAgICAgICAgIH0KKyAgICAgfSBlbHNlIHsKKyAgICAgICAgIGNhbnZhcy0+ZHJhd1RleHQoY2hhcnMgKyBzdGFydCwgY291bnQgPDwgMSwgeF8sIHlfLCAqcGFpbnQpOworICAgICB9CisgfQorCit2b2lkIFRleHRMYXlvdXQ6OmdldFRleHRSdW5BZHZhbmNlcyhTa1BhaW50ICpwYWludCwgY29uc3QgamNoYXIgKmNoYXJzLCBqaW50IHN0YXJ0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgamludCBjb3VudCwgamludCBjb250ZXh0Q291bnQsIGppbnQgZGlyRmxhZ3MsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqZmxvYXQgKnJlc3VsdEFkdmFuY2VzLCBqZmxvYXQgJnJlc3VsdFRvdGFsQWR2YW5jZSkgeworICAgIGpjaGFyIGJ1ZmZlcltjb250ZXh0Q291bnRdOworCisgICAgU2tTY2FsYXIqIHNjYWxhckFycmF5ID0gKFNrU2NhbGFyICopcmVzdWx0QWR2YW5jZXM7CisgICAgcmVzdWx0VG90YWxBZHZhbmNlID0gMDsKKworICAgIC8vIHRoaXMgaXMgd2hlcmUgd2UnZCBjYWxsIGhhcmZidXp6CisgICAgLy8gZm9yIG5vdyB3ZSBqdXN0IHVzZSB1c2hhcGUuYworCisgICAgaW50IHdpZHRoczsKKyAgICBjb25zdCBqY2hhciogdGV4dDsKKyAgICBpZiAoZGlyRmxhZ3MgJiAweDEpIHsgLy8gcnRsLCBjYWxsIGFyYWJpYyBzaGFwaW5nIGluIGNhc2UKKyAgICAgICAgVUVycm9yQ29kZSBzdGF0dXMgPSBVX1pFUk9fRVJST1I7CisgICAgICAgIC8vIFVzZSBmaXhlZCBsZW5ndGggc2luY2Ugd2UgbmVlZCB0byBrZWVwIHN0YXJ0IGFuZCBjb3VudCB2YWxpZAorICAgICAgICB1X3NoYXBlQXJhYmljKGNoYXJzLCBjb250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gYmlkaSBhbmQgc2hhcGluZwordm9pZCBUZXh0TGF5b3V0OjpkcmF3VGV4dChTa1BhaW50KiBwYWludCwgY29uc3QgamNoYXIqIHRleHQsIGpzaXplIGxlbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGJpZGlGbGFncywgamZsb2F0IHgsIGpmbG9hdCB5LCBTa0NhbnZhcyogY2FudmFzKSB7CisKKyAgICBoYW5kbGVUZXh0KHBhaW50LCB0ZXh0LCBsZW4sIGJpZGlGbGFncywgeCwgeSwgY2FudmFzLCBOVUxMKTsKK30KKwordm9pZCBUZXh0TGF5b3V0OjpnZXRUZXh0UGF0aChTa1BhaW50ICpwYWludCwgY29uc3QgamNoYXIgKnRleHQsIGpzaXplIGxlbiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgamludCBiaWRpRmxhZ3MsIGpmbG9hdCB4LCBqZmxvYXQgeSwgU2tQYXRoICpwYXRoKSB7CisgICAgaGFuZGxlVGV4dChwYWludCwgdGV4dCwgbGVuLCBiaWRpRmxhZ3MsIHgsIHksIE5VTEwsIHBhdGgpOworfQorCisKK3ZvaWQgVGV4dExheW91dDo6ZHJhd1RleHRPblBhdGgoU2tQYWludCogcGFpbnQsIGNvbnN0IGpjaGFyKiB0ZXh0LCBpbnQgY291bnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBiaWRpRmxhZ3MsIGpmbG9hdCBoT2Zmc2V0LCBqZmxvYXQgdk9mZnNldCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU2tQYXRoKiBwYXRoLCBTa0NhbnZhcyogY2FudmFzKSB7CisKKyAgICBTa1NjYWxhciBoXyA9IFNrRmxvYXRUb1NjYWxhcihoT2Zmc2V0KTsKKyAgICBTa1NjYWxhciB2XyA9IFNrRmxvYXRUb1NjYWxhcih2T2Zmc2V0KTsKKworICAgIGlmICghbmVlZHNMYXlvdXQodGV4dCwgY291bnQsIGJpZGlGbGFncykpIHsKKyAgICAg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gICAgICAgIGtCaWRpX0ZvcmNlX0xUUiA9IDQsCisgICAgICAgIGtCaWRpX0ZvcmNlX1JUTCA9IDUsCisKKyAgICAgICAga0JpZGlfTWFzayA9IDB4NworICAgIH07CisKKyAgICAvKgorICAgICAqIERyYXdzIGEgdW5pZGlyZWN0aW9uYWwgcnVuIG9mIHRleHQuCisgICAgICovCisgICAgc3RhdGljIHZvaWQgZHJhd1RleHRSdW4oU2tQYWludCogcGFpbnQsIGNvbnN0IGpjaGFyKiBjaGFycywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBqaW50IHN0YXJ0LCBqaW50IGNvdW50LCBqaW50IGNvbnRleHRDb3VudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgZGlyRmxhZ3MsIGpmbG9hdCB4LCBqZmxvYXQgeSwgU2tDYW52YXMqIGNhbnZhcyk7CisKKyAgICBzdGF0aWMgdm9pZCBnZXRUZXh0UnVuQWR2YW5jZXMoU2tQYWludCAqcGFpbnQsIGNvbnN0IGpjaGFyICpjaGFycywgamludCBzdGFydCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgamludCBjb3VudCwgamludCBjb250ZXh0Q291bnQsIGppbnQgZGlyRmxhZ3MsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpmbG9hdCAqcmVzdWx0QWR2YW5jZXMsIGpmbG9hdCAmcmVzdWx0VG90YWxBZHZhbmNlKTsKKworICAgIHN0YXRpYyB2b2lkIGRyYXdUZXh0KFNrUGFpbnQqIHBhaW50LCBjb25zdCBqY2hhciogdGV4dCwganNpemUgbGVuLAorICAgICAgICAgICAgICAgICAgICAgICAgIGppbnQgYmlkaUZsYWdzLCBqZmxvYXQgeCwgamZsb2F0IHksIFNrQ2FudmFzKiBjYW52YXMpOworCisgICAgc3RhdGljIHZvaWQgZ2V0VGV4dFBhdGgoU2tQYWludCAqcGFpbnQsIGNvbnN0IGpjaGFyICp0ZXh0LCBqc2l6ZSBsZW4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgamludCBiaWRpRmxhZ3MsIGpmbG9hdCB4LCBqZmxvYXQgeSwgU2tQYXRoICpwYXRoKTsKKworICAgIHN0YXRpYyB2b2lkIGRyYXdUZXh0T25QYXRoKFNrUGFpbnQqIHBhaW50LCBjb25zdCBqY2hhciogdGV4dCwganNpemUgbGVuLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBiaWRpRmxhZ3MsIGpmbG9hdCBoT2Zmc2V0LCBqZmxvYXQgdk9mZnNldCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTa1BhdGgqIHBhdGgsIFNrQ2FudmFzKiBjYW52YXMpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAorICAgc3RhdGljIGJvb2wgcHJlcGFyZVRleHQoU2tQYWludCAqcGFpbnQsIGNvbnN0IGpjaGFyKiB0ZXh0LCBqc2l6ZSBsZW4sIGppbnQgYmlkaUZsYWdzLAorICAgICAgICBjb25zdCBqY2hhcioqIG91dFRleHQsIGludDMyX3QqIG91dEJ5dGVzLCBqY2hhcioqIG91dEJ1ZmZlcik7CisgICAgc3RhdGljIGJvb2wgcHJlcGFyZVJ0bFRleHRSdW4oY29uc3QgamNoYXIqIGNvbnRleHQsIGpzaXplIHN0YXJ0LCBqc2l6ZSYgY291bnQsCisgICAgICAgIGpzaXplIGNvbnRleHRDb3VudCwgamNoYXIqIHNoYXBlZCk7CisgICAgICAgIAorCitwcml2YXRlOgorICAgIHN0YXRpYyBib29sIG5lZWRzTGF5b3V0KGNvbnN0IGpjaGFyKiB0ZXh0LCBqaW50IGxlbiwgamludCBiaWRpRmxhZ3MpOworICAgIHN0YXRpYyBpbnQgc2hhcGVSdGxUZXh0KGNvbnN0IGpjaGFyKiBjb250ZXh0LCBqc2l6ZSBzdGFydCwganNpemUgY291bnQsIGpzaXplIGNvbnRleHRDb3VudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBqY2hhciogc2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SAoc2NvQmxhY2tsaXN0X3QgKiljYWxsb2MoMSwgc2l6ZW9mKHNjb0JsYWNrbGlzdF90KSk7Ci0gICAgICAgICAgICBpZiAobmV3ZWxlbSA9PSBOVUxMKSB7Ci0gICAgICAgICAgICAgICAgTE9HRSgiJXM6IG91dCBvZiBtZW1vcnkhIiwgX19GVU5DVElPTl9fKTsKLSAgICAgICAgICAgICAgICByZXR1cm47Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICAvLyBwYXJzZSBsaW5lCi0gICAgICAgICAgICBjaGFyICp0eXBlID0gc3RydG9rKE5VTEwsICIsIik7Ci0gICAgICAgICAgICBjaGFyICp2YWx1ZUxpc3QgPSBzdHJ0b2soTlVMTCwgIiwiKTsKLSAgICAgICAgICAgIGNoYXIgKnBhcmFtTGlzdCA9IHN0cnRvayhOVUxMLCAiLCIpOwotICAgICAgICAgICAgaWYgKENPTVBBUkVfU1RSSU5HKHR5cGUsIEJMQUNLTElTVF9CWV9OQU1FKSkgewotICAgICAgICAgICAgICAgIC8vIEV4dHJhY3QgTmFtZSBmcm9tIFZhbHVlIGxpc3QKLSAgICAgICAgICAgICAgICBuZXdlbGVtLT5maWVsZFR5cGUgPSBCTF9UWVBFX05BTUU7Ci0gICAgICAgICAgICAgICAgbmV3ZWxlbS0+dmFsdWUgPSAoY2hhciAqKWNhbGxvYygxLCBzdHJsZW4odmFsdWVMaXN0KSk7Ci0gICAgICAgICAgICAgICAgaWYgKG5ld2VsZW0tPnZhbHVlID09IE5VTEwpIHsKLSAgICAgICAgICAgICAgICAgICAgTE9HRSgiJXM6IG91dCBvZiBtZW1vcnkhIiwgX19GVU5DVElPTl9fKTsKLSAgICAgICAgICAgICAgICAgICAgY29udGludWU7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIHZhbHVlTGlzdCsrOyAgLy8gU2tpcCBvcGVuIHF1b3RlCi0gICAgICAgICAgICAgICAgc3RybmNweShuZXdlbGVtLT52YWx1ZSwgdmFsdWVMaXN0LCBzdHJsZW4odmFsdWVMaXN0KSAtIDEpOwotCi0gICAgICAgICAgICAgICAgLy8gR2V0IFNjbyBTZXR0aW5ncyBmcm9tIFBhcmFtZXRlcnMKLSAgICAgICAgICAgICAgICBjaGFyICpwYXJhbSA9IHN0cnRvayhwYXJhbUxpc3QsICI7Iik7Ci0gICAgICAgICAgICAgICAgdWludDE2X3Qgc2NvVHlwZXMgPSAwOwotICAgICAgICAgICAgICAgIHdoaWxlIChwYXJhbSAhPSBOVUxMKSB7Ci0gICAgICAgICAgICAgICAgICAgIHVpbnQxNl90IHNjbzsKLSAgICAgICAgICAgICAgICAgICAgaWYgKHBhcmFtWzBdID09ICctJykgewotICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW0rKzsKLSAgICAgICAgICAgICAgICAgICAgICAgIHNjbyA9IHN0cjJzY29UeXBlKHBhcmFtKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzY28gIT0gMCkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY29UeXBlcyAmPSB+c2NvOwotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHBhcmFtWzBdID09ICcrJykgewotICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW0rKzsKLSAgICAgICAgICAgICAgICAgICAgICAgIHNjbyA9IHN0cjJzY29UeXBlKHBhcmFtKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzY28gIT0gMCkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY29UeXBlcyB8PSBzY287Ci0gICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAocGFyYW1bMF0gPT0gJz0nKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBwYXJhbSsrOwotICAgICAgICAgICAgICAgICAgICAgICAgc2NvID0gc3RyMnNjb1R5cGUocGFyYW0pOwotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHNjbyAhPSAwKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNjb1R5cGVzID0gc2NvOwotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgTE9HRSgiSW52YWxpZCBTQ08gdHlwZSBtdXN0IGJlID0sICsgb3IgLSIpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIHBhcmFtID0gc3RydG9rKE5VTEwsICI7Iik7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIG5ld2VsZW0tPnNjb1R5cGUgPSBzY29UeXBlczsKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgTE9HRSgiVW5rbm93biBTQ08gdHlwZSBlbnRyeSBpbiBCbGFja2xpc3QgZmlsZSIpOwotICAgICAgICAgICAgICAgIGNvbnRpbnVlOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKGxpc3QpIHsKLSAgICAgICAgICAgICAgICBsaXN0LT5uZXh0ID0gbmV3ZWxlbTsKLSAgICAgICAgICAgICAgICBsaXN0ID0gbmV3ZWxlbTsKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgYmxhY2tsaXN0ID0gbGlzdCA9IG5ld2VsZW07Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBMT0dJKCJFbnRyeSBuYW1lID0gJXMgU2NvVHlwZXMgPSAweCV4IiwgbmV3ZWxlbS0+dmFsdWUsCi0gICAgICAgICAgICAgICAgIG5ld2VsZW0tPnNjb1R5cGUpOwotICAgICAgICB9Ci0gICAgfQotICAgIGZjbG9zZShmcCk7Ci0gICAgcmV0dXJuOwotfQotc3RhdGljIHVpbnQxNl90IGdldFNjb1R5cGUoY2hhciAqYWRkcmVzcywgY29uc3QgY2hhciAqbmFtZSkgewotICAgIHVpbnQxNl90IHJldCA9IDA7Ci0gICAgc2NvQmxhY2tsaXN0X3QgKmxpc3QgPSBibGFja2xpc3Q7Ci0KLSAgICB3aGlsZSAobGlzdCAhPSB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LDYgKzY5LDE2IEBACiAgICAgeyJVVUlEcyIsIERCVVNfVFlQRV9BUlJBWX0sCiB9OwogCitzdGF0aWMgUHJvcGVydGllcyBpbnB1dF9wcm9wZXJ0aWVzW10gPSB7CisgICAgeyJDb25uZWN0ZWQiLCBEQlVTX1RZUEVfQk9PTEVBTn0sCit9OworCitzdGF0aWMgUHJvcGVydGllcyBwYW5fcHJvcGVydGllc1tdID0geworICAgIHsiQ29ubmVjdGVkIiwgREJVU19UWVBFX0JPT0xFQU59LAorICAgIHsiSW50ZXJmYWNlIiwgREJVU19UWVBFX1NUUklOR30sCisgICAgeyJVVUlEIiwgREJVU19UWVBFX1NUUklOR30sCit9OworCiB0eXBlZGVmIHVuaW9uIHsKICAgICBjaGFyICpzdHJfdmFsOwogICAgIGludCBpbnRfdmFsOwpAQCAtMTg3LDYgKzE5Nyw3IEBACiAgICAgZGJ1c19ib29sX3QgcmV0OwogICAgIHZhX2xpc3QgbHN0OwogICAgIHZhX3N0YXJ0KGxzdCwgZmlyc3RfYXJnX3R5cGUpOworCiAgICAgcmV0ID0gZGJ1c19mdW5jX2FyZ3NfYXN5bmNfdmFsaXN0KGVudiwgY29ubiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGltZW91dF9tcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVwbHksIHVzZXIsIG5hdCwKQEAgLTY5OSw2ICs3MTAsMTYgQEAKICAgICAgICAgICAgICAgICAgICAgc2l6ZW9mKHJlbW90ZV9kZXZpY2VfcHJvcGVydGllcykgLyBzaXplb2YoUHJvcGVydGllcykpOwogfQogCitqb2JqZWN0QXJyYXkgcGFyc2VfaW5wdXRfcHJvcGVydHlfY2hhbmdlKEpOSUVudiAqZW52LCBEQnVzTWVzc2FnZSAqbXNnKSB7CisgICAgcmV0dXJuIHBhcnNlX3Byb3BlcnR5X2NoYW5nZShlbnYsIG1zZywgKFByb3BlcnRpZXMgKikgJmlucHV0X3By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bmRvdy0+cmVhZF9maWVsZF9zbG90KHJvdywgY29sdW1uLCAmZmllbGQpOwotICAgIGlmIChlcnIgIT0gMCkgewotICAgICAgICB0aHJvd0V4Y2VwdGlvbldpdGhSb3dDb2woZW52LCByb3csIGNvbHVtbik7Ci0gICAgICAgIHJldHVybiBOVUxMOwotICAgIH0KLQotICAgIHJldHVybiBmaWVsZC50eXBlID09IEZJRUxEX1RZUEVfRkxPQVQ7Ci19Ci0KIHN0YXRpYyBqc3RyaW5nIGdldFN0cmluZ19uYXRpdmUoSk5JRW52KiBlbnYsIGpvYmplY3Qgb2JqZWN0LCBqaW50IHJvdywgamludCBjb2x1bW4pCiB7CiAgICAgaW50MzJfdCBlcnI7CkBAIC00ODcsMTAgKzQyMyw5IEBACiAgICAgfQogfQogCi1zdGF0aWMgamJvb2xlYW4gaXNOdWxsX25hdGl2ZShKTklFbnYqIGVudiwgam9iamVjdCBvYmplY3QsIGppbnQgcm93LCBqaW50IGNvbHVtbikKK2Jvb2wgaXNOdWxsX25hdGl2ZShDdXJzb3JXaW5kb3cgKndpbmRvdywgamludCByb3csIGppbnQgY29sdW1uKQogewotICAgIEN1cnNvcldpbmRvdyAqIHdpbmRvdyA9IEdFVF9XSU5ET1coZW52LCBvYmplY3QpOwotTE9HX1dJTkRPVygiQ2hlY2tpbmcgZm9yIE5VTEwgYXQgJWQsJWQgZnJvbSAlcCIsIHJvdywgY29sdW1uLCB3aW5kb3cpOworICAgIExPR19XSU5ET1coIkNoZWNraW5nIGZvciBOVUxMIGF0ICVkLCVkIGZyb20gJXAiLCByb3csIGNvbHVtbiwgd2luZG93KTsKIAogICAgIGJvb2wgaXNOdWxsOwogICAgIGlmICh3aW5kb3ctPmdldE51bGwocm93LCBjb2x1bW4sICZpc051bGwpKSB7CkBAIC02NTIsNiArNTg3LDI2IEBACiAgICAgd2luZG93LT5mcmVlTGFzdFJvdygpOwogfQogCitzdGF0aWMgamludCBnZXRUeXBlX25hdGl2ZShKTklFbnYqIGVudiw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nVuY3Rpb24gb2JqZWN0IGZyb20gb3VyIHVzZXIgZGF0YQorICAgIGpvYmplY3QgZnVuY3Rpb24gPSAoam9iamVjdClzcWxpdGUzX3VzZXJfZGF0YShjb250ZXh0KTsKKworICAgIC8vIHBhY2sgdXAgdGhlIGFyZ3VtZW50cyBpbnRvIGEgc3RyaW5nIGFycmF5CisgICAgaWYgKCFzdHJpbmdfY2xhc3MpCisgICAgICAgIHN0cmluZ19jbGFzcyA9IChqY2xhc3MpZW52LT5OZXdHbG9iYWxSZWYoZW52LT5GaW5kQ2xhc3MoImphdmEvbGFuZy9TdHJpbmciKSk7CisgICAgam9iamVjdEFycmF5IHN0ckFycmF5ID0gZW52LT5OZXdPYmplY3RBcnJheShhcmdjLCBzdHJpbmdfY2xhc3MsIE5VTEwpOworICAgIGlmICghc3RyQXJyYXkpCisgICAgICAgIGdvdG8gZG9uZTsKKyAgICBmb3IgKGludCBpID0gMDsgaSA8IGFyZ2M7IGkrKykgeworICAgICAgICBjaGFyKiBhcmcgPSAoY2hhciAqKXNxbGl0ZTNfdmFsdWVfdGV4dChhcmd2W2ldKTsKKyAgICAgICAgaWYgKCFhcmcpIHsKKyAgICAgICAgICAgIExPR0UoIk5VTEwgYXJndW1lbnQgaW4gY3VzdG9tX2Z1bmN0aW9uX2NhbGxiYWNrLiAgVGhpcyBzaG91bGQgbm90IGhhcHBlbi4iKTsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorICAgICAgICBqb2JqZWN0IG9iaiA9IGVudi0+TmV3U3RyaW5nVVRGKGFyZyk7CisgICAgICAgIGlmICghb2JqKQorICAgICAgICAgICAgZ290byBkb25lOworICAgICAgICBlbnYtPlNldE9iamVjdEFycmF5RWxlbWVudChzdHJBcnJheSwgaSwgb2JqKTsKKyAgICAgICAgZW52LT5EZWxldGVMb2NhbFJlZihvYmopOworICAgIH0KKworICAgIGVudi0+Q2FsbFZvaWRNZXRob2QoZnVuY3Rpb24sIG1ldGhvZF9jdXN0b21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3IEBACiAgICAgICAgICAgICAgICAgICAgIGludCBvZmZzZXQgPSB3aW5kb3ctPmFsbG9jKHNpemUpOwogICAgICAgICAgICAgICAgICAgICBpZiAoIW9mZnNldCkgewogICAgICAgICAgICAgICAgICAgICAgICAgd2luZG93LT5mcmVlTGFzdFJvdygpOwotICAgICAgICAgICAgICAgICAgICAgICAgTE9HRSgiRmFpbGVkIGFsbG9jYXRpbmcgJXUgYnl0ZXMgZm9yIHRleHQvYmxvYiBhdCAlZCwlZCIsIHNpemUsCisgICAgICAgICAgICAgICAgICAgICAgICBMT0dEKCJGYWlsZWQgYWxsb2NhdGluZyAldSBieXRlcyBmb3IgdGV4dC9ibG9iIGF0ICVkLCVkIiwgc2l6ZSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnRQb3MgKyBudW1Sb3dzLCBpKTsKICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBzdGFydFBvcyArIG51bVJvd3MgKyBmaW5pc2hfcHJvZ3JhbV9hbmRfZ2V0X3Jvd19jb3VudChzdGF0ZW1lbnQpICsgMTsKICAgICAgICAgICAgICAgICAgICAgfQpAQCAtMjI1LDcgKzIyNSw3IEBACiAgICAgICAgICAgICAgICAgICAgIGludDY0X3QgdmFsdWUgPSBzcWxpdGUzX2NvbHVtbl9pbnQ2NChzdGF0ZW1lbnQsIGkpOwogICAgICAgICAgICAgICAgICAgICBpZiAoIXdpbmRvdy0+cHV0TG9uZyhudW1Sb3dzLCBpLCB2YWx1ZSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgIHdpbmRvdy0+ZnJlZUxhc3RSb3coKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIExPR0UoIkZhaWxlZCBhbGxvY2F0aW5nIHNwYWNlIGZvciBhIGxvbmcgaW4gY29sdW1uICVkIiwgaSk7CisgICAgICAgICAgICAgICAgICAgICAgICBMT0dEKCJGYWlsZWQgYWxsb2NhdGluZyBzcGFjZSBmb3IgYSBsb25nIGluIGNvbHVtbiAlZCIsIGkpOwogICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHN0YXJ0UG9zICsgbnVtUm93cyArIGZpbmlzaF9wcm9ncmFtX2FuZF9nZXRfcm93X2NvdW50KHN0YXRlbWVudCkgKyAxOwogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIExPR19XSU5ET1coIiVkLCVkIGlzIElOVEVHRVIgMHglMDE2bGx4Iiwgc3RhcnRQb3MgKyBudW1Sb3dzLCBpLCB2YWx1ZSk7CkBAIC0yMzQsNyArMjM0LDcgQEAKICAgICAgICAgICAgICAgICAgICAgZG91YmxlIHZhbHVlID0gc3FsaXRlM19jb2x1bW5fZG91YmxlKHN0YXRlbWVudCwgaSk7CiAgICAgICAgICAgICAgICAgICAgIGlmICghd2luZG93LT5wdXREb3VibGUobnVtUm93cywgaSwgdmFsdWUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICB3aW5kb3ctPmZyZWVMYXN0Um93KCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBMT0dFKCJGYWlsZWQgYWxsb2NhdGluZyBzcGFjZSBmb3IgYSBkb3VibGUgaW4gY29sdW1uICVkIiwgaSk7CisgICAgICAgICAgICAgICAgICAgICAgICBMT0dEKCJGYWlsZWQgYWxsb2NhdGluZyBzcGFjZSBmb3IgYSBkb3VibGUgaW4gY29sdW1uICVkIiwgaSk7CiAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gc3RhcnRQb3MgKyBudW1Sb3dzICsgZmluaXNoX3Byb2dyYW1fYW5kX2dldF9yb3dfY291bnQoc3RhdGVtZW50KSArIDE7CiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgTE9HX1dJTkRPVygiJWQsJWQgaXMgRkxPQVQgJWxmIiwgc3RhcnRQb3MgKyBudW1Sb3dzLCBpLCB2YWx1ZSk7CkBAIC0yNDUsNyArMjQ1LDcgQEAKICAgICAgICAgICAgICAgICAgIC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Rfcm93aWQoaGFuZGxlKTsKKyAgICB9IGVsc2UgeworICAgICAgICByZXR1cm4gLTE7CisgICAgfQogfQogCiBzdGF0aWMgamxvbmcgbmF0aXZlXzF4MV9sb25nKEpOSUVudiogZW52LCBqb2JqZWN0IG9iamVjdCkKQEAgLTExNSwxMyArMTQwLDExMyBAQAogICAgIHJldHVybiB2YWx1ZTsKIH0KIAorc3RhdGljIGpvYmplY3QgY3JlYXRlUGFyY2VsRmlsZURlc2NyaXB0b3IoSk5JRW52ICogZW52LCBpbnQgZmQpCit7CisgICAgLy8gQ3JlYXRlIEZpbGVEZXNjcmlwdG9yIG9iamVjdAorICAgIGpvYmplY3QgZmlsZURlc2MgPSBuZXdGaWxlRGVzY3JpcHRvcihlbnYsIGZkKTsKKyAgICBpZiAoZmlsZURlc2MgPT0gTlVMTCkgeworICAgICAgICAvLyBGaWxlRGVzY3JpcHRvciBjb25zdHJ1Y3RvciBoYXMgdGhyb3duIGFuIGV4Y2VwdGlvbgorICAgICAgICBjbG9zZShmZCk7CisgICAgICAgIHJldHVybiBOVUxMOworICAgIH0KKworICAgIC8vIFdyYXAgaXQgaW4gYSBQYXJjZWxGaWxlRGVzY3JpcHRvcgorICAgIGpvYmplY3QgcGFyY2VsRmlsZURlc2MgPSBuZXdQYXJjZWxGaWxlRGVzY3JpcHRvcihlbnYsIGZpbGVEZXNjKTsKKyAgICBpZiAocGFyY2VsRmlsZURlc2MgPT0gTlVMTCkgeworICAgICAgICAvLyBQYXJjZWxGaWxlRGVzY3JpcHRvciBjb25zdHJ1Y3RvciBoYXMgdGhyb3duIGFuIGV4Y2VwdGlvbgorICAgICAgICBjbG9zZShmZCk7CisgICAgICAgIHJldHVybiBOVUxMOworICAgIH0KKworICAgIHJldHVybiBwYXJjZWxGaWxlRGVzYzsKK30KKworLy8gQ3JlYXRlcyBhbiBhc2htZW0gYXJlYSwgY29waWVzIHNvbWUgZGF0YSBpbnRvIGl0LCBhbmQgcmV0dXJucworLy8gYSBQYXJjZWxGaWxlRGVzY3JpcHRvciBmb3IgdGhlIGFzaG1lbSBhcmVhLgorc3RhdGljIGpvYmplY3QgY3JlYXRlX2FzaG1lbV9yZWdpb25fd2l0aF9kYXRhKEpOSUVudiAqIGVudiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCB2b2lkICogZGF0YSwgaW50IGxlbmd0aCkKK3sKKyAgICAvLyBDcmVhdGUgYXNobWVtIGFyZWEKKyAgICBpbnQgZmQgPSBhc2htZW1fY3JlYXRlX3JlZ2lvbihOVUxMLCBsZW5ndGgpOworICAgIGlmIChmZCA8IDApIHsKKyAgICAgICAgTE9HRSgiYXNobWVtX2NyZWF0ZV9yZWdpb24gZmFpbGVkOiAlcyIsIHN0cmVycm9yKGVycm5vKSk7CisgICAgICAgIGpuaVRocm93SU9FeGNlcHRpb24oZW52LCBlcnJubyk7CisgICAgICAgIHJldHVybiBOVUxMOworICAgIH0KKworICAgIGlmIChsZW5ndGggPiAwKSB7CisgICAgICAgIC8vIG1tYXAgdGhlIGFzaG1lbSBhcmVhCisgICAgICAgIHZvaWQgKiBhc2htZW1fcHRyID0KKyAgICAgICAgICAgICAgICBtbWFwKE5VTEwsIGxlbmd0aCwgUFJPVF9SRUFEIHwgUFJPVF9XUklURSwgTUFQX1NIQVJFRCwgZmQsIDApOworICAgICAgICBpZiAoYXNobWVtX3B0ciA9PSBNQVBfRkFJTEVEKSB7CisgICAgICAgICAgICBMT0dFKCJtbWFwIGZhaWxlZDogJXMiLCBzdHJlcnJvcihlcnJubykpOworICAgICAgICAgICAgam5pVGhyb3dJT0V4Y2VwdGlvbihlbnYsIGVycm5vKTsKKyAgICAgICAgICAgIGNsb3NlKGZkKTsKKyAgICAgICAgICAgIHJldHVybiBOVUxMOworICAgICAgICB9CisKKyAgICAgICAgLy8gQ29weSBkYXRhIHRvIGFzaG1lbSBhcmVhCisgICAgICAgIG1lbWNweShhc2htZW1fcHRyLCBkYXRhLCBsZW5ndGgpOworCisgICAgICAgIC8vIG11bm1hcCBhc2htZW0gYXJlYQorICAgICAgICBpZiAobXVubWFwKGFzaG1lbV9wdHIsIGxlbmd0aCkgPCAwKSB7CisgICAgICAgICAgICBMT0dFKCJtdW5tYXAgZmFpbGVkOiAlcyIsIHN0cmVycm9yKGVycm5vKSk7CisgICAgICAgICAgICBqbmlUaHJvd0lPRXhjZXB0aW9uKGVudiwgZXJybm8pOworICAgICAgICAgICAgY2xvc2UoZmQpOworICAgICAgICAgICAgcmV0dXJuIE5VTEw7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvLyBNYWtlIGFzaG1lbSBhcmVhIHJlYWQtb25seQorICAgIGlmIChhc2htZW1fc2V0X3Byb3RfcmVnaW9uKGZkLCBQUk9UX1JFQUQpIDwgMCkgeworICAgICAgICBMT0dFKCJhc2htZW1fc2V0X3Byb3RfcmVnaW9uIGZhaWxlZDogJXMiLCBzdHJlcnJvcihlcnJubykpOworICAgICAgICBqbmlUaHJvd0lPRXhjZXB0aW9uKGVudiwgZXJybm8pOworICAgICAgICBjbG9zZShmZCk7CisgICAgICAgIHJldHVybiBOVUxMOworICAgIH0KKworICAgIC8vIFdyYXAgaXQgaW4gYSBQYXJjZWxGaWxlRGVzY3JpcHRvcgorICAgIHJldHVybiBjcmVhdGVQYXJjZWxGaWxlRGVzY3JpcHRvcihlbnYsIGZkKTsKK30KKworc3RhdGljIGpvYmplY3QgbmF0aXZlXzF4MV9ibG9iX2FzaG1lbShKTklFbnYqIGVudiwgam9iamVjdCBvYmplY3QpCit7CisgICAgaW50IGVycjsKKyAgICBzcWxpdGUzICogaGFuZGxlID0gR0VUX0hBTkRMRShlbnYsIG9iamVjdCk7CisgICAgc3FsaXRlM19zdG10ICogc3RhdGVtZW50ID0gR0VUX1NUQVRFTUVOVChlbnYsIG9iamVjdCk7CisgICAgam9iamVjdCB2YWx1ZSA9IE5VTEw7CisKKyAgICAvLyBFeGVjdXRlIHRoZSBzdGF0ZW1lbnQKKyAg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p6KQoreworICAgIHJldHVybiAoamJvb2xlYW4pKDo6aXNfd2lmaV9kcml2ZXJfbG9hZGVkKCkgPT0gMSk7Cit9CisKIHN0YXRpYyBqYm9vbGVhbiBhbmRyb2lkX25ldF93aWZpX2xvYWREcml2ZXIoSk5JRW52KiBlbnYsIGpvYmplY3QgY2xhenopCiB7CiAgICAgcmV0dXJuIChqYm9vbGVhbikoOjp3aWZpX2xvYWRfZHJpdmVyKCkgPT0gMCk7CkBAIC00MDYsNiArNDExLDMwIEBACiAgICAgcmV0dXJuIChqaW50KXBvd2VyOwogfQogCitzdGF0aWMgamJvb2xlYW4gYW5kcm9pZF9uZXRfd2lmaV9zZXRCYW5kQ29tbWFuZChKTklFbnYqIGVudiwgam9iamVjdCBjbGF6eiwgamludCBiYW5kKQoreworICAgIGNoYXIgY21kc3RyWzI1XTsKKworICAgIGludCBudW1Xcml0dGVuID0gc25wcmludGYoY21kc3RyLCBzaXplb2YoY21kc3RyKSwgIkRSSVZFUiBTRVRCQU5EICVkIiwgYmFuZCk7CisgICAgaW50IGNtZFRvb0xvbmcgPSBudW1Xcml0dGVuID49IChpbnQpc2l6ZW9mKGNtZHN0cik7CisKKyAgICByZXR1cm4gKGpib29sZWFuKSFjbWRUb29Mb25nICYmIGRvQm9vbGVhbkNvbW1hbmQoY21kc3RyLCAiT0siKTsKK30KKworc3RhdGljIGppbnQgYW5kcm9pZF9uZXRfd2lmaV9nZXRCYW5kQ29tbWFuZChKTklFbnYqIGVudiwgam9iamVjdCBjbGF6eikKK3sKKyAgICBjaGFyIHJlcGx5WzI1XTsKKyAgICBpbnQgYmFuZDsKKworICAgIGlmIChkb0NvbW1hbmQoIkRSSVZFUiBHRVRCQU5EIiwgcmVwbHksIHNpemVvZihyZXBseSkpICE9IDApIHsKKyAgICAgICAgcmV0dXJuIChqaW50KS0xOworICAgIH0KKyAgICAvLyByZXBseSBjb21lcyBiYWNrIGluIHRoZSBmb3JtICJCYW5kIFgiIHdoZXJlIFggaXMgdGh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3RhY2sgdHJhY2UuICBTaW5jZSB0aGUgZW50cmllcyBhcmUKKyAqIGZpeGVkLXNpemUsIGFuZCB3ZSdyZSBhbGxvd2VkIChieSB0aGUgY3VycmVudCBpbXBsZW1lbnRhdGlvbikgdG8gbWFuZ2xlCisgKiB0aGVtLCB3ZSBjYW4gZG8gdGhpcyBpbiBwbGFjZS4KKyAqLworc3RhdGljIHZvaWQgZHVtcE5hdGl2ZUhlYXAoRklMRSogZnApCit7CisgICAgdWludDhfdCogaW5mbyA9IE5VTEw7CisgICAgc2l6ZV90IG92ZXJhbGxTaXplLCBpbmZvU2l6ZSwgdG90YWxNZW1vcnksIGJhY2t0cmFjZVNpemU7CisKKyAgICBnZXRfbWFsbG9jX2xlYWtfaW5mbygmaW5mbywgJm92ZXJhbGxTaXplLCAmaW5mb1NpemUsICZ0b3RhbE1lbW9yeSwKKyAgICAgICAgJmJhY2t0cmFjZVNpemUpOworICAgIGlmIChpbmZvID09IE5VTEwpIHsKKyAgICAgICAgZnByaW50ZihmcCwgIk5hdGl2ZSBoZWFwIGR1bXAgbm90IGF2YWlsYWJsZS4gVG8gZW5hYmxlLCBydW4gdGhlc2UiCisgICAgICAgICAgICAgICAgICAgICIgY29tbWFuZHMgKHJlcXVpcmVzIHJvb3QpOlxuIik7CisgICAgICAgIGZwcmludGYoZnAsICIkIGFkYiBzaGVsbCBzZXRwcm9wIGxpYmMuZGVidWcubWFsbG9jIDFcbiIpOworICAgICAgICBmcHJpbnRmKGZwLCAiJCBhZGIgc2hlbGwgc3RvcFxuIik7CisgICAgICAgIGZwcmludGYoZnAsICIkIGFkYiBzaGVsbCBzdGFydFxuIik7CisgICAgICAgIHJldHVybjsKKyAgICB9CisgICAgYXNzZXJ0KGluZm9TaXplICE9IDApOworICAgIGFzc2VydChvdmVyYWxsU2l6ZSAlIGluZm9TaXplID09IDApOworCisgICAgZnByaW50ZihmcCwgIkFuZHJvaWQgTmF0aXZlIEhlYXAgRHVtcCB2MS4wXG5cbiIpOwor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BR19aWUdPVEVfQ0hJTEQpICE9IDAsCisgICAgICAgICAgICAgICAgc2l6ZSAmIH5TSVpFX0ZMQUdfWllHT1RFX0NISUxELAorICAgICAgICAgICAgICAgIGFsbG9jYXRpb25zKTsKKyAgICAgICAgZm9yIChzaXplX3QgYnQgPSAwOyBidCA8IGJhY2t0cmFjZVNpemU7IGJ0KyspIHsKKyAgICAgICAgICAgIGlmIChiYWNrdHJhY2VbYnRdID09IDApIHsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgZnByaW50ZihmcCwgIiAlMDh4IiwgYmFja3RyYWNlW2J0XSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgZnByaW50ZihmcCwgIlxuIik7CisKKyAgICAgICAgcHRyICs9IGluZm9TaXplOworICAgIH0KKworICAgIGZwcmludGYoZnAsICJFTkRcbiIpOworICAgIGZyZWVfbWFsbG9jX2xlYWtfaW5mbyhpbmZvKTsKK30KKyNlbmRpZiAvKkhBVkVfQU5EUk9JRF9PUyovCisKKy8qCisgKiBEdW1wIHRoZSBuYXRpdmUgaGVhcCwgd3JpdGluZyBodW1hbi1yZWFkYWJsZSBvdXRwdXQgdG8gdGhlIHNwZWNpZmllZAorICogZmlsZSBkZXNjcmlwdG9yLgorICovCitzdGF0aWMgdm9pZCBhbmRyb2lkX29zX0RlYnVnX2R1bXBOYXRpdmVIZWFwKEpOSUVudiogZW52LCBqb2JqZWN0IGNsYXp6LAorICAgIGpvYmplY3QgZmlsZURlc2NyaXB0b3IpCit7CisgICAgaWYgKGZpbGVEZXNjcmlwdG9yID09IE5VTEwpIHsKKyAgICAgICAgam5pVGhyb3dOdWxsUG9pbnRlckV4Y2VwdGlvbihlbnYsIE5VTEwpOworICAgICAgICByZXR1cm47CisgICAgfQorICAgIGludCBvcmlnRmQgPSBqbmlHZXRGREZyb21GaWxlRGVzY3JpcHRvcihlbnYsIGZpbGVEZXNjcmlw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HR5cGVkZWYgZXZlbnRfbG9vcF9uYXRpdmVfZGF0YV90IG5hdGl2ZV9kYXRhX3Q7CiAKICNkZWZpbmUgRVZFTlRfTE9PUF9SRUZTIDEwCkBAIC05NSw2ICsxMDIsMTAgQEAKICAgICBtZXRob2Rfb25EZXZpY2VSZW1vdmVkID0gZW52LT5HZXRNZXRob2RJRChjbGF6eiwgIm9uRGV2aWNlUmVtb3ZlZCIsICIoTGphdmEvbGFuZy9TdHJpbmc7KVYiKTsKICAgICBtZXRob2Rfb25EZXZpY2VEaXNjb25uZWN0UmVxdWVzdGVkID0gZW52LT5HZXRNZXRob2RJRChjbGF6eiwgIm9uRGV2aWNlRGlzY29ubmVjdFJlcXVlc3RlZCIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICIoTGphdmEvbGFuZy9TdHJpbmc7KVYiKTsKKyAgICBtZXRob2Rfb25OZXR3b3JrRGV2aWNlQ29ubmVjdGVkID0gZW52LT5HZXRNZXRob2RJRChjbGF6eiwgIm9uTmV0d29ya0RldmljZUNvbm5lY3RlZCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICIoTGphdmEvbGFuZy9TdHJpbmc7SSlWIik7CisgICAgbWV0aG9kX29uTmV0d29ya0RldmljZURpc2Nvbm5lY3RlZCA9IGVudi0+R2V0TWV0aG9kSUQoY2xhenosICJvbk5ldHdvcmtEZXZpY2VEaXNjb25uZWN0ZWQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiKExqYXZhL2xhbmcvU3RyaW5nOylWIik7CiAKICAgICBtZXRob2Rfb25DcmVhdGVQYWlyZWREZXZpY2VSZXN1bHQgPSBlbnYtPkdldE1ldGhvZElEKGNsYXp6LCAib25DcmVhdGVQYWlyZWREZXZpY2VSZXN1bHQiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIihMamF2YS9sYW5nL1N0cmluZztJKVYiKTsKQEAgLTExNiw2ICsxMjcsMTQgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIihMamF2YS9sYW5nL1N0cmluZztJKVYiKTsKICAgICBtZXRob2Rfb25EaXNwbGF5UGFzc2tleSA9IGVudi0+R2V0TWV0aG9kSUQoY2xhenosICJvbkRpc3BsYXlQYXNza2V5IiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIihMamF2YS9sYW5nL1N0cmluZztJSSlWIik7CisgICAgbWV0aG9kX29uSW5wdXREZXZpY2VQcm9wZXJ0eUNoYW5nZWQgPSBlbnYtPkdldE1ldGhvZElEKGNsYXp6LCAib25JbnB1dERldmljZVByb3BlcnR5Q2hhbmdlZCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICIoTGphdmEvbGFuZy9TdHJpbmc7W0xqYXZhL2xhbmcvU3RyaW5nOylWIik7CisgICAgbWV0aG9kX29uSW5wdXREZXZpY2VDb25uZWN0aW9uUmVzdWx0ID0gZW52LT5HZXRNZXRob2RJRChjbGF6eiwgIm9uSW5wdXREZXZpY2VDb25uZWN0aW9uUmVzdWx0IiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIihMamF2YS9sYW5nL1N0cmluZztaKVYiKTsKKyAgICBtZXRob2Rfb25QYW5EZXZpY2VQcm9wZXJ0eUNoYW5nZWQgPSBlbnYtPkdldE1ldGhvZElEKGNsYXp6LCAib25QYW5EZXZpY2VQcm9wZXJ0eUNoYW5nZWQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiKExqYXZhL2xhbmcvU3RyaW5nO1tMamF2YS9sYW5nL1N0cmluZzspViIpOworICAgIG1ldGhvZF9vblBhbkRldmljZUNvbm5lY3Rpb25SZXN1bHQgPSBlbnYtPkdldE1ldGhvZElEKGNsYXp6LCAib25QYW5EZXZpY2VDb25uZWN0aW9uUmVzdWx0IiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIihMamF2YS9sYW5nL1N0cmluZztaKVYiKTsKIAogICAgIGZpZWxkX21OYXRpdmVEYXRhID0gZW52LT5HZXRGaWVsZElEKGNsYXp6LCAibU5hdGl2ZURhdGEiLCAiSSIpOwogI2VuZGlmCkBAIC0yMjYsNiArMjQ1LDI3IEBACiAgICAgICAgICAgICByZXR1cm4gSk5JX0ZBTFNFOwogICAgICAgICB9CiAgICAgICAgIGRidXNfYnVzX2FkZF9tYXRjaChuYXQtPmNvbm4sCisgICAgICAgICAgICAgICAgInR5cGU9J3NpZ25hbCcsaW50ZXJmYWNlPSciQkxVRVpfREJVU19CQVNFX0lGQyIuSW5wdXQnIiwKKyAgICAgICAgICAgICAgICAmZXJyKTsKKyAgICAgICAgaWYgKGRidXNfZXJyb3JfaXNfc2V0KCZlcnIpKSB7CisgICAgICAgICAgICBMT0dfQU5EX0ZSRUVfREJVU19FUlJPUigmZXJyKTsKKyAgICAgICAgICAgIHJldHVybiBKTklfRkFMU0U7CisgICAgICAgIH0KKyAgICAgICAgZGJ1c19idXNfYWRkX21hdGNoKG5hdC0+Y29ubiwKKyAgICAgICAgICAgICAgICAidHlwZT0nc2lnbmFsJyxpbnRlcmZhY2U9JyJCTFVFWl9EQlVTX0JBU0VfSUZDIi5OZXR3b3JrJyIsCisgICAgICAgICAgICAgICAgJmVycik7CisgICAgICAgIGlmIChkYnVzX2Vycm9yX2lzX3NldCgmZXJyKSkgeworICAgICAgICAgICAgTE9HX0FORF9GUkVFX0RCVVNfRVJST1IoJmVycik7CisgICAgICAgICAgICByZXR1cm4gSk5JX0ZBTFNFOworICAgICAgICB9CisgICAgICAgIGRidXNfYnVzX2FkZF9tYXRjaChuYXQtPmNvbm4sCisgICAgICAgICAgICAgICAgInR5cGU9J3NpZ25hbCcsaW50ZXJmYWNlPSciQkxVRVpfREJVU19CQVNFX0lGQyIuTmV0d29ya1NlcnZlciciLAorICAgICAgICAgICAgICAgICZlcnIpOworICAgICAgICBpZiAoZGJ1c19lcnJvcl9pc19zZXQoJmVycikpIHsKKyAgICAgICAgICAgIExPR19BTkRfRlJFRV9EQlVTX0VSUk9SKCZlcnIpOworICAgICAgICAgICAgcmV0dXJuIEpOSV9GQUxTRTsKKyAgICAgICAgfQorICAgICAgICBkYnVzX2J1c19hZGRfbWF0Y2gobmF0LT5jb25uLAogICAgICAgICAgICAgICAgICJ0eXBlPSdzaWduYWwnLGludGVyZmFjZT0nb3JnLmJsdWV6LkF1ZGlvU2luayciLAogICAgICAgICAgICAgICAgICZlcnIpOwogICAgICAgICBpZiAoZGJ1c19lcnJvcl9pc19zZXQoJmVycikpIHsKQEAgLTM4MiwxMyArNDIyLDMxIEBACiAgICAgICAgIGRidXNfY29ubmVjdGlvbl91bnJlZ2lzdGVyX29iamVjdF9wYXRoKG5hdC0+Y29ubiwgYWdlbnRfcGF0aCk7CiAKICAgICAgICAgZGJ1c19idXNfcmVtb3ZlX21hdGNoKG5hdC0+Y29ubiwKLSAgICAgICAgICAgICAgICAidHlwZT0nc2lnbmFsJyxpbnRlcmZhY2U9J29yZy5ibHVlei5BdWRpb1NpbmsnIiwKKyAgICAgICAgICAgICAgICAidHlwZT0nc2lnbmFsJyxpbnRlcmZhY2U9JyJCTFVFWl9EQlVTX0JBU0VfSUZDIi5BdWRpb1NpbmsnIiwKICAgICAgICAgICAgICAgICAmZXJyKTsKICAgICAgICAgaWYgKGRidXNfZXJyb3JfaXNfc2V0KCZlcnIpKSB7CiAgICAgICAgICAgICBMT0dfQU5EX0ZSRUVfREJVU19FUlJPUigmZXJyKTsKICAgICAgICAgfQogICAgICAgICBkYnVzX2J1c19yZW1vdmVfbWF0Y2gobmF0LT5jb25uLAotICAgICAgICAgICAgICAgICJ0eXBlPSdzaWduYWwnLGludGVyZmFjZT0nb3JnLmJsdWV6LmF1ZGlvLkRldmljZSciLAorICAgICAgICAgICAgICAgICJ0eXBlPSdzaWduYWwnLGludGVyZmFjZT0nIkJMVUVaX0RCVVNfQkFTRV9JRkMiLkRldmljZSciLAorICAgICAgICAgICAgICAgICZlcnIpOworICAgICAgICBpZiAoZGJ1c19lcnJvcl9pc19zZXQoJmVycikpIHsKKyAgICAgICAgICAgIExPR19BTkRfRlJFRV9EQlVTX0VSUk9SKCZlcnIpOworICAgICAgICB9CisgICAgICAgIGRidXNfYnVzX3JlbW92ZV9tYXRjaChuYXQtPmNvbm4sCisgICAgICAgICAgICAgICAgInR5cGU9J3NpZ25hbCcsaW50ZXJmYWNlPSciQkxVRVpfREJVU19CQVNFX0lGQyIuSW5wdXQnIiwKKyAgICAgICAgICAgICAgICAmZXJyKTsKKyAgICAgICAgaWYgKGRidXNfZXJyb3JfaXNfc2V0KCZlcnIpKSB7CisgICAgICAgICAgICBMT0dfQU5EX0ZSRUVfREJVU19FUlJPUigmZXJyKTsKKyAgICAgICAgfQorICAgICAgICBkYnVzX2J1c19yZW1vdmVfbWF0Y2gobmF0LT5jb25uLAorICAgICAgICAgICAgICAgICJ0eXBlPSdzaWduYWwnLGludGVyZmFjZT0nIkJMVUVaX0RCVVNfQkFTRV9JRkMiLk5ldHdvcmsnIiwKKyAgICAgICAgICAgICAgICAmZXJyKTsKKyAgICAgICAgaWYgKGRidXNfZXJyb3JfaXNfc2V0KCZlcnIpKSB7CisgICAgICAgICAgICBMT0dfQU5EX0ZSRUVfREJVU19FUlJPUigmZXJyKTsKKyAgICAgICAgfQorICAgICAgICBkYnVzX2J1c19yZW1vdmVfbWF0Y2gobmF0LT5jb25uLAorICAgICAgICAgICAgICAgICJ0eXBlPSdzaWduYWwnLGludGVyZmFjZT0nIkJMVUVaX0RCVVNfQkFTRV9JRkMiLk5ldHdvcmtTZXJ2ZXInIiwKICAgICAgICAgICAgICAgICAmZXJyKTsKICAgICAgICAgaWYgKGRidXNfZXJyb3JfaXNfc2V0KCZlcnIpKSB7CiAgICAgICAgICAgICBMT0dfQU5EX0ZSRUVfREJVU19FUlJPUigmZXJyKTsKQEAgLTg1Myw2ICs5MTEsNzAgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXRob2Rfb25EZXZpY2VEaXNjb25uZWN0UmVxdWVzdGVkLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudi0+TmV3U3RyaW5nVVRGKHJlbW90ZV9kZXZpY2VfcGF0aCkpOwogICAgICAgICBnb3RvIHN1Y2Nlc3M7CisgICAgfSBlbHNlIGlmIChkYnVzX21lc3NhZ2VfaXNfc2lnbmFsKG1zZywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIm9yZy5ibHVlei5JbnB1dCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJQcm9wZXJ0eUNoYW5nZWQiKSkgeworCisgICAgICAgIGpvYmplY3RBcnJheSBzdHJfYXJyYXkgPQorICAgICAgICAgICAgICAgICAgICBwYXJzZV9pbnB1dF9wcm9wZXJ0eV9jaGFuZ2UoZW52LCBtc2cpOworICAgICAgICBpZiAoc3RyX2FycmF5ICE9IE5VTEwpIHsKKyAgICAgICAgICAgIGNvbnN0IGNoYXIgKmNfcGF0aCA9IGRidXNfbWVzc2FnZV9nZXRfcGF0aChtc2cpOworICAgICAgICAgICAgZW52LT5DYWxsVm9pZE1ldGhvZChuYXQtPm1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXRob2Rfb25JbnB1dERldmljZVByb3BlcnR5Q2hhbmdlZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW52LT5OZXdTdHJpbmdVVEYoY19wYXRoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RyX2FycmF5KTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIExPR19BTkRfRlJFRV9EQlVTX0VSUk9SX1dJVEhfTVNHKCZlcnIsIG1zZyk7CisgICAgICAgIH0KKyAgICAgICAgZ290byBzdWNjZXNzOworICAgIH0gZWxzZSBpZiAoZGJ1c19tZXNzYWdlX2lzX3NpZ25hbChtc2csCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIm9yZy5ibHVlei5OZXR3b3JrIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiUHJvcGVydHlDaGFuZ2VkIikpIHsKKworICAgICAgIGpvYmplY3RBcnJheSBzdHJfYXJyYXkgPQorICAgICAgICAgICAgICAgICAgIHBhcnNlX3Bhbl9wcm9wZXJ0eV9jaGFuZ2UoZW52LCBtc2cpOworICAgICAgIGlmIChzdHJfYXJyYXkgIT0gTlVMTCkgeworICAgICAgICAgICBjb25zdCBjaGFyICpjX3BhdGggPSBkYnVzX21lc3NhZ2VfZ2V0X3BhdGgobXNnKTsKKyAgICAgICAgICAgZW52LT5DYWxsVm9pZE1ldGhvZChuYXQtPm1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ldGhvZF9vblBhbkRldmljZVByb3BlcnR5Q2hhbmdlZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBlbnYtPk5ld1N0cmluZ1VURihjX3BhdGgpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cl9hcnJheSk7CisgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgTE9HX0FORF9GUkVFX0RCVVNfRVJST1JfV0lUSF9NU0coJmVyciwgbXNnKTsKKyAgICAgICB9CisgICAgICAgZ290byBzdWNjZXNzOworICAgIH0gZWxzZSBpZiAoZGJ1c19tZXNzYWdlX2lzX3NpZ25hbChtc2csCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIm9yZy5ibHVlei5OZXR3b3JrU2VydmVyIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiRGV2aWNlRGlzY29ubmVjdGVkIikpIHsKKyAgICAgICBjaGFyICpjX2FkZHJlc3M7CisgICAgICAgaWYgKGRidXNfbWVzc2FnZV9nZXRfYXJncyhtc2csICZlcnIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgREJVU19UWVBFX1NUUklORywgJmNfYWRkcmVzcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEQlVTX1RZUEVfSU5WQUxJRCkpIHsKKyAgICAgICAgICAgZW52LT5DYWxsVm9pZE1ldGhvZChuYXQtPm1lLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ldGhvZF9vbk5ldHdvcmtEZXZpY2VEaXNjb25uZWN0ZWQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW52LT5OZXdTdHJpbmdVVEYoY19hZGRyZXNzKSk7CisgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgTE9HX0FORF9GUkVFX0RCVVNfRVJST1JfV0lUSF9NU0coJmVyciwgbXNnKTsKKyAgICAgICB9CisgICAgICAgZ290byBzdWNjZXNzOworICAgIH0gZWxzZSBpZiAoZGJ1c19tZXNzYWdlX2lzX3NpZ25hbChtc2csCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIm9yZy5ibHVlei5OZXR3b3JrU2VydmVyIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiRGV2aWNlQ29ubmVjdGVkIikpIHsKKyAgICAgICBjaGFyICpjX2FkZHJlc3M7CisgICAgICAgdWludDE2X3QgdXVpZDsKKworICAgICAgIGlmIChkYnVzX21lc3NhZ2VfZ2V0X2FyZ3MobXNnLCAmZXJyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERCVVNfVFlQRV9TVFJJTkcsICZjX2FkZHJlc3MsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgREJVU19UWVBFX1VJTlQxNiwgJnV1aWQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgREJVU19UWVBFX0lOVkFMSUQpKSB7CisgICAgICAgICAgIGVudi0+Q2FsbFZvaWRNZXRob2QobmF0LT5tZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXRob2Rfb25OZXR3b3JrRGV2aWNlQ29ubmVjdGVkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVudi0+TmV3U3RyaW5nVVRGKGNfYWRkcmVzcyksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXVpZCk7CisgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgTE9HX0FORF9GUkVFX0RCVVNfRVJST1JfV0lUSF9NU0coJmVyciwgbXNnKTsKKyAgICAgICB9CisgICAgICAgZ290byBzdWNjZXNzOwogICAgIH0KIAogICAgIHJldCA9IGEyZHBfZXZlbnRfZmlsdGVyKG1zZywgZW52KTsKQEAgLTEyMTAsNiArMTMzMiw1NyBAQAogICAgIGVudi0+RGVsZXRlTG9jYWxSZWYoYWRkcik7CiAgICAgZnJlZSh1c2VyKTsKIH0KKwordm9pZCBvbklucHV0RGV2aWNlQ29ubmVjdGlvblJlc3VsdChEQnVzTWVzc2FnZSAqbXNnLCB2b2lkICp1c2VyLCB2b2lkICpuKSB7CisgICAgTE9HVihfX0ZVTkNUSU9OX18pOworCisgICAgbmF0aXZlX2RhdGFfdCAqbmF0ID0gKG5hdGl2ZV9kYXRhX3QgKiluOworICAgIGNvbnN0IGNoYXIgKnBhdGggPSAoY29uc3QgY2hhciAqKXVzZXI7CisgICAgREJ1c0Vycm9yIGVycjsKKyAgICBkYnVzX2Vycm9yX2luaXQoJmVycik7CisgICAgSk5JRW52ICplbnY7CisgICAgbmF0LT52bS0+R2V0RW52KCh2b2lkKiopJmVudiwgbmF0LT5lbnZWZXIpOworCisgICAgYm9vbCByZXN1bHQgPSBKTklfVFJVRTsKKyAgICBpZiAoZGJ1c19zZXRfZXJyb3JfZnJvbV9tZXNzYWdlKCZlcnIsIG1zZykpIHsKKyAgICAgICAgTE9HX0FORF9GUkVFX0RCVVNfRVJST1IoJmVycik7CisgICAgICAgIHJlc3VsdCA9IEpOSV9GQUxTRTsKKyAgICB9CisgICAgTE9HVigiLi4uIERldmljZSBQYXRoID0gJXMsIHJlc3VsdCA9ICVkIiwgcGF0aCwgcmVzdWx0KTsKKyAgICBqc3RyaW5nIGpQYXRoID0gZW52LT5OZXdTdHJpbmdVVEYocGF0aCk7CisgICAgZW52LT5DYWxsVm9pZE1ldGhvZChuYXQtPm1lLAorICAgICAgICAgICAgICAgICAgICAgICAgbWV0aG9kX29uSW5wdXREZXZpY2VDb25uZWN0aW9uUmVzdWx0LAorICAgICAgICAgICAgICAgICAgICAgICAgalBhdGgsCisgICAgICAgICAgICAgICAgICAgICAgICByZXN1bHQpOworICAgIGVudi0+RGVsZXRlTG9jYWxSZWYoalBhdGgpOworICAgIGZyZWUodXNlcik7Cit9CisKK3ZvaWQgb25QYW5EZXZpY2VDb25uZWN0aW9uUmVzdWx0KERCdXNNZXNzYWdlICptc2csIHZvaWQgKnVzZXIsIHZvaWQgKm4pIHsKKyAgICBMT0dWKF9fRlVOQ1RJT05fXyk7CisKKyAgICBuYXRpdmVfZGF0YV90ICpuYXQgPSAobmF0aXZlX2RhdGFfdCAqKW47CisgICAgY29uc3QgY2hhciAqcGF0aCA9IChjb25zdCBjaGFyICopdXNlcjsKKyAgICBEQnVzRXJyb3IgZXJyOworICAgIGRidXNfZXJyb3JfaW5pdCgmZXJyKTsKKyAgICBKTklFbnYgKmVudjsKKyAgICBuYXQtPnZtLT5HZXRFbnYoKHZvaWQqKikmZW52LCBuYXQtPmVudlZlcik7CisKKyAgICBib29sIHJlc3VsdCA9IEpOSV9UUlVFOworICAgIGlmIChkYnVzX3NldF9lcnJvcl9mcm9tX21lc3NhZ2UoJmVyciwgbXNnKSkgeworICAgICAgICBMT0dfQU5EX0ZSRUVfREJVU19FUlJPUigmZXJyKTsKKyAgICAgICAgcmVzdW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Q0UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIkNvbm5lY3QiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERCVVNfVFlQRV9JTlZBTElEKTsKKworICAgICAgICBlbnYtPlJlbGVhc2VTdHJpbmdVVEZDaGFycyhwYXRoLCBjX3BhdGgpOworICAgICAgICByZXR1cm4gcmV0ID8gSk5JX1RSVUUgOiBKTklfRkFMU0U7CisgICAgfQorI2VuZGlmCisgICAgcmV0dXJuIEpOSV9GQUxTRTsKK30KKworc3RhdGljIGpib29sZWFuIGRpc2Nvbm5lY3RJbnB1dERldmljZU5hdGl2ZShKTklFbnYgKmVudiwgam9iamVjdCBvYmplY3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAganN0cmluZyBwYXRoKSB7CisgICAgTE9HVihfX0ZVTkNUSU9OX18pOworI2lmZGVmIEhBVkVfQkxVRVRPT1RICisgICAgbmF0aXZlX2RhdGFfdCAqbmF0ID0gZ2V0X25hdGl2ZV9kYXRhKGVudiwgb2JqZWN0KTsKKyAgICBqb2JqZWN0IGV2ZW50TG9vcCA9IGVudi0+R2V0T2JqZWN0RmllbGQob2JqZWN0LCBmaWVsZF9tRXZlbnRMb29wKTsKKyAgICBzdHJ1Y3QgZXZlbnRfbG9vcF9uYXRpdmVfZGF0YV90ICpldmVudExvb3BOYXQgPQorICAgICAgICAgICAgZ2V0X0V2ZW50TG9vcF9uYXRpdmVfZGF0YShlbnYsIGV2ZW50TG9vcCk7CisKKyAgICBpZiAobmF0ICYmIGV2ZW50TG9vcE5hdCkgeworICAgICAgICBjb25zdCBjaGFyICpjX3BhdGggPSBlbnYtPkdldFN0cmluZ1VURkNoYXJzKHBhdGgsIE5VTEwpOworCisgICAgICAgIGludCBsZW4gPSBlbnYtPkdldFN0cmluZ0xlbmd0aChwYXRoKSArIDE7CisgICAgICAgIGNoYXIgKmNvbnRleHRfcGF0aCA9IChjaGFyICopY2FsbG9jKGxlbiwgc2l6ZW9mKGNoYXIpKTsKKyAgICAgICAgc3RybGNweShjb250ZXh0X3BhdGgsIGNfcGF0aCwgbGVuKTsgIC8vIGZvciBjYWxsYmFjaworCisgICAgICAgIGJvb2wgcmV0ID0gZGJ1c19mdW5jX2FyZ3NfYXN5bmMoZW52LCBuYXQtPmNvbm4sIC0xLCBvbklucHV0RGV2aWNlQ29ubmVjdGlvblJlc3VsdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZXh0X3BhdGgsIGV2ZW50TG9vcE5hdCwgY19wYXRoLCBEQlVTX0lOUFVUX0lGQUNFLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJEaXNjb25uZWN0IiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEQlVTX1RZUEVfSU5WQUxJRCk7CisKKyAgICAgICAgZW52LT5SZWxlYXNlU3RyaW5nVVRGQ2hhcnMocGF0aCwgY19wYXRoKTsKKyAgICAgICAgcmV0dXJuIHJldCA/IEpOSV9UUlVFIDogSk5JX0ZBTFNFOworICAgIH0KKyNlbmRpZgorICAgIHJldHVybiBKTklfRkFMU0U7Cit9CisKK3N0YXRpYyBqYm9vbGVhbiBzZXRCbHVldG9vdGhUZXRoZXJpbmdOYXRpdmUoSk5JRW52ICplbnYsIGpvYmplY3Qgb2JqZWN0LCBqYm9vbGVhbiB2YWx1ZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAganN0cmluZyBzcmNfcm9sZSwganN0cmluZyBicmlkZ2UpIHsKKyAgICBMT0dWKF9fRlVOQ1RJT05fXyk7CisjaWZkZWYgSEFWRV9CTFVFVE9PVEgKKyAgICBuYXRpdmVfZGF0YV90ICpuYXQgPSBnZXRfbmF0aXZlX2RhdGEoZW52LCBvYmplY3QpOworICAgIGlmIChuYXQpIHsKKyAgICAgICAgREJ1c01lc3NhZ2UgKnJlcGx5OworICAgICAgICBjb25zdCBjaGFyICpjX3JvbGUgPSBlbnYtPkdldFN0cmluZ1VURkNoYXJzKHNyY19yb2xlLCBOVUxMKTsKKyAgICAgICAgY29uc3QgY2hhciAqY19icmlkZ2UgPSBlbnYtPkdldFN0cmluZ1VURkNoYXJzKGJyaWRnZSwgTlVMTCk7CisgICAgICAgIGlmICh2YWx1ZSkgeworICAgICAgICAgICAgTE9HRSgic2V0Qmx1ZXRvb3RoVGV0aGVyaW5nTmF0aXZlIHRydWUiKTsKKyAgICAgICAgICAgIHJlcGx5ID0gZGJ1c19mdW5jX2FyZ3MoZW52LCBuYXQtPmNvbm4sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0X2FkYXB0ZXJfcGF0aChlbnYsIG9iamVjdCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgREJVU19ORVRXT1JLU0VSVkVSX0lGQUNFLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJSZWdpc3RlciIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgREJVU19UWVBFX1NUUklORywgJmNfcm9sZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEQlVTX1RZUEVfU1RSSU5HLCAmY19icmlkZ2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgREJVU19UWVBFX0lOVkFMSUQpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgTE9HRSgic2V0Qmx1ZXRvb3RoVGV0aGVyaW5nTmF0aXZlIGZhbHNlIik7CisgICAgICAgICAgICByZXBseSA9IGRidXNfZnVuY19hcmdzKGVudiwgbmF0LT5jb25uLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldF9hZGFwdGVyX3BhdGgoZW52LCBvYmplY3QpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERCVVNfTkVUV09SS1NFUlZFUl9JRkFDRSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiVW5yZWdpc3RlciIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgREJVU19UWVBFX1NUUklORywgJmNfcm9sZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEQlVTX1RZUEVfSU5WQUxJRCk7CisgICAgICAgIH0KKyAgICAgICAgZW52LT5SZWxlYXNlU3RyaW5nVVRGQ2hhcnMoc3JjX3JvbGUsIGNfcm9sZSk7CisgICAgICAgIGVudi0+UmVsZWFzZVN0cmluZ1VURkNoYXJzKGJyaWRnZSwgY19icmlkZ2UpOworICAgICAgICByZXR1cm4gcmVwbHkgPyBKTklfVFJVRSA6IEpOSV9GQUxTRTsKKyAgICB9CisjZW5kaWYKKyAgICByZXR1cm4gSk5JX0ZBTFNFOworfQorCitzdGF0aWMgamJvb2xlYW4gY29ubmVjdFBhbkRldmljZU5hdGl2ZShKTklFbnYgKmVudiwgam9iamVjdCBvYmplY3QsIGpzdHJpbmcgcGF0aCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpzdHJpbmcgc3JjUm9sZSwganN0cmluZyBkc3RSb2xlKSB7CisgICAgTE9HVihfX0ZVTkNUSU9OX18pOworI2lmZGVmIEhBVkVfQkxVRVRPT1RICisgICAgTE9HRSgiY29ubmVjdFBhbkRldmljZU5hdGl2ZSIpOworICAgIG5hdGl2ZV9kYXRhX3QgKm5hdCA9IGdldF9uYXRpdmVfZGF0YShlbnYsIG9iamVjdCk7CisgICAgam9iamVjdCBldmVudExvb3AgPSBlbnYtPkdldE9iamVjdEZpZWxkKG9iamVjdCwgZmllbGRfbUV2ZW50TG9vcCk7CisgICAgc3RydWN0IGV2ZW50X2xvb3BfbmF0aXZlX2RhdGFfdCAqZXZlbnRMb29wTmF0ID0KKyAgICAgICAgICAgIGdldF9FdmVudExvb3BfbmF0aXZlX2RhdGEoZW52LCBldmVudExvb3ApOworCisgICAgaWYgKG5hdCAmJiBldmVudExvb3BOYXQpIHsKKyAgICAgICAgY29uc3QgY2hhciAqY19wYXRoID0gZW52LT5HZXRTdHJpbmdVVEZDaGFycyhwYXRoLCBOVUxMKTsKKyAgICAgICAgY29uc3QgY2hhciAqc3JjID0gZW52LT5HZXRTdHJpbmdVVEZDaGFycyhzcmNSb2xlLCBOVUxMKTsKKyAgICAgICAgY29uc3QgY2hhciAqZHN0ID0gZW52LT5HZXRTdHJpbmdVVEZDaGFycyhkc3RSb2xlLCBOVUxMKTsKKworICAgICAgICBpbnQgbGVuID0gZW52LT5HZXRTdHJpbmdMZW5ndGgocGF0aCkgKyAxOworICAgICAgICBjaGFyICpjb250ZXh0X3BhdGggPSAoY2hhciAqKWNhbGxvYyhsZW4sIHNpemVvZihjaGFyKSk7CisgICAgICAgIHN0cmxjcHkoY29udGV4dF9wYXRoLCBjX3BhdGgsIGxlbik7ICAvLyBmb3IgY2FsbGJhY2sKKworICAgICAgICBib29sIHJldCA9IGRidXNfZnVuY19hcmdzX2FzeW5jKGVudiwgbmF0LT5jb25uLCAtMSxvblBhbkRldmljZUNvbm5lY3Rpb25SZXN1bHQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZXh0X3BhdGgsIGV2ZW50TG9vcE5hdCwgY19wYXRoLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgREJVU19ORVRXT1JLX0lGQUNFLCAiQ29ubmVjdCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBEQlVTX1RZUEVfU1RSSU5HLCAmc3JjLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgREJVU19UWVBFX1NUUklORywgJmRzdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERCVVNfVFlQRV9JTlZBTElEKTsKKworICAgICAgICBlbnYtPlJlbGVhc2VTdHJpbmdVVEZDaGFycyhwYXRoLCBjX3BhdGgpOworICAgICAgICBlbnYtPlJlbGVhc2VTdHJpbmdVVEZDaGFycyhzcmNSb2xlLCBzcmMpOworICAgICAgICBlbnYtPlJlbGVhc2VTdHJpbmdVVEZDaGFycyhkc3RSb2xlLCBkc3QpOworICAgICAgICByZXR1cm4gcmV0ID8gSk5JX1RSVUUgOiBKTklfRkFMU0U7CisgICAgfQorI2VuZGlmCisgICAgcmV0dXJuIEpOSV9GQUxTRTsKK30KKworc3RhdGljIGpib29sZWFuIGRpc2Nvbm5lY3RQYW5EZXZpY2VOYXRpdmUoSk5JRW52ICplbnYsIGpvYmplY3Qgb2JqZWN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpzdHJpbmcgcGF0aCkgeworICAgIExPR1YoX19GVU5DVElPTl9fKTsKKyNpZmRlZiBIQVZFX0JMVUVUT09USAorICAgIExPR0UoImRpc2Nvbm5lY3RQYW5EZXZpY2VOYXRpdmUiKTsKKyAgICBuYXRpdmVfZGF0YV90ICpuYXQgPSBnZXRfbmF0aXZlX2RhdGEoZW52LCBvYmplY3QpOworICAgIGpvYmplY3QgZXZlbnRMb29wID0gZW52LT5HZXRPYmplY3RGaWVsZChvYmplY3QsIGZpZWxkX21FdmVudExvb3ApOworICAgIHN0cnVjdCBldmVudF9sb29wX25hdGl2ZV9kYXRhX3QgKmV2ZW50TG9vcE5hdCA9CisgICAgICAgICAgICBnZXRfRXZlbnRMb29wX25hdGl2ZV9kYXRhKGVudiwgZXZlbnRMb29wKTsKKworICAgIGlmIChuYXQgJiYgZXZlbnRMb29wTmF0KSB7CisgICAgICAgIGNvbnN0IGNoYXIgKmNfcGF0aCA9IGVudi0+R2V0U3RyaW5nVVRGQ2hhcnMocGF0aCwgTlVMTCk7CisKKyAgICAgICAgaW50IGxlbiA9IGVudi0+R2V0U3RyaW5nTGVuZ3RoKHBhdGgpICsgMTsKKyAgICAgICAgY2hhciAqY29udGV4dF9wYXRoID0gKGNoYXIgKiljYWxsb2MobGVuLCBzaXplb2YoY2hhcikpOworICAgICAgICBzdHJsY3B5KGNvbnRleHRfcGF0aCwgY19wYXRoLCBsZW4pOyAgLy8gZm9yIGNhbGxiYWNrCisKKyAgICAgICAgYm9vbCByZXQgPSBkYnVzX2Z1bmNfYXJnc19hc3luYyhlbnYsIG5hdC0+Y29ubiwgLTEsb25QYW5EZXZpY2VDb25uZWN0aW9uUmVzdWx0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRleHRfcGF0aCwgZXZlbnRMb29wTmF0LCBjX3BhdGgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgREJVU19ORVRXT1JLX0lGQUNFLCAiRGlzY29ubmVjdCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgREJVU19UWVBFX0lOVkFMSUQpOworCisgICAgICAgIGVudi0+UmVsZWFzZVN0cmluZ1VURkNoYXJzKHBhdGgsIGNfcGF0aCk7CisgICAgICAgIHJldHVybiByZXQgPyBKTklfVFJVRSA6IEpOSV9GQUxTRTsKKyAgICB9CisjZW5kaWYKKyAgICByZXR1cm4gSk5JX0ZBTFNFOworfQorCiBzdGF0aWMgSk5JTmF0aXZlTWV0aG9kIHNNZXRob2RzW10gPSB7CiAgICAgIC8qIG5hbWUsIHNpZ25hdHVyZSwgZnVuY1B0ciAqLwogICAgIHsiY2xhc3NJbml0TmF0aXZlIiwgIigpViIsICh2b2lkKiljbGFzc0luaXROYXRpdmV9LApAQCAtOTI2LDggKzEwODgsMTggQEAKICAgICB7ImFkZFJmY29tbVNlcnZpY2VSZWNvcmROYXRpdmUiLCAiKExqYXZhL2xhbmcvU3RyaW5nO0pKUylJIiwgKHZvaWQgKilhZGRSZmNvbW1TZXJ2aWNlUmVjb3JkTmF0aXZlfSwKICAgICB7InJlbW92ZVNlcnZpY2VSZWNvcmROYXRpdmUiLCAiKEkpWiIsICh2b2lkICopcmVtb3ZlU2VydmljZVJlY29yZE5hdGl2ZX0sCiAgICAgeyJzZXRMaW5rVGltZW91dE5hdGl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NvbnN0IGNoYXIqKSB3b3JrVGV4dCwgd29ya0J5dGVzLCBjb3VudCwgeCwgeSwgcGFpbnQpOworICAgICAgICBmcmVlKGJ1ZmZlcik7CisgICAgfQorfQorCitzdGF0aWMgdm9pZCByZW5kZXJUZXh0UnVuKE9wZW5HTFJlbmRlcmVyKiByZW5kZXJlciwgY29uc3QgamNoYXIqIHRleHQsCisgICAgICAgIGppbnQgc3RhcnQsIGppbnQgY291bnQsIGppbnQgY29udGV4dENvdW50LCBqZmxvYXQgeCwgamZsb2F0IHksCisgICAgICAgIGludCBmbGFncywgU2tQYWludCogcGFpbnQpIHsKKyAgICB1aW50OF90IHJ0bCA9IGZsYWdzICYgMHgxOworICAgIGlmIChydGwpIHsKKyAgICAgICAgU2tBdXRvU1RNYWxsb2M8ODAsIGpjaGFyPiBidWZmZXIoY29udGV4dENvdW50KTsKKyAgICAgICAgamNoYXIqIHNoYXBlZCA9IGJ1ZmZlci5nZXQoKTsKKyAgICAgICAgaWYgKFRleHRMYXlvdXQ6OnByZXBhcmVSdGxUZXh0UnVuKHRleHQsIHN0YXJ0LCBjb3VudCwgY29udGV4dENvdW50LCBzaGFwZWQpKSB7CisgICAgICAgICAgICByZW5kZXJlci0+ZHJhd1RleHQoKGNvbnN0IGNoYXIqKSBzaGFwZWQsIGNvdW50IDw8IDEsIGNvdW50LCB4LCB5LCBwYWludCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBMT0dXKCJkcmF3VGV4dFJ1biBlcnJvciIpOworICAgICAgICB9CisgICAgfSBlbHNlIHsKKyAgICAgICAgcmVuZGVyZXItPmRyYXdUZXh0KChjb25zdCBjaGFyKikgKHRleHQgKyBzdGFydCksIGNvdW50IDw8IDEsIGNvdW50LCB4LCB5LCBwYWludCk7CisgICAgfQorfQorCitzdGF0aWMgdm9pZCBhbmRyb2lkX3ZpZXdfR0xFUzIwQ2FudmFzX2RyYXdUZXh0QXJyYXkoSk5JRW52KiBlbnYsIGpvYmplY3QgY2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FudmFzIjsKKworc3RhdGljIEpOSU5hdGl2ZU1ldGhvZCBnTWV0aG9kc1tdID0geworICAgIHsgIm5Jc0F2YWlsYWJsZSIsICAgICAgICIoKVoiLCAgICAgICAgICAgICAodm9pZCopIGFuZHJvaWRfdmlld19HTEVTMjBDYW52YXNfaXNBdmFpbGFibGUgfSwKKworI2lmZGVmIFVTRV9PUEVOR0xfUkVOREVSRVIKKyAgICB7ICJuQ3JlYXRlUmVuZGVyZXIiLCAgICAiKClJIiwgICAgICAgICAgICAgKHZvaWQqKSBhbmRyb2lkX3ZpZXdfR0xFUzIwQ2FudmFzX2NyZWF0ZVJlbmRlcmVyIH0sCisgICAgeyAibkRlc3Ryb3lSZW5kZXJlciIsICAgIihJKVYiLCAgICAgICAgICAgICh2b2lkKikgYW5kcm9pZF92aWV3X0dMRVMyMENhbnZhc19kZXN0cm95UmVuZGVyZXIgfSwKKyAgICB7ICJuU2V0Vmlld3BvcnQiLCAgICAgICAiKElJSSlWIiwgICAgICAgICAgKHZvaWQqKSBhbmRyb2lkX3ZpZXdfR0xFUzIwQ2FudmFzX3NldFZpZXdwb3J0IH0sCisgICAgeyAiblByZXBhcmUiLCAgICAgICAgICAgIihJKVYiLCAgICAgICAgICAgICh2b2lkKikgYW5kcm9pZF92aWV3X0dMRVMyMENhbnZhc19wcmVwYXJlIH0sCisgICAgeyAibkFjcXVpcmVDb250ZXh0IiwgICAgIihJKVYiLCAgICAgICAgICAgICh2b2lkKikgYW5kcm9pZF92aWV3X0dMRVMyMENhbnZhc19hY3F1aXJlQ29udGV4dCB9LAorICAgIHsgIm5SZWxlYXNlQ29udGV4dCIsICAgICIoSSlWIiwgICAgICAgICAgICAodm9pZCopIGFuZHJvaWRfdmlld19HTEVTMjBDYW52YXNfcmVsZWFzZUNvbnRleHQgfSwKKworICAgIHsgIm5TYXZlIiwgICAgICAgICAgICAgICIoSUkpSSIsICAgICAgICAgICAodm9pZCopIGFuZHJvaWRfdmlld19HTEVTMjBDYW52YXNfc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BhbmRyb2lkX3ZpZXdfR0xFUzIwQ2FudmFzX3RyYW5zbGF0ZSB9LAorICAgIHsgIm5Sb3RhdGUiLCAgICAgICAgICAgICIoSUYpViIsICAgICAgICAgICAodm9pZCopIGFuZHJvaWRfdmlld19HTEVTMjBDYW52YXNfcm90YXRlIH0sCisgICAgeyAiblNjYWxlIiwgICAgICAgICAgICAgIihJRkYpViIsICAgICAgICAgICh2b2lkKikgYW5kcm9pZF92aWV3X0dMRVMyMENhbnZhc19zY2FsZSB9LAorCisgICAgeyAiblNldE1hdHJpeCIsICAgICAgICAgIihJSSlWIiwgICAgICAgICAgICh2b2lkKikgYW5kcm9pZF92aWV3X0dMRVMyMENhbnZhc19zZXRNYXRyaXggfSwKKyAgICB7ICJuR2V0TWF0cml4IiwgICAgICAgICAiKElJKVYiLCAgICAgICAgICAgKHZvaWQqKSBhbmRyb2lkX3ZpZXdfR0xFUzIwQ2FudmFzX2dldE1hdHJpeCB9LAorICAgIHsgIm5Db25jYXRNYXRyaXgiLCAgICAgICIoSUkpViIsICAgICAgICAgICAodm9pZCopIGFuZHJvaWRfdmlld19HTEVTMjBDYW52YXNfY29uY2F0TWF0cml4IH0sCisKKyAgICB7ICJuRHJhd0JpdG1hcCIsICAgICAgICAiKElJRkZJKVYiLCAgICAgICAgKHZvaWQqKSBhbmRyb2lkX3ZpZXdfR0xFUzIwQ2FudmFzX2RyYXdCaXRtYXAgfSwKKyAgICB7ICJuRHJhd0JpdG1hcCIsICAgICAgICAiKElJRkZGRkZGRkZJKVYiLCAgKHZvaWQqKSBhbmRyb2lkX3ZpZXdfR0xFUzIwQ2FudmFzX2RyYXdCaXRtYXBSZWN0IH0sCisgICAgeyAibkRyYXdCaXRtYXAiLCAgICAgICAgIihJSUlJKVYiLCAgICAgICAgICh2b2lkKikgYW5kcm9pZF92aWV3X0dMRVMyMENhbnZhc19kcmF3Qml0bWFwTWF0cml4IH0sCisgICAgeyAibkRyYXdQYXRjaCIsICAgICAgICAgIihJSVtCRkZGRkkpViIsICAgICh2b2lkKikgYW5kcm9pZF92aWV3X0dMRVMyMENhbnZhc19kcmF3UGF0Y2ggfSwKKyAgICB7ICJuRHJhd0NvbG9yIiwgICAgICAgICAiKElJSSlWIiwgICAgICAgICAgKHZvaWQqKSBhbmRyb2lkX3ZpZXdfR0xFUzIwQ2FudmFzX2RyYXdDb2xvciB9LAorICAgIHsgIm5EcmF3UmVjdCIsICAgICAgICAgICIoSUZGRkZJKVYiLCAgICAgICAodm9pZCopIGFuZHJvaWRfdmlld19HTEVTMjBDYW52YXNfZHJhd1JlY3QgfSwKKyAgICB7ICJuRHJhd1JlY3RzIiwgICAgICAgICAiKElJSSlWIiwgICAgICAgICAgKHZvaWQqKSBhbmRyb2lkX3ZpZXdfR0xFUzIwQ2FudmFzX2RyYXdSZWN0cyB9LAorICAgIHsgIm5EcmF3UGF0aCIsICAgICAgICAgICIoSUlJKVYiLCAgICAgICAgICAodm9pZCopIGFuZHJvaWRfdmlld19HTEVTMjBDYW52YXNfZHJhd1BhdGggfSwKKworICAgIHsgIm5SZXNldE1vZGlmaWVycyIsICAgICIoSSlWIiwgICAgICAgICAgICAodm9pZCopIGFuZHJvaWRfdmlld19HTEVTMjBDYW52YXNfcmVzZXRNb2RpZmllcnMgfSwKKyAgICB7ICJuU2V0dXBTaGFkZXIiLCAgICAgICAiKElJKVYiLCAgICAgICAgICAgKHZvaWQqKSBhbmRyb2lkX3ZpZXdfR0xFUzIwQ2FudmFzX3NldHVwU2hhZGVyIH0sCisgICAgeyAiblNldHVwQ29sb3JGaWx0ZXIiLCAgIihJSSlWIiwgICAgICAgICAgICh2b2lkKikgYW5kcm9pZF92aWV3X0dMRVMyMENhbnZhc19zZXR1cENvbG9yRmlsdGVyIH0sCisgICAgeyAiblNldHVwU2hhZG93IiwgICAgICAgIihJRkZGSSlWIiwgICAgICAgICh2b2lkKikgYW5kcm9pZF92aWV3X0dMRVMyMENhbnZhc19zZXR1cFNoYWRvdyB9LAorCisgICAgeyAibk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0xYjUKKy5lYXJ0aDUKKy5lYXIydAorLmUyYTJyCisuZWFzM2kKKy4yZTFiNAorLmVlcjQKKy5lZzIKKy5lMmw1ZAorLmVsM2VtCisuZW5hbTMKKy5lMW5hCisuZW4zZworLmUybjNzMgorLmVxNXVpNXQKKy5lMXEKKy5lcXUyCisuZXEydWkyCisuZXI0cmkKKy5lcjFyNAorLmVzMworLjRldTMKKy5leWU1CisuZmVzMworLmZvcjVtZXIKKy4xZm8KKy5mbzJyCisuZm9yMW0KKy5mb3IybWUKKy4xZ2EyCisuZ2UyCisuZ2VuM3Q0CisuMWdlbgorLmdlNW8yZworLjFnZW8KKy4xZzJpNWEKKy5naTRiCisuZ280cgorLjFnbworLmhhbmQ1aQorLmhhMm4KKy5oNGFuZAorLmhhNG41azIKKy5oZTIKKy5oZXJvNWkyCisuaDJlcm8KKy5oMWVzMworLmhlNHQzCisuaGkzYgorLmhpM2VyCisuaDJpZTQKKy5ob241ZXkKKy5obzJuCisuaG9uM28KKy5ob3Y1CisuaWQ0bAorLjJpZAorLmlkb2wzCisuaTFkbworLmltM20KKy5pbTVwMWkybgorLmk0bTFwCisuaW0ycGkKKy5pbjEKKy5pbjNjaQorLjJpbmUyCisuNGk0bjJrMgorLjJpMm4zczIKKy5pcjVyNAorLjRpcgorLmlzNGkKKy5qdTNyCisubGE0Y3kKKy5sYTRtCisubGF0NWVyCisubDRhdGg1CisubGUyCisubGVnNWUKKy5sZW40CisubGVwNQorLmxldjEKKy5sMmk0ZworLmxpMWc1YQorLmxpMm4KKy5sMmkzbworLmwxaTR0CisubWExZzVhNQorLjFtYQorLm1hbDVvCisubWExbjVhCisubWEybgorLm1hcjV0aQorLm0yYTJyCisubWUyCisubWVyM2MKKy5tZTV0ZXIKKy5tZTF0ZQorLm0yaXMxCisubWlzNHQ1aQorLm1vbjNlCisuMW1vCisubW8ybgorLm1vM3JvCisubW8ycgorLm11NXRhCisuMW11CisubXUydGE1YgorLm5pNGMKKy5vZDIKKy5vZDFkNQorLm9mNXRlCisubzJmdAorLm9yNWExdG8KKy5vMXJhCisub3IzYworLm9yMWQKKy5vcjN0Cisub3MzCisub3M0dGwKKy40b3RoMworLm91dDMKKy5vdTIKKy5wZWQ1YWwKKy4ycDJlZAorLnAyZTJkMmEKKy5wZTV0ZQorLnBlMnQKKy5wZTV0aXQKKy5wMmk0ZTQKKy5waW81bjQKKy4zcDJpMW8KKy5waTJ0CisucHJlM20KKy5wcjIKKy5yYTRjCisucmFuNHQKKy5yYTJuCisucmF0aW81bjFhCisucmF0aW8ybjQKKy5yYTF0MmlvCisucmVlMgorLnJlNW1pdAorLnJlczIKKy5yZTVzdGF0CisucmVzMnQKKy5yZXMxdGEKKy5yMmk0ZworLnJpMnQ1dQorLnJvNHEKKy5yb3M1dAorLnJvdzVkCisucnU0ZAorLjNzNGMyaTNlNAorLnMxY2kKKy41c2UybDJmNQorLnNlbDFsNQorLnNlMm4KKy5zZTVyMmllNAorLnNlcjFpCisuczJoMgorLnNpMgorLnMzaW5nNAorLjJzMWluCisuc3Q0Cisuc3RhNWIybDIKKy5zMXRhCisuczJ0YWIKKy5zNHkyCisuMXRhNAorLnRlNAorLjN0ZW41YTJuCisudGUxbmEKKy50aDIKKy50aTIKKy50aWw0CisudGkxbTVvNQorLjF0aW0KKy50aW5nNAorLjJ0MWluCisudDRpNG41azIKKy50bzFuNGEKKy4xdG8KKy50bzJuCisudG80cAorLnRvcDVpCisudG8ydTVzCisudG91MgorLnRyaWI1dXQKKy50cjRpYgorLnUxbjFhCisudW4zY2UKKy51bmRlcjUKKy51bjFkZQorLnUybjFlCisudTRuNWsyCisudW41bworLnVuM3U0CisudXAzCisudXJlMworLnVzNWEyCisuMnVzCisudmVuNGRlCisudmU1cjFhCisud2lsNWkKKy53aTIKKy53aWwyCisueWU0Cis0YWIuCithNWJhbAorYTViYTJuCithYmUyCithYjVlcmQKK2FiMmk1YQorYWI1aTJ0NWFiCithYmkydAorYWJpMXRhCithYjVsYXQKK2FiMmwyCithYjVvNWwxaXoKK2Fib2wyaQorNGFicgorYWI1cm9nCithYjN1bAorYTRjMmEycgorYTFjYQorYWM1YXJkCithYzVhcm8KK2E1Y2VvdTIKK2FjMWVyCithNWNoZTR0CithMmNoCithY2hlMgorNGEyY2kKK2EzYzJpZTQKK2EyYzFpbgorYTNjMmlvCithYzVyb2IKK2FjdDVpZjIKK2EyYzF0CithYzN1bAorYWM0dW0KK2EyZAorYWQ0ZDFpbgorYWQxZDQKK2FkNWVyLgorMmFkaQorYTNkNGkzYQorYWQzaTFjYQorYWRpNGVyCithZDJpZTQKK2EzZDJpbworYTNkaXQKK2E1ZGkxdQorYWQ0bGUKK2FkM293CithMWRvCithZDVyYTJuCithMWRyCithZDRzdQorYTJkMXMyCis0YTFkdQorYTNkdTJjCithZDV1bQorYWU0cgorYWVyMmk0ZTQKK2FlcjFpCithMmYKK2E0ZjFmNAorYTRnYWIKK2ExZ2EKK2FnYTRuCithZzVlbDFsCithMWdlNG8KKzRhZzRldQorYWcxaQorNGFnNGwyCithZzFuCithMmdvCiszYTNnNG80ZworYWczbzNuaQorYWdvMm4yCithNWd1ZXIKK2EyZ3VlCithZzV1bAorYTRneQorYTNoYQorYTNoZQorYTRoNGw0CithM2hvCithaTIKK2E1aTFhCithM2ljLgorYWk1bHkKK2E0aTRuCithaW41aW4KK2EyaW5pCithMmkxbjVvCithaXQ1ZW4KK2EyaXRlCithMWoKK2FrMWVuCithbDVhYgorYWwzYTJkCithNGwyYTJyCis0YWxkaTQKK2EybGQKKzJhbGUKK2FsM2VuZAorYTRsZW50MmkKK2ExbGVuMXQKK2E1bGU1bworYWwxaQorYWw0aWEuCithbDJpMWEKK2FsMmk0ZTQKK2FsNWxldgorYWwxbAorYWwybGUKKzRhbGxpYworYWxsMmkKKzRhMmxtCithNWxvZy4KK2E0bHkuCithMWx5Cis0YTJseXM0Cis1YTVseXMxdAorNWFseXQKKzNhbHl6Cis0YTFtYQorYTJtNWFiCithbTNhZworYW1hNXJhCithbTJhMnIKK2FtNWFzYworYTRtYTN0aXMKK2E0bTVhMXRvCithbTVlcjFhCithbTNpYworYW01aWYKK2FtNWkxbHkKK2FtMWluCithbTJpNG5vCithMm1vCithNW1vMm4KK2Ftb3I1aQorYW1vMnIKK2FtcDVlbgorYTRtMXAKK2EybgorYW4zYWdlCithMW5hCiszYW5hMWx5CithM24yYTJyCithbjNhcjNjCithbmFyNGkKK2EzbmF0aQorYW4yYXQKKzRhbmQKK2FuZGU0czIKK2FuMWRlCithbjNkaXMxCithbjFkbAorYW40ZG93CithbjFkbworYTVuZWUKK2EzbmVuCithbjVlMnN0LgorYTFuZXMKK2EybmVzdAorYTNuNGV1CisyYW5nCithbmc1aWU0CithbjFnbDIKK2E0bjFpYworYTNuaWVzCithbjJpZTQKK2FuM2kzZgorYW40aW1lCithbjFpbQorYTVuaW0xaQorYTVuMmluZQorYW4xaW4KK2FuM2k0bworYTNuMmlwCithbjNpczJoCithbjNpdAorYTNuaTF1CithbjRrbGkKK2E0bmsyCithbjFrMWwKKzVhbm5pegorYTRuMW4yCithbm80CithbjVvdAorYW40b3RoNQorYW4yc2EyCithMm4xczIKK2FuNHMxY28KK2FuczRjCithbjRzMW40CithbjJzcAorYW5zM3BvCithbjRzdAorYW40c3UycgorYW4xc3UKK2FudGEybDQKK2FuMXQKK2FuMXRhCithbjR0MmllNAorYW50MmkKKzRhbjF0bworYW4ydHIKK2FuNHR3NAorYW4zdTFhCithbjN1bAorYTVudXIKKzRhbworYXAyYTJyNAorYTFwYQorYXA1YXQKK2FwNWVyM28KK2EzcGg0ZXIKKzRhcGhpCithNHBpbGxhCithcGlsMWwKK2FwNWlsbDJhMnIKK2FwM2kybgorYXAzaTF0YQorYTNwaTJ0dQorYTJwMmwyCithcG80YzUKK2FwNW8xbGEKK2Fwb3I1aQorYTFwNG9yCithcG9zM3QKK2ExcG9zCithcHM1ZTRzCithMnAxczIKK2FwMnNlCithM3B1CithcXVlNQorYXF1MgorMmEycgorYXIzYTJjMXQKK2E1cmFkZQorYXJhMmQKK2FyNWFkaXMxCithcjJhZGkKK2FyM2FsCithNXJhbWUxdGUKK2FyYW0zZXQKK2FyMmFuNGcKK2FyYTJuCithcmEzcAorYXI0YXQKK2E1cmExdDJpbworYXI1YTF0Mml2CithNXJhdQorYXI1YXY0CithcmF3NAorYXJiYWw0CithcjFiCithcjRjaGEybgorYXIxYworYXIzY2hhCithcjJjaAorYXI1ZDJpbmUKK2FyZDJpCithcmQxaW40CithcjRkcgorYXI1ZWFzCithM3JlZQorYXIzZW4xdAorYTVyMmUyc3MKK2FyNGZpCithcjFmCithcjRmNGwyCithcjFpCithcjVpMmFsCithcjJpM2EKK2FyM2kyYTJuCithM3JpNWV0CithcjJpZTQKK2FyNGltCithcjVpbjJhdAorYXIyaTFuYQorYXIzaTFvCithcjJpegorYXIybWkKK2FyMW0KK2FyNW81ZAorYTVyb25pCithcm8ybgorYTNyb28yCithcjJwCithcjNxCithcnJlNAorYXIxcjQKK2FyNHNhMgorYTRyczIKK2FyMnMyaAorNGFzLgorYTJzNGFiCithc2EyCithczNhbjF0Cithc2EybgorYXNoaTQKK2FzMmgKK2E1c2lhLgorYXMyaTFhCithM3NpMWIKK2Ezc2ljCis1YTVzaTR0Cithc2szaQorYXNrMgorYXM0bDIKK2E0c29jCithMXNvCithczVwaAorYXM0czJoCithMnNzCithczN0ZW4KK2FzMXQ0cgorYXN1MXI1YQorYTFzdQorYXN1MnIKK2EydGEKK2F0M2FiMmwyCithMnRhYgorYXQ1YWMKK2F0M2FsbworYXRhMmwKK2F0NWFwCithdGU1YworYXQ1ZTJjaAorYXQzZTFnbworYXRlZzQKK2F0M2VuLgorYXQzZXIxYQorYXRlcjVuCithNXRlcjFuYQorYXQzZXN0CithdDVldgorNGF0aAorYXRoNWVtCithdGgyZQorYTV0aGUybgorYXQ0aG8KK2F0aDVvbQorNGF0aS4KK2E1dDJpMWEKK2EydDVpNWIKK2F0MWljCithdDNpZjIKK2F0aW9uNWEycgorYTF0MmlvCithdGlvMm4KK2F0aW8xbjFhCithdDNpMXR1CithNHRvZworYTF0bworYTJ0b20KK2F0NW9tMml6CithNHRvcAorYTR0b3MyCithMXRyCithdDVyb3AKK2F0NHNrMgorYTR0MXMyCithdDR0YWcKK2E0dDN0MgorYXQxdGEKK2F0NXRlCithdDR0aAorYTJ0dQorYXQ1dTFhCithNHQ1dWUKK2F0M3VsCithdDN1MXJhCithMnR5CithdTRiCithdWdoMworYXUzZ3UKK2F1NGwyCithdW41ZAorYXUzcgorYXU1c2kxYgorYTJ1cworYTR1dDVlbgorYXUxdGgKK2EydmEKK2F2M2FnNAorYTV2YTJuCithdjRlNG5vCithdjNlcjFhCithdjVlcm4KK2F2NWVyeQorYXYxaQorYXZpNGVyCithdjJpZTQKK2F2M2lnCithdjVvYworYTF2b3IKKzNhd2F5CithdzNpMgorYXc0bHkKK2F3czQKK2F4NGk1YworYXgzaQorYXg0aWQKK2F5NWFsCitheWU0CitheXM0Cithemk0ZXIKK2EyejFpCithejJpZTQKK2F6Mno1aQorYTR6MXoyCis1YmEuCitiYWQ1Z2VyCitiYTJkCitiYTRnZQorYmFsMWEKK2JhbjVkYWcKK2JhMm4KK2I0YW5kCitiYW4xZDJhCitiYW40ZQorYmFuM2kKK2JhcmJpNQorYjJhMnIKK2JhcjFiCitiYXIyaTRhCitiYXIxaQorYmFzNHNpCitiYTJzcworMWJhdAorYmE0egorMmIxYgorYjJiZQorYjNiZXIKK2JiaTRuYQorNGIxZAorNGJlLgorYmVhazQKK2JlYTJ0MworNGJlMmQKK2IyZTNkMmEKK2JlM2RlCitiNGUzZGkKK2JlM2dpCitiZTVndQorMWJlbAorYmUxbDJpCitiZTNsbworNGJlNW0KK2JlNW4yaWcKK2JlNW51Cis0YmVzNAorYmUzc3AKK2IyZTVzdDRyCiszYmV0CitiZTF0NWl6CitiZTV0cgorYmUzdHc0CitiZTN3CitiZTV5MW80CisyYmYKKzRiM2gKK2JpMmIKK2IyaTRkCiszYjJpZTQKK2JpNWVuCitiaTRlcgorMmIzaWYKKzFiaWwKK2JpM2wyaXoKK2JpbDFpCitiaW4yYTVyNAorYmkxbmEKK2I0aW40ZAorYmk1bmV0CitiMmluZQorYmkzbzJncgorYjJpbworYmk1b3UyCitiaTJ0CiszYjJpM3QyaW8KK2JpMXRpCitiaTN0cgorM2JpdDV1MWEKK2JpMXR1CitiNWk0dHoKK2IxagorYms0CitiMmwyCitibDRhdGg1CitiNGxlLgorYmxlbjQKKzVibGUxc3AKK2JsZXMyCitiM2xpcworYjRsbworYmx1bjR0Cis0YjFtCis0YjNuCitibmU1ZworM2JvZAorYm9kM2kKK2JvNGUKK2JvbDNpYworYm9sMmkKK2JvbTRiaQorYm80bTFiCitibzFuNGEKK2JvMm4KK2JvbjVhdAorM2JvbzIKKzVib3IuCis0YjFvMXJhCitib3I1ZAorNWJvcmUKKzVib3JpCis1Ym9zNAorYjVvMXRhCitiNG90aDUKK2JvNHRvCitib3VuMmQzCitib3UyCis0YnAKKzRicml0CiticjRvdGgzCisyYjVzMgorYnNvcjQKK2Ixc28KKzJidAorYjJ0NGwKK2I0dG8KK2IzdHIKK2J1ZjRmZXIxCitidTRmMWYKK2J1NGdhCitidTNsMmkKK2J1MW1pNAorYnU0bgorYnVudDRpCitidW4xdAorYnUzcmUKK2J1czVpZTQKK2IydXMKK2J1c3M0ZQorYnUyc3MKKzVidXN0Cis0YnUxdGEKKzNidTF0MmlvCitiNHUxdDJpCitiNXUxdG8KK2IxdgorNGI1dworNWJ5LgorYnlzNAorMWNhCitjYWIzaW4KK2NhMWIybDIKK2NhMmNoNAorY2E1ZGVuCitjYTJkCis0Y2FnNAorMmM1YWgKK2NhM2xhdAorY2FsNGxhCitjYWwxbAorY2FsMmw1aW40CitjYWxsMmkKKzRjYWxvCitjNGFuNWQKK2NhMm4KK2NhbjRlCitjYTRuNGljCitjYW41aXMKK2NhbjNpegorY2FuNHR5CitjYW4xdAorY2FueTQKK2NhNXBlcgorY2FyNW9tCitjMmEycgorY2FzdDVlcgorY2FzNXQy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0xYgorZTNpbjNmCitlMWluZworZTVpbnN0CitlMmkybjFzMgorZWlyNGQKK2U0aXIKK2UyaXQzZQorZTJpM3RoCitlNWkxdHkKK2UxagorZTRqdWQKK2VqNXVkaQorZWtpNG4KK2VrMWkKK2VrNGxhCitlazFsCitlMWxhCitlNGxhLgorZTRsYWMKK2UzbDRhbjRkCitlbGEybgorZTRsNWExdDJpdgorZTRsYXcKK2VsYXgxYTQKK2UzbGUyYQorZWw1ZWJyYQorZWwyZTFiCitlbGUzYnIKKzVlbGVjCitlNGxlZAorZWwzZTFnYQorZTVsZW4KK2U0bDFlcgorZTFsZXMyCitlMmwyZgorZWwyaQorZTNsaWJlNAorZTRsNWljLgorZWwzaTFjYQorZTNsaWVyCitlbDJpZTQKK2VsNWkzZ2liCitlbDJpZworZWw0aWdpCitlNWxpbQorZTRsM2luZworZTNsMmlvCitlMmxpcworZWw1aXMyaAorZTNsMml2MworNGVsbGEKK2VsMWwKK2VsNGxhYgorZWxsNG80CitlNWxvYworZWw1b2cKK2VsM29wLgorZWwyczJoCitlMmwxczIKK2VsNHRhCitlNGx0CitlNWx1ZAorZWw1dWcKK2U0bWFjCitlMW1hCitlNG1hZworZTVtYTJuCitlbTVhMW5hCitlNG01YgorZTFtZQorZTJtZWwKK2U0bWV0CitlbTNpMWNhCitlbTJpNGU0CitlbTVpZ3JhCitlbTJpZzQKK2VtaTFncgorZW0xaW4yCitlbTVpbmUKK2VtM2kzbmkKK2U0bTJpcworZW01aXMyaAorZTVtNGkyczFzCitlbTNpegorNWVtbml6CitlNG0xbgorZW1vNGcKK2UxbW8KK2VtbzNuMmk1bworZW1vMm4KK2VtM3BpCitlNG0xcAorZTRtdWwKK2UxbXUKK2VtNXUxbGEKK2VtdTNuMgorZTNteQorZW41YTJtbworZTFuYQorZTRuYW4xdAorZW4yYTJuCitlbmNoNGVyCitlbjJjaAorZW5jaGUyCitlbjNkaWMKK2U1bmVhCitlNW5lZQorZW4zZW0KK2VuNWVybworZW4xZXIKK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raG81c2VuCitob3MxcAorMWhvMnVzCitob3UyCitob3VzZTMKK2hvdjVlbAorNGg1cAorNGhyNAoraHJlZTUKK2hybzVuaXoKK2hybzJuCitocm8zcG8KKzRoMXMyCitoNHMyaAoraDR0MmEycgoraDF0YQoraHQxZW4KK2h0NWVzCitoNHR5CitodTRnCitodTRtaW4KK2h1MW1pCitodW41a2UKK2h1NG5rMgoraHVuNHQKK2h1czN0NAoraDJ1cworaHU0dAoraDF3CitoNHdhcjR0CitodzJhMnIKK2h5M3BlCitoeTNwaAoraHkycworMmkxYQoraTJhbAoraWFtNAoraWFtNWUxdGUKK2kyYTJuCis0aWFuYworaWFuM2kKKzRpYW40dAoraWE1cGUKK2lhMnNzNAoraTRhMXQyaXYKK2lhNHRyaWMKK2lhMXRyCitpNGEydHUKK2liZTQKK2liM2VyMWEKK2liNWVydAoraWI1aTFhCitpYjNpbgoraWI1aXQuCitpYmkydAoraWI1aXRlCitpMWIybDIKK2liM2xpCitpNWJvCitpMWJyCitpMmI1cmkKK2k1YnU0bgorNGljYW0KK2kxY2EKKzVpY2FwCis0aWMyYTJyCitpNGNhci4KK2k0Y2FyYQoraWNhczUKK2k0Y2F5CitpY2N1NAoraWMzYworNGljZW8KKzRpMmNoCisyaTFjaQoraTVjMmlkCitpYzVpMW5hCitpMmNpbgoraTJjMmlwCitpYzNpMXBhCitpNGMxbHk0CitpMWM0bDQKK2kyYzVvYworaTFjbworNGkxY3IKKzVpY3JhCitpNGNyeQoraWM0dGUKK2kyYzF0CitpYzF0dTIKK2ljNHQzdTFhCitpYzN1MWxhCitpYzR1bQoraWM1dW8KK2kzY3VyCisyaWQKK2k0ZGFpMgoraTFkMmEKK2lkNWFuYworaWRhMm4KK2lkNWQ0CitpZGUzYTRsCitpZGU0czIKK2kyZGkKK2lkNWkyYTJuCitpMWQ0aTNhCitpZGk0YTJyCitpNWQyaWU0CitpMWQzaW8KK2lkaTVvdTIKK2lkMWl0CitpZDVpMXUKK2kzZGxlCitpNGRvbQ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kxYgoraXMyaTRkCitpNXNpcworaXM1aTF0Mml2Citpc2kxdGkKKzRpczRrMgoraXNsYTJuNAoraXMxbDIKKzRpczRtMXMyCitpMnMxbQoraTJzbworaXNvNW1lcgoraTNzb20KK2lzbzJtZQoraXMxcAoraXMycGkKK2lzNHB5Cis0aTJzMXMKK2lzNHNhbAoraXMxc2EyCitpc3NlbjQKK2lzNHMxZTRzCitpczR0YS4KK2lzMXRhCitpczF0ZQoraXMxdDJpCitpc3Q0bHkKK2lzMnRsCis0aXN0cmFsCitpc3Q0cgoraXMxdHJhCitpMnN1CitpczV1cworNGkzdGEuCitpMXRhCitpdGE0YmkKK2kydGFiCitpNHRhZworNGl0YTVtCitpM3RhMm4KK2kzdGF0CisyaXRlCitpdDNlcjFhCitpNXRlcjFpCitpdDRlcworMml0aAoraTF0aQorNGkxdDJpMWEKKzRpMnRpYworaXQzaTFjYQorNWk1dGljazEKK2kydDNpZworaXQ1aWwxbAoraTJ0aW0KKzJpMXQyaW8KKzRpdGlzCitpNHRpMnM0bQoraTJ0NW81bQoraTF0bworNGl0bzJuCitpNHRyYW0KK2kxdHJhCitpdDVyeQorNGk0dDN0MgoraXQzdTFhdAoraTF0dQoraXR1MWEKK2k1dHVkMgoraXQzdWwKKzRpdHouCitpNHR6CitpMXUKKzJpdgoraXYzZWwxbAoraXYzZW4uCitpNHYzZXIuCitpNHZlcnMuCitpdmU0cjFzMgoraXY1aWwuCitpMnZpbAoraXY1aW8KK2l2MWl0CitpNXZvcmUKK2l2M28zcm8KK2k0djNvdAorNGk1dworaXg0bworNGl5Cis0aXoyYTJyMgoraXphMQoraTJ6MWk0Cis1aXpvbjF0CitpMXpvCitpem8ybgorNWphCitqYWM0cQoramE0cAorMWplCitqZTRyNXMyCis0amVzNHQyaWU0CitqZXN0MmkKKzRqZXMydHkKK2pldzMKK2pvNHAKKzVqdWRnCisza2EuCitrM2FiCitrNWFnCitrYWlzNAora2FpMgora2FsNAorazFiCitrMmVkCisxa2VlCitrZTRnCitrZTVsMmkKK2szZW40ZAorazFlcgora2VzNAorazNlMnN0Lgora2U0dHkKK2szZgora2g0CitrMWkKKzVraS4KKzVrMmljCitrNGlsMWwKK2tpbG81CitrNGltCitrNGluLgora2luNGRlCitrNGluZAorazVpNW4yZTJzcworazJpbmUKK2tpMW5lcwora2luNGcKK2syaTRwCitraXM0CitrNWlzMmgKK2trNAorazFsCis0azNsZXkKKzRrMWx5CitrMW0KK2s1bmVzCisxazJubwora281cgora29zMmg0CitrM291Mgora3JvNW4KKzRrMXMyCitrNHNjCitrczRsMgorazRzNHkKK2s1dAorazF3CitsYWIzaWMKK2w0YWJvCitsNGEyY2k0CitsNGFkZQorbGEyZAorbGEzZDJ5CitsYWc0bgorbGEybTNvCiszbDRhbmQKK2xhMm4KK2xhbjRkbAorbGFuNWV0CitsYW40dGUKK2xhbjF0CitsYXI0ZzIKK2wyYTJyCitsYXIzaQorbGFzNGUKK2xhNXRhMm4KK2xhMnRhCis0bGF0ZWwyaTQKKzRsYTF0Mml2Cis0bGF2CitsYTR2NGEKKzJsMWIKK2xiaW40Cis0bDFjMgorbGNlNAorbDNjaQorMmxkCitsMmRlCitsZDRlcmUKK2xkNGVyMWkKK2xkaTQKK2xkNWlzMQorbDNkcgorbDRkcmkKK2xlMmEKK2xlNGJpCitsMmUxYgorbGUyZnQ1CitsZTFmCis1bGVnLgorNWxlNGcxZzIKK2xlNG1hdAorbGUxbWEKK2xlbTVhdDFpYworNGxlbi4KKzNsZW5jCis1bGUybmUuCisxbGVuMXQKK2xlM3BoCitsZTRwcjIKK2xlMnJhNWIKK2xlcjFhCitsZXI0ZQorM2xlcmcyCiszbDRlcjFpCitsNGVybworbGVzMgorbGU1czFjbworbGVzMmMKKzVsZXNxCiszbDJlMnNzCis1bGVzcy4KK2wzZTF2YQorbGV2NGVyLgorbGV2MWVyCitsZXY0ZXIxYQorbGV2NGU0cjFzMgorM2xleQorNGxleWUKKzJsZgorbDVmcgorNGwxZzQKK2w1Z2EKK2xnM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TF0bworbG81cjJpZTQKK2xvcjVvdTIKKzVsb3MuCitsb3M1ZXQKKzVsb3M1bzNwaGl6CitsbzJzbworbG9zNG9wCitsb3Myb3BoCis1bG9zNW8xcGh5Citsb3M0dAorbG80dGEKK2xvdW41ZAorbG91MgorMmxvdXQKKzRsb3YKKzJscAorbHBhNWIKK2wxcGEKK2wzcGhhCitsNXBoaQorbHA1aW5nCitscGkybgorbDNwaXQKK2w0cDJsMgorbDVwcjIKKzRsMXIKKzJsMXMyCitsNHNjCitsMnNlCitsNHMyaWU0Cis0bHQKK2x0NWFnCitsMXRhCitsdGFuZTUKK2x0YTJuCitsMXRlCitsdGVuNAorbHRlcjFhNAorbHRoM2kKK2w1dGllcy4KK2x0MmllNAorbHRpczQKK2wxdHIKK2wxdHUyCitsdHUxcjNhCitsdTVhCitsdTNicgorbHUyY2g0CitsdTNjaQorbHUzZW4KK2x1ZjQKK2x1NWlkCitsMnVpMgorbHU0bWEKKzVsdTFtaQorbDV1bW4uCitsdTRtMW4KKzVsdW0zbjRpMWEKK2x1M28KK2x1bzNyCis0bHVwCitsdTJzczQKK2wydXMKK2x1czN0ZQorMWx1dAorbDV2ZW4KK2w1dmV0NAorMmwxdworMWx5Cis0bHlhCis0bHkxYgorbHk1bWU0CitseTNubworMmx5czQKK2w1eTNzMmUKKzFtYQorMm1hYgorbWEyY2EKK21hNWNoMmluZQorbWEyY2gKK21hNGNoMWluCittYTRjNGw0CittYWc1aW4KK21hZzFpCis1bWFnMW4KKzJtYWgKK21hMmlkNQorbWFpMgorNG1hMmxkCittYTNsMmlnCittYWwxaQorbWE1bGluCittYWw0bDJpCittYWwxbAorbWFsNHR5CittYTRsdAorNW1hM240aTFhCittYTJuCittYW41aXMKK21hbjNpegorNG1hcAorbWE1cmkybmUuCittMmEycgorbWFyMWkKK21hcjJpbjRlCittYTVyMml6CittYXI0bHkKK21hcjFsCittYXIzdgorbWE1c2NlCittYXM0ZQorbWFzMXQKKzVtYXRlCittNGF0aDMKK21hM3RpcworNG1hdGkzemExCittYTF0aXoKKzRtMWIKK20xYmE0dDUKK201YmlsCittNGIzaW5nCittYjJpNHYKKzRtNWMKKzRtZS4KKzJtZWQKKzRtZWQuCis1bWUzZDRpM2EKK200ZWRpCittZTNkMmllNAorbTVlNWQyeQorbWUyZworbWVsNW8ybgorbWU0bDR0CittZTJtCittZTFtMW8zCisxbWVuCittZTFuNGEKK21lbjVhYworbWVuNGRlCis0bWVuZQorbWVuNGkKK21lMm4xczQKK21lbjFzdTUKKzNtZW4xdAorbWVuNHRlCittZTVvMm4KK201ZXIxc2EyCittZTRyMXMyCisybWVzCiszbWVzdDJpCittZTR0YQorbWV0M2EybAorbWUxdGUKK21lNXRoaQorbTRldHIKKzVtZXQzcmljCittZTV0cjJpZTQKK21lM3RyeQorbWU0dgorNG0xZgorMm1oCis1bWkuCittMmkzYQorbWkxZDRhCittMmlkCittaWQ0ZworbTJpZzQKKzNtaWwzaTFhCittaWwxaQorbTVpNWwyaWU0CittNGlsMWwKK21pMW40YQorM200aW5kCittNWkzbmVlCittMmluZQorbTRpbmdsMgorbWluNWdsaQorbTVpbmcxbHkKK21pbjR0CittNGluMXUKK21pb3Q0CittMmlvCittMmlzCittaTRzNGVyLgorbTRpc2UKK21pczNlcgorbWlzNWwyCittaXM0dDJpCittNWk0c3RyeQorbWlzdDRyCis0bTJpdGgKK20yaXoKKzRtaworNG0xbAorbTFtCittbWE1cnkKK20xbWEKK21tMmEycgorNG0xbgorbTFuNGEKK200bjFpbgorbW40bworMW1vCis0bW9jcgorNW1vYzVyYTF0aXoKK21vMmQxCittbzRnbworbW9pczIKK21vaTIKK21vNGk1c2UKKzRtMm9rCittbzVsZXN0Cittb2xlczIKK21vM21lCittb241ZXQKK21vMm4KK21vbjVnZQorbW8zbjRpM2EKK21vbjRpMnMxbQorbW9uMWlzCittb240aXN0CittbzNuaXoKK21vbm9sNAorbW8zbnkuCittbzJyCis0bW81cmEuCittbzFyYQorbW9zMgorbW81c2V5CittbzNzcAorbTRvdGgzCittNW91ZgorbW91MgorM21vMnVzCittbzJ2Cis0bTFwCittcGFyYTUKK20xcGEKK21wMmEycgorbXBhNXJhYgorbXA0YTRyNWkKK20zcGUydAorbXBoYXM0CittMnBpCittcDJpNGEKK21wNWllcworbXAyaWU0CittNHAxaTJuCittNXA0aXIKK21wNWlzCittcG8zcmkKK20xcDRvcgorbXBvczVpdGUKK20xcG9zCittNHBvMnVzCittcG91MgorbXBvdjUKK21wNHRyCittMnAxdAorbTJweQorNG0zcgorNG0xczIKK200czJoCittNXNpCis0bXQKKzFtdQorbXVsMmE1cjQKK211MWxhCis1bXU0bHQKK211bDF0aTMKKzNtdW0KK211bjIKKzRtdXAKK211NHUKKzRtdworMW5hCisybjFhMmIKK240YWJ1Cis0bmFjLgorbmE0Y2EKK241YTJjMXQKK25hZzVlci4KK25hazQKK25hNGwxaQorbmE1bDJpMWEKKzRuYTRsdAorbmE1bWl0CituMmEybgorbmFuMWNpNAorbmFuNGl0CituYTRuazQKK25hcjNjCituMmEycgorNG5hcmUKK25hcjNpCituYXI0bAorbjVhcjFtCituNGFzCituYXM0YworbmFzNXQyaQorbjJhdAorbmEzdGEybAorbmEydGEKK25hdDVvNW0yaXoKK25hMnRvbQorbmExdG8KK24yYXUKK25hdTNzZQorbmEydXMKKzNuYXV0CituYXY0ZQorNG4xYjQKK25jMmEycjUKK24xY2EKK240Y2VzLgorbjNjaGEKK24yY2gKK241Y2hlbworbmNoZTIKK241Y2g0aWwyCituM2NoaXMKK24yYzFpbgorbjFjaQorbjJjNGl0CituY291MXI1YQorbjFjbworbmNvdTIKK24xY3IKK24xY3UKK240ZGFpMgorbjFkMmEKK241ZGEybgorbjFkZQorbmQ1ZTJzdC4KK25kZXMyCituZGk0YgorbjVkMmlmCituMWRpdAorbjNkaXoKK241ZHUyYworbjFkdQorbmR1NHIKK25kMndlCituZDF3CisybmUuCituM2UyYTJyCituMmUyYgorbmViM3UKK25lMmMKKzVuZWNrMQorMm5lZAorbmU0Z2F0CituZTFnYQorbmU0ZzVhMXQyaXYKKzVuZWdlCituZTRsYQorbmVsNWl6CituZWwyaQorbmU1bWkKK25lNG1vCisxbmVuCis0bmVuZQorM25lbworbmU0cG8KK25lMnEKK24xZXIKK25lMnJhNWIKK25lcjFhCituNGVyM2EycgorbjJlcmUKK240ZXI1aQorbmVyNHI0CisxbmVzCisybmVzLgorNG5lMXNwCisybmVzdAorNG5lczR3MgorM25ldDFpYworbmU0dgorbjVldmUKK25lNHcKK24zZgorbjRnYWIKK24xZ2EKK24zZ2VsCituZ2U0bjRlCituMWdlbgorbjVnZXJlCituM2dlcjFpCituZzVoYQorbjNnaWIKK25nMWluCituNWdpdAorbjRnbGE0CituZ2wyCituZ292NAorbjFnbworbmc1czJoCituZ3MyCituMWd1CituNGd1bQorbjJneQorNG4xaDQKK25oYTQKK25oYWIzCituaGU0CiszbjRpMWEKK25pM2Eybgorbmk0YXAKK25pM2JhCituaTRiMmwyCituMmk0ZAorbmk1ZGkKK25pNGVyCituMmllNAorbmkyZmkKK25pNWZpY2F0CituaWZpMWNhCituNWkxZ3IKK24yaWcKK240aWs0CituMWltCituaTNtMml6CituaW0xaQorbjFpbgorNW5pMm5lLgorbjJpbmUKK25pbjRnCituMmk0bworNW4yaXMuCituaXM0dGEKK24yaXQKK240aXRoCiszbjJpMXQyaW8KK25pMXRpCituM2l0b3IKK25pMXRvCituaTN0cgorbjFqCis0bmsyCituNWsyZXJvCituazFlcgorbjNrZXQKK25rM2luCituazFpCituMWsxbAorNG4xbAorbjVtCitubWU0CitubWV0NAorNG4xbjIKK25uZTQKK25uaTNhbAorbjNuNGkxYQorbm4yaTR2Citub2I0bDIKK25vM2JsZQorbjVvMWM0bDQKKzRuM28yZAorM25vZQorNG5vZworbm8xZ2U0Citub2lzNWkKK25vaTIKK25vNWw0aQorNW5vbDFvMWdpcworM25vbWljCituNW81bTJpegorbm80bW8KK25vM215CitubzRuCitub240YWcKK25vMW4xYQorbm9uNWkKK241b25pegorNG5vcAorNW5vcDVvNWwyaQorbm8ycjVhYgorbm8xcmEKK25vNHJhcnkKK25vcjJhMnIKKzRub3MyYworbm9zNGUKK25vczV0CitubzV0YQorMW5vdTIKKzNub3VuCitub3YzZWwzCitub3dsMworbjFwNAorbnBpNAorbnByZTRjCitucHIyCituMXEKK24xcgorbnJ1NAorMm4xczIKK24yczVhYgorbnNhMgorbnNhdGk0CituczRjCituMnNlCituNHMzZTRzCituczJpZDEKK25zMmlnNAorbjJzMWwyCituMnMzbQorbjRzb2MKK24xc28KK25zNHBlCituNXNwaQorbnN0YTViMmwyCituczF0YQorbnMydGFiCituMXQKK24ydGE0YgorbjF0YQorbnRlNHIzczIKK250MmkKK241dGkyYgorbnRpNGVyCitudDJpZTQKK250aTJmMgorbjN0MmluZQorbjJ0MWluCituNHQzaW5nCitudDJpNHAKK250cm9sNWwyaQorbnRyb2wxbAorbjR0NHMyCitudHUzbWUKK24xdHUKK24zdHVtCitudTFhCitudTRkCitudTVlbgorbnVmNGZlCitudTRmMWYKK24zdWk0bgorbjJ1aTIKKzNudTNpdAorbjR1bQorbnUxbWUKK241dTFtaQorM251NG4KK24zdW8KK251M3RyCituMXYyCituMXc0CitueW00CitueXA0Cis0bnoKK24zemExCis0b2EKK29hMmQzCitvNWE1bGVzMgorbzJhbGUKK29hcmQzCitvMmEycgorb2FzNGUKK29hc3Q1ZQorb2F0NWkKK29iM2EzYgorbzViMmEycgorbzFiZTRsCitvMWJpCitvMmJpbgorb2I1aW5nCitvM2JyCitvYjN1bAorbzFjZQorbzJjaDQKK28zY2hlNHQKK29jaGUyCitvY2lmMworbzFjaQorbzRjaWwKK280Y2xhbQorbzFjNGw0CitvNGNvZAorbzFjbworb2MzcmFjCitvYzVyYTF0aXoKK29jcmUzCis1b2NyaXQKK29jcmkyCitvY3RvMnI1YQorbzJjMXQKK29jMXRvCitvYzN1MWxhCitvNWN1cmUKK29kNWQxZWQKK29kMWQ0CitvZDNpYworbzFkMmkzbworbzJkbzQKK29kNG9yMworbzRkNXVjdC4KK28xZHUKK29kdTJjCitvZHUyYzF0CitvNGQ1dWM0dDFzMgorbzRlbAorbzVlbmcKK28zZXIKK29lNHRhCitvM2V2CitvMmZpCitvZjVpdGUKK29mNGk0dDR0MgorbzJnNWE1cgorbzFnYQorbzRnNWExdDJpdgorbzRnYTF0bworbzFnZQorbzVnZW5lCitvMWdlbgorbzVnZW8KK280Z2VyCitvM2cyaWU0CisxbzFnaXMKK29nM2l0CitvNGdsMgorbzVnMmx5Ciszb2duaXoKK29nMW5pCitvNGc0cm8KK28xZ3IKK29nMnU1aTIKKzFvMWd5CisybzJnNXkzbgorbzFoMgorb2hhYjUKK29pMgorb2ljM2VzCitvaTNkZXIKK28yaWQKK29pNGYxZjQKK28yaWc0CitvaTVsZXQKK28zaW5nCitvaW50NWVyCitvaW4xdAorbzVpMnMxbQorb2k1c28ybgorb2kyc28KK29pc3Q1ZW4KK29pczF0ZQorb2kzdGVyCitvMml0ZQorbzVqCisyb2sKK28za2VuCitvazVpZTQKK29rMWkKK28xbGEKK280bGEybgorb2xhMnNzNAorbzJsMmQKK29sMmQxZQorb2wzZXIKK28zbGVzMmMKK29sZXMyCitvM2xldAorb2w0ZmkKK28ybGYKK29sMmkKK28zbDJpMWEKK28zbGljZQorb2w1aWQuCitvbDJpZAorbzNsaTRmCitvNWw0aTRsCitvbDNpbmcKK281bDJpbworbzVsMmlzLgorb2wzaXMyaAorbzVsMml0ZQorb2wxaXQKK281bDJpMXQyaW8KK29saTF0aQorbzVsMml2CitvbGwyaTRlNAorb2wxbAorb2xsMmkKK29sNW8zZ2l6CitvbG80cgorb2w1cDJsMgorbzJscAorbzRsMnQKK29sM3ViCitvbDN1bWUKK29sM3VuCitvNWwydXMKK29sMnYKK28ybHkKK28ybTVhaAorbzFtYQorb21hNWwKK29tNWExdGl6CitvbTJiZQorbzRtMWIKK29tNGIybDIKK28ybWUKK29tM2UxbjRhCitvMW1lbgorb201ZXIyc2UKK29tZTRyMXMyCitvNG1ldAorb201ZTN0cnkKK29tNGV0cgorbzNtMmkzYQorb20zaWMuCitvbTNpMWNhCitvNW0yaWQKK29tMWluCitvNW0yaW5pCis1b21tZW5kCitvbTFtCitvbTFtZW4KK29tbzRnZQorbzFtbworbzRtbzJuCitvbTNwaQorbzRtMXAKK29tcHJvNQorb21wcjIKK28ybgorbzFuMWEKK29uNGFjCitvM24yYTJuCitvbjFjCiszb25jaWwKK29uMWNpCisyb25kCitvbjVkbworbzNuZW4KK28ybjVlc3QKK28xbmVzCitvbjRndQorb24xaWMKK28zbjJpNG8KK29uMWlzCitvNW5pMXUKK29uM2tleQorbzRuazIKK29uNG9kaQorbzRuM28yZAorb24zbzNteQorbzJuM3MyCitvbjVzcGk0CitvbnNwaTFyNWEKK29uc3A0aXIKK29uMXN1NAorb250ZW40CitvbjF0CitvbjN0NGkKK29udGkyZjUKK29uNXVtCitvbjF2YTUKK29uMXYyCitvbzIKK29vZDVlCitvb2Q1aQorbzJvNGsKK29vcDNpCitvM29yZAorb29zdDUKK28ycGEKK28ycDJlNWQKK29wMWVyCiszb3BlcjFhCis0b3A0ZXJhZworMm9waAorbzVwaGEybgorbzVwaDRlcgorb3AzaW5nCitvcGkybgorbzNwaXQKK281cG8ybgorbzRwb3NpCitvMXBvcworbzFwcjIKK29wMXUKK29weTUKK28xcQorbzFyYQorbzVyYS4KK280cjNhZworb3I1YWwxaXoKK29yYWwxaQorb3I1YW40Z2UKK29yYTJuCitvcjJhbmcKK29yZTVhCitvNXJlMWE0bAorb3IzZWkyCitvcjRlNXMyaAorb3I1ZTJzdC4KK29yZXMydAorb3JldzQKK29yNGd1CitvcmcyCis0bzVyMmkzYQorb3IzaTFjYQorbzVyaWwKK29yMWluCitvMXIyaTFvCitvcjNpMXR5CitvM3JpMXUKK29yMm1pCitvcjFtCitvcm4yZQorbzVyb2YKK29yM291Zworb3JvdTIKK29yNXBlCitvcjFwCiszb3JyaDQKK29yMXI0CitvcjRzZQorbzRyczIKK29yczVlbgorb3JzdDQKK29yM3RoaQorb3IzdGh5CitvcjR0eQorbzVydW0KK28xcnkKK29zM2FsCitvc2EyCitvczJjCitvczRjZQorbzNzY29wCitvczFjbworNG9zY29waQorbzVzY3IKK29zNGk0ZTQKK29zNWkxdDJpdgorb3NpMXRpCitvczNpMXRvCitvczNpMXR5CitvNXNpNHUKK29zNGwyCitvMnNvCitvMnM0cGEKK29zNHBvCitvczJ0YQorbzVzdGF0aQorb3M1dGlsCitvc3QyaQorb3M1dGl0CitvNHRhMm4KK28xdGEKK290ZWxlNGcKK290M2VyLgorb3Q1ZTRyMXMyCitvNHRlcworNG90aAorb3RoNWUxc2kKK290aDJlCitvdGgxZXMKK290aDNpNAorb3QzaWMuCitvdDVpMWNhCitvM3RpY2UKK28zdGlmMgorbzN0aXMKK290bzVzMgorbzF0bworb3UyCitvdTNiMmwyCitvdWNoNWkKK291MmNoCitvdTVldAorb3U0bAorb3VuYzVlcgorb3VuMmQKK291NXYyCitvdjRlbgorb3ZlcjRuZQorb3ZlNHIzczIKK292NGVydAorbzN2aXMKK280dmkxdGk0CitvNXY0b2wKK293M2Rlcgorb3czZWwKK293NWVzdDMKK293MWkyCitvd241aQorbzR3bzIKK295MWEKKzFwYQorcGE0Y2EKK3BhNGNlCitwYTJjNHQKK3A0YTJkCis1cGFnYTRuCitwYTFnYQorcDNhZ2F0CitwNGFpMgorcGE0aTRuNAorcDRhbAorcGExbjRhCitwYTJuCitwYW4zZWwKK3BhbjR0eQorcGFuMXQKK3BhM255CitwYTFwCitwYTRwdQorcGFyYTViMmwyCitwMmEycgorcGEycmFiCitwYXI1YWdlCitwYXI1ZDJpCiszcGFyZQorcGFyNWVsCitwNGE0cjFpCitwYXI0aXMKK3BhMnRlCitwYTV0ZXIKKzVwYXRoaWMKK3A0YXRoCitwYTV0aHkKK3BhNHRyaWMKK3BhMXRyCitwYXY0CiszcGF5Cis0cDFiCitwZDQKKzRwZS4KKzNwZTRhCitwZWFyNGwKK3BlMmEycgorcGUyYworMnAyZWQKKzNw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zJuCitwbzRwCisxcDRvcgorcG80cnkKKzFwb3MKK3BvMnMxcworcDRvdAorcG80dGEKKzVwb3VuCitwb3UyCis0cDFwCitwcGE1cmEKK3AxcGEKK3BwMmEycgorcDJwZQorcDRwMmVkCitwNXBlbAorcDNwZW4KK3AzcGVyCitwM3BlMnQKK3BwbzVzMml0ZQorcDFwb3MKK3ByMgorcHJheTRlNAorNXByZTFjMmkKK3ByZTVjbworcHJlM2UybQorcHJlNGY1YWMKK3ByZTFmCitwcmUxZmEKK3ByZTRsYQorcHIxZTNyNAorcDNyZTFzMmUKKzNwcjJlMnNzCitwcmU1dGVuCitwcmUzdjIKKzVwcjJpNGU0CitwcmluNHQzCitwcjJpNHMKK3ByaTJzM28KK3Azcm8xY2EKK3ByMm9jCitwcm9mNWl0Citwcm8yZmkKK3BybzNsCitwcm9zM2UKK3BybzF0CisycDFzMgorcDJzZQorcHM0aAorcDRzaTFiCisycDF0CitwMnQ1YTRiCitwMXRhCitwMnRlCitwMnRoCitwMXRpM20KK3B0dTRyCitwMXR1CitwNHR3NAorcHViMworcHVlNAorcHVmNAorcHU0bDNjMgorcHU0bQorcHUybgorcHVyNHI0Cis1cDJ1cworcHUydAorNXB1dGUKK3B1dDNlcgorcHUzdHIKK3B1dDR0MWVkCitwdTR0M3QyCitwdXQ0dDFpbgorcDN3CitxdTIKK3F1YTV2NAorMnF1ZS4KKzNxdWVyCiszcXVldAorMnJhYgorcmEzYmkKK3JhY2g0ZTIKK3JhMmNoCityNWExYzRsNAorcmFmNWZpCityYTJmCityYTRmMWY0CityYTJmNHQKK3IyYWkyCityYTRsbworcmFtM2V0CityMmFtaQorcmEzbmU1bworcmEybgorcmFuNGdlCityMmFuZworcjRhbmkKK3JhNW5vNAorcmFwM2VyCiszcmExcGh5CityYXI1YworcjJhMnIKK3JhcmU0CityYXI1ZTFmCis0cmFyaWwKK3JhcjFpCityMmFzCityYXRpbzJuNAorcmExdDJpbworcmF1NHQKK3JhNXZhaTIKK3JhMnZhCityYXYzZWwKK3JhNXoyaWU0CityYTJ6MWkKK3IxYgorcjRiYWIKK3I0YmFnCityYmkyCityMmIzaTRmCityMmJpbgorcjViMmluZQorcmI1aW5nLgorcmI0bworcjFjCityMmNlCityMWNlbjQKK3IzY2hhCityMmNoCityY2g0ZXIKK3JjaGUyCityNGNpNGIKK3IxY2kKK3IyYzRpdAorcmN1bTMKK3I0ZGFsCityMWQyYQorcmQyaQorcjFkNGk0YQorcmRpNGVyCityZDJpZTQKK3JkMWluNAorcmQzaW5nCisycmUuCityZTFhNGwKK3JlM2EybgorcmU1YXIxcjQKK3JlMmEycgorNXJlYTJ2CityZTRhdworcjVlYnJhdAorcjJlMWIKK3JlM2JyCityZWM1b2wxbAorcmUyY29sCityZTFjbworcmU0YzVvbXBlCityZWNvNG0xcAorcmU0Y3JlCityZTFjcgorMnIyZWQKK3JlMWRlCityZTNkaXMxCityNGVkaQorcmVkNWl0CityZTRmYWMKK3JlMWYKK3JlMWZhCityZTJmZQorcmU1ZmVyLgorcmVmZXIxCityZTNmaQorcmU0ZnkKK3JlZzNpcworcmU1aXQKK3JlaTIKK3JlMWwyaQorcmU1bHUKK3I0ZW40dGEKK3JlbjF0CityZW40dGUKK3JlMW8KK3JlNXBpMm4KK3JlNHBvc2kKK3JlMXBvCityZTFwb3MKK3JlMXB1CityMWVyNAorcjRlcjFpCityMmVybzQKK3I0ZTVydQorcjRlcy4KK3JlNHNwaQorcmUxc3AKK3JlczRzNWk0YgorcjJlMnNzCityZXMxc2kKK3JlczJ0CityZTVzMnRhMmwKK3JlczF0YQorcjJlM3N0NHIKK3JlNHRlcgorcmU0dGk0egorcmUzdHJpCityNGV1MgorcmU1dTF0MmkKK3JldjIKK3JlNHZhbAorcmUxdmEKK3JldjNlbAorcjVldjVlci4KK3JldjFlcgorcmU1dmU0cjFzMgorcmU1dmVydAorcmU1dmk0bAorcmUxdmkKK3JldjVvbHUKK3JlNHdoCityMWYKK3IzZnU0CityNGZ5CityZzIKK3JnM2VyCityM2dldAorcjNnMWljCityZ2k0bgorcmczaW5nCityNWdpcworcjVnaXQKK3IxZ2wyCityZ280bjIKK3IxZ28KK3IzZ3UKK3JoNAorNHJoLgorNHJoYWwKK3IyaTNhCityaWE0Ygorcmk0YWcKK3I0aWIKK3JpYjNhCityaWM1YXM1CityaTFjYQorcjRpY2UKKzRyMmkxY2kKKzVyaTVjMmlkCityaTRjMmllNAorcjRpMWNvCityaWQ1ZXIKK3IyaWQKK3JpM2VuYworcjJpZTQKK3JpM2VuMXQKK3JpMWVyCityaTVldAorcmlnNWEybgorcjJpZworcmkxZ2EKKzVyNGlnaQorcmlsM2l6CityaWwxaQorNXJpbWEybgorcmkxbWEKK3JpbTVpCiszcmkxbW8KK3JpbTRwZQorcmk0bTFwCityMmkxbmEKKzVyaW5hLgorcjRpbjRkCityMmluNGUKK3JpbjRnCityMmkxbworNXJpcGgKK3IyaXAKK3JpcGg1ZQorcmkycDJsMgorcmlwNWxpYworcjRpcQorcjJpcworcjRpcy4KK3IyaXM0YworcjNpczJoCityaXM0cAorcmkzdGEzYgorcmkxdGEKK3I1aXRlZC4KK3IyaXRlCityaTJ0MWVkCityaXQ1ZXIuCityaXQ1ZTRyMXMyCityNGkydDNpYworcmkxdGkKK3JpMnR1CityaXQ1dXIKK3JpdjVlbAorcjJpdgorcml2M2V0CityaXYzaQorcjNqCityM2tldAorcms0bGUKK3JrMWwKK3JrNGxpbgorcjFsCitybGU0CityMmxlZAorcjRsMmlnCityNGxpcworcmw1aXMyaAorcjNsbzQKK3IxbQorcm1hNWMKK3IxbWEKK3IybWUKK3IzbWVuCitybTVlNHIxczIKK3JtM2luZworcjRtaW5nLgorcjRtMmlvCityM21pdAorcjRteQorcjRuMmEycgorcjFuYQorcjNuZWwKK3I0bjFlcgorcjVuZXQKK3IzbmV5CityNW5pYworcjFuaXM0CityM24yaXQKK3IzbjJpdgorcm5vNAorcjRub3UyCityM251Cityb2IzbDIKK3Iyb2MKK3JvM2NyCitybzRlCitybzFmZQorcm81ZmlsCitybzJmaQorcjJvazIKK3JvNWsxZXIKKzVyb2xlLgorcm9tNWUxdGUKK3JvMm1lCitybzRtZXQKK3JvbTRpCitybzRtNHAKK3JvbjRhbAorcm8ybgorcm8xbjFhCityb240ZQorcm81bjRpcworcm9uNHRhCityb24xdAorMXJvb20KK3JvbzIKKzVyb290CitybzNwZWwKK3JvcDNpYworcm9yM2kKK3JvNXJvCitybzJzNXBlcgorcm8yczRzCitybzR0aDJlCityNG90aAorcm80dHkKK3JvNHZhCityb3Y1ZWwKK3JveDUKK3IxcAorcjRwZTRhCityNXBlbjF0CitycDVlci4KK3IzcGUydAorcnA0aDQKK3JwM2luZworcnBpMm4KK3IzcG8KK3IxcjQKK3JyZTRjCitycmU0ZgorcjRyZTFvCitycmU0czJ0CitycjJpNG8KK3JyMmk0dgorcnJvMm40Citycm9zNAorcnJ5czQKKzRyczIKK3Ixc2EyCityc2E1dGkKK3JzNGMKK3Iyc2UKK3Izc2VjCityc2U0Y3IKK3I0czVlci4KK3JzM2U0cworcjVzZTV2MgorcjFzMmgKK3I1c2hhCityMXNpCityNHNpNGIKK3JzbzJuMworcjFzbworcjFzcAorcjVzdzIKK3J0YTJjaDQKK3IxdGEKK3I0dGFnCityM3QyZTFiCityM3RlbjRkCityMXRlNW8KK3IxdGkKK3IydDVpMmIKK3J0Mmk0ZAorcjR0aWVyCitydDJpZTQKK3IzdDJpZworcnRpbDNpCitydGlsNGwKK3I0dGkxbHkKK3I0dGlzdAorcjR0Mml2CityM3RyaQorcnRyMm9waDQKK3J0NHMyaDQKK3I0dDFzMgorcnUzYQorcnUzZTRsCitydTNlbgorcnU0Z2wyCitydTNpNG4KK3IydWkyCitydW0zcDJsMgorcnU0bTJwCitydTJuCitydTRuazUKK3J1bjR0eQorcnVuMXQKK3I1dXNjMgorcjJ1cworcnUydDFpNW4KK3I0dTF0MmkKK3J2NGUKK3J2ZWw0aQorcjN2ZW4KK3J2NWVyLgorcjV2ZXN0CitydjRlMnMKK3I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KK3M1aWMzYworM3NpMmRlLgorczJpZAorNXNpZGU0czIKKzVzaTJkaQorc2k1ZGl6Cis0c2lnMW40YQorczJpZworc2lsNGUKKzRzaTFseQorMnMxaW4KK3MyaTFuYQorNXNpMm5lLgorczJpbmUKK3MzaW5nCisxczJpbworNXNpbzJuCitzaW8xbjVhCitzNGkycgorc2kxcjVhCisxc2lzCiszczJpMXQyaW8KK3NpMXRpCis1c2kxdQorMXMyaXYKKzVzaXoKK3NrMgorNHNrZQorczNrZXQKK3NrNWluZQorc2sxaQorc2s1aW40ZworczFsMgorczNsYXQKK3MybGUKK3NsMml0aDUKK3NsMWl0CisyczFtCitzM21hCitzbWFsMWwzCitzbWEybjMKK3NtZWw0CitzNW1lbgorNXM0bTJpdGgKK3NtbzJsNWQ0CitzMW1vCitzMW40Cisxc28KK3NvNGNlCitzbzJmdDMKK3NvNGxhYgorc28xbGEKK3NvMmwzZDIKK3NvM2xpYworc29sMmkKKzVzb2wydgorM3NvbQorM3M0b24uCitzbzJuCitzbzFuMWE0Citzb240ZworczRvcAorNXNvcGgxaWMKK3Myb3BoCitzNW8zcGhpegorczVvMXBoeQorc29yNWMKK3NvcjVkCis0c292CitzbzV2aQorMnMxcGEKKzVzcDRhaTIKK3NwYTRuCitzcGVuNGQKKzJzNXBlbworMnNwZXIKK3MycGhlCiszc3BoNGVyCitzcGhvNQorc3BpbDQKK3NwNWluZworc3BpMm4KKzRzM3AyaTFvCitzNHAxbHkKK3MxcDJsMgorczRwbzJuCitzMXA0b3I0Cis0c3A0b3QKK3NxdWFsNGwKK3NxdTIKK3MxcgorMnNzCitzMXNhMgorc3NhczMKK3MyczVjCitzM3NlbAorczVzZW41ZworczRzZXMuCitzczFlNHMKK3M1c2V0CitzMXNpCitzNHMyaWU0Citzc2k0ZXIKK3M0czVpMWx5CitzNHMxbDIKK3NzNGxpCitzNHMxbjQKK3NzcGVuNGQ0CitzczJ0Citzc3UxcjVhCitzMXN1Citzc3Uycgorc3M1dzIKKzJzdC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jJsMgordTFtaQordTRtM2luZwordW1vcjVvCit1MW1vCit1bW8ycgordTRtMnAKK3VuMmF0NAordTFuYQordTJuZQordW40ZXIKK3UxbmkKK3VuNGltCit1Mm4xaW4KK3VuNWlzMmgKK3VuMmkzdgordTJuM3M0Cit1bjRzdzIKK3VuMnQzYTRiCit1bjF0Cit1bjF0YQordW40dGVyLgordW40dGVzCit1bnU0Cit1bjV5Cit1NG41egordTRvNHJzMgordTVvcwordTFvdTIKK3UxcGUKK3VwZTRyNXMyCit1NXAyaTNhCit1cDNpbmcKK3VwaTJuCit1M3AybDIKK3U0cDNwCit1cHBvcnQ1Cit1cDFwNG9yCit1cDJ0NWkyYgordTJwMXQKK3VwMXR1NAordTFyYQorNHVyYS4KK3U0cmFnCit1NHIyYXMKK3VyNGJlCit1cjFiCit1cjFjNAordXIxZAordXJlNWEydAordXI0ZmVyMQordXIxZgordXI0ZnIKK3UzcmlmCit1cmk0ZmljCit1cmkxZmkKK3VyMWluCit1M3IyaTFvCit1MXJpdAordXIzaXoKK3VyMmwKK3VybDVpbmcuCit1cjRubzQKK3Vyb3M0Cit1cjRwZQordXIxcAordXI0cGkKK3VyczVlcgordTRyczIKK3VyMnNlCit1cjV0ZXMKK3VyM3RoMmUKK3VyMXRpNAordXI0dDJpZTQKK3UzcnUKKzJ1cwordTVzYTJkCit1c2EyCit1NXNhMm4KK3VzNGFwCit1c2MyCit1czNjaQordXNlNWEKK3U1czJpMWEKK3Uzc2ljCit1czRsaW4KK3VzMWwyCit1czFwCit1czVzMWwyCit1MnNzCit1czV0ZXJlCit1czF0NHIKK3Uyc3UKK3VzdTJyNAordTJ0YTRiCit1MXRhCit1M3RhdAorNHU0dGUuCis0dXRlbAorNHV0ZW4KK3V0ZW40aQorNHUxdDJpCit1dGk1bDJpegordXRpbDFpCit1M3QyaW5lCit1MnQxaW4KK3V0M2luZwordXRpbzFuNWEKK3UxdDJpbwordXRpbzJuCit1NHRpcworNXU1dGl6Cit1NHQxbAordTJ0NW9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pNAordm80cnkKK3ZvNHRhCis0dm8xdGVlCis0dnY0Cit2NHkKK3c1YWIybDIKKzJ3YWMKK3dhNWdlcgord2EyZzVvCit3YWl0NQord2FpMgordzVhbC4KK3dhbTQKK3dhcjR0Cit3MmEycgord2FzNHQKK3dhMXRlCit3YTV2ZXIKK3cxYgord2VhNXIyaWU0Cit3ZTJhMnIKK3dlYXIxaQord2U0YXRoMword2VhMnQKK3dlNGQ0bjQKK3dlZXQzCit3ZWU1dgord2VsNGwKK3cxZXIKK3dlc3QzCit3M2V2Cit3aGk0Cit3aTIKK3dpbDIKK3dpbDJsNWluNAord2lsMWwKK3dpbGwyaQord2luNGRlCit3NGluZAord2luNGcKK3c0aXI0CiszdzRpc2UKK3cyaXRoMword2l6NQordzRrCit3bDRlczIKK3dsM2luCit3NG5vCisxd28yCit3b20xCit3bzV2NGVuCit3NXAKK3dyYTQKK3dyaTQKK3dyaTF0YTQKK3czczJoCit3czRsMgord3M0cGUKK3c1czR0Cis0d3QKK3d5NAoreDFhCit4YWM1ZQoreDRhMmdvCit4YW0zCit4NGFwCit4YXM1Cit4M2MyCit4MWUKK3hlNGN1MXRvCit4ZTFjdQoreGUzYzR1dAoreDJlZAoreGVyNGkKK3gyZTVybworeDFoCit4aGkyCit4aDRpbDUKK3hodTQKK3gzaQoreDJpNWEKK3hpNWMKK3hpNWRpCit4MmlkCit4NGltZQoreGk1bTJpegoreGltMWkKK3gzbworeDRvYgoreDNwCit4cDRhbjRkCit4MXBhCit4cGEybgoreHBlYzF0bzUKK3hwZTJjCit4cGUyYzF0Cit4MnAyZTNkCit4MXQyCit4M3RpCit4MXUKK3h1M2EKK3h4NAoreTVhYworM3kyYTJyNAoreTVhdAoreTFiCit5MWMKK3kyY2UKK3ljNWVyCit5M2NoCit5Y2g0ZTIKK3ljb200Cit5MWNvCit5Y290NAoreTFkCit5NWVlCit5MWVyCit5NGVyMWYKK3llczQKK3llNHQKK3k1Z2kKKzR5M2gKK3kxaQoreTNsYQoreWxs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tbzhuOG85ZThuOWU4cjlnOGU4dDhpOGMuCisubW8zbm9lCisubW9ub2VuMWVyCisubW9ub2VuZXJnMgorLm1vbm9lbmVyM2dldAorLm1vbm9lbmVyZ2V0MWljCisubW84bjlvOGk4ZC4KKy5tb25vaTIKKy5tb25vMmlkCisubW84bjhvOXA4bzhsOGUuCisubW80bm9wCisubW84bjhvOXA4bzhsOGU4cy4KKy5tb25vcG9sZXMyCisubW85bjhvOHA5bzhsOHkuCisubW9ub3BvMmx5CisubW84bjhvOXM4cDhsOGk4bjhlLgorLm1vbm9zMXAybDIKKy5tb25vc3BsaTRuCisubW9ub3NwMWw0aW5lCisubW84bjhvOXM4cDhsOGk4bjhlOHMuCisubW9ub3NwbGkxbmVzCisubW84bjhvOXM4dDhyOG84ZjhpOGMuCisubW9ub3M1dAorLm1vbm9zdDRyCisubW9ub3N0cm8yZmkKKy5tbzluOG84dDlvOW44aThlOHMuCisubW9ubzF0bworLm1vMm5vdG8ybgorLm1vbm90b24yaWU0CisubW85bjhvOHQ5bzluOG84dThzLgorLm1vbm80dG9ubworLm1vbm90bzFub3UyCisubW9ub3Rvbm8ydXMKKy5tbzlyOG84bjlpOHM4bS4KKy5tb3JvNW40aXMKKy5tb3JvMm4KKy5tb3JvbmkyczFtCisubW84czlxOHU4aTl0OG8uCisubW9zMgorLm1vc3F1MgorLm1vc3EydWkyCisubW9zcXVpMXRvCisubW84czlxOHU4aTl0OG84cy4KKy5tb3NxdWl0b3MyCisubW84czlxOHU4aTl0OG84ZThzLgorLm11OGQ5cjhvOG84bS4KKy5tdTFkcgorLm11ZDFyb29tCisubXVkcm9vMgorLm11OGQ5cjhvOG84bThzLgorLm11ZHJvbzRtMXMyCisubXU4bDl0OGk5ZjhhOGM5ZTh0OGU4ZC4KKy41bXU0bHQKKy5tdWwxdGkzCisubXVsdGlmMgorLm11bHRpMWZhCisubXVsdGlmYTRjZQorLm11bHRpZmFjZXQ0CisubXVsdGlmYWNlMnQxZWQKKy5tdThsOXQ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k4bjhlLgorLnBoZW55M2xhCisucGhlbnlsYWxhMm4KKy5waGVueWxhbGE1bjJpbmUKKy5waGVueWxhbGFuMWluCisucGg4aTlsOGE4dDllOWw4aThzOHQuCisucGhpNGxhdGVsMmk0CisucGhpbGF0ZTJsaXMKKy5waDhpOWw4YTh0OWU5bDhpOHM4dDhzLgorLnBoaWxhdGVsaXM0dDFzMgorLnBoOG85bjhlOG04ZS4KKy4zcGhvbmUKKy5waG8ybgorLnBob25lMW1lCisucGg4bzluOGU4bThlOHMuCisucGhvbmUybWVzCisucGg4bzluOGU5bThpOGMuCisucGhvbmU1bWkKKy5waDhvOHM5cDhoOG84cjlpOGMuCisucGhvczFwCisucGhvc3BobzUKKy5waG9zcGhvNHIKKy5waDhvOXQ4bzlnOHI4YThwOGg4cy4KKy5waG8xdG8KKy5waG90bzJncgorLnBob3RvZ3JhNHA0aDFzMgorLnBoOG85dDhvOW84ZjhmOXM4ZTh0LgorLnBob3RvbzIKKy5waG90b280ZjFmCisucGhvdG9vZjJmM3MKKy5waThjOWE5ZDhvOHIuCisucGkxY2EKKy5waWNhMmQKKy5waWNhMWRvCisucGljYWQ0b3IKKy5waThjOWE5ZDhvOHI4cy4KKy5waWNhZG80cnMyCisucGk4cDhlOWw4aThuOGUuCisucDJpcAorLnBpcGU0CisucGlwZWwyaQorLnBpcGUxbDRpbmUKKy5waThwOGU5bDhpOG44ZThzLgorLnBpcGVsaTFuZXMKKy5waThwOGU5bDhpOG45aThuOGcuCisucGlwZWwyaW4zaQorLnBpcGVsaW4xaW4KKy5waXBlbGluaW40ZworLnBpOXI4YTluOGg4YThzLgorLnA0aXIKKy5waTFyYQorLnBpcmEybgorLnBpcmE0bjFoNAorLnBpcmFuaGE0CisucGw4YThjOGE5YjhsOGUuCisuMXAybDIKKy5wbGExY2EKKy5wbGFjYTFiMmwyCisucGw4YThuOHQ5aDhvOHA5cDhlOHIuCisuM3BsYTJuCisucGxhbjF0CisucGxhbnRobzRwMXAKKy5wbGFudGh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5wcmVzMXAybDIKKy5wcmVzcGwxaXQKKy5wcmVzcGw0aTR0M3QyCisucHJlc3BsaXQydDFpbgorLnByOGU5dzhyOGE4cC4KKy5wcmV3cmE0CisucHI4ZTl3OHI4YThwOHA4ZThkLgorLnByZXdyYTRwMXAKKy5wcmV3cmFwMnBlCisucHJld3JhcDRwMmVkCisucHI4aThlOHM4dDllOHM4czhlOHMuCisuNXByMmk0ZTQKKy5wcmkxZXN0CisucHJpZXM0dDJlMnNzCisucHJpZXN0ZXNzMWU0cworLnByOGU4dDl0OHk5cDhyOGk4bjl0OGU4ci4KKy5wcmU0dDN0MgorLnByZXQxdHkKKy5wcjJldHR5cHIyCisucHJldHR5cHJpbjR0MworLnByOGU4dDl0OHk5cDhyOGk4bjl0OGk4bjhnLgorLnByZXR0eXByaW50MmkKKy5wcmV0dHlwcmluNHQzaW5nCisucHJldHR5cHJpbjJ0MWluCisucHI4bzljOGU5ZDh1OHI5YThsLgorLnByMm9jCisucHJvMWNlCisucHJvY2UxZHUKKy5wcm9jZWR1MXJhCisucHI4bzhjOGU4czhzLgorLnByb2MyZTJzcworLnByOG85Yzh1OHI5YThuOGM4ZS4KKy5wcm9jdTFyYQorLnByb2N1cmEybgorLnByOG84ZzllOW44aThlOHMuCisucHJvMWdlCisucHJvMWdlbgorLnByb2dlNW4yaWU0CisucHI4bzhnOWU5bjh5LgorLnBybzRnZW55CisucHI4bzlnOHI4YThtOW04YThiOGw4ZS4KKy5wcm8xZ3IKKy5wcm9ncmFtMW0KKy5wcm9ncmFtMW1hCisucHJvZ3JhbTJtYWIKKy5wcm9ncmFtbWFiMmwyCisucHI4bzhtOWk5bjhlOG44dC4KKy5wcm9tNGkKKy5wcm9tMWluCisucHJvbTJpbmUKKy5wcm9taTFuZW4KKy5wcm9taW5lbjF0CisucHI4bzltOGk4czljOHU5bzh1OHMuCisucHJvbTJpcworLnByb20yaXMxYworLnByb21pczFjdQorLnByb21pc2N1MW91MgorLnByb21pc2N1bzJ1cworLnByO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lLgorLnRlOHM4dDliOGU4ZC4KKy50ZXMydDFiCisudGVzdDRiZTJkCisudGU4eDh0OXc4aThkOHQ4aC4KKy4zdGV4CisudGV4MXQyCisudGV4dHc0CisudGV4dHdpMgorLnRleHR3MmlkCisudGV4dHdpZDJ0aAorLnRoOGE4bDlhOW04dThzLgorLnRoYTNsYQorLnRoYWxhM20KKy50aGFsYTFtdQorLnRoYWxhbTJ1cworLnRoOGU4cjltOG85ZThsOGE4czl0OGk4Yy4KKy50aDJlCisudGhlcjNtNAorLnRoZXIxbW8KKy50aGVybW80ZWwKKy50aGVybW9lMWxhCisudGhlcm1vZWxhc3QyaQorLnRoZXJtb2VsYXMxdGljCisudGk4bThlOXM4dDhhOG04cC4KKy50aTJtZXMKKy50aW1lczF0YQorLnRpbWVzdGE0bTFwCisudGk4bThlOXM4dDhhOG04cDhzLgorLnRpbWVzdGFtMnAxczIKKy50bzhvOGw5azhpOHQuCisudG9vMgorLnRvb2xrMWkKKy50bzhvOGw5azhpOHQ4cy4KKy50b29sa2k0dDFzMgorLnRvOHA4bzlnOHI4YThwOGg5aTljOGE4bC4KKy50bzVwbzRnCisudG9wbzFncgorLnRvcG81Z3JhcGgxaWMKKy50b3BvZ3I0YXBoaQorLnRvcG9ncmFwaGkxY2EKKy50bzhxOHU4ZThzLgorLnRvMXEKKy50b3F1MgorLnRyOGE4aTl0OG84cjlvOHU4cy4KKy4xdHJhCisudHIyYWkyCisudHJhaTF0bworLnRyYWl0b3JvdTIKKy50cmFpdG9ybzJ1cworLnRyOGE4bjhzOWM4ZThpOHY4ZThyLgorLnRyYTJuCisudHJhMm4xczIKKy50cmFuczRjCisudHJhbjRzM2NlaTIKKy50cmFuc2NlMml2CisudHI4YThuOHM5YzhlOGk4djhlOHI4cy4KKy50cmFuc2NlaXZlNHIxczIKKy50cjhhOG44czlnOHI4ZThzOHMuCisudHJhbjJzM2cKKy50cmFuczFncgorLnRyYW5zZ3IyZTJzcworLnRyOGE4bjhzOXY4ZThyOXM4YThsLgorLnRyYW40c3YKKy50cmFuc3ZlNHIxczIKKy50cmFuc3ZlcjFzYTIKKy50cjhhOG44czl2OGU4cjlzOGE4bDhzLgorLnRyYW5zdmVyc2EybDFzMgorLnRyOGE4bjhzOXY4ZThzOXQ4aTh0OGUuCisudHJhbnN2NGUycworLnRyYW5zdmVzdDJpCisudHJhbnN2ZXN0Mml0ZQorLnRyOGE4bjhzOXY4ZThzOXQ4aTh0OGU4cy4KKy50cmFuc3Zlc3RpdDRlcworLnRyOGE5djhlOHI4czlhOWI4bDhlLgorLnRyYXZlNHIxczIKKy50cmF2ZXIxc2EyCisudHJhdmVyMnMxYWIKKy50cmF2ZXJzYWIybDIKKy50cjhhOXY4ZThyOXM4YThsLgorLnRyOGE5djhlOHI5czhhOGw4cy4KKy50cmF2ZXJzYTJsMXMyCisudHI4aTllOHQ4aDh5OGw5YThtOGk4bjhlLgorLnRyaTVldAorLnRyMmllNAorLnRyaWV0aHkzbGEKKy50cmlldGh5bGFtMWluCisudHJpZXRoeWxhbTJpbmUKKy50cjhlOGE4YzhoOWU4cjhpOGU4cy4KKy50cmVhMmNoCisudHJlYWNoZTIKKy50cmVhY2hlcjFpCisudHJlYWNoZXIyaWU0CisudHI4bzh1OWI4YTlkOG84dThyLgorLnRyb3UyCisudHJvdWJhMmQKKy50cm91YmExZG8KKy50cm91YmFkb3UyCisudHU4cjlrOGU4eS4KKy4xdHUKKy50dThyOWs4ZTh5OHMuCisudHVya2V5czQKKy50dThyOG45YThyOG84dThuOGQuCisudHVyNG4yYTJyCisudHVyMW5hCisudHVybmFyb3UyCisudHVybmFyb3VuMmQKKy50dThyOG45YThyOG84dThuOGQ4cy4KKy50dXJuYXJvdW4yZDFzMgorLnR5OHA5YThsLgorLjF0eQorLnR5MXBhCisudHlwNGFsCisudW45YTh0OXQ4YThjOGg4ZThkLgorLnVuMmF0NAorLnVuYTR0M3QyCisudW5hdDF0YQorLnVuYXR0YTJjaAorLnVuYXR0YWNoZTIKKy51bmF0dGE0Y2g0ZWQKKy51bjllOHI4cjlpOG44ZzlsOHkuCisudW40ZXIKKy51bmVyNHI0CisudW5lcnJpbjRnCisudW5lcnJpbmdsMgorLnVuZXJyaW5nMWx5CisudW45ZjhyOGk4ZThuOGQ5bDh5LgorLnVuM2YKKy51bmZyaTIKKy51bmZyMmllNAorLnVuZnJpZW4yZDFseQorLnVuOWY4cjhpOGU4bjhkOWw4aTllOHIuCisudW5mcmllbmRsMmllNAorLnZhOGc4dThlOHIuCisuMXZhCisudmFnNAorLnZhNWd1ZXIKKy52YTJndWUKKy52YTh1OGQ4ZTl2OGk4bDhsOGUuCisudmF1ZGUxdjQKKy52YXVkZTJ2M2k0bAorLnZhdWRlMXZpCisudmF1ZGV2aWwxbAorLnZhdWRldmlsMmxlCisudmk4YzlhOHI4cy4KKy52NGljMmEycgorLnZpMWNhCisudmljYTRyczIKKy52aThsOWw4YThpOG45ZThzOHMuCisuMnZpbAorLnZpbDFsCisudmlsbGFpMgorLnZpbGxhNGk0bgorLnZpbGxhMmluZQorLnZpbGxhaTVuMmUyc3MKKy52aWxsYWkxbmVzCisudmk4czl1OGE4bC4KKy52aTNzdQorLnZpc3UxYWwKKy52aThzOXU4YThsOWw4eS4KKy52aXN1YWwxbAorLnZpc3VhbDFseQorLnZpOXY4aThwOWE5cjhvOHU4cy4KKy4zdjJpdgorLnZpdjJpNHAKKy52aXZpMXBhCisudml2aXAyYTJyCisudml2aXBhcm91MgorLnZpdmlwYXJvMnVzCisudm84aThjOGU5cDhyOGk4bjh0LgorLnZvaTQKKy52b2kzY2VwCisudm9pY2VwcjIKKy52b2ljZXByaW40dDMKKy52czhwOGE4YzhlLgorLnYyczFwYQorLnZzcGE0Y2UKKy53YThkOWQ4aThuOGcuCisud2EyZAorLndhZDRkMWluCisud2FkMWQ0Cisud2E4bDhsOWY4bDhvOHc4ZThyLgorLndhbDFsCisud2FsMmxmCisud2FsbGY0bDIKKy53YWxsZmxvdzFlcgorLndhOGw4bDlmOGw4bzh3OWU4cjhzLgorLndhbGxmbG93ZTRyMXMyCisud2E4cjhtOWU4czh0LgorLncyYTJyCisud2FyMW0KKy53YXIybWUKKy53YXIybWVzCisud2E4czh0OGU5dzhhOHQ4ZThyLgorLndhczR0Cisud2FzdGUydworLndhc3RlMXc1YQorLndhc3Rld2ExdGUKKy53YTh2OGU5Zzh1OGk4ZDhlLgorLndhdmVnMworLndhdmVnMnVpMgorLndhdmVndTJpZAorLndhOHY4ZTlnOHU4aThkOGU4cy4KKy53YXZlZ3VpZGU0czIKKy53YTh2OGU5bDhlOHQuCisud2E4djhlOWw4ZTh0OHMuCisud2F2ZWxlNHQxczIKKy53ZThiOWw4aThrOGUuCisudzJlMWIKKy53ZWIybDIKKy53ZWIzbDRpaworLndlOGU4azluOGk4ZzhoOHQuCisud2Vla24yaWcKKy53ZThlOGs5bjhpOGc4aDh0OHMuCisud2Vla25pZ2g0dDFzMgorLndoOGU4ZThsOWM4aDhhOGk4ci4KKy53aGVlNGwxYzIKKy53aGVlbDJjaAorLndoZWVsY2hhaTIKKy53aGVlbGNoYTRpcgorLndoOGU4ZThsOWM4aDhhOGk4cjhzLgorLndoZWVsY2hhaTRyczIKKy53aDhpOGM4aDllOHY4ZThyLgorLndoaTQKKy53aDRpMmNoCisud2hpY2hlMgorLndoaWNoZXYxZXIKKy53aDhpOHQ4ZTlzOGk4ZDhlOGQuCisud2gyaXRlCisud2hpdDRlcworLndoaXRlMXNpCisud2hpdGUyczJpZAorLndoaXRlc2kyZDFlZAorLndoOGk4dDhlOXM4cDhhOGM4ZS4KKy53aGl0ZTFzcAorLndoaXRlMnMxcGEKKy53aGl0ZXNwYTRjZQorLndoOGk4dDhlOXM4cDhhOGM4ZThzLgorLndpOGQ4ZTlzOHA4cjhlOGE4ZC4KKy53MmlkCisud2lkZTRzMgorLndpZGUxc3AKKy53aWRlczRwcmUKKy53aWRlc3ByMgorLndpZGVzcHJlYTJkMQorLndpOG44ZzlzOHA4YThuLgorLndpbjRnCisud2luZ3MyCisud2luZzJzMXBhCisud2luZ3NwYTRuCisud2k4bjhnOXM4cDhhOG44cy4KKy53aW5nc3BhMm4xczIKKy53aThuOGc5czhwOHI4ZThhOGQuCisud2luZ3NwcjIKKy53aW5nc3ByZWEyZDEKKy53aTh0OGM4aDljOHI4YThmOHQuCisud2k0dGMKKy53aXQ0Y2gKKy53aXRjaGNyYTJmNHQKKy53aXRjaGNyYTJmCisud284cjhkOXM4cDhhOGM5aThuOGcuCisuMXdvMgorLndvcjJkMXMyCisud29yZHM0cAorLndvcmQyczFwYQorLndvcmRzcDRhMmNpCisud29yZHNwYTJjMWluCisud29yZHNwYWMxaW5nCisud284cjhrOWE4cjhvOHU4bjhkLgorLndvcmsyYTJyCisud29ya2Fyb3UyCisud29ya2Fyb3VuMmQKKy53bzhyOGs5YThyOG84dThuOGQ4cy4KKy53b3JrYXJvdW4yZDFzMgorLndvOHI4azloOG84cjhzOGUuCisud29ya2g0Cisud29ya2hvcjRzZQorLndvcmtobzRyczIKKy53bzhyOGs5aDhvOHI4czhlOHMuCisud29ya2hvcnMzZTRzCisud3I4YThwOWE4cjhvOHU4bjhkLgorLndyYTQKKy53cmFwMmEycjQKKy53cmExcGEKKy53cmFwYXJvdTIKKy53cmFwYXJvdW4yZAorLndyOGU4dDhjOGg5ZThkLgorLndyZTR0YworLndyZXQ0Y2gKKy53cmV0Y2hlMgorLndyZXQ0Y2g0ZWQKKy53cjhlOHQ4YzhoOWU4ZDlsOHkuCisud3JldGNoZTJkMWx5CisueWU4czl0OGU4cjl5OGU4YThyLgorLnllczQKKy55ZXN0ZXJ5ZTJhMnIKKy5hbDlnOGU5YjhyOGE4aTlzOGM4aDhlLgorLmFsZ2VicmEyaXMxYworLmFsZ2VicmFpczNjaDIKKy5hbGdlYnJhaXNjaGUyCisuYWw5bDhlOWc4aDhlOW44eS4KKy5hbDFsCisuYWwybGUKKy5hbDNsZWcKKy5hbGxlZ2hlMm4KKy5hcjlrOGE4bjlzOGE4cy4KKy5hcmthM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MuCisua2EybgorLmthbjJzYTIKKy5rYTJuMXMyCisua2E4cjhsOHM5cjh1OGg4ZS4KKy5rMmEycgorLmthcjFsCisua2FyMmwxczIKKy5rYXJsczFyCisua284cjl0OGU5dzhlOGcuCisua281cgorLmtyOGk4czhoOG44YS4KKy5rcjJpcworLmtyM2lzMmgKKy5rcmlzMmgxbgorLmtyaXNoMW5hCisua3I4aThzOGg5bjhhOWk4czhtLgorLmtyaXNobmFpMgorLmtyaXNobmFpMnMxbQorLmtyOGk4czhoOW44YThuLgorLmtyaXNobjJhMm4KKy5sYThuOWM4YThzOXQ4ZThyLgorLmxhbjFjYQorLmxhbmNhc3Q1ZXIKKy5sZTlnOGU4bjhkOHI4ZS4KKy5sZTFnZW4KKy5sZWdlbjFkcgorLmxlZ2VuZHJlNAorLmxlOGk4YzhlOHM5dDhlOHIuCisubGVpMgorLmxlNWljCisubGVpY2VzNXQKKy5saThwOXM4YzhoOGk4dDh6LgorLmwyaXAKKy5saTJwMXMyCisubGlwczJjaDIKKy5saXBzM2NoaXQKKy5saXBzY2hpNHR6CisubGk4cDlzOGM4aDhpOHQ4ejlpOGE4bi4KKy5saXBzY2hpdDJ6MWkKKy5saXBzY2hpdHoyaTFhCisubGlwc2NoaXR6aTJhMm4KKy5sbzhqOWI4YThuLgorLmxvNWoKKy5sb2piYTJuCisubG84dTlpOXM4aTlhOG44YS4KKy5sb3UyCisubG8ydWkyCisubG91aXMyaTFhCisubG91aXNpMmEybgorLmxvdWlzaWExbmEKKy5tYThjOW84cy4KKy5tYTFjbworLm1hOG45YzhoOGU4czl0OGU4ci4KKy5tYW4yY2gKKy5tYW5jaGUyCisubWFuY2gxZXMKKy5tYThyOWs4bzh2OWk4YThuLgorLm1hcmtvNXZpMmEybgorLm1hcmtvdjJpMWEKKy5tYThyOGs4dDlvOGI4ZThyOWQ4bzhyOGYuCisubWFyazV0CisubWFyazF0bworLm1hcmt0bzNiCisubWFya3RvYmVyMWRvCisubWFya3RvYmVyZDRvcgorL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ThpOHQ4aC4KKy52NGk1aTQKKy52aTRpNWk0CisudmlpMml0aAorLnZpOGk4dDhoLgorLnZpMml0aAorLndhOGg4cjlzOGM4aDhlOGk4bjlsOGk4YzhoOWs4ZThpOHQ4czl0OGg4ZThvOXI4aThlLgorLndhNGhyNAorLndhaDRyczIKKy53YWhyczRjCisud2FocnMyY2gyCisud2FocnNjaGUyCisud2FocnNjaGVpMgorLndhaHJzY2hlNGk0bjFsCisud2FocnMyY2hlaW5sNGkyY2gKKy53YWhyc2NoZWlubGljNGhrCisud2FocnNjaGVpbmxpY2hrZWkyCisud2FocnNjaGVpbmxpY2hrZWk0dDFzMgorLndhaHJzY2hlaW5saWNoa2VpdHMzdGgyZQorLndhaHJzY2hlaW5saWNoa2VpdHN0aGUxbzVyCisud2FocnNjaGVpbmxpY2hrZWl0c3RoZW9yMmllNAorLndlOHI5bjhlOHIuCisudzFlcgorLndlcjRuMWVyCisud2U4cjl0OGg4ZThyOWk4YThuLgorLndlcnRoMmUKKy53ZXJ0aGVyMWkKKy53ZXJ0aGUxcjJpM2E0Cisud2VydGhlcmkyYTJuCisud2k4bjljOGg4ZThzOXQ4ZThyLgorLndpbjJjaAorLndpbmNoZTIKKy53aW5jaDFlcworLndpOHI4dDlzOGM4aDhhOGY4dC4KKy53NGlyNAorLndpcjR0MXMyCisud2lydDRzYworLndpcnRzMmNoMgorLndpcnRzY2hhMmYKKy53aXJ0c2NoYTJmdAorLndpOHM5czhlOG45czhjOGg4YThmOHQ5bDhpOGM4aC4KKy53NGkyczFzCisud2lzc2VuNAorLndpc3NlMm4xczIKKy53aXNzZW5zNGMKKy53aXNzZW5zMmNoMgorLndpc3NlbnNjaGEyZgorLndpc3NlbnNjaGEyZnQKKy53aXNzZW5zY2hhZjJ0bAorLndpc3NlbnMyY2hhZnRsNGkyY2gKKy54djhpOGk4aTh0OGguCisueHY0aTVpNAorLnh2aTRpNWk0CisueHZpaTJpdGgKKy54djhpOGk4dDhoLgorLnh2aTJpdGgKKy54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G9ja3NjcmVlbl9nbG9naW5fdXNlcm5hbWVfaGludCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmlucHV0VHlwZT0idGV4dEVtYWlsQWRkcmVzcyIKKyAgICAgICAgICAgICAgICAvPgorICAgICAgICAKKyAgICAgICAgICAgIDxFZGl0VGV4dAorICAgICAgICAgICAgICAgIGFuZHJvaWQ6aWQ9IkAraWQvcGFzc3dvcmQiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2lkdGg9Im1hdGNoX3BhcmVudCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9iZWxvdz0iQGlkL2xvZ2luIgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X21hcmdpblRvcD0iMTVkaXAiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfbWFyZ2luTGVmdD0iN2RpcCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9tYXJnaW5SaWdodD0iN2RpcCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmlucHV0VHlwZT0idGV4dFBhc3N3b3JkIgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6aGludD0iQGFuZHJvaWQ6c3RyaW5nL2xvY2tzY3JlZW5fZ2xvZ2luX3Bhc3N3b3JkX2hpbnQiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpuZXh0Rm9jdXNSaWdodD0iQCtpZC9vayIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOm5leHRGb2N1c0Rvd249IkAraWQvb2siCisgICAgICAgICAgICAgICAgLz4KKyAgICAgICAgCisgICAgICAgICAgICA8IS0tIG9rIGJlbG93IHBhc3N3b3JkLCBhbGlnbmVkIHRvIHJpZ2h0IG9mIHNjcmVlbiAtLT4KKyAgICAgICAgICAgIDxCdXR0b24KKyAgICAgICAgICAgICAgICBhbm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gICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgICAgICAgYW5kcm9pZDpncmF2aXR5PSJjZW50ZXIiCisgICAgICAgICAgICAgICAgICBhbmRyb2lkOnRleHRTaXplPSIzNHNwIi8+CisKKyAgICAgICAgPFRleHRWaWV3IGFuZHJvaWQ6aWQ9IkAraWQvZGF0ZSIKKyAgICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dpZHRoPSJtYXRjaF9wYXJlbnQiCisgICAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgICAgICAgIGFuZHJvaWQ6Z3Jhdml0eT0iY2VudGVyIgorICAgICAgICAgICAgICAgICAgYW5kcm9pZDp0ZXh0U2l6ZT0iMThzcCIvPgorCisgICAgICAgIDwhLS0gc3BhY2VyIGFmdGVyIHRpbWUgYW5kIGRhdGUgLS0+CisgICAgICAgIDxWaWV3CisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0ibWF0Y2hfcGFyZW50IgorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfaGVpZ2h0PSIxZGlwIgorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfbWFyZ2luQm90dG9tPSI4ZGlwIgorICAgICAgICAgICAgYW5kcm9pZDpiYWNrZ3JvdW5kPSJAYW5kcm9pZDpkcmF3YWJsZS9kaXZpZGVyX2hvcml6b250YWxfZGFyayIKKyAgICAgICAgICAgICAgICAvPgorCisgICAgICAgIDwhLS0gYmF0dGVyeSBpbmZvIC0tPgorICAgICAgICA8TGluZWFyTGF5b3V0IGFuZHJvaWQ6aWQ9IkAraWQvYmF0dGVyeUluZm8iCisgICAgICAgICAgICAgICAgYW5kcm9pZDpvcmllbnRhdGlvbj0iaG9yaXpvbnRhbCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0ibWF0Y2hfcGFyZW50IgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6Z3Jhdml0eT0iY2VudGVyIgorICAgICAgICAgICAgICA+CisKKyAgICAgICAgICAgIDxJbWFnZVZpZXcgYW5kcm9pZDppZD0iQCtpZC9iYXR0ZXJ5SW5mb0ljb24iCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2lkdGg9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9tYXJnaW5SaWdodD0iNmRpcCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmJhc2VsaW5lQWxpZ25lZD0idHJ1ZSIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmdyYXZpdHk9ImNlbnRlciIKKyAgICAgICAgICAgIC8+CisKKyAgICAgICAgICAgIDxUZXh0VmlldyBhbmRyb2lkOmlkPSJAK2lkL2JhdHRlcnlJbmZvVGV4dCIKKyAgICAgICAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgICAgICAgICAgIGFuZHJvaWQ6dGV4dFNpemU9IjE4c3AiCisgICAgICAgICAgICAgICAgICAgICAgYW5kcm9pZDpncmF2aXR5PSJjZW50ZXIiCisgICAgICAgICAgICAvPgorCisgICAgICAgIDwvTGluZWFyTGF5b3V0PgorCisgICAgICAgIDwhLS0gc3BhY2VyIGFmdGVyIGJhdHRlcnkgaW5mbyAtLT4KKyAgICAgICAgPFZpZXcgYW5kcm9pZDppZD0iQCtpZC9iYXR0ZXJ5SW5mb1NwYWNlciIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dpZHRoPSJtYXRjaF9wYXJlbnQiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9IjFkaXAiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9tYXJnaW5Ub3A9IjhkaXAiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9tYXJnaW5Cb3R0b209IjhkaXAiCisgICAgICAgICAgICBhbmRyb2lkOmJhY2tncm91bmQ9IkBhbmRyb2lkOmRyYXdhYmxlL2RpdmlkZXJfaG9yaXpvbnRhbF9kYXJrIgorICAgICAgICAgICAgICAgIC8+CisKKyAgICAgICAgPCEtLSBuZXh0IGFsYXJtIGluZm8gLS0+CisKKyAgICAgICAgPExpbmVhckxheW91dCBhbmRyb2lkOmlkPSJAK2lkL25leHRBbGFybUluZm8iCisgICAgICAgICAgICAgICAgYW5kcm9pZDpvcmllbnRhdGlvbj0iaG9yaXpvbnRhbCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0ibWF0Y2hfcGFyZW50IgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6Z3Jhdml0eT0iY2VudGVyIgorICAgICAgICAgICAgICA+CisKKyAgICAgICAgICAgIDxJbWFnZVZpZXcKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X21hcmdpblJpZ2h0PSI2ZGlwIgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6YmFzZWxpbmVBbGlnbmVkPSJ0cnVlIgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6c3JjPSJAYW5kcm9p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0lNIGNhcmQgaXMgcHJlc2VudCkgLS0+CisgICAgICAgIDxMaW5lYXJMYXlvdXQgYW5kcm9pZDppZD0iQCtpZC9zY3JlZW5Mb2NrZWRJbmZvIgorICAgICAgICAgICAgYW5kcm9pZDpvcmllbnRhdGlvbj0iaG9yaXpvbnRhbCIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dpZHRoPSJtYXRjaF9wYXJlbnQiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgIGFuZHJvaWQ6Z3Jhdml0eT0iY2VudGVyIgorICAgICAgICAgICAgPgorCisgICAgICAgICAgICA8SW1hZ2VWaWV3CisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2lkdGg9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9tYXJnaW5SaWdodD0iNmRpcCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmJhc2VsaW5lQWxpZ25lZD0idHJ1ZSIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOnNyYz0iQGFuZHJvaWQ6ZHJhd2FibGUvaWNfbG9ja19pZGxlX2xvY2siCisgICAgICAgICAgICAgICAgYW5kcm9pZDpncmF2aXR5PSJjZW50ZXIiCisgICAgICAgICAgICAvPgorCisgICAgICAgICAgICA8VGV4dFZpZXcKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6dGV4dFNpemU9IjE4c3AiCisgICAgICAgICAgICAgICAgYW5kcm9pZDp0ZXh0PSJAYW5kcm9pZDpzdHJpbmcvbG9ja3NjcmVlbl9zY3JlZW5fbG9ja2VkIgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6Z3Jhdml0eT0iY2VudGVyIgorICAgICAgICAgICAgICAgICAgICAvPgorICAgICAgICA8L0xpbmVhckxheW91dD4KKworICAgICAgICA8IS0tIG1lc3NhZ2UgYWJvdXQgaG93IHRvIHVubG9jaworICAgICAgICAgICAgIChzaG93biB3aGVuIFNJTSBjYXJkIGlzIHByZXNlbnQpIC0tPgorICAgICAgICA8VGV4dFZpZXcgYW5kcm9pZDppZD0iQCtpZC9sb2NrSW5zdHJ1Y3Rpb25zIgorICAgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2lkdGg9Im1hdGNoX3BhcmVudCIKKyAgICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfbWFyZ2luQm90dG9tPSI1ZGlwIgorICAgICAgICAgICAgICAgICAgYW5kcm9pZDpncmF2aXR5PSJjZW50ZXIiCisgICAgICAgICAgICAgICAgICBhbmRyb2lkOnRleHRTaXplPSIxNHNwIi8+CisKKworICAgICAgICA8IS0tIGVtZXJnZW5jeSBjYWxsIGJ1dHRvbiBzaG93biB3aGVuIHNpbSBpcyBtaXNzaW5nIG9yIFBVS2QgLS0+CisgICAgICAgIDxCdXR0b24KKyAgICAgICAgICAgIGFuZHJvaWQ6aWQ9IkAraWQvZW1lcmdlbmN5Q2FsbEJ1dHRvbiIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dpZHRoPSJ3cmFwX2NvbnRlbnQiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X21hcmdpbkJvdHRvbT0iNWRpcCIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X21hcmdpblRvcD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udCIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dlaWdodD0iMSIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dpZHRoPSIwZGlwIgorICAgICAgICAgICAgYW5kcm9pZDpvcmllbnRhdGlvbj0idmVydGljYWwiCisgICAgICAgICAgICBhbmRyb2lkOmdyYXZpdHk9ImNlbnRlcl92ZXJ0aWNhbCIKKyAgICAgICAgICAgICAgICA+CisgICAgICAgIDxpbmNsdWRlIGxheW91dD0iQGxheW91dC9rZXlndWFyZF9zY3JlZW5fc3RhdHVzX2xhbmQiIC8+CisgICAgPC9MaW5lYXJMYXlvdXQ+CisgICAgCisgICAgPCEtLSByaWdodCBzaWRlOiBwYXNzd29yZCAtLT4KKyAgICA8TGluZWFyTGF5b3V0CisgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dpZHRoPSIwZGlwIgorICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9Im1hdGNoX3BhcmVudCIKKyAgICAgICAgYW5kcm9pZDpvcmllbnRhdGlvbj0idmVydGljYWwiCisgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dlaWdodD0iMSIKKyAgICAgICAgYW5kcm9pZDpncmF2aXR5PSJjZW50ZXIiPgorCisgICAgICAgIDwhLS0gUGFzc3dvcmQgZW50cnkgZmllbGQgLS0+CisgICAgICAgIDxFZGl0VGV4dCBhbmRyb2lkOmlkPSJAK2lkL3Bhc3N3b3JkRW50cnkiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dpZHRoPSIzMzBkaXAiCisgICAgICAgICAgICBhbmRyb2lkOnNpbmdsZUxpbmU9InRydWUiCisgICAgICAgICAgICBhbmRyb2lkOnRleHRTdHlsZT0ibm9ybWFsIgorICAgICAgICAgICAgYW5kcm9pZDppbnB1dFR5cGU9InRleHRQYXNzd29yZCIKKyAg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pZDpsYXlvdXRfd2VpZ2h0PSIxIgorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfaGVpZ2h0PSJtYXRjaF9wYXJlbnQiCisgICAgICAgICAgICBhbmRyb2lkOm1heExpbmVzPSIxIgorICAgICAgICAgICAgYW5kcm9pZDpiYWNrZ3JvdW5kPSJAbnVsbCIKKyAgICAgICAgICAgIGFuZHJvaWQ6dGV4dFNpemU9IjMyc3AiCisgICAgICAgICAgICBhbmRyb2lkOmlucHV0VHlwZT0idGV4dFBhc3N3b3JkIgorICAgICAgICAgICAgLz4KKworICAgICAgICA8SW1hZ2VCdXR0b24gYW5kcm9pZDppZD0iQCtpZC9iYWNrc3BhY2UiCisgICAgICAgICAgICAgYW5kcm9pZDpzcmM9IkBhbmRyb2lkOmRyYXdhYmxlL2ljX2lucHV0X2RlbGV0ZSIKKyAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0ibWF0Y2hfcGFyZW50IgorICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X21hcmdpblRvcD0iMmRpcCIKKyAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9tYXJnaW5SaWdodD0iMmRpcCIKKyAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9tYXJnaW5Cb3R0b209IjJkaXAiCisgICAgICAgICAgICAgYW5kcm9pZDpncmF2aXR5PSJjZW50ZXIiCisgICAgICAgICAgICAvPgorCisgICAgPC9MaW5lYXJMYXlvdXQ+CisgICAgICAgIAorICAgIDxMaW5lYXJMYXlvdXQKKyAgICAgICAgYW5kcm9pZDpvcmllbnRhdGlvbj0iaG9yaXpvbnRhbCIKKyAgICAgICAgYW5kcm9pZDpsYXlvdXRfYWxpZ25QYXJlbnRCb3R0b209InRydWUiCisgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dpZHRoPSJtYXRjaF9wYXJlbnQiCisg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3Jhdml0eT0iY2VudGVyIgorICAgICAgICAgICAgYW5kcm9pZDpzaW5nbGVMaW5lPSJ0cnVlIgorICAgICAgICAgICAgYW5kcm9pZDplbGxpcHNpemU9Im1hcnF1ZWUiCisgICAgICAgICAgICBhbmRyb2lkOnRleHRBcHBlYXJhbmNlPSI/YW5kcm9pZDphdHRyL3RleHRBcHBlYXJhbmNlTWVkaXVtIi8+CisKKyAgICAgICAgPCEtLSBwYXNzd29yZCBlbnRyeSAtLT4KKyAgICAgICAgPExpbmVhckxheW91dAorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2lkdGg9Im1hdGNoX3BhcmVudCIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgYW5kcm9pZDpvcmllbnRhdGlvbj0iaG9yaXpvbnRhbCIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X21hcmdpblJpZ2h0PSI2ZGlwIgorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfbWFyZ2luTGVmdD0iNmRpcCIKKyAgICAgICAgICAgIGFuZHJvaWQ6Z3Jhdml0eT0iY2VudGVyX3ZlcnRpY2FsIgorICAgICAgICAgICAgYW5kcm9pZDpiYWNrZ3JvdW5kPSJAYW5kcm9pZDpkcmF3YWJsZS9lZGl0X3RleHQiPgorCisgICAgICAgICAgICA8IS0tIGRpc3BsYXlzIGRvdHMgYXMgdXNlciBlbnRlcnMgcGluIC0tPgorICAgICAgICAgICAgPFRleHRWaWV3IGFuZHJvaWQ6aWQ9IkAraWQvcGluRGlzcGxheSIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0iMGRpcCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93ZWlnaHQ9IjEiCisgICAgICAgICAgICAgICAgYW5kcm9pZDptYXhMaW5lcz0iMSIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOnRleHRBcHBlYXJhbmNlPSI/YW5kcm9pZDphdHRyL3RleHRBcHBlYXJhbmNlTGFyZ2VJbnZlcnNlIgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6dGV4dFN0eWxlPSJib2xkIgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6aW5wdXRUeXBlPSJ0ZXh0UGFzc3dvcmQiCisgICAgICAgICAgICAvPgorCisgICAgICAgICAgICA8SW1hZ2VCdXR0b24gYW5kcm9pZDppZD0iQCtpZC9iYWNrc3BhY2UiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpzcmM9IkBhbmRyb2lkOmRyYXdhYmxlL2ljX2lucHV0X2RlbGV0ZSIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X21hcmdpblJpZ2h0PSItM2RpcCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9tYXJnaW5Cb3R0b209Ii0zZGlwIgorICAgICAgICAgICAgLz4KKyAgICAgICAgPC9MaW5lYXJMYXlvdXQ+CisKKyAgICA8L0xpbmVhckxheW91dD4KKworICAgIDxpbmNsdWRlCisgICAgICAgIGFuZHJvaWQ6aWQ9IkAraWQva2V5UGFkIgorICAgICAgICBsYXlvdXQ9IkBhbmRyb2lkOmxheW91dC90d2VsdmVfa2V5X2VudHJ5IgorICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0iZmlsbF9wYXJlbnQiCisgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0id3JhcF9jb250ZW50IgorICAgICAgICBhbmRyb2lkOmxheW91dF9iZWxvdz0iQGlkL3RvcERpc3BsYXlHcm91cCIKKyA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KyAgICAgICAgPgorCisgICAgICAgIDxUZXh0VmlldyBhbmRyb2lkOmlkPSJAK2lkL3RpbWVEaXNwbGF5IgorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2lkdGg9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgYW5kcm9pZDpzaW5nbGVMaW5lPSJ0cnVlIgorICAgICAgICAgICAgYW5kcm9pZDplbGxpcHNpemU9Im5vbmUiCisgICAgICAgICAgICBhbmRyb2lkOnRleHRTaXplPSIxMjBzcCIKKyAgICAgICAgICAgIGFuZHJvaWQ6dGV4dEFwcGVhcmFuY2U9Ij9hbmRyb2lkOmF0dHIvdGV4dEFwcGVhcmFuY2VNZWRpdW0iCisgICAgICAgICAgICBhbmRyb2lkOnNoYWRvd0NvbG9yPSIjQzAwMDAwMDAiCisgICAgICAgICAgICBhbmRyb2lkOnNoYWRvd0R4PSIwIgorICAgICAgICAgICAgYW5kcm9pZDpzaGFkb3dEeT0iMCIKKyAgICAgICAgICAgIGFuZHJvaWQ6c2hhZG93UmFkaXVzPSIzLjAiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9tYXJnaW5Cb3R0b209IjZkaXAiCisgICAgICAgICAgICAvPgorCisKKyAgICAgICAgPFRleHRWaWV3IGFuZHJvaWQ6aWQ9IkAraWQvYW1fcG0iCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfaGVpZ2h0PSJ3cmFwX2NvbnRlbnQiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF90b1JpZ2h0T2Y9IkBpZC90aW1lRGlzcGxheSIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2FsaWduQmFzZWxpbmU9IkBpZC90aW1lRGlzcGxheSIKKyAgICAgICAgICAgIGFuZHJvaW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gICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9Im1hdGNoX3BhcmVudCIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dlaWdodD0iMSIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dpZHRoPSIwZGlwIgorICAgICAgICAgICAgYW5kcm9pZDpvcmllbnRhdGlvbj0iaG9yaXpvbnRhbCIKKyAgICAgICAgICAgIGFuZHJvaWQ6Z3Jhdml0eT0iY2VudGVyX2hvcml6b250YWwiCisgICAgICAgICAgICAgICAgPgorICAgICAgICA8VGV4dFZpZXcKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmlkPSJAK2lkL3NjcmVlbkxvY2tlZCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2JlbG93PSJAaWQvc3RhdHVzMiIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOnRleHRBcHBlYXJhbmNlPSI/YW5kcm9pZDphdHRyL3RleHRBcHBlYXJhbmNlTWVkaXVtIgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6Z3Jhdml0eT0iY2VudGVyIgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X21hcmdpblRvcD0iMTJkaXAiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpkcmF3YWJsZVBhZGRpbmc9IjRkaXAiCisgICAgICAgICAgICAgICAgLz4KKworICAgICAgICA8Y29tLmFuZHJvaWQuaW50ZXJuYWwud2lkZ2V0LlNsaWRpbmdUYWIKKyAgICAgICAgICAgIGFuZHJvaWQ6aWQ9IkAraWQvdGFiX3NlbGVjdG9yIgorICAgICAgICAgICAgYW5kcm9pZDpvcmllbnRhdGlvbj0idmVydGljYWwiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfaGVpZ2h0PSJtYXRjaF9wYXJlbnQiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9tYXJnaW5SaWdodD0iMGRpcCIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dlaWdodD0iMS4wIgorICAgICAgICAgICAgLz4KKyAgICAgICAgICAgIAorICAgICAgICA8IS0tICJlbWVyZ2VuY3kgY2FsbHMgb25seSIgc2hvd24gd2hlbiBzaW0gaXMgbWlzc2luZyBvciBQVUtkIC0tPgorICAgICAgICA8VGV4dFZpZXcKKyAgICAgICAgICAgIGFuZHJvaWQ6aWQ9IkAraWQvZW1lcmdlbmN5Q2FsbFRleHQiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfaGVpZ2h0PSJ3cmFwX2NvbnRlbnQiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9hbGlnblBhcmVudFRvcD0idHJ1ZSIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X21hcmdpblRvcD0iMjBkaXAiCisgICAgICAgICAgICBhbmRyb2lkOnRleHQ9IkBzdHJpbmcvZW1lcmdlbmN5X2NhbGxzX29ubHkiCisgICAgICAgICAgICBhbmRyb2lkOnRleHRBcHBlYXJhbmNlPSI/YW5kcm9pZDphdHRyL3RleHRBcHBlYXJhbmNlU21hbGwiCisgICAgICAgICAgICBhbmRyb2lkOnRleHRDb2xvcj0iQGNvbG9yL3doaXRlIgorICAgICAgICAgICAgICAgLz4KKworICAgICAgICA8IS0tIGVtZXJnZW5jeSBjYWxsIGJ1dHRvbiBzaG93biB3aGVuIHNpbSBpcyBQVUtkIGFuZCB0YWJfc2VsZWN0b3IgaXMKKyAgICAgICAgICAgICBoaWRkZW4gLS0+CisgICAgICAgI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kxlZnQ9IjE0MGRpcCIKKyAgICAgICAgICAgID4KKworICAgICAgICAgICAgPCEtLSBvcHRpb24gMTogYSBzaW5nbGUgZW1lcmdlbmN5IGNhbGwgYnV0dG9uIC0tPgorICAgICAgICAgICAgPFJlbGF0aXZlTGF5b3V0IGFuZHJvaWQ6aWQ9IkAraWQvZm9vdGVyTm9ybWFsIgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dpZHRoPSJtYXRjaF9wYXJlbnQiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfaGVpZ2h0PSJ3cmFwX2NvbnRlbnQiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpncmF2aXR5PSJsZWZ0IgorICAgICAgICAgICAgICAgID4KKyAgICAgICAgICAgICAgICA8QnV0dG9uIGFuZHJvaWQ6aWQ9IkAraWQvZW1lcmdlbmN5Q2FsbEFsb25lIgorICAgICAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgICAgICAgICAgYW5kcm9pZDp0ZXh0PSJAc3RyaW5nL2xvY2tzY3JlZW5fZW1lcmdlbmN5X2NhbGwiCisgICAgICAgICAgICAgICAgICAgIHN0eWxlPSJAc3R5bGUvV2lkZ2V0LkJ1dHRvbi5UcmFuc3BhcmVudCIKKyAgICAgICAgICAgICAgICAgICAgYW5kcm9pZDpkcmF3YWJsZUxlZnQ9IkBkcmF3YWJsZS9pY19lbWVyZ2VuY3kiCisgICAgICAgICAgICAgICAgICAgIGFuZHJvaWQ6ZHJhd2FibGVQYWRkaW5nPSI4ZGlwIgorICAgICAgICAgICAgICAgICAgICBhbmRyb2lkOnZpc2liaWxpdHk9ImdvbmUiCisgICAgICAgICAgICAgICAgICAgIC8+CisgICAgICAgICAgICA8L1JlbGF0aXZlTGF5b3V0Pgor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cm9pZDpncmF2aXR5PSJjZW50ZXJfdmVydGljYWwiCisgICAgICAgICAgICAgICAgPgorICAgICAgICAKKyAgICAgICAgPGluY2x1ZGUgbGF5b3V0PSJAbGF5b3V0L2tleWd1YXJkX3NjcmVlbl9zdGF0dXNfcG9ydCIgLz4KKworICAgICAgICA8IS0tIGZvb3RlciAtLT4KKyAgICAgICAgPEZyYW1lTGF5b3V0CisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0ibWF0Y2hfcGFyZW50IgorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfaGVpZ2h0PSJ3cmFwX2NvbnRlbnQiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9tYXJnaW5MZWZ0PSIxNDBkaXAiCisgICAgICAgICAgICA+CisKKyAgICAgICAgICAgIDwhLS0gb3B0aW9uIDE6IGEgc2luZ2xlIGVtZXJnZW5jeSBjYWxsIGJ1dHRvbiAtLT4KKyAgICAgICAgICAgIDxSZWxhdGl2ZUxheW91dCBhbmRyb2lkOmlkPSJAK2lkL2Zvb3Rlck5vcm1hbCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0ibWF0Y2hfcGFyZW50IgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6Z3Jhdml0eT0ibGVmdCIKKyAgICAgICAgICAgICAgICA+CisgICAgICAgICAgICAgICAgPEJ1dHRvbiBhbmRyb2lkOmlkPSJAK2lkL2VtZXJnZW5jeUNhbGxBbG9uZSIKKyAgICAgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2lkdGg9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfaGVpZ2h0PSJ3cmFwX2NvbnRlbnQiCisgICAgICAgICAgICAgICAgICAgIGFuZHJvaWQ6dGV4dD0iQHN0cmluZy9sb2Nrc2NyZWVuX2VtZXJnZW5jeV9jYWxsIgorICAgICAgICAgICAgICAgICAgICBzdHlsZT0iQHN0eWxlL1dpZGdldC5CdXR0b24uVHJhbnNwYXJlbnQiCisgICAgICAgICAgICAgICAgICAgIGFuZHJvaWQ6ZHJhd2FibGVMZWZ0PSJAZHJhd2FibGUvaWNfZW1lcmdlbmN5IgorICAgICAgICAgICAgICAgICAgICBhbmRyb2lkOmRyYXdhYmxlUGFkZGluZz0iOGRpcCIKKyAgICAgICAgICAgICAgICAgICAgYW5kcm9pZDp2aXNpYmlsaXR5PSJnb25lIgorICAgICAgICAgICAgICAgICAgICAvPgorICAgICAgICAgICAgPC9SZWxhdGl2ZUxheW91dD4KKworICAgICAgICAgICAgPCEtLSBvcHRpb24gMjogYW4gZW1lcmdlbmN5IGNhbGwgYnV0dG9uLCBhbmQgYSAnZm9yZ290IHBhdHRlcm4/JyBidXR0b24gLS0+CisgICAgICAgICAgICA8TGluZWFyTGF5b3V0IGFuZHJvaWQ6aWQ9IkAraWQvZm9vdGVyRm9yZ290UGF0dGVybiIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOm9yaWVudGF0aW9uPSJ2ZXJ0aWNhbCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0ibWF0Y2hfcGFyZW50IgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6Z3Jhdml0eT0ibGVmdCIKKyAgICAgICAgICAgICAgICA+CisgICAgICAgICAgICAgICAgPEJ1dHRvbiBhbmRyb2lkOmlkPSJAK2lkL2ZvcmdvdFBhdHRlcm4iCisgICAgICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dpZHRoPSJtYXRjaF9wYXJlbnQiCisgICAgICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0id3JhcF9jb250ZW50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Y2tfbGFuZHNjYXBlLnhtbAorKysgYi9jb3JlL3Jlcy9yZXMvbGF5b3V0L2tleWd1YXJkX3NjcmVlbl91bmxvY2tfbGFuZHNjYXBlLnhtbApAQCAtNTgsMTggKzU4LDE5IEBACiAgICAgICAgICAgICBhbmRyb2lkOmVsbGlwc2l6ZT0ibWFycXVlZSIKICAgICAgICAgICAgIGFuZHJvaWQ6Z3Jhdml0eT0icmlnaHR8Ym90dG9tIgogICAgICAgICAgICAgLz4KKwogICAgICAgICA8Y29tLmFuZHJvaWQuaW50ZXJuYWwud2lkZ2V0LkRpZ2l0YWxDbG9jayBhbmRyb2lkOmlkPSJAK2lkL3RpbWUiCiAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0id3JhcF9jb250ZW50IgogICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfaGVpZ2h0PSJ3cmFwX2NvbnRlbnQiCiAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9hbGlnblBhcmVudFRvcD0idHJ1ZSIKICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2FsaWduUGFyZW50TGVmdD0idHJ1ZSIKICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X21hcmdpblRvcD0iOGRpcCIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X21hcmdpbkJvdHRvbT0iOGRpcCIKICAgICAgICAgICAgID4KIAogICAgICAgICAgICAgPFRleHRWaWV3IGFuZHJvaWQ6aWQ9IkAraWQvdGltZURpc3BsYXkiCiAgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2lkdGg9IndyYXBfY29udGVudCIKICAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9IndyYXBfY29udGVudCIKLSAgICAgICAgICAgICAgICBhbmRyb2lkOmdyYXZpdHk9ImJvdHRvbSIKICAgICAgICAgICAgICAgICBhbmRyb2lkOnNpbmdsZUxpbmU9InRydWUiCiAgICAgICAgICAgICA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3Byb2dyZXNzQmFyU3R5bGVMYXJnZSIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0id3JhcF9jb250ZW50IiAvPgorICAgICAgICA8VGV4dFZpZXcgYW5kcm9pZDpsYXlvdXRfd2lkdGg9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOnRleHRBcHBlYXJhbmNlPSI/YW5kcm9pZDphdHRyL3RleHRBcHBlYXJhbmNlU21hbGwiCisgICAgICAgICAgICAgICAgYW5kcm9pZDp0ZXh0PSJAc3RyaW5nL2xvYWRpbmciCisgICAgICAgICAgICAgICAgYW5kcm9pZDpwYWRkaW5nVG9wPSI0ZGlwIgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6c2luZ2xlTGluZT0idHJ1ZSIgLz4KKyAgICAgICAgICAgIAorICAgIDwvTGluZWFyTGF5b3V0PgorICAgICAgICAKKyAgICA8RnJhbWVMYXlvdXQgYW5kcm9pZDppZD0iQCtpZC9saXN0Q29udGFpbmVyIgorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2lkdGg9Im1hdGNoX3BhcmVudCIgCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9Im1hdGNoX3BhcmVudCI+CisgICAgICAgICAgICAKKyAgICAgICAgPExpc3RWaWV3IGFuZHJvaWQ6aWQ9IkBhbmRyb2lkOmlkL2xpc3QiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2lkdGg9Im1hdGNoX3BhcmVudCIgCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfaGVpZ2h0PSJtYXRjaF9wYXJlbnQiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpkcmF3U2V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IkBkcmF3YWJsZS9pY19idG5fYmFjayIKKyAgICAgICAgICAgIGFuZHJvaWQ6ZHJhd2FibGVQYWRkaW5nPSIzZGlwIgorICAgICAgICAgICAgYW5kcm9pZDp0ZXh0PSJAc3RyaW5nL2JhY2tfYnV0dG9uX2xhYmVsIgorICAgICAgICAvPgorICAgICAgICA8TGluZWFyTGF5b3V0CisgICAgICAgICAgICBhbmRyb2lkOm9yaWVudGF0aW9uPSJob3Jpem9udGFsIgorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2lkdGg9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfYWxpZ25QYXJlbnRSaWdodD0idHJ1ZSI+CisKKyAgICAgICAgICAgIDxCdXR0b24gYW5kcm9pZDppZD0iQCtpZC9za2lwX2J1dHRvbiIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0iMTUwZGlwIgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X21hcmdpbj0iNWRpcCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOnRleHQ9IkBzdHJpbmcvc2tpcF9idXR0b25fbGFiZWwiCisgICAgICAgICAgICAgICAgYW5kcm9pZDp2aXNpYmlsaXR5PSJnb25lIgorICAgICAgICAgICAgLz4KKworICAgICAgICAgICAgPEJ1dHRvbiBhbmRyb2lkOmlkPSJAK2lkL25leHRfYnV0dG9uIgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dpZHRoPSIxNTBkaXAiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfaGVpZ2h0PSJ3cmFwX2NvbnRlbnQiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvd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YWx1ZUZyb20gYW5kIHZhbHVlVG8gYXJlIGEgY3VzdG9tIHR5cGUuIC0tPgorICAgICAgICAgICAgPGVudW0gbmFtZT0iY3VzdG9tVHlwZSIgdmFsdWU9IjQiIC8+CisgICAgICAgIDwvYXR0cj4KKyAgICA8L2RlY2xhcmUtc3R5bGVhYmxlPgorCisgICAgPCEtLSA9PT09PT09PT09PT09PT09PT09PT09PT09PSAtLT4KKyAgICA8IS0tIFByb3BlcnR5QW5pbWF0b3IgY2xhc3MgYXR0cmlidXRlcyAtLT4KKyAgICA8IS0tID09PT09PT09PT09PT09PT09PT09PT09PT09IC0tPgorICAgIDxlYXQtY29tbWVudCAvPgorCisgICAgPGRlY2xhcmUtc3R5bGVhYmxlIG5hbWU9IlByb3BlcnR5QW5pbWF0b3IiPgorICAgICAgICA8IS0tIE5hbWUgb2YgdGhlIHByb3BlcnR5IGJlaW5nIGFuaW1hdGVkLiAtLT4KKyAgICAgICAgPGF0dHIgbmFtZT0icHJvcGVydHlOYW1lIiBmb3JtYXQ9InN0cmluZyIvPgorICAgIDwvZGVjbGFyZS1zdHlsZWFibGU+CisKKworICAgIDwhLS0gPT09PT09PT09PT09PT09PT09PT09PT09PT0gLS0+CisgICAgPCEtLSBTZXF1ZW5jZXIgY2xhc3MgYXR0cmlidXRlcyAtLT4KKyAgICA8IS0tID09PT09PT09PT09PT09PT09PT09PT09PT09IC0tPgorICAgIDxlYXQtY29tbWVudCAvPgorCisgICAgPGRlY2xhcmUtc3R5bGVhYmxlIG5hbWU9IlNlcXVlbmNlciI+CisgICAgICAgIDwhLS0gTmFtZSBvZiB0aGUgcHJvcGVydHkgYmVpbmcgYW5pbWF0ZWQuIC0tPgorICAgICAgICA8YXR0ciBuYW1lPSJvcmRlcmluZyI+CisgICAgICAgICAgICA8IS0tIGNoaWxkIGFuaW1hdGlvbnMgc2hvdWxkIGJlIHBsYXllZCB0b2dldGhlci4gLS0+CisgICAgICAgICAgICA8ZW51bSBuYW1lPSJ0b2dldG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cgKzEyMTEsNyBAQAogICA8cHVibGljIHR5cGU9ImF0dHIiIG5hbWU9InF1aWNrQ29udGFjdEJhZGdlU3R5bGVTbWFsbFdpbmRvd1NtYWxsIiBpZD0iMHgwMTAxMDJiMSIgLz4KICAgPHB1YmxpYyB0eXBlPSJhdHRyIiBuYW1lPSJxdWlja0NvbnRhY3RCYWRnZVN0eWxlU21hbGxXaW5kb3dNZWRpdW0iIGlkPSIweDAxMDEwMmIyIiAvPgogICA8cHVibGljIHR5cGU9ImF0dHIiIG5hbWU9InF1aWNrQ29udGFjdEJhZGdlU3R5bGVTbWFsbFdpbmRvd0xhcmdlIiBpZD0iMHgwMTAxMDJiMyIgLz4KLSAgCisKIDwhLS0gPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09CiAgICAgIFJlc291cmNlcyBhZGRlZCBpbiB2ZXJzaW9uIDcgb2YgdGhlIHBsYXRmb3JtIChFY2xhaXIgTVIxKS4KICAgICAgPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09IC0tPgpAQCAtMTIyMCw3ICsxMjIwLDcgQEAKICAgPHB1YmxpYyB0eXBlPSJhdHRyIiBuYW1lPSJhdXRob3IiIGlkPSIweDAxMDEwMmI0IiAvPgogICA8cHVibGljIHR5cGU9ImF0dHIiIG5hbWU9ImF1dG9TdGFydCIgaWQ9IjB4MDEwMTAyYjUiIC8+CiAKLSAgICAKKwogPCEtLSA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KICAgICAgUmVzb3VyY2VzIGFkZGVkIGluIHZlcnNpb24gOCBvZiB0aGUgcGxhdGZvcm0gKEVjbGFpciBNUjIpLgogICAgICA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0gLS0+CkBAIC0xMjQxLDI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XZhdGUgQmx1ZXRvb3RoQTJkcCBtQTJkcDsKLQotICAgIHByaXZhdGUgQmx1ZXRvb3RoSGVhZHNldCBtSGVhZHNldDsKLQogICAgIHByaXZhdGUgU3RyaW5nIG1PdXRwdXRGaWxlOwogICAgIHByaXZhdGUgU3RyaW5nIG1UYWc7Ci0gICAgcHJpdmF0ZSBjbGFzcyBIZWFkc2V0U2VydmljZUxpc3RlbmVyIGltcGxlbWVudHMgU2VydmljZUxpc3RlbmVyIHsKLSAgICAgICAgcHJpdmF0ZSBib29sZWFuIG1Db25uZWN0ZWQgPSBmYWxzZTsKLQotICAgICAgICBAT3ZlcnJpZGUKLSAgICAgICAgcHVibGljIHZvaWQgb25TZXJ2aWNlQ29ubmVjdGVkKCkgewotICAgICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7Ci0gICAgICAgICAgICAgICAgbUNvbm5lY3RlZCA9IHRydWU7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICBAT3ZlcnJpZGUKLSAgICAgICAgcHVibGljIHZvaWQgb25TZXJ2aWNlRGlzY29ubmVjdGVkKCkgewotICAgICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7Ci0gICAgICAgICAgICAgICAgbUNvbm5lY3RlZCA9IGZhbHNlOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIGJvb2xlYW4gaXNDb25uZWN0ZWQoKSB7Ci0gICAgICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gbUNvbm5lY3RlZDsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgIH0KLQotICAgIHByaXZhdGUgSGVhZHNldFNlcnZpY2VMaXN0ZW5lciBtSGVhZHNldFNlcnZpY2VMaXN0ZW5lciA9IG5ldyBIZWFkc2V0U2VydmljZUxpc3RlbmVyKCk7CiAKICAgICBwcml2YXRlIGNsYXNzIEJsdWV0b290aFJlY2VpdmVyIGV4dGVuZHMgQnJvYWRjYXN0UmVjZWl2ZXIgewogICAgICAgICBwcml2YXRlIGludCBtRmlyZWRGbGFncyA9IDA7Ci0gICAgICAgIHByaXZhdGUgaW50IG1QYWlyRmlyZWRGbGFncyA9IDA7Ci0gICAgICAgIHByaXZhdGUgaW50IG1BMmRwRmlyZWRGbGFncyA9IDA7Ci0gICAgICAgIHByaXZhdGUgaW50IG1IZWFkc2V0RmlyZWRGbGFncyA9IDA7CiAKICAgICAgICAgQE92ZXJyaWRlCiAgICAgICAgIHB1YmxpYyB2b2lkIG9uUmVjZWl2ZShDb250ZXh0IGNvbnRleHQsIEludGVudCBpbnRlbnQpIHsKQEAgLTIwMiw1OCArMTIyLDYgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtRmlyZWRGbGFncyB8PSBTVEFURV9UVVJOSU5HX09GRl9GTEFHOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChCbHVldG9vdGhEZXZpY2UuQUNUSU9OX0JPTkRfU1RBVEVfQ0hBTkdFRC5lcXVhbHMoaW50ZW50LmdldEFjdGlvbigpKSkgewotICAgICAgICAgICAgICAgICAgICBtRmlyZWRGbGFncyB8PSBQQUlSX1NUQVRFX0ZMQUc7Ci0gICAgICAgICAgICAgICAgICAgIGludCBzdGF0ZSA9IGludGVudC5nZXRJbnRFeHRyYShCbHVldG9vdGhEZXZpY2UuRVhUUkFfQk9ORF9TVEFURSwgLTEpOwotICAgICAgICAgICAgICAgICAgICBhc3NlcnROb3RTYW1lKHN0YXRlLCAtMSk7Ci0gICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoc3RhdGUpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgQmx1ZXRvb3RoRGV2aWNlLkJPTkRfQk9OREVEOgotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1QYWlyRmlyZWRGbGFncyB8PSBQQUlSX1NUQVRFX0JPTkRFRDsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgQmx1ZXRvb3RoRGV2aWNlLkJPTkRfQk9ORElORzoKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBtUGFpckZpcmVkRmxhZ3MgfD0gUEFJUl9TVEFURV9CT05ESU5HOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBCbHVldG9vdGhEZXZpY2UuQk9ORF9OT05FOgotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1QYWlyRmlyZWRGbGFncyB8PSBQQUlSX1NUQVRFX05PTkU7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKEJsdWV0b290aEEyZHAuQUNUSU9OX1NJTktfU1RBVEVfQ0hBTkdFRC5lcXVhbHMoaW50ZW50LmdldEFjdGlvbigpKSkgewotICAgICAgICAgICAgICAgICAgICBtRmlyZWRGbGFncyB8PSBQUk9GSUxFX0EyRFBfRkxBRzsKLSAgICAgICAgICAgICAgICAgICAgaW50IHN0YXRlID0gaW50ZW50LmdldEludEV4dHJhKEJsdWV0b290aEEyZHAuRVhUUkFfU0lOS19TVEFURSwgLTEpOwotICAgICAgICAgICAgICAgICAgICBhc3NlcnROb3RTYW1lKHN0YXRlLCAtMSk7Ci0gICAgICAgICAgICAgICAgICAgIHN3aXRjaCAoc3RhdGUpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgQmx1ZXRvb3RoQTJkcC5TVEFURV9ESVNDT05ORUNURUQ6Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbUEyZHBGaXJlZEZsYWdzIHw9IEEyRFBfU1RBVEVfRElTQ09OTkVDVEVEOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBCbHVldG9vdGhBMmRwLlNUQVRFX0NPTk5FQ1RJTkc6Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbUEyZHBGaXJlZEZsYWdzIHw9IEEyRFBfU1RBVEVfQ09OTkVDVElORzsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgQmx1ZXRvb3RoQTJkcC5TVEFURV9DT05ORUNURUQ6Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbUEyZHBGaXJlZEZsYWdzIHw9IEEyRFBfU1RBVEVfQ09OTkVDVEVEOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBCbHVldG9vdGhBMmRwLlNUQVRFX0RJU0NPTk5FQ1RJTkc6Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbUEyZHBGaXJlZEZsYWdzIHw9IEEyRFBfU1RBVEVfRElTQ09OTkVDVElORzsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgQmx1ZXRvb3RoQTJkcC5TVEFURV9QTEFZSU5HOgotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1BMmRwRmlyZWRGbGFncyB8PSBBMkRQX1NUQVRFX1BMQVlJTkc7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKEJsdWV0b290aEhlYWRzZXQuQUNUSU9OX1NUQVRFX0NIQU5HRUQuZXF1YWxzKGludGVudC5nZXRBY3Rpb24oKSkpIHsKLSAgICAgICAgICAgICAgICAgICAgbUZpcmVkRmxhZ3MgfD0gUFJPRklMRV9IRUFEU0VUX0ZMQUc7Ci0gICAgICAgICAgICAgICAgICAgIGludCBzdGF0ZSA9IGludGVudC5nZXRJbnRFeHRyYShCbHVldG9vdGhIZWFkc2V0LkVYVFJBX1NUQVRFLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIEJsdWV0b290aEhlYWRzZXQuU1RBVEVfRVJST1IpOwotICAgICAgICAgICAgICAgICAgICBhc3NlcnROb3RTYW1lKHN0YXRlLCBCbHVldG9vdGhIZWFkc2V0LlNUQVRFX0VSUk9SKTsKLSAgICAgICAgICAgICAgICAgICAgc3dpdGNoIChzdGF0ZSkgewotICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBCbHVldG9vdGhIZWFkc2V0LlNUQVRFX0RJU0NPTk5FQ1RFRDoKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBtSGVhZHNldEZpcmVkRmxhZ3MgfD0gSEVBRFNFVF9TVEFURV9ESVNDT05ORUNURUQ7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgICAgICBjYXNlIEJsdWV0b290aEhlYWRzZXQuU1RBVEVfQ09OTkVDVElORzoKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBtSGVhZHNldEZpcmVkRmxhZ3MgfD0gSEVBRFNFVF9TVEFURV9DT05ORUNUSU5HOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBCbHVldG9vdGhIZWFkc2V0LlNUQVRFX0NPTk5FQ1RFRDoKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBtSGVhZHNldEZpcmVkRmxhZ3MgfD0gSEVBRFNFVF9TVEFURV9DT05ORUNURUQ7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KQEAgLTI2NCwzMCArMTMyLDkgQEAKICAgICAgICAgICAgIH0KICAgICAgICAgfQogCi0gICAgICAgIHB1YmxpYyBpbnQgZ2V0UGFpckZpcmVkRmxhZ3MoKSB7Ci0gICAgICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gbVBhaXJGaXJlZEZsYWdzOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIGludCBnZXRBMmRwRmlyZWRGbGFncygpIHsKLSAgICAgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgewotICAgICAgICAgICAgICAgIHJldHVybiBtQTJkcEZpcmVkRmxhZ3M7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgaW50IGdldEhlYWRzZXRGaXJlZEZsYWdzKCkgewotICAgICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIG1IZWFkc2V0RmlyZWRGbGFnczsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCiAgICAgICAgIHB1YmxpYyB2b2lkIHJlc2V0RmlyZWRGbGFncygpIHsKICAgICAgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgewogICAgICAgICAgICAgICAgIG1GaXJlZEZsYWdzID0gMDsKLSAgICAgICAgICAgICAgICBtUGFpckZpcmVkRmxhZ3MgPSAwOwotICAgICAgICAgICAgICAgIG1BMmRwRmlyZWRGbGFncyA9IDA7Ci0gICAgICAgICAgICAgICAgbUhlYWRzZXRGaXJlZEZsYWdzID0gMDsKICAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgIH0KQEAgLTU3MiwzNTEgKzQxOSw2IEBACiAKICAgICB9CiAKLSAgICBwdWJsaWMgdm9pZCBwYWlyKEJsdWV0b290aEFkYXB0ZXIgYWRhcHRlciwgQmx1ZXRvb3RoRGV2aWNlIGRldmljZSkgewotICAgICAgICBpbnQgbWFzayA9IFBBSVJfU1RBVEVfRkxBRzsKLSAgICAgICAgaW50IHBhaXJNYXNrID0gUEFJUl9TVEFURV9CT05ESU5HIHwgUEFJUl9TVEFURV9CT05ERUQ7Ci0gICAgICAgIG1SZWNlaXZlci5yZXNldEZpcmVkRmxhZ3MoKTsKLQotICAgICAgICBpZiAoIWFkYXB0ZXIuaXNFbmFibGVkKCkpIHsKLSAgICAgICAgICAgIGZhaWwoInBhaXIoKSBibHVldG9vdGggbm90IGVuYWJsZWQiKTsKLSAgICAgICAgfQotCi0gICAgICAgIGludCBzdGF0ZSA9IGRldmljZS5nZXRCb25kU3RhdGUoKTsKLSAgICAgICAgc3dpdGNoIChzdGF0ZSkgewotICAgICAgICAgICAgY2FzZSBCbHVldG9vdGhEZXZpY2UuQk9ORF9CT05ERUQ6Ci0gICAgICAgICAgICAgICAgYXNzZXJ0VHJ1ZShhZGFwdGVyLmdldEJvbmRlZERldmljZXMoKS5jb250YWlucyhkZXZpY2UpKTsKLSAgICAgICAgICAgICAgICByZXR1cm47Ci0gICAgICAgICAgICBjYXNlIEJsdWV0b290aERldmljZS5CT05EX0JPTkRJTkc6Ci0gICAgICAgICAgICAgICAgLy8gRG9uJ3QgY2hlY2sgZm9yIHJlY2VpdmVkIGludGVudHMgc2luY2Ugd2UgbWlnaHQgaGF2ZSBtaXNzZWQgdGhlbS4KLSAgICAgICAgICAgICAgICBtYXNrID0gcGFpck1hc2sgPSAwOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgY2FzZSBCbHVldG9vdGhEZXZpY2UuQk9ORF9OT05FOgotICAgICAgICAgICAgICAgIGFzc2VydEZhbHNlKGFkYXB0ZXIuZ2V0Qm9uZGVkRGV2aWNlcygpLmNvbnRhaW5zKGRldmljZSkpOwotICAgICAgICAgICAgICAgIGFzc2VydFRydWUoZGV2aWNlLmNyZWF0ZUJvbmQoKSk7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICBkZWZhdWx0OgotICAgICAgICAgICAgICAgIGZhaWwoInBhaXIoKSBpbnZhbGlkZSBzdGF0ZTogc3RhdGU9IiArIHN0YXRlKTsKLSAgICAgICAgfQotCi0gICAgICAgIGxvbmcgcyA9IFN5c3RlbS5jdXJyZW50VGltZU1pbGxpcygpOwotICAgICAgICB3aGlsZSAoU3lzdGVtLmN1cnJlbnRUaW1lTWlsbGlzKCkgLSBzIDwgUEFJUl9USU1FT1VUKSB7Ci0gICAgICAgICAgICBzdGF0ZSA9IGRldmljZS5nZXRCb25kU3RhdGUoKTsKLSAgICAgICAgICAgIGlmIChzdGF0ZSA9PSBCbHVldG9vdGhEZXZpY2UuQk9ORF9CT05ERUQpIHsKLSAgICAgICAgICAgICAgICBhc3NlcnRUcnVlKGFkYXB0ZXIuZ2V0Qm9uZGVkRGV2aWNlcygpLmNvbnRhaW5zKGRldmljZSkpOwotICAgICAgICAgICAgICAgIGlmICgobVJlY2VpdmVyLmdldEZpcmVkRmxhZ3MoKSAmIG1hc2spID09IG1hc2sKLSAgICAgICAgICAgICAgICAgICAgICAgICYmIChtUmVjZWl2ZXIuZ2V0UGFpckZpcmVkRmxhZ3MoKSAmIHBhaXJNYXNrKSA9PSBwYWlyTWFzaykgewotICAgICAgICAgICAgICAgICAgICB3cml0ZU91dHB1dChTdHJpbmcuZm9ybWF0KCJwYWlyKCkgY29tcGxldGVkIGluICVkIG1zOiBkZXZpY2U9JXMiLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIChTeXN0ZW0uY3VycmVudFRpbWVNaWxsaXMoKSAtIHMpLCBkZXZpY2UpKTsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHNsZWVwKFBPTExfVElNRSk7Ci0gICAgICAgIH0KLQotICAgICAgICBpbnQgZmlyZWRGbGFncyA9IG1SZWNlaXZlci5nZXRGaXJlZEZsYWdzKCk7Ci0gICAgICAgIGludCBwYWlyRmlyZWR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IGFzc2VydFRydWUoZGV2aWNlLnJlbW92ZUJvbmQoKSk7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICBjYXNlIEJsdWV0b290aERldmljZS5CT05EX0JPTkRJTkc6Ci0gICAgICAgICAgICAgICAgYXNzZXJ0VHJ1ZShkZXZpY2UucmVtb3ZlQm9uZCgpKTsKLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgIGNhc2UgQmx1ZXRvb3RoRGV2aWNlLkJPTkRfTk9ORToKLSAgICAgICAgICAgICAgICBhc3NlcnRGYWxzZShhZGFwdGVyLmdldEJvbmRlZERldmljZXMoKS5jb250YWlucyhkZXZpY2UpKTsKLSAgICAgICAgICAgICAgICByZXR1cm47Ci0gICAgICAgICAgICBkZWZhdWx0OgotICAgICAgICAgICAgICAgIGZhaWwoInVucGFpcigpIGludmFsaWQgc3RhdGU6IHN0YXRlPSIgKyBzdGF0ZSk7Ci0gICAgICAgIH0KLQotICAgICAgICBhc3NlcnRUcnVlKGRldmljZS5yZW1vdmVCb25kKCkpOwotCi0gICAgICAgIGxvbmcgcyA9IFN5c3RlbS5jdXJyZW50VGltZU1pbGxpcygpOwotICAgICAgICB3aGlsZSAoU3lzdGVtLmN1cnJlbnRUaW1lTWlsbGlzKCkgLSBzIDwgVU5QQUlSX1RJTUVPVVQpIHsKLSAgICAgICAgICAgIGlmIChkZXZpY2UuZ2V0Qm9uZFN0YXRlKCkgPT0gQmx1ZXRvb3RoRGV2aWNlLkJPTkRfTk9ORSkgewotICAgICAgICAgICAgICAgIGFzc2VydEZhbHNlKGFkYXB0ZXIuZ2V0Qm9uZGVkRGV2aWNlcygpLmNvbnRhaW5zKGRldmljZSkpOwotICAgICAgICAgICAgICAgIGlmICgobVJlY2VpdmVyLmdldEZpcmVkRmxhZ3MoKSAmIG1hc2spID09IG1hc2sKLSAgICAgICAgICAgICAgICAgICAgICAgICYmIChtUmVjZWl2ZXIuZ2V0UGFpckZpcmVkRmxhZ3MoKSAmIHBhaXJNYXNrKSA9PSBwYWlyTWFzaykgewotICAgICAgICAgICAgICAgICAgICB3cml0ZU91dHB1dChTdHJpbmcuZm9ybWF0KCJ1bnBhaXIoKSBjb21wbGV0ZWQgaW4gJWQgbXM6IGRldmljZT0lcyIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgKFN5c3RlbS5jdXJyZW50VGltZU1pbGxpcygpIC0gcyksIGRldmljZSkpOwotICAgICAgICAgICAgICAgICAgICByZXR1cm47Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgaW50IGZpcmVkRmxhZ3MgPSBtUmVjZWl2ZXIuZ2V0RmlyZWRGbGFncygpOwotICAgICAgICBpbnQgcGFpckZpcmVkRmxhZ3MgPSBtUmVjZWl2ZXIuZ2V0UGFpckZpcmVkRmxhZ3MoKTsKLSAgICAgICAgbVJlY2VpdmVyLnJlc2V0RmlyZWRGbGFncygpOwotICAgICAgICBmYWlsKFN0cmluZy5mb3JtYXQoInVucGFpcigpIHRpbWVvdXQ6IHN0YXRlPSVkIChleHBlY3RlZCAlZCksIGZsYWdzPTB4JXggKGV4cGVjdGVkIDB4JXgpLCAiCi0gICAgICAgICAgICAgICAgKyAicGFpckZsYWdzPTB4JXggKGV4cGVjdGVkIDB4JXgpIiwgc3RhdGUsIEJsdWV0b290aERldmljZS5CT05EX0JPTkRFRCwgZmlyZWRGbGFncywKLSAgICAgICAgICAgICAgICBtYXNrLCBwYWlyRmlyZWRGbGFncywgcGFpck1hc2spKTsKLSAgICB9Ci0KLSAgICBwdWJsaWMgdm9pZCBjb25uZWN0QTJkcChCbHVldG9vdGhBZGFwdGVyIGFkYXB0ZXIsIEJsdWV0b290aERldmljZSBkZXZpY2UpIHsKLSAgICAgICAgaW50IG1hc2sgPSBQUk9GSUxFX0EyRFBfRkxBRzsKLSAgICAgICAgaW50IGEyZHBNYXNrMSA9IEEyRFBfU1RBVEVfQ09OTkVDVElORyB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N0ZWQoZGV2aWNlKSk7Ci0gICAgICAgICAgICAgICAgLy8gQ2hlY2sgd2hldGhlciBTVEFURV9DT05ORUNUSU5HIGFuZCAoU1RBVEVfQ09OTkVDVEVEIG9yIFNUQVRFX1BMQVlJTkcpIGludGVudHMKLSAgICAgICAgICAgICAgICAvLyBoYXZlIGZpcmVkIGlmIHdlIGFyZSBjaGVja2luZyBpZiBpbnRlbnRzIHNob3VsZCBiZSBmaXJlZC4KLSAgICAgICAgICAgICAgICBpbnQgZmlyZWRGbGFncyA9IG1SZWNlaXZlci5nZXRGaXJlZEZsYWdzKCk7Ci0gICAgICAgICAgICAgICAgaW50IGEyZHBGaXJlZEZsYWdzID0gbVJlY2VpdmVyLmdldEEyZHBGaXJlZEZsYWdzKCk7Ci0gICAgICAgICAgICAgICAgaWYgKChtUmVjZWl2ZXIuZ2V0RmlyZWRGbGFncygpICYgbWFzaykgPT0gbWFzawotICAgICAgICAgICAgICAgICAgICAgICAgJiYgKChhMmRwRmlyZWRGbGFncyAmIGEyZHBNYXNrMSkgPT0gYTJkcE1hc2sxCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHx8IChhMmRwRmlyZWRGbGFncyAmIGEyZHBNYXNrMikgPT0gYTJkcE1hc2syCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHx8IChhMmRwRmlyZWRGbGFncyAmIGEyZHBNYXNrMykgPT0gYTJkcE1hc2szKSkgewotICAgICAgICAgICAgICAgICAgICBtUmVjZWl2ZXIucmVzZXRGaXJlZEZsYWdzKCk7Ci0gICAgICAgICAgICAgICAgICAgIHdyaXRlT3V0cHV0KFN0cmluZy5mb3JtYXQoImNvbm5lY3RBMmRwKCkgY29tcGxldGVkIGluICVkIG1zOiBkZXZpY2U9JXMiLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIChTeXN0ZW0uY3VycmVudFRpbWVNaWxsaXMoKSAtIHMpLCBkZXZpY2UpKTsKLSAgICAgICAgICAgICAgICAgICAgcm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BMmRwRmlyZWRGbGFncygpICYgYTJkcE1hc2spID09IGEyZHBNYXNrKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1SZWNlaXZlci5yZXNldEZpcmVkRmxhZ3MoKTsKLSAgICAgICAgICAgICAgICAgICAgd3JpdGVPdXRwdXQoU3RyaW5nLmZvcm1hdCgiZGlzY29ubmVjdEEyZHAoKSBjb21wbGV0ZWQgaW4gJWQgbXM6IGRldmljZT0lcyIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgKFN5c3RlbS5jdXJyZW50VGltZU1pbGxpcygpIC0gcyksIGRldmljZSkpOwotICAgICAgICAgICAgICAgICAgICByZXR1cm47Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICAgICAgc2xlZXAoUE9MTF9USU1FKTsKLSAgICAgICAgfQotCi0gICAgICAgIGludCBmaXJlZEZsYWdzID0gbVJlY2VpdmVyLmdldEZpcmVkRmxhZ3MoKTsKLSAgICAgICAgaW50IGEyZHBGaXJlZEZsYWdzID0gbVJlY2VpdmVyLmdldEEyZHBGaXJlZEZsYWdzKCk7Ci0gICAgICAgIG1SZWNlaXZlci5yZXNldEZpcmVkRmxhZ3MoKTsKLSAgICAgICAgZmFpbChTdHJpbmcuZm9ybWF0KCJkaXNjb25uZWN0QTJkcCgpIHRpbWVvdXQ6IHN0YXRlPSVkIChleHBlY3RlZCAlZCksICIKLSAgICAgICAgICAgICAgICArICJmbGFncz0weCV4IChleHBlY3RlZCAweCV4KSwgYTJkcEZsYWdzPTB4JXggKGV4cGVjdGVkIDB4JXgpIiwgc3RhdGUsCi0gICAgICAgICAgICAgICAgQmx1ZXRvb3RoQTJkcC5TVEFURV9ESVNDT05ORUNURUQsIGZpcmVkRmxhZ3MsIG1hc2ssIGEyZHBGaXJlZEZsYWdzLCBhMmRwTWFzaykpOwotICAgIH0KLQotICAgIHB1YmxpYyB2b2lkIGNvbm5lY3RIZWFkc2V0KEJsdWV0b290aEFkYXB0ZXIgYWR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kgewotICAgICAgICAgICAgICAgIGFzc2VydFRydWUobUhlYWRzZXQuaXNDb25uZWN0ZWQoZGV2aWNlKSk7Ci0gICAgICAgICAgICAgICAgaWYgKChtUmVjZWl2ZXIuZ2V0RmlyZWRGbGFncygpICYgbWFzaykgPT0gbWFzawotICAgICAgICAgICAgICAgICAgICAgICAgJiYgKG1SZWNlaXZlci5nZXRIZWFkc2V0RmlyZWRGbGFncygpICYgaGVhZHNldE1hc2spID09IGhlYWRzZXRNYXNrKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1SZWNlaXZlci5yZXNldEZpcmVkRmxhZ3MoKTsKLSAgICAgICAgICAgICAgICAgICAgd3JpdGVPdXRwdXQoU3RyaW5nLmZvcm1hdCgiY29ubmVjdEhlYWRzZXQoKSBjb21wbGV0ZWQgaW4gJWQgbXM6IGRldmljZT0lcyIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgKFN5c3RlbS5jdXJyZW50VGltZU1pbGxpcygpIC0gcyksIGRldmljZSkpOwotICAgICAgICAgICAgICAgICAgICByZXR1cm47Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICAgICAgc2xlZXAoUE9MTF9USU1FKTsKLSAgICAgICAgfQotCi0gICAgICAgIGludCBmaXJlZEZsYWdzID0gbVJlY2VpdmVyLmdldEZpcmVkRmxhZ3MoKTsKLSAgICAgICAgaW50IGhlYWRzZXRGaXJlZEZsYWdzID0gbVJlY2VpdmVyLmdldEhlYWRzZXRGaXJlZEZsYWdzKCk7Ci0gICAgICAgIG1SZWNlaXZlci5yZXNldEZpcmVkRmxhZ3MoKTsKLSAgICAgICAgZmFpbChTdHJpbmcuZm9ybWF0KCJjb25uZWN0SGVhZHNldCgpIHRpbWVvdXQ6IHN0YXRlPSVkIChleHBlY3RlZCAlZCksICIKLSAgICAgICAgICAgICAgICArICJmbGFncz0weCV4IChleHBlY3RlZCAweCV4KSwgaGVhZHNldEZsYWdzPTB4JXMgKGV4cGVjdGVk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290aEhlYWRzZXQuU1RBVEVfQ09OTkVDVEVEOgotICAgICAgICAgICAgICAgIG1IZWFkc2V0LmRpc2Nvbm5lY3RIZWFkc2V0KGRldmljZSk7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICBjYXNlIEJsdWV0b290aEhlYWRzZXQuU1RBVEVfQ09OTkVDVElORzoKLSAgICAgICAgICAgICAgICBtSGVhZHNldC5kaXNjb25uZWN0SGVhZHNldChkZXZpY2UpOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgY2FzZSBCbHVldG9vdGhIZWFkc2V0LlNUQVRFX0RJU0NPTk5FQ1RFRDoKLSAgICAgICAgICAgICAgICByZXR1cm47Ci0gICAgICAgICAgICBjYXNlIEJsdWV0b290aEhlYWRzZXQuU1RBVEVfRVJST1I6Ci0gICAgICAgICAgICAgICAgZmFpbCgiZGlzY29ubmVjdEhlYWRzZXQoKSBlcnJvciBzdGF0ZSIpOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgZGVmYXVsdDoKLSAgICAgICAgICAgICAgICBmYWlsKCJkaXNjb25uZWN0SGVhZHNldCgpIGludmFsaWQgc3RhdGU6IHN0YXRlPSIgKyBzdGF0ZSk7Ci0gICAgICAgIH0KLQotICAgICAgICBsb25nIHMgPSBTeXN0ZW0uY3VycmVudFRpbWVNaWxsaXMoKTsKLSAgICAgICAgd2hpbGUgKFN5c3RlbS5jdXJyZW50VGltZU1pbGxpcygpIC0gcyA8IERJU0NPTk5FQ1RfSEVBRFNFVF9USU1FT1VUKSB7Ci0gICAgICAgICAgICBzdGF0ZSA9IG1IZWFkc2V0LmdldFN0YXRlKGRldmljZSk7Ci0gICAgICAgICAgICBpZiAoc3RhdGUgPT0gQmx1ZXRvb3RoSGVhZHNldC5TVEFURV9ESVNDT05ORUNURUQpIHsKLSAgICAgICAgICAgICAgICBhc3NlcnRGYWxzZShtSGVhZHNldC5pc0Nvbm5lY3RlZChkZXZpY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xlKHVybCwgbW9kZSwgc3FsKTsKICAgICAgICAgICAgIGNhc2UgSFVHRToKICAgICAgICAgICAgICAgICB0cnkgewotICAgICAgICAgICAgICAgICAgICBNZW1vcnlGaWxlIG1lbW9yeUZpbGUgPSBuZXcgTWVtb3J5RmlsZShudWxsLCA1MDAwMDAwKTsKLSAgICAgICAgICAgICAgICAgICAgbWVtb3J5RmlsZS53cml0ZUJ5dGVzKFRFU1RfQkxPQiwgMCwgMTAwMDAwMCwgVEVTVF9CTE9CLmxlbmd0aCk7Ci0gICAgICAgICAgICAgICAgICAgIG1lbW9yeUZpbGUuZGVhY3RpdmF0ZSgpOwotICAgICAgICAgICAgICAgICAgICByZXR1cm4gQXNzZXRGaWxlRGVzY3JpcHRvci5mcm9tTWVtb3J5RmlsZShtZW1vcnlGaWxlKTsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFBhcmNlbEZpbGVEZXNjcmlwdG9yLmZyb21EYXRhKFRFU1RfQkxPQiwgbnVsbCk7CiAgICAgICAgICAgICAgICAgfSBjYXRjaCAoSU9FeGNlcHRpb24gZXgpIHsKICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEZpbGVOb3RGb3VuZEV4Y2VwdGlvbigiRXJyb3IgcmVhZGluZyAiICsgdXJsICsgIjoiICsgZXgudG9TdHJpbmcoKSk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgY2FzZSBGSUxFOgogICAgICAgICAgICAgICAgIEZpbGUgZmlsZSA9IGdldENvbnRleHQoKS5nZXRGaWxlU3RyZWFtUGF0aChEQVRBX0ZJTEUpOwotICAgICAgICAgICAgICAgIFBhcmNlbEZpbGVEZXNjcmlwdG9yIGZkID0KLSAgICAgICAgICAgICAgICAgICAgICAgIFBhcmNlbEZpbGVEZXNjcmlwdG9yLm9wZW4oZmlsZSwgUGFyY2VsRmlsZURlc2NyaXB0b3IuTU9ERV9SRUFEX09OTFkpOwotICAgICAgICAgICAgICAgIHJldHVybiBuZXcgQX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WxsLCBudWxsLCBudWxsKTsKLSAgICAgICAgaW50IGRDb2wgPSBjLmdldENvbHVtbkluZGV4T3JUaHJvdygiZCIpOwotICAgICAgICBpbnQgc0NvbCA9IGMuZ2V0Q29sdW1uSW5kZXhPclRocm93KCJzIik7Ci0gICAgICAgIAotICAgICAgICBpbnQgY291bnQgPSAwOwotICAgICAgICB3aGlsZSAoYy5tb3ZlVG9OZXh0KCkpIHsKLSAgICAgICAgICAgIGFzc2VydFRydWUoYy51cGRhdGVJbnQoZENvbCwgMykpOwotICAgICAgICAgICAgY291bnQrKzsKLSAgICAgICAgfQotICAgICAgICBhc3NlcnRFcXVhbHMoMTAsIGNvdW50KTsKLSAgICAgICAgCi0gICAgICAgIGFzc2VydFRydWUoYy5jb21taXRVcGRhdGVzKCkpOwotICAgICAgICAKLSAgICAgICAgYXNzZXJ0VHJ1ZShjLnJlcXVlcnkoKSk7Ci0gICAgICAgIAotICAgICAgICBjb3VudCA9IDA7Ci0gICAgICAgIHdoaWxlIChjLm1vdmVUb05leHQoKSkgewotICAgICAgICAgICAgYXNzZXJ0RXF1YWxzKDMsIGMuZ2V0SW50KGRDb2wpKTsKLSAgICAgICAgICAgIGNvdW50Kys7Ci0gICAgICAgIH0KLSAgICAgICAgCi0gICAgICAgIGFzc2VydEVxdWFscygxMCwgY291bnQpOwotICAgICAgICBhc3NlcnRUcnVlKGMubW92ZVRvRmlyc3QoKSk7Ci0gICAgICAgIGFzc2VydFRydWUoYy5kZWxldGVSb3coKSk7Ci0gICAgICAgIGFzc2VydEVxdWFscyg5LCBjLmdldENvdW50KCkpOwotICAgICAgICBjLmNsb3NlKCk7Ci0gICAgfQotICAgIAotICAgIEBNZWRpdW1UZXN0CiAgICAgcHVibGljIHZvaWQgdGVzdEJsb2IoKSB0aHJvd3MgRXhjZXB0aW9uIHsKICAgICAgICAgLy8gY3JlYXRlIHRhYmxlCiAgICAgICAgIG1EYXRhYmFzZS5leGVjU1FMKApAQCAtMTY0LDI0ICsxMjQs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pbGUuZ2V0UGF0aCgpLCBudWxsLAorICAgICAgICAgICAgICAgIG5ldyBNeURhdGFiYXNlQ29ycnVwdGlvbkhhbmRsZXIoKSk7CisgICAgICAgIGFzc2VydFRydWUoZGIuaXNEYXRhYmFzZUludGVncml0eU9rKCkpOworICAgIH0KKworICAgIC8qKgorICAgICAqIEFuIGV4YW1wbGUgaW1wbGVtZW50YXRpb24gb2Yge0BsaW5rIERhdGFiYXNlRXJyb3JIYW5kbGVyfSB0byBkZW1vbnN0cmF0ZQorICAgICAqIGRhdGFiYXNlIGNvcnJ1cHRpb24gaGFuZGxlciB3aGljaCBjaGVja3MgdG8gbWFrZSBzdXJlIGRhdGFiYXNlIGlzIGluZGVlZAorICAgICAqIGNvcnJ1cHQgYmVmb3JlIGRlbGV0aW5nIHRoZSBmaWxlLgorICAgICAqLworICAgIHB1YmxpYyBjbGFzcyBNeURhdGFiYXNlQ29ycnVwdGlvbkhhbmRsZXIgaW1wbGVtZW50cyBEYXRhYmFzZUVycm9ySGFuZGxlciB7CisgICAgICAgIHB1YmxpYyB2b2lkIG9uQ29ycnVwdGlvbihTUUxpdGVEYXRhYmFzZSBkYk9iaikgeworICAgICAgICAgICAgYm9vbGVhbiBkYXRhYmFzZU9rID0gZGJPYmouaXNEYXRhYmFzZUludGVncml0eU9rKCk7CisgICAgICAgICAgICAvLyBjbG9zZSB0aGUgZGF0YWJhc2UKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgZGJPYmouY2xvc2UoKTsKKyAgICAgICAgICAgIH0gY2F0Y2ggKFNRTGl0ZUV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgLyogaWdub3JlICovCisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoZGF0YWJhc2VPaykgeworICAgICAgICAgICAgICAgIC8vIGRhdGFiYXNlIGlzIGp1c3QgZmluZS4gbm8gbmVlZCB0byBkZWxldGUgdGhlIGRhdGFiYXNlIGZpbGUKKyAgICAgICAgICAg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JzZWxlY3QgaSBmcm9tIEEgd2hlcmUgaSA+IDIgIiArCisgICAgICAgICAgICAgICAgIlVOSU9OIHNlbGVjdCBrIGZyb20gQiB3aGVyZSBrID4gMjAxICIgKworICAgICAgICAgICAgICAgICJVTklPTiBzZWxlY3QgbiBmcm9tIEMgd2hlcmUgbiAhPTkwMDsiOworICAgICAgICBDdXJzb3IgYyA9IG1EYXRhYmFzZS5yYXdRdWVyeShzLCBudWxsKTsKKyAgICAgICAgaW50IG4gPSBjLmdldENvdW50KCk7CisgICAgICAgIGMuY2xvc2UoKTsKKyAgICAgICAgU3RyaW5nIHMxID0gInNlbGVjdCBpIGZyb20gQSB3aGVyZSBpID4gPyAiICsKKyAgICAgICAgICAgICAgICAiVU5JT04gc2VsZWN0IGsgZnJvbSBCIHdoZXJlIGsgPiA/ICIgKworICAgICAgICAgICAgICAgICJVTklPTiBzZWxlY3QgbiBmcm9tIEMgd2hlcmUgbiAhPSA/OyI7CisgICAgICAgIEN1cnNvciBjMSA9IG1EYXRhYmFzZS5yYXdRdWVyeShzMSwgbmV3IFN0cmluZ1tdeyIyIiwgIjIwMSIsICI5MDAifSk7CisgICAgICAgIGFzc2VydEVxdWFscyhuLCBjMS5nZXRDb3VudCgpKTsKKyAgICAgICAgYzEuY2xvc2UoKTsKKyAgICB9CisKICAgICAvKioKICAgICAgKiBUaGlzIHRlc3QgaXMgYXZhaWxhYmxlIG9ubHkgd2hlbiB0aGUgcGxhdGZvcm0gaGFzIGEgbG9jYWxlIHdpdGggdGhlIGxhbmd1YWdlICJqYSIuCiAgICAgICogSXQgZmluaXNoZXMgd2l0aG91dCBmYWlsdXJlIHdoZW4gaXQgaXMgbm90IGF2YWlsYWJsZS4gIApAQCAtMTEwOCw1ICsxMDU5LDExMyBAQAogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KICAgICAgICAgfQotICAgIH0gICAgCisgICAgfQorCisgICAgQFNtYWxsVGVzdAorICAgIHB1YmxpYyB2b2lkIHRlc3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5TGlzdDxTdHJpbmc+IGF0dGFjaGVkRGJGaWxlcyA9IG5ldyBBcnJheUxpc3Q8U3RyaW5nPihOKTsKKyAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBOOyBpKyspIHsKKyAgICAgICAgICAgIGF0dGFjaGVkRGJGaWxlcy5hZGQobURhdGFiYXNlLmdldFBhdGgoKSArIGkpOworICAgICAgICB9CisgICAgICAgIGRiT2JqID0gU1FMaXRlRGF0YWJhc2Uub3Blbk9yQ3JlYXRlRGF0YWJhc2UobURhdGFiYXNlLmdldFBhdGgoKSwgbnVsbCk7CisgICAgICAgIGRiT2JqLmV4ZWNTUUwoIkFUVEFDSCBEQVRBQkFTRSAnOm1lbW9yeTonIGFzIG1lbW9yeURiIik7CisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgTjsgaSsrKSB7CisgICAgICAgICAgICBkYk9iai5leGVjU1FMKCJBVFRBQ0ggREFUQUJBU0UgJyIgKyAgYXR0YWNoZWREYkZpbGVzLmdldChpKSArICInIGFzIGF0dGFjaGVkRGIiICsgaSk7CisgICAgICAgIH0KKyAgICAgICAgYXNzZXJ0VHJ1ZShkYmZpbGUuZXhpc3RzKCkpOworICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IE47IGkrKykgeworICAgICAgICAgICAgYXNzZXJ0VHJ1ZShuZXcgRmlsZShhdHRhY2hlZERiRmlsZXMuZ2V0KGkpKS5leGlzdHMoKSk7CisgICAgICAgIH0KKyAgICAgICAgYXNzZXJ0Tm90TnVsbChkYk9iaik7CisgICAgICAgIGFzc2VydFRydWUoZGJPYmouaXNPcGVuKCkpOworICAgICAgICBhdHRhY2hlZERicyA9IGRiT2JqLmdldEF0dGFjaGVkRGJzKCk7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBlcnJvckhhbmRsZXIub25Db3JydXB0aW9uKGRiT2JqKTsKKyAgICAgICAgICAgIGFzc2VydEZhbHNlKGRiZmlsZS5leGlzdHMoKSk7CisgICAgICAgIC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wdGlvbiBleHBlY3RlZCIpOworICAgICAgICB9IGNhdGNoIChJbGxlZ2FsU3RhdGVFeGNlcHRpb24gZSApIHsKKyAgICAgICAgICAgIC8vIGV4cGVjdGVkLgorICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogZ2V0IGFsbCBjb25uZWN0aW9ucyBmcm9tIHRoZSBwb29sIGFuZCBhc2sgZm9yIG9uZSBtb3JlLgorICAgICAqIHNob3VsZCBnZXQgb25lIG9mIHRoZSBjb25uZWN0aW9ucyBhbHJlYWR5IGdvdCBzbyBmYXIuIAorICAgICAqLworICAgIEBTbWFsbFRlc3QKKyAgICBwdWJsaWMgdm9pZCB0ZXN0R2V0QWxsQ29ubkFuZE9uZU1vcmUoKSB7CisgICAgICAgIG1UZXN0UG9vbC5zZXRNYXhQb29sU2l6ZShNQVhfQ09OTik7CisgICAgICAgIGFzc2VydEVxdWFscyhNQVhfQ09OTiwgbVRlc3RQb29sLmdldE1heFBvb2xTaXplKCkpOworICAgICAgICBBcnJheUxpc3Q8U1FMaXRlRGF0YWJhc2U+IGRiT2JqcyA9IG5ldyBBcnJheUxpc3Q8U1FMaXRlRGF0YWJhc2U+KCk7CisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgTUFYX0NPTk47IGkrKykgeworICAgICAgICAgICAgU1FMaXRlRGF0YWJhc2UgZGIgPSBtVGVzdFBvb2wuZ2V0KFRFU1RfU1FMKTsKKyAgICAgICAgICAgIGFzc2VydEZhbHNlKGRiT2Jqcy5jb250YWlucyhkYikpOworICAgICAgICAgICAgZGJPYmpzLmFkZChkYik7CisgICAgICAgICAgICBhc3NlcnRFcXVhbHMobURhdGFiYXNlLCBkYi5tUGFyZW50Q29ubk9iaik7CisgICAgICAgIH0KKyAgICAgICAgYXNzZXJ0RXF1YWxzKDAsIG1UZXN0UG9vbC5nZXRGcmVlUG9vbFNpemUoKSk7CisgICAgICAgIGFzc2VydEVxdWFscyhNQVhfQ09OTiwgbVRlc3RQb29sLm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RNYXhQb29sU2l6ZSgpKTsKKworICAgICAgICBhc3NlcnRGYWxzZShtVGVzdFBvb2wuaXNEYXRhYmFzZU9iakZyZWUoZGIxKSk7CisgICAgICAgIGFzc2VydEZhbHNlKGRiMS5lcXVhbHMoZGIpKTsKKworICAgICAgICBtVGVzdFBvb2wucmVsZWFzZShkYik7CisgICAgICAgIGFzc2VydEVxdWFscygxLCBtVGVzdFBvb2wuZ2V0RnJlZVBvb2xTaXplKCkpOworICAgICAgICBhc3NlcnRFcXVhbHMoMiwgbVRlc3RQb29sLmdldFNpemUoKSk7CisgICAgICAgIGFzc2VydEVxdWFscyhNQVhfQ09OTiwgbVRlc3RQb29sLmdldE1heFBvb2xTaXplKCkpOworCisgICAgICAgIG1UZXN0UG9vbC5yZWxlYXNlKGRiMSk7CisgICAgICAgIGFzc2VydEVxdWFscygyLCBtVGVzdFBvb2wuZ2V0RnJlZVBvb2xTaXplKCkpOworICAgICAgICBhc3NlcnRFcXVhbHMoMiwgbVRlc3RQb29sLmdldFNpemUoKSk7CisgICAgICAgIGFzc2VydEVxdWFscyhNQVhfQ09OTiwgbVRlc3RQb29sLmdldE1heFBvb2xTaXplKCkpOworICAgIH0KKworICAgIC8qKgorICAgICAqIGdldCB0aGUgc2FtZSBjb25uZWN0aW9uIE4gdGltZXMgYW5kIHJlbGVhc2UgaXQgTiB0aW1lcy4KKyAgICAgKiB0aGlzIHRlc3RzIERhdGFiYXNlQ29ubmVjdGlvblBvb2wuUG9vbE9iai5tTnVtSG9sZGVycworICAgICAqLworICAgIEBTbWFsbFRlc3QKKyAgICBwdWJsaWMgdm9pZCB0ZXN0R2V0U2FtZUNvbm5OdGltZXNBbmRSZWxlYXNlSXROdGltZXMoKSB7CisgICAgICAgIG1UZXN0UG9vbC5zZXRNYXhQb29sU2l6ZShNQVhfQ09OTik7CisgICAgICAgIGFzc2VydEVxdWFscyhNQVhfQ09OTiwgbVRlc3RQb29sLmdldE1heFBvb2xTaXplKCkpOworCisgICAgICAgIE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worICAgICAgICBhc3NlcnRFcXVhbHMoTUFYX0NPTk4sIG1UZXN0UG9vbC5nZXRNYXhQb29sU2l6ZSgpKTsKKyAgICAgICAgLy8gZ2V0IHRoZSBzYW1lIGNvbm5lY3Rpb24gTiB0aW1lcyBtb3JlCisgICAgICAgIGludCBOID0gMTAwOworICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IE47IGkrKykgeworICAgICAgICAgICAgU1FMaXRlRGF0YWJhc2UgZGIyID0gbVRlc3RQb29sLmdldCh0ZXN0U3FsKTsKKyAgICAgICAgICAgIGFzc2VydEVxdWFscyhkYjEsIGRiMik7CisgICAgICAgICAgICBhc3NlcnRGYWxzZShtVGVzdFBvb2wuaXNEYXRhYmFzZU9iakZyZWUoZGIyKSk7CisgICAgICAgICAgICAvLyBudW1Ib2xkZXJzIGZvciB0aGlzIG9iamVjdCBzaG91bGQgYmUgbm93IHVwIGJ5IDEKKyAgICAgICAgICAgIGludCBwcmV2ID0gbnVtSG9sZGVyczsKKyAgICAgICAgICAgIG51bUhvbGRlcnMgPSBwb29sT2JqLmdldE51bUhvbGRlcnMoKTsKKyAgICAgICAgICAgIGFzc2VydEVxdWFscyhwcmV2ICsgMSwgbnVtSG9sZGVycyk7CisgICAgICAgIH0KKyAgICAgICAgLy8gcmVsZWFzZSBpdCBOIHRpbWVzCisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgTjsgaSsrKSB7CisgICAgICAgICAgICBtVGVzdFBvb2wucmVsZWFzZShkYjEpOworICAgICAgICAgICAgaW50IHByZXYgPSBudW1Ib2xkZXJzOworICAgICAgICAgICAgbnVtSG9sZGVycyA9IHBvb2xPYmouZ2V0TnVtSG9sZGVycygpOworICAgICAgICAgICAgYXNzZXJ0RXF1YWxzKHByZXYgLSAxLCBudW1Ib2xkZXJzKTsKKyAgICAgICAgICAgIGFzc2VydEZhbHNlKG1UZXN0UG9vbC5pc0RhdGFiYXNlT2JqRnJlZShkYjEpKTsKKyAgICAgICAgfQorICAg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1ZShkYk1hcC5jb250YWluc0tleShkYikpOworICAgICAgICAgICAgaW50IGsgPSBkYk1hcC5nZXQoZGIpOworICAgICAgICAgICAgZGJNYXAucHV0KGRiLCArK2spOworICAgICAgICB9CisgICAgICAgIGFzc2VydEVxdWFscygwLCBtVGVzdFBvb2wuZ2V0RnJlZVBvb2xTaXplKCkpOworICAgICAgICBhc3NlcnRFcXVhbHMoTUFYX0NPTk4sIG1UZXN0UG9vbC5nZXRTaXplKCkpOworICAgICAgICBhc3NlcnRFcXVhbHMoTUFYX0NPTk4sIG1UZXN0UG9vbC5nZXRNYXhQb29sU2l6ZSgpKTsKKyAgICAgICAgLy8gcHJpbnQgdGhlIGRpc3RyaWJ1dGlvbiBvZiB0aGUgZGF0YWJhc2UgY29ubmVjdGlvbiBoYW5kbGVzIHJlY2VpdmVkLCBzaG91bGQgYmUgdW5pZm9ybS4KKyAgICAgICAgZm9yIChTUUxpdGVEYXRhYmFzZSBkIDogZGJNYXAua2V5U2V0KCkpIHsKKyAgICAgICAgICAgIExvZy5pKFRBRywgImNvbm5lY3Rpb24gIyAiICsgZC5tQ29ubmVjdGlvbk51bSArICIsIG51bUhvbGRlcnM6ICIgKyBkYk1hcC5nZXQoZCkpOworICAgICAgICB9CisgICAgICAgIC8vIHByaW50IHRoZSBwb29sIGluZm8KKyAgICAgICAgTG9nLmkoVEFHLCBtVGVzdFBvb2wudG9TdHJpbmcoKSk7CisgICAgICAgIC8vIHJlbGVhc2UgYWxsCisgICAgICAgIGZvciAoU1FMaXRlRGF0YWJhc2UgZCA6IGRiTWFwLmtleVNldCgpKSB7CisgICAgICAgICAgICBpbnQgbnVtID0gZGJNYXAuZ2V0KGQpOworICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBudW07IGkrKykgeworICAgICAgICAgICAgICAgIG1UZXN0UG9vbC5yZWxlYXNlKGQpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGFzc2VydEVxdWFscyhNQVhfQ09OTiw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cGRhdGVTcWwoaW50IHN0bXRUeXBlKSB0aHJvd3MgSW50ZXJydXB0ZWRFeGNlcHRpb24geworICAgICAgICBjcmVhdGVUYWJsZUFuZENsZWFyQ2FjaGUoKTsKKworICAgICAgICBDb250ZW50VmFsdWVzIHZhbHVlcyA9IG5ldyBDb250ZW50VmFsdWVzKCk7CisgICAgICAgIC8vIG1ha2Ugc29tZSBjaGFuZ2VzIHRvIGRhdGEgaW4gVEVTVF9UQUJMRQorICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IDU7IGkrKykgeworICAgICAgICAgICAgdmFsdWVzLnB1dCgiaSIsIGkpOworICAgICAgICAgICAgdmFsdWVzLnB1dCgiaiIsICJpIiArIFN5c3RlbS5jdXJyZW50VGltZU1pbGxpcygpKTsKKyAgICAgICAgICAgIG1EYXRhYmFzZS5pbnNlcnQoVEVTVF9UQUJMRSwgbnVsbCwgdmFsdWVzKTsKKyAgICAgICAgICAgIHN3aXRjaCAoc3RtdFR5cGUpIHsKKyAgICAgICAgICAgICAgICBjYXNlIFVQREFURToKKyAgICAgICAgICAgICAgICAgICAgdmFsdWVzLnB1dCgiaiIsICJ1IiArIFN5c3RlbS5jdXJyZW50VGltZU1pbGxpcygpKTsKKyAgICAgICAgICAgICAgICAgICAgbURhdGFiYXNlLnVwZGF0ZShURVNUX1RBQkxFLCB2YWx1ZXMsICJpID0gIiArIGksIG51bGwpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIERFTEVURToKKyAgICAgICAgICAgICAgICAgICAgbURhdGFiYXNlLmRlbGV0ZShURVNUX1RBQkxFLCAiaSA9IDEiLCBudWxsKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgLy8gZG8gYSBxdWVyeS4gZXZlbiB0aG91Z2ggcXVlcnkgdXNlcyBhIGRpZmZlcmVudCBkYXRhYmFzZSBjb25uZWN0aW9uLAorICAg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ZXMucHV0KCJpIiwgaSk7CisgICAgICAgICAgICB2YWx1ZXMucHV0KCJqIiwgImkiICsgU3lzdGVtLmN1cnJlbnRUaW1lTWlsbGlzKCkpOworICAgICAgICAgICAgbURhdGFiYXNlLmluc2VydChURVNUX1RBQkxFLCBudWxsLCB2YWx1ZXMpOworICAgICAgICAgICAgc3dpdGNoIChzdG10VHlwZSkgeworICAgICAgICAgICAgICAgIGNhc2UgVVBEQVRFOgorICAgICAgICAgICAgICAgICAgICB2YWx1ZXMucHV0KCJqIiwgInUiICsgU3lzdGVtLmN1cnJlbnRUaW1lTWlsbGlzKCkpOworICAgICAgICAgICAgICAgICAgICBtRGF0YWJhc2UudXBkYXRlKFRFU1RfVEFCTEUsIHZhbHVlcywgImkgPSAiICsgaSwgbnVsbCk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgREVMRVRFOgorICAgICAgICAgICAgICAgICAgICBtRGF0YWJhc2UuZGVsZXRlKFRFU1RfVEFCTEUsICJpID0gMSIsIG51bGwpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBtRGF0YWJhc2Uuc2V0VHJhbnNhY3Rpb25TdWNjZXNzZnVsKCk7CisgICAgICAgIC8vIGRvIGEgcXVlcnkgYmVmb3JlIGNvbW1pdCAtIHNob3VsZCBzdGlsbCBoYXZlIDUgcm93cworICAgICAgICAvLyB0aGlzIHF1ZXJ5IHNob3VsZCBydW4gaW4gYSBkaWZmZXJlbnQgdGhyZWFkIHRvIGZvcmNlIGl0IHRvIHVzZSBhIGRpZmZlcmVudCBkYXRhYmFzZQorICAgICAgICAvLyBjb25uZWN0aW9uCisgICAgICAgIFRocmVhZCB0ID0gbmV3IFRocmVhZCgpIHsKKyAgICAgICAgICAgIEBPdmVycmlkZSBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgICAgICAgICAgU3RyaW5nIHNxbCA9ICJzZ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uZygpKTsKKyAgICAgICAgc3RtdC5jbG9zZSgpOworICAgICAgICBjID0gbURhdGFiYXNlLnJhd1F1ZXJ5KHNxbCwgbnVsbCk7CisgICAgICAgIGFzc2VydEVxdWFscygxLCBjLmdldENvdW50KCkpOworICAgICAgICBjLm1vdmVUb0ZpcnN0KCk7CisgICAgICAgIGFzc2VydEVxdWFscyhleHBlY3RlZFZhbHVlMiwgYy5nZXRMb25nKDApKTsKKyAgICAgICAgYy5jbG9zZSgpOworICAgIH0KKyAgICBwcml2YXRlIHN5bmNocm9uaXplZCBTUUxpdGVEYXRhYmFzZSBnZXREYigpIHsKKyAgICAgICAgcmV0dXJuIG1EYXRhYmFzZTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBUZXN0IHRvIGVuc3VyZSB0aGF0IHJlYWRlcnMgYXJlIGFibGUgdG8gcmVhZCB0aGUgZGF0YWJhc2UgZGF0YSAob2xkIHZlcnNpb25zKQorICAgICAqIEVWRU4gV0hFTiB0aGUgd3JpdGVyIGlzIGluIGEgdHJhbnNhY3Rpb24gb24gdGhlIHNhbWUgZGF0YWJhc2UuCisgICAgICo8cD4KKyAgICAgKiBUaGlzIHRlc3Qgc3RhcnRzIDEgV3JpdGVyIGFuZCAyIFJlYWRlcnMgYW5kIHNldHMgdXAgY29ubmVjdGlvbiBwb29sIGZvciByZWFkZXJzCisgICAgICogYnkgY2FsbGluZyB0aGUgbWV0aG9kIHtAbGluayBTUUxpdGVEYXRhYmFzZSNlbmFibGVXcml0ZUFoZWFkTG9nZ2luZygpfS4KKyAgICAgKiA8cD4KKyAgICAgKiBXcml0ZXIgZG9lcyB0aGUgZm9sbG93aW5nIGluIGEgdGlnaHQgbG9vcAorICAgICAqIDxwcmU+CisgICAgICogICAgIGJlZ2luIHRyYW5zYWN0aW9uCisgICAgICogICAgIGluc2VydCBpbnRvIHRhYmxlXzEKKyAgICAgKiAgICAgaW5zZXJ0IGludG8gdGFibGVfMgorICAgICAqICAgICBjb21taXQKKyAgIC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YXNlLmJlZ2luVHJhbnNhY3Rpb24oKTsKKyAgICAgICAgICAgIGZvciAoaW50IGsgPSAwOyBrIDwgNTsgaysrKSB7CisgICAgICAgICAgICAgICAgbURhdGFiYXNlLmV4ZWNTUUwoImluc2VydCBpbnRvIHQxIHZhbHVlcyg/LD8pOyIsIG5ldyBTdHJpbmdbXSB7aysiIiwgaysiIn0pOworICAgICAgICAgICAgICAgIG1EYXRhYmFzZS5leGVjU1FMKCJpbnNlcnQgaW50byB0MiB2YWx1ZXMoPyw/KTsiLCBuZXcgU3RyaW5nW10ge2srIiIsIGsrIiJ9KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1EYXRhYmFzZS5zZXRUcmFuc2FjdGlvblN1Y2Nlc3NmdWwoKTsKKyAgICAgICAgICAgIG1EYXRhYmFzZS5lbmRUcmFuc2FjdGlvbigpOworCisgICAgICAgICAgICAvLyBzdGFydCBhIHdyaXRlcgorICAgICAgICAgICAgV3JpdGVyIHcgPSBuZXcgV3JpdGVyKG1EYXRhYmFzZSk7CisKKyAgICAgICAgICAgIC8vIGluaXRpYWxpemUgYW4gYXJyYXkgb2YgY291bnRlcnMgdG8gYmUgcGFzc2VkIHRvIHRoZSByZWFkZXJzCisgICAgICAgICAgICBSZWFkZXIgcjEgPSBuZXcgUmVhZGVyKG1EYXRhYmFzZSwgInQxIiwgdywgMCk7CisgICAgICAgICAgICBSZWFkZXIgcjIgPSBuZXcgUmVhZGVyKG1EYXRhYmFzZSwgInQyIiwgdywgMSk7CisgICAgICAgICAgICB3LnN0YXJ0KCk7CisgICAgICAgICAgICByMS5zdGFydCgpOworICAgICAgICAgICAgcjIuc3RhcnQoKTsKKworICAgICAgICAgICAgLy8gd2FpdCBmb3IgYWxsIHRocmVhZHMgdG8gZGllCisgICAgICAgICAgICB3LmpvaW4oKTsKKyAgICAgICAgICAgIHIxLmpvaW4oKTsKKyAgICAgICAgICAgIHIyLmpvaW4oKTsKKworICAgICAgICAgICAgLy8gcHJpbnQgdGhlIHN0YXRzCisgICAgICAgICAgICBpbnRbXVtdIGNvdW50cyA9IGdldENvdW50cygpOworICAgICAgICAgICAgYnVmZltpXSA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7CisgICAgICAgICAgICBidWZmW2ldLmFwcGVuZCgiY29ubnBvb2wtc2l6ZSA9ICIpOworICAgICAgICAgICAgYnVmZltpXS5hcHBlbmQoaSArIDEpOworICAgICAgICAgICAgYnVmZltpXS5hcHBlbmQoIiwgbnVtIHhhY3RzIGJ5IHdyaXRlciA9ICIpOworICAgICAgICAgICAgYnVmZltpXS5hcHBlbmQoZ2V0TnVtWGFjdHMoKSk7CisgICAgICAgICAgICBidWZmW2ldLmFwcGVuZCgiLCBudW0tcmVhZHMtaW4teGFjdC9OT1QtaW4teGFjdCBieSByZWFkZXIxID0gIik7CisgICAgICAgICAgICBidWZmW2ldLmFwcGVuZChjb3VudHNbMF1bMV0gKyAiLyIgKyBjb3VudHNbMF1bMF0pOworICAgICAgICAgICAgYnVmZltpXS5hcHBlbmQoIiwgYnkgcmVhZGVyMiA9ICIpOworICAgICAgICAgICAgYnVmZltpXS5hcHBlbmQoY291bnRzWzFdWzFdICsgIi8iICsgY291bnRzWzFdWzBdKTsKKworICAgICAgICAgICAgTG9nLmkoVEFHLCAiZG9uZSB0ZXN0aW5nIGZvciBjb25uLXBvb2wtc2l6ZSBvZiAiICsgKGkrMSkpOworCisgICAgICAgICAgICBkYlRlYXJkb3duKCk7CisgICAgICAgICAgICBkYlNldFVwKCk7CisgICAgICAgIH0KKyAgICAgICAgTG9nLmkoVEFHLCAiZHVyYXRpb24gb2YgdGVzdCAiICsgVElNRV9UT19SVU5fV0FMX1RFU1RfRk9SICsgIiBzZWMiKTsKKyAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBNOyBpKyspIHsKKyAgICAgICAgICAgIExvZy5pKFRBRywgYnVmZltpXS50b1N0cmluZygpKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgYm9vbGVhbiBpblhhY3QgPSBmYWxzZTsKKyAgICBwcml2YXRlIGludCBudW1YYWN0czsKKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgVElNRV9UT19SVU5fV0FMX1RFU1RfRk9SID0gMTU7IC8vIG51bSBzZWMgdGhpcyB0ZXN0IHNob3VsZCBydW4KKyAgICBwcml2YXRlIGludFtdW10gY291bnRzID0gbmV3IGludFsyXVsyXTsKKworICAgIHByaXZhdGUgc3luY2hyb25pemVkIGJvb2xlYW4gaW5YYWN0KCkgeworICAgICAgICByZXR1cm4gaW5YYWN0OworICAgIH0KKworICAgIHByaXZhdGUgc3luY2hyb25pemVkIHZvaWQgc2V0SW5YYWN0RmxhZyhib29sZWFuIGZsYWcpIHsKKyAgICAgICAgaW5YYWN0ID0gZmxhZzsKKyAgICB9CisKKyAgICBwcml2YXRlIHN5bmNocm9uaXplZCB2b2lkIHNldENvdW50cyhpbnQgcmVhZGVyTnVtLCBpbnRbXSBudW1SZWFkcykgeworICAgICAgICBjb3VudHNbcmVhZGVyTnVtXVswXSA9IG51bVJlYWRzWzBdOworICAgICAgICBjb3VudHNbcmVhZGVyTnVtXVsxXSA9IG51bVJlYWRzWzFdOworICAgIH0KKworICAgIHByaXZhdGUgc3luY2hyb25pemVkIGludFtdW10gZ2V0Q291bnRzKCkgeworICAgICAgICByZXR1cm4gY291bnRzOworICAgIH0KKworICAgIHByaXZhdGUgc3luY2hyb25pemVkIHZvaWQgc2V0TnVtWGFjdHMoaW50IG51bSkgeworICAgICAgICBudW1YYWN0cyA9IG51bTsKKyAgICB9CisKKyAgICBwcml2YXRlIHN5bmNocm9uaXplZCBpbnQgZ2V0TnVtWGFjdHMoKSB7CisgICAgICAgIHJldHVybiBudW1YYWN0czsKKyAgICB9CisKKyAgICBwcml2YXRlIGNsYXNzIFdyaXRlciBleHRlbmRzIFRocmVhZCB7CisgICAgICAgIHByaXZhdGUgU1FMaXRlRGF0YWJhc2UgZGIgPSBudWxsOworICAgICAgICBwdWJsaWMgV3JpdGVyKFNRTGl0ZURhdGFiYXNlIGRiKSB7CisgICAgICAgICAgICB0aGlzLmRiID0gZGI7CisgICAgICAgIH0KKyAgICAgICAgQE92ZXJyaWRlIHB1YmxpYyB2b2lkIHJ1bigpIHsKKyAgICAgICAgICAgIC8vIGluIGEgbG9vcCwgZm9yIE4gc2VjLCBkbyB0aGUgZm9sbG93aW5nCisgICAgICAgICAgICAvLyAgICBCRUdJTiB0cmFuc2FjdGlvbgorICAgICAgICAgICAgLy8gICAgaW5zZXJ0IGludG8gdGFibGUgdDEsIHQyCisgICAgICAgICAgICAvLyAgICBDb21taXQKKyAgICAgICAgICAgIGxvbmcgbm93ID0gU3lzdGVtLmN1cnJlbnRUaW1lTWlsbGlzKCk7CisgICAgICAgICAgICBpbnQgazsKKyAgICAgICAgICAgIGZvciAoayA9IDA7KFN5c3RlbS5jdXJyZW50VGltZU1pbGxpcygpIC0gbm93KSAvIDEwMDAgPCBUSU1FX1RPX1JVTl9XQUxfVEVTVF9GT1I7IGsrKykgeworICAgICAgICAgICAgICAgIGRiLmJlZ2luVHJhbnNhY3Rpb25Ob25FeGNsdXNpdmUoKTsKKyAgICAgICAgICAgICAgICBzZXRJblhhY3RGbGFnKHRydWUpOworICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgMTA7IGkrKykgeworICAgICAgICAgICAgICAgICAgICBkYi5leGVjU1FMKCJpbnNlcnQgaW50byB0MSB2YWx1ZXMoPyw/KTsiLCBuZXcgU3RyaW5nW10ge2krIiIsIGkrIiJ9KTsKKyAgICAgICAgICAgICAgICAgICAgZGIuZXhlY1NRTCgiaW5zZXJ0IGludG8gdDIgdmFsdWVzKD8sPyk7IiwgbmV3IFN0cmluZ1tdIHtpKyIiLCBpKyIifSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGRiLnNldFRyYW5zYWN0aW9uU3VjY2Vzc2Z1bCgpOworICAgICAgICAgICAgICAgIHNldEluWGFjdEZsYWcoZmFsc2UpOworICAgICAgICAgICAgICAgIGRiLmVuZFRyYW5zYWN0aW9uKCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBzZXROdW1YYWN0cyhrKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgY2xhc3MgUmVhZGVyIGV4dGVuZHMgVGhyZWFkIHsKKyAgICAgICAgcHJpdmF0ZSBTUUxpdGVEYXRhYmFzZSBkYiA9IG51bGw7CisgICAgICAgIHByaXZhdGUgU3RyaW5nIHRhYmxlID0gbnVsbDsKKyAgICAgICAgcHJpdmF0ZSBXcml0ZXIgdyA9IG51bGw7CisgICAgICAgIHByaXZhdGUgaW50IHJlYWRlck51bTsKKyAgICAgICAgcHJpdmF0ZSBpbnRbXSBudW1SZWFkcyA9IG5ldyBpbnRbMl07CisgICAgICAgIHB1YmxpYyBSZWFkZXIoU1FMaXRlRGF0YWJhc2UgZGIsIFN0cmluZyB0YWJsZSwgV3JpdGVyIHcsIGludCByZWFkZXJOdW0pIHsKKyAgICAgICAgICAgIHRoaXMuZGIgPSBkYjsKKyAgICAgICAgICAgIHRoaXMudGFibGUgPSB0YWJsZTsKKyAgICAgICAgICAgIHRoaXMudyA9IHc7CisgICAgICAgICAgICB0aGlzLnJlYWRlck51bSA9IHJlYWRlck51bTsKKyAgICAgICAgfQorICAgICAgICBAT3ZlcnJpZGUgcHVibGljIHZvaWQgcnVuKCkgeworICAgICAgICAgICAgLy8gd2hpbGUgdGhlIHdyaXRlIGlzIGFsaXZlLCBpbiBhIGxvb3AgZG8gdGhlIHF1ZXJ5IG9uIGEgdGFibGUKKyAgICAgICAgICAgIHdoaWxlICh3LmlzQWxpdmUoKSkgeworICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgMTA7IGkrKykgeworICAgICAgICAgICAgICAgICAgICBEYXRhYmFzZVV0aWxzLmxvbmdGb3JRdWVyeShkYiwgInNlbGVjdCBjb3VudCgqKSBmcm9tICIgKyB0aGlzLnRhYmxlLCBudWxsKTsKKyAgICAgICAgICAgICAgICAgICAgLy8gdXBkYXRlIGNvdW50IG9mIHJlYWRzCisgICAgICAgICAgICAgICAgICAgIG51bVJlYWRzW2luWGFjdCgpID8gMSA6IDBdICs9IDE7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgc2V0Q291bnRzKHJlYWRlck51bSwgbnVtUmVhZHMpOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHN0YXRpYyBjbGFzcyBDbGFzc1RvVGVzdFNxbENvbXBpbGF0aW9uQW5kQ2FjaGluZyBleHRlbmRzIFNRTGl0ZVByb2dyYW0geworICAgICAgICBwcml2YXRlIENsYXNzVG9UZXN0U3FsQ29tcGlsYXRpb25BbmRDYWNoaW5nKFNRTGl0ZURhdGFiYXNlIGRiLCBTdHJpbmcgc3FsKSB7CisgICAgICAgICAgICBzdXBlcihkYiwgc3FsKTsKKyAgICAgICAgfQorICAgICAgICBwdWJsaWMgc3RhdGljIENsYXNzVG9UZXN0U3FsQ29tcGlsYXRpb25BbmRDYWNoaW5nIGNyZWF0ZShTUUxpdGVEYXRhYmFzZSBkYiwgU3RyaW5nIHNxbCkgeworICAgICAgICAgICAgZGIubG9jaygpOworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICByZXR1cm4gbmV3IENsYXNzVG9UZXN0U3FsQ29tcGlsYXRpb25BbmRDYWNoaW5nKGRiLCBzcWwpOworICAgICAgICAgICAgfSBmaW5hbGx5IHsKKyAgICAgICAgICAgICAgICBkYi51bmxvY2soKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIEBTbWFsbFRlc3QKKyAgICBwdWJsaWMgdm9pZCB0ZXN0THJ1Q2FjaGluZ09mU3FsaXRlQ29tcGlsZWRTcWxPYmpzKCkgeworICAgICAgICBjcmVhdGVUYWJsZUFuZENsZWFyQ2FjaGUoKTsKKyAgICAgICAgLy8gc2V0IGN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NzVG9UZXN0U3FsQ29tcGlsYXRpb25BbmRDYWNoaW5nLmNyZWF0ZShtRGF0YWJhc2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgImluc2VydCBpbnRvIHRlc3QgdmFsdWVzKCIgKyBpICsgIiwgPyk7Iik7CisgICAgICAgICAgICAvLyBrZWVwIHRyYWNrIG9mIDB0aCBlbnRyeQorICAgICAgICAgICAgaWYgKGkgPT0gMCkgeworICAgICAgICAgICAgICAgIHN0bXQwSWQgPSBjLmdldFNxbFN0YXRlbWVudElkKCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjLmNsb3NlKCk7CisgICAgICAgIH0KKworICAgICAgICAvLyBhZGQgb25lIG1vcmUgdG8gdGhlIGNhY2hlIC0gYW5kIHRoZSBhYm92ZSAnc3RtdDBJZCcgc2hvdWxkIGZhbGwgb3V0IG9mIGNhY2hlCisgICAgICAgIENsYXNzVG9UZXN0U3FsQ29tcGlsYXRpb25BbmRDYWNoaW5nIHN0bXQxID0KKyAgICAgICAgICAgICAgICBDbGFzc1RvVGVzdFNxbENvbXBpbGF0aW9uQW5kQ2FjaGluZy5jcmVhdGUobURhdGFiYXNlLAorICAgICAgICAgICAgICAgICAgICAgICAgImluc2VydCBpbnRvIHRlc3QgdmFsdWVzKDEwMCwgPyk7Iik7CisgICAgICAgIHN0bXQxLmNsb3NlKCk7CisKKyAgICAgICAgLy8gdGhlIGFib3ZlIGNsb3NlKCkgc2hvdWxkIGhhdmUgcXVldWVkVXAgdGhlIHN0YXRlbWVudCBmb3IgZmluYWxpemF0aW9uCisgICAgICAgIEFycmF5TGlzdDxJbnRlZ2VyPiBzdGF0ZW1lbnRJZHMgPSBtRGF0YWJhc2UuZ2V0UXVldWVkVXBTdG10TGlzdCgpOworICAgICAgICBhc3NlcnRUcnVlKHN0YXRlbWVudElkcy5jb250YWlucyhzdG10MElkKSk7CisKKyAgICAgICAgLy8gZXhlY3V0ZSBzb21ldGhpbmcgdG8gc2VlIGlmIHRoaX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AgIFNRTGl0ZVN0YXRlbWVudCBzdG10OworICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgTjsgaSsrKSB7CisgICAgICAgICAgICAgICAgICAgIENsYXNzVG9UZXN0U3FsQ29tcGlsYXRpb25BbmRDYWNoaW5nIGMgPQorICAgICAgICAgICAgICAgICAgICAgICAgQ2xhc3NUb1Rlc3RTcWxDb21waWxhdGlvbkFuZENhY2hpbmcuY3JlYXRlKGdldERiKCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJpbnNlcnQgaW50byB0ZXN0IHZhbHVlcygiICsgaSArICIsID8pOyIpOworICAgICAgICAgICAgICAgICAgICAvLyBrZWVwIHRyYWNrIG9mIDB0aCBlbnRyeQorICAgICAgICAgICAgICAgICAgICBpZiAoaSA9PSAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBzdG10MElkID0gYy5nZXRTcWxTdGF0ZW1lbnRJZCgpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGMuY2xvc2UoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH07CisgICAgICAgIHQxLnN0YXJ0KCk7CisgICAgICAgIC8vIHdhaXQgZm9yIHRoZSB0aHJlYWQgdG8gZmluaXNoCisgICAgICAgIHQxLmpvaW4oKTsKKyAgICAgICAgLy8gbURhdGFiYXNlIHNob3VsZG4ndCBoYXZlIGFueSBzdGF0ZW1lbnRzIHRvIGJlIHJlbGVhc2VkCisgICAgICAgIGFzc2VydEVxdWFscygwLCBtRGF0YWJhc2UuZ2V0UXVldWVkVXBTdG10TGlzdCgpLnNpemUoKSk7CisKKyAgICAgICAgLy8gYWRkIG9uZSBtb3JlIHRvIHRoZSBjYWNoZSAtIGFuZCB0aGUgYWJvdmUgJ3N0bXQwSWQnIHNob3VsZCBmYWxsIG91dCBvZiBjYWNoZQorICAgICAgICAvLyBqdXN0IGZvciB0aGUgaGVjayBvZiBpdCwgZG8gaXQgaW4gYSBzZXBhcmF0ZSB0aHJlYWQKKyAgICAgICAgVGhyZWFkIHQyID0gbmV3IFRocmVhZCgpIHsKKyAgICAgICAgICAgIEBPdmVycmlkZSBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgICAgICAgICAgQ2xhc3NUb1Rlc3RTcWxDb21waWxhdGlvbkFuZENhY2hpbmcgc3RtdDEgPQorICAgICAgICAgICAgICAgICAgICBDbGFzc1RvVGVzdFNxbENvbXBpbGF0aW9uQW5kQ2FjaGluZy5jcmVhdGUoZ2V0RGIoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAiaW5zZXJ0IGludG8gdGVzdCB2YWx1ZXMoMTAwLCA/KTsiKTsKKyAgICAgICAgICAgICAgICBzdG10MS5iaW5kTG9uZygxLCAxKTsKKyAgICAgICAgICAgICAgICBzdG10MS5jbG9zZSgpOworICAgICAgICAgICAgfQorICAgICAgICB9OworICAgICAgICB0Mi5zdGFydCgpOworICAgICAgICB0Mi5qb2luKCk7CisKKyAgICAgICAgLy8gY2xvc2UoKSBpbiB0aGUgYWJvdmUgdGhyZWFkIHNob3VsZCBoYXZlIHF1ZXVlZFVwIHRoZSBzdG10MElkIGZvciBmaW5hbGl6YXRpb24KKyAgICAgICAgQXJyYXlMaXN0PEludGVnZXI+IHN0YXRlbWVudElkcyA9IGdldERiKCkuZ2V0UXVldWVkVXBTdG10TGlzdCgpOworICAgICAgICBhc3NlcnRUcnVlKHN0YXRlbWVudElkcy5jb250YWlucyhnZXRTdG10MElkKCkpKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKDEsIHN0YXRlbWVudElkcy5zaXplKCkpOworCisgICAgICAgIC8vIGV4ZWN1dGUgc29tZXRoaW5nIHRvIHNlZSBpZiB0aGlzIHN0YXRlbWVudCBnZXRzIGZpbmFsaXplZAorICAgICAgICAvLyBhZ2FpbiBkbyBpdCBpbiBhIHNlcGFyYXRlIHRocmVhZAorICAgICAgICBUaHJlYWQgdDMgP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HQxID0gbmV3IFRocmVhZCgpIHsKKyAgICAgICAgICAgIEBPdmVycmlkZSBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgICAgICAgICAgaW50IE4gPSBTUUxpdGVEYXRhYmFzZS5NQVhfU1FMX0NBQ0hFX1NJWkU7CisgICAgICAgICAgICAgICAgZ2V0RGIoKS5zZXRNYXhTcWxDYWNoZVNpemUoTik7CisgICAgICAgICAgICAgICAgU1FMaXRlU3RhdGVtZW50IHN0bXQ7CisgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBOOyBpICsrKSB7CisgICAgICAgICAgICAgICAgICAgIENsYXNzVG9UZXN0U3FsQ29tcGlsYXRpb25BbmRDYWNoaW5nIGMgPQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIENsYXNzVG9UZXN0U3FsQ29tcGlsYXRpb25BbmRDYWNoaW5nLmNyZWF0ZShnZXREYigpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImluc2VydCBpbnRvIHRlc3QgdmFsdWVzKCIgKyBpICsgIiwgPyk7Iik7CisgICAgICAgICAgICAgICAgICAgIC8vIGtlZXAgdHJhY2sgb2YgMHRoIGVudHJ5CisgICAgICAgICAgICAgICAgICAgIGlmIChpID09IDApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHN0bXQwSWQgPSBjLmdldFNxbFN0YXRlbWVudElkKCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgYy5jbG9zZSgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfTsKKyAgICAgICAgdDEuc3RhcnQoKTsKKyAgICAgICAgLy8gd2FpdCBmb3IgdGhlIHRocmVhZCB0byBmaW5pc2gKKyAgICAgICAgdDEuam9pbigpOworCisgICAgICAgIC8vIGFkZCBvbmUgbW9yZSB0byB0aGUgY2FjaGUgLSBhbmQgdGhlIGFib3ZlICdzdG10MElkJyBzaG91bGQgZmFsbCBvdXQgb2YgY2FjaGUKKyAgICAgICAgLy8ganVzdCBmb3IgdGhlIGhlY2sgb2YgaXQsIGRvIGl0IGluIGEgc2VwYXJhdGUgdGhyZWFkCisgICAgICAgIFRocmVhZCB0MiA9IG5ldyBUaHJlYWQoKSB7CisgICAgICAgICAgICBAT3ZlcnJpZGUgcHVibGljIHZvaWQgcnVuKCkgeworICAgICAgICAgICAgICAgIENsYXNzVG9UZXN0U3FsQ29tcGlsYXRpb25BbmRDYWNoaW5nIHN0bXQxID0KKyAgICAgICAgICAgICAgICAgICAgICAgIENsYXNzVG9UZXN0U3FsQ29tcGlsYXRpb25BbmRDYWNoaW5nLmNyZWF0ZShnZXREYigpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiaW5zZXJ0IGludG8gdGVzdCB2YWx1ZXMoMTAwLCA/KTsiKTsKKyAgICAgICAgICAgICAgICBzdG10MS5iaW5kTG9uZygxLCAxKTsKKyAgICAgICAgICAgICAgICBzdG10MS5jbG9zZSgpOworICAgICAgICAgICAgfQorICAgICAgICB9OworICAgICAgICB0Mi5zdGFydCgpOworICAgICAgICB0Mi5qb2luKCk7CisKKyAgICAgICAgLy8gY2xvc2UoKSBpbiB0aGUgYWJvdmUgdGhyZWFkIHNob3VsZCBoYXZlIHF1ZXVlZFVwIHRoZSBzdGF0ZW1lbnQgZm9yIGZpbmFsaXphdGlvbgorICAgICAgICBBcnJheUxpc3Q8SW50ZWdlcj4gc3RhdGVtZW50SWRzID0gZ2V0RGIoKS5nZXRRdWV1ZWRVcFN0bXRMaXN0KCk7CisgICAgICAgIGFzc2VydFRydWUoZ2V0U3RtdDBJZCgpID4gMCk7CisgICAgICAgIGFzc2VydFRydWUoc3RhdGVtZW50SWRzLmNvbnRhaW5zKHN0bXQwSWQpKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKDEsIHN0YXRlbWVudElkcy5zaXplKCkpOworCisgICAgICAgIC8vIGNsb3NlIHRoZSBkYXRhYmFzZS4gZXZlcnl0aGluZyBmcm9tIG1DbG9zZWRTdGF0ZW1lbnRJZHMgaW4gbURhdGFiYXNlCisgICAgICAgIC8vIHNob3VsZCBiZSBmaW5hbGl6ZWQgYW5kIGNsZWFyZWQgZnJvbSB0aGUgbGlzdAorICAgICAgICAvLyBhZ2FpbiBkbyBpdCBpbiBhIHNlcGFyYXRlIHRocmVhZAorICAgICAgICBUaHJlYWQgdDMgPSBuZXcgVGhyZWFkKCkgeworICAgICAgICAgICAgQE92ZXJyaWRlIHB1YmxpYyB2b2lkIHJ1bigpIHsKKyAgICAgICAgICAgICAgICBnZXREYigpLmNsb3NlKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH07CisgICAgICAgIHQzLnN0YXJ0KCk7CisgICAgICAgIHQzLmpvaW4oKTsKKworICAgICAgICAvLyBjaGVjayBtQ2xvc2VkU3RhdGVtZW50SWRzIGluIG1EYXRhYmFzZS4gaXQgc2hvdWxkIGJlIGVtcHR5CisgICAgICAgIHN0YXRlbWVudElkcyA9IGdldERiKCkuZ2V0UXVldWVkVXBTdG10TGlzdCgpOworICAgICAgICBhc3NlcnRFcXVhbHMoMCwgc3RhdGVtZW50SWRzLnNpemUoKSk7CisgICAgfQorCisgICAgLyoqCisgICAgICogVGhpcyB0ZXN0IHRlc3RzIHVzYWdlIGV4ZWNTUUwoKSB0byBiZWdpbiB0cmFuc2FjdGlvbiB3b3JrcyBpbiB0aGUgZm9sbG93aW5nIHdheQorICAgICAqICAgVGhyZWFkICMxIGRvZXMKKyAgICAgKiAgICAgICBleGVjU1FMKCJiZWdpbiB0cmFuc2FjdGlvbiIpOworICAgICAqICAgICAgIGluc2VydCgpCisgICAgICogICBUaHJlYWQgIyAyCisgICAgICogICAgICAgcXVlcnkoKQorICAgICAqICAgVGhyZWFkIzEgKCJlbmQgdHJhbnNhY3Rpb24iKQorICAgICAqIFRocmVhZCAjIDIgcXVlcnkgd2lsbCBleGVjdXRlIC0gYmVjYXVzZSBqYXZhIGxheWVyIHdp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AsIDk5OSk7Iik7CisgICAgICAgIGFzc2VydFRydWUobURhdGFiYXNlLmluVHJhbnNhY3Rpb24oKSk7CisgICAgICAgIGFzc2VydEZhbHNlKG1EYXRhYmFzZS5pc0RiTG9ja2VkQnlDdXJyZW50VGhyZWFkKCkpOworICAgICAgICBhc3NlcnRGYWxzZShtRGF0YWJhc2UuaXNEYkxvY2tlZEJ5T3RoZXJUaHJlYWRzKCkpOworICAgICAgICBhc3NlcnRUcnVlKG1EYXRhYmFzZS5hbUlJblRyYW5zYWN0aW9uKCkpOworICAgICAgICBUaHJlYWQgdCA9IG5ldyBUaHJlYWQoKSB7CisgICAgICAgICAgICBAT3ZlcnJpZGUgcHVibGljIHZvaWQgcnVuKCkgeworICAgICAgICAgICAgICAgIGFzc2VydFRydWUobURhdGFiYXNlLmFtSUluVHJhbnNhY3Rpb24oKSk7CisgICAgICAgICAgICAgICAgYXNzZXJ0RXF1YWxzKDk5OSwgRGF0YWJhc2VVdGlscy5sb25nRm9yUXVlcnkoZ2V0RGIoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICJzZWxlY3QgaiBmcm9tICIgKyBURVNUX1RBQkxFICsgIiBXSEVSRSBpID0gMTAiLCBudWxsKSk7CisgICAgICAgICAgICAgICAgYXNzZXJ0VHJ1ZShnZXREYigpLmluVHJhbnNhY3Rpb24oKSk7CisgICAgICAgICAgICAgICAgYXNzZXJ0RmFsc2UoZ2V0RGIoKS5pc0RiTG9ja2VkQnlDdXJyZW50VGhyZWFkKCkpOworICAgICAgICAgICAgICAgIGFzc2VydEZhbHNlKGdldERiKCkuaXNEYkxvY2tlZEJ5T3RoZXJUaHJlYWRzKCkpOworICAgICAgICAgICAgICAgIGFzc2VydFRydWUobURhdGFiYXNlLmFtSUluVHJhbnNhY3Rpb24oKSk7CisgICAgICAgICAgICB9CisgICAgICAgIH07CisgICAgICAgIHQuc3RhcnQoKTsKKyAgICAgICAgdC5qb2luKCk7CisgICAgICAgIGFzc2VydFRydWUobURhdGFiYXNlLmFtSUluVHJhbnNhY3Rpb24oKSk7CisgICAgICAgIGFzc2VydFRydWUobURhdGFiYXNlLmluVHJhbnNhY3Rpb24oKSk7CisgICAgICAgIGFzc2VydEZhbHNlKG1EYXRhYmFzZS5pc0RiTG9ja2VkQnlDdXJyZW50VGhyZWFkKCkpOworICAgICAgICBhc3NlcnRGYWxzZShtRGF0YWJhc2UuaXNEYkxvY2tlZEJ5T3RoZXJUaHJlYWRzKCkpOworICAgICAgICBtRGF0YWJhc2UuZXhlY1NRTChzdHIpOworICAgICAgICBhc3NlcnRGYWxzZShtRGF0YWJhc2UuYW1JSW5UcmFuc2FjdGlvbigpKTsKKyAgICAgICAgYXNzZXJ0RmFsc2UobURhdGFiYXNlLmluVHJhbnNhY3Rpb24oKSk7CisgICAgICAgIGFzc2VydEZhbHNlKG1EYXRhYmFzZS5pc0RiTG9ja2VkQnlDdXJyZW50VGhyZWFkKCkpOworICAgICAgICBhc3NlcnRGYWxzZShtRGF0YWJhc2UuaXNEYkxvY2tlZEJ5T3RoZXJUaHJlYWRzKCkpOworICAgIH0KKworICAgIC8qKgorICAgICAqIHRlc3QgdGhlIGZvbGxvd2luZworICAgICAqIGh0dHA6Ly9iL2lzc3VlP2lkPTI4NzEwMzcKKyAgICAgKiAgICAgICAgICBDdXJzb3IgY3Vyc29yID0gZGIucXVlcnkoLi4uKTsKKyAgICAgKiAgICAgICAgICAvLyB3aXRoIFdBTCBlbmFibGVkLCB0aGUgYWJvdmUgdXNlcyBhIHBvb2xlZCBkYXRhYmFzZSBjb25uZWN0aW9uCisgICAgICogICAgICAgICAgZGIuYmVnaW5UcmFuc2FjdGlvbigpCisgICAgICogICAgICAgICAgdHJ5IHsKKyAgICAgKiAgICAgICAgICAgIGRiLmluc2VydCguLi4uLi4pOworICAgICAqICAgICAgICAgICAgY3Vyc29yLnJlcXVlcnkoKTsKKyAgICAgKiAgICAgICAgICAgIC8vIHNpbmNlIHRoZSBjdXJzb3IgdXNlcyBwb29sZWQg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gbmV3IFRocmVhZCgpIHsKKyAgICAgICAgICAgICAgICBAT3ZlcnJpZGUgcHVibGljIHZvaWQgcnVuKCkgeworICAgICAgICAgICAgICAgICAgICBjMS5yZXF1ZXJ5KCk7CisgICAgICAgICAgICAgICAgICAgIGFzc2VydEVxdWFscygxLCBjMS5nZXRDb3VudCgpKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9OworICAgICAgICAgICAgdC5zdGFydCgpOworICAgICAgICAgICAgdC5qb2luKCk7CisgICAgICAgICAgICAvLyBzaG91bGQgYmUgMiByb3dzIG5vdyAtIGluY2x1ZGluZyB0aGUgdGhlIHJvdyBpbnNlcnRlZCBhYm92ZQorICAgICAgICAgICAgbURhdGFiYXNlLnNldFRyYW5zYWN0aW9uU3VjY2Vzc2Z1bCgpOworICAgICAgICB9IGZpbmFsbHkgeworICAgICAgICAgICAgbURhdGFiYXNlLmVuZFRyYW5zYWN0aW9uKCk7CisgICAgICAgIH0KKyAgICAgICAgYzEuY2xvc2UoKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBUaGlzIHRlc3QgaXMgc2FtZSBhcyB7QGxpbmsgI3Rlc3RUcmFuc2FjdGlvbkFuZFdhbEludGVycGxheTEoKX0gZXhjZXB0IHRoZSBmb2xsb3dpbmc6CisgICAgICogaW5zdGVhZCBvZiBtRGF0YWJhc2UuYmVnaW5UcmFuc2FjdGlvbk5vbkV4Y2x1c2l2ZSgpLCB1c2UgZXhlY1NRTCgiQkVHSU4gdHJhbnNhY3Rpb24iKQorICAgICAqIGFuZCBpbnN0ZWFkIG9mIG1EYXRhYmFzZS5lbmRUcmFuc2FjdGlvbigpLCB1c2UgZXhlY1NRTCgiRU5EIik7CisgICAgICovCisgICAgQFNtYWxsVGVzdAorICAgIHB1YmxpYyB2b2lkIHRlc3RUcmFuc2FjdGlvbkFuZFdhbEludGVycGxheTIoKSB0aHJvd3MgSW50ZXJydXB0ZWRFeGNlcHRpb24geworICAgICAgICBjcmVhdGV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3IncyBxdWVyeSBpcyBjb25zaWRlcmVkIHBhcnQgb2YKKyAgICAgICAgICAgIC8vIHRoZSBzYW1lIHRyYW5zYWN0aW9uIC0gYW5kIGhlbmNlIGl0IHNob3VsZCBzZWUgdGhlIGFib3ZlIGluc2VydGVkIHJvdworICAgICAgICAgICAgVGhyZWFkIHQgPSBuZXcgVGhyZWFkKCkgeworICAgICAgICAgICAgICAgIEBPdmVycmlkZSBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgICAgICAgICAgICAgIGMxLnJlcXVlcnkoKTsKKyAgICAgICAgICAgICAgICAgICAgYXNzZXJ0RXF1YWxzKDEsIGMxLmdldENvdW50KCkpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH07CisgICAgICAgICAgICB0LnN0YXJ0KCk7CisgICAgICAgICAgICB0LmpvaW4oKTsKKyAgICAgICAgICAgIC8vIHNob3VsZCBiZSAyIHJvd3Mgbm93IC0gaW5jbHVkaW5nIHRoZSB0aGUgcm93IGluc2VydGVkIGFib3ZlCisgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICBtRGF0YWJhc2UuZXhlY1NRTCgiY29tbWl0Iik7CisgICAgICAgIH0KKyAgICAgICAgYzEuY2xvc2UoKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBUaGlzIHRlc3QgaXMgc2FtZSBhcyB7QGxpbmsgI3Rlc3RUcmFuc2FjdGlvbkFuZFdhbEludGVycGxheTIoKX0gZXhjZXB0IHRoZSBmb2xsb3dpbmc6CisgICAgICogaW5zdGVhZCBvZiBjb21taXR0aW5nIHRoZSBkYXRhLCBkbyByb2xsYmFjayBhbmQgbWFrZSBzdXJlIHRoZSBkYXRhIHNlZW4gYnkgdGhlIHF1ZXJ5CisgICAgICogd2l0aGluIHRoZSB0cmFuc2FjdGlvbiBpcyBub3cgZ29uZS4KKyAgICAgKi8KKyAgICBAU21hbGxUZXN0CisgICAgcHVibGljIHZvaWQgdGVzdFRyYW5zYWN0aW9uQW5kV2FsSW50ZXJwbGF5MygpIHsKKyAgICAgICAgY3JlYXRlVGFibGVBbmRDbGVhckNhY2hlKCk7CisgICAgICAgIG1EYXRhYmFzZS5leGVjU1FMKCJJTlNFUlQgaW50byAiICsgVEVTVF9UQUJMRSArICIgdmFsdWVzKDEwLCA5OTkpOyIpOworICAgICAgICBTdHJpbmcgc3FsID0gInNlbGVjdCAqIGZyb20gIiArIFRFU1RfVEFCTEU7CisgICAgICAgIEN1cnNvciBjID0gbURhdGFiYXNlLnJhd1F1ZXJ5KHNxbCwgbnVsbCk7CisgICAgICAgIC8vIHNob3VsZCBoYXZlIDEgcm93IGluIHRoZSB0YWJsZQorICAgICAgICBhc3NlcnRFcXVhbHMoMSwgYy5nZXRDb3VudCgpKTsKKyAgICAgICAgbURhdGFiYXNlLmV4ZWNTUUwoIkJFR0lOIHRyYW5zYWN0aW9uIik7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBtRGF0YWJhc2UuZXhlY1NRTCgiSU5TRVJUIGludG8gIiArIFRFU1RfVEFCTEUgKyAiIHZhbHVlcygxMDAsIDk5MDkpOyIpOworICAgICAgICAgICAgYXNzZXJ0RXF1YWxzKDIsIERhdGFiYXNlVXRpbHMubG9uZ0ZvclF1ZXJ5KG1EYXRhYmFzZSwKKyAgICAgICAgICAgICAgICAgICAgInNlbGVjdCBjb3VudCgqKSBmcm9tICIgKyBURVNUX1RBQkxFLCBudWxsKSk7CisgICAgICAgICAgICAvLyByZXF1ZXJ5IG9uIHRoZSBwcmV2aW91c2x5IG9wZW5lZCBjdXJzb3IKKyAgICAgICAgICAgIC8vIGN1cnNvciBzaG91bGQgbm93IHVzZSB0aGUgbWFpbiBkYXRhYmFzZSBjb25uZWN0aW9uIGFuZCBzZWUgMiByb3dzCisgICAgICAgICAgICBjLnJlcXVlcnkoKTsKKyAgICAgICAgICAgIGFzc2VydEVxdWFscygyLCBjLmdldENvdW50KCkpOworICAgICAgICB9IGZpbmFsbHkgeworICAgICAgIC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ZLCBqIHRleHQpOyIpOworICAgICAgICBmaW5hbCBTdHJpbmcgc3RtdCA9ICJTRUxFQ1QgKiBGUk9NIHRlc3RfcHN0bXQgV0hFUkUgaSA9ID8iOworICAgICAgICBjbGFzcyBSdW5TdG10VGhyZWFkIGV4dGVuZHMgVGhyZWFkIHsKKyAgICAgICAgICAgIEBPdmVycmlkZSBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgICAgICAgICAgLy8gZG8gaXQgZW5vdWdoIHRpbWVzIHRvIG1ha2Ugc3VyZSB0aGVyZSBhcmUgbm8gY29ybmVyIGNhc2VzIGdvaW5nIHVudGVzdGVkCisgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCAxMDAwOyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgU1FMaXRlU3RhdGVtZW50IHMxID0gbURhdGFiYXNlLmNvbXBpbGVTdGF0ZW1lbnQoc3RtdCk7CisgICAgICAgICAgICAgICAgICAgIHMxLmJpbmRMb25nKDEsIGkpOworICAgICAgICAgICAgICAgICAgICBzMS5leGVjdXRlKCk7CisgICAgICAgICAgICAgICAgICAgIHMxLmNsb3NlKCk7CisgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBSdW5TdG10VGhyZWFkIHQxID0gbmV3IFJ1blN0bXRUaHJlYWQoKTsKKyAgICAgICAgdDEuc3RhcnQoKTsKKyAgICAgICAgUnVuU3RtdFRocmVhZCB0MiA9IG5ldyBSdW5TdG10VGhyZWFkKCk7CisgICAgICAgIHQyLnN0YXJ0KCk7CisgICAgICAgICB3aGlsZSAodDEuaXNBbGl2ZSgpIHx8IHQyLmlzQWxpdmUoKSkgeworICAgICAgICAgICAgIFRocmVhZC5zbGVlcCgxMCk7CisgICAgICAgICB9CisgICAgIH0KKworICAgIC8qKgorICAgICAqIEEgc2ltcGxlIHRlc3Q6IHN0YXJ0IDIgdGhyZWFkcyB0byByZXBlYXRlZGx5IGV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ICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgMTAwMDsgaSsrKSB7CisgICAgICAgICAgICAgICAgICAgIGxvY2soKTsKKyAgICAgICAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHMxLmJpbmRMb25nKDEsIGkpOworICAgICAgICAgICAgICAgICAgICAgICAgczEuZXhlY3V0ZSgpOworICAgICAgICAgICAgICAgICAgICB9IGZpbmFsbHkgeworICAgICAgICAgICAgICAgICAgICAgICAgdW5sb2NrKCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgVGhyZWFkLnlpZWxkKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIFJ1blN0bXRUaHJlYWQgdDEgPSBuZXcgUnVuU3RtdFRocmVhZCgpOworICAgICAgICB0MS5zdGFydCgpOworICAgICAgICBSdW5TdG10VGhyZWFkIHQyID0gbmV3IFJ1blN0bXRUaHJlYWQoKTsKKyAgICAgICAgdDIuc3RhcnQoKTsKKyAgICAgICAgd2hpbGUgKHQxLmlzQWxpdmUoKSB8fCB0Mi5pc0FsaXZlKCkpIHsKKyAgICAgICAgICAgIFRocmVhZC5zbGVlcCgxMCk7CisgICAgICAgIH0KKyAgICB9CisgICAgLyoqIFN5bmNocm9uaXplIG9uIHRoaXMgd2hlbiBhY2Nlc3NpbmcgdGhlIFNxbGl0ZVN0YXRlbWV0IGluIHRoZSBhYm92ZSAqLworICAgIHByaXZhdGUgZmluYWwgUmVlbnRyYW50TG9jayBtTG9jayA9IG5ldyBSZWVudHJhbnRMb2NrKHRydWUpOworICAgIHByaXZhdGUgdm9pZCBsb2NrKCkgeworICAgICAgICBtTG9jay5sb2NrKCk7CisgICAgfQorICAgIHByaXZhdGUgdm9pZCB1bmxvY2soKSB7CisgICAgICAgIG1Mb2NrLnVubG9jaygpOworICAgIH0KKworICAgIC8qKgorICAgICAqIFRlc3RzIHRoZ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nVzZSBpcyBmYWxzZSwgc2hvdWxkIGFsd2F5cyBiZSB0cnVlLCAjIiArIG1zZy53aGF0KSk7CisgICAgICAgICAgICB9CiAgICAgICAgICAgICBpZiAobUNvdW50IDw9IG1MYXN0TWVzc2FnZSkgewogICAgICAgICAgICAgICAgIGlmIChtc2cud2hhdCAhPSBtQ291bnQpIHsKICAgICAgICAgICAgICAgICAgICAgZmFpbHVyZShuZXcgUnVudGltZUV4Y2VwdGlvbigKQEAgLTk5LDUgKzEwMywxNzQgQEAKIAogICAgICAgICB0ZXN0ZXIuZG9UZXN0KDEwMDApOwogICAgIH0KLX0KIAorICAgIHByaXZhdGUgc3RhdGljIGNsYXNzIFRlc3RGaWVsZEludGVncml0eUhhbmRsZXIgZXh0ZW5kcyBUZXN0SGFuZGxlclRocmVhZCB7CisgICAgICAgIEhhbmRsZXIgbUhhbmRsZXI7CisgICAgICAgIGludCBtTGFzdE1lc3NhZ2U7CisgICAgICAgIGludCBtQ291bnQ7CisKKyAgICAgICAgcHVibGljIFRlc3RGaWVsZEludGVncml0eUhhbmRsZXIoKSB7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBnbygpIHsKKyAgICAgICAgICAgIG1IYW5kbGVyID0gbmV3IEhhbmRsZXIoKSB7CisgICAgICAgICAgICAgICAgcHVibGljIHZvaWQgaGFuZGxlTWVzc2FnZShNZXNzYWdlIG1zZykgeworICAgICAgICAgICAgICAgICAgICBUZXN0RmllbGRJbnRlZ3JpdHlIYW5kbGVyLnRoaXMuaGFuZGxlTWVzc2FnZShtc2cpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH07CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBoYW5kbGVNZXNzYWdlKE1lc3NhZ2UgbXNnKSB7CisgICAgICAgICAgICBpZiAoIW1zZy5pc0luVXNlKCkpIHsKKyAgICAgICAgICAgICAgICBmYWlsdXJlKG5ldyBSdW50aW1lRXhjZXB0aW9uKAorICAgICAgICAgICAgICAgICAgICAgICAgIm1zZy5pc0ludXNlIGlzIGZhbHNlLCBzaG91bGQgYWx3YXlzIGJlIHRydWUsICMiICsgbXNnLndoYXQpKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChtQ291bnQgPD0gbUxhc3RNZXNzYWdlKSB7CisgICAgICAgICAgICAgICAgaWYgKG1zZy53aGF0ICE9IG1Db3VudCkgeworICAgICAgICAgICAgICAgICAgICBmYWlsdXJlKG5ldyBSdW50aW1lRXhjZXB0aW9uKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICJFeHBlY3RlZCBtZXNzYWdlICMiICsgbUNvdW50CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArICIsIHJlY2VpdmVkICMiICsgbXNnLndoYXQpKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKG1Db3VudCA9PSBtTGFzdE1lc3NhZ2UpIHsKKyAgICAgICAgICAgICAgICAgICAgc3VjY2VzcygpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBtQ291bnQrKzsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgZmFpbHVyZShuZXcgUnVudGltZUV4Y2VwdGlvbigKKyAgICAgICAgICAgICAgICAgICAgICAgICJNZXNzYWdlIHJlY2VpdmVkIGFmdGVyIGRvbmUsICMiICsgbXNnLndoYXQpKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIEBNZWRpdW1UZXN0CisgICAgcHVibGljIHZvaWQgdGVzdEZpZWxkSW50ZWdyaXR5KCkgdGhyb3dzIEV4Y2VwdGlvbiB7CisKKyAgICAgICAgVGVzdEhhbmRsZXJUaHJlYWQgdGVzdGVyID0gbmV3IFRlc3RGaWVsZEludGVncml0eUhhbmRsZXIoKSB7CisgICAgICAgICAgICBCdW5kbGUgbUJ1bmRsZTsKKworICAgICAgICAgICAgcHVibGljIHZvaWQgZ28oKSB7CisgICAgICAgICAgICAgICAgc3VwZXIuZ28oKTsKKyAgICAgICAgICAgICAgICBtTGFzdE1lc3NhZ2UgPSAxOworICAgICAgICAgICAgICAgIG1Db3VudCA9IDA7CisgICAgICAgICAgICAgICAgbUhhbmRsZXIuc2VuZE1lc3NhZ2UobUhhbmRsZXIub2J0YWluTWVzc2FnZSgwKSk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHB1YmxpYyB2b2lkIGhhbmRsZU1lc3NhZ2UoTWVzc2FnZSBtc2cpIHsKKyAgICAgICAgICAgICAgICBzdXBlci5oYW5kbGVNZXNzYWdlKG1zZyk7CisgICAgICAgICAgICAgICAgaWYgKG1zZy53aGF0ID09IDApIHsKKyAgICAgICAgICAgICAgICAgICAgbXNnLmZsYWdzID0gLTE7CisgICAgICAgICAgICAgICAgICAgIG1zZy53aGF0ID0gMTsKKyAgICAgICAgICAgICAgICAgICAgbXNnLmFyZzEgPSA0NTY7CisgICAgICAgICAgICAgICAgICAgIG1zZy5hcmcyID0gNzg5OworICAgICAgICAgICAgICAgICAgICBtc2cub2JqID0gdGhpczsKKyAgICAgICAgICAgICAgICAgICAgbXNnLnJlcGx5VG8gPSBudWxsOworICAgICAgICAgICAgICAgICAgICBtQnVuZGxlID0gbmV3IEJ1bmRsZSgpOworICAgICAgICAgICAgICAgICAgICBtc2cuZGF0YSA9IG1CdW5kbGU7CisgICAgICAgICAgICAgICAgICAgIG1zZy5kYXRhLnB1dFN0cmluZygia2V5IiwgInZhbHVlIik7CisKKyAgICAgICAgICAgICAgICAgICAgTWVzc2FnZSBuZXdNc2cgPSBtSGFuZGxlci5vYnRhaW5NZXNzYWdlKCk7CisgICAgICAgICAgICAgICAgICAgIG5ld01zZy5jb3B5RnJvbShtc2cpOworICAgICAgICAgICAgICAgICAgICBpZiAobmV3TXNnLmlzSW5Vc2UoKSAhPSBmYWxzZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgZmFpbHVyZShuZXcgUnVudGltZUV4Y2VwdGlvbigKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIm5ld01zZy5pc0luVXNlIGlzIHRydWUgc2hvdWxkIGJlIGZhbHNlIGFmdGVyIGNvcHlGcm9tIikpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGlmIChuZXdNc2cuZmxhZ3MgIT0gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgZmFpbHVyZShuZXcgUnVudGltZUV4Y2VwdGlvbihTdHJpbmcuZm9ybWF0KAorICAgICAgICAgICAgICAgICAgICAgICAgIm5ld01zZy5mbGFncyBpcyAlZCBzaG91bGQgYmUgMCBhZnRlciBjb3B5RnJvbSIsIG5ld01zZy5mbGFncykpKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBpZiAobmV3TXNnLndoYXQgIT0gMSkgeworICAgICAgICAgICAgICAgICAgICAgICAgZmFpbHVyZShuZXcgUnVudGltZUV4Y2VwdGlvbihTdHJpbmcuZm9ybWF0KAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAibmV3TXNnLndoYXQgaXMgJWQgc2hvdWxkIGJlICVkIGFmdGVyIGNvcHlGcm9tIiwgbmV3TXNnLndoYXQsIDEpKSk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgaWYgKG5ld01zZy5hcmcxICE9IDQ1NikgeworICAgICAgICAgICAgICAgICAgICAgICAgZmFpbHVyZShuZXcgUnVudGltZUV4Y2VwdGlvbihTdHJpbmcuZm9ybWF0KAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAibmV3TXNnLmFyZzEgaXMgJWQgc2hvdWxkIGJlICVkIGFmdGVyIGNvcHlGcm9tIiwgbXNnLmFyZzEsIDQ1NikpKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBpZiAobmV3TXNnLmFyZzIgIT0gNzg5KSB7CisgICAgICAgICAgICAgICAgICAgICAgICBmYWlsdXJlKG5ldyBSdW50aW1lRXhjZXB0aW9uKFN0cmluZy5mb3JtYXQoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJuZXdNc2cuYXJnMiBpcyAlZCBzaG91bGQgYmUgJWQgYWZ0ZXIgY29weUZyb20iLCBtc2cuYXJnMiwgNzg5KSkpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGlmIChuZXdNc2cub2JqICE9IHRoaXMpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZhaWx1cmUobmV3IFJ1bnRpbWVFeGNlcHRpb24oCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJuZXdNc2cub2JqIHNob3VsZCBiZSAndGhpcycgYWZ0ZXIgY29weUZyb20iKSk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgaWYgKG5ld01zZy5yZXBseVRvICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZhaWx1cmUobmV3IFJ1bnRpbWVFeGNlcHRpb24oCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJuZXdNc2cucmVwbHlUbyBzaG91bGQgYmUgbnVsbCBhZnRlciBjb3B5RnJvbSIpKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBpZiAobmV3TXNnLmRhdGEgPT0gbUJ1bmRsZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgZmFpbHVyZShuZXcgUnVudGltZUV4Y2VwdGlvbigKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIm5ld01zZy5kYXRhIHNob3VsZCBOT1QgYmUgbUJ1bmRsZSBhZnRlciBjb3B5RnJvbSIpKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBpZiAoIW5ld01zZy5kYXRhLmdldFN0cmluZygia2V5IikuZXF1YWxzKG1CdW5kbGUuZ2V0U3RyaW5nKCJrZXkiKSkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZhaWx1cmUobmV3IFJ1bnRpbWVFeGNlcHRpb24oU3RyaW5nLmZvcm1hdCgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIm5ld01zZy5kYXRhLmdldFN0cmluZyhcImtleVwiKSBpcyAlcyBhbmQgZG9lcyBub3QgZXF1YWwiICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIiBtQnVuZGxlLmdldFN0cmluZyhcImtleVwiKSB3aGljaCBpcyAlcyBhZnRlciBjb3B5RnJvbSIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ld01zZy5kYXRhLmdldFN0cmluZygia2V5IiksICBtQnVuZGxlLmdldFN0cmluZygia2V5IikpKSk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgaWYgKG5ld01zZy53aGVuICE9IDApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZhaWx1cmUobmV3IFJ1bnRpbWVFeGNlcHRpb24oU3RyaW5nLmZvcm1hdCgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIm5ld01zZy53aGVuIGlzICVkIHNob3VsZCBiZSAwIGFmdGVyIGNvcHlGcm9tIiwgbmV3TXNnLndoZW4pKSk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgaWYgKG5ld01zZy50YXJnZXQgIT0gbUhhbmRsZXIpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZhaWx1cmUobmV3IFJ1bnRpbWVFeGNlcHRpb24oCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJuZXdNc2cudGFyZ2V0IGlzIE5PVCBtSGFuZGxlciBhZnRlciBjb3B5RnJvbSIpKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBpZiAobmV3TXNnLmNhbGxiYWNrICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZhaWx1cmUobmV3IFJ1bnRpbWVFeGNlcHRpb24oCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJuZXdNc2cuY2FsbGJhY2sgaXMgTk9UIG51bGwgYWZ0ZXIgY29weUZyb20iKSk7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICBtSGFuZGxlci5zZW5kTWVzc2FnZShuZXdNc2cpOworICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobXNnLndoYXQgPT0gMSkgeworICAgICAgICAgICAgICAgICAgICBpZiAobXNnLmlzSW5Vc2UoKSAhPSB0cnVlKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBmYWlsdXJlKG5ldyBSdW50aW1lRXhjZXB0aW9uKFN0cmluZy5mb3JtYXQoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJtc2cuaXNJblVzZSBpcyBmYWxzZSBzaG91bGQgYmUgdHJ1ZSBhZnRlciB3aGVuIHByb2Nlc3NpbmcgJWQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtc2cud2hhdCkpKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBpZiAobXNnLmFyZzEgIT0gNDU2KSB7CisgICAgICAgICAgICAgICAgICAgICAgICBmYWlsdXJlKG5ldyBSdW50aW1lRXhjZXB0aW9uKFN0cmluZy5mb3JtYXQoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJtc2cuYXJnMSBpcyAlZCBzaG91bGQgYmUgJWQgd2hlbiBwcm9jZXNzaW5nICMgJWQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtc2cuYXJnMSwgNDU2LCBtc2cud2hhdCkpKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBpZiAobXNnLmFyZzIgIT0gNzg5KSB7CisgICAgICAgICAgICAgICAgICAgICAgICBmYWlsdXJlKG5ldyBSdW50aW1lRXhjZXB0aW9uKFN0cmluZy5mb3JtYXQoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJtc2cuYXJnMiBpcyAlZCBzaG91bGQgYmUgJWQgd2hlbiBwcm9jZXNzaW5nICMgJWQiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtc2cuYXJnMiwgNzg5LCBtc2cud2hhdCkpKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBpZiAobXNnLm9iaiAhPSB0aGlzKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBmYWlsdXJlKG5ldyBSdW50aW1lRXhjZXB0aW9uKFN0cmluZy5mb3JtYXQoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJtc2cub2JqIHNob3VsZCBiZSAndGhpcycgd2hlbiBwcm9jZXNzaW5nICMgJWQiLCBtc2cud2hhdCkpKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBpZiAobXNnLnJlcGx5VG8gIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgZmFpbHVyZShuZXcgUnVudGltZUV4Y2VwdGlvbihTdHJpbmcuZm9ybWF0KAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAibXNnLnJlcGx5VG8gc2hvdWxkIGJlIG51bGwgd2hlbiBwcm9jZXNzaW5nICMgJWQiLCBtc2cud2hhdCkpKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBpZiAoIW1zZy5kYXRhLmdldFN0cmluZygia2V5IikuZXF1YWxzKG1CdW5kbGUuZ2V0U3RyaW5nKCJrZXkiKSkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZhaWx1cmUobmV3IFJ1bnRpbWVFeGNlcHRpb24oU3RyaW5nLmZvcm1hdCgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIm1zZy5kYXRhLmdldFN0cmluZyhcImtleVwiKSBpcyAlcyBhbmQgZG9lcyBub3QgZXF1YWwiICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIiBtQnVuZGxlLmdldFN0cmluZyhcImtleVwiKSB3aGljaCBpcyAlcyB3aGVuIHByb2Nlc3NpbmcgIyAlZCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1zZy5kYXRhLmdldFN0cmluZygia2V5IiksICBtQnVuZGxlLmdldFN0cmluZygia2V5IiksIG1zZy53aGF0KSkpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGlmIChtc2cud2hlbiAhPSAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBmYWlsdXJlKG5ldyBSdW50aW1lRXhjZXB0aW9uKFN0cmluZy5mb3JtYXQoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJtc2cud2hlbiBpcyAlZCBzaG91bGQgYmUgMCB3aGVuIHByb2Nlc3NpbmcgIyAlZCIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1zZy53aGVuLCBtc2cud2hhdCkpKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBpZiAobXNnLnRhcmdldCAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBmYWlsdXJlKG5ldyBSdW50aW1lRXhjZXB0aW9uKFN0cmluZy5mb3JtYXQoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJtc2cudGFyZ2V0IGlzIE5PVCBudWxsIHdoZW4gcHJvY2Vzc2luZyAjICVkIiwgbXNnLndoYXQpKSk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgaWYgKG1zZy5jYWxsYmFjayAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBmYWlsdXJlKG5ldyBSdW50aW1lRXhjZXB0aW9uKFN0cmluZy5mb3JtYXQoCisgICAgICAgICAgICAgICAgICAgICAgICAgICA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BvcnQoaW50IHZjYXJkVHlwZSkgewotICAgICAgICBtVmVyaWZpZXIuaW5pdEZvckV4cG9ydFRlc3QodmNhcmRUeXBlKTsKLSAgICAgICAgQ29udGFjdEVudHJ5IGVudHJ5ID0gbVZlcmlmaWVyLmFkZElucHV0RW50cnkoKTsKLSAgICAgICAgZW50cnkuYWRkQ29udGVudFZhbHVlcyhQaG9uZS5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLk5VTUJFUiwgIjEwIikKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLlRZUEUsIFBob25lLlRZUEVfSE9NRSk7Ci0gICAgICAgIGVudHJ5LmFkZENvbnRlbnRWYWx1ZXMoUGhvbmUuQ09OVEVOVF9JVEVNX1RZUEUpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5OVU1CRVIsICIyMCIpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5UWVBFLCBQaG9uZS5UWVBFX1dPUkspOwotICAgICAgICBlbnRyeS5hZGRDb250ZW50VmFsdWVzKFBob25lLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuTlVNQkVSLCAiMzAiKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuVFlQRSwgUGhvbmUuVFlQRV9GQVhfSE9NRSk7Ci0gICAgICAgIGVudHJ5LmFkZENvbnRlbnRWYWx1ZXMoUGhvbmUuQ09OVEVOVF9JVEVNX1RZUEUpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5OVU1CRVIsICI0MCIpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5UWVBFLCBQaG9uZS5UWVBFX0ZBWF9XT1JLKTsKLSAgICAgICAgZW50cnkuYWRkQ29udGVudFZhbHVlcyhQaG9uZS5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLk5VTUJFUiwgIjUwIikKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLlRZUEUsIFBob25lLlRZUEVfTU9CSUxFKTsKLSAgICAgICAgZW50cnkuYWRkQ29udGVudFZhbHVlcyhQaG9uZS5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLk5VTUJFUiwgIjYwIikKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLlRZUEUsIFBob25lLlRZUEVfUEFHRVIpOwotICAgICAgICBlbnRyeS5hZGRDb250ZW50VmFsdWVzKFBob25lLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuTlVNQkVSLCAiNzAiKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuVFlQRSwgUGhvbmUuVFlQRV9PVEhFUik7Ci0gICAgICAgIGVudHJ5LmFkZENvbnRlbnRWYWx1ZXMoUGhvbmUuQ09OVEVOVF9JVEVNX1RZUEUpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5OVU1CRVIsICI4MCIpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5UWVBFLCBQaG9uZS5UWVBFX0NBUik7Ci0gICAgICAgIGVudHJ5LmFkZENvbnRlbnRWYWx1ZXMoUGhvbmUuQ09OVEVOVF9JVEVNX1RZUEUpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5OVU1CRVIsICI5MCIpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5UWVBFLCBQaG9uZS5UWVBFX0NPTVBBTllfTUFJTik7Ci0gICAgICAgIGVudHJ5LmFkZENvbnRlbnRWYWx1ZXMoUGhvbmUuQ09OVEVOVF9JVEVNX1RZUEUpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5OVU1CRVIsICIxMDAiKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuVFlQRSwgUGhvbmUuVFlQRV9JU0ROKTsKLSAgICAgICAgZW50cnkuYWRkQ29udGVudFZhbHVlcyhQaG9uZS5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLk5VTUJFUiwgIjExMCIpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5UWVBFLCBQaG9uZS5UWVBFX01BSU4pOwotICAgICAgICBlbnRyeS5hZGRDb250ZW50VmFsdWVzKFBob25lLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuTlVNQkVSLCAiMTIwIikKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLlRZUEUsIFBob25lLlRZUEVfT1RIRVJfRkFYKTsKLSAgICAgICAgZW50cnkuYWRkQ29udGVudFZhbHVlcyhQaG9uZS5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLk5VTUJFUiwgIjEzMCIpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5UWVBFLCBQaG9uZS5UWVBFX1RFTEVYKTsKLSAgICAgICAgZW50cnkuYWRkQ29udGVudFZhbHVlcyhQaG9uZS5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLk5VTUJFUiwgIjE0MCIpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5UWVBFLCBQaG9uZS5UWVBFX1dPUktfTU9CSUxFKTsKLSAgICAgICAgZW50cnkuYWRkQ29udGVudFZhbHVlcyhQaG9uZS5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLk5VTUJFUiwgIjE1MCIpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5UWVBFLCBQaG9uZS5UWVBFX1dPUktfUEFHRVIpOwotICAgICAgICBlbnRyeS5hZGRDb250ZW50VmFsdWVzKFBob25lLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuTlVNQkVSLCAiMTYwIikKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLlR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0NvbW1vbihpbnQgdmNhcmRUeXBlKSB7Ci0gICAgICAgIG1WZXJpZmllci5pbml0Rm9yRXhwb3J0VGVzdCh2Y2FyZFR5cGUpOwotICAgICAgICBDb250YWN0RW50cnkgZW50cnkgPSBtVmVyaWZpZXIuYWRkSW5wdXRFbnRyeSgpOwotICAgICAgICBlbnRyeS5hZGRDb250ZW50VmFsdWVzKFBob25lLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuTlVNQkVSLCAiMSIpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5UWVBFLCBQaG9uZS5UWVBFX0hPTUUpOwotICAgICAgICBlbnRyeS5hZGRDb250ZW50VmFsdWVzKFBob25lLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuTlVNQkVSLCAiMiIpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5UWVBFLCBQaG9uZS5UWVBFX1dPUkspCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5JU19QUklNQVJZLCAxKTsKLSAgICAgICAgZW50cnkuYWRkQ29udGVudFZhbHVlcyhQaG9uZS5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLk5VTUJFUiwgIjMiKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuVFlQRSwgUGhvbmUuVFlQRV9GQVhfSE9NRSkKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLklTX1BSSU1BUlksIDEpOwotICAgICAgICBlbnRyeS5hZGRDb250ZW50VmFsdWVzKFBob25lLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuTlVNQkVSLCAiNCIpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5UWVBFLCBQaG9uZS5UWVBFX0ZBWF9XT1JLKTsKLQotICAgICAgICBtVmVyaWZpZXIuYWRkUHJvcGV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29udGVudFZhbHVlcyhQaG9uZS5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLk5VTUJFUiwgIjEiKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuVFlQRSwgUGhvbmUuVFlQRV9DVVNUT00pCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5MQUJFTCwgIk1vZGVtIik7Ci0gICAgICAgIGVudHJ5LmFkZENvbnRlbnRWYWx1ZXMoUGhvbmUuQ09OVEVOVF9JVEVNX1RZUEUpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5OVU1CRVIsICIyIikKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLlRZUEUsIFBob25lLlRZUEVfQ1VTVE9NKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuTEFCRUwsICJNU0ciKTsKLSAgICAgICAgZW50cnkuYWRkQ29udGVudFZhbHVlcyhQaG9uZS5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLk5VTUJFUiwgIjMiKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuVFlQRSwgUGhvbmUuVFlQRV9DVVNUT00pCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5MQUJFTCwgIkJCUyIpOwotICAgICAgICBlbnRyeS5hZGRDb250ZW50VmFsdWVzKFBob25lLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuTlVNQkVSLCAiNCIpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5UWVBFLCBQaG9uZS5UWVBFX0NVU1RPTSkKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLkxBQkVMLCAiVklERU8iKTsKLSAgICAgICAgZW50cnkuYWRkQ29udGVudFZhbHVlcyhQaG9uZS5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLk5VTUJFUiwgIjUiKQotICAgICA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9uLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoT3JnYW5pemF0aW9uLkNPTVBBTlksICJDb21wYW55WCIpCi0gICAgICAgICAgICAgICAgLnB1dChPcmdhbml6YXRpb24uREVQQVJUTUVOVCwgIkRlcGFydG1lbnRZIikKLSAgICAgICAgICAgICAgICAucHV0KE9yZ2FuaXphdGlvbi5USVRMRSwgIlRpdGxlWiIpCi0gICAgICAgICAgICAgICAgLnB1dChPcmdhbml6YXRpb24uSk9CX0RFU0NSSVBUSU9OLCAiRGVzY3JpcHRpb24gUmFtYmRhIikgIC8vIElnbm9yZWQuCi0gICAgICAgICAgICAgICAgLnB1dChPcmdhbml6YXRpb24uT0ZGSUNFX0xPQ0FUSU9OLCAiTW91bnRhaW4gVmlldyIpICAvLyBJZ25vcmVkLgotICAgICAgICAgICAgICAgIC5wdXQoT3JnYW5pemF0aW9uLlBIT05FVElDX05BTUUsICJQaG9uZXRpY05hbWUhIikgIC8vIElnbm9yZWQKLSAgICAgICAgICAgICAgICAucHV0KE9yZ2FuaXphdGlvbi5TWU1CT0wsICIoXm9eKS9+fiIpOyAgLy8gSWdub3JlIGhpbSAoaGVyKS4KLSAgICAgICAgZW50cnkuYWRkQ29udGVudFZhbHVlcyhPcmdhbml6YXRpb24uQ09OVEVOVF9JVEVNX1RZUEUpCi0gICAgICAgICAgICAgICAgLnB1dE51bGwoT3JnYW5pemF0aW9uLkNPTVBBTlkpCi0gICAgICAgICAgICAgICAgLnB1dChPcmdhbml6YXRpb24uREVQQVJUTUVOVCwgIkRlcGFydG1lbnRYWCIpCi0gICAgICAgICAgICAgICAgLnB1dE51bGwoT3JnYW5pemF0aW9uLlRJVExFKTsKLSAgICAgICAgZW50cnkuYWRkQ29udGVudFZhbHVlcyhPcmdhbml6YXRpb24uQ09OVEVOVF9JVEVNX1RZUEUpCi0gICAgICAgICAgICAgICAgLnB1dChPcmdhbml6YXRpb24uQ09NUEFOWSwgIkNvbXBhbnlY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9pZCB0ZXN0T3JnYW5pemF0aW9uVjQwKCkgewotICAgICAgICB0ZXN0T3JnYW5pemF0aW9uQ29tbW9uKFY0MCk7Ci0gICAgfQotCi0gICAgcHJpdmF0ZSB2b2lkIHRlc3RJbVZhcmlvdXNUeXBlU3VwcG9ydENvbW1vbihpbnQgdmNhcmRUeXBlKSB7Ci0gICAgICAgIG1WZXJpZmllci5pbml0Rm9yRXhwb3J0VGVzdCh2Y2FyZFR5cGUpOwotICAgICAgICBDb250YWN0RW50cnkgZW50cnkgPSBtVmVyaWZpZXIuYWRkSW5wdXRFbnRyeSgpOwotICAgICAgICBlbnRyeS5hZGRDb250ZW50VmFsdWVzKEltLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoSW0uUFJPVE9DT0wsIEltLlBST1RPQ09MX0FJTSkKLSAgICAgICAgICAgICAgICAucHV0KEltLkRBVEEsICJhaW0iKTsKLSAgICAgICAgZW50cnkuYWRkQ29udGVudFZhbHVlcyhJbS5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAucHV0KEltLlBST1RPQ09MLCBJbS5QUk9UT0NPTF9NU04pCi0gICAgICAgICAgICAgICAgLnB1dChJbS5EQVRBLCAibXNuIik7Ci0gICAgICAgIGVudHJ5LmFkZENvbnRlbnRWYWx1ZXMoSW0uQ09OVEVOVF9JVEVNX1RZUEUpCi0gICAgICAgICAgICAgICAgLnB1dChJbS5QUk9UT0NPTCwgSW0uUFJPVE9DT0xfWUFIT08pCi0gICAgICAgICAgICAgICAgLnB1dChJbS5EQVRBLCAieWFob28iKTsKLSAgICAgICAgZW50cnkuYWRkQ29udGVudFZhbHVlcyhJbS5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAucHV0KEltLlBST1RPQ09MLCBJbS5QUk9UT0NPTF9TS1lQRSkKLSAgICAgICAgICAgICAgICAucHV0KEltLkRBVEEsICJza3lwZSIpOwotICAgICAgICBlbnRyeS5hZGRDb250ZW50VmFsdWVzKEltLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoSW0uUFJPVE9DT0wsIEltLlBST1RPQ09MX1FRKQotICAgICAgICAgICAgICAgIC5wdXQoSW0uREFUQSwgInFxIik7Ci0gICAgICAgIGVudHJ5LmFkZENvbnRlbnRWYWx1ZXMoSW0uQ09OVEVOVF9JVEVNX1RZUEUpCi0gICAgICAgICAgICAgICAgLnB1dChJbS5QUk9UT0NPTCwgSW0uUFJPVE9DT0xfR09PR0xFX1RBTEspCi0gICAgICAgICAgICAgICAgLnB1dChJbS5EQVRBLCAiZ29vZ2xlIHRhbGsiKTsKLSAgICAgICAgZW50cnkuYWRkQ29udGVudFZhbHVlcyhJbS5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAucHV0KEltLlBST1RPQ09MLCBJbS5QUk9UT0NPTF9JQ1EpCi0gICAgICAgICAgICAgICAgLnB1dChJbS5EQVRBLCAiaWNxIik7Ci0gICAgICAgIGVudHJ5LmFkZENvbnRlbnRWYWx1ZXMoSW0uQ09OVEVOVF9JVEVNX1RZUEUpCi0gICAgICAgICAgICAgICAgLnB1dChJbS5QUk9UT0NPTCwgSW0uUFJPVE9DT0xfSkFCQkVSKQotICAgICAgICAgICAgICAgIC5wdXQoSW0uREFUQSwgImphYmJlciIpOwotICAgICAgICBlbnRyeS5hZGRDb250ZW50VmFsdWVzKEltLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoSW0uUFJPVE9DT0wsIEltLlBST1RPQ09MX05FVE1FRVRJTkcpCi0gICAgICAgICAgICAgICAgLnB1dChJbS5EQVRBLCAibmV0bWVldGluZyIpOwotCi0gICAgICAgIC8vIE5vIGRldGVybWluZWQgd2F5IHRvIGV4cHJlc3MgdW5rbm93biB0eXBlLi4uCi0gICAgICAgIG1WZXJpZmllci5hZGRQcm9wZXJ0eU5vZGVzVmVyaWZpZXJFbGVtV2l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EVOVF9JVEVNX1RZUEUsICIyMDE4LTAzLTEyIiwgRXZlbnQuVFlQRV9PVEhFUikpCi0gICAgICAgICAgICAgICAgLmFkZEV4cGVjdGVkTm9kZSgiWC1BTkRST0lELUNVU1RPTSIsCi0gICAgICAgICAgICAgICAgICAgICAgICBnZXRBbmRyb2lkUHJvcFZhbHVlKAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBFdmVudC5DT05URU5UX0lURU1fVFlQRSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIldoZW4gdGhlIFRvd2VyIG9mIEhhbm9pIHdpdGggNjQgcmluZ3MgaXMgY29tcGxldGVkLiIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEV2ZW50LlRZUEVfQ1VTVE9NLCAiVGhlIGxhc3QgZGF5IikpOwotICAgIH0KLQotICAgIHB1YmxpYyB2b2lkIHRlc3RFdmVudFYyMSgpIHsKLSAgICAgICAgdGVzdEV2ZW50Q29tbW9uKFYyMSk7Ci0gICAgfQotCi0gICAgcHVibGljIHZvaWQgdGVzdEV2ZW50VjMwKCkgewotICAgICAgICB0ZXN0RXZlbnRDb21tb24oVjMwKTsKLSAgICB9Ci0KLSAgICBwdWJsaWMgdm9pZCB0ZXN0RXZlbnRWNDAoKSB7Ci0gICAgICAgIHRlc3RFdmVudENvbW1vbihWNDApOwotICAgIH0KLQotICAgIHByaXZhdGUgdm9pZCB0ZXN0Tm90ZUNvbW1vbihpbnQgdmNhcmRUeXBlKSB7Ci0gICAgICAgIG1WZXJpZmllci5pbml0Rm9yRXhwb3J0VGVzdCh2Y2FyZFR5cGUpOwotICAgICAgICBDb250YWN0RW50cnkgZW50cnkgPSBtVmVyaWZpZXIuYWRkSW5wdXRFbnRyeSgpOwotICAgICAgICBlbnRyeS5hZGRDb250ZW50VmFsdWVzKE5vdGUuQ09OVEVOVF9JVEVNX1RZUEUpCi0gICAgICAgICAgICAgICAgLnB1dChOb3RlLk5PVEUsICJub3RlMSIp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k7Ci0gICAgICAgIG1WZXJpZmllci5hZGRDb250ZW50VmFsdWVzVmVyaWZpZXJFbGVtKCkKLSAgICAgICAgICAgICAgICAuYWRkRXhwZWN0ZWQoU3RydWN0dXJlZE5hbWUuQ09OVEVOVF9JVEVNX1RZUEUpCi0gICAgICAgICAgICAgICAgICAgICAgICAucHV0KFN0cnVjdHVyZWROYW1lLkZBTUlMWV9OQU1FLCAiQW5kbyIpCi0gICAgICAgICAgICAgICAgICAgICAgICAucHV0KFN0cnVjdHVyZWROYW1lLkdJVkVOX05BTUUsICJSb2lkIikKLSAgICAgICAgICAgICAgICAgICAgICAgIC5wdXQoU3RydWN0dXJlZE5hbWUuRElTUExBWV9OQU1FLCAiUm9pZCBBbmRvIik7Ci0gICAgfQotCi0gICAgcHVibGljIHZvaWQgdGVzdFYyMVNpbXBsZUNhc2UxX1R5cGVfSmFwYW5lc2UoKSB7Ci0gICAgICAgIG1WZXJpZmllci5pbml0Rm9ySW1wb3J0VGVzdChWQ2FyZENvbmZpZy5WQ0FSRF9UWVBFX1YyMV9KQVBBTkVTRSwgUi5yYXcudjIxX3NpbXBsZV8xKTsKLSAgICAgICAgbVZlcmlmaWVyLmFkZENvbnRlbnRWYWx1ZXNWZXJpZmllckVsZW0oKQotICAgICAgICAgICAgICAgIC5hZGRFeHBlY3RlZChTdHJ1Y3R1cmVkTmFtZS5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAgICAgICAgIC5wdXQoU3RydWN0dXJlZE5hbWUuRkFNSUxZX05BTUUsICJBbmRvIikKLSAgICAgICAgICAgICAgICAgICAgICAgIC5wdXQoU3RydWN0dXJlZE5hbWUuR0lWRU5fTkFNRSwgIlJvaWQiKQotICAgICAgICAgICAgICAgICAgICAgICAgLy8gSWYgbmFtZS1yZWxhdGVkIHN0cmluZ3Mgb25seSBjb250YWlucyBwcmludGFibGUgQXNjaWksCi0gICAgICAgICAgICAgICAgICAgICAgICAvLyB0aGUgb3JkZXIgaXMgcm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0dXJlZE5hbWUuQ09OVEVOVF9JVEVNX1RZUEUpCi0gICAgICAgICAgICAgICAgLnB1dChTdHJ1Y3R1cmVkTmFtZS5ESVNQTEFZX05BTUUsICJTbWl0aCIpOwotICAgICAgICBlbGVtLmFkZEV4cGVjdGVkKFBob25lLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuTlVNQkVSLCAiMSIpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5UWVBFLCBQaG9uZS5UWVBFX0hPTUUpOwotICAgICAgICBlbGVtLmFkZEV4cGVjdGVkKFBob25lLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuTlVNQkVSLCAiMiIpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5UWVBFLCBQaG9uZS5UWVBFX1dPUkspCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5JU19QUklNQVJZLCAxKTsKLSAgICAgICAgZWxlbS5hZGRFeHBlY3RlZChQaG9uZS5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLk5VTUJFUiwgIjMiKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuVFlQRSwgUGhvbmUuVFlQRV9JU0ROKTsKLSAgICAgICAgZWxlbS5hZGRFeHBlY3RlZChFbWFpbC5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAucHV0KEVtYWlsLkRBVEEsICJ0ZXN0QGV4YW1wbGUuY29tIikKLSAgICAgICAgICAgICAgICAucHV0KEVtYWlsLlRZUEUsIEVtYWlsLlRZUEVfSE9NRSkKLSAgICAgICAgICAgICAgICAucHV0KEVtYWlsLklTX1BSSU1BUlksIDEpOwotICAgICAgICBlbGVtLmFkZEV4cGVjdGVkKEVtYWlsLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoRW1haWwuREFUQSwgInRlc3QyQGV4YW1pbmF0aW9uLmNvbSIpCi0gICAgICAgICAgICAgICAgLnB1dChFbWFpbC5UWVBFLCBFbWFpbC5UWVBFX01PQklMRSkKLSAgICAgICAgICAgICAgICAucHV0KEVtYWlsLklTX1BSSU1BUlksIDEpOwotICAgICAgICBlbGVtLmFkZEV4cGVjdGVkKE9yZ2FuaXphdGlvbi5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAucHV0KE9yZ2FuaXphdGlvbi5DT01QQU5ZLCAiQ29tcGFueSIpCi0gICAgICAgICAgICAgICAgLnB1dChPcmdhbml6YXRpb24uVElUTEUsICJFbmdpbmVlciIpCi0gICAgICAgICAgICAgICAgLnB1dChPcmdhbml6YXRpb24uVFlQRSwgT3JnYW5pemF0aW9uLlRZUEVfV09SSyk7Ci0gICAgICAgIGVsZW0uYWRkRXhwZWN0ZWQoT3JnYW5pemF0aW9uLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoT3JnYW5pemF0aW9uLkNPTVBBTlksICJNeXN0ZXJ5IikKLSAgICAgICAgICAgICAgICAucHV0KE9yZ2FuaXphdGlvbi5USVRMRSwgIkJsb2dnZXIiKQotICAgICAgICAgICAgICAgIC5wdXQoT3JnYW5pemF0aW9uLlRZUEUsIE9yZ2FuaXphdGlvbi5UWVBFX1dPUkspOwotICAgICAgICBlbGVtLmFkZEV4cGVjdGVkKE9yZ2FuaXphdGlvbi5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAucHV0KE9yZ2FuaXphdGlvbi5DT01QQU5ZLCAiUG9ldHJ5IikKLSAgICAgICAgICAgICAgICAucHV0KE9yZ2FuaXphdGlvbi5USVRMRSwgIlBvZXQiKQotICAgICAgICAgICAgICAgIC5wdXQoT3JnYW5pemF0aW9uLlRZUEUsIE9yZ2FuaXphdGlvbi5UWVBFX1dPUkspOwotICAgIH0KLQotICAgIC8qKgotICAgICAqIFRlc3RzIGFsbCB0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AgICAgICAgICAgICAgICAgICAgICBudWxsLCBudWxsLCBuZXcgVHlwZVNldCgiV09SSyIpLCBudWxsKQotICAgICAgICAgICAgICAgIC5hZGRFeHBlY3RlZE5vZGVXaXRoT3JkZXIoIkxBQkVMIiwKLSAgICAgICAgICAgICAgICAgICAgICAgICIxMDAgV2F0ZXJzIEVkZ2VcclxuQmF5dG93biwgTEEgMzAzMTRcclxuVW5pdGVkICBTdGF0ZXMgb2YgQW1lcmljYSIsCi0gICAgICAgICAgICAgICAgICAgICAgICBudWxsLCBudWxsLCBtQ29udGVudFZhbHVlc0ZvclFQLCBuZXcgVHlwZVNldCgiV09SSyIpLCBudWxsKQotICAgICAgICAgICAgICAgIC5hZGRFeHBlY3RlZE5vZGVXaXRoT3JkZXIoIkFEUiIsCi0gICAgICAgICAgICAgICAgICAgICAgICAiOzs0MiBQbGFudGF0aW9uIFN0LjtCYXl0b3duO0xBOzMwMzE0O1VuaXRlZCBTdGF0ZXMgb2YgQW1lcmljYSIsCi0gICAgICAgICAgICAgICAgICAgICAgICBBcnJheXMuYXNMaXN0KCIiLCAiIiwgIjQyIFBsYW50YXRpb24gU3QuIiwgIkJheXRvd24iLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiTEEiLCAiMzAzMTQiLCAiVW5pdGVkIFN0YXRlcyBvZiBBbWVyaWNhIiksIG51bGwsIG51bGwsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBUeXBlU2V0KCJIT01FIiksIG51bGwpCi0gICAgICAgICAgICAgICAgLmFkZEV4cGVjdGVkTm9kZVdpdGhPcmRlcigiTEFCRUwiLAotICAgICAgICAgICAgICAgICAgICAgICAgIjQyIFBsYW50YXRpb24gU3QuXHJcbkJheXRvd24sIExBIDMwMzE0XHJcblVuaXRlZCAgU3RhdGVzIG9mIEFtZXJpY2EiLAotICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwgbnVsbCwgbUNvbnRlbnRWYWx1ZXNGb3JRUCwKLSAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBUeXBlU2V0KCJIT01FIiksIG51bGwpCi0gICAgICAgICAgICAgICAgLmFkZEV4cGVjdGVkTm9kZVdpdGhPcmRlcigiRU1BSUwiLCAiZm9ycmVzdGd1bXBAd2FsbGFkYWxsYS5jb20iLAotICAgICAgICAgICAgICAgICAgICAgICAgbmV3IFR5cGVTZXQoIlBSRUYiLCAiSU5URVJORVQiKSkKLSAgICAgICAgICAgICAgICAuYWRkRXhwZWN0ZWROb2RlV2l0aE9yZGVyKCJFTUFJTCIsICJjZWxsQGV4YW1wbGUuY29tIiwgbmV3IFR5cGVTZXQoIkNFTEwiKSkKLSAgICAgICAgICAgICAgICAuYWRkRXhwZWN0ZWROb2RlV2l0aE9yZGVyKCJOT1RFIiwKLSAgICAgICAgICAgICAgICAgICAgICAgICJUaGUgZm9sbG93aW5nIG5vdGUgaXMgdGhlIGV4YW1wbGUgZnJvbSBSRkMgMjA0NS4iKQotICAgICAgICAgICAgICAgIC5hZGRFeHBlY3RlZE5vZGVXaXRoT3JkZXIoIk5PVEUiLAotICAgICAgICAgICAgICAgICAgICAgICAgIk5vdydzIHRoZSB0aW1lIGZvciBhbGwgZm9sayB0byBjb21lIHRvIHRoZSBhaWQgb2YgdGhlaXIgY291bnRyeS4iLAotICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwgbnVsbCwgbUNvbnRlbnRWYWx1ZXNGb3JRUCwgbnVsbCwgbnVsbCkKLSAgICAgICAgICAgICAgICAuYWRkRXhwZWN0ZWROb2RlV2l0aE9yZGVyKCJQSE9UTyIsIG51bGwsCi0gICAgICAgICAgICAgICAgICAgICAgICBudWxsLCBzUGhvdG9CeXRlQXJyYXlGb3JDb21wbGljYXRlZENhc2UsIG1Db250ZW50VmFsdWVzRm9yQmFzZTY0VjIxLAotICAgICAgICAgICAgICAgICAgICAgICAgbmV3IFR5cGVTZXQoIkpQRUciKSwgbnVsbCkKLSAgICAgICAgICAgICAgICAuYWRkRX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TkFNRSwgIkZvcnJlc3QiKQotICAgICAgICAgICAgICAgIC5wdXQoU3RydWN0dXJlZE5hbWUuTUlERExFX05BTUUsICJIb2dlIikKLSAgICAgICAgICAgICAgICAucHV0KFN0cnVjdHVyZWROYW1lLlBSRUZJWCwgIlBvcyIpCi0gICAgICAgICAgICAgICAgLnB1dChTdHJ1Y3R1cmVkTmFtZS5TVUZGSVgsICJUYW8iKQotICAgICAgICAgICAgICAgIC5wdXQoU3RydWN0dXJlZE5hbWUuRElTUExBWV9OQU1FLCAiSm9lIER1ZSIpOwotICAgICAgICBlbGVtLmFkZEV4cGVjdGVkKE9yZ2FuaXphdGlvbi5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAucHV0KE9yZ2FuaXphdGlvbi5UWVBFLCBPcmdhbml6YXRpb24uVFlQRV9XT1JLKQotICAgICAgICAgICAgICAgIC5wdXQoT3JnYW5pemF0aW9uLkNPTVBBTlksICJHdW1wIFNocmltcCBDby4iKQotICAgICAgICAgICAgICAgIC5wdXQoT3JnYW5pemF0aW9uLkRFUEFSVE1FTlQsICJTYWxlcyBEZXB0LjtNYW5hZ2VyIEZpc2gga2VlcGVyIikKLSAgICAgICAgICAgICAgICAucHV0KE9yZ2FuaXphdGlvbi5USVRMRSwgIlNocmltcCBNYW4iKTsKLSAgICAgICAgZWxlbS5hZGRFeHBlY3RlZChQaG9uZS5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLlRZUEUsIFBob25lLlRZUEVfV09SSykKLSAgICAgICAgICAgICAgICAvLyBQaG9uZSBudW1iZXIgaXMgZXhwZWN0ZWQgdG8gYmUgZm9ybWF0ZWQgd2l0aCBOQU1QIGZvcm1hdCBpbiBkZWZhdWx0LgotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuTlVNQkVSLCAiMTExLTU1NS0xMjEyIik7Ci0gICAgICAgIGVsZW0uYWRkRXhwZWN0ZWQoUGhvbmUuQ09OVEVO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ZChTdHJ1Y3R1cmVkTmFtZS5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAucHV0KFN0cnVjdHVyZWROYW1lLkZBTUlMWV9OQU1FLCAiQW5kIikKLSAgICAgICAgICAgICAgICAucHV0KFN0cnVjdHVyZWROYW1lLkdJVkVOX05BTUUsICJSb2lkIikKLSAgICAgICAgICAgICAgICAucHV0KFN0cnVjdHVyZWROYW1lLkRJU1BMQVlfTkFNRSwgIkFuZCBSb2lkIikKLSAgICAgICAgICAgICAgICAucHV0KFN0cnVjdHVyZWROYW1lLlBIT05FVElDX0dJVkVOX05BTUUsICJhbmRyb2lkIik7Ci0gICAgICAgIGVsZW0uYWRkRXhwZWN0ZWQoT3JnYW5pemF0aW9uLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoT3JnYW5pemF0aW9uLkNPTVBBTlksICJPcGVuIikKLSAgICAgICAgICAgICAgICAucHV0KE9yZ2FuaXphdGlvbi5ERVBBUlRNRU5ULCAiSGFuZHNldCAgQWxsaWFuY2UiKQotICAgICAgICAgICAgICAgIC5wdXQoT3JnYW5pemF0aW9uLlRZUEUsIE9yZ2FuaXphdGlvbi5UWVBFX1dPUkspOwotICAgICAgICBlbGVtLmFkZEV4cGVjdGVkKFBob25lLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuVFlQRSwgUGhvbmUuVFlQRV9DVVNUT00pCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5MQUJFTCwgIlZPSUNFIikKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLk5VTUJFUiwgIjAzMC0wMDAtMDAwMCIpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5JU19QUklNQVJZLCAxKTsKLSAgICB9Ci0KLSAgICBwdWJsaWMgdm9pZCB0ZXN0VjIxSmFwYW5lc2UxX1BhcnNpbmcoKSB7Ci0gICAgICAgIC8vIFRob3VnaCBK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AgICAgICBtVmVyaWZpZXIuYWRkUHJvcGVydHlOb2Rlc1ZlcmlmaWVyRWxlbSgpCi0gICAgICAgICAgICAgICAgLmFkZEV4cGVjdGVkTm9kZVdpdGhPcmRlcigiTiIsICJcdTVCODlcdTg1RTQ7XHUzMEVEXHUzMEE0XHUzMEM5XHUwMDMxOzs7IiwKLSAgICAgICAgICAgICAgICAgICAgICAgIEFycmF5cy5hc0xpc3QoIlx1NUI4OVx1ODVFNCIsICJcdTMwRURcdTMwQTRcdTMwQzlcdTAwMzEiLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiIiwgIiIsICIiKSwKLSAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsIG1Db250ZW50VmFsdWVzRm9yU0ppcywgbnVsbCwgbnVsbCkKLSAgICAgICAgICAgICAgICAuYWRkRXhwZWN0ZWROb2RlV2l0aE9yZGVyKCJGTiIsICJcdTVCODlcdTg1RTRcdTAwMjBcdTMwRURcdTMwQTRcdTMwQzlcdTAwMjBcdTAwMzEiLAotICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwgbnVsbCwgbUNvbnRlbnRWYWx1ZXNGb3JTSmlzLCBudWxsLCBudWxsKQotICAgICAgICAgICAgICAgIC5hZGRFeHBlY3RlZE5vZGVXaXRoT3JkZXIoIlNPVU5EIiwKLSAgICAgICAgICAgICAgICAgICAgICAgICJcdUZGNzFcdUZGOURcdUZGODRcdUZGOUVcdUZGNzM7XHVGRjlCXHVGRjcyXHVGRjg0XHVGRjlFXHUwMDMxOzs7IiwKLSAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsIG51bGwsIG1Db250ZW50VmFsdWVzRm9yU0ppcywKLSAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBUeXBlU2V0KCJYLUlSTUMtTiIpLCBudWxsKQotICAgICAgICAgICAgICAgIC5hZGRFeHBlY3RlZE5vZGVXaXRoT3JkZXIoIkFEUiIsCi0gICAgICAgICAgICAgICAgICAgICAgICAiO1x1Njc3MVx1NEVBQ1x1OTBGRFx1NkUwQlx1OEMzN1x1NTMzQVx1Njg1QyIgKwotICAgICAgICAgICAgICAgICAgICAgICAgIlx1NEUxOFx1NzUzQVx1MDAzMlx1MDAzNlx1MDAyRFx1MDAzMVx1MzBCQiIgKwotICAgICAgICAgICAgICAgICAgICAgICAgIlx1MzBFQlx1MzBFQVx1MzBBMlx1MzBGM1x1MzBCRlx1MzBFRlx1MzBGQ1x1MDAzNiIgKwotICAgICAgICAgICAgICAgICAgICAgICAgIlx1OTY4RTs7OzsxNTAtODUxMjsiLAotICAgICAgICAgICAgICAgICAgICAgICAgQXJyYXlzLmFzTGlzdCgiIiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIlx1Njc3MVx1NEVBQ1x1OTBGRFx1NkUwQlx1OEMzN1x1NTMzQVx1Njg1QyIgKwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiXHU0RTE4XHU3NTNBXHUwMDMyXHUwMDM2XHUwMDJEXHUwMDMxXHUzMEJCIiArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJcdTMwRUJcdTMwRUFcdTMwQTJcdTMwRjNcdTMwQkZcdTMwRUZcdTMwRkMiICsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIlx1MDAzNlx1OTY4RSIsICIiLCAiIiwgIiIsICIxNTAtODUxMiIsICIiKSwKLSAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsIG1Db250ZW50VmFsdWVzRm9yUVBBbmRTSmlzLCBuZXcgVHlwZVNldCgiSE9NRSIpLCBudWxsKQotICAgICAgICAgICAgICAgIC5hZGRFeHBlY3RlZE5vZGVXaXRoT3JkZXIoIk5PVEUiLCAiXHUzMEUxXHUzMEUyIiwgbnVsbCwgbnVsbCwKLSAgICAgICAgICAgICAgICAgICAgICAgIG1Db250ZW50VmFsdWVzRm9yUVBBbmRTSmlzLCBudWxsLCBudWxsKTsKLSAgICB9Ci0KLSAgICBwdWJsaWMgd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ORVRJQ19HSVZFTl9OQU1FLCAiXHVGRjlCXHVGRjcyXHVGRjg0XHVGRjlFXHUwMDMxIik7Ci0gICAgICAgIGVsZW0uYWRkRXhwZWN0ZWQoU3RydWN0dXJlZFBvc3RhbC5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAucHV0KFN0cnVjdHVyZWRQb3N0YWwuUE9TVENPREUsICIxNTAtODUxMiIpCi0gICAgICAgICAgICAgICAgLnB1dChTdHJ1Y3R1cmVkUG9zdGFsLlNUUkVFVCwKLSAgICAgICAgICAgICAgICAgICAgICAgICJcdTY3NzFcdTRFQUNcdTkwRkRcdTZFMEJcdThDMzdcdTUzM0FcdTY4NUMiICsKLSAgICAgICAgICAgICAgICAgICAgICAgICJcdTRFMThcdTc1M0FcdTAwMzJcdTAwMzZcdTAwMkRcdTAwMzFcdTMwQkIiICsKLSAgICAgICAgICAgICAgICAgICAgICAgICJcdTMwRUJcdTMwRUFcdTMwQTJcdTMwRjNcdTMwQkZcdTMwRUZcdTMwRkMiICsKLSAgICAgICAgICAgICAgICAgICAgICAgICJcdTAwMzZcdTk2OEUiKQotICAgICAgICAgICAgICAgIC5wdXQoU3RydWN0dXJlZFBvc3RhbC5GT1JNQVRURURfQUREUkVTUywKLSAgICAgICAgICAgICAgICAgICAgICAgICJcdTY3NzFcdTRFQUNcdTkwRkRcdTZFMEJcdThDMzdcdTUzM0FcdTY4NUMiICsKLSAgICAgICAgICAgICAgICAgICAgICAgICJcdTRFMThcdTc1M0FcdTAwMzJcdTAwMzZcdTAwMkRcdTAwMzFcdTMwQkIiICsKLSAgICAgICAgICAgICAgICAgICAgICAgICJcdTMwRUJcdTMwRUFcdTMwQTJcdTMwRjNcdTMwQkZcdTMwRUZcdTMwRkMiICsKLSAgICAgICAgICAgICAgICAgICAgICAgICJcdTAwMzZcdTk2OEUgMTUwLTg1MTIiKQotICAgICAgICAgICAgICAgIC5wdXQoU3RydWN0dXJlZFBvc3RhbC5UWVBFLCBTdH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AgICAgICAgICAgICAgIC5wdXQoU3RydWN0dXJlZE5hbWUuUEhPTkVUSUNfR0lWRU5fTkFNRSwKLSAgICAgICAgICAgICAgICAgICAgICAgICJcdUZGNzFcdUZGOURcdUZGODRcdUZGOUVcdUZGNzNcdUZGOUJcdUZGNzJcdUZGODRcdUZGOUVcdTAwMzUiKTsKLSAgICAgICAgZWxlbS5hZGRFeHBlY3RlZChQaG9uZS5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLlRZUEUsIFBob25lLlRZUEVfQ1VTVE9NKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuTEFCRUwsICJORUMtQk9ZIikKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLk5VTUJFUiwgIjE3Iik7Ci0gICAgICAgIGVsZW0uYWRkRXhwZWN0ZWQoUGhvbmUuQ09OVEVOVF9JVEVNX1RZUEUpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5UWVBFLCBQaG9uZS5UWVBFX0NVU1RPTSkKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLkxBQkVMLCAiTkVDLUZSSUVORCIpCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5OVU1CRVIsICIxOCIpOwotICAgICAgICBlbGVtLmFkZEV4cGVjdGVkKFBob25lLkNPTlRFTlRfSVRFTV9UWVBFKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuVFlQRSwgUGhvbmUuVFlQRV9DVVNUT00pCi0gICAgICAgICAgICAgICAgLnB1dChQaG9uZS5MQUJFTCwgIk5FQy1QSFMiKQotICAgICAgICAgICAgICAgIC5wdXQoUGhvbmUuTlVNQkVSLCAiMTkiKTsKLSAgICAgICAgZWxlbS5hZGRFeHBlY3RlZChQaG9uZS5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAucHV0KFBob25lLlRZUEUsIFBob25lLlRZUEVfQ1VTVE9NKQotICAgICAgICAgICAgICAgIC5wdXQoU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cmVkTmFtZS5DT05URU5UX0lURU1fVFlQRSkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAucHV0KFN0cnVjdHVyZWROYW1lLkdJVkVOX05BTUUsICJBO0JcXCIpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgLnB1dChTdHJ1Y3R1cmVkTmFtZS5NSURETEVfTkFNRSwgIkNcXDsiKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5wdXQoU3RydWN0dXJlZE5hbWUuUFJFRklYLCAiRCIpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgLnB1dChTdHJ1Y3R1cmVkTmFtZS5TVUZGSVgsICI6RSIpOwotICAgICAgICAgICAgLy8gRElTUExBWV9OQU1FIGlzIG1pc3NpbmcuCi0gICAgICAgICAgICB2ZXJpZmllci52ZXJpZnkoKTsKLSAgICAgICAgfSBjYXRjaCAoQXNzZXJ0aW9uRmFpbGVkRXJyb3IgZSkgewotICAgICAgICAgICAgZmFpbHVyZURldGVjdGVkID0gdHJ1ZTsKLSAgICAgICAgfQotICAgICAgICBpZiAoIWZhaWx1cmVEZXRlY3RlZCkgewotICAgICAgICAgICAgVGVzdENhc2UuZmFpbCgiVGVzdCBjYXNlIHRoYXQgc2hvdWxkIGZhaWwgYWN0dWFsbHkgc3VjY2VlZGVkLiIpOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgcHVibGljIHZvaWQgdGVzdFNob3VsZEZhaWxBdExpbmVWZXJpZmljYXRpb24oKSB7Ci0gICAgICAgIGJvb2xlYW4gZmFpbHVyZURldGVjdGVkID0gZmFsc2U7Ci0gICAgICAgIHRyeSB7Ci0gICAgICAgICAgICBmaW5hbCBWQ2FyZFZlcmlmaWVyIHZlcmlmaWVyID0gbmV3IFZDYXJkVmVyaWZpZXIodGhpcyk7Ci0gICAgICAgICAgICB2ZXJpZmllci5pbml0Rm9yRXhwb3J0VGVzdChWQ2FyZENvbmZpZy5WQ0FSRF9UWVBFX1YzMF9HRU5FUklDKTsKLS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VmFsdWVzTGlzdCkgewotICAgICAgICAgICAgICAgICAgICBlbnRpdHkuYWRkU3ViVmFsdWUoRGF0YS5DT05URU5UX1VSSSwgY29udGVudFZhbHVlcyk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBtRW50aXR5TGlzdC5hZGQoZW50aXR5KTsKLSAgICAgICAgICAgIG1JdGVyYXRvciA9IG1FbnRpdHlMaXN0Lml0ZXJhdG9yKCk7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgYm9vbGVhbiBoYXNOZXh0KCkgewotICAgICAgICAgICAgcmV0dXJuIG1JdGVyYXRvci5oYXNOZXh0KCk7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgRW50aXR5IG5leHQoKSB7Ci0gICAgICAgICAgICByZXR1cm4gbUl0ZXJhdG9yLm5leHQoKTsKLSAgICAgICAgfQotCi0gICAgICAgIHB1YmxpYyB2b2lkIHJlbW92ZSgpIHsKLSAgICAgICAgICAgIHRocm93IG5ldyBVbnN1cHBvcnRlZE9wZXJhdGlvbkV4Y2VwdGlvbigicmVtb3ZlIG5vdCBzdXBwb3J0ZWQiKTsKLSAgICAgICAgfQotCi0gICAgICAgIHB1YmxpYyB2b2lkIHJlc2V0KCkgewotICAgICAgICAgICAgbUl0ZXJhdG9yID0gbUVudGl0eUxpc3QuaXRlcmF0b3IoKTsKLSAgICAgICAgfQotCi0gICAgICAgIHB1YmxpYyB2b2lkIGNsb3NlKCkgewotICAgICAgICB9Ci0gICAgfQotCi0gICAgcHVibGljIEV4cG9ydFRlc3RQcm92aWRlcihBbmRyb2lkVGVzdENhc2UgYW5kcm9pZFRlc3RDYXNlKSB7Ci0gICAgfQotCi0gICAgcHVibGljIENvbnRhY3RFbnRyeSBidWlsZElucHV0RW50cnkoKSB7Ci0gICAgICAgIENvbnRhY3RFbnRyeSBjb250YWN0RW50cnkgPSBuZXcgQ29udGFjdEVudHJ5KCk7Ci0gICAgICAgIG1Db250YWN0RW50cnlMaXN0L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gICBwdWJsaWMgaW50IGdldENvdW50KCkgewotICAgICAgICAgICAgICAgIHJldHVybiBtQ29udGFjdEVudHJ5TGlzdC5zaXplKCk7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIEBPdmVycmlkZQotICAgICAgICAgICAgcHVibGljIGJvb2xlYW4gbW92ZVRvRmlyc3QoKSB7Ci0gICAgICAgICAgICAgICAgbUN1cnJlbnRQb3NpdGlvbiA9IDA7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIEBPdmVycmlkZQotICAgICAgICAgICAgcHVibGljIGJvb2xlYW4gbW92ZVRvTmV4dCgpIHsKLSAgICAgICAgICAgICAgICBpZiAobUN1cnJlbnRQb3NpdGlvbiA8IG1Db250YWN0RW50cnlMaXN0LnNpemUoKSkgewotICAgICAgICAgICAgICAgICAgICBtQ3VycmVudFBvc2l0aW9uKys7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIEBPdmVycmlkZQotICAgICAgICAgICAgcHVibGljIGJvb2xlYW4gaXNCZWZvcmVGaXJzdCgpIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gbUN1cnJlbnRQb3NpdGlvbiA8IDA7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIEBPdmVycmlkZQotICAgICAgICAgICAgcHVibGljIGJvb2xlYW4gaXNBZnRlckxhc3QoKSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIG1DdXJyZW50UG9zaXRpb24gPj0gbUNvbnRhY3RFbnRyeUxpc3Quc2l6ZSgpOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBAT3ZlcnJpZGUKLSAgICAgICAgICAgIHB1Ym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3cKLSAgICAgICAgICAgICAgICAvLyByZXNvbHZlci1yZWxhdGVkIGNvZGUgaGFuZGxlcyBpdC4KLSAgICAgICAgICAgICAgICAvLyBIZXJlLCB3ZSBpZ25vcmUgdGhlc2UgaW1wbGVtZW50YXRpb24tZGVwZW5kZW50IHNwZWNzIGFuZAotICAgICAgICAgICAgICAgIC8vIGp1c3QgY2hlY2sgd2hldGhlciB2Q2FyZCBpbXBvcnRlciBjb3JyZWN0bHkgaW5zZXJ0cyByZWxsZXZlbnQgZGF0YS4KLSAgICAgICAgICAgICAgICBTZXQ8U3RyaW5nPiBrZXlUb0JlUmVtb3ZlZCA9IG5ldyBIYXNoU2V0PFN0cmluZz4oKTsKLSAgICAgICAgICAgICAgICBmb3IgKEVudHJ5PFN0cmluZywgT2JqZWN0PiBlbnRyeSA6IGFjdHVhbENvbnRlbnRWYWx1ZXMudmFsdWVTZXQoKSkgewotICAgICAgICAgICAgICAgICAgICBPYmplY3QgdmFsdWUgPSBlbnRyeS5nZXRWYWx1ZSgpOwotICAgICAgICAgICAgICAgICAgICBpZiAodmFsdWUgPT0gbnVsbCB8fCBUZXh0VXRpbHMuaXNFbXB0eSh2YWx1ZS50b1N0cmluZygpKSkgewotICAgICAgICAgICAgICAgICAgICAgICAga2V5VG9CZVJlbW92ZWQuYWRkKGVudHJ5LmdldEtleSgpKTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBmb3IgKFN0cmluZyBrZXk6IGtleVRvQmVSZW1vdmVkKSB7Ci0gICAgICAgICAgICAgICAgICAgIGFjdHVhbENvbnRlbnRWYWx1ZXMucmVtb3ZlKGtleSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIC8qIGZvciB0ZXN0aW5nCi0gICAgICAgICAgICAgICAgTG9nLmQoIkBAQCIsCi0gICAgICAgICAgICAgICAgICAgICAgICBTdHJpbmcuZm9ybWF0KCJNaW1lVHlwZTogJXMsIGRhdGE6ICVzIiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWltZVR5cGUsIGFjdHVhbENvbnRlbnRWYWx1ZXMudG9TdHJpbmcoKSkpOyAqLwotICAgICAgICAgICAgICAgIC8vIFJlbW92ZSBSQVdfQ09OVEFDVF9JRCBlbnRyeSBqdXN0IGZvciBzYWZldHksIHNpbmNlIHdlIGRvIG5vdCBjYXJlCi0gICAgICAgICAgICAgICAgLy8gaG93IHJlc29sdmVyLXJlbGF0ZWQgY29kZSBoYW5kbGVzIHRoZSBlbnRyeSBpbiB0aGlzIHVuaXQgdGVzdCwKLSAgICAgICAgICAgICAgICBpZiAoYWN0dWFsQ29udGVudFZhbHVlcy5jb250YWluc0tleShEYXRhLlJBV19DT05UQUNUX0lEKSkgewotICAgICAgICAgICAgICAgICAgICBhY3R1YWxDb250ZW50VmFsdWVzLnJlbW92ZShEYXRhLlJBV19DT05UQUNUX0lEKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgZmluYWwgQ29sbGVjdGlvbjxDb250ZW50VmFsdWVzPiBjb250ZW50VmFsdWVzQ29sbGVjdGlvbiA9Ci0gICAgICAgICAgICAgICAgICAgIG1NaW1lVHlwZVRvRXhwZWN0ZWRDb250ZW50VmFsdWVzLmdldChtaW1lVHlwZSk7Ci0gICAgICAgICAgICAgICAgaWYgKGNvbnRlbnRWYWx1ZXNDb2xsZWN0aW9uLmlzRW1wdHkoKSkgewotICAgICAgICAgICAgICAgICAgICBUZXN0Q2FzZS5mYWlsKCJDb250ZW50VmFsdWVzIGZvciBNaW1lVHlwZSAiICsgbWltZVR5cGUKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICArICIgaXMgbm90IGV4cGVjdGVkIGF0IGFsbCAoIiArIGFjdHVhbENvbnRlbnRWYWx1ZXMgKyAiKSIpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBib29sZWFuIGNoZWNrZWQgPSBmYWxzZTsKLSAgICAgICAgICAgICAgICBmb3IgKENvbnRlbnRWYWx1ZXMgZXhwZWN0ZWRDb250ZW50VmFsdWVzIDogY29udGVudFZhbHVlc0NvbGxlY3Rpb24pIHsKLSAgICAgICAgICAgICAgICAgICAgLypmb3IgdGVzdGluZwotICAgICAgICAgICAgICAgICAgICBMb2cuZCgiQEBAIiwgImV4cGVjdGVkOiAiCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgKyBjb252ZXJ0VG9FYXNpbHlSZWFkYWJsZVN0cmluZyhleHBlY3RlZENvbnRlbnRWYWx1ZXMpKTsKLSAgICAgICAgICAgICAgICAgICAgTG9nLmQoIkBAQCIsICJhY3R1YWwgIDogIgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgY29udmVydFRvRWFzaWx5UmVhZGFibGVTdHJpbmcoYWN0dWFsQ29udGVudFZhbHVlcykpOyovCi0gICAgICAgICAgICAgICAgICAgIGlmIChlcXVhbHNGb3JDb250ZW50VmFsdWVzKGV4cGVjdGVkQ29udGVudFZhbHVlcywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBhY3R1YWxDb250ZW50VmFsdWVzKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgVGVzdENhc2UuYXNzZXJ0VHJ1ZShjb250ZW50VmFsdWVzQ29sbGVjdGlvbi5yZW1vdmUoZXhwZWN0ZWRDb250ZW50VmFsdWVzKSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBjaGVja2VkID0gdHJ1ZTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGlmICghY2hlY2tlZCkgewotICAgICAgICAgICAgICAgICAgICBmaW5hbCBTdHJpbmdCdWlsZGVyIGJ1aWxkZXIgPSBuZXcgU3RyaW5nQnVpbGRlcigpOwotICAgICAgICAgICAgICAgICAgICBidWlsZGVyLmFwcGVuZCgiXG4iKTsKLSAgICAgICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQoIlVuZXhwZWN0ZWQ6ICIpOwotICAgICAgICAgICAgICAgICAgICBidWlsZGVyLmFwcGVuZChjb252ZXJ0VG9FYXNpbHlSZWFkYWJsZVN0cmluZyhhY3R1YWxDb250ZW50VmFsdWVzKSk7Ci0gICAgICAgICAgICAgICAgICAgIGJ1aWxkZXIuYXBwZW5kKCJcbiIpOwotICAgICAgICAgICAgICAgICAgICBidWlsZGVyLmFwcGVuZCgiRXhwZWN0ZWQgIDogIik7Ci0gICAgICAgICAgICAgICAgICAgIGZvciAoQ29udGVudFZhbHVlcyBleHBlY3RlZENvbnRlbnRWYWx1ZXMgOiBjb250ZW50VmFsdWVzQ29sbGVjdGlvbikgewotICAgICAgICAgICAgICAgICAgICAgICAgYnVpbGRlci5hcHBlbmQoY29udmVydFRvRWFzaWx5UmVhZGFibGVTdHJpbmcoZXhwZWN0ZWRDb250ZW50VmFsdWVzKSk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgVGVzdENhc2UuZmFpbChidWlsZGVyLnRvU3RyaW5nKCkpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgVGVzdENhc2UuZmFpbCgiVW5leHBlY3RlZCBVcmkgaGFzIGNvbWU6ICIgKyB1cmkpOwotICAgICAgICAgICAgfQotICAgICAgICB9ICAvLyBmb3IgKGludCBpID0gMDsgaSA8IHNpemU7IGkrKykgewotICAgICAgICByZXR1cm4gZmFrZVJlc3VsdEFycmF5OwotICAgIH0KLQotICAgIHB1YmxpYyB2b2lkIHZlcmlmeSgpIHsKLSAgICAgICAgU3RyaW5nQnVpbGRlciBidWlsZGVyID0gbmV3IFN0cmluZ0J1aWxkZXIoKTsKLSAgICAgICAgZm9yIChDb2xsZWN0aW9uPENvbnRlbnRWYWx1ZXM+IGNvbnRlbnRWYWx1ZXNDb2xsZWN0aW9uIDoKLSAgICAgICAgICAgICAgICBtTWltZVR5cGVUb0V4cGVjdGVkQ29udGVudFZhbHVlcy52YWx1ZXMoKSkgewotICAgICAgICAgICAgZm9yIChDb250ZW50VmFsdWVzIGV4cGVjdGVkQ29udGVudFZhbHVlczogY29udGVudFZhbHVlc0NvbGxlY3Rpb24pIHsKLSAgICAgICAgICAgICAgICBidWlsZGVyLmFwcGVuZChjb252ZXJ0VG9FYXNpbHlSZWFkYWJsZVN0cmluZyhleHBlY3RlZENvbnRlbnRWYWx1ZXMpKTsKLSAgICAgICAgICAgICAgICBidWlsZGVyLmFwcGVuZCgiXG4iKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgICAgICBpZiAoYnVpbGRlci5sZW5ndGgoKSA+IDApIHsKLSAgICAgICAgICAgIGZpbmFsIFN0cmluZyBmYWlsTXNnID0KLSAgICAgICAgICAgICAgICAiVGhlcmUgaXMoYXJlKSByZW1haW5pbmcgZXhwZWN0ZWQgQ29udGVudFZhbHVlcyBpbnN0YW5jZShzKTogXG4iCi0gICAgICAgICAgICAgICAgICAgICsgYnVpbGRlci50b1N0cmluZygpOwotICAgICAgICAgICAgVGVzdENhc2UuZmFpbChmYWlsTXNnKTsKLSAgICAgICAgfQotICAgIH0KLQotICAgIC8qKgotICAgICAqIFV0aWxpdHkgbWV0aG9kIHRvIHByaW50IENvbnRlbnRWYWx1ZXMgd2hvc2UgY29udGVudCBpcyBwcmludGVkIHdpdGggc29ydGVkIGtleXMuCi0gICAgICovCi0gICAgcHJpdmF0ZSBTdHJpbmcgY29udmVydFRvRWFzaWx5UmVhZGFibGVTdHJpbmcoQ29udGVudFZhbHVlcyBjb250ZW50VmFsdWVzKSB7Ci0gICAgICAgIGlmIChjb250ZW50VmFsdWVzID09IG51bGwpIHsKLSAgICAgICAgICAgIHJldHVybiAibnVsbCI7Ci0gICAgICAgIH0KLSAgICAgICAgU3RyaW5nIG1pbWVUeXBlVmFsdWUgPSAiIjsKLSAgICAgICAgU29ydGVkTWFwPF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BTdHJpbmcgdmNhcmQpIHsKLSAgICAgICAgZmluYWwgU3RyaW5nW10gbGluZUFycmF5ID0gdmNhcmQuc3BsaXQoIlxccj9cXG4iKTsKLSAgICAgICAgZmluYWwgaW50IGxlbmd0aCA9IGxpbmVBcnJheS5sZW5ndGg7Ci0gICAgICAgIGJvb2xlYW4gYmVnaW5FeGlzdHMgPSBmYWxzZTsKLSAgICAgICAgYm9vbGVhbiBlbmRFeGlzdHMgPSBmYWxzZTsKLSAgICAgICAgYm9vbGVhbiB2ZXJzaW9uRXhpc3RzID0gZmFsc2U7Ci0KLSAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBsZW5ndGg7IGkrKykgewotICAgICAgICAgICAgZmluYWwgU3RyaW5nIGxpbmUgPSBsaW5lQXJyYXlbaV07Ci0gICAgICAgICAgICBpZiAoVGV4dFV0aWxzLmlzRW1wdHkobGluZSkpIHsKLSAgICAgICAgICAgICAgICBjb250aW51ZTsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgaWYgKCJCRUdJTjpWQ0FSRCIuZXF1YWxzSWdub3JlQ2FzZShsaW5lKSkgewotICAgICAgICAgICAgICAgIGlmIChiZWdpbkV4aXN0cykgewotICAgICAgICAgICAgICAgICAgICBUZXN0Q2FzZS5mYWlsKCJNdWx0aXBsZSBcIkJFR0lOOlZDQVJEXCIgbGluZSBmb3VuZCIpOwotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIGJlZ2luRXhpc3RzID0gdHJ1ZTsKLSAgICAgICAgICAgICAgICAgICAgY29udGludWU7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfSBlbHNlIGlmICgiRU5EOlZDQVJEIi5lcXVhbHNJZ25vcmVDYXNlKGxpbmUpKSB7Ci0gICAgICAgICAgICAgICAgaWYgKGVuZEV4aXN0cykgewotICAgICAgICAgICAgICAgICAgICBUZXN0Q2FzZS5mYWlsKCJNdWx0aXBsZSBcIkVORDpWQ0FSRFwiIGxpbmUgZm91bmQiKTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBlbmRFeGlzdHMgPSB0cnVlOwotICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9IGVsc2UgaWYgKChWQ2FyZENvbmZpZy5pc1ZlcnNpb24yMShtVkNhcmRUeXBlKSA/ICJWRVJTSU9OOjIuMSIgOgotICAgICAgICAgICAgICAgIChWQ2FyZENvbmZpZy5pc1ZlcnNpb24zMChtVkNhcmRUeXBlKSA/ICJWRVJTSU9OOjMuMCIgOgotICAgICAgICAgICAgICAgICAgICAiVkVSU0lPTjo0LjAiKSkuZXF1YWxzSWdub3JlQ2FzZShsaW5lKSkgewotICAgICAgICAgICAgICAgIGlmICh2ZXJzaW9uRXhpc3RzKSB7Ci0gICAgICAgICAgICAgICAgICAgIFRlc3RDYXNlLmZhaWwoIk11bHRpcGxlIFZFUlNJT04gbGluZSArIGZvdW5kIik7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgdmVyc2lvbkV4aXN0cyA9IHRydWU7Ci0gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgaWYgKCFiZWdpbkV4aXN0cykgewotICAgICAgICAgICAgICAgIFRlc3RDYXNlLmZhaWwoIlByb3BlcnR5IG90aGVyIHRoYW4gQkVHSU4gY2FtZSBiZWZvcmUgQkVHSU4gcHJvcGVydHk6ICIgKyBsaW5lKTsKLSAgICAgICAgICAgIH0gZWxzZSBpZiAoZW5kRXhpc3RzKSB7Ci0gICAgICAgICAgICAgICAgVGVzdENhc2UuZmFpbCgiUHJvcGVydHkgb3RoZXIgdGhhbiBFTkQgY2FtZSBhZnRlciBFTkQgcHJvcGVydHk6ICIgKyBsaW5lKTsKLSAgICAgIC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kZXJlZE5vZGVNYXAudmFsdWVzKCkpIHsKLSAgICAgICAgICAgICAgICBmb3IgKFByb3BlcnR5Tm9kZSBub2RlIDogbm9kZXMpIHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKCFleHBlY3RlZFByb3BzLmNvbnRhaW5zKG5vZGUucHJvcE5hbWUpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBleHBlY3RlZFByb3BzLmFkZChub2RlLnByb3BOYW1lKTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGZvciAoUHJvcGVydHlOb2RlIG5vZGUgOiBtVW5vcmRlcmVkTm9kZUxpc3QpIHsKLSAgICAgICAgICAgICAgICBpZiAoIWV4cGVjdGVkUHJvcHMuY29udGFpbnMobm9kZS5wcm9wTmFtZSkpIHsKLSAgICAgICAgICAgICAgICAgICAgZXhwZWN0ZWRQcm9wcy5hZGQobm9kZS5wcm9wTmFtZSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICAgICAgVGVzdENhc2UuZmFpbCgiRXhwZWN0ZWQgcHJvcGVydHkgIiArIEFycmF5cy50b1N0cmluZyhleHBlY3RlZFByb3BzLnRvQXJyYXkoKSkKLSAgICAgICAgICAgICAgICAgICAgKyAiIHdhcyBub3QgZm91bmQuIik7Ci0gICAgICAgIH0KLSAgICB9Ci0KLSAgICBwcml2YXRlIHZvaWQgdmVyaWZ5Tm9kZShmaW5hbCBTdHJpbmcgcHJvcE5hbWUsIGZpbmFsIFByb3BlcnR5Tm9kZSBhY3R1YWxOb2RlKSB7Ci0gICAgICAgIGZpbmFsIExpc3Q8UHJvcGVydHlOb2RlPiBleHBlY3RlZE5vZGVMaXN0ID0gbU9yZGVyZWROb2RlTWFwLmdldChwcm9wTmFtZSk7Ci0gICAgICAgIGZpbmFsIGludCBzaXplID0gKGV4cGVjdGVkTm9kZUxpc3QgIT0gbnVsbCA/IGV4cGVjdGVkTm9kZUxpc3Quc2l6ZSgpIDogMCk7Ci0gICAgICAgIGlmIChzaXplID4gMCkgewotICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBzaXplOyBpKyspIHsKLSAgICAgICAgICAgICAgICBmaW5hbCBQcm9wZXJ0eU5vZGUgZXhwZWN0ZWROb2RlID0gZXhwZWN0ZWROb2RlTGlzdC5nZXQoaSk7Ci0gICAgICAgICAgICAgICAgZmluYWwgTGlzdDxQcm9wZXJ0eU5vZGU+IGV4cGVjdGVkQnV0RGlmZmVyZW50VmFsdWVMaXN0ID0KLSAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBBcnJheUxpc3Q8UHJvcGVydHlOb2RlPigpOwotICAgICAgICAgICAgICAgIGlmIChleHBlY3RlZE5vZGUucHJvcE5hbWUuZXF1YWxzKHByb3BOYW1lKSkgewotICAgICAgICAgICAgICAgICAgICBpZiAoZXhwZWN0ZWROb2RlLmVxdWFscyhhY3R1YWxOb2RlKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgZXhwZWN0ZWROb2RlTGlzdC5yZW1vdmUoaSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZXhwZWN0ZWROb2RlTGlzdC5zaXplKCkgPT0gMCkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1PcmRlcmVkTm9kZU1hcC5yZW1vdmUocHJvcE5hbWUpOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgZXhwZWN0ZWRCdXREaWZmZXJlbnRWYWx1ZUxpc3QuYWRkKGV4cGVjdGVkTm9kZSk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAvLyAiYWN0dWFsTm9kZSIgaXMgbm90IGluIG9yZGVyZWQgZXhwZWN0ZWQgbGlzdC4KLSAgICAgICAgICAgICAgICAvLyBUcnkgbG9va2luZyBvdmVyIHVub3JkZXJlZCBleHBlY3RlZCBsaXN0LgotICAgICAgICAgICAgICAgIGlmICh0cnlGb3VuZEV4cGVjdGVkTm9kZUZyb21Vbm9yZGVyZWRMaXN0KGFjdHVhbE5vZGUsCi0gICAgICAgICAgICAgICAgICAgICAgICBleHBlY3RlZEJ1dERpZmZlcmVudFZhbHVlTGlzdCkpIHsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwotICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgIGlmICghZXhwZWN0ZWRCdXREaWZmZXJlbnRWYWx1ZUxpc3QuaXNFbXB0eSgpKSB7Ci0gICAgICAgICAgICAgICAgICAgIC8vIFNhbWUgcHJvcE5hbWUgZXhpc3RzIGJ1dCB3aXRoIGRpZmZlcmVudCB2YWx1ZShzKS4KLSAgICAgICAgICAgICAgICAgICAgZmFpbFdpdGhFeHBlY3RlZE5vZGVMaXN0KHByb3BOYW1lLCBhY3R1YWxOb2RlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4cGVjdGVkQnV0RGlmZmVyZW50VmFsdWVMaXN0KTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAvLyBUaGVyZSdzIG5vIGV4cGVjdGVkIG5vZGUgd2l0aCBzYW1lIHByb3BOYW1lLgotICAgICAgICAgICAgICAgICAgICBUZXN0Q2FzZS5mYWlsKCJVbmV4cGVjdGVkIHByb3BlcnR5IFwiIiArIHByb3BOYW1lICsgIlwiIGV4aXN0cy4iKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICBMaXN0PFByb3BlcnR5Tm9kZT4gZXhwZWN0ZWRCdXREaWZmZXJlbnRWYWx1ZUxpc3QgPQotICAgICAgICAgICAgICAgIG5ldyBBcnJheUxpc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ICAgICAgICByZXR1cm47Ci0gICAgICAgIH0KLSAgICAgICAgCi0gICAgICAgIENvbnRlbnRWYWx1ZXMgcGFyYW1NYXAgPSBtQ3VycmVudFByb3BOb2RlLnBhcmFtTWFwOwotICAgICAgICAKLSAgICAgICAgU3RyaW5nIHRhcmdldENoYXJzZXQgPSBDaGFyc2V0VXRpbHMubmFtZUZvckRlZmF1bHRWZW5kb3IocGFyYW1NYXAuZ2V0QXNTdHJpbmcoIkNIQVJTRVQiKSk7IAotICAgICAgICBTdHJpbmcgZW5jb2RpbmcgPSBwYXJhbU1hcC5nZXRBc1N0cmluZygiRU5DT0RJTkciKTsgCi0gICAgICAgIAotICAgICAgICBpZiAodGFyZ2V0Q2hhcnNldCA9PSBudWxsIHx8IHRhcmdldENoYXJzZXQubGVuZ3RoKCkgPT0gMCkgewotICAgICAgICAgICAgdGFyZ2V0Q2hhcnNldCA9IG1UYXJnZXRDaGFyc2V0OwotICAgICAgICB9Ci0gICAgICAgIAotICAgICAgICBmb3IgKFN0cmluZyB2YWx1ZSA6IHZhbHVlcykgewotICAgICAgICAgICAgbUN1cnJlbnRQcm9wTm9kZS5wcm9wVmFsdWVfdmVjdG9yLmFkZCgKLSAgICAgICAgICAgICAgICAgICAgaGFuZGxlT25lVmFsdWUodmFsdWUsIHRhcmdldENoYXJzZXQsIGVuY29kaW5nKSk7Ci0gICAgICAgIH0KLQotICAgICAgICBtQ3VycmVudFByb3BOb2RlLnByb3BWYWx1ZSA9IGxpc3RUb1N0cmluZyhtQ3VycmVudFByb3BOb2RlLnByb3BWYWx1ZV92ZWN0b3IpOwotICAgIH0KLQotICAgIHByaXZhdGUgU3RyaW5nIGxpc3RUb1N0cmluZyhMaXN0PFN0cmluZz4gbGlzdCl7Ci0gICAgICAgIGludCBzaXplID0gbGlzdC5zaXplKCk7Ci0gICAgICAgIGlmIChzaXplID4gMSkgewotICAgICAgICAgICAgU3RyaW5nQnVpbGRlciB0eXBlTGlzdEIgPSBuZXcgU3RyaW5n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IiwKKyAgICAgICAgImExIiwKKyAgICAgICAgImFBIiwKKyAgICAgICAgImExYiIsCisgICAgICAgICJhMUEiLAorICAgICAgICAiYUExIiwKKyAgICAgICAgImFBYiIsCisgICAgICAgICJhQTFCIiwKKyAgICAgICAgImFBMUIyIiwKKworICAgICAgICAvLyBydGwKKyAgICAgICAgIkEiLAorICAgICAgICAiQTEiLAorICAgICAgICAiQWEiLAorICAgICAgICAiQTFCIiwKKyAgICAgICAgIkExYSIsCisgICAgICAgICJBYTEiLAorICAgICAgICAiQWFCIgorICAgIH07CisKKyAgICAvLyBFeHBlY3RlZCBkaXJlY3Rpb25zIGFyZSBhbiBhcnJheSBvZiBzdGFydC9sZW5ndGgrbGV2ZWwgcGFpcnMsCisgICAgLy8gaW4gdmlzdWFsIG9yZGVyIGZyb20gdGhlIGxlYWRpbmcgbWFyZ2luLgorICAgIHByaXZhdGUgc3RhdGljIERpcmVjdGlvbnNbXSBleHBlY3RlZCA9IHsKKyAgICAgICAgRElSU19BTExfTEVGVF9UT19SSUdIVCwKKyAgICAgICAgRElSU19BTExfTEVGVF9UT19SSUdIVCwKKyAgICAgICAgRElSU19BTExfTEVGVF9UT19SSUdIVCwKKyAgICAgICAgRElSU19BTExfTEVGVF9UT19SSUdIVCwKKyAgICAgICAgZGlycygwLCAxLCAxLCBMVkwxXzEpLAorICAgICAgICBESVJTX0FMTF9MRUZUX1RPX1JJR0hULAorICAgICAgICBkaXJzKDAsIDIsIDIsIExWTDFfMSksCisgICAgICAgIGRpcnMoMCwgMSwgMiwgTFZMMl8xLCAxLCBMVkwxXzEpLAorICAgICAgICBkaXJzKDAsIDEsIDEsIExWTDFfMSwgMiwgMSksCisgICAgICAgIGRpcnMoMCwgMSwgMywgTFZMMV8xLCAyLCBMVkwyXzEsIDEsIExWTDFfMSksCisgICAgICAgIGRpcnMoMCwgMSwgNCwgTFZMMl8xLCAzLCBMVkwxXzEsIDIsIExWTDJfMSwgMSwgTFZMMV8xKSwKKworICAgICAgICAvLyBydGwKKyAgICAgICAgRElSU19BTExfUklHSFRfVE9fTEVGVCwKKyAgICAgICAgZGlycygwLCBMVkwxXzEsIDEsIExWTDJfMSksCisgICAgICAgIGRpcnMoMCwgTFZMMV8xLCAxLCBMVkwyXzEpLAorICAgICAgICBkaXJzKDAsIExWTDFfMSwgMSwgTFZMMl8xLCAyLCBMVkwxXzEpLAorICAgICAgICBkaXJzKDAsIExWTDFfMSwgMSwgTFZMMl8yKSwKKyAgICAgICAgZGlycygwLCBMVkwxXzEsIDEsIExWTDJfMiksCisgICAgICAgIGRpcnMoMCwgTFZMMV8xLCAxLCBMVkwyXzEsIDIsIExWTDFfMSksCisgICAgfTsKKworICAgIHByaXZhdGUgc3RhdGljIFN0cmluZyBwc2V1ZG9CaWRpVG9SZWFsKFN0cmluZyBzcmMpIHsKKyAgICAgICAgY2hhcltdIGNoYXJzID0gc3JjLnRvQ2hhckFycmF5KCk7CisgICAgICAgIGZvciAoaW50IGogPSAwOyBqIDwgY2hhcnMubGVuZ3RoOyArK2opIHsKKyAgICAgICAgICAgIGNoYXIgYyA9IGNoYXJzW2pdOworICAgICAgICAgICAgaWYgKGMgPj0gJ0EnICYmIGMgPD0gJ0QnKSB7CisgICAgICAgICAgICAgICAgY2hhcnNbal0gPSAoY2hhcikoQUxFRiArIGMgLSAnQScpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcmV0dXJuIG5ldyBTdHJpbmcoY2hhcnMsIDAsIGNoYXJzLmxlbmd0aCk7CisgICAgfQorCisgICAgLy8gQFNtYWxsVGVzdAorICAgIHB1YmxpYyB2b2lkIHRlc3REaXJlY3Rpb25zKCkgeworICAgICAgICBTdHJpbmdCdWlsZGVyIGJ1ZiA9IG5ldyBTdHJpbmdCdWlsZGVyKCJcbiIpOworICAgICAgICBGb3JtYXR0ZXIgZiA9IG5ldyBGb3JtYXR0ZXIoYnVmKTsKKworICAgICAgICBMYXlvdXRCdWlsZGVyIGIgPSBTdGF0aWNMYXlv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WwoIm9mZnNldFsiICsgaSArICJdIHRvIHJpZ2h0IG9mOiAiICsgbiArICIgZXhwZWN0ZWQ6ICIgKworICAgICAgICAgICAgICAgICAgICAgICAgZXhwZWN0ZWRbaV0gKyAiIGdvdDogIiArIHQpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbiA9IHQ7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB0ZXN0TmV4dFRvTGVmdE9mKCkgeworICAgICAgICBMYXlvdXRCdWlsZGVyIGIgPSBTdGF0aWNMYXlvdXRUZXN0LmJ1aWxkZXIoKTsKKyAgICAgICAgYi5zZXRUZXh0KHBzZXVkb0JpZGlUb1JlYWwoImFBMUIyIikpOworICAgICAgICBpbnRbXSBleHBlY3RlZCA9IHsgMCwgMSwgNCwgMywgMiwgNSB9OworICAgICAgICBMYXlvdXQgbCA9IGIuYnVpbGQoKTsKKyAgICAgICAgaW50IG4gPSA1OworICAgICAgICBmb3IgKGludCBpID0gZXhwZWN0ZWQubGVuZ3RoIC0gMTsgLS1pID49IDA7KSB7CisgICAgICAgICAgICBpbnQgdCA9IGwuZ2V0T2Zmc2V0VG9MZWZ0T2Yobik7CisgICAgICAgICAgICBpZiAodCAhPSBleHBlY3RlZFtpXSkgeworICAgICAgICAgICAgICAgIGZhaWwoIm9mZnNldFsiICsgaSArICJdIHRvIGxlZnQgb2Y6ICIgKyBuICsgIiBleHBlY3RlZDogIiArCisgICAgICAgICAgICAgICAgICAgICAgICBleHBlY3RlZFtpXSArICIgZ290OiAiICsgdCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBuID0gdDsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8vIHV0aWxpdHksIG5vdCByZWFsbHkgYSB0ZXN0CisgICAgLyoKKyAgICBwdWJsaWMgdm9pZCB0ZXN0TWVhc3VyZVRleHQxKCkgeworICAgICAgICBMYXlvdXRCdWlsZGVyIGIgPSBTdGF0aWNMYXlvdXRUZXN0LmJ1aWxkZXIoKTsKKyAgICAgICAgU3RyaW5nIHRleHQgPSAiQUJDIjsgLy8gImFiQUIiCisgICAgICAgIGIuc2V0VGV4dChwc2V1ZG9CaWRpVG9SZWFsKHRleHQpKTsKKyAgICAgICAgTGF5b3V0IGwgPSBiLmJ1aWxkKCk7CisgICAgICAgIERpcmVjdGlvbnMgZGlyZWN0aW9ucyA9IGwuZ2V0TGluZURpcmVjdGlvbnMoMCk7CisKKyAgICAgICAgVGV4dFBhaW50IHdvcmtQYWludCA9IG5ldyBUZXh0UGFpbnQoKTsKKworICAgICAgICBpbnQgZGlyID0gLTE7IC8vIExFRlRfVE9fUklHSFQKKyAgICAgICAgYm9vbGVhbiB0cmFpbGluZyA9IHRydWU7CisgICAgICAgIGJvb2xlYW4gYWx0ID0gdHJ1ZTsKKyAgICAgICAgZG8geworICAgICAgICAgICAgZGlyID0gLWRpcjsKKyAgICAgICAgICAgIGRvIHsKKyAgICAgICAgICAgICAgICB0cmFpbGluZyA9ICF0cmFpbGluZzsKKyAgICAgICAgICAgICAgICBmb3IgKGludCBvZmZzZXQgPSAwLCBlbmQgPSBiLnRleHQubGVuZ3RoKCk7IG9mZnNldCA8PSBlbmQ7ICsrb2Zmc2V0KSB7CisgICAgICAgICAgICAgICAgICAgIGZsb2F0IHdpZHRoID0gTGF5b3V0Lm1lYXN1cmVUZXh0KGIucGFpbnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgd29ya1BhaW50LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIudGV4dCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLCBvZmZzZXQsIGVuZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXIsIGRpcmVjdGlvbnMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJhaWxpbmcsIGZhbHNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwpOworICAgICAgICAgICAgICAgICAgICBMb2cuaSgiQklESSIsICJkaXI6ICIgKyBkaXIgKyAiIHRyYWlsOiAiICsgdHJhaWxpbmcgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICIgb2Zmc2V0OiAiICsgb2Zmc2V0ICsgIiB3aWR0aDogIiArIHdpZHRoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IHdoaWxlICghdHJhaWxpbmcpOworICAgICAgICB9IHdoaWxlIChkaXIgPiAwKTsKKyAgICB9CisgICAgKi8KKworICAgIC8vIHV0aWxpdHkgZm9yIGRpc3BsYXlpbmcgYXJyYXlzIGluIGhleAorICAgIHByaXZhdGUgc3RhdGljIFN0cmluZyBoZXhBcnJheShpbnRbXSBhcnJheSkgeworICAgICAgICBTdHJpbmdCdWlsZGVyIHNiID0gbmV3IFN0cmluZ0J1aWxkZXIoKTsKKyAgICAgICAgc2IuYXBwZW5kKCd7Jyk7CisgICAgICAgIGZvciAoaW50IGkgOiBhcnJheSkgeworICAgICAgICAgICAgaWYgKHNiLmxlbmd0aCgpID4gMSkgeworICAgICAgICAgICAgICAgIHNiLmFwcGVuZCgiLCAiKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHNiLmFwcGVuZChJbnRlZ2VyLnRvSGV4U3RyaW5nKGkpKTsKKyAgICAgICAgfQorICAgICAgICBzYi5hcHBlbmQoJ30nKTsKKyAgICAgICAgcmV0dXJuIHNiLnRvU3RyaW5nKCk7CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIGNoZWNrRGlyZWN0aW9ucyhMYXlvdXQgbCwgaW50IGksIFN0cmluZyB0ZXh0LAorICAgICAgICAgICAgRGlyZWN0aW9uc1tdIGV4cGVjdGVkRGlycywgRm9ybWF0dGVyIGYpIHsKKyAgICAgICAgRGlyZWN0aW9ucyBleHBlY3RlZCA9IGV4cGVjdGVkRGlyc1tpXTsKKyAgICAgICAgRGlyZWN0aW9ucyByZXN1bHQgPSBsLmdldExpbmVEaXJlY3Rpb25zKDApOworICAgICAgICBpZiAoIUFycmF5cy5lcXVhbH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lld0dyb3VwIHBhcmVudCwgaW50IGRlc2lyZWRIZWlnaHQpIHsKLSAgICAgICAgVGV4dFZpZXcgcmVzdWx0ID0gbmV3IFRleHRWaWV3KHBhcmVudC5nZXRDb250ZXh0KCkpOwotICAgICAgICByZXN1bHQuc2V0SGVpZ2h0KGRlc2lyZWRIZWlnaHQpOwotICAgICAgICByZXN1bHQuc2V0VGV4dChnZXRWYWx1ZUF0UG9zaXRpb24ocGFja2VkUG9zaXRpb24pKTsKLSAgICAgICAgZmluYWwgVmlld0dyb3VwLkxheW91dFBhcmFtcyBscCA9IG5ldyBBYnNMaXN0Vmlldy5MYXlvdXRQYXJhbXMoCi0gICAgICAgICAgICAgICAgVmlld0dyb3VwLkxheW91dFBhcmFtcy5NQVRDSF9QQVJFTlQsCi0gICAgICAgICAgICAgICAgVmlld0dyb3VwLkxheW91dFBhcmFtcy5XUkFQX0NPTlRFTlQpOwotICAgICAgICByZXN1bHQuc2V0TGF5b3V0UGFyYW1zKGxwKTsKLSAgICAgICAgcmVzdWx0LnNldEdyYXZpdHkoR3Jhdml0eS5DRU5URVJfVkVSVElDQUwpOwotICAgICAgICByZXN1bHQuc2V0UGFkZGluZygzNiwgMCwgMCwgMCk7Ci0gICAgICAgIHJlc3VsdC5zZXRJZChmbFBvcyk7Ci0gICAgICAgIHJldHVybiByZXN1bHQ7Ci0gICAgfQotICAgIAotICAgIC8qKgotICAgICAqIFJldHVybnMgYSBncm91cCBpbmRleCBjb250YWluaW5nIGVpdGhlciB0aGUgbnVtYmVyIG9mIGNoaWxkcmVuIG9yIGF0Ci0gICAgICogbGVhc3Qgb25lIGNoaWxkLgotICAgICAqIAotICAgICAqIEBwYXJhbSBudW1DaGlsZHJlbiBUaGUgZ3JvdXAgbXVzdCBoYXZlIHRoaXMgYW1vdW50LCBvciAtMSBpZiB1c2luZwotICAgICAqICAgICAgICAgICAgYXRMZWFzdE9uZUNoaWxkLgotICAgICAqIEBwYXJhbSBhdExlYXN0T25lQ2hpbGQgV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KGdyb3VwUG9zaXRpb24sCi0gICAgICAgICAgICAgICAgICAgIGNoaWxkUG9zaXRpb24pLCBjb252ZXJ0VmlldywgcGFyZW50KTsKLSAgICAgICAgfQotCi0gICAgICAgIHB1YmxpYyBPYmplY3QgZ2V0R3JvdXAoaW50IGdyb3VwUG9zaXRpb24pIHsKLSAgICAgICAgICAgIHJldHVybiBnZXRWYWx1ZUF0UG9zaXRpb24oRXhwYW5kYWJsZUxpc3RWaWV3LmdldFBhY2tlZFBvc2l0aW9uRm9yR3JvdXAoZ3JvdXBQb3NpdGlvbikpOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIGludCBnZXRHcm91cENvdW50KCkgewotICAgICAgICAgICAgcmV0dXJuIG1Hcm91cHMuc2l6ZSgpOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIGxvbmcgZ2V0R3JvdXBJZChpbnQgZ3JvdXBQb3NpdGlvbikgewotICAgICAgICAgICAgcmV0dXJuIG1Hcm91cHMuZ2V0KGdyb3VwUG9zaXRpb24pLmlkOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIFZpZXcgZ2V0R3JvdXBWaWV3KGludCBncm91cFBvc2l0aW9uLCBib29sZWFuIGlzRXhwYW5kZWQsIFZpZXcgY29udmVydFZpZXcsCi0gICAgICAgICAgICAgICAgVmlld0dyb3VwIHBhcmVudCkgewotICAgICAgICAgICAgcmV0dXJuIGdldFZpZXcoRXhwYW5kYWJsZUxpc3RWaWV3LmdldFBhY2tlZFBvc2l0aW9uRm9yR3JvdXAoZ3JvdXBQb3NpdGlvbiksCi0gICAgICAgICAgICAgICAgICAgIGNvbnZlcnRWaWV3LCBwYXJlbnQpOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIGJvb2xlYW4gaXNDaGlsZFNlbGVjdGFibGUoaW50IGdyb3VwUG9zaXRpb24sIGludCBjaGlsZFBvc2l0aW9uKSB7Ci0gICAgICAgICAgICByZXR1cm4gdHJ1ZTsKLSAgICAgIC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ICB9CisKKyAgICBwdWJsaWMgdm9pZCB0ZXN0UmVhZEVtcHR5QXJyYXkoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBKc29uUmVhZGVyIHJlYWRlciA9IG5ldyBKc29uUmVhZGVyKG5ldyBTdHJpbmdSZWFkZXIoIltdIikpOworICAgICAgICByZWFkZXIuYmVnaW5BcnJheSgpOworICAgICAgICBhc3NlcnRGYWxzZShyZWFkZXIuaGFzTmV4dCgpKTsKKyAgICAgICAgcmVhZGVyLmVuZEFycmF5KCk7CisgICAgICAgIGFzc2VydEVxdWFscyhKc29uVG9rZW4uRU5EX0RPQ1VNRU5ULCByZWFkZXIucGVlaygpKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB0ZXN0UmVhZE9iamVjdCgpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIEpzb25SZWFkZXIgcmVhZGVyID0gbmV3IEpzb25SZWFkZXIobmV3IFN0cmluZ1JlYWRlcigKKyAgICAgICAgICAgICAgICAie1wiYVwiOiBcImFuZHJvaWRcIiwgXCJiXCI6IFwiYmFuYW5hXCJ9IikpOworICAgICAgICByZWFkZXIuYmVnaW5PYmplY3QoKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKCJhIiwgcmVhZGVyLm5leHROYW1lKCkpOworICAgICAgICBhc3NlcnRFcXVhbHMoImFuZHJvaWQiLCByZWFkZXIubmV4dFN0cmluZygpKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKCJiIiwgcmVhZGVyLm5leHROYW1lKCkpOworICAgICAgICBhc3NlcnRFcXVhbHMoImJhbmFuYSIsIHJlYWRlci5uZXh0U3RyaW5nKCkpOworICAgICAgICByZWFkZXIuZW5kT2JqZWN0KCk7CisgICAgICAgIGFzc2VydEVxdWFscyhKc29uVG9rZW4uRU5EX0RPQ1VNRU5ULCByZWFkZXIucGVlaygpKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB0ZXN0UmVhZEVtcHR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IntcbiIgKworICAgICAgICAgICAgICAgICIgICBcImhlbGxvXCI6IHRydWUsXG4iICsKKyAgICAgICAgICAgICAgICAiICAgXCJmb29cIjogW1wid29ybGRcIl1cbiIgKworICAgICAgICAgICAgICAgICJ9IjsKKyAgICAgICAgSnNvblJlYWRlciByZWFkZXIgPSBuZXcgSnNvblJlYWRlcihuZXcgU3RyaW5nUmVhZGVyKGpzb24pKTsKKyAgICAgICAgcmVhZGVyLmJlZ2luT2JqZWN0KCk7CisgICAgICAgIGFzc2VydEVxdWFscygiaGVsbG8iLCByZWFkZXIubmV4dE5hbWUoKSk7CisgICAgICAgIGFzc2VydEVxdWFscyh0cnVlLCByZWFkZXIubmV4dEJvb2xlYW4oKSk7CisgICAgICAgIGFzc2VydEVxdWFscygiZm9vIiwgcmVhZGVyLm5leHROYW1lKCkpOworICAgICAgICByZWFkZXIuYmVnaW5BcnJheSgpOworICAgICAgICBhc3NlcnRFcXVhbHMoIndvcmxkIiwgcmVhZGVyLm5leHRTdHJpbmcoKSk7CisgICAgICAgIHJlYWRlci5lbmRBcnJheSgpOworICAgICAgICByZWFkZXIuZW5kT2JqZWN0KCk7CisgICAgICAgIGFzc2VydEVxdWFscyhKc29uVG9rZW4uRU5EX0RPQ1VNRU5ULCByZWFkZXIucGVlaygpKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB0ZXN0TnVsbHMoKSB7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBuZXcgSnNvblJlYWRlcihudWxsKTsKKyAgICAgICAgICAgIGZhaWwoKTsKKyAgICAgICAgfSBjYXRjaCAoTnVsbFBvaW50ZXJFeGNlcHRpb24gZXhwZWN0ZWQpIHsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHRlc3RFbXB0eVN0cmluZygpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBuZXcgSnNvblJlYWRlcihuZXcgU3RyaW5nUmVhZGVyKCIiKSkuYmVnaW5BcnJheSgpOworICAgICAgICB9IGNhdGNoIChJT0V4Y2VwdGlvbiBleHBlY3RlZCkgeworICAgICAgICB9CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBuZXcgSnNvblJlYWRlcihuZXcgU3RyaW5nUmVhZGVyKCIiKSkuYmVnaW5PYmplY3QoKTsKKyAgICAgICAgfSBjYXRjaCAoSU9FeGNlcHRpb24gZXhwZWN0ZWQpIHsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHRlc3ROb1RvcExldmVsT2JqZWN0KCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIG5ldyBKc29uUmVhZGVyKG5ldyBTdHJpbmdSZWFkZXIoInRydWUiKSkubmV4dEJvb2xlYW4oKTsKKyAgICAgICAgfSBjYXRjaCAoSU9FeGNlcHRpb24gZXhwZWN0ZWQpIHsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHRlc3RDaGFyYWN0ZXJVbmVzY2FwaW5nKCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgU3RyaW5nIGpzb24gPSAiW1wiYVwiLCIKKyAgICAgICAgICAgICAgICArICJcImFcXFwiXCIsIgorICAgICAgICAgICAgICAgICsgIlwiXFxcIlwiLCIKKyAgICAgICAgICAgICAgICArICJcIjpcIiwiCisgICAgICAgICAgICAgICAgKyAiXCIsXCIsIgorICAgICAgICAgICAgICAgICsgIlwiXFxiXCIsIgorICAgICAgICAgICAgICAgICsgIlwiXFxmXCIsIgorICAgICAgICAgICAgICAgICsgIlwiXFxuXCIsIgorICAgICAgICAgICAgICAgICsgIlwiXFxyXCIsIgorICAgICAgICAgICAgICAgICsgIlwiXFx0XCIsIgorICAgICAgICAgICAgICAgICsgIlwiIFwiLCIKKyAgICAgICAgICAgICAgICArICJcIlxcXFxcIiwiCisgICAgICAgICAgICAgICAgKyAiXCJ7XCIsIgorICAgICAgICAgICAgICAgICsgIlwifVwiLCIKKyAgICAgICAgICAgICAgICArICJcIltcIiwiCisgICAgICAgICAgICAgICAgKyAiXCJdXCIsIgorICAgICAgICAgICAgICAgICsgIlwiXFx1MDAwMFwiLCIKKyAgICAgICAgICAgICAgICArICJcIlxcdTAwMTlcIiwiCisgICAgICAgICAgICAgICAgKyAiXCJcXHUyMEFDXCIiCisgICAgICAgICAgICAgICAgKyAiXSI7CisgICAgICAgIEpzb25SZWFkZXIgcmVhZGVyID0gbmV3IEpzb25SZWFkZXIobmV3IFN0cmluZ1JlYWRlcihqc29uKSk7CisgICAgICAgIHJlYWRlci5iZWdpbkFycmF5KCk7CisgICAgICAgIGFzc2VydEVxdWFscygiYSIsIHJlYWRlci5uZXh0U3RyaW5nKCkpOworICAgICAgICBhc3NlcnRFcXVhbHMoImFcIiIsIHJlYWRlci5uZXh0U3RyaW5nKCkpOworICAgICAgICBhc3NlcnRFcXVhbHMoIlwiIiwgcmVhZGVyLm5leHRTdHJpbmcoKSk7CisgICAgICAgIGFzc2VydEVxdWFscygiOiIsIHJlYWRlci5uZXh0U3RyaW5nKCkpOworICAgICAgICBhc3NlcnRFcXVhbHMoIiwiLCByZWFkZXIubmV4dFN0cmluZygpKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKCJcYiIsIHJlYWRlci5uZXh0U3RyaW5nKCkpOworICAgICAgICBhc3NlcnRFcXVhbHMoIlxmIiwgcmVhZGVyLm5leHRTdHJpbmcoKSk7CisgICAgICAgIGFzc2VydEVxdWFscygiXG4iLCByZWFkZXIubmV4dFN0cmluZygpKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKCJcciIsIHJlYWRlci5uZXh0U3RyaW5nKCkpOworICAgICAgICBhc3NlcnRFcXVhbHMoIlx0IiwgcmVhZGVyLm5leHRTdHJpbmcoKSk7CisgICAgICAgIGFzc2VydEVxdWFscygiICIsIHJlYWRlci5uZXh0U3RyaW5nKCkpOworICAgICAgICBhc3NlcnRFcXVhbHMoIlxcIiwgcmVhZGVyLm5leHRTdHJpbmcoKSk7CisgICAgICAgIGFzc2VydEVxdWFscygieyIsIHJlYWRlci5uZXh0U3RyaW5nKCkpOworICAgICAgICBhc3NlcnRFcXVhbHMoIn0iLCByZWFkZXIubmV4dFN0cmluZygpKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKCJbIiwgcmVhZGVyLm5leHRTdHJpbmcoKSk7CisgICAgICAgIGFzc2VydEVxdWFscygiXSIsIHJlYWRlci5uZXh0U3RyaW5nKCkpOworICAgICAgICBhc3NlcnRFcXVhbHMoIlwwIiwgcmVhZGVyLm5leHRTdHJpbmcoKSk7CisgICAgICAgIGFzc2VydEVxdWFscygiXHUwMDE5IiwgcmVhZGVyLm5leHRTdHJpbmcoKSk7CisgICAgICAgIGFzc2VydEVxdWFscygiXHUyMEFDIiwgcmVhZGVyLm5leHRTdHJpbmcoKSk7CisgICAgICAgIHJlYWRlci5lbmRBcnJheSgpOworICAgICAgICBhc3NlcnRFcXVhbHMoSnNvblRva2VuLkVORF9ET0NVTUVOVCwgcmVhZGVyLnBlZWsoKSk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdGVzdEludGVnZXJzV2l0aEZyYWN0aW9uYWxQYXJ0U3BlY2lmaWVkKCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgSnNvblJlYWRlciByZWFkZXIgPSBuZXcgSnNvblJlYWRlcihuZXcgU3RyaW5nUmVhZGVyKCJbMS4wLDEuMCwxLjBdIikpOworICAgICAgICByZWFkZXIuYmVnaW5BcnJheSgpOworICAgICAgICBhc3NlcnRFcXVhbHMoMS4wLCByZWFkZXIubmV4dERvdWJsZSgpKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKDEsIHJlYWRlci5uZXh0SW50KCkpOworICAgICAgICBhc3NlcnRFcXVhbHMoMUwsIHJlYWRlci5uZXh0TG9uZygpKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB0ZXN0RG91YmxlcygpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIFN0cmluZyBqc29uID0gIlstMC4wLCIKKyAgICAgICAgICAgICAgICArICIxLjAsIgorICAgICAgICAgICAgICAgICsgIjEuNzk3NjkzMTM0ODYyMzE1N0UzMDgsIgorICAgICAgICAgICAgICAgICsgIjQuOUUtMzI0LCIKKyAgICAgICAgICAgICAgICArICIwLjAsIgorICAgICAgICAgICAgICAgICsgIi0wLjUsIgorICAgICAgICAgICAgICAgICsgIjIuMjI1MDczODU4NTA3MjAxNEUtMzA4LCIKKyAgICAgICAgICAgICAgICArICIzLjE0MTU5MjY1MzU4OTc5MywiCisgICAgICAgICAgICAgICAgKyAiMi43MTgyODE4Mjg0NTkwNDVdIjsKKyAgICAgICAgSnNvblJlYWRlciByZWFkZXIgPSBuZXcgSnNvblJlYWRlcihuZXcgU3RyaW5nUmVhZGVyKGpzb24pKTsKKyAgICAgICAgcmVhZGVyLmJlZ2luQXJyYXkoKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKC0wLjAsIHJlYWRlci5uZXh0RG91YmxlKCkpOworICAgICAgICBhc3NlcnRFcXVhbHMoMS4wLCByZWFkZXIubmV4dERvdWJsZSgpKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKDEuNzk3NjkzMTM0ODYyMzE1N0UzMDgsIHJlYWRlci5uZXh0RG91YmxlKCkpOworICAgICAgICBhc3NlcnRFcXVhbHMoNC45RS0zMjQsIHJlYWRlci5uZXh0RG91YmxlKCkpOworICAgICAgICBhc3NlcnRFcXVhbHMoMC4wLCByZWFkZXIubmV4dERvdWJsZSgpKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKC0wLjUsIHJlYWRlci5uZXh0RG91YmxlKCkpOworICAgICAgICBhc3NlcnRFcXVhbHMoMi4yMjUwNzM4NTg1MDcyMDE0RS0zMDgsIHJlYWRlci5uZXh0RG91YmxlKCkpOworICAgICAgICBhc3NlcnRFcXVhbHMoMy4xNDE1OTI2NTM1ODk3OTMsIHJlYWRlci5uZXh0RG91YmxlKCkpOworICAgICAgICBhc3NlcnRFcXVhbHMoMi43MTgyODE4Mjg0NTkwNDUsIHJlYWRlci5uZXh0RG91YmxlKCkpOworICAgICAgICByZWFkZXIuZW5kQXJyYXkoKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKEpzb25Ub2tlbi5FTkRfRE9DVU1FTlQsIHJlYWRlci5wZWVrKCkpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHRlc3ROb25GaW5pdGVEb3VibGVzKCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgU3RyaW5nIGpzb24gPSAiW05hTl0iOworICAgICAgICBKc29uUmVhZGVyIHJlYWRlciA9IG5ldyBKc29uUmVhZGVyKG5ldyBTdHJpbmdSZWFkZXIoanNvbikpOworICAgICAgICByZWFkZXIuYmVnaW5BcnJheSgpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgcmVhZGVyLm5leHREb3VibGUoKTsKKyAgICAgICAgICAgIGZhaWwoKTsKKyAgICAgICAgfSBjYXRjaCAoTnVtYmVyRm9ybWF0RXhjZXB0aW9uIGV4cGVjdGVkKSB7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB0ZXN0TG9uZ3MoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBTdHJpbmcganNvbiA9ICJbMCwwLDAsIgorICAgICAgICAgICAgICAgICsgIjEsMSwxLCIKKyAgICAgICAgICAgICAgICArICItMSwtMSwtMSwiCisgICAgICAgICAgICAgICAgKyAiLTkyMjMzNzIwMzY4NTQ3NzU4MDgsIgorICAgICAgICAgICAgICAgICsgIjkyMjMzNzIwMzY4NTQ3NzU4MDddIjsKKyAgICAgICAgSnNvblJlYWRlciByZWFkZXIgPSBuZXcgSnNvblJlYWRlcihuZXcgU3RyaW5nUmVhZGVyKGpzb24pKTsKKyAgICAgICAgcmVhZGVyLmJlZ2luQXJyYXkoKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKDBMLCByZWFkZXIubmV4dExvbmcoKSk7CisgICAgICAgIGFzc2VydEVxdWFscygwLCByZWFkZXIubmV4dEludCgpKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKDAuMCwgcmVhZGVyLm5leHREb3VibGUoKSk7CisgICAgICAgIGFzc2VydEVxdWFscygxTCwgcmVhZGVyLm5leHRMb25nKCkpOworICAgICAgICBhc3NlcnRFcXVhbHMoMSwgcmVhZGVyLm5leHRJbnQoKSk7CisgICAgICAgIGFzc2VydEVxdWFscygxLjAsIHJlYWRlci5uZXh0RG91YmxlKCkpOworICAgICAgICBhc3NlcnRFcXVhbHMoLTFMLCByZWFkZXIubmV4dExvbmcoKSk7CisgICAgICAgIGFzc2VydEVxdWFscygtMSwgcmVhZGVyLm5leHRJbnQoKSk7CisgICAgICAgIGFzc2VydEVxdWFscygtMS4wLCByZWFkZXIubmV4dERvdWJsZSgpKTsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIHJlYWRlci5uZXh0SW50KCk7CisgICAgICAgICAgICBmYWlsKCk7CisgICAgICAgIH0gY2F0Y2ggKE51bWJlckZvcm1hdEV4Y2VwdGlvbiBleHBlY3RlZCkgeworICAgICAgICB9CisgICAgICAgIGFzc2VydEVxdWFscyhMb25nLk1JTl9WQUxVRSwgcmVhZGVyLm5leHRMb25nKCkpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgcmVhZGVyLm5leHRJbnQoKTsKKyAgICAgICAgICAgIGZhaWwoKTsKKyAgICAgICAgfSBjYXRjaCAoTnVtYmVyRm9ybWF0RXhjZXB0aW9uIGV4cGVjdGVkKSB7CisgICAgICAgIH0KKyAgICAgICAgYXNzZXJ0RXF1YWxzKExvbmcuTUFYX1ZBTFVFLCByZWFkZXIubmV4dExvbmcoKSk7CisgICAgICAgIHJlYWRlci5lbmRBcnJheSgpOworICAgICAgICBhc3NlcnRFcXVhbHMoSnNvblRva2VuLk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gICAgfQorICAgICAgICB0cnkgeworICAgICAgICAgICAgcmVhZGVyLm5leHRMb25nKCk7CisgICAgICAgICAgICBmYWlsKCk7CisgICAgICAgIH0gY2F0Y2ggKE51bWJlckZvcm1hdEV4Y2VwdGlvbiBleHBlY3RlZCkgeworICAgICAgICB9CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICByZWFkZXIubmV4dERvdWJsZSgpOworICAgICAgICAgICAgZmFpbCgpOworICAgICAgICB9IGNhdGNoIChOdW1iZXJGb3JtYXRFeGNlcHRpb24gZXhwZWN0ZWQpIHsKKyAgICAgICAgfQorICAgICAgICBhc3NlcnRFcXVhbHMoIjAxIiwgcmVhZGVyLm5leHRTdHJpbmcoKSk7CisgICAgICAgIHJlYWRlci5lbmRBcnJheSgpOworICAgICAgICBhc3NlcnRFcXVhbHMoSnNvblRva2VuLkVORF9ET0NVTUVOVCwgcmVhZGVyLnBlZWsoKSk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdGVzdEJvb2xlYW5zKCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgSnNvblJlYWRlciByZWFkZXIgPSBuZXcgSnNvblJlYWRlcihuZXcgU3RyaW5nUmVhZGVyKCJbdHJ1ZSxmYWxzZV0iKSk7CisgICAgICAgIHJlYWRlci5iZWdpbkFycmF5KCk7CisgICAgICAgIGFzc2VydEVxdWFscyh0cnVlLCByZWFkZXIubmV4dEJvb2xlYW4oKSk7CisgICAgICAgIGFzc2VydEVxdWFscyhmYWxzZSwgcmVhZGVyLm5leHRCb29sZWFuKCkpOworICAgICAgICByZWFkZXIuZW5kQXJyYXkoKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKEpzb25Ub2tlbi5FTkRfRE9DVU1FTlQsIHJlYWRlci5wZWVrKCkpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHRlc3RNaXhlZENhc2VMaXRlcmFscygpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIEpzb25SZWF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JlbWF0dXJlRW5kT2ZJbnB1dCgpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIEpzb25SZWFkZXIgcmVhZGVyID0gbmV3IEpzb25SZWFkZXIobmV3IFN0cmluZ1JlYWRlcigie1wiYVwiOnRydWUsIikpOworICAgICAgICByZWFkZXIuYmVnaW5PYmplY3QoKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKCJhIiwgcmVhZGVyLm5leHROYW1lKCkpOworICAgICAgICBhc3NlcnRFcXVhbHModHJ1ZSwgcmVhZGVyLm5leHRCb29sZWFuKCkpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgcmVhZGVyLm5leHROYW1lKCk7CisgICAgICAgICAgICBmYWlsKCk7CisgICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGV4cGVjdGVkKSB7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB0ZXN0UHJlbWF0dXJlbHlDbG9zZWQoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICB0cnkgeworICAgICAgICAgICAgSnNvblJlYWRlciByZWFkZXIgPSBuZXcgSnNvblJlYWRlcihuZXcgU3RyaW5nUmVhZGVyKCJ7XCJhXCI6W119IikpOworICAgICAgICAgICAgcmVhZGVyLmJlZ2luT2JqZWN0KCk7CisgICAgICAgICAgICByZWFkZXIuY2xvc2UoKTsKKyAgICAgICAgICAgIHJlYWRlci5uZXh0TmFtZSgpOworICAgICAgICAgICAgZmFpbCgpOworICAgICAgICB9IGNhdGNoIChJbGxlZ2FsU3RhdGVFeGNlcHRpb24gZXhwZWN0ZWQpIHsKKyAgICAgICAgfQorCisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBKc29uUmVhZGVyIHJlYWRlciA9IG5ldyBKc29uUmVhZGVyKG5ldyBTdHJpbmdSZWFkZXIoIntcImFcIjpbXX0iKSk7CisgICAgICAgICAgICByZWFkZXIuY2xvc2UoKTsKKyAgICAgICAgICAgIHJlYWRlci5iZWdpbk9iamVjdCgpOworICAgICAgICAgICAgZmFpbCgpOworICAgICAgICB9IGNhdGNoIChJbGxlZ2FsU3RhdGVFeGNlcHRpb24gZXhwZWN0ZWQpIHsKKyAgICAgICAgfQorCisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBKc29uUmVhZGVyIHJlYWRlciA9IG5ldyBKc29uUmVhZGVyKG5ldyBTdHJpbmdSZWFkZXIoIntcImFcIjp0cnVlfSIpKTsKKyAgICAgICAgICAgIHJlYWRlci5iZWdpbk9iamVjdCgpOworICAgICAgICAgICAgcmVhZGVyLm5leHROYW1lKCk7CisgICAgICAgICAgICByZWFkZXIucGVlaygpOworICAgICAgICAgICAgcmVhZGVyLmNsb3NlKCk7CisgICAgICAgICAgICByZWFkZXIubmV4dEJvb2xlYW4oKTsKKyAgICAgICAgICAgIGZhaWwoKTsKKyAgICAgICAgfSBjYXRjaCAoSWxsZWdhbFN0YXRlRXhjZXB0aW9uIGV4cGVjdGVkKSB7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB0ZXN0TmV4dEZhaWx1cmVzRG9Ob3RBZHZhbmNlKCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgSnNvblJlYWRlciByZWFkZXIgPSBuZXcgSnNvblJlYWRlcihuZXcgU3RyaW5nUmVhZGVyKCJ7XCJhXCI6dHJ1ZX0iKSk7CisgICAgICAgIHJlYWRlci5iZWdpbk9iamVjdCgpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgcmVhZGVyLm5leHRTdHJpbmcoKTsKKyAgICAgICAgICAgIGZhaWwoKTsKKyAgICAgICAgfSBjYXRjaCAoSWxsZWdhbFN0YXRlRXhjZXB0aW9uIGV4cGVjdGVkKSB7CisgICAgICAgIH0KKyAgICAgICAgYXNzZXJ0RXF1YWxzKCJhIiwgcmVhZGVyLm5leHROYW1lKCkpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgcmVhZGVyLm5leHROYW1lKCk7CisgICAgICAgICAgICBmYWlsKCk7CisgICAgICAgIH0gY2F0Y2ggKElsbGVnYWxTdGF0ZUV4Y2VwdGlvbiBleHBlY3RlZCkgeworICAgICAgICB9CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICByZWFkZXIuYmVnaW5BcnJheSgpOworICAgICAgICAgICAgZmFpbCgpOworICAgICAgICB9IGNhdGNoIChJbGxlZ2FsU3RhdGVFeGNlcHRpb24gZXhwZWN0ZWQpIHsKKyAgICAgICAgfQorICAgICAgICB0cnkgeworICAgICAgICAgICAgcmVhZGVyLmVuZEFycmF5KCk7CisgICAgICAgICAgICBmYWlsKCk7CisgICAgICAgIH0gY2F0Y2ggKElsbGVnYWxTdGF0ZUV4Y2VwdGlvbiBleHBlY3RlZCkgeworICAgICAgICB9CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICByZWFkZXIuYmVnaW5PYmplY3QoKTsKKyAgICAgICAgICAgIGZhaWwoKTsKKyAgICAgICAgfSBjYXRjaCAoSWxsZWdhbFN0YXRlRXhjZXB0aW9uIGV4cGVjdGVkKSB7CisgICAgICAgIH0KKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIHJlYWRlci5lbmRPYmplY3QoKTsKKyAgICAgICAgICAgIGZhaWwoKTsKKyAgICAgICAgfSBjYXRjaCAoSWxsZWdhbFN0YXRlRXhjZXB0aW9uIGV4cGVjdGVkKSB7CisgICAgICAgIH0KKyAgICAgICAgYXNzZXJ0RXF1YWxzKHRydWUsIHJlYWRlci5uZXh0Qm9vbGVhbigpKTsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIHJlYWRlci5uZXh0U3RyaW5nKCk7CisgICAgICAgICAgICBmYWlsKCk7CisgICAgICAgIH0gY2F0Y2ggKElsbGVnYWxTdGF0ZUV4Y2VwdGlvbiBleHBlY3RlZCkgeworICAgICAgICB9CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICByZWFkZXIubmV4dE5hbWUoKTsKKyAgICAgICAgICAgIGZhaWwoKTsKKyAgICAgICAgfSBjYXRjaCAoSWxsZWdhbFN0YXRlRXhjZXB0aW9uIGV4cGVjdGVkKSB7CisgICAgICAgIH0KKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIHJlYWRlci5iZWdpbkFycmF5KCk7CisgICAgICAgICAgICBmYWlsKCk7CisgICAgICAgIH0gY2F0Y2ggKElsbGVnYWxTdGF0ZUV4Y2VwdGlvbiBleHBlY3RlZCkgeworICAgICAgICB9CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICByZWFkZXIuZW5kQXJyYXkoKTsKKyAgICAgICAgICAgIGZhaWwoKTsKKyAgICAgICAgfSBjYXRjaCAoSWxsZWdhbFN0YXRlRXhjZXB0aW9uIGV4cGVjdGVkKSB7CisgICAgICAgIH0KKyAgICAgICAgcmVhZGVyLmVuZE9iamVjdCgpOworICAgICAgICBhc3NlcnRFcXVhbHMoSnNvblRva2VuLkVORF9ET0NVTUVOVCwgcmVhZGVyLnBlZWsoKSk7CisgICAgICAgIHJlYWRlci5jbG9zZSgpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHRlc3RTdHJpbmdOdWxsSXNOb3ROdWxsKCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgSnNvblJlYWRlciByZWFkZXIgPSBuZXcgSnNvblJlYWRlcihuZXcgU3RyaW5nUmVhZGVyKCJbXCJudWxsXCJdIikpOworICAgICAgICByZWFkZXIuYmVnaW5BcnJheSgpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgcmVhZGVyLm5leHROdWxsKCk7CisgICAgICAgICAgICBmYWlsKCk7CisgICAgICAgIH0gY2F0Y2ggKElsbGVnYWxTdGF0ZUV4Y2VwdGlvbiBleHBlY3RlZCkgeworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdGVzdE51bGxMaXRlcmFsSXNOb3RBU3RyaW5nKCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICBKc29uUmVhZGVyIHJlYWRlciA9IG5ldyBKc29uUmVhZGVyKG5ldyBTdHJpbmdSZWFkZXIoIltudWxsXSIpKTsKKyAgICAgICAgcmVhZGVyLmJlZ2luQXJyYXkoKTsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIHJlYWRlci5uZXh0U3RyaW5nKCk7CisgICAgICAgICAgICBmYWlsKCk7CisgICAgICAgIH0gY2F0Y2ggKElsbGVnYWxTdGF0ZUV4Y2VwdGlvbiBleHBlY3RlZCkgeworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdGVzdFN0cmljdE5hbWVWYWx1ZVNlcGFyYXRvcigpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIEpzb25SZWFkZXIgcmVhZGVyID0gbmV3IEpzb25SZWFkZXIobmV3IFN0cmluZ1JlYWRlcigie1wiYVwiPXRydWV9IikpOworICAgICAgICByZWFkZXIuYmVnaW5PYmplY3QoKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKCJhIiwgcmVhZGVyLm5leHROYW1lKCkpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgcmVhZGVyLm5leHRCb29sZWFuKCk7CisgICAgICAgICAgICBmYWlsKCk7CisgICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGV4cGVjdGVkKSB7CisgICAgICAgIH0KKworICAgICAgICByZWFkZXIgPSBuZXcgSnNvblJlYWRlcihuZXcgU3RyaW5nUmVhZGVyKCJ7XCJhXCI9PnRydWV9IikpOworICAgICAgICByZWFkZXIuYmVnaW5PYmplY3QoKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKCJhIiwgcmVhZGVyLm5leHROYW1lKCkpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgcmVhZGVyLm5leHRCb29sZWFuKCk7CisgICAgICAgICAgICBmYWlsKCk7CisgICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGV4cGVjdGVkKSB7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB0ZXN0TGVuaWVudE5hbWVWYWx1ZVNlcGFyYXRvcigpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIEpzb25SZWFkZXIgcmVhZGVyID0gbmV3IEpzb25SZWFkZXIobmV3IFN0cmluZ1JlYWRlcigie1wiYVwiPXRydWV9IikpOworICAgICAgICByZWFkZXIuc2V0TGVuaWVudCh0cnVlKTsKKyAgICAgICAgcmVhZGVyLmJlZ2luT2JqZWN0KCk7CisgICAgICAgIGFzc2VydEVxdWFscygiYSIsIHJlYWRlci5uZXh0TmFtZSgpKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKHRydWUsIHJlYWRlci5uZXh0Qm9vbGVhbigpKTsKKworICAgICAgICByZWFkZXIgPSBuZXcgSnNvblJlYWRlcihuZXcgU3RyaW5nUmVhZGVyKCJ7XCJhXCI9PnRydWV9IikpOworICAgICAgICByZWFkZXIuc2V0TGVuaWVudCh0cnVlKTsKKyAgICAgICAgcmVhZGVyLmJlZ2luT2JqZWN0KCk7CisgICAgICAgIGFzc2VydEVxdWFscygiYSIsIHJlYWRlci5uZXh0TmFtZSgpKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKHRydWUsIHJlYWRlci5uZXh0Qm9vbGVhbigpKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB0ZXN0U3RyaWN0Q29tbWVudHMoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBKc29uUmVhZGVyIHJlYWRlciA9IG5ldyBKc29uUmVhZGVyKG5ldyBTdHJpbmdSZWFkZXIoIlsvLyBjb21tZW50IFxuIHRydWVdIikpOworICAgICAgICByZWFkZXIuYmVnaW5BcnJheSgpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgcmVhZGVyLm5leHRCb29sZWFuKCk7CisgICAgICAgICAgICBmYWlsKCk7CisgICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGV4cGVjdGVkKSB7CisgICAgICAgIH0KKworICAgICAgICByZWFkZXIgPSBuZXcgSnNvblJlYWRlcihuZXcgU3RyaW5nUmVhZGVyKCJbIyBjb21tZW50IFxuIHRydWVdIikpOworICAgICAgICByZWFkZXIuYmVnaW5BcnJheSgpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgcmVhZGVyLm5leHRCb29sZWFuKCk7CisgICAgICAgICAgICBmYWlsKCk7CisgICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGV4cGVjdGVkKSB7CisgICAgICAgIH0KKworICAgICAgICByZWFkZXIgPSBuZXcgSnNvblJlYWRlcihuZXcgU3RyaW5nUmVhZGVyKCJbLyogY29tbWVudCAqLyB0cnVlXSIpKTsKKyAgICAgICAgcmVhZGVyLmJlZ2luQXJyYXkoKTsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIHJlYWRlci5uZXh0Qm9vbGVhbigpOworICAgICAgICAgICAgZmFpbCgpOworICAgICAgICB9IGNhdGNoIChJT0V4Y2VwdGlvbiBleHBlY3RlZCkgeworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdGVzdExlbmllbnRDb21tZW50cygpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIEpzb25SZWFkZXIgcmVhZGVyID0gbmV3IEpzb25SZWFkZXIobmV3IFN0cmluZ1JlYWRlcigiWy8vIGNvbW1lbnQgXG4gdHJ1ZV0iKSk7CisgICAgICAgIHJlYWRlci5zZXRMZW5pZW50KHRydWUpOworICAgICAgICByZWFkZXIuYmVnaW5BcnJheSgpOworICAgICAgICBhc3NlcnRFcXVhbHModHJ1ZSwgcmVhZGVyLm5leHRCb29sZWFuKCkpOworCisgICAgICAgIHJlYWRlciA9IG5ldyBKc29uUmVhZGVyKG5ldyBTdHJpbmdSZWFkZXIoIlsjIGNvbW1lbnQgXG4gdHJ1ZV0iKSk7CisgICAgICAgIHJlYWRlci5zZXRMZW5pZW50KHRydWUpOworICAgICAgICByZWFkZXIuYmVnaW5BcnJheSgpOworICAgICAgICBhc3NlcnRFcXVhbHModHJ1ZSwgcmVhZGVyLm5leHRCb29sZWFuKCkpOworCisgICAgICAgIHJlYWRlciA9IG5ldyBKc29uUmVhZGVyKG5ldyBTdHJpbmdSZWFkZXIoIlsvKiBjb21tZW50ICovIHRydWVdIikpOworICAgICAgICByZWFkZXIuc2V0TGVuaWVudCh0cnVlKTsKKyAgICAgICAgcmVhZGVyLmJlZ2luQXJyYXkoKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKHRydWUsIHJlYWRlci5uZXh0Qm9vbGVhbigpKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB0ZXN0U3RyaWN0VW5xdW90ZWROYW1lcygpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIEpzb25SZWFkZXIgcmVhZGVyID0gbmV3IEpzb25SZWFkZXIobmV3IFN0cmluZ1JlYWRlcigie2E6dHJ1ZX0iKSk7CisgICAgICAgIHJlYWRlci5iZWdpbk9iamVjdCgpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgcmVhZGVyLm5leHROYW1lKCk7CisgICAgICAgICAgICBmYWlsKCk7CisgICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGV4cGVjdGVkKSB7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB0ZXN0TGVuaWVudFVucXVvdGVkTmFtZXMoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBKc29uUmVhZGVyIHJlYWRlciA9IG5ldyBKc29uUmVhZGVyKG5ldyBTdHJpbmdSZWFkZXIoInthOnRydWV9IikpOworICAgICAgICByZWFkZXIuc2V0TGVuaWVudCh0cnVlKTsKKyAgICAgICAgcmVhZGVyLmJlZ2luT2JqZWN0KCk7CisgICAgICAgIGFzc2VydEVxdWFscygiYSIsIHJlYWRlci5uZXh0TmFtZSgpKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB0ZXN0U3RyaWN0U2luZ2xlUXVvdGVkTmFtZXMoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBKc29uUmVhZGVyIHJlYWRlciA9IG5ldyBKc29uUmVhZGVyKG5ldyBTdHJpbmdSZWFkZXIoInsnYSc6dHJ1ZX0iKSk7CisgICAgICAgIHJlYWRlci5iZWdpbk9iamVjdCgpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgcmVhZGVyLm5leHROYW1lKCk7CisgICAgICAgICAgICBmYWlsKCk7CisgICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGV4cGVjdGVkKSB7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB0ZXN0TGVuaWVudFNpbmdsZVF1b3RlZE5hbWVzKCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgSnNvblJlYWRlciByZWFkZXIgPSBuZXcgSnNvblJlYWRlcihuZXcgU3RyaW5nUmVhZGVyKCJ7J2EnOnRydWV9IikpOworICAgICAgICByZWFkZXIuc2V0TGVuaWVudCh0cnVlKTsKKyAgICAgICAgcmVhZGVyLmJlZ2luT2JqZWN0KCk7CisgICAgICAgIGFzc2VydEVxdWFscygiYSIsIHJlYWRlci5uZXh0TmFtZSgpKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB0ZXN0U3RyaWN0VW5xdW90ZWRTdHJpbmdzKCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgSnNvblJlYWRlciByZWFkZXIgPSBuZXcgSnNvblJlYWRlcihuZXcgU3RyaW5nUmVhZGVyKCJbYV0iKSk7CisgICAgICAgIHJlYWRlci5iZWdpbkFycmF5KCk7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICByZWFkZXIubmV4dFN0cmluZygpOworICAgICAgICAgICAgZmFpbCgpOworICAgICAgICB9IGNhdGNoIChJT0V4Y2VwdGlvbiBleHBlY3RlZCkgeworICAgICAgICB9CisgICAgfQorCisgICAg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ZXIubmV4dEJvb2xlYW4oKSk7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICByZWFkZXIubmV4dE51bGwoKTsKKyAgICAgICAgICAgIGZhaWwoKTsKKyAgICAgICAgfSBjYXRjaCAoSU9FeGNlcHRpb24gZXhwZWN0ZWQpIHsKKyAgICAgICAgfQorCisgICAgICAgIHJlYWRlciA9IG5ldyBKc29uUmVhZGVyKG5ldyBTdHJpbmdSZWFkZXIoIlssdHJ1ZV0iKSk7CisgICAgICAgIHJlYWRlci5iZWdpbkFycmF5KCk7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICByZWFkZXIubmV4dE51bGwoKTsKKyAgICAgICAgICAgIGZhaWwoKTsKKyAgICAgICAgfSBjYXRjaCAoSU9FeGNlcHRpb24gZXhwZWN0ZWQpIHsKKyAgICAgICAgfQorCisgICAgICAgIHJlYWRlciA9IG5ldyBKc29uUmVhZGVyKG5ldyBTdHJpbmdSZWFkZXIoIlt0cnVlLF0iKSk7CisgICAgICAgIHJlYWRlci5iZWdpbkFycmF5KCk7CisgICAgICAgIGFzc2VydEVxdWFscyh0cnVlLCByZWFkZXIubmV4dEJvb2xlYW4oKSk7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICByZWFkZXIubmV4dE51bGwoKTsKKyAgICAgICAgICAgIGZhaWwoKTsKKyAgICAgICAgfSBjYXRjaCAoSU9FeGNlcHRpb24gZXhwZWN0ZWQpIHsKKyAgICAgICAgfQorCisgICAgICAgIHJlYWRlciA9IG5ldyBKc29uUmVhZGVyKG5ldyBTdHJpbmdSZWFkZXIoIlssXSIpKTsKKyAgICAgICAgcmVhZGVyLmJlZ2luQXJyYXkoKTsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIHJlYWRlci5uZXh0TnVsbCgpOworICAgICAgICAgICAgZmFpbCgpOworICAgICAgICB9IGNhdGNoIChJT0V4Y2VwdGlvbiBleHBlY3RlZCkgeworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdGVzdExlbmllbnRVbm5lY2Vzc2FyeUFycmF5U2VwYXJhdG9ycygpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIEpzb25SZWFkZXIgcmVhZGVyID0gbmV3IEpzb25SZWFkZXIobmV3IFN0cmluZ1JlYWRlcigiW3RydWUsLHRydWVdIikpOworICAgICAgICByZWFkZXIuc2V0TGVuaWVudCh0cnVlKTsKKyAgICAgICAgcmVhZGVyLmJlZ2luQXJyYXkoKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKHRydWUsIHJlYWRlci5uZXh0Qm9vbGVhbigpKTsKKyAgICAgICAgcmVhZGVyLm5leHROdWxsKCk7CisgICAgICAgIGFzc2VydEVxdWFscyh0cnVlLCByZWFkZXIubmV4dEJvb2xlYW4oKSk7CisgICAgICAgIHJlYWRlci5lbmRBcnJheSgpOworCisgICAgICAgIHJlYWRlciA9IG5ldyBKc29uUmVhZGVyKG5ldyBTdHJpbmdSZWFkZXIoIlssdHJ1ZV0iKSk7CisgICAgICAgIHJlYWRlci5zZXRMZW5pZW50KHRydWUpOworICAgICAgICByZWFkZXIuYmVnaW5BcnJheSgpOworICAgICAgICByZWFkZXIubmV4dE51bGwoKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKHRydWUsIHJlYWRlci5uZXh0Qm9vbGVhbigpKTsKKyAgICAgICAgcmVhZGVyLmVuZEFycmF5KCk7CisKKyAgICAgICAgcmVhZGVyID0gbmV3IEpzb25SZWFkZXIobmV3IFN0cmluZ1JlYWRlcigiW3RydWUsXSIpKTsKKyAgICAgICAgcmVhZGVyLnNldExlbmllbnQodHJ1ZSk7CisgICAgICAgIHJlYWRlci5iZWdpbkFycmF5KCk7CisgICAgICAgIGFzc2VydEVxdWFscyh0cnVlLCByZWFkZXIubmV4dEJvb2xlYW4oKSk7CisgICAgICAgIHJlYWRlci5uZXh0TnVsbCgpOworICAgICAgICByZWFkZXIuZW5kQXJyYXkoKTsKKworICAgICAgICByZWFkZXIgP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AgICBqc29uV3JpdGVyLmJlZ2luT2JqZWN0KCk7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBqc29uV3JpdGVyLmVuZEFycmF5KCk7CisgICAgICAgICAgICBmYWlsKCk7CisgICAgICAgIH0gY2F0Y2ggKElsbGVnYWxTdGF0ZUV4Y2VwdGlvbiBleHBlY3RlZCkgeworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdGVzdEJhZE5lc3RpbmdBcnJheSgpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIFN0cmluZ1dyaXRlciBzdHJpbmdXcml0ZXIgPSBuZXcgU3RyaW5nV3JpdGVyKCk7CisgICAgICAgIEpzb25Xcml0ZXIganNvbldyaXRlciA9IG5ldyBKc29uV3JpdGVyKHN0cmluZ1dyaXRlcik7CisgICAgICAgIGpzb25Xcml0ZXIuYmVnaW5BcnJheSgpOworICAgICAgICBqc29uV3JpdGVyLmJlZ2luQXJyYXkoKTsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIGpzb25Xcml0ZXIuZW5kT2JqZWN0KCk7CisgICAgICAgICAgICBmYWlsKCk7CisgICAgICAgIH0gY2F0Y2ggKElsbGVnYWxTdGF0ZUV4Y2VwdGlvbiBleHBlY3RlZCkgeworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdGVzdE51bGxOYW1lKCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgU3RyaW5nV3JpdGVyIHN0cmluZ1dyaXRlciA9IG5ldyBTdHJpbmdXcml0ZXIoKTsKKyAgICAgICAgSnNvbldyaXRlciBqc29uV3JpdGVyID0gbmV3IEpzb25Xcml0ZXIoc3RyaW5nV3JpdGVyKTsKKyAgICAgICAganNvbldyaXRlci5iZWdpbk9iamVjdCgpOworICAgICAgICB0cnkgeworICAgICAgICAgICAganNvbldyaXRlci5uYW1lKG51bGwpOworICAgICAgICAgICAgZmFpbCgpOworICAgICAgICB9IGNhdGNoIChOdWxsUG9pbnRlckV4Y2VwdGlvbiBleHBlY3RlZCkgeworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdGVzdE51bGxTdHJpbmdWYWx1ZSgpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIFN0cmluZ1dyaXRlciBzdHJpbmdXcml0ZXIgPSBuZXcgU3RyaW5nV3JpdGVyKCk7CisgICAgICAgIEpzb25Xcml0ZXIganNvbldyaXRlciA9IG5ldyBKc29uV3JpdGVyKHN0cmluZ1dyaXRlcik7CisgICAgICAgIGpzb25Xcml0ZXIuYmVnaW5PYmplY3QoKTsKKyAgICAgICAganNvbldyaXRlci5uYW1lKCJhIik7CisgICAgICAgIGpzb25Xcml0ZXIudmFsdWUobnVsbCk7CisgICAgICAgIGpzb25Xcml0ZXIuZW5kT2JqZWN0KCk7CisgICAgICAgIGFzc2VydEVxdWFscygie1wiYVwiOm51bGx9Iiwgc3RyaW5nV3JpdGVyLnRvU3RyaW5nKCkpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHRlc3ROb25GaW5pdGVEb3VibGVzKCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgU3RyaW5nV3JpdGVyIHN0cmluZ1dyaXRlciA9IG5ldyBTdHJpbmdXcml0ZXIoKTsKKyAgICAgICAgSnNvbldyaXRlciBqc29uV3JpdGVyID0gbmV3IEpzb25Xcml0ZXIoc3RyaW5nV3JpdGVyKTsKKyAgICAgICAganNvbldyaXRlci5iZWdpbkFycmF5KCk7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBqc29uV3JpdGVyLnZhbHVlKERvdWJsZS5OYU4pOworICAgICAgICAgICAgZmFpbCgpOworICAgICAgICB9IGNhdGNoIChJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24gZXhwZWN0ZWQpIHsKKyAgICAgICAgfQorICAgICAgICB0cnkgeworICAgICAgICAgICAganNvbldyaXRlci52YWx1ZShEb3VibGUuTkVHQVRJVkVfSU5GSU5JVFkpOworICAgICAgICAgICAgZmFpbCgpOworICAgICAgICB9IGNhdGNoIChJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24gZXhwZWN0ZWQpIHsKKyAgICAgICAgfQorICAgICAgICB0cnkgeworICAgICAgICAgICAganNvbldyaXRlci52YWx1ZShEb3VibGUuUE9TSVRJVkVfSU5GSU5JVFkpOworICAgICAgICAgICAgZmFpbCgpOworICAgICAgICB9IGNhdGNoIChJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24gZXhwZWN0ZWQpIHsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHRlc3REb3VibGVzKCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgU3RyaW5nV3JpdGVyIHN0cmluZ1dyaXRlciA9IG5ldyBTdHJpbmdXcml0ZXIoKTsKKyAgICAgICAgSnNvbldyaXRlciBqc29uV3JpdGVyID0gbmV3IEpzb25Xcml0ZXIoc3RyaW5nV3JpdGVyKTsKKyAgICAgICAganNvbldyaXRlci5iZWdpbkFycmF5KCk7CisgICAgICAgIGpzb25Xcml0ZXIudmFsdWUoLTAuMCk7CisgICAgICAgIGpzb25Xcml0ZXIudmFsdWUoMS4wKTsKKyAgICAgICAganNvbldyaXRlci52YWx1ZShEb3VibGUuTUFYX1ZBTFVFKTsKKyAgICAgICAganNvbldyaXRlci52YWx1ZShEb3VibGUuTUlOX1ZBTFVFKTsKKyAgICAgICAganNvbldyaXRlci52YWx1ZSgwLjApOworICAgICAgICBqc29uV3JpdGVyLnZhbHVlKC0wLjUpOworICAgICAgICBqc29uV3JpdGVyLnZhbHVlKERvdWJsZS5NSU5fTk9STUFMKTsKKyAgICAgICAganNvbldyaXRlci52YWx1ZShNYXRoLlBJKTsKKyAgICAgICAganNvbldyaXRlci52YWx1ZShNYXRoLkUpOworICAgICAgICBqc29uV3JpdGVyLmVuZEFycmF5KCk7CisgICAgICAgIGpzb25Xcml0ZXIuY2xvc2UoKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKCJbLTAuMCwiCisgICAgICAgICAgICAgICAgKyAiMS4wLCIKKyAgICAgICAgICAgICAgICArICIxLjc5NzY5MzEzNDg2MjMxNTdFMzA4LCIKKyAgICAgICAgICAgICAgICArICI0LjlFLTMyNCwiCisgICAgICAgICAgICAgICAgKyAiMC4wLCIKKyAgICAgICAgICAgICAgICArICItMC41LCIKKyAgICAgICAgICAgICAgICArICIyLjIyNTA3Mzg1ODUwNzIwMTRFLTMwOCwiCisgICAgICAgICAgICAgICAgKyAiMy4xNDE1OTI2NTM1ODk3OTMsIgorICAgICAgICAgICAgICAgICsgIjIuNzE4MjgxODI4NDU5MDQ1XSIsIHN0cmluZ1dyaXRlci50b1N0cmluZygpKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB0ZXN0TG9uZ3MoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBTdHJpbmdXcml0ZXIgc3RyaW5nV3JpdGVyID0gbmV3IFN0cmluZ1dyaXRlcigpOworICAgICAgICBKc29uV3JpdGVyIGpzb25Xcml0ZXIgPSBuZXcgSnNvbldyaXRlcihzdHJpbmdXcml0ZXIpOworICAgICAgICBqc29uV3JpdGVyLmJlZ2luQXJyYXkoKTsKKyAgICAgICAganNvbldyaXRlci52YWx1ZSgwKTsKKyAgICAgICAganNvbldyaXRlci52YWx1ZSgxKTsKKyAgICAgICAganNvbldyaXRlci52YWx1ZSgtMSk7CisgICAgICAgIGpzb25Xcml0ZXIudmFsdWUoTG9uZy5NSU5fVkFMVUUpOworICAgICAgICBqc29uV3JpdGVyLnZhbHVlKExvbmcuTUFYX1ZBTFVFKTsKKyAgICAgICAganNvbldyaXRlci5lbmRBcnJheSgpOworICAgICAgICBqc29uV3JpdGVyLmNsb3NlKCk7CisgICAgICAgIGFzc2VydEVxdWFscygiWzAsIgorICAgICAgICAgICAgICAgICsgIjEsIgorICAgICAgICAgICAgICAgICsgIi0xLCIKKyAgICAgICAgICAgICAgICArICItOTIyMzM3MjAzNjg1NDc3NTgwOCwiCisgICAgICAgICAgICAgICAgKyAiOTIyMzM3MjAzNjg1NDc3NTgwN10iLCBzdHJpbmdXcml0ZXIudG9TdHJpbmcoKSk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdGVzdEJvb2xlYW5zKCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgU3RyaW5nV3JpdGVyIHN0cmluZ1dyaXRlciA9IG5ldyBTdHJpbmdXcml0ZXIoKTsKKyAgICAgICAgSnNvbldyaXRlciBqc29uV3JpdGVyID0gbmV3IEpzb25Xcml0ZXIoc3RyaW5nV3JpdGVyKTsKKyAgICAgICAganNvbldyaXRlci5iZWdpbkFycmF5KCk7CisgICAgICAgIGpzb25Xcml0ZXIudmFsdWUodHJ1ZSk7CisgICAgICAgIGpzb25Xcml0ZXIudmFsdWUoZmFsc2UpOworICAgICAgICBqc29uV3JpdGVyLmVuZEFycmF5KCk7CisgICAgICAgIGFzc2VydEVxdWFscygiW3RydWUsZmFsc2VdIiwgc3RyaW5nV3JpdGVyLnRvU3RyaW5nKCkpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHRlc3ROdWxscygpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIFN0cmluZ1dyaXRlciBzdHJpbmdXcml0ZXIgPSBuZXcgU3RyaW5nV3JpdGVyKCk7CisgICAgICAgIEpzb25Xcml0ZXIganNvbldyaXRlciA9IG5ldyBKc29uV3JpdGVyKHN0cmluZ1dyaXRlcik7CisgICAgICAgIGpzb25Xcml0ZXIuYmVnaW5BcnJheSgpOworICAgICAgICBqc29uV3JpdGVyLm51bGxWYWx1ZSgpOworICAgICAgICBqc29uV3JpdGVyLmVuZEFycmF5KCk7CisgICAgICAgIGFzc2VydEVxdWFscygiW251bGxdIiwgc3RyaW5nV3JpdGVyLnRvU3RyaW5nKCkpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHRlc3RTdHJpbmdzKCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgU3RyaW5nV3JpdGVyIHN0cmluZ1dyaXRlciA9IG5ldyBTdHJpbmdXcml0ZXIoKTsKKyAgICAgICAgSnNvbldyaXRlciBqc29uV3JpdGVyID0gbmV3IEpzb25Xcml0ZXIoc3RyaW5nV3JpdGVyKTsKKyAgICAgICAganNvbldyaXRlci5iZWdpbkFycmF5KCk7CisgICAgICAgIGpzb25Xcml0ZXIudmFsdWUoImEiKTsKKyAgICAgICAganNvbldyaXRlci52YWx1ZSgiYVwiIik7CisgICAgICAgIGpzb25Xcml0ZXIudmFsdWUoIlwiIik7CisgICAgICAgIGpzb25Xcml0ZXIudmFsdWUoIjoiKTsKKyAgICAgICAganNvbldyaXRlci52YWx1ZSgiLCIpOworICAgICAgICBqc29uV3JpdGVyLnZhbHVlKCJcYiIpOworICAgICAgICBqc29uV3JpdGVyLnZhbHVlKCJcZiIpOworICAgICAgICBqc29uV3JpdGVyLnZhbHVlKCJcbiIpOworICAgICAgICBqc29uV3JpdGVyLnZhbHVlKCJcciIpOworICAgICAgICBqc29uV3JpdGVyLnZhbHVlKCJcdCIpOworICAgICAgICBqc29uV3JpdGVyLnZhbHVlKCIgIik7CisgICAgICAgIGpzb25Xcml0ZXIudmFsdWUoIlxcIik7CisgICAgICAgIGpzb25Xcml0ZXIudmFsdWUoInsiKTsKKyAgICAgICAganNvbldyaXRlci52YWx1ZSgifSIpOworICAgICAgICBqc29uV3JpdGVyLnZhbHVlKCJbIik7CisgICAgICAgIGpzb25Xcml0ZXIudmFsdWUoIl0iKTsKKyAgICAgICAganNvbldyaXRlci52YWx1ZSgiXDAiKTsKKyAgICAgICAganNvbldyaXRlci52YWx1ZSgiXHUwMDE5Iik7CisgICAgICAgIGpzb25Xcml0ZXIuZW5kQXJyYXkoKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKCJbXCJhXCIsIgorICAgICAgICAgICAgICAgICsgIlwiYVxcXCJcIiwiCisgICAgICAgICAgICAgICAgKyAiXCJcXFwiXCIsIgorICAgICAgICAgICAgICAgICsgIlwiOlwiLCIKKyAgICAgICAgICAgICAgICArICJcIixcIiwiCisgICAgICAgICAgICAgICAgKyAiXCJcXGJcIiwiCisgICAgICAgICAgICAgICAgKyAiXCJcXGZcIiwiCisgICAgICAgICAgICAgICAgKyAiXCJcXG5cIiwiCisgICAgICAgICAgICAgICAgKyAiXCJcXHJcIiwiCisgICAgICAgICAgICAgICAgKyAiXCJcXHRcIiwiCisgICAgICAgICAgICAgICAgKyAiXCIgXCIsIgorICAgICAgICAgICAgICAgICsgIlwiXFxcXFwiLCIKKyAgICAgICAgICAgICAgICArICJcIntcIiwiCisgICAgICAgICAgICAgICAgKyAiXCJ9XCIsIgorICAgICAgICAgICAgICAgICsgIlwiW1wiLCIKKyAgICAgICAgICAgICAgICArICJcIl1cIiwiCisgICAgICAgICAgICAgICAgKyAiXCJcXHUwMDAwXCIsIgorICAgICAgICAgICAgICAgICsgIlwiXFx1MDAxOVwiXSIsIHN0cmluZ1dyaXRlci50b1N0cmluZygpKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB0ZXN0RW1wdHlBcnJheSgpIHRocm93cyBJT0V4Y2VwdGlvbiB7CisgICAgICAgIFN0cmluZ1dyaXRlciBzdHJpbmdXcml0ZXIgPSBuZXcgU3RyaW5nV3JpdGVyKCk7CisgICAgICAgIEpzb25Xcml0ZXIganNvbldyaXRlciA9IG5ldyBKc29uV3JpdGVyKHN0cmluZ1dyaXRlcik7CisgICAgICAgIGpzb25Xcml0ZXIuYmVnaW5BcnJheSgpOworICAgICAgICBqc29uV3JpdGVyLmVuZEFycmF5KCk7CisgICAgICAgIGFzc2VydEVxdWFscygiW10iLCBzdHJpbmdXcml0ZXIudG9TdHJpbmcoKSk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdGVzdEVtcHR5T2JqZWN0KCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgU3RyaW5nV3JpdGVyIHN0cmluZ1dyaXRlciA9IG5ldyBTdHJpbmdXcml0ZXIoKTsKKyAgICAgICAgSnNvbldyaXRlciBqc29uV3JpdGVyID0gbmV3IEpzb25Xcml0ZXIoc3RyaW5nV3JpdGVyKTsKKyAgICAgICAganNvbldyaXRlci5iZWdpbk9iamVjdCgpOworICAgICAgICBqc29uV3JpdGVyLmVuZE9iamVjdCgpOworICAgICAgICBhc3NlcnRFcXVhbHMoInt9Iiwgc3RyaW5nV3JpdGVyLnRvU3RyaW5nKCkpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHRlc3RPYmplY3RzSW5BcnJheXMoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBTdHJpbmdXcml0ZXIgc3RyaW5nV3JpdGVyID0gbmV3IFN0cmluZ1dyaXRlcigpOworICAgICAgICBKc29uV3JpdGVyIGpzb25Xcml0ZXIgPSBuZXcgSnNvbldyaXRlcihzdHJpbmdXcml0ZXIpOworICAgICAgICBqc29uV3JpdGVyLmJlZ2luQXJyYXkoKTsKKyAgICAgICAganNvbldyaXRlci5iZWdpbk9iamVjdCgpOworICAgICAgICBqc29uV3JpdGVyLm5hbWUoImEiKS52YWx1ZSg1KTsKKyAgICAgICAganNvbldyaXRlci5uYW1lKCJiIikudmFsdWUoZmFsc2UpOworICAgICAgICBqc29uV3JpdGVyLmVuZE9iamVjdCgpOworICAgICAgICBqc29uV3JpdGVyLmJlZ2luT2JqZWN0KCk7CisgICAgICAgIGpzb25Xcml0ZXIubmFtZSgiYyIpLnZhbHVlKDYpOworICAgICAgICBqc29uV3JpdGVyLm5hbWUoImQiKS52YWx1ZSh0cnVlKTsKKyAgICAgICAganNvbldyaXRlci5lbmRPYmplY3QoKTsKKyAgICAgICAganNvbldyaXRlci5lbmRBcnJheSgpOworICAgICAgICBhc3NlcnRFcXVhbHMoIlt7XCJhXCI6NSxcImJcIjpmYWxzZX0sIgorICAgICAgICAgICAgICAgICsgIntcImNcIjo2LFwiZFwiOnRydWV9XSIsIHN0cmluZ1dyaXRlci50b1N0cmluZygpKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB0ZXN0QXJyYXlzSW5PYmplY3RzKCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgU3RyaW5nV3JpdGVyIHN0cmluZ1dyaXRlciA9IG5ldyBTdHJpbmdXcml0ZXIoKTsKKyAgICAgICAgSnNvbldyaXRlciBqc29uV3JpdGVyID0gbmV3IEpzb25Xcml0ZXIoc3RyaW5nV3JpdGVyKTsKKyAgICAgICAganNvbldyaXRlci5iZWdpbk9iamVjdCgpOworICAgICAgICBqc29uV3JpdGVyLm5hbWUoImEiKTsKKyAgICAgICAganNvbldyaXRlci5iZWdpbkFycmF5KCk7CisgICAgICAgIGpzb25Xcml0ZXIudmFsdWUoNSk7CisgICAgICAgIGpzb25Xcml0ZXIudmFsdWUoZmFsc2UpOworICAgICAgICBqc29uV3JpdGVyLmVuZEFycmF5KCk7CisgICAgICAgIGpzb25Xcml0ZXIubmFtZSgiYiIpOworICAgICAgICBqc29uV3JpdGVyLmJlZ2luQXJyYXkoKTsKKyAgICAgICAganNvbldyaXRlci52YWx1ZSg2KTsKKyAgICAgICAganNvbldyaXRlci52YWx1ZSh0cnVlKTsKKyAgICAgICAganNvbldyaXRlci5lbmRBcnJheSgpOworICAgICAgICBqc29uV3JpdGVyLmVuZE9iamVjdCgpOworICAgICAgICBhc3NlcnRFcXVhbHMoIntcImFcIjpbNSxmYWxzZV0sIgorICAgICAgICAgICAgICAgICsgIlwiYlwiOls2LHRydWVdfSIsIHN0cmluZ1dyaXRlci50b1N0cmluZygpKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB0ZXN0RGVlcE5lc3RpbmdBcnJheXMoKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBTdHJpbmdXcml0ZXIgc3RyaW5nV3JpdGVyID0gbmV3IFN0cmluZ1dyaXRlcigpOworICAgICAgICBKc29uV3JpdGVyIGpzb25Xcml0ZXIgPSBuZXcgSnNvbldyaXRlcihzdHJpbmdXcml0ZXIpOworICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IDIwOyBpKyspIHsKKyAgICAgICAgICAgIGpzb25Xcml0ZXIuYmVnaW5BcnJheSgpOworICAgICAgICB9CisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgMjA7IGkrKykgeworICAgICAgICAgICAganNvbldyaXRlci5lbmRBcnJheSgpOworICAgICAgICB9CisgICAgICAgIGFzc2VydEVxdWFscygiW1tbW1tbW1tbW1tbW1tbW1tbW1tdXV1dXV1dXV1dXV1dXV1dXV1dXSIsIHN0cmluZ1dyaXRlci50b1N0cmluZygpKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB0ZXN0RGVlcE5lc3RpbmdPYmplY3RzKCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgU3RyaW5nV3JpdGVyIHN0cmluZ1dyaXRlciA9IG5ldyBTdHJpbmdXcml0ZXIoKTsKKyAgICAgICAgSnNvbldyaXRlciBqc29uV3JpdGVyID0gbmV3IEpzb25Xcml0ZXIoc3RyaW5nV3JpdGVyKTsKKyAgICAgICAganNvbldyaXRlci5iZWdpbk9iamVjdCgpOworICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IDIwOyBpKyspIHsKKyAgICAgICAgICAgIGpzb25Xcml0ZXIubmFtZSgiYSIpOworICAgICAgICAgICAganNvbldyaXRlci5iZWdpbk9iamVjdCgpOworICAgICAgICB9CisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgMjA7IGkrKykgeworICAgICAgICAgICAganNvbldyaXRlci5lbmRPYmplY3QoKTsKKyAgICAgICAgfQorICAgICAgICBqc29uV3JpdGVyLmVuZE9iamVjdCgpOworICAgICAgICBhc3NlcnRFcXVhbHMoIntcImFcIjp7XCJhXCI6e1wiYVwiOntcImFcIjp7XCJhXCI6e1wiYVwiOntcImFcIjp7XC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c3RyaW5nV3JpdGVyKTsKKyAgICAgICAganNvbldyaXRlci5zZXRJbmRlbnQoIiAgICIpOworCisgICAgICAgIGpzb25Xcml0ZXIuYmVnaW5PYmplY3QoKTsKKyAgICAgICAganNvbldyaXRlci5uYW1lKCJhIikudmFsdWUodHJ1ZSk7CisgICAgICAgIGpzb25Xcml0ZXIubmFtZSgiYiIpLnZhbHVlKGZhbHNlKTsKKyAgICAgICAganNvbldyaXRlci5uYW1lKCJjIikudmFsdWUoNS4wKTsKKyAgICAgICAganNvbldyaXRlci5uYW1lKCJlIikubnVsbFZhbHVlKCk7CisgICAgICAgIGpzb25Xcml0ZXIubmFtZSgiZiIpLmJlZ2luQXJyYXkoKTsKKyAgICAgICAganNvbldyaXRlci52YWx1ZSg2LjApOworICAgICAgICBqc29uV3JpdGVyLnZhbHVlKDcuMCk7CisgICAgICAgIGpzb25Xcml0ZXIuZW5kQXJyYXkoKTsKKyAgICAgICAganNvbldyaXRlci5uYW1lKCJnIikuYmVnaW5PYmplY3QoKTsKKyAgICAgICAganNvbldyaXRlci5uYW1lKCJoIikudmFsdWUoOC4wKTsKKyAgICAgICAganNvbldyaXRlci5uYW1lKCJpIikudmFsdWUoOS4wKTsKKyAgICAgICAganNvbldyaXRlci5lbmRPYmplY3QoKTsKKyAgICAgICAganNvbldyaXRlci5lbmRPYmplY3QoKTsKKworICAgICAgICBTdHJpbmcgZXhwZWN0ZWQgPSAie1xuIgorICAgICAgICAgICAgICAgICsgIiAgIFwiYVwiOiB0cnVlLFxuIgorICAgICAgICAgICAgICAgICsgIiAgIFwiYlwiOiBmYWxzZSxcbiIKKyAgICAgICAgICAgICAgICArICIgICBcImNcIjogNS4wLFxuIgorICAgICAgICAgICAgICAgICsgIiAgIFwiZVwiOiBudWxsLFxuIgorICAgICAgICAgICAgICAgICsgIiAgIFwiZlwiOiBbXG4iCisgICAgICAgICAgICAgICAgKyAiICAgICAgNi4wLFxuIgorICAgICAgICAgICAgICAgICsgIiAgICAgIDcuMFxuIgorICAgICAgICAgICAgICAgICsgIiAgIF0sXG4iCisgICAgICAgICAgICAgICAgKyAiICAgXCJnXCI6IHtcbiIKKyAgICAgICAgICAgICAgICArICIgICAgICBcImhcIjogOC4wLFxuIgorICAgICAgICAgICAgICAgICsgIiAgICAgIFwiaVwiOiA5LjBcbiIKKyAgICAgICAgICAgICAgICArICIgICB9XG4iCisgICAgICAgICAgICAgICAgKyAifSI7CisgICAgICAgIGFzc2VydEVxdWFscyhleHBlY3RlZCwgc3RyaW5nV3JpdGVyLnRvU3RyaW5nKCkpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHRlc3RQcmV0dHlQcmludEFycmF5KCkgdGhyb3dzIElPRXhjZXB0aW9uIHsKKyAgICAgICAgU3RyaW5nV3JpdGVyIHN0cmluZ1dyaXRlciA9IG5ldyBTdHJpbmdXcml0ZXIoKTsKKyAgICAgICAgSnNvbldyaXRlciBqc29uV3JpdGVyID0gbmV3IEpzb25Xcml0ZXIoc3RyaW5nV3JpdGVyKTsKKyAgICAgICAganNvbldyaXRlci5zZXRJbmRlbnQoIiAgICIpOworCisgICAgICAgIGpzb25Xcml0ZXIuYmVnaW5BcnJheSgpOworICAgICAgICBqc29uV3JpdGVyLnZhbHVlKHRydWUpOworICAgICAgICBqc29uV3JpdGVyLnZhbHVlKGZhbHNlKTsKKyAgICAgICAganNvbldyaXRlci52YWx1ZSg1LjApOworICAgICAgICBqc29uV3JpdGVyLm51bGxWYWx1ZSgpOworICAgICAgICBqc29uV3JpdGVyLmJlZ2luT2JqZWN0KCk7CisgICAgICAgIGpzb25Xcml0ZXIubmFtZSgiYSIpLnZhbHVlKDYuMCk7CisgICAgICAgIGpzb25Xcml0ZXIubmFtZSgiYiIpLnZhbHVlKDcuMCk7CisgICAgICAgIGpzb25Xcml0ZXIuZW5kT2JqZWN0KCk7CisgICAgICAgIGpzb25Xcml0ZXIuYmVnaW5BcnJheSgpOworICAgICAgICBqc29uV3JpdGVyLnZhbHVlKDguMCk7CisgICAgICAgIGpzb25Xcml0ZXIudmFsdWUoOS4wKTsKKyAgICAgICAganNvbldyaXRlci5lbmRBcnJheSgpOworICAgICAgICBqc29uV3JpdGVyLmVuZEFycmF5KCk7CisKKyAgICAgICAgU3RyaW5nIGV4cGVjdGVkID0gIltcbiIKKyAgICAgICAgICAgICAgICArICIgICB0cnVlLFxuIgorICAgICAgICAgICAgICAgICsgIiAgIGZhbHNlLFxuIgorICAgICAgICAgICAgICAgICsgIiAgIDUuMCxcbiIKKyAgICAgICAgICAgICAgICArICIgICBudWxsLFxuIgorICAgICAgICAgICAgICAgICsgIiAgIHtcbiIKKyAgICAgICAgICAgICAgICArICIgICAgICBcImFcIjogNi4wLFxuIgorICAgICAgICAgICAgICAgICsgIiAgICAgIFwiYlwiOiA3LjBcbiIKKyAgICAgICAgICAgICAgICArICIgICB9LFxuIgorICAgICAgICAgICAgICAgICsgIiAgIFtcbiIKKyAgICAgICAgICAgICAgICArICIgICAgICA4LjAsXG4iCisgICAgICAgICAgICAgICAgKyAiICAgICAgOS4wXG4iCisgICAgICAgICAgICAgICAgKyAiICAgXVxuIgorICAgICAgICAgICAgICAgICsgIl0iOworICAgICAgICBhc3NlcnRFcXVhbHMoZXhwZWN0ZWQsIHN0cmluZ1dyaXRlci50b1N0cmluZygpKTsKKyAgICB9Cit9CmRpZmYgLS1naXQgYS9jb3JlL3Rlc3RzL2NvcmV0ZXN0cy9zcmMvYW5kcm9pZC91dGlsL1BhdHRlcm5zVGVzdC5qYXZhIGIvY29yZS90ZXN0cy9jb3JldGVzdHMvc3JjL2FuZHJvaWQvdXRpbC9QYXR0ZXJuc1Rlc3QuamF2YQppbmRleCBiOTBjOTdiLi5hYWQzZmUxIDEwMDY0NAotLS0gYS9jb3JlL3Rlc3RzL2NvcmV0ZXN0cy9zcmMvYW5kcm9pZC91dGlsL1BhdHRlcm5zVGVzdC5qYXZhCisrKyBiL2NvcmUvdGVzdHMvY29yZXRlc3RzL3NyYy9hbmRyb2lkL3V0aW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gICAvLyBTZXQgdGhlIHRleHQgc3RhcnRpbmcgcG9zaXRpb24KLSAgICAgICAgICAgIHRleHRWaWV3LnNldFBhZGRpbmcoMzYsIDAsIDAsIDApOwotICAgICAgICAgICAgcmV0dXJuIHRleHRWaWV3OwotICAgICAgICB9Ci0gICAgICAgIAotICAgICAgICBwdWJsaWMgVmlldyBnZXRDaGlsZFZpZXcoaW50IGdyb3VwUG9zaXRpb24sIGludCBjaGlsZFBvc2l0aW9uLCBib29sZWFuIGlzTGFzdENoaWxkLAotICAgICAgICAgICAgICAgIFZpZXcgY29udmVydFZpZXcsIFZpZXdHcm91cCBwYXJlbnQpIHsKLSAgICAgICAgICAgIFRleHRWaWV3IHRleHRWaWV3ID0gZ2V0R2VuZXJpY1ZpZXcoKTsKLSAgICAgICAgICAgIHRleHRWaWV3LnNldFRleHQoZ2V0Q2hpbGQoZ3JvdXBQb3NpdGlvbiwgY2hpbGRQb3NpdGlvbikudG9TdHJpbmcoKSk7Ci0gICAgICAgICAgICByZXR1cm4gdGV4dFZpZXc7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgT2JqZWN0IGdldEdyb3VwKGludCBncm91cFBvc2l0aW9uKSB7Ci0gICAgICAgICAgICByZXR1cm4gZ3JvdXBzW2dyb3VwUG9zaXRpb25dOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIGludCBnZXRHcm91cENvdW50KCkgewotICAgICAgICAgICAgcmV0dXJuIGdyb3Vwcy5sZW5ndGg7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgbG9uZyBnZXRHcm91cElkKGludCBncm91cFBvc2l0aW9uKSB7Ci0gICAgICAgICAgICByZXR1cm4gZ3JvdXBQb3NpdGlvbjsKLSAgICAgICAgfQotCi0gICAgICAgIHB1YmxpYyBWaWV3IGdldEdyb3VwVmlldyhpbnQgZ3JvdXBQb3NpdGlvbiwgYm9vbGVhbiBpc0V4cGFuZGVkLCBWaWV3IGNvbnZlcnRWaWV3LAotIC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bCgiV3JvbmcgZmxhdCBwb3NpdGlvbiIsIGdyb3VwUG9zaXRpb24sIGFkYXB0ZXJDb250ZXh0TWVudUluZm8ucG9zaXRpb24pKSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuOwotICAgICAgICAgICAgfQotICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgaWYgKCFpc1RydWUoIk1lbnVJbmZvIGlzIG5vdCBhbiBFeHBhbmRhYmxlTGlzdENvbnRleHRNZW51SW5mbyIsCi0gICAgICAgICAgICAgICAgICAgIG1lbnVJbmZvIGluc3RhbmNlb2YgRXhwYW5kYWJsZUxpc3RWaWV3LkV4cGFuZGFibGVMaXN0Q29udGV4dE1lbnVJbmZvKSkgewotICAgICAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIEV4cGFuZGFibGVMaXN0Vmlldy5FeHBhbmRhYmxlTGlzdENvbnRleHRNZW51SW5mbyBlbHZNZW51SW5mbyA9Ci0gICAgICAgICAgICAgICAgKEV4cGFuZGFibGVMaXN0Vmlldy5FeHBhbmRhYmxlTGlzdENvbnRleHRNZW51SW5mbykgbWVudUluZm87Ci0gICAgICAgICAgICBsb25nIHBhY2tlZFBvc2l0aW9uID0gZWx2TWVudUluZm8ucGFja2VkUG9zaXRpb247Ci0KLSAgICAgICAgICAgIGludCBwYWNrZWRQb3NpdGlvblR5cGUgPSBFeHBhbmRhYmxlTGlzdFZpZXcuZ2V0UGFja2VkUG9zaXRpb25UeXBlKHBhY2tlZFBvc2l0aW9uKTsKLSAgICAgICAgICAgIGlmICghYXJlRXF1YWwoIldyb25nIHBhY2tlZCBwb3NpdGlvbiB0eXBlIiwgdGVzdFR5cGUsIHBhY2tlZFBvc2l0aW9uVHlwZSkpIHsKLSAgICAgICAgICAgICAgICByZXR1cm47Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGludCBwYWNrZWRQb3NpdGlvbkdyb3VwID0gRXhwYW5kYWJsZUxpc3RWaWV3LmdldFBhY2tlZFBvc2l0aW9uR3JvdXAocGFja2VkUG9zaXRpb24pOwotICAgICAgICAgICAgaWYgKCFhcmVFcXVhbCgiV3JvbmcgZ3JvdXAgcG9zaXRpb24iLCBncm91cFBvc2l0aW9uLCBwYWNrZWRQb3NpdGlvbkdyb3VwKSkgewotICAgICAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgaWYgKHRlc3RUeXBlID09IEV4cGFuZGFibGVMaXN0Vmlldy5QQUNLRURfUE9TSVRJT05fVFlQRV9DSElMRCkgewotICAgICAgICAgICAgICAgIGludCBwYWNrZWRQb3NpdGlvbkNoaWxkID0gRXhwYW5kYWJsZUxpc3RWaWV3LmdldFBhY2tlZFBvc2l0aW9uQ2hpbGQocGFja2VkUG9zaXRpb24pOwotICAgICAgICAgICAgICAgIGlmICghYXJlRXF1YWwoIldyb25nIGNoaWxkIHBvc2l0aW9uIiwgY2hpbGRQb3NpdGlvbiwgcGFja2VkUG9zaXRpb25DaGlsZCkpIHsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgIH0KLQotICAgIHByaXZhdGUgYm9vbGVhbiBhcmVFcXVhbChTdHJpbmcgbWVzc2FnZSwgaW50IGV4cGVjdGVkLCBpbnQgYWN0dWFsKSB7Ci0gICAgICAgIGlmIChleHBlY3RlZCAhPSBhY3R1YWwpIHsKLSAgICAgICAgICAgIGVycm9yTWVzc2FnZSA9IFN0cmluZy5mb3JtYXQobWVzc2FnZSArICIgKCVkIHZzICVkIiwgZXhwZWN0ZWQsIGFjdHVhbCk7Ci0gICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgIH0KLSAgICAgICAgcmV0dXJuIHRydWU7Ci0gICAgfQotCi0gICAgcHJpdmF0ZSBib29sZWFuIGlzVHJ1ZShTdHJpbmcgbWVzc2FnZSwgYm9vbGVhbi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E+CisgICAgICAgICAgICAgICAgICAgIDxvbD4KKyAgICAgICAgICAgICAgICAgICAgICAgIDxsaT4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICA8YSBocmVmPSIjQ3JlYXRlVGVzdFByb2plY3QiPkNyZWF0aW5nIGEgdGVzdCBwcm9qZWN0PC9hPgorICAgICAgICAgICAgICAgICAgICAgICAgPC9saT4KKyAgICAgICAgICAgICAgICAgICAgICAgIDxsaT4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICA8YSBocmVmPSIjVXBkYXRlVGVzdFByb2plY3QiPlVwZGF0aW5nIGEgdGVzdCBwcm9qZWN0PC9hPgorICAgICAgICAgICAgICAgICAgICAgICAgPC9saT4KKyAgICAgICAgICAgICAgICAgICAgPC9vbD4KKyAgICAgICAgICAgICAgICA8L2xpPgorICAgICAgICAgICAgICAgIDxsaT4KKyAgICAgICAgICAgICAgICAgICAgPGEgaHJlZj0iI0NyZWF0ZVRlc3RBcHAiPkNyZWF0aW5nIGEgVGVzdCBQYWNrYWdlPC9hPgorICAgICAgICAgICAgICAgIDwvbGk+CisgICAgICAgICAgICAgICAgPGxpPgorICAgICAgICAgICAgICAgICAgICA8YSBocmVmPSIjUnVuVGVzdHNDb21tYW5kIj5SdW5uaW5nIFRlc3RzPC9hPgorICAgICAgICAgICAgICAgICAgICA8b2w+CisgICAgICAgICAgICAgICAgICAgICAgICA8bGk+CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgPGEgaHJlZj0iI1J1blRlc3RzQW50Ij5RdWljayBidWlsZCBhbmQgcnVuIHdpdGggQW50PC9hPgorICAgICAgICAgICAgICAgICAgICAgICAgPC9saT4KKyAgICAgICAgICAgICAgICAgICAgICAgIDxsaT4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICA8YSBocmVmPSIjUnVuVGVzdHNEZXZpY2UiPlJ1bm5pbmcgdGVzdHMgb24gYSBkZXZpY2Ugb3IgZW11bGF0b3I8L2E+CisgICAgICAgICAgICAgICAgICAgICAgICA8L2xpPgorICAgICAgICAgICAgICAgICAgICA8L29sPgorICAgICAgICAgICAgICAgIDwvbGk+CisgICAgICAgICAgICAgICAgPGxpPgorICAgICAgICAgICAgICAgICAgICA8YSBocmVmPSIjQU1TeW50YXgiPlVzaW5nIHRoZSBJbnN0cnVtZW50IENvbW1hbmQ8L2E+CisgICAgICAgICAgICAgICAgICAgIDxvbD4KKyAgICAgICAgICAgICAgICAgICAgICAgIDxsaT4KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICA8YSBocmVmPSIjQU1PcHRpb25zU3ludGF4Ij5JbnN0cnVtZW50IG9wdGlvbnM8L2E+CisgICAgICAgICAgICAgICAgICAgICAgICA8L2xpPgorICAgICAgICAgICAgICAgICAgICAgICAgPGxpPgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxhIGhyZWY9IiNSdW5UZXN0RXhhbXBsZXMiPkluc3RydW1lbnQgZXhhbXBsZXM8L2E+CisgICAgICAgICAgICAgICAgICAgICAgICA8L2xpPgorICAgICAgICAgICAgICAgICAgICA8L29sPgorICAgICAgICAgICAgICAgIDwvbGk+CisgICAgICAgICAgICA8L29sPgorICAgICAgICA8aDI+U2VlIEFsc288L2gyPgorICAgICAgICAgICAgPG9sPgorICAgICAgICAgICAgICAgIDxsaT4KKyAgICAgICAgICAgICAgICAgICAgPGEgaHJlZj0ie0Bkb2NSb290fWd1aWRlL3RvcGljcy90ZXN0aW5nL3Rlc3RpbmdfYW5kcm9pZC5odG1sIj4KKyAgICAgICAgICAgICAgICAgICAgICAgIFRlc3RpbmcgRnVuZGFtZW50YWxzPC9hPgorICAgICAgICAgICAgICAgIDwvbGk+CisgICAgICAgICAgICAgICAgPGxpPgorICAgICAgICAgICAgICAgICAgICA8YSBocmVmPSJ7QGRvY1Jvb3R9Z3VpZGUvZGV2ZWxvcGluZy90b29scy9hZGIuaHRtbCI+QW5kcm9pZCBEZWJ1ZyBCcmlkZ2U8L2E+CisgICAgICAgICAgICAgICAgPC9saT4KKyA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KKyAgICBwYXRoOiAnc2FtcGxlcy9Db250YWN0TWFuYWdlci9pbmRleC5odG1sJywKKyAgICB0aXRsZTogeworICAgICAgZW46ICdDb250YWN0IE1hbmFnZXInCisgICAgfSwKKyAgICBkZXNjcmlwdGlvbjogeworICAgICAgZW46ICdBbiBhcHBsaWNhdGlvbiB0aGF0IGRlbW9uc3RyYXRlcyBob3cgdG8gcXVlcnkgdGhlIHN5c3RlbSBjb250YWN0cyBwcm92aWRlciAgdXNpbmcgdGhlIDxjb2RlPkNvbnRhY3RzQ29udHJhY3Q8L2NvZGU+IEFQSSwgYXMgd2VsbCBhcyBpbnNlcnQgY29udGFjdHMgaW50byBhIHNwZWNpZmljIGFjY291bnQuJworICAgIH0KKyAgfSwKKyAgeworICAgIHRhZ3M6IFsnc2FtcGxlJ10sCisgICAgcGF0aDogJ3NhbXBsZXMvSG9tZS9pbmRleC5odG1sJywKKyAgICB0aXRsZTogeworICAgICAgZW46ICdIb21lJworICAgIH0sCisgICAgZGVzY3JpcHRpb246IHsKKyAgICAgIGVuOiAnQSBob21lIHNjcmVlbiByZXBsYWNlbWVudCBhcHBsaWNhdGlvbi4nCisgICAgfQorICB9LAorICB7CisgICAgdGFnczogWydzYW1wbGUnLCAnZ2FtZWRldicsICdtZWRpYSddLAorICAgIHBhdGg6ICdzYW1wbGVzL0pldEJveS9pbmRleC5odG1sJywKKyAgICB0aXRsZTogeworICAgICAgZW46ICdKZXRCb3knCisgICAgfSwKKyAgICBkZXNjcmlwdGlvbjogeworICAgICAgZW46ICdBIGdhbWUgdGhhdCBkZW1vbnN0cmF0ZXMgdGhlIFNPTmlWT1ggSkVUIGludGVyYWN0aXZlIG11c2ljIHRlY2hub2xvZ3ksIHdpdGggPGNvZGU+PGEgaHJlZj0iL3JlZmVyZW5jZS9hbmRyb2lkL21lZGlhL0pldFBsYXllci5odG1sIj5KZXRQbGF5ZXI8L2E+PC9jb2RlPi4nCisgICAgfQorICB9LAorICB7CisgICAgdGFnczogWydzYW1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NyZWVuIHdpZGdldHMgZXhhbXBsZS4nCisgICAgfQorICB9LAorICB7CisgICAgdGFnczogWydzYW1wbGUnLCAnbGF5b3V0JywgJ25ldyddLAorICAgIHBhdGg6ICdzYW1wbGVzL1htbEFkYXB0ZXJzL2luZGV4Lmh0bWwnLAorICAgIHRpdGxlOiB7CisgICAgICBlbjogJ1hNTCBBZGFwdGVycycKKyAgICB9LAorICAgIGRlc2NyaXB0aW9uOiB7CisgICAgICBlbjogJ0JpbmRpbmcgZGF0YSB0byB2aWV3cyB1c2luZyBYTUwgQWRhcHRlcnMgZXhhbXBsZXMuJworICAgIH0KKyAgfSwKKworLy8vLy8vLy8vLy8vLy8vLy8KKy8vLyBUVVRPUklBTFMgLy8vCisvLy8vLy8vLy8vLy8vLy8vLworCisgIHsKKyAgICB0YWdzOiBbJ3R1dG9yaWFsJ10sCisgICAgcGF0aDogJ3R1dG9yaWFscy9oZWxsby13b3JsZC5odG1sJywKKyAgICB0aXRsZTogeworICAgICAgZW46ICdIZWxsbyBXb3JsZCcKKyAgICB9LAorICAgIGRlc2NyaXB0aW9uOiB7CisgICAgICBlbjogJ0JlZ2lubmluZyBiYXNpYyBhcHBsaWNhdGlvbiBkZXZlbG9wbWVudCB3aXRoIHRoZSBBbmRyb2lkIFNESy4nCisgICAgfQorICB9LAorICB7CisgICAgdGFnczogWyd0dXRvcmlhbCcsICd1aScsICdsYXlvdXQnXSwKKyAgICBwYXRoOiAndHV0b3JpYWxzL3ZpZXdzL2luZGV4Lmh0bWwnLAorICAgIHRpdGxlOiB7CisgICAgICBlbjogJ0hlbGxvIFZpZXdzJworICAgIH0sCisgICAgZGVzY3JpcHRpb246IHsKKyAgICAgIGVuOiAnQSB3YWxrLXRocm91Z2ggb2YgdGhlIHZhcmlvdXMgdHlwZXMgb2YgbGF5b3V0cyBhbmQgdmlld3MgYXZhaWxhYmxlIGluIHRoZSBBbmRyb2lkIFNESy4nCisgICAgfQorICB9LAorICB7CisgICAgdGFnczogWyd0dXR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pdHkoKSBCaXRtYXAuZ2V0RGVuc2l0eSgpfS4KKyAgICAgKiBAZGVwcmVjYXRlZCBUaGlzIG1ldGhvZCBpcyBub3Qgc3VwcG9ydGVkIGFuZCBzaG91bGQgbm90IGJlIGludm9rZWQuCiAgICAgICovCi0gICAgcHVibGljIENhbnZhcyhHTCBnbCkgewotICAgICAgICBtTmF0aXZlQ2FudmFzID0gaW5pdEdMKCk7Ci0gICAgICAgIG1HTCA9IGdsOwotICAgICAgICBtRGVuc2l0eSA9IEJpdG1hcC5nZXREZWZhdWx0RGVuc2l0eSgpOworICAgIEBEZXByZWNhdGVkCisgICAgcHJvdGVjdGVkIEdMIGdldEdMKCkgeworICAgICAgICByZXR1cm4gbnVsbDsKICAgICB9Ci0gICAgCisKICAgICAvKioKLSAgICAgKiBSZXR1cm4gdGhlIEdMIG9iamVjdCBhc3NvY2lhdGVkIHdpdGggdGhpcyBjYW52YXMsIG9yIG51bGwgaWYgaXQgaXMgbm90Ci0gICAgICogYmFja2VkIGJ5IEdMLgorICAgICAqIEluZGljYXRlcyB3aGV0aGVyIHRoaXMgQ2FudmFzIHVzZXMgaGFyZHdhcmUgYWNjZWxlcmF0aW9uLgorICAgICAqIAorICAgICAqIE5vdGUgdGhhdCB0aGlzIG1ldGhvZCBkb2VzIG5vdCBkZWZpbmUgd2hhdCB0eXBlIG9mIGhhcmR3YXJlIGFjY2VsZXJhdGlvbgorICAgICAqIG1heSBvciBtYXkgbm90IGJlIHVzZWQuCisgICAgICogCisgICAgICogQHJldHVybiBUcnVlIGlmIGRyYXdpbmcgb3BlcmF0aW9ucyBhcmUgaGFyZHdhcmUgYWNjZWxlcmF0ZWQsCisgICAgICogICAgICAgICBmYWxzZSBvdGhlcndpc2UuCiAgICAgICovCi0gICAgcHVibGljIEdMIGdldEdMKCkgewotICAgICAgICByZXR1cm4gbUdMOworICAgIHB1YmxpYyBib29sZWFuIGlzSGFyZHdhcmVBY2NlbGVyYXRlZCgpIHsKKyAgICAgICAgcmV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F0Y2gpCisgICAgICogQHBhcmFtIGRzdCBUaGUgZGVzdGluYXRpb24gcmVjdGFuZ2xlLgorICAgICAqIEBwYXJhbSBwYWludCBUaGUgcGFpbnQgdG8gZHJhdyB0aGUgYml0bWFwIHdpdGguIG1heSBiZSBudWxsCisgICAgICogCisgICAgICogQGhpZGUKKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBkcmF3UGF0Y2goQml0bWFwIGJpdG1hcCwgYnl0ZVtdIGNodW5rcywgUmVjdEYgZHN0LCBQYWludCBwYWludCkgeworICAgIH0gICAgCisgICAgCisgICAgLyoqCiAgICAgICogRHJhdyB0aGUgc3BlY2lmaWVkIGJpdG1hcCwgd2l0aCBpdHMgdG9wL2xlZnQgY29ybmVyIGF0ICh4LHkpLCB1c2luZwogICAgICAqIHRoZSBzcGVjaWZpZWQgcGFpbnQsIHRyYW5zZm9ybWVkIGJ5IHRoZSBjdXJyZW50IG1hdHJpeC4KICAgICAgKiAKQEAgLTEyNDYsOCArMTI3MCw4IEBACiAgICAgICAgICAgICAodGV4dC5sZW5ndGggLSBpbmRleCAtIGNvdW50KSkgPCAwKSB7CiAgICAgICAgICAgICB0aHJvdyBuZXcgSW5kZXhPdXRPZkJvdW5kc0V4Y2VwdGlvbigpOwogICAgICAgICB9Ci0gICAgICAgIG5hdGl2ZV9kcmF3VGV4dChtTmF0aXZlQ2FudmFzLCB0ZXh0LCBpbmRleCwgY291bnQsIHgsIHksCi0gICAgICAgICAgICAgICAgICAgICAgICBwYWludC5tTmF0aXZlUGFpbnQpOworICAgICAgICBuYXRpdmVfZHJhd1RleHQobU5hdGl2ZUNhbnZhcywgdGV4dCwgaW5kZXgsIGNvdW50LCB4LCB5LCBwYWludC5tQmlkaUZsYWdzLAorICAgICAgICAgICAgICAgIHBhaW50Lm1OYXRpdmVQYWludCk7CiAgICAgfQogCiAgICAgLyoqCkBAIC0xMjU5LDcgKzEyODMsMTAgQEAKICAgICAgKiBAcGFyYW0geSAgICAgVGhlIHkt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0LCBlbmQsIHgsIHksIHBhaW50Lm1CaWRpRmxhZ3MsCisgICAgICAgICAgICAgICAgcGFpbnQubU5hdGl2ZVBhaW50KTsKICAgICB9CiAKICAgICAvKioKQEAgLTEyOTksMTYgKzEzMjYsMTA4IEBACiAgICAgICAgIGlmICh0ZXh0IGluc3RhbmNlb2YgU3RyaW5nIHx8IHRleHQgaW5zdGFuY2VvZiBTcGFubmVkU3RyaW5nIHx8CiAgICAgICAgICAgICB0ZXh0IGluc3RhbmNlb2YgU3Bhbm5hYmxlU3RyaW5nKSB7CiAgICAgICAgICAgICBuYXRpdmVfZHJhd1RleHQobU5hdGl2ZUNhbnZhcywgdGV4dC50b1N0cmluZygpLCBzdGFydCwgZW5kLCB4LCB5LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhaW50Lm1OYXRpdmVQYWludCk7Ci0gICAgICAgIH0KLSAgICAgICAgZWxzZSBpZiAodGV4dCBpbnN0YW5jZW9mIEdyYXBoaWNzT3BlcmF0aW9ucykgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhaW50Lm1CaWRpRmxhZ3MsIHBhaW50Lm1OYXRpdmVQYWludCk7CisgICAgICAgIH0gZWxzZSBpZiAodGV4dCBpbnN0YW5jZW9mIEdyYXBoaWNzT3BlcmF0aW9ucykgewogICAgICAgICAgICAgKChHcmFwaGljc09wZXJhdGlvbnMpIHRleHQpLmRyYXdUZXh0KHRoaXMsIHN0YXJ0LCBlbmQsIHgsIHksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhaW50KTsKLSAgICAgICAgfQotICAgICAgICBlbHNlIHsKKyAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgIGNoYXJbXSBidWYgPSBUZW1wb3JhcnlCdWZmZXIub2J0YWluKGVuZCAtIHN0YXJ0KTsKICAgICAgICAgICAgIFRleHRVdGlscy5nZXRDaGFycyh0ZXh0LCBzdGFydCwgZW5kLCBidWYsIDApOwotICAgICAgICAgICAgZHJhd1RleHQoYnVmLCAwLCBlbmQgLSBzdGFydCwgeCwgeSwgcGFpbnQpOworICAgICAgICAgICAgbmF0aXZlX2RyYXdUZXh0KG1OYXRpdmVDYW52YXMsIGJ1ZiwgMCwgZW5kIC0gc3RhcnQsIHgsIHksIAorICAgICAgICAgICAgICAgICAgICBwYWludC5tQmlkaUZsYWdzLCBwYWludC5tTmF0aXZlUGFpbnQpOworICAgICAgICAgICAgVGVtcG9yYXJ5QnVmZmVyLnJlY3ljbGUoYnVmKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIFJlbmRlciBhIHJ1biBvZiBhbGwgTFRSIG9yIGFsbCBSVEwgdGV4dCwgd2l0aCBzaGFwaW5nLiBUaGlzIGRvZXMgbm90IHJ1bgorICAgICAqIGJpZGkgb24gdGhlIHByb3ZpZGVkIHRleHQsIGJ1dCByZW5kZXJzIGl0IGFzIGEgdW5pZm9ybSByaWdodC10by1sZWZ0IG9yCisgICAgICogbGVmdC10by1yaWdodCBydW4sIGFzIGluZGljYXRlZCBieSBkaXIuIEFsaWdubWVudCBvZiB0aGUgdGV4dCBpcyBhcworICAgICAqIGRldGVybWluZWQgYnkgdGhlIFBhaW50J3MgVGV4dEFsaWduIHZhbHVlLgorICAgICAqIAorICAgICAqIEBwYXJhbSB0ZXh0IHRoZSB0ZXh0IHRvIHJlbmRlcgorICAgICAqIEBwYXJhbSBpbmRleCB0aGUgc3RhcnQgb2YgdGhlIHRleHQgdG8gcmVuZGVyCisgICAgICogQHBhcmFtIGNvdW50IHRoZSBjb3VudCBvZiBjaGFycyB0byByZW5kZXIKKyAgICAgKiBAcGFyYW0gY29udGV4dEluZGV4IHRoZSBzdGFydCBvZiB0aGUgY29udGV4dCBmb3Igc2hhcGluZy4gIE11c3QgYmUKKyAgICAgKiAgICAgICAgIG5vIGdyZWF0ZXIgdGhhbiBpbmRleC4KKyAgICAgKiBAcGFyYW0gY29udGV4dENvdW50IHRoZSBudW1iZXIgb2YgY2hhcmFjdGVycyBpbiB0aGUgY29udGV4dCBmb3Igc2hhcGluZy4KKyAgICAgKiAgICAgICAgIENvbnRleEluZGV4ICsgY29udGV4dENvdW50IG11c3QgYmUgbm8gbGVzcyB0aGFuIGluZGV4CisgICAgICogICAgICAgICArIGNvdW50LgorICAgICAqIEBwYXJhbSB4IHRoZSB4IHBvc2l0aW9uIGF0IHdoaWNoIHRvIGRyYXcgdGhlIHRleHQKKyAgICAgKiBAcGFyYW0geSB0aGUgeSBwb3NpdGlvbiBhdCB3aGljaCB0byBkcmF3IHRoZSB0ZXh0CisgICAgICogQHBhcmFtIGRpciB0aGUgcnVuIGRpcmVjdGlvbiwgZWl0aGVyIHtAbGluayAjRElSRUNUSU9OX0xUUn0gb3IKKyAgICAgKiAgICAgICAgIHtAbGluayAjRElSRUNUSU9OX1JUTH0uCisgICAgICogQHBhcmFtIHBhaW50IHRoZSBwYWludAorICAgICAqIEBoaWRlCisgICAgICovCisgICAgcHVibGljIHZvaWQgZHJhd1RleHRSdW4oY2hhcltdIHRleHQsIGludCBpbmRleCwgaW50IGNvdW50LAorICAgICAgICAgICAgaW50IGNvbnRleHRJbmRleCwgaW50IGNvbnRleHRDb3VudCwgZmxvYXQgeCwgZmxvYXQgeSwgaW50IGRpciwKKyAgICAgICAgICAgIFBhaW50IHBhaW50KSB7CisKKyAgICAgICAgaWYgKHRleHQgPT0gbnVsbCkgeworICAgICAgICAgICAgdGhyb3cgbmV3IE51bGxQb2ludGVyRXhjZXB0aW9uKCJ0ZXh0IGlzIG51bGwiKTsKKyAgICAgICAgfQorICAgICAgICBpZiAocGFpbnQgPT0gbnVsbCkgeworICAgICAgICAgICAgdGhyb3cgbmV3IE51bGxQb2ludGVyRXhjZXB0aW9uKCJwYWludCBpcyBudWxsIik7CisgICAgICAgIH0KKyAgICAgICAgaWYgKChpbmRleCB8IGNvdW50IHwgdGV4dC5sZW5ndGggLSBpbmRleCAtIGNvdW50KSA8IDApIHsKKyA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EluZGV4T3V0T2ZCb3VuZHNFeGNlcHRpb24oKTsKKyAgICAgICAgfQorCisgICAgICAgIGludCBmbGFncyA9IGRpciA9PSAwID8gMCA6IDE7CisKKyAgICAgICAgaWYgKHRleHQgaW5zdGFuY2VvZiBTdHJpbmcgfHwgdGV4dCBpbnN0YW5jZW9mIFNwYW5uZWRTdHJpbmcgfHwKKyAgICAgICAgICAgICAgICB0ZXh0IGluc3RhbmNlb2YgU3Bhbm5hYmxlU3RyaW5nKSB7CisgICAgICAgICAgICBuYXRpdmVfZHJhd1RleHRSdW4obU5hdGl2ZUNhbnZhcywgdGV4dC50b1N0cmluZygpLCBzdGFydCwgZW5kLAorICAgICAgICAgICAgICAgICAgICBjb250ZXh0U3RhcnQsIGNvbnRleHRFbmQsIHgsIHksIGZsYWdzLCBwYWludC5tTmF0aXZlUGFpbnQpOworICAgICAgICB9IGVsc2UgaWYgKHRleHQgaW5zdGFuY2VvZiBHcmFwaGljc09wZXJhdGlvbnMpIHsKKyAgICAgICAgICAgICgoR3JhcGhpY3NPcGVyYXRpb25zKSB0ZXh0KS5kcmF3VGV4dFJ1bih0aGlzLCBzdGFydCwgZW5kLAorICAgICAgICAgICAgICAgICAgICBjb250ZXh0U3RhcnQsIGNvbnRleHRFbmQsIHgsIHksIGZsYWdzLCBwYWludCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBpbnQgY29udGV4dExlbiA9IGNvbnRleHRFbmQgLSBjb250ZXh0U3RhcnQ7CisgICAgICAgICAgICBpbnQgbGVuID0gZW5kIC0gc3RhcnQ7CisgICAgICAgICAgICBjaGFyW10gYnVmID0gVGVtcG9yYXJ5QnVmZmVyLm9idGFpbihjb250ZXh0TGVuKTsKKyAgICAgICAgICAgIFRleHRVdGlscy5nZXRDaGFycyh0ZXh0LCBjb250ZXh0U3RhcnQsIGNvbnRleHRFbmQsIGJ1ZiwgMCk7CisgICAgICAgICAgICBuYXRpdmVfZHJhd1RleHRSdW4obU5hdGl2ZUNhbnZhcywgYnVmLCBzdGFydCAtIGNvbnRleHRTdGFydCwgbGVuLAorICAgICAgICAgICAgICAgICAgICAwLCBjb250ZXh0TGVuLCB4LCB5LCBmbGFncywgcGFpbnQubU5hdGl2ZVBhaW50KTsKICAgICAgICAgICAgIFRlbXBvcmFyeUJ1ZmZlci5yZWN5Y2xlKGJ1Zik7CiAgICAgICAgIH0KICAgICB9CkBAIC0xMzY4LDcgKzE0ODcsNyBAQAogICAgICAgICB9CiAgICAgICAgIG5hdGl2ZV9kcmF3VGV4dE9uUGF0aChtTmF0aXZlQ2FudmFzLCB0ZXh0LCBpbmRleCwgY291bnQsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXRoLm5pKCksIGhPZmZzZXQsIHZPZmZzZXQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWludC5tTmF0aXZlUGFpbnQpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFpbnQubUJpZGlGbGFncywgcGFpbnQubU5hdGl2ZVBhaW50KTsKICAgICB9CiAKICAgICAvKioKQEAgLTEzODgsNyArMTUwNyw4IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgdk9mZnNldCwgUGFpbnQgcGFpbnQpIHsKICAgICAgICAgaWYgKHRleHQubGVuZ3RoKCkgPiAwKSB7CiAgICAgICAgICAgICBuYXRpdmVfZHJhd1RleHRPblBhdGgobU5hdGl2ZUNhbnZhcywgdGV4dCwgcGF0aC5uaSgpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhPZmZzZXQsIHZPZmZzZXQsIHBhaW50Lm1OYXRpdmVQYWludCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaE9mZnNldCwgdk9mZnNldCwgcGFpbnQubUJpZGlGbGFncywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWludC5tTmF0aXZlUGFpbnQpOwogICAgICAgICB9CiAgICAgfQogCkBAIC0xNDMxLDI4ICsxNTUxLDc0IEBACiAgICAgICAgIGRyYXdQaWN0dXJlKHBpY3R1cmUpOwogICAgICAgICByZXN0b3JlKCk7CiAgICAgfQotICAgIAorCisgICAgLyoqCisgICAgICogPHA+QWNxdWlyZXMgdGhlIENhbnZhcyBjb250ZXh0LiBBZnRlciBpbnZva2luZyB0aGlzIG1ldGhvZCwgdGhlIENhbnZhcworICAgICAqIGNvbnRleHQgIGNhbiBiZSBtb2RpZmllZCBieSB0aGUgY2FsbGVyLiBGb3IgaW5zdGFuY2UsIGlmIHlvdSBhY3F1aXJlCisgICAgICogdGhlIGNvbnRleHQgb2YgYW4gT3BlbkdMIENhbnZhcyB5b3UgY2FuIHJlc2V0IHRoZSBHTCB2aWV3cG9ydCwgc2Npc3NvciwKKyAgICAgKiBldGMuPC9wPgorICAgICAqIAorICAgICAqIDxwPkEgY2FsbCB0byB7QGxpbmsgI2FjcXVpcmVDb250ZXh0KCl9IHNob3VsZCBhd2F5cyBiZSBmb2xsb3dlZCBieQorICAgICAqIGEgY2FsbCB0byB7QGxpbmsgI3JlbGVhc2VDb250ZXh0KCl9LCBwcmVmZXJyYWJseSB1c2luZyBhIHRyeSBibG9jazo8L3A+CisgICAgICogCisgICAgICogPHByZT4KKyAgICAgKiB0cnkgeworICAgICAqICAgICBpZiAoY2FudmFzLmFjcXVpcmVDb250ZXh0KCkpIHsKKyAgICAgKiAgICAgICAgIC8vIFVzZSB0aGUgY2FudmFzIGFuZC9vciBpdHMgY29udGV4dAorICAgICAqICAgICB9CisgICAgICogfSBmaW5hbGx5IHsKKyAgICAgKiAgICAgY2FudmFzLnJlbGVhc2VDb250ZXh0KCk7CisgICAgICogfQorICAgICAqIDwvcHJlPgorICAgICAqIAorICAgICAqIDxwPkFjcXVpcmluZyB0aGUgY29udGV4dCBjYW4gYmUgYW4gZXhwZW5zaXZlIG9wZXJhdGlvbiBhbmQgc2hvdWxkIG5vdAorICAgICAqIGJlIGRvbmUgdW5sZXNzIGFic29sdX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XAoaW50IG5hdGl2ZUNhbnZhcywgaW50IGJpdG1hcCk7Ci0gICAgcHJpdmF0ZSBzdGF0aWMgbmF0aXZlIHZvaWQgbmF0aXZlU2V0Vmlld3BvcnQoaW50IG5DYW52YXMsIGludCB3LCBpbnQgaCk7CiAgICAgcHJpdmF0ZSBzdGF0aWMgbmF0aXZlIGludCBuYXRpdmVfc2F2ZUxheWVyKGludCBuYXRpdmVDYW52YXMsIFJlY3RGIGJvdW5kcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHBhaW50LCBpbnQgbGF5ZXJGbGFncyk7CiAgICAgcHJpdmF0ZSBzdGF0aWMgbmF0aXZlIGludCBuYXRpdmVfc2F2ZUxheWVyKGludCBuYXRpdmVDYW52YXMsIGZsb2F0IGwsCkBAIC0xNTU1LDEwICsxNzIxLDE5IEBACiAgICAgCiAgICAgcHJpdmF0ZSBzdGF0aWMgbmF0aXZlIHZvaWQgbmF0aXZlX2RyYXdUZXh0KGludCBuYXRpdmVDYW52YXMsIGNoYXJbXSB0ZXh0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgaW5kZXgsIGludCBjb3VudCwgZmxvYXQgeCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgeSwgaW50IHBhaW50KTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgeSwgaW50IGZsYWdzLCBpbnQgcGFpbnQpOwogICAgIHByaXZhdGUgc3RhdGljIG5hdGl2ZSB2b2lkIG5hdGl2ZV9kcmF3VGV4dChpbnQgbmF0aXZlQ2FudmFzLCBTdHJpbmcgdGV4dCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHN0YXJ0LCBpbnQgZW5kLCBmbG9hdCB4LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB5LCBpbnQgcGFpbnQpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB5LCBpbnQgZmxhZ3MsIGludCBwYWludCk7CisKKyAgICBwcml2YXRlIHN0YXRpYyBuYXRpdmUgdm9pZCBuYXRpdmVfZHJhd1RleHRSdW4oaW50IG5hdGl2ZUNhbnZhcywgU3RyaW5nIHRleHQsCisgICAgICAgICAgICBpbnQgc3RhcnQsIGludCBlbmQsIGludCBjb250ZXh0U3RhcnQsIGludCBjb250ZXh0RW5kLAorICAgICAgICAgICAgZmxvYXQgeCwgZmxvYXQgeSwgaW50IGZsYWdzLCBpbnQgcGFpbnQpOworCisgICAgcHJpdmF0ZSBzdGF0aWMgbmF0aXZlIHZvaWQgbmF0aXZlX2RyYXdUZXh0UnVuKGludCBuYXRpdmVDYW52YXMsIGNoYXJbXSB0ZXh0LAorICAgICAgICAgICAgaW50IHN0YXJ0LCBpbnQgY291bnQsIGludCBjb250ZXh0U3RhcnQsIGludCBjb250ZXh0Q291bnQsCisgICAgICAgICAgICBmbG9hdCB4LCBmbG9hdCB5LCBpbnQgZmxhZ3MsIGludCBwYWludCk7CisKICAgICBwcml2YXRlIHN0YXRpYyBuYXRpdmUgdm9pZCBuYXRpdmVfZHJhd1Bvc1RleHQoaW50IG5hdGl2ZUNhbnZhcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhcltdIHRleHQsIGludCBpbmRleCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGNvdW50LCBmbG9hdFtdIHBvcywKQEAgLTE1NzAsMTEgKzE3NDUsMTMgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hhcltdIHRleHQsIGludCBpbmRleCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGNvdW50LCBpbnQgcGF0aCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgaE9mZnNldCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgdk9mZnNldCwgaW50IHBhaW50KTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgdk9mZnNldCwgaW50IGJpZGlGbGFncywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHBhaW50KTsKICAgICBwcml2YXRlIHN0YXRpYyBuYXRpdmUgdm9pZCBuYXRpdmVfZHJhd1RleHRPblBhdGgoaW50IG5hdGl2ZUNhbnZhcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU3RyaW5nIHRleHQsIGludCBwYXRoLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCBoT2Zmc2V0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB2T2Zmc2V0LCBpbnQgcGFpbnQpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCBoT2Zmc2V0LCAKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgdk9mZnNldCwgCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBmbGFncywgaW50IHBhaW50KTsKICAgICBwcml2YXRlIHN0YXRpYyBuYXRpdmUgdm9pZCBuYXRpdmVfZHJhd1BpY3R1cmUoaW50IG5hdGl2ZUNhbn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ssCisgICAgICAgICAgICAgICAgICAgICAgIG1QYWludCAhPSBudWxsID8gbVBhaW50Lm1OYXRpdmVQYWludCA6IDAsCisgICAgICAgICAgICAgICAgICAgICAgIGNhbnZhcy5tRGVuc2l0eSwgbUJpdG1hcC5tRGVuc2l0eSk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBjYW52YXMuZHJhd1BhdGNoKG1CaXRtYXAsIG1DaHVuaywgbG9jYXRpb24sIG51bGwpOworICAgICAgICB9CiAgICAgfQogICAgIAogICAgIC8qKiAKQEAgLTg3LDEwICs5NywxNSBAQAogICAgICAqIEBwYXJhbSBsb2NhdGlvbiAgV2hlcmUgdG8gZHJhdyB0aGUgYml0bWFwLgogICAgICAqLwogICAgIHB1YmxpYyB2b2lkIGRyYXcoQ2FudmFzIGNhbnZhcywgUmVjdCBsb2NhdGlvbikgewotICAgICAgICBuYXRpdmVEcmF3KGNhbnZhcy5tTmF0aXZlQ2FudmFzLCBsb2NhdGlvbiwKLSAgICAgICAgICAgICAgICBtQml0bWFwLm5pKCksIG1DaHVuaywKLSAgICAgICAgICAgICAgICBtUGFpbnQgIT0gbnVsbCA/IG1QYWludC5tTmF0aXZlUGFpbnQgOiAwLAotICAgICAgICAgICAgICAgIGNhbnZhcy5tRGVuc2l0eSwgbUJpdG1hcC5tRGVuc2l0eSk7CisgICAgICAgIGlmICghY2FudmFzLmlzSGFyZHdhcmVBY2NlbGVyYXRlZCgpKSB7CisgICAgICAgICAgICBuYXRpdmVEcmF3KGNhbnZhcy5tTmF0aXZlQ2FudmFzLCBsb2NhdGlvbiwKKyAgICAgICAgICAgICAgICAgICAgICAgIG1CaXRtYXAubmkoKSwgbUNodW5rLAorICAgICAgICAgICAgICAgICAgICAgICAgbVBhaW50ICE9IG51bGwgPyBtUGFpbnQubU5hdGl2ZVBhaW50IDogMCwKKyAgICAgICAgICAgICAgICAgICAgICAgIGNhbnZhcy5tRGVuc2l0eSwgbUJpdG1hcC5tRGVuc2l0eSk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBtUmVjdC5zZXQobG9jYXRpb24pOworICAgICAgICAgICAgY2FudmFzLmRyYXdQYXRjaChtQml0bWFwLCBtQ2h1bmssIG1SZWN0LCBudWxsKTsKKyAgICAgICAgfQogICAgIH0KIAogICAgIC8qKiAKQEAgLTEwMSw5ICsxMTYsMTQgQEAKICAgICAgKiBAcGFyYW0gcGFpbnQgICAgIFRoZSBQYWludCB0byBkcmF3IHRocm91Z2guCiAgICAgICovCiAgICAgcHVibGljIHZvaWQgZHJhdyhDYW52YXMgY2FudmFzLCBSZWN0IGxvY2F0aW9uLCBQYWludCBwYWludCkgewotICAgICAgICBuYXRpdmVEcmF3KGNhbnZhcy5tTmF0aXZlQ2FudmFzLCBsb2NhdGlvbiwKLSAgICAgICAgICAgICAgICBtQml0bWFwLm5pKCksIG1DaHVuaywgcGFpbnQgIT0gbnVsbCA/IHBhaW50Lm1OYXRpdmVQYWludCA6IDAsCi0gICAgICAgICAgICAgICAgY2FudmFzLm1EZW5zaXR5LCBtQml0bWFwLm1EZW5zaXR5KTsKKyAgICAgICAgaWYgKCFjYW52YXMuaXNIYXJkd2FyZUFjY2VsZXJhdGVkKCkpIHsKKyAgICAgICAgICAgIG5hdGl2ZURyYXcoY2FudmFzLm1OYXRpdmVDYW52YXMsIGxvY2F0aW9uLAorICAgICAgICAgICAgICAgICAgICBtQml0bWFwLm5pKCksIG1DaHVuaywgcGFpbnQgIT0gbnVsbCA/IHBhaW50Lm1OYXRpdmVQYWludCA6IDAsCisgICAgICAgICAgICAgICAgICAgIGNhbnZhcy5tRGVuc2l0eSwgbUJpdG1hcC5tRGVuc2l0eSk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBtUmVjdC5zZXQobG9jYXRpb24pOworICAgICAgICAgICAgY2FudmFzLmRyYXdQYXRjaChtQml0bWFwLCBtQ2h1bmssIG1SZWN0LCBwYWludCk7CisgICAgICAgIH0KICAgICB9CiAKICAgICAvKio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GlkZQorICAgICAqLworICAgIHB1YmxpYyBmbG9hdCBzaGFkb3dEeTsKKyAgICAvKioKKyAgICAgKiBAaGlkZQorICAgICAqLworICAgIHB1YmxpYyBmbG9hdCBzaGFkb3dSYWRpdXM7CisgICAgLyoqCisgICAgICogQGhpZGUKKyAgICAgKi8KKyAgICBwdWJsaWMgaW50IHNoYWRvd0NvbG9yOworCisgICAgLyoqCisgICAgICogQGhpZGUKKyAgICAgKi8KKyAgICBwdWJsaWMgIGludCAgICAgICAgIG1CaWRpRmxhZ3MgPSBCSURJX0RFRkFVTFRfTFRSOwogICAgIAogICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIFN0eWxlW10gc1N0eWxlQXJyYXkgPSB7CiAgICAgICAgIFN0eWxlLkZJTEwsIFN0eWxlLlNUUk9LRSwgU3R5bGUuRklMTF9BTkRfU1RST0tFCkBAIC03Niw4ICsxMDYsMTE2IEBACiAgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IERFRkFVTFRfUEFJTlRfRkxBR1MgPSBERVZfS0VSTl9URVhUX0ZMQUc7CiAKICAgICAvKioKLSAgICAgKiBUaGUgU3R5bGUgc3BlY2lmaWVzIGlmIHRoZSBwcmltaXRpdmUgYmVpbmcgZHJhd24gaXMgZmlsbGVkLAotICAgICAqIHN0cm9rZWQsIG9yIGJvdGggKGluIHRoZSBzYW1lIGNvbG9yKS4gVGhlIGRlZmF1bHQgaXMgRklMTC4KKyAgICAgKiBCaWRpIGZsYWcgdG8gc2V0IExUUiBwYXJhZ3JhcGggZGlyZWN0aW9uLgorICAgICAqIAorICAgICAqIEBoaWRlCisgICAgICovCisgICAgcHVibGljIHN0YXRpYyBmaW5hbCBpbnQgQklESV9MVFIgPSAweDA7CisKKyAgICAvKioKKyAgICAgKiBCaWRpIGZsYWcgdG8gc2V0IFJUTCBwYXJhZ3JhcGggZGlyZWN0aW9uLgorICAgICAqIAorICAgICAqIEBoaWRlCisgICAgICovCisgICAgcHVibGljIHN0YXRpYyBmaW5hbCBpbnQgQklESV9SVEwgPSAweDE7CisKKyAgICAvKioKKyAgICAgKiBCaWRpIGZsYWcgdG8gZGV0ZWN0IHBhcmFncmFwaCBkaXJlY3Rpb24gdmlhIGhldXJpc3RpY3MsIGRlZmF1bHRpbmcgdG8KKyAgICAgKiBMVFIuCisgICAgICogCisgICAgICogQGhpZGUKKyAgICAgKi8KKyAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBCSURJX0RFRkFVTFRfTFRSID0gMHgyOworCisgICAgLyoqCisgICAgICogQmlkaSBmbGFnIHRvIGRldGVjdCBwYXJhZ3JhcGggZGlyZWN0aW9uIHZpYSBoZXVyaXN0aWNzLCBkZWZhdWx0aW5nIHRvCisgICAgICogUlRMLgorICAgICAqIAorICAgICAqIEBoaWRlCisgICAgICovCisgICAgcHVibGljIHN0YXRpYyBmaW5hbCBpbnQgQklESV9ERUZBVUxUX1JUTCA9IDB4MzsKKworICAgIC8qKgorICAgICAqIEJpZGkgZmxhZyB0byBvdmVycmlkZSBkaXJlY3Rpb24gdG8gYWxsIExUUiAoaWdub3JlIGJpZGkpLgorICAgICAqIAorICAgICAqIEBoaWRlCisgICAgICovCisgICAgcHVibGljIHN0YXRpYyBmaW5hbCBpbnQgQklESV9GT1JDRV9MVFIgPSAweDQ7CisKKyAgICAvKioKKyAgICAgKiBCaWRpIGZsYWcgdG8gb3ZlcnJpZGUgZGlyZWN0aW9uIHRvIGFsbCBSVEwgKGlnbm9yZSBiaWRpKS4KKyAgICAgKiAKKyAgICAgKiBAaGlkZQorICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IEJJRElfRk9SQ0VfUlRMID0gMHg1OworCisgICAgLyoqCisgICAgICogTWF4aW11bSBCaWRpIGZsYWcgdmFsdWUuCisgICAgICogQGhpZGUKKyAgICAgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgQklESV9NQVhfRkxBR19WQUxVRSA9IEJJRElfRk9SQ0VfUlRMOworCisgICAgLyoqCisgICAgICogTWFzayBmb3IgYmlkaSBmbGFncy4KKyAgICAgKiBAaGlkZQorICAgICAqLworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBCSURJX0ZMQUdfTUFTSyA9IDB4NzsKKworICAgIC8qKgorICAgICAqIEZsYWcgZm9yIGdldFRleHRSdW5BZHZhbmNlcyBpbmRpY2F0aW5nIGxlZnQtdG8tcmlnaHQgcnVuIGRpcmVjdGlvbi4KKyAgICAgKiBAaGlkZQorICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IERJUkVDVElPTl9MVFIgPSAwOworCisgICAgLyoqCisgICAgICogRmxhZyBmb3IgZ2V0VGV4dFJ1bkFkdmFuY2VzIGluZGljYXRpbmcgcmlnaHQtdG8tbGVmdCBydW4gZGlyZWN0aW9uLgorICAgICAqIEBoaWRlCisgICAgICovCisgICAgcHVibGljIHN0YXRpYyBmaW5hbCBpbnQgRElSRUNUSU9OX1JUTCA9IDE7CisKKyAgICAvKioKKyAgICAgKiBPcHRpb24gZm9yIGdldFRleHRSdW5DdXJzb3IgdG8gY29tcHV0ZSB0aGUgdmFsaWQgY3Vyc29yIGFmdGVyCisgICAgICogb2Zmc2V0IG9yIHRoZSBsaW1pdCBvZiB0aGUgY29udGV4dCwgd2hpY2hldmVyIGlzIGxlc3MuCisgICAgICogQGhpZGUKKyAgICAgKi8KKyAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBDVVJTT1JfQUZURVIgPSAwOworCisgICAgLyoqCisgICAgICogT3B0aW9uIGZvciBnZXRUZXh0UnVuQ3Vyc29yIHRvIGNvbXB1dGUgdGhlIHZhbGlkIGN1cnNvciBhdCBvciBhZnRlcgorICAgICAqIHRoZSBvZmZzZXQgb3IgdGhlIGxpbWl0IG9mIHRoZSBjb250ZXh0LCB3aGljaGV2ZXIgaXMgbGVzcy4KKyAgICAgKiBAaGlkZQorICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgZm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ZXN0b3JlcyB0aGUgcGFpbnQgdG8gaXRzIGRlZmF1bHQgc2V0dGluZ3MuICovCkBAIC0yMTYsNiArMzU3LDcgQEAKICAgICAgICAgc2V0RmxhZ3MoREVGQVVMVF9QQUlOVF9GTEFHUyk7CiAgICAgICAgIG1IYXNDb21wYXRTY2FsaW5nID0gZmFsc2U7CiAgICAgICAgIG1Db21wYXRTY2FsaW5nID0gbUludkNvbXBhdFNjYWxpbmcgPSAxOworICAgICAgICBtQmlkaUZsYWdzID0gQklESV9ERUZBVUxUX0xUUjsKICAgICB9CiAgICAgCiAgICAgLyoqCkBAIC0yMzgsNiArMzgwLDcgQEAKICAgICAgICAgICAgIG1IYXNDb21wYXRTY2FsaW5nID0gc3JjLm1IYXNDb21wYXRTY2FsaW5nOwogICAgICAgICAgICAgbUNvbXBhdFNjYWxpbmcgICAgPSBzcmMubUNvbXBhdFNjYWxpbmc7CiAgICAgICAgICAgICBtSW52Q29tcGF0U2NhbGluZyA9IHNyYy5tSW52Q29tcGF0U2NhbGluZzsKKyAgICAgICAgICAgIG1CaWRpRmxhZ3MgICAgICA9IHNyYy5tQmlkaUZsYWdzOwogICAgICAgICB9CiAgICAgfQogCkBAIC0yNTIsMTAgKzM5NSwzMyBAQAogICAgICAgICAgICAgbUludkNvbXBhdFNjYWxpbmcgPSAxLjBmL2ZhY3RvcjsKICAgICAgICAgfQogICAgIH0KLSAgICAKKworICAgIC8qKgorICAgICAqIFJldHVybiB0aGUgYmlkaSBmbGFncyBvbiB0aGUgcGFpbnQuCisgICAgICogCisgICAgICogQHJldHVybiB0aGUgYmlkaSBmbGFncyBvbiB0aGUgcGFpbnQKKyAgICAgKiBAaGlkZQorICAgICAqLworICAgIHB1YmxpYyBpbnQgZ2V0QmlkaUZsYWdzKCkgeworICAgICAgICByZXR1cm4gbUJpZGlGbGFnczsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBTZXQgdGhlIGJpZGkgZmxhZ3Mgb24gdGhlIHBhaW50LgorICAgICAqIEBoaWRlCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0QmlkaUZsYWdzKGludCBmbGFncykgeworICAgICAgICAvLyBvbmx5IGZsYWcgdmFsdWUgaXMgdGhlIDMtYml0IEJJREkgY29udHJvbCBzZXR0aW5nCisgICAgICAgIGZsYWdzICY9IEJJRElfRkxBR19NQVNLOworICAgICAgICBpZiAoZmxhZ3MgPiBCSURJX01BWF9GTEFHX1ZBTFVFKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJ1bmtub3duIGJpZGkgZmxhZzogIiArIGZsYWdzKTsKKyAgICAgICAgfQorICAgICAgICBtQmlkaUZsYWdzID0gZmxhZ3M7CisgICAgfQorCiAgICAgLyoqCiAgICAgICogUmV0dXJuIHRoZSBwYWludCdzIGZsYWdzLiBVc2UgdGhlIEZsYWcgZW51bSB0byB0ZXN0IGZsYWcgdmFsdWVzLgotICAgICAqCisgICAgICogCiAgICAgICogQHJldHVybiB0aGUgcGFpbnQncyBmbGFncyAoc2VlIGVudW1zIGVuZGluZyBpbiBfRmxhZyBmb3IgYml0IG1hc2tzKQogICAgICAqLwogICAgIHB1YmxpYyBuYXRpdmUgaW50IGdldEZsYWdzKCk7CkBAIC03ODcsMTggKzk1MywyNyBAQAogICAgIH0KICAgICAKICAgICAvKioKLSAgICAgKiBUZW1wb3JhcnkgQVBJIHRvIGV4cG9zZSBsYXllciBkcmF3aW5nLiBUaGlzIGRyYXdzIGEgc2hhZG93IGxheWVyIGJlbG93Ci0gICAgICogdGhlIG1haW4gbGF5ZXIsIHdpdGggdGhlIHNwZWNpZmllZCBvZmZzZXQgYW5kIGNvbG9yLCBhbmQgYmx1ciByYWRpdXMuCi0gICAgICogSWYgcmFkaXVzIGlzIDAsIHRoZW4gdGhlIHNoYWRvdyBsYXllciBpcyByZW1vdmVkLgorICAgICAqIFRoaXMgZHJhd3MgYSBzaGFkb3cgbGF5ZXIgYmVsb3cgdGhlIG1haW4gbGF5ZXIsIHdpdGggdGhlIHNwZWNpZmllZAorICAgICAqIG9mZnNldCBhbmQgY29sb3IsIGFuZCBibHVyIHJhZGl1cy4gSWYgcmFkaXVzIGlzIDAsIHRoZW4gdGhlIHNoYWRvdworICAgICAqIGxheWVyIGlzIHJlbW92ZWQuCiAgICAgICovCi0gICAgcHVibGljIG5hdGl2ZSB2b2lkIHNldFNoYWRvd0xheWVyKGZsb2F0IHJhZGl1cywgZmxvYXQgZHgsIGZsb2F0IGR5LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgY29sb3IpOworICAgIHB1YmxpYyB2b2lkIHNldFNoYWRvd0xheWVyKGZsb2F0IHJhZGl1cywgZmxvYXQgZHgsIGZsb2F0IGR5LCBpbnQgY29sb3IpIHsKKyAgICAgICAgaGFzU2hhZG93ID0gcmFkaXVzID4gMC4wZjsKKyAgICAgICAgc2hhZG93UmFkaXVzID0gcmFkaXVzOworICAgICAgICBzaGFkb3dEeCA9IGR4OworICAgICAgICBzaGFkb3dEeSA9IGR5OworICAgICAgICBzaGFkb3dDb2xvciA9IGNvbG9yOworICAgICAgICBuU2V0U2hhZG93TGF5ZXIocmFkaXVzLCBkeCwgZHksIGNvbG9yKTsKKyAgICB9CisgICAgCisgICAgcHJpdmF0ZSBuYXRpdmUgdm9pZCBuU2V0U2hhZG93TGF5ZXIoZmxvYXQgcmFkaXVzLCBmbG9hdCBkeCwgZmxvYXQgZHksIGludCBjb2xvcik7CiAKICAgICAvKioKLSAgICAgKiBUZW1wb3JhcnkgQVBJIHRvIGNsZWFyIHRoZSBzaGFkb3cgbGF5ZXIuCisgICAgICogQ2xlYXIgdGhlIHNoYWRvdyBsYXllci4KICAgICAgKi8KICAgICBwdWJsaWMgdm9pZCBjbGVhclNoYWRvd0xheWVyKCkgewotICAgICAgICBzZXRTaGFkb3dMYXllcigwLCAwLCAwLCAwKTsKKyAgICAgICAgaGFzU2hhZG93ID0gZmFsc2U7CisgICA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pbnQgZmxhZ3MsIGZsb2F0W10gYWR2YW5jZXMsCisgICAgICAgICAgICBpbnQgYWR2YW5jZXNJbmRleCkgeworCisgICAgICAgIGlmICgoaW5kZXggfCBjb3VudCB8IGNvbnRleHRJbmRleCB8IGNvbnRleHRDb3VudCB8IGFkdmFuY2VzSW5kZXgKKyAgICAgICAgICAgICAgICB8IChpbmRleCAtIGNvbnRleHRJbmRleCkKKyAgICAgICAgICAgICAgICB8ICgoY29udGV4dEluZGV4ICsgY29udGV4dENvdW50KSAtIChpbmRleCArIGNvdW50KSkKKyAgICAgICAgICAgICAgICB8IChjaGFycy5sZW5ndGggLSAoY29udGV4dEluZGV4ICsgY29udGV4dENvdW50KSkKKyAgICAgICAgICAgICAgICB8IChhZHZhbmNlcyA9PSBudWxsID8gMCA6CisgICAgICAgICAgICAgICAgICAgIChhZHZhbmNlcy5sZW5ndGggLSAoYWR2YW5jZXNJbmRleCArIGNvdW50KSkpKSA8IDApIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBJbmRleE91dE9mQm91bmRzRXhjZXB0aW9uKCk7CisgICAgICAgIH0KKyAgICAgICAgaWYgKGZsYWdzICE9IERJUkVDVElPTl9MVFIgJiYgZmxhZ3MgIT0gRElSRUNUSU9OX1JUTCkgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigidW5rbm93biBmbGFncyB2YWx1ZTogIiArIGZsYWdzKTsKKyAgICAgICAgfQorCisgICAgICAgIGlmICghbUhhc0NvbXBhdFNjYWxpbmcpIHsKKyAgICAgICAgICAgIHJldHVybiBuYXRpdmVfZ2V0VGV4dFJ1bkFkdmFuY2VzKG1OYXRpdmVQYWludCwgY2hhcnMsIGluZGV4LCBjb3VudCwKKyAgICAgICAgICAgICAgICAgICAgY29udGV4dEluZGV4LCBjb250ZXh0Q291bnQsIGZsYWdzLCBhZHZhbmNlcywgYWR2YW5jZXNJbmRleCk7CisgICAgICAgIH0KKworICAgICAgICBmaW5hbCBmbG9hdCBvbGRTaXplID0gZ2V0VGV4dFNpemUoKTsKKyAgICAgICAgc2V0VGV4dFNpemUob2xkU2l6ZSAqIG1Db21wYXRTY2FsaW5nKTsKKyAgICAgICAgZmxvYXQgcmVzID0gbmF0aXZlX2dldFRleHRSdW5BZHZhbmNlcyhtTmF0aXZlUGFpbnQsIGNoYXJzLCBpbmRleCwgY291bnQsCisgICAgICAgICAgICAgICAgY29udGV4dEluZGV4LCBjb250ZXh0Q291bnQsIGZsYWdzLCBhZHZhbmNlcywgYWR2YW5jZXNJbmRleCk7CisgICAgICAgIHNldFRleHRTaXplKG9sZFNpemUpOworCisgICAgICAgIGlmIChhZHZhbmNlcyAhPSBudWxsKSB7CisgICAgICAgICAgICBmb3IgKGludCBpID0gYWR2YW5jZXNJbmRleCwgZSA9IGkgKyBjb3VudDsgaSA8IGU7IGkrKykgeworICAgICAgICAgICAgICAgIGFkdmFuY2VzW2ldICo9IG1JbnZDb21wYXRTY2FsaW5nOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiByZXMgKiBtSW52Q29tcGF0U2NhbGluZzsgLy8gYXNzdW1lIGVycm9ycyBhcmUgbm90IHNpZ25pZmljYW50CisgICAgfQorCisgICAgLyoqCisgICAgICogQ29udmVuaWVuY2Ugb3ZlcmxvYWQgdGhhdCB0YWtlcyBhIENoYXJTZXF1ZW5jZSBpbnN0ZWFkIG9mIGEKKyAgICAgKiBTdHJpbmcuCisgICAgICoKKyAgICAgKiBAc2VlICNnZXRUZXh0UnVuQWR2YW5jZXMoU3RyaW5nLCBpbnQsIGludCwgaW50LCBpbnQsIGludCwgZmxvYXRbXSwgaW50KQorICAgICAqIEBoaWRlCisgICAgICovCisgICAgcHVibGljIGZsb2F0IGdldFRleHRSdW5BZHZhbmNlcyhDaGFyU2VxdWVuY2UgdGV4dCwgaW50IHN0YXJ0LCBpbnQgZW5kLAorICAgICAgICAgICAgaW50IGNvbnRleHRTdGFydCwgaW50IGNvbnRleHRFbmQsIGludCBmbGFncywgZmxvYXRbXSBhZHZhbmNlcywKKyAgICAgICAgICAgIGludCBhZHZhbmNlc0luZGV4KSB7CisKKyAgICAgICAgaWYgKHRleHQgaW5zdGFuY2VvZiBTdHJpbmcpIHsKKyAgICAgICAgICAgIHJldHVybiBnZXRUZXh0UnVuQWR2YW5jZXMoKFN0cmluZykgdGV4dCwgc3RhcnQsIGVuZCwKKyAgICAgICAgICAgICAgICAgICAgY29udGV4dFN0YXJ0LCBjb250ZXh0RW5kLCBmbGFncywgYWR2YW5jZXMsIGFkdmFuY2VzSW5kZXgpOworICAgICAgICB9CisgICAgICAgIGlmICh0ZXh0IGluc3RhbmNlb2YgU3Bhbm5lZFN0cmluZyB8fAorICAgICAgICAgICAgdGV4dCBpbnN0YW5jZW9mIFNwYW5uYWJsZVN0cmluZykgeworICAgICAgICAgICAgcmV0dXJuIGdldFRleHRSdW5BZHZhbmNlcyh0ZXh0LnRvU3RyaW5nKCksIHN0YXJ0LCBlbmQsCisgICAgICAgICAgICAgICAgICAgIGNvbnRleHRTdGFydCwgY29udGV4dEVuZCwgZmxhZ3MsIGFkdmFuY2VzLCBhZHZhbmNlc0luZGV4KTsKKyAgICAgICAgfQorICAgICAgICBpZiAodGV4dCBpbnN0YW5jZW9mIEdyYXBoaWNzT3BlcmF0aW9ucykgeworICAgICAgICAgICAgcmV0dXJuICgoR3JhcGhpY3NPcGVyYXRpb25zKSB0ZXh0KS5nZXRUZXh0UnVuQWR2YW5jZXMoc3RhcnQsIGVuZCwKKyAgICAgICAgICAgICAgICAgICAgY29udGV4dFN0YXJ0LCBjb250ZXh0RW5kLCBmbGFncywgYWR2YW5jZXMsIGFkdmFuY2VzSW5kZXgsIHRoaXMpOworICAgICAgICB9CisKKyAgICAgICAgaW50IGNvbnRleHRMZW4gPSBjb250ZXh0RW5kIC0gY29udGV4dFN0YXJ0OworICAgICAgICBpbnQgbGVuID0gZW5kIC0gc3RhcnQ7CisgICAgICAgIGNoYXJ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RleHQsIGludCBzdGFydCwgaW50IGVuZCwgaW50IGNvbnRleHRTdGFydCwKKyAgICAgICAgICAgIGludCBjb250ZXh0RW5kLCBpbnQgZmxhZ3MsIGZsb2F0W10gYWR2YW5jZXMsIGludCBhZHZhbmNlc0luZGV4KSB7CisKKyAgICAgICAgaWYgKChzdGFydCB8IGVuZCB8IGNvbnRleHRTdGFydCB8IGNvbnRleHRFbmQgfCBhZHZhbmNlc0luZGV4IHwgKGVuZCAtIHN0YXJ0KQorICAgICAgICAgICAgICAgIHwgKHN0YXJ0IC0gY29udGV4dFN0YXJ0KSB8IChjb250ZXh0RW5kIC0gZW5kKQorICAgICAgICAgICAgICAgIHwgKHRleHQubGVuZ3RoKCkgLSBjb250ZXh0RW5kKQorICAgICAgICAgICAgICAgIHwgKGFkdmFuY2VzID09IG51bGwgPyAwIDoKKyAgICAgICAgICAgICAgICAgICAgKGFkdmFuY2VzLmxlbmd0aCAtIGFkdmFuY2VzSW5kZXggLSAoZW5kIC0gc3RhcnQpKSkpIDwgMCkgeworICAgICAgICAgICAgdGhyb3cgbmV3IEluZGV4T3V0T2ZCb3VuZHNFeGNlcHRpb24oKTsKKyAgICAgICAgfQorICAgICAgICBpZiAoZmxhZ3MgIT0gRElSRUNUSU9OX0xUUiAmJiBmbGFncyAhPSBESVJFQ1RJT05fUlRMKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJ1bmtub3duIGZsYWdzIHZhbHVlOiAiICsgZmxhZ3MpOworICAgICAgICB9CisKKyAgICAgICAgaWYgKCFtSGFzQ29tcGF0U2NhbGluZykgeworICAgICAgICAgICAgcmV0dXJuIG5hdGl2ZV9nZXRUZXh0UnVuQWR2YW5jZXMobU5hdGl2ZVBhaW50LCB0ZXh0LCBzdGFydCwgZW5kLAorICAgICAgICAgICAgICAgICAgICBjb250ZXh0U3RhcnQsIGNvbnRleHRFbmQsIGZsYWdzLCBhZHZhbmNlcywgYWR2YW5jZXNJbmRleCk7CisgICAgICAgIH0KKworICAgICAgICBmaW5hbCBmbG9hdCBvbGRTaXplID0gZ2V0VGV4dFNpemUoKTsKKyAgICAgICAgc2V0VGV4dFNpemUob2xkU2l6ZSAqIG1Db21wYXRTY2FsaW5nKTsKKyAgICAgICAgZmxvYXQgdG90YWxBZHZhbmNlID0gbmF0aXZlX2dldFRleHRSdW5BZHZhbmNlcyhtTmF0aXZlUGFpbnQsIHRleHQsIHN0YXJ0LCBlbmQsCisgICAgICAgICAgICAgICAgY29udGV4dFN0YXJ0LCBjb250ZXh0RW5kLCBmbGFncywgYWR2YW5jZXMsIGFkdmFuY2VzSW5kZXgpOworICAgICAgICBzZXRUZXh0U2l6ZShvbGRTaXplKTsKKworICAgICAgICBpZiAoYWR2YW5jZXMgIT0gbnVsbCkgeworICAgICAgICAgICAgZm9yIChpbnQgaSA9IGFkdmFuY2VzSW5kZXgsIGUgPSBpICsgKGVuZCAtIHN0YXJ0KTsgaSA8IGU7IGkrKykgeworICAgICAgICAgICAgICAgIGFkdmFuY2VzW2ldICo9IG1JbnZDb21wYXRTY2FsaW5nOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiB0b3RhbEFkdmFuY2UgKiBtSW52Q29tcGF0U2NhbGluZzsgLy8gYXNzdW1lIGVycm9ycyBhcmUgaW5zaWduaWZpY2FudAorICAgIH0KKworICAgIC8qKgorICAgICAqIFJldHVybnMgdGhlIG5leHQgY3Vyc29yIHBvc2l0aW9uIGluIHRoZSBydW4uICBUaGlzIGF2b2lkcyBwbGFjaW5nIHRoZQorICAgICAqIGN1cnNvciBiZXR3ZWVuIHN1cnJvZ2F0ZXMsIGJldHdlZW4gY2hhcmFjdGVycyB0aGF0IGZvcm0gY29uanVuY3RzLAorICAgICAqIGJldHdlZW4gYmFzZSBjaGFyYWN0ZXJzIGFuZCBjb21iaW5pbmcgbWFya3MsIG9yIHdpdGhpbiBhIHJlb3JkZXJpbmcKKyAgICAgKiB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b2Yge0BsaW5rICNDVVJTT1JfQUZURVJ9LAorICAgICAqIHtAbGluayAjQ1VSU09SX0FUX09SX0FGVEVSfSwge0BsaW5rICNDVVJTT1JfQkVGT1JFfSwKKyAgICAgKiB7QGxpbmsgI0NVUlNPUl9BVF9PUl9CRUZPUkV9LCBvciB7QGxpbmsgI0NVUlNPUl9BVH0KKyAgICAgKiBAcmV0dXJuIHRoZSBvZmZzZXQgb2YgdGhlIG5leHQgcG9zaXRpb24sIG9yIC0xCisgICAgICogQGhpZGUKKyAgICAgKi8KKyAgICBwdWJsaWMgaW50IGdldFRleHRSdW5DdXJzb3IoY2hhcltdIHRleHQsIGludCBjb250ZXh0U3RhcnQsIGludCBjb250ZXh0TGVuZ3RoLAorICAgICAgICAgICAgaW50IGZsYWdzLCBpbnQgb2Zmc2V0LCBpbnQgY3Vyc29yT3B0KSB7CisgICAgICAgIGludCBjb250ZXh0RW5kID0gY29udGV4dFN0YXJ0ICsgY29udGV4dExlbmd0aDsKKyAgICAgICAgaWYgKCgoY29udGV4dFN0YXJ0IHwgY29udGV4dEVuZCB8IG9mZnNldCB8IChjb250ZXh0RW5kIC0gY29udGV4dFN0YXJ0KQorICAgICAgICAgICAgICAgIHwgKG9mZnNldCAtIGNvbnRleHRTdGFydCkgfCAoY29udGV4dEVuZCAtIG9mZnNldCkKKyAgICAgICAgICAgICAgICB8ICh0ZXh0Lmxlbmd0aCAtIGNvbnRleHRFbmQpIHwgY3Vyc29yT3B0KSA8IDApCisgICAgICAgICAgICAgICAgfHwgY3Vyc29yT3B0ID4gQ1VSU09SX09QVF9NQVhfVkFMVUUpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBJbmRleE91dE9mQm91bmRzRXhjZXB0aW9uKCk7CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gbmF0aXZlX2dldFRleHRSdW5DdXJzb3IobU5hdGl2ZVBhaW50LCB0ZXh0LAorICAgICAgICAgICAgICAgIGNvbnRleHRTdGFydCwgY29udGV4dExlb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Cwgc3RhcnQsIGVuZCwgeCwgeSwgCisgICAgICAgICAgICAgICAgcGF0aC5uaSgpKTsKICAgICB9CiAgICAgCiAgICAgLyoqCkBAIC0xNDA0LDkgKzE4NTksMjIgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFyW10gdGV4dCwgaW50IGluZGV4LCBpbnQgY291bnQsIGZsb2F0W10gd2lkdGhzKTsKICAgICBwcml2YXRlIHN0YXRpYyBuYXRpdmUgaW50IG5hdGl2ZV9nZXRUZXh0V2lkdGhzKGludCBuYXRpdmVfb2JqZWN0LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIFN0cmluZyB0ZXh0LCBpbnQgc3RhcnQsIGludCBlbmQsIGZsb2F0W10gd2lkdGhzKTsKLSAgICBwcml2YXRlIHN0YXRpYyBuYXRpdmUgdm9pZCBuYXRpdmVfZ2V0VGV4dFBhdGgoaW50IG5hdGl2ZV9vYmplY3QsCisKKyAgICBwcml2YXRlIHN0YXRpYyBuYXRpdmUgZmxvYXQgbmF0aXZlX2dldFRleHRSdW5BZHZhbmNlcyhpbnQgbmF0aXZlX29iamVjdCwKKyAgICAgICAgICAgIGNoYXJbXSB0ZXh0LCBpbnQgaW5kZXgsIGludCBjb3VudCwgaW50IGNvbnRleHRJbmRleCwgaW50IGNvbnRleHRDb3VudCwKKyAgICAgICAgICAgIGludCBmbGFncywgZmxvYXRbXSBhZHZhbmNlcywgaW50IGFkdmFuY2VzSW5kZXgpOworICAgIHByaXZhdGUgc3RhdGljIG5hdGl2ZSBmbG9hdCBuYXRpdmVfZ2V0VGV4dFJ1bkFkdmFuY2VzKGludCBuYXRpdmVfb2JqZWN0LAorICAgICAgICAgICAgU3RyaW5nIHRleHQsIGludCBzdGFydCwgaW50IGVuZCwgaW50IGNvbnRleHRTdGFydCwgaW50IGNvbnRleHRFbmQsCisgICAgICAgICAgICBpbnQgZmxhZ3MsIGZsb2F0W10gYWR2YW5jZXMsIGludCBhZHZhbmNlc0luZGV4KTsKKwor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aDsKKworICAgIC8qKgorICAgICAqIEBoaWRlCisgICAgICovCisgICAgcHVibGljIGJvb2xlYW4gaXNTaW1wbGVQYXRoID0gdHJ1ZTsKKyAgICAvKioKKyAgICAgKiBAaGlkZQorICAgICAqLworICAgIHB1YmxpYyBSZWdpb24gcmVjdHM7CisgICAgcHJpdmF0ZSBib29sZWFuIG1EZXRlY3RTaW1wbGVQYXRoczsKIAogICAgIC8qKgogICAgICAqIENyZWF0ZSBhbiBlbXB0eSBwYXRoCiAgICAgICovCiAgICAgcHVibGljIFBhdGgoKSB7CiAgICAgICAgIG1OYXRpdmVQYXRoID0gaW5pdDEoKTsKKyAgICAgICAgbURldGVjdFNpbXBsZVBhdGhzID0gSGFyZHdhcmVSZW5kZXJlci5pc0F2YWlsYWJsZSgpOwogICAgIH0KIAogICAgIC8qKgpAQCAtNDMsNiArNjAsNyBAQAogICAgICAgICAgICAgdmFsTmF0aXZlID0gc3JjLm1OYXRpdmVQYXRoOwogICAgICAgICB9CiAgICAgICAgIG1OYXRpdmVQYXRoID0gaW5pdDIodmFsTmF0aXZlKTsKKyAgICAgICAgbURldGVjdFNpbXBsZVBhdGhzID0gSGFyZHdhcmVSZW5kZXJlci5pc0F2YWlsYWJsZSgpOwogICAgIH0KICAgICAKICAgICAvKioKQEAgLTUwLDYgKzY4LDEwIEBACiAgICAgICogVGhpcyBkb2VzIE5PVCBjaGFuZ2UgdGhlIGZpbGwtdHlwZSBzZXR0aW5nLgogICAgICAqLwogICAgIHB1YmxpYyB2b2lkIHJlc2V0KCkgeworICAgICAgICBpc1NpbXBsZVBhdGggPSB0cnVlOworICAgICAgICBpZiAobURldGVjdFNpbXBsZVBhdGhzKSB7CisgICAgICAgICAgICBpZiAocmVjdHMgIT0gbnVsbCkgcmVjdHMuc2V0RW1wdHkoKTsKKyAgICAgICAgfQogICAgICAgICBuYXRpdmVfcmVzZXQobU5hdGl2ZVBhdGgpOwogICAgIH0KIApAQCAtNTgsNiArODAsMTAgQEAKICAgICAg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qLwogICAgIHB1YmxpYyB2b2lkIGNsb3NlKCkgeworICAgICAgICBpc1NpbXBsZVBhdGggPSBmYWxzZTsKICAgICAgICAgbmF0aXZlX2Nsb3NlKG1OYXRpdmVQYXRoKTsKICAgICB9CiAKQEAgLTM1MSw2ICszODYsMTEgQEAKICAgICAgICAgaWYgKHJlY3QgPT0gbnVsbCkgewogICAgICAgICAgICAgdGhyb3cgbmV3IE51bGxQb2ludGVyRXhjZXB0aW9uKCJuZWVkIHJlY3QgcGFyYW1ldGVyIik7CiAgICAgICAgIH0KKyAgICAgICAgaWYgKG1EZXRlY3RTaW1wbGVQYXRocykgeworICAgICAgICAgICAgaWYgKHJlY3RzID09IG51bGwpIHJlY3RzID0gbmV3IFJlZ2lvbigpOworICAgICAgICAgICAgcmVjdHMub3AoKGludCkgcmVjdC5sZWZ0LCAoaW50KSByZWN0LnRvcCwgKGludCkgcmVjdC5yaWdodCwgKGludCkgcmVjdC5ib3R0b20sCisgICAgICAgICAgICAgICAgICAgIFJlZ2lvbi5PcC5VTklPTik7CisgICAgICAgIH0KICAgICAgICAgbmF0aXZlX2FkZFJlY3QobU5hdGl2ZVBhdGgsIHJlY3QsIGRpci5uYXRpdmVJbnQpOwogICAgIH0KIApAQCAtMzYzLDggKzQwMywxMSBAQAogICAgICAqIEBwYXJhbSBib3R0b20gVGhlIGJvdHRvbSBvZiBhIHJlY3RhbmdsZSB0byBhZGQgdG8gdGhlIHBhdGgKICAgICAgKiBAcGFyYW0gZGlyICAgIFRoZSBkaXJlY3Rpb24gdG8gd2luZCB0aGUgcmVjdGFuZ2xlJ3MgY29udG91cgogICAgICAqLwotICAgIHB1YmxpYyB2b2lkIGFkZFJlY3QoZmxvYXQgbGVmdCwgZmxvYXQgdG9wLCBmbG9hdCByaWdodCwgZmxvYXQgYm90dG9tLAotICAgICAgICAgICAgICAgICAgICAgICAgRGlyZWN0aW9uIGRpcikgeworICAgIHB1YmxpYyB2b2lkIGFkZFJlY3QoZmxvYXQgbGVmd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gTGV2ZWxMaXN0RHJhd2FibGUoKTsKKyAgICAgICAgfSBlbHNlIGlmIChuYW1lLmVxdWFscygibWlwbWFwIikpIHsKKyAgICAgICAgICAgIGRyYXdhYmxlID0gbmV3IE1pcG1hcERyYXdhYmxlKCk7CiAgICAgICAgIH0gZWxzZSBpZiAobmFtZS5lcXVhbHMoImxheWVyLWxpc3QiKSkgewogICAgICAgICAgICAgZHJhd2FibGUgPSBuZXcgTGF5ZXJEcmF3YWJsZSgpOwogICAgICAgICB9IGVsc2UgaWYgKG5hbWUuZXF1YWxzKCJ0cmFuc2l0aW9uIikpIHsKQEAgLTc3MCw3ICs3ODMsNyBAQAogICAgICAgICB9IGVsc2UgaWYgKG5hbWUuZXF1YWxzKCJpbnNldCIpKSB7CiAgICAgICAgICAgICBkcmF3YWJsZSA9IG5ldyBJbnNldERyYXdhYmxlKCk7CiAgICAgICAgIH0gZWxzZSBpZiAobmFtZS5lcXVhbHMoImJpdG1hcCIpKSB7Ci0gICAgICAgICAgICBkcmF3YWJsZSA9IG5ldyBCaXRtYXBEcmF3YWJsZSgpOworICAgICAgICAgICAgZHJhd2FibGUgPSBuZXcgQml0bWFwRHJhd2FibGUocik7CiAgICAgICAgICAgICBpZiAociAhPSBudWxsKSB7CiAgICAgICAgICAgICAgICAoKEJpdG1hcERyYXdhYmxlKSBkcmF3YWJsZSkuc2V0VGFyZ2V0RGVuc2l0eShyLmdldERpc3BsYXlNZXRyaWNzKCkpOwogICAgICAgICAgICAgfQpAQCAtODA1LDYgKzgxOCw5IEBACiAgICAgICAgIHJldHVybiBudWxsOwogICAgIH0KIAorICAgIC8qKgorICAgICAqIEluZmxhdGUgdGhpcyBEcmF3YWJsZSBmcm9tIGFuIFhNTCByZXNvdXJjZS4KKyAgICAgKi8KICAgICBwdWJsaWMgdm9pZCBpbmZsYXRlKFJlc291cmNlcyByLCBYbWxQdWxsUGFyc2VyIHBhcnNlciwgQXR0cmlidXRlU2V0IGF0dHJzKQogICAgICAgICAgICAg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RHJhd2FibGUgZHIgPSBkcmF3YWJsZXNbaV07CmRpZmYgLS1naXQgYS9ncmFwaGljcy9qYXZhL2FuZHJvaWQvZ3JhcGhpY3MvZHJhd2FibGUvR3JhZGllbnREcmF3YWJsZS5qYXZhIGIvZ3JhcGhpY3MvamF2YS9hbmRyb2lkL2dyYXBoaWNzL2RyYXdhYmxlL0dyYWRpZW50RHJhd2FibGUuamF2YQppbmRleCAzM2VjYmVhLi44OGY2ZDQzIDEwMDY0NAotLS0gYS9ncmFwaGljcy9qYXZhL2FuZHJvaWQvZ3JhcGhpY3MvZHJhd2FibGUvR3JhZGllbnREcmF3YWJsZS5qYXZhCisrKyBiL2dyYXBoaWNzL2phdmEvYW5kcm9pZC9ncmFwaGljcy9kcmF3YWJsZS9HcmFkaWVudERyYXdhYmxlLmphdmEKQEAgLTMxMywxOCArMzEzLDE2IEBACiAgICAgICAgICAgICBjYXNlIFJFQ1RBTkdMRToKICAgICAgICAgICAgICAgICBpZiAoc3QubVJhZGl1c0FycmF5ICE9IG51bGwpIHsKICAgICAgICAgICAgICAgICAgICAgbVBhdGgucmVzZXQoKTsKLSAgICAgICAgICAgICAgICAgICAgbVBhdGguYWRkUm91bmRSZWN0KG1SZWN0LCBzdC5tUmFkaXVzQXJyYXksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBQYXRoLkRpcmVjdGlvbi5DVyk7CisgICAgICAgICAgICAgICAgICAgIG1QYXRoLmFkZFJvdW5kUmVjdChtUmVjdCwgc3QubVJhZGl1c0FycmF5LCBQYXRoLkRpcmVjdGlvbi5DVyk7CiAgICAgICAgICAgICAgICAgICAgIGNhbnZhcy5kcmF3UGF0aChtUGF0aCwgbUZpbGxQYWludCk7CiAgICAgICAgICAgICAgICAgICAgIGlmIChoYXZlU3Ryb2tlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBjYW52YXMuZHJhd1BhdGgobVBhdGgsIG1TdHJva2VQYWludCk7CiAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgZWxzZSB7CisgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChzdC5tUmFkaXVzID4gMC4wZikgewogICAgICAgICAgICAgICAgICAgICAvLyBzaW5jZSB0aGUgY2FsbGVyIGlzIG9ubHkgZ2l2aW5nIHVzIDEgdmFsdWUsIHdlIHdpbGwgZm9yY2UKICAgICAgICAgICAgICAgICAgICAgLy8gaXQgdG8gYmUgc3F1YXJlIGlmIHRoZSByZWN0IGlzIHRvbyBzbWFsbCBpbiBvbmUgZGltZW5zaW9uCiAgICAgICAgICAgICAgICAgICAgIC8vIHRvIHNob3cgaXQuIElmIHdlIGRpZCBub3RoaW5nLCBTa2lhIHdvdWxkIGNsYW1wIHRoZSByYWQKLSAgICAgICAgICAgICAgICAgICAgLy8gaW5kZXBlbmRlbnRseSBhbG9uZyBlYWNoIGF4aXMsIGdpdmluZyB1cyBhIHRoaW4gZWxsaXBzCisgICAgICAgICAgICAgICAgICAgIC8vIGluZGVwZW5kZW50bHkgYWxvbmcgZWFjaCBheGlzLCBnaXZpbmcgdXMgYSB0aGluIGVsbGlwc2UKICAgICAgICAgICAgICAgICAgICAgLy8gaWYgdGhlIHJlY3Qgd2VyZSB2ZXJ5IHdpZGUgYnV0IG5vdCB2ZXJ5IHRhbGwKICAgICAgICAgICAgICAgICAgICAgZmxvYXQgcmFkID0gc3QubVJhZGl1czsKICAgICAgICAgICAgICAgICAgICAgZmxvYXQgciA9IE1hdGgubWluKG1SZWN0LndpZHRoKCksIG1SZWN0LmhlaWdodCgpKSAqIDAuNWY7CkBAIC0zMzUsNiArMzMzLDExIEBACiAgICAgICAgICAgICAgICAgICAgIGlmIChoYXZlU3Ryb2tlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBjYW52YXMuZHJhd1JvdW5kUmVjdChtUmVjdCwgcmFkLCByYWQsIG1TdHJva2VQYWludCk7CiAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICBjYW52YXMuZHJhd1JlY3QobVJlY3QsIG1GaWxsUGFpbnQpOworICAgICAgICAgICAgICAgICAgICBpZiAoaGF2ZVN0cm9rZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgY2FudmFzLmRyYXdSZWN0KG1SZWN0LCBtU3Ryb2tlUGFpbnQpOworICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgY2FzZSBPVkFMOgpkaWZmIC0tZ2l0IGEvZ3JhcGhpY3MvamF2YS9hbmRyb2lkL2dyYXBoaWNzL2RyYXdhYmxlL0xheWVyRHJhd2FibGUuamF2YSBiL2dyYXBoaWNzL2phdmEvYW5kcm9pZC9ncmFwaGljcy9kcmF3YWJsZS9MYXllckRyYXdhYmxlLmphdmEKaW5kZXggODA0N2RkNC4uNTAxY2NhOSAxMDA2NDQKLS0tIGEvZ3JhcGhpY3MvamF2YS9hbmRyb2lkL2dyYXBoaWNzL2RyYXdhYmxlL0xheWVyRHJhd2FibGUuamF2YQorKysgYi9ncmFwaGljcy9qYXZhL2FuZHJvaWQvZ3JhcGhpY3MvZHJhd2FibGUvTGF5ZXJEcmF3YWJsZS5qYXZhCkBAIC0yNjYsNiArMjY2LDcgQEAKICAgICAgKi8KICAgICBwdWJsaWMgYm9vbGVhbiBzZXREcmF3YWJsZUJ5TGF5ZXJJZChpbnQgaWQsIERyYXdhYmxlIGRyYXdhYmxlKSB7CiAgICAgICAgIGZpbmFsIENoaWxkRHJhd2FibGVbXSBsYXllcnMgPSBtTGF5ZXJTdGF0ZS5tQ2hpbGRyZW47CisgICAgICAgIGRyYXdhYmxlLnNldENhbGxiYWNrKHRoaXMpOwogICAgICAgICAKICAgICAgICAgZm9yIChpbnQgaSA9IG1MYXllclN0YXRlLm1OdW0gLSAxOyBpID49IDA7IGktLSkgewogICAgICAgICAgICA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AgICAvLyBXaWxsIGNhbGwgaW52YWxpZGF0ZVNlbGYoKSBpZiBuZWVkZWQKKyAgICAgICAgc2VsZWN0RHJhd2FibGUoaW5kZXgpOworCisgICAgICAgIHN1cGVyLm9uQm91bmRzQ2hhbmdlKGJvdW5kcyk7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgaW5mbGF0ZShSZXNvdXJjZXMgciwgWG1sUHVsbFBhcnNlciBwYXJzZXIsIEF0dHJpYnV0ZVNldCBhdHRycykKKyAgICB0aHJvd3MgWG1sUHVsbFBhcnNlckV4Y2VwdGlvbiwgSU9FeGNlcHRpb24geworCisgICAgICAgIHN1cGVyLmluZmxhdGUociwgcGFyc2VyLCBhdHRycyk7CisKKyAgICAgICAgaW50IHR5cGU7CisKKyAgICAgICAgZmluYWwgaW50IGlubmVyRGVwdGggPSBwYXJzZXIuZ2V0RGVwdGgoKSArIDE7CisgICAgICAgIGludCBkZXB0aDsKKyAgICAgICAgd2hpbGUgKCh0eXBlID0gcGFyc2VyLm5leHQoKSkgIT0gWG1sUHVsbFBhcnNlci5FTkRfRE9DVU1FTlQKKyAgICAgICAgICAgICAgICAmJiAoKGRlcHRoID0gcGFyc2VyLmdldERlcHRoKCkpID49IGlubmVyRGVwdGgKKyAgICAgICAgICAgICAgICAgICAgICAgIHx8IHR5cGUgIT0gWG1sUHVsbFBhcnNlci5FTkRfVEFHKSkgeworICAgICAgICAgICAgaWYgKHR5cGUgIT0gWG1sUHVsbFBhcnNlci5TVEFSVF9UQUcpIHsKKyAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKGRlcHRoID4gaW5uZXJEZXB0aCB8fCAhcGFyc2VyLmdldE5hbWUoKS5lcXVhbHMoIml0ZW0iKSkgeworICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBUeXBlZEFycmF5IGEgPSByLm9idGFpbkF0dHJpYnV0ZXMoYXR0cnMsCisgICAgICAgICAgICAgICAgICAgIGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3R5bGVhYmxlLk1pcG1hcERyYXdhYmxlSXRlbSk7CisKKyAgICAgICAgICAgIGludCBkcmF3YWJsZVJlcyA9IGEuZ2V0UmVzb3VyY2VJZCgKKyAgICAgICAgICAgICAgICAgICAgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuTWlwbWFwRHJhd2FibGVJdGVtX2RyYXdhYmxlLCAwKTsKKworICAgICAgICAgICAgYS5yZWN5Y2xlKCk7CisKKyAgICAgICAgICAgIERyYXdhYmxlIGRyOworICAgICAgICAgICAgaWYgKGRyYXdhYmxlUmVzICE9IDApIHsKKyAgICAgICAgICAgICAgICBkciA9IHIuZ2V0RHJhd2FibGUoZHJhd2FibGVSZXMpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICB3aGlsZSAoKHR5cGUgPSBwYXJzZXIubmV4dCgpKSA9PSBYbWxQdWxsUGFyc2VyLlRFWFQpIHsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKHR5cGUgIT0gWG1sUHVsbFBhcnNlci5TVEFSVF9UQUcpIHsKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFhtbFB1bGxQYXJzZXJFeGNlcHRpb24oCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyc2VyLmdldFBvc2l0aW9uRGVzY3JpcHRpb24oKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgIjogPGl0ZW0+IHRhZyByZXF1aXJlcyBhICdkcmF3YWJsZScgYXR0cmlidXRlIG9yICIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICArICJjaGlsZCB0YWcgZGVmaW5pbmcgYSBkcmF3YWJsZSIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBkciA9IERyYXdhYmxlLmNyZWF0ZUZyb21YbWxJbm5lcihyLCBwYXJzZXIsIGF0dHJzKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgbU1pcG1hcENvbnRhaW5lclN0YXRlLmFkZERyYXdhYmxlKGRyKTsKKyAgICAgICAgfQorCisgICAgICAgIG9uRHJhd2FibGVBZGRlZCgpOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyBEcmF3YWJsZSBtdXRhdGUoKSB7CisgICAgICAgIGlmICghbU11dGF0ZWQgJiYgc3VwZXIubXV0YXRlKCkgPT0gdGhpcykgeworICAgICAgICAgICAgbU1pcG1hcENvbnRhaW5lclN0YXRlLm1NaXBtYXBIZWlnaHRzID0gbU1pcG1hcENvbnRhaW5lclN0YXRlLm1NaXBtYXBIZWlnaHRzLmNsb25lKCk7CisgICAgICAgICAgICBtTXV0YXRlZCA9IHRydWU7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHRoaXM7CisgICAgfQorCisgICAgcHJpdmF0ZSBmaW5hbCBzdGF0aWMgY2xhc3MgTWlwbWFwQ29udGFpbmVyU3RhdGUgZXh0ZW5kcyBEcmF3YWJsZUNvbnRhaW5lclN0YXRlIHsKKyAgICAgICAgcHJpdmF0ZSBpbnRbXSBtTWlwbWFwSGVpZ2h0czsKKworICAgICAgICBNaXBtYXBDb250YWluZXJTdGF0ZShNaXBtYXBDb250YWluZXJTdGF0ZSBvcmlnLCBNaXBtYXBEcmF3YWJsZSBvd25lciwgUmVzb3VyY2VzIHJlcykgeworICAgICAgICAgICAgc3VwZXIob3JpZywgb3duZXIsIHJlcyk7CisKKyAgICAgICAgICAgIGlmIChvcmlnICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBtTWlwbWFwSGVpZ2h0cyA9IG9yaWcubU1pcG1hcEhlaWdodHM7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIG1NaXBtYXBIZWlnaHRzID0gbmV3IGludFtnZXRDaGlsZHJlbigpLmxlbmd0aF07CisgICAgICAg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dW5kc0hlaWdodCA9IGJvdW5kcy5oZWlnaHQoKTsKKyAgICAgICAgICAgIGZpbmFsIGludCBOID0gZ2V0Q2hpbGRDb3VudCgpOworICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBOOyBpKyspIHsKKyAgICAgICAgICAgICAgICBpZiAoYm91bmRzSGVpZ2h0IDw9IG1NaXBtYXBIZWlnaHRzW2ldKSB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgLy8gTm8gbWlwbWFwIGxhcmdlciB0aGFuIGJvdW5kcyBmb3VuZC4gVXNlIGxhcmdlc3Qgb25lIHdoaWNoIHdpbGwgYmUgc2NhbGVkIHVwLgorICAgICAgICAgICAgaWYgKE4gPiAwKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIE4gLSAxOworICAgICAgICAgICAgfQorICAgICAgICAgICAgLy8gTm8gRHJhd2FibGUgbWlwbWFwIGF0IGFsbAorICAgICAgICAgICAgcmV0dXJuIC0xOworICAgICAgICB9CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIEFkZHMgYSBEcmF3YWJsZSB0byB0aGUgbGlzdCBvZiBhdmFpbGFibGUgbWlwbWFwIERyYXdhYmxlcy4gVGhpcyBsaXN0IGNhbiBiZSByZXRyaWV2ZWQKKyAgICAgICAgICogdXNpbmcge0BsaW5rIERyYXdhYmxlQ29udGFpbmVyLkRyYXdhYmxlQ29udGFpbmVyU3RhdGUjZ2V0Q2hpbGRyZW4oKX0gYW5kIHRoaXMgbWV0aG9kCisgICAgICAgICAqIGVuc3VyZXMgdGhhdCBpdCBpcyBhbHdheXMgc29ydGVkIGJ5IGluY3JlYXNpbmcge0BsaW5rIERyYXdhYmxlI2dldEludHJpbnNpY0hlaWdodCgpfS4KKyAgICAgICAgICoKKyAgICAgICAgICogQHBhcmFtIGRyYXdhYmxlIFRoZSBEcmF3YWJsZSB0aGF0IHdpbGwgYmUgYWRkZWQgdG8gY2hpbGRyZW4gbGlzdAorICAgICAgICAgKi8KKyAgICAgICAgcHVibGljIHZvaWQgYWRkRHJhd2FibGUoRHJhd2FibGUgZHJhd2FibGUpIHsKKyAgICAgICAgICAgIC8vIEluc2VydCBkcmF3YWJsZSBpbiBsYXN0IHBvc2l0aW9uLCBjb3JyZWN0bHkgcmVzZXR0aW5nIGNhY2hlZCB2YWx1ZXMgYW5kCisgICAgICAgICAgICAvLyBlc3BlY2lhbGx5IG1Db21wdXRlZENvbnN0YW50U2l6ZQorICAgICAgICAgICAgaW50IHBvcyA9IGFkZENoaWxkKGRyYXdhYmxlKTsKKworICAgICAgICAgICAgLy8gQnViYmxlIHNvcnQgdGhlIGxhc3QgZHJhd2FibGUgdG8gcmVzdG9yZSB0aGUgc29ydCBieSBpbnRyaW5zaWMgaGVpZ2h0CisgICAgICAgICAgICBmaW5hbCBpbnQgZHJhd2FibGVIZWlnaHQgPSBkcmF3YWJsZS5nZXRJbnRyaW5zaWNIZWlnaHQoKTsKKworICAgICAgICAgICAgd2hpbGUgKHBvcyA+IDApIHsKKyAgICAgICAgICAgICAgICBmaW5hbCBEcmF3YWJsZSBwcmV2aW91c0RyYXdhYmxlID0gbURyYXdhYmxlc1twb3MtMV07CisgICAgICAgICAgICAgICAgZmluYWwgaW50IHByZXZpb3VzSW50cmluc2ljSGVpZ2h0ID0gcHJldmlvdXNEcmF3YWJsZS5nZXRJbnRyaW5zaWNIZWlnaHQoKTsKKworICAgICAgICAgICAgICAgIGlmIChkcmF3YWJsZUhlaWdodCA8IHByZXZpb3VzSW50cmluc2ljSGVpZ2h0KSB7CisgICAgICAgICAgICAgICAgICAgIG1EcmF3YWJsZXNbcG9zXSA9IHByZXZpb3VzRHJhd2FibGU7CisgICAgICAgICAgICAgICAgICAgIG1NaXBtYXBIZWlnaHRzW3Bvc10gPSBwcmV2aW91c0ludHJpbnNpY0hlaWdodDsKKworICAgICAgICAgICAgICAgICAgICBtRHJhd2FibGVzW3Bvcy0xXSA9IGRyYXdhYmxlOworICAgICAgICAgICAgICAgICAgICBtTWlwbWFwSGVpZ2h0c1twb3MtMV0gPSBkcmF3YWJsZUhlaWdodDsKKyAgICAgICAgICAgICAgICAgICAgcG9zLS07CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIEludHJpbnNpYyBzaXplcyBhcmUgdGhvc2Ugb2YgdGhlIGxhcmdlc3QgYXZhaWxhYmxlIG1pcG1hcC4KKyAgICAgICAgICogTWluaW11bSBzaXplcyBhcmUgdGhvc2Ugb2YgdGhlIHNtYWxsZXN0IGF2YWlsYWJsZSBtaXBtYXAuCisgICAgICAgICAqLworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHJvdGVjdGVkIHZvaWQgY29tcHV0ZUNvbnN0YW50U2l6ZSgpIHsKKyAgICAgICAgICAgIGZpbmFsIGludCBOID0gZ2V0Q2hpbGRDb3VudCgpOworICAgICAgICAgICAgaWYgKE4gPiAwKSB7CisgICAgICAgICAgICAgICAgZmluYWwgRHJhd2FibGUgc21hbGxlc3REcmF3YWJsZSA9IG1EcmF3YWJsZXNbMF07CisgICAgICAgICAgICAgICAgbUNvbnN0YW50TWluaW11bVdpZHRoID0gc21hbGxlc3REcmF3YWJsZS5nZXRNaW5pbXVtV2lkdGgoKTsKKyAgICAgICAgICAgICAgICBtQ29uc3RhbnRNaW5pbXVtSGVpZ2h0ID0gc21hbGxlc3REcmF3YWJsZS5nZXRNaW5pbXVtSGVpZ2h0KCk7CisKKyAgICAgICAgICAgICAgICBmaW5hbCBEcmF3YWJsZSBsYXJnZXN0RHJhd2FibGUgPSBtRHJhd2FibGVzW04tMV07CisgICAgICAgICAgICAgICAgbUNvbnN0YW50V2lkdGggPSBsYXJnZXN0RHJhd2FibGUuZ2V0SW50cmluc2ljV2lkdGgoKTsKKyAgICAgICAgICAgICAgICBtQ29uc3RhbnRIZWlnaHQgPSBsYXJnZXN0RHJhd2FibGUuZ2V0SW50cmluc2ljSGVpZ2h0KCk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIG1Db25zdGFudFdpZHRoID0gbUNvbnN0YW50SGVpZ2h0ID0gLTE7CisgICAgICAgICAgICAgICAgbUNvbnN0YW50TWluaW11bVdpZHRoID0gbUNvbnN0YW50TWluaW11bUhlaWdodCA9IDA7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBtQ29tcHV0ZWRDb25zdGFudFNpemUgPSB0cnVlOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBEcmF3YWJsZSBuZXdEcmF3YWJsZSgpIHsKKyAgICAgICAgICAgIHJldHVybiBuZXcgTWlwbWFwRHJhd2FibGUodGhpcywgbnVsbCk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIERyYXdhYmxlIG5ld0RyYXdhYmxlKFJlc291cmNlcyByZXMpIHsKKyAgICAgICAgICAgIHJldHVybiBuZXcgTWlwbWFwRHJhd2FibGUodGhpcywgcmVzKTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgdm9pZCBncm93QXJyYXkoaW50IG9sZFNpemUsIGludCBuZXdTaXplKSB7CisgICAgICAgICAgICBzdXBlci5ncm93QXJyYXkob2xkU2l6ZSwgbmV3U2l6ZSk7CisgICAgICAgICAgICBpbnRbXSBuZXdJbnRzID0gbmV3IGludFtuZXdTaXplXTsKKyAgICAgICAgICAgIFN5c3RlbS5hcnJheWNvcHkobU1pcG1hcEhlaWdodHMsIDAsIG5ld0ludHMsIDAsIG9sZFNpemUpOworICAgICAgICAgICAgbU1pcG1hcEhlaWdodHMgPSBuZXdJbnRzOworICAgICAgICB9CisgICAgfQorCisgICAgcHJ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ICAgICAgICJvdXRlciByYWRpaSBtdXN0IGhhdmUgPj0gOCB2YWx1ZXMiKTsKKyAgICAgICAgaWYgKG91dGVyUmFkaWkgIT0gbnVsbCAmJiBvdXRlclJhZGlpLmxlbmd0aCA8IDgpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBBcnJheUluZGV4T3V0T2ZCb3VuZHNFeGNlcHRpb24oIm91dGVyIHJhZGlpIG11c3QgaGF2ZSA+PSA4IHZhbHVlcyIpOwogICAgICAgICB9CiAgICAgICAgIGlmIChpbm5lclJhZGlpICE9IG51bGwgJiYgaW5uZXJSYWRpaS5sZW5ndGggPCA4KSB7Ci0gICAgICAgICAgICB0aHJvdyBuZXcgQXJyYXlJbmRleE91dE9mQm91bmRzRXhjZXB0aW9uKAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJpbm5lciByYWRpaSBtdXN0IGhhdmUgPj0gOCB2YWx1ZXMiKTsKKyAgICAgICAgICAgIHRocm93IG5ldyBBcnJheUluZGV4T3V0T2ZCb3VuZHNFeGNlcHRpb24oImlubmVyIHJhZGlpIG11c3QgaGF2ZSA+PSA4IHZhbHVlcyIpOwogICAgICAgICB9CiAgICAgICAgIG1PdXRlclJhZGlpID0gb3V0ZXJSYWRpaTsKICAgICAgICAgbUluc2V0ID0gaW5zZXQ7CkBAIC05Nyw4ICs5NSw3IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICByLnJpZ2h0IC0gbUluc2V0LnJpZ2h0LCByLmJvdHRvbSAtIG1JbnNldC5ib3R0b20pOwogICAgICAgICAgICAgaWYgKG1Jbm5lclJlY3Qud2lkdGgoKSA8IHcgJiYgbUlubmVyUmVjdC5oZWlnaHQoKSA8IGgpIHsKICAgICAgICAgICAgICAgICBpZiAobUlubmVyUmFkaWkgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICBtUGF0aC5hZGRSb3VuZFJlY3QobUlubmVyUmVjdCwgbUlubmVyUmFkaWksCi0gICAgICAgICA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lwZTsKICAgICB9CkBAIC03NiwxMCArOTAsNTAgQEAKICAgICAgICAgc3ViRGF0YTFEKDAsIG1UeXBlLmdldEVsZW1lbnRDb3VudCgpLCBkKTsKICAgICB9CiAKKyAgICBwdWJsaWMgdm9pZCBzdWJEYXRhKGludCB4b2ZmLCBGaWVsZFBhY2tlciBmcCkgeworICAgICAgICBpbnQgZVNpemUgPSBtVHlwZS5tRWxlbWVudC5nZXRTaXplQnl0ZXMoKTsKKyAgICAgICAgZmluYWwgYnl0ZVtdIGRhdGEgPSBmcC5nZXREYXRhKCk7CisKKyAgICAgICAgaW50IGNvdW50ID0gZGF0YS5sZW5ndGggLyBlU2l6ZTsKKyAgICAgICAgaWYgKChlU2l6ZSAqIGNvdW50KSAhPSBkYXRhLmxlbmd0aCkgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiRmllbGQgcGFja2VyIGxlbmd0aCAiICsgZGF0YS5sZW5ndGggKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiIG5vdCBkaXZpc2libGUgYnkgZWxlbWVudCBzaXplICIgKyBlU2l6ZSArICIuIik7CisgICAgICAgIH0KKyAgICAgICAgZGF0YTFEQ2hlY2tzKHhvZmYsIGNvdW50LCBkYXRhLmxlbmd0aCwgZGF0YS5sZW5ndGgpOworICAgICAgICBtUlMubkFsbG9jYXRpb25TdWJEYXRhMUQobUlELCB4b2ZmLCBjb3VudCwgZGF0YSwgZGF0YS5sZW5ndGgpOworICAgIH0KKworCisgICAgcHVibGljIHZvaWQgc3ViRWxlbWVudERhdGEoaW50IHhvZmYsIGludCBjb21wb25lbnRfbnVtYmVyLCBGaWVsZFBhY2tlciBmcCkgeworICAgICAgICBpZiAoY29tcG9uZW50X251bWJlciA+PSBtVHlwZS5tRWxlbWVudC5tRWxlbWVudHMubGVuZ3RoKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJDb21wb25lbnRfbnVtYmVyICIgKyBjb21wb25lbnRfbnVtYmVyICsgIiBvdXQgb2YgcmFuZ2UuIik7CisgICAgICAgIH0KKyAgICAgICAgaWYoeG9mZiA8IDApIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oIk9mZnNldCBtdXN0IGJlID49IDAuIik7CisgICAgICAgIH0KKworICAgICAgICBmaW5hbCBieXRlW10gZGF0YSA9IGZwLmdldERhdGEoKTsKKyAgICAgICAgaW50IGVTaXplID0gbVR5cGUubUVsZW1lbnQubUVsZW1lbnRzW2NvbXBvbmVudF9udW1iZXJdLmdldFNpemVCeXRlcygpOworCisgICAgICAgIGlmIChkYXRhLmxlbmd0aCAhPSBlU2l6ZSkgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiRmllbGQgcGFja2VyIHNpemVsZW5ndGggIiArIGRhdGEubGVuZ3RoICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIiBkb2VzIG5vdCBtYXRjaCBjb21wb25lbnQgc2l6ZSAiICsgZVNpemUgKyAiLiIpOworICAgICAgICB9CisKKyAgICAgICAgbVJTLm5BbGxvY2F0aW9uU3ViRWxlbWVudERhdGExRChtSUQsIHhvZmYsIGNvbXBvbmVudF9udW1iZXIsIGRhdGEsIGRhdGEubGVuZ3RoKTsKKyAgICB9CisKICAgICBwcml2YXRlIHZvaWQgZGF0YTFEQ2hlY2tzKGludCBvZmYsIGludCBjb3VudCwgaW50IGxlbiwgaW50IGRhdGFTaXplKSB7CiAgICAgICAgIG1SUy52YWxpZGF0ZSgpOwotICAgICAgICBpZigob2ZmIDwgMCkgfHwgKGNvdW50IDwgMSkgfHwgKChvZmYgKyBjb3VudCkgPiBtVHlwZS5nZXRFbGVtZW50Q291bnQoKSkpIHsKLSAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oIk9mZnNldCBvciBDb3VudCBvdXQgb2YgYm91bmRzLiIpOworICAgICAgICBpZihvZmYgPCAwKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJPZmZzZXQgbXVzdCBiZSA+PSAwLiIpOworICAgICAgICB9CisgICAgICAgIGlmKGNvdW50IDwgMSkgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiQ291bnQgbXVzdCBiZSA+PSAxLiIpOworICAgICAgICB9CisgICAgICAgIGlmKChvZmYgKyBjb3VudCkgPiBtVHlwZS5nZXRFbGVtZW50Q291bnQoKSkgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiT3ZlcmZsb3csIEF2YWlsYWJsZSBjb3VudCAiICsgbVR5cGUuZ2V0RWxlbWVudENvdW50KCkgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiLCBnb3QgIiArIGNvdW50ICsgIiBhdCBvZmZzZXQgIiArIG9mZiArICIuIik7CiAgICAgICAgIH0KICAgICAgICAgaWYoKGxlbikgPCBkYXRhU2l6ZSkgewogICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiQXJyYXkgdG9vIHNtYWxsIGZvciBhbGxvY2F0aW9uIHR5cGUuIik7CkBAIC0xMDgsNyArMTYyLDYgQEAKICAgICB9CiAKIAotCiAgICAgcHVibGljIHZvaWQgc3ViRGF0YTJEKGludCB4b2ZmLCBpbnQgeW9mZiwgaW50IHcsIGludCBoLCBpbnRbXSBkKSB7CiAgICAgICAgIG1SUy52YWxpZGF0ZSgpOwogICAgICAgICBtUlMubkFsbG9jYXRpb25TdWJEYXRhMkQobUlELCB4b2ZmLCB5b2ZmLCB3LCBoLCBkL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fNjQgKDExLCA4KSwKIAotICAgICAgICBVTlNJR05FRF81XzZfNSAoMTIsIDIpLAotICAgICAgICBVTlNJR05FRF81XzVfNV8xICgxMywgMiksCi0gICAgICAgIFVOU0lHTkVEXzRfNF80XzQgKDE0LCAyKSwKKyAgICAgICAgQk9PTEVBTigxMiwgMSksCiAKLSAgICAgICAgUlNfRUxFTUVOVCAoMTUsIDQpLAotICAgICAgICBSU19UWVBFICgxNiwgNCksCi0gICAgICAgIFJTX0FMTE9DQVRJT04gKDE3LCA0KSwKLSAgICAgICAgUlNfU0FNUExFUiAoMTgsIDQpLAotICAgICAgICBSU19TQ1JJUFQgKDE5LCA0KSwKLSAgICAgICAgUlNfTUVTSCAoMjAsIDQpLAotICAgICAgICBSU19QUk9HUkFNX0ZSQUdNRU5UICgyMSwgNCksCi0gICAgICAgIFJTX1BST0dSQU1fVkVSVEVYICgyMiwgNCksCi0gICAgICAgIFJTX1BST0dSQU1fUkFTVEVSICgyMywgNCksCi0gICAgICAgIFJTX1BST0dSQU1fU1RPUkUgKDI0LCA0KTsKKyAgICAgICAgVU5TSUdORURfNV82XzUgKDEzLCAyKSwKKyAgICAgICAgVU5TSUdORURfNV81XzVfMSAoMTQsIDIpLAorICAgICAgICBVTlNJR05FRF80XzRfNF80ICgxNSwgMiksCisKKyAgICAgICAgTUFUUklYXzRYNCAoMTYsIDY0KSwKKyAgICAgICAgTUFUUklYXzNYMyAoMTcsIDM2KSwKKyAgICAgICAgTUFUUklYXzJYMiAoMTgsIDE2KSwKKworICAgICAgICBSU19FTEVNRU5UICgxMDAwLCA0KSwKKyAgICAgICAgUlNfVFlQRSAoMTAwMSwgNCksCisgICAgICAgIFJTX0FMTE9DQVRJT04gKDEwMDIsIDQpLAorICAgICAgICBSU19TQU1QTEVSICgxMDAzLCA0KSwKKyAgICAgICAgUlNfU0NSSVBUICgxMDA0LCA0KSwKKyAgICAgICAgUlNfTUVTSCAoMTAwNSwgNCksCisgICAgICAgIFJTX1BST0dSQU1fRlJBR01FTlQgKDEwMDYsIDQpLAorICAgICAgICBSU19QUk9HUkFNX1ZFUlRFWCAoMTAwNywgNCksCisgICAgICAgIFJTX1BST0dSQU1fUkFTVEVSICgxMDA4LCA0KSwKKyAgICAgICAgUlNfUFJPR1JBTV9TVE9SRSAoMTAwOSwgNCk7CiAKICAgICAgICAgaW50IG1JRDsKICAgICAgICAgaW50IG1TaXplOwpAQCAtNzIsMTIgKzgwLDYgQEAKIAogICAgIHB1YmxpYyBlbnVtIERhdGFLaW5kIHsKICAgICAgICAgVVNFUiAoMCksCi0gICAgICAgIENPTE9SICgxKSwKLSAgICAgICAgUE9TSVRJT04gKDIpLAotICAgICAgICBURVhUVVJFICgzKSwKLSAgICAgICAgTk9STUFMICg0KSwKLSAgICAgICAgSU5ERVggKDUpLAotICAgICAgICBQT0lOVF9TSVpFKDYpLAogCiAgICAgICAgIFBJWEVMX0wgKDcpLAogICAgICAgICBQSVhFTF9BICg4KSwKQEAgLTkxLDQxICs5MywxMzMgQEAKICAgICAgICAgfQogICAgIH0KIAotICAgIHB1YmxpYyBzdGF0aWMgRWxlbWVudCBVU0VSX1U4KFJlbmRlclNjcmlwdCBycykgewotICAgICAgICBpZihycy5tRWxlbWVudF9VU0VSX1U4ID09IG51bGwpIHsKLSAgICAgICAgICAgIHJzLm1FbGVtZW50X1VTRVJfVTggPSBjcmVhdGVVc2VyKHJzLCBEYXRhVHlwZS5VTlNJR05FRF84KTsKKyAgICBwdWJsaWMgc3RhdGljIEVsZW1lbnQgQk9PTEVBTihSZW5kZXJTY3JpcHQgcnMpIHsKKyAgICAgICAgaWYocnMubUVsZW1lbnRfQk9PTEVBTiA9PSBudWxsKSB7CisgICAgICAgICAgICBycy5tRWxlbWVudF9CT09MRUFOID0gY3JlYXRlVXNlcihycywgRGF0YVR5cGUuQk9PTEVBTik7CiAgICAgICAgIH0KLSAgICAgICAgcmV0dXJuIHJzLm1FbGVtZW50X1VTRVJfVTg7CisgICAgICAgIHJldHVybiBycy5tRWxlbWVudF9CT09MRUFOOwogICAgIH0KIAotICAgIHB1YmxpYyBzdGF0aWMgRWxlbWVudCBVU0VSX0k4KFJlbmRlclNjcmlwdCBycykgewotICAgICAgICBpZihycy5tRWxlbWVudF9VU0VSX0k4ID09IG51bGwpIHsKLSAgICAgICAgICAgIHJzLm1FbGVtZW50X1VTRVJfSTggPSBjcmVhdGVVc2VyKHJzLCBEYXRhVHlwZS5TSUdORURfOCk7CisgICAgcHVibGljIHN0YXRpYyBFbGVtZW50IFU4KFJlbmRlclNjcmlwdCBycykgeworICAgICAgICBpZihycy5tRWxlbWVudF9VOCA9PSBudWxsKSB7CisgICAgICAgICAgICBycy5tRWxlbWVudF9VOCA9IGNyZWF0ZVVzZXIocnMsIERhdGFUeXBlLlVOU0lHTkVEXzgpOwogICAgICAgICB9Ci0gICAgICAgIHJldHVybiBycy5tRWxlbWVudF9VU0VSX0k4OworICAgICAgICByZXR1cm4gcnMubUVsZW1lbnRfVTg7CiAgICAgfQogCi0gICAgcHVibGljIHN0YXRpYyBFbGVtZW50IFVTRVJfVTMyKFJlbmRlclNjcmlwdCBycykgewotICAgICAgICBpZihycy5tRWxlbWVudF9VU0VSX1UzMiA9PSBudWxsKSB7Ci0gICAgICAgICAgICBycy5tRWxlbWVudF9VU0VSX1UzMiA9IGNyZWF0ZVVzZXIocnMsIERhdGFUeXBlLlVOU0lHTkVEXzMyKTsKKyAgICBwdWJsaWMgc3RhdGljIEVsZW1lbnQgSTgoUmVuZGVyU2NyaXB0IHJzKSB7CisgICAgICAgIGlmKHJzLm1FbGVtZW50X0k4ID09IG51bGwpIHsKKyAgICAgICAgICAgIHJzLm1FbGVtZW50X0k4ID0gY3JlYXRlVXNlcihycywgRGF0YVR5cGUuU0lHTkVEXzgpOwogICAgICAgICB9Ci0gICAgICAgIHJldHVybiBycy5tRWxlbWVudF9VU0VSX1UzMjsKKyAgICAgICAgcmV0dXJuIHJzLm1FbGVtZW50X0k4OwogICAgIH0KIAotICAgIHB1Ymxp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F0aWMgRWxlbWVudCBVMzIoUmVuZGVyU2NyaXB0IHJzKSB7CisgICAgICAgIGlmKHJzLm1FbGVtZW50X1UzMiA9PSBudWxsKSB7CisgICAgICAgICAgICBycy5tRWxlbWVudF9VMzIgPSBjcmVhdGVVc2VyKHJzLCBEYXRhVHlwZS5VTlNJR05FRF8zMik7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHJzLm1FbGVtZW50X1UzMjsKKyAgICB9CisKKyAgICBwdWJsaWMgc3RhdGljIEVsZW1lbnQgSTMyKFJlbmRlclNjcmlwdCBycykgeworICAgICAgICBpZihycy5tRWxlbWVudF9JMzIgPT0gbnVsbCkgeworICAgICAgICAgICAgcnMubUVsZW1lbnRfSTMyID0gY3JlYXRlVXNlcihycywgRGF0YVR5cGUuU0lHTkVEXzMyKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gcnMubUVsZW1lbnRfSTMyOworICAgIH0KKworICAgIHB1YmxpYyBzdGF0aWMgRWxlbWVudCBGMzIoUmVuZGVyU2NyaXB0IHJzKSB7CisgICAgICAgIGlmKHJzLm1FbGVtZW50X0YzMiA9PSBudWxsKSB7CisgICAgICAgICAgICBycy5tRWxlbWVudF9GMzIgPSBjcmVhdGVVc2VyKHJzLCBEYXRhVHlwZS5GTE9BVF8zMik7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHJzLm1FbGVtZW50X0YzMjsKKyAgICB9CisKKyAgICBwdWJsaWMgc3RhdGljIEVsZW1lbnQgRUxFTUVOVChSZW5kZXJTY3JpcHQgcnMpIHsKKyAgICAgICAgaWYocnMubUVsZW1lbnRfRUxFTUVOVCA9PSBudWxsKSB7CisgICAgICAgICAgICBycy5tRWxlbWVudF9FTEVNRU5UID0gY3JlYXRlVXNlcihycywgRGF0YVR5cGUuUlNfRUxFTUVOVCk7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHJzLm1FbGVtZW50X0VMRU1FTlQ7CisgICAgfQorCisgICAgcHVibGljIHN0YXRpYyBFbGVtZW50IFRZUEUoUmVuZGVyU2NyaXB0IHJzKSB7CisgICAgICAgIGlmKHJzLm1FbGVtZW50X1RZUEUgPT0gbnVsbCkgeworICAgICAgICAgICAgcnMubUVsZW1lbnRfVFlQRSA9IGNyZWF0ZVVzZXIocnMsIERhdGFUeXBlLlJTX1RZUEUpOworICAgICAgICB9CisgICAgICAgIHJldHVybiBycy5tRWxlbWVudF9UWVBFOworICAgIH0KKworICAgIHB1YmxpYyBzdGF0aWMgRWxlbWVudCBBTExPQ0FUSU9OKFJlbmRlclNjcmlwdCBycykgeworICAgICAgICBpZihycy5tRWxlbWVudF9BTExPQ0FUSU9OID09IG51bGwpIHsKKyAgICAgICAgICAgIHJzLm1FbGVtZW50X0FMTE9DQVRJT04gPSBjcmVhdGVVc2VyKHJzLCBEYXRhVHlwZS5SU19BTExPQ0FUSU9OKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gcnMubUVsZW1lbnRfQUxMT0NBVElPTjsKKyAgICB9CisKKyAgICBwdWJsaWMgc3RhdGljIEVsZW1lbnQgU0FNUExFUihSZW5kZXJTY3JpcHQgcnMpIHsKKyAgICAgICAgaWYocnMubUVsZW1lbnRfU0FNUExFUiA9PSBudWxsKSB7CisgICAgICAgICAgICBycy5tRWxlbWVudF9TQU1QTEVSID0gY3JlYXRlVXNlcihycywgRGF0YVR5cGUuUlNfU0FNUExFUik7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHJzLm1FbGVtZW50X1NBTVBMRVI7CisgICAgfQorCisgICAgcHVibGljIHN0YXRpYyBFbGVtZW50IFNDUklQVChSZW5kZXJTY3JpcHQgcnMpIHsKKyAgICAgICAgaWYocnMubUVsZW1lbnRfU0NSSVBUID09IG51bGwpIHsKKyAgICAgICAgICAgIHJzLm1FbGVtZW50X1NDUklQVCA9IGNyZWF0ZVVzZXIocnMsIERhdGFUeXBlLlJTX1NDUklQVCk7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHJzLm1FbGVtZW50X1NDUklQVDsKKyAgICB9CisKKyAgICBwdWJsaWMgc3RhdGljIEVsZW1lbnQgTUVTSChSZW5kZXJTY3JpcHQgcnMpIHsKKyAgICAgICAgaWYocnMubUVsZW1lbnRfTUVTSCA9PSBudWxsKSB7CisgICAgICAgICAgICBycy5tRWxlbWVudF9NRVNIID0gY3JlYXRlVXNlcihycywgRGF0YVR5cGUuUlNfTUVTSCk7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHJzLm1FbGVtZW50X01FU0g7CisgICAgfQorCisgICAgcHVibGljIHN0YXRpYyBFbGVtZW50IFBST0dSQU1fRlJBR01FTlQoUmVuZGVyU2NyaXB0IHJzKSB7CisgICAgICAgIGlmKHJzLm1FbGVtZW50X1BST0dSQU1fRlJBR01FTlQgPT0gbnVsbCkgeworICAgICAgICAgICAgcnMubUVsZW1lbnRfUFJPR1JBTV9GUkFHTUVOVCA9IGNyZWF0ZVVzZXIocnMsIERhdGFUeXBlLlJTX1BST0dSQU1fRlJBR01FTlQpOworICAgICAgICB9CisgICAgICAgIHJldHVybiBycy5tRWxlbWVudF9QUk9HUkFNX0ZSQUdNRU5UOworICAgIH0KKworICAgIHB1YmxpYyBzdGF0aWMgRWxlbWVudCBQUk9HUkFNX1ZFUlRFWChSZW5kZXJTY3JpcHQgcnMpIHsKKyAgICAgICAgaWYocnMubUVsZW1lbnRfUFJPR1JBTV9WRVJURVggPT0gbnVsbCkgeworICAgICAgICAgICAgcnMubUVsZW1lbnRfUFJPR1JBTV9WRVJURVggPSBjcmVhdGVVc2VyKHJzLCBEYXRhVHlwZS5SU19QUk9HUkFNX1ZFUlRFWCk7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHJzLm1FbGVtZW50X1BST0dSQU1fVkVSVEVYOworICAgIH0KKworICAgIHB1YmxpYyBzdGF0aWMgRWxlbWVudCBQUk9HUkFNX1JBU1RFUihSZW5kZXJTY3JpcHQgcnMpIHsKKyAgICAgICAgaWYocnMubUVsZW1lbnRfUFJPR1JBTV9SQVNURVIgPT0gbnVsbCkgeworICAgICAgICAgICAgcnMubUVsZW1lbnRfUFJPR1JBTV9SQVNURVIgPSBjcmVhdGVVc2VyKHJzLCBEYXRhVHlwZS5SU19QUk9HUkFNX1JBU1RFUik7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHJzLm1FbGVtZW50X1BST0dSQU1fUkFTVEVSOworICAgIH0KKworICAgIHB1YmxpYyBzdGF0aWMgRWxlbWVudCBQUk9HUkFNX1NUT1JFKFJlbmRlclNjcmlwdCBycykgeworICAgICAgICBpZihycy5tRWxlbWVudF9QUk9HUkFNX1NUT1JFID09IG51bGwpIHsKKyAgICAgICAgICAgIHJzLm1FbGVtZW50X1BST0dSQU1fU1RPUkUgPSBjcmVhdGVVc2VyKHJzLCBEYXRhVHlwZS5SU19QUk9HUkFNX1NUT1JFKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gcnMubUVsZW1lbnRfUFJPR1JBTV9TVE9SRTsKKyAgICB9CisKKwogICAgIHB1YmxpYyBzdGF0aWMgRWxlbWVudCBBXzgoUmVuZGVyU2NyaXB0IHJzKSB7CiAgICAgICAgIGlmKHJzLm1FbGVtZW50X0FfOCA9PSBudWxsKSB7CiAgICAgICAgICAgICBycy5tRWxlbWVudF9BXzggPSBjcmVhdGVQaXhlbChycywgRGF0YVR5cGUuVU5TSUdORURfOCwgRGF0YUtpbmQuUElYRUxfQSk7CkBAIC0xNjgsMTY4ICsyNjIsMTQxIEBACiAgICAgICAgIHJldHVybiBycy5tRWxlbWVudF9SR0JBXzg4ODg7CiAgICAgfQogCi0gICAgcHVibGljIHN0YXRpYyBFbGVtZW50IElOREVYXzE2KFJlbmRlclNjcmlwdCBycykgewotICAgICAgICBpZihycy5tRWxlbWVudF9JTkRFWF8xNiA9PSBudWxsKSB7Ci0gICAgICAgICAgICBycy5tRWxlbWVudF9JTkRFWF8xNiA9IGNyZWF0ZUluZGV4KHJzKTsKKyAgICBwdWJsaWMgc3RhdGljIEVsZW1lbnQgRjMyXzIoUmVuZGVyU2NyaXB0IHJzKSB7CisgICAgICAgIGlmKHJzLm1FbGVtZW50X0ZMT0FUXzIgPT0gbnVsbCkgeworICAgICAgICAgICAgcnMubUVsZW1lbnRfRkxPQVRfMiA9IGNyZWF0ZVZlY3RvcihycywgRGF0YVR5cGUuRkxPQVRfMzIsIDIpOwogICAgICAgICB9Ci0gICAgICAgIHJldHVybiBycy5tRWxlbWVudF9JTkRFWF8xNjsKKyAgICAgICAgcmV0dXJuIHJzLm1FbGVtZW50X0ZMT0FUXzI7CiAgICAgfQogCi0gICAgcHVibGljIHN0YXRpYyBFbGVtZW50IEFUVFJJQl9QT1NJVElPTl8yKFJlbmRlclNjcmlwdCBycykgewotICAgICAgICBpZihycy5tRWxlbWVudF9QT1NJVElPTl8yID09IG51bGwpIHsKLSAgICAgICAgICAgIHJzLm1FbGVtZW50X1BPU0lUSU9OXzIgPSBjcmVhdGVBdHRyaWIocnMsIERhdGFUeXBlLkZMT0FUXzMyLCBEYXRhS2luZC5QT1NJVElPTiwgMik7CisgICAgcHVibGljIHN0YXRpYyBFbGVtZW50IEYzMl8zKFJlbmRlclNjcmlwdCBycykgeworICAgICAgICBpZihycy5tRWxlbWVudF9GTE9BVF8zID09IG51bGwpIHsKKyAgICAgICAgICAgIHJzLm1FbGVtZW50X0ZMT0FUXzMgPSBjcmVhdGVWZWN0b3IocnMsIERhdGFUeXBlLkZMT0FUXzMyLCAzKTsKICAgICAgICAgfQotICAgICAgICByZXR1cm4gcnMubUVsZW1lbnRfUE9TSVRJT05fMjsKKyAgICAgICAgcmV0dXJuIHJzLm1FbGVtZW50X0ZMT0FUXzM7CiAgICAgfQogCi0gICAgcHVibGljIHN0YXRpYyBFbGVtZW50IEFUVFJJQl9QT1NJVElPTl8zKFJlbmRlclNjcmlwdCBycykgewotICAgICAgICBpZihycy5tRWxlbWVudF9QT1NJVElPTl8zID09IG51bGwpIHsKLSAgICAgICAgICAgIHJzL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XIoaWQsIHJzKTsKICAgICAgICAgbVNpemUgPSAwOwogICAgICAgICBtRWxlbWVudHMgPSBlOwogICAgICAgICBtRWxlbWVudE5hbWVzID0gbjsKLSAgICAgICAgaW50W10gaWRzID0gbmV3IGludFttRWxlbWVudHMubGVuZ3RoXTsKKyAgICAgICAgbUFycmF5U2l6ZXMgPSBhczsKICAgICAgICAgZm9yIChpbnQgY3QgPSAwOyBjdCA8IG1FbGVtZW50cy5sZW5ndGg7IGN0KysgKSB7CiAgICAgICAgICAgICBtU2l6ZSArPSBtRWxlbWVudHNbY3RdLm1TaXplOwotICAgICAgICAgICAgaWRzW2N0XSA9IG1FbGVtZW50c1tjdF0ubUlEOwogICAgICAgICB9Ci0gICAgICAgIG1JRCA9IHJzLm5FbGVtZW50Q3JlYXRlMihpZHMsIG1FbGVtZW50TmFtZXMpOwogICAgIH0KIAotICAgIEVsZW1lbnQoUmVuZGVyU2NyaXB0IHJzLCBEYXRhVHlwZSBkdCwgRGF0YUtpbmQgZGssIGJvb2xlYW4gbm9ybSwgaW50IHNpemUpIHsKLSAgICAgICAgc3VwZXIocnMpOworICAgIEVsZW1lbnQoaW50IGlkLCBSZW5kZXJTY3JpcHQgcnMsIERhdGFUeXBlIGR0LCBEYXRhS2luZCBkaywgYm9vbGVhbiBub3JtLCBpbnQgc2l6ZSkgeworICAgICAgICBzdXBlcihpZCwgcnMpOwogICAgICAgICBtU2l6ZSA9IGR0Lm1TaXplICogc2l6ZTsKICAgICAgICAgbVR5cGUgPSBkdDsKICAgICAgICAgbUtpbmQgPSBkazsKICAgICAgICAgbU5vcm1hbGl6ZWQgPSBub3JtOwogICAgICAgICBtVmVjdG9yU2l6ZSA9IHNpemU7Ci0gICAgICAgIG1JRCA9IHJzLm5FbGVtZW50Q3JlYXRlKGR0Lm1JRCwgZGsubUlELCBub3JtLCBzaXplKTsKKyAgICB9CisKKyAgICBFbGVtZW50KGludCBpZCwgUmVuZGVyU2NyaXB0IHJzKSB7CisgICAgICAgIHN1cGVyKGlkLCBycyk7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgdm9pZCB1cGRhdGVGcm9tTmF0aXZlKCkgeworCisgICAgICAgIC8vIHdlIHdpbGwgcGFjayBtVHlwZTsgbUtpbmQ7IG1Ob3JtYWxpemVkOyBtVmVjdG9yU2l6ZTsgTnVtU3ViRWxlbWVudHMKKyAgICAgICAgaW50W10gZGF0YUJ1ZmZlciA9IG5ldyBpbnRbNV07CisgICAgICAgIG1SUy5uRWxlbWVudEdldE5hdGl2ZURhdGEobUlELCBkYXRhQnVmZmVyKTsKKworICAgICAgICBtTm9ybWFsaXplZCA9IGRhdGFCdWZmZXJbMl0gPT0gMSA/IHRydWUgOiBmYWxzZTsKKyAgICAgICAgbVZlY3RvclNpemUgPSBkYXRhQnVmZmVyWzNdOworICAgICAgICBtU2l6ZSA9IDA7CisgICAgICAgIGZvciAoRGF0YVR5cGUgZHQ6IERhdGFUeXBlLnZhbHVlcygpKSB7CisgICAgICAgICAgICBpZihkdC5tSUQgPT0gZGF0YUJ1ZmZlclswXSl7CisgICAgICAgICAgICAgICAgbVR5cGUgPSBkdDsKKyAgICAgICAgICAgICAgICBtU2l6ZSA9IG1UeXBlLm1TaXplICogbVZlY3RvclNpemU7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgZm9yIChEYXRhS2luZCBkazogRGF0YUtpbmQudmFsdWVzKCkpIHsKKyAgICAgICAgICAgIGlmKGRrLm1JRCA9PSBkYXRhQnVmZmVyWzFdKXsKKyAgICAgICAgICAgICAgICBtS2luZCA9IGRrOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgaW50IG51bVN1YkVsZW1lbnRzID0gZGF0YUJ1ZmZlcls0XTsKKyAgICAgICAgaWYobnVtU3ViRWxlbWVudHMgPiAwKSB7CisgICAgICAgICAgICBtRWxlbWVudHMgPSBuZXcgRWxlbWVudFtudW1TdWJFbGVtZW50c107CisgICAgICAgICAgICBtRWxlbWVudE5hbWVzID0gbmV3IFN0cmluZ1tudW1TdWJFbGVtZW50c107CisKKyAgICAgICAgICAgIGludFtdIHN1YkVsZW1lbnRJZHMgPSBuZXcgaW50W251bVN1YkVsZW1lbnRzXTsKKyAgICAgICAgICAgIG1SUy5uRWxlbWVudEdldFN1YkVsZW1lbnRzKG1JRCwgc3ViRWxlbWVudElkcywgbUVsZW1lbnROYW1lcyk7CisgICAgICAgICAgICBmb3IoaW50IGkgPSAwOyBpIDwgbnVtU3ViRWxlbWVudHM7IGkgKyspIHsKKyAgICAgICAgICAgICAgICBtRWxlbWVudHNbaV0gPSBuZXcgRWxlbWVudChzdWJFbGVtZW50SWRzW2ldLCBtUlMpOworICAgICAgICAgICAgICAgIG1FbGVtZW50c1tpXS51cGRhdGVGcm9tTmF0aXZlKCk7CisgICAgICAgICAgICAgICAgbVNpemUgKz0gbUVsZW1lbnRzW2ldLm1TaXplOworICAgICAgICAgICAgfQorICAgICAgICB9CisKICAgICB9CiAKICAgICBwdWJsaWMgdm9pZCBkZXN0cm95KCkgdGhyb3dzIElsbGVnYWxTdGF0ZUV4Y2VwdGlvbiB7CiAgICAgICAgIHN1cGVyLmRlc3Ryb3koKTsKICAgICB9CiAKLSAgICBwdWJsaWMgc3RhdGljIEVsZW1lbnQgY3JlYXRlRnJvbUNsYXNzKFJlbmRlclNjcmlwdCBycywgQ2xhc3MgYykgewotICAgICAgICBycy52YWxpZGF0ZSgpOwotICAgICAgICBGaWVsZFtdIGZpZWxkcyA9IGMuZ2V0RmllbGRzKCk7Ci0gICAgICAgIEJ1aWxkZXIgYiA9IG5ldyBCdWlsZGVyKHJzKTsKLQotICAgICAgICBmb3IoRmllbGQgZjogZmllbGRzKSB7Ci0gICAgICAgICAgICBDbGFzcyBmYyA9IGYuZ2V0VHlwZSgpOwotICAgICAgICAgICAgaWYoZmMgPT0gaW50LmNsYXNzKSB7Ci0gICAgICAgICAgICAgICAgYi5hZGQoY3JlYXRlVXNlcihycywgRGF0YVR5cGUuU0lHTkVEXzMyKSwgZi5nZXROYW1lKCkpOwotICAgICAgICAgICAgfSBlbHNlIGlmKGZjID09IHNob3J0LmNsYXNzKSB7Ci0gICAgICAgICAgICAgICAgYi5hZGQoY3JlYXRlVXNlcihycywgRGF0YVR5cGUuU0lHTkVEXzE2KSwgZi5nZXROYW1lKCkpOwotICAgICAgICAgICAgfSBlbHNlIGlmKGZjID09IGJ5dGUuY2xhc3MpIHsKLSAgICAgICAgICAgICAgICBiLmFkZChjcmVhdGVVc2VyKHJzLCBEYXRhVHlwZS5TSUdORURfOCksIGYuZ2V0TmFtZSgpKTsKLSAgICAgICAgICAgIH0gZWxzZSBpZihmYyA9PSBmbG9hdC5jbGFzcykgewotICAgICAgICAgICAgICAgIGIuYWRkKGNyZWF0ZVVzZXIocnMsIERhdGFUeXBlLkZMT0FUXzMyKSwgZi5nZXROYW1lKCkpOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJVbmtvd24gZmllbGQgdHlwZSIpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgICAgIHJldHVybiBiLmNyZWF0ZSgpOwotICAgIH0KLQotCiAgICAgLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8KICAgICBwdWJsaWMgc3RhdGljIEVsZW1lbnQgY3JlYXRlVXNlcihSZW5kZXJTY3JpcHQgcnMsIERhdGFUeXBlIGR0KSB7Ci0gICAgICAgIHJldHVybiBuZXcgRWxlbWVudChycywgZHQsIERhdGFLaW5kLlVTRVIsIGZhbHNlLCAxKTsKKyAgICAgICAgRGF0YUtpbmQgZGsgPSBEYXRhS2luZC5VU0VSOworICAgICAgICBib29sZWFuIG5vcm0gPSBmYWxzZTsKKyAgICAgICAgaW50IHZlY1NpemUgPSAxOworICAgICAgICBpbnQgaWQgPSBycy5uRWxlbWVudENyZWF0ZShkdC5tSUQs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gICAgICAgIGR0ID09IERhdGFUeXBlLlNJR05FRF8xNiB8fAotICAgICAgICAgICAgICBkdCA9PSBEYXRhVHlwZS5TSUdORURfMzIpKSB7Ci0gICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJVbnN1cHBvcnRlZCBEYXRhVHlwZSIpOwotICAgICAgICB9Ci0KLSAgICAgICAgaWYgKCEoZGsgPT0gRGF0YUtpbmQuQ09MT1IgfHwKLSAgICAgICAgICAgICAgZGsgPT0gRGF0YUtpbmQuUE9TSVRJT04gfHwKLSAgICAgICAgICAgICAgZGsgPT0gRGF0YUtpbmQuVEVYVFVSRSB8fAotICAgICAgICAgICAgICBkayA9PSBEYXRhS2luZC5OT1JNQUwgfHwKLSAgICAgICAgICAgICAgZGsgPT0gRGF0YUtpbmQuUE9JTlRfU0laRSB8fAotICAgICAgICAgICAgICBkayA9PSBEYXRhS2luZC5VU0VSKSkgewotICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiVW5zdXBwb3J0ZWQgRGF0YUtpbmQiKTsKLSAgICAgICAgfQotCi0gICAgICAgIGlmIChkayA9PSBEYXRhS2luZC5DT0xPUiAmJgotICAgICAgICAgICAgKChkdCAhPSBEYXRhVHlwZS5GTE9BVF8zMiAmJiBkdCAhPSBEYXRhVHlwZS5VTlNJR05FRF84KSB8fAotICAgICAgICAgICAgIHNpemUgPCAzIHx8IHNpemUgPiA0KSkgewotICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiQmFkIGNvbWJvIik7Ci0gICAgICAgIH0KLSAgICAgICAgaWYgKGRrID09IERhdGFLaW5kLlBPU0lUSU9OICYmIChzaXplIDwgMSB8fCBzaXplID4gNCkpIHsKLSAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oIkJhZCBjb21ibyIpOwotICAgIC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WQsIHJzLCBkdCwgZGssIG5vcm0sIHNpemUpOwogICAgIH0KIAogICAgIHB1YmxpYyBzdGF0aWMgRWxlbWVudCBjcmVhdGVQaXhlbChSZW5kZXJTY3JpcHQgcnMsIERhdGFUeXBlIGR0LCBEYXRhS2luZCBkaykgewpAQCAtMzY3LDEzICs0MzQsMTYgQEAKICAgICAgICAgICAgIHNpemUgPSA0OwogICAgICAgICB9CiAKLSAgICAgICAgcmV0dXJuIG5ldyBFbGVtZW50KHJzLCBkdCwgZGssIHRydWUsIHNpemUpOworICAgICAgICBib29sZWFuIG5vcm0gPSB0cnVlOworICAgICAgICBpbnQgaWQgPSBycy5uRWxlbWVudENyZWF0ZShkdC5tSUQsIGRrLm1JRCwgbm9ybSwgc2l6ZSk7CisgICAgICAgIHJldHVybiBuZXcgRWxlbWVudChpZCwgcnMsIGR0LCBkaywgbm9ybSwgc2l6ZSk7CiAgICAgfQogCiAgICAgcHVibGljIHN0YXRpYyBjbGFzcyBCdWlsZGVyIHsKICAgICAgICAgUmVuZGVyU2NyaXB0IG1SUzsKICAgICAgICAgRWxlbWVudFtdIG1FbGVtZW50czsKICAgICAgICAgU3RyaW5nW10gbUVsZW1lbnROYW1lczsKKyAgICAgICAgaW50W10gbUFycmF5U2l6ZXM7CiAgICAgICAgIGludCBtQ291bnQ7CiAKICAgICAgICAgcHVibGljIEJ1aWxkZXIoUmVuZGVyU2NyaXB0IHJzKSB7CkBAIC0zODEsMjkgKzQ1MSw0OSBAQAogICAgICAgICAgICAgbUNvdW50ID0gMDsKICAgICAgICAgICAgIG1FbGVtZW50cyA9IG5ldyBFbGVtZW50WzhdOwogICAgICAgICAgICAgbUVsZW1lbnROYW1lcyA9IG5ldyBTdHJpbmdbOF07CisgICAgICAgICAgICBtQXJyYXlTaXplcyA9IG5ldyBpbnRbOF07CiAgICAgICAgIH0KIAotICAgICAgICBwdWJsaWMgdm9pZCBhZGQoRWxlbWVudCBlbGVtZW50LCBTdHJpbmcgbmFtZSkgeworICAgICAgICBwdWJsaWMgdm9pZCBhZGQoRWxlbWVudCBlbGVtZW50LCBTdHJpbmcgbmFtZSwgaW50IGFycmF5U2l6ZSkgeworICAgICAgICAgICAgaWYgKGFycmF5U2l6ZSA8IDEpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJBcnJheSBzaXplIGNhbm5vdCBiZSBsZXNzIHRoYW4gMS4iKTsKKyAgICAgICAgICAgIH0KICAgICAgICAgICAgIGlmKG1Db3VudCA9PSBtRWxlbWVudHMubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgRWxlbWVudFtdIGUgPSBuZXcgRWxlbWVudFttQ291bnQgKyA4XTsKICAgICAgICAgICAgICAgICBTdHJpbmdbXSBzID0gbmV3IFN0cmluZ1ttQ291bnQgKyA4XTsKKyAgICAgICAgICAgICAgICBpbnRbXSBhcyA9IG5ldyBpbnRbbUNvdW50ICsgOF07CiAgICAgICAgICAgICAgICAgU3lzdGVtLmFycmF5Y29weShtRWxlbWVudHMsIDAsIGUsIDAsIG1Db3VudCk7CiAgICAgICAgICAgICAgICAgU3lzdGVtLmFycmF5Y29weShtRWxlbWVudE5hbWVzLCAwLCBzLCAwLCBtQ291bnQpOworICAgICAgICAgICAgICAgIFN5c3RlbS5hcnJheWNvcHkobUFycmF5U2l6ZXMsIDAsIGFzLCAwLCBtQ291bnQpOwogICAgICAgICAgICAgICAgIG1FbGVtZW50cyA9IGU7CiAgICAgICAgICAgICAgICAgbUVsZW1lbnROYW1lcyA9IHM7CisgICAgICAgICAgICAgICAgbUFycmF5U2l6ZXMgPSBhczsKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIG1FbGVtZW50c1ttQ291bnRdID0gZWxlbWVudDsKICAgICAgICAgICAgIG1FbGVtZW50TmFtZXNbbUNvdW50XSA9IG5hbWU7CisgICAgICAgICAgICBtQXJyYXlTaXplc1ttQ291bnRdID0gYXJyYXlTaXplOwogICAgICAgICAgICAgbUNvdW50Kys7CiAgICAgICAgIH0KIAorICAgICAgICBwdWJsaWMgdm9pZCBhZGQoRWxlbWVudCBlbGVtZW50LCBTdHJpbmcgbmFtZSkgeworICAgICAgICAgICAgYWRkKGVsZW1lbnQsIG5hbWUsIDEpOworICAgICAgICB9CisKICAgICAgICAgcHVibGljIEVsZW1lbnQgY3JlYXRlKCkgewogICAgICAgICAgICAgbVJTLnZhbGlkYXRlKCk7CiAgICAgICAgICAgICBFbGVtZW50W10gZWluID0gbmV3IEVsZW1lbnRbbUNvdW50XTsKICAgICAgICAgICAgIFN0cmluZ1tdIHNpbiA9IG5ldyBTdHJpbmdbbUNvdW50XTsKKyAgICAgICAgICAgIGludFtdIGFzaW4gPSBuZXcgaW50W21Db3VudF07CiAgICAgICAgICAgICBqYXZhLmxhbmcuU3lzdGVtLmFycmF5Y29weShtRWxlbWVudHMsIDAsIGVpbiwgMCwgbUNvdW50KTsKICAgICAgICAgICAgIGphdmEubGFuZy5TeXN0ZW0uYXJyYXljb3B5KG1FbGVtZW50TmFtZXMsIDAsIHNpbiwgMCwgbUNvdW50KTsKLSAgICAgICAgICAgIHJldHVybiBuZXcgRWxlbWVudChtUlMsIGVpbiwgc2luKTsKKyAgICAgICAgICAgIGphdmEubGFuZy5TeXN0ZW0uYXJyYXljb3B5KG1BcnJheVNpemVzLCAwLCBhc2luLCAwLCBtQ291bnQpOworCisgICAgICAgICAgICBpbnRbXSBpZHMgPSBuZXcgaW50W2Vpbi5sZW5ndGhdOworICAgICAgICAgICAgZm9yIChpbnQgY3QgPSAwOyBjdCA8IGVpbi5sZW5ndGg7IGN0KysgKSB7CisgICAgICAgICAgICAgICAgaWRzW2N0XSA9IGVpbltjdF0ubUlEOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaW50IGlkID0gbVJTLm5FbGVtZW50Q3JlYXRlMihpZHMsIHNpbiwgYXNpbik7CisgICAgICAgICAgICByZXR1cm4gbmV3IEVsZW1lbnQoaWQsIG1SUywgZWluLC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ZvaWQgYWRkSTMyKGludCB2KSB7CiAgICAgICAgIGFsaWduKDQpOwogICAgICAgICBtRGF0YVttUG9zKytdID0gKGJ5dGUpKHYgJiAweGZmKTsKICAgICAgICAgbURhdGFbbVBvcysrXSA9IChieXRlKSgodiA+PiA4KSAmIDB4ZmYpOwpAQCAtNTUsNyArNjIsNyBAQAogICAgICAgICBtRGF0YVttUG9zKytdID0gKGJ5dGUpKCh2ID4+IDI0KSAmIDB4ZmYpOwogICAgIH0KIAotICAgIHZvaWQgYWRkSTY0KGxvbmcgdikgeworICAgIHB1YmxpYyB2b2lkIGFkZEk2NChsb25nIHYpIHsKICAgICAgICAgYWxpZ24oOCk7CiAgICAgICAgIG1EYXRhW21Qb3MrK10gPSAoYnl0ZSkodiAmIDB4ZmYpOwogICAgICAgICBtRGF0YVttUG9zKytdID0gKGJ5dGUpKCh2ID4+IDgpICYgMHhmZik7CkBAIC02NywxNSArNzQsMTcgQEAKICAgICAgICAgbURhdGFbbVBvcysrXSA9IChieXRlKSgodiA+PiA1NikgJiAweGZmKTsKICAgICB9CiAKLSAgICB2b2lkIGFkZFU4KHNob3J0IHYpIHsKKyAgICBwdWJsaWMgdm9pZCBhZGRVOChzaG9ydCB2KSB7CiAgICAgICAgIGlmICgodiA8IDApIHx8ICh2ID4gMHhmZikpIHsKKyAgICAgICAgICAgIGFuZHJvaWQudXRpbC5Mb2cuZSgicnMiLCAiRmllbGRQYWNrZXIuYWRkVTgoICIgKyB2ICsgIiApIik7CiAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJTYXZpbmcgdmFsdWUgb3V0IG9mIHJhbmdlIGZvciB0eXBlIik7CiAgICAgICAgIH0KICAgICAgICAgbURhdGFbbVBvcysrXSA9IChieXRlKXY7CiAgICAgfQogCi0gICAgdm9pZCBhZGRVMTYoaW50IHYpIHsKKyAgICBwdWJsaWMgdm9pZCBhZGRVMTYoaW50IHYpIHsKICAgICAgICAgaWYgKCh2IDwgMCkgfHwgKHYgPiAweGZmZmYpKSB7CisgICAgICAgICAgICBhbmRyb2lkLnV0aWwuTG9nLmUoInJzIiwgIkZpZWxkUGFja2VyLmFkZFUxNiggIiArIHYgKyAiICkiKTsKICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oIlNhdmluZyB2YWx1ZSBvdXQgb2YgcmFuZ2UgZm9yIHR5cGUiKTsKICAgICAgICAgfQogICAgICAgICBhbGlnbigyKTsKQEAgLTgzLDggKzkyLDkgQEAKICAgICAgICAgbURhdGFbbVBvcysrXSA9IChieXRlKSh2ID4+IDgpOwogICAgIH0KIAotICAgIHZvaWQgYWRkVTMyKGxvbmcgdikgewotICAgICAgICBpZiAoKHYgPCAwKSB8fCAodiA+IDB4ZmZmZmZmZmYpKSB7CisgICAgcHVibGljIHZvaWQgYWRkVTMyKGxvbmcgdikgeworICAgICAgICBpZiAoKHYgPCAwKSB8fCAodiA+IDB4ZmZmZmZmZmZMKSkgeworICAgICAgICAgICAgYW5kcm9pZC51dGlsLkxvZy5lKCJycyIsICJGaWVsZFBhY2tlci5hZGRVMzIoICIgKyB2ICsgIiApIik7CiAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJTYXZpbmcgdmFsdWUgb3V0IG9mIHJhbmdlIGZvciB0eXBlIik7CiAgICAgICAgIH0KICAgICAgICAgYWxpZ24oNCk7CkBAIC05NCw4ICsxMDQsOSBAQAogICAgICAgICBtRGF0YVttUG9zKytdID0gKGJ5dGUpKCh2ID4+IDI0KSAmIDB4ZmYpOwogICAgIH0KIAotICAgIHZvaWQgYWRkVTY0KGxvbmcgdikgeworICAgIHB1YmxpYyB2b2lkIGFkZFU2NChsb25nIHYpIHsKICAgICAgICAgaWYgKHYgPCAwKSB7CisgICAgICAgICAgICBhbmRyb2lkLnV0aWwuTG9nLmUoInJzIiwgIkZpZWxkUGFja2VyLmFkZFU2NCggIiArIHYgKyAiICkiKTsKICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oIlNhdmluZyB2YWx1ZSBvdXQgb2YgcmFuZ2UgZm9yIHR5cGUiKTsKICAgICAgICAgfQogICAgICAgICBhbGlnbig4KTsKQEAgLTEwOSwxNSArMTIwLDE1NyBAQAogICAgICAgICBtRGF0YVttUG9zKytdID0gKGJ5dGUpKCh2ID4+IDU2KSAmIDB4ZmYpOwogICAgIH0KIAotICAgIHZvaWQgYWRkRjMyKGZsb2F0IHYpIHsKKyAgICBwdWJsaWMgdm9pZCBhZGRGMzIoZmxvYXQgdikgewogICAgICAgICBhZGRJMzIoRmxvYXQuZmxvYXRUb1Jhd0ludEJpdHModikpOwogICAgIH0KIAotICAgIHZvaWQgYWRkRjY0KGZsb2F0IHYpIHsKKyAgICBwdWJsaWMgdm9pZCBhZGRGNjQoZmxvYXQgdikgewogICAgICAgICBhZGRJNjQoRG91YmxlLmRvdWJsZVRvUmF3TG9uZ0JpdHModikpOwogICAgIH0KIAotICAgIGZpbmFsIGJ5dGVbXSBnZXREYXRhKCkgeworICAgIHB1YmxpYyB2b2lkIGFkZE9iaihCYXNlT2JqIG9iaikgeworICAgICAgICBpZiAob2JqICE9IG51bGwpIHsKKyAgICAgICAgICAgIGFkZEkzMihvYmouZ2V0SUQoKSk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBhZGRJMzIoMCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBhZGRGMzIoRmxvYXQyIHYpIHsKKyAgICAgICAgYWRkRjMyKHYueCk7CisgICAgICAgIGFkZEYzMih2LnkpOworICAgIH0KKyAgICBwdWJsaWMgdm9pZCBhZGRGMzIoRmxvYXQzIHYpIHsKKyAgICAgICAgYWRkRjMyKHYueCk7CisgICAgICAgIGFkZEYzMih2LnkpOworICAgICAgICBhZGRGMzIodi56KTsKKyAgICB9CisgICAgcHVibGljIHZvaWQgYWRkRjMyKEZsb2F0NCB2KSB7CisgICAgICAgIGFkZEYzMih2LngpOworICAgICAgICBhZGRGMzIodi55KTsKKyAgICAgICAgYWRkRjMyKHYueik7CisgICAgICAgIGFkZEYzMih2LncpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGFkZEk4KEJ5dGUyIHYpIHsKKyAgICAgICAgYWRkSTgodi54KTsKKyAgICAgICAgYWRkSTgodi55KTsKKyAgICB9CisgICAgcHVibGljIHZvaWQgYWRkSTgoQnl0ZTMgdikgeworICAgICAgICBhZGRJOCh2LngpOworICAgICAgICBhZGRJOCh2LnkpOworICAgICAgICBhZGRJOCh2LnopOworICAgIH0KKyAgICBwdWJsaWMgdm9pZCBhZGRJOChCeXRlNCB2KSB7CisgICAgICAgIGFkZEk4KHYueCk7CisgICAgICAgIGFkZEk4KHYueSk7CisgICAgICAgIGFkZEk4KHYueik7CisgICAgICAgIGFkZEk4KHYudyk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgYWRkVTgoU2hvcnQyIHYpIHsKKyAgICAgICAgYWRkVTgodi54KTsKKyAgICAgICAgYWRkVTgodi55KTsKKyAgICB9CisgICAgcHVibGljIHZvaWQgYWRkVTgoU2hvcnQzIHYpIHsKKyAgICAgICAgYWRkVTgodi54KTsKKyAgICAgICAgYWRkVTgodi55KTsKKyAgICAgICAgYWRkVTgodi56KTsKKyAgICB9CisgICAgcHVibGljIHZvaWQgYWRkVTgoU2hvcnQ0IHYpIHsKKyAgICAgICAgYWRkVTgodi54KTsKKyAgICAgICAgYWRkVTgodi55KTsKKyAgICAgICAgYWRkVTgodi56KTsKKyAgICAgICAgYWRkVTgodi53KTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBhZGRJMTYoU2hvcnQyIHYpIHsKKyAgICAgICAgYWRkSTE2KHYueCk7CisgICAgICAgIGFkZEkxNih2LnkpOworICAgIH0KKyAgICBwdWJsaWMgdm9pZCBhZGRJMTYoU2hvcnQzIHYpIHsKKyAgICAgICAgYWRkSTE2KHYueCk7CisgICAgICAgIGFkZEkxNih2LnkpOworICAgICAgICBhZGRJMTYodi56KTsKKyAgICB9CisgICAgcHVibGljIHZvaWQgYWRkSTE2KFNob3J0NCB2KSB7CisgICAgICAgIGFkZEkxNih2LngpOworICAgICAgICBhZGRJMTYodi55KTsKKyAgICAgICAgYWRkSTE2KHYueik7CisgICAgICAgIGFkZEkxNih2LncpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGFkZFUxNihJbnQyIHYpIHsKKyAgICAgICAgYWRkVTE2KHYueCk7CisgICAgICAgIGFkZFUxNih2LnkpOworICAgIH0KKyAgICBwdWJsaWMgdm9pZCBhZGRVMTYoSW50MyB2KSB7CisgICAgICAgIGFkZFUxNih2LngpOworICAgICAgICBhZGRVMTYodi55KTsKKyAgICAgICAgYWRkVTE2KHYueik7CisgICAgfQorICAgIHB1YmxpYyB2b2lkIGFkZFUxNihJbnQ0IHYpIHsKKyAgICAgICAgYWRkVTE2KHYueCk7CisgICAgICAgIGFkZFUxNih2LnkpOworICAgICAgICBhZGRVMTYodi56KTsKKyAgICAgICAgYWRkVTE2KHYudyk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgYWRkSTMyKEludDIgdikgeworICAgICAgICBhZGRJMzIodi54KTsKKyAgICAgICAgYWRkSTMyKHYueSk7CisgICAgfQorICAgIHB1YmxpYyB2b2lkIGFkZEkzMihJbnQzIHYpIHsKKyAgICAgICAgYWRkSTMyKHYueCk7CisgICAgICAgIGFkZEkzMih2LnkpOworICAgICAgICBhZGRJMzIodi56KTsKKyAgICB9CisgICAgcHVibGljIHZvaWQgYWRkSTMyKEludDQgdikgeworICAgICAgICBhZGRJMzIodi54KTsKKyAgICAgICAgYWRkSTMyKHYueSk7CisgICAgICAgIGFkZEkzMih2LnopOworICAgICAgICBhZGRJMzIodi53KTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBhZGRVMzIoSW50MiB2KSB7CisgICAgICAgIGFkZFUzMih2LngpOworICAgICAgICBhZGRVMzIodi55KTsKKyAgICB9CisgICAgcHVibGljIHZvaWQgYWRkVTMyKEludDMgdikgeworICAgICAgICBhZGRVMzIodi54KTsKKyAgICAgICAgYWRkVTMyKHYueSk7CisgICAgICAgIGFkZFUzMih2LnopOworICAgIH0KKyAgICBwdWJsaWMgdm9pZCBhZGRVMzIoSW50NCB2KSB7CisgICAgICAgIGFkZFUzMih2LngpOworICAgICAgICBhZGRVMzIodi55KTsKKyAgICAgICAgYWRkVTMyKHYueik7CisgICAgICAgIGFkZFUzMih2LncpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGFkZE9iaihNYXRyaXg0ZiB2KSB7CisgICAgICAgIGZvciAoaW50IGk9MDsgaSA8IHYubU1hdC5sZW5ndGg7IGkrKykgeworICAgICAgICAgICAgYWRkRjMyKHYubU1hdFtpXSk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBhZGRPYmooTWF0cml4M2YgdikgeworICAgICAgICBmb3IgKGludCBpPTA7IGkgPCB2Lm1NYXQubGVuZ3RoOyBpKyspIHsKKyAgICAgICAgICAgIGFkZEYzMih2Lm1NYXRbaV0pOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgYWRkT2JqKE1hdHJpeDJmIHYpIHsKKyAgICAgICAgZm9yIChpbnQgaT0wOyBpIDwgdi5tTWF0Lmxlbmd0aDsgaSsrKSB7CisgICAgICAgICAgICBhZGRGMzIodi5tTWF0W2ldKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGFkZEJvb2xlYW4oYm9vbGVhbiB2KSB7CisgICAgICAgIGFkZEk4KChieXRlKSh2ID8gMSA6IDApKTsKKyAgICB9CisKKyAgICBwdWJsaWMgZmluYWwgYnl0ZVtdIGdldERhdGEoKSB7CiAgICAgICAgIHJldHVybiBtRGF0YTsKICAgICB9CiAKZGlmZiAtLWdpdCBhL2dyYXBoaWNzL2phd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npb25zIGFuZAorICogbGltaXRhdGlvbnMgdW5kZXIgdGhlIExpY2Vuc2UuCisgKi8KKworcGFja2FnZSBhbmRyb2lkLnJlbmRlcnNjcmlwdDsKKworaW1wb3J0IGphdmEuaW8uSU9FeGNlcHRpb247CitpbXBvcnQgamF2YS5pby5JbnB1dFN0cmVhbTsKKworaW1wb3J0IGFuZHJvaWQuY29udGVudC5yZXMuUmVzb3VyY2VzOworaW1wb3J0IGFuZHJvaWQuY29udGVudC5yZXMuQXNzZXRNYW5hZ2VyOworaW1wb3J0IGFuZHJvaWQuZ3JhcGhpY3MuQml0bWFwOworaW1wb3J0IGFuZHJvaWQuZ3JhcGhpY3MuQml0bWFwRmFjdG9yeTsKK2ltcG9ydCBhbmRyb2lkLnV0aWwuTG9nOworaW1wb3J0IGFuZHJvaWQudXRpbC5UeXBlZFZhbHVlOworCisvKioKKyAqIEBoaWRlCisgKgorICoqLworcHVibGljIGNsYXNzIEZpbGVBM0QgZXh0ZW5kcyBCYXNlT2JqIHsKKworICAgIHB1YmxpYyBlbnVtIENsYXNzSUQgeworCisgICAgICAgIFVOS05PV04sCisgICAgICAgIE1FU0gsCisgICAgICAgIFRZUEUsCisgICAgICAgIEVMRU1FTlQsCisgICAgICAgIEFMTE9DQVRJT04sCisgICAgICAgIFBST0dSQU1fVkVSVEVYLAorICAgICAgICBQUk9HUkFNX1JBU1RFUiwKKyAgICAgICAgUFJPR1JBTV9GUkFHTUVOVCwKKyAgICAgICAgUFJPR1JBTV9TVE9SRSwKKyAgICAgICAgU0FNUExFUiwKKyAgICAgICAgQU5JTUFUSU9OLAorICAgICAgICBMSUdIVCwKKyAgICAgICAgQURBUFRFUl8xRCwKKyAgICAgICAgQURBUFRFUl8yRCwKKyAgICAgICAgU0NSSVBUX0M7CisKKyAgICAgICAgcHVibGljIHN0YXRpYyBDbGFzc0lEIHRvQ2xhc3NJRChpbnQgaW50SUQpIHsKKyAgICAgICAgICAgIHJldHVybiBDbGFzc0lELnZhbHVlcygpW2ludElEXTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8vIFJlYWQgb25seSBjbGFzcyB3aXRoIGluZGV4IGVudHJpZXMKKyAgICBwdWJsaWMgc3RhdGljIGNsYXNzIEluZGV4RW50cnkgeworICAgICAgICBSZW5kZXJTY3JpcHQgbVJTOworICAgICAgICBpbnQgbUluZGV4OworICAgICAgICBpbnQgbUlEOworICAgICAgICBTdHJpbmcgbU5hbWU7CisgICAgICAgIENsYXNzSUQgbUNsYXNzSUQ7CisgICAgICAgIEJhc2VPYmogbUxvYWRlZE9iajsKKworICAgICAgICBwdWJsaWMgU3RyaW5nIGdldE5hbWUoKSB7CisgICAgICAgICAgICByZXR1cm4gbU5hbWU7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgQ2xhc3NJRCBnZXRDbGFzc0lEKCkgeworICAgICAgICAgICAgcmV0dXJuIG1DbGFzc0lEOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIEJhc2VPYmogZ2V0T2JqZWN0KCkgeworICAgICAgICAgICAgbVJTLnZhbGlkYXRlKCk7CisgICAgICAgICAgICBCYXNlT2JqIG9iaiA9IGludGVybmFsQ3JlYXRlKG1SUywgdGhpcyk7CisgICAgICAgICAgICByZXR1cm4gb2JqOworICAgICAgICB9CisKKyAgICAgICAgc3RhdGljIHN5bmNocm9uaXplZCBCYXNlT2JqIGludGVybmFsQ3JlYXRlKFJlbmRlclNjcmlwdCBycywgSW5kZXhFbnRyeSBlbnRyeSkgeworICAgICAgICAgICAgaWYoZW50cnkubUxvYWRlZE9iaiAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIGVudHJ5Lm1Mb2FkZWRPYmo7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmKGVudHJ5Lm1DbGFzc0lEID09IENsYXNzSUQuVU5LTk9XTikgeworICAgICAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpbnQgb2JqZWN0SUQgPSBycy5uRmlsZUEzREdldEVudHJ5QnlJbmRleChlbnRyeS5tSUQsIGVudHJ5Lm1JbmRleCk7CisgICAgICAgICAgICBpZihvYmplY3RJRCA9PSAwKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHN3aXRjaCAoZW50cnkubUNsYXNzSUQpIHsKKyAgICAgICAgICAgIGNhc2UgTUVTSDoKKyAgICAgICAgICAgICAgICBlbnRyeS5tTG9hZGVkT2JqID0gbmV3IE1lc2gob2JqZWN0SUQsIHJzKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgVFlQRToKKyAgICAgICAgICAgICAgICBlbnRyeS5tTG9hZGVkT2JqID0gbmV3IFR5cGUob2JqZWN0SUQsIHJzKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgRUxFTUVOVDoKKyAgICAgICAgICAgICAgICBlbnRyeS5tTG9hZGVkT2JqID0gbnVsbDsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgQUxMT0NBVElPTjoKKyAgICAgICAgICAgICAgICBlbnRyeS5tTG9hZGVkT2JqID0gbnVsbDsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgUFJPR1JBTV9WRVJURVg6CisgICAgICAgICAgICAgICAgZW50cnkubUxvYWRlZE9iaiA9IG5ldyBQcm9ncmFtVmVydGV4KG9iamVjdElELCBycyk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIFBST0dSQU1fUkFTVEVSOgorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBQUk9HUkFNX0ZSQUdNRU5UOgorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBQUk9HUkFNX1NUT1JFOgorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBTQU1QTEVSOgorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBBTklNQVRJT046CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIExJR0hUOgorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBBREFQVEVSXzFEOgorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBBREFQVEVSXzJEOgorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBTQ1JJUFRfQzoKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgZW50cnkubUxvYWRlZE9iai51cGRhdGVGcm9tTmF0aXZlKCk7CisKKyAgICAgICAgICAgIHJldHVybiBlbnRyeS5tTG9hZGVkT2JqOworICAgICAgICB9CisKKyAgICAgICAgSW5kZXhFbnRyeShSZW5kZXJTY3JpcHQgcnMsIGludCBpbmRleCwgaW50IGlkLCBTdHJpbmcgbmFtZSwgQ2xhc3NJRCBjbGFzc0lEKSB7CisgICAgICAgICAgICBtUlMgPSByczsKKyAgICAgICAgICAgIG1JbmRleCA9IGluZGV4OworICAgICAgICAgICAgbUlEID0gaWQ7CisgICAgICAgICAgICBtTmFtZSA9IG5hbWU7CisgICAgICAgICAgICBtQ2xhc3NJRCA9IGNsYXNzSUQ7CisgICAgICAgICAgICBtTG9hZGVkT2JqID0gbnVsbDsKKyAgICAgICAgfQorICAgIH0KKworICAgIEluZGV4RW50cnlbXSBtRmlsZUVudHJpZXM7CisKKyAgICBGaWxlQTNEKGludCBpZCwgUmVuZGVyU2NyaXB0IHJzKSB7CisgICAgICAgIHN1cGVyKGlkLCBycyk7CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIGluaXRFbnRyaWVzKCkgeworICAgICAgICBpbnQgbnVtRmlsZUVudHJpZXMgPSBtUlMubkZpbGVBM0RHZXROdW1JbmRleEVudHJpZXMobUlEKTsKKyAgICAgICAgaWYobnVtRmlsZUVudHJpZXMgPD0gMCkgeworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisKKyAgICAgICAgbUZpbGVFbnRyaWVzID0gbmV3IEluZGV4RW50cnlbbnVtRmlsZUVudHJpZXNdOworICAgICAgICBpbnRbXSBpZHMgPSBuZXcgaW50W251bUZpbGVFbnRyaWVzXTsKKyAgICAgICAgU3RyaW5nW10gbmFtZXMgPSBuZXcgU3RyaW5nW251bUZpbGVFbnRyaWVzXTsKKworICAgICAgICBtUlMubkZpbGVBM0RHZXRJbmRleEVudHJpZXMobUlELCBudW1GaWxlRW50cmllcywgaWRzLCBuYW1lcyk7CisKKyAgICAgICAgZm9yKGludCBpID0gMDsgaSA8IG51bUZpbGVFbnRyaWVzOyBpICsrKSB7CisgICAgICAgICAgICBtRmlsZUVudHJpZXNbaV0gPSBuZXcgSW5kZXhFbnRyeShtUlMsIGksIG1JRCwgbmFtZXNbaV0sIENsYXNzSUQudG9DbGFzc0lEKGlkc1tpXSkpOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIGludCBnZXROdW1JbmRleEVudHJpZXMoKSB7CisgICAgICAgIGlmKG1GaWxlRW50cmllcyA9PSBudWxsKSB7CisgICAgICAgICAgICByZXR1cm4gMDsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbUZpbGVFbnRyaWVzLmxlbmd0aDsKKyAgICB9CisKKyAgICBwdWJsaWMgSW5kZXhFbnRyeSBnZXRJbmRleEVudHJ5KGludCBpbmRleCkgeworICAgICAgICBpZihnZXROdW1JbmRleEVudHJpZXMoKSA9PSAwIHx8IGluZGV4IDwgMCB8fCBpbmRleCA+PSBtRmlsZUVudHJpZXMubGVuZ3RoKSB7CisgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbUZpbGVFbnRyaWVzW2luZGV4XTsKKyAgICB9CisKKyAgICBzdGF0aWMgcHVibGljIEZpbGVBM0QgY3JlYXRlRnJvbVJlc291cmNlKFJlbmRlclNjcmlwdCBycywgUmVzb3VyY2VzIHJlcywgaW50IGlkKQorICAgICAgICB0aHJvd3MgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uIHsKKworICAgICAgICBycy52YWxpZGF0ZSgpOworICAgICAgICBJbnB1dFN0cmVhbSBpcyA9IG51bGw7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBmaW5hbCBUeXBlZFZhbHVlIHZhbHVlID0gbmV3IFR5cGVkVmFsdWUoKTsKKyAgICAgICAgICAgIGlzID0gcmVzLm9wZW5SYXdSZXNvdXJjZShpZCwgdmFsdWUpOworCisgICAgICAgICAgICBpbnQgYXNzZXQgPSAoKEFzc2V0TWFuYWdlci5Bc3NldElucHV0U3RyZWFtKSBpcykuZ2V0QXNzZXRJbnQoKTsKKworICAgICAgICAgICAgaW50IGZpbGVJZCA9IHJzLm5GaWxlQTNEQ3JlYXRlRnJvbUFzc2V0U3RyZWFtKGFzc2V0KTsKKworICAgICAgICAgICAgaWYoZmlsZUlkID09IDApIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJMb2FkIGZhaWxlZC4iKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIEZpbGVBM0QgZmEzZCA9IG5ldyBGaWxlQTNEKGZpbGVJZCwgcnMpOworICAgICAgICAgICAgZmEzZC5pbml0RW50cmllcygpOworICAgICAgICAgICAgcmV0dXJuIGZhM2Q7CisKKyAgICAgICAgfSBjYXRjaCAoRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIC8vIElnbm9yZQorICAgICAgICB9IGZpbmFsbHkgeworICAgICAgICAgICAgaWYgKGlzICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICBpcy5jbG9zZSgpOworICAgICAgICAgICAgICAgIH0gY2F0Y2ggKElPRXhjZXB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nRGYW1pbHlNYXAoKTsKKyAgICB9CisKKyAgICBzdGF0aWMgU3RyaW5nIGdldEZvbnRGaWxlTmFtZShTdHJpbmcgZmFtaWx5TmFtZSwgU3R5bGUgc3R5bGUpIHsKKyAgICAgICAgRm9udEZhbWlseSBmYW1pbHkgPSBzRm9udEZhbWlseU1hcC5nZXQoZmFtaWx5TmFtZSk7CisgICAgICAgIGlmKGZhbWlseSAhPSBudWxsKSB7CisgICAgICAgICAgICBzd2l0Y2goc3R5bGUpIHsKKyAgICAgICAgICAgICAgICBjYXNlIE5PUk1BTDoKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbWlseS5tTm9ybWFsRmlsZU5hbWU7CisgICAgICAgICAgICAgICAgY2FzZSBCT0xEOgorICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFtaWx5Lm1Cb2xkRmlsZU5hbWU7CisgICAgICAgICAgICAgICAgY2FzZSBJVEFMSUM6CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYW1pbHkubUl0YWxpY0ZpbGVOYW1lOworICAgICAgICAgICAgICAgIGNhc2UgQk9MRF9JVEFMSUM6CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYW1pbHkubUJvbGRJdGFsaWNGaWxlTmFtZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICAvLyBGYWxsYmFjayBpZiB3ZSBjb3VsZCBub3QgZmluZCB0aGUgZGVzaXJlZCBmYW1pbHkKKyAgICAgICAgcmV0dXJuICJEcm9pZFNhbnMudHRmIjsKKyAgICB9CisKKyAgICBGb250KGludCBpZCwgUmVuZGVyU2NyaXB0IHJzKSB7CisgICAgICAgIHN1cGVyKGlkLCBycyk7CisgICAgfQorCisgICAgLyoqCisgICAgICogVGFrZXMgYSBzcGVjaWZpYyBmaWxlIG5hbWUgYXMgYW4gYXJndW1lbnQKKyAgICAgKi8KKyAgICBzdGF0aWMgcHVibGljIEZvbnQgY3JlYXRlKFJlbmRlclNjcmlwdCBycywgUmVzb3VyY2VzIHJlcywgU3RyaW5nIGZpbGVOYW1lLCBpbnQgc2l6ZSkKKyAgICAgICAgdGhyb3dzIElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbiB7CisKKyAgICAgICAgcnMudmFsaWRhdGUoKTsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIGludCBkcGkgPSByZXMuZ2V0RGlzcGxheU1ldHJpY3MoKS5kZW5zaXR5RHBpOworICAgICAgICAgICAgaW50IGZvbnRJZCA9IHJzLm5Gb250Q3JlYXRlRnJvbUZpbGUoZmlsZU5hbWUsIHNpemUsIGRwaSk7CisKKyAgICAgICAgICAgIGlmKGZvbnRJZCA9PSAwKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiRmFpbGVkIGxvYWRpbmcgYSBmb250Iik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBGb250IHJzRm9udCA9IG5ldyBGb250KGZvbnRJZCwgcnMpOworCisgICAgICAgICAgICByZXR1cm4gcnNGb250OworCisgICAgICAgIH0gY2F0Y2ggKEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAvLyBJZ25vcmUKKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiBudWxsOworICAgIH0KKworICAgIC8qKgorICAgICAqIEFjY2VwdHMgb25lIG9mIHRoZSBmb2xsb3dpbmcgZmFtaWx5IG5hbWVzIGFzIGFuIGFyZ3VtZW50CisgICAgICogYW5kIHdpbGwgYXR0ZW1wIHRvIHByb2R1Y2UgdGhlIGJlc3QgbWF0Y2ggd2l0aCBhIHN5c3RlbSBmb250CisgICAgICogInNhbnMtc2VyaWYiICJhcmlhbCIgImhlbHZldGljYSIgInRhaG9tYSIgInZlcmRhbmEiCisgICAgICogInNlcmlmIiAidGltZXMiICJ0aW1lcyBuZXcgcm9tYW4iICJwYWxhdGlubyIgImdlb3JnaWEiICJiYXNrZXJ2aWxsZSIKKyAgICAgKiAiZ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Ck7CisgICAgICAgIHMgPSAoZmxvYXQpamF2YS5sYW5nLk1hdGguc2luKHJvdCk7CisgICAgICAgIG1NYXRbMF0gPSBjOworICAgICAgICBtTWF0WzFdID0gLXM7CisgICAgICAgIG1NYXRbMl0gPSBzOworICAgICAgICBtTWF0WzNdID0gYzsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBsb2FkU2NhbGUoZmxvYXQgeCwgZmxvYXQgeSkgeworICAgICAgICBsb2FkSWRlbnRpdHkoKTsKKyAgICAgICAgbU1hdFswXSA9IHg7CisgICAgICAgIG1NYXRbM10gPSB5OworICAgIH0KKyAgICBwdWJsaWMgdm9pZCBsb2FkTXVsdGlwbHkoTWF0cml4MmYgbGhzLCBNYXRyaXgyZiByaHMpIHsKKyAgICAgICAgZm9yIChpbnQgaT0wIDsgaTwyIDsgaSsrKSB7CisgICAgICAgICAgICBmbG9hdCByaTAgPSAwOworICAgICAgICAgICAgZmxvYXQgcmkxID0gMDsKKyAgICAgICAgICAgIGZvciAoaW50IGo9MCA7IGo8MiA7IGorKykgeworICAgICAgICAgICAgICAgIGZsb2F0IHJoc19paiA9IHJocy5nZXQoaSxqKTsKKyAgICAgICAgICAgICAgICByaTAgKz0gbGhzLmdldChqLDApICogcmhzX2lqOworICAgICAgICAgICAgICAgIHJpMSArPSBsaHMuZ2V0KGosMSkgKiByaHNfaWo7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBzZXQoaSwwLCByaTApOworICAgICAgICAgICAgc2V0KGksMSwgcmkxKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIG11bHRpcGx5KE1hdHJpeDJmIHJocykgeworICAgICAgICBNYXRyaXgyZiB0bXAgPSBuZXcgTWF0cml4MmYoKTsKKyAgICAgICAgdG1wLmxvYWRNdWx0aXBseSh0aGlzLCByaHMpOworICAgICAgICBsb2FkKHRtcCk7CisgICAgfQorICAgIHB1YmxpYyB2b2lkIHJvdGF0ZShmbG9hdCByb3QpIHsK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HJvdCAqPSAoZmxvYXQpKGphdmEubGFuZy5NYXRoLlBJIC8gMTgwLjBmKTsKKyAgICAgICAgYyA9IChmbG9hdClqYXZhLmxhbmcuTWF0aC5jb3Mocm90KTsKKyAgICAgICAgcyA9IChmbG9hdClqYXZhLmxhbmcuTWF0aC5zaW4ocm90KTsKKworICAgICAgICBmbG9hdCBsZW4gPSAoZmxvYXQpamF2YS5sYW5nLk1hdGguc3FydCh4KnggKyB5KnkgKyB6KnopOworICAgICAgICBpZiAoIShsZW4gIT0gMSkpIHsKKyAgICAgICAgICAgIGZsb2F0IHJlY2lwTGVuID0gMS5mIC8gbGVuOworICAgICAgICAgICAgeCAqPSByZWNpcExlbjsKKyAgICAgICAgICAgIHkgKj0gcmVjaXBMZW47CisgICAgICAgICAgICB6ICo9IHJlY2lwTGVuOworICAgICAgICB9CisgICAgICAgIGZsb2F0IG5jID0gMS4wZiAtIGM7CisgICAgICAgIGZsb2F0IHh5ID0geCAqIHk7CisgICAgICAgIGZsb2F0IHl6ID0geSAqIHo7CisgICAgICAgIGZsb2F0IHp4ID0geiAqIHg7CisgICAgICAgIGZsb2F0IHhzID0geCAqIHM7CisgICAgICAgIGZsb2F0IHlzID0geSAqIHM7CisgICAgICAgIGZsb2F0IHpzID0geiAqIHM7CisgICAgICAgIG1NYXRbMF0gPSB4KngqbmMgKyAgYzsKKyAgICAgICAgbU1hdFszXSA9ICB4eSpuYyAtIHpzOworICAgICAgICBtTWF0WzZdID0gIHp4Km5jICsgeXM7CisgICAgICAgIG1NYXRbMV0gPSAgeHkqbmMgKyB6czsKKyAgICAgICAgbU1hdFs0XSA9IHkqeSpuYyArICBjOworICAgICAgICBtTWF0WzldID0gIHl6Km5jIC0geHM7CisgICAgICAgIG1NYXRbMl0gPSAgengqbmMgLSB5czsKKyAgICAgICAgbU1hdFs2XSA9ICB5eipuYyArIHhzOworICAgICAgICBtTWF0WzhdID0geip6Km5jICsgIGM7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgbG9hZFJvdGF0ZShmbG9hdCByb3QpIHsKKyAgICAgICAgZmxvYXQgYywgczsKKyAgICAgICAgcm90ICo9IChmbG9hdCkoamF2YS5sYW5nLk1hdGguUEkgLyAxODAuMGYpOworICAgICAgICBjID0gKGZsb2F0KWphdmEubGFuZy5NYXRoLmNvcyhyb3QpOworICAgICAgICBzID0gKGZsb2F0KWphdmEubGFuZy5NYXRoLnNpbihyb3QpOworICAgICAgICBtTWF0WzBdID0gYzsKKyAgICAgICAgbU1hdFsxXSA9IC1zOworICAgICAgICBtTWF0WzNdID0gczsKKyAgICAgICAgbU1hdFs0XSA9IGM7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgbG9hZFNjYWxlKGZsb2F0IHgsIGZsb2F0IHkpIHsKKyAgICAgICAgbG9hZElkZW50aXR5KCk7CisgICAgICAgIG1NYXRbMF0gPSB4OworICAgICAgICBtTWF0WzRdID0geTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBsb2FkU2NhbGUoZmxvYXQgeCwgZmxvYXQgeSwgZmxvYXQgeikgeworICAgICAgICBsb2FkSWRlbnRpdHkoKTsKKyAgICAgICAgbU1hdFswXSA9IHg7CisgICAgICAgIG1NYXRbNF0gPSB5OworICAgICAgICBtTWF0WzhdID0gejsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBsb2FkVHJhbnNsYXRlKGZsb2F0IHgsIGZsb2F0IHkpIHsKKyAgICAgICAgbG9hZElkZW50aXR5KCk7CisgICAgICAgIG1NYXRbNl0gPSB4OworICAgICAgICBtTWF0WzddID0geTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBsb2FkTXVsdGlwbHkoTWF0cml4M2YgbGhzLCBNYXRyaXgzZiByaHMpIHsKKyAgICAgICAgZm9yIChpbnQgaT0wIDsgaTwzIDsgaSsrKSB7CisgICAgICAgICAgICBmbG9hdCByaTAgPSAwOworICAgICAgICAgICAgZmxvYXQgcmkxID0gMDsKKyAgICAgICAgICAgIGZsb2F0IHJpMiA9IDA7CisgICAgICAgICAgICBmb3IgKGludCBqPTAgOyBqPDMgOyBqKyspIHsKKyAgICAgICAgICAgICAgICBmbG9hdCByaHNfaWogPSByaHMuZ2V0KGksaik7CisgICAgICAgICAgICAgICAgcmkwICs9IGxocy5nZXQoaiwwKSAqIHJoc19pajsKKyAgICAgICAgICAgICAgICByaTEgKz0gbGhzLmdldChqLDEpICogcmhzX2lqOworICAgICAgICAgICAgICAgIHJpMiArPSBsaHMuZ2V0KGosMikgKiByaHNfaWo7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBzZXQoaSwwLCByaTApOworICAgICAgICAgICAgc2V0KGksMSwgcmkxKTsKKyAgICAgICAgICAgIHNldChpLDIsIHJpMik7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBtdWx0aXBseShNYXRyaXgzZiByaHMpIHsKKyAgICAgICAgTWF0cml4M2YgdG1wID0gbmV3IE1hdHJpeDNmKCk7CisgICAgICAgIHRtcC5sb2FkTXVsdGlwbHkodGhpcywgcmhzKTsKKyAgICAgICAgbG9hZCh0bXApOworICAgIH0KKyAgICBwdWJsaWMgdm9pZCByb3RhdGUoZmxvYXQgcm90LCBmbG9hdCB4LCBmbG9hdCB5LCBmbG9hdCB6KSB7CisgICAgICAgIE1hdHJpeDNmIHRtcCA9IG5ldyBNYXRyaXgzZigpOworICAgICAgICB0bXAubG9hZFJvdGF0ZShyb3QsIHgsIHksIHopOworICAgICAgICBtdWx0aXBseSh0bXApOworICAgIH0KKyAgICBwdWJsaWMgdm9pZCByb3RhdGUoZmxvYXQgcm90KSB7CisgICAgICAgIE1hdHJpeDNmIHRtcCA9IG5ldyBNYXRyaXgzZigpOworICAgICAgICB0bXAubG9hZFJvdGF0ZShyb3QpOworICAgICAgICBtdWx0aXBseSh0bXApOworICAgIH0KKyAgICBwdWJsaWMgdm9pZCBzY2FsZShmbG9hdCB4LCBmbG9hdCB5KSB7CisgICAgICAgIE1hdHJpeDNmIHRtcCA9IG5ldyBNYXRyaXgzZigpOworICAgICAgICB0bXAubG9hZFNjYWxlKHgsIHkpOworICAgICAgICBtdWx0aXBseSh0bXApOworICAgIH0KKyAgICBwdWJsaWMgdm9pZCBzY2FsZShmbG9hdCB4LCBmbG9hdCB5LCBmbG9hdCB6KSB7CisgICAgICAgIE1hdHJpeDNmIHRtcCA9IG5ldyBNYXRyaXgzZigpOworICAgICAgICB0bXAubG9hZFNjYWxlKHgsIHksIHopOworICAgICAgICBtdWx0aXBseSh0bXApOworICAgIH0KKyAgICBwdWJsaWMgdm9pZCB0cmFuc2xhdGUoZmxvYXQgeCwgZmxvYXQgeSkgeworICAgICAgICBNYXRyaXgzZiB0bXAgPSBuZXcgTWF0cml4M2YoKTsKKyAgICAgICAgdG1wLmxvYWRUcmFuc2xhdGUoeCwgeSk7CisgICAgICAgIG11bHRpcGx5KHRtcCk7CisgICAgfQorICAgIHB1YmxpYyB2b2lkIHRyYW5zcG9zZSgpIHsKKyAgICAgICAgZm9yKGludCBpID0gMDsgaSA8IDI7ICsraSkgeworICAgICAgICAgICAgZm9yKGludCBqID0gaSArIDE7IGogPCAzOyArK2opIHsKKyAgICAgICAgICAgICAgICBmbG9hdCB0ZW1wID0gbU1hdFtpKjMgKyBqXTsKKyAgICAgICAgICAgICAgICBtTWF0W2kqMyArIGpdID0gbU1hdFtqKjMgKyBpXTsKKyAgICAgICAgICAgICAgICBtTWF0W2oqMyArIGldID0gdGVtcDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKwogICAgIGZpbmFsIGZsb2F0W10gbU1hdDsKIH0KIApkaWZmIC0tZ2l0IGEvZ3JhcGhpY3MvamF2YS9hbmRyb2lkL3JlbmRlcnNjcmlwdC9NYXRyaXg0Zi5qYXZhIGIvZ3JhcGhpY3MvamF2YS9hbmRyb2lkL3JlbmRlcnNjcmlwdC9NYXRyaXg0Zi5qYXZhCmluZGV4IGViZDViZGUuLjVmZmMyMWEgMTAwNjQ0Ci0tLSBhL2dyYXBoaWNzL2phdmEvYW5kcm9pZC9yZW5kZXJzY3JpcHQvTWF0cml4NGYuamF2YQorKysgYi9ncmFwaGljcy9qYXZhL2FuZHJvaWQvcmVuZGVyc2NyaXB0L01hdHJpeDRmLmphdmEKQEAgLTE3OSw2ICsxNzksODUgQEAKICAgICAgICAgdG1wLmxvYWRUcmFuc2xhdGUoeCwgeSwgeik7CiAgICAgICAgIG11bHRpcGx5KHRtcCk7CiAgICAgfQorICAgIHByaXZhdGUgZmxvYXQgY29tcHV0ZUNvZmFjdG9yKGludCBpLCBpbnQgaikgeworICAgICAgICBpbnQgYzAgPSAoaSsxKSAlIDQ7CisgICAgICAgIGludCBjMSA9IChpKzIpICUgNDsKKyAgICAgICAgaW50IGMyID0gKGkrMykgJSA0OworICAgICAgICBpbnQgcjAgPSAoaisxKSAlIDQ7CisgICAgICAgIGludCByMSA9IChqKzIpICUgNDsKKyAgICAgICAgaW50IHIyID0gKGorMykgJSA0OworCisgICAgICAgIGZsb2F0IG1pbm9yID0gKG1NYXRbYzAgKyA0KnIwXSAqIChtTWF0W2MxICsgNCpyMV0gKiBtTWF0W2MyICsgNCpyMl0gLQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtTWF0W2MxICsgNCpyMl0gKiBtTWF0W2MyICsgNCpyMV0pKQorICAgICAgICAgICAgICAgICAgICAgLSAobU1hdFtjMCArIDQqcjFdICogKG1NYXRbYzEgKyA0KnIwXSAqIG1NYXRbYzIgKyA0KnIyXSAtCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1NYXRbYzEgKyA0KnIyXSAqIG1NYXRbYzIgKyA0KnIwXSkpCisgICAgICAgICAgICAgICAgICAgICArIChtTWF0W2MwICsgNCpyMl0gKiAobU1hdFtjMSArIDQqcjBdICogbU1hdFtjMiArIDQqcjFdIC0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbU1hdFtjMSArIDQqcjFdICogbU1hdFtjMiArIDQqcjBdKSk7CisKKyAgICAgICAgZmxvYXQgY29mYWN0b3IgPSAoKGkraikgJiAxKSAhPSAwID8gLW1pbm9yIDogbWlub3I7CisgICAgICAgIHJldHVybiBjb2ZhY3RvcjsKKyAgICB9CisKKyAgICBwdWJsaWMgYm9vbGVhbiBpbnZlcnNlKCkgeworCisgICAgICAgIE1hdHJpeDRmIHJlc3VsdCA9IG5ldyBNYXRyaXg0ZigpOworCisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgNDsgKytpKSB7CisgICAgICAgICAgICBmb3IgKGludCBqID0gMDsgaiA8IDQ7ICsraikgeworICAgICAgICAgICAgICAgIHJlc3VsdC5tTWF0WzQqaSArIGpdID0gY29tcHV0ZUNvZmFjdG9yKGksIGopOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgLy8gRG90IHByb2R1Y3Qgb2YgMHRoIGNvbHVtbiBvZiBzb3VyY2UgYW5kIDB0aCByb3cgb2YgcmVzdWx0CisgICAgICAgIGZsb2F0IGRldCA9IG1NYXRbMF0qcmVzdWx0Lm1NYXRbMF0gKyBtTWF0WzRdKnJlc3VsdC5tTWF0WzFdICsKKyAgICAgICAgICAgICAgICAgICAgIG1NYXRbOF0qcmVzdWx0Lm1NYXRbMl0gKyBtTWF0WzEyXSpyZXN1bHQubU1hdFszXTsKKworICAgICAgICBpZiAoTWF0aC5hYnMoZGV0KSA8IDFlLTYpIHsKKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorCisgICAgICAgIGRldCA9IDEuMGYgLyBkZXQ7CisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgMTY7ICsraSkgeworICAgICAgICAgICAgbU1hdFtpXSA9IHJlc3VsdC5tTWF0W2ldICogZGV0OworICAgICAgICB9CisKKyAgICAgICAgcmV0dXJuIHRydWU7CisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gaW52ZXJzZVRyYW5zcG9zZSgpIHsKKworICAgICAgICBNYXRyaXg0ZiByZXN1bHQgPSBuZXcgTWF0cml4NGYoKTsKKworICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IDQ7ICsraSkgeworICAgICAgICAgICAgZm9yIChpbnQgaiA9IDA7IGogPCA0OyArK2opIHsKKyAgICAgICAgICAgICAgICByZXN1bHQubU1hdFs0KmogKyBpXSA9IGNvbXB1dGVDb2ZhY3RvcihpLCBqKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGZsb2F0IGRldCA9IG1NYXRbMF0qcmVzdWx0Lm1NYXRbMF0gKyBtTWF0WzRdKnJlc3VsdC5tTWF0WzRdICsKKyAgICAgICAgICAgICAgICAgICAgIG1NYXRbOF0qcmVzdWx0Lm1NYXRbOF0gKyBtTWF0WzEyXSpyZXN1bHQubU1hdFsxMl07CisKKyAgICAgICAgaWYgKE1hdGguYWJzKGRldCkgPCAxZS02KSB7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKworICAgICAgICBkZXQgPSAxLjBmIC8gZGV0OworICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IDE2OyArK2kpIHsKKyAgICAgICAgICAgIG1NYXRbaV0gPSByZXN1bHQubU1hdFtpXSAqIGRldDsKKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiB0cnVlOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHRyYW5zcG9zZSgpIHsKKyAgICAgICAgZm9yKGludCBpID0gMDsgaSA8IDM7ICsraSkgeworICAgICAgICAgICAgZm9yKGludCBqID0gaSArIDE7IGogPCA0OyArK2opIHsKKyAgICAgICAgICAgICAgICBmbG9hdCB0ZW1wID0gbU1hdFtpKjQgKyBqXTsKKyAgICAgICAgICAgICAgICBtTWF0W2kqNCArIGpdID0gbU1hdFtqKjQgKyBpXTsKKyAgICAgICAgICAgICAgICBtTWF0W2oqNCArIGldID0gdGVtcDsKKyAgICAgICAgICAgIH0KKyAgICAg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SBMaWNlbnNlIGZvciB0aGUgc3BlY2lmaWMgbGFuZ3VhZ2UgZ292ZXJuaW5nIHBlcm1pc3Npb25zIGFuZAorICogbGltaXRhdGlvbnMgdW5kZXIgdGhlIExpY2Vuc2UuCisgKi8KKworcGFja2FnZSBhbmRyb2lkLnJlbmRlcnNjcmlwdDsKKworaW1wb3J0IGphdmEudXRpbC5WZWN0b3I7CisKK2ltcG9ydCBhbmRyb2lkLnV0aWwuQ29uZmlnOworaW1wb3J0IGFuZHJvaWQudXRpbC5Mb2c7CisKKy8qKgorICogQGhpZGUKKyAqCisgKiovCitwdWJsaWMgY2xhc3MgTWVzaCBleHRlbmRzIEJhc2VPYmogeworCisgICAgQWxsb2NhdGlvbltdIG1WZXJ0ZXhCdWZmZXJzOworICAgIEFsbG9jYXRpb25bXSBtSW5kZXhCdWZmZXJzOworICAgIFByaW1pdGl2ZVtdIG1QcmltaXRpdmVzOworCisgICAgTWVzaChpbnQgaWQsIFJlbmRlclNjcmlwdCBycykgeworICAgICAgICBzdXBlcihpZCwgcnMpOworICAgIH0KKworICAgIHB1YmxpYyBpbnQgZ2V0VmVydGV4QWxsb2NhdGlvbkNvdW50KCkgeworICAgICAgICBpZihtVmVydGV4QnVmZmVycyA9PSBudWxsKSB7CisgICAgICAgICAgICByZXR1cm4gMDsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbVZlcnRleEJ1ZmZlcnMubGVuZ3RoOworICAgIH0KKyAgICBwdWJsaWMgQWxsb2NhdGlvbiBnZXRWZXJ0ZXhBbGxvY2F0aW9uKGludCBzbG90KSB7CisgICAgICAgIHJldHVybiBtVmVydGV4QnVmZmVyc1tzbG90XTsKKyAgICB9CisKKyAgICBwdWJsaWMgaW50IGdldFByaW1pdGl2ZUNvdW50KCkgeworICAgICAgICBpZihtSW5kZXhCdWZmZXJzID09IG51bGwpIHsKKyAgICAgICAgICAgIHJldHVybiAwOworICAgICAgICB9CisgICAgICAgIHJldHVybiBtSW5kZXhCdWZmZXJzLmxlbmd0aDsKKyAgICB9CisgICAgcHVibGljIEFsbG9jYXRpb24gZ2V0SW5kZXhBbGxvY2F0aW9uKGludCBzbG90KSB7CisgICAgICAgIHJldHVybiBtSW5kZXhCdWZmZXJzW3Nsb3RdOworICAgIH0KKyAgICBwdWJsaWMgUHJpbWl0aXZlIGdldFByaW1pdGl2ZShpbnQgc2xvdCkgeworICAgICAgICByZXR1cm4gbVByaW1pdGl2ZXNbc2xvdF07CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgdm9pZCB1cGRhdGVGcm9tTmF0aXZlKCkgeworICAgICAgICBtTmFtZSA9IG1SUy5uR2V0TmFtZShtSUQpOworICAgICAgICBpbnQgdnR4Q291bnQgPSBtUlMubk1lc2hHZXRWZXJ0ZXhCdWZmZXJDb3VudChtSUQpOworICAgICAgICBpbnQgaWR4Q291bnQgPSBtUlMubk1lc2hHZXRJbmRleENvdW50KG1JRCk7CisKKyAgICAgICAgaW50W10gdnR4SURzID0gbmV3IGludFt2dHhDb3VudF07CisgICAgICAgIGludFtdIGlkeElEcyA9IG5ldyBpbnRbaWR4Q291bnRdOworICAgICAgICBpbnRbXSBwcmltaXRpdmVzID0gbmV3IGludFtpZHhDb3VudF07CisKKyAgICAgICAgbVJTLm5NZXNoR2V0VmVydGljZXMobUlELCB2dHhJRHMsIHZ0eENvdW50KTsKKyAgICAgICAgbVJTLm5NZXNoR2V0SW5kaWNlcyhtSUQsIGlkeElEcywgcHJpbWl0aXZlcywgdnR4Q291bnQpOworCisgICAgICAgIG1WZXJ0ZXhCdWZmZXJzID0gbmV3IEFsbG9jYXRpb25bdnR4Q291bnRdOworICAgICAgICBtSW5kZXhCdWZmZXJzID0gbmV3IEFsbG9jYXRpb25baWR4Q291bnRdOworICAgICAgICBtUHJpbWl0aXZlcyA9IG5ldyBQcmltaXRpdmVbaWR4Q291bnRdOworCisgICAgICAgIGZvcihpbnQgaSA9IDA7IGkgPCB2dHhDb3VudDsgaSArKykgeworICAgICAgICAgICAgaWYodnR4SURzW2ldICE9IDApIHsKKyAgICAgICAgICAgICAgICBtVmVydGV4QnVmZmVyc1tpXSA9IG5ldyBBbGxvY2F0aW9uKHZ0eElEc1tpXSwgbVJTKTsKKyAgICAgICAgICAgICAgICBtVmVydGV4QnVmZmVyc1tpXS51cGRhdGVGcm9tTmF0aXZlKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBmb3IoaW50IGkgPSAwOyBpIDwgaWR4Q291bnQ7IGkgKyspIHsKKyAgICAgICAgICAgIGlmKGlkeElEc1tpXSAhPSAwKSB7CisgICAgICAgICAgICAgICAgbUluZGV4QnVmZmVyc1tpXSA9IG5ldyBBbGxvY2F0aW9uKGlkeElEc1tpXSwgbVJTKTsKKyAgICAgICAgICAgICAgICBtSW5kZXhCdWZmZXJzW2ldLnVwZGF0ZUZyb21OYXRpdmUoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1QcmltaXRpdmVzW2ldID0gUHJpbWl0aXZlLnZhbHVlcygpW3ByaW1pdGl2ZXNbaV1dOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHN0YXRpYyBjbGFzcyBCdWlsZGVyIHsKKyAgICAgICAgUmVuZGVyU2NyaXB0IG1SUzsKKworICAgICAgICBjbGFzcyBFbnRyeSB7CisgICAgICAgICAgICBUeXBlIHQ7CisgICAgICAgICAgICBFbGVtZW50IGU7CisgICAgICAgICAgICBpbnQgc2l6ZTsKKyAgICAgICAgICAgIFByaW1pdGl2ZSBwcmltOworICAgICAgICB9CisKKyAgICAgICAgaW50IG1WZXJ0ZXhUeXBlQ291bnQ7CisgICAgICAgIEVudHJ5W10gbVZlcnRleFR5cGVzOworICAgICAgICBWZWN0b3IgbUluZGV4VHlwZXM7CisKKyAgICAgICAgcHVibGljIEJ1aWxkZXIoUmVuZGVyU2NyaXB0IHJzKSB7CisgICAgICAgICAgICBtUlMgPSByczsKKyAgICAgICAgICAgIG1WZXJ0ZXhUeXBlQ291bnQgPSAwOworICAgICAgICAgICAgbVZlcnRleFR5cGVzID0gbmV3IEVudHJ5WzE2XTsKKyAgICAgICAgICAgIG1JbmRleFR5cGVzID0gbmV3IFZlY3RvcigpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGludCBhZGRWZXJ0ZXhUeXBlKFR5cGUgdCkgdGhyb3dzIElsbGVnYWxTdGF0ZUV4Y2VwdGlvbiB7CisgICAgICAgICAgICBpZiAobVZlcnRleFR5cGVDb3VudCA+PSBtVmVydGV4VHlwZXMubGVuZ3RoKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiTWF4IHZlcnRleCB0eXBlcyBleGNlZWRlZC4iKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaW50IGFkZGVkSW5kZXggPSBtVmVydGV4VHlwZUNvdW50OworICAgICAgICAgICAgbVZlcnRleFR5cGVzW21WZXJ0ZXhUeXBlQ291bnRdID0gbmV3IEVudHJ5KCk7CisgICAgICAgICAgICBtVmVydGV4VHlwZXNbbVZlcnRleFR5cGVDb3VudF0udCA9IHQ7CisgICAgICAgICAgICBtVmVydGV4VHlwZXNbbVZlcnRleFR5cGVDb3VudF0uZSA9IG51bGw7CisgICAgICAgICAgICBtVmVydGV4VHlwZUNvdW50Kys7CisgICAgICAgICAgICByZXR1cm4gYWRkZWRJbmRleDsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBpbnQgYWRkVmVydGV4VHlwZShFbGVtZW50IGUsIGludCBzaXplKSB0aHJvd3MgSWxsZWdhbFN0YXRlRXhjZXB0aW9uIHsKKyAgICAgICAgICAgIGlmIChtVmVydGV4VHlwZUNvdW50ID49IG1WZXJ0ZXhUeXBlcy5sZW5ndGgpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJNYXggdmVydGV4IHR5cGVzIGV4Y2VlZGVkLiIpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpbnQgYWRkZWRJbmRleCA9IG1WZXJ0ZXhUeXBlQ291bnQ7CisgICAgICAgICAgICBtVmVydGV4VHlwZXNbbVZlcnRleFR5cGVDb3VudF0gPSBuZXcgRW50cnkoKTsKKyAgICAgICAgICAgIG1WZXJ0ZXhUeXBlc1ttVmVydGV4VHlwZUNvdW50XS50ID0gbnVsbDsKKyAgICAgICAgICAgIG1WZXJ0ZXhUeXBlc1ttVmVydGV4VHlwZUNvdW50XS5lID0gZTsKKyAgICAgICAgICAgIG1WZXJ0ZXhUeXBlc1ttVmVydGV4VHlwZUNvdW50XS5zaXplID0gc2l6ZTsKKyAgICAgICAgICAgIG1WZXJ0ZXhUeXBlQ291bnQrKzsKKyAgICAgICAgICAgIHJldHVybiBhZGRlZEluZGV4OworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGludCBhZGRJbmRleFR5cGUoVHlwZSB0LCBQcmltaXRpdmUgcCkgeworICAgICAgICAgICAgaW50IGFkZGVkSW5kZXggID0gbUluZGV4VHlwZXMuc2l6ZSgpOworICAgICAgICAgICAgRW50cnkgaW5kZXhUeXBlID0gbmV3IEVudHJ5KCk7CisgICAgICAgICAgICBpbmRleFR5cGUudCA9IHQ7CisgICAgICAgICAgICBpbmRleFR5cGUuZSA9IG51bGw7CisgICAgICAgICAgICBpbmRleFR5cGUuc2l6ZSA9IDA7CisgICAgICAgICAgICBpbmRleFR5cGUucHJpbSA9IHA7CisgICAgICAgICAgICBtSW5kZXhUeXBlcy5hZGRFbGVtZW50KGluZGV4VHlwZSk7CisgICAgICAgICAgICByZXR1cm4gYWRkZWRJbmRleDsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBpbnQgYWRkSW5kZXhUeXBlKFByaW1pdGl2ZSBwKSB7CisgICAgICAgICAgICBpbnQgYWRkZWRJbmRleCAgPSBtSW5kZXhUeXBlcy5zaXplKCk7CisgICAgICAgICAgICBFbnRyeSBpbmRleFR5cGUgPSBuZXcgRW50cnkoKTsKKyAgICAgICAgICAgIGluZGV4VHlwZS50ID0gbnVsbDsKKyAgICAgICAgICAgIGluZGV4VHlwZS5lID0gbnVsbDsKKyAgICAgICAgICAgIGluZGV4VHlwZS5zaXplID0gMDsKKyAgICAgICAgICAgIGluZGV4VHlwZS5wcmltID0gcDsKKyAgICAgICAgICAgIG1JbmRleFR5cGVzLmFkZEVsZW1lbnQoaW5kZXhUeXBlKTsKKyAgICAgICAgICAgIHJldHVybiBhZGRlZEluZGV4OworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGludCBhZGRJbmRleFR5cGUoRWxlbWVudCBlLCBpbnQgc2l6ZSwgUHJpbWl0aXZlIHApIHsKKyAgICAgICAgICAgIGludCBhZGRlZEluZGV4ICA9IG1JbmRleFR5cGVzLnNpemUoKTsKKyAgICAgICAgICAgIEVudHJ5IGluZGV4VHlwZSA9IG5ldyBFbnRyeSgpOworICAgICAgICAgICAgaW5kZXhUeXBlLnQgPSBudWxsOworICAgICAgICAgICAgaW5kZXhUeXBlLmUgPSBlOworICAgICAgICAgICAgaW5kZXhUeXBlLnNpemUgPSBzaXplOworICAgICAgICAgICAgaW5kZXhUeXBlLnByaW0gPSBwOworICAgICAgICAgICAgbUluZGV4VHlwZXMuYWRkRWxlbWVudChpbmRleFR5cGUpOworICAgICAgICAgICAgcmV0dXJuIGFkZGVkSW5kZXg7CisgICAgICAgIH0KKworICAgICAgICBUeXBlIG5ld1R5cGUoRWxlbWVudCBlLCBpbnQgc2l6ZSkgeworICAgICAgICAgICAgVHlwZS5CdWlsZGVyIHRiID0gbmV3IFR5cGUuQnVpbGRlcihtUlMsIGUpOworICAgICAgICAgICAgdGIuYWRkKERpbWVuc2lvbi5YLCBzaXplKTsKKyAgICAgICAgICAgIHJldHVybiB0Yi5jcmVhdGUoKTsKKyAgICAgICAgfQorCisgICAgICAgIHN0YXRpYyBzeW5jaHJvbml6ZWQgTWVzaCBpbnRlcm5hbENyZWF0ZShSZW5kZXJTY3JpcHQgcnMsIEJ1aWxkZXIgYikgeworCisgICAgICAgICAgICBpbnQgaWQgPSBycy5uTWVzaENyZWF0ZShiLm1WZXJ0ZXhUeXBlQ291bnQsIGIubUluZGV4VHlwZXMuc2l6ZSgpKTsKKyAgICAgICAgICAgIE1lc2ggbmV3TWVzaCA9IG5ldyBNZXNoKGlkLCBycyk7CisgICAgICAgICAgICBuZXdNZXNoLm1JbmRleEJ1ZmZlcnMgPSBuZXcgQWxsb2NhdGlvbltiLm1JbmRleFR5cGVzLnNpemUoKV07CisgICAgICAgICAgICBuZXdNZXNoLm1QcmltaXRpdmVzID0gbmV3IFByaW1pdGl2ZVtiLm1JbmRleFR5cGVzLnNpemUoKV07CisgICAgICAgICAgICBuZXdNZXNoLm1WZXJ0ZXhCdWZmZXJzID0gbmV3IEFsbG9jYXRpb25bYi5tVmVydGV4VHlwZUNvdW50XTsKKworICAgICAgICAgICAgZm9yKGludCBjdCA9IDA7IGN0IDwgYi5tSW5kZXhUeXBlcy5zaXplKCk7IGN0ICsrKSB7CisgICAgICAgICAgICAgICAgQWxsb2NhdGlvbiBhbGxvYyA9IG51bGw7CisgICAgICAgICAgICAgICAgRW50cnkgZW50cnkgPSAoRW50cnkpYi5tSW5kZXhUeXBlcy5lbGVtZW50QXQoY3QpOworICAgICAgICAgICAgICAgIGlmIChlbnRyeS50ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgYWxsb2MgPSBBbGxvY2F0aW9uLmNyZWF0ZVR5cGVkKHJzLCBlbnRyeS50KTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZWxzZSBpZihlbnRyeS5lICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgYWxsb2MgPSBBbGxvY2F0aW9uLmNyZWF0ZVNpemVkKHJzLCBlbnRyeS5lLCBlbnRyeS5zaXplKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaW50IGFsbG9jSUQgPSAoYWxsb2MgPT0gbnVsbCkgPyAwIDogYWxsb2MuZ2V0SUQoKTsKKyAgICAgICAgICAgICAgICBycy5uTWVzaEJpbmRJbmRleChpZCwgYWxsb2NJRCwgZW50cnkucHJpbS5tSUQsIGN0KTsKKyAgICAgICAgICAgICAgICBuZXdNZXNoLm1JbmRleEJ1ZmZlcnNbY3RdID0gYWxsb2M7CisgICAgICAgICAgICAgICAgbmV3TWVzaC5tUHJpbWl0aXZlc1tjdF0gPSBlbnRyeS5wcmltOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBmb3IoaW50IGN0ID0gMDsgY3QgPCBiLm1WZXJ0ZXhUeXBlQ291bnQ7IGN0ICsrKSB7CisgICAgICAgICAgICAgICAgQWxsb2NhdGlvbiBhbGxvYyA9IG51bGw7CisgICAgICAgICAgICAgICAgRW50cnkgZW50cnkgPSBiLm1WZXJ0ZXhUeXBlc1tjdF07CisgICAgICAgICAgICAgICAgaWYgKGVudHJ5LnQgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBhbGxvYyA9IEFsbG9jYXRpb24uY3JlYXRlVHlwZWQocnMsIGVudHJ5LnQpOworICAgICAgICAgICAgICAgIH0gZWxzZSBpZihlbnRyeS5lICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgYWxsb2MgPSBBbGxvY2F0aW9uLmNyZWF0ZVNpemVkKHJzLCBlbnRyeS5lLCBlbnRyeS5zaXplKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcnMubk1lc2hCaW5kVmVydGV4KGlkLCBhbGxvYy5nZXRJRCgpLCBjdCk7CisgICAgICAgICAgICAgICAgbmV3TWVzaC5tVmVydGV4QnVmZmVyc1tjdF0gPSBhbGxvYzsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcmV0dXJuIG5ld01lc2g7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgTWVzaCBjcmVhdGUoKSB7CisgICAgICAgICAgICBtUlMudmFsaWRhdGUoKTsKKyAgICAgICAgICAgIE1lc2ggc20gPSBpbnRlcm5hbENyZWF0ZShtUlMsIHRoaXMpOworICAgICAgICAgICAgcmV0dXJuIHNtOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHN0YXRpYyBjbGFzcyBBbGxvY2F0aW9uQnVpbGRlciB7CisgICAgICAgIFJlbmRlclNjcmlwdCBtUlM7CisKKyAgICAgICAgY2xhc3MgRW50cnkgeworICAgICAgICAgICAgQWxsb2NhdGlvbiBhOworICAgICAgICAgICAgUHJpbWl0aXZlIHByaW07CisgICAgICAgIH0KKworICAgICAgICBpbnQgbVZlcnRleFR5cGVDb3VudDsKKyAgICAgICAgRW50cnlbXSBtVmVydGV4VHlwZXM7CisKKyAgICAgICAgVmVjdG9yIG1JbmRleFR5cGVzOworCisgICAgICAgIHB1YmxpYyBBbGxvY2F0aW9uQnVpbGRlcihSZW5kZXJTY3JpcHQgcnMpIHsKKyAgICAgICAgICAgIG1SUyA9IHJzOworICAgICAgICAgICAgbVZlcnRleFR5cGVDb3VudCA9IDA7CisgICAgICAgICAgICBtVmVydGV4VHlwZXMgPSBuZXcgRW50cnlbMTZdOworICAgICAgICAgICAgbUluZGV4VHlwZXMgPSBuZXcgVmVjdG9yKCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgaW50IGFkZFZlcnRleEFsbG9jYXRpb24oQWxsb2NhdGlvbiBhKSB0aHJvd3MgSWxsZWdhbFN0YXRlRXhjZXB0aW9uIHsKKyAgICAgICAgICAgIGlmIChtVmVydGV4VHlwZUNvdW50ID49IG1WZXJ0ZXhUeXBlcy5sZW5ndGgpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJNYXggdmVydGV4IHR5cGVzIGV4Y2VlZGVkLiIpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpbnQgYWRkZWRJbmRleCA9IG1WZXJ0ZXhUeXBlQ291bnQ7CisgICAgICAgICAgICBtVmVydGV4VHlwZXNbbVZlcnRleFR5cGVDb3VudF0gPSBuZXcgRW50cnkoKTsKKyAgICAgICAgICAgIG1WZXJ0ZXhUeXBlc1ttVmVydGV4VHlwZUNvdW50XS5hID0gYTsKKyAgICAgICAgICAgIG1WZXJ0ZXhUeXBlQ291bnQrKzsKKyAgICAgICAgICAgIHJldHVybiBhZGRlZEluZGV4OworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGludCBhZGRJbmRleEFsbG9jYXRpb24oQWxsb2NhdGlvbiBhLCBQcmltaXRpdmUgcCkgeworICAgICAgICAgICAgaW50IGFkZGVkSW5kZXggID0gbUluZGV4VHlwZXMuc2l6ZSgpOworICAgICAgICAgICAgRW50cnkgaW5kZXhUeXBlID0gbmV3IEVudHJ5KCk7CisgICAgICAgICAgICBpbmRleFR5cGUuYSA9IGE7CisgICAgICAgICAgICBpbmRleFR5cGUucHJpbSA9IHA7CisgICAgICAgICAgICBtSW5kZXhUeXBlcy5hZGRFbGVtZW50KGluZGV4VHlwZSk7CisgICAgICAgICAgICByZXR1cm4gYWRkZWRJbmRleDsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBpbnQgYWRkSW5kZXhUeXBlKFByaW1pdGl2ZSBwKSB7CisgICAgICAgICAgICBpbnQgYWRkZWRJbmRleCAgPSBtSW5kZXhUeXBlcy5zaXplKCk7CisgICAgICAgICAgICBFbnRyeSBpbmRleFR5cGUgPSBuZXcgRW50cnkoKTsKKyAgICAgICAgICAgIGluZGV4VHlwZS5hID0gbnVsbDsKKyAgICAgICAgICAgIGluZGV4VHlwZS5wcmltID0gcDsKKyAgICAgICAgICAgIG1JbmRleFR5cGVzLmFkZEVsZW1lbnQoaW5kZXhUeXBlKTsKKyAgICAgICAgICAgIHJldHVybiBhZGRlZEluZGV4OworICAgICAgICB9CisKKyAgICAgICAgc3RhdGljIHN5bmNocm9uaXplZCBNZXNoIGludGVybmFsQ3JlYXRlKFJlbmRlclNjcmlwdCBycywgQWxsb2NhdGlvbkJ1aWxkZXIgYikgeworCisgICAgICAgICAgICBpbnQgaWQgPSBycy5uTWVzaENyZWF0ZShiLm1WZXJ0ZXhUeXBlQ291bnQsIGIubUluZGV4VHlwZXMuc2l6ZSgpKTsKKyAgICAgICAgICAgIE1lc2ggbmV3TWVzaCA9IG5ldyBNZXNoKGlkLCBycyk7CisgICAgICAgICAgICBuZXdNZXNoLm1JbmRleEJ1ZmZlcnMgPSBuZXcgQWxsb2NhdGlvbltiLm1JbmRleFR5cGVzLnNpemUoKV07CisgICAgICAgICAgICBuZXdNZXNoLm1QcmltaXRpdmVzID0gbmV3IFByaW1pdGl2ZVtiLm1JbmRleFR5cGVzLnNpemUoKV07CisgICAgICAgICAgICBuZXdNZXNoLm1WZXJ0ZXhCdWZmZXJzID0gbmV3IEFsbG9jYXRpb25bYi5tVmVydGV4VHlwZUNvdW50XTsKKworICAgICAgICAgICAgZm9yKGludCBjdCA9IDA7IGN0IDwgYi5tSW5kZXhUeXBlcy5zaXplKCk7IGN0ICsrKSB7CisgICAgICAgICAgICAgICAgRW50cnkgZW50cnkgPSAoRW50cnkpYi5tSW5kZXhUeXBlcy5lbGVtZW50QXQoY3QpOworICAgICAgICAgICAgICAgIGludCBhbGxvY0lEID0gKGVudHJ5LmEgPT0gbnVsbCkgPyAwIDogZW50cnkuYS5nZXRJRCgpOworICAgICAgICAgICAgICAgIHJzLm5NZXNoQmluZEluZGV4KGlkLCBhbGxvY0lELCBlbnRyeS5wcmltLm1JRCwgY3QpOworICAgICAgICAgICAgICAgIG5ld01lc2gubUluZGV4QnVmZmVyc1tjdF0gPSBlbnRyeS5hOworICAgICAgICAgICAgICAgIG5ld01lc2gubVByaW1pdGl2ZXNbY3RdID0gZW50cnkucHJpbTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgZm9yKGludCBjdCA9IDA7IGN0IDwgYi5tVmVydGV4VHlwZUNvdW50OyBjdCArKykgeworICAgICAgICAgICAgICAgIEVudHJ5IGVudHJ5ID0gYi5tVmVydGV4VHlwZXNbY3RdOworICAgICAgICAgICAgICAgIHJzLm5NZXNoQmluZFZlcnRleChpZCwgZW50cnkuYS5tSUQsIGN0KTsKKyAgICAgICAgICAgICAgICBuZXdNZXNoLm1WZXJ0ZXhCdWZmZXJzW2N0XSA9IGVudHJ5LmE7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHJldHVybiBuZXdNZXNoOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIE1lc2ggY3JlYXRlKCkgeworICAgICAgICAgICAgbVJTLnZhbGlkYXRlKCk7CisgICAgICAgICAgICBNZXNoIHNtID0gaW50ZXJuYWxDcmVhdGUobVJTLCB0aGlzKTsKKyAgICAgICAgICAgIHJldHVybiBzbTsKKyAgICAgICAgfQorICAgIH0KKworCisgICAgcHVibGljIHN0YXRpYyBjbGFzcyBUcmlhbmdsZU1lc2hCdWlsZGVyIHsKKyAgICAgICAgZmxvYXQgbVZ0eERhdGFbXTsKKyAgICAgICAgaW50IG1WdHhDb3VudDsKKyAgICAgICAgc2hvcnQgbUluZGV4RGF0YVtdOworICAgICAgICBpbnQgbUluZGV4Q291bnQ7CisgICAgICAgIFJlbmRlclNjcmlwdCBtUlM7CisgICAgICAgIEVsZW1lbnQgbUVsZW1lbnQ7CisKKyAgICAgICAgZmxvYXQgbU5YID0gMDsKKyAgICAgICAgZmxvYXQgbU5ZID0gMDsKKyAgICAgICAgZmxvYXQgbU5aID0gLTE7CisgICAgICAgIGZsb2F0IG1TMCA9IDA7CisgICAgICAgIGZsb2F0IG1UMCA9IDA7CisgICAgICAgIGZsb2F0IG1SID0gMTsKKyAgICAgICAgZmxvYXQgbUcgPSAxOworICAgICAgICBmbG9hdCBtQiA9IDE7CisgICAgICAgIGZsb2F0IG1BID0gMTsKKworICAgICAgICBpbnQgbVZ0eFNpemU7CisgICAgICAgIGludCBtRmxhZ3M7CisKKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBpbnQgQ09MT1IgPSAweDAwMDE7CisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IE5PUk1BTCA9IDB4MDAwMjsKKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBpbnQgVEVYVFVSRV8wID0gMHgwMTAwOworCisgICAgICAgIHB1YmxpYyBUcmlhbmdsZU1lc2hCdWlsZGVyKFJlbmRlclNjcmlwdCBycywgaW50IHZ0eFNpemUsIGludCBmbGFncykgeworICAgICAgICAgICAgbVJTID0gcnM7CisgICAgICAgICAgICBtVnR4Q291bnQgPSAwOworICAgICAgICAgICAgbUluZGV4Q291bnQgPSAwOworICAgICAgICAgICAgbVZ0eERhdGEgPSBuZXcgZmxvYXRbMTI4XTsKKyAgICAgICAgICAgIG1JbmRleERhdGEgPSBuZXcgc2hvcnRbMTI4XTsKKyAgICAgICAgICAgIG1WdHhTaXplID0gdnR4U2l6ZTsKKyAgICAgICAgICAgIG1GbGFncyA9IGZsYWdzOworCisgICAgICAgICAgICBpZiAodnR4U2l6ZSA8IDIgfHwgdnR4U2l6ZSA+IDMpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJWZXJ0ZXggc2l6ZSBvdXQgb2YgcmFuZ2UuIik7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIHZvaWQgbWFrZVNwYWNlKGludCBjb3VudCkgeworICAgICAgICAgICAgaWYgKChtVnR4Q291bnQgKyBjb3VudCkgPj0gbVZ0eERhdGEubGVuZ3RoKSB7CisgICAgICAgICAgICAgICAgZmxvYXQgdFtdID0gbmV3IGZsb2F0W21WdHhEYXRhLmxlbmd0aCAqIDJdOworICAgICAgICAgICAgICAgIFN5c3RlbS5hcnJheWNvcHkobVZ0eERhdGEsIDAsIHQsIDAsIG1WdHhEYXRhLmxlbmd0aCk7CisgICAgICAgICAgICAgICAgbVZ0eERhdGEgPSB0OworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSB2b2lkIGxhdGNoKCkgeworICAgICAgICAgICAgaWYgKChtRmxhZ3MgJiBDT0xPUikgIT0gMCkgeworICAgICAgICAgICAgICAgIG1ha2VTcGFjZSg0KTsKKyAgICAgICAgICAgICAgICBtVnR4RGF0YVttVnR4Q291bnQrK10gPSBtUjsKKyAgICAgICAgICAgICAgICBtVnR4RGF0YVttVnR4Q291bnQrK10gPSBtRzsKKyAgICAgICAgICAgICAgICBtVnR4RGF0YVttVnR4Q291bnQrK10gPSBtQjsKKyAgICAgICAgICAgICAgICBtVnR4RGF0YVttVnR4Q291bnQrK10gPSBtQTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmICgobUZsYWdzICYgVEVYVFVSRV8wKSAhPSAwKSB7CisgICAgICAgICAgICAgICAgbWFrZVNwYWNlKDIpOworICAgICAgICAgICAgICAgIG1WdHhEYXRhW21WdHhDb3VudCsrXSA9IG1TMDsKKyAgICAgICAgICAgICAgICBtVnR4RGF0YVttVnR4Q291bnQrK10gPSBtVDA7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoKG1GbGFncyAmIE5PUk1BTCkgIT0gMCkgeworICAgICAgICAgICAgICAgIG1ha2VTcGFjZSgzKTsKKyAgICAgICAgICAgICAgICBtVnR4RGF0YVttVnR4Q291bnQrK10gPSBtTlg7CisgICAgICAgICAgICAgICAgbVZ0eERhdGFbbVZ0eENvdW50KytdID0gbU5ZOworICAgICAgICAgICAgICAgIG1WdHhEYXRhW21WdHhDb3VudCsrXSA9IG1OWjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyB2b2lkIGFkZFZlcnRleChmbG9hdCB4LCBmbG9hdCB5KSB7CisgICAgICAgICAgICBpZiAobVZ0eFNpemUgIT0gMikgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oImFkZCBtaXN0bWF0Y2ggd2l0aCBkZWNsYXJlZCBjb21wb25lbnRzLiIpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbWFrZVNwYWNlKDIpOworICAgICAgICAgICAgbVZ0eERhdGFbbVZ0eENvdW50KytdID0geDsKKyAgICAgICAgICAgIG1WdHhEYXRhW21WdHhDb3VudCsrXSA9IHk7CisgICAgICAgICAgICBsYXRjaCgpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgYWRkVmVydGV4KGZsb2F0IHgsIGZsb2F0IHksIGZsb2F0IHopIHsKKyAgICAgICAgICAgIGlmIChtVnR4U2l6ZSAhPSAzKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiYWRkIG1pc3RtYXRjaCB3aXRoIGRlY2xhcmVkIGNvbXBvbmVudHMuIik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBtYWtlU3BhY2UoMyk7CisgICAgICAgICAgICBtVnR4RGF0YVttVnR4Q291bnQrK10gPSB4OworICAgICAgICAgICAgbVZ0eERhdGFbbVZ0eENvdW50KytdID0geTsKKyAgICAgICAgICAgIG1WdHhEYXRhW21WdHhDb3VudCsrXSA9IHo7CisgICAgICAgICAgICBsYXRjaCgpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgc2V0VGV4dHVyZShmbG9hdCBzLCBmbG9hdCB0KSB7CisgICAgICAgICAgICBpZiAoKG1GbGFncyAmIFRFWFRVUkVfMCkgPT0gMCkgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oImFkZCBtaXN0bWF0Y2ggd2l0aCBkZWNsYXJlZCBjb21wb25lbnRzLiIpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbVMwID0gczsKKyAgICAgICAgICAgIG1UMCA9IHQ7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBzZXROb3JtYWwoZmxvYXQgeCwgZmxvYXQgeSwgZmxvYXQgeikgeworICAgICAgICAgICAgaWYgKChtRmxhZ3MgJiBOT1JNQUwpID09IDApIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJhZGQgbWlzdG1hdGNoIHdpdGggZGVjbGFyZWQgY29tcG9uZW50cy4iKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1OWCA9IHg7CisgICAgICAgICAgICBtTlkgPSB5OworICAgICAgICAgICAgbU5aID0gejsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyB2b2lkIHNldENvbG9yKGZsb2F0IHIsIGZsb2F0IGcsIGZsb2F0IGIsIGZsb2F0IGEpIHsKKyAgICAgICAgICAgIGlmICgobUZsYWdzICYgQ09MT1IpID09IDApIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJhZGQgbWlzdG1hdGNoIHdpdGggZGVjbGFyZWQgY29tcG9uZW50cy4iKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1SID0gcjsKKyAgICAgICAgICAgIG1HID0gZzsKKyAgICAgICAgICAgIG1CID0gYjsKKyAgICAgICAgICAgIG1BID0gYTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyB2b2lkIGFkZFRyaWFuZ2xlKGludCBpZHgxLCBpbnQgaWR4MiwgaW50IGlkeDMpIHsKKyAgICAgICAgICAgIGlmKChpZHgxID49IG1WdHhDb3VudCkgfHwgKGlkeDEgPCAwKSB8fAorICAgICAgICAgICAgICAgKGlkeDIgPj0gbVZ0eENvdW50KSB8fCAoaWR4MiA8IDApIHx8CisgICAgICAgICAgICAgICAoaWR4MyA+PSBtVnR4Q291bnQpIHx8IChpZHgzIDwgMCkpIHsKKyAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oIkluZGV4IHByb3ZpZGVkIGdyZWF0ZXIgdGhhbiB2ZXJ0ZXggY291bnQuIik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoKG1JbmRleENvdW50ICsgMykgPj0gbUluZGV4RGF0YS5sZW5ndGgpIHsKKyAgICAgICAgICAgICAgICBzaG9ydCB0W10gPSBuZXcgc2hvcnRbbUluZGV4RGF0YS5sZW5ndGggKiAyXTsKKyAgICAgICAgICAgICAgICBTeXN0ZW0uYXJyYXljb3B5KG1JbmRleERhdGEsIDAsIHQsIDAsIG1JbmRleERhdGEubGVuZ3RoKTsKKyAgICAgICAgICAgICAgICBtSW5kZXhEYXRhID0gdDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1JbmRleERhdGFbbUluZGV4Q291bnQrK10gPSAoc2hvcnQpaWR4MTsKKyAgICAgICAgICAgIG1JbmRleERhdGFbbUluZGV4Q291bnQrK10gPSAoc2hvcnQpaWR4MjsKKyAgICAgICAgICAgIG1JbmRleERhdGFbbUluZGV4Q291bnQrK10gPSAoc2hvcnQpaWR4MzsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBNZXNoIGNyZWF0ZShib29sZWFuIHVwbG9hZFRvQnVmZmVyT2JqZWN0KSB7CisgICAgICAgICAgICBFbGVtZW50LkJ1aWxkZXIgYiA9IG5ldyBFbGVtZW50LkJ1aWxkZXIobVJTKTsKKyAgICAgICAgICAgIGludCBmbG9hdENvdW50ID0gbVZ0eFNpemU7CisgICAgICAgICAgICBiLmFkZChFbGVtZW50LmNyZWF0ZVZlY3RvcihtUlMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBFbGVtZW50LkRhdGFUeXBlLkZMT0FUXzMyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVZ0eFNpemUpLCAicG9zaXRpb24iKTsKKyAgICAgICAgICAgIGlmICgobUZsYWdzICYgQ09MT1IpICE9IDApIHsKKyAgICAgICAgICAgICAgICBmbG9hdENvdW50ICs9IDQ7CisgICAgICAgICAgICAgICAgYi5hZGQoRWxlbWVudC5GMzJfNChtUlMpLCAiY29sb3IiKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmICgobUZsYWdzICYgVEVYVFVSRV8wKSAhPSAwKSB7CisgICAgICAgICAgICAgICAgZmxvYXRDb3VudCArPSAyOworICAgICAgICAgICAgICAgIGIuYWRkKEVsZW1lbnQuRjMyXzIobVJTKSwgInRleHR1cmUwIik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoKG1GbGFncyAmIE5PUk1BTCkgIT0gMCkgeworICAgICAgICAgICAgICAgIGZsb2F0Q291bnQgKz0gMzsKKyAgICAgICAgICAgICAgICBiLmFkZChFbGVtZW50LkYzMl8zKG1SUyksICJub3JtYWwiKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1FbGVtZW50ID0gYi5jcmVhdGUoKTsKKworICAgICAgICAgICAgQnVpbGRlciBzbWIgPSBuZXcgQnVpbGRlcihtUlMpOworICAgICAgICAgICAgc21iLmFkZFZlcnRleFR5cGUobUVsZW1lbnQsIG1WdHhDb3VudCAvIGZsb2F0Q291bnQpOworICAgICAgICAgICAgc21iLmFkZEluZGV4VHlwZShFbGVtZW50LlUxNihtUlMpLCBtSW5kZXhDb3VudCwgUHJpbWl0aXZlLlRSSUFOR0xFKTsKKworICAgICAgICAgICAgTWVzaCBzbSA9IHNtYi5jcmVhdGUoKTsKKworICAgICAgICAgICAgc20uZ2V0VmVydGV4QWxsb2NhdGlvbigwKS5kYXRhKG1WdHhEYXRhKTsKKyAgICAgICAgICAgIGlmKHVwbG9hZFRvQnVmZmVyT2JqZWN0KSB7CisgICAgICAgICAgICAgICAgc20uZ2V0VmVydGV4QWxsb2NhdGlvbigwKS51cGxvYWRUb0J1ZmZlck9iamVjdCgpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBzbS5nZXRJbmRleEFsbG9jYXRpb24oMCkuZGF0YShtSW5kZXhEYXRhKTsKKyAgICAgICAgICAgIHNtLmdldEluZGV4QWxsb2N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gICAgICAgICAgbVRleHR1cmVDb3VudCA9IDA7CiAgICAgICAgIH0KIAotICAgICAgICBwdWJsaWMgdm9pZCBzZXRTaGFkZXIoU3RyaW5nIHMpIHsKKyAgICAgICAgcHVibGljIEJhc2VQcm9ncmFtQnVpbGRlciBzZXRTaGFkZXIoU3RyaW5nIHMpIHsKICAgICAgICAgICAgIG1TaGFkZXIgPSBzOworICAgICAgICAgICAgcmV0dXJuIHRoaXM7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgQmFzZVByb2dyYW1CdWlsZGVyIHNldFNoYWRlcihSZXNvdXJjZXMgcmVzb3VyY2VzLCBpbnQgcmVzb3VyY2VJRCkgeworICAgICAgICAgICAgYnl0ZVtdIHN0cjsKKyAgICAgICAgICAgIGludCBzdHJMZW5ndGg7CisgICAgICAgICAgICBJbnB1dFN0cmVhbSBpcyA9IHJlc291cmNlcy5vcGVuUmF3UmVzb3VyY2UocmVzb3VyY2VJRCk7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgIHN0ciA9IG5ldyBieXRlWzEwMjRdOworICAgICAgICAgICAgICAgICAgICBzdHJMZW5ndGggPSAwOworICAgICAgICAgICAgICAgICAgICB3aGlsZSh0cnVlKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBpbnQgYnl0ZXNMZWZ0ID0gc3RyLmxlbmd0aCAtIHN0ckxlbmd0aDsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChieXRlc0xlZnQgPT0gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ5dGVbXSBidWYyID0gbmV3IGJ5dGVbc3RyLmxlbmd0aCAqIDJdOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIFN5c3RlbS5hcnJheWNvcHkoc3RyLCAwLCBidWYyLCAwLCBzdHIubGVuZ3RoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHIgPSBidWYyOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJ5dGVzTGVmdCA9IHN0ci5sZW5ndGggLSBzdHJMZW5ndGg7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBpbnQgYnl0ZXNSZWFkID0gaXMucmVhZChzdHIsIHN0ckxlbmd0aCwgYnl0ZXNMZWZ0KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChieXRlc1JlYWQgPD0gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgc3RyTGVuZ3RoICs9IGJ5dGVzUmVhZDsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICAgICAgICAgIGlzLmNsb3NlKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSBjYXRjaChJT0V4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFJlc291cmNlcy5Ob3RGb3VuZEV4Y2VwdGlvbigpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIG1TaGFkZXIgPSBuZXcgU3RyaW5nKHN0ciwgMCwgc3RyTGVuZ3RoLCAiVVRGLTgiKTsKKyAgICAgICAgICAgIH0gY2F0Y2ggKFVuc3VwcG9ydGVkRW5jb2RpbmdFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgIExvZy5lKCJSZW5kZXJzY3JpcHQgc2hhZGVyIGNyZWF0aW9uIiwgIkNvdWxkIG5vdCBkZWNvZGUgc2hhZGVyIHN0cmluZyIpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgfQogCiAgICAgICAgIHB1YmxpYyB2b2lkIGFkZElucHV0KEVsZW1lbnQgZSkgdGhyb3dzIElsbGVnYWxTdGF0ZUV4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xlYW4gZW5hYmxlKSB7CisgICAgICAgIHB1YmxpYyBCdWlsZGVyIHNldFBvaW50U3ByaXRlVGV4Q29vcmRpbmF0ZVJlcGxhY2VtZW50KGJvb2xlYW4gZW5hYmxlKSB7CiAgICAgICAgICAgICBtUG9pbnRTcHJpdGVFbmFibGUgPSBlbmFibGU7CisgICAgICAgICAgICByZXR1cm4gdGhpczsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBCdWlsZGVyIHNldFZhcnlpbmdDb2xvcihib29sZWFuIGVuYWJsZSkgeworICAgICAgICAgICAgbVZhcnlpbmdDb2xvckVuYWJsZSA9IGVuYWJsZTsKKyAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgICB9CiAKICAgICAgICAgcHVibGljIFByb2dyYW1GcmFnbWVudCBjcmVhdGUoKSB7CiAgICAgICAgICAgICBtUlMudmFsaWRhdGUoKTsKLSAgICAgICAgICAgIGludFtdIHRtcCA9IG5ldyBpbnRbTUFYX1RFWFRVUkUgKiAyICsgMV07CisgICAgICAgICAgICBpbnRbXSB0bXAgPSBuZXcgaW50W01BWF9URVhUVVJFICogMiArIDJdOwogICAgICAgICAgICAgaWYgKG1TbG90c1swXSAhPSBudWxsKSB7CiAgICAgICAgICAgICAgICAgdG1wWzBdID0gbVNsb3RzWzBdLmVudi5tSUQ7CiAgICAgICAgICAgICAgICAgdG1wWzFdID0gbVNsb3RzWzBdLmZvcm1hdC5tSUQ7CkBAIC0xMzAsNiArMTM4LDcgQEAKICAgICAgICAgICAgICAgICB0bXBbM10gPSBtU2xvdHNbMV0uZm9ybWF0Lm1JRDsKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIHRtcFs0XSA9IG1Qb2ludFNwcml0ZUVuYWJsZSA/IDEgOiAwOworICAgICAgICAgICAgdG1wWzVdID0gbVZhcnlpbmdDb2xvckVuYWJsZSA/IDEgOiAwOwogICAgICAgICAgICAgaW50IGlkID0gbVJTLm5Qcm9ncmFtRnJhZ21lbnRDcmVh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nM7Ci0gICAgICAgICAgICBtUFIgPSBuZXcgUHJvZ3JhbVJhc3RlcigwLCBycyk7CisgICAgICAgICAgICBtUG9pbnRTbW9vdGggPSBmYWxzZTsKKyAgICAgICAgICAgIG1MaW5lU21vb3RoID0gZmFsc2U7CisgICAgICAgICAgICBtUG9pbnRTcHJpdGUgPSBmYWxzZTsKKyAgICAgICAgICAgIG1DdWxsTW9kZSA9IEN1bGxNb2RlLkJBQ0s7CiAgICAgICAgIH0KIAotICAgICAgICBwdWJsaWMgdm9pZCBzZXRQb2ludFNwcml0ZUVuYWJsZShib29sZWFuIGVuYWJsZSkgewotICAgICAgICAgICAgbVBSLm1Qb2ludFNwcml0ZSA9IGVuYWJsZTsKKyAgICAgICAgcHVibGljIEJ1aWxkZXIgc2V0UG9pbnRTcHJpdGVFbmFibGUoYm9vbGVhbiBlbmFibGUpIHsKKyAgICAgICAgICAgIG1Qb2ludFNwcml0ZSA9IGVuYWJsZTsKKyAgICAgICAgICAgIHJldHVybiB0aGlzOwogICAgICAgICB9CiAKLSAgICAgICAgcHVibGljIHZvaWQgc2V0UG9pbnRTbW9vdGhFbmFibGUoYm9vbGVhbiBlbmFibGUpIHsKLSAgICAgICAgICAgIG1QUi5tUG9pbnRTbW9vdGggPSBlbmFibGU7CisgICAgICAgIHB1YmxpYyBCdWlsZGVyIHNldFBvaW50U21vb3RoRW5hYmxlKGJvb2xlYW4gZW5hYmxlKSB7CisgICAgICAgICAgICBtUG9pbnRTbW9vdGggPSBlbmFibGU7CisgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgfQogCi0gICAgICAgIHB1YmxpYyB2b2lkIHNldExpbmVTbW9vdGhFbmFibGUoYm9vbGVhbiBlbmFibGUpIHsKLSAgICAgICAgICAgIG1QUi5tTGluZVNtb290aCA9IGVuYWJsZTsKKyAgICAgICAgcHVibGljIEJ1aWxkZXIgc2V0TGluZVNtb290aEVuYWJsZShib29sZWFuIGVuYWJsZSkgeworICAgICAgICAgICAgbU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TEVORF9OT05FX0RFUFRIX05PX0RFUFRIKFJlbmRlclNjcmlwdCBycykgeworICAgICAgICBpZihycy5tUHJvZ3JhbVN0b3JlX0JMRU5EX05PTkVfREVQVEhfTk9fREVQVEggPT0gbnVsbCkgeworICAgICAgICAgICAgUHJvZ3JhbVN0b3JlLkJ1aWxkZXIgYnVpbGRlciA9IG5ldyBQcm9ncmFtU3RvcmUuQnVpbGRlcihycyk7CisgICAgICAgICAgICBidWlsZGVyLnNldERlcHRoRnVuYyhQcm9ncmFtU3RvcmUuRGVwdGhGdW5jLkFMV0FZUyk7CisgICAgICAgICAgICBidWlsZGVyLnNldEJsZW5kRnVuYyhCbGVuZFNyY0Z1bmMuT05FLCBCbGVuZERzdEZ1bmMuWkVSTyk7CisgICAgICAgICAgICBidWlsZGVyLnNldERpdGhlckVuYWJsZShmYWxzZSk7CisgICAgICAgICAgICBidWlsZGVyLnNldERlcHRoTWFzayhmYWxzZSk7CisgICAgICAgICAgICBycy5tUHJvZ3JhbVN0b3JlX0JMRU5EX05PTkVfREVQVEhfTk9fREVQVEggPSBidWlsZGVyLmNyZWF0ZSgpOworICAgICAgICB9CisgICAgICAgIHJldHVybiBycy5tUHJvZ3JhbVN0b3JlX0JMRU5EX05PTkVfREVQVEhfTk9fREVQVEg7CisgICAgfQorICAgIHB1YmxpYyBzdGF0aWMgUHJvZ3JhbVN0b3JlIEJMRU5EX05PTkVfREVQVEhfTk9fVEVTVChSZW5kZXJTY3JpcHQgcnMpIHsKKyAgICAgICAgaWYocnMubVByb2dyYW1TdG9yZV9CTEVORF9OT05FX0RFUFRIX05PX1RFU1QgPT0gbnVsbCkgeworICAgICAgICAgICAgUHJvZ3JhbVN0b3JlLkJ1aWxkZXIgYnVpbGRlciA9IG5ldyBQcm9ncmFtU3RvcmUuQnVpbGRlcihycyk7CisgICAgICAgICAgICBidWlsZGVyLnNldERlcHRoRnVuYyhQcm9ncmFtU3RvcmUuRGVwdGhGdW5jLkFMV0FZUyk7CisgICAgICAgICAgICBidWlsZGVyLnNldEJsZW5kRnVuYyhCbGVuZFNyY0Z1bmMuT05FLCBCbGVuZERzdEZ1bmMuWkVSTyk7CisgICAgICAgICAgICBidWlsZGVyLnNldERpdGhlckVuYWJsZShmYWxzZSk7CisgICAgICAgICAgICBidWlsZGVyLnNldERlcHRoTWFzayh0cnVlKTsKKyAgICAgICAgICAgIHJzLm1Qcm9ncmFtU3RvcmVfQkxFTkRfTk9ORV9ERVBUSF9OT19URVNUID0gYnVpbGRlci5jcmVhdGUoKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gcnMubVByb2dyYW1TdG9yZV9CTEVORF9OT05FX0RFUFRIX05PX1RFU1Q7CisgICAgfQorICAgIHB1YmxpYyBzdGF0aWMgUHJvZ3JhbVN0b3JlIEJMRU5EX05PTkVfREVQVEhfTk9fV1JJVEUoUmVuZGVyU2NyaXB0IHJzKSB7CisgICAgICAgIGlmKHJzLm1Qcm9ncmFtU3RvcmVfQkxFTkRfTk9ORV9ERVBUSF9OT19XUklURSA9PSBudWxsKSB7CisgICAgICAgICAgICBQcm9ncmFtU3RvcmUuQnVpbGRlciBidWlsZGVyID0gbmV3IFByb2dyYW1TdG9yZS5CdWlsZGVyKHJzKTsKKyAgICAgICAgICAgIGJ1aWxkZXIuc2V0RGVwdGhGdW5jKFByb2dyYW1TdG9yZS5EZXB0aEZ1bmMuTEVTUyk7CisgICAgICAgICAgICBidWlsZGVyLnNldEJsZW5kRnVuYyhCbGVuZFNyY0Z1bmMuT05FLCBCbGVuZERzdEZ1bmMuWkVSTyk7CisgICAgICAgICAgICBidWlsZGVyLnNldERpdGhlckVuYWJsZShmYWxzZSk7CisgICAgICAgICAgICBidWlsZGVyLnNldERlcHRoTWFzayhmYWxzZSk7CisgICAgICAgICAgICBycy5tUHJvZ3JhbVN0b3JlX0JMRU5EX05PTkVfREVQVEhfTk9fV1JJVEUgPSBidWlsZGVyLmNyZWF0ZSgpOworICAgICAgICB9CisgICAgICAgIHJldHVybiByc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mMgPSBCbGVuZFNyY0Z1bmMuT05FOwogICAgICAgICAgICAgbUJsZW5kRHN0ID0gQmxlbmREc3RGdW5jLlpFUk87Ci0KLQogICAgICAgICB9CiAKLSAgICAgICAgcHVibGljIHZvaWQgc2V0RGVwdGhGdW5jKERlcHRoRnVuYyBmdW5jKSB7CisgICAgICAgIHB1YmxpYyBCdWlsZGVyKFJlbmRlclNjcmlwdCBycykgeworICAgICAgICAgICAgbVJTID0gcnM7CisgICAgICAgICAgICBtSW4gPSBudWxsOworICAgICAgICAgICAgbU91dCA9IG51bGw7CisgICAgICAgICAgICBtRGVwdGhGdW5jID0gRGVwdGhGdW5jLkFMV0FZUzsKKyAgICAgICAgICAgIG1EZXB0aE1hc2sgPSBmYWxzZTsKKyAgICAgICAgICAgIG1Db2xvck1hc2tSID0gdHJ1ZTsKKyAgICAgICAgICAgIG1Db2xvck1hc2tHID0gdHJ1ZTsKKyAgICAgICAgICAgIG1Db2xvck1hc2tCID0gdHJ1ZTsKKyAgICAgICAgICAgIG1Db2xvck1hc2tBID0gdHJ1ZTsKKyAgICAgICAgICAgIG1CbGVuZFNyYyA9IEJsZW5kU3JjRnVuYy5PTkU7CisgICAgICAgICAgICBtQmxlbmREc3QgPSBCbGVuZERzdEZ1bmMuWkVSTzsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBCdWlsZGVyIHNldERlcHRoRnVuYyhEZXB0aEZ1bmMgZnVuYykgewogICAgICAgICAgICAgbURlcHRoRnVuYyA9IGZ1bmM7CisgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgfQogCi0gICAgICAgIHB1YmxpYyB2b2lkIHNldERlcHRoTWFzayhib29sZWFuIGVuYWJsZSkgeworICAgICAgICBwdWJsaWMgQnVpbGRlciBzZXREZXB0aE1hc2soYm9vbGVhbiBlbmFibGUpIHsKICAgICAgICAgICAgIG1EZXB0aE1hc2sgPSBlbmFibGU7CisgICAgICAgICAgICByZXR1cm4gdGhpczsKICAgICAgICAgfQogCi0gICAgICAgIHB1YmxpYyB2b2lkIHNldENvbG9yTWFzayhib29sZWFuIHIsIGJvb2xlYW4gZywgYm9vbGVhbiBiLCBib29sZWFuIGEpIHsKKyAgICAgICAgcHVibGljIEJ1aWxkZXIgc2V0Q29sb3JNYXNrKGJvb2xlYW4gciwgYm9vbGVhbiBnLCBib29sZWFuIGIsIGJvb2xlYW4gYSkgewogICAgICAgICAgICAgbUNvbG9yTWFza1IgPSByOwogICAgICAgICAgICAgbUNvbG9yTWFza0cgPSBnOwogICAgICAgICAgICAgbUNvbG9yTWFza0IgPSBiOwogICAgICAgICAgICAgbUNvbG9yTWFza0EgPSBhOworICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgIH0KIAotICAgICAgICBwdWJsaWMgdm9pZCBzZXRCbGVuZEZ1bmMoQmxlbmRTcmNGdW5jIHNyYywgQmxlbmREc3RGdW5jIGRzdCkgeworICAgICAgICBwdWJsaWMgQnVpbGRlciBzZXRCbGVuZEZ1bmMoQmxlbmRTcmNGdW5jIHNyYywgQmxlbmREc3RGdW5jIGRzdCkgewogICAgICAgICAgICAgbUJsZW5kU3JjID0gc3JjOwogICAgICAgICAgICAgbUJsZW5kRHN0ID0gZHN0OworICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgIH0KIAotICAgICAgICBwdWJsaWMgdm9pZCBzZXREaXRoZXJFbmFibGUoYm9vbGVhbiBlbmFibGUpIHsKKyAgICAgICAgcHVibGljIEJ1aWxkZXIgc2V0RGl0aGVyRW5hYmxlKGJvb2xlYW4gZW5hYmxlKSB7CiAgICAgICAgICAgICBtRGl0aGVyID0gZW5hYmxlOworICAgICAgICAgICAgcmV0dXJuIHRoaXM7CiAgICAgICAgIH0KIAogICAgICAgICBzdGF0aWMgc3luY2hyb25pemVkIFByb2dyYW1TdG9yZSBpbnRlcm5hbENyZWF0ZShSZW5kZXJTY3JpcHQgcnMsIEJ1aWxkZXIgYikgewpAQCAtMTQ3LDE3ICsyOTYsMTcgQEAKICAgICAgICAgICAgIGlmIChiLm1PdXQgIT0gbnVsbCkgewogICAgICAgICAgICAgICAgIG91dElEID0gYi5tT3V0Lm1JRDsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJzLm5Qcm9ncmFtRnJhZ21lbnRTdG9yZUJlZ2luKGluSUQsIG91dElEKTsKLSAgICAgICAgICAgIHJzLm5Qcm9ncmFtRnJhZ21lbnRTdG9yZURlcHRoRnVuYyhiLm1EZXB0aEZ1bmMubUlEKTsKLSAgICAgICAgICAgIHJzLm5Qcm9ncmFtRnJhZ21lbnRTdG9yZURlcHRoTWFzayhiLm1EZXB0aE1hc2spOwotICAgICAgICAgICAgcnMublByb2dyYW1GcmFnbWVudFN0b3JlQ29sb3JNYXNrKGIubUNvbG9yTWFza1IsCisgICAgICAgICAgICBycy5uUHJvZ3JhbVN0b3JlQmVnaW4oaW5JRCwgb3V0SUQpOworICAgICAgICAgICAgcnMublByb2dyYW1TdG9yZURlcHRoRnVuYyhiLm1EZXB0aEZ1bmMubUlEKTsKKyAgICAgICAgICAgIHJzLm5Qcm9ncmFtU3RvcmVEZXB0aE1hc2soYi5tRGVwdGhNYXNrKTsKKyAgICAgICAgICAgIHJzLm5Qcm9ncmFtU3RvcmVDb2xvck1hc2soYi5tQ29sb3JNYXNrUiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiLm1Db2xvck1hc2tHLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIubUNvbG9yTWFza0IsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYi5tQ29sb3JNYXNrQSk7Ci0gICAgICAgICAgICBycy5uUHJvZ3JhbUZyYWdtZW50U3RvcmVCbGVuZEZ1bmMoYi5tQmxlbmRTcmMubUlELCBiLm1CbGVuZERzdC5tSUQpOwotICAgICAgICAgICAgcnMublByb2dyYW1GcmFnbWVudFN0b3JlR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RlKGRldiwgdmVyKTsKKyAgICB9CisgICAgbmF0aXZlIHZvaWQgcnNuQ29udGV4dERlc3Ryb3koaW50IGNvbik7CisgICAgc3luY2hyb25pemVkIHZvaWQgbkNvbnRleHREZXN0cm95KCkgeworICAgICAgICByc25Db250ZXh0RGVzdHJveShtQ29udGV4dCk7CisgICAgfQorICAgIG5hdGl2ZSB2b2lkIHJzbkNvbnRleHRTZXRTdXJmYWNlKGludCBjb24sIGludCB3LCBpbnQgaCwgU3VyZmFjZSBzdXIpOworICAgIHN5bmNocm9uaXplZCB2b2lkIG5Db250ZXh0U2V0U3VyZmFjZShpbnQgdywgaW50IGgsIFN1cmZhY2Ugc3VyKSB7CisgICAgICAgIHJzbkNvbnRleHRTZXRTdXJmYWNlKG1Db250ZXh0LCB3LCBoLCBzdXIpOworICAgIH0KKyAgICBuYXRpdmUgdm9pZCByc25Db250ZXh0U2V0UHJpb3JpdHkoaW50IGNvbiwgaW50IHApOworICAgIHN5bmNocm9uaXplZCB2b2lkIG5Db250ZXh0U2V0UHJpb3JpdHkoaW50IHApIHsKKyAgICAgICAgcnNuQ29udGV4dFNldFByaW9yaXR5KG1Db250ZXh0LCBwKTsKKyAgICB9CisgICAgbmF0aXZlIHZvaWQgcnNuQ29udGV4dER1bXAoaW50IGNvbiwgaW50IGJpdHMpOworICAgIHN5bmNocm9uaXplZCB2b2lkIG5Db250ZXh0RHVtcChpbnQgYml0cykgeworICAgICAgICByc25Db250ZXh0RHVtcChtQ29udGV4dCwgYml0cyk7CisgICAgfQorICAgIG5hdGl2ZSB2b2lkIHJzbkNvbnRleHRGaW5pc2goaW50IGNvbik7CisgICAgc3luY2hyb25pemVkIHZvaWQgbkNvbnRleHRGaW5pc2goKSB7CisgICAgICAgIHJzbkNvbnRleHRGaW5pc2gobUNvbnRleHQpOworICAgIH0KIAotICAgIG5hdGl2ZSB2b2lkIG5UeXBlQmVnaW4oaW50IGVsZW1lbnRJRCk7Ci0gICAgbmF0aXZlIHZvaWQgblR5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VybiByc25GaWxlT3BlbihtQ29udGV4dCwgbmFtZSk7CisgICAgfQogCi0gICAgbmF0aXZlIHZvaWQgbkFsbG9jYXRpb25VcGxvYWRUb1RleHR1cmUoaW50IGFsbG9jLCBib29sZWFuIGdlbk1pcHMsIGludCBiYXNlTWlvTGV2ZWwpOwotICAgIG5hdGl2ZSB2b2lkIG5BbGxvY2F0aW9uVXBsb2FkVG9CdWZmZXJPYmplY3QoaW50IGFsbG9jKTsKKyAgICBuYXRpdmUgaW50ICByc25FbGVtZW50Q3JlYXRlKGludCBjb24sIGludCB0eXBlLCBpbnQga2luZCwgYm9vbGVhbiBub3JtLCBpbnQgdmVjU2l6ZSk7CisgICAgc3luY2hyb25pemVkIGludCBuRWxlbWVudENyZWF0ZShpbnQgdHlwZSwgaW50IGtpbmQsIGJvb2xlYW4gbm9ybSwgaW50IHZlY1NpemUpIHsKKyAgICAgICAgcmV0dXJuIHJzbkVsZW1lbnRDcmVhdGUobUNvbnRleHQsIHR5cGUsIGtpbmQsIG5vcm0sIHZlY1NpemUpOworICAgIH0KKyAgICBuYXRpdmUgaW50ICByc25FbGVtZW50Q3JlYXRlMihpbnQgY29uLCBpbnRbXSBlbGVtZW50cywgU3RyaW5nW10gbmFtZXMsIGludFtdIGFycmF5U2l6ZXMpOworICAgIHN5bmNocm9uaXplZCBpbnQgbkVsZW1lbnRDcmVhdGUyKGludFtdIGVsZW1lbnRzLCBTdHJpbmdbXSBuYW1lcywgaW50W10gYXJyYXlTaXplcykgeworICAgICAgICByZXR1cm4gcnNuRWxlbWVudENyZWF0ZTIobUNvbnRleHQsIGVsZW1lbnRzLCBuYW1lcywgYXJyYXlTaXplcyk7CisgICAgfQorICAgIG5hdGl2ZSB2b2lkIHJzbkVsZW1lbnRHZXROYXRpdmVEYXRhKGludCBjb24sIGludCBpZCwgaW50W10gZWxlbWVudERhdGEpOworICAgIHN5bmNocm9uaXplZCB2b2lkIG5FbGVtZW50R2V0TmF0aXZlRGF0YShpbnQgaWQsI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WVzKGludCBmaWxlQTNEKSB7CisgICAgICAgIHJldHVybiByc25GaWxlQTNER2V0TnVtSW5kZXhFbnRyaWVzKG1Db250ZXh0LCBmaWxlQTNEKTsKKyAgICB9CisgICAgbmF0aXZlIHZvaWQgcnNuRmlsZUEzREdldEluZGV4RW50cmllcyhpbnQgY29uLCBpbnQgZmlsZUEzRCwgaW50IG51bUVudHJpZXMsIGludFtdIElEcywgU3RyaW5nW10gbmFtZXMpOworICAgIHN5bmNocm9uaXplZCB2b2lkIG5GaWxlQTNER2V0SW5kZXhFbnRyaWVzKGludCBmaWxlQTNELCBpbnQgbnVtRW50cmllcywgaW50W10gSURzLCBTdHJpbmdbXSBuYW1lcykgeworICAgICAgICByc25GaWxlQTNER2V0SW5kZXhFbnRyaWVzKG1Db250ZXh0LCBmaWxlQTNELCBudW1FbnRyaWVzLCBJRHMsIG5hbWVzKTsKKyAgICB9CisgICAgbmF0aXZlIGludCAgcnNuRmlsZUEzREdldEVudHJ5QnlJbmRleChpbnQgY29uLCBpbnQgZmlsZUEzRCwgaW50IGluZGV4KTsKKyAgICBzeW5jaHJvbml6ZWQgaW50IG5GaWxlQTNER2V0RW50cnlCeUluZGV4KGludCBmaWxlQTNELCBpbnQgaW5kZXgpIHsKKyAgICAgICAgcmV0dXJuIHJzbkZpbGVBM0RHZXRFbnRyeUJ5SW5kZXgobUNvbnRleHQsIGZpbGVBM0QsIGluZGV4KTsKKyAgICB9CiAKLSAgICBuYXRpdmUgdm9pZCBuU2FtcGxlckJlZ2luKCk7Ci0gICAgbmF0aXZlIHZvaWQgblNhbXBsZXJTZXQoaW50IHBhcmFtLCBpbnQgdmFsdWUpOwotICAgIG5hdGl2ZSBpbnQgIG5TYW1wbGVyQ3JlYXRlKCk7CisgICAgbmF0aXZlIGludCAgcnNuRm9udENyZWF0ZUZyb21GaWxlKGludCBjb24sIFN0cmluZyBmaWxlTmFtZSwgaW50IHNpemUsIGludCBkcGkpOworICAgIHN5bmNocm9uaXplZCBpbnQg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SB2b2lkIHJzbkFkYXB0ZXIxRFNldENvbnN0cmFpbnQoaW50IGNvbiwgaW50IGFkLCBpbnQgZGltLCBpbnQgdmFsdWUpOworICAgIHN5bmNocm9uaXplZCB2b2lkIG5BZGFwdGVyMURTZXRDb25zdHJhaW50KGludCBhZCwgaW50IGRpbSwgaW50IHZhbHVlKSB7CisgICAgICAgIHJzbkFkYXB0ZXIxRFNldENvbnN0cmFpbnQobUNvbnRleHQsIGFkLCBkaW0sIHZhbHVlKTsKKyAgICB9CisgICAgbmF0aXZlIHZvaWQgcnNuQWRhcHRlcjFERGF0YShpbnQgY29uLCBpbnQgYWQsIGludFtdIGQpOworICAgIHN5bmNocm9uaXplZCB2b2lkIG5BZGFwdGVyMUREYXRhKGludCBhZCwgaW50W10gZCkgeworICAgICAgICByc25BZGFwdGVyMUREYXRhKG1Db250ZXh0LCBhZCwgZCk7CisgICAgfQorICAgIG5hdGl2ZSB2b2lkIHJzbkFkYXB0ZXIxRERhdGEoaW50IGNvbiwgaW50IGFkLCBmbG9hdFtdIGQpOworICAgIHN5bmNocm9uaXplZCB2b2lkIG5BZGFwdGVyMUREYXRhKGludCBhZCwgZmxvYXRbXSBkKSB7CisgICAgICAgIHJzbkFkYXB0ZXIxRERhdGEobUNvbnRleHQsIGFkLCBkKTsKKyAgICB9CisgICAgbmF0aXZlIHZvaWQgcnNuQWRhcHRlcjFEU3ViRGF0YShpbnQgY29uLCBpbnQgYWQsIGludCBvZmYsIGludCBjb3VudCwgaW50W10gZCk7CisgICAgc3luY2hyb25pemVkIHZvaWQgbkFkYXB0ZXIxRFN1YkRhdGEoaW50IGFkLCBpbnQgb2ZmLCBpbnQgY291bnQsIGludFtdIGQpIHsKKyAgICAgICAgcnNuQWRhcHRlcjFEU3ViRGF0YShtQ29udGV4dCwgYWQsIG9mZiwgY291bnQsIGQpOworICAgIH0KKyAgICBuYXRpdmUgdm9pZCByc25BZGFwdGVyMURTdWJEYXRhKGludCBjb24sIGludCBhZCwgaW50IG9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jcmlwdCwgYnl0ZVtdIHRpbWVab25lKTsKKyAgICBzeW5jaHJvbml6ZWQgdm9pZCBuU2NyaXB0U2V0VGltZVpvbmUoaW50IHNjcmlwdCwgYnl0ZVtdIHRpbWVab25lKSB7CisgICAgICAgIHJzblNjcmlwdFNldFRpbWVab25lKG1Db250ZXh0LCBzY3JpcHQsIHRpbWVab25lKTsKKyAgICB9CisgICAgbmF0aXZlIHZvaWQgcnNuU2NyaXB0SW52b2tlKGludCBjb24sIGludCBpZCwgaW50IHNsb3QpOworICAgIHN5bmNocm9uaXplZCB2b2lkIG5TY3JpcHRJbnZva2UoaW50IGlkLCBpbnQgc2xvdCkgeworICAgICAgICByc25TY3JpcHRJbnZva2UobUNvbnRleHQsIGlkLCBzbG90KTsKKyAgICB9CisgICAgbmF0aXZlIHZvaWQgcnNuU2NyaXB0SW52b2tlVihpbnQgY29uLCBpbnQgaWQsIGludCBzbG90LCBieXRlW10gcGFyYW1zKTsKKyAgICBzeW5jaHJvbml6ZWQgdm9pZCBuU2NyaXB0SW52b2tlVihpbnQgaWQsIGludCBzbG90LCBieXRlW10gcGFyYW1zKSB7CisgICAgICAgIHJzblNjcmlwdEludm9rZVYobUNvbnRleHQsIGlkLCBzbG90LCBwYXJhbXMpOworICAgIH0KKyAgICBuYXRpdmUgdm9pZCByc25TY3JpcHRTZXRWYXJJKGludCBjb24sIGludCBpZCwgaW50IHNsb3QsIGludCB2YWwpOworICAgIHN5bmNocm9uaXplZCB2b2lkIG5TY3JpcHRTZXRWYXJJKGludCBpZCwgaW50IHNsb3QsIGludCB2YWwpIHsKKyAgICAgICAgcnNuU2NyaXB0U2V0VmFySShtQ29udGV4dCwgaWQsIHNsb3QsIHZhbCk7CisgICAgfQorICAgIG5hdGl2ZSB2b2lkIHJzblNjcmlwdFNldFZhckYoaW50IGNvbiwgaW50IGlkLCBpbnQgc2xvdCwgZmxvYXQgdmFsKTsKKyAgICBzeW5jaHJvbml6ZWQgdm9pZCBuU2NyaXB0U2V0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9uaXplZCBpbnQgbk1lc2hDcmVhdGUoaW50IHZ0eENvdW50LCBpbnQgaW5kZXhDb3VudCkgeworICAgICAgICByZXR1cm4gcnNuTWVzaENyZWF0ZShtQ29udGV4dCwgdnR4Q291bnQsIGluZGV4Q291bnQpOworICAgIH0KKyAgICBuYXRpdmUgdm9pZCByc25NZXNoQmluZFZlcnRleChpbnQgY29uLCBpbnQgaWQsIGludCBhbGxvYywgaW50IHNsb3QpOworICAgIHN5bmNocm9uaXplZCB2b2lkIG5NZXNoQmluZFZlcnRleChpbnQgaWQsIGludCBhbGxvYywgaW50IHNsb3QpIHsKKyAgICAgICAgcnNuTWVzaEJpbmRWZXJ0ZXgobUNvbnRleHQsIGlkLCBhbGxvYywgc2xvdCk7CisgICAgfQorICAgIG5hdGl2ZSB2b2lkIHJzbk1lc2hCaW5kSW5kZXgoaW50IGNvbiwgaW50IGlkLCBpbnQgYWxsb2MsIGludCBwcmltLCBpbnQgc2xvdCk7CisgICAgc3luY2hyb25pemVkIHZvaWQgbk1lc2hCaW5kSW5kZXgoaW50IGlkLCBpbnQgYWxsb2MsIGludCBwcmltLCBpbnQgc2xvdCkgeworICAgICAgICByc25NZXNoQmluZEluZGV4KG1Db250ZXh0LCBpZCwgYWxsb2MsIHByaW0sIHNsb3QpOworICAgIH0KKyAgICBuYXRpdmUgaW50ICByc25NZXNoR2V0VmVydGV4QnVmZmVyQ291bnQoaW50IGNvbiwgaW50IGlkKTsKKyAgICBzeW5jaHJvbml6ZWQgaW50IG5NZXNoR2V0VmVydGV4QnVmZmVyQ291bnQoaW50IGlkKSB7CisgICAgICAgIHJldHVybiByc25NZXNoR2V0VmVydGV4QnVmZmVyQ291bnQobUNvbnRleHQsIGlkKTsKKyAgICB9CisgICAgbmF0aXZlIGludCAgcnNuTWVzaEdldEluZGV4Q291bnQoaW50IGNvbiwgaW50IGlkKTsKKyAgICBzeW5jaHJvbml6ZWQgaW50IG5NZXNoR2V0SW5kZXhDb3VudChpbnQgaWQpIHs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BAIC0yNjQsMTcgKzYwNCwyNCBAQAogICAgICAgICAgICAgLy8gVGhpcyBmdW5jdGlvbiBpcyBhIHRlbXBvcmFyeSBzb2x1dGlvbi4gIFRoZSBmaW5hbCBzb2x1dGlvbiB3aWxsCiAgICAgICAgICAgICAvLyB1c2VkIHR5cGVkIGFsbG9jYXRpb25zIHdoZXJlIHRoZSBtZXNzYWdlIGlkIGlzIHRoZSB0eXBlIGluZGljYXRvci4KICAgICAgICAgICAgIGludFtdIHJidWYgPSBuZXcgaW50WzE2XTsKLSAgICAgICAgICAgIG1SUy5uQ29udGV4dEluaXRUb0NsaWVudCgpOworICAgICAgICAgICAgbVJTLm5Db250ZXh0SW5pdFRvQ2xpZW50KG1SUy5tQ29udGV4dCk7CiAgICAgICAgICAgICB3aGlsZShtUnVuKSB7Ci0gICAgICAgICAgICAgICAgaW50IG1zZyA9IG1SUy5uQ29udGV4dEdldE1lc3NhZ2UocmJ1ZiwgdHJ1ZSk7CisgICAgICAgICAgICAgICAgcmJ1ZlswXSA9IDA7CisgICAgICAgICAgICAgICAgaW50IG1zZyA9IG1SUy5uQ29udGV4dEdldE1lc3NhZ2UobVJTLm1Db250ZXh0LCByYnVmLCB0cnVlKTsKICAgICAgICAgICAgICAgICBpZiAobXNnID09IDApIHsKLSAgICAgICAgICAgICAgICAgICAgLy8gU2hvdWxkIG9ubHkgaGFwcGVuIGR1cmluZyB0ZWFyZG93bi4KLSAgICAgICAgICAgICAgICAgICAgLy8gQnV0IHdlIHdhbnQgdG8gYXZvaWQgc3RhcnZpbmcgb3RoZXIgdGhyZWFkcyBkdXJpbmcKLSAgICAgICAgICAgICAgICAgICAgLy8gdGVhcmRvd24gYnkgeWllbGRpbmcgdW50aWwgdGhlIG5leHQgbGluZSBpbiB0aGUgZGVzdHJ1Y3RvcgotICAgICAgICAgICAgICAgICAgICAvLyBjYW4gZXhlY3V0ZSB0byBzZXQgbVJ1biA9IGZhbHNlCi0gICAgICAgICAgICAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBzbGVlcCgxLCAwKTsKLSAgICAgICAgICAgICAgICAgICAgfSBjYXRjaChJbnRlcnJ1cHRlZEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgICAgIC8vIENhbiBoYXBwZW4gZm9yIHR3byByZWFzb25zCisgICAgICAgICAgICAgICAgICAgIGlmIChyYnVmWzBdID4gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgLy8gMTogQnVmZmVyIG5lZWRzIHRvIGJlIGVubGFyZ2VkLgorICAgICAgICAgICAgICAgICAgICAgICAgcmJ1ZiA9IG5ldyBpbnRbcmJ1ZlswXSArIDJdOworICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgLy8gMjogdGVhcmRvd24uCisgICAgICAgICAgICAgICAgICAgICAgICAvLyBCdXQgd2Ugd2FudCB0byBhdm9pZCBzdGFydmluZyBvdGhlciB0aHJlYWRzIGR1cmluZworICAgICAgICAgICAgICAgICAgICAgICAgLy8gdGVhcmRvd24gYnkgeWllbGRpbmcgdW50aWwgdGhlIG5leHQgbGluZSBpbiB0aGUgZGVzdHJ1Y3RvcgorICAgICAgICAgICAgICAgICAgICAgICAgLy8gY2FuIGV4ZWN1dGUgdG8gc2V0IG1SdW4gPSBmYWxzZQorICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzbGVlcCgxLCAwKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2goSW50ZXJydXB0ZWRFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGlmKG1SUy5tTWVzc2FnZUNhbGxiYWNrICE9IG51bGwpIHsKQEAgLTI4Miw3ICs2MjksNiBAQAogICAgICAgICAgICAgICAgICAgICBtUlMubU1lc3NhZ2VDYWxsYmFjay5tSUQgPSBtc2c7CiAgICAgICAgICAgICAgICAgICAgIG1SUy5tTWVzc2FnZUNhbGxiYWNrLnJ1bigpOwogICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAvL0xvZy5kKExPR19UQUcsICJNZXNzYWdlVGhyZWFkIG1zZyAiICsgbXNnICsgIiB2MSAiICsgcmJ1ZlswXSArICIgdjIgIiArIHJidWZbMV0gKyAiIHYzICIgK3JidWZbMl0pOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIk1lc3NhZ2VUaHJlYWQgZXhpdGluZy4iKTsKICAgICAgICAgfQpAQCAtMzA3LDEyICs2NTMsMTYgQEAKICAgICAgICAgbkNvbnRleHREdW1wKGJpdHMpOwogICAgIH0KIAorICAgIHB1YmxpYyB2b2lkIGZpbmlzaCgpIHsKKyAgICAgICAgbkNvbnRleHRGaW5pc2goKTsKKyAgICB9CisKICAgICBwdWJsaWMgdm9pZCBkZXN0cm95KCkgewogICAgICAgICB2YWxpZGF0ZSgpOwotICAgICAgICBuQ29udGV4dERlaW5pdFRvQ2xpZW50KCk7CisgICAgICAgIG5Db250ZXh0RGVpbml0VG9DbGllbnQobUNvbnRleHQpOwogICAgICAgICBtTWVzc2FnZVRocmVhZC5tUnVuID0gZmFsc2U7CiAKLSAgICAgICAgbkNvbnRleHREZXN0cm95KG1Db250ZXh0KTsKKyAgICAgICAgbkNvbnRleHREZXN0cm95KCk7CiAgICAgICAgIG1Db250ZXh0ID0gMDsKIAogICAgICAgICBuRGV2aWNlRGVzdHJveShtRGV2KTsKQEAgLTMzNSwzICs2ODUsNCBAQAogfQogCiAKKwpkaWZmIC0tZ2l0IGEvZ3JhcGhpY3MvamF2YS9hbmRyb2lkL3JlbmRlcnNjcmlwdC9SZW5kZXJTY3JpcHRHTC5qYXZhIGIvZ3JhcGhpY3MvamF2YS9hbmRyb2lkL3JlbmRlcnNjcmlwdC9SZW5kZXJTY3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jcmlwdCBycykgeworICAgICAgICBpZihycy5tU2FtcGxlcl9XUkFQX05FQVJFU1QgPT0gbnVsbCkgeworICAgICAgICAgICAgQnVpbGRlciBiID0gbmV3IEJ1aWxkZXIocnMpOworICAgICAgICAgICAgYi5zZXRNaW4oVmFsdWUuTkVBUkVTVCk7CisgICAgICAgICAgICBiLnNldE1hZyhWYWx1ZS5ORUFSRVNUKTsKKyAgICAgICAgICAgIGIuc2V0V3JhcFMoVmFsdWUuV1JBUCk7CisgICAgICAgICAgICBiLnNldFdyYXBUKFZhbHVlLldSQVApOworICAgICAgICAgICAgcnMubVNhbXBsZXJfV1JBUF9ORUFSRVNUID0gYi5jcmVhdGUoKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gcnMubVNhbXBsZXJfV1JBUF9ORUFSRVNUOworICAgIH0KKworICAgIHB1YmxpYyBzdGF0aWMgU2FtcGxlciBXUkFQX0xJTkVBUihSZW5kZXJTY3JpcHQgcnMpIHsKKyAgICAgICAgaWYocnMubVNhbXBsZXJfV1JBUF9MSU5FQVIgPT0gbnVsbCkgeworICAgICAgICAgICAgQnVpbGRlciBiID0gbmV3IEJ1aWxkZXIocnMpOworICAgICAgICAgICAgYi5zZXRNaW4oVmFsdWUuTElORUFSKTsKKyAgICAgICAgICAgIGIuc2V0TWFnKFZhbHVlLkxJTkVBUik7CisgICAgICAgICAgICBiLnNldFdyYXBTKFZhbHVlLldSQVApOworICAgICAgICAgICAgYi5zZXRXcmFwVChWYWx1ZS5XUkFQKTsKKyAgICAgICAgICAgIHJzLm1TYW1wbGVyX1dSQVBfTElORUFSID0gYi5jcmVhdGUoKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gcnMubVNhbXBsZXJfV1JBUF9MSU5FQVI7CisgICAgfQorCisgICAgcHVibGljIHN0YXRpYyBTYW1wbGVyIFdSQVBfTElORUFSX01JUF9MSU5FQVIoUmVuZGVyU2NyaXB0IHJzKSB7CisgICAgICAgIGlmKHJzLm1TYW1wbGVyX1dSQVBfTElORUFSX01JUF9MSU5FQVIgPT0gbnVsbCkgeworICAgICAgICAgICAgQnVpbGRlciBiID0gbmV3IEJ1aWxkZXIocnMpOworICAgICAgICAgICAgYi5zZXRNaW4oVmFsdWUuTElORUFSX01JUF9MSU5FQVIpOworICAgICAgICAgICAgYi5zZXRNYWcoVmFsdWUuTElORUFSKTsKKyAgICAgICAgICAgIGIuc2V0V3JhcFMoVmFsdWUuV1JBUCk7CisgICAgICAgICAgICBiLnNldFdyYXBUKFZhbHVlLldSQVApOworICAgICAgICAgICAgcnMubVNhbXBsZXJfV1JBUF9MSU5FQVJfTUlQX0xJTkVBUiA9IGIuY3JlYXRlKCk7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHJzLm1TYW1wbGVyX1dSQVBfTElORUFSX01JUF9MSU5FQVI7CisgICAgfQorCisKICAgICBwdWJsaWMgc3RhdGljIGNsYXNzIEJ1aWxkZXIgewogICAgICAgICBSZW5kZXJTY3JpcHQgbVJTOwogICAgICAgICBWYWx1ZSBtTWluOwpkaWZmIC0tZ2l0IGEvZ3JhcGhpY3MvamF2YS9hbmRyb2lkL3JlbmRlcnNjcmlwdC9TY3JpcHQuamF2YSBiL2dyYXBoaWNzL2phdmEvYW5kcm9pZC9yZW5kZXJzY3JpcHQvU2NyaXB0LmphdmEKaW5kZXggNTdjY2ZhMy4uMTljNDQ0YyAxMDA2NDQKLS0tIGEvZ3JhcGhpY3MvamF2YS9hbmRyb2lkL3JlbmRlcnNjcmlwdC9TY3JpcHQuamF2YQorKysgYi9ncmFwaGljcy9qYXZhL2FuZHJvaWQvcmVuZGVyc2NyaXB0L1NjcmlwdC5qYXZhCkBAIC00MiwyOSArNDIsNDYgQEAKICAgICAgICAgfQogICAgIH0KIAorICAgIHByb3RlY3RlZCB2b2lkIGludm9rZShpbnQgc2xvdCkgeworICAgICAgICBtUlMublNjcmlwdEludm9rZShtSUQsIHNsb3QpOworICAgIH0KKworICAgIHByb3RlY3RlZCB2b2lkIGludm9rZShpbnQgc2xvdCwgRmllbGRQYWNrZXIgdikgeworICAgICAgICBpZiAodiAhPSBudWxsKSB7CisgICAgICAgICAgICBtUlMublNjcmlwdEludm9rZVYobUlELCBzbG90LCB2LmdldERhdGEoKSk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBtUlMublNjcmlwdEludm9rZShtSUQsIHNsb3QpOworICAgICAgICB9CisgICAgfQorCisKICAgICBTY3JpcHQoaW50IGlkLCBSZW5kZXJTY3JpcHQgcnMpIHsKLSAgICAgICAgc3VwZXIocnMpOwotICAgICAgICBtSUQgPSBpZDsKKyAgICAgICAgc3VwZXIoaWQsIHJzKTsKICAgICB9CiAKICAgICBwdWJsaWMgdm9pZCBiaW5kQWxsb2NhdGlvbihBbGxvY2F0aW9uIHZhLCBpbnQgc2xvdCkgewogICAgICAgICBtUlMudmFsaWRhdGUoKTsKLSAgICAgICAgbVJTLm5TY3JpcHRCaW5kQWxsb2NhdGlvbihtSUQsIHZhLm1JRCwgc2xvdCk7CisgICAgICAgIGlmICh2YSAhPSBudWxsKSB7CisgICAgICAgICAgICBtUlMublNjcmlwdEJpbmRBbGxvY2F0aW9uKG1JRCwgdmEubUlELCBzbG90KTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIG1SUy5uU2NyaXB0QmluZEFsbG9jYXRpb24obUlELCAwLCBzbG90KTsKKyAgICAgICAgfQogICAgIH0KIAotICAgIHB1YmxpYyB2b2lkIHNldENsZWFyQ29sb3IoZmxvYXQgciwgZmxvYXQgZywgZmxvYXQgYiwgZmxvYXQgYSkgewotICAgICAgICBtUlMudmFsaWRhdGUoKTsKLSAgICAgICAgbVJTLm5TY3JpcHRTZXRDbGVhckNvbG9yKG1JRCwgciwgZywgYiwgYSk7CisgICAgcHVibGljIHZvaWQgc2V0VmFyKGludCBpbmRleCwgZmxvYXQgdikgeworICAgICAgICBtUlMublNjcmlwdFNldFZhckYobUlELCBpbmRleCwgdik7CiAgICAgfQogCi0gICAgcHVibGljIHZvaWQgc2V0Q2xlYXJEZXB0aChmbG9hdCBkKSB7Ci0gICAgICAgIG1SUy52YWxpZGF0ZSgpOwotICAgICAgICBtUlMublNjcmlwdFNldENsZWFyRGVwdGgobUlELCBkKTsKKyAgICBwdWJsaWMgdm9pZCBzZXRWYXIoaW50IGluZGV4LCBpbnQgdikgeworICAgICAgICBtUlMublNjcmlwdFNldFZhckkobUlELCBpbmRleCwgdik7CiAgICAgfQogCi0gICAgcHVibGljIHZvaWQgc2V0Q2xlYXJTdGVuY2lsKGludCBzdGVuY2lsKSB7Ci0gICAgICAgIG1SUy52YWxpZGF0ZSgpOwotICAgICAgICBtUlMublNjcmlwdFNldENsZWFyU3RlbmNpbChtSUQsIHN0ZW5jaWwpOworICAgIHB1YmxpYyB2b2lkIHNldFZhcihpbnQgaW5kZXgsIGJvb2xlYW4gdikgeworICAgICAgICBtUlMublNjcmlwdFNldFZhckkobUlELCBpbmRleCwgdiA/IDEgOiAwKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBzZXRWYXIoaW50IGluZGV4LCBGaWVsZFBhY2tlciB2KSB7CisgICAgICAgIG1SUy5uU2NyaXB0U2V0VmFyVihtSUQsIGluZGV4LCB2LmdldERhdGEoKSk7CiAgICAgfQogCiAgICAgcHVibGljIHZvaWQgc2V0VGltZVpvbmUoU3RyaW5nIHRpbWVab25lKSB7CkBAIC03OCw3MiArOTUsNTQgQEAKIAogICAgIHB1YmxpYyBzdGF0aWMgY2xhc3MgQnVpbGRlciB7CiAgICAgICAgIFJlbmRlclNjcmlwdCBtUlM7Ci0gICAgICAgIGJvb2xlYW4gbUlzUm9vdCA9IGZhbHNlOwotICAgICAgICBUeXBlW10gbVR5cGVzOwotICAgICAgICBTdHJpbmdbXSBtTmFtZXM7Ci0gICAgICAgIGJvb2xlYW5bXSBtV3JpdGFibGU7Ci0gICAgICAgIGludCBtSW52b2thYmxlQ291bnQgPSAwOwotICAgICAgICBJbnZva2FibGVbXSBtSW52b2thYmxlczsKIAogICAgICAgICBCdWlsZGVyKFJlbmRlclNjcmlwdCBycykgewogICAgICAgICAgICAgbVJTID0gcnM7Ci0gICAgICAgICAgICBtVHlwZXMgPSBuZXcgVHlwZVtNQVhfU0xPVF07Ci0gICAgICAgICAgICBtTmFtZXMgPSBuZXcgU3RyaW5nW01BWF9TTE9UXTsKLSAgICAgICAgICAgIG1Xcml0YWJsZSA9IG5ldyBib29sZWFuW01BWF9TTE9UXTsKLSAgICAgICAgICAgIG1JbnZva2FibGVzID0gbmV3IEludm9rYWJsZVtNQVhfU0xPVF07CiAgICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgdm9pZCBzZXRUeXBlKFR5cGUgdCwgaW50IHNsb3QpIHsKLSAgICAgICAgICAgIG1UeXBlc1tzbG90XSA9IHQ7Ci0gICAgICAgICAgICBtTmFtZXNbc2xvdF0gPSBudWxsOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIHZvaWQgc2V0VHlwZShUeXBlIHQsIFN0cmluZyBuYW1lLCBpbnQgc2xvdCkgewotICAgICAgICAgICAgbVR5cGVzW3Nsb3RdID0gdDsKLSAgICAgICAgICAgIG1OYW1lc1tzbG90XSA9IG5hbWU7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgSW52b2thYmxlIGFkZEludm9rYWJsZShTdHJpbmcgZnVuYykgewotICAgICAgICAgICAgSW52b2thYmxlIGkgPSBuZXcgSW52b2thYmxlKCk7Ci0gICAgICAgICAgICBpLm1OYW1lID0gZnVuYzsKLSAgICAgICAgICAgIGkubVJTID0gbVJTOwotICAgICAgICAgICAgaS5tU2xvdCA9IG1JbnZva2FibGVDb3VudDsKLSAgICAgICAgICAgIG1JbnZva2FibGVzW21JbnZva2FibGVDb3VudCsrXSA9IGk7Ci0gICAgICAgICAgICByZXR1cm4gaTsKLSAgICAgICAgfQotCi0gICAgICAgIHB1YmxpYyB2b2lkIHNldFR5cGUoYm9vbGVhbiB3cml0YWJsZSwgaW50IHNsb3QpIHsKLSAgICAgICAgICAgIG1Xcml0YWJsZVtzbG90XSA9IHdyaXRhYmxlOwotICAgICAgICB9Ci0KLSAgICAgICAgdm9pZCB0cmFuc2ZlckNyZWF0ZSgpIHsKLSAgICAgICAgICAgIG1SUy5uU2NyaXB0U2V0Um9vdChtSXNSb290KTsKLSAgICAgICAgICAgIGZvcihpbnQgY3Q9MDsgY3QgPCBtVHlwZXMubGVuZ3RoOyBjdCsrKSB7Ci0gICAgICAgICAgICAgICAgaWYobVR5cGVzW2N0XSAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1SUy5uU2NyaXB0U2V0VHlwZShtVHlwZXNbY3RdLm1JRCwgbVdyaXRhYmxlW2N0XSwgbU5hbWVzW2N0XSwgY3QpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGZvcihpbnQgY3Q9MDsgY3QgPCBtSW52b2thYmxlQ291bnQ7IGN0KyspIHsKLSAgICAgICAgICAgICAgICBtUlMublNjcmlwdFNldEludm9rYWJsZShtSW52b2thYmxlc1tjdF0ubU5hbWUsIGN0KTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIHZvaWQgdHJhbnNmZXJPYmplY3QoU2NyaXB0IHMpIHsKLSAgICAgICAgICAgIHMubUlzUm9vdCA9IG1Jc1Jvb3Q7Ci0gICAgICAgICAgICBzLm1UeXBlcyA9IG1UeXBlczsKLSAgICAgICAgICAgIHMubUludm9rYWJsZXMgPSBuZXcgSW52b2thYmxlW21JbnZva2FibGVDb3VudF07Ci0gICAgICAgICAgICBmb3IoaW50IGN0PTA7IGN0IDwgbUludm9rYWJsZUNvdW50OyBjdCsrKSB7Ci0gICAgICAgICAgICAgICAgcy5tSW52b2thYmxlc1tjdF0gPSBtSW52b2thYmxlc1tjdF07Ci0gICAgICAgICAgICAgICAgcy5tSW52b2thYmxlc1tjdF0ubVNjcmlwdCA9IHM7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBzLm1JbnZva2FibGVzID0gbnVsbDsKLSAgICAgICAgfQotCi0gICAgICAgIHB1YmxpYyB2b2lkIHNldFJvb3QoYm9vbGVhbiByKSB7Ci0gICAgICAgICAgICBtSXNSb290ID0gcjsKLSAgICAgICAgfQotCiAgICAgfQogCisKKyAgICBwdWJsaWMgc3RhdGljIGNsYXNzIEZpZWxkQmFzZSB7CisgICAgICAgIHByb3RlY3RlZCBFbGVtZW50IG1FbGVtZW50OworICAgICAgICBwcm90ZWN0ZWQgVHlwZSBtVHlwZTsKKyAgICAgICAgcHJvdGVjdGVkIEFsbG9jYXRpb24gbUFsbG9jYXRpb247CisKKyAgICAgICAgcHJvdGVjdGVkIHZvaWQgaW5pdChSZW5kZXJTY3JpcHQgcnMsIGludCBkaW14KSB7CisgICAgICAgICAgICBtQWxsb2NhdGlvbiA9IEFsbG9jYXRpb24uY3JlYXRlU2l6ZWQocnMsIG1FbGVtZW50LCBkaW14KTsKKyAgICAgICAgICAgIG1UeXBlID0gbUFsbG9jYXRpb24uZ2V0VHlwZSgpOworICAgICAgICB9CisKKyAgICAgICAgcHJvdGVjdGVkIEZpZWxkQmFzZSgpIHsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBFbGVtZW50IGdldEVsZW1lbnQoKSB7CisgICAgICAgICAgICByZXR1cm4gbUVsZW1lbnQ7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgVHlwZSBnZXRUeXBlKCkgeworICAgICAgICAgICAgcmV0dXJuIG1UeXBlOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIEFsbG9jYXRpb24gZ2V0QWxsb2NhdGlvbigpIHsKKyAgICAgICAgICAgIHJldHVybiBtQWxsb2NhdGlvbjsKKyAgICAgICAgfQorCisgICAgICAgIC8vQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIHVwZGF0ZUFsbG9jYXRpb24oKSB7CisgICAgICAgIH0KKworCisgICAgICAgIC8vCisgICAg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FtIGlzID0gcmVzb3VyY2VzLm9wZW5SYXdSZXNvdXJjZShyZXNvdXJjZUlEKTsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgcGdtID0gbmV3IGJ5dGVbMTAyNF07CisgICAgICAgICAgICAgICAgcGdtTGVuZ3RoID0gMDsKKyAgICAgICAgICAgICAgICB3aGlsZSh0cnVlKSB7CisgICAgICAgICAgICAgICAgICAgIGludCBieXRlc0xlZnQgPSBwZ20ubGVuZ3RoIC0gcGdtTGVuZ3RoOworICAgICAgICAgICAgICAgICAgICBpZiAoYnl0ZXNMZWZ0ID09IDApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJ5dGVbXSBidWYyID0gbmV3IGJ5dGVbcGdtLmxlbmd0aCAqIDJdOworICAgICAgICAgICAgICAgICAgICAgICAgU3lzdGVtLmFycmF5Y29weShwZ20sIDAsIGJ1ZjIsIDAsIHBnbS5sZW5ndGgpOworICAgICAgICAgICAgICAgICAgICAgICAgcGdtID0gYnVmMjsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJ5dGVzTGVmdCA9IHBnbS5sZW5ndGggLSBwZ21MZW5ndGg7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgaW50IGJ5dGVzUmVhZCA9IGlzLnJlYWQocGdtLCBwZ21MZW5ndGgsIGJ5dGVzTGVmdCk7CisgICAgICAgICAgICAgICAgICAgIGlmIChieXRlc1JlYWQgPD0gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgcGdtTGVuZ3RoICs9IGJ5dGVzUmVhZDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGZpbmFsbHkgeworICAgICAgICAgICAgICAgIGlzLmNsb3NlKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0gY2F0Y2goSU9FeGNlcHRpb24gZSkgeworICAgICAgICAgICAgdGhyb3cgbmV3IFJlc291cmNlcy5Ob3RGb3VuZEV4Y2VwdGlvbigpOworICAgICAgICB9CisKKyAgICAgICAgcnMublNjcmlwdENCZWdpbigpOworICAgICAgICBycy5uU2NyaXB0Q1NldFNjcmlwdChwZ20sIDAsIHBnbUxlbmd0aCk7CisgICAgICAgIHJldHVybiBycy5uU2NyaXB0Q0NyZWF0ZSgpOworICAgIH0KKwogICAgIHB1YmxpYyBzdGF0aWMgY2xhc3MgQnVpbGRlciBleHRlbmRzIFNjcmlwdC5CdWlsZGVyIHsKICAgICAgICAgYnl0ZVtdIG1Qcm9ncmFtOwogICAgICAgICBpbnQgbVByb2dyYW1MZW5ndGg7Ci0gICAgICAgIEhhc2hNYXA8U3RyaW5nLEludGVnZXI+IG1JbnREZWZpbmVzID0gbmV3IEhhc2hNYXAoKTsKLSAgICAgICAgSGFzaE1hcDxTdHJpbmcsRmxvYXQ+IG1GbG9hdERlZmluZXMgPSBuZXcgSGFzaE1hcCgpOwogCiAgICAgICAgIHB1YmxpYyBCdWlsZGVyKFJlbmRlclNjcmlwdCBycykgewogICAgICAgICAgICAgc3VwZXIocnMpOwpAQCAtOTIsNjYgKzEzMCwyMCBAQAogCiAgICAgICAgIHN0YXRpYyBzeW5jaHJvbml6ZWQgU2NyaXB0QyBpbnRlcm5hbENyZWF0ZShCdWlsZGVyIGIpIHsKICAgICAgICAgICAgIGIubVJTLm5TY3JpcHRDQmVnaW4oKTsKLSAgICAgICAgICAgIGIudHJhbnNmZXJDcmVhdGUoKTsKIAotICAgICAgICAgICAgZm9yIChFbnRyeTxTdHJpbmcsSW50ZWdlcj4gZTogYi5tSW50RGVmaW5lcy5lbnRyeVNldCgpKSB7Ci0gICAgICAgICAgICAgICAgYi5tUlMublNjcmlwdENBZGREZWZpbmVJMzIoZS5nZXRLZXkoKSwgZS5nZXRWYWx1ZSgpLmludFZhbHVlKCkpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZm9yICh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ZpZWxkIGFzIHRoZSBuYW1lIG9mIHRoZSBkZWZpbmUuCi0gICAgICAgICAqLwotICAgICAgICBwdWJsaWMgdm9pZCBhZGREZWZpbmVzKENsYXNzIGNsKSB7Ci0gICAgICAgICAgICBhZGREZWZpbmVzKGNsLmdldEZpZWxkcygpLCAoTW9kaWZpZXIuU1RBVElDIHwgTW9kaWZpZXIuRklOQUwgfCBNb2RpZmllci5QVUJMSUMpLCBudWxsKTsKLSAgICAgICAgfQotCi0gICAgICAgIC8qKgotICAgICAgICAgKiBUYWtlcyB0aGUgYWxsIHB1YmxpYyBmaWVsZHMgZm9yIGFuIG9iamVjdCwgYW5kIGFkZHMgZGVmaW5lcwotICAgICAgICAgKiBmb3IgdGhlbSwgdXNpbmcgdGhlIG5hbWUgb2YgdGhlIGZpZWxkIGFzIHRoZSBuYW1lIG9mIHRoZSBkZWZpbmUuCi0gICAgICAgICAqLwotICAgICAgICBwdWJsaWMgdm9pZCBhZGREZWZpbmVzKE9iamVjdCBvKSB7Ci0gICAgICAgICAgICBhZGREZWZpbmVzKG8uZ2V0Q2xhc3MoKS5nZXRGaWVsZHMoKSwgTW9kaWZpZXIuUFVCTElDLCBvKTsKLSAgICAgICAgfQotCi0gICAgICAgIHZvaWQgYWRkRGVmaW5lcyhGaWVsZFtdIGZpZWxkcywgaW50IG1hc2ssIE9iamVjdCBvKSB7Ci0gICAgICAgICAgICBmb3IgKEZpZWxkIGY6IGZpZWxkcykgewotICAgICAgICAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmICgoZi5nZXRNb2RpZmllcnMoKSAmIG1hc2spID09IG1hc2spIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIENsYXNzIHQgPSBmLmdldFR5cGUoKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0ID09IGludC5jbGFzcykgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1JbnREZWZpbmVzLnB1dChmLmdldE5hbWUoKSwgZi5nZXRJbnQobykpOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAodCA9PSBmbG9hdC5jbGFzcykgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1GbG9hdERlZmluZXMucHV0KGYuZ2V0TmFtZSgpLCBmLmdldEZsb2F0KG8pKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0gY2F0Y2ggKElsbGVnYWxBY2Nlc3NFeGNlcHRpb24gZXgpIHsKLSAgICAgICAgICAgICAgICAgICAgLy8gVE9ETzogRG8gd2Ugd2FudCB0aGlzIGxvZz8KLSAgICAgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAiYWRkRGVmaW5lcyBza2lwcGluZyBmaWVsZCAiICsgZi5nZXROYW1lKCkpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfQorICAgICAgICBwdWJsaWMgdm9pZCBhZGREZWZpbmUoU3RyaW5nIG5hbWUsIGludCB2YWx1ZSkge30KKyAgICAgICAgcHVibGljIHZvaWQgYWRkRGVmaW5lKFN0cmluZyBuYW1lLCBmbG9hdCB2YWx1ZSkge30KKyAgICAgICAgcHVibGljIHZvaWQgYWRkRGVmaW5lcyhDbGFzcyBjbCkge30KKyAgICAgICAgcHVibGljIHZvaWQgYWRkRGVmaW5lcyhPYmplY3Qgbykge30KKyAgICAgICAgdm9pZCBhZGREZWZpbmVzKEZpZWxkW10gZmllbGRzLCBpbnQgbWFzaywgT2JqZWN0IG8pIHt9CiAKICAgICAgICAgcHVibGljIFNjcmlwdEMgY3JlYXRlKCkgewogICAgICAgICAgICAgcmV0dXJuIGludGVybmFsQ3JlYXRlKHRoaXMpOwpkaWZmIC0tZ2l0IGEvZ3JhcGhpY3MvamF2YS9hbmRyb2lkL3JlbmRlcnNjcmlwdC9TaG9ydDIuamF2YSBiL2dyYXBoaWNzL2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lc1ttVmVydGV4VHlwZUNvdW50XSA9IG5ldyBFbnRyeSgpOwotICAgICAgICAgICAgbVZlcnRleFR5cGVzW21WZXJ0ZXhUeXBlQ291bnRdLmUgPSBlOwotICAgICAgICAgICAgbVZlcnRleFR5cGVzW21WZXJ0ZXhUeXBlQ291bnRdLnNpemUgPSBzaXplOwotICAgICAgICAgICAgbVZlcnRleFR5cGVDb3VudCsrOwotICAgICAgICAgICAgcmV0dXJuIGFkZGVkSW5kZXg7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgdm9pZCBzZXRJbmRleFR5cGUoVHlwZSB0KSB7Ci0gICAgICAgICAgICBtSW5kZXhUeXBlLnQgPSB0OwotICAgICAgICAgICAgbUluZGV4VHlwZS5lID0gbnVsbDsKLSAgICAgICAgICAgIG1JbmRleFR5cGUuc2l6ZSA9IDA7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgdm9pZCBzZXRJbmRleFR5cGUoRWxlbWVudCBlLCBpbnQgc2l6ZSkgewotICAgICAgICAgICAgbUluZGV4VHlwZS50ID0gbnVsbDsKLSAgICAgICAgICAgIG1JbmRleFR5cGUuZSA9IGU7Ci0gICAgICAgICAgICBtSW5kZXhUeXBlLnNpemUgPSBzaXplOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIHZvaWQgc2V0UHJpbWl0aXZlKFByaW1pdGl2ZSBwKSB7Ci0gICAgICAgICAgICBtUHJpbWl0aXZlID0gcDsKLSAgICAgICAgfQotCi0KLSAgICAgICAgVHlwZSBuZXdUeXBlKEVsZW1lbnQgZSwgaW50IHNpemUpIHsKLSAgICAgICAgICAgIFR5cGUuQnVpbGRlciB0YiA9IG5ldyBUeXBlLkJ1aWxkZXIobVJTLCBlKTsKLSAgICAgICAgICAgIHRiLmFkZChEaW1lbnNpb24uWCwgc2l6ZSk7Ci0gICAgICAgICAgICByZXR1cm4gdGIuY3JlYXRlKCk7Ci0gICAgICAgIH0KLQotICAgICAgICBzdGF0aWMgc3luY2hyb25pemVkIFNpbXBsZU1lc2ggaW50ZXJuYWxDcmVhdGUoUmVuZGVyU2NyaXB0IHJzLCBCdWlsZGVyIGIpIHsKLSAgICAgICAgICAgIFR5cGVbXSB0b0Rlc3Ryb3kgPSBuZXcgVHlwZVsxOF07Ci0gICAgICAgICAgICBpbnQgdG9EZXN0cm95Q291bnQgPSAwOwotCi0gICAgICAgICAgICBpbnQgaW5kZXhJRCA9IDA7Ci0gICAgICAgICAgICBpZiAoYi5tSW5kZXhUeXBlLnQgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIGluZGV4SUQgPSBiLm1JbmRleFR5cGUudC5tSUQ7Ci0gICAgICAgICAgICB9IGVsc2UgaWYgKGIubUluZGV4VHlwZS5zaXplICE9IDApIHsKLSAgICAgICAgICAgICAgICBiLm1JbmRleFR5cGUudCA9IGIubmV3VHlwZShiLm1JbmRleFR5cGUuZSwgYi5tSW5kZXhUeXBlLnNpemUpOwotICAgICAgICAgICAgICAgIGluZGV4SUQgPSBiLm1JbmRleFR5cGUudC5tSUQ7Ci0gICAgICAgICAgICAgICAgdG9EZXN0cm95W3RvRGVzdHJveUNvdW50KytdID0gYi5tSW5kZXhUeXBlLnQ7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGludFtdIElEcyA9IG5ldyBpbnRbYi5tVmVydGV4VHlwZUNvdW50XTsKLSAgICAgICAgICAgIGZvcihpbnQgY3Q9MDsgY3QgPCBiLm1WZXJ0ZXhUeXBlQ291bnQ7IGN0KyspIHsKLSAgICAgICAgICAgICAgICBpZiAoYi5tVmVydGV4VHlwZXNbY3RdLnQgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICBJRHNbY3RdID0gYi5tVmVydGV4VHlwZXNbY3RdLnQubUlEOwotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIGIubVZlcnRleFR5cGVzW2N0XS50ID0gYi5uZXdUeXBlKGIubVZlcnRleFR5cGVz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W1pdGl2ZTsKLSAgICAgICAgICAgIHJldHVybiBzbTsKLSAgICAgICAgfQotICAgIH0KLQotICAgIHB1YmxpYyBzdGF0aWMgY2xhc3MgVHJpYW5nbGVNZXNoQnVpbGRlciB7Ci0gICAgICAgIGZsb2F0IG1WdHhEYXRhW107Ci0gICAgICAgIGludCBtVnR4Q291bnQ7Ci0gICAgICAgIHNob3J0IG1JbmRleERhdGFbXTsKLSAgICAgICAgaW50IG1JbmRleENvdW50OwotICAgICAgICBSZW5kZXJTY3JpcHQgbVJTOwotICAgICAgICBFbGVtZW50IG1FbGVtZW50OwotCi0gICAgICAgIGZsb2F0IG1OWCA9IDA7Ci0gICAgICAgIGZsb2F0IG1OWSA9IDA7Ci0gICAgICAgIGZsb2F0IG1OWiA9IC0xOwotICAgICAgICBmbG9hdCBtUzAgPSAwOwotICAgICAgICBmbG9hdCBtVDAgPSAwOwotICAgICAgICBmbG9hdCBtUiA9IDE7Ci0gICAgICAgIGZsb2F0IG1HID0gMTsKLSAgICAgICAgZmxvYXQgbUIgPSAxOwotICAgICAgICBmbG9hdCBtQSA9IDE7Ci0KLSAgICAgICAgaW50IG1WdHhTaXplOwotICAgICAgICBpbnQgbUZsYWdzOwotCi0gICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IENPTE9SID0gMHgwMDAxOwotICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBOT1JNQUwgPSAweDAwMDI7Ci0gICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IFRFWFRVUkVfMCA9IDB4MDEwMDsKLQotICAgICAgICBwdWJsaWMgVHJpYW5nbGVNZXNoQnVpbGRlcihSZW5kZXJTY3JpcHQgcnMsIGludCB2dHhTaXplLCBpbnQgZmxhZ3MpIHsKLSAgICAgICAgICAgIG1SUyA9IHJzOwotICAgICAgICAgICAgbVZ0eENvdW50ID0gMDsKLSAgICAgICAgICAgIG1JbmRleENvdW50ID0gMDsKLSAgICAgICAgICAgIG1WdHhEYXRhID0gbmV3IGZsb2F0WzEyOF07Ci0gICAgICAgICAgICBtSW5kZXhEYXRhID0gbmV3IHNob3J0WzEyOF07Ci0gICAgICAgICAgICBtVnR4U2l6ZSA9IHZ0eFNpemU7Ci0gICAgICAgICAgICBtRmxhZ3MgPSBmbGFnczsKLQotICAgICAgICAgICAgaWYgKHZ0eFNpemUgPCAyIHx8IHZ0eFNpemUgPiAzKSB7Ci0gICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiVmVydGV4IHNpemUgb3V0IG9mIHJhbmdlLiIpOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgcHJpdmF0ZSB2b2lkIG1ha2VTcGFjZShpbnQgY291bnQpIHsKLSAgICAgICAgICAgIGlmICgobVZ0eENvdW50ICsgY291bnQpID49IG1WdHhEYXRhLmxlbmd0aCkgewotICAgICAgICAgICAgICAgIGZsb2F0IHRbXSA9IG5ldyBmbG9hdFttVnR4RGF0YS5sZW5ndGggKiAyXTsKLSAgICAgICAgICAgICAgICBTeXN0ZW0uYXJyYXljb3B5KG1WdHhEYXRhLCAwLCB0LCAwLCBtVnR4RGF0YS5sZW5ndGgpOwotICAgICAgICAgICAgICAgIG1WdHhEYXRhID0gdDsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIHByaXZhdGUgdm9pZCBsYXRjaCgpIHsKLSAgICAgICAgICAgIGlmICgobUZsYWdzICYgQ09MT1IpICE9IDApIHsKLSAgICAgICAgICAgICAgICBtYWtlU3BhY2UoNCk7Ci0gICAgICAgICAgICAgICAgbVZ0eERhdGFbbVZ0eENvdW50KytdID0gbVI7Ci0gICAgICAgICAgICAgICAgbVZ0eERhdGFbbVZ0eENvdW50KytdID0gbUc7Ci0gICAgICAgICAgICAgICAgbVZ0eERhdGFbbVZ0eENvdW50KytdID0gbUI7Ci0gICAgICAgICAgICAgICAgbVZ0eERhdGFbbVZ0eENvdW50KytdID0gbUE7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAoKG1GbGFncyAmIFRFWFRVUkVfMCkgIT0gMCkgewotICAgICAgICAgICAgICAgIG1ha2VTcGFjZSgyKTsKLSAgICAgICAgICAgICAgICBtVnR4RGF0YVttVnR4Q291bnQrK10gPSBtUzA7Ci0gICAgICAgICAgICAgICAgbVZ0eERhdGFbbVZ0eENvdW50KytdID0gbVQwOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKChtRmxhZ3MgJiBOT1JNQUwpICE9IDApIHsKLSAgICAgICAgICAgICAgICBtYWtlU3BhY2UoMyk7Ci0gICAgICAgICAgICAgICAgbVZ0eERhdGFbbVZ0eENvdW50KytdID0gbU5YOwotICAgICAgICAgICAgICAgIG1WdHhEYXRhW21WdHhDb3VudCsrXSA9IG1OWTsKLSAgICAgICAgICAgICAgICBtVnR4RGF0YVttVnR4Q291bnQrK10gPSBtTlo7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgdm9pZCBhZGRWZXJ0ZXgoZmxvYXQgeCwgZmxvYXQgeSkgewotICAgICAgICAgICAgaWYgKG1WdHhTaXplICE9IDIpIHsKLSAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJhZGQgbWlzdG1hdGNoIHdpdGggZGVjbGFyZWQgY29tcG9uZW50cy4iKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIG1ha2VTcGFjZSgyKTsKLSAgICAgICAgICAgIG1WdHhEYXRhW21WdHhDb3VudCsrXSA9IHg7Ci0gICAgICAgICAgICBtVnR4RGF0YVttVnR4Q291bnQrK10gPSB5OwotICAgICAgICAgICAgbGF0Y2goKTsKLSAgICAgICAgfQotCi0gICAgICAgIHB1YmxpYyB2b2lkIGFkZFZlcnRleChmbG9hdCB4LCBmbG9hdCB5LCBmbG9hdCB6KSB7Ci0gICAgICAgICAgICBpZiAobVZ0eFNpemUgIT0gMykgewotICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oImFkZCBtaXN0bWF0Y2ggd2l0aCBkZWNsYXJlZCBjb21wb25lbnRzLiIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgbWFrZVNwYWNlKDMpOwotICAgICAgICAgICAgbVZ0eERhdGFbbVZ0eENvdW50KytdID0geDsKLSAgICAgICAgICAgIG1WdHhEYXRhW21WdHhDb3VudCsrXSA9IHk7Ci0gICAgICAgICAgICBtVnR4RGF0YVttVnR4Q291bnQrK10gPSB6OwotICAgICAgICAgICAgbGF0Y2goKTsKLSAgICAgICAgfQotCi0gICAgICAgIHB1YmxpYyB2b2lkIHNldFRleHR1cmUoZmxvYXQgcywgZmxvYXQgdCkgewotICAgICAgICAgICAgaWYgKChtRmxhZ3MgJiBURVhUVVJFXzApID09IDApIHsKLSAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJhZGQgbWlzdG1hdGNoIHdpdGggZGVjbGFyZWQgY29tcG9uZW50cy4iKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIG1TMCA9IHM7Ci0gICAgICAgICAgICBtVDAgPSB0OwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIHZvaWQgc2V0Tm9ybWFsKGZsb2F0IHgsIGZsb2F0IHksIGZsb2F0IHopIHsKLSAgICAgICAgICAgIGlmICgobUZsYWdzICYgTk9STUFMKSA9PSAwKSB7Ci0gICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiYWRkIG1pc3RtYXRjaCB3aXRoIGRlY2xhcmVkIGNvbXBvbmVudHMuIik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBtTlggPSB4OwotICAgICAgICAgICAgbU5ZID0geTsKLSAgICAgICAgICAgIG1OWiA9IHo7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgdm9pZCBzZXRDb2xvcihmbG9hdCByLCBmbG9hdCBnLCBmbG9hdCBiLCBmbG9hdCBhKSB7Ci0gICAgICAgICAgICBpZiAoKG1GbGFncyAmIENPTE9SKSA9PSAwKSB7Ci0gICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiYWRkIG1pc3RtYXRjaCB3aXRoIGRlY2xhcmVkIGNvbXBvbmVudHMuIik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBtUiA9IHI7Ci0gICAgICAgICAgICBtRyA9IGc7Ci0gICAgICAgICAgICBtQiA9IGI7Ci0gICAgICAgICAgICBtQSA9IGE7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgdm9pZCBhZGRUcmlhbmdsZShpbnQgaWR4MSwgaW50IGlkeDIsIGludCBpZHgzKSB7Ci0gICAgICAgICAgICBpZigoaWR4MSA+PSBtVnR4Q291bnQpIHx8IChpZHgxIDwgMCkgfHwKLSAgICAgICAgICAgICAgIChpZHgyID49IG1WdHhDb3VudCkgfHwgKGlkeDIgPCAwKSB8fAotICAgICAgICAgICAgICAgKGlkeDMgPj0gbVZ0eENvdW50KSB8fCAoaWR4MyA8IDApKSB7Ci0gICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJJbmRleCBwcm92aWRlZCBncmVhdGVyIHRoYW4gdmVydGV4IGNvdW50LiIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKChtSW5kZXhDb3VudCArIDMpID49IG1JbmRleERhdGEubGVuZ3RoKSB7Ci0gICAgICAgICAgICAgICAgc2hvcnQgdFtdID0gbmV3IHNob3J0W21JbmRleERhdGEubGVuZ3RoICogMl07Ci0gICAgICAgICAgICAgICAgU3lzdGVtLmFycmF5Y29weShtSW5kZXhEYXRhLCAwLCB0LCAwLCBtSW5kZXhEYXRhLmxlbmd0aCk7Ci0gICAgICAgICAgICAgICAgbUluZGV4RGF0YSA9IHQ7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBtSW5kZXhEYXRhW21JbmRleENvdW50KytdID0gKHNob3J0KWlkeDE7Ci0gICAgICAgICAgICBtSW5kZXhEYXRhW21JbmRleENvdW50KytdID0gKHNob3J0KWlkeDI7Ci0gICAgICAgICAgICBtSW5kZXhEYXRhW21JbmRleENvdW50KytdID0gKHNob3J0KWlkeDM7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgU2ltcGxlTWVzaCBjcmVhdGUoKSB7Ci0gICAgICAgICAgICBFbGVtZW50LkJ1aWxkZXIgYiA9IG5ldyBFbGVtZW50LkJ1aWxkZXIobVJTKTsKLSAgICAgICAgICAgIGludCBmbG9hdENvdW50ID0gbVZ0eFNpemU7Ci0gICAgICAgICAgICBiLmFkZChFbGVtZW50LmNyZWF0ZUF0dHJpYihtUlMsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBFbGVtZW50LkRhdGFUeXBlLkZMT0FUXzMyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRWxlbWVudC5EYXRhS2luZC5QT1NJVElPTiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1WdHhTaXplKSwgInBvc2l0aW9uIik7Ci0gICAgICAgICAgICBpZiAoKG1GbGFncyAmIENPTE9SKSAhPSAwKSB7Ci0gICAgICAgICAgICAgICAgZmxvYXRDb3VudCArPSA0OwotICAgICAgICAgICAgICAgIGIuYWRkKEVsZW1lbnQuY3JlYXRlQXR0cmliKG1SUywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBFbGVtZW50LkRhdGFUeXBlLkZMT0FUXzMyLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEVsZW1lbnQuRGF0YUtpbmQuQ09MT1IsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNCksICJjb2xvciIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKChtRmxhZ3MgJiBURVhUVVJFXzApICE9IDApIHsKLSAgICAgICAgICAgICAgICBmbG9hdENvdW50ICs9IDI7Ci0gICAgICAgICAgICAgICAgYi5hZGQoRWxlbWVudC5jcmVhdGVBdHRyaWIobVJTLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEVsZW1lbnQuRGF0YVR5cGUuRkxPQVRfMzIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRWxlbWVudC5EYXRhS2luZC5URVhUVVJFLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDIpLCAidGV4dHVyZSIpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKChtRmxhZ3MgJiBOT1JNQUwpICE9IDApIHsKLSAgICAgICAgICAgICAgICBmbG9hdENvdW50ICs9IDM7Ci0gICAgICAgICAgICAgICAgYi5hZGQoRWxlbWVudC5jcmVhdGVBdHRyaWIobVJTLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEVsZW1lbnQuRGF0YVR5cGUuRkxPQVRfMzIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRWxlbWVudC5EYXRhS2luZC5OT1JNQUwsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMyksICJub3JtYWwiKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIG1FbGVtZW50ID0gYi5jcmVhdGUoKTsKLQotICAgICAgICAgICAgQnVpbGRlciBzbWIgPSBuZXcgQnVpbGRlcihtUlMpOwotICAgICAgICAgICAgc21iLmFkZFZlcnRleFR5cGUobUVsZW1lbnQsIG1WdHhDb3VudCAvIGZsb2F0Q291bnQpOwotICAgICAgICAgICAgc21iLnNldEluZGV4VHl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ci0gICAgICAgICAgICAgICAgQ2xhc3MgZmMgPSBmLmdldFR5cGUoKTsKLSAgICAgICAgICAgICAgICBpZihmYyA9PSBpbnQuY2xhc3MpIHsKLSAgICAgICAgICAgICAgICAgICAgYXJUeXBlc1tjdF0gPSBFbGVtZW50LkRhdGFUeXBlLlNJR05FRF8zMi5tSUQ7Ci0gICAgICAgICAgICAgICAgICAgIGFyQml0c1tjdF0gPSAzMjsKLSAgICAgICAgICAgICAgICB9IGVsc2UgaWYoZmMgPT0gc2hvcnQuY2xhc3MpIHsKLSAgICAgICAgICAgICAgICAgICAgYXJUeXBlc1tjdF0gPSBFbGVtZW50LkRhdGFUeXBlLlNJR05FRF8xNi5tSUQ7Ci0gICAgICAgICAgICAgICAgICAgIGFyQml0c1tjdF0gPSAxNjsKLSAgICAgICAgICAgICAgICB9IGVsc2UgaWYoZmMgPT0gYnl0ZS5jbGFzcykgewotICAgICAgICAgICAgICAgICAgICBhclR5cGVzW2N0XSA9IEVsZW1lbnQuRGF0YVR5cGUuU0lHTkVEXzgubUlEOwotICAgICAgICAgICAgICAgICAgICBhckJpdHNbY3RdID0gODsKLSAgICAgICAgICAgICAgICB9IGVsc2UgaWYoZmMgPT0gZmxvYXQuY2xhc3MpIHsKLSAgICAgICAgICAgICAgICAgICAgYXJUeXBlc1tjdF0gPSBFbGVtZW50LkRhdGFUeXBlLkZMT0FUXzMyLm1JRDsKLSAgICAgICAgICAgICAgICAgICAgYXJCaXRzW2N0XSA9IDMyOwotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oIlVua293biBmaWVsZCB0eXBlIik7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICAgICAgcnMublR5cGVTZXR1cEZpZWxkcyh0LCBhclR5cGVzLCBhckJpdHMsIGZpZWxkcyk7CisgICAgICAgIGludCBlbGVtZW50SUQgPS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nYtPkdldEludEZpZWxkKF90aGlzLCBnQ29udGV4dElkKSk7CiAgICAgTE9HX0FQSSgibkZpbGVPcGVuLCBjb24oJXApIiwgY29uKTsKLQogICAgIGppbnQgbGVuID0gX2Vudi0+R2V0QXJyYXlMZW5ndGgoc3RyKTsKICAgICBqYnl0ZSAqIGNwdHIgPSAoamJ5dGUgKikgX2Vudi0+R2V0UHJpbWl0aXZlQXJyYXlDcml0aWNhbChzdHIsIDApOwogICAgIGppbnQgcmV0ID0gKGppbnQpcnNGaWxlT3Blbihjb24sIChjb25zdCBjaGFyICopY3B0ciwgbGVuKTsKQEAgLTE2NSw5ICsxNjUsOCBAQAogfQogCiBzdGF0aWMgdm9pZAotbkNvbnRleHRTZXRQcmlvcml0eShKTklFbnYgKl9lbnYsIGpvYmplY3QgX3RoaXMsIGppbnQgcCkKK25Db250ZXh0U2V0UHJpb3JpdHkoSk5JRW52ICpfZW52LCBqb2JqZWN0IF90aGlzLCBSc0NvbnRleHQgY29uLCBqaW50IHApCiB7Ci0gICAgUnNDb250ZXh0IGNvbiA9IChSc0NvbnRleHQpKF9lbnYtPkdldEludEZpZWxkKF90aGlzLCBnQ29udGV4dElkKSk7CiAgICAgTE9HX0FQSSgiQ29udGV4dFNldFByaW9yaXR5LCBjb24oJXApLCBwcmlvcml0eSglaSkiLCBjb24sIHApOwogICAgIHJzQ29udGV4dFNldFByaW9yaXR5KGNvbiwgcCk7CiB9CkBAIC0xNzUsMTAxICsxNzQsOTIgQEAKIAogCiBzdGF0aWMgdm9pZAotbkNvbnRleHRTZXRTdXJmYWNlKEpOSUVudiAqX2Vudiwgam9iamVjdCBfdGhpcywgamludCB3aWR0aCwgamludCBoZWlnaHQsIGpvYmplY3Qgd25kKQorbkNvbnRleHRTZXRTdXJmYWNlKEpOSUVudiAqX2Vudiwgam9iamVjdCBfdGhpcywgUnNDb250ZXh0IGNvbiwgamludCB3aWR0aCwgamludCBoZWlnaHQsIGpvYmplY3Qgd25kKQogewotICAgIFJzQ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Ci0gICAgcnNDb250ZXh0RGVzdHJveSgoUnNDb250ZXh0KWNvbik7CisgICAgTE9HX0FQSSgibkNvbnRleHREZXN0cm95LCBjb24oJXApIiwgY29uKTsKKyAgICByc0NvbnRleHREZXN0cm95KGNvbik7CiB9CiAKIHN0YXRpYyB2b2lkCi1uQ29udGV4dER1bXAoSk5JRW52ICpfZW52LCBqb2JqZWN0IF90aGlzLCBqaW50IGJpdHMpCituQ29udGV4dER1bXAoSk5JRW52ICpfZW52LCBqb2JqZWN0IF90aGlzLCBSc0NvbnRleHQgY29uLCBqaW50IGJpdHMpCiB7Ci0gICAgUnNDb250ZXh0IGNvbiA9IChSc0NvbnRleHQpKF9lbnYtPkdldEludEZpZWxkKF90aGlzLCBnQ29udGV4dElkKSk7CiAgICAgTE9HX0FQSSgibkNvbnRleHREdW1wLCBjb24oJXApICBiaXRzKCVpKSIsIChSc0NvbnRleHQpY29uLCBiaXRzKTsKICAgICByc0NvbnRleHREdW1wKChSc0NvbnRleHQpY29uLCBiaXRzKTsKIH0KIAogc3RhdGljIHZvaWQKLW5Db250ZXh0UGF1c2UoSk5JRW52ICpfZW52LCBqb2JqZWN0IF90aGlzKQorbkNvbnRleHRQYXVzZShKTklFbnYgKl9lbnYsIGpvYmplY3QgX3RoaXMsIFJzQ29udGV4dCBjb24pCiB7Ci0gICAgUnNDb250ZXh0IGNvbiA9IChSc0NvbnRleHQpKF9lbnYtPkdldEludEZpZWxkKF90aGlzLCBnQ29udGV4dElkKSk7CiAgICAgTE9HX0FQSSgibkNvbnRleHRQYXVzZSwgY29uKCVwKSIsIGNvbik7CiAgICAgcnNDb250ZXh0UGF1c2UoY29uKTsKIH0KIAogc3RhdGljIHZvaWQKLW5Db250ZXh0UmVzdW1lKEpOSUVudiAqX2Vudiwgam9iamVjdCBfdGhpcykKK25Db250ZXh0UmVzdW1lKEpOSUVudiAqX2Vudiwgam9iamVjdCBfdGhpcywgUnNDb250ZXh0IGNvbikKIHsKLSAgICBSc0NvbnRle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yAgICAgICAgKnB0ciA9IChqaW50KXJlY2VpdmVMZW47CiAgICAgfQogICAgIF9lbnYtPlJlbGVhc2VJbnRBcnJheUVsZW1lbnRzKGRhdGEsIHB0ciwgMCk7CiAgICAgcmV0dXJuIGlkOwogfQogCi1zdGF0aWMgdm9pZCBuQ29udGV4dEluaXRUb0NsaWVudChKTklFbnYgKl9lbnYsIGpvYmplY3QgX3RoaXMpCitzdGF0aWMgdm9pZCBuQ29udGV4dEluaXRUb0NsaWVudChKTklFbnYgKl9lbnYsIGpvYmplY3QgX3RoaXMsIFJzQ29udGV4dCBjb24pCiB7Ci0gICAgUnNDb250ZXh0IGNvbiA9IChSc0NvbnRleHQpKF9lbnYtPkdldEludEZpZWxkKF90aGlzLCBnQ29udGV4dElkKSk7CiAgICAgTE9HX0FQSSgibkNvbnRleHRJbml0VG9DbGllbnQsIGNvbiglcCkiLCBjb24pOwogICAgIHJzQ29udGV4dEluaXRUb0NsaWVudChjb24pOwogfQogCi1zdGF0aWMgdm9pZCBuQ29udGV4dERlaW5pdFRvQ2xpZW50KEpOSUVudiAqX2Vudiwgam9iamVjdCBfdGhpcykKK3N0YXRpYyB2b2lkIG5Db250ZXh0RGVpbml0VG9DbGllbnQoSk5JRW52ICpfZW52LCBqb2JqZWN0IF90aGlzLCBSc0NvbnRleHQgY29uKQogewotICAgIFJzQ29udGV4dCBjb24gPSAoUnNDb250ZXh0KShfZW52LT5HZXRJbnRGaWVsZChfdGhpcywgZ0NvbnRleHRJZCkpOwogICAgIExPR19BUEkoIm5Db250ZXh0RGVpbml0VG9DbGllbnQsIGNvbiglcCkiLCBjb24pOwogICAgIHJzQ29udGV4dERlaW5pdFRvQ2xpZW50KGNvbik7CiB9CiAKIAogc3RhdGljIGppbnQKLW5FbGVtZW50Q3JlYXRlKEpOSUVudiAqX2Vudiwgam9iamVjdCBfdGhpcywgamludCB0eXBlLCBqaW50IGtpbmQsIGpib29sZWFuIG5vcm0sIGppbnQgc2l6ZSkKK25FbGVtZW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pemUgPSBfZW52LT5HZXRBcnJheUxlbmd0aChfSURzKTsKKyAgICBMT0dfQVBJKCJuRWxlbWVudEdldFN1YkVsZW1lbnRzLCBjb24oJXApIiwgY29uKTsKKworICAgIHVpbnQzMl90ICppZHMgPSAodWludDMyX3QgKiltYWxsb2MoKHVpbnQzMl90KWRhdGFTaXplICogc2l6ZW9mKHVpbnQzMl90KSk7CisgICAgY29uc3QgY2hhciAqKm5hbWVzID0gKGNvbnN0IGNoYXIgKiopbWFsbG9jKCh1aW50MzJfdClkYXRhU2l6ZSAqIHNpemVvZihjb25zdCBjaGFyICopKTsKKworICAgIHJzRWxlbWVudEdldFN1YkVsZW1lbnRzKGNvbiwgKFJzRWxlbWVudClpZCwgaWRzLCBuYW1lcywgKHVpbnQzMl90KWRhdGFTaXplKTsKKworICAgIGZvcihqaW50IGkgPSAwOyBpIDwgZGF0YVNpemU7IGkgKyspIHsKKyAgICAgICAgX2Vudi0+U2V0T2JqZWN0QXJyYXlFbGVtZW50KF9uYW1lcywgaSwgX2Vudi0+TmV3U3RyaW5nVVRGKG5hbWVzW2ldKSk7CisgICAgICAgIF9lbnYtPlNldEludEFycmF5UmVnaW9uKF9JRHMsIGksIDEsIChjb25zdCBqaW50KikmaWRzW2ldKTsKKyAgICB9CisKKyAgICBmcmVlKGlkcyk7CisgICAgZnJlZShuYW1lcyk7Cit9CisKIC8vIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tCiAKIHN0YXRpYyB2b2lkCi1uVHlwZUJlZ2luKEpOSUVudiAqX2Vudiwgam9iamVjdCBfdGhpcywgamludCBlSUQpCituVHlwZUJlZ2luKEpOSUVudiAqX2Vudiwgam9iamVjdCBfdGhpcywgUnNDb250ZXh0IGNvbiwgamludCBlSUQpCiB7Ci0gICAgUnNDb250ZXh0IGNvbiA9IChSc0NvbnRleHQpKF9lbnYtPkdldEludEZpZWxkKF90aGlzLCBnQ29udGV4dElkKSk7CiAgICAgTE9HX0FQSS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NBbGxvY2F0aW9uKWFsbG9jLCBvZmZzZXQsIGNvdW50LCBsZW4sIHNpemVCeXRlcyk7CiAgICAgamZsb2F0ICpwdHIgPSBfZW52LT5HZXRGbG9hdEFycmF5RWxlbWVudHMoZGF0YSwgTlVMTCk7CkBAIC02MTYsOSArNTMwLDE5IEBACiB9CiAKIHN0YXRpYyB2b2lkCi1uQWxsb2NhdGlvblN1YkRhdGEyRF9pKEpOSUVudiAqX2Vudiwgam9iamVjdCBfdGhpcywgamludCBhbGxvYywgamludCB4b2ZmLCBqaW50IHlvZmYsIGppbnQgdywgamludCBoLCBqaW50QXJyYXkgZGF0YSwgaW50IHNpemVCeXRlcykKKy8vICAgIG5hdGl2ZSB2b2lkIHJzbkFsbG9jYXRpb25TdWJFbGVtZW50RGF0YTFEKGludCBjb24sIGludCBpZCwgaW50IHhvZmYsIGludCBjb21wSWR4LCBieXRlW10gZCwgaW50IHNpemVCeXRlcyk7CituQWxsb2NhdGlvblN1YkVsZW1lbnREYXRhMUQoSk5JRW52ICpfZW52LCBqb2JqZWN0IF90aGlzLCBSc0NvbnRleHQgY29uLCBqaW50IGFsbG9jLCBqaW50IG9mZnNldCwgamludCBjb21wSWR4LCBqYnl0ZUFycmF5IGRhdGEsIGludCBzaXplQnl0ZXMpCiB7Ci0gICAgUnNDb250ZXh0IGNvbiA9IChSc0NvbnRleHQpKF9lbnYtPkdldEludEZpZWxkKF90aGlzLCBnQ29udGV4dElkKSk7CisgICAgamludCBsZW4gPSBfZW52LT5HZXRBcnJheUxlbmd0aChkYXRhKTsKKyAgICBMT0dfQVBJKCJuQWxsb2NhdGlvblN1YkVsZW1lbnREYXRhMUQsIGNvbiglcCksIGFsbG9jKCVwKSwgb2Zmc2V0KCVpKSwgY29tcCglaSksIGxlbiglaSksIHNpemVCeXRlcyglaSkiLCBjb24sIChSc0FsbG9jYXRpb24pYWxsb2MsIG9mZnNldCwgY29tcElkeCwgbGVuLCBzaXplQnl0ZXMpOworICAgIGpieXRlICpwd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SAgICAgICAgY29uc3QgVHlwZUZpZWxkQ2FjaGUgKnRmYyA9ICZ0Yy0+ZmllbGRzW2N0XTsKLSAgICAgICAgYnVmID0gdGZjLT5yZWFkUHRyKF9lbnYsIF9vLCB0ZmMtPmZpZWxkLCBidWYpOworICAgIGZvcihqaW50IGkgPSAwOyBpIDwgbnVtRW50cmllczsgaSArKykgeworICAgICAgICBfZW52LT5TZXRPYmplY3RBcnJheUVsZW1lbnQoX2VudHJpZXMsIGksIF9lbnYtPk5ld1N0cmluZ1VURihmaWxlRW50cmllc1tpXS5vYmplY3ROYW1lKSk7CisgICAgICAgIF9lbnYtPlNldEludEFycmF5UmVnaW9uKF9pZHMsIGksIDEsIChjb25zdCBqaW50KikmZmlsZUVudHJpZXNbaV0uY2xhc3NJRCk7CiAgICAgfQotICAgIGZyZWUoYnVmQWxsb2MpOworCisgICAgZnJlZShmaWxlRW50cmllcyk7Cit9CisKK3N0YXRpYyBpbnQKK25GaWxlQTNER2V0RW50cnlCeUluZGV4KEpOSUVudiAqX2Vudiwgam9iamVjdCBfdGhpcywgUnNDb250ZXh0IGNvbiwgamludCBmaWxlQTNELCBqaW50IGluZGV4KQoreworICAgIExPR1YoIl9fX19fX25GaWxlQTNEICV1IiwgKHVpbnQzMl90KSBmaWxlQTNEKTsKKyAgICBqaW50IGlkID0gKGppbnQpcnNGaWxlQTNER2V0RW50cnlCeUluZGV4KGNvbiwgKHVpbnQzMl90KWluZGV4LCAoUnNGaWxlKWZpbGVBM0QpOworICAgIHJldHVybiBpZDsKK30KKworLy8gLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KKworc3RhdGljIGludAorbkZvbnRDcmVhdGVGcm9tRmlsZShKTklFbnYgKl9lbnYsIGpvYmplY3QgX3RoaXMsIFJzQ29udGV4dCBjb24sIGpzdHJpbmcgZmlsZU5hbWUsIGppbnQgZm9udFNpemUsIGppbnQgZHBpKQoreworICAgIGNvbnN0IGNoYXIqIGZpbGVOY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Vudi0+R2V0SW50RmllbGQoX3RoaXMsIGdDb250ZXh0SWQpKTsKLSAgICBMT0dfQVBJKCJuU2ltcGxlTWVzaEJpbmRJbmRleCwgY29uKCVwKSwgU2ltcGxlTWVzaCglcCksIEFsbG9jKCVwKSIsIGNvbiwgKFJzU2ltcGxlTWVzaClzLCAoUnNBbGxvY2F0aW9uKWFsbG9jKTsKLSAgICByc1NpbXBsZU1lc2hCaW5kSW5kZXgoY29uLCAoUnNTaW1wbGVNZXNoKXMsIChSc0FsbG9jYXRpb24pYWxsb2MpOworICAgIExPR19BUEkoIm5NZXNoQmluZEluZGV4LCBjb24oJXApLCBNZXNoKCVwKSwgQWxsb2MoJXApIiwgY29uLCAoUnNNZXNoKW1lc2gsIChSc0FsbG9jYXRpb24pYWxsb2MpOworICAgIHJzTWVzaEJpbmRJbmRleChjb24sIChSc01lc2gpbWVzaCwgKFJzQWxsb2NhdGlvbilhbGxvYywgcHJpbUlELCBzbG90KTsKK30KKworc3RhdGljIGppbnQKK25NZXNoR2V0VmVydGV4QnVmZmVyQ291bnQoSk5JRW52ICpfZW52LCBqb2JqZWN0IF90aGlzLCBSc0NvbnRleHQgY29uLCBqaW50IG1lc2gpCit7CisgICAgTE9HX0FQSSgibk1lc2hHZXRWZXJ0ZXhCdWZmZXJDb3VudCwgY29uKCVwKSwgTWVzaCglcCkiLCBjb24sIChSc01lc2gpbWVzaCk7CisgICAgamludCB2dHhDb3VudCA9IDA7CisgICAgcnNNZXNoR2V0VmVydGV4QnVmZmVyQ291bnQoY29uLCAoUnNNZXNoKW1lc2gsICZ2dHhDb3VudCk7CisgICAgcmV0dXJuIHZ0eENvdW50OworfQorCitzdGF0aWMgamludAorbk1lc2hHZXRJbmRleENvdW50KEpOSUVudiAqX2Vudiwgam9iamVjdCBfdGhpcywgUnNDb250ZXh0IGNvbiwgamludCBtZXNoKQoreworICAgIExPR19BUEkoIm5NZXNoR2V0SW5kZXhDb3VudCwgY29uKCVwKSwgTWVzaCglcCkiLCBjb24sIChSc01lc2gpbWVzaCk7CisgICAgamludCBpZHhDb3VudCA9IDA7CisgICAgcnNNZXNoR2V0SW5kZXhDb3VudChjb24sIChSc01lc2gpbWVzaCwgJmlkeENvdW50KTsKKyAgICByZXR1cm4gaWR4Q291bnQ7Cit9CisKK3N0YXRpYyB2b2lkCituTWVzaEdldFZlcnRpY2VzKEpOSUVudiAqX2Vudiwgam9iamVjdCBfdGhpcywgUnNDb250ZXh0IGNvbiwgamludCBtZXNoLCBqaW50QXJyYXkgX2lkcywgaW50IG51bVZ0eElEcykKK3sKKyAgICBMT0dfQVBJKCJuTWVzaEdldFZlcnRpY2VzLCBjb24oJXApLCBNZXNoKCVwKSIsIGNvbiwgKFJzTWVzaCltZXNoKTsKKworICAgIFJzQWxsb2NhdGlvbiAqYWxsb2NzID0gKFJzQWxsb2NhdGlvbiopbWFsbG9jKCh1aW50MzJfdCludW1WdHhJRHMgKiBzaXplb2YoUnNBbGxvY2F0aW9uKSk7CisgICAgcnNNZXNoR2V0VmVydGljZXMoY29uLCAoUnNNZXNoKW1lc2gsIGFsbG9jcywgKHVpbnQzMl90KW51bVZ0eElEcyk7CisKKyAgICBmb3IoamludCBpID0gMDsgaSA8IG51bVZ0eElEczsgaSArKykgeworICAgICAgICBfZW52LT5TZXRJbnRBcnJheVJlZ2lvbihfaWRzLCBpLCAxLCAoY29uc3QgamludCopJmFsbG9jc1tpXSk7CisgICAgfQorCisgICAgZnJlZShhbGxvY3MpOworfQorCitzdGF0aWMgdm9pZAorbk1lc2hHZXRJbmRpY2VzKEpOSUVudiAqX2Vudiwgam9iamVjdCBfdGhpcywgUnNDb250ZXh0IGNvbiwgamludCBtZXNoLCBqaW50QXJyYXkgX2lkeElkcywgamludEFycmF5IF9wcmltaXRpdmVzLCBpbnQgbnVtSW5kaWNlcykKK3sKKyAgICBMT0dfQVBJKCJuTWVzaEdldFZlcnRpY2VzLCBjb24oJXApLCBNZXNoKCVwKSIsIGNvbiwgKFJzTWVzaCltZXNoKTsKKworICAgIFJzQWxsb2NhdGlvbiAqYWxsb2NzID0gKFJzQWxsb2NhdGlvbiopbWFsbG9jKCh1aW50MzJfdCludW1JbmRpY2VzICogc2l6ZW9mKFJzQWxsb2NhdGlvbikpOworICAgIHVpbnQzMl90ICpwcmltcz0gKHVpbnQzMl90KiltYWxsb2MoKHVpbnQzMl90KW51bUluZGljZXMgKiBzaXplb2YodWludDMyX3QpKTsKKworICAgIHJzTWVzaEdldEluZGljZXMoY29uLCAoUnNNZXNoKW1lc2gsIGFsbG9jcywgcHJpbXMsICh1aW50MzJfdCludW1JbmRpY2VzKTsKKworICAgIGZvcihqaW50IGkgPSAwOyBpIDwgbnVtSW5kaWNlczsgaSArKykgeworICAgICAgICBfZW52LT5TZXRJbnRBcnJheVJlZ2lvbihfaWR4SWRzLCBpLCAxLCAoY29uc3QgamludCopJmFsbG9jc1tpXSk7CisgICAgICAgIF9lbnYtPlNldEludEFycmF5UmVnaW9uKF9wcmltaXRpdmVzLCBpLCAxLCAoY29uc3QgamludCopJnByaW1zW2ldKTsKKyAgICB9CisKKyAgICBmcmVlKGFsbG9jcyk7CisgICAgZnJlZShwcmltcyk7CiB9CiAKIC8vIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQpAQCAtMTM1OSwxMjQgKzEyMDQsMTI5IEBACiB7Im5EZXZpY2VDcmVhdGUiLCAgICAgICAgICAgICAgICAgICIoKUkiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkRldmljZUNyZWF0ZSB9LAogeyJuRGV2aWNlRGVzdHJveSIsICAgICAgICAgICAgICAgICAiKEkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5EZXZpY2VEZXN0cm95IH0sCiB7Im5EZXZpY2VTZXRDb25maWciLCAgICAgICAgICAgICAgICIoSUlJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkRldmljZVNldENvbmZpZyB9LAoteyJuQ29udGV4dENyZWF0ZSIsICAgICAgICAgICAgICAgICAiKElJKUkiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Db250ZXh0Q3JlYXRlIH0sCi17Im5Db250ZXh0Q3JlYXRlR0wiLCAgICAgICAgICAgICAgICIoSUlaKUkiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkNvbnRleHRDcmVhdGVHTCB9LAoteyJuQ29udGV4dFNldFByaW9yaXR5IiwgICAgICAgICAgICAiKEkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Db250ZXh0U2V0UHJpb3JpdHkgfSwKLXsibkNvbnRleHRTZXRTdXJmYWNlIiwgICAgICAgICAgICAgIihJSUxhbmRyb2lkL3ZpZXcvU3VyZmFjZTspViIsICAgICAgICAgICh2b2lkKiluQ29udGV4dFNldFN1cmZhY2UgfSwKLXsibkNvbnRleHREZXN0cm95IiwgICAgICAgICAgICAgICAgIihJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQ29udGV4dERlc3Ryb3kgfSwKLXsibkNvbnRleHREdW1wIiwgICAgICAgICAgICAgICAgICAgIihJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQ29udGV4dER1bXAgfSwKLXsibkNvbnRleHRQYXVzZSIsICAgICAgICAgICAgICAgICAgIigpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQ29udGV4dFBhdXNlIH0sCi17Im5Db250ZXh0UmVzdW1lIiwgICAgICAgICAgICAgICAgICIoKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkNvbnRleHRSZXN1bWUgfSwKLXsibkFzc2lnbk5hbWUiLCAgICAgICAgICAgICAgICAgICAgIihJW0IpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQXNzaWduTmFtZSB9LAoteyJuT2JqRGVzdHJveSIsICAgICAgICAgICAgICAgICAgICAiKEkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5PYmpEZXN0cm95IH0sCi17Im5PYmpEZXN0cm95T09CIiwgICAgICAgICAgICAgICAgICIoSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbk9iakRlc3Ryb3lPT0IgfSwKLXsibkNvbnRleHRHZXRNZXNzYWdlIiwgICAgICAgICAgICAgIihbSVopSSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQ29udGV4dEdldE1lc3NhZ2UgfSwKLXsibkNvbnRleHRJbml0VG9DbGllbnQiLCAgICAgICAgICAgIigpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQ29udGV4dEluaXRUb0NsaWVudCB9LAoteyJuQ29udGV4dERlaW5pdFRvQ2xpZW50IiwgICAgICAgICAiKClWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Db250ZXh0RGVpbml0VG9DbGllbnQgfSwKK3sibkNvbnRleHRHZXRNZXNzYWdlIiwgICAgICAgICAgICAgIihJW0laKUkiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkNvbnRleHRHZXRNZXNzYWdlIH0sCit7Im5Db250ZXh0SW5pdFRvQ2xpZW50IiwgICAgICAgICAgICIoSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Db250ZXh0SW5pdFRvQ2xpZW50IH0sCit7Im5Db250ZXh0RGVpbml0VG9DbGllbnQiLCAgICAgICAgICIoSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Db250ZXh0RGVpbml0VG9DbGllbnQgfSwKIAoteyJuRmlsZU9wZW4iLCAgICAgICAgICAgICAgICAgICAgICAiKFtCKUkiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5GaWxlT3BlbiB9LAogCi17Im5FbGVtZW50Q3JlYXRlIiwgICAgICAgICAgICAgICAgICIoSUlaSSlJIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkVsZW1lbnRDcmVhdGUgfSwKLXsibkVsZW1lbnRDcmVhdGUyIiwgICAgICAgICAgICAgICAgIihbSVtMamF2YS9sYW5nL1N0cmluZzspSSIsICAgICAgICAgICAgICh2b2lkKiluRWxlbWVudENyZWF0ZTIgfSwKKy8vIEFsbCBtZXRob2RzIGJlbG93IGFyZSB0aHJlYWQgcHJvdGVjdGVkIGluIGphdmEuCit7InJzbkNvbnRleHRDcmVhdGUiLCAgICAgICAgICAgICAgICAgIihJSSlJIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQ29udGV4dENyZWF0ZSB9LAoreyJyc25Db250ZXh0Q3JlYXRlR0wiLCAgICAgICAgICAgICAgICIoSUlaKUkiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkNvbnRleHRDcmVhdGVHTCB9LAoreyJyc25Db250ZXh0RmluaXNoIiwgICAgICAgICAgICAgICAgICIoSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Db250ZXh0RmluaXNoIH0sCit7InJzbkNvbnRleHRTZXRQcmlvcml0eSIsICAgICAgICAgICAgIihJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkNvbnRleHRTZXRQcmlvcml0eSB9LAoreyJyc25Db250ZXh0U2V0U3VyZmFjZSIsICAgICAgICAgICAgICIoSUlJTGFuZHJvaWQvdmlldy9TdXJmYWNlOylWIiwgICAgICAgICAgKHZvaWQqKW5Db250ZXh0U2V0U3VyZmFjZSB9LAoreyJyc25Db250ZXh0RGVzdHJveSIsICAgICAgICAgICAgICAgICIoSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkNvbnRleHREZXN0cm95IH0sCit7InJzbkNvbnRleHREdW1wIiwgICAgICAgICAgICAgICAgICAgIihJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkNvbnRleHREdW1wIH0sCit7InJzbkNvbnRleHRQYXVzZSIsICAgICAgICAgICAgICAgICAgIihJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkNvbnRleHRQYXVzZSB9LAoreyJyc25Db250ZXh0UmVzdW1lIiwgICAgICAgICAgICAgICAgICIoSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Db250ZXh0UmVzdW1lIH0sCit7InJzbkFzc2lnbk5hbWUiLCAgICAgICAgICAgICAgICAgICAgIihJSVtCKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkFzc2lnbk5hbWUgfSwKK3sicnNuR2V0TmFtZSIsICAgICAgICAgICAgICAgICAgICAgICAiKElJKUxqYXZhL2xhbmcvU3RyaW5nOyIsICAgICAgICAgICAgICAgKHZvaWQqKW5HZXROYW1lIH0sCit7InJzbk9iakRlc3Ryb3kiLCAgICAgICAgICAgICAgICAgICAgIihJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbk9iakRlc3Ryb3kgfSwKIAoteyJuVHlwZUJlZ2luIiwgICAgICAgICAgICAgICAgICAgICAiKEkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5UeXBlQmVnaW4gfSwKLXsiblR5cGVBZGQiLCAgICAgICAgICAgICAgICAgICAgICAgIihJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluVHlwZUFkZCB9LAoteyJuVHlwZUNyZWF0ZSIsICAgICAgICAgICAgICAgICAgICAiKClJIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5UeXBlQ3JlYXRlIH0sCi17Im5UeXBlRmluYWxEZXN0cm95IiwgICAgICAgICAgICAgICIoTGFuZHJvaWQvcmVuZGVyc2NyaXB0L1R5cGU7KVYiLCAgICAgICAodm9pZCopblR5cGVGaW5hbERlc3Ryb3kgfSwKLXsiblR5cGVTZXR1cEZpZWxkcyIsICAgICAgICAgICAgICAgIihMYW5kcm9pZC9yZW5kZXJzY3JpcHQvVHlwZTtbSVtJW0xqYXZhL2xhbmcvcmVmbGVjdC9GaWVsZDspViIsICh2b2lkKiluVHlwZVNldHVwRmllbGRzIH0sCit7InJzbkZpbGVPcGVuIiwgICAgICAgICAgICAgICAgICAgICAgIihJW0IpSSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkZpbGVPcGVuIH0sCit7InJzbkZpbGVBM0RDcmVhdGVGcm9tQXNzZXRTdHJlYW0iLCAgIihJSSlJIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkZpbGVBM0RDcmVhdGVGcm9tQXNzZXRTdHJlYW0gfSwKK3sicnNuRmlsZUEzREdldE51bUluZGV4RW50cmllcyIsICAgICAiKElJKUkiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluRmlsZUEzREdldE51bUluZGV4RW50cmllcyB9LAoreyJyc25GaWxlQTNER2V0SW5kZXhFbnRyaWVzIiwgICAgICAgICIoSUlJW0lbTGphdmEvbGFuZy9TdHJpbmc7KVYiLCAgICAgICAgICAodm9pZCopbkZpbGVBM0RHZXRJbmRleEVudHJpZXMgfSwKK3sicnNuRmlsZUEzREdldEVudHJ5QnlJbmRleCIsICAgICAgICAiKElJSSlJIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluRmlsZUEzREdldEVudHJ5QnlJbmRleCB9LAogCi17Im5Bb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ICAiKElJSVtJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5BbGxvY2F0aW9uU3ViRGF0YTFEX2kgfSwKLXsibkFsbG9jYXRpb25TdWJEYXRhMUQiLCAgICAgICAgICAgIihJSUlbU0kpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQWxsb2NhdGlvblN1YkRhdGExRF9zIH0sCi17Im5BbGxvY2F0aW9uU3ViRGF0YTFEIiwgICAgICAgICAgICIoSUlJW0JJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkFsbG9jYXRpb25TdWJEYXRhMURfYiB9LAoteyJuQWxsb2NhdGlvblN1YkRhdGExRCIsICAgICAgICAgICAiKElJSVtGSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5BbGxvY2F0aW9uU3ViRGF0YTFEX2YgfSwKLXsibkFsbG9jYXRpb25TdWJEYXRhMkQiLCAgICAgICAgICAgIihJSUlJSVtJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQWxsb2NhdGlvblN1YkRhdGEyRF9pIH0sCi17Im5BbGxvY2F0aW9uU3ViRGF0YTJEIiwgICAgICAgICAgICIoSUlJSUlbRkkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkFsbG9jYXRpb25TdWJEYXRhMkRfZiB9LAoteyJuQWxsb2NhdGlvblJlYWQiLCAgICAgICAgICAgICAgICAiKElbSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5BbGxvY2F0aW9uUmVhZF9pIH0sCi17Im5BbGxvY2F0aW9uUmVhZCIsICAgICAgICAgICAgICAgICIoSVtGKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkFsbG9jYXRpb25SZWFkX2YgfSwKLXsibkFsbG9jYXRpb25TdWJEYXRhRnJvbU9iamVjdCIsICAgIihJTGFuZHJvaWQvcmVuZGVyc2NyaXB0L1R5cGU7SUxqYXZhL2xhbmcvT2JqZWN0OylWIiwgICAodm9pZCopbkFsbG9jYXRpb25TdWJEYXRhRnJvbU9iamVjdCB9LAoteyJuQWxsb2NhdGlvblN1YlJlYWRGcm9tT2JqZWN0IiwgICAiKElMYW5kcm9pZC9yZW5kZXJzY3JpcHQvVHlwZTtJTGphdmEvbGFuZy9PYmplY3Q7KVYiLCAgICh2b2lkKiluQWxsb2NhdGlvblN1YlJlYWRGcm9tT2JqZWN0IH0sCit7InJzbkZvbnRDcmVhdGVGcm9tRmlsZSIsICAgICAgICAgICAgIihJTGphdmEvbGFuZy9TdHJpbmc7SUkpSSIsICAgICAgICAgICAgICh2b2lkKiluRm9udENyZWF0ZUZyb21GaWxlIH0sCiAKLXsibkFkYXB0ZXIxREJpbmRBbGxvY2F0aW9uIiwgICAgICAgIihJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQWRhcHRlcjFEQmluZEFsbG9jYXRpb24gfSwKLXsibkFkYXB0ZXIxRFNldENvbnN0cmFpbnQiLCAgICAgICAgIihJSUkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQWRhcHRlcjFEU2V0Q29uc3RyYWludCB9LAoteyJuQWRhcHRlcjFERGF0YSIsICAgICAgICAgICAgICAgICAiKElbSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5BZGFwdGVyMUREYXRhX2kgfSwKLXsibkFkYXB0ZXIxRERhdGEiLCAgICAgICAgICAgICAgICAgIihJW0YpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQWRhcHRlcjFERGF0YV9mIH0sCi17Im5BZGFwdGVyMURTdWJEYXRhIiwgICAgICAgICAgICAgICIoSUlJW0kpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkFkYXB0ZXIxRFN1YkRhdGFfaSB9LAoteyJuQWRhcHRlcjFEU3ViRGF0YSIsICAgICAgICAgICAgICAiKElJSVtGKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5BZGFwdGVyMURTdWJEYXRhX2YgfSwKLXsibkFkYXB0ZXIxRENyZWF0ZSIsICAgICAgICAgICAgICAgIigpSSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQWRhcHRlcjFEQ3JlYXRlIH0sCit7InJzbkVsZW1lbnRDcmVhdGUiLCAgICAgICAgICAgICAgICAgIihJSUlaSSlJIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkVsZW1lbnRDcmVhdGUgfSwKK3sicnNuRWxlbWVudENyZWF0ZTIiLCAgICAgICAgICAgICAgICAiKElbSVtMamF2YS9sYW5nL1N0cmluZztbSSlJIiwgICAgICAgICAgICh2b2lkKiluRWxlbWVudENyZWF0ZTIgfSwKK3sicnNuRWxlbWVudEdldE5hdGl2ZURhdGEiLCAgICAgICAgICAiKElJW0kpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluRWxlbWVudEdldE5hdGl2ZURhdGEgfSwKK3sicnNuRWxlbWVudEdldFN1YkVsZW1lbnRzIiwgICAgICAgICAiKElJW0lbTGphdmEvbGFuZy9TdHJpbmc7KVYiLCAgICAgICAgICAgKHZvaWQqKW5FbGVtZW50R2V0U3ViRWxlbWVudHMgfSwKIAoteyJuQWRhcHRlcjJEQmluZEFsbG9jYXRpb24iLCAgICAgICAiKElJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5BZGFwdGVyMkRCaW5kQWxsb2NhdGlvbiB9LAoteyJuQWRhcHRlcjJEU2V0Q29uc3RyYWludCIsICAgICAgICAiKElJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5BZGFwdGVyMkRTZXRDb25zdHJhaW50IH0sCi17Im5BZGFwdGVyMkREYXRhIiwgICAgICAgICAgICAgICAgICIoSVtJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkFkYXB0ZXIyRERhdGFfaSB9LAoteyJuQWRhcHRlcjJERGF0YSIsICAgICAgICAgICAgICAgICAiKElbRilWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5BZGFwdGVyMkREYXRhX2YgfSwKLXsibkFkYXB0ZXIyRFN1YkRhdGEiLCAgICAgICAgICAgICAgIihJSUlJSVtJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQWRhcHRlcjJEU3ViRGF0YV9pIH0sCi17Im5BZGFwdGVyMkRTdWJEYXRhIiwgICAgICAgICAgICAgICIoSUlJSUlbRilWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkFkYXB0ZXIyRFN1YkRhdGFfZiB9LAoteyJuQWRhcHRlcjJEQ3JlYXRlIiwgICAgICAgICAgICAgICAiKClJIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5BZGFwdGVyMkRDcmVhdGUgfSwKK3sicnNuVHlwZUJlZ2luIiwgICAgICAgICAgICAgICAgICAgICAiKElJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluVHlwZUJlZ2luIH0sCit7InJzblR5cGVBZGQiLCAgICAgICAgICAgICAgICAgICAgICAgIihJSUkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblR5cGVBZGQgfSwKK3sicnNuVHlwZUNyZWF0ZSIsICAgICAgICAgICAgICAgICAgICAiKEkpSSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluVHlwZUNyZWF0ZSB9LAoreyJyc25UeXBlR2V0TmF0aXZlRGF0YSIsICAgICAgICAgICAgICIoSUlbSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluVHlwZUdldE5hdGl2ZURhdGEgfSwKIAoteyJuU2NyaXB0QmluZEFsbG9jYXRpb24iLCAgICAgICAgICAiKElJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5TY3JpcHRCaW5kQWxsb2NhdGlvbiB9LAoteyJuU2NyaXB0U2V0Q2xlYXJDb2xvciIsICAgICAgICAgICAiKElGRkZGKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5TY3JpcHRTZXRDbGVhckNvbG9yIH0sCi17Im5TY3JpcHRTZXRDbGVhckRlcHRoIiwgICAgICAgICAgICIoSUYpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblNjcmlwdFNldENsZWFyRGVwdGggfSwKLXsiblNjcmlwdFNldENsZWFyU3RlbmNpbCIsICAgICAgICAgIihJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluU2NyaXB0U2V0Q2xlYXJTdGVuY2lsIH0sCi17Im5TY3JpcHRTZXRUaW1lWm9uZSIsICAgICAgICAgICAgICIoSVtCKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblNjcmlwdFNldFRpbWVab25lIH0sCi17Im5TY3JpcHRTZXRUeXBlIiwgICAgICAgICAgICAgICAgICIoSVpMamF2YS9sYW5nL1N0cmluZztJKVYiLCAgICAgICAgICAgICAodm9pZCopblNjcmlwdFNldFR5cGUgfSwKLXsiblNjcmlwdFNldFJvb3QiLCAgICAgICAgICAgICAgICAgIihaKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluU2NyaXB0U2V0Um9vdCB9LAoteyJuU2NyaXB0U2V0SW52b2thYmxlIiwgICAgICAgICAgICAiKExqYXZhL2xhbmcvU3RyaW5nO0kpViIsICAgICAgICAgICAgICAgKHZvaWQqKW5TY3JpcHRTZXRJbnZva2UgfSwKLXsiblNjcmlwdEludm9rZSIsICAgICAgICAgICAgICAg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gICAgICAgICAodm9pZCopbkFsbG9jYXRpb25VcGxvYWRUb0J1ZmZlck9iamVjdCB9LAoreyJyc25BbGxvY2F0aW9uU3ViRGF0YTFEIiwgICAgICAgICAgICIoSUlJSVtJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5BbGxvY2F0aW9uU3ViRGF0YTFEX2kgfSwKK3sicnNuQWxsb2NhdGlvblN1YkRhdGExRCIsICAgICAgICAgICAiKElJSUlbU0kpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQWxsb2NhdGlvblN1YkRhdGExRF9zIH0sCit7InJzbkFsbG9jYXRpb25TdWJEYXRhMUQiLCAgICAgICAgICAgIihJSUlJW0JJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkFsbG9jYXRpb25TdWJEYXRhMURfYiB9LAoreyJyc25BbGxvY2F0aW9uU3ViRGF0YTFEIiwgICAgICAgICAgICIoSUlJSVtGSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5BbGxvY2F0aW9uU3ViRGF0YTFEX2YgfSwKK3sicnNuQWxsb2NhdGlvblN1YkVsZW1lbnREYXRhMUQiLCAgICAiKElJSUlbQkkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQWxsb2NhdGlvblN1YkVsZW1lbnREYXRhMUQgfSwKK3sicnNuQWxsb2NhdGlvblN1YkRhdGEyRCIsICAgICAgICAgICAiKElJSUlJSVtJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQWxsb2NhdGlvblN1YkRhdGEyRF9pIH0sCit7InJzbkFsbG9jYXRpb25TdWJEYXRhMkQiLCAgICAgICAgICAgIihJSUlJSUlbRkkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkFsbG9jYXRpb25TdWJEYXRhMkRfZiB9LAoreyJyc25BbGxvY2F0aW9uUmVhZCIsICAgICAgICAgICAgICAgICIoSUlbSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5BbGxvY2F0aW9uUmVhZF9pIH0sCit7InJzbkFsbG9jYXRpb25SZWFkIiwgICAgICAgICAgICAgICAgIihJSVtGKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkFsbG9jYXRpb25SZWFkX2YgfSwKK3sicnNuQWxsb2NhdGlvbkdldFR5cGUiLCAgICAgICAgICAgICAiKElJKUkiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQWxsb2NhdGlvbkdldFR5cGV9LAogCi17Im5TY3JpcHRDQmVnaW4iLCAgICAgICAgICAgICAgICAgICIoKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblNjcmlwdENCZWdpbiB9LAoteyJuU2NyaXB0Q1NldFNjcmlwdCIsICAgICAgICAgICAgICAiKFtCSUkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5TY3JpcHRDU2V0U2NyaXB0IH0sCi17Im5TY3JpcHRDQ3JlYXRlIiwgICAgICAgICAgICAgICAgICIoKUkiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblNjcmlwdENDcmVhdGUgfSwKLXsiblNjcmlwdENBZGREZWZpbmVJMzIiLCAgICAgICAgICAgIihMamF2YS9sYW5nL1N0cmluZztJKVYiLCAgICAgICAgICAgICAgICh2b2lkKiluU2NyaXB0Q0FkZERlZmluZUkzMiB9LAoteyJuU2NyaXB0Q0FkZERlZmluZUYiLCAgICAgICAgICAgICAiKExqYXZhL2xhbmcvU3RyaW5nO0YpViIsICAgICAgICAgICAgICAgKHZvaWQqKW5TY3JpcHRDQWRkRGVmaW5lRiB9LAoreyJyc25BZGFwdGVyMURCaW5kQWxsb2NhdGlvbiIsICAgICAgICIoSUlJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5BZGFwdGVyMURCaW5kQWxsb2NhdGlvbiB9LAoreyJyc25BZGFwdGVyMURTZXRDb25zdHJhaW50IiwgICAgICAgICIoSUlJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5BZGFwdGVyMURTZXRDb25zdHJhaW50IH0sCit7InJzbkFkYXB0ZXIxRERhdGEiLCAgICAgICAgICAgICAgICAgIihJSVtJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkFkYXB0ZXIxRERhdGFfaSB9LAoreyJyc25BZGFwdGVyMUREYXRhIiwgICAgICAgICAgICAgICAgICIoSUlbRilWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5BZGFwdGVyMUREYXRhX2YgfSwKK3sicnNuQWRhcHRlcjFEU3ViRGF0YSIsICAgICAgICAgICAgICAiKElJSUlbSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQWRhcHRlcjFEU3ViRGF0YV9pIH0sCit7InJzbkFkYXB0ZXIxRFN1YkRhdGEiLCAgICAgICAgICAgICAgIihJSUlJW0YpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkFkYXB0ZXIxRFN1YkRhdGFfZiB9LAoreyJyc25BZGFwdGVyMURDcmVhdGUiLCAgICAgICAgICAgICAgICIoSSlJIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5BZGFwdGVyMURDcmVhdGUgfSwKIAoteyJuUHJvZ3JhbUZyYWdtZW50U3RvcmVCZWdpbiIsICAgICAiKElJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Qcm9ncmFtRnJhZ21lbnRTdG9yZUJlZ2luIH0sCi17Im5Qcm9ncmFtRnJhZ21lbnRTdG9yZURlcHRoRnVuYyIsICIoSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblByb2dyYW1GcmFnbWVudFN0b3JlRGVwdGhGdW5jIH0sCi17Im5Qcm9ncmFtRnJhZ21lbnRTdG9yZURlcHRoTWFzayIsICIoWilWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblByb2dyYW1GcmFnbWVudFN0b3JlRGVwdGhNYXNrIH0sCi17Im5Qcm9ncmFtRnJhZ21lbnRTdG9yZUNvbG9yTWFzayIsICIoWlpaWilWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblByb2dyYW1GcmFnbWVudFN0b3JlQ29sb3JNYXNrIH0sCi17Im5Qcm9ncmFtRnJhZ21lbnRTdG9yZUJsZW5kRnVuYyIsICIoSUkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblByb2dyYW1GcmFnbWVudFN0b3JlQmxlbmRGdW5jIH0sCi17Im5Qcm9ncmFtRnJhZ21lbnRTdG9yZURpdGhlciIsICAgICIoWilWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblByb2dyYW1GcmFnbWVudFN0b3JlRGl0aGVyIH0sCi17Im5Qcm9ncmFtRnJhZ21lbnRTdG9yZUNyZWF0ZSIsICAgICIoKUkiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblByb2dyYW1GcmFnbWVudFN0b3JlQ3JlYXRlIH0sCit7InJzbkFkYXB0ZXIyREJpbmRBbGxvY2F0aW9uIiwgICAgICAgIihJSUkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkFkYXB0ZXIyREJpbmRBbGxvY2F0aW9uIH0sCit7InJzbkFkYXB0ZXIyRFNldENvbnN0cmFpbnQiLCAgICAgICAgIihJSUlJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkFkYXB0ZXIyRFNldENvbnN0cmFpbnQgfSwKK3sicnNuQWRhcHRlcjJERGF0YSIsICAgICAgICAgICAgICAgICAiKElJW0kpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQWRhcHRlcjJERGF0YV9pIH0sCit7InJzbkFkYXB0ZXIyRERhdGEiLCAgICAgICAgICAgICAgICAgIihJSVtGKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkFkYXB0ZXIyRERhdGFfZiB9LAoreyJyc25BZGFwdGVyMkRTdWJEYXRhIiwgICAgICAgICAgICAgICIoSUlJSUlJW0kpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5BZGFwdGVyMkRTdWJEYXRhX2kgfSwKK3sicnNuQWRhcHRlcjJEU3ViRGF0YSIsICAgICAgICAgICAgICAiKElJSUlJSVtGKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQWRhcHRlcjJEU3ViRGF0YV9mIH0sCit7InJzbkFkYXB0ZXIyRENyZWF0ZSIsICAgICAgICAgICAgICAgIihJKUkiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkFkYXB0ZXIyRENyZWF0ZSB9LAogCi17Im5Qcm9ncmFtQmluZENvbnN0YW50cyIsICAgICAgICAgICIoSUlJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblByb2dyYW1CaW5kQ29uc3RhbnRzIH0sCi17Im5Qcm9ncmFtQmluZFRleHR1cmUiLCAgICAgICAgICAgICIoSUlJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblByb2dyYW1CaW5kVGV4dHVyZSB9LAoteyJuUHJvZ3JhbUJpbmRTYW1wbGVyIiwgICAgICAgICAgICAiKElJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Qcm9ncmFtQmluZFNhbXBsZXIgfSwKK3sicnNuU2NyaXB0QmluZEFsbG9jYXRpb24iLCAgICAgICAgICAiKElJSUkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluU2NyaXB0QmluZEFsbG9jYXRpb24gfSwKK3sicnNuU2NyaXB0U2V0VGltZVpvbmUiLCAgICAgICAgICAgICAiKElJW0IpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluU2NyaXB0U2V0VGltZVpvbmUgfSwKK3sicnNuU2NyaXB0SW52b2tlIiwgICAgICAgICAgICAgICAgICAiKElJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluU2NyaXB0SW52b2tlIH0sCit7InJzblNjcmlwdEludm9rZVYiLCAgICAgICAgICAgICAgICAgIihJSUlbQilWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblNjcmlwdEludm9rZVYgfSwKK3sicnNuU2NyaXB0U2V0VmFySSIsICAgICAgICAgICAgICAgICAiKElJSUkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluU2NyaXB0U2V0VmFySSB9LAoreyJyc25TY3JpcHRTZXRWYXJGIiwgICAgICAgICAgICAgICAgICIoSUlJRilWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5TY3JpcHRTZXRWYXJGIH0sCit7InJzblNjcmlwdFNldFZhclYiLCAgICAgICAgICAgICAgICAgIihJSUlbQilWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblNjcmlwdFNldFZhclYgfSwKIAoteyJuUHJvZ3JhbUZyYWdtZW50Q3JlYXRlIiwgICAgICAgICAiKFtJKUkiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Qcm9ncmFtRnJhZ21lbnRDcmVhdGUgfSwKLXsiblByb2dyYW1GcmFnbWVudENyZWF0ZTIiLCAgICAgICAgIihMamF2YS9sYW5nL1N0cmluZztbSSlJIiwgICAgICAgICAgICAgICh2b2lkKiluUHJvZ3JhbUZyYWdtZW50Q3JlYXRlMiB9LAoreyJyc25TY3JpcHRDQmVnaW4iLCAgICAgICAgICAgICAgICAgICIoSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5TY3JpcHRDQmVnaW4gfSwKK3sicnNuU2NyaXB0Q1NldFNjcmlwdCIsICAgICAgICAgICAgICAiKElbQklJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluU2NyaXB0Q1NldFNjcmlwdCB9LAoreyJyc25TY3JpcHRDQ3JlYXRlIiwgICAgICAgICAgICAgICAgICIoSSlJIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5TY3JpcHRDQ3JlYXRlIH0sCiAKLXsiblByb2dyYW1SYXN0ZXJDcmVhdGUiLCAgICAgICAgICAgIihJSVpaWilJIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluUHJvZ3JhbVJhc3RlckNyZWF0ZSB9LAoteyJuUHJvZ3JhbVJhc3RlclNldFBvaW50U2l6ZSIsICAgICAiKElGKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Qcm9ncmFtUmFzdGVyU2V0UG9pbnRTaXplIH0sCi17Im5Qcm9ncmFtUmFzdGVyU2V0TGluZVdpZHRoIiwgICAgICIoSUYpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblByb2dyYW1SYXN0ZXJTZXRMaW5lV2lkdGggfSwKK3sicnNuUHJvZ3JhbVN0b3JlQmVnaW4iLCAgICAgICAgICAgICAiKElJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluUHJvZ3JhbVN0b3JlQmVnaW4gfSwKK3sicnNuUHJvZ3JhbVN0b3JlRGVwdGhGdW5jIiwgICAgICAgICAiKElJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluUHJvZ3JhbVN0b3JlRGVwdGhGdW5jIH0sCit7InJzblByb2dyYW1TdG9yZURlcHRoTWFzayIsICAgICAgICAgIihJWilWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblByb2dyYW1TdG9yZURlcHRoTWFzayB9LAoreyJyc25Qcm9ncmFtU3RvcmVDb2xvck1hc2siLCAgICAgICAgICIoSVpaWlopViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Qcm9ncmFtU3RvcmVDb2xvck1hc2sgfSwKK3sicnNuUHJvZ3JhbVN0b3JlQmxlbmRGdW5jIiwgICAgICAgICAiKElJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluUHJvZ3JhbVN0b3JlQmxlbmRGdW5jIH0sCit7InJzblByb2dyYW1TdG9yZURpdGhlciIsICAgICAgICAgICAgIihJWilWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblByb2dyYW1TdG9yZURpdGhlciB9LAoreyJyc25Qcm9ncmFtU3RvcmVDcmVhdGUiLCAgICAgICAgICAgICIoSSlJIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Qcm9ncmFtU3RvcmVDcmVhdGUgfSwKIAoteyJuUHJvZ3JhbVZlcnRleENyZWF0ZSIsICAgICAgICAgICAiKFopSSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Qcm9ncmFtVmVydGV4Q3JlYXRlIH0sCi17Im5Qcm9ncmFtVmVydGV4Q3JlYXRlMiIsICAgICAgICAgICIoTGphdmEvbGFuZy9TdHJpbmc7W0kpSSIsICAgICAgICAgICAgICAodm9pZCopblByb2dyYW1WZXJ0ZXhDcmVhdGUyIH0sCit7InJzblByb2dyYW1CaW5kQ29uc3RhbnRzIiwgICAgICAgICAgIihJSUlJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblByb2dyYW1CaW5kQ29uc3RhbnRzIH0sCit7InJzblByb2dyYW1CaW5kVGV4dHVyZSIsICAgICAgICAgICAgIihJSUlJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblByb2dyYW1CaW5kVGV4dHVyZSB9LAoreyJyc25Qcm9ncmFtQmluZFNhbXBsZXIiLCAgICAgICAgICAgICIoSUlJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Qcm9ncmFtQmluZFNhbXBsZXIgfSwKIAoteyJuTGlnaHRCZWdpbiIsICAgICAgICAgICAgICAgICAgICAiKClWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5MaWdodEJlZ2luIH0sCi17Im5MaWdodFNldElzTW9ubyIsICAgICAgICAgICAgICAgICIoWilWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkxpZ2h0U2V0SXNNb25vIH0sCi17Im5MaWdodFNldElzTG9jYWwiLCAgICAgICAgICAgICAgICIoWilWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkxpZ2h0U2V0SXNMb2NhbCB9LAoteyJuTGlnaHRDcmVhdGUiLCAgICAgICAgICAgICAgICAgICAiKClJIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5MaWdodENyZWF0ZSB9LAoteyJuTGlnaHRTZXRDb2xvciIsICAgICAgICAgICAgICAgICAiKElGRkYpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5MaWdodFNldENvbG9yIH0sCi17Im5MaWdodFNldFBvc2l0aW9uIiwgICAgICAgICAgICAgICIoSUZGRilWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkxpZ2h0U2V0UG9zaXRpb24gfSwKK3sicnNuUHJvZ3JhbUZyYWdtZW50Q3JlYXRlIiwgICAgICAgICAiKElbSSlJIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluUHJvZ3JhbUZyYWdtZW50Q3JlYXRlIH0sCit7InJzblByb2dyYW1GcmFnbWVudENyZWF0ZTIiLCAgICAgICAgIihJTGphdmEvbGFuZy9TdHJpbmc7W0kpSSIsICAgICAgICAgICAgICAodm9pZCopblByb2dyYW1GcmFnbWVudENyZWF0ZTIgfSwKIAoteyJuQ29udGV4dEJpbmRSb290U2NyaXB0IiwgICAgICAgICAiKEkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Db250ZXh0QmluZFJvb3RTY3JpcHQgfSwKLXsibkNvbnRleHRCaW5kUHJvZ3JhbUZyYWdtZW50U3RvcmUiLCIoSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQ29udGV4dEJpbmRQcm9ncmFtRnJhZ21lbnRTdG9yZSB9LAoteyJuQ29udGV4dEJpbmRQcm9ncmFtRnJhZ21lbnQiLCAgICAiKEkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Db250ZXh0QmluZFByb2dyYW1GcmFnbWVudCB9LAoteyJuQ29udGV4dEJpbmRQcm9ncmFtVmVydGV4IiwgICAgICAiKEkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Db250ZXh0QmluZFByb2dyYW1WZXJ0ZXggfSwKLXsibkNvbnRleHRCaW5kUHJvZ3JhbVJhc3RlciIsICAgICAgIihJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluQ29udGV4dEJpbmRQcm9ncmFtUmFzdGVyIH0sCit7InJzblByb2dyYW1SYXN0ZXJDcmVhdGUiLCAgICAgICAgICAgIihJWlpaKUkiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Qcm9ncmFtUmFzdGVyQ3JlYXRlIH0sCit7InJzblByb2dyYW1SYXN0ZXJTZXRMaW5lV2lkdGgiLCAgICAgIihJSUYpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblByb2dyYW1SYXN0ZXJTZXRMaW5lV2lkdGggfSwKK3sicnNuUHJvZ3JhbVJhc3RlclNldEN1bGxNb2RlIiwgICAgICAiKElJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluUHJvZ3JhbVJhc3RlclNldEN1bGxNb2RlIH0sCiAKLXsiblNhbXBsZXJCZWdpbiIsICAgICAgICAgICAgICAgICAgIigpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluU2FtcGxlckJlZ2luIH0sCi17Im5TYW1wbGVyU2V0IiwgICAgICAgICAgICAgICAgICAgICIoSUkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopblNhbXBsZXJTZXQgfSwKLXsiblNhbXBsZXJDcmVhdGUiLCAgICAgICAgICAgICAgICAgIigpSSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluU2FtcGxlckNyZWF0ZSB9LAoreyJyc25Qcm9ncmFtVmVydGV4Q3JlYXRlIiwgICAgICAgICAgICIoSVopSSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Qcm9ncmFtVmVydGV4Q3JlYXRlIH0sCit7InJzblByb2dyYW1WZXJ0ZXhDcmVhdGUyIiwgICAgICAgICAgIihJTGphdmEvbGFuZy9TdHJpbmc7W0kpSSIsICAgICAgICAgICAgICAodm9pZCopblByb2dyYW1WZXJ0ZXhDcmVhdGUyIH0sCiAKLXsiblNpbXBsZU1lc2hDcmVhdGUiLCAgICAgICAgICAgICAgIihJSVtJSSlJIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluU2ltcGxlTWVzaENyZWF0ZSB9LAoteyJuU2ltcGxlTWVzaEJpbmRWZXJ0ZXgiLCAgICAgICAgICAiKElJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5TaW1wbGVNZXNoQmluZFZlcnRleCB9LAoteyJuU2ltcGxlTWVzaEJpbmRJbmRleCIsICAgICAgICAgICAiKElJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5TaW1wbGVNZXNoQmluZEluZGV4IH0sCit7InJzbkNvbnRleHRCaW5kUm9vdFNjcmlwdCIsICAgICAgICAgIihJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkNvbnRleHRCaW5kUm9vdFNjcmlwdCB9LAoreyJyc25Db250ZXh0QmluZFByb2dyYW1TdG9yZSIsICAgICAgICIoSUkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkNvbnRleHRCaW5kUHJvZ3JhbVN0b3JlIH0sCit7InJzbkNvbnRleHRCaW5kUHJvZ3JhbUZyYWdtZW50IiwgICAgIihJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkNvbnRleHRCaW5kUHJvZ3JhbUZyYWdtZW50IH0sCit7InJzbkNvbnRleHRCaW5kUHJvZ3JhbVZlcnRleCIsICAgICAgIihJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbkNvbnRleHRCaW5kUHJvZ3JhbVZlcnRleCB9LAoreyJyc25Db250ZXh0QmluZFByb2dyYW1SYXN0ZXIiLCAgICAgICIoSUkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5Db250ZXh0QmluZFByb2dyYW1SYXN0ZXIgfSwKKworeyJyc25TYW1wbGVyQmVnaW4iLCAgICAgICAgICAgICAgICAgICIoSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5TYW1wbGVyQmVnaW4gfSwKK3sicnNuU2FtcGxlclNldCIsICAgICAgICAgICAgICAgICAgICAiKElJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluU2FtcGxlclNldCB9LAoreyJyc25TYW1wbGVyQ3JlYXRlIiwgICAgICAgICAgICAgICAgICIoSSlJIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5TYW1wbGVyQ3JlYXRlIH0sCisKK3sicnNuTWVzaENyZWF0ZSIsICAgICAgICAgICAgICAgICAgICAiKElJSSlJIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluTWVzaENyZWF0ZSB9LAoreyJyc25NZXNoQmluZFZlcnRleCIsICAgICAgICAgICAgICAgICIoSUlJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5NZXNoQmluZFZlcnRleCB9LAoreyJyc25NZXNoQmluZEluZGV4IiwgICAgICAgICAgICAgICAgICIoSUlJSUkpViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQqKW5NZXNoQmluZEluZGV4IH0sCisKK3sicnNuTWVzaEdldFZlcnRleEJ1ZmZlckNvdW50IiwgICAgICAiKElJKUkiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluTWVzaEdldFZlcnRleEJ1ZmZlckNvdW50IH0sCit7InJzbk1lc2hHZXRJbmRleENvdW50IiwgICAgICAgICAgICAgIihJSSlJIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbk1lc2hHZXRJbmRleENvdW50IH0sCit7InJzbk1lc2hHZXRWZXJ0aWNlcyIsICAgICAgICAgICAgICAgIihJSVtJSSlWIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkKiluTWVzaEdldFZlcnRpY2VzIH0sCit7InJzbk1lc2hHZXRJbmRpY2VzIiwgICAgICAgICAgICAgICAgIihJSVtJW0lJKVYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCopbk1lc2hHZXRJbmRpY2VzIH0sCiAKIH07CiAKQEAgLTE1MTAsMyArMTM2MCw0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BACisvKgorKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorKiAgIENvcHlyaWdodCAoQykgMjAwMS0yMDA5LCBJbnRlcm5hdGlvbmFsIEJ1c2luZXNzIE1hY2hpbmVzCisqICAgQ29ycG9yYXRpb24gYW5kIG90aGVycy4gIEFsbCBSaWdodHMgUmVzZXJ2ZWQuCisqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisqLworCisvKgorICogUG9ydGVkIHdpdGggbWlub3IgbW9kaWZpY2F0aW9ucyBmcm9tIElDVTRKIDQuMidzCisgKiBjb20uaWJtLmljdS50ZXh0LkFyYWJpY1NoYXBpbmcgY2xhc3MuCisgKi8KKworcGFja2FnZSBhbmRyb2lkLmljdS50ZXh0OworCisKKy8qKgorICogU2hhcGUgQXJhYmljIHRleHQgb24gYSBjaGFyYWN0ZXIgYmFzaXMuCisgKgorICogPHA+QXJhYmljU2hhcGluZyBwZXJmb3JtcyBiYXNpYyBvcGVyYXRpb25zIGZvciAic2hhcGluZyIgQXJhYmljIHRleHQuIEl0IGlzIG1vc3QKKyAqIHVzZWZ1bCBmb3IgdXNlIHdpdGggbGVnYWN5IGRhdGEgZm9ybWF0cyBhbmQgbGVnYWN5IGRpc3BsYXkgdGVjaG5vbG9neQorICogKHNpbXBsZSB0ZXJtaW5hbHMpLiBBbGwgb3BlcmF0aW9ucyBhcmUgcGVyZm9ybWVkIG9uIFVuaWNvZGUgY2hhcmFjdGVycy48L3A+CisgKgorICogPHA+VGV4dC1iYXNlZCBzaGFwaW5nIG1lYW5zIHRoYXQgc29tZSBjaGFyYWN0ZXIgY29kZSBwb2ludHMgaW4gdGhlIHRleHQgYXJlCisgKiByZXBsYWNlZCBieSBvdGhlcnMgZGVwZW5kaW5nIG9uIHRoZSBjb250ZXh0LiBJdCB0cmFuc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ZUxlbmd0aCwKKyAgICAgICAgICAgICAgICAgICAgIGNoYXJbXSBkZXN0LCBpbnQgZGVzdFN0YXJ0LCBpbnQgZGVzdFNpemUpIHRocm93cyBBcmFiaWNTaGFwaW5nRXhjZXB0aW9uIHsKKyAgICAgICAgaWYgKHNvdXJjZSA9PSBudWxsKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJzb3VyY2UgY2FuIG5vdCBiZSBudWxsIik7CisgICAgICAgIH0KKyAgICAgICAgaWYgKHNvdXJjZVN0YXJ0IDwgMCB8fCBzb3VyY2VMZW5ndGggPCAwIHx8IHNvdXJjZVN0YXJ0ICsgc291cmNlTGVuZ3RoID4gc291cmNlLmxlbmd0aCkgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiYmFkIHNvdXJjZSBzdGFydCAoIiArIHNvdXJjZVN0YXJ0ICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIikgb3IgbGVuZ3RoICgiICsgc291cmNlTGVuZ3RoICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIikgZm9yIGJ1ZmZlciBvZiBsZW5ndGggIiArIHNvdXJjZS5sZW5ndGgpOworICAgICAgICB9CisgICAgICAgIGlmIChkZXN0ID09IG51bGwgJiYgZGVzdFNpemUgIT0gMCkgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigibnVsbCBkZXN0IHJlcXVpcmVzIGRlc3RTaXplID09IDAiKTsKKyAgICAgICAgfQorICAgICAgICBpZiAoKGRlc3RTaXplICE9IDApICYmCisgICAgICAgICAgICAoZGVzdFN0YXJ0IDwgMCB8fCBkZXN0U2l6ZSA8IDAgfHwgZGVzdFN0YXJ0ICsgZGVzdFNpemUgPiBkZXN0Lmxlbmd0aCkpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oImJhZCBkZXN0IHN0YXJ0ICgiICsgZGVzdFN0YXJ0ICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIikgb3Igc2l6ZSAoIiArIGRlc3RTaXplICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIikgZm9yIGJ1ZmZlciBvZiBsZW5ndGggIiArIGRlc3QubGVuZ3RoKTsKKyAgICAgICAgfQorICAgICAgICAvKiBWYWxpZGF0ZSBpbnB1dCBvcHRpb25zICovCisgICAgICAgIGlmICggKChvcHRpb25zJlRBU0hLRUVMX01BU0spID4gMCkgJiYKKyAgICAgICAgICAgICAhKCgob3B0aW9ucyAmIFRBU0hLRUVMX01BU0spPT1UQVNIS0VFTF9CRUdJTikgIHx8CisgICAgICAgICAgICAgICAoKG9wdGlvbnMgJiBUQVNIS0VFTF9NQVNLKT09VEFTSEtFRUxfRU5EICkgICB8fAorICAgICAgICAgICAgICAgKChvcHRpb25zICYgVEFTSEtFRUxfTUFTSyk9PVRBU0hLRUVMX1JFU0laRSApfHwKKyAgICAgICAgICAgICAgICgob3B0aW9ucyAmIFRBU0hLRUVMX01BU0spPT1UQVNIS0VFTF9SRVBMQUNFX0JZX1RBVFdFRUwpKSApeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiV3JvbmcgVGFzaGtlZWwgYXJndW1lbnQiKTsKKyAgICAgICAgfQorCisgICAgICAgLy8vQ0xPVkVSOk9GRgorICAgICAgIC8vQWNjb3JkaW5nIHRvIFN0ZXZlbiBMb29taXMsIHRoZSBjb2RlIGlzIHVucmVhY2hhYmxlIHdoZW4geW91IE9SIGFsbCB0aGUgY29uc3RhbnRzIHdpdGhpbiB0aGUgaWYgc3RhdGVtZW50cworICAgICAgIGlmKCgob3B0aW9ucyZMQU1BTEVGX01BU0spID4gMCkmJgorICAgICAgICAgICAgICAhKCgob3B0aW9ucyAmIExBTUFMRUZfTUFTSyk9PUxBTUFMRUZfQkVHSU4pICB8fAorICAgICAgICAgICAgICAgICgob3B0aW9ucyAmIExBTUFMRUZfTUFTSyk9PUxBTUFMRUZfRU5EICkgICB8fAorICAgICAgICAgICAgICAgICgob3B0aW9ucyAmIExBTUFMRUZfTUFTSyk9PUxBTUFMRUZfUkVTSVpFICl8fAorICAgICAgICAgICAgICAgICAoKG9wdGlvbnMgJiBMQU1BTEVGX01BU0spPT1MQU1BTEVGX0FVVE8pICB8fAorICAgICAgICAgICAgICAgICAoKG9wdGlvbnMgJiBMQU1BTEVGX01BU0spPT1MQU1BTEVGX05FQVIpKSl7CisgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oIldyb25nIExhbSBBbGVmIGFyZ3VtZW50Iik7CisgICAgICAgfQorICAgICAgIC8vL0NMT1ZFUjpPTgorCisgICAgICAgLyogVmFsaWRhdGUgVGFzaGtlZWwgKFRhc2hrZWVsIHJlcGxhY2VtZW50IG9wdGlvbnMgc2hvdWxkIGJlIGVuYWJsZWQgaW4gc2hhcGluZyBtb2RlIG9ubHkpKi8KKyAgICAgICBpZigoKG9wdGlvbnMmVEFTSEtFRUxfTUFTSykgPiAwKSAmJiAob3B0aW9ucyZMRVRURVJTX01BU0spID09IExFVFRFUlNfVU5TSEFQRSkgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiVGFzaGtlZWwgcmVwbGFjZW1lbnQgc2hvdWxkIG5vdCBiZSBlbmFibGVkIGluIGRlc2hhcGluZyBtb2RlICIpOworICAgICAgIH0KKyAgICAgICByZXR1cm4gaW50ZXJuYWxTaGFwZShzb3VyY2UsIHNvdXJjZVN0YXJ0LCBzb3VyY2VMZW5ndGgsIGRlc3QsIGRlc3RTdGFydCwgZGVzdFNpemUpOwor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wZW5kKCJdIik7CisKKyAgICAgICAgcmV0dXJuIGJ1Zi50b1N0cmluZygpOworICAgIH0KKyAgICAvLy9DTE9WRVI6T04KKworICAgIC8vCisgICAgLy8gcG9ydGVkIGFwaQorICAgIC8vCisKKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgSVJSRUxFVkFOVCA9IDQ7CisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IExBTVRZUEUgPSAxNjsKKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgQUxFRlRZUEUgPSAzMjsKKworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBMSU5LUiA9IDE7CisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IExJTktMID0gMjsKKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgTElOS19NQVNLID0gMzsKKworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBpcnJlbGV2YW50UG9zW10gPSB7CisgICAgICAgIDB4MCwgMHgyLCAweDQsIDB4NiwgMHg4LCAweEEsIDB4QywgMHhFCisgICAgfTsKKworLyoKKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBjaGFyIGNvbnZlcnRMYW1BbGVmW10gPSAgeworICAgICAgICAnXHUwNjIyJywgLy8gRkVGNQorICAgICAgICAnXHUwNjIyJywgLy8gRkVGNgorICAgICAgICAnXHUwNjIzJywgLy8gRkVGNworICAgICAgICAnXHUwNjIzJywgLy8gRkVGOAorICAgICAgICAnXHUwNjI1JywgLy8gRkVGOQorICAgICAgICAnXHUwNjI1JywgLy8gRkVGQQorICAgICAgICAnXHUwNjI3JywgLy8gRkVGQgorICAgICAgICAnXHUwNjI3JyAgLy8gRkVGQworICAgIH07CisqLworCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IHRhaWxGYW1pbHlJc29sYXRlZEZpbmFsW10gPSB7CisgICAgICAgIC8qIEZFQjEgKi8gMSwKKyAgICAgICAgLyogRkVCMiAqLyAxLAorICAgICAgICAvKiBGRUIzICovIDAsCisgICAgICAgIC8qIEZFQjQgKi8gMCwKKyAgICAgICAgLyogRkVCNSAqLyAxLAorICAgICAgICAvKiBGRUI2ICovIDEsCisgICAgICAgIC8qIEZFQjcgKi8gMCwKKyAgICAgICAgLyogRkVCOCAqLyAwLAorICAgICAgICAvKiBGRUI5ICovIDEsCisgICAgICAgIC8qIEZFQkEgKi8gMSwKKyAgICAgICAgLyogRkVCQiAqLyAwLAorICAgICAgICAvKiBGRUJDICovIDAsCisgICAgICAgIC8qIEZFQkQgKi8gMSwKKyAgICAgICAgLyogRkVCRSAqLyAxCisgICAgfTsKKworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCB0YXNoa2VlbE1lZGlhbFtdID0geworICAgICAgICAvKiBGRTcwICovIDAsCisgICAgICAgIC8qIEZFNzEgKi8gMSwKKyAgICAgICAgLyogRkU3MiAqLyAwLAorICAgICAgICAvKiBGRTczICovIDAsCisgICAgICAgIC8qIEZFNzQgKi8gMCwKKyAgICAgICAgLyogRkU3NSAqLyAwLAorICAgICAgICAvKiBGRTc2ICovIDAsCisgICAgICAgIC8qIEZFNzcgKi8gMSwKKyAgICAgICAgLyogRkU3OCAqLyAwLAorICAgICAgICAvKiBGRTc5ICovIDEsCisgICAgICAgIC8qIEZFN0EgKi8gMCwKKyAgICAgICAgLyogRkU3QiAqLyAxLAorICAgICAgICAvKiBGRTdDICovIDAsCisgICAgICAgIC8qIEZFN0QgKi8gMSwKKyAgICAgICAgLyogRkU3RSAqLyAwLAorICAgICAgICAvKiBGRTdGICovIDEKKyAgICB9OworCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgY2hhciB5ZWhIYW16YVRvWWVoW10gPQorICAgIHsKKyAgICAvKiBpc29sYXRlZCovIDB4RkVFRiwKKyAgICAvKiBmaW5hbCAgICovIDB4RkVGMAorICAgIH07CisKKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBjaGFyIGNvbnZlcnROb3JtYWxpemVkTGFtQWxlZltdID0geworICAgICAgICAnXHUwNjIyJywgLy8gMDY1QworICAgICAgICAnXHUwNjIzJywgLy8gMDY1RAorICAgICAgICAnXHUwNjI1JywgLy8gMDY1RQorICAgICAgICAnXHUwNjI3JywgLy8gMDY1RgorICAgIH07CisKKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnRbXSBhcmFMaW5rID0geworICAgICAgICAxICAgICAgICAgICArIDMyICsgMjU2ICogMHgxMSwgIC8qMHgwNjIyKi8KKyAgICAgICAgMSAgICAgICAgICAgKyAzMiArIDI1NiAqIDB4MTMsICAvKjB4MDYyMyovCisgICAgICAgIDEgICAgICAgICAgICAgICAgKyAyNTYgKiAweDE1LCAgLyoweDA2MjQqLworICAgICAgICAxICAgICAgICAgICArIDMyICsgMjU2ICogMHgxNywgIC8qMHgwNjI1Ki8KKyAgICAgICAgMSArIDIgICAgICAgICAgICArIDI1NiAqIDB4MTksICAvKjB4MDYyNiovCisgICAgICAgIDEgICAgICAgICAgICsgMzIgKyAyNTYgKiAweDFELCAgLyoweDA2MjcqLworICAgICAgICAxICsgMiAgICAgICAgICAgICsgMjU2ICogMHgxRiwgIC8qMHgwNjI4Ki8KKyAgICAgICAgMSAgICAgICAgICAgICAgICArIDI1NiAqIDB4MjMsICAvKjB4MDYyOSovCisgICAgICAgIDEgKyAyICAgICAgICAgICAgKyAyNTYgKiAweDI1LCAgLyoweDA2MkEqLworICAgICAgICAxICsgMiAgICAgICAgICAgICsgMjU2ICogMHgyOSwgIC8qMHgwNjJCKi8KKyAgICAgICAgMSArIDIgICAgICAgICAgICArIDI1NiAqIDB4MkQsICAvKjB4MDYyQyovCisgICAgICAgIDEgKyAyICAgICAgICAgICAgKyAyNTYgKiAweDMxLCAgLyoweDA2MkQqLworICAgICAgICAxICsgMiAgICAgICAgICAgICsgMjU2ICogMHgzNSwgIC8qMHgwNjJFKi8KKyAgICAgICAgMSAgICAgICAgICAgICAgICArIDI1NiAqIDB4MzksICAvKjB4MDYyRiovCisgICAgICAgIDEgICAgICAgICAgICAgICAgKyAyNTYgKiAweDNCLCAgLyoweDA2MzAqLworICAgICAgICAxICAgICAgICAgICAgICAgICsgMjU2ICogMHgzRCwgIC8qMHgwNjMxKi8KKyAgICAgICAgMSAgICAgICAgICAgICAgICArIDI1NiAqIDB4M0YsICAvKjB4MDYzMiovCisgICAgICAgIDEgKyAyICAgICAgICAgICAgKyAyNTYgKiAweDQxLCAgLyoweDA2MzMqLworICAgICAgICAxICsgMiAgICAgICAgICAgICsgMjU2ICogMHg0NSwgIC8qMHgwNjM0Ki8KKyAgICAgICAgMSArIDIgICAgICAgICAgICArIDI1NiAqIDB4NDksICAvKjB4MDYzNSovCisgICAgICAgIDEgKyAyICAgICAgICAgICAgKyAyNTYgKiAweDRELCAgLyoweDA2MzYqLworICAgICAgICAxICsgMiAgICAgICAgICAgICsgMjU2ICogMHg1MSwgIC8qMHgwNjM3Ki8KKyAgICAgICAgMSArIDIgICAgICAgICAgICArIDI1NiAqIDB4NTUsICAvKjB4MDYzOCovCisgICAgICAgIDEgKyAyICAgICAgICAgICAgKyAyNTYgKiAweDU5LCAgLyoweDA2MzkqLworICAgICAgICAxICsgMiAgICAgICAgICAgICsgMjU2ICogMHg1RCwgIC8qMHgwNjNBKi8KKyAgICAgICAgMCwgMCwgMCwgMCwgMCwgICAgICAgICAgICAgICAgICAvKjB4MDYzQi0weDA2M0YqLworICAgICAgICAxICsgMiwgICAgICAgICAgICAgICAgICAgICAgICAgIC8qMHgwNjQwKi8KKyAgICAgICAgMSArIDIgICAgICAgICAgICArIDI1NiAqIDB4NjEsICAvKjB4MDY0MSovCisgICAgICAgIDEgKyAyICAgICAgICAgICAgKyAyNTYgKiAweDY1LCAgLyoweDA2NDIqLworICAgICAgICAxICsgMiAgICAgICAgICAgICsgMjU2ICogMHg2OSwgIC8qMHgwNjQzKi8KKyAgICAgICAgMSArIDIgICAgICAgKyAxNiArIDI1NiAqIDB4NkQsICAvKjB4MDY0NCovCisgICAgICAgIDEgKyAyICAgICAgICAgICAgKyAyNTYgKiAweDcxLCAgLyoweDA2NDUqLworICAgICAgICAxICsgMiAgICAgICAgICAgICsgMjU2ICogMHg3NSwgIC8qMHgwNjQ2Ki8KKyAgICAgICAgMSArIDIgICAgICAgICAgICArIDI1NiAqIDB4NzksICAvKjB4MDY0NyovCisgICAgICAgIDEgICAgICAgICAgICAgICAgKyAyNTYgKiAweDdELCAgLyoweDA2NDgqLworICAgICAgICAxICAgICAgICAgICAgICAgICsgMjU2ICogMHg3RiwgIC8qMHgwNjQ5Ki8KKyAgICAgICAgMSArIDIgICAgICAgICAgICArIDI1NiAqIDB4ODEsICAvKjB4MDY0QSovCisgICAgICAgIDQsIDQsIDQsIDQsICAgICAgICAgICAgICAgICAgICAgLyoweDA2NEItMHgwNjRFKi8KKyAgICAgICAgNCwgNCwgNCwgNCwgICAgICAgICAgICAgICAgICAgICAvKjB4MDY0Ri0weDA2NTIqLworICAgICAgICA0LCA0LCA0LCAwLCAwLCAgICAgICAgICAgICAgICAgIC8qMHgwNjUzLTB4MDY1NyovCisgICAgICAgIDAsIDAsIDAsIDAsICAgICAgICAgICAgICAgICAgICAgLyoweDA2NTgtMHgwNjVCKi8KKyAgICAgICAgMSAgICAgICAgICAgICAgICArIDI1NiAqIDB4ODUsICAvKjB4MDY1QyovCisgICAgICAgIDEgICAgICAgICAgICAgICAgKyAyNTYgKiAweDg3LCAgLyoweDA2NUQqLworICAgICAgICAxICAgICAgICAgICAgICAgICsgMjU2ICogMHg4OSwgIC8qMHgwNjVFKi8KKyAgICAgICAgMSAgICAgICAgICAgICAgICArIDI1NiAqIDB4OEIsICAvKjB4MDY1RiovCisgICAgICAgIDAsIDAsIDAsIDAsIDAsICAgICAgICAgICAgICAgICAgLyoweDA2NjAtMHgwNjY0Ki8KKyAgICAgICAgMCwgMCwgMCwgMCwgMCwgICAgICAgICAgICAgICAgICAvKjB4MDY2NS0weDA2NjkqLworICAgICAgICAwLCAwLCAwLCAwLCAwLCAwLCAgICAgICAgICAgICAgIC8qMHgwNjZBLTB4MDY2RiovCisgICAgICAgIDQsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyoweDA2NzAqLworICAgICAgICAwLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qMHgwNjcxKi8KKyAgICAgICAgMSAgICAgICAgICAgKyAzMiwgICAgICAgICAgICAgICAvKjB4MDY3MiovCisgICAgICAgIDEgICAgICAgICAgICsgMzIsICAgICAgICAgICAgICAgLyoweDA2NzMqLworICAgICAgICAwLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qMHgwNjc0Ki8KKyAgICAgICAgMSAgICAgICAgICAgKyAzMiwgICAgICAgICAgICAgICAvKjB4MDY3NSovCisgICAgICAgIDEsIDEsICAgICAgICAgICAgICAgICAgICAgICAgICAgLyoweDA2NzYtMHgwNjc3Ki8KKyAgICAgICAgMSsyLCAxKzIsIDErMiwgMSsyLCAxKzIsIDErMiwgICAvKjB4MDY3OC0weDA2N0QqLworICAgICAgICAxKzIsIDErMiwgMSsyLCAxKzIsIDErMiwgMSsyLCAgIC8qMHgwNjdFLTB4MDY4MyovCisgICAgICAgIDErMiwgMSsyLCAxKzIsIDErMiwgICAgICAgICAgICAgLyoweDA2ODQtMHgwNjg3Ki8KKyAgICAgICAgMSwgMSwgMSwgMSwgMSwgMSwgMSwgMSwgMSwgMSwgICAvKjB4MDY4OC0weDA2OTEqLworICAgICAgICAxLCAxLCAxLCAxLCAxLCAxLCAxLCAxLCAgICAgICAgIC8qMHgwNjkyLTB4MDY5OSovCisgICAgICAgIDErMiwgMSsyLCAxKzIsIDErMiwgMSsyLCAxKzIsICAgLyoweDA2OUEtMHgwNkEzKi8KKyAgICAgICAgMSsyLCAxKzIsIDErMiwgMSsyLCAgICAgICAgICAgICAvKjB4MDY5QS0weDA2QTMqLworICAgICAgICAxKzIsIDErMiwgMSsyLCAxKzIsIDErMiwgMSsyLCAgIC8qMHgwNkE0LTB4MDZBRCovCisgICAgICAgIDErMiwgMSsyLCAxKzIsIDErMiwgICAgICAgICAgICAgLyoweDA2QTQtMHgwNkFEKi8KKyAgICAgICAgMSsyLCAxKzIsIDErMiwgMSsyLCAxKzIsIDErMiwgICAvKjB4MDZBRS0weDA2QjcqLworICAgICAgICAxKzIsIDErMiwgMSsyLCAxKzIsICAgICAgICAgICAgIC8qMHgwNkFFLTB4MDZCNyovCisgICAgICAgIDErMiwgMSsyLCAxKzIsIDErMiwgMSsyLCAxKzIsICAgLyoweDA2QjgtMHgwNkJGKi8KKyAgICAgICAgMSsyLCAxKzIsICAgICAgICAgICAgICAgICAgICAgICAvKjB4MDZCOC0weDA2QkYqLworICAgICAgICAxLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qMHgwNkMwKi8KKyAgICAgICAgMSsyLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKjB4MDZDMSovCisgICAgICAgIDEsIDEsIDEsIDEsIDEsIDEsIDEsIDEsIDEsIDEsICAgLyoweDA2QzItMHgwNkNCKi8KKyAgICAgICAgMSsyLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKjB4MDZDQyovCisgICAgICAgIDEsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyoweDA2Q0QqLworICAgICAgICAxKzIsIDErMiwgMSsyLCAxKzIsICAgICAgICAgICAgIC8qMHgwNkNFLTB4MDZEMSovCisgICAgICAgIDEsIDEgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyoweDA2RDItMHgwNkQzKi8KKyAgICB9OworCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50W10gcHJlc0xpbmsgPSB7CisgICAgICAgIDEgKyAyLCAgICAgICAgICAgICAgICAgICAgICAgIC8qMHhGRTcwKi8KKyAgICAgICAgMSArIDIsICAgICAgICAgICAgICAgICAgICAgICAgLyoweEZFNzEqLworICAgICAgICAxICsgMiwgMCwgMSsgMiwgMCwgMSsgMiwgICAgICAvKjB4RkU3Mi0weEZFNzYqLworICAgICAgICAxICsgMiwgICAgICAgICAgICAgICAgICAgICAgICAvKjB4RkU3NyovCisgICAgICAgIDErIDIsIDEgKyAyLCAxKzIsIDEgKyAyLCAgICAgIC8qMHhGRTc4LTB4RkU4MSovCisgICAgICAgIDErIDIsIDEgKyAyLCAxKzIsIDEgKyAyLCAgICAgIC8qMHhGRTgyLTB4RkU4NSovCisgICAgICAgIDAsIDAgKyAzMiwgMSArIDMyLCAwICsgMzIsICAgIC8qMHhGRTg2LTB4RkU4OSovCisgICAgICAgIDEgKyAzMiwgMCwgMSwgIDAgKyAzMiwgICAgICAgIC8qMHhGRThBLTB4RkU4RCovCisgICAgICAgIDEgKyAzMiwgMCwgMiwgIDEgKyAyLCAgICAgICAgIC8qMHhGRThFLTB4RkU5MSovCisgICAgICAgIDEsIDAgKyAzMiwgMSArIDMyLCAwLCAgICAgICAgIC8qMHhGRTkyLTB4RkU5NSovCisgICAgICAgIDIsIDEgKyAyLCAxLCAwLCAgICAgICAgICAgICAgIC8qMHhGRTk2LTB4RkU5OSovCisgICAgICAgIDEsIDAsIDIsIDEgKyAyLCAgICAgICAgICAgICAgIC8qMHhGRTlBLTB4RkU5RCovCisgICAgICAgIDEsIDAsIDIsIDEgKyAyLCAgICAgICAgICAgICAgIC8qMHhGRTlFLTB4RkVBMSovCisgICAgICAgIDEsIDAsIDIsIDEgKyAyLCAgICAgICAgICAgICAgIC8qMHhGRUEyLTB4RkVBNSovCisgICAgICAgIDEsIDAsIDIsIDEgKyAyLCAgICAgICAgICAgICAgIC8qMHhGRUE2LTB4RkVBOSovCisgICAgICAgIDEsIDAsIDIsIDEgKyAyLCAgICAgICAgICAgICAgIC8qMHhGRUFBLTB4RkVBRCovCisgICAgICAgIDEsIDAsIDEsIDAsICAgICAgICAgICAgICAgICAgIC8qMHhGRUFFLTB4RkVCMSovCisgICAgICAgIDEsIDAsIDEsIDAsICAgICAgICAgICAgICAgICAgIC8qMHhGRUIyLTB4RkVCNSovCisgICAgICAgIDEsIDAsIDIsIDErMiwgICAgICAgICAgICAgICAgIC8qMHhGRUI2LTB4RkVCOSovCisgICAgICAgIDEsIDAsIDIsIDErMiwgICAgICAgICAgICAgICAgIC8qMHhGRUJBLTB4RkVCRCovCisgICAgICAgIDEsIDAsIDIsIDErMiwgICAgICAgICAgICAgICAgIC8qMHhGRUJFLTB4RkVDMSovCisgICAgICAgIDEsIDAsIDIsIDErMiwgICAgICAgICAgICAgICAgIC8qMHhGRUMyLTB4RkVDNSovCisgICAgICAgIDEsIDAsIDIsIDErMiwgICAgICAgICAgICAgICAgIC8qMHhGRUM2LTB4RkVDOSovCisgICAgICAgIDEsIDAsIDIsIDErMiwgICAgICAgICAgICAgICAgIC8qMHhGRUNBLTB4RkVDRCovCisgICAgICAgIDEsIDAsIDIsIDErMiwgICAgICAgICAgICAgICAgIC8qMHhGRUNFLTB4RkVEMSovCisgICAgICAgIDEsIDAsIDIsIDErMiwgICAgICAgICAgICAgICAgIC8qMHhGRUQyLTB4RkVENSovCisgICAgICAgIDEsIDAsIDIsIDErMiwgICAgICAgICAgICAgICAgIC8qMHhGRUQ2LTB4RkVEOSovCisgICAgICAgIDEsIDAsIDIsIDErMiwgICAgICAgICAgICAgICAgIC8qMHhGRURBLTB4RkVERCovCisgICAgICAgIDEsIDAsIDIsIDErMiwgICAgICAgICAgICAgICAgIC8qMHhGRURFLTB4RkVFMSovCisgICAgICAgIDEsIDAgKyAxNiwgMiArIDE2LCAxICsgMiArMTYsIC8qMHhGRUUyLTB4RkVFNSovCisgICAgICAgIDEgKyAxNiwgMCwgMiwgMSsyLCAgICAgICAgICAgIC8qMHhGRUU2LTB4RkVFOSovCisgICAgICAgIDEsIDAsIDIsIDErMiwgICAgICAgICAgICAgICAgIC8qMHhGRUVBLTB4RkVFRCovCisgICAgICAgIDEsIDAsIDIsIDErMiwgICAgICAgICAgICAgICAgIC8qMHhGRUVFLTB4RkVGMSovCisgICAgICAgIDEsIDAsIDEsIDAsICAgICAgICAgICAgICAgICAgIC8qMHhGRUYyLTB4RkVGNSovCisgICAgICAgIDEsIDAsIDIsIDErMiwgICAgICAgICAgICAgICAgIC8qMHhGRUY2LTB4RkVGOSovCisgICAgICAgIDEsIDAsIDEsIDAsICAgICAgICAgICAgICAgICAgIC8qMHhGRUZBLTB4RkVGRCovCisgICAgICAgIDEsIDAsIDEsIDAsCisgICAgICAgIDEKKyAgICB9OworCisgICAgcHJpdmF0ZSBzdGF0aWMgaW50W10gY29udmVydEZFdG8wNiA9IHsKKyAgICAgICAgLyoqKioqKioqKioqMCoqKioqKjEqKioqKioyKioqKioqMyoqKioqKjQqKioqKio1KioqKioqNioqKioqKjcqKioqKio4KioqKioqOSoqKioqKkEqKioqKipCKioqKioqQyoqKioqKkQqKioqKipFKioqKioqRioqKi8KKyAgICAgICAgLypGRTcqLyAgIDB4NjRCLCAweDY0QiwgMHg2NEMsIDB4NjRDLCAweDY0RCwgMHg2NEQsIDB4NjRFLCAweDY0RSwgMHg2NEYsIDB4NjRGLCAweDY1MCwgMHg2NTAsIDB4NjUxLCAweDY1MSwgMHg2NTIsIDB4NjUyLAorICAgICAgICAvKkZFOCovICAgMHg2MjEsIDB4NjIyLCAweDYyMiwgMHg2MjMsIDB4NjIzLCAweDYyNCwgMHg2MjQsIDB4NjI1LCAweDYyNSwgMHg2MjYsIDB4NjI2LCAweDYyNiwgMHg2MjYsIDB4NjI3LCAweDYyNywgMHg2MjgsCisgICAgICAgIC8qRkU5Ki8gICAweDYyOCwgMHg2MjgsIDB4NjI4LCAweDYyOSwgMHg2MjksIDB4NjJBLCAweDYyQSwgMHg2MkEsIDB4NjJBLCAweDYyQiwgMHg2MkIsIDB4NjJCLCAweDYyQiwgMHg2MkMsIDB4NjJDLCAweDYyQywKKyAgICAgICAgLypGRUEqLyAgIDB4NjJDLCAweDYyRCwgMHg2MkQsIDB4NjJELCAweDYyRCwgMHg2MkUsIDB4NjJFLCAweDYyRSwgMHg2MkUsIDB4NjJGLCAweDYy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wyfSwgezAsMSwxLDJ9LCB7MCwxLDEsM30gfSwKKyAgICAgICAgeyB7MCwwLDAsMH0sIHswLDAsMCwwfSwgezAsMSwwLDN9LCB7MCwxLDAsM30gfSwKKyAgICAgICAgeyB7MCwwLDEsMn0sIHswLDAsMSwyfSwgezAsMSwxLDJ9LCB7MCwxLDEsM30gfQorICAgIH07CisKKyAgICAvKgorICAgICAqIFRoaXMgZnVuY3Rpb24gc2hhcGVzIEV1cm9wZWFuIGRpZ2l0cyB0byBBcmFiaWMtSW5kaWMgZGlnaXRzCisgICAgICogaW4tcGxhY2UsIHdyaXRpbmcgb3ZlciB0aGUgaW5wdXQgY2hhcmFjdGVycy4gIERhdGEgaXMgaW4gdmlzdWFsCisgICAgICogb3JkZXIuCisgICAgICovCisgICAgcHJpdmF0ZSB2b2lkIHNoYXBlVG9BcmFiaWNEaWdpdHNXaXRoQ29udGV4dChjaGFyW10gZGVzdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBzdGFydCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBsZW5ndGgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFyIGRpZ2l0QmFzZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2xlYW4gbGFzdFN0cm9uZ1dhc0FMKSB7CisgICAgICAgIGRpZ2l0QmFzZSAtPSAnMCc7IC8vIG1vdmUgY29tbW9uIGFkanVzdG1lbnQgb3V0IG9mIGxvb3AKKworICAgICAgICBmb3IoaW50IGkgPSBzdGFydCArIGxlbmd0aDsgLS1pID49IHN0YXJ0OykgeworICAgICAgICAgICAgY2hhciBjaCA9IGRlc3RbaV07CisgICAgICAgICAgICBzd2l0Y2ggKENoYXJhY3Rlci5nZXREaXJlY3Rpb25hbGl0eShjaCkpIHsKKyAgICAgICAgICAgIGNhc2UgQ2hhcmFjdGVyLkRJUkVDVElPTkFMSVRZX0xFRlRfVE9fUklHSFQ6CisgICAgICAgICAgICBjYXNlIENoYXJhY3Rlci5ESVJFQ1RJT05BTElUWV9SSUdIVF9UT19MRUZUOgorICAgICAgICAgICAgICAgIGxhc3RTdHJvbmdXYXNBTCA9IGZhbHNlOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBDaGFyYWN0ZXIuRElSRUNUSU9OQUxJVFlfUklHSFRfVE9fTEVGVF9BUkFCSUM6CisgICAgICAgICAgICAgICAgbGFzdFN0cm9uZ1dhc0FMID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgQ2hhcmFjdGVyLkRJUkVDVElPTkFMSVRZX0VVUk9QRUFOX05VTUJFUjoKKyAgICAgICAgICAgICAgICBpZiAobGFzdFN0cm9uZ1dhc0FMICYmIGNoIDw9ICdcdTAwMzknKSB7CisgICAgICAgICAgICAgICAgICAgIGRlc3RbaV0gPSAoY2hhcikoY2ggKyBkaWdpdEJhc2UpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKgorICAgICAqIE5hbWUgICAgOiBpbnZlcnRCdWZmZXIKKyAgICAgKiBGdW5jdGlvbjogVGhpcyBmdW5jdGlvbiBpbnZlcnRzIHRoZSBidWZmZXIsIGl0J3MgdXNlZAorICAgICAqICAgICAgICAgICBpbiBjYXNlIHRoZSB1c2VyIHNwZWNpZmllcyB0aGUgYnVmZmVyIHRvIGJlCisgICAgICogICAgICAgICAgIFRFWFRfRElSRUNUSU9OX0xPR0lDQUwKKyAgICAgKi8KKyAgICBwcml2YXRlIHN0YXRpYyB2b2lkIGludmVydEJ1ZmZlcihjaGFyW10gYnVmZmVyLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBzdGFydCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgbGVuZ3RoKSB7CisKKyAgICAgICAgZm9yKGludCBpID0gc3RhcnQsIGogPSBzdGFydCArIGxlbmd0aCAtIDE7IGkgPCBqOyBpKyssIC0taikgeworICAgICAgICAgICAgY2hhciB0ZW1wID0gYnVmZmVyW2ldOworICAgICAgICAgICAgYnVmZmVyW2ldID0gYnVmZmVyW2pdOworICAgICAgICAgICAgYnVmZmVyW2pdID0gdGVtcDsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qCisgICAgICogTmFtZSAgICA6IGNoYW5nZUxhbUFsZWYKKyAgICAgKiBGdW5jdGlvbjogQ29udmVydHMgdGhlIEFsZWYgY2hhcmFjdGVycyBpbnRvIGFuIGVxdWl2YWxlbnQKKyAgICAgKiAgICAgICAgICAgTGFtQWxlZiBsb2NhdGlvbiBpbiB0aGUgMHgwNnh4IFJhbmdlLCB0aGlzIGlzIGFuCisgICAgICogICAgICAgICAgIGludGVybWVkaWF0ZSBzdGFnZSBpbiB0aGUgb3BlcmF0aW9uIG9mIHRoZSBwcm9ncmFtCisgICAgICogICAgICAgICAgIGxhdGVyIGl0J2xsIGJlIGNvbnZlcnRlZCBpbnRvIHRoZSAweEZFeHggTGFtQWxlZnMKKyAgICAgKiAgICAgICAgICAgaW4gdGhlIHNoYXBpbmcgZnVuY3Rpb24uCisgICAgICovCisgICAgcHJpdmF0ZSBzdGF0aWMgY2hhciBjaGFuZ2VMYW1BbGVmKGNoYXIgY2gpIHsKKyAgICAgICAgc3dpdGNoKGNoKSB7CisgICAgICAgIGNhc2UgJ1x1MDYyMic6IHJldHVybiAnXHUwNjVDJzsKKyAgICAgICAgY2FzZSAnXHUwNjIzJzogcmV0dXJuICdcdTA2NUQnOworICAgICAgICBjYXNlICdcdTA2MjUnOiByZXR1cm4gJ1x1MDY1RSc7CisgICAgICAgIGNhc2UgJ1x1MDYyNyc6IHJldHVybiAnXHUwNjVGJzsKKyAgICAgICAgZGVmYXVsdDogIHJldHVybiAnXHUwMDAwJzsgLy8gbm90IGEgbGFtYWxlZgorICAgICAgICB9CisgICAgfQorCisgICAgLyoKKyAgICAgKiBOYW1lICAgIDogc3BlY2lhbENoYXIKKyAgICAgKiBGdW5jdGlvbjogU3BlY2lhbCBBcmFiaWMgY2hhcmFjdGVycyBuZWVkIHNwZWNpYWwgaGFuZGxpbmcgaW4gdGhlIHNoYXBlVW5pY29kZQorICAgICAqICAgICAgICAgICBmdW5jdGlvbiwgdGhpcyBmdW5jdGlvbiByZXR1cm5zIDEgb3IgMiBmb3IgdGhlc2Ugc3BlY2lhbCBjaGFyYWN0ZXJzCisgICAgICovCisgICAgcHJpdmF0ZSBzdGF0aWMgaW50IHNwZWNpYWxDaGFyKGNoYXIgY2gpIHsKKyAgICAgICAgaWYgKChjaCA+ICdcdTA2MjEnICYmIGNoIDwgJ1x1MDYyNicpIHx8CisgICAgICAgICAgICAoY2ggPT0gJ1x1MDYyNycpIHx8CisgICAgICAgICAgICAoY2ggPiAnXHUwNjJFJyAmJiBjaCA8ICdcdTA2MzMnKSB8fAorICAgICAgICAgICAgKGNoID4gJ1x1MDY0NycgJiYgY2ggPCAnXHUwNjRBJykgfHwKKyAgICAgICAgICAgIChjaCA9PSAnXHUwNjI5JykpIHsKKyAgICAgICAgICAgIHJldHVybiAxOworICAgICAgICB9IGVsc2UgaWYgKGNoID49ICdcdTA2NEInICYmIGNoPD0gJ1x1MDY1MicpIHsKKyAgICAgICAgICAgIHJldHVybiAyOworICAgICAgICB9IGVsc2UgaWYgKGNoID49IDB4MDY1MyAmJiBjaCA8PSAweDA2NTUgfHwKKyAgICAgICAgICAgICAgICAgICBjaCA9PSAweDA2NzAgfHwKKyAgICAgICAgICAgICAgICAgICBjaCA+PSAweEZFNzAgJiYgY2ggPD0gMHhGRTdGKSB7CisgICAgICAgICAgICByZXR1cm4gMzsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIHJldHVybiAwOworICAgICAgICB9CisgICAgfQorCisgICAgLyoKKyAgICAgKiBOYW1lICAgIDogZ2V0TGluaworICAgICAqIEZ1bmN0aW9uOiBSZXNvbHZlcyB0aGUgbGluayBiZXR3ZWVuIHRoZSBjaGFyYWN0ZXJzIGFzCisgICAgICogICAgICAgICAgIEFyYWJpYyBjaGFyYWN0ZXJzIGhhdmUgZm91ciBmb3JtcyA6CisgICAgICogICAgICAgICAgIElzb2xhdGVkLCBJbml0aWFsLCBNaWRkbGUgYW5kIEZpbmFsIEZvcm0KKyAgICAgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBpbnQgZ2V0TGluayhjaGFyIGNoKSB7CisgICAgICAgIGlmIChjaCA+PSAnXHUwNjIyJyAmJiBjaCA8PSAnXHUwNkQzJykgeworICAgICAgICAgICAgcmV0dXJuIGFyYUxpbmtbY2ggLSAnXHUwNjIyJ107CisgICAgICAgIH0gZWxzZSBpZiAoY2ggPT0gJ1x1MjAwRCcpIHsKKyAgICAgICAgICAgIHJldHVybiAzOworICAgICAgICB9IGVsc2UgaWYgKGNoID49ICdcdTIwNkQnICYmIGNoIDw9ICdcdTIwNkYnKSB7CisgICAgICAgICAgICByZXR1cm4gNDsKKyAgICAgICAgfSBlbHNlIGlmIChjaCA+PSAnXHVGRTcwJyAmJiBjaCA8PSAnXHVGRUZDJykgeworICAgICAgICAgICAgcmV0dXJuIHByZXNMaW5rW2NoIC0gJ1x1RkU3MCddOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgcmV0dXJuIDA7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKgorICAgICAqIE5hbWUgICAgOiBjb3VudFNwYWNlcworICAgICAqIEZ1bmN0aW9uOiBDb3VudHMgdGhlIG51bWJlciBvZiBzcGFjZXMKKyAgICAgKiAgICAgICAgICAgYXQgZWFjaCBlbmQgb2YgdGhlIGxvZ2ljYWwgYnVmZmVyCisgICAgICovCisgICAgcHJpdmF0ZSBzdGF0aWMgaW50IGNvdW50U3BhY2VzTGVmdChjaGFyW10gZGVzdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBzdGFydCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBjb3VudCkgeworICAgICAgICBmb3IgKGludCBpID0gc3RhcnQsIGUgPSBzdGFydCArIGNvdW50OyBpIDwgZTsgKytpKSB7CisgICAgICAgICAgICBpZiAoZGVzdFtpXSAhPSBTUEFDRV9DSEFSKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIGkgLSBzdGFydDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4gY291bnQ7CisgICAgfQorCisgICAgcHJpdmF0ZSBzdGF0aWMgaW50IGNvdW50U3BhY2VzUmlnaHQoY2hhcltdIGRlc3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHN0YXJ0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBjb3VudCkgeworCisgICAgICAgIGZvciAoaW50IGkgPSBzdGFydCArIGNvdW50OyAtLWkgPj0gc3RhcnQ7KSB7CisgICAgICAgICAgICBpZiAoZGVzdFtpXSAhPSBTUEFDRV9DSEFSKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIHN0YXJ0ICsgY291bnQgLSAxIC0gaTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4gY291bnQ7CisgICAgfQorCisgICAgLyoKKyAgICAgKiBOYW1lICAgIDogaXNUYXNoa2VlbENoYXIKKyAgICAgKiBGdW5jdGlvbjogUmV0dXJucyB0cnVlIGZvciBUYXNoa2VlbCBjaGFyYWN0ZXJzIGVsc2UgcmV0dXJuIGZhbHNlCisgICAgICovCisgICAgcHJpdmF0ZSBzdGF0aWMgYm9vbGVhbiBpc1Rhc2hrZWVsQ2hhcihjaGFyIGNoKSB7CisgICAgICAgIHJldHVybiAoIGNoID49J1x1MDY0QicgJiYgY2ggPD0gJ1x1MDY1MicgKTsKKyAgICB9CisKKyAgICAvKgorICAgICAqTmFtZSAgICAgOiBpc1NlZW5UYWlsRmFtaWx5Q2hhcgorICAgICAqRnVuY3Rpb24gOiByZXR1cm5zIDEgaWYgdGhlIGNoYXJhY3RlciBpcyBhIHNlZW4gZmFtaWx5IGlzb2xhdGVkIGNoYXJhY3RlcgorICAgICAqICAgICAgICAgICBpbiB0aGUgRkUgcmFuZ2Ugb3RoZXJ3aXNlIHJldHVybnMgMAorICAgICAqLworCisgICAgcHJpdmF0ZSBzdGF0aWMgaW50IGlzU2VlblRhaWxGYW1pbHlDaGFyKGNoYXIgY2gpIHsKKyAgICAgICAgaWYgKGNoID49IDB4ZmViMSAmJiBjaCA8IDB4ZmViZil7CisgICAgICAgICAgICAgcmV0dXJuIHRhaWxGYW1pbHlJc29sYXRlZEZpbmFsIFtjaCAtIDB4RkVCMV07CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgcmV0dXJuIDA7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAgLyogTmFtZSAgICAgOiBpc1NlZW5GYW1pbHlDaGFyCisgICAgICAqIEZ1bmN0aW9uIDogcmV0dXJucyAxIGlmIHRoZSBjaGFyYWN0ZXIgaXMgYSBzZWVuIGZhbWlseSBjaGFyYWN0ZXIgaW4gdGhlIFVuaWNvZGUKKyAgICAgICogICAgICAgICAgICAwNiByYW5nZSBvdGhlcndpc2UgcmV0dXJucyAwCisgICAgICovCisKKyAgICBwcml2YXRlIHN0YXRpYyBpbnQgaXNTZWVuRmFtaWx5Q2hhcihjaGFyICBjaCl7CisgICAgICAgIGlmIChjaCA+PSAweDYzMyAmJiBjaCA8PSAweDYzNil7CisgICAgICAgICAgICByZXR1cm4gMTsKKyAgICAgICAgfWVsc2UgeworICAgICAgICAgICAgcmV0dXJuIDA7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKgorICAgICAqTmFtZSAgICAgOiBpc1RhaWxDaGFyCisgICAgICpGdW5jdGlvbiA6IHJldHVybnMgdHJ1ZSBpZiB0aGUgY2hhcmFjdGVyIG1hdGNoZXMgb25lIG9mIHRoZSB0YWlsIGNoYXJhY3RlcnMKKyAgICAgKiAgICAgICAgICAgKDB4ZmU3MyBvciAweDIwMGIpIG90aGVyd2lzZSByZXR1cm5zIGZhbHNlCisgICAgICovCisKKyAgICBwcml2YXRlIHN0YXRpYyBib29sZWFuIGlzVGFpbENoYXIoY2hhciBjaCkgeworICAgICAgICBpZihjaCA9PSBPTERfVEFJTF9DSEFSIHx8IGNoID09IE5FV19UQUlMX0NIQVIpeworICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9ZWxzZXsKKyAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKgorICAgICAqTmFtZSAgICAgOiBpc0FsZWZNYWtzb3VyYUNoYXIKKyAgICAgKkZ1bmN0aW9uIDogcmV0dXJucyB0cnVlIGlmIHRoZSBjaGFyYWN0ZXIgaXMgYSBBbGVmIE1ha3NvdXJhIEZpbmFsIG9yIGlzb2xhdGVkCisgICAgICogICAgICAgICAgIG90aGVyd2lzZSByZXR1cm5zIGZhbHNlCisgICAgICovCisgICAgcHJpdmF0ZSBzdGF0aWMgYm9vbGVhbiBpc0FsZWZNYWtzb3VyYUNoYXIoY2hhciBjaCkgeworICAgICAgICByZXR1cm4gKCAoY2ggPT0gMHhGRUVGKSB8fCAoIGNoID09IDB4RkVGMCkgfHwgKGNoID09IDB4MDY0OSkpOworICAgIH0KKworICAgIC8qCisgICAgICogTmFtZSAgICAgOiBpc1llaEhhbXphQ2hhcgorICAgICAqIEZ1bmN0aW9uIDogcmV0dXJucyB0cnVlIGlmIHRoZSBjaGFyYWN0ZXIgaXMgYSB5ZWhIYW16YSBpc29sYXRlZCBvciB5ZWhoYW16YQorICAgICAqICAgICAgICAgICAgZmluYWwgaXMgZm91bmQgb3RoZXJ3aXNlIHJldHVybnMgZmFsc2UKKyAgICAgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBib29sZWFuIGlzWWVoSGFtemFDaGFyKGNoYXIgY2gpIHsKKyAgICAgICAgaWYoKGNoPT0weEZFODkpfHwoY2g9PTB4RkU4QSkpeworICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgIH1lbHNleworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgfQorCisgICAgLyoKKyAgICAgKk5hbWUgICAgIDogaXNUYXNoa2VlbENoYXJGRQorICAgICAqRnVuY3Rpb24gOiBSZXR1cm5zIHRydWUgZm9yIFRhc2hrZWVsIGNoYXJhY3RlcnMgaW4gRkUgcmFuZ2UgZWxzZSByZXR1cm4gZmFsc2UKKyAgICAgKi8KKworICAgIHByaXZhdGUgc3RhdGljIGJvb2xlYW4gaXNUYXNoa2VlbENoYXJGRShjaGFyIGNoKSB7CisgICAgICAgIHJldHVybiAoIGNoIT0weEZFNzUgJiYoY2g+PTB4RkU3MCAmJiBjaDw9IDB4RkU3RikgKTsKKyAgICB9CisKKyAgICAvKgorICAgICAqIE5hbWU6IGlzVGFzaGtlZWxPblRhdHdlZWxDaGFyCisgICAgICogRnVuY3Rpb246IENoZWNrcyBpZiB0aGUgVGFzaGtlZWwgQ2hhcmFjdGVyIGlzIG9uIFRhdHdlZWwgb3Igbm90LGlmIHRoZQorICAgICAqICAgICAgICAgICBUYXNoa2VlbCBvbiB0YXR3ZWVsIChGRSByYW5nZSksIGl0IHJldHVybnMgMSBlbHNlIGlmIHRoZQorICAgICAqICAgICAgICAgICBUYXNoa2VlbCB3aXRoIHNoYWRkYSBvbiB0YXR3ZWVsIChGQyByYW5nZSlyZXR1cm4gMiBvdGhlcndpc2UKKyAgICAgKiAgICAgICAgICAgcmV0dXJucyAwCisgICAgICovCisgICAgcHJpdmF0ZSBzdGF0aWMgaW50I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l7CisgICAgICAgICAgICByZXR1cm4gKDEgLSB0YXNoa2VlbE1lZGlhbCBbY2ggLSAweEZFNzBdKTsKKyAgICAgICAgfSBlbHNlIGlmKGNoID49IDB4ZmM1ZSAmJiBjaCA8PSAweGZjNjMpeworICAgICAgICAgICAgcmV0dXJuIDE7CisgICAgICAgIH0gZWxzZXsKKyAgICAgICAgICAgIHJldHVybiAwOworICAgICAgICB9CisgICAgfQorCisgICAgLyoKKyAgICAgKiBOYW1lICAgIDogaXNBbGVmQ2hhcgorICAgICAqIEZ1bmN0aW9uOiBSZXR1cm5zIDEgZm9yIEFsZWYgY2hhcmFjdGVycyBlbHNlIHJldHVybiAwCisgICAgICovCisgICAgcHJpdmF0ZSBzdGF0aWMgYm9vbGVhbiBpc0FsZWZDaGFyKGNoYXIgY2gpIHsKKyAgICAgICAgcmV0dXJuIGNoID09ICdcdTA2MjInIHx8IGNoID09ICdcdTA2MjMnIHx8IGNoID09ICdcdTA2MjUnIHx8IGNoID09ICdcdTA2MjcnOworICAgIH0KKworICAgIC8qCisgICAgICogTmFtZSAgICA6IGlzTGFtQWxlZkNoYXIKKyAgICAgKiBGdW5jdGlvbjogUmV0dXJucyB0cnVlIGZvciBMYW1BbGVmIGNoYXJhY3RlcnMgZWxzZSByZXR1cm4gZmFsc2UKKyAgICAgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBib29sZWFuIGlzTGFtQWxlZkNoYXIoY2hhciBjaCkgeworICAgICAgICByZXR1cm4gY2ggPj0gJ1x1RkVGNScgJiYgY2ggPD0gJ1x1RkVGQyc7CisgICAgfQorCisgICAgcHJpdmF0ZSBzdGF0aWMgYm9vbGVhbiBpc05vcm1hbGl6ZWRMYW1BbGVmQ2hhcihjaGFyIGNoKSB7CisgICAgICAgIHJldHVybiBjaCA+PSAnXHUwNjVDJyAmJiBjaCA8PSAnXHUwNjVGJzsKKyAgICB9CisKKyAgICAvKgorICAgICAqIE5hbWUgICAgOiBjYWxjdWxhdGVTaXplCisgICAgICogRnVuY3Rpb246IFRoaXMgZnVuY3Rpb24gY2FsY3VsYXRlcyB0aGUgZGVzdFNpemUgdG8gYmUgdXNlZCBpbiBwcmVmbGlnaHRpbmcKKyAgICAgKiAgICAgICAgICAgd2hlbiB0aGUgZGVzdFNpemUgaXMgZXF1YWwgdG8gMAorICAgICAqLworICAgIHByaXZhdGUgaW50IGNhbGN1bGF0ZVNpemUoY2hhcltdIHNvdXJjZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBzb3VyY2VTdGFydCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBzb3VyY2VMZW5ndGgpIHsKKworICAgICAgICBpbnQgZGVzdFNpemUgPSBzb3VyY2VMZW5ndGg7CisKKyAgICAgICAgc3dpdGNoIChvcHRpb25zICYgTEVUVEVSU19NQVNLKSB7CisgICAgICAgIGNhc2UgTEVUVEVSU19TSEFQRToKKyAgICAgICAgY2FzZSBMRVRURVJTX1NIQVBFX1RBU0hLRUVMX0lTT0xBVEVEOgorICAgICAgICAgICAgaWYgKGlzTG9naWNhbCkgeworICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSBzb3VyY2VTdGFydCwgZSA9IHNvdXJjZVN0YXJ0ICsgc291cmNlTGVuZ3RoIC0gMTsgaSA8IGU7ICsraSkgeworICAgICAgICAgICAgICAgICAgICBpZiAoKHNvdXJjZVtpXSA9PSBMQU1fQ0hBUiAmJiBpc0FsZWZDaGFyKHNvdXJjZVtpKzFdKSkgfHwgaXNUYXNoa2VlbENoYXJGRShzb3VyY2VbaV0pKXsKKyAgICAgICAgICAgICAgICAgICAgICAgIC0tZGVzdFNpemU7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGVsc2UgeyAvLyB2aXN1YWwKKyAgICAgICAgICAgICAgICBmb3IoaW50IGkgPSBzb3VyY2VTdGFydCArIDEsIGUgPSBzb3VyY2VTdGFydCArIHNvdXJjZUxlbmd0aDsgaSA8IGU7ICsraSkgeworICAgICAgICAgICAgICAgICAgICBpZiAoKHNvdXJjZVtpXSA9PSBMQU1fQ0hBUiAmJiBpc0FsZWZDaGFyKHNvdXJjZVtpLTFdKSkgfHwgaXNUYXNoa2VlbENoYXJGRShzb3VyY2VbaV0pKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAtLWRlc3RTaXplOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgY2FzZSBMRVRURVJTX1VOU0hBUEU6CisgICAgICAgICAgICBmb3IoaW50IGkgPSBzb3VyY2VTdGFydCwgZSA9IHNvdXJjZVN0YXJ0ICsgc291cmNlTGVuZ3RoOyBpIDwgZTsgKytpKSB7CisgICAgICAgICAgICAgICAgaWYgKGlzTGFtQWxlZkNoYXIoc291cmNlW2ldKSkgeworICAgICAgICAgICAgICAgICAgICBkZXN0U2l6ZSsrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiBkZXN0U2l6ZTsKKyAgICB9CisKKworICAgIC8qCisgICAgICogTmFtZSAgICA6IGNvdW50U3BhY2VTdWIKKyAgICAgKiBGdW5jdGlvbjogQ291bnRzIG51bWJlciBvZiB0aW1lcyB0aGUgc3ViQ2hhciBhcHBlYXJzIGluIHRoZSBhcnJheQorICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgaW50IGNvdW50U3BhY2VTdWIoY2hhciBbXSBkZXN0LGludCBsZW5ndGgsIGNoYXIgc3ViQ2hhcil7CisgICAgICAgIGludCBpID0gMDsKKyAgICAgICAgaW50IGNvdW50ID0gMDsKKyAgICAgICAgd2hpbGUgKGkgPCBsZW5ndGgpIHsKKyAgICAgICAgICBpZiAoZGVzdFtpXSA9PSBzdWJDaGFyKSB7CisgICAgICAgICAgICAgIGNvdW50Kys7CisgICAgICAgICAgICAgIH0KKyAgICAgICAgICBpKys7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGNvdW50OworICAgIH0KKworICAgIC8qCisgICAgICogTmFtZSAgICA6IHNoaWZ0QXJyYXkKKyAgICAgKiBGdW5jdGlvbjogU2hpZnRzIGNoYXJhY3RlcnMgdG8gcmVwbGFjZSBzcGFjZSBzdWIgY2hhcmFjdGVycworICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgdm9pZCBzaGlmdEFycmF5KGNoYXIgW10gZGVzdCxpbnQgc3RhcnQsIGludCBlLCBjaGFyIHN1YkNoYXIpeworICAgICAgICBpbnQgdyA9IGU7CisgICAgICAgIGludCByID0gZTsKKyAgICAgICAgd2hpbGUgKC0tciA+PSBzdGFydCkgeworICAgICAgICAgIGNoYXIgY2ggPSBkZXN0W3JdOworICAgICAgICAgIGlmIChjaCAhPSBzdWJDaGFyKSB7CisgICAgICAgICAgICAtLXc7CisgICAgICAgICAgICBpZiAodyAhPSByKSB7CisgICAgICAgICAgICAgIGRlc3Rbd10gPSBjaDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICB9CisgICAgICAgIH0KKyAgIH0KKworICAgIC8qCisgICAgICogTmFtZSAgICA6IGZsaXBBcnJheQorICAgICAqIEZ1bmN0aW9uOiBpbnZlcnRzIGFycmF5LCBzbyB0aGF0IHN0YXJ0IGJlY29tZXMgZW5kIGFuZCB2aWNlIHZlcnNhCisgICAgICovCisgICAgICBwdWJsaWMgc3RhdGljIGludCBmbGlwQXJyYXkoY2hhciBbXSBkZXN0LCBpbnQgc3RhcnQsIGludCBlLCBpbnQgdyl7CisgICAgICAgIGludCByOworICAgICAgICBpZiAodyA+IHN0YXJ0KSB7CisgICAgICAgIC8vIHNoaWZ0LCBhc3N1bWUgc21hbGwgYnVmZmVyIHNpemUgc28gZG9uJ3QgdXNlIGFycmF5Y29weQorICAgICAgICAgIHIgPSB3OworICAgICAgICAgIHcgPSBzdGFydDsKKyAgICAgICAgICB3aGlsZSAociA8IGUpIHsKKyAgICAgICAgICAgIGRlc3RbdysrXSA9IGRlc3RbcisrXTsKKyAgICAgICAgICAgfQorICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICB3ID0gZTsKKyAgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHc7CisgICAgICB9CisKKyAgICAvKgorICAgICAqIE5hbWUgICAgIDogaGFuZGxlVGFzaGtlZWxXaXRoVGF0d2VlbAorICAgICAqIEZ1bmN0aW9uIDogUmVwbGFjZXMgVGFzaGtlZWwgYXMgZm9sbG93aW5nOgorICAgICAqICAgICAgICAgICAgQ2FzZSAxIDppZiB0aGUgVGFzaGtlZWwgb24gdGF0d2VlbCwgcmVwbGFjZSBpdCB3aXRoIFRhdHdlZWwuCisgICAgICogICAgICAgICAgICBDYXNlIDIgOmlmIHRoZSBUYXNoa2VlbCBhZ2dyZWdhdGVkIHdpdGggU2hhZGRhIG9uIFRhdHdlZWwsIHJlcGxhY2UKKyAgICAgKiAgICAgICAgICAgICAgICAgICBpdCB3aXRoIFNoYWRkYSBvbiBUYXR3ZWVsLgorICAgICAqICAgICAgICAgICAgQ2FzZSAzOiBpZiB0aGUgVGFzaGtlZWwgaXMgaXNvbGF0ZWQgcmVwbGFjZSBpdCB3aXRoIFNwYWNlLgorICAgICAqCisgICAgICovCisgICAgcHJpdmF0ZSBzdGF0aWMgaW50IGhhbmRsZVRhc2hrZWVsV2l0aFRhdHdlZWwoY2hhcltdIGRlc3QsIGludCBzb3VyY2VMZW5ndGgpIHsKKyAgICAgICAgICAgICAgICAgICAgIGludCBpOworICAgICAgICAgICAgICAgICAgICAgZm9yKGkgPSAwOyBpIDwgc291cmNlTGVuZ3RoOyBpKyspeworICAgICAgICAgICAgICAgICAgICAgICAgIGlmKChpc1Rhc2hrZWVsT25UYXR3ZWVsQ2hhcihkZXN0W2ldKSA9PSAxKSl7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlc3RbaV0gPSBUQVRXRUVMX0NIQVI7CisgICAgICAgICAgICAgICAgICAgICAgICB9ZWxzZSBpZigoaXNUYXNoa2VlbE9uVGF0d2VlbENoYXIoZGVzdFtpXSkgPT0gMikpeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXN0W2ldID0gU0hBRERBX1RBVFdFRUxfQ0hBUjsKKyAgICAgICAgICAgICAgICAgICAgICAgIH1lbHNlIGlmKChpc0lzb2xhdGVkVGFzaGtlZWxDaGFyKGRlc3RbaV0pPT0xKSAmJiBkZXN0W2ldICE9IFNIQUREQV9DSEFSKXsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVzdFtpXSA9IFNQQUNFX0NIQVI7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICByZXR1cm4gc291cmNlTGVuZ3RoOworICAgIH0KKworICAgIC8qCisgICAgICpOYW1lICAgICA6IGhhbmRsZUdlbmVyYXRlZFNwYWNlcworICAgICAqRnVuY3Rpb24gOiBUaGUgc2hhcGVVbmljb2RlIGZ1bmN0aW9uIGNvbnZlcnRzIExhbSArIEFsZWYgaW50byBMYW1BbGVmICsgc3BhY2UsCisgICAgICogICAgICAgICAgIGFuZCBUYXNoa2VlbCB0byBzcGFjZS4KKyAgICAgKiAgICAgICAgICAgaGFuZGxlR2VuZXJhdGVkU3BhY2VzIGZ1bmN0aW9uIHB1dHMgdGhlc2UgZ2VuZXJhdGVkIHNwYWNlcworICAgICAqICAgICAgICAgICBhY2NvcmRpbmcgdG8gdGhlIG9wdGlvbnMgdGhlIHVzZXIgc3BlY2lmaWVzLiBMYW1BbGVmIGFuZCBUYXNoa2VlbAorICAgICAqICAgICAgICAgICBzcGFjZXMgY2FuIGJlIHJlcGxhY2VkIGF0IGJlZ2luLCBhdCBlbmQsIGF0IG5lYXIgb3IgZGVjcmVhc2UgdGhlCisgICAgICogICAgICAgICAgIGJ1ZmZlciBzaXplLgorICAgICAqCisgICAgICogICAgICAgICAgIFRoZXJlIGlzIGFsc28gQXV0byBvcHRpb24gZm9yIExhbUFsZWYgYW5kIHRhc2hrZWVsLCB3aGljaCB3aWxsIHB1dAorICAgICAqICAgICAgICAgICB0aGUgc3BhY2VzIGF0IGVuZCBvZiB0aGUgYnVmZmVyIChvciBlbmQgb2YgdGV4dCBpZiB0aGUgdXNlciB1c2VkCisgICAgICogICAgICAgICAgIHRoZSBvcHRpb24gU1BBQ0VTX1JFTEFUSVZFX1RPX1RFWFRfQkVHSU5fRU5EKS4KKyAgICAgKgorICAgICAqICAgICAgICAgICBJZiB0aGUgdGV4dCB0eXBlIHdhcyB2aXN1YWxfTFRSIGFuZCB0aGUgb3B0aW9uCisgICAgICogICAgICAgICAgIFNQQUNFU19SRUxBVElWRV9UT19URVhUX0JFR0lOX0VORCB3YXMgc2VsZWN0ZWQgdGhlIEVORAorICAgICAqICAgICAgICAgICBvcHRpb24gd2lsbCBwbGFjZSB0aGUgc3BhY2UgYXQgdGhlIGJlZ2lubmluZyBvZiB0aGUgYnVmZmVyIGFuZAorICAgICAqICAgICAgICAgICBCRUdJTiB3aWxsIHBsYWNlIHRoZSBzcGFjZSBhdCB0aGUgZW5kIG9mIHRoZSBidWZmZXIuCisgICAgICovCisgIHByaXZhdGUgaW50IGhhbmRsZUdlbmVyYXRlZFNwYWNlcyhjaGFyW10gZGVzdCwKKyAgICAgICAgICAgIGludCBzdGFydCwKKyAgICAgICAgICAgIGludCBsZW5ndGgpIHsKKworICAgICAgaW50IGxlbk9wdGlvbnNMYW1BbGVmID0gb3B0aW9ucyAmIExBTUFMRUZfTUFTSzsKKyAgICAgIGludCBsZW5PcHRpb25zVGFzaGtlZWwgPSBvcHRpb25zICYgVEFTSEtFRUxfTUFTSzsKKyAgICAgIGJvb2xlYW4gbGFtQWxlZk9uID0gZmFsc2U7CisgICAgICBib29sZWFuIHRhc2hrZWVsT24gPSBmYWxzZTsKKworICAgICAgaWYgKCFpc0xvZ2ljYWwgJiAhc3BhY2VzUmVsYXRpdmVUb1RleHRCZWdpbkVuZCkgeworICAgICAgICAgIHN3aXRjaCAobGVuT3B0aW9uc0xhbUFsZWYpIHsKKyAgICAgICAgICBjYXNlIExBTUFMRUZfQkVHSU46IGxlbk9wdGlvbnNMYW1BbGVmID0gTEFNQUxFRl9FTkQ7IGJyZWFrOworICAgICAgICAgIGNhc2UgTEFNQUxFRl9FTkQ6IGxlbk9wdGlvbnNMYW1BbGVmID0gTEFNQUxFRl9CRUdJTjsgYnJlYWs7CisgICAgICAgICAgZGVmYXVsdDogYnJlYWs7CisgICAgICAgICB9CisgICAgICAgICAgc3dpdGNoIChsZW5PcHRpb25zVGFzaGtlZWwpeworICAgICAgICAgIGNhc2UgVEFTSEtFRUxfQkVHSU46IGxlbk9wdGlvbnNUYXNoa2VlbCA9IFRBU0hLRUVMX0VORDsgYnJlYWs7CisgICAgICAgICAgY2FzZSBUQVNIS0VFTF9FTkQ6IGxlbk9wdGlvbnNUYXNoa2VlbCA9IFRBU0hLRUVMX0JFR0lOOyBicmVhazsKKyAgICAgICAgICBkZWZhdWx0OiBicmVhazsKKyAgICAgICAgICB9CisgICAgICAgIH0KKworCisgICAgICBpZiAobGVuT3B0aW9uc0xhbUFsZWYgPT0gTEFNQUxFRl9ORUFSKSB7CisgICAgICAgICAgZm9yIChpbnQgaSA9IHN0YXJ0LCBlID0gaSArIGxlbmd0aDsgaSA8IGU7ICsraSkgeworICAgICAgICAgICAgICBpZiAoZGVzdFtpXSA9PSBMQU1BTEVGX1NQQUNFX1NVQikgeworICAgICAgICAgICAgICAgICAgZGVzdFtpXSA9IFNQQUNFX0NIQVJfRk9SX0xBTUFMRUY7CisgICAgICAgICAgICAgIH0KKyAgICAgICAgICB9CisKKyAgICAgIH0gZWxzZSB7CisKKyAgICAgICAgICBmaW5hbCBpbnQgZSA9IHN0YXJ0ICsgbGVuZ3RoOworICAgICAgICAgIGludCB3TCA9IGNvdW50U3BhY2VTdWIoZGVzdCwgbGVuZ3RoLCBMQU1BTEVGX1NQQUNFX1NVQik7CisgICAgICAgICAgaW50IHdUID0gY291bnRTcGFjZVN1YihkZXN0LCBsZW5ndGgsIFRBU0hLRUVMX1NQQUNFX1NVQik7CisKKyAgICAgICAgICBpZiAobGVuT3B0aW9uc0xhbUFsZWYgPT0gTEFNQUxFRl9FTkQpeworICAgICAgICAgICAgbGFtQWxlZk9uID0gdHJ1ZTsKKyAgICAgICAgICB9CisgICAgICAgICAgaWYgKGxlbk9wdGlvbnNUYXNoa2VlbCA9PSBUQVNIS0VFTF9FTkQpeworICAgICAgICAgICAgdGFzaGtlZWxPbiA9IHRydWU7CisgICAgICAgICAgfQorCisKKyAgICAgICAgICBpZiAobGFtQWxlZk9uICYmIChsZW5PcHRpb25zTGFtQWxlZiA9PSBMQU1BTEVGX0VORCkpIHsKKyAgICAgICAgICAgIHNoaWZ0QXJyYXkoZGVzdCwgc3RhcnQsIGUsIExBTUFMRUZfU1BBQ0VfU1VCKTsKKyAgICAgICAgICAgIHdoaWxlICh3TCA+IHN0YXJ0KSB7CisgICAgICAgICAgICAgICAgZGVzdFstLXdMXSA9IFNQQUNFX0NIQVI7CisgICAgICAgICAgICB9CisgICAgICAgICAgfQorCisgICAgICAgICAgaWYgKHRhc2hrZWVsT24gJiYgKGxlbk9wdGlvbnNUYXNoa2VlbCA9PSBUQVNIS0VFTF9FTkQpKXsKKyAgICAgICAgICAgIHNoaWZ0QXJyYXkoZGVzdCwgc3RhcnQsIGUsIFRBU0hLRUVMX1NQQUNFX1NVQik7CisgICAgICAgICAgICB3aGlsZSAod1QgPiBzdGFydCkgeworICAgICAgICAgICAgICAgICBkZXN0Wy0td1RdID0gU1BBQ0VfQ0hBUjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICB9CisKKyAgICAgICAgICBsYW1BbGVmT24gPSBmYWxzZTsKKyAgICAgICAgICB0YXNoa2VlbE9uID0gZmFsc2U7CisKKyAgICAgICAgICBpZiAobGVuT3B0aW9uc0xhbUFsZWYgPT0gTEFNQUxFRl9SRVNJWkUpeworICAgICAgICAgICAgbGFtQWxlZk9uID0gdHJ1ZTsKKyAgICAgICAgICB9CisgICAgICAgICAgaWYgKGxlbk9wdGlvbnNUYXNoa2VlbCA9PSBUQVNIS0VFTF9SRVNJWkUpeworICAgICAgICAgICAgdGFzaGtlZWxPbiA9IHRydWU7CisgICAgICAgICAgfQorCisgICAgICAgICAgaWYgKGxhbUFsZWZPbiAmJiAobGVuT3B0aW9uc0xhbUFsZWYgPT0gTEFNQUxFRl9SRVNJWkUpKXsKKyAgICAgICAgICAgICAgc2hpZnRBcnJheShkZXN0LCBzdGFydCwgZSwgTEFNQUxFRl9TUEFDRV9TVUIpOworICAgICAgICAgICAgICB3TCA9IGZsaXBBcnJheShkZXN0LHN0YXJ0LGUsIHdMKTsKKyAgICAgICAgICAgICAgbGVuZ3RoID0gd0wgLSBzdGFydDsKKyAgICAgICAgICB9CisgICAgICAgICAgaWYgKHRhc2hrZWVsT24gJiYgKGxlbk9wdGlvbnNUYXNoa2VlbCA9PSBUQVNIS0VFTF9SRVNJWkUpKSB7CisgICAgICAgICAgICAgIHNoaWZ0QXJyYXkoZGVzdCwgc3RhcnQsIGUsIFRBU0hLRUVMX1NQQUNFX1NVQik7CisgICAgICAgICAgICAgIHdUID0gZmxpcEFycmF5KGRlc3Qsc3RhcnQsZSwgd1QpOworICAgICAgICAgICAgICBsZW5ndGggPSB3VCAtIHN0YXJ0OworICAgICAgICAgIH0KKworICAgICAgICAgIGxhbUFsZWZPbiA9IGZhbHNlOworICAgICAgICAgIHRhc2hrZWVsT24gPSBmYWxzZTsKKworICAgICAgICAgIGlmICgobGVuT3B0aW9uc0xhbUFsZWYgPT0gTEFNQUxFRl9CRUdJTikgfHwKKyAgICAgICAgICAgICAgKGxlbk9wdGlvbnNMYW1BbGVmID09IExBTUFMRUZfQVVUTykpeworICAgICAgICAgICAgICAgIGxhbUFsZWZPbiA9IHRydWU7CisgICAgICAgICAgfQorICAgICAgICAgIGlmIChsZW5PcHRpb25zVGFzaGtlZWwgPT0gVEFTSEtFRUxfQkVHSU4peworICAgICAgICAgICAgICAgIHRhc2hrZWVsT24gPSB0cnVlOworICAgICAgICAgIH0KKworICAgICAgICAgIGlmIChsYW1BbGVmT24gJiYgKChsZW5PcHRpb25zTGFtQWxlZiA9PSBMQU1BTEVGX0JFR0lOKXx8CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGxlbk9wdGlvbnNMYW1BbGVmID09IExBTUFMRUZfQVVUTykpKSB7IC8vIHNwYWNlcyBhdCBiZWdpbm5pbmcKKyAgICAgICAgICAgICAgc2hpZnRBcnJheShkZXN0LCBzdGFydCwgZSwgTEFNQUxFRl9TUEFDRV9TVUIpOworICAgICAgICAgICAgICAgd0wgPSBmbGlwQXJyYXkoZGVzdCxzdGFydCxlLCB3TCk7CisgICAgICAgICAgICAgICAgICB3aGlsZSAod0wgPCBlKSB7CisgICAgICAgICAgICAgICAgICAgICAgZGVzdFt3TCsrXSA9IFNQQUNFX0NIQVI7CisgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgaWYodGFzaGtlZWxPbiAmJiAobGVuT3B0aW9uc1Rhc2hrZWVsID09IFRBU0hLRUVMX0JFR0lOKSl7CisgICAgICAgICAgICAgICBzaGlmdEFycmF5KGRlc3QsIHN0YXJ0LCBlLCBUQVNIS0VFTF9TUEFDRV9TVUIpOworICAgICAgICAgICAgICAgd1QgPSBmbGlwQXJyYXkoZGVzdCxzdGFydCxlLCB3VCk7CisgICAgICAgICAgICAgICAgICB3aGlsZSAod1QgPCBlKSB7CisgICAgICAgICAgICAgICAgICAgICAgZGVzdFt3VCsrXSA9IFNQQUNFX0NIQVI7CisgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgfQorCisgICAgICByZXR1cm4gbGVuZ3RoOworICB9CisKKworICA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90Rm91bmQgPSBmYWxzZTsKKworICAgICAgaWYgKGxhY291bnQgPiBjb3VudFNwYWNlc0xlZnQoZGVzdCwgc3RhcnQsIGxlbmd0aCkpIHsKKyAgICAgICAgICBzcGFjZU5vdEZvdW5kID0gdHJ1ZTsKKyAgICAgICAgICByZXR1cm4gc3BhY2VOb3RGb3VuZDsKKyAgICAgIH0KKyAgICAgIGZvciAoaW50IHIgPSBzdGFydCArIGxhY291bnQsIHcgPSBzdGFydCwgZSA9IHN0YXJ0ICsgbGVuZ3RoOyByIDwgZTsgKytyKSB7CisgICAgICAgICAgY2hhciBjaCA9IGRlc3Rbcl07CisgICAgICAgICAgaWYgKGlzTm9ybWFsaXplZExhbUFsZWZDaGFyKGNoKSkgeworICAgICAgICAgICAgICBkZXN0W3crK10gPSBjb252ZXJ0Tm9ybWFsaXplZExhbUFsZWZbY2ggLSAnXHUwNjVDJ107CisgICAgICAgICAgICAgIGRlc3RbdysrXSA9IExBTV9DSEFSOworICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgIGRlc3RbdysrXSA9IGNoOworICAgICAgICAgIH0KKyAgICAgIH0KKyAgICAgIHJldHVybiBzcGFjZU5vdEZvdW5kOworICB9CisKKyAgLyoKKyAgICpOYW1lICAgICA6IGV4cGFuZENvbXBvc2l0Q2hhckF0TmVhcgorICAgKkZ1bmN0aW9uIDogRXhwYW5kcyB0aGUgTGFtQWxlZiBjaGFyYWN0ZXIgaW50byBMYW0gKyBBbGVmLCBZZWhIYW16YSBjaGFyYWN0ZXIKKyAgICogICAgICAgICAgIGludG8gWWVoICsgSGFtemEsIFNlZW5GYW1pbHkgY2hhcmFjdGVyIGludG8gU2VlbkZhbWlseSBjaGFyYWN0ZXIKKyAgICogICAgICAgICAgICsgVGFpbCwgd2hpbGUgY29uc3VtaW5nIHRoZSBzcGFjZSBuZXh0IHRvIHRoZSBjaGFyYWN0ZXIuCisgICAqLworCisgIHByaXZhdGUgYm9vbGVhbiBleHBhbmRDb21wb3NpdENoYXJBdE5lYXIoY2hhcltdIGRlc3QsaW50IHN0YXJ0LCBpbnQgbGVuZ3RoLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHllaEhhbXphT3B0aW9uLCBpbnQgc2VlblRhaWxPcHRpb24sIGludCBsYW1BbGVmT3B0aW9uKXsKKworICAgICAgYm9vbGVhbiBzcGFjZU5vdEZvdW5kID0gZmFsc2U7CisKKworCisgICAgICBpZiAoaXNOb3JtYWxpemVkTGFtQWxlZkNoYXIoZGVzdFtzdGFydF0pKSB7CisgICAgICAgICAgc3BhY2VOb3RGb3VuZCA9IHRydWU7CisgICAgICAgICAgcmV0dXJuIHNwYWNlTm90Rm91bmQ7CisgICAgICB9CisgICAgICBmb3IgKGludCBpID0gc3RhcnQgKyBsZW5ndGg7IC0taSA+PXN0YXJ0OykgeworICAgICAgICAgIGNoYXIgY2ggPSBkZXN0W2ldOworICAgICAgICAgIGlmIChsYW1BbGVmT3B0aW9uID09IDEgJiYgaXNOb3JtYWxpemVkTGFtQWxlZkNoYXIoY2gpKSB7CisgICAgICAgICAgICAgIGlmIChpPnN0YXJ0ICYmZGVzdFtpLTFdID09IFNQQUNFX0NIQVIpIHsKKyAgICAgICAgICAgICAgICAgIGRlc3RbaV0gPSBMQU1fQ0hBUjsKKyAgICAgICAgICAgICAgICAgIGRlc3RbLS1pXSA9IGNvbnZlcnROb3JtYWxpemVkTGFtQWxlZltjaCAtICdcdTA2NUMnXTsKKyAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgIHNwYWNlTm90Rm91bmQgPSB0cnVlOworICAgICAgICAgICAgICAgICAgcmV0dXJuIHNwYWNlTm90Rm91bmQ7CisgICAgICAgICAgICAgIH0KKyAgICAgICAgICB9ZWxzZSBpZihzZWVuVGFpbE9wdGlvbiA9PSAxICYmIGlzU2VlblRhaWxGYW1pbHlDaGFyKGNoKSA9PSAxKXsKKyAgICAgICAgICAgICAgaWYoaT5zdGFydCAmJmRlc3RbaS0xXSA9PSBTUEFDRV9DSEFSKXsKKyAgICAgICAgICAgICAgICAgIGRlc3RbaS0xXSA9IHRhaWxDaGFyOworICAgICAgICAgICAgICB9IGVsc2V7CisgICAgICAgICAgICAgICAgICBzcGFjZU5vdEZvdW5kID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgIHJldHVybiBzcGFjZU5vdEZvdW5kOworICAgICAgICAgICAgICB9CisgICAgICAgICAgfWVsc2UgaWYoeWVoSGFtemFPcHRpb24gPT0gMSAmJiBpc1llaEhhbXphQ2hhcihjaCkpeworCisgICAgICAgICAgICAgICBpZihpPnN0YXJ0ICYmZGVzdFtpLTFdID09IFNQQUNFX0NIQVIpeworICAgICAgICAgICAgICAgICAgZGVzdFtpXSA9IHllaEhhbXphVG9ZZWhbY2ggLSBZRUhfSEFNWkFGRV9DSEFSXTsKKyAgICAgICAgICAgICAgICAgIGRlc3RbaS0xXSA9IEhBTVpBRkVfQ0hBUjsKKyAgICAgICAgICAgICAgfWVsc2V7CisgICAgICAgICAgICAgICAgICBzcGFjZU5vdEZvdW5kID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgIHJldHVybiBzcGFjZU5vdEZvdW5kOworICAgICAgICAgICAgICAgIH0KKworCisgICAgICAgICAgfQorICAgICAgfQorICAgICAgcmV0dXJuIGZhbHNlOworCisgIH0KKworICAgIC8qCisgICAgICogTmFtZSAgICA6IGV4cGFuZENvbXBvc2l0Q2hhcgorICAgICAqIEZ1bmN0aW9uOiBMYW1BbGVmIG5lZWRzIHNwZWNpYWwgaGFuZGxpbmcgYXMgdGhlIExhbUFsZWYgaXMKKyAgICAgKiAgICAgICAgICAgb25lIGNoYXJhY3RlciB3aGlsZSBleHBhbmRpbmcgaXQgd2lsbCBnaXZlIHR3bworICAgICAqICAgICAgICAgICBjaGFyYWN0ZXJzIExhbSArIEFsZWYsIHNvIHdlIG5lZWQgdG8gZXhwYW5kIHRoZSBMYW1BbGVmCisgICAgICogICAgICAgICAgIGluIG5lYXIgb3IgZmFyIHNwYWNlcyBhY2NvcmRpbmcgdG8gdGhlIG9wdGlvbnMgdGhlIHVzZXIKKyAgICAgKiAgICAgICAgICAgc3BlY2lmaWVzIG9yIGluY3JlYXNlIHRoZSBidWZmZXIgc2l6ZS4KKyAgICAgKiAgICAgICAgICAgRGVzdCBoYXMgZW5vdWdoIHJvb20gZm9yIHRoZSBleHBhbnNpb24gaWYgd2UgYXJlIGdyb3dpbmcuCisgICAgICogICAgICAgICAgIGxhbWFsZWYgYXJlIG5vcm1hbGl6ZWQgdG8gdGhlICdzcGVjaWFsIGNoYXJhY3RlcnMnCisgICAgICovCisgICAgcHJpdmF0ZSBpbnQgZXhwYW5kQ29tcG9zaXRDaGFyKGNoYXJbXSBkZXN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHN0YXJ0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGxlbmd0aCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBsYWNvdW50LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHNoYXBpbmdNb2RlKSB0aHJvd3MgQXJhYmljU2hhcGluZ0V4Y2VwdGlvbiB7CisKKyAgICAgICAgaW50IGxlbk9wdGlvbnNMYW1BbGVmID0gb3B0aW9ucyAmIExBTUFMRUZfTUFTSzsKKyAgICAgICAgaW50IGxlbk9wdGlvbnNTZWVuID0gb3B0aW9ucyAmIFNFRU5fTUFTSzsKKyAgICAgICAgaW50IGxlbk9wdGlvbnNZZWhIYW16YSA9IG9wdGlvbnMgJiBZRUhIQU1aQV9NQVNLOworICAgICAgICBib29sZWFuIHNwYWNlTm90Rm91bmQgPSBmYWxzZTsKKworICAgICAgICBpZiAoIWlzTG9naWNhbCAmJiAhc3BhY2VzUmVsYXRpdmVUb1RleHRCZWdpbkVuZCkgeworICAgICAgICAgICAgc3dpdGNoIChsZW5PcHRpb25zTGFtQWxlZikgeworICAgICAgICAgICAgY2FzZSBMQU1BTEVGX0JFR0lOOiBsZW5PcHRpb25zTGFtQWxlZiA9IExBTUFMRUZfRU5EOyBicmVhazsKKyAgICAgICAgICAgIGNhc2UgTEFNQUxFRl9FTkQ6IGxlbk9wdGlvbnNMYW1BbGVmID0gTEFNQUxFRl9CRUdJTjsgYnJlYWs7CisgICAgICAgICAgICBkZWZhdWx0OiBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGlmKHNoYXBpbmdNb2RlID09IDEpeworICAgICAgICAgICAgaWYobGVuT3B0aW9uc0xhbUFsZWYgPT0gTEFNQUxFRl9BVVRPKXsKKyAgICAgICAgICAgICAgICBpZihpc0xvZ2ljYWwpeworICAgICAgICAgICAgICAgICAgICBzcGFjZU5vdEZvdW5kID0gZXhwYW5kQ29tcG9zaXRDaGFyQXRFbmQoZGVzdCwgc3RhcnQsIGxlbmd0aCwgbGFjb3VudCk7CisgICAgICAgICAgICAgICAgICAgIGlmKHNwYWNlTm90Rm91bmQpeworICAgICAgICAgICAgICAgICAgICAgICAgc3BhY2VOb3RGb3VuZCA9IGV4cGFuZENvbXBvc2l0Q2hhckF0QmVnaW4oZGVzdCwgc3RhcnQsIGxlbmd0aCwgbGFjb3VudCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgaWYoc3BhY2VOb3RGb3VuZCl7CisgICAgICAgICAgICAgICAgICAgICAgICBzcGFjZU5vdEZvdW5kID0gZXhwYW5kQ29tcG9zaXRDaGFyQXROZWFyKGRlc3QsIHN0YXJ0LCBsZW5ndGgsMCwwLDEpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGlmKHNwYWNlTm90Rm91bmQpeworICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEFyYWJpY1NoYXBpbmdFeGNlcHRpb24oIk5vIHNwYWNlZm9yIGxhbWFsZWYiKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH1lbHNleworICAgICAgICAgICAgICAgICAgICBzcGFjZU5vdEZvdW5kID0gZXhwYW5kQ29tcG9zaXRDaGFyQXRCZWdpbihkZXN0LCBzdGFydCwgbGVuZ3RoLCBsYWNvdW50KTsKKyAgICAgICAgICAgICAgICAgICAgaWYoc3BhY2VOb3RGb3VuZCl7CisgICAgICAgICAgICAgICAgICAgICAgICBzcGFjZU5vdEZvdW5kID0gZXhwYW5kQ29tcG9zaXRDaGFyQXRFbmQoZGVzdCwgc3RhcnQsIGxlbmd0aCwgbGFjb3VudCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgaWYoc3BhY2VOb3RGb3VuZCl7CisgICAgICAgICAgICAgICAgICAgICAgICBzcGFjZU5vdEZvdW5kID0gZXhwYW5kQ29tcG9zaXRDaGFyQXROZWFyKGRlc3QsIHN0YXJ0LCBsZW5ndGgsMCwwLDEpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGlmKHNwYWNlTm90Rm91bmQpeworICAgICAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEFyYWJpY1NoYXBpbmdFeGNlcHRpb24oIk5vIHNwYWNlZm9yIGxhbWFsZWYiKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH1lbHNlIGlmKGxlbk9wdGlvbnNMYW1BbGVmID09IExBTUFMRUZfRU5EKXsKKyAgICAgICAgICAgICAgICBzcGFjZU5vdEZvdW5kID0gZXhwYW5kQ29tcG9zaXRDaGFyQXRFbmQoZGVzdCwgc3RhcnQsIGxlbmd0aCwgbGFjb3VudCk7CisgICAgICAgICAgICAgICAgaWYoc3BhY2VOb3RGb3VuZCl7CisgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBBcmFiaWNTaGFwaW5nRXhjZXB0aW9uKCJObyBzcGFjZWZvciBsYW1hbGVmIik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfWVsc2UgaWYobGVuT3B0aW9uc0xhbUFsZWYgPT0gTEFNQUxFRl9CRUdJTil7CisgICAgICAgICAgICAgICAgc3BhY2VOb3RGb3VuZCA9IGV4cGFuZENvbXBvc2l0Q2hhckF0QmVnaW4oZGVzdCwgc3RhcnQsIGxlbmd0aCwgbGFjb3VudCk7CisgICAgICAgICAgICAgICAgaWYoc3BhY2VOb3RGb3VuZCl7CisgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBBcmFiaWNTaGFwaW5nRXhjZXB0aW9uKCJObyBzcGFjZWZvciBsYW1hbGVmIik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfWVsc2UgaWYobGVuT3B0aW9uc0xhbUFsZWYgPT0gTEFNQUxFRl9ORUFSKXsKKyAgICAgICAgICAgICAgICBzcGFjZU5vdEZvdW5kID0gZXhwYW5kQ29tcG9zaXRDaGFyQXROZWFyKGRlc3QsIHN0YXJ0LCBsZW5ndGgsMCwwLDEpOworICAgICAgICAgICAgICAgIGlmKHNwYWNlTm90Rm91bmQpeworICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgQXJhYmljU2hhcGluZ0V4Y2VwdGlvbigiTm8gc3BhY2Vmb3IgbGFtYWxlZiIpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgfWVsc2UgaWYobGVuT3B0aW9uc0xhbUFsZWYgPT0gTEFNQUxFRl9SRVNJWkUpeworICAgICAgICAgICAgICAgIGZvciAoaW50IHIgPSBzdGFydCArIGxlbmd0aCwgdyA9IHIgKyBsYWNvdW50OyAtLXIgPj0gc3RhcnQ7KSB7CisgICAgICAgICAgICAgICAgICAgIGNoYXIgY2ggPSBkZXN0W3JdOworICAgICAgICAgICAgICAgICAgICBpZiAoaXNOb3JtYWxpemVkTGFtQWxlZkNoYXIoY2gpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBkZXN0Wy0td10gPSAnXHUwNjQ0JzsKKyAgICAgICAgICAgICAgICAgICAgICAgIGRlc3RbLS13XSA9IGNvbnZlcnROb3JtYWxpemVkTGFtQWxlZltjaCAtICdcdTA2NUMnXTsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGRlc3RbLS13XSA9IGNoOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGxlbmd0aCArPSBsYWNvdW50OworICAgICAgICAgICAgfQorICAgICAgICAgICAgfWVsc2V7CisgICAgICAgICAgICAgICAgaWYobGVuT3B0aW9uc1NlZW4gPT0gU0VFTl9UV09DRUxMX05FQVIpeworICAgICAgICAgICAgICAgIHNwYWNlTm90Rm91bmQgPSBleHBhbmRDb21wb3NpdENoYXJBdE5lYXIoZGVzdCwgc3RhcnQsIGxlbmd0aCwwLDEsMCk7CisgICAgICAgICAgICAgICAgaWYoc3BhY2VOb3RGb3VuZCl7CisgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBBcmFiaWNTaGFwaW5nRXhjZXB0aW9uKCJObyBzcGFjZSBmb3IgU2VlbiB0YWlsIGV4cGFuc2lvbiIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmKGxlbk9wdGlvbnNZZWhIYW16YSA9PSBZRUhIQU1aQV9UV09DRUxMX05FQVIpeworICAgICAgICAgICAgICAgIHNwYWNlTm90Rm91bmQgPSBleHBhbmRDb21wb3NpdENoYXJBdE5lYXIoZGVzdCwgc3RhcnQsIGxlbmd0aCwxLDAsMCk7CisgICAgICAgICAgICAgICAgaWYoc3BhY2VOb3RGb3VuZCl7CisgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBBcmFiaWNTaGFwaW5nRXhjZXB0aW9uKCJObyBzcGFjZSBmb3IgWWVoSGFtemEgZXhwYW5zaW9uIik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICByZXR1cm4gbGVuZ3RoOworICAgIH0KKworCisgICAgLyogQ29udmVydCB0aGUgaW5wdXQgYnVmZmVyIGZyb20gRkV4eCBSYW5nZSBpbnRvIDA2eHggUmFuZ2UKKyAgICAgKiB0byBwdXQgYWxsIGNoYXJhY3RlcnMgaW50byB0aGUgMDZ4eCByYW5nZQorICAgICAqIGV2ZW4gdGhlIGxhbWFsZWYgaXMgY29udmVydGVkIHRvIHRoZSBzcGVjaWFsIHJlZ2lvbiBpbgorICAgICAqIHRoZSAwNnh4IHJhbmdlLiAgUmV0dXJuIHRoZSBudW1iZXIgb2YgbGFtYWxlZiBjaGFycyBmb3VuZC4KKyAgICAgKi8KKyAgICBwcml2YXRlIGludCBub3JtYWxpemUoY2hhcltdIGRlc3QsIGludCBzdGFydCwgaW50IGxlbmd0aCkgeworICAgICAgICBpbnQgbGFjb3VudCA9IDA7CisgICAgICAgIGZvciAoaW50IGkgPSBzdGFydCwgZSA9IGkgKyBsZW5ndGg7IGkgPCBlOyArK2kpIHsKKyAgICAgICAgICAgIGNoYXIgY2ggPSBkZXN0W2ldOworICAgICAgICAgICAgaWYgKGNoID49ICdcdUZFNzAnICYmIGNoIDw9ICdcdUZFRkMnKSB7CisgICAgICAgICAgICAgICAgaWYgKGlzTGFtQWxlZkNoYXIoY2gpKSB7CisgICAgICAgICAgICAgICAgICAgICsrbGFjb3VudDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZGVzdFtpXSA9IChjaGFyKWNvbnZlcnRGRXRvMDZbY2ggLSAnXHVGRTcwJ107CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGxhY291bnQ7CisgICAgfQorCisgICAgLyoKKyAgICAgKiBOYW1lICAgIDogZGVzaGFwZU5vcm1hbGl6ZQorICAgICAqIEZ1bmN0aW9uOiBDb252ZXJ0IHRoZSBpbnB1dCBidWZmZXIgZnJvbSBGRXh4IFJhbmdlIGludG8gMDZ4eCBSYW5nZQorICAgICAq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ICAgICAgICAgICAgY2hhciBjaCA9IGRlc3RbaV07CisKKyAgICAgICAgaWYoICh5ZWhIYW16YUNvbXBvc2VFbmFibGVkID09IDEpICYmICgoY2ggPT0gSEFNWkEwNl9DSEFSKSB8fCAoY2ggPT0gSEFNWkFGRV9DSEFSKSkKKyAgICAgICAgICAgICAgICYmIChpIDwgKGxlbmd0aCAtIDEpKSAmJiBpc0FsZWZNYWtzb3VyYUNoYXIoZGVzdFtpKzFdICkpIHsKKyAgICAgICAgICAgICAgICBkZXN0W2ldID0gU1BBQ0VfQ0hBUjsKKyAgICAgICAgICAgICAgICBkZXN0W2krMV0gPSBZRUhfSEFNWkFfQ0hBUjsKKyAgICAgICB9IGVsc2UgaWYgKCAoc2VlbkNvbXBvc2VFbmFibGVkID09IDEpICYmIChpc1RhaWxDaGFyKGNoKSkgJiYgKGk8IChsZW5ndGggLSAxKSkKKyAgICAgICAgICAgICAgICAgICAgICAgJiYgKGlzU2VlblRhaWxGYW1pbHlDaGFyKGRlc3RbaSsxXSk9PTEpICkgeworICAgICAgICAgICAgICAgZGVzdFtpXSA9IFNQQUNFX0NIQVI7CisgICAgICAgfQorICAgICAgIGVsc2UgaWYgKGNoID49ICdcdUZFNzAnICYmIGNoIDw9ICdcdUZFRkMnKSB7CisgICAgICAgICAgICAgICAgaWYgKGlzTGFtQWxlZkNoYXIoY2gpKSB7CisgICAgICAgICAgICAgICAgICAgICsrbGFjb3VudDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZGVzdFtpXSA9IChjaGFyKWNvbnZlcnRGRXRvMDZbY2ggLSAnXHVGRTcwJ107CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGxhY291bnQ7CisgICAgfQorCisgICAgLyoKKyAgICAgKiBOYW1lICAgIDogc2hhcGVVbmljb2RlCisgICAgICogRnVuY3Rpb246IENvbnZlcnRzIGFuIEFyYWJpYyBVbmljb2RlIGJ1ZmZlciBpbiAwNnh4IFJhbmdlIGludG8gYSBzaGFwZWQKKyAgICAgKiAgICAgICAgICAgYXJhYmljIFVuaWNvZGUgYnVmZmVyIGluIEZFeHggUmFuZ2UKKyAgICAgKi8KKyAgICBwcml2YXRlIGludCBzaGFwZVVuaWNvZGUoY2hhcltdIGRlc3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBzdGFydCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGxlbmd0aCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGRlc3RTaXplLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgdGFzaGtlZWxGbGFnKXRocm93cyBBcmFiaWNTaGFwaW5nRXhjZXB0aW9uIHsKKworICAgICAgICBpbnQgbGFtYWxlZl9jb3VudCA9IG5vcm1hbGl6ZShkZXN0LCBzdGFydCwgbGVuZ3RoKTsKKworICAgICAgICAvLyByZXNvbHZlIHRoZSBsaW5rIGJldHdlZW4gdGhlIGNoYXJhY3RlcnMuCisgICAgICAgIC8vIEFyYWJpYyBjaGFyYWN0ZXJzIGhhdmUgZm91ciBmb3JtczogSXNvbGF0ZWQsIEluaXRpYWwsIE1lZGlhbCBhbmQgRmluYWwuCisgICAgICAgIC8vIFRhc2hrZWVsIGNoYXJhY3RlcnMgaGF2ZSB0d28sIGlzb2xhdGVkIG9yIG1lZGlhbCwgYW5kIHNvbWV0aW1lcyBvbmx5IGlzb2xhdGVkLgorICAgICAgICAvLyB0YXNoa2VlbEZsYWcgPT0gMDogc2hhcGUgbm9ybWFsbHksIDE6IHNoYXBlIGlzb2xhdGVkLCAyOiBkb24ndCBzaGFwZQorCisgICAgICAgIGJvb2xlYW4gbGFtYWxlZl9mb3VuZCA9IGZhbHNlLCBzZWVuZmFtX2ZvdW5kID0gZmFsc2U7CisgICAgICAgIGJvb2xlYW4geWVoaGFtemFfZm91bmQgPSBmYWxzZSwgdGFzaGtlZWxfZm91bmQgPSBmYWxzZTsKKyAgICAgICAgaW50IGkgPSBzdGFydCArIGxlbmd0aCAtIDE7CisgICAgICAgIGludCBjdXJyTGluayA9IGdldExpbmsoZGVzdFtpXSk7CisgICAgICAgIGludCBuZXh0TGluayA9IDA7CisgICAgICAgIGludCBwcmV2TGluayA9IDA7CisgICAgICAgIGludCBsYXN0TGluayA9IDA7CisgICAgICAgIC8vaW50IHByZXZQb3MgPSBpOworICAgICAgICBpbnQgbGFzdFBvcyA9IGk7CisgICAgICAgIGludCBueCA9IC0yOworICAgICAgICBpbnQgbncgPSAwOworCisgICAgICAgIHdoaWxlIChpID49IDApIHsKKyAgICAgICAgICAgIC8vIElmIGhpZ2ggYnl0ZSBvZiBjdXJyTGluayA+IDAgdGhlbiB0aGVyZSBtaWdodCBiZSBtb3JlIHRoYW4gb25lIHNoYXBlCisgICAgICAgICAgICBpZiAoKGN1cnJMaW5rICYgJ1x1RkYwMCcpID4gMCB8fCBpc1Rhc2hrZWVsQ2hhcihkZXN0W2ldKSkgeworICAgICAgICAgICAgICAgIG53ID0gaSAtIDE7CisgICAgICAgICAgICAgICAgbnggPSAtMjsKKyAgICAgICAgICAgICAgICB3aGlsZSAobnggPCAwKSB7IC8vIHdlIG5lZWQgdG8ga25vdyBhYm91dCBuZXh0IGNoYXIKKyAgICAgICAgICAgICAgICAgICAgaWYgKG53ID09IC0xKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBuZXh0TGluayA9IDA7CisgICAgICAgICAgICAgICAgICAgICAgICBueCA9IEludGVnZXIuTUFYX1ZBTFVFOworICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgbmV4dExpbmsgPSBnZXRMaW5rKGRlc3RbbnddKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmICgobmV4dExpbmsgJiBJUlJFTEVWQU5UKSA9PSAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnggPSBudzsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLS1udzsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIGlmICgoKGN1cnJMaW5rICYgQUxFRlRZUEUpID4gMCkgJiYgKChsYXN0TGluayAmIExBTVRZUEUpID4gMCkpIHsKKyAgICAgICAgICAgICAgICAgICAgbGFtYWxlZl9mb3VuZCA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgIGNoYXIgd0xhbWFsZWYgPSBjaGFuZ2VMYW1BbGVmKGRlc3RbaV0pOyAvLyBnZXQgZnJvbSAweDA2NUMtMHgwNjVmCisgICAgICAgICAgICAgICAgICAgIGlmICh3TGFtYWxlZiAhPSAnXHUwMDAwJykgeworICAgICAgICAgICAgICAgICAgICAgICAgLy8gcmVwbGFjZSBhbGVmIGJ5IG1hcmtlciwgaXQgd2lsbCBiZSByZW1vdmVkIGxhdGVyCisgICAgICAgICAgICAgICAgICAgICAgICBkZXN0W2ldID0gJ1x1ZmZmZic7CisgICAgICAgICAgICAgICAgICAgICAgICBkZXN0W2xhc3RQb3NdID0gd0xhbWFsZWY7CisgICAgICAgICAgICAgICAgICAgICAgICBpID0gbGFzdFBvczsKKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIGxhc3RMaW5rID0gcHJldkxpbms7CisgICAgICAgICAgICAgICAgICAgIGN1cnJMaW5rID0gZ2V0TGluayh3TGFtYWxlZik7IC8vIHJlcXVpcmVzICdcdTAwMDAnLCB1bmZvcnR1bmF0ZWx5CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGlmICgoaSA+IDApICYmIChkZXN0W2ktMV0gPT0gU1BBQ0VfQ0hBUikpCisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBpZiAoIGlzU2VlbkZhbWlseUNoYXIoZGVzdFtpXSkgPT0gMSl7CisgICAgICAgICAgICAgICAgICAgICAgICBzZWVuZmFtX2ZvdW5kID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChkZXN0W2ldID09IFlFSF9IQU1aQV9DSEFSKSB7CisgICAgICAgICAgICAgICAgICAgICAgICB5ZWhoYW16YV9mb3VuZCA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZWxzZSBpZihpPT0wKXsKKyAgICAgICAgICAgICAgICAgICAgaWYgKCBpc1NlZW5GYW1pbHlDaGFyKGRlc3RbaV0pID09IDEpeworICAgICAgICAgICAgICAgICAgICAgICAgc2VlbmZhbV9mb3VuZCA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoZGVzdFtpXSA9PSBZRUhfSEFNWkFfQ0hBUikgeworICAgICAgICAgICAgICAgICAgICAgICAgeWVoaGFtemFfZm91bmQgPSB0cnVlOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorCisKKyAgICAgICAgICAgICAgICAvLyBnZXQgdGhlIHByb3BlciBzaGFwZSBhY2NvcmRpbmcgdG8gbGluayBhYmlsaXR5IG9mIG5laWdoYm9ycworICAgICAgICAgICAgICAgIC8vIGFuZCBvZiBjaGFyYWN0ZXI7IGRlcGVuZHMgb24gdGhlIG9yZGVyIG9mIHRoZSBzaGFwZXMKKyAgICAgICAgICAgICAgICAvLyAoaXNvbGF0ZWQsIGluaXRpYWwsIG1pZGRsZSwgZmluYWwpIGluIHRoZSBjb21wYXRpYmlsaXR5IGFyZWEKKworICAgICAgICAgICAgICAgIGludCBmbGFnID0gc3BlY2lhbENoYXIoZGVzdFtpXSk7CisKKyAgICAgICAgICAgICAgICBpbnQgc2hhcGUgPSBzaGFwZVRhYmxlW25leHRMaW5rICYgTElOS19NQVNLXQorICAgICAgICAgICAgICAgICAgICBbbGFzdExpbmsgJiBMSU5LX01BU0tdCisgICAgICAgICAgICAgICAgICAgIFtjdXJyTGluayAmIExJTktfTUFTS107CisKKyAgICAgICAgICAgICAgICBpZiAoZmxhZyA9PSAxKSB7CisgICAgICAgICAgICAgICAgICAgIHNoYXBlICY9IDB4MTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGZsYWcgPT0gMikgeworICAgICAgICAgICAgICAgICAgICBpZiAodGFzaGtlZWxGbGFnID09IDAgJiYKKyAgICAgICAgICAgICAgICAgICAgICAgICgobGFzdExpbmsgJiBMSU5LTCkgIT0gMCkgJiYKKyAgICAgICAgICAgICAgICAgICAgICAgICgobmV4dExpbmsgJiBMSU5LUikgIT0gMCkgJiYKKyAgICAgICAgICAgICAgICAgICAgICAgIGRlc3RbaV0gIT0gJ1x1MDY0QycgJiYKKyAgICAgICAgICAgICAgICAgICAgICAgIGRlc3RbaV0gIT0gJ1x1MDY0RCcgJiYKKyAgICAgICAgICAgICAgICAgICAgICAgICEoKG5leHRMaW5rICYgQUxFRlRZUEUpID09IEFMRUZUWVBFICYmCisgICAgICAgICAgICAgICAgICAgICAgICAgIChsYXN0TGluayAmIExBTVRZUEUpID09IExBTVRZUEUpKSB7CisKKyAgICAgICAgICAgICAgICAgICAgICAgIHNoYXBlID0gMTsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHNoYXBlID0gMDsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBpZiAoZmxhZyA9PSAyKSB7CisgICAgICAgICAgICAgICAgICAgIGlmICh0YXNoa2VlbEZsYWcgPT0gMikgeworICAgICAgICAgICAgICAgICAgICAgICAgZGVzdFtpXSA9IFRBU0hLRUVMX1NQQUNFX1NVQjsKKyAgICAgICAgICAgICAgICAgICAgICAgIHRhc2hrZWVsX2ZvdW5kID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBlbHNleworICAgICAgICAgICAgICAgICAgICAgICAgZGVzdFtpXSA9IChjaGFyKSgnXHVGRTcwJyArIGlycmVsZXZhbnRQb3NbZGVzdFtpXSAtICdcdTA2NEInXSArIHNoYXBlKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAvLyBlbHNlIGxlYXZlIHRhc2hrZWVsIGFsb25lCisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgZGVzdFtpXSA9IChjaGFyKSgnXHVGRTcwJyArIChjdXJyTGluayA+PiA4KSArIHNoYXBlKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIG1vdmUgb25lIG5vdGNoIGZvcndhcmQKKyAgICAgICAgICAgIGlmICgoY3VyckxpbmsgJiBJUlJFTEVWQU5UKSA9PSAwKSB7CisgICAgICAgICAgICAgICAgcHJldkxpbmsgPSBsYXN0TGluazsKKyAgICAgICAgICAgICAgICBsYXN0TGluayA9IGN1cnJMaW5rOworICAgICAgICAgICAgICAgIC8vcHJldlBvcyA9IGxhc3RQb3M7CisgICAgICAgICAgICAgICAgbGFzdFBvcyA9IGk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC0taTsKKyAgICAgICAgICAgIGlmIChpID09IG54KSB7CisgICAgICAgICAgICAgICAgY3VyckxpbmsgPSBuZXh0TGluazsKKyAgICAgICAgICAgICAgICBueCA9IC0yOworICAgICAgICAgICAgfSBlbHNlIGlmIChpICE9IC0xKSB7CisgICAgICAgICAgICAgICAgY3VyckxpbmsgPSBnZXRMaW5rKGRlc3RbaV0pOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgLy8gSWYgd2UgZm91bmQgYSBsYW0vYWxlZiBwYWlyIGluIHRoZSBidWZmZXIKKyAgICAgICAgLy8gY2FsbCBoYW5kbGVHZW5lcmF0ZWRTcGFjZXMgdG8gcmVtb3ZlIHRoZSBzcGFjZXMgdGhhdCB3ZXJlIGFkZGVkCisKKyAgICAgICAgZGVzdFNpemUgPSBsZW5ndGg7CisgICAgICAgIGlmIChsYW1hbGVmX2ZvdW5kIHx8IHRhc2hrZWVsX2ZvdW5kKSB7CisgICAgICAgICAgICBkZXN0U2l6ZSA9IGhhbmRsZUdlbmVyYXRlZFNwYWNlcyhkZXN0LCBzdGFydCwgbGVuZ3RoKTsKKyAgICAgICAgfQorICAgICAgICBpZiAoc2VlbmZhbV9mb3VuZCB8fCB5ZWhoYW16YV9mb3VuZCl7CisgICAgICAgICAgICBkZXN0U2l6ZSA9IGV4cGFuZENvbXBvc2l0Q2hhcihkZXN0LCBzdGFydCwgZGVzdFNpemUsIGxhbWFsZWZfY291bnQsIFNIQVBFX01PREUpOworICAgICAgICB9CisgICAgICAgIHJldHVybiBkZXN0U2l6ZTsKKyAgICB9CisKKyAgICAvKgorICAgICAqIE5hbWUgICAgOiBkZVNoYXBlVW5pY29kZQorICAgICAqIEZ1bmN0aW9uOiBDb252ZXJ0cyBhbiBBcmFiaWMgVW5pY29kZSBidWZmZXIgaW4gRkV4eCBSYW5nZSBpbnRvIHVuc2hhcGVkCisgICAgICogICAgICAgICAgIGFyYWJpYyBVbmljb2RlIGJ1ZmZlciBpbiAwNnh4IFJhbmdlCisgICAgICovCisgICAgcHJpdmF0ZSBpbnQgZGVTaGFwZVVuaWNvZGUoY2hhcltdIGRlc3QsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHN0YXJ0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBsZW5ndGgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGRlc3RTaXplKSB0aHJvd3MgQXJhYmljU2hhcGluZ0V4Y2VwdGlvbiB7CisKKyAgICAgICAgaW50IGxhbWFsZWZfY291bnQgPSBkZXNoYXBlTm9ybWFsaXplKGRlc3QsIHN0YXJ0LCBsZW5ndGgpOworCisgICAgICAgIC8vIElmIHRoZXJlIHdhcyBhIGxhbWFsZWYgaW4gdGhlIGJ1ZmZlciBjYWxsIGV4cGFuZExhbUFsZWYKKyAgICAgICAgaWYgKGxhbWFsZWZfY291bnQgIT0gMCkgeworICAgICAgICAgICAgLy8gbmVlZCB0byBhZGp1c3QgZGVzdCB0byBmaXQgZXhwYW5kZWQgYnVmZmVyLi4uICEhIQorICAgICAgICAgICAgZGVzdFNpemUgPSBleHBhbmRDb21wb3NpdENoYXIoZGVzdCwgc3RhcnQsIGxlbmd0aCwgbGFtYWxlZl9jb3VudCxERVNIQVBFX01PREUpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgZGVzdFNpemUgPSBsZW5ndGg7CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gZGVzdFNpemU7CisgICAgfQorCisgICAgcHJpdmF0ZSBpbnQgaW50ZXJuYWxTaGFwZShjaGFyW10gc291cmNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHNvdXJjZVN0YXJ0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IHNvdXJjZUxlbmd0aCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoYXJbXSBkZXN0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGRlc3RTdGFydCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBkZXN0U2l6ZSkgdGhyb3dzIEFyYWJpY1NoYXBpbmdFeGNlcHRpb24geworCisgICAgICAgIGlmIChzb3VyY2VMZW5ndGggPT0gMCkgeworICAgICAgICAgICAgcmV0dXJuIDA7CisgICAgICAgIH0KKworICAgICAgICBpZiAoZGVzdFNpemUgPT0gMCkgeworICAgICAgICAgICAgaWYgKCgob3B0aW9ucyAmIExFVFRFUlNfTUFTSykgIT0gTEVUVEVSU19OT09QKSAmJgorICAgICAgICAgICAgICAgICgob3B0aW9ucyAmIExBTUFMRUZfTUFTSykgPT0gTEFNQUxFRl9SRVNJWkUpKSB7CisKKyAgICAgICAgICAgICAgICByZXR1cm4gY2FsY3VsYXRlU2l6ZShzb3VyY2UsIHNvdXJjZVN0YXJ0LCBzb3VyY2VMZW5ndGgpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gc291cmNlTGVuZ3RoOyAvLyBieSBkZWZpbml0aW9uCisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICAvLyBhbHdheXMgdXNlIHRlbXAgYnVmZmVyCisgICAgICAgIGNoYXJbXSB0ZW1wID0gbmV3IGNoYXJbc291cmNlTGVuZ3RoICogMl07IC8vIGFsbCBsYW1hbGVmcyByZXF1aXJpbmcgZXhwYW5zaW9uCisgICAgICAgIFN5c3RlbS5hcnJheWNvcHkoc291cmNlLCBzb3VyY2VTdGFydCwgdGVtcCwgMCwgc291cmNlTGVuZ3RoKTsKKworICAgICAgICBpZiAoaXNMb2dpY2FsKSB7CisgICAgICAgICAgICBpbnZlcnRCdWZmZXIodGVtcCwgMCwgc291cmNlTGVuZ3RoKTsKKyAgICAgICAgfQorCisgICAgICAgIGludCBvdXRwdXRTaXplID0gc291cmNlTGVuZ3RoOworCisgICAgICAgIHN3aXRjaCAob3B0aW9ucyAmIExFVFRFUlNfTUFTSykgeworICAgICAgICBjYXNlIExFVFRFUlNfU0hBUEVfVEFTSEtFRUxfSVNPTEFURUQ6CisgICAgICAgICAgICBvdXRwdXRTaXplID0gc2hhcGVVbmljb2RlKHRlbXAsIDAsIHNvdXJjZUxlbmd0aCwgZGVzdFNpemUsIDEpOworICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgY2FzZSBMRVRURVJTX1NIQVBFOgorICAgICAgICAgICAgaWYoICgob3B0aW9ucyZUQVNIS0VFTF9NQVNLKT4gMCkgJiYKKyAgICAgICAgICAgICAgICAoKG9wdGlvbnMmVEFTSEtFRUxfTUFTSykgIT1UQVNIS0VFTF9SRVBMQUNFX0JZX1RBVFdFRUwpKSB7CisgICAgICAgICAgICAgICAgICAgLyogQ2FsbCB0aGUgc2hhcGluZyBmdW5jdGlvbiB3aXRoIHRhc2hrZWVsIGZsYWcgPT0gMiBmb3IgcmVtb3ZhbCBvZiB0YXNoa2VlbCAqLworICAgICAgICAgICAgICAgIG91dHB1dFNpemUgPSBzaGFwZVVuaWNvZGUodGVtcCwgMCwgc291cmNlTGVuZ3RoLCBkZXN0U2l6ZSwgMik7CisgICAgICAgICAgICAgICAgfWVsc2UgeworICAgICAgICAgICAgICAgICAgIC8vZGVmYXVsdCBDYWxsIHRoZSBzaGFwaW5nIGZ1bmN0aW9uIHdpdGggdGFzaGtlZWwgZmxhZyA9PSAxICovCisgICAgICAgICAgICAgICAgICAgIG91dHB1dFNpemUgPSBzaGFwZVVuaWNvZGUodGVtcCwgMCwgc291cmNlTGVuZ3RoLCBkZXN0U2l6ZSwgMCk7CisKKyAgICAgICAgICAgICAgICAgICAvKkFmdGVyIHNoYXBpbmcgdGV4dCBjaGVjayBpZiB1c2VyIHdhbnRzIHRvIHJlbW92ZSB0YXNoa2VlbCBhbmQgcmVwbGFjZSBpdCB3aXRoIHRhdHdlZWwqLworICAgICAgICAgICAgICAgICAgIGlmKCAob3B0aW9ucyZUQVNIS0VFTF9NQVNLKSA9PSBUQVNIS0VFTF9SRVBMQUNFX0JZX1RBVFdFRUwpeworICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXRTaXplID0gaGFuZGxlVGFzaGtlZWxXaXRoVGF0d2VlbCh0ZW1wLHNvdXJjZUxlbmd0aCk7CisgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgY2FzZSBMRVRURVJTX1VOU0hBUEU6CisgICAgICAgICAgICBvdXRwdXRTaXplID0gZGVTaGFwZVVuaWNvZGUodGVtcCwgMCwgc291cmNlTGVuZ3RoLCBkZXN0U2l6ZSk7CisgICAgICAgICAgICBicmVhazsKKworICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKworICAgICAgICBpZiAob3V0cHV0U2l6ZSA+IGRlc3RTaXplKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgQXJhYmljU2hhcGluZ0V4Y2VwdGlvbigibm90IGVub3VnaCByb29tIGZvciByZXN1bHQgZGF0YSIpOworICAgICAgICB9CisKKyAgICAgICAgaWYgKChvcHRpb25zICYgRElHSVRTX01BU0spICE9IERJR0lUU19OT09QKSB7CisgICAgICAgICAgICBjaGFyIGRpZ2l0QmFzZSA9ICdcdTAwMzAnOyAvLyBFdXJvcGVhbiBkaWdpdHMKKyAgICAgICAgICAgIHN3aXRjaCAob3B0aW9ucyAmIERJR0lUX1RZUEVfTUFTSykgeworICAgICAgICAgICAgY2FzZSBESUdJVF9UWVBFX0FOOgorICAgICAgICAgICAgICAgIGRpZ2l0QmFzZSA9ICdcdTA2NjAnOyAgLy8gQXJhYmljLUluZGljIGRpZ2l0cworICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICBjYXNlIERJR0lUX1RZUEVfQU5fRVhURU5ERUQ6CisgICAgICAgICAgICAgICAgZGlnaXRCYXNlID0gJ1x1MDZmMCc7ICAvLyBFYXN0ZXJuIEFyYWJpYy1JbmRpYyBkaWdpdHMgKFBlcnNpYW4gYW5kIFVyZHUpCisgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHN3aXRjaCAob3B0aW9ucyAmIERJR0lUU19NQVNLKSB7CisgICAgICAgICAgICBjYXNlIERJR0lUU19FTjJBTjoKKyAgICAgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgICAgIGludCBkaWdpdERlbHRhID0gZGlnaXRCYXNlIC0gJ1x1MDAzMCc7CisgICAgICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgb3V0cHV0U2l6ZTsgKytpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBjaGFyIGNoID0gdGVtcFtpXTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChjaCA8PSAnXHUwMDM5JyAmJiBjaCA+PSAnXHUwMDMwJykgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRlbXBbaV0gKz0gZGlnaXREZWx0YTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgY2FzZSBESUdJVFNfQU4yRU46CisgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICBjaGFyIGRpZ2l0VG9wID0gKGNoYXIpKGRpZ2l0QmFzZSArIDkpOworICAgICAgICAgICAgICAgICAgICBpbnQgZGlnaXREZWx0YSA9ICdcdTAwMzAnIC0gZGlnaXRCYXNlOworICAgICAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IG91dHB1dFNpemU7ICsraSkgeworICAgICAgICAgICAgICAgICAgICAgICAgY2hhciBjaCA9IHRlbXBbaV07CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY2ggPD0gZGlnaXRUb3AgJiYgY2ggPj0gZGlnaXRCYXNlKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGVtcFtpXSArPSBkaWdpdERlbHRhOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICBjYXNlIERJR0lUU19FTjJBTl9JTklUX0xSOgorICAgICAgICAgICAgICAgIHNoYXBlVG9BcmFiaWNEaWdpdHNXaXRoQ29udGV4dCh0ZW1wLCAwLCBvdXRwdXRTaXplLCBkaWdpdEJhc2UsIGZhbHNlKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgY2FzZSBESUdJVFNfRU4y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sKKworICAgIGJvb2wgICAgICAgICAgICAgICAgaW5pdEJ1ZmZlcihib29sIGxvY2FsT25seSk7CisgICAgc3A8SU1lbW9yeT4gICAgICAgICBnZXRNZW1vcnkoKSB7cmV0dXJuIG1NZW1vcnk7fQorCisgICAgc2l6ZV90ICAgICAgICAgICAgICBzaXplKCkge3JldHVybiBtU2l6ZTt9CisgICAgdWludDhfdCAqICAgICAgICAgICBkYXRhKCkge3JldHVybiBtRGF0YTt9CisgICAgdWludDMyX3QgICAgICAgICAgICBnZXROdW1Sb3dzKCkge3JldHVybiBtSGVhZGVyLT5udW1Sb3dzO30KKyAgICB1aW50MzJfdCAgICAgICAgICAgIGdldE51bUNvbHVtbnMoKSB7cmV0dXJuIG1IZWFkZXItPm51bUNvbHVtbnM7fQorICAgIHZvaWQgICAgICAgICAgICAgICAgZnJlZUxhc3RSb3coKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1IZWFkZXItPm51bVJvd3MgPiAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1IZWFkZXItPm51bVJvd3MtLTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgYm9vbCAgICAgICAgICAgICAgICBzZXROdW1Db2x1bW5zKHVpbnQzMl90IG51bUNvbHVtbnMpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCBjdXIgPSBtSGVhZGVyLT5udW1Db2x1bW5zOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoY3VyID4gMCAmJiBjdXIgIT0gbnVtQ29sdW1ucykgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTE9HRSgiVHJ5aW5nIHRvIGdvIGZyb20gJWQgY29sdW1ucyB0byAlZCIsIGN1ciwgbnVtQ29sdW1ucyk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUhlYWRlci0+bnVtQ29sdW1ucyA9IG51bUNvbHVtbnM7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKworICAgIGludDMyX3QgICAgICAgICAgICAgZnJlZVNwYWNlKCk7CisKKyAgICB2b2lkICAgICAgICAgICAgICAgIGNsZWFyKCk7CisKKyAgICAgICAgICAgICAgICAgICAgICAgIC8qKgorICAgICAgICAgICAgICAgICAgICAgICAgICogQWxsb2NhdGUgYSByb3cgc2xvdCBhbmQgaXRzIGRpcmVjdG9yeS4gVGhlIHJldHVybmVkCisgICAgICAgICAgICAgICAgICAgICAgICAgKiBwb2ludGVyIHBvaW50cyB0byB0aGUgYmVnaW5pbmcgb2YgdGhlIHJvdydzIGRpcmVjdG9yeQorICAgICAgICAgICAgICAgICAgICAgICAgICogb3IgTlVMTCBpZiB0aGVyZSB3YXNuJ3Qgcm9vbS4gVGhlIGRpcmVjdG9yeSBpcworICAgICAgICAgICAgICAgICAgICAgICAgICogaW5pdGlhbGllZCB3aXRoIE5VTEwgZW50cmllcyBmb3IgZWFjaCBmaWVsZC4KKyAgICAgICAgICAgICAgICAgICAgICAgICAqLworICAgIGZpZWxkX3Nsb3RfdCAqICAgICAgYWxsb2NSb3coKTsKKworICAgICAgICAgICAgICAgICAgICAgICAgLyoqCisgICAgICAgICAgICAgICAgICAgICAgICAgKiBBbGxvY2F0ZSBhIHBvcnRpb24gb2YgdGhlIHdpbmRvdy4gUmV0dXJucyB0aGUgb2Zmc2V0CisgICAgICAgICAgICAgICAgICAgICAgICAgKiBvZiB0aGUgYWxsb2NhdGlvbiwgb3IgMCBpZiB0aGVyZSBpc24ndCBlbm91Z2ggc3BhY2UuCisgICAgICAgICAgICAgICAgICAgICAgICAgKiBJZiBhbGlnbmVkIGlzIHRydWUsIHRoZSBhbGxvY2F0aW9uIGdldHMgNCBieXRlIGFsaWdubWVudC4KKyAgICAgICAgICAgICAgICAgICAgICAgICAqLworICAgIHVpbnQzMl90ICAgICAgICAgICAgYWxsb2Moc2l6ZV90IHNpemUsIGJvb2wgYWxpZ25lZCA9IGZhbHNlKTsKKworICAgIHVpbnQzMl90ICAgICAgICAgICAgcmVhZF9maWVsZF9zbG90KGludCByb3csIGludCBjb2x1bW4sIGZpZWxkX3Nsb3RfdCAqIHNsb3QpOworCisgICAgICAgICAgICAgICAgICAgICAgICAvKioKKyAgICAgICAgICAgICAgICAgICAgICAgICAqIENvcHkgZGF0YSBpbnRvIHRoZSB3aW5kb3cgYXQgdGhlIGdpdmVuIG9mZnNldC4KKyAgICAgICAgICAgICAgICAgICAgICAgICAqLworICAgIHZvaWQgICAgICAgICAgICAgICAgY29weUluKHVpbnQzMl90IG9mZnNldCwgdWludDhfdCBjb25zdCAqIGRhdGEsIHNpemVfdCBzaXplKTsKKyAgICB2b2lkICAgICAgICAgICAgICAgIGNvcHlJbih1aW50MzJfdCBvZmZzZXQsIGludDY0X3QgZGF0YSk7CisgICAgdm9pZCAgICAgICAgICAgICAgICBjb3B5SW4odWludDMyX3Qgb2Zmc2V0LCBkb3VibGUgZGF0YSk7CisKKyAgICB2b2lkICAgICAgICAgICAgICAgIGNvcHlPdXQodWludDMyX3Qgb2Zmc2V0LCB1aW50OF90ICogZGF0YSwgc2l6ZV90IHNpemUpOworICAgIGludDY0X3QgICAgICAgICAgICAgY29weU91dExvbmcodWludDMyX3Qgb2Zmc2V0KTsKKyAgICBkb3VibGUgICAgICAgICAgICAgIGNvcHlPdXREb3VibGUodWludDMyX3Qgb2Zmc2V0KTsKKworICAgIGJvb2wgICAgICAgICAgICAgICAgcHV0TG9uZyh1bnNpZ25lZCBpbnQgcm93LCB1bnNpZ25lZCBpbnQgY29sLCBpbnQ2NF90IHZhbHVlKTsKKyAgICBib29sICAgICAgICAgICAgICAgIHB1dERvdWJsZSh1bnNpZ25lZCBpbnQgcm93LCB1bnNpZ25lZCBpbnQgY29sLCBkb3VibGUgdmFsdWUpOworICAgIGJvb2wgICAgICAgICAgICAgICAgcHV0TnVsbCh1bnNpZ25lZCBpbnQgcm93LCB1bnNpZ25lZCBpbnQgY29sKTsKKworICAgIGJvb2wgICAgICAgICAgICAgICAgZ2V0TG9uZyh1bnNpZ25lZCBpbnQgcm93LCB1bnNpZ25lZCBpbnQgY29sLCBpbnQ2NF90ICogdmFsdWVPdXQpOworICAgIGJvb2wgICAgICAgICAgICAgICAgZ2V0RG91YmxlKHVuc2lnbmVkIGludCByb3csIHVuc2lnbmVkIGludCBjb2wsIGRvdWJsZSAqIHZhbHVlT3V0KTsKKyAgICBib29sICAgICAgICAgICAgICAgIGdldE51bGwodW5zaWduZWQgaW50IHJvdywgdW5zaWduZWQgaW50IGNvbCwgYm9vbCAqIHZhbHVlT3V0KTsKKworICAgIHVpbnQ4X3QgKiAgICAgICAgICAgb2Zmc2V0VG9QdHIodWludDMyX3Qgb2Zmc2V0KSB7cmV0dXJuIG1EYXRhICsgb2Zmc2V0O30KKworICAgIHJvd19zbG90X3QgKiAgICAgICAgYWxsb2NSb3dTbG90KCk7CisKKyAgICByb3dfc2xvdF90ICogICAgICAgIGdldFJvd1Nsb3QoaW50IHJvdyk7CisKKyAgICAgICAgICAgICAgICAgICAgICAgIC8qKgorICAgICAgICAgICAgICAgICAgICAgICAgICogcmV0dXJuIE5VTEwgaWYgRmFpbGVkIHRvIGZpbmQgcm93U2xvdCBvcgorICAgICAgICAgICAgICAgICAgICAgICAgICogSW52YWxpZCByb3dTbG90CisgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKyAgICBmaWVsZF9zbG90X3QgKiAgICAgIGdldEZpZWxkU2xvdFdpdGhDaGVjayhpbnQgcm93LCBpbnQgY29sdW1uKTsKKyAgICBmaWVsZF9zbG90X3QgKiAgICAgIGdldEZpZWxkU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GVhcEJhc2U+IGhlYXA7CisgICAgaGVhcCA9IG5ldyBNZW1vcnlIZWFwQmFzZShtTWF4U2l6ZSwgMCwgIkN1cnNvcldpbmRvdyIpOworICAgIGlmIChoZWFwICE9IE5VTEwpIHsKKyAgICAgICAgbU1lbW9yeSA9IG5ldyBNZW1vcnlCYXNlKGhlYXAsIDAsIG1NYXhTaXplKTsKKyAgICAgICAgaWYgKG1NZW1vcnkgIT0gTlVMTCkgeworICAgICAgICAgICAgbURhdGEgPSAodWludDhfdCAqKSBtTWVtb3J5LT5wb2ludGVyKCk7CisgICAgICAgICAgICBpZiAobURhdGEpIHsKKyAgICAgICAgICAgICAgICBtSGVhZGVyID0gKHdpbmRvd19oZWFkZXJfdCAqKSBtRGF0YTsKKyAgICAgICAgICAgICAgICBtU2l6ZSA9IG1NYXhTaXplOworCisgICAgICAgICAgICAgICAgLy8gUHV0IHRoZSB3aW5kb3cgaW50byBhIGNsZWFuIHN0YXRlCisgICAgICAgICAgICAgICAgY2xlYXIoKTsKKyAgICAgICAgICAgIExPR19XSU5ET1coIkNyZWF0ZWQgQ3Vyc29yV2luZG93IHdpdGggbmV3IE1lbW9yeURlYWxlcjogbUZyZWVPZmZzZXQgPSAlZCwgbVNpemUgPSAlZCwgbU1heFNpemUgPSAlZCwgbURhdGEgPSAlcCIsIG1GcmVlT2Zmc2V0LCBtU2l6ZSwgbU1heFNpemUsIG1EYXRhKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsgICAgICAgICAgICAgICAgCisgICAgICAgICAgICB9CisgICAgICAgIH0gCisgICAgICAgIExPR0UoIkN1cnNvcldpbmRvdyBoZWFwIGFsbG9jYXRpb24gZmFpbGVkIik7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9IGVsc2UgeworICAgICAgICBMT0dFKCJmYWlsZWQgdG8gY3JlYXRlIHRoZSBDdXJzb3JXaW5kb3cgaGVhcCIpOworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorf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yAgICB1aW50MzJfdCBmaWVsZERpck9mZnNldCA9IGFsbG9jKGZpZWxkRGlyU2l6ZSk7CisgICAgaWYgKCFmaWVsZERpck9mZnNldCkgeworICAgICAgICBtSGVhZGVyLT5udW1Sb3dzLS07CisgICAgICAgIExPR0UoIlRoZSByb3cgZmFpbGVkLCBzbyBiYWNrIG91dCB0aGUgbmV3IHJvdyBhY2NvdW50aW5nIGZyb20gYWxsb2NSb3dTbG90ICVkIiwgbUhlYWRlci0+bnVtUm93cyk7CisgICAgICAgIHJldHVybiBOVUxMOworICAgIH0KKyAgICBmaWVsZF9zbG90X3QgKiBmaWVsZERpciA9IChmaWVsZF9zbG90X3QgKilvZmZzZXRUb1B0cihmaWVsZERpck9mZnNldCk7CisgICAgbWVtc2V0KGZpZWxkRGlyLCAweDAsIGZpZWxkRGlyU2l6ZSk7CisKK0xPR19XSU5ET1coIkFsbG9jYXRlZCByb3cgJXUsIHJvd1Nsb3QgaXMgYXQgb2Zmc2V0ICV1LCBmaWVsZERpciBpcyAlZCBieXRlcyBhdCBvZmZzZXQgJXVcbiIsIChtSGVhZGVyLT5udW1Sb3dzIC0gMSksICgodWludDhfdCAqKXJvd1Nsb3QpIC0gbURhdGEsIGZpZWxkRGlyU2l6ZSwgZmllbGREaXJPZmZzZXQpOworICAgIHJvd1Nsb3QtPm9mZnNldCA9IGZpZWxkRGlyT2Zmc2V0OworCisgICAgcmV0dXJuIGZpZWxkRGlyOworfQorCit1aW50MzJfdCBDdXJzb3JXaW5kb3c6OmFsbG9jKHNpemVfdCByZXF1ZXN0ZWRTaXplLCBib29sIGFsaWduZWQpCit7CisgICAgaW50MzJfdCBzaXplOworICAgIHVpbnQzMl90IHBhZGRpbmc7CisgICAgaWYgKGFsaWduZWQpIHsKKyAgICAgICAgLy8gNCBieXRlIGFsaWdubWVudAorICAgICAgICBwYWRkaW5nID0gNCAtIChtRnJlZU9mZnNldCAmIDB4Myk7CisgICAgfSBlbHNlIHsKKyAgICAgICAgcGFkZGlu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gIHJldHVybiAwOworICAgICAgICAgICAgfQorICAgICAgICB9CitMT0dfV0lORE9XKCJmb3VuZCBzaXplICVkIiwgbmV3U2l6ZSk7CisgICAgICAgIG1TaXplID0gbmV3U2l6ZTsKKyAgICB9CisKKyAgICB1aW50MzJfdCBvZmZzZXQgPSBtRnJlZU9mZnNldCArIHBhZGRpbmc7CisgICAgbUZyZWVPZmZzZXQgKz0gc2l6ZTsKKyAgICByZXR1cm4gb2Zmc2V0OworfQorCityb3dfc2xvdF90ICogQ3Vyc29yV2luZG93OjpnZXRSb3dTbG90KGludCByb3cpCit7CisgICAgTE9HX1dJTkRPVygiZW50ZXIgZ2V0Um93U2xvdCBjdXJyZW50IHJvdyBudW0gJWQsIHRoaXMgcm93ICVkIiwgbUhlYWRlci0+bnVtUm93cywgcm93KTsKKyAgICBpbnQgY2h1bmtOdW0gPSByb3cgLyBST1dfU0xPVF9DSFVOS19OVU1fUk9XUzsKKyAgICBpbnQgY2h1bmtQb3MgPSByb3cgJSBST1dfU0xPVF9DSFVOS19OVU1fUk9XUzsKKyAgICBpbnQgY2h1bmtQdHJPZmZzZXQgPSBzaXplb2Yod2luZG93X2hlYWRlcl90KSArIFJPV19TTE9UX0NIVU5LX1NJWkUgLSBzaXplb2YodWludDMyX3QpOworICAgIHVpbnQ4X3QgKiByb3dDaHVuayA9IG1EYXRhICsgc2l6ZW9mKHdpbmRvd19oZWFkZXJfdCk7CisgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBjaHVua051bTsgaSsrKSB7CisgICAgICAgIHJvd0NodW5rID0gb2Zmc2V0VG9QdHIoKigodWludDMyX3QgKikobURhdGEgKyBjaHVua1B0ck9mZnNldCkpKTsKKyAgICAgICAgY2h1bmtQdHJPZmZzZXQgPSByb3dDaHVuayAtIG1EYXRhICsgKFJPV19TTE9UX0NIVU5LX05VTV9ST1dTICogc2l6ZW9mKHJvd19zbG90X3QpKTsKKyAgICB9CisgICAgcmV0dXJuIChyb3dfc2xvdF90ICopKHJvd0NodW5rICsgKGNodW5rUG9zICogc2l6ZW9mKHJvd19zbG90X3QpKSk7CisgICAgTE9HX1dJTkRPVygiZXhpdCBnZXRSb3dTbG90IGN1cnJlbnQgcm93IG51bSAlZCwgdGhpcyByb3cgJWQiLCBtSGVhZGVyLT5udW1Sb3dzLCByb3cpOyAgICAKK30KKworcm93X3Nsb3RfdCAqIEN1cnNvcldpbmRvdzo6YWxsb2NSb3dTbG90KCkKK3sKKyAgICBpbnQgY2h1bmtOdW0gPSBtSGVhZGVyLT5udW1Sb3dzIC8gUk9XX1NMT1RfQ0hVTktfTlVNX1JPV1M7CisgICAgaW50IGNodW5rUG9zID0gbUhlYWRlci0+bnVtUm93cyAlIFJPV19TTE9UX0NIVU5LX05VTV9ST1dTOworICAgIGludCBjaHVua1B0ck9mZnNldCA9IHNpemVvZih3aW5kb3dfaGVhZGVyX3QpICsgUk9XX1NMT1RfQ0hVTktfU0laRSAtIHNpemVvZih1aW50MzJfdCk7CisgICAgdWludDhfdCAqIHJvd0NodW5rID0gbURhdGEgKyBzaXplb2Yod2luZG93X2hlYWRlcl90KTsKK0xPR19XSU5ET1coIkFsbG9jYXRpbmcgcm93IHNsb3QsIG1IZWFkZXItPm51bVJvd3MgaXMgJWQsIGNodW5rTnVtIGlzICVkLCBjaHVua1BvcyBpcyAlZCIsIG1IZWFkZXItPm51bVJvd3MsIGNodW5rTnVtLCBjaHVua1Bvcyk7CisgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBjaHVua051bTsgaSsrKSB7CisgICAgICAgIHVpbnQzMl90IG5leHRDaHVua09mZnNldCA9ICooKHVpbnQzMl90ICopKG1EYXRhICsgY2h1bmtQdHJPZmZzZXQpKTsKK0xPR19XSU5ET1coIm5leHRDaHVua09mZnNldCBpcyAlZCIsIG5leHRDaHVua09mZnNldCk7CisgICAgICAgIGlmIChuZXh0Q2h1bmtPZmZzZXQgPT0gMCkgeworICAgICAgICAgICAgLy8gQWxsb2NhdGUgYSBuZXcgcm93IGNodW5rCisgICAgICAgICAgICBuZXh0Q2h1bmtPZmZzZXQgPSBhbGxvYyhST1dfU0xPVF9DSFVOS19TSVpFLCB0cnVlKTsKKyAgICAgICAgICAgIGlmIChuZXh0Q2h1bmtPZmZzZXQgPT0gMCkgeworICAgICAgICAgICAgICAgIHJldHVybiBOVUxMOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcm93Q2h1bmsgPSBvZmZzZXRUb1B0cihuZXh0Q2h1bmtPZmZzZXQpOworTE9HX1dJTkRPVygiYWxsb2NhdGVkIG5ldyBjaHVuayBhdCAlZCwgcm93Q2h1bmsgPSAlcCIsIG5leHRDaHVua09mZnNldCwgcm93Q2h1bmspOworICAgICAgICAgICAgKigodWludDMyX3QgKikobURhdGEgKyBjaHVua1B0ck9mZnNldCkpID0gcm93Q2h1bmsgLSBtRGF0YTsKKyAgICAgICAgICAgIC8vIE1hcmsgdGhlIG5ldyBjaHVuaydzIG5leHQgJ3BvaW50ZXInIGFzIG51bGwKKyAgICAgICAgICAgICooKHVpbnQzMl90ICopKHJvd0NodW5rICsgUk9XX1NMT1RfQ0hVTktfU0laRSAtIHNpemVvZih1aW50MzJfdCkpKSA9IDA7CisgICAgICAgIH0gZWxzZSB7CitMT0dfV0lORE9XKCJmb2xsd2luZyAncG9pbnRlcicgdG8gbmV4dCBjaHVuaywgb2Zmc2V0IG9mIG5leHQgcG9pbnRlciBpcyAlZCIsIGNodW5rUHRyT2Zmc2V0KTsKKyAgICAgICAgICAgIHJvd0NodW5rID0gb2Zmc2V0VG9QdHIobmV4dENodW5rT2Zmc2V0KTsKKyAgICAgICAgICAgIGNodW5rUHRyT2Zmc2V0ID0gcm93Q2h1bmsgLSBtRGF0YSArIChST1dfU0xPVF9DSFVOS19OVU1fUk9XUyAqIHNpemVvZihyb3dfc2xvdF90KSk7CisgICAgICAgIH0KKyAgICB9CisgICAgbUhlYWRlci0+bnVtUm93cysrOworCisgICAgcmV0dXJuIChyb3dfc2xvdF90ICopKHJvd0NodW5rIC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G9wOworCisgICAgaW50IHdpZHRoID0gKGludCkgZ2x5cGgtPm1CaXRtYXBXaWR0aDsKKyAgICBpbnQgaGVpZ2h0ID0gKGludCkgZ2x5cGgtPm1CaXRtYXBIZWlnaHQ7CisKKyAgICBpZiAoYm91bmRzLT5ib3R0b20gPiBuUGVuWSkgeworICAgICAgICBib3VuZHMtPmJvdHRvbSA9IG5QZW5ZOworICAgIH0KKyAgICBpZiAoYm91bmRzLT5sZWZ0ID4gblBlblgpIHsKKyAgICAgICAgYm91bmRzLT5sZWZ0ID0gblBlblg7CisgICAgfQorICAgIGlmIChib3VuZHMtPnJpZ2h0IDwgblBlblggKyB3aWR0aCkgeworICAgICAgICBib3VuZHMtPnJpZ2h0ID0gblBlblggKyB3aWR0aDsKKyAgICB9CisgICAgaWYgKGJvdW5kcy0+dG9wIDwgblBlblkgKyBoZWlnaHQpIHsKKyAgICAgICAgYm91bmRzLT50b3AgPSBuUGVuWSArIGhlaWdodDsKKyAgICB9Cit9CisKK3ZvaWQgRm9udDo6ZHJhd0NhY2hlZEdseXBoKENhY2hlZEdseXBoSW5mbyogZ2x5cGgsIGludCB4LCBpbnQgeSkgeworICAgIGludCBuUGVuWCA9IHggKyBnbHlwaC0+bUJpdG1hcExlZnQ7CisgICAgaW50IG5QZW5ZID0geSArIGdseXBoLT5tQml0bWFwVG9wICsgZ2x5cGgtPm1CaXRtYXBIZWlnaHQ7CisKKyAgICBmbG9hdCB1MSA9IGdseXBoLT5tQml0bWFwTWluVTsKKyAgICBmbG9hdCB1MiA9IGdseXBoLT5tQml0bWFwTWF4VTsKKyAgICBmbG9hdCB2MSA9IGdseXBoLT5tQml0bWFwTWluVjsKKyAgICBmbG9hdCB2MiA9IGdseXBoLT5tQml0bWFwTWF4VjsKKworICAgIGludCB3aWR0aCA9IChpbnQpIGdseXBoLT5tQml0bWFwV2lkdGg7CisgICAgaW50IGhlaWdodCA9IChpbnQpIGdseXBoLT5tQml0bWFwSGVpZ2h0OworCisgICAgbVN0Y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WSwgYlkgPSBuUGVuWTsgY2FjaGVZIDwgZW5kWTsgY2FjaGVZKyssIGJZKyspIHsKKyAgICAgICAgICAgIGlmIChiWCA8IDAgfHwgYlkgPCAwIHx8IGJYID49IChpbnQzMl90KSBiaXRtYXBXIHx8IGJZID49IChpbnQzMl90KSBiaXRtYXBIKSB7CisgICAgICAgICAgICAgICAgTE9HRSgiU2tpcHBpbmcgaW52YWxpZCBpbmRleCIpOworICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgfQorICAgICAgICAgICAgdWludDhfdCB0ZW1wQ29sID0gY2FjaGVCdWZmZXJbY2FjaGVZICogY2FjaGVXaWR0aCArIGNhY2hlWF07CisgICAgICAgICAgICBiaXRtYXBbYlkgKiBiaXRtYXBXICsgYlhdID0gdGVtcENvbDsKKyAgICAgICAgfQorICAgIH0KKworfQorCitGb250OjpDYWNoZWRHbHlwaEluZm8qIEZvbnQ6OmdldENhY2hlZFVURkNoYXIoU2tQYWludCogcGFpbnQsIGludDMyX3QgdXRmQ2hhcikgeworICAgIENhY2hlZEdseXBoSW5mbyogY2FjaGVkR2x5cGggPSBOVUxMOworICAgIHNzaXplX3QgaW5kZXggPSBtQ2FjaGVkR2x5cGhzLmluZGV4T2ZLZXkodXRmQ2hhcik7CisgICAgaWYgKGluZGV4ID49IDApIHsKKyAgICAgICAgY2FjaGVkR2x5cGggPSBtQ2FjaGVkR2x5cGhzLnZhbHVlQXQoaW5kZXgpOworICAgIH0gZWxzZSB7CisgICAgICAgIGNhY2hlZEdseXBoID0gY2FjaGVHbHlwaChwYWludCwgdXRmQ2hhcik7CisgICAgfQorCisgICAgLy8gSXMgdGhlIGdseXBoIHN0aWxsIGluIHRleHR1cmUgY2FjaGU/CisgICAgaWYgKCFjYWNoZWRHbHlwaC0+bUlzVmFsaWQpIHsKKyAgICAgICAgY29uc3QgU2tHbHlwaCYgc2tpYUdseXBoID0gcGFpbnQtPmdldFVuaWNoYXJNZXRyaWNzKHV0ZkNoY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TYsIC0xZTYsIDFlNik7CisgICAgcmVuZGVyVVRGKHBhaW50LCB0ZXh0LCBzdGFydCwgbGVuLCBudW1HbHlwaHMsIDAsIDAsIE1FQVNVUkUsIE5VTEwsIDAsIDAsIGJvdW5kcyk7Cit9CisKK3ZvaWQgRm9udDo6cmVuZGVyVVRGKFNrUGFpbnQqIHBhaW50LCBjb25zdCBjaGFyKiB0ZXh0LCB1aW50MzJfdCBzdGFydCwgdWludDMyX3QgbGVuLAorICAgICAgICBpbnQgbnVtR2x5cGhzLCBpbnQgeCwgaW50IHksIFJlbmRlck1vZGUgbW9kZSwgdWludDhfdCAqYml0bWFwLAorICAgICAgICB1aW50MzJfdCBiaXRtYXBXLCB1aW50MzJfdCBiaXRtYXBILFJlY3QgKmJvdW5kcykgeworICAgIGlmIChudW1HbHlwaHMgPT0gMCB8fCB0ZXh0ID09IE5VTEwgfHwgbGVuID09IDApIHsKKyAgICAgICAgcmV0dXJuOworICAgIH0KKworICAgIGludCBwZW5YID0geCwgcGVuWSA9IHk7CisgICAgaW50IGdseXBoc0xlZnQgPSAxOworICAgIGlmIChudW1HbHlwaHMgPiAwKSB7CisgICAgICAgIGdseXBoc0xlZnQgPSBudW1HbHlwaHM7CisgICAgfQorCisgICAgdGV4dCArPSBzdGFydDsKKworICAgIHdoaWxlIChnbHlwaHNMZWZ0ID4gMCkgeworICAgICAgICBpbnQzMl90IHV0ZkNoYXIgPSBTa1VURjE2X05leHRVbmljaGFyKChjb25zdCB1aW50MTZfdCoqKSAmdGV4dCk7CisKKyAgICAgICAgLy8gUmVhY2hlZCB0aGUgZW5kIG9mIHRoZSBzdHJpbmcKKyAgICAgICAgaWYgKHV0ZkNoYXIgPCAwKSB7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorCisgICAgICAgIENhY2hlZEdseXBoSW5mbyogY2FjaGVkR2x5cGggPSBnZXRDYWNoZWRVVEZDaGFyKHBhaW50LCB1dGZDaGFyKTsKKworICAgICAgICAvLyBJZiBpdCdzIHN0aWxsIG5vdCB2YWxpZCwgd2UgY291bGRuJ3QgY2FjaGUgaXQsIHNvIHdlIHNob3VsZG4ndCBkcmF3IGdhcmJhZ2UKKyAgICAgICAgaWYgKGNhY2hlZEdseXBoLT5tSXNWYWxpZCkgeworICAgICAgICAgICAgc3dpdGNoKG1vZGUpIHsKKyAgICAgICAgICAgIGNhc2UgRlJBTUVCVUZGRVI6CisgICAgICAgICAgICAgICAgZHJhd0NhY2hlZEdseXBoKGNhY2hlZEdseXBoLCBwZW5YLCBwZW5ZKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgQklUTUFQOgorICAgICAgICAgICAgICAgIGRyYXdDYWNoZWRHbHlwaChjYWNoZWRHbHlwaCwgcGVuWCwgcGVuWSwgYml0bWFwLCBiaXRtYXBXLCBiaXRtYXBIKTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgTUVBU1VSRToKKyAgICAgICAgICAgICAgICBtZWFzdXJlQ2FjaGVkR2x5cGgoY2FjaGVkR2x5cGgsIHBlblgsIHBlblksIGJvdW5kcyk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwZW5YICs9IFNrRml4ZWRGbG9vcihjYWNoZWRHbHlwaC0+bUFkdmFuY2VYKTsKKworICAgICAgICAvLyBJZiB3ZSB3ZXJlIGdpdmVuIGEgc3BlY2lmaWMgbnVtYmVyIG9mIGdseXBocywgZGVjcmVtZW50CisgICAgICAgIGlmIChudW1HbHlwaHMgPiAwKSB7CisgICAgICAgICAgICBnbHlwaHNMZWZ0LS07CisgICAgICAgIH0KKyAgICB9Cit9CisKK3ZvaWQgRm9udDo6dXBkYXRlR2x5cGhDYWNoZShTa1BhaW50KiBwYWludCwgY29uc3QgU2tHbHlwaCYgc2tpYUdseXBoLCBDYWNoZWRHbHlwaEluZm8qIGdseXBoKSB7CisgICAgZ2x5cGgtPm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5zaXplKCk7IGkrKykgeworICAgICAgICBGb250KiBmb250ID0gYWN0aXZlRm9udHNbaV07CisgICAgICAgIGlmIChmb250LT5tRm9udElkID09IGZvbnRJZCAmJiBmb250LT5tRm9udFNpemUgPT0gZm9udFNpemUpIHsKKyAgICAgICAgICAgIHJldHVybiBmb250OworICAgICAgICB9CisgICAgfQorCisgICAgRm9udCogbmV3Rm9udCA9IG5ldyBGb250KHN0YXRlLCBmb250SWQsIGZvbnRTaXplKTsKKyAgICBhY3RpdmVGb250cy5wdXNoKG5ld0ZvbnQpOworICAgIHJldHVybiBuZXdGb250OworfQorCisvLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vCisvLyBGb250UmVuZGVyZXIKKy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8KKworRm9udFJlbmRlcmVyOjpGb250UmVuZGVyZXIoKSB7CisgICAgTE9HRCgiQ3JlYXRpbmcgRm9udFJlbmRlcmVyIik7CisKKyAgICBtR2FtbWFUYWJsZSA9IE5VTEw7CisgICAgbUluaXRpYWxpemVkID0gZmFsc2U7CisgICAgbU1heE51bWJlck9mUXVhZHMgPSAxMDI0OworICAgIG1DdXJyZW50UXVhZEluZGV4ID0gMDsKKyAgICBtVGV4dHVyZUlkID0gMDsKKworICAgIG1UZXh0TWVzaFB0ciA9IE5VTEw7CisgICAgbVRleHRUZXh0dXJlID0gTlVMTDsKKworICAgIG1JbmRleEJ1ZmZlcklEID0gMDsKKworICAgIG1DYWNoZVdpZHRoID0gREVGQVVMVF9URVhUX0NBQ0hFX1dJRFRIOworICAgIG1DYWNoZUhlaWdodCA9IERFRkFVTFRfVEVYVF9DQUNIRV9IRUlHSFQ7CisKKyAgICBjaGFyIHByb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gIGlmIChiaXRtYXBGaXQpIHsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIC8vIGlmIHdlIHN0aWxsIGRvbid0IGZpdCwgc29tZXRoaW5nIGlzIHdyb25nIGFuZCB3ZSBzaG91bGRuJ3QgZHJhdworICAgICAgICBpZiAoIWJpdG1hcEZpdCkgeworICAgICAgICAgICAgTE9HRSgiQml0bWFwIGRvZXNuJ3QgZml0IGluIGNhY2hlLiB3aWR0aCwgaGVpZ2h0ID0gJWksICVpIiwKKyAgICAgICAgICAgICAgICAgICAgKGludCkgZ2x5cGguZldpZHRoLCAoaW50KSBnbHlwaC5mSGVpZ2h0KTsKKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorICAgIH0KKworICAgICpyZXRPcmlnaW5YID0gc3RhcnRYOworICAgICpyZXRPcmlnaW5ZID0gc3RhcnRZOworCisgICAgdWludDMyX3QgZW5kWCA9IHN0YXJ0WCArIGdseXBoLmZXaWR0aDsKKyAgICB1aW50MzJfdCBlbmRZID0gc3RhcnRZICsgZ2x5cGguZkhlaWdodDsKKworICAgIHVpbnQzMl90IGNhY2hlV2lkdGggPSBtQ2FjaGVXaWR0aDsKKworICAgIHVpbnQ4X3QqIGNhY2hlQnVmZmVyID0gbVRleHRUZXh0dXJlOworICAgIHVpbnQ4X3QqIGJpdG1hcEJ1ZmZlciA9ICh1aW50OF90KikgZ2x5cGguZkltYWdlOworICAgIHVuc2lnbmVkIGludCBzdHJpZGUgPSBnbHlwaC5yb3dCeXRlcygpOworCisgICAgdWludDMyX3QgY2FjaGVYID0gMCwgYlggPSAwLCBjYWNoZVkgPSAwLCBiWSA9IDA7CisgICAgZm9yIChjYWNoZVggPSBzdGFydFgsIGJYID0gMDsgY2FjaGVYIDwgZW5kWDsgY2FjaGVYKyssIGJYKyspIHsKKyAgICAgICAgZm9yIChjYWNoZVkgPSBzdGFydFksIGJZID0gMDsgY2Fj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ZXI6Omhvcml6b250YWxCbHVyKGZsb2F0KiB3ZWlnaHRzLCBpbnQzMl90IHJhZGl1cywKKyAgICAgICAgY29uc3QgdWludDhfdCogc291cmNlLCB1aW50OF90KiBkZXN0LCBpbnQzMl90IHdpZHRoLCBpbnQzMl90IGhlaWdodCkgeworICAgIGZsb2F0IGJsdXJyZWRQaXhlbCA9IDAuMGY7CisgICAgZmxvYXQgY3VycmVudFBpeGVsID0gMC4wZjsKKworICAgIGZvcihpbnQzMl90IHkgPSAwOyB5IDwgaGVpZ2h0OyB5ICsrKSB7CisKKyAgICAgICAgY29uc3QgdWludDhfdCogaW5wdXQgPSBzb3VyY2UgKyB5ICogd2lkdGg7CisgICAgICAgIHVpbnQ4X3QqIG91dHB1dCA9IGRlc3QgKyB5ICogd2lkdGg7CisKKyAgICAgICAgZm9yKGludDMyX3QgeCA9IDA7IHggPCB3aWR0aDsgeCArKykgeworICAgICAgICAgICAgYmx1cnJlZFBpeGVsID0gMC4wZjsKKyAgICAgICAgICAgIGNvbnN0IGZsb2F0KiBnUHRyID0gd2VpZ2h0czsKKyAgICAgICAgICAgIC8vIE9wdGltaXphdGlvbiBmb3Igbm9uLWJvcmRlciBwaXhlbHMKKyAgICAgICAgICAgIGlmICgoeCA+IHJhZGl1cykgJiYgKHggPCAod2lkdGggLSByYWRpdXMpKSkgeworICAgICAgICAgICAgICAgIGNvbnN0IHVpbnQ4X3QgKmkgPSBpbnB1dCArICh4IC0gcmFkaXVzKTsKKyAgICAgICAgICAgICAgICBmb3IoaW50IHIgPSAtcmFkaXVzOyByIDw9IHJhZGl1czsgciArKykgeworICAgICAgICAgICAgICAgICAgICBjdXJyZW50UGl4ZWwgPSAoZmxvYXQpKCppKTsKKyAgICAgICAgICAgICAgICAgICAgYmx1cnJlZFBpeGVsICs9IGN1cnJlbnRQaXhlbCAqIGdQdHJbMF07CisgICAgICAgICAgICAgICAgICAgIGdQdHIrKzsKKyAgICAgICAgICAgICAgICAgICAgaSsrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgZm9yKGludDMyX3QgciA9IC1yYWRpdXM7IHIgPD0gcmFkaXVzOyByICsrKSB7CisgICAgICAgICAgICAgICAgICAgIC8vIFN0ZXBwaW5nIGxlZnQgYW5kIHJpZ2h0IGF3YXkgZnJvbSB0aGUgcGl4ZWwKKyAgICAgICAgICAgICAgICAgICAgaW50IHZhbGlkVyA9IHggKyByOworICAgICAgICAgICAgICAgICAgICBpZih2YWxpZFcgPCAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICB2YWxpZFcgPSAwOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGlmKHZhbGlkVyA+IHdpZHRoIC0gMSkgeworICAgICAgICAgICAgICAgICAgICAgICAgdmFsaWRXID0gd2lkdGggLSAxOworICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgY3VycmVudFBpeGVsID0gKGZsb2F0KShpbnB1dFt2YWxpZFddKTsKKyAgICAgICAgICAgICAgICAgICAgYmx1cnJlZFBpeGVsICs9IGN1cnJlbnRQaXhlbCAqIGdQdHJbMF07CisgICAgICAgICAgICAgICAgICAgIGdQdHIrKzsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICAqb3V0cHV0ID0gKHVpbnQ4X3QpYmx1cnJlZFBpeGVsOworICAgICAgICAgICAgb3V0cHV0ICsrOworICAgICAgICB9CisgICAgfQorfQorCit2b2lkIEZvbnRSZW5kZXJlcjo6dmVydGljYWxCbHVyKGZsb2F0KiB3ZWlnaHRzLCBpbnQzMl90IHJhZGl1cywKKyAgICAgICAgY29uc3QgdWludDhfdCogc291cmNlLCB1aW50OF90KiBkZXN0LCBpbnQzMl90IHdpZHRoLCBpbnQzMl90IGhlaWdodCkgeworICAgIGZsb2F0IGJsdXJyZWRQaXhlbCA9IDAuMGY7CisgICAgZmxvYXQgY3VycmVudFBpeGVsID0gMC4wZjsKKworICAgIGZvcihpbnQzMl90IHkgPSAwOyB5IDwgaGVpZ2h0OyB5ICsrKSB7CisKKyAgICAgICAgdWludDhfdCogb3V0cHV0ID0gZGVzdCArIHkgKiB3aWR0aDsKKworICAgICAgICBmb3IoaW50MzJfdCB4ID0gMDsgeCA8IHdpZHRoOyB4ICsrKSB7CisgICAgICAgICAgICBibHVycmVkUGl4ZWwgPSAwLjBmOworICAgICAgICAgICAgY29uc3QgZmxvYXQqIGdQdHIgPSB3ZWlnaHRzOworICAgICAgICAgICAgY29uc3QgdWludDhfdCogaW5wdXQgPSBzb3VyY2UgKyB4OworICAgICAgICAgICAgLy8gT3B0aW1pemF0aW9uIGZvciBub24tYm9yZGVyIHBpeGVscworICAgICAgICAgICAgaWYgKCh5ID4gcmFkaXVzKSAmJiAoeSA8IChoZWlnaHQgLSByYWRpdXMpKSkgeworICAgICAgICAgICAgICAgIGNvbnN0IHVpbnQ4X3QgKmkgPSBpbnB1dCArICgoeSAtIHJhZGl1cykgKiB3aWR0aCk7CisgICAgICAgICAgICAgICAgZm9yKGludDMyX3QgciA9IC1yYWRpdXM7IHIgPD0gcmFkaXVzOyByICsrKSB7CisgICAgICAgICAgICAgICAgICAgIGN1cnJlbnRQaXhlbCA9IChmbG9hdCkoKmkpOworICAgICAgICAgICAgICAgICAgICBibHVycmVkUGl4ZWwgKz0gY3VycmVudFBpeGVsICogZ1B0clswXTsKKyAgICAgICAgICAgICAgICAgICAgZ1B0cisrOworICAgICAgICAgICAgICAgICAgICBpICs9IHdpZHRoOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgZm9yKGludDMyX3QgciA9IC1yYWRpdXM7IHIgPD0gcmFkaXVzOyByICsrKSB7CisgICAgICAgICAgICAgICAgICAgIGludCB2YWxpZEggPSB5ICsgcjsKKyAgICAgICAgICAgICAgICAgICAgLy8gQ2xhbXAgdG8gemVybyBhbmQgd2lkdGgKKyAgICAgICAgICAgICAgICAgICAgaWYodmFsaWRIIDwgMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgdmFsaWRIID0gMDsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBpZih2YWxpZEggPiBoZWlnaHQgLSAxKSB7CisgICAgICAgICAgICAgICAgICAgICAgICB2YWxpZEggPSBoZWlnaHQgLSAxOworICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgY29uc3QgdWludDhfdCAqaSA9IGlucHV0ICsgdmFsaWRIICogd2lkdGg7CisgICAgICAgICAgICAgICAgICAgIGN1cnJlbnRQaXhlbCA9IChmbG9hdCkoKmkpOworICAgICAgICAgICAgICAgICAgICBibHVycmVkUGl4ZWwgKz0gY3VycmVudFBpeGVsICogZ1B0clswXTsKKyAgICAgICAgICAgICAgICAgICAgZ1B0cisrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgICpvdXRwdXQgPSAodWludDhfdClibHVycmVkUGl4ZWw7CisgICAgICAgICAgICBvdXRwdXQgKys7CisgICAgICAgIH0KKyAgICB9Cit9CisKKwordm9pZCBGb250UmVuZGVyZXI6OmJsdXJJbWFnZSh1aW50OF90ICppbWFnZSwgaW50MzJfdCB3aWR0aCwgaW50MzJfdCBoZWlnaHQsIGludDMyX3QgcmFkaXVzKSB7CisgICAgZmxvYXQgKmdhdXNzaWFuID0gbmV3IGZsb2F0WzIgKiByYWRpdXMgKyAxXTsKKyAgICBjb21wdXRlR2F1c3NpYW5XZWlnaHRzKGdhdXNzaWFuLCByYWRpdXMpOworICAgIHVpbnQ4X3QqIHNjcmF0Y2ggPSBuZXcgdWludDhfdFt3aWR0aCAqIGhlaWdodF07CisgICAgaG9yaXpvbnRhbEJsdXIoZ2F1c3NpYW4sIHJhZGl1cywgaW1hZ2UsIHNjcmF0Y2gsIHdpZHRoLCBoZWlnaHQpOworICAgIHZlcnRpY2FsQmx1cih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sIGl0IHdpbGwgYmUgdXNlZCBhcyB0aGUgcmVuZGVyIHRhcmdldAorICAgICAqLworICAgIHZvaWQgcmVuZGVyVVRGKFNrUGFpbnQqIHBhaW50LCBjb25zdCBjaGFyICp0ZXh0LCB1aW50MzJfdCBzdGFydCwgdWludDMyX3QgbGVuLAorICAgICAgICAgICAgICAgICAgICAgaW50IG51bUdseXBocywgaW50IHgsIGludCB5LAorICAgICAgICAgICAgICAgICAgICAgdWludDhfdCAqYml0bWFwID0gTlVMTCwgdWludDMyX3QgYml0bWFwVyA9IDAsIHVpbnQzMl90IGJpdG1hcEggPSAwKTsKKyAgICAvKioKKyAgICAgKiBDcmVhdGVzIGEgbmV3IGZvbnQgYXNzb2NpYXRlZCB3aXRoIHRoZSBzcGVjaWZpZWQgZm9udCBzdGF0ZS4KKyAgICAgKi8KKyAgICBzdGF0aWMgRm9udCogY3JlYXRlKEZvbnRSZW5kZXJlciogc3RhdGUsIHVpbnQzMl90IGZvbnRJZCwgZmxvYXQgZm9udFNpemUpOworCitwcm90ZWN0ZWQ6CisgICAgZnJpZW5kIGNsYXNzIEZvbnRSZW5kZXJlcjsKKworICAgIGVudW0gUmVuZGVyTW9kZSB7CisgICAgICAgIEZSQU1FQlVGRkVSLAorICAgICAgICBCSVRNQVAsCisgICAgICAgIE1FQVNVUkUsCisgICAgfTsKKworICAgIHZvaWQgcmVuZGVyVVRGKFNrUGFpbnQqIHBhaW50LCBjb25zdCBjaGFyICp0ZXh0LCB1aW50MzJfdCBzdGFydCwgdWludDMyX3QgbGVuLAorICAgICAgICAgICAgICAgICAgICAgaW50IG51bUdseXBocywgaW50IHgsIGludCB5LCBSZW5kZXJNb2RlIG1vZGUsCisgICAgICAgICAgICAgICAgICAgICB1aW50OF90ICpiaXRtYXAsIHVpbnQzMl90IGJpdG1hcFcsIHVpbnQzMl90IGJpdG1hcEgsCisgICAgICAgICAgICAgICAgICAgICBSZWN0ICpib3VuZHMpOworCisgICAgdm9pZCBtZWFzdXJlVV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AgICAgICAgaW50MzJfdCBtQml0bWFwTGVmdDsKKyAgICAgICAgaW50MzJfdCBtQml0bWFwVG9wOworICAgIH07CisKKyAgICBGb250KEZvbnRSZW5kZXJlciogc3RhdGUsIHVpbnQzMl90IGZvbnRJZCwgZmxvYXQgZm9udFNpemUpOworCisgICAgRGVmYXVsdEtleWVkVmVjdG9yPGludDMyX3QsIENhY2hlZEdseXBoSW5mbyo+IG1DYWNoZWRHbHlwaHM7CisKKyAgICB2b2lkIGludmFsaWRhdGVUZXh0dXJlQ2FjaGUoKTsKKworICAgIENhY2hlZEdseXBoSW5mbyogY2FjaGVHbHlwaChTa1BhaW50KiBwYWludCwgaW50MzJfdCBnbHlwaCk7CisgICAgdm9pZCB1cGRhdGVHbHlwaENhY2hlKFNrUGFpbnQqIHBhaW50LCBjb25zdCBTa0dseXBoJiBza2lhR2x5cGgsIENhY2hlZEdseXBoSW5mbyAqZ2x5cGgpOworICAgIHZvaWQgbWVhc3VyZUNhY2hlZEdseXBoKENhY2hlZEdseXBoSW5mbyAqZ2x5cGgsIGludCB4LCBpbnQgeSwgUmVjdCAqYm91bmRzKTsKKyAgICB2b2lkIGRyYXdDYWNoZWRHbHlwaChDYWNoZWRHbHlwaEluZm8gKmdseXBoLCBpbnQgeCwgaW50IHkpOworICAgIHZvaWQgZHJhd0NhY2hlZEdseXBoKENhY2hlZEdseXBoSW5mbyAqZ2x5cGgsIGludCB4LCBpbnQgeSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDhfdCAqYml0bWFwLCB1aW50MzJfdCBiaXRtYXBXLCB1aW50MzJfdCBiaXRtYXBIKTsKKworICAgIENhY2hlZEdseXBoSW5mbyogZ2V0Q2FjaGVkVVRGQ2hhcihTa1BhaW50KiBwYWludCwgaW50MzJfdCB1dGZDaGFyKTsKKworICAgIEZvbnRSZW5kZXJlciogbVN0YXRlOworICAgIHVpbnQzMl90IG1Gb250SWQ7CisgICAgZmxvYXQgbUZvbnRTaXplOworfTsKKworY2xhc3MgRm9udFJlbmRlcmVyIHsKK3B1YmxpYzoKKyAgICBGb250UmVuZGVyZXIoKTsKKyAgICB+Rm9udFJlbmRlcmVyKCk7CisKKyAgICB2b2lkIGluaXQoKTsKKyAgICB2b2lkIGRlaW5pdCgpOworCisgICAgdm9pZCBzZXRHYW1tYVRhYmxlKGNvbnN0IHVpbnQ4X3QqIGdhbW1hVGFibGUpIHsKKyAgICAgICAgbUdhbW1hVGFibGUgPSBnYW1tYVRhYmxlOworICAgIH0KKworICAgIHZvaWQgc2V0Rm9udChTa1BhaW50KiBwYWludCwgdWludDMyX3QgZm9udElkLCBmbG9hdCBmb250U2l6ZSk7CisgICAgdm9pZCByZW5kZXJUZXh0KFNrUGFpbnQqIHBhaW50LCBjb25zdCBSZWN0KiBjbGlwLCBjb25zdCBjaGFyICp0ZXh0LCB1aW50MzJfdCBzdGFydEluZGV4LAorICAgICAgICAgICAgdWludDMyX3QgbGVuLCBpbnQgbnVtR2x5cGhzLCBpbnQgeCwgaW50IHkpOworCisgICAgc3RydWN0IERyb3BTaGFkb3cgeworICAgICAgICBEcm9wU2hhZG93KCkgeyB9OworCisgICAgICAgIERyb3BTaGFkb3coY29uc3QgRHJvcFNoYWRvdyYgZHJvcFNoYWRvdyk6CisgICAgICAgICAgICB3aWR0aChkcm9wU2hhZG93LndpZHRoKSwgaGVpZ2h0KGRyb3BTaGFkb3cuaGVpZ2h0KSwKKyAgICAgICAgICAgIGltYWdlKGRyb3BTaGFkb3cuaW1hZ2UpLCBwZW5YKGRyb3BTaGFkb3cucGVuWCksCisgICAgICAgICAgICBwZW5ZKGRyb3BTaGFkb3cucGVuWSkgeworICAgICAgICB9CisKKyAgICAgICAgdWludDMyX3Qgd2lkdGg7CisgICAgICAgIHVpbnQzMl90IGhlaWdodDsKKyAgICAgICAgdWludDhfdCogaW1hZ2U7CisgICAgICAgIGludDMyX3QgcGVuWDsKKyAgICAgICAgaW50MzJfdCBwZW5ZOworICAgIH07CisKKyAgICAvLyBBZnRlciByZW5kZXJEcm9wU2hhZG93IHJldHVybnMsIHRoZSBjYWxsZWQgb3ducyB0aGUgbWVtb3J5IGluIERyb3BTaGFkb3cuaW1hZ2UKKyAgICAvLyBhbmQgaXMgcmVzcG9uc2libGUgZm9yIHJlbGVhc2luZyBpdCB3aGVuIGl0J3MgZG9uZSB3aXRoIGl0CisgICAgRHJvcFNoYWRvdyByZW5kZXJEcm9wU2hhZG93KFNrUGFpbnQqIHBhaW50LCBjb25zdCBjaGFyICp0ZXh0LCB1aW50MzJfdCBzdGFydEluZGV4LAorICAgICAgICAgICAgdWludDMyX3QgbGVuLCBpbnQgbnVtR2x5cGhzLCB1aW50MzJfdCByYWRpdXMpOworCisgICAgR0x1aW50IGdldFRleHR1cmUoKSB7CisgICAgICAgIGNoZWNrSW5pdCgpOworICAgICAgICByZXR1cm4gbVRleHR1cmVJZDsKKyAgICB9CisKK3Byb3RlY3RlZDoKKyAgICBmcmllbmQgY2xhc3MgRm9udDsKKworICAgIGNvbnN0IHVpbnQ4X3QqIG1HYW1tYVRhYmxlOworCisgICAgc3RydWN0IENhY2hlVGV4dHVyZUxpbmUgeworICAgICAgICB1aW50MTZfdCBtTWF4SGVpZ2h0OworICAgICAgICB1aW50MTZfdCBtTWF4V2lkdGg7CisgICAgICAgIHVpbnQzMl90IG1DdXJyZW50Um93OworICAgICAgICB1aW50MzJfdCBtQ3VycmVudENvbDsKKyAgICAgICAgYm9vbCBtRGlydHk7CisKKyAgICAgICAgQ2FjaGVUZXh0dXJlTGluZSh1aW50MTZfdCBtYXhXaWR0aCwgdWludDE2X3QgbWF4SGVpZ2h0LCB1aW50MzJfdCBjdXJyZW50Um93LAorICAgICAgICAgICAgICAgIHVpbnQzMl90IGN1cnJlbnRDb2wpOgorICAgICAgICAgICAgICAgICAgICBtTWF4SGVpZ2h0KG1heEhlaWdodCksCisgICAgICAgICAgICAgICAgICAgIG1NYXhXaWR0aChtYXhXaWR0aCksCisgICAgICAgICAgICAgICAgICAgIG1DdXJyZW50Um93KGN1cnJlbnRSb3cpLAorICAgICAgICAgICAgICAgICAgICBtQ3VycmVudENvbChjdXJyZW50Q29sKSwKKyAgICAgICAgICAgICAgICAgICAgbURpcnR5KGZhbHNlKSB7CisgICAgICAgIH0KKworICAgICAgICBib29sIGZpdEJpdG1hcChjb25zdCBTa0dseXBoJiBnbHlwaCwgdWludDMyX3QgKnJldE9yaWdpblgsIHVpbnQzMl90ICpyZXRPcmlnaW5ZKSB7CisgICAgICAgICAgICBpZiAoZ2x5cGguZkhlaWdodCA+IG1NYXhIZWlnaHQpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmIChtQ3VycmVudENvbCArIGdseXBoLmZXaWR0aCA8IG1NYXhXaWR0aCkgeworICAgICAgICAgICAgICAgICpyZXRPcmlnaW5YID0gbUN1cnJlbnRDb2w7CisgICAgICAgICAgICAgICAgKnJldE9yaWdpblkgPSBtQ3VycmVudFJvdzsKKyAgICAgICAgICAgICAgICBtQ3VycmVudENvbCArPSBnbHlwaC5mV2lkdGg7CisgICAgICAgICAgICAgICAgbURpcnR5ID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgfTsKKworICAgIHVpbnQzMl90IGdldENhY2hlV2lkdGgoKSBjb25zdCB7CisgICAgICAgIHJldHVybiBtQ2FjaGVXaWR0aDsKKyAgICB9CisKKyAgICB1aW50MzJfdCBnZXRDYWNoZUhlaWdodCgpIGNvbnN0IHsKKyAgICAgICAgcmV0dXJuIG1DYWNoZUhlaWdodDsKKyAgICB9CisKKyAgICB2b2lkIGluaXRUZXh0VGV4dHVyZSgpOworICAgIGJvb2wgY2FjaGVCaXRtYXAoY29uc3QgU2tHbHlwaCYgZ2x5cGgsIHVpbnQzMl90ICpyZXRPcmlnaW5YLCB1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BlbmFtZSBLLCB0eXBlbmFtZSBWPgorViBHZW5lcmF0aW9uQ2FjaGU8SywgVj46OmdldChLIGtleSkgeworICAgIHNzaXplX3QgaW5kZXggPSBtQ2FjaGUuaW5kZXhPZktleShrZXkpOworICAgIGlmIChpbmRleCA+PSAwKSB7CisgICAgICAgIHNwPEVudHJ5PEssIFY+ID4gZW50cnkgPSBtQ2FjaGUudmFsdWVBdChpbmRleCk7CisgICAgICAgIGlmIChlbnRyeS5nZXQoKSkgeworICAgICAgICAgICAgZGV0YWNoRnJvbUNhY2hlKGVudHJ5KTsKKyAgICAgICAgICAgIGF0dGFjaFRvQ2FjaGUoZW50cnkpOworICAgICAgICAgICAgcmV0dXJuIGVudHJ5LT52YWx1ZTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHJldHVybiBOVUxMOworfQorCit0ZW1wbGF0ZTx0eXBlbmFtZSBLLCB0eXBlbmFtZSBWPgordm9pZCBHZW5lcmF0aW9uQ2FjaGU8SywgVj46OnB1dChLIGtleSwgViB2YWx1ZSkgeworICAgIGlmIChtTWF4Q2FwYWNpdHkgIT0ga1VubGltaXRlZENhcGFjaXR5ICYmIG1DYWNoZS5zaXplKCkgPj0gbU1heENhcGFjaXR5KSB7CisgICAgICAgIHJlbW92ZU9sZGVzdCgpOworICAgIH0KKworICAgIHNzaXplX3QgaW5kZXggPSBtQ2FjaGUuaW5kZXhPZktleShrZXkpOworICAgIGlmIChpbmRleCA+PSAwKSB7CisgICAgICAgIHNwPEVudHJ5PEssIFY+ID4gZW50cnkgPSBtQ2FjaGUudmFsdWVBdChpbmRleCk7CisgICAgICAgIGRldGFjaEZyb21DYWNoZShlbnRyeSk7CisgICAgICAgIGFkZFRvQ2FjaGUoZW50cnksIGtleSwgdmFsdWUpOworICAgIH0gZWxzZSB7CisgICAgICAgIHNwPEVudHJ5PEssIFY+ID4gZW50cnkgPSBuZXcgRW50cnk8SywgVj47CisgICAgICAgIGFkZFRvQ2FjaGUoZW50cnksIGtleSwgdmFsdWUpOworICAgIH0KK30KKwordGVtcGxhdGU8dHlwZW5hbWUgSywgdHlwZW5hbWUgVj4KK3ZvaWQgR2VuZXJhdGlvbkNhY2hlPEssIFY+OjphZGRUb0NhY2hlKHNwPEVudHJ5PEssIFY+ID4gZW50cnksIEsga2V5LCBWIHZhbHVlKSB7CisgICAgZW50cnktPmtleSA9IGtleTsKKyAgICBlbnRyeS0+dmFsdWUgPSB2YWx1ZTsKKyAgICBtQ2FjaGUuYWRkKGtleSwgZW50cnkpOworICAgIGF0dGFjaFRvQ2FjaGUoZW50cnkpOworfQorCit0ZW1wbGF0ZTx0eXBlbmFtZSBLLCB0eXBlbmFtZSBWPgorViBHZW5lcmF0aW9uQ2FjaGU8SywgVj46OnJlbW92ZShLIGtleSkgeworICAgIHNzaXplX3QgaW5kZXggPSBtQ2FjaGUuaW5kZXhPZktleShrZXkpOworICAgIGlmIChpbmRleCA+PSAwKSB7CisgICAgICAgIHJldHVybiByZW1vdmVBdChpbmRleCk7CisgICAgfQorCisgICAgcmV0dXJuIE5VTEw7Cit9CisKK3RlbXBsYXRlPHR5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ZDsKKyAgICAgICAgfQorICAgICAgICBpZiAod2lkdGggPT0gcmhzLndpZHRoKSB7CisgICAgICAgICAgICByZXR1cm4gaGVpZ2h0IDwgcmhzLmhlaWdodDsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gd2lkdGggPCByaHMud2lkdGg7CisgICAgfQorCisgICAgYm9vbCBvcGVyYXRvcj09KGNvbnN0IExheWVyU2l6ZSYgcmhzKSBjb25zdCB7CisgICAgICAgIHJldHVybiB3aWR0aCA9PSByaHMud2lkdGggJiYgaGVpZ2h0ID09IHJocy5oZWlnaHQ7CisgICAgfQorfTsgLy8gc3RydWN0IExheWVyU2l6ZQorCisvKioKKyAqIEEgbGF5ZXIgaGFzIGRpbWVuc2lvbnMgYW5kIGlzIGJhY2tlZCBieSBhbiBPcGVuR0wgdGV4dHVyZS4KKyAqLworc3RydWN0IExheWVyIHsKKyAgICAvKioKKyAgICAgKiBDb29yZGluYXRlcyBvZiB0aGUgbGF5ZXIgY29ycmVzcG9uZGluZyB0byB0aGlzIHNuYXBzaG90LgorICAgICAqIE9ubHkgc2V0IHdoZW4gdGhlIGZsYWcga0ZsYWdJc0xheWVyIGlzIHNldC4KKyAgICAgKi8KKyAgICBSZWN0IGxheWVyOworICAgIC8qKgorICAgICAqIE5hbWUgb2YgdGhlIHRleHR1cmUgdXNlZCB0byByZW5kZXIgdGhlIGxheWVyLgorICAgICAqIE9ubHkgc2V0IHdoZW4gdGhlIGZsYWcga0ZsYWdJc0xheWVyIGlzIHNldC4KKyAgICAgKi8KKyAgICBHTHVpbnQgdGV4dHVyZTsKKyAgICAvKioKKyAgICAgKiBOYW1lIG9mIHRoZSBGQk8gdXNlZCB0byByZW5kZXIgdGhlIGxheWVyLgorICAgICAqIE9ubHkgc2V0IHdoZW4gdGhlIGZsYWcga0ZsYWdJc0xheWVyIGlzIHNldC4KKyAgICAgKi8KKyAgICBHTHVpbnQgZmJvOworICAgIC8qKgorICAgICAqIE9wYWNpdHkgb2YgdGhlIGxheWV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RpbWVuc2lvbnMgb2YgdGhlIGRlc2lyZWQgbGF5ZXIKKyAgICAgKiBAcGFyYW0gcHJldmlvdXNGYm8gVGhlIG5hbWUgb2YgdGhlIEZCTyB0byBiaW5kIHRvIGlmIGNyZWF0aW5nIGEgbmV3CisgICAgICogICAgICAgIGxheWVyIGZhaWxzCisgICAgICovCisgICAgTGF5ZXIqIGdldChMYXllclNpemUmIHNpemUsIEdMdWludCBwcmV2aW91c0Zibyk7CisgICAgLyoqCisgICAgICogQWRkcyB0aGUgbGF5ZXIgdG8gdGhlIGNhY2hlLiBUaGUgbGF5ZXIgd2lsbCBub3QgYmUgYWRkZWQgaWYgdGhlcmUgaXMKKyAgICAgKiBub3QgZW5vdWdoIHNwYWNlIGF2YWlsYWJsZS4KKyAgICAgKgorICAgICAqIEBwYXJhbSBzaXplIFRoZSBkaW1lbnNpb25zIG9mIHRoZSBsYXllcgorICAgICAqIEBwYXJhbSBsYXllciBUaGUgbGF5ZXIgdG8gYWRkIHRvIHRoZSBjYWNoZQorICAgICAqCisgICAgICogQHJldHVybiBUcnVlIGlmIHRoZSBsYXllciB3YXMgYWRkZWQsIGZhbHNlIG90aGVyd2lzZS4KKyAgICAgKi8KKyAgICBib29sIHB1dChMYXllclNpemUmIHNpemUsIExheWVyKiBsYXllcik7CisgICAgLyoqCisgICAgICogQ2xlYXJzIHRoZSBjYWNoZS4gVGhpcyBjYXVzZXMgYWxsIGxheWVycyB0byBiZSBkZWxldGVkLgorICAgICAqLworICAgIHZvaWQgY2xlYXIoKTsKKworICAgIC8qKgorICAgICAqIFNldHMgdGhlIG1heGltdW0gc2l6ZSBvZiB0aGUgY2FjaGUgaW4gYnl0ZXMuCisgICAgICovCisgICAgdm9pZCBzZXRNYXhTaXplKHVpbnQzMl90IG1heFNpemUpOworICAgIC8qKgorICAgICAqIFJldHVybnMgdGhlIG1heGltdW0gc2l6ZSBvZiB0aGUgY2FjaGUgaW4gYnl0ZXMuCisgICAgICovCisgICAgdWludDMyX3Qg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hdGFba1NjYWxlWF0gICAgICAgPSAxLjBmOworICAgIGRhdGFba1NrZXdZXSAgICAgICAgPSAwLjBmOworICAgIGRhdGFbMl0gICAgICAgICAgICAgPSAwLjBmOworICAgIGRhdGFba1BlcnNwZWN0aXZlMF0gPSAwLjBmOworCisgICAgZGF0YVtrU2tld1hdICAgICAgICA9IDAuMGY7CisgICAgZGF0YVtrU2NhbGVZXSAgICAgICA9IDEuMGY7CisgICAgZGF0YVs2XSAgICAgICAgICAgICA9IDAuMGY7CisgICAgZGF0YVtrUGVyc3BlY3RpdmUxXSA9IDAuMGY7CisKKyAgICBkYXRhWzhdICAgICAgICAgICAgID0gMC4wZjsKKyAgICBkYXRhWzldICAgICAgICAgICAgID0gMC4wZjsKKyAgICBkYXRhW2tTY2FsZVpdICAgICAgID0gMS4wZjsKKyAgICBkYXRhWzExXSAgICAgICAgICAgID0gMC4wZjsKKworICAgIGRhdGFba1RyYW5zbGF0ZVhdICAgPSAwLjBmOworICAgIGRhdGFba1RyYW5zbGF0ZVldICAgPSAwLjBmOworICAgIGRhdGFba1RyYW5zbGF0ZVpdICAgPSAwLjBmOworICAgIGRhdGFba1BlcnNwZWN0aXZlMl0gPSAxLjBmOworCisgICAgbVNpbXBsZU1hdHJpeCA9IHRydWU7Cit9CisKK3ZvaWQgTWF0cml4NDo6bG9hZChjb25zdCBmbG9hdCogdikgeworICAgIG1lbWNweShkYXRhLCB2LCBzaXplb2YoZGF0YSkpOworICAgIG1TaW1wbGVNYXRyaXggPSBmYWxzZTsKK30KKwordm9pZCBNYXRyaXg0Ojpsb2FkKGNvbnN0IE1hdHJpeDQmIHYpIHsKKyAgICBtZW1jcHkoZGF0YSwgdi5kYXRhLCBzaXplb2YoZGF0YSkpOworICAgIG1TaW1wbGVNYXRyaXggPSB2Lm1TaW1wbGVNYXRyaXg7Cit9CisKK3ZvaWQgTWF0cml4NDo6bG9hZChjb25zdCBTa01hdHJpeCYgdikgeworICAgIG1lbXNldChkYXRhLCAwLCBza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9IHogKiBzOworCisgICAgZGF0YVtrU2NhbGVYXSA9IHggKiB4ICogbmMgKyAgYzsKKyAgICBkYXRhW2tTa2V3WF0gID0gICAgeHkgKiBuYyAtIHpzOworICAgIGRhdGFbOF0gICAgICAgPSAgICB6eCAqIG5jICsgeXM7CisgICAgZGF0YVtrU2tld1ldICA9ICAgIHh5ICogbmMgKyB6czsKKyAgICBkYXRhW2tTY2FsZVldID0geSAqIHkgKiBuYyArICBjOworICAgIGRhdGFbOV0gICAgICAgPSAgICB5eiAqIG5jIC0geHM7CisgICAgZGF0YVsyXSAgICAgICA9ICAgIHp4ICogbmMgLSB5czsKKyAgICBkYXRhWzZdICAgICAgID0gICAgeXogKiBuYyArIHhzOworICAgIGRhdGFba1NjYWxlWl0gPSB6ICogeiAqIG5jICsgIGM7CisKKyAgICBtU2ltcGxlTWF0cml4ID0gZmFsc2U7Cit9CisKK3ZvaWQgTWF0cml4NDo6bG9hZE11bHRpcGx5KGNvbnN0IE1hdHJpeDQmIHUsIGNvbnN0IE1hdHJpeDQmIHYpIHsKKyAgICBmb3IgKGludCBpID0gMCA7IGkgPCA0IDsgaSsrKSB7CisgICAgICAgIGZsb2F0IHggPSAwOworICAgICAgICBmbG9hdCB5ID0gMDsKKyAgICAgICAgZmxvYXQgeiA9IDA7CisgICAgICAgIGZsb2F0IHcgPSAwOworCisgICAgICAgIGZvciAoaW50IGogPSAwIDsgaiA8IDQgOyBqKyspIHsKKyAgICAgICAgICAgIGNvbnN0IGZsb2F0IGUgPSB2LmdldChpLCBqKTsKKyAgICAgICAgICAgIHggKz0gdS5nZXQoaiwgMCkgKiBlOworICAgICAgICAgICAgeSArPSB1LmdldChqLCAxKSAqIGU7CisgICAgICAgICAgICB6ICs9IHUuZ2V0KGosIDIpICogZTsKKyAgICAgICAgICAgIHcgKz0gdS5nZXQoaiwgMykgKiBlOworICAgICAgICB9CisKKyAgICAgICAgc2V0KGksIDAsIHgpOworICAgICAgICBzZXQoaSwgMSwgeSk7CisgICA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aSA8IDg7IGkrPSAyKSB7CisgICAgICAgIGZsb2F0IHB4ID0gdmVydGljZXNbaV07CisgICAgICAgIGZsb2F0IHB5ID0gdmVydGljZXNbaSArIDFdOworCisgICAgICAgIHggPSBweCAqIGRhdGFba1NjYWxlWF0gKyBweSAqIGRhdGFba1NrZXdYXSArIGRhdGFba1RyYW5zbGF0ZVhdOworICAgICAgICB5ID0gcHggKiBkYXRhW2tTa2V3WV0gKyBweSAqIGRhdGFba1NjYWxlWV0gKyBkYXRhW2tUcmFuc2xhdGVZXTsKKyAgICAgICAgeiA9IHB4ICogZGF0YVtrUGVyc3BlY3RpdmUwXSArIHB5ICogZGF0YVtrUGVyc3BlY3RpdmUxXSArIGRhdGFba1BlcnNwZWN0aXZlMl07CisgICAgICAgIGlmICh6KSB6ID0gMS4wZiAvIHo7CisKKyAgICAgICAgdmVydGljZXNbaV0gPSB4ICogejsKKyAgICAgICAgdmVydGljZXNbaSArIDFdID0geSAqIHo7CisgICAgfQorCisgICAgci5sZWZ0ID0gci5yaWdodCA9IHZlcnRpY2VzWzBdOworICAgIHIudG9wID0gci5ib3R0b20gPSB2ZXJ0aWNlc1sxXTsKKworICAgIGZvciAoaW50IGkgPSAyOyBpIDwgODsgaSArPSAyKSB7CisgICAgICAgIHggPSB2ZXJ0aWNlc1tpXTsKKyAgICAgICAgeSA9IHZlcnRpY2VzW2kgKyAxXTsKKworICAgICAgICBpZiAoeCA8IHIubGVmdCkgci5sZWZ0ID0geDsKKyAgICAgICAgZWxzZSBpZiAoeCA+IHIucmlnaHQpIHIucmlnaHQgPSB4OworICAgICAgICBpZiAoeSA8IHIudG9wKSByLnRvcCA9IHk7CisgICAgICAgIGVsc2UgaWYgKHkgPiByLmJvdHRvbSkgci5ib3R0b20gPSB5OworICAgIH0KK30KKwordm9pZCBNYXRyaXg0OjpkdW1wKCkgY29uc3QgeworICAgIExPR0QoIk1hdHJpeDRbc2ltcGxlPSVkIiwgbVNpbXBsZU1hdHJpeCk7CisgICAgT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GVYID0gMCwKKyAgICAgICAga1NrZXdZID0gMSwKKyAgICAgICAga1BlcnNwZWN0aXZlMCA9IDMsCisgICAgICAgIGtTa2V3WCA9IDQsCisgICAgICAgIGtTY2FsZVkgPSA1LAorICAgICAgICBrUGVyc3BlY3RpdmUxID0gNywKKyAgICAgICAga1NjYWxlWiA9IDEwLAorICAgICAgICBrVHJhbnNsYXRlWCA9IDEyLAorICAgICAgICBrVHJhbnNsYXRlWSA9IDEzLAorICAgICAgICBrVHJhbnNsYXRlWiA9IDE0LAorICAgICAgICBrUGVyc3BlY3RpdmUyID0gMTUKKyAgICB9OworCisgICAgTWF0cml4NCgpIHsKKyAgICAgICAgbG9hZElkZW50aXR5KCk7CisgICAgfQorCisgICAgTWF0cml4NChjb25zdCBmbG9hdCogdikgeworICAgICAgICBsb2FkKHYpOworICAgIH0KKworICAgIE1hdHJpeDQoY29uc3QgTWF0cml4NCYgdikgeworICAgICAgICBsb2FkKHYpOworICAgIH0KKworICAgIE1hdHJpeDQoY29uc3QgU2tNYXRyaXgmIHYpIHsKKyAgICAgICAgbG9hZCh2KTsKKyAgICB9CisKKyAgICB2b2lkIGxvYWRJZGVudGl0eSgpOworCisgICAgdm9pZCBsb2FkKGNvbnN0IGZsb2F0KiB2KTsKKyAgICB2b2lkIGxvYWQoY29uc3QgTWF0cml4NCYgdik7CisgICAgdm9pZCBsb2FkKGNvbnN0IFNrTWF0cml4JiB2KTsKKworICAgIHZvaWQgbG9hZEludmVyc2UoY29uc3QgTWF0cml4NCYgdik7CisKKyAgICB2b2lkIGxvYWRUcmFuc2xhdGUoZmxvYXQgeCwgZmxvYXQgeSwgZmxvYXQgeik7CisgICAgdm9pZCBsb2FkU2NhbGUoZmxvYXQgc3gsIGZsb2F0IHN5LCBmbG9hdCBzeik7CisgICAgdm9pZCBsb2FkUm90YXRlKGZsb2F0IGFuZ2xlLCBmbG9hdCB4LCBmbG9hdCB5LCBmbG9hdCB6KTsKKyAgICB2b2lkIGxvYWRNdWx0a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W5kZXJlcjo6c2F2ZVNuYXBzaG90KGludCBmbGFncykgeworICAgIG1TbmFwc2hvdCA9IG5ldyBTbmFwc2hvdChtU25hcHNob3QsIGZsYWdzKTsKKyAgICByZXR1cm4gbVNhdmVDb3VudCsrOworfQorCitib29sIE9wZW5HTFJlbmRlcmVyOjpyZXN0b3JlU25hcHNob3QoKSB7CisgICAgYm9vbCByZXN0b3JlQ2xpcCA9IG1TbmFwc2hvdC0+ZmxhZ3MgJiBTbmFwc2hvdDo6a0ZsYWdDbGlwU2V0OworICAgIGJvb2wgcmVzdG9yZUxheWVyID0gbVNuYXBzaG90LT5mbGFncyAmIFNuYXBzaG90OjprRmxhZ0lzTGF5ZXI7CisgICAgYm9vbCByZXN0b3JlT3J0aG8gPSBtU25hcHNob3QtPmZsYWdzICYgU25hcHNob3Q6OmtGbGFnRGlydHlPcnRobzsKKworICAgIHNwPFNuYXBzaG90PiBjdXJyZW50ID0gbVNuYXBzaG90OworICAgIHNwPFNuYXBzaG90PiBwcmV2aW91cyA9IG1TbmFwc2hvdC0+cHJldmlvdXM7CisKKyAgICBpZiAocmVzdG9yZU9ydGhvKSB7CisgICAgICAgIFJlY3QmIHIgPSBwcmV2aW91cy0+dmlld3BvcnQ7CisgICAgICAgIGdsVmlld3BvcnQoci5sZWZ0LCByLnRvcCwgci5yaWdodCwgci5ib3R0b20pOworICAgICAgICBtT3J0aG9NYXRyaXgubG9hZChjdXJyZW50LT5vcnRob01hdHJpeCk7CisgICAgfQorCisgICAgbVNhdmVDb3VudC0tOworICAgIG1TbmFwc2hvdCA9IHByZXZpb3VzOworCisgICAgaWYgKHJlc3RvcmVMYXllcikgeworICAgICAgICBjb21wb3NlTGF5ZXIoY3VycmVudCwgcHJldmlvdXMpOworICAgIH0KKworICAgIGlmIChyZXN0b3JlQ2xpcCkgeworICAgICAgICBzZXRTY2lzc29yRnJvbUNsaXAoKTsKKyAgICB9CisKKyAgICByZXR1cm4gcmVzdG9yZUNsaXA7Cit9CisKKy8v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OVUxMIHx8IGNvdW50ID09IDAgfHwKKyAgICAgICAgICAgIChwYWludC0+Z2V0QWxwaGEoKSA9PSAwICYmIHBhaW50LT5nZXRYZmVybW9kZSgpID09IE5VTEwpKSB7CisgICAgICAgIHJldHVybjsKKyAgICB9CisKKyAgICBmbG9hdCBzY2FsZVggPSBwYWludC0+Z2V0VGV4dFNjYWxlWCgpOworICAgIGJvb2wgYXBwbHlTY2FsZVggPSBzY2FsZVggPCAwLjk5OTlmIHx8IHNjYWxlWCA+IDEuMDAwMWY7CisgICAgaWYgKGFwcGx5U2NhbGVYKSB7CisgICAgICAgIHNhdmUoU2tDYW52YXM6OmtNYXRyaXhfU2F2ZUZsYWcpOworICAgICAgICB0cmFuc2xhdGUoeCAtICh4ICogc2NhbGVYKSwgMC4wZik7CisgICAgICAgIHNjYWxlKHNjYWxlWCwgMS4wZik7CisgICAgfQorCisgICAgZmxvYXQgbGVuZ3RoID0gLTEuMGY7CisgICAgc3dpdGNoIChwYWludC0+Z2V0VGV4dEFsaWduKCkpIHsKKyAgICAgICAgY2FzZSBTa1BhaW50OjprQ2VudGVyX0FsaWduOgorICAgICAgICAgICAgbGVuZ3RoID0gcGFpbnQtPm1lYXN1cmVUZXh0KHRleHQsIGJ5dGVzQ291bnQpOworICAgICAgICAgICAgeCAtPSBsZW5ndGggLyAyLjBmOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgU2tQYWludDo6a1JpZ2h0X0FsaWduOgorICAgICAgICAgICAgbGVuZ3RoID0gcGFpbnQtPm1lYXN1cmVUZXh0KHRleHQsIGJ5dGVzQ291bnQpOworICAgICAgICAgICAgeCAtPSBsZW5ndGg7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgIGJyZWFrOworICAgIH0KKworICAgIGludCBhbHBoYTsKKyAgICBTa1hmZXJtb2RlOjpNb2RlIG1vZGU7CisgICAgZ2V0QWxwaGFBbmRNb2RlKHBhaW50LCAmYWxwaGEsICZtb2RlKTsKKworICAgIHVpbnQzMl90IGNvbG9yID0gcGFpbnQtPmdldENvbG9yKCk7CisgICAgY29uc3QgR0xmbG9hdCBhID0gYWxwaGEgLyAyNTUuMGY7CisgICAgY29uc3QgR0xmbG9hdCByID0gYSAqICgoY29sb3IgPj4gMTYpICYgMHhGRikgLyAyNTUuMGY7CisgICAgY29uc3QgR0xmbG9hdCBnID0gYSAqICgoY29sb3IgPj4gIDgpICYgMHhGRikgLyAyNTUuMGY7CisgICAgY29uc3QgR0xmbG9hdCBiID0gYSAqICgoY29sb3IgICAgICApICYgMHhGRikgLyAyNTUuMGY7CisKKyAgICBGb250UmVuZGVyZXImIGZvbnRSZW5kZXJlciA9IG1DYWNoZXMuZm9udFJlbmRlcmVyLmdldEZvbnRSZW5kZXJlcihwYWludCk7CisgICAgZm9udFJlbmRlcmVyLnNldEZvbnQocGFpbnQsIFNrVHlwZWZhY2U6OlVuaXF1ZUlEKHBhaW50LT5nZXRUeXBlZmFjZSgpKSwKKyAgICAgICAgICAgIHBhaW50LT5nZXRUZXh0U2l6ZSgpKTsKKyAgICBpZiAobUhhc1NoYWRvdykgeworICAgICAgICBnbEFjdGl2ZVRleHR1cmUoZ1RleHR1cmVVbml0c1swXSk7CisgICAgICAgIG1DYWNoZXMuZHJvcFNoYWRvd0NhY2hlLnNldEZvbnRSZW5kZXJlcihmb250UmVuZGVyZXIpOworICAgICAgICBjb25zdCBTaGFkb3dUZXh0dXJlKiBzaGFkb3cgPSBtQ2FjaGVzLmRyb3BTaGFkb3dDYWNoZS5nZXQocGFpbnQsIHRleHQsIGJ5dGVzQ291bnQsCisgICAgICAgICAgICAgICAgY291bnQsIG1TaGFkb3dSYWRpdXMpOworICAgICAgICBjb25zdCBBdXRvVGV4dHVyZSBhdXRvQ2xlYW51cChzaGFkb3cpOworCisgICAgICAgIHNldHVwU2hhZG93KHNoYWRvdywgeCwgeSwgbW9kZSwgYSk7CisKKyAgICAgICAgLy8gRHJhdyB0aG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saWduOgorICAgICAgICAgICAgICAgIG9mZnNldFggPSB1bmRlcmxpbmVXaWR0aDsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKworICAgICAgICBpZiAodW5kZXJsaW5lV2lkdGggPiAwLjBmKSB7CisgICAgICAgICAgICBmbG9hdCB0ZXh0U2l6ZSA9IHBhaW50LT5nZXRUZXh0U2l6ZSgpOworICAgICAgICAgICAgZmxvYXQgaGVpZ2h0ID0gdGV4dFNpemUgKiBrU3RkVW5kZXJsaW5lX1RoaWNrbmVzczsKKworICAgICAgICAgICAgZmxvYXQgbGVmdCA9IHggLSBvZmZzZXRYOworICAgICAgICAgICAgZmxvYXQgdG9wID0gMC4wZjsKKyAgICAgICAgICAgIGZsb2F0IHJpZ2h0ID0gbGVmdCArIHVuZGVybGluZVdpZHRoOworICAgICAgICAgICAgZmxvYXQgYm90dG9tID0gMC4wZjsKKworICAgICAgICAgICAgaWYgKGZsYWdzICYgU2tQYWludDo6a1VuZGVybGluZVRleHRfRmxhZykgeworICAgICAgICAgICAgICAgIHRvcCA9IHkgKyB0ZXh0U2l6ZSAqIGtTdGRVbmRlcmxpbmVfT2Zmc2V0OworICAgICAgICAgICAgICAgIGJvdHRvbSA9IHRvcCArIGhlaWdodDsKKyAgICAgICAgICAgICAgICBkcmF3UmVjdChsZWZ0LCB0b3AsIHJpZ2h0LCBib3R0b20sIHBhaW50KTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKGZsYWdzICYgU2tQYWludDo6a1N0cmlrZVRocnVUZXh0X0ZsYWcpIHsKKyAgICAgICAgICAgICAgICB0b3AgPSB5ICsgdGV4dFNpemUgKiBrU3RkU3RyaWtlVGhydV9PZmZzZXQ7CisgICAgICAgICAgICAgICAgYm90dG9tID0gdG9wICsgaGVpZ2h0OworICAgICAgICAgICAgICAgIGRyYXdSZWN0KGxlZnQsIHRv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pOworICAgIFRleHR1cmVWZXJ0ZXg6OnNldFVWKHYrKywgdTEsIHYyKTsKKyAgICBUZXh0dXJlVmVydGV4OjpzZXRVVih2KyssIHUyLCB2Mik7Cit9CisKK3ZvaWQgT3BlbkdMUmVuZGVyZXI6OmdldEFscGhhQW5kTW9kZShjb25zdCBTa1BhaW50KiBwYWludCwgaW50KiBhbHBoYSwgU2tYZmVybW9kZTo6TW9kZSogbW9kZSkgeworICAgIGlmIChwYWludCkgeworICAgICAgICBjb25zdCBib29sIGlzTW9kZSA9IFNrWGZlcm1vZGU6OklzTW9kZShwYWludC0+Z2V0WGZlcm1vZGUoKSwgbW9kZSk7CisgICAgICAgIGlmICghaXNNb2RlKSB7CisgICAgICAgICAgICAvLyBBc3N1bWUgU1JDX09WRVIKKyAgICAgICAgICAgICptb2RlID0gU2tYZmVybW9kZTo6a1NyY092ZXJfTW9kZTsKKyAgICAgICAgfQorCisgICAgICAgIC8vIFNraWEgZHJhd3MgdXNpbmcgdGhlIGNvbG9yJ3MgYWxwaGEgY2hhbm5lbCBpZiA8IDI1NQorICAgICAgICAvLyBPdGhlcndpc2UsIGl0IHVzZXMgdGhlIHBhaW50J3MgYWxwaGEKKyAgICAgICAgaW50IGNvbG9yID0gcGFpbnQtPmdldENvbG9yKCk7CisgICAgICAgICphbHBoYSA9IChjb2xvciA+PiAyNCkgJiAweEZGOworICAgICAgICBpZiAoKmFscGhhID09IDI1NSkgeworICAgICAgICAgICAgKmFscGhhID0gcGFpbnQtPmdldEFscGhhKCk7CisgICAgICAgIH0KKyAgICB9IGVsc2UgeworICAgICAgICAqbW9kZSA9IFNrWGZlcm1vZGU6OmtTcmNPdmVyX01vZGU7CisgICAgICAgICphbHBoYSA9IDI1NTsKKyAgICB9Cit9CisKK3ZvaWQgT3BlbkdMUmVuZGVyZXI6OmJpbmRUZXh0dXJlKEdMdWludCB0ZXh0dXJlLCBHTGVudW0gd3JhcFMsIEdMZW51bSB3cmFwVCwgR0x1aW50IHRleHR1cm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B0aGUgcmVuZGVyZXIgYXMgYSBuZXcgc25hcHNob3QuCisgICAgICogVGhlIG5ldyBzbmFwc2hvdCBpcyBzYXZlZCBpbiBtU25hcHNob3QgYW5kIHRoZSBwcmV2aW91cyBzbmFwc2hvdAorICAgICAqIGlzIGxpbmtlZCBmcm9tIG1TbmFwc2hvdC0+cHJldmlvdXMuCisgICAgICoKKyAgICAgKiBAcGFyYW0gZmxhZ3MgVGhlIHNhdmUgZmxhZ3M7IHNlZSBTa0NhbnZhcyBmb3IgbW9yZSBpbmZvcm1hdGlvbgorICAgICAqCisgICAgICogQHJldHVybiBUaGUgbmV3IHNhdmUgY291bnQuIFRoaXMgdmFsdWUgY2FuIGJlIHBhc3NlZCB0byAjcmVzdG9yZVRvQ291bnQoKQorICAgICAqLworICAgIGludCBzYXZlU25hcHNob3QoaW50IGZsYWdzKTsKKworICAgIC8qKgorICAgICAqIFJlc3RvcmVzIHRoZSBjdXJyZW50IHNuYXBzaG90OyBtU25hcHNob3QgYmVjb21lcyBtU25hcHNob3QtPnByZXZpb3VzLgorICAgICAqCisgICAgICogQHJldHVybiBUcnVlIGlmIHRoZSBjbGlwIHdhcyBtb2RpZmllZC4KKyAgICAgKi8KKyAgICBib29sIHJlc3RvcmVTbmFwc2hvdCgpOworCisgICAgLyoqCisgICAgICogU2V0cyB0aGUgY2xpcHBpbmcgcmVjdGFuZ2xlIHVzaW5nIGdsU2Npc3Nvci4gVGhlIGNsaXAgaXMgZGVmaW5lZCBieQorICAgICAqIHRoZSBjdXJyZW50IHNuYXBzaG90J3MgY2xpcFJlY3QgbWVtYmVyLgorICAgICAqLworICAgIHZvaWQgc2V0U2Npc3NvckZyb21DbGlwKCk7CisKKyAgICAvKioKKyAgICAgKiBDb21wb3NlIHRoZSBsYXllciBkZWZpbmVkIGluIHRoZSBjdXJyZW50IHNuYXBzaG90IHdpdGggdGhlIGxheWVyCisgICAgICogZGVmaW5lZCBieSB0aGUgcHJldmlvdXMgc25hcHNob3QuCisgICAg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8vLy8vLy8vLy8vLy8vLy8vLy8vLworLy8gQ29uc3RydWN0b3JzL2Rlc3RydWN0b3IKKy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8KKworUGF0Y2g6OlBhdGNoKGNvbnN0IHVpbnQzMl90IHhDb3VudCwgY29uc3QgdWludDMyX3QgeUNvdW50KToKKyAgICAgICAgeENvdW50KHhDb3VudCArIDIpLCB5Q291bnQoeUNvdW50ICsgMikgeworICAgIHZlcnRpY2VzQ291bnQgPSAoeENvdW50ICsgMikgKiAoeUNvdW50ICsgMik7CisgICAgdmVydGljZXMgPSBuZXcgVGV4dHVyZVZlcnRleFt2ZXJ0aWNlc0NvdW50XTsKKworICAgIC8vIDIgdHJpYW5nbGVzIHBlciBwYXRjaCwgMyB2ZXJ0aWNlcyBwZXIgdHJpYW5nbGUKKyAgICBpbmRpY2VzQ291bnQgPSAoeENvdW50ICsgMSkgKiAoeUNvdW50ICsgMSkgKiAyICogMzsKKyAgICBpbmRpY2VzID0gbmV3IHVpbnQxNl90W2luZGljZXNDb3VudF07CisKKyAgICBjb25zdCB1aW50MzJfdCB4TnVtID0geENvdW50ICsgMTsKKyAgICBjb25zdCB1aW50MzJfdCB5TnVtID0geUNvdW50ICsgMTsKKworICAgIHVpbnQxNl90KiBzdGFydEluZGljZXMgPSBpbmRpY2VzOworICAgIHVpbnQzMl90IG4gPSAwOworICAgIGZvciAodWludDMyX3QgeSA9IDA7IHkgPCB5TnVtOyB5KyspIHsKKyAgICAgICAgZm9yICh1aW50MzJfdCB4ID0gMDsgeCA8IHhOdW07IHgrKykgeworICAgICAgICAgICAgKnN0YXJ0SW5kaWNlcysrID0gbjsKKyAgICAgICAgICAgICpzdGFydEluZGljZXMrKyA9IG4gKyAxOworICAgICAgICAgICAgKnN0YXJ0SW5kaWNlcysrID0gbiArIHhOdW0gKyAyOworCis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IDA7CisgICAgZmxvYXQgeVN0cmV0Y2hUZXggPSAwOworCisgICAgY29uc3QgZmxvYXQgbWVzaFdpZHRoID0gcmlnaHQgLSBsZWZ0OworCisgICAgY29uc3QgZmxvYXQgYml0bWFwV2lkdGggPSBmbG9hdChiaXRtYXAtPndpZHRoKCkpOworICAgIGNvbnN0IGZsb2F0IGJpdG1hcEhlaWdodCA9IGZsb2F0KGJpdG1hcC0+aGVpZ2h0KCkpOworCisgICAgaWYgKHhTdHJldGNoQ291bnQgPiAwKSB7CisgICAgICAgIHVpbnQzMl90IHN0cmV0Y2hTaXplID0gMDsKKyAgICAgICAgZm9yICh1aW50MzJfdCBpID0gMTsgaSA8IHdpZHRoOyBpICs9IDIpIHsKKyAgICAgICAgICAgIHN0cmV0Y2hTaXplICs9IHhEaXZzW2ldIC0geERpdnNbaSAtIDFdOworICAgICAgICB9CisgICAgICAgIHhTdHJldGNoVGV4ID0gKHN0cmV0Y2hTaXplIC8gYml0bWFwV2lkdGgpIC8geFN0cmV0Y2hDb3VudDsKKyAgICAgICAgY29uc3QgZmxvYXQgZml4ZWQgPSBiaXRtYXBXaWR0aCAtIHN0cmV0Y2hTaXplOworICAgICAgICB4U3RyZXRjaCA9IChyaWdodCAtIGxlZnQgLSBmaXhlZCkgLyB4U3RyZXRjaENvdW50OworICAgIH0KKworICAgIGlmICh5U3RyZXRjaENvdW50ID4gMCkgeworICAgICAgICB1aW50MzJfdCBzdHJldGNoU2l6ZSA9IDA7CisgICAgICAgIGZvciAodWludDMyX3QgaSA9IDE7IGkgPCBoZWlnaHQ7IGkgKz0gMikgeworICAgICAgICAgICAgc3RyZXRjaFNpemUgKz0geURpdnNbaV0gLSB5RGl2c1tpIC0gMV07CisgICAgICAgIH0KKyAgICAgICAgeVN0cmV0Y2hUZXggPSAoc3RyZXRjaFNpemUgLyBiaXRtYXBIZWlnaHQpIC8geVN0cmV0Y2hDb3VudDsKKyAgICAgICAgY29uc3QgZmxvYXQgZml4ZWQgPSBiaXR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Ly8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLworLy8gRGVidWcgdG9vbHMKKy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8KKwordm9pZCBQYXRjaDo6ZHVtcCgpIHsKKyAgICBMT0dEKCJWZXJ0aWNlcyBbIik7CisgICAgZm9yICh1aW50MzJfdCB5ID0gMDsgeSA8IHlDb3VudDsgeSsrKSB7CisgICAgICAgIGNoYXIgYnVmZmVyWzUxMl07CisgICAgICAgIGJ1ZmZlclswXSA9ICdcMCc7CisgICAgICAgIHVpbnQzMl90IG9mZnNldCA9IDA7CisgICAgICAgIGZvciAodWludDMyX3QgeCA9IDA7IHggPCB4Q291bnQ7IHgrKykgeworICAgICAgICAgICAgVGV4dHVyZVZlcnRleCogdiA9ICZ2ZXJ0aWNlc1t5ICogeENvdW50ICsgeF07CisgICAgICAgICAgICBvZmZzZXQgKz0gc3ByaW50ZigmYnVmZmVyW29mZnNldF0sICIgKCUuNGYsJS40ZiktKCUuNGYsJS40ZikiLAorICAgICAgICAgICAgICAgICAgICB2LT5wb3NpdGlvblswXSwgdi0+cG9zaXRpb25bMV0sIHYtPnRleHR1cmVbMF0sIHYtPnRleHR1cmVbMV0pOworICAgICAgICB9CisgICAgICAgIExPR0QoIiAgWyVzIF0iLCBidWZmZXIpOworICAgIH0KKyAgICBMT0dEKCJdXG5JbmRpY2VzIFsgIik7CisgICAgY2hhciBidWZmZXJbNDA5Nl07CisgICAgYnVmZmVyWzBdID0gJ1wwJzsKKyAgICB1aW50MzJfdCBvZmZzZXQgPSAwOworICAgIGZvciAodWludDMyX3QgaSA9IDA7IGkgPCBpbmRpY2VzQ291bnQ7IGkrKykgeworICAgICAgICBvZmZzZXQgKz0gc3ByaW50ZigmYnVmZmVyW29mZnNldF0sICIlZCAiLCBpbmRpY2Vz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OjprRGVmYXVsdF9Kb2luOworICAgICAgICBjYXAgPSBTa1BhaW50OjprRGVmYXVsdF9DYXA7CisgICAgICAgIHN0eWxlID0gU2tQYWludDo6a0ZpbGxfU3R5bGU7CisgICAgICAgIG1pdGVyID0gNC4wZjsKKyAgICAgICAgc3Ryb2tlV2lkdGggPSAxLjBmOworICAgIH0KKworICAgIFBhdGhDYWNoZUVudHJ5KGNvbnN0IFBhdGhDYWNoZUVudHJ5JiBlbnRyeSk6CisgICAgICAgIHBhdGgoZW50cnkucGF0aCksIGpvaW4oZW50cnkuam9pbiksIGNhcChlbnRyeS5jYXApLAorICAgICAgICBzdHlsZShlbnRyeS5zdHlsZSksIG1pdGVyKGVudHJ5Lm1pdGVyKSwKKyAgICAgICAgc3Ryb2tlV2lkdGgoZW50cnkuc3Ryb2tlV2lkdGgpIHsKKyAgICB9CisKKyAgICBQYXRoQ2FjaGVFbnRyeShTa1BhdGgqIHBhdGgsIFNrUGFpbnQqIHBhaW50KSB7CisgICAgICAgIHRoaXMtPnBhdGggPSBwYXRoOworICAgICAgICBqb2luID0gcGFpbnQtPmdldFN0cm9rZUpvaW4oKTsKKyAgICAgICAgY2FwID0gcGFpbnQtPmdldFN0cm9rZUNhcCgpOworICAgICAgICBtaXRlciA9IHBhaW50LT5nZXRTdHJva2VNaXRlcigpOworICAgICAgICBzdHJva2VXaWR0aCA9IHBhaW50LT5nZXRTdHJva2VXaWR0aCgpOworICAgICAgICBzdHlsZSA9IHBhaW50LT5nZXRTdHlsZSgpOworICAgIH0KKworICAgIFNrUGF0aCogcGF0aDsKKyAgICBTa1BhaW50OjpKb2luIGpvaW47CisgICAgU2tQYWludDo6Q2FwIGNhcDsKKyAgICBTa1BhaW50OjpTdHlsZSBzdHlsZTsKKyAgICBmbG9hdCBtaXRlcjsKKyAgICBmbG9hdCBzdHJva2VXaWR0aDsKKworICAgIGJvb2wgb3BlcmF0b3I8KGNvbnN0IFBhdGhDYWNoZUVudHJ5JiByaHMpIGNvbnN0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YW1lKSB7CisgICAgc3NpemVfdCBpbmRleCA9IGF0dHJpYnV0ZXMuaW5kZXhPZktleShuYW1lKTsKKyAgICBpZiAoaW5kZXggPj0gMCkgeworICAgICAgICByZXR1cm4gYXR0cmlidXRlcy52YWx1ZUF0KGluZGV4KTsKKyAgICB9CisgICAgcmV0dXJuIGFkZEF0dHJpYihuYW1lKTsKK30KKworaW50IFByb2dyYW06OmFkZFVuaWZvcm0oY29uc3QgY2hhciogbmFtZSkgeworICAgIGludCBzbG90ID0gZ2xHZXRVbmlmb3JtTG9jYXRpb24oaWQsIG5hbWUpOworICAgIHVuaWZvcm1zLmFkZChuYW1lLCBzbG90KTsKKyAgICByZXR1cm4gc2xvdDsKK30KKworaW50IFByb2dyYW06OmdldFVuaWZvcm0oY29uc3QgY2hhciogbmFtZSkgeworICAgIHNzaXplX3QgaW5kZXggPSB1bmlmb3Jtcy5pbmRleE9mS2V5KG5hbWUpOworICAgIGlmIChpbmRleCA+PSAwKSB7CisgICAgICAgIHJldHVybiB1bmlmb3Jtcy52YWx1ZUF0KGluZGV4KTsKKyAgICB9CisgICAgcmV0dXJuIGFkZFVuaWZvcm0obmFtZSk7Cit9CisKK0dMdWludCBQcm9ncmFtOjpidWlsZFNoYWRlcihjb25zdCBjaGFyKiBzb3VyY2UsIEdMZW51bSB0eXBlKSB7CisgICAgR0x1aW50IHNoYWRlciA9IGdsQ3JlYXRlU2hhZGVyKHR5cGUpOworICAgIGdsU2hhZGVyU291cmNlKHNoYWRlciwgMSwgJnNvdXJjZSwgMCk7CisgICAgZ2xDb21waWxlU2hhZGVyKHNoYWRlcik7CisKKyAgICBHTGludCBzdGF0dXM7CisgICAgZ2xHZXRTaGFkZXJpdihzaGFkZXIsIEdMX0NPTVBJTEVfU1RBVFVTLCAmc3RhdHVzKTsKKyAgICBpZiAoc3RhdHVzICE9IEdMX1RSVUUpIHsKKyAgICAgICAgLy8gU29tZSBkcml2ZXJzIHJldHVybiB3cm9uZyB2YWx1ZXMgZm9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ZiB0aGUgc3BlY2lmaWVkIGF0dHJpYnV0ZS4KKyAgICAgKi8KKyAgICBpbnQgZ2V0QXR0cmliKGNvbnN0IGNoYXIqIG5hbWUpOworCisgICAgLyoqCisgICAgICogUmV0dXJucyB0aGUgT3BlbkdMIG5hbWUgb2YgdGhlIHNwZWNpZmllZCB1bmlmb3JtLgorICAgICAqLworICAgIGludCBnZXRVbmlmb3JtKGNvbnN0IGNoYXIqIG5hbWUpOworCisgICAgLyoqCisgICAgICogSW5kaWNhdGVzIHdoZXRoZXIgdGhpcyBwcm9ncmFtIGlzIGN1cnJlbnRseSBpbiB1c2Ugd2l0aAorICAgICAqIHRoZSBHTCBjb250ZXh0LgorICAgICAqLworICAgIGlubGluZSBib29sIGlzSW5Vc2UoKSBjb25zdCB7CisgICAgICAgIHJldHVybiBtVXNlOworICAgIH0KKworICAgIC8qKgorICAgICAqIEJpbmRzIHRoZSBwcm9ncmFtIHdpdGggdGhlIHNwZWNpZmllZCBwcm9qZWN0aW9uLCBtb2RlbFZpZXcgYW5kCisgICAgICogdHJhbnNmb3JtIG1hdHJpY2VzLgorICAgICAqLworICAgIHZvaWQgc2V0KGNvbnN0IG1hdDQmIHByb2plY3Rpb25NYXRyaXgsIGNvbnN0IG1hdDQmIG1vZGVsVmlld01hdHJpeCwKKyAgICAgICAgICAgICBjb25zdCBtYXQ0JiB0cmFuc2Zvcm1NYXRyaXgpOworCisgICAgLyoqCisgICAgICogTmFtZSBvZiB0aGUgcG9zaXRpb24gYXR0cmlidXRlLgorICAgICAqLworICAgIGludCBwb3NpdGlvbjsKKworICAgIC8qKgorICAgICAqIE5hbWUgb2YgdGhlIGNvbG9yIHVuaWZvcm0uCisgICAgICovCisgICAgaW50IGNvbG9yOworCisgICAgLyoqCisgICAgICogTmFtZSBvZiB0aGUgdHJhbnNmb3JtIHVuaWZvcm0uCisgICAgICovCisgICAgaW50IHRyYW5zZm9ybTsKKworcHJvdGVjdGVkOgorICAgIC8qKgorICAgICAqIEFkZHM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gICAgICAidW5pZm9ybSBzYW1wbGVyMkQgYml0bWFwU2FtcGxlcjtcbiI7Citjb25zdCBjaGFyKiBnRlNfVW5pZm9ybXNfQ29sb3JPcFs0XSA9IHsKKyAgICAgICAgLy8gTm9uZQorICAgICAgICAiIiwKKyAgICAgICAgLy8gTWF0cml4CisgICAgICAgICJ1bmlmb3JtIG1hdDQgY29sb3JNYXRyaXg7XG4iCisgICAgICAgICJ1bmlmb3JtIHZlYzQgY29sb3JNYXRyaXhWZWN0b3I7XG4iLAorICAgICAgICAvLyBMaWdodGluZworICAgICAgICAidW5pZm9ybSB2ZWM0IGxpZ2h0aW5nTXVsO1xuIgorICAgICAgICAidW5pZm9ybSB2ZWM0IGxpZ2h0aW5nQWRkO1xuIiwKKyAgICAgICAgLy8gUG9ydGVyRHVmZgorICAgICAgICAidW5pZm9ybSB2ZWM0IGNvbG9yQmxlbmQ7XG4iCit9OworY29uc3QgY2hhciogZ0ZTX01haW4gPQorICAgICAgICAiXG52b2lkIG1haW4odm9pZCkge1xuIgorICAgICAgICAiICAgIGxvd3AgdmVjNCBmcmFnQ29sb3I7XG4iOworY29uc3QgY2hhciogZ0ZTX01haW5fRmV0Y2hDb2xvciA9CisgICAgICAgICIgICAgZnJhZ0NvbG9yID0gY29sb3I7XG4iOworY29uc3QgY2hhciogZ0ZTX01haW5fRmV0Y2hUZXh0dXJlID0KKyAgICAgICAgIiAgICBmcmFnQ29sb3IgPSBjb2xvciAqIHRleHR1cmUyRChzYW1wbGVyLCBvdXRUZXhDb29yZHMpO1xuIjsKK2NvbnN0IGNoYXIqIGdGU19NYWluX0ZldGNoQThUZXh0dXJlID0KKyAgICAgICAgIiAgICBmcmFnQ29sb3IgPSBjb2xvciAqIHRleHR1cmUyRChzYW1wbGVyLCBvdXRUZXhDb29yZHMpLmE7XG4iOworY29uc3QgY2hhciogZ0ZTX01haW5fRmV0Y2hHcmFkaWVudCA9CisgICAgICAgICIgICAgdmVjNCBncmFkaWVudENvbG9yID0gdGV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y8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8KKworY29uc3QgY2hhciogZ0JsZW5kT3BzWzE4XSA9IHsKKyAgICAgICAgLy8gQ2xlYXIKKyAgICAgICAgInJldHVybiB2ZWM0KDAuMCwgMC4wLCAwLjAsIDAuMCk7XG4iLAorICAgICAgICAvLyBTcmMKKyAgICAgICAgInJldHVybiBzcmM7XG4iLAorICAgICAgICAvLyBEc3QKKyAgICAgICAgInJldHVybiBkc3Q7XG4iLAorICAgICAgICAvLyBTcmNPdmVyCisgICAgICAgICJyZXR1cm4gc3JjICsgZHN0ICogKDEuMCAtIHNyYy5hKTtcbiIsCisgICAgICAgIC8vIERzdE92ZXIKKyAgICAgICAgInJldHVybiBkc3QgKyBzcmMgKiAoMS4wIC0gZHN0LmEpO1xuIiwKKyAgICAgICAgLy8gU3JjSW4KKyAgICAgICAgInJldHVybiBzcmMgKiBkc3QuYTtcbiIsCisgICAgICAgIC8vIERzdEluCisgICAgICAgICJyZXR1cm4gZHN0ICogc3JjLmE7XG4iLAorICAgICAgICAvLyBTcmNPdXQKKyAgICAgICAgInJldHVybiBzcmMgKiAoMS4wIC0gZHN0LmEpO1xuIiwKKyAgICAgICAgLy8gRHN0T3V0CisgICAgICAgICJyZXR1cm4gZHN0ICogKDEuMCAtIHNyYy5hKTtcbiIsCisgICAgICAgIC8vIFNyY0F0b3AKKyAgICAgICAgInJldHVybiB2ZWM0KHNyYy5yZ2IgKiBkc3QuYSArICgxLjAgLSBzcmMuYSkgKiBkc3QucmdiLCBkc3QuYSk7XG4iLAorICAgICAgICAvLyBEc3RBdG9wCisgICAgICAgICJyZXR1cm4gdmVjNChkc3QucmdiICogc3JjLmEgKyAoMS4wIC0gZHN0LmEpICogc3JjLnJnYiwgc3JjLmEpO1xuIiwKKyAgICAgICAgLy8gWG9yCisgICAgICAgICJyZXR1cm4gdmVjNChzcmMucmdiICogKDEuMCAtIGRzdC5hKSArICgxLjAgLSBzcmMuYSkgKiBkc3QucmdiLCAiCisgICAgICAgICAgICAgICAgInNyYy5hICsgZHN0LmEgLSAyLjAgKiBzcmMuYSAqIGRzdC5hKTtcbiIsCisgICAgICAgIC8vIEFkZAorICAgICAgICAicmV0dXJuIG1pbihzcmMgKyBkc3QsIDEuMCk7XG4iLAorICAgICAgICAvLyBNdWx0aXBseQorICAgICAgICAicmV0dXJuIHNyYyAqIGRzdDtcbiIsCisgICAgICAgIC8vIFNjcmVlbgorICAgICAgICAicmV0dXJuIHNyYyArIGRzdCAtIHNyYyAqIGRzdDtcbiIsCisgICAgICAgIC8vIE92ZXJsYXkKKyAgICAgICAgInJldHVybiBjbGFtcCh2ZWM0KG1peCgiCisgICAgICAgICAgICAgICAgIjIuMCAqIHNyYy5yZ2IgKiBkc3QucmdiICsgc3JjLnJnYiAqICgxLjAgLSBkc3QuYSkgKyBkc3QucmdiICogKDEuMCAtIHNyYy5hKSwgIgorICAgICAgICAgICAgICAgICJzcmMuYSAqIGRzdC5hIC0gMi4wICogKGRzdC5hIC0gZHN0LnJnYikgKiAoc3JjLmEgLSBzcmMucmdiKSArIHNyYy5yZ2IgKiAoMS4wIC0gZHN0LmEpICsgZHN0LnJnYiAqICgxLjAgLSBzcmMuYSksICIKKyAgICAgICAgICAgICAgICAic3RlcChkc3QuYSwgMi4wICogZHN0LnJnYikpLCAiCisgICAgICAgICAgICAgICAgInNyYy5hICsgZHN0LmEgLSBzcmMuYSAqIGRzdC5hKSwgMC4wLCAxLjApO1xuIiwKKyAgICAgICAgLy8gRGFya2VuCisgICAgICAgICJyZXR1cm4gdmVjNChzcmMucmdiICogKDEuMCAtIGRzdC5hKSArICgxLjAgLSBzcmMuYSkgKiBkc3QucmdiICsgIgorICAgICAgICAgICAgICAgICJtaW4oc3JjLnJnYiAqIGRzdC5hLCBkc3QucmdiICogc3JjLmEpLCBzcmMuYSArIGRzdC5hIC0gc3JjLmEgKiBkc3QuYSk7XG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AgfSBlbHNlIHsKKyAgICAgICAgICAgIHNoYWRlci5hcHBlbmQoZ0ZTX01haW5fRmV0Y2hDb2xvcik7CisgICAgICAgIH0KKyAgICAgICAgaWYgKGRlc2NyaXB0aW9uLmhhc0dyYWRpZW50KSB7CisgICAgICAgICAgICBzaGFkZXIuYXBwZW5kKGdGU19NYWluX0ZldGNoR3JhZGllbnQpOworICAgICAgICB9CisgICAgICAgIGlmIChkZXNjcmlwdGlvbi5oYXNCaXRtYXApIHsKKyAgICAgICAgICAgIGlmICghZGVzY3JpcHRpb24uaXNCaXRtYXBOcG90KSB7CisgICAgICAgICAgICAgICAgc2hhZGVyLmFwcGVuZChnRlNfTWFpbl9GZXRjaEJpdG1hcCk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHNoYWRlci5hcHBlbmQoZ0ZTX01haW5fRmV0Y2hCaXRtYXBOcG90KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICAvLyBDYXNlIHdoZW4gd2UgaGF2ZSB0d28gc2hhZGVycyBzZXQKKyAgICAgICAgaWYgKGRlc2NyaXB0aW9uLmhhc0dyYWRpZW50ICYmIGRlc2NyaXB0aW9uLmhhc0JpdG1hcCkgeworICAgICAgICAgICAgaWYgKGRlc2NyaXB0aW9uLmlzQml0bWFwRmlyc3QpIHsKKyAgICAgICAgICAgICAgICBzaGFkZXIuYXBwZW5kKGdGU19NYWluX0JsZW5kU2hhZGVyc0JHKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgc2hhZGVyLmFwcGVuZChnRlNfTWFpbl9CbGVuZFNoYWRlcnNHQik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBzaGFkZXIuYXBwZW5kKGdGU19NYWluX0JsZW5kU2hhZGVyc19Nb2R1bGF0ZSk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBpZiAoZGVzY3JpcHRpb24uaGFzR3JhZGllbnQpIHsKKyAgICAgIC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CisgICAgICAgIGNhc2UgR0xfTUlSUk9SRURfUkVQRUFUOgorICAgICAgICAgICAgc2hhZGVyLmFwcGVuZCgieE1vZDIiKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgIH0KKyAgICBzaGFkZXIuYXBwZW5kKCIsICIpOworICAgIHN3aXRjaCAod3JhcFQpIHsKKyAgICAgICAgY2FzZSBHTF9DTEFNUF9UT19FREdFOgorICAgICAgICAgICAgc2hhZGVyLmFwcGVuZCgidGV4Q29vcmRzLnkiKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIEdMX1JFUEVBVDoKKyAgICAgICAgICAgIHNoYWRlci5hcHBlbmQoIm1vZCh0ZXhDb29yZHMueSwgMS4wKSIpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgR0xfTUlSUk9SRURfUkVQRUFUOgorICAgICAgICAgICAgc2hhZGVyLmFwcGVuZCgieU1vZDIiKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgIH0KKyAgICBzaGFkZXIuYXBwZW5kKCIpO1xuIik7CisgICAgc2hhZGVyLmFwcGVuZCgifVxuIik7Cit9CisKK3ZvaWQgUHJvZ3JhbUNhY2hlOjpwcmludExvbmdTdHJpbmcoY29uc3QgU3RyaW5nOCYgc2hhZGVyKSBjb25zdCB7CisgICAgc3NpemVfdCBpbmRleCA9IDA7CisgICAgc3NpemVfdCBsYXN0SW5kZXggPSAwOworICAgIGNvbnN0IGNoYXIqIHN0ciA9IHNoYWRlci5zdHJpbmcoKTsKKyAgICB3aGlsZSAoKGluZGV4ID0gc2hhZGVyLmZpbmQoIlxuIiwgaW5kZXgpKSA+IC0xKSB7CisgICAgICAgIFN0cmluZzggbGluZShzdHIsIGluZGV4IC0gbGFzdEluZGV4KTsKKyAgICAgICAgaWYgKGxpbmUubGVuZ3RoKCkgPT0gMCkgbGluZS5hcHBlbmQoIlxuIik7CisgICAgICAgIFBST0dSQU1fTE9HRCgiJXMiLCBsaW5lLnN0cmluZ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ZSksCisgICAgICAgIGJpdG1hcFdyYXBTKEdMX0NMQU1QX1RPX0VER0UpLCBiaXRtYXBXcmFwVChHTF9DTEFNUF9UT19FREdFKSwKKyAgICAgICAgY29sb3JPcChrQ29sb3JOb25lKSwgY29sb3JNb2RlKFNrWGZlcm1vZGU6OmtDbGVhcl9Nb2RlKSB7CisgICAgfQorCisgICAgLy8gVGV4dHVyaW5nCisgICAgYm9vbCBoYXNUZXh0dXJlOworICAgIGJvb2wgaGFzQWxwaGE4VGV4dHVyZTsKKworICAgIC8vIFNoYWRlcnMKKyAgICBib29sIGhhc0JpdG1hcDsKKyAgICBib29sIGlzQml0bWFwTnBvdDsKKyAgICBib29sIGhhc0dyYWRpZW50OworICAgIFNrWGZlcm1vZGU6Ok1vZGUgc2hhZGVyc01vZGU7CisgICAgYm9vbCBpc0JpdG1hcEZpcnN0OworICAgIEdMZW51bSBiaXRtYXBXcmFwUzsKKyAgICBHTGVudW0gYml0bWFwV3JhcFQ7CisKKyAgICAvLyBDb2xvciBvcGVyYXRpb25zCisgICAgaW50IGNvbG9yT3A7CisgICAgU2tYZmVybW9kZTo6TW9kZSBjb2xvck1vZGU7CisKKyAgICBpbmxpbmUgdWludDMyX3QgZ2V0RW51bUZvcldyYXAoR0xlbnVtIHdyYXApIGNvbnN0IHsKKyAgICAgICAgc3dpdGNoICh3cmFwKSB7CisgICAgICAgICAgICBjYXNlIEdMX0NMQU1QX1RPX0VER0U6CisgICAgICAgICAgICAgICAgcmV0dXJuIDA7CisgICAgICAgICAgICBjYXNlIEdMX1JFUEVBVDoKKyAgICAgICAgICAgICAgICByZXR1cm4gMTsKKyAgICAgICAgICAgIGNhc2UgR0xfTUlSUk9SRURfUkVQRUFUOgorICAgICAgICAgICAgICAgIHJldHVybiAyOworICAgICAgICB9CisgICAgICAgIHJldHVybiAwOworICAgIH0KKworICAgIHByb2dyYW1pZCBrZXkoKSBjb25zdCB7CisgICAgICAgIHByb2dyYW1pZCBrZXkgPSAwOworICAgICAgICBpZiAoaGFzVGV4dHVyZSkga2V5IHw9IFBST0dSQU1fS0VZX1RFWFRVUkU7CisgICAgICAgIGlmIChoYXNBbHBoYThUZXh0dXJlKSBrZXkgfD0gUFJPR1JBTV9LRVlfQThfVEVYVFVSRTsKKyAgICAgICAgaWYgKGhhc0JpdG1hcCkgeworICAgICAgICAgICAga2V5IHw9IFBST0dSQU1fS0VZX0JJVE1BUDsKKyAgICAgICAgICAgIGlmIChpc0JpdG1hcE5wb3QpIHsKKyAgICAgICAgICAgICAgICBrZXkgfD0gUFJPR1JBTV9LRVlfQklUTUFQX05QT1Q7CisgICAgICAgICAgICAgICAga2V5IHw9IGdldEVudW1Gb3JXcmFwKGJpdG1hcFdyYXBTKSA8PCBQUk9HUkFNX0JJVE1BUF9XUkFQU19TSElGVDsKKyAgICAgICAgICAgICAgICBrZXkgfD0gZ2V0RW51bUZvcldyYXAoYml0bWFwV3JhcFQpIDw8IFBST0dSQU1fQklUTUFQX1dSQVBUX1NISUZUOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGlmIChoYXNHcmFkaWVudCkga2V5IHw9IFBST0dSQU1fS0VZX0dSQURJRU5UOworICAgICAgICBpZiAoaXNCaXRtYXBGaXJzdCkga2V5ICB8PSBQUk9HUkFNX0tFWV9CSVRNQVBfRklSU1Q7CisgICAgICAgIGlmIChoYXNCaXRtYXAgJiYgaGFzR3JhZGllbnQpIHsKKyAgICAgICAgICAgIGtleSB8PSAoc2hhZGVyc01vZGUgJiBQUk9HUkFNX01BWF9YRkVSTU9ERSkgPDwgUFJPR1JBTV9YRkVSTU9ERV9TSEFERVJfU0hJRlQ7CisgICAgICAgIH0KKyAgICAgICAgc3dpdGNoIChjb2xvck9wKSB7CisgICAgICAgICAgICBjYXNlIGtDb2xvck1hdHJpeDoKKyAgICAgICAgICAgICAgICBrZXkgfD0gUFJPR1JBTV9LRVlfQ09MT1JfTUFUUklYOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBrQ29sb3JMaWdodGluZzoKKyAgICAgICAgICAgICAgICBrZXkgfD0gUFJPR1JBTV9LRVlfQ09MT1JfTElHSFRJTkc7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIGtDb2xvckJsZW5kOgorICAgICAgICAgICAgICAgIGtleSB8PSBQUk9HUkFNX0tFWV9DT0xPUl9CTEVORDsKKyAgICAgICAgICAgICAgICBrZXkgfD0gKGNvbG9yTW9kZSAmIFBST0dSQU1fTUFYX1hGRVJNT0RFKSA8PCBQUk9HUkFNX1hGRVJNT0RFX0NPTE9SX09QX1NISUZUOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBrQ29sb3JOb25lOgorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgICAgIHJldHVybiBrZXk7CisgICAgfQorfTsgLy8gc3RydWN0IFByb2dyYW1EZXNjcmlwdGlvbgorCisvKioKKyAqIEdlbmVyYXRlcyBhbmQgY2FjaGVzIHByb2dyYW0uIFByb2dyYW1zIGFyZSBnZW5lcmF0ZWQgYmFzZWQgb24KKyAqIFByb2dyYW1EZXNjcmlwdGlvbnMuCisgKi8KK2NsYXNzIFByb2dyYW1DYWNoZSB7CitwdWJsaWM6CisgICAgUHJvZ3JhbUNhY2hlKCk7CisgICAgflByb2dyYW1DYWNoZSgpOworCisgICAgUHJvZ3JhbSogZ2V0KGNvbnN0IFByb2dyYW1EZXNjcmlwdGlvbiYgZGVzY3JpcHRpb24pOworCisgICAgdm9pZCBjbGVhcigpOworCitwcml2YXRlOgorICAgIFByb2dyYW0qIGdlbmVyYXRlUHJvZ3JhbShjb25zdCBQcm9ncmFtRGVzY3JpcHRpb24mIGRlc2NyaXB0aW9uLCBwcm9ncmFtaWQga2V5KTsKKyAgICBTdHJpbmc4IGdlbmVyYXRlVmVydGV4U2hhZGVyKGNvbnN0IFByb2dyYW1EZXNjcmlwdGlvbiYgZGVzY3JpcHRpb24pOwor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B9CisKKyAgICBSZWN0KGZsb2F0IGxlZnQsIGZsb2F0IHRvcCwgZmxvYXQgcmlnaHQsIGZsb2F0IGJvdHRvbSk6CisgICAgICAgICAgICBsZWZ0KGxlZnQpLAorICAgICAgICAgICAgdG9wKHRvcCksCisgICAgICAgICAgICByaWdodChyaWdodCksCisgICAgICAgICAgICBib3R0b20oYm90dG9tKSB7CisgICAgfQorCisgICAgUmVjdChjb25zdCBSZWN0JiByKSB7CisgICAgICAgIHNldChyKTsKKyAgICB9CisKKyAgICBSZWN0KFJlY3QmIHIpIHsKKyAgICAgICAgc2V0KHIpOworICAgIH0KKworICAgIFJlY3QmIG9wZXJhdG9yPShjb25zdCBSZWN0JiByKSB7CisgICAgICAgIHNldChyKTsKKyAgICAgICAgcmV0dXJuICp0aGlzOworICAgIH0KKworICAgIFJlY3QmIG9wZXJhdG9yPShSZWN0JiByKSB7CisgICAgICAgIHNldChyKTsKKyAgICAgICAgcmV0dXJuICp0aGlzOworICAgIH0KKworICAgIGZyaWVuZCBpbnQgb3BlcmF0b3I9PShjb25zdCBSZWN0JiBhLCBjb25zdCBSZWN0JiBiKSB7CisgICAgICAgIHJldHVybiAhbWVtY21wKCZhLCAmYiwgc2l6ZW9mKGEpKTsKKyAgICB9CisKKyAgICBmcmllbmQgaW50IG9wZXJhdG9yIT0oY29uc3QgUmVjdCYgYSwgY29uc3QgUmVjdCYgYikgeworICAgICAgICByZXR1cm4gbWVtY21wKCZhLCAmYiwgc2l6ZW9mKGEpKTsKKyAgICB9CisKKyAgICBib29sIGlzRW1wdHkoKSBjb25zdCB7CisgICAgICAgIHJldHVybiBsZWZ0ID49IHJpZ2h0IHx8IHRvcCA+PSBib3R0b207CisgICAgfQorCisgICAgdm9pZCBzZXRFbXB0eSgpIHsKKyAgICAgICAgbWVtc2V0KHRoaXMsIDAsIHNpemVvZigqdGhpcykpOworICAgIH0KKworICAgIHZvaWQgc2V0KGZsb2F0IGxlZnQsIGZsb2F0IHRvcCwgZmxvYXQgcmlnaHQsIGZsb2F0IGJvdHRvbSkgeworICAgICAgICB0aGlzLT5sZWZ0ID0gbGVmdDsKKyAgICAgICAgdGhpcy0+cmlnaHQgPSByaWdodDsKKyAgICAgICAgdGhpcy0+dG9wID0gdG9wOworICAgICAgICB0aGlzLT5ib3R0b20gPSBib3R0b207CisgICAgfQorCisgICAgdm9pZCBzZXQoY29uc3QgUmVjdCYgcikgeworICAgICAgICBzZXQoci5sZWZ0LCByLnRvcCwgci5yaWdodCwgci5ib3R0b20pOworICAgIH0KKworICAgIGlubGluZSBmbG9hdCBnZXRXaWR0aCgpIGNvbnN0IHsKKyAgICAgICAgcmV0dXJuIHJpZ2h0IC0gbGVmdDsKKyAgICB9CisKKyAgICBpbmxpbmUgZmxvYXQgZ2V0SGVpZ2h0KCkgY29uc3QgeworICAgICAgICByZXR1cm4gYm90dG9tIC0gdG9wOworICAgIH0KKworICAgIGJvb2wgaW50ZXJzZWN0cyhmbG9hdCBsZWZ0LCBmbG9hdCB0b3AsIGZsb2F0IHJpZ2h0LCBmbG9hdCBib3R0b20pIGNvbnN0IHsKKyAgICAgICAgcmV0dXJuIGxlZnQgPCByaWdodCAmJiB0b3AgPCBib3R0b20gJiYKKyAgICAgICAgICAgICAgICB0aGlzLT5sZWZ0IDwgdGhpcy0+cmlnaHQgJiYgdGhpcy0+dG9wIDwgdGhpcy0+Ym90dG9tICYmCisgICAgICAgICAgICAgICAgdGhpcy0+bGVmdCA8IHJpZ2h0ICYmIGxlZnQgPCB0aGlzLT5yaWdodCAmJgorICAgICAgICAgICAgICAgIHRoaXMtPnRvcCA8IGJvdHRvbSAmJiB0b3AgPCB0aGlzLT5ib3R0b207CisgICAgfQorCisgICAgYm9vbCBpbnRlcnNlY3RzKGNvbnN0IFJlY3QmIHIpIGNvbnN0IHsKKyAgICAgICAgcmV0dXJuIGludGVyc2VjdHMoci5sZWZ0LCByLnRvcCwgci5yaWdodCwgci5ib3R0b20pOworICAgIH0KKworICAgIGJvb2wgaW50ZX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7CisgICAgICAgICAgICAgICAgaWYgKHRvcCA+IHIudG9wKSB0b3AgPSByLnRvcDsKKyAgICAgICAgICAgICAgICBpZiAocmlnaHQgPCByLnJpZ2h0KSByaWdodCA9IHIucmlnaHQ7CisgICAgICAgICAgICAgICAgaWYgKGJvdHRvbSA8IHIuYm90dG9tKSBib3R0b20gPSByLmJvdHRvbTsKKyAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgbGVmdCA9IHIubGVmdDsKKyAgICAgICAgICAgICAgICB0b3AgPSByLnRvcDsKKyAgICAgICAgICAgICAgICByaWdodCA9IHIucmlnaHQ7CisgICAgICAgICAgICAgICAgYm90dG9tID0gci5ib3R0b207CisgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIHZvaWQgZHVtcCgpIGNvbnN0IHsKKyAgICAgICAgTE9HRCgiUmVjdFtsPSVmIHQ9JWYgcj0lZiBiPSVmXSIsIGxlZnQsIHRvcCwgcmlnaHQsIGJvdHRvbSk7CisgICAgfQorCit9OyAvLyBzdHJ1Y3QgUmVjdAorCit9OyAvLyBuYW1lc3BhY2UgdWlyZW5kZXJlcgorfTsgLy8gbmFtZXNwYWNlIGFuZHJvaWQKKworI2VuZGlmIC8vIEFORFJPSURfUkVDVF9ICmRpZmYgLS1naXQgYS9saWJzL2h3dWkvU2tpYUNvbG9yRmlsdGVyLmNwcCBiL2xpYnMvaHd1aS9Ta2lhQ29sb3JGaWx0ZXIuY3BwCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLmZlNTdhZTcKLS0tIC9kZXYvbnVsbAorKysgYi9saWJzL2h3dWkvU2tpYUNvbG9yRmlsdGVyLmNwcApAQCAtMCwwICsxLDEwMiBAQAorLyoKKyAqIENvcHlyaWdodCAo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ICAgICAgICBjbGlwUmVjdCA9ICZtQ2xpcFJlY3RSb290OworICAgIH0KKworICAgIC8qKgorICAgICAqIENvcGllcyB0aGUgc3BlY2lmaWVkIHNuYXBzaG90LyBUaGUgc3BlY2lmaWVkIHNuYXBzaG90IGlzIHN0b3JlZCBhcworICAgICAqIHRoZSBwcmV2aW91cyBzbmFwc2hvdC4KKyAgICAgKi8KKyAgICBTbmFwc2hvdChjb25zdCBzcDxTbmFwc2hvdD4mIHMsIGludCBzYXZlRmxhZ3MpOgorICAgICAgICAgICAgaGVpZ2h0KHMtPmhlaWdodCksCisgICAgICAgICAgICBpbnZpc2libGUocy0+aW52aXNpYmxlKSwKKyAgICAgICAgICAgIGZsYWdzKDApLAorICAgICAgICAgICAgcHJldmlvdXMocyksCisgICAgICAgICAgICBsYXllcihOVUxMKSwKKyAgICAgICAgICAgIGZibyhzLT5mYm8pLAorICAgICAgICAgICAgdmlld3BvcnQocy0+dmlld3BvcnQpIHsKKyAgICAgICAgaWYgKHNhdmVGbGFncyAmIFNrQ2FudmFzOjprTWF0cml4X1NhdmVGbGFnKSB7CisgICAgICAgICAgICBtVHJhbnNmb3JtUm9vdC5sb2FkKCpzLT50cmFuc2Zvcm0pOworICAgICAgICAgICAgdHJhbnNmb3JtID0gJm1UcmFuc2Zvcm1Sb290OworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgdHJhbnNmb3JtID0gcy0+dHJhbnNmb3JtOworICAgICAgICB9CisKKyAgICAgICAgaWYgKHNhdmVGbGFncyAmIFNrQ2FudmFzOjprQ2xpcF9TYXZlRmxhZykgeworICAgICAgICAgICAgbUNsaXBSZWN0Um9vdC5zZXQoKnMtPmNsaXBSZWN0KTsKKyAgICAgICAgICAgIGNsaXBSZWN0ID0gJm1DbGlwUmVjdFJvb3Q7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBjbGlwUmVjdCA9IHMtPmNsaXBSZWN0OworICAgICAgICB9CisKKyAgICAgICAgaWYgKChzLT5mbGFncyAmIFNuYXBzaG90OjprRmxhZ0NsaXBTZXQpICYmCisgICAgICAgICAgICAgICAgIShzLT5mbGFncyAmIFNuYXBzaG90OjprRmxhZ0RpcnR5TG9jYWxDbGlwKSkgeworICAgICAgICAgICAgbUxvY2FsQ2xpcC5zZXQocy0+bUxvY2FsQ2xpcCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBmbGFncyB8PSBTbmFwc2hvdDo6a0ZsYWdEaXJ0eUxvY2FsQ2xpcDsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIFZhcmlvdXMgZmxhZ3Mgc2V0IG9uICNmbGFncy4KKyAgICAgKi8KKyAgICBlbnVtIEZsYWdzIHsKKyAgICAgICAgLyoqCisgICAgICAgICAqIEluZGljYXRlcyB0aGF0IHRoZSBjbGlwIHJlZ2lvbiB3YXMgbW9kaWZpZWQuIFdoZW4gdGhpcworICAgICAgICAgKiBzbmFwc2hvdCBpcyByZXN0b3JlZCBzbyBtdXN0IHRoZSBjbGlwLgorICAgICAgICAgKi8KKyAgICAgICAga0ZsYWdDbGlwU2V0ID0gMHgxLAorICAgICAgICAvKioKKyAgICAgICAgICogSW5kaWNhdGVzIHRoYXQgdGhpcyBzbmFwc2hvdCB3YXMgY3JlYXRlZCB3aGVuIHNhdmluZworICAgICAgICAgKiBhIG5ldyBsYXllci4KKyAgICAgICAgICovCisgICAgICAgIGtGbGFnSXNMYXllciA9IDB4MiwKKyAgICAgICAgLyoqCisgICAgICAgICAqIEluZGljYXRlcyB0aGF0IHRoaXMgc25hcHNob3QgaGFzIGNoYW5nZWQgdGhlIG9ydGhvIG1hdHJpeC4KKyAgICAgICAgICovCisgICAgICAgIGtGbGFnRGlydHlPcnRobyA9IDB4NCwKKyAgICAgICAgLyoqCisgICAgICAgICAqIEluZGljYXRlcyB0aGF0IHRoZSBsb2NhbCBjbGlwIHNob3VsZCBiZSByZWNvbXB1dGVkLgorICAgICAgICAgKi8KKyAgICAgICAga0ZsYWdEaXJ0eUxvY2FsQ2xpcCA9IDB4OCwKKyAgICB9OworCisgICAgLyoqCisgICAgICogSW50ZXJzZWN0cyB0aGUgY3VycmVudCBjbGlwIHdpdGggdGhlIG5ldyBjbGlwIHJlY3RhbmdsZS4KKyAgICAgKi8KKyAgICBib29sIGNsaXAoZmxvYXQgbGVmdCwgZmxvYXQgdG9wLCBmbG9hdCByaWdodCwgZmxvYXQgYm90dG9tLCBTa1JlZ2lvbjo6T3Agb3ApIHsKKyAgICAgICAgYm9vbCBjbGlwcGVkID0gZmFsc2U7CisKKyAgICAgICAgUmVjdCByKGxlZnQsIHRvcCwgcmlnaHQsIGJvdHRvbSk7CisgICAgICAgIHRyYW5zZm9ybS0+bWFwUmVjdChyKTsKKworICAgICAgICBzd2l0Y2ggKG9wKSB7CisgICAgICAgICAgICBjYXNlIFNrUmVnaW9uOjprRGlmZmVyZW5jZV9PcDoKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgU2tSZWdpb246OmtJbnRlcnNlY3RfT3A6CisgICAgICAgICAgICAgICAgY2xpcHBlZCA9IGNsaXBSZWN0LT5pbnRlcnNlY3Qocik7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIFNrUmVnaW9uOjprVW5pb25fT3A6CisgICAgICAgICAgICAgICAgY2xpcHBlZCA9IGNsaXBSZWN0LT51bmlvbldpdGgocik7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIFNrUmVnaW9uOjprWE9SX09wOgorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBTa1JlZ2lvbjo6a1JldmVyc2VEaWZmZXJlbmNlX09wOgorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBTa1JlZ2lvbjo6a1JlcGxhY2VfT3A6CisgICAgICAgICAgICAgICAgY2xpcFJlY3QtPnNldChyKTsKKyAgICAgICAgICAgICAgICBjbGlwcGVkID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorCisgICAgICAgIGlmIChjbGlwcGVkKSB7CisgICAgICAgICAgICBmbGFncyB8PSBTbmFwc2hvdDo6a0ZsYWdDbGlwU2V0IHwgU25hcHNob3Q6OmtGbGFnRGlydHlMb2NhbENsaXA7CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gY2xpcHBlZDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBTZXRzIHRoZSBjdXJyZW50IGNsaXAuCisgICAgICovCisgICAgdm9pZCBzZXRDbGlwKGZsb2F0IGxlZnQsIGZsb2F0IHRvcCwgZmxvYXQgcmlnaHQsIGZsb2F0IGJvdHRvbSkgeworICAgICAgICBjbGlwUmVjdC0+c2V0KGxlZnQsIHRvcCwgcmlnaHQsIGJvdHRvbSk7CisgICAgICAgIGZsYWdzIHw9IFNuYXBzaG90OjprRmxhZ0NsaXBTZXQgfCBTbmFwc2hvdDo6a0ZsYWdEaXJ0eUxvY2FsQ2xpcDsKKyAgICB9CisKKyAgICBjb25zdCBSZWN0JiBnZXRMb2NhbENsaXAoKSB7CisgICAgICAgIGlmIChmbGFncyAmIFNuYXBzaG90OjprRmxhZ0RpcnR5TG9jYWxDbGlwKSB7CisgICAgICAgICAgICBtYXQ0IGludmVyc2U7CisgICAgICAgICAgICBpbnZlcnNlLmxvYWRJbnZlcnNlKCp0cmFuc2Zvcm0pOworCisgICAgICAgICAgICBtTG9jYWxDbGlwLnNldCgqY2xpcFJlY3QpOworICAgICAgICAgICAgaW52ZXJzZS5tYXBSZWN0KG1Mb2NhbENsaXApOworCisgICAgICAgICAgICBmbGFncyAmPSB+U25hcHNob3Q6OmtGbGFnRGlydHlMb2NhbENsaXA7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIG1Mb2NhbENsaXA7CisgICAgfQorCisgICAgLy8gVE9ETzogVGVtcG9yYXJ5CisgICAgdm9pZCByZXNldFRyYW5zZm9ybShmbG9hdCB4LCBmbG9hdCB5LCBmbG9hdCB6KSB7CisgICAgICAgIHRyYW5zZm9ybSA9ICZtVHJhbnNmb3JtUm9vdDsKKyAgICAgICAgdHJhbnNmb3JtLT5sb2FkVHJhbnNsYXRlKHgsIHksIHopOworICAgIH0KKworICAgIC8vIFRPRE86IFRlbXBvcmFyeQorICAgIHZvaWQgcmVzZXRDbGlwKGZsb2F0IGxlZnQsIGZsb2F0IHRvcCwgZmxvYXQgcmlnaHQsIGZsb2F0IGJvdHRvbSkgeworICAgICAgICBjbGlwUmVjdCA9ICZtQ2xpcFJlY3RSb290OworICAgICAgICBjbGlwUmVjdC0+c2V0KGxlZnQsIHRvcCwgcmlnaHQsIGJvdHRvbSk7CisgICAgICAgIGZsYWdzIHw9IFNuYXBzaG90OjprRmxhZ0NsaXBTZXQgfCBTbmFwc2hvdDo6a0ZsYWdEaXJ0eUxvY2FsQ2xpcDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBIZWlnaHQgb2YgdGhlIGZyYW1lYnVmZmVyIHRoZSBzbmFwc2hvdCBpcyByZW5kZXJpbmcgaW50by4KKyAgICAgKi8KKyAgICBpbnQgaGVpZ2h0OworCisgICAgLyoqCisgICAgICogSWYgdHJ1ZSwgdGhlIGxheWVyIHdvbid0IGJlIHJlbmRlcmVkLgorICAgICAqLworICAgIGJvb2wgaW52aXNpYmxlOworCisgICAgLyoqCisgICAgICogRGlydHkgZmxhZ3MuCisgICAgICovCisgICAgaW50IGZsYWdzOworCisgICAgLyoqCisgICAgICogUHJldmlvdXMgc25hcHNob3QuCisgICAgICovCisgICAgc3A8U25hcHNob3Q+IHByZXZpb3VzOworCisgICAgLyoqCisgICAgICogT25seSBzZXQgd2hlbiB0aGUgZmxhZyBrRmxhZ0lzTGF5ZXIgaXMgc2V0LgorICAgICAqLworICAgIExheWVyKiBsYXllcjsKKyAgICBHTHVpbnQgZmJvOworCisgICAgLyoqCisgICAgICogQ3VycmVudCB2aWV3cG9ydC4KKyAg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0gbUNhY2hlLmdldChlbnRyeSk7CisKKyAgICBpZiAoIXRleHR1cmUpIHsKKyAgICAgICAgRm9udFJlbmRlcmVyOjpEcm9wU2hhZG93IHNoYWRvdyA9IG1SZW5kZXJlci0+cmVuZGVyRHJvcFNoYWRvdyhwYWludCwgdGV4dCwgMCwKKyAgICAgICAgICAgICAgICBsZW4sIG51bUdseXBocywgcmFkaXVzKTsKKworICAgICAgICB0ZXh0dXJlID0gbmV3IFNoYWRvd1RleHR1cmU7CisgICAgICAgIHRleHR1cmUtPmxlZnQgPSBzaGFkb3cucGVuWDsKKyAgICAgICAgdGV4dHVyZS0+dG9wID0gc2hhZG93LnBlblk7CisgICAgICAgIHRleHR1cmUtPndpZHRoID0gc2hhZG93LndpZHRoOworICAgICAgICB0ZXh0dXJlLT5oZWlnaHQgPSBzaGFkb3cuaGVpZ2h0OworICAgICAgICB0ZXh0dXJlLT5nZW5lcmF0aW9uID0gMDsKKyAgICAgICAgdGV4dHVyZS0+YmxlbmQgPSB0cnVlOworCisgICAgICAgIGNvbnN0IHVpbnQzMl90IHNpemUgPSBzaGFkb3cud2lkdGggKiBzaGFkb3cuaGVpZ2h0OworICAgICAgICAvLyBEb24ndCBldmVuIHRyeSB0byBjYWNoZSBhIGJpdG1hcCB0aGF0J3MgYmlnZ2VyIHRoYW4gdGhlIGNhY2hlCisgICAgICAgIGlmIChzaXplIDwgbU1heFNpemUpIHsKKyAgICAgICAgICAgIHdoaWxlIChtU2l6ZSArIHNpemUgPiBtTWF4U2l6ZSkgeworICAgICAgICAgICAgICAgIG1DYWNoZS5yZW1vdmVPbGRlc3QoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGdsR2VuVGV4dHVyZXMoMSwgJnRleHR1cmUtPmlkKTsKKworICAgICAgICBnbEJpbmRUZXh0dXJlKEdMX1RFWFRVUkVfMkQsIHRleHR1cmUtPmlkKTsKKyAgICAgICAgLy8gVGV4dHVyZXMgYXJlIEFscGhhOAorICAgICAgICBnbFBpeGVsU3RvcmVpKEdMX1VOUEFDS19BTElHTk1FTlQsIDEpOworCisgICAgICAgIGdsVGV4SW1hZ2UyRChHTF9URVhUVVJFXzJELCAwLCBHTF9BTFBIQSwgdGV4dHVyZS0+d2lkdGgsIHRleHR1cmUtPmhlaWdodCwgMCwKKyAgICAgICAgICAgICAgICBHTF9BTFBIQSwgR0xfVU5TSUdORURfQllURSwgc2hhZG93LmltYWdlKTsKKworICAgICAgICBnbFRleFBhcmFtZXRlcmkoR0xfVEVYVFVSRV8yRCwgR0xfVEVYVFVSRV9NSU5fRklMVEVSLCBHTF9MSU5FQVIpOworICAgICAgICBnbFRleFBhcmFtZXRlcmkoR0xfVEVYVFVSRV8yRCwgR0xfVEVYVFVSRV9NQUdfRklMVEVSLCBHTF9MSU5FQVIpOworCisgICAgICAgIGdsVGV4UGFyYW1ldGVyaShHTF9URVhUVVJFXzJELCBHTF9URVhUVVJFX1dSQVBfUywgR0xfQ0xBTVBfVE9fRURHRSk7CisgICAgICAgIGdsVGV4UGFyYW1ldGVyaShHTF9URVhUVVJFXzJELCBHTF9URVhUVVJFX1dSQVBfVCwgR0xfQ0xBTVBfVE9fRURHRSk7CisKKyAgICAgICAgaWYgKHNpemUgPCBtTWF4U2l6ZSkgeworICAgICAgICAgICAgbVNpemUgKz0gc2l6ZTsKKyAgICAgICAgICAgIG1DYWNoZS5wdXQoZW50cnksIHRleHR1cmUpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgdGV4dHVyZS0+Y2xlYW51cCA9IHRydWU7CisgICAgICAgIH0KKworICAgICAgICAvLyBDbGVhbnVwIHNoYWRvdworICAgICAgICBkZWxldGVbXSBzaGFkb3cuaW1hZ2U7CisgICAgfQorCisgICAgcmV0dXJuIHRleHR1cmU7Cit9CisKK307IC8vIG5hbWVzcGFjZSB1aXJlbmRlcmVyCit9OyAvLyBuYW1lc3BhY2UgYW5kcm9pZApkaWZmIC0tZ2l0IGEvbGlicy9od3VpL1RleHRE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EFORFJPSURfVUlfVEVYVF9EUk9QX1NIQURPV19DQUNIRV9ICisjZGVmaW5lIEFORFJPSURfVUlfVEVYVF9EUk9QX1NIQURPV19DQUNIRV9ICisKKyNpbmNsdWRlIDxHTEVTMi9nbDIuaD4KKworI2luY2x1ZGUgPFNrUGFpbnQuaD4KKworI2luY2x1ZGUgIkdlbmVyYXRpb25DYWNoZS5oIgorI2luY2x1ZGUgIkZvbnRSZW5kZXJlci5oIgorI2luY2x1ZGUgIlRleHR1cmUuaCIKKworbmFtZXNwYWNlIGFuZHJvaWQgeworbmFtZXNwYWNlIHVpcmVuZGVyZXIgeworCitzdHJ1Y3QgU2hhZG93VGV4dCB7CisgICAgU2hhZG93VGV4dCgpIHsKKyAgICAgICAgdGV4dCA9IE5VTEw7CisgICAgfQorCisgICAgU2hhZG93VGV4dChTa1BhaW50KiBwYWludCwgdWludDMyX3QgcmFkaXVzLCB1aW50MzJfdCBsZW4sIGNvbnN0IGNoYXIqIHNyY1RleHQpOgorICAgICAgICAgICAgcmFkaXVzKHJhZGl1cyksIGxlbihsZW4pIHsKKyAgICAgICAgdGV4dCA9IG5ldyBjaGFyW2xlbl07CisgICAgICAgIG1lbWNweSh0ZXh0LCBzcmNUZXh0LCBsZW4pOworCisgICAgICAgIHRleHRTaXplID0gcGFpbnQtPmdldFRleHRTaXplKCk7CisgICAgICAgIHR5cGVmYWNlID0gcGFpbnQtPmdldFR5cGVmYWNlKCk7CisKKyAgICAgICAgaGFzaCA9IDA7CisgICAgICAgIHVpbnQzMl90IG11bHRpcGxpZXIgPSAxOworICAgICAgICBmb3IgKHVpbnQzMl90IGkgPSAwOyBpIDwgbGVuOyBpKyspIHsKKyAgICAgICAgICAgIGhhc2ggKz0gdGV4dFtpXSAqIG11bHRpcGxpZXI7CisgICAgICAgICAgICB1aW50MzJfdCBzaGlmdGVkID0gbXVsdGlwbGllciA8PCA1OworICAgICAgICAgICAgbXVsdGlwbGllciA9IHNoaWZ0ZWQgLSBtdWx0aXBsaWVyOworICAgICAgICB9CisgICAgfQorCisgICAgU2hhZG93VGV4dChjb25zdCBTaGFkb3dUZXh0JiBzaGFkb3cpOgorICAgICAgICAgICAgcmFkaXVzKHNoYWRvdy5yYWRpdXMpLCBsZW4oc2hhZG93LmxlbiksIGhhc2goc2hhZG93Lmhhc2gpLAorICAgICAgICAgICAgdGV4dFNpemUoc2hhZG93LnRleHRTaXplKSwgdHlwZWZhY2Uoc2hhZG93LnR5cGVmYWNlKSB7CisgICAgICAgIHRleHQgPSBuZXcgY2hhcltzaGFkb3cubGVuXTsKKyAgICAgICAgbWVtY3B5KHRleHQsIHNoYWRvdy50ZXh0LCBzaGFkb3cubGVuKTsKKyAgICB9CisKKyAgICB+U2hhZG93VGV4dCgpIHsKKyAgICAgICAgZGVsZXRlW10gdGV4dDsKKyAgICB9CisKKyAgICB1aW50MzJfdCByYWRpdXM7CisgICAgdWludDMyX3QgbGVuOworICAgIHVpbnQzMl90IGhhc2g7CisgICAgZmxvYXQgdGV4dFNpemU7CisgICAgU2tUeXBlZmFjZSogdHlwZWZhY2U7CisgICAgY2hhciAqdGV4dDsKKworICAgIGJvb2wgb3BlcmF0b3I8KGNvbnN0IFNoYWRvd1RleHQmIHJocykgY29uc3QgeworICAgICAgICBpZiAoaGFzaCA8IHJocy5oYXNoKSByZXR1cm4gdHJ1ZTsKKyAgICAgICAgZWxzZSBpZiAoaGFzaCA9PSByaHMuaGFzaCkgeworICAgICAgICAgICAgaWYgKGxlbiA8IHJocy5sZW4pIHJldHVybiB0cnVlOworICAgICAgICAgICAgZWxzZSBpZiAobGVuID09IHJocy5sZW4pIHsKKyAgICAgICAgICAgICAgICBpZiAocmFkaXVzIDwgcmhzLnJhZGl1cykgcmV0dXJuIHRydWU7CisgICAgICAgICAgICAgICAgZWxzZSBpZiAocmFkaXVzID09IHJocy5yYWRpdXMpIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKHRleHRTaXplIDwgcmhzLnRleHRTaXplKSByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAodGV4dFNpemUgPT0gcmhzLnRleHRTaXplKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAodHlwZWZhY2UgPCByaHMudHlwZWZhY2UpIHJldHVybiB0cnVlOworICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAodHlwZWZhY2UgPT0gcmhzLnR5cGVmYWNlKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHN0cm5jbXAodGV4dCwgcmhzLnRleHQsIGxlbikgPCAwOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9Cit9OyAvLyBzdHJ1Y3QgU2hhZG93VGV4dAorCisvKioKKyAqIEFscGhhIHRleHR1cmUgdXNlZCB0byByZXByZXNlbnQgYSBzaGFkb3cuCisgKi8KK3N0cnVjdCBTaGFkb3dUZXh0dXJlOiBwdWJsaWMgVGV4dHVyZSB7CisgICAgU2hhZG93VGV4dHVyZSgpOiBUZXh0dXJlKCkgeworICAgIH0KKworICAgIGZsb2F0IGxlZnQ7CisgICAgZmxvYXQgdG9wOworfTsgLy8gc3RydWN0IFNoYWRvd1RleHR1cmUKKworY2xhc3MgVGV4dERyb3BTaGFkb3dDYWNoZTogcHVibGljIE9uRW50cnlSZW1vdmVkPFNoYWRvd1RleHQsIFNoYWRvd1RleHR1cmUqPiB7CitwdWJsaWM6CisgICAgVGV4dERyb3BTaGFkb3dDYWNoZSgpOworICAgIFRleHREcm9wU2hhZG93Q2FjaGUodWludDMyX3QgbWF4Qnl0ZVNpemUpOworICAgIH5UZXh0RHJvcFNoYWRvd0NhY2hlKCk7CisKKyAgICAvKioKKyAgICAgKiBVc2VkIGFzIGEgY2FsbGJhY2sgd2hlbiBhbiBlbnRyeSBpcyByZW1vdmVkIGZyb20gdGhlIGNhY2hlLgorICAgICAqIERvIG5vdCBpbnZva2UgZGlyZWN0bHkuCisgICAgICovCisgICAgdm9pZCBvcGVyYXRvcigpKFNoYWRvd1RleHQmIHRleHQsIFNoYWRvd1RleHR1cmUqJiB0ZXh0dXJlKTsKKworICAgIFNoYWRvd1RleHR1cmUqIGdldChTa1BhaW50KiBwYWludCwgY29uc3QgY2hhciogdGV4dCwgdWludDMyX3QgbGVuLAorICAgICAgICAgICAgaW50IG51bUdseXBocywgdWludDMyX3QgcmFkaXVzKTsKKworICAgIC8qKgorICAgICAqIENsZWFycyB0aGUgY2FjaGUuIFRoaXMgY2F1c2VzIGFsbCB0ZXh0dXJlcyB0byBiZSBkZWxldGVkLgorICAgICAqLworICAgIHZvaWQgY2xlYXIoKTsKKworICAgIHZvaWQgc2V0Rm9udFJlbmRlcmVyKEZvbnRSZW5kZXJlciYgZm9udFJlbmRlcmVyKSB7CisgICAgICAgIG1SZW5kZXJlciA9ICZmb250UmVuZGVyZXI7CisgICAgfQorCisgICAgLyoqCisgICAgICogU2V0cyB0aGUgbWF4aW11bSBzaXplIG9mIHRoZSBjYWNoZSBpbiBieXRlcy4KKyAgICAgKi8KKyAgICB2b2lkIHNldE1heFNpemUodWludDMyX3QgbWF4U2l6ZSk7CisgICAgLyoqCisgICAgICogUmV0dXJucyB0aGUgbWF4aW11bSBzaXplIG9mIHRoZSBjYWNoZSBpbiBieXRlcy4KKyAgICAgKi8KKyAgICB1aW50MzJfdCBnZXRNYXhTaXplKCk7CisgICAgLyoqCisgICAgICogUmV0dXJucyB0aGUgY3VycmVudCBzaXplIG9mIHRoZSBjYWNoZSBpbiBieXRlcy4KKyAgICAgKi8KKyAgICB1aW50MzJfdCBnZXRTaXplKCk7CisKK3ByaXZhdGU6CisgICAgR2VuZXJhdGlvbkNhY2hlPFNoYWRvd1RleHQsIFNoYWRvd1RleHR1cmUqPiBtQ2FjaGU7CisKKyAgICB1aW50MzJfdCBtU2l6ZTsKKyAg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UlJBTlRJRVMgT1IgQ09ORElUSU9OUyBPRiBBTlkgS0lORCwgZWl0aGVyIGV4cHJlc3Mgb3IgaW1wbGllZC4KKyAqIFNlZSB0aGUgTGljZW5zZSBmb3IgdGhlIHNwZWNpZmljIGxhbmd1YWdlIGdvdmVybmluZyBwZXJtaXNzaW9ucyBhbmQKKyAqIGxpbWl0YXRpb25zIHVuZGVyIHRoZSBMaWNlbnNlLgorICovCisKKyNpZm5kZWYgQU5EUk9JRF9VSV9URVhUVVJFX0gKKyNkZWZpbmUgQU5EUk9JRF9VSV9URVhUVVJFX0gKKworI2luY2x1ZGUgPEdMRVMyL2dsMi5oPgorCituYW1lc3BhY2UgYW5kcm9pZCB7CituYW1lc3BhY2UgdWlyZW5kZXJlciB7CisKKy8qKgorICogUmVwcmVzZW50cyBhbiBPcGVuR0wgdGV4dHVyZS4KKyAqLworc3RydWN0IFRleHR1cmUgeworICAgIFRleHR1cmUoKSB7CisgICAgICAgIGNsZWFudXAgPSBmYWxzZTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBOYW1lIG9mIHRoZSB0ZXh0dXJlLgorICAgICAqLworICAgIEdMdWludCBpZDsKKyAgICAvKioKKyAgICAgKiBHZW5lcmF0aW9uIG9mIHRoZSBiYWNraW5nIGJpdG1hcCwKKyAgICAgKi8KKyAgICB1aW50MzJfdCBnZW5lcmF0aW9uOworICAgIC8qKgorICAgICAqIEluZGljYXRlcyB3aGV0aGVyIHRoZSB0ZXh0dXJlIHJlcXVpcmVzIGJsZW5kaW5nLgorICAgICAqLworICAgIGJvb2wgYmxlbmQ7CisgICAgLyoqCisgICAgICogV2lkdGggb2YgdGhlIGJhY2tpbmcgYml0bWFwLgorICAgICAqLworICAgIHVpbnQzMl90IHdpZHRoOworICAgIC8qKgorICAgICAqIEhlaWdodCBvZiB0aGUgYmFja2luZyBiaXRtYXAuCisgICAgICovCisgICAgdWludDMyX3QgaGVpZ2h0OworICAgIC8qKgorICAgICAqIEluZGljYXRlcyB3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isgICAgICAgIH0KKworICAgICAgICBjb25zdCB1aW50MzJfdCBzaXplID0gYml0bWFwLT5yb3dCeXRlcygpICogYml0bWFwLT5oZWlnaHQoKTsKKyAgICAgICAgLy8gRG9uJ3QgZXZlbiB0cnkgdG8gY2FjaGUgYSBiaXRtYXAgdGhhdCdzIGJpZ2dlciB0aGFuIHRoZSBjYWNoZQorICAgICAgICBpZiAoc2l6ZSA8IG1NYXhTaXplKSB7CisgICAgICAgICAgICB3aGlsZSAobVNpemUgKyBzaXplID4gbU1heFNpemUpIHsKKyAgICAgICAgICAgICAgICBtQ2FjaGUucmVtb3ZlT2xkZXN0KCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICB0ZXh0dXJlID0gbmV3IFRleHR1cmU7CisgICAgICAgIGdlbmVyYXRlVGV4dHVyZShiaXRtYXAsIHRleHR1cmUsIGZhbHNlKTsKKworICAgICAgICBpZiAoc2l6ZSA8IG1NYXhTaXplKSB7CisgICAgICAgICAgICBtU2l6ZSArPSBzaXplOworICAgICAgICAgICAgbUNhY2hlLnB1dChiaXRtYXAsIHRleHR1cmUpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgdGV4dHVyZS0+Y2xlYW51cCA9IHRydWU7CisgICAgICAgIH0KKyAgICB9IGVsc2UgaWYgKGJpdG1hcC0+Z2V0R2VuZXJhdGlvbklEKCkgIT0gdGV4dHVyZS0+Z2VuZXJhdGlvbikgeworICAgICAgICBnZW5lcmF0ZVRleHR1cmUoYml0bWFwLCB0ZXh0dXJlLCB0cnVlKTsKKyAgICB9CisKKyAgICByZXR1cm4gdGV4dHVyZTsKK30KKwordm9pZCBUZXh0dXJlQ2FjaGU6OnJlbW92ZShTa0JpdG1hcCogYml0bWFwKSB7CisgICAgbUNhY2hlLnJlbW92ZShiaXRtYXApOworfQorCit2b2lkIFRleHR1cmVDYWNoZTo6Y2xlYXIoKSB7CisgICAgbUNhY2hlLmNsZWFyKCk7Cit9CisKK3ZvaWQgVGV4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FJTX0tJTkRfUElYRUxfUkdCLAogICAgIFJTX0tJTkRfUElYRUxfUkdCQSwKLQogfTsKIAogZW51bSBSc1NhbXBsZXJQYXJhbSB7CkBAIC0yMDUsOSArMjA2LDcxIEBACiBlbnVtIFJzRXJyb3IgewogICAgIFJTX0VSUk9SX05PTkUsCiAgICAgUlNfRVJST1JfQkFEX1NIQURFUiwKLSAgICBSU19FUlJPUl9CQURfU0NSSVBUCisgICAgUlNfRVJST1JfQkFEX1NDUklQVCwKKyAgICBSU19FUlJPUl9CQURfVkFMVUUsCisgICAgUlNfRVJST1JfT1VUX09GX01FTU9SWQogfTsKIAorZW51bSBSc0FuaW1hdGlvbkludGVycG9sYXRpb24geworICAgIFJTX0FOSU1BVElPTl9JTlRFUlBPTEFUSU9OX1NURVAsCisgICAgUlNfQU5JTUFUSU9OX0lOVEVSUE9MQVRJT05fTElORUFSLAorICAgIFJTX0FOSU1BVElPTl9JTlRFUlBPTEFUSU9OX0JFWklFUiwKKyAgICBSU19BTklNQVRJT05fSU5URVJQT0xBVElPTl9DQVJESU5BTCwKKyAgICBSU19BTklNQVRJT05fSU5URVJQT0xBVElPTl9IRVJNSVRFLAorICAgIFJTX0FOSU1BVElPTl9JTlRFUlBPTEFUSU9OX0JTUExJTkUKK307CisKK2VudW0gUnNBbmltYXRpb25FZGdlIHsKKyAgICBSU19BTklNQVRJT05fRURHRV9VTkRFRklORUQsCisgICAgUlNfQU5JTUFUSU9OX0VER0VfQ09OU1RBTlQsCisgICAgUlNfQU5JTUFUSU9OX0VER0VfR1JBRElFTlQsCisgICAgUlNfQU5JTUFUSU9OX0VER0VfQ1lDTEUsCisgICAgUlNfQU5JTUFUSU9OX0VER0VfT1NDSUxMQVRFLAorICAgIFJTX0FOSU1BVElPTl9FREdFX0NZTEVfUkVMQVRJVkUKK307CisKK2VudW0gUnNBM0RDbGFzc0lEIHsKKyAgICBSU19BM0RfQ0xBU1NfSURfVU5LTk9XTiwKKyAgICBSU19BM0RfQ0xBU1N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MyKGNvbiwgMiwgc3JjSWR4ICsgMyk7Ci0gICAgICAgIHBvc3kgPSBsb2FkSTMyKGNvbiwgMiwgc3JjSWR4ICsgNCk7Ci0KLSAgICAgICAgaWYgKGxpZmUpIHsKLSAgICAgICAgICAgIGlmIChwb3N5IDwgKDQ4MCA8PCAxNikpIHsKLSAgICAgICAgICAgICAgICBkc3RJZHggPSBkcmF3Q291bnQgKiA5OwotICAgICAgICAgICAgICAgIGMgPSAweGZmYWZjZiB8ICgobGlmZSA+PiBsaWZlU2hpZnQpIDw8IDI0KTsKLQotICAgICAgICAgICAgICAgIHN0b3JlVTMyKGNvbiwgMSwgZHN0SWR4LCBjKTsKLSAgICAgICAgICAgICAgICBzdG9yZUkzMihjb24sIDEsIGRzdElkeCArIDEsIHBvc3gpOwotICAgICAgICAgICAgICAgIHN0b3JlSTMyKGNvbiwgMSwgZHN0SWR4ICsgMiwgcG9zeSk7Ci0KLSAgICAgICAgICAgICAgICBzdG9yZVUzMihjb24sIDEsIGRzdElkeCArIDMsIGMpOwotICAgICAgICAgICAgICAgIHN0b3JlSTMyKGNvbiwgMSwgZHN0SWR4ICsgNCwgcG9zeCArIDB4MTAwMDApOwotICAgICAgICAgICAgICAgIHN0b3JlSTMyKGNvbiwgMSwgZHN0SWR4ICsgNSwgcG9zeSArIGR5ICogNCk7Ci0KLSAgICAgICAgICAgICAgICBzdG9yZVUzMihjb24sIDEsIGRzdElkeCArIDYsIGMpOwotICAgICAgICAgICAgICAgIHN0b3JlSTMyKGNvbiwgMSwgZHN0SWR4ICsgNywgcG9zeCAtIDB4MTAwMDApOwotICAgICAgICAgICAgICAgIHN0b3JlSTMyKGNvbiwgMSwgZHN0SWR4ICsgOCwgcG9zeSArIGR5ICogNCk7Ci0gICAgICAgICAgICAgICAgZHJhd0NvdW50ICsrOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBpZiAoZHkgPiAwKSB7Ci0gICAgICAgICAgICAgICAgICAgIGR5ID0g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IHggPSBfeDsKLSAgICAgICAgICAgIHkgPSBfeTsKLSAgICAgICAgICAgIHogPSBfejsKLSAgICAgICAgfQotCi0gICAgICAgIHZvaWQgbnh5eihmbG9hdCBfeCwgZmxvYXQgX3ksIGZsb2F0IF96KSB7Ci0gICAgICAgICAgICBueCA9IF94OwotICAgICAgICAgICAgbnkgPSBfeTsKLSAgICAgICAgICAgIG56ID0gX3o7Ci0gICAgICAgIH0KLQotICAgICAgICB2b2lkIHN0KGZsb2F0IF9zLCBmbG9hdCBfdCkgewotICAgICAgICAgICAgcyA9IF9zOwotICAgICAgICAgICAgdCA9IF90OwotICAgICAgICB9Ci0KLSAgICAgICAgdm9pZCBjb21wdXRlTm9ybShWZXJ0ZXggdjEsIFZlcnRleCB2MikgewotICAgICAgICAgICAgZmxvYXQgZHggPSB2MS54IC0gdjIueDsKLSAgICAgICAgICAgIGZsb2F0IGR5ID0gdjEueSAtIHYyLnk7Ci0gICAgICAgICAgICBmbG9hdCBkeiA9IHYxLnogLSB2Mi56OwotICAgICAgICAgICAgZmxvYXQgbGVuID0gKGZsb2F0KWphdmEubGFuZy5NYXRoLnNxcnQoZHgqZHggKyBkeSpkeSArIGR6KmR6KTsKLSAgICAgICAgICAgIGR4IC89IGxlbjsKLSAgICAgICAgICAgIGR5IC89IGxlbjsKLSAgICAgICAgICAgIGR6IC89IGxlbjsKLQotICAgICAgICAgICAgbnggPSBkeCAqIGR6OwotICAgICAgICAgICAgbnkgPSBkeSAqIGR6OwotICAgICAgICAgICAgbnogPSAoZmxvYXQpamF2YS5sYW5nLk1hdGguc3FydChkeCpkeCArIGR5KmR5KTsKLQotICAgICAgICAgICAgbGVuID0gKGZsb2F0KWphdmEubGFuZy5NYXRoLnNxcnQobngqbnggKyBueSpueSArIG56Km56KTsKLSAgICAgICAgICAgIG54IC89IGxlbjsKLSAgICAgICAgICAgIG55IC89IGxlbjsKLSAgICAgICAgICAgIG56IC89IGxlbjsKLSAgICAgICAgfQotICAgIH0KLQotICAgI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yMzY0ZiwKLSAgICAgICAgICAgICAtMTA5LjQ4OTUyM2YsIDE2OS4yMTE4NjZmLAotICAgICAgICAgICAgIC0xMTguNjk5NTgyZiwgMTYzLjE3MDA5NmYsCi0gICAgICAgICAgICAgLTEyNS44NTY4NzJmLCAxNTQuNzk3NDM5ZiwKLSAgICAgICAgICAgICAtMTMwLjM5MjMxMWYsIDE0NC43NTk2MTNmLAotICAgICAgICAgICAgIC0xMzEuOTQ1MjgzZiwgMTMzLjg1NDczMWYsCi0gICAgICAgICAgICAgLTEzMC4zOTIzMTFmLCAxMjIuOTQ5ODQ5ZiwKLSAgICAgICAgICAgICAtMTI1Ljg1Njg3MmYsIDExMi45MTIwMjJmLAotICAgICAgICAgICAgIC0xMTguNjk5NTgyZiwgMTA0LjUzOTM2NmYsCi0gICAgICAgICAgICAgLTEwOS40ODk1MjNmLCA5OC40OTc1OTZmLAotICAgICAgICAgICAgIC05OC45NTg5OTRmLCA5NS4yNjcwOThmLAotICAgICAgICAgICAgIC04Ny45NDUyODNmLCA5NS4xMDQ3MzFmLAotICAgICAgICAgICAgIC04NC4zNzE3NzNmLCA5NS43NzEwMjNmLAotICAgICAgICAgICAgIC04MC44OTg1NzRmLCA5Ni44NDM3ODFmLAotICAgICAgICAgICAgIC03Ny41NzE3NTdmLCA5OC4zMDg3NzdmLAotICAgICAgICAgICAgIC03NC40MzU0NTJmLCAxMDAuMTQ2NTc3ZiwKLSAgICAgICAgICAgICAtNzEuNTMxMjU5ZiwgMTAyLjMzMjgwM2YsCi0gICAgICAgICAgICAgLTY4Ljg5NzcwM2YsIDEwNC44Mzg0NTdmLAotICAgICAgICAgICAgIC02Ni41Njk3MTZmLCAxMDcuNjMwMzAyZiwKLSAgICAgICAgICAgICAtNjQuNTc4MTc3ZiwgMTEwLjY3MTMwNGYsCi0gICAgICAgICAgICAgLTYyLjk0OTUwNWYsIDExMy45MjExMjdmLAotICAgICAgICAgICAgIC02MS43MDUzMDNmLCAxMTcuMzM2NjYyZiw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XSk7Ci0gICAgICAgICAgICBmbG9hdCBsZW4gPSAoZmxvYXQpamF2YS5sYW5nLk1hdGguc3FydCh0Lm54ICogdC5ueCArIHQubnkgKiB0Lm55KTsKLSAgICAgICAgICAgIHJ1bm5pbmdTICs9IGxlbiAvIDEwMDsKLSAgICAgICAgICAgIHQubnggLz0gbGVuOwotICAgICAgICAgICAgdC5ueSAvPSBsZW47Ci0gICAgICAgICAgICB0LnkgPSAtMC41ZjsKLSAgICAgICAgICAgIHQudCA9IDA7Ci0gICAgICAgICAgICB0bS5zZXROb3JtYWwodC5ueCwgdC5ueSwgdC5ueik7Ci0gICAgICAgICAgICB0bS5zZXRUZXh0dXJlKHQucywgdC50KTsKLSAgICAgICAgICAgIHRtLmFkZFZlcnRleCh0LngsIHQueSwgdC56KTsKLSAgICAgICAgICAgIC8vYW5kcm9pZC51dGlsLkxvZy5lKCJycyIsICJ2dHggeD0iK3QueCsiIHk9Iit0LnkrIiB6PSIrdC56KyIgcz0iK3QucysiIHQ9Iit0LnQpOwotICAgICAgICAgICAgdC55ID0gLjVmOwotICAgICAgICAgICAgdC50ID0gMTsKLSAgICAgICAgICAgIHRtLnNldFRleHR1cmUodC5zLCB0LnQpOwotICAgICAgICAgICAgdG0uYWRkVmVydGV4KHQueCwgdC55LCB0LnopOwotICAgICAgICAgICAgLy9hbmRyb2lkLnV0aWwuTG9nLmUoInJzIiwgInZ0eCB4PSIrdC54KyIgeT0iK3QueSsiIHo9Iit0LnorIiBzPSIrdC5zKyIgdD0iK3QudCk7Ci0KLSAgICAgICAgICAgIGlmKChydW5uaW5nUyoyKSA+IG1UcmlhbmdsZU9mZnNldHNDb3VudCkgewotICAgICAgICAgICAgICAgIG1UcmlhbmdsZU9mZnNldHNbbVRyaWFuZ2xlT2Zmc2V0c0NvdW50XSA9IGN0KjIgKiAzOwotICAgICAgICAgICAgICAgIG1UcmlhbmdsZU9mZnNldHNUZXhbbVRyaWFuZ2xlT2Zmc2V0c0NvdW50XSA9IHQuczs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AgICAgICAgICBtUmVuZGVyID0gbmV3IEZpbG1SUygpOwotICAgICAgICAgICAgbVJlbmRlci5pbml0KG1SUywgZ2V0UmVzb3VyY2VzKCksIHcsIGgpOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgQE92ZXJyaWRlCi0gICAgcHJvdGVjdGVkIHZvaWQgb25EZXRhY2hlZEZyb21XaW5kb3coKSB7Ci0gICAgICAgIGlmKG1SUyAhPSBudWxsKSB7Ci0gICAgICAgICAgICBtUlMgPSBudWxsOwotICAgICAgICAgICAgZGVzdHJveVJlbmRlclNjcmlwdCgpOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgQE92ZXJyaWRlCi0gICAgcHVibGljIGJvb2xlYW4gb25LZXlEb3duKGludCBrZXlDb2RlLCBLZXlFdmVudCBldmVudCkKLSAgICB7Ci0gICAgICAgIC8vIGJyZWFrIHBvaW50IGF0IGhlcmUKLSAgICAgICAgLy8gdGhpcyBtZXRob2QgZG9lc24ndCB3b3JrIHdoZW4gJ2V4dGVuZHMgVmlldycgaW5jbHVkZSAnZXh0ZW5kcyBTY3JvbGxWaWV3Jy4KLSAgICAgICAgcmV0dXJuIHN1cGVyLm9uS2V5RG93bihrZXlDb2RlLCBldmVudCk7Ci0gICAgfQotCi0KLSAgICBAT3ZlcnJpZGUKLSAgICBwdWJsaWMgYm9vbGVhbiBvblRvdWNoRXZlbnQoTW90aW9uRXZlbnQgZXYpCi0gICAgewotICAgICAgICBib29sZWFuIHJldCA9IHRydWU7Ci0gICAgICAgIGludCBhY3QgPSBldi5nZXRBY3Rpb24oKTsKLSAgICAgICAgaWYgKGFjdCA9PSBldi5BQ1RJT05fVVApIHsKLSAgICAgICAgICAgIHJldCA9IGZhbHNlOwotICAgICAgICB9Ci0gICAgICAgIG1SZW5kZXIuc2V0RmlsbVN0cmlwUG9zaXRpb24oKGludClldi5nZXRYKCksIChpbnQpZXYuZ2V0WSgpIC8gNSk7Ci0gICAgICAgIHJldHVybiByZXQ7Ci0gICAgfQ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uZikpIDw8IDggfAotICAgICAgICAgICAgICAgICAgICAoKGludCkoQ29udHJvbC0+YiAqIDI1NS5mKSkgPDwgMTYgfAotICAgICAgICAgICAgICAgICAgICAoMHhmMCA8PCAyNCk7Ci0gICAgICAgIHN0cnVjdCBwb2ludF9zICogbnAgPSAmcFtuZXdQYXJ0XTsKLQotICAgICAgICB3aGlsZSAocmF0ZS0tKSB7Ci0gICAgICAgICAgICB2ZWMyUmFuZCgoZmxvYXQgKikmbnAtPmRlbHRhLngsIHJNYXgpOwotICAgICAgICAgICAgbnAtPnBvc2l0aW9uLnggPSB4OwotICAgICAgICAgICAgbnAtPnBvc2l0aW9uLnkgPSB5OwotICAgICAgICAgICAgbnAtPmNvbG9yID0gY29sb3I7Ci0gICAgICAgICAgICBuZXdQYXJ0Kys7Ci0gICAgICAgICAgICBucCsrOwotICAgICAgICAgICAgaWYgKG5ld1BhcnQgPj0gY291bnQpIHsKLSAgICAgICAgICAgICAgICBuZXdQYXJ0ID0gMDsKLSAgICAgICAgICAgICAgICBucCA9ICZwW25ld1BhcnRdOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgfQotCi0gICAgZm9yIChjdD0wOyBjdCA8IGNvdW50OyBjdCsrKSB7Ci0gICAgICAgIGZsb2F0IGR5ID0gcC0+ZGVsdGEueSArIDAuMTVmOwotICAgICAgICBmbG9hdCBwb3N5ID0gcC0+cG9zaXRpb24ueSArIGR5OwotICAgICAgICBpZiAoKHBvc3kgPiBoZWlnaHQpICYmIChkeSA+IDApKSB7Ci0gICAgICAgICAgICBkeSAqPSAtMC4zZjsKLSAgICAgICAgfQotICAgICAgICBwLT5kZWx0YS55ID0gZHk7Ci0gICAgICAgIHAtPnBvc2l0aW9uLnggKz0gcC0+ZGVsdGEueDsKLSAgICAgICAgcC0+cG9zaXRpb24ueSA9IHBvc3k7Ci0gICAgICAgIHArKzsKLSAgICB9Ci0KLSAgICB1cGxvYWRUb0J1ZmZlck9iamVjdChOQU1FRF9QYXJ0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sKLSAgICBpbnQgcmF0ZSA9IENvbnRyb2wtPnJhdGU7Ci0gICAgZmxvYXQgaGVpZ2h0ID0gZ2V0SGVpZ2h0KCk7Ci0gICAgUG9pbnRfdCAqIHAgPSBwb2ludDsKLQotICAgIGlmIChyYXRlKSB7Ci0gICAgICAgIGZsb2F0IHJNYXggPSAoKGZsb2F0KXJhdGUpICogMC4wMDVmOwotICAgICAgICBpbnQgeCA9IENvbnRyb2wtPng7Ci0gICAgICAgIGludCB5ID0gQ29udHJvbC0+eTsKLSAgICAgICAgaW50IGNvbG9yID0gKChpbnQpKENvbnRyb2wtPnIgKiAyNTUuZikpIHwKLSAgICAgICAgICAgICAgICAgICAgKChpbnQpKENvbnRyb2wtPmcgKiAyNTUuZikpIDw8IDggfAotICAgICAgICAgICAgICAgICAgICAoKGludCkoQ29udHJvbC0+YiAqIDI1NS5mKSkgPDwgMTYgfAotICAgICAgICAgICAgICAgICAgICAoMHhmMCA8PCAyNCk7Ci0gICAgICAgIFBvaW50X3QgKiBucCA9ICZwW25ld1BhcnRdOwotCi0gICAgICAgIHdoaWxlIChyYXRlLS0pIHsKLSAgICAgICAgICAgIG5wLT5kZWx0YSA9IHZlYzJSYW5kKHJNYXgpOwotICAgICAgICAgICAgbnAtPnBvc2l0aW9uLnggPSB4OwotICAgICAgICAgICAgbnAtPnBvc2l0aW9uLnkgPSB5OwotICAgICAgICAgICAgbnAtPmNvbG9yID0gY29sb3I7Ci0gICAgICAgICAgICBuZXdQYXJ0Kys7Ci0gICAgICAgICAgICBucCsrOwotICAgICAgICAgICAgaWYgKG5ld1BhcnQgPj0gY291bnQpIHsKLSAgICAgICAgICAgICAgICBuZXdQYXJ0ID0gMDsKLSAgICAgICAgICAgICAgICBucCA9ICZwW25ld1BhcnRdOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgfQotCi0gICAgZm9yIChjdD0wOyBjdCA8IGNvdW50OyBjdCsrKSB7Ci0gICAgICAgIGZsb2F0IGR5ID0gcC0+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vbihwb2ludHMuZ2V0QWxsb2NhdGlvbigpKTsKKyAgICAgICAgc21iLmFkZEluZGV4VHlwZShQcmltaXRpdmUuUE9JTlQpOworICAgICAgICBNZXNoIHNtID0gc21iLmNyZWF0ZSgpOworCisgICAgICAgIG1TY3JpcHQgPSBuZXcgU2NyaXB0Q19Gb3VudGFpbihtUlMsIG1SZXMsIFIucmF3LmZvdW50YWluLCB0cnVlKTsKKyAgICAgICAgbVNjcmlwdC5zZXRfcGFydE1lc2goc20pOworICAgICAgICBtU2NyaXB0LmJpbmRfcG9pbnQocG9pbnRzKTsKKyAgICAgICAgbVJTLmNvbnRleHRCaW5kUm9vdFNjcmlwdChtU2NyaXB0KTsKICAgICB9CiAKLSAgICBwdWJsaWMgdm9pZCBuZXdUb3VjaFBvc2l0aW9uKGludCB4LCBpbnQgeSwgaW50IHJhdGUpIHsKLSAgICAgICAgaWYgKG1TRC5yYXRlID09IDApIHsKLSAgICAgICAgICAgIG1TRC5yID0gKCh4ICYgMHgxKSAhPSAwKSA/IDAuZiA6IDEuZjsKLSAgICAgICAgICAgIG1TRC5nID0gKCh4ICYgMHgyKSAhPSAwKSA/IDAuZiA6IDEuZjsKLSAgICAgICAgICAgIG1TRC5iID0gKCh4ICYgMHg0KSAhPSAwKSA/IDAuZiA6IDEuZjsKLSAgICAgICAgICAgIGlmICgobVNELnIgKyBtU0QuZyArIG1TRC5iKSA8IDAuOWYpIHsKLSAgICAgICAgICAgICAgICBtU0QuciA9IDAuOGY7Ci0gICAgICAgICAgICAgICAgbVNELmcgPSAwLjVmOwotICAgICAgICAgICAgICAgIG1TRC5iID0gMS5mOwotICAgICAgICAgICAgfQorICAgIGJvb2xlYW4gaG9sZGluZ0NvbG9yW10gPSBuZXcgYm9vbGVhblsxMF07CisgICAgcHVibGljIHZvaWQgbmV3VG91Y2hQb3NpdGlvbihmbG9hdCB4LCBmbG9hdCB5LCBmbG9hdCBwcmVzc3VyZSwgaW50IGlkKSB7CisgICAgICAgIGlmIChpZ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MvamF2YS9Gb3VudGFpbi9zcmMvY29tL2FuZHJvaWQvZm91bnRhaW4vRm91bnRhaW5WaWV3LmphdmEKaW5kZXggZGZkNmE0OS4uYzE0MTE2NTZiIDEwMDY0NAotLS0gYS9saWJzL3JzL2phdmEvRm91bnRhaW4vc3JjL2NvbS9hbmRyb2lkL2ZvdW50YWluL0ZvdW50YWluVmlldy5qYXZhCisrKyBiL2xpYnMvcnMvamF2YS9Gb3VudGFpbi9zcmMvY29tL2FuZHJvaWQvZm91bnRhaW4vRm91bnRhaW5WaWV3LmphdmEKQEAgLTcxLDE3ICs3MSwzMyBAQAogICAgIEBPdmVycmlkZQogICAgIHB1YmxpYyBib29sZWFuIG9uVG91Y2hFdmVudChNb3Rpb25FdmVudCBldikKICAgICB7Ci0gICAgICAgIGludCBhY3QgPSBldi5nZXRBY3Rpb24oKTsKKyAgICAgICAgaW50IGFjdCA9IGV2LmdldEFjdGlvbk1hc2tlZCgpOwogICAgICAgICBpZiAoYWN0ID09IGV2LkFDVElPTl9VUCkgewotICAgICAgICAgICAgbVJlbmRlci5uZXdUb3VjaFBvc2l0aW9uKDAsIDAsIDApOworICAgICAgICAgICAgbVJlbmRlci5uZXdUb3VjaFBvc2l0aW9uKDAsIDAsIDAsIGV2LmdldFBvaW50ZXJJZCgwKSk7CiAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0gZWxzZSBpZiAoYWN0ID09IE1vdGlvbkV2ZW50LkFDVElPTl9QT0lOVEVSX1VQKSB7CisgICAgICAgICAgICAvLyBvbmx5IG9uZSBwb2ludGVyIGdvaW5nIHVwLCB3ZSBjYW4gZ2V0IHRoZSBpbmRleCBsaWtlIHRoaXMKKyAgICAgICAgICAgIGludCBwb2ludGVySW5kZXggPSBldi5nZXRBY3Rpb25JbmRleCgpOworICAgICAgICAgICAgaW50IHBvaW50ZXJJZCA9IGV2LmdldFBvaW50ZXJJZChwb2ludGVySW5kZXgpOworICAgICAgICAgICAgbVJlbmRlci5uZXdUb3VjaFBvc2l0aW9uKDAsIDAsIDAsIHBvaW50ZXJJZCk7CiAgICAgICAgIH0KLSAgICAgICAgZmxvYXQgcmF0ZSA9IChldi5nZXRQcmVzc3VyZSgpICogNTAuZik7Ci0gICAgICAgIHJhdGUgKj0gcmF0ZTsKLSAgICAgICAgaWYocmF0ZSA+IDIwMDAuZikgewotICAgICAgICAgICAgcmF0ZSA9IDIwMDAuZjsKKyAgICAgICAgaW50IGNvdW50ID0gZXYuZ2V0SGlzdG9yeVNpemUoKTsKKyAgICAgICAgaW50IHBjb3VudCA9IGV2LmdldFBvaW50ZXJDb3VudCgpOworCisgICAgICAgIGZvciAoaW50IHA9MDsgcCA8IHBjb3VudDsgcCsrKSB7CisgICAgICAgICAgICBpbnQgaWQgPSBldi5nZXRQb2ludGVySWQocCk7CisgICAgICAgICAgICBtUmVuZGVyLm5ld1RvdWNoUG9zaXRpb24oZXYuZ2V0WChwKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldi5nZXRZKHApLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2LmdldFByZXNzdXJlKHApLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkKTsKKworICAgICAgICAgICAgZm9yIChpbnQgaT0wOyBpIDwgY291bnQ7IGkrKykgeworICAgICAgICAgICAgICAgIG1SZW5kZXIubmV3VG91Y2hQb3NpdGlvbihldi5nZXRIaXN0b3JpY2FsWChwLCBpKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXYuZ2V0SGlzdG9yaWNhbFkocCwgaSksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2LmdldEhpc3RvcmljYWxQcmVzc3VyZShwLCBpKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQpOworICAgICAgICAgICAgfQogICAgICAgICB9Ci0gICAgICAgIG1SZW5kZXI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2F0IGR0ID0gbWluKHJzR2V0RHQoKSwgMC4xZik7CisgICAgcnNnQ2xlYXJDb2xvcigwLmYsIDAuZiwgMC5mLCAxLmYpOworICAgIGNvbnN0IGZsb2F0IGhlaWdodCA9IHJzZ0dldEhlaWdodCgpOworICAgIGNvbnN0IGludCBzaXplID0gcnNBbGxvY2F0aW9uR2V0RGltWChyc0dldEFsbG9jYXRpb24ocG9pbnQpKTsKKyAgICBmbG9hdCBkeTIgPSBkdCAqICgxMC5mKTsKKyAgICBQb2ludF90ICogcCA9IHBvaW50OworICAgIGZvciAoaW50IGN0PTA7IGN0IDwgc2l6ZTsgY3QrKykgeworICAgICAgICBwLT5kZWx0YS55ICs9IGR5MjsKKyAgICAgICAgcC0+cG9zaXRpb24gKz0gcC0+ZGVsdGE7CisgICAgICAgIGlmICgocC0+cG9zaXRpb24ueSA+IGhlaWdodCkgJiYgKHAtPmRlbHRhLnkgPiAwKSkgeworICAgICAgICAgICAgcC0+ZGVsdGEueSAqPSAtMC4zZjsKKyAgICAgICAgfQorICAgICAgICBwKys7CisgICAgfQorCisgICAgcnNnRHJhd01lc2gocGFydE1lc2gpOworICAgIHJldHVybiAxOworfQorCitzdGF0aWMgZmxvYXQ0IHBhcnRDb2xvclsxMF07Cit2b2lkIGFkZFBhcnRpY2xlcyhpbnQgcmF0ZSwgZmxvYXQgeCwgZmxvYXQgeSwgaW50IGluZGV4LCBib29sIG5ld0NvbG9yKQoreworICAgIGlmIChuZXdDb2xvcikgeworICAgICAgICBwYXJ0Q29sb3JbaW5kZXhdLnggPSByc1JhbmQoMC41ZiwgMS4wZik7CisgICAgICAgIHBhcnRDb2xvcltpbmRleF0ueSA9IHJzUmFuZCgxLjBmKTsKKyAgICAgICAgcGFydENvbG9yW2luZGV4XS56ID0gcnNSYW5kKDEuMGYpOworICAgIH0KKyAgICBmbG9hdCByTWF4ID0gKChmbG9hdClyYXRlKSAqIDAuMDJmOworICAgIGludCBzaXplID0gcnNBbGxvY2F0aW9uR2V0RGltWChyc0dldEFsbG9jYXRpb24ocG9pbnQpKTsKKyAgICB1Y2hhcjQgYyA9IHJzUGFja0NvbG9yVG84ODg4KHBhcnRDb2xvcltpbmRleF0pOworCisgICAgUG9pbnRfdCAqIG5wID0gJnBvaW50W25ld1BhcnRdOworICAgIGZsb2F0MiBwID0ge3gsIHl9OworICAgIHdoaWxlIChyYXRlLS0pIHsKKyAgICAgICAgZmxvYXQgYW5nbGUgPSByc1JhbmQoMy4xNGYgKiAyLmYpOworICAgICAgICBmbG9hdCBsZW4gPSByc1JhbmQock1heCk7CisgICAgICAgIG5wLT5kZWx0YS54ID0gbGVuICogc2luKGFuZ2xlKTsKKyAgICAgICAgbnAtPmRlbHRhLnkgPSBsZW4gKiBjb3MoYW5nbGUpOworICAgICAgICBucC0+cG9zaXRpb24gPSBwOworICAgICAgICBucC0+Y29sb3IgPSBjOworICAgICAgICBuZXdQYXJ0Kys7CisgICAgICAgIG5wKys7CisgICAgICAgIGlmIChuZXdQYXJ0ID49IHNpemUpIHsKKyAgICAgICAgICAgIG5ld1BhcnQgPSAwOworICAgICAgICAgICAgbnAgPSAmcG9pbnRbbmV3UGFydF07CisgICAgICAgIH0KKyAgICB9Cit9CisKZGlmZiAtLWdpdCBhL2xpYnMvcnMvamF2YS9JbWFnZVByb2Nlc3NpbmcvQW5kcm9pZC5tayBiL2xpYnMvcnMvamF2YS9JbWFnZVByb2Nlc3NpbmcvQW5kcm9pZC5tawppbmRleCA4MzM0MjdiLi43ZmEzMGQwIDEwMDY0NAotLS0gYS9saWJzL3JzL2phdmEvSW1hZ2VQcm9jZXNzaW5nL0FuZHJvaWQubWsKKysrIGIvbGlicy9ycy9qYXZhL0ltYWdlUHJvY2Vzc2luZy9BbmRyb2lkLm1rCkBAIC0xNCwxNCArMTQsMTkgQEAKICMgbGltaXRhdGlvbnMgdW5kZXIgdGhlIExpY2Vuc2UuCiAjCiAKK2lmbmVxICgkKFRBUkdFVF9TSU1VTEFUT1IpLHRydWUpCisKIEx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nQgb3V0SGVpZ2h0OwotCi0gICAgICAgIHB1YmxpYyBmbG9hdCB0aHJlc2hvbGQ7Ci0gICAgfQotCi0gICAgc3RhdGljIGNsYXNzIFBpeGVsIHsKLSAgICAgICAgcHVibGljIGJ5dGUgYTsKLSAgICAgICAgcHVibGljIGJ5dGUgcjsKLSAgICAgICAgcHVibGljIGJ5dGUgZzsKLSAgICAgICAgcHVibGljIGJ5dGUgYjsKLSAgICB9Ci0KICAgICBjbGFzcyBGaWx0ZXJDYWxsYmFjayBleHRlbmRzIFJlbmRlclNjcmlwdC5SU01lc3NhZ2UgewogICAgICAgICBwcml2YXRlIFJ1bm5hYmxlIG1BY3Rpb24gPSBuZXcgUnVubmFibGUoKSB7CiAgICAgICAgICAgICBwdWJsaWMgdm9pZCBydW4oKSB7Ci0gICAgICAgICAgICAgICAgbU91dFBpeGVsc0FsbG9jYXRpb24ucmVhZERhdGEobU91dERhdGEpOwotICAgICAgICAgICAgICAgIG1CaXRtYXAuc2V0UGl4ZWxzKG1PdXREYXRhLCAwLCBtUGFyYW1zLm91dFdpZHRoLCAwLCAwLAotICAgICAgICAgICAgICAgICAgICAgICAgbVBhcmFtcy5vdXRXaWR0aCwgbVBhcmFtcy5vdXRIZWlnaHQpOwogICAgICAgICAgICAgICAgIG1EaXNwbGF5Vmlldy5pbnZhbGlkYXRlKCk7CiAgICAgICAgICAgICB9CiAgICAgICAgIH07CkBAIC04OSwyOSArOTIsMjE4IEBACiAgICAgICAgIH0KICAgICB9CiAKLSAgICBwcml2YXRlIHZvaWQgamF2YUZpbHRlcigpIHsKKyAgICBpbnQgaW5bXTsKKyAgICBpbnQgaW50ZXJtW107CisgICAgaW50IG91dFtdOworICAgIGludCBNQVhfUkFESVVTID0gMjU7CisgICAgLy8gU3RvcmUgb3VyIGNvZWZmaWNpZW50cyBoZXJlCisgICAgZmxvYXQgZ2F1c3NpYW5bXTsKKworICAgIHByaXZhdGUgbG9uZyBqYXZhRmlsdGVyKCkgeworICAgICAgICBmaW5hbCBpbnQgd2lkdGggPSBtQml0bWFwSW4uZ2V0V2lkdGgoKTsKKyAgICAgICAgZmluYWwgaW50IGhlaWdodCA9IG1CaXRtYXBJbi5nZXRIZWlnaHQoKTsKKyAgICAgICAgZmluYWwgaW50IGNvdW50ID0gd2lkdGggKiBoZWlnaHQ7CisKKyAgICAgICAgaWYgKGluID09IG51bGwpIHsKKyAgICAgICAgICAgIGluID0gbmV3IGludFtjb3VudF07CisgICAgICAgICAgICBpbnRlcm0gPSBuZXcgaW50W2NvdW50XTsKKyAgICAgICAgICAgIG91dCA9IG5ldyBpbnRbY291bnRdOworICAgICAgICAgICAgZ2F1c3NpYW4gPSBuZXcgZmxvYXRbTUFYX1JBRElVUyAqIDIgKyAxXTsKKyAgICAgICAgICAgIG1CaXRtYXBJbi5nZXRQaXhlbHMoaW4sIDAsIHdpZHRoLCAwLCAwLCB3aWR0aCwgaGVpZ2h0KTsKKyAgICAgICAgfQorCiAgICAgICAgIGxvbmcgdCA9IGphdmEubGFuZy5TeXN0ZW0uY3VycmVudFRpbWVNaWxsaXMoKTsKLSAgICAgICAgaW50IGNvdW50ID0gbVBhcmFtcy5pbldpZHRoICogbVBhcmFtcy5pbkhlaWdodDsKLSAgICAgICAgZmxvYXQgdGhyZXNob2xkID0gbVBhcmFtcy50aHJlc2hvbGQgKiAyNTUuZjsKIAotICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGNvdW50OyBpKyspIHsKLSAgICAgICAgICAgIGZpbmFsIGZsb2F0IHIgPSAoZmxvYXQpKChtSW5EYXRhW2ldID4+IDApICYgMHhmZik7Ci0gICAgICAgICAgICBmaW5hbCBmbG9hdCBnID0gKGZsb2F0KSgobUluRGF0YVtpXSA+PiA4KSAmIDB4ZmYpOwotICAgICAgICAgICAgZmluYWwgZmxvYXQgYiA9IChmbG9hdCkoKG1JbkRhdGFbaV0gPj4gMTYpICYgMHhmZik7CisgICAgICAgIGludCB3LCBoLCByOwogCi0gICAgICAgICAgICBmaW5hbCBmbG9hdCBsdW1pbmFuY2UgPSAwLjIxMjVmICogciArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjcxNTRmICogZyArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwLjA3MjFmICogYjsKLSAgICAgICAgICAgIGlmIChsdW1pbmFuY2UgPiB0aHJlc2hvbGQpIHsKLSAgICAgICAgICAgICAgICBtT3V0RGF0YVtpXSA9IG1JbkRhdGFbaV07Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIG1PdXREYXRhW2ldID0gbUluRGF0YVtpXSAmIDB4ZmYwMDAwMDA7CisgICAgICAgIGZsb2F0IGZSYWRpdXMgPSAoZmxvYXQpbVJhZGl1czsKKyAgICAgICAgaW50IHJhZGl1cyA9IChpbnQpbVJhZGl1czsKKworICAgICAgICAvLyBDb21wdXRlIGdhdXNzaWFuIHdlaWdodHMgZm9yIHRoZSBibHVyCisgICAgICAgIC8vIGUgaXMgdGhlIGV1bGVyJ3MgbnVtYmVyCisgICAgICAgIGZsb2F0IGUgPSAyLjcxODI4MTgyODQ1OTA0NWY7CisgICAgICAgIGZsb2F0IHBpID0gMy4xNDE1OTI2NTM1ODk3OTMyZjsKKyAgICAgICAgLy8gZyh4KSA9ICggMSAvIHNxcnQoIDIgKiBwaSApICogc2lnbWEpICogZSBeICggLXheMiAvIDIgKiBzaWdtYV4yICkKKyAgICAgICAgLy8geCBpcyBvZiB0aGUgZm9ybSBbLXJhZGl1cyAuLiAwIC4uIHJhZGl1c10KKyAgICAgICAgLy8gYW5kIHNpZ21hIHZhcmllcyB3aXRoIHJhZGl1cy4KKyAgICAgICAgLy8gQmFzZWQgb24gc29tZSBleHBlcmltZW50YWwgcmFkaXVzIHZhbHVlcyBhbmQgc2lnbWEncworICAgICAgICAvLyB3ZSBhcHByb3hpbWF0ZWx5IGZpdCBzaWdtYSA9IGYocmFkaXVzKSBhcworICAgICAgICAvLyBzaWdtYSA9IHJhZGl1cyAqI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3IgKyByYWRpdXNdOworICAgICAgICB9CisKKyAgICAgICAgLy9Ob3cgd2UgbmVlZCB0byBub3JtYWxpemUgdGhlIHdlaWdodHMgYmVjYXVzZSBhbGwgb3VyIGNvZWZmaWNpZW50cyBuZWVkIHRvIGFkZCB1cCB0byBvbmUKKyAgICAgICAgbm9ybWFsaXplRmFjdG9yID0gMS4wZiAvIG5vcm1hbGl6ZUZhY3RvcjsKKyAgICAgICAgZm9yKHIgPSAtcmFkaXVzOyByIDw9IHJhZGl1czsgciArKykgeworICAgICAgICAgICAgZmxvYXRSID0gKGZsb2F0KXI7CisgICAgICAgICAgICBnYXVzc2lhbltyICsgcmFkaXVzXSAqPSBub3JtYWxpemVGYWN0b3I7CisgICAgICAgIH0KKworICAgICAgICBmbG9hdCBibHVycmVkUGl4ZWxSID0gMC4wZjsKKyAgICAgICAgZmxvYXQgYmx1cnJlZFBpeGVsRyA9IDAuMGY7CisgICAgICAgIGZsb2F0IGJsdXJyZWRQaXhlbEIgPSAwLjBmOworICAgICAgICBmbG9hdCBibHVycmVkUGl4ZWxBID0gMC4wZjsKKworICAgICAgICBmb3IoaCA9IDA7IGggPCBoZWlnaHQ7IGggKyspIHsKKyAgICAgICAgICAgIGZvcih3ID0gMDsgdyA8IHdpZHRoOyB3ICsrKSB7CisKKyAgICAgICAgICAgICAgICBibHVycmVkUGl4ZWxSID0gMC4wZjsKKyAgICAgICAgICAgICAgICBibHVycmVkUGl4ZWxHID0gMC4wZjsKKyAgICAgICAgICAgICAgICBibHVycmVkUGl4ZWxCID0gMC4wZjsKKyAgICAgICAgICAgICAgICBibHVycmVkUGl4ZWxBID0gMC4wZjsKKworICAgICAgICAgICAgICAgIGZvcihyID0gLXJhZGl1czsgciA8PSByYWRpdXM7IHIgKyspIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gU3RlcHBpbmcgbGVmdCBhbmQgcmlnaHQgYXdheSBmcm9tIHRoZSBwaXhlbAorICAgICAgICAgICAgICAgICAgICBpbnQgdmFsaWRXID0gdyArIHI7CisgICAgICAgICAgICAgICAgICAgIC8vIENsYW1wIHRvIHplcm8gYW5kIHdpZHRoIG1heCgpIGlzbid0IGV4cG9zZWQgZm9yIGludHMgeWV0CisgICAgICAgICAgICAgICAgICAgIGlmKHZhbGlkVyA8IDApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHZhbGlkVyA9IDA7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgaWYodmFsaWRXID4gd2lkdGggLSAxKSB7CisgICAgICAgICAgICAgICAgICAgICAgICB2YWxpZFcgPSB3aWR0aCAtIDE7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICBpbnQgaW5wdXQgPSBpbltoKndpZHRoICsgdmFsaWRXXTsKKworICAgICAgICAgICAgICAgICAgICBpbnQgUiA9ICgoaW5wdXQgPj4gMjQpICYgMHhmZik7CisgICAgICAgICAgICAgICAgICAgIGludCBHID0gKChpbnB1dCA+PiAxNikgJiAweGZmKTsKKyAgICAgICAgICAgICAgICAgICAgaW50IEIgPSAoKGlucHV0ID4+IDgpICYgMHhmZik7CisgICAgICAgICAgICAgICAgICAgIGludCBBID0gKGlucHV0ICYgMHhmZik7CisKKyAgICAgICAgICAgICAgICAgICAgZmxvYXQgd2VpZ2h0ID0gZ2F1c3NpYW5bciArIHJhZGl1c107CisKKyAgICAgICAgICAgICAgICAgICAgYmx1cnJlZFBpeGVsUiArPSAoZmxvYXQpKFIpKndlaWdodDsKKyAgICAgICAgICAgICAgICAgICAgYmx1cnJlZFBpeGVsRyArPSAoZmxvYXQpKEcpKndlaWdodDsKKyAgICAgICAgICAgICAgICAgICAgYmx1cnJlZFBpeGVsQiArPSAoZmxvYXQpKEIpKndlaWdodDsKKyAgICAgICAgICAgICAgICAgICAgYmx1cnJlZFBpeGVsQSArPSAoZmxvYXQpKEEpKndlaWdodDsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBpbnQgUiA9IChpbnQpYmx1cnJlZFBpeGVsUjsKKyAgICAgICAgICAgICAgICBpbnQgRyA9IChpbnQpYmx1cnJlZFBpeGVsRzsKKyAgICAgICAgICAgICAgICBpbnQgQiA9IChpbnQpYmx1cnJlZFBpeGVsQjsKKyAgICAgICAgICAgICAgICBpbnQgQSA9IChpbnQpYmx1cnJlZFBpeGVsQTsKKworICAgICAgICAgICAgICAgIGludGVybVtoKndpZHRoICsgd10gPSAoUiA8PCAyNCkgfCAoRyA8PCAxNikgfCAoQiA8PCA4KSB8IChBKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGZvcihoID0gMDsgaCA8IGhlaWdodDsgaCArKykgeworICAgICAgICAgICAgZm9yKHcgPSAwOyB3IDwgd2lkdGg7IHcgKyspIHsKKworICAgICAgICAgICAgICAgIGJsdXJyZWRQaXhlbFIgPSAwLjBmOworICAgICAgICAgICAgICAgIGJsdXJyZWRQaXhlbEcgPSAwLjBmOworICAgICAgICAgICAgICAgIGJsdXJyZWRQaXhlbEIgPSAwLjBmOworICAgICAgICAgICAgICAgIGJsdXJyZWRQaXhlbEEgPSAwLjBmOworICAgICAgICAgICAgICAgIGZvcihyID0gLXJhZGl1czsgciA8PSByYWRpdXM7IHIgKyspIHsKKyAgICAgICAgICAgICAgICAgICAgaW50IHZhbGlkSCA9IGggKyByOworICAgICAgICAgICAgICAgICAgICAvLyBDbGFtcCB0byB6ZXJvIGFuZCB3aWR0aAorICAgICAgICAgICAgICAgICAgICBpZih2YWxpZEggPCAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICB2YWxpZEggPSAwOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGlmKHZhbGlkSCA+IGhlaWdodCAtIDEpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHZhbGlkSCA9IGhlaWdodCAtIDE7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICBpbnQgaW5wdXQgPSBpbnRlcm1bdmFsaWRIKndpZHRoICsgd107CisKKyAgICAgICAgICAgICAgICAgICAgaW50IFIgPSAoKGlucHV0ID4+IDI0KSAmIDB4ZmYpOworICAgICAgICAgICAgICAgICAgICBpbnQgRyA9ICgoaW5wdXQgPj4gMTYpICYgMHhmZik7CisgICAgICAgICAgICAgICAgICAgIGludCBCID0gKChpbnB1dCA+PiA4KSAmIDB4ZmYpOworICAgICAgICAgICAgICAgICAgICBpbnQgQSA9IChpbnB1dCAmIDB4ZmYpOworCisgICAgICAgICAgICAgICAgICAgIGZsb2F0IHdlaWdodCA9IGdhdXNzaWFuW3IgKyByYWRpdXNdOworCisgICAgICAgICAgICAgICAgICAgIGJsdXJyZWRQaXhlbFIgKz0gKGZsb2F0KShSKSp3ZWlnaHQ7CisgICAgICAgICAgICAgICAgICAgIGJsdXJyZWRQaXhlbEcgKz0gKGZsb2F0KShHKSp3ZWlnaHQ7CisgICAgICAgICAgICAgICAgICAgIGJsdXJyZWRQaXhlbEIgKz0gKGZsb2F0KShCKSp3ZWlnaHQ7CisgICAgICAgICAgICAgICAgICAgIGJsdXJyZWRQaXhlbEEgKz0gKGZsb2F0KShBKSp3ZWlnaHQ7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgaW50IFIgPSAoaW50KWJsdXJyZWRQaXhlbFI7CisgICAgICAgICAgICAgICAgaW50IEcgPSAoaW50KWJsdXJyZWRQaXhlbEc7CisgICAgICAgICAgICAgICAgaW50IEIgPSAoaW50KWJsdXJyZWRQaXhlbEI7CisgICAgICAgICAgICAgICAgaW50IEEgPSAoaW50KWJsdXJyZWRQaXhlbEE7CisKKyAgICAgICAgICAgICAgICBvdXRbaCp3aWR0aCArIHddID0gKFIgPDwgMjQpIHwgKEcgPDwgMTYpIHwgKEIgPDwgOCkgfCAoQSk7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KIAogICAgICAgICB0ID0gamF2YS5sYW5nLlN5c3RlbS5jdXJyZW50VGltZU1pbGxpcygpIC0gdDsKKyAgICAgICAgYW5kcm9pZC51dGlsLkxvZy52KCJJbWciLCAiSmF2YSBmcmFtZSB0aW1lIG1zICIgKyB0KTsKKyAgICAgICAgbUJpdG1hcE91dC5zZXRQaXhlbHMob3V0LCAwLCB3aWR0aCwgMCwgMCwgd2lkdGgsIGhlaWdodCk7CisgICAgICAgIHJldHVybiB0OworICAgIH0KIAotICAgICAgICBhbmRyb2lkLnV0aWwuTG9nLnYoIkltZyIsICJmcmFtZSB0aW1lIG1zICIgKyB0KTsKKyAgICBwdWJsaWMgdm9pZCBvblByb2dyZXNzQ2hhbmdlZChTZWVrQmFyIHNlZWtCYXIsIGludCBwcm9ncmVzcywgYm9vbGVhbiBmcm9tVXNlcikgeworICAgICAgICBpZiAoZnJvbVVzZXIpIHsKKworICAgICAgICAgICAgaWYoc2Vla0JhciA9PSBtUmFkaXVzU2Vla0JhcikgeworICAgICAgICAgICAgICAgIGZsb2F0IGZSYWRpdXMgPSBwcm9ncmVzcyAvIDEwMC4wZjsKKyAgICAgICAgICAgICAgICBmUmFkaXVzICo9IChmbG9hdCkoTUFYX1JBRElVUyk7CisgICAgICAgICAgICAgICAgbVJhZGl1cyA9IChpbnQpZlJhZGl1czsKKworICAgICAgICAgICAgICAgIG1TY3JpcHQuc2V0X3JhZGl1cyhtUmFkaXVzKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UgaWYoc2Vla0JhciA9PSBtSW5CbGFja1NlZWtCYXIpIHsKKyAgICAgICAgICAgICAgICBtSW5CbGFjayA9IChmbG9hdClwcm9ncmVzczsKKyAgICAgICAgICAgICAgICBtU2NyaXB0VkJsdXIuaW52b2tlX3NldExldmVscyhtSW5CbGFjaywgbU91dEJsYWNrLCBtSW5XaGl0ZSwgbU91dFdoaXRlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UgaWYoc2Vla0JhciA9PSBtT3V0QmxhY2tTZWVrQmFyKSB7CisgICAgICAgICAgICAgICAgbU91dEJsYWNrID0gKGZsb2F0KXByb2dyZXNzOworICAgICAgICAgICAgICAgIG1TY3JpcHRWQmx1ci5pbnZva2Vfc2V0TGV2ZWxzKG1JbkJsYWNrLCBtT3V0QmxhY2ssIG1JbldoaXRlLCBtT3V0V2hpdGUpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZSBpZihzZWVrQmFyID09IG1JbldoaXRlU2Vla0JhcikgeworICAgICAgICAgICAgICAgIG1JbldoaXRlID0gKGZsb2F0KXByb2dyZXNzICsgMTI3LjBmOworICAgICAgICAgICAgICAgIG1TY3JpcHRWQmx1ci5pbnZva2Vfc2V0TGV2ZWxzKG1JbkJsYWNrLCBtT3V0QmxhY2ssIG1JbldoaXRlLCBtT3V0V2hpdGUpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZSBpZihzZWVrQmFyID09IG1PdXRXaGl0ZVNlZWtCYXIpIHsKKyAgICAgICAgICAgICAgICBtT3V0V2hpdGUgPSAoZmxvYXQpcHJvZ3Jlc3MgKyAxMjcuMGY7CisgICAgICAgICAgICAgICAgbVNjcmlwdFZCbHVyLmludm9rZV9zZXRMZXZlbHMobUluQmxhY2ssIG1PdXRCbGFjaywgbUluV2hpdGUsIG1PdXRXaGl0ZSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlIGlmKHNlZWtCYXIgPT0gbUdhbW1hU2Vla0JhcikgeworICAgICAgICAgICAgICAgIG1HYW1tYSA9IChmbG9hdClwcm9ncmVzcy8xMDAuMGY7CisgICAgICAgICAgICAgICAgbUdhbW1hID0gTWF0aC5tYXgobUdhbW1hLCAwLjFmKTsKKyAgICAgICAgICAgICAgICBtR2FtbWEgPSAxLjBmIC8gbUdhbW1hOworICAgICAgICAgICAgICAgIG1TY3JpcHRWQmx1ci5pbnZva2Vfc2V0R2FtbWEobUdhbW1hKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UgaWYoc2Vla0JhciA9PSBtU2F0dXJhdGlvblNlZWtCYXIpIHsKKyAgICAgICAgICAgICAgICBtU2F0dXJhdGlvbiA9IChmbG9hdClwcm9ncmVzcyAvIDUwLjBmOworICAgICAgICAgICAgICAgIG1TY3JpcHRWQmx1ci5pbnZva2Vfc2V0U2F0dXJhdGlvbihtU2F0dXJhdGlvbik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGxvbmcgdCA9IGphdmEubGFuZy5TeXN0ZW0uY3VycmVudFRpbWVNaWxsaXMoKTsKKyAgICAgICAgICAgIGlmICh0cnVlKSB7CisgICAgICAgICAgICAgICAgbVNjcmlwdC5pbnZva2VfZmlsdGVyKCk7CisgICAgICAgICAgICAgICAgbVJTLmZpbmlzaCgpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBqYXZhRmlsdGVyKCk7CisgICAgICAgICAgICAgICAgbURpc3BsYXlWaWV3LmludmFsaWRhdGUoKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgdCA9IGphdmEubGFuZy5TeXN0ZW0uY3VycmVudFRpbWVNaWxsaXMoKSAtIHQ7CisgICAgICAgICAgICBhbmRyb2lkLnV0aWwuTG9nLnYoIkltZyIsICJSZW5kZXJzY3JpcHQgZnJhbWUgdGltZSBjb3JlIG1zICIgKyB0KTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIG9uU3RhcnRUcmFja2luZ1RvdWNoKFNlZWtCYXIgc2Vla0JhcikgeworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIG9uU3RvcFRyYWNraW5nVG91Y2goU2Vla0JhciBzZWVrQmFyKSB7CiAgICAgfQogCiAgICAgQE92ZXJyaWRlCkBAIC0xMTksNDUgKzMxMSw1NCBAQAogICAgICAgICBzdXBlci5vbkNyZWF0ZShzYXZlZEluc3RhbmNlU3RhdGUpOwogICAgICAgICBzZXRDb250ZW50VmlldyhSLmxheW91dC5tYWluKTsKIAotICAgICAgICBtQml0bWFwID0gbG9hZEJ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hdGEobVBhcmFtcyk7CisgICAgICAgIG1SYWRpdXNTZWVrQmFyID0gKFNlZWtCYXIpIGZpbmRWaWV3QnlJZChSLmlkLnJhZGl1cyk7CisgICAgICAgIG1SYWRpdXNTZWVrQmFyLnNldE9uU2Vla0JhckNoYW5nZUxpc3RlbmVyKHRoaXMpOwogCi0gICAgICAgICAgICAgICAgICAgIGlmICh0cnVlKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBtSW52b2thYmxlLmV4ZWN1dGUoKTsKLSAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGphdmFGaWx0ZXIoKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIG1CaXRtYXAuc2V0UGl4ZWxzKG1PdXREYXRhLCAwLCBtUGFyYW1zLm91dFdpZHRoLCAwLCAwLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtUGFyYW1zLm91dFdpZHRoLCBtUGFyYW1zLm91dEhlaWdodCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBtRGlzcGxheVZpZXcuaW52YWxpZGF0ZSgpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQorICAgICAgICBtSW5CbGFja1NlZWtCYXIgPSAoU2Vla0JhcilmaW5kVmlld0J5SWQoUi5pZC5pbkJsYWNrKTsKKyAgICAgICAgbUluQmxhY2tTZWVrQmFyLnNldE9uU2Vla0JhckNoYW5nZUxpc3RlbmVyKHRoaXMpOworICAgICAgICBtSW5CbGFja1NlZWtCYXIuc2V0TWF4KDEyOCk7CisgICAgICAgIG1JbkJsYWNrU2Vla0Jhci5zZXRQcm9ncmVzcygwKTsKKyAgICAgICAgbU91dEJsYWNrU2Vla0JhciA9IChTZWVrQmFyKWZpbmRWaWV3QnlJZChSLmlkLm91dEJsYWNrKTsKKyAgICAgICAgbU91dEJsYWNrU2Vla0Jhci5zZXRPblNlZWtCYXJDaGFuZ2V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lnaHQgPSBtQml0bWFwLmdldEhlaWdodCgpOwotICAgICAgICBwYXJhbXMudGhyZXNob2xkID0gMC41ZjsKLSAgICAgICAgcmV0dXJuIHBhcmFtczsKKyAgICAgICAgbVNjcmlwdC5zZXRfdkJsdXJTY3JpcHQobVNjcmlwdFZCbHVyKTsKKyAgICAgICAgbVNjcmlwdC5zZXRfaEJsdXJTY3JpcHQobVNjcmlwdEhCbHVyKTsKICAgICB9CiAKICAgICBwcml2YXRlIEJpdG1hcCBsb2FkQml0bWFwKGludCByZXNvdXJjZSkgewpAQCAtMjI5LDQgKzQxNCwzMCBAQAogICAgICAgICBzb3VyY2UucmVjeWNsZSgpOwogICAgICAgICByZXR1cm4gYjsKICAgICB9CisKKyAgICAvLyBidXR0b24gaG9vaworICAgIHB1YmxpYyB2b2lkIGJlbmNobWFyayhWaWV3IHYpIHsKKyAgICAgICAgYW5kcm9pZC51dGlsLkxvZy52KCJJbWciLCAiQmVuY2htYXJraW5nIik7CisgICAgICAgIGludCBvbGRSYWRpdXMgPSBtUmFkaXVzOworICAgICAgICBtUmFkaXVzID0gTUFYX1JBRElVUzsKKyAgICAgICAgbVNjcmlwdC5zZXRfcmFkaXVzKG1SYWRpdXMpOworCisgICAgICAgIGxvbmcgdCA9IGphdmEubGFuZy5TeXN0ZW0uY3VycmVudFRpbWVNaWxsaXMoKTsKKworICAgICAgICBtU2NyaXB0Lmludm9rZV9maWx0ZXIoKTsKKyAgICAgICAgbVJTLmZpbmlzaCgpOworCisgICAgICAgIHQgPSBqYXZhLmxhbmcuU3lzdGVtLmN1cnJlbnRUaW1lTWlsbGlzKCkgLSB0OworICAgICAgICBhbmRyb2lkLnV0aWwuTG9nLnYoIkltZyIsICJSZW5kZXJzY3JpcHQgZnJhbWUgdGltZSBjb3JlIG1zICIgKyB0KTsKKworICAgICAgICAvL2xvbmcgamF2YVRpbWUgPSBqYXZhRmlsdGVyKCk7CisgICAgICAgIC8vbUJlbmNobWFya1Jlc3VsdC5zZXRUZX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1dCA9IChjb25zdCBmbG9hdDQgKilyc0dldEVsZW1lbnRBdChmcy0+YWluLCAwLCB5KTsKKworICAgIGZsb2F0MyBibHVycmVkUGl4ZWwgPSAwOworICAgIGNvbnN0IGZsb2F0ICpnUHRyID0gZnMtPmdhdXNzaWFuOworICAgIGlmICgoeCA+IGZzLT5yYWRpdXMpICYmICh4IDwgKGZzLT53aWR0aCAtIGZzLT5yYWRpdXMpKSkgeworICAgICAgICBjb25zdCBmbG9hdDQgKmkgPSBpbnB1dCArICh4IC0gZnMtPnJhZGl1cyk7CisgICAgICAgIGZvcihpbnQgciA9IC1mcy0+cmFkaXVzOyByIDw9IGZzLT5yYWRpdXM7IHIgKyspIHsKKyAgICAgICAgICAgIGJsdXJyZWRQaXhlbCArPSBpLT54eXogKiBnUHRyWzBdOworICAgICAgICAgICAgZ1B0cisrOworICAgICAgICAgICAgaSsrOworICAgICAgICB9CisgICAgfSBlbHNlIHsKKyAgICAgICAgZm9yKGludCByID0gLWZzLT5yYWRpdXM7IHIgPD0gZnMtPnJhZGl1czsgciArKykgeworICAgICAgICAgICAgLy8gU3RlcHBpbmcgbGVmdCBhbmQgcmlnaHQgYXdheSBmcm9tIHRoZSBwaXhlbAorICAgICAgICAgICAgaW50IHZhbGlkVyA9IHJzQ2xhbXAoeCArIHIsICh1aW50KTAsICh1aW50KShmcy0+d2lkdGggLSAxKSk7CisgICAgICAgICAgICBibHVycmVkUGl4ZWwgKz0gaW5wdXRbdmFsaWRXXS54eXogKiBnUHRyWzBdOworICAgICAgICAgICAgZ1B0cisrOworICAgICAgICB9CisgICAgfQorCisgICAgb3V0cHV0LT54eXogPSBibHVycmVkUGl4ZWw7Cit9CisKZGlmZiAtLWdpdCBhL2xpYnMvcnMvamF2YS9JbWFnZVByb2Nlc3Npbmcvc3JjL2NvbS9hbmRyb2lkL3JzL2ltYWdlL2lwLnJzaCBiL2xpYnMvcnMvamF2YS9JbWFnZVByb2Nlc3Npbmcvc3JjL2NvbS9hbmRyb2l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JtYWxpemVGYWN0b3IgKz0gZ2F1c3NpYW5bciArIHJhZGl1c107CisgICAgfQorCisgICAgLy9Ob3cgd2UgbmVlZCB0byBub3JtYWxpemUgdGhlIHdlaWdodHMgYmVjYXVzZSBhbGwgb3VyIGNvZWZmaWNpZW50cyBuZWVkIHRvIGFkZCB1cCB0byBvbmUKKyAgICBub3JtYWxpemVGYWN0b3IgPSAxLjBmIC8gbm9ybWFsaXplRmFjdG9yOworICAgIGZvcihyID0gLXJhZGl1czsgciA8PSByYWRpdXM7IHIgKyspIHsKKyAgICAgICAgZmxvYXRSID0gKGZsb2F0KXI7CisgICAgICAgIGdhdXNzaWFuW3IgKyByYWRpdXNdICo9IG5vcm1hbGl6ZUZhY3RvcjsKKyAgICB9Cit9CisKKworc3RhdGljIHZvaWQgY29weUlucHV0KCkgeworICAgIFJTX0RFQlVHX01BUktFUjsKKyAgICByc19hbGxvY2F0aW9uIGFpbiA9IHJzR2V0QWxsb2NhdGlvbihJblBpeGVsKTsKKyAgICB1aW50MzJfdCBkaW14ID0gcnNBbGxvY2F0aW9uR2V0RGltWChhaW4pOworICAgIHVpbnQzMl90IGRpbXkgPSByc0FsbG9jYXRpb25HZXREaW1ZKGFpbik7CisgICAgZm9yKHVpbnQzMl90IHkgPSAwOyB5IDwgZGlteTsgeSsrKSB7CisgICAgICAgIGZvcih1aW50MzJfdCB4ID0gMDsgeCA8IGRpbXg7IHgrKykgeworICAgICAgICAgICAgU2NyYXRjaFBpeGVsMVt4ICsgeSAqIGRpbXhdID0gY29udmVydF9mbG9hdDQoSW5QaXhlbFt4ICsgeSAqIGRpbXhdKTsKKyAgICAgICAgfQorICAgIH0KKyAgICBSU19ERUJVR19NQVJLRVI7Cit9CisKK3ZvaWQgZmlsdGVyKCkgeworICAgIGNvcHlJbnB1dCgpOworICAgIGNvbXB1dGVHYXVzc2lhbldlaWdodHMoKTsKKworICAgIEZpbHRlclN0cnVjdCBmczsKKyAgICBmcy5nYXVzc2lhbiA9IGdhdXN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VpZ2h0ID0gMC4yOTlmOworICAgIGZsb2F0IGdXZWlnaHQgPSAwLjU4N2Y7CisgICAgZmxvYXQgYldlaWdodCA9IDAuMTE0ZjsKKworICAgIGZsb2F0IG9uZU1pbnVzUyA9IDEuMGYgLSBzYXR1cmF0aW9uOworICAgIHJzTWF0cml4U2V0KCZjb2xvck1hdCwgMCwgMCwgb25lTWludXNTICogcldlaWdodCArIHNhdHVyYXRpb24pOworICAgIHJzTWF0cml4U2V0KCZjb2xvck1hdCwgMCwgMSwgb25lTWludXNTICogcldlaWdodCk7CisgICAgcnNNYXRyaXhTZXQoJmNvbG9yTWF0LCAwLCAyLCBvbmVNaW51c1MgKiByV2VpZ2h0KTsKKyAgICByc01hdHJpeFNldCgmY29sb3JNYXQsIDEsIDAsIG9uZU1pbnVzUyAqIGdXZWlnaHQpOworICAgIHJzTWF0cml4U2V0KCZjb2xvck1hdCwgMSwgMSwgb25lTWludXNTICogZ1dlaWdodCArIHNhdHVyYXRpb24pOworICAgIHJzTWF0cml4U2V0KCZjb2xvck1hdCwgMSwgMiwgb25lTWludXNTICogZ1dlaWdodCk7CisgICAgcnNNYXRyaXhTZXQoJmNvbG9yTWF0LCAyLCAwLCBvbmVNaW51c1MgKiBiV2VpZ2h0KTsKKyAgICByc01hdHJpeFNldCgmY29sb3JNYXQsIDIsIDEsIG9uZU1pbnVzUyAqIGJXZWlnaHQpOworICAgIHJzTWF0cml4U2V0KCZjb2xvck1hdCwgMiwgMiwgb25lTWludXNTICogYldlaWdodCArIHNhdHVyYXRpb24pOworfQorCit2b2lkIHNldEdhbW1hKGZsb2F0IGcpIHsKKyAgICBnYW1tYSA9IChmbG9hdDMpZzsKK30KKwordm9pZCByb290KGNvbnN0IHZvaWQgKnZfaW4sIHZvaWQgKnZfb3V0LCBjb25zdCB2b2lkICp1c3JEYXRhLCB1aW50MzJfdCB4LCB1aW50MzJfdCB5KSB7CisgICAgdWNoYXI0ICpvdXRwdXQgPSAodWNoYXI0ICopdl9vdXQ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yU2NyaXB0R0wgbVJTOworICAgIHByaXZhdGUgU2FtcGxlciBtU2FtcGxlcjsKKyAgICBwcml2YXRlIFByb2dyYW1TdG9yZSBtUFNCYWNrZ3JvdW5kOworICAgIHByaXZhdGUgUHJvZ3JhbUZyYWdtZW50IG1QRkJhY2tncm91bmQ7CisgICAgcHJpdmF0ZSBQcm9ncmFtVmVydGV4IG1QVkJhY2tncm91bmQ7CisgICAgcHJpdmF0ZSBQcm9ncmFtVmVydGV4Lk1hdHJpeEFsbG9jYXRpb24gbVBWQTsKKworICAgIHByaXZhdGUgQWxsb2NhdGlvbiBtR3JpZEltYWdlOworICAgIHByaXZhdGUgQWxsb2NhdGlvbiBtQWxsb2NQVjsKKworICAgIHByaXZhdGUgTWVzaCBtTWVzaDsKKworICAgIHByaXZhdGUgRm9udCBtSXRhbGljOworICAgIHByaXZhdGUgQWxsb2NhdGlvbiBtVGV4dEFsbG9jOworCisgICAgcHJpdmF0ZSBTY3JpcHRDX1NjZW5lZ3JhcGggbVNjcmlwdDsKKyAgICBwcml2YXRlIFNjcmlwdENfVHJhbnNmb3JtIG1UcmFuc2Zvcm1TY3JpcHQ7CisKKyAgICBpbnQgbUxhc3RYOworICAgIGludCBtTGFzdFk7CisKKyAgICBwdWJsaWMgdm9pZCB0b3VjaEV2ZW50KGludCB4LCBpbnQgeSkgeworICAgICAgICBpbnQgZHggPSBtTGFzdFggLSB4OworICAgICAgICBpZihNYXRoLmFicyhkeCkgPiA1MCB8fCBNYXRoLmFicyhkeCkgPCAzKSB7CisgICAgICAgICAgICBkeCA9IDA7CisgICAgICAgIH0KKworICAgICAgICBtUm90YXRpb24gLT0gZHg7CisgICAgICAgIGlmKG1Sb3RhdGlvbiA+IDM2MCkgeworICAgICAgICAgICAgbVJvdGF0aW9uIC09IDM2MDsKKyAgICAgICAgfQorICAgICAgICBpZihtUm90YXRpb24gPCAwKSB7CisgICAgICAgICAgICBtUm90YXRpb24gKz0gMzYwOworICAgICAgICB9CisKKyAgICAg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VRyYW5zZm9ybVNjcmlwdCk7CisKKyAgICAgICAgbVNjcmlwdC5zZXRfZ1RyYW5zZm9ybVJTKG1UcmFuc2Zvcm1TY3JpcHQpOworCisgICAgICAgIGluaXRQRlMoKTsKKyAgICAgICAgaW5pdFBGKCk7CisgICAgICAgIGluaXRQVigpOworCisgICAgICAgIGxvYWRJbWFnZSgpOworCisgICAgICAgIEZpbGVBM0QgbW9kZWwgPSBGaWxlQTNELmNyZWF0ZUZyb21SZXNvdXJjZShtUlMsIG1SZXMsIFIucmF3LnJvYm90KTsKKyAgICAgICAgRmlsZUEzRC5JbmRleEVudHJ5IGVudHJ5ID0gbW9kZWwuZ2V0SW5kZXhFbnRyeSgwKTsKKyAgICAgICAgaWYoZW50cnkgPT0gbnVsbCB8fCBlbnRyeS5nZXRDbGFzc0lEKCkgIT0gRmlsZUEzRC5DbGFzc0lELk1FU0gpIHsKKyAgICAgICAgICAgIExvZy5lKCJycyIsICJjb3VsZCBub3QgbG9hZCBtb2RlbCIpOworICAgICAgICB9CisgICAgICAgIGVsc2UgeworICAgICAgICAgICAgbU1lc2ggPSAoTWVzaCllbnRyeS5nZXRPYmplY3QoKTsKKyAgICAgICAgICAgIG1TY3JpcHQuc2V0X2dUZXN0TWVzaChtTWVzaCk7CisgICAgICAgIH0KKworICAgICAgICBtSXRhbGljID0gRm9udC5jcmVhdGUobVJTLCBtUmVzLCAiRHJvaWRTZXJpZi1JdGFsaWMudHRmIiwgOCk7CisgICAgICAgIG1TY3JpcHQuc2V0X2dJdGFsaWMobUl0YWxpYyk7CisKKyAgICAgICAgaW5pdFRleHRBbGxvY2F0aW9uKCk7CisKKyAgICAgICAgaW5pdFRyYW5zZm9ybUhpZXJhcmNoeSgpOworCisgICAgICAgIExvZy52KCI9PT09PT09PVNjZW5lR3JhcGg9PT09PT09PSIsICJ0cmFuc2Zvcm0gaGllcmFyY2h5IGluaXRpYWxpemVkIik7CisKKyAgICAgICAgbVNjcmlwdC5iaW5kX2dSb290Tm9k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m9ybWF0LCB3LCBoKTsKKyAgICAgICAgaWYgKG1SUyA9PSBudWxsKSB7CisgICAgICAgICAgICBtUlMgPSBjcmVhdGVSZW5kZXJTY3JpcHQodHJ1ZSk7CisgICAgICAgICAgICBtUlMuY29udGV4dFNldFN1cmZhY2UodywgaCwgaG9sZGVyLmdldFN1cmZhY2UoKSk7CisgICAgICAgICAgICBtUmVuZGVyID0gbmV3IFNjZW5lR3JhcGhSUygpOworICAgICAgICAgICAgbVJlbmRlci5pbml0KG1SUywgZ2V0UmVzb3VyY2VzKCksIHcsIGgpOworICAgICAgICB9CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHJvdGVjdGVkIHZvaWQgb25EZXRhY2hlZEZyb21XaW5kb3coKSB7CisgICAgICAgIGlmKG1SUyAhPSBudWxsKSB7CisgICAgICAgICAgICBtUlMgPSBudWxsOworICAgICAgICAgICAgZGVzdHJveVJlbmRlclNjcmlwdCgpOworICAgICAgICB9CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIGJvb2xlYW4gb25LZXlEb3duKGludCBrZXlDb2RlLCBLZXlFdmVudCBldmVudCkKKyAgICB7CisgICAgICAgIC8vIGJyZWFrIHBvaW50IGF0IGhlcmUKKyAgICAgICAgLy8gdGhpcyBtZXRob2QgZG9lc24ndCB3b3JrIHdoZW4gJ2V4dGVuZHMgVmlldycgaW5jbHVkZSAnZXh0ZW5kcyBTY3JvbGxWaWV3Jy4KKyAgICAgICAgcmV0dXJuIHN1cGVyLm9uS2V5RG93bihrZXlDb2RlLCBldmVudCk7CisgICAgfQorCisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgYm9vbGVhbiBvblRvdWNoRXZlbnQoTW90aW9uRXZlbnQgZXYpCisgICAgeworICAgICAgICBib29sZWFuIHJldCA9IHRydWU7CisgICAgICAgIGludCBhY3QgPSBldi5nZXRBY3Rpb24oKTsKKyAgICAgICAgaWYgKGFjdCA9PSBldi5BQ1RJT05fVVApIHs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GUgU2FtcGxlciBtU2FtcGxlcjsKKyAgICBwcml2YXRlIFByb2dyYW1TdG9yZSBtUFNCYWNrZ3JvdW5kOworICAgIHByaXZhdGUgUHJvZ3JhbUZyYWdtZW50IG1QRkJhY2tncm91bmQ7CisgICAgcHJpdmF0ZSBQcm9ncmFtVmVydGV4IG1QVkJhY2tncm91bmQ7CisgICAgcHJpdmF0ZSBQcm9ncmFtVmVydGV4Lk1hdHJpeEFsbG9jYXRpb24gbVBWQTsKKworICAgIHByaXZhdGUgQWxsb2NhdGlvbiBtR3JpZEltYWdlOworICAgIHByaXZhdGUgQWxsb2NhdGlvbiBtQWxsb2NQVjsKKworICAgIHByaXZhdGUgTWVzaCBtTWVzaDsKKworICAgIHByaXZhdGUgRm9udCBtSXRhbGljOworICAgIHByaXZhdGUgQWxsb2NhdGlvbiBtVGV4dEFsbG9jOworCisgICAgcHJpdmF0ZSBTY3JpcHRDX1NpbXBsZW1vZGVsIG1TY3JpcHQ7CisKKyAgICBpbnQgbUxhc3RYOworICAgIGludCBtTGFzdFk7CisKKyAgICBwdWJsaWMgdm9pZCB0b3VjaEV2ZW50KGludCB4LCBpbnQgeSkgeworICAgICAgICBpbnQgZHggPSBtTGFzdFggLSB4OworICAgICAgICBpZihNYXRoLmFicyhkeCkgPiA1MCB8fCBNYXRoLmFicyhkeCkgPCAzKSB7CisgICAgICAgICAgICBkeCA9IDA7CisgICAgICAgIH0KKworICAgICAgICBtUm90YXRpb24gLT0gZHg7CisgICAgICAgIGlmKG1Sb3RhdGlvbiA+IDM2MCkgeworICAgICAgICAgICAgbVJvdGF0aW9uIC09IDM2MDsKKyAgICAgICAgfQorICAgICAgICBpZihtUm90YXRpb24gPCAwKSB7CisgICAgICAgICAgICBtUm90YXRpb24gKz0gMzYwOworICAgICAgICB9CisKKyAgICAgICAgbVNjcmlwdC5zZXRfZ1JvdGF0ZSgoZmxvYXQpbVJvdGF0aW9uKTsKKworICAgICAgICBtTGFzdFggPSB4OworICAgICAgICBtTG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yhtUlMsIGFsbG9jU3RyaW5nKTsKKyAgICAgICAgbVNjcmlwdC5zZXRfZ1RleHRBbGxvYyhtVGV4dEFsbG9jKTsKKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgaW5pdFJTKCkgeworCisgICAgICAgIG1TY3JpcHQgPSBuZXcgU2NyaXB0Q19TaW1wbGVtb2RlbChtUlMsIG1SZXMsIFIucmF3LnNpbXBsZW1vZGVsLCB0cnVlKTsKKworICAgICAgICBpbml0UEZTKCk7CisgICAgICAgIGluaXRQRigpOworICAgICAgICBpbml0UFYoKTsKKworICAgICAgICBsb2FkSW1hZ2UoKTsKKworICAgICAgICBGaWxlQTNEIG1vZGVsID0gRmlsZUEzRC5jcmVhdGVGcm9tUmVzb3VyY2UobVJTLCBtUmVzLCBSLnJhdy5yb2JvdCk7CisgICAgICAgIEZpbGVBM0QuSW5kZXhFbnRyeSBlbnRyeSA9IG1vZGVsLmdldEluZGV4RW50cnkoMCk7CisgICAgICAgIGlmKGVudHJ5ID09IG51bGwgfHwgZW50cnkuZ2V0Q2xhc3NJRCgpICE9IEZpbGVBM0QuQ2xhc3NJRC5NRVNIKSB7CisgICAgICAgICAgICBMb2cuZSgicnMiLCAiY291bGQgbm90IGxvYWQgbW9kZWwiKTsKKyAgICAgICAgfQorICAgICAgICBlbHNlIHsKKyAgICAgICAgICAgIG1NZXNoID0gKE1lc2gpZW50cnkuZ2V0T2JqZWN0KCk7CisgICAgICAgICAgICBtU2NyaXB0LnNldF9nVGVzdE1lc2gobU1lc2gpOworICAgICAgICB9CisKKyAgICAgICAgbUl0YWxpYyA9IEZvbnQuY3JlYXRlKG1SUywgbVJlcywgIkRyb2lkU2VyaWYtSXRhbGljLnR0ZiIsIDgpOworICAgICAgICBtU2NyaXB0LnNldF9nSXRhbGljKG1JdGFsaWMpOworCisgICAgICAgIGluaXRUZXh0QWxsb2NhdGlvbigpOworCisgICAgICAgIG1SUy5jb250ZXh0QmluZFJvb3RTY3JpcHQobVNjcmlwdC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AgICAgICAgICBtUlMgPSBudWxsOworICAgICAgICAgICAgZGVzdHJveVJlbmRlclNjcmlwdCgpOworICAgICAgICB9CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIGJvb2xlYW4gb25LZXlEb3duKGludCBrZXlDb2RlLCBLZXlFdmVudCBldmVudCkKKyAgICB7CisgICAgICAgIC8vIGJyZWFrIHBvaW50IGF0IGhlcmUKKyAgICAgICAgLy8gdGhpcyBtZXRob2QgZG9lc24ndCB3b3JrIHdoZW4gJ2V4dGVuZHMgVmlldycgaW5jbHVkZSAnZXh0ZW5kcyBTY3JvbGxWaWV3Jy4KKyAgICAgICAgcmV0dXJuIHN1cGVyLm9uS2V5RG93bihrZXlDb2RlLCBldmVudCk7CisgICAgfQorCisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgYm9vbGVhbiBvblRvdWNoRXZlbnQoTW90aW9uRXZlbnQgZXYpCisgICAgeworICAgICAgICBib29sZWFuIHJldCA9IHRydWU7CisgICAgICAgIGludCBhY3QgPSBldi5nZXRBY3Rpb24oKTsKKyAgICAgICAgaWYgKGFjdCA9PSBldi5BQ1RJT05fVVApIHsKKyAgICAgICAgICAgIHJldCA9IGZhbHNlOworICAgICAgICB9CisKKyAgICAgICAgbVJlbmRlci50b3VjaEV2ZW50KChpbnQpZXYuZ2V0WCgpLCAoaW50KWV2LmdldFkoKSk7CisgICAgICAgIHJldHVybiByZXQ7CisgICAgfQorfQorCisKZGlmZiAtLWdpdCBhL2xpYnMvcnMvamF2YS9Nb2RlbFZpZXdlci9zcmMvY29tL2FuZHJvaWQvbW9kZWx2aWV3ZXIvc2NlbmVncmFwaC5ycyBiL2xpYnMvcnMvamF2YS9Nb2RlbFZpZXdlci9zcmMvY29tL2FuZHJvaWQvbW9kZWx2aWV3ZXIvc2NlbmVncmFwaC5ycwpuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi5jZTZiYjFlCi0tLSAvZGV2L251bGw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7CisKKyAgICBwdWJsaWMgdm9pZCBvbkFjdGlvbkRvd24oaW50IHgsIGludCB5KSB7CisgICAgICAgIG1TY3JpcHQuc2V0X2dEWSgwLjBmKTsKKworICAgICAgICBtTGFzdFggPSB4OworICAgICAgICBtTGFzdFkgPSB5OworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIG9uQWN0aW9uTW92ZShpbnQgeCwgaW50IHkpIHsKKyAgICAgICAgaW50IGR4ID0gbUxhc3RYIC0geDsKKyAgICAgICAgaW50IGR5ID0gbUxhc3RZIC0geTsKKworICAgICAgICBpZihNYXRoLmFicyhkeSkgPD0gMikgeworICAgICAgICAgICAgZHkgPSAwOworICAgICAgICB9CisKKyAgICAgICAgbVNjcmlwdC5zZXRfZ0RZKGR5KTsKKworICAgICAgICBtTGFzdFggPSB4OworICAgICAgICBtTGFzdFkgPSB5OworICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBpbml0UlMoKSB7CisKKyAgICAgICAgbVNjcmlwdCA9IG5ldyBTY3JpcHRDX1JzbGlzdChtUlMsIG1SZXMsIFIucmF3LnJzbGlzdCwgdHJ1ZSk7CisKKyAgICAgICAgbUxpc3RBbGxvY3MgPSBuZXcgU2NyaXB0RmllbGRfTGlzdEFsbG9jc19zKG1SUywgREFUQV9MSVNULmxlbmd0aCk7CisgICAgICAgIGZvcihpbnQgaSA9IDA7IGkgPCBEQVRBX0xJU1QubGVuZ3RoOyBpICsrKSB7CisgICAgICAgICAgICBTY3JpcHRGaWVsZF9MaXN0QWxsb2NzX3MuSXRlbSBsaXN0RWxlbSA9IG5ldyBTY3JpcHRGaWVsZF9MaXN0QWxsb2NzX3MuSXRlbSgpOworICAgICAgICAgICAgbGlzdEVsZW0udGV4dCA9IEFsbG9jYXRpb24uY3JlYXRlRnJvbVN0cmluZyhtUlMsIERBVEFfTElTVFtpXSk7CisgICAgICAgICAgICBtTGlzdEFsbG9jcy5zZXQobGlzdEVsZW0sIGksIGZhbHNlKTsKKyAgICAgICAgfQorC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UlMoKTsKKyAgICAgICAgICAgIG1SZW5kZXIuaW5pdChtUlMsIGdldFJlc291cmNlcygpLCB3LCBoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHByb3RlY3RlZCB2b2lkIG9uRGV0YWNoZWRGcm9tV2luZG93KCkgeworICAgICAgICBpZihtUlMgIT0gbnVsbCkgeworICAgICAgICAgICAgbVJTID0gbnVsbDsKKyAgICAgICAgICAgIGRlc3Ryb3lSZW5kZXJTY3JpcHQoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyBib29sZWFuIG9uS2V5RG93bihpbnQga2V5Q29kZSwgS2V5RXZlbnQgZXZlbnQpCisgICAgeworICAgICAgICAvLyBicmVhayBwb2ludCBhdCBoZXJlCisgICAgICAgIC8vIHRoaXMgbWV0aG9kIGRvZXNuJ3Qgd29yayB3aGVuICdleHRlbmRzIFZpZXcnIGluY2x1ZGUgJ2V4dGVuZHMgU2Nyb2xsVmlldycuCisgICAgICAgIHJldHVybiBzdXBlci5vbktleURvd24oa2V5Q29kZSwgZXZlbnQpOworICAgIH0KKworCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIGJvb2xlYW4gb25Ub3VjaEV2ZW50KE1vdGlvbkV2ZW50IGV2KQorICAgIHsKKyAgICAgICAgYm9vbGVhbiByZXQgPSBmYWxzZTsKKyAgICAgICAgaW50IGFjdCA9IGV2LmdldEFjdGlvbigpOworICAgICAgICBpZiAoYWN0ID09IGV2LkFDVElPTl9ET1dOKSB7CisgICAgICAgICAgICBtUmVuZGVyLm9uQWN0aW9uRG93bigoaW50KWV2LmdldFgoKSwgKGludClldi5nZXRZKCkpOworICAgICAgICAgICAgcmV0ID0gdHJ1ZTsKKyAgICAgICAgfQorICAgICAgICBlbHNlIGlmIChhY3QgPT0gZXYuQUNUSU9OX01PVkUpIHsKKyAgICAgICAgICAgIG1SZW5kZXIub25BY3Rpb25Nb3ZlKChpbnQpZ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WF4TW9kZXM7CisKKyAgICBwdWJsaWMgdm9pZCBvbkFjdGlvbkRvd24oaW50IHgsIGludCB5KSB7CisgICAgICAgIG1Nb2RlICsrOworICAgICAgICBtTW9kZSA9IG1Nb2RlICUgbU1heE1vZGVzOworICAgICAgICBtU2NyaXB0LnNldF9nRGlzcGxheU1vZGUobU1vZGUpOworICAgIH0KKworICAgIHByaXZhdGUgTWVzaCBnZXRNYnlOTWVzaChmbG9hdCB3aWR0aCwgZmxvYXQgaGVpZ2h0LCBpbnQgd1Jlc29sdXRpb24sIGludCBoUmVzb2x1dGlvbikgeworCisgICAgICAgIE1lc2guVHJpYW5nbGVNZXNoQnVpbGRlciB0bWIgPSBuZXcgTWVzaC5UcmlhbmdsZU1lc2hCdWlsZGVyKG1SUywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAyLCBNZXNoLlRyaWFuZ2xlTWVzaEJ1aWxkZXIuVEVYVFVSRV8wKTsKKworICAgICAgICBmb3IgKGludCB5ID0gMDsgeSA8PSBoUmVzb2x1dGlvbjsgeSsrKSB7CisgICAgICAgICAgICBmaW5hbCBmbG9hdCBub3JtYWxpemVkWSA9IChmbG9hdCl5IC8gaFJlc29sdXRpb247CisgICAgICAgICAgICBmaW5hbCBmbG9hdCB5T2Zmc2V0ID0gKG5vcm1hbGl6ZWRZIC0gMC41ZikgKiBoZWlnaHQ7CisgICAgICAgICAgICBmb3IgKGludCB4ID0gMDsgeCA8PSB3UmVzb2x1dGlvbjsgeCsrKSB7CisgICAgICAgICAgICAgICAgZmxvYXQgbm9ybWFsaXplZFggPSAoZmxvYXQpeCAvIHdSZXNvbHV0aW9uOworICAgICAgICAgICAgICAgIGZsb2F0IHhPZmZzZXQgPSAobm9ybWFsaXplZFggLSAwLjVmKSAqIHdpZHRoOworICAgICAgICAgICAgICAgIHRtYi5zZXRUZXh0dXJlKG5vcm1hbGl6ZWRYLCBub3JtYWxpemVkWSk7CisgICAgICAgICAgICAgICAgdG1iLmFkZFZlcnRleCh4T2Zmc2V0LCB5T2Zmc2V0KTsKKyAgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBmb3IgKGludCB5ID0gMDsgeSA8IGhSZXNvbHV0aW9uOyB5KyspIHsKKyAgICAgICAgICAgIGZpbmFsIGludCBjdXJZID0geSAqICh3UmVzb2x1dGlvbiArIDEpOworICAgICAgICAgICAgZmluYWwgaW50IGJlbG93WSA9ICh5ICsgMSkgKiAod1Jlc29sdXRpb24gKyAxKTsKKyAgICAgICAgICAgIGZvciAoaW50IHggPSAwOyB4IDwgd1Jlc29sdXRpb247IHgrKykgeworICAgICAgICAgICAgICAgIGludCBjdXJWID0gY3VyWSArIHg7CisgICAgICAgICAgICAgICAgaW50IGJlbG93ViA9IGJlbG93WSArIHg7CisgICAgICAgICAgICAgICAgdG1iLmFkZFRyaWFuZ2xlKGN1clYsIGJlbG93ViwgY3VyViArIDEpOworICAgICAgICAgICAgICAgIHRtYi5hZGRUcmlhbmdsZShiZWxvd1YsIGJlbG93ViArIDEsIGN1clYgKyAxKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiB0bWIuY3JlYXRlKHRydWUpOworICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBpbml0UHJvZ3JhbVN0b3JlKCkgeworICAgICAgICAvLyBVc2Ugc3RvY2sgdGhlIHN0b2NrIHByb2dyYW0gc3RvcmUgb2JqZWN0CisgICAgICAgIG1Qcm9nU3RvcmVCbGVuZE5vbmVEZXB0aCA9IFByb2dyYW1TdG9yZS5CTEVORF9OT05FX0RFUFRIX1RFU1QobVJTKTsKKyAgICAgICAgbVByb2dTdG9yZUJsZW5kTm9uZSA9IFByb2dyYW1TdG9yZS5CTEVORF9OT05FX0RFUFRIX05PX0RFUFRIKG1SUyk7CisKKyAgICAgICAgLy8gQ3JlYXRlIGEgY3VzdG9tIHByb2dyYW0gc3RvcmUKKyAgICAgICAgUHJvZ3JhbVN0b3JlLkJ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250U2VyaWZCb2xkSXRhbGljID0gRm9udC5jcmVhdGVGcm9tRmFtaWx5KG1SUywgbVJlcywgInNlcmlmIiwgRm9udC5TdHlsZS5CT0xEX0lUQUxJQywgOCk7CisgICAgICAgIG1Gb250TW9ubyA9IEZvbnQuY3JlYXRlRnJvbUZhbWlseShtUlMsIG1SZXMsICJtb25vIiwgRm9udC5TdHlsZS5OT1JNQUwsIDgpOworCisgICAgICAgIG1TY3JpcHQuc2V0X2dGb250U2FucyhtRm9udFNhbnMpOworICAgICAgICBtU2NyaXB0LnNldF9nRm9udFNlcmlmKG1Gb250U2VyaWYpOworICAgICAgICBtU2NyaXB0LnNldF9nRm9udFNlcmlmQm9sZChtRm9udFNlcmlmQm9sZCk7CisgICAgICAgIG1TY3JpcHQuc2V0X2dGb250U2VyaWZJdGFsaWMobUZvbnRTZXJpZkl0YWxpYyk7CisgICAgICAgIG1TY3JpcHQuc2V0X2dGb250U2VyaWZCb2xkSXRhbGljKG1Gb250U2VyaWZCb2xkSXRhbGljKTsKKyAgICAgICAgbVNjcmlwdC5zZXRfZ0ZvbnRNb25vKG1Gb250TW9ubyk7CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIGluaXRNZXNoKCkgeworICAgICAgICBtTWJ5Tk1lc2ggPSBnZXRNYnlOTWVzaCgyNTYsIDI1NiwgMTAsIDEwKTsKKyAgICAgICAgbVNjcmlwdC5zZXRfZ01ieU5NZXNoKG1NYnlOTWVzaCk7CisKKyAgICAgICAgRmlsZUEzRCBtb2RlbCA9IEZpbGVBM0QuY3JlYXRlRnJvbVJlc291cmNlKG1SUywgbVJlcywgUi5yYXcudG9ydXMpOworICAgICAgICBGaWxlQTNELkluZGV4RW50cnkgZW50cnkgPSBtb2RlbC5nZXRJbmRleEVudHJ5KDApOworICAgICAgICBpZihlbnRyeSA9PSBudWxsIHx8IGVudHJ5LmdldENsYXNzSUQoKSAhPSBGaWxlQTNELkNsYXNzSUQuTUVTSCkgeworICAgICAgICAgICAgTG9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nRleHQgY29udGV4dCkgeworICAgICAgICBzdXBlcihjb250ZXh0KTsKKyAgICAgICAgLy9zZXRGb2N1c2FibGUodHJ1ZSk7CisgICAgfQorCisgICAgcHJpdmF0ZSBSZW5kZXJTY3JpcHRHTCBtUlM7CisgICAgcHJpdmF0ZSBSc1JlbmRlclN0YXRlc1JTIG1SZW5kZXI7CisKKworICAgIHB1YmxpYyB2b2lkIHN1cmZhY2VDaGFuZ2VkKFN1cmZhY2VIb2xkZXIgaG9sZGVyLCBpbnQgZm9ybWF0LCBpbnQgdywgaW50IGgpIHsKKyAgICAgICAgc3VwZXIuc3VyZmFjZUNoYW5nZWQoaG9sZGVyLCBmb3JtYXQsIHcsIGgpOworICAgICAgICBpZiAobVJTID09IG51bGwpIHsKKyAgICAgICAgICAgIG1SUyA9IGNyZWF0ZVJlbmRlclNjcmlwdCh0cnVlKTsKKyAgICAgICAgICAgIG1SUy5jb250ZXh0U2V0U3VyZmFjZSh3LCBoLCBob2xkZXIuZ2V0U3VyZmFjZSgpKTsKKyAgICAgICAgICAgIG1SZW5kZXIgPSBuZXcgUnNSZW5kZXJTdGF0ZXNSUygpOworICAgICAgICAgICAgbVJlbmRlci5pbml0KG1SUywgZ2V0UmVzb3VyY2VzKCksIHcsIGgpOworICAgICAgICB9CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHJvdGVjdGVkIHZvaWQgb25EZXRhY2hlZEZyb21XaW5kb3coKSB7CisgICAgICAgIGlmKG1SUyAhPSBudWxsKSB7CisgICAgICAgICAgICBtUlMgPSBudWxsOworICAgICAgICAgICAgZGVzdHJveVJlbmRlclNjcmlwdCgpOworICAgICAgICB9CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIGJvb2xlYW4gb25LZXlEb3duKGludCBrZXlDb2RlLCBLZXlFdmVudCBldmVudCkKKyAgICB7CisgICAgICAgIC8vIGJyZWFrIHBvaW50IGF0IGhlcmUKKyAgICAgICAgLy8gdGhpcyBtZXRob2Qg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0gMC4wZjsKK30KKworaW50IHRleHRQb3MgPSAwOworCitpbnQgcm9vdChpbnQgbGF1bmNoSUQpIHsKKworICAgIHJzZ0NsZWFyQ29sb3IoMC4wZiwgMC4wZiwgMC4wZiwgMC4wZik7CisgICAgcnNnQ2xlYXJEZXB0aCgxLjBmKTsKKworICAgIHRleHRQb3MgLT0gKGludClnRFkqMjsKKyAgICBnRFkgKj0gMC45NTsKKworICAgIHJzZ0ZvbnRDb2xvcigwLjlmLCAwLjlmLCAwLjlmLCAxLjBmKTsKKyAgICByc2dCaW5kRm9udChnSXRhbGljKTsKKyAgICBjb2xvcigwLjIsIDAuMiwgMC4yLCAwKTsKKworICAgIHJzX2FsbG9jYXRpb24gbGlzdEFsbG9jID0gcnNHZXRBbGxvY2F0aW9uKGdMaXN0KTsKKyAgICBpbnQgYWxsb2NTaXplID0gcnNBbGxvY2F0aW9uR2V0RGltWChsaXN0QWxsb2MpOworCisgICAgaW50IHdpZHRoID0gcnNnR2V0V2lkdGgoKTsKKyAgICBpbnQgaGVpZ2h0ID0gcnNnR2V0SGVpZ2h0KCk7CisKKyAgICBpbnQgaXRlbUhlaWdodCA9IDgwOworICAgIGludCBjdXJyZW50WVBvcyA9IGl0ZW1IZWlnaHQgKyB0ZXh0UG9zOworCisgICAgZm9yKGludCBpID0gMDsgaSA8IGFsbG9jU2l6ZTsgaSArKykgeworICAgICAgICBpZihjdXJyZW50WVBvcyAtIGl0ZW1IZWlnaHQgPiBoZWlnaHQpIHsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisKKyAgICAgICAgaWYoY3VycmVudFlQb3MgPiAwKSB7CisgICAgICAgICAgICByc2dEcmF3UmVjdCgwLCBjdXJyZW50WVBvcyAtIDEsIHdpZHRoLCBjdXJyZW50WVBvcywgMCk7CisgICAgICAgICAgICByc2dEcmF3VGV4dChnTGlzdFtpXS50ZXh0LCAzMCwgY3VycmVudFlQb3MgLSAzMik7CisgICAgICAgIH0KKyAgICAgICAgY3VycmV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gICAgICAgICAgICAwLjFmKmlQbHVzT25lLCAwLjJmKmlQbHVzT25lLCAwLjNmKmlQbHVzT25lLCAxKTsKKyAgICAgICAgZmxvYXQgeVBvcyA9IDE1MCAqIChmbG9hdClpOworICAgICAgICByc2dEcmF3UmVjdCgwLCB5UG9zLCAyMDAsIHlQb3MgKyAyMDAsIDApOworICAgIH0KKworICAgIHJzZ0JpbmRQcm9ncmFtU3RvcmUoZ1Byb2dTdG9yZUJsZW5kQWxwaGEpOworICAgIGZvcihpID0gMDsgaSA8IDM7IGkgKyspIHsKKyAgICAgICAgZmxvYXQgaVBsdXNPbmUgPSAoZmxvYXQpKGkgKyAxKTsKKyAgICAgICAgcnNnUHJvZ3JhbUZyYWdtZW50Q29uc3RhbnRDb2xvcihnUHJvZ0ZyYWdtZW50Q29sb3IsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4yZippUGx1c09uZSwgMC4zZippUGx1c09uZSwgMC4xZippUGx1c09uZSwgMC41KTsKKyAgICAgICAgZmxvYXQgeVBvcyA9IDE1MCAqIChmbG9hdClpOworICAgICAgICByc2dEcmF3UmVjdCgxNTAsIHlQb3MsIDM1MCwgeVBvcyArIDIwMCwgMCk7CisgICAgfQorCisgICAgcnNnQmluZFByb2dyYW1TdG9yZShnUHJvZ1N0b3JlQmxlbmRBZGQpOworICAgIGZvcihpID0gMDsgaSA8IDM7IGkgKyspIHsKKyAgICAgICAgZmxvYXQgaVBsdXNPbmUgPSAoZmxvYXQpKGkgKyAxKTsKKyAgICAgICAgcnNnUHJvZ3JhbUZyYWdtZW50Q29uc3RhbnRDb2xvcihnUHJvZ0ZyYWdtZW50Q29sb3IsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMC4zZippUGx1c09uZSwgMC4xZippUGx1c09uZSwgMC4yZippUGx1c09uZSwgMC41KTsKKyAgICAgICAgZmxvYXQgeVBvcyA9IDE1MCAqIChmbG9hdClpOworICAgICAgICByc2dEc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zdXBlci5zdXJmYWNlQ2hhbmdlZChob2xkZXIsIGZvcm1hdCwgdywgaCk7CisgICAgICAgIGlmIChtUlMgPT0gbnVsbCkgeworICAgICAgICAgICAgbVJTID0gY3JlYXRlUmVuZGVyU2NyaXB0KGZhbHNlKTsKKyAgICAgICAgICAgIG1SUy5jb250ZXh0U2V0U3VyZmFjZSh3LCBoLCBob2xkZXIuZ2V0U3VyZmFjZSgpKTsKKyAgICAgICAgICAgIG1SZW5kZXIgPSBuZXcgUlNUZXN0Q29yZSgpOworICAgICAgICAgICAgbVJlbmRlci5pbml0KG1SUywgZ2V0UmVzb3VyY2VzKCksIHcsIGgpOworICAgICAgICB9CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHJvdGVjdGVkIHZvaWQgb25EZXRhY2hlZEZyb21XaW5kb3coKSB7CisgICAgICAgIGlmKG1SUyAhPSBudWxsKSB7CisgICAgICAgICAgICBtUlMgPSBudWxsOworICAgICAgICAgICAgZGVzdHJveVJlbmRlclNjcmlwdCgpOworICAgICAgICB9CisgICAgfQorCisvKgorICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyBib29sZWFuIG9uVG91Y2hFdmVudChNb3Rpb25FdmVudCBldikKKyAgICB7CisgICAgICAgIGludCBhY3QgPSBldi5nZXRBY3Rpb25NYXNrZWQoKTsKKyAgICAgICAgaWYgKGFjdCA9PSBldi5BQ1RJT05fVVApIHsKKyAgICAgICAgICAgIG1SZW5kZXIubmV3VG91Y2hQb3NpdGlvbigwLCAwLCAwLCBldi5nZXRQb2ludGVySWQoMCkpOworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9IGVsc2UgaWYgKGFjdCA9PSBNb3Rpb25FdmVudC5BQ1RJT05fUE9JTlRFUl9VUCkgeworICAgICAgICAgICAgLy8gb25seSBvbmUgcG9pbnRlciBnb2luZyB1cCwgd2UgY2FuIGdldCB0aGUgaW5kZXggbGlrZSB0aGlzCisgICAgICAgICAgICBpbnQgcG9pbnRlckluZGV4ID0gZXYuZ2V0QWN0aW9uSW5kZXgoKTsKKyAgICAgICAgICAgIGludCBwb2ludGVySWQgPSBldi5nZXRQb2ludGVySWQocG9pbnRlckluZGV4KTsKKyAgICAgICAgICAgIG1SZW5kZXIubmV3VG91Y2hQb3NpdGlvbigwLCAwLCAwLCBwb2ludGVySWQpOworICAgICAgICB9CisgICAgICAgIGludCBjb3VudCA9IGV2LmdldEhpc3RvcnlTaXplKCk7CisgICAgICAgIGludCBwY291bnQgPSBldi5nZXRQb2ludGVyQ291bnQoKTsKKworICAgICAgICBmb3IgKGludCBwPTA7IHAgPCBwY291bnQ7IHArKykgeworICAgICAgICAgICAgaW50IGlkID0gZXYuZ2V0UG9pbnRlcklkKHApOworICAgICAgICAgICAgbVJlbmRlci5uZXdUb3VjaFBvc2l0aW9uKGV2LmdldFgocCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXYuZ2V0WShwKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldi5nZXRQcmVzc3VyZShwKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZCk7CisKKyAgICAgICAgICAgIGZvciAoaW50IGk9MDsgaSA8IGNvdW50OyBpKyspIHsKKyAgICAgICAgICAgICAgICBtUmVuZGVyLm5ld1RvdWNoUG9zaXRpb24oZXYuZ2V0SGlzdG9yaWNhbFgocCwgaSksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV2LmdldEhpc3RvcmljYWxZKHAsIGkpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBldi5nZXRIaXN0b3JpY2FsUHJlc3N1cmUocCwgaSksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICB9CisgICAgKi8KK30KKworCmRpZmYg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ICAgICAgICAgICAgICAgICAgICAgICBkYXRhX2Y0W2krNF0gKiAwLjJmICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YV9mNFtpKzVdICogMC4yZiArCisgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFfZjRbaSs2XSAqIDAuMWYgKworICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhX2Y0W2krN10gKiAwLjA1ZiArCisgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFfZjRbaSs4XSAqIDAuMDRmICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YV9mNFtpKzldICogMC4wMmYgKyAxLmYpOworICAgICAgICB9CisgICAgfQorCisgICAgZmxvYXQgdGltZSA9IGVuZChpbmRleCk7CisgICAgcnNEZWJ1ZygiZnBfbWFkNCBNIG9wcyIsIDEwMDAuZiAvIHRpbWUpOworfQorCitzdGF0aWMgdm9pZCB0ZXN0X21hZCh1aW50MzJfdCBpbmRleCkgeworICAgIHN0YXJ0KCk7CisKKyAgICBmbG9hdCB0b3RhbCA9IDA7CisgICAgLy8gRG8gfjEgYmlsbGlvbiBvcHMKKyAgICBmb3IgKGludCBjdD0wOyBjdCA8IDEwMDAgKiAoMTAwMCAvIDIwKTsgY3QrKykgeworICAgICAgICBmb3IgKGludCBpPTA7IGkgPCAoMTAwMCk7IGkrKykgeworICAgICAgICAgICAgZGF0YV9mMVtpXSA9IChkYXRhX2YxW2ldICogMC4wMmYgKworICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhX2YxW2krMV0gKiAwLjA0ZiArCisgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFfZjFbaSsyXSAqIDAuMDVmICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YV9mMVtpKzNdICogMC4xZiArCisgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFfZjFbaSs0XSAqIDAuMmYgKworICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhX2YxW2krNV0gKiAwLjJmICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YV9mMVtpKzZdICogMC4xZiArCisgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFfZjFbaSs3XSAqIDAuMDVmICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YV9mMVtpKzhdICogMC4wNGYgKworICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhX2YxW2krOV0gKiAwLjAyZiArIDEuZik7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBmbG9hdCB0aW1lID0gZW5kKGluZGV4KTsKKyAgICByc0RlYnVnKCJmcF9tYWQgTSBvcHMiLCAxMDAwLmYgLyB0aW1lKTsKK30KKworc3RhdGljIHZvaWQgdGVzdF9ub3JtKHVpbnQzMl90IGluZGV4KSB7CisgICAgc3RhcnQoKTsKKworICAgIGZsb2F0IHRvdGFsID0gMDsKKyAgICAvLyBEbyB+MTAgTSBvcHMKKyAgICBmb3IgKGludCBjdD0wOyBjdCA8IDEwMDAgKiAxMDsgY3QrKykgeworICAgICAgICBmb3IgKGludCBpPTA7IGkgPCAoMTAwMCk7IGkrKykgeworICAgICAgICAgICAgZGF0YV9mNFtpXSA9IG5vcm1hbGl6ZShkYXRhX2Y0W2ldKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIGZsb2F0IHRpbWUgPSBlbmQoaW5kZXgpOworICAgIHJzRGVidWcoImZwX25vcm0gTSBvcHMiLCAxMC5mIC8gdGltZSk7Cit9CisKK3N0YXRpYyB2b2lkIHRlc3Rfc2luY29zNCh1aW50MzJfdCBpbmRleCkgeworICAgIHN0YXJ0KCk7CisKKyAgICBmbG9hdCB0b3RhbCA9IDA7CisgICAgLy8gRG8gfjEwIE0gb3BzCisgICAgZm9yIChpbnQgY3Q9MDsgY3QgPCAxMDAwICogMTAgLyA0OyBjdCsrKSB7CisgICAgICAgIGZvciAoaW50IGk9MDsgaSA8ICgxMDAwKTsgaSsrKSB7CisgICAgICAgICAgICBkYXRhX2Y0W2ldID0gc2luKGRhdGFfZjRbaV0pICogY29zKGRhdGFfZjRbaV0pOworICAgICAgICB9CisgICAgfQorCisgICAgZmxvYXQgdGltZSA9IGVuZChpbmRleCk7CisgICAgcnNEZWJ1ZygiZnBfc2luY29zNCBNIG9wcyIsIDEwLmYgLyB0aW1lKTsKK30KKworc3RhdGljIHZvaWQgdGVzdF9zaW5jb3ModWludDMyX3QgaW5kZXgpIHsKKyAgICBzdGFydCgpOworCisgICAgZmxvYXQgdG90YWwgPSAwOworICAgIC8vIERvIH4xMCBNIG9wcworICAgIGZvciAoaW50IGN0PTA7IGN0IDwgMTAwMCAqIDEwOyBjdCsrKSB7CisgICAgICAgIGZvciAoaW50IGk9MDsgaSA8ICgxMDAwKTsgaSsrKSB7CisgICAgICAgICAgICBkYXRhX2YxW2ldID0gc2luKGRhdGFfZjFbaV0pICogY29zKGRhdGFfZjFbaV0pOworICAgICAgICB9CisgICAgfQorCisgICAgZmxvYXQgdGltZSA9IGVuZChpbmRleCk7CisgICAgcnNEZWJ1ZygiZnBfc2luY29zIE0gb3BzIiwgMTAuZiAvIHRpbWUpOworfQorCitzdGF0aWMgdm9pZCB0ZXN0X2NsYW1wKHVpbnQzMl90IGluZGV4KSB7CisgICAgc3RhcnQoKTsKKworICAgIC8vIERvIH4xMDAgTSBvcHMKKyAgICBmb3IgKGludCBjdD0wOyBjdCA8IDEwMDAgKiAxMDA7IGN0KyspIHsKKyAgICAgICAgZm9yIChpbnQgaT0wOyBpIDwgKDEwMDApOyBpKyspIHsKKyAgICAgICAgICAgIGRhdGFfZjFbaV0gPSBjbGFtcChkYXRhX2YxW2ldLCAtMS5mLCAxLmYpOworICAgICAgICB9CisgICAgfQorCisgICAgZmxvYXQgdGltZSA9IGVuZChpbmRleCk7CisgICAgcnNEZWJ1ZygiZnBfY2xhbXAgTSBvcHMiLCAxMDAuZiAvIHRpbWUpOworCisgICAgc3RhcnQoKTsKKyAgICAvLyBEbyB+MTAwIE0gb3BzCisgICAgZm9yIChjdD0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ICAgZS0+aW5jUmVmcyhkYXRhKTsKKyAgICAgICAgZS0+ZGVjUmVmcyhwdHIpOworICAgIH0KKworICAgIG1lbWNweShwdHIsIGRhdGEsIHNpemVCeXRlcyk7CisgICAgc2VuZERpcnR5KCk7CisgICAgbVVwbG9hZERlZmVyZWQgPSB0cnVlOworfQorCit2b2lkIEFsbG9jYXRpb246OnN1YkVsZW1lbnREYXRhKENvbnRleHQgKnJzYywgdWludDMyX3QgeCwgdWludDMyX3QgeSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgdm9pZCAqZGF0YSwgdWludDMyX3QgY0lkeCwgdWludDMyX3Qgc2l6ZUJ5dGVzKQoreworICAgIHVpbnQzMl90IGVTaXplID0gbVR5cGUtPmdldEVsZW1lbnRTaXplQnl0ZXMoKTsKKyAgICB1aW50OF90ICogcHRyID0gc3RhdGljX2Nhc3Q8dWludDhfdCAqPihtUHRyKTsKKyAgICBwdHIgKz0gZVNpemUgKiAoeCArIHkgKiBtVHlwZS0+Z2V0RGltWCgpKTsKKworICAgIGlmICh4ID49IG1UeXBlLT5nZXREaW1YKCkpIHsKKyAgICAgICAgTE9HRSgiRXJyb3IgQWxsb2NhdGlvbjo6c3ViRWxlbWVudERhdGEgWCBvZmZzZXQgJWkgb3V0IG9mIHJhbmdlLiIsIHgpOworICAgICAgICByc2MtPnNldEVycm9yKFJTX0VSUk9SX0JBRF9WQUxVRSwgInN1YkVsZW1lbnREYXRhIFggb2Zmc2V0IG91dCBvZiByYW5nZS4iKTsKKyAgICAgICAgcmV0dXJuOworICAgIH0KKworICAgIGlmICh5ID49IG1UeXBlLT5nZXREaW1ZKCkpIHsKKyAgICAgICAgTE9HRSgiRXJyb3IgQWxsb2NhdGlvbjo6c3ViRWxlbWVudERhdGEgWCBvZmZzZXQgJWkgb3V0IG9mIHJhbmdlLiIsIHgpOworICAgICAgICByc2MtPnNldEVycm9yKFJTX0VSUk9SX0JBRF9WQUxVRSwgInN1YkVsZW1lb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ik7CisgICAgY29uc3QgRWxlbWVudCAqZSA9IG1UeXBlLT5nZXRFbGVtZW50KCk7CisgICAgdWludDMyX3Qgc3RyaWRlID0gZS0+Z2V0U2l6ZUJ5dGVzKCk7CisKKyAgICB3aGlsZSAoY3QgPiAwKSB7CisgICAgICAgIGUtPmRlY1JlZnMocCk7CisgICAgICAgIGN0IC0tOworICAgICAgICBwICs9IHN0cmlkZTsKKyAgICB9Cit9CisKIC8vLy8vLy8vLy8vLy8vLy8vCiAvLwogCkBAIC00OTUsNyArNjg3LDcgQEAKICAgICBpZiAoc3JjR0xUeXBlID09IEdMX1VOU0lHTkVEX0JZVEUgJiYKICAgICAgICAgc3JjR0xGbXQgPT0gR0xfUkdCICYmCiAgICAgICAgIGRzdEdMVHlwZSA9PSBHTF9VTlNJR05FRF9TSE9SVF81XzZfNSAmJgotICAgICAgICBkc3RHTFR5cGUgPT0gR0xfUkdCKSB7CisgICAgICAgIGRzdEdMRm10ID09IEdMX1JHQikgewogCiAgICAgICAgIHJldHVybiBlbGVtZW50Q29udmVydGVyXzg4OF90b181NjU7CiAgICAgfQpAQCAtNTAzLDE1ICs2OTUsMjEgQEAKICAgICBpZiAoc3JjR0xUeXBlID09IEdMX1VOU0lHTkVEX0JZVEUgJiYKICAgICAgICAgc3JjR0xGbXQgPT0gR0xfUkdCQSAmJgogICAgICAgICBkc3RHTFR5cGUgPT0gR0xfVU5TSUdORURfU0hPUlRfNV82XzUgJiYKLSAgICAgICAgZHN0R0xUeXBlID09IEdMX1JHQikgeworICAgICAgICBkc3RHTEZtdCA9PSBHTF9SR0IpIHsKIAogICAgICAgICByZXR1cm4gZWxlbWVudENvbnZlcnRlcl84ODg4X3RvXzU2NTsKICAgICB9CiAKICAgICBMT0dFKCJwaWNrQ29udmVydGVyLCB1bnN1cG9ydGVkIGNvbWJvLCBzcmMgJXAsICBkc3QgJXAiLCBzcmMsIGRzdCk7CisgICAgTE9HRSgicGlja0NvbnZlcnRlciwgc3JjR0xUeXBlID0g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UDsKKyAgICBtRWRnZVByZSA9IFJTX0FOSU1BVElPTl9FREdFX1VOREVGSU5FRDsKKyAgICBtRWRnZVBvc3QgPSBSU19BTklNQVRJT05fRURHRV9VTkRFRklORUQ7CisgICAgbUlucHV0TWluID0gMDsKKyAgICBtSW5wdXRNYXggPSAwOworfQorCitBbmltYXRpb24gKiBBbmltYXRpb246OmNyZWF0ZShDb250ZXh0ICpyc2MsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBmbG9hdCAqaW5WYWx1ZXMsIGNvbnN0IGZsb2F0ICpvdXRWYWx1ZXMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCB2YWx1ZUNvdW50LCBSc0FuaW1hdGlvbkludGVycG9sYXRpb24gaW50ZXJwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUnNBbmltYXRpb25FZGdlIHByZSwgUnNBbmltYXRpb25FZGdlIHBvc3QpCit7CisgICAgaWYgKHZhbHVlQ291bnQgPCAyKSB7CisgICAgICAgIHJzYy0+c2V0RXJyb3IoUlNfRVJST1JfQkFEX1ZBTFVFLCAiQW5pbWF0aW9ucyByZXF1aXJlIG1vcmUgdGhhbiAyIHZhbHVlcy4iKTsKKyAgICAgICAgcmV0dXJuIE5VTEw7CisgICAgfQorICAgIEFuaW1hdGlvbiAqYSA9IG5ldyBBbmltYXRpb24ocnNjKTsKKyAgICBpZiAoIWEpIHsKKyAgICAgICAgcnNjLT5zZXRFcnJvcihSU19FUlJPUl9PVVRfT0ZfTUVNT1JZKTsKKyAgICAgICAgcmV0dXJuIE5VTEw7CisgICAgfQorCisgICAgZmxvYXQgKnZpbiA9IChmbG9hdCAqKW1hbGxvYyh2YWx1ZUNvdW50ICogc2l6ZW9mKGZsb2F0KSk7CisgICAgZmxvYXQgKnZvdXQgPSAoZmxvYXQgKiltYWxsb2ModmFsdWVDb3VudCAqIHNpemVvZihmbG9hdCkpOworICAgIGEtPm1WYWx1ZXNJbnB1dCA9IHZpbjsKKyAgICBhLT5tVmFsdWVzT3V0cHV0ID0gdm91dDsKKyAgICBpZiAoYS0+bVZhbHVlc0lucHV0ID09IE5VTEwgfHwgYS0+bVZhbHVlc091dHB1dCA9PSBOVUxMKSB7CisgICAgICAgIGRlbGV0ZSBhOworICAgICAgICByc2MtPnNldEVycm9yKFJTX0VSUk9SX09VVF9PRl9NRU1PUlkpOworICAgICAgICByZXR1cm4gTlVMTDsKKyAgICB9CisKKyAgICBhLT5tRWRnZVByZSA9IHByZTsKKyAgICBhLT5tRWRnZVBvc3QgPSBwb3N0OworICAgIGEtPm1JbnRlcnBvbGF0aW9uID0gaW50ZXJwOworICAgIGEtPm1WYWx1ZUNvdW50ID0gdmFsdWVDb3VudDsKKworICAgIG1lbWNweSh2aW4sIGluVmFsdWVzLCB2YWx1ZUNvdW50ICogc2l6ZW9mKGZsb2F0KSk7CisgICAgbWVtY3B5KHZvdXQsIG91dFZhbHVlcywgdmFsdWVDb3VudCAqIHNpemVvZihmbG9hdCkpOworICAgIGEtPm1JbnB1dE1pbiA9IGluVmFsdWVzWzBdOworICAgIGEtPm1JbnB1dE1heCA9IGluVmFsdWVzWzBdOworCisgICAgYm9vbCBuZWVkU29ydCA9IGZhbHNlOworICAgIGZvciAodWludDMyX3QgY3Q9MTsgY3QgPCB2YWx1ZUNvdW50OyBjdCsrKSB7CisgICAgICAgIGlmIChhLT5tSW5wdXRNaW4gPiB2aW5bY3RdKSB7CisgICAgICAgICAgICBuZWVkU29ydCA9IHRydWU7CisgICAgICAgICAgICBhLT5tSW5wdXRNaW4gPSB2aW5bY3RdOworICAgICAgICB9CisgICAgICAgIGlmIChhLT5tSW5wdXRNYXggPCB2aW5bY3RdKSB7CisgICAgICAgICAgICBhLT5tSW5wdXRNYXggPSB2aW5bY3RdOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgbmVlZFNvcnQgPSB0cnVlOworICAgICAgICB9CisgICAgfQorCisgICAgd2hpbGUgKDEpIHsKKyAgICAgICAgYm9vbCBjaGFuZ2VkID0gZmFsc2U7CisgICAgICAgIGZvciAodWludDMyX3QgY3Q9MTsgY3QgPCB2YWx1ZUNvdW50OyBjdCsrKSB7CisgICAgICAgICAgICBpZiAodmluW2N0LTFdID4gdmluW2N0XSkgeworICAgICAgICAgICAgICAgIGZsb2F0IHQgPSB2aW5bY3QtMV07CisgICAgICAgICAgICAgICAgdmluW2N0LTFdID0gdmluW2N0XTsKKyAgICAgICAgICAgICAgICB2aW5bY3RdID0gdDsKKyAgICAgICAgICAgICAgICB0ID0gdm91dFtjdC0xXTsKKyAgICAgICAgICAgICAgICB2b3V0W2N0LTFdID0gdm91dFtjdF07CisgICAgICAgICAgICAgICAgdm91dFtjdF0gPSB0OworICAgICAgICAgICAgICAgIGNoYW5nZWQgPSB0cnVlOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGlmICghY2hhbmdlZCkgYnJlYWs7CisgICAgfQorCisgICAgcmV0dXJuIGE7Cit9CisqLworCisKKy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vCisvLworCituYW1lc3BhY2UgYW5kcm9pZCB7CituYW1lc3BhY2UgcmVuZGVyc2NyaXB0IHsKKworUnNBbmltYXRpb24gcnNpX0FuaW1hdGlvbkNyZWF0ZShDb250ZXh0ICpyc2MsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGZsb2F0ICppblZhbHVlcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZmxvYXQgKm91dFZhbHVlcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdWludDMyX3QgdmFsdWVDb3VudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUnNBbmltYXRpb25JbnRlcnBvbGF0aW9uIGludGVycCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUnNBbmltYXRpb25FZGdlIHByZSwKKyAgICAgICAgICAgIC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yAgICAgICAgcnNBc3NlcnQobU5vcm1hbGl6ZWQgPT0gZmFsc2UpOworICAgICAgICByc0Fzc2VydChtS2luZCA9PSBSU19LSU5EX1VTRVIpOworICAgICAgICBicmVhazsKKwogICAgIGNhc2UgUlNfVFlQRV9FTEVNRU5UOgogICAgIGNhc2UgUlNfVFlQRV9UWVBFOgogICAgIGNhc2UgUlNfVFlQRV9BTExPQ0FUSU9OOgpAQCAtMTQ4LDExICsxNzIsMTkgQEAKICAgICBjYXNlIFJTX1RZUEVfVU5TSUdORURfNjQ6CiAgICAgICAgIG1UeXBlQml0cyA9IDY0OwogICAgICAgICBicmVhazsKKworICAgIGNhc2UgUlNfVFlQRV9CT09MRUFOOgorICAgICAgICBtVHlwZUJpdHMgPSA4OworICAgICAgICBicmVhazsKICAgICB9CiAKICAgICBtQml0cyA9IG1UeXBlQml0cyAqIG1WZWN0b3JTaXplOwogfQogCitib29sIENvbXBvbmVudDo6aXNSZWZlcmVuY2UoKSBjb25zdAoreworICAgIHJldHVybiAobVR5cGUgPj0gUlNfVFlQRV9FTEVNRU5UKTsKK30KIAogCiAKQEAgLTE4OCw4MiArMjIwLDYgQEAKICAgICByZXR1cm4gMDsKIH0KIAotc3RhdGljIGNvbnN0IGNoYXIgKiBnQ1R5cGVTdHJpbmdzW10gPSB7Ci0gICAgMCwKLSAgICAwLC8vIkYxNiIsCi0gICAgImZsb2F0IiwKLSAgICAiZG91YmxlIiwKLSAgICAiY2hhciIsCi0gICAgInNob3J0IiwKLSAgICAiaW50IiwKLSAgICAwLC8vIlM2NCIsCi0gICAgImNoYXIiLC8vVTgiLAotICAgICJzaG9ydCIsLy9VMTYiLAotICAgICJpbnQiLC8vVTMyIiwKLSAgICAwLC8vIlU2NCIsCi0gICAgMCwvLyJVUF81NjUiLAotICAgIDAsLy8iVVBfNTU1MSIsCi0gICAgMCwvLyJVUF80NDQ0IiwKLSAgICAwLC8vIkVMRU1FTlQiLAotICAgIDAsLy8iVFlQRSIsCi0gICAgMC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VmVydGV4LmluaXQocnNjKTsKICAgICAgICAgIHJzYy0+c2V0VmVydGV4KE5VTEwpOwotICAgICAgICAgcnNjLT5tU3RhdGVGcmFnbWVudC5pbml0KHJzYywgcnNjLT5tRUdMLm1XaWR0aCwgcnNjLT5tRUdMLm1IZWlnaHQpOworICAgICAgICAgcnNjLT5tU3RhdGVGcmFnbWVudC5pbml0KHJzYyk7CiAgICAgICAgICByc2MtPnNldEZyYWdtZW50KE5VTEwpOwotICAgICAgICAgcnNjLT5tU3RhdGVGcmFnbWVudFN0b3JlLmluaXQocnNjLCByc2MtPm1FR0wubVdpZHRoLCByc2MtPm1FR0wubUhlaWdodCk7CisgICAgICAgICByc2MtPm1TdGF0ZUZyYWdtZW50U3RvcmUuaW5pdChyc2MpOwogICAgICAgICAgcnNjLT5zZXRGcmFnbWVudFN0b3JlKE5VTEwpOworICAgICAgICAgcnNjLT5tU3RhdGVGb250LmluaXQocnNjKTsKKyAgICAgICAgIHJzYy0+c2V0Rm9udChOVUxMKTsKICAgICAgICAgIHJzYy0+bVN0YXRlVmVydGV4QXJyYXkuaW5pdChyc2MpOwogICAgICB9CiAKQEAgLTMyMSw2ICszMjcsMTEgQEAKICAgICAgICAgIHVpbnQzMl90IHRhcmdldFRpbWUgPSAwOwogICAgICAgICAgaWYgKG1EcmF3ICYmIHJzYy0+bUlzR3JhcGhpY3NDb250ZXh0KSB7CiAgICAgICAgICAgICAgdGFyZ2V0VGltZSA9IHJzYy0+cnVuUm9vdFNjcmlwdCgpOworCisgICAgICAgICAgICAgaWYocnNjLT5wcm9wcy5tTG9nVmlzdWFsKSB7CisgICAgICAgICAgICAgICAgIHJzYy0+ZGlzcGxheURlYnVnU3RhdHMoKTsKKyAgICAgICAgICAgICB9CisKICAgICAgICAgICAgICBtRHJhdyA9IHRhcmdldFRpbWUgJiYgIXJzYy0+bVBhdXNlZDsKICAgICAgICAgICAgICByc2MtPnRpbWVyU2V0KFJTX1RJTUVSX0NMRUFSX1NXQVApOwogICAgICAgICAgICAgIGVnbFN3YXBCdWZmZXJzKHJzYy0+bUVHTC5tRGlzcGxheSwgcnNjLT5tRUdMLm1TdXJmYWNlKTsKQEAgLTMyOSw5ICszNDAsNiBAQAogICAgICAgICAgICAgIHJzYy0+dGltZXJQcmludCgpOwogICAgICAgICAgICAgIHJzYy0+dGltZXJSZXNldCgpOwogICAgICAgICAgfQotICAgICAgICAgaWYgKHJzYy0+bU9iakRlc3Ryb3kubU5lZWRUb0VtcHR5KSB7Ci0gICAgICAgICAgICAgcnNjLT5vYmpEZXN0cm95T09CUnVuKCk7Ci0gICAgICAgICB9CiAgICAgICAgICBpZiAocnNjLT5tVGhyZWFkUHJpb3JpdHkgPiAwICYmIHRhcmdldFRpbWUpIHsKICAgICAgICAgICAgICBpbnQzMl90IHQgPSAodGFyZ2V0VGltZSAtIChpbnQzMl90KShyc2MtPm1UaW1lTVNMYXN0U2NyaXB0ICsgcnNjLT5tVGltZU1TTGFzdFN3YXApKSAqIDEwMDA7CiAgICAgICAgICAgICAgaWYgKHQgPiAwKSB7CkBAIC0zNDYsMTcgKzM1NCwxNiBAQAogICAgICAgICAgcnNjLT5tRnJhZ21lbnQuY2xlYXIoKTsKICAgICAgICAgIHJzYy0+bVZlcnRleC5jbGVhcigpOwogICAgICAgICAgcnNjLT5tRnJhZ21lbnRTdG9yZS5jbGVhcigpOworICAgICAgICAgcnNjLT5tRm9udC5jbGVhcigpOwogICAgICAgICAgcnNjLT5tUm9vdFNjcmlwdC5jbGVhcigpOwogICAgICAgICAgcnNjLT5tU3RhdGVSYXN0ZXIuZGVpbml0KHJzYyk7CiAgICAgICAgICByc2MtPm1TdGF0ZVZlcnRleC5kZWluaXQocnNjKTsKICAgICAgICAgIHJzYy0+bVN0YXRlRnJhZ21lbnQuZGVpbml0KHJzYyk7CiAgICAgICAgICByc2MtPm1TdGF0ZUZyYWdtZW50U3RvcmUuZGVpbml0KHJzYyk7CisgICAgICAgICByc2MtPm1TdGF0ZUZvbnQuZGVpbml0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jb25zdCB7cmV0dXJuICh1aW50MzJfdCltV29ya2Vycy5tUnVubmluZ0NvdW50O30KKwogcHJvdGVjdGVkOgogICAgIERldmljZSAqbURldjsKIApAQCAtMTc3LDggKzE4Niw2IEBACiAgICAgICAgIEVHTENvbmZpZyBtQ29uZmlnOwogICAgICAgICBFR0xDb250ZXh0IG1Db250ZXh0OwogICAgICAgICBFR0xTdXJmYWNlIG1TdXJmYWNlOwotICAgICAgICBFR0xpbnQgbVdpZHRoOwotICAgICAgICBFR0xpbnQgbUhlaWdodDsKICAgICAgICAgRUdMRGlzcGxheSBtRGlzcGxheTsKICAgICB9IG1FR0w7CiAKQEAgLTIxOSwyMiArMjI2LDI4IEBACiAgICAgcHRocmVhZF90IG1UaHJlYWRJZDsKICAgICBwaWRfdCBtTmF0aXZlVGhyZWFkSWQ7CiAKKyAgICBzdHJ1Y3QgV29ya2VycyB7CisgICAgICAgIHZvbGF0aWxlIGludCBtUnVubmluZ0NvdW50OworICAgICAgICB2b2xhdGlsZSBpbnQgbUxhdW5jaENvdW50OworICAgICAgICB1aW50MzJfdCBtQ291bnQ7CisgICAgICAgIHB0aHJlYWRfdCAqbVRocmVhZElkOworICAgICAgICBwaWRfdCAqbU5hdGl2ZVRocmVhZElkOworICAgICAgICBTaWduYWwgbUNvbXBsZXRlU2lnbmFsOworCisgICAgICAgIFNpZ25hbCAqbUxhdW5jaFNpZ25hbHM7CisgICAgICAgIFdvcmtlckNhbGxiYWNrX3QgbUxhdW5jaENhbGxiYWNrOworICAgICAgICB2b2lkICptTGF1bmNoRGF0YTsKKyAgICB9OworICAgIFdvcmtlcnMgbVdvcmtlcnM7CisKICAgICBPYmplY3RCYXNlUmVmPFNjcmlwdD4gbVJvb3RTY3JpcHQ7CiAgICAgT2JqZWN0QmFzZVJlZjxQcm9ncmFtRnJhZ21lbnQ+IG1GcmFnbWVudDsKICAgICBPYmplY3RCYXNlUmVmPFByb2dyYW1WZXJ0ZXg+IG1WZXJ0ZXg7Ci0gICAg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ICAgUHJvZ3JhbVJhc3RlciAqIGdldERlZmF1bHRQcm9ncmFtUmFzdGVyKCkgY29uc3QgeworICAgICAgICByZXR1cm4gTlVMTDsKKyAgICB9CisKKyAgICB1aW50MzJfdCBnZXRXaWR0aCgpIGNvbnN0IHtyZXR1cm4gMDt9CisgICAgdWludDMyX3QgZ2V0SGVpZ2h0KCkgY29uc3Qge3JldHVybiAwO30KKworICAgIC8vIFRpbWVycworICAgIGVudW0gVGltZXJzIHsKKyAgICAgICAgUlNfVElNRVJfSURMRSwKKyAgICAgICAgUlNfVElNRVJfSU5URVJOQUwsCisgICAgICAgIFJTX1RJTUVSX1NDUklQVCwKKyAgICAgICAgUlNfVElNRVJfQ0xFQVJfU1dBUCwKKyAgICAgICAgX1JTX1RJTUVSX1RPVEFMCisgICAgfTsKKworICAgIGJvb2wgY2hlY2tWZXJzaW9uMV8xKCkgY29uc3Qge3JldHVybiBmYWxzZTsgfQorICAgIGJvb2wgY2hlY2tWZXJzaW9uMl8wKCkgY29uc3Qge3JldHVybiBmYWxzZTsgfQorCisgICAgc3RydWN0IHsKKyAgICAgICAgYm9vbCBtTG9nVGltZXM7CisgICAgICAgIGJvb2wgbUxvZ1NjcmlwdHM7CisgICAgICAgIGJvb2wgbUxvZ09iamVjdHM7CisgICAgICAgIGJvb2wgbUxvZ1NoYWRlcnM7CisgICAgfSBwcm9wczsKKworICAgIHZvaWQgZHVtcERlYnVnKCkgY29uc3QgeyAgICB9CisgICAgdm9pZCBjaGVja0Vycm9yKGNvbnN0IGNoYXIgKikgY29uc3QgeyAgfTsKKyAgICB2b2lkIHNldEVycm9yKFJzRXJyb3IgZSwgY29uc3QgY2hhciAqbXNnID0gTlVMTCkgeyAgfQorCisgICAgbXV0YWJsZSBjb25zdCBPYmplY3RCYXNlICogbU9iakhlYWQ7CisKKyAgICBib29sIGV4dF9PRVNfdGV4dHVyZV9ucG90KCkgY29uc3Qge3JldHVybiBtR0wuT0VTX3RleHR1cmVfbnBvdDt9CisKK3Byb3RlY3RlZDoKKworICAgIHN0cnVjdCB7CisgICAgICAgIGNvbnN0IHVpbnQ4X3QgKiBtVmVuZG9yOworICAgICAgICBjb25zdCB1aW50OF90ICogbVJlbmRlcmVyOworICAgICAgICBjb25zdCB1aW50OF90ICogbVZlcnNpb247CisgICAgICAgIGNvbnN0IHVpbnQ4X3QgKiBtRXh0ZW5zaW9uczsKKworICAgICAgICB1aW50MzJfdCBtTWFqb3JWZXJzaW9uOworICAgICAgICB1aW50MzJfdCBtTWlub3JWZXJzaW9uOworCisgICAgICAgIGludDMyX3QgbU1heFZhcnlpbmdWZWN0b3JzOworICAgICAgICBpbnQzMl90IG1NYXhUZXh0dXJlSW1hZ2VVbml0czsKKworICAgICAgICBpbnQzMl90IG1NYXhGcmFnbWVudFRleHR1cmVJbWFnZVVuaXRzOworICAgICAgICBpbnQzMl90IG1NYXhGcmFnbWVudFVuaWZvcm1WZWN0b3JzOworCisgICAgICAgIGludDMyX3QgbU1heFZlcnRleEF0dHJpYnM7CisgICAgICAgIGludDMyX3QgbU1heFZlcnRleFVuaWZvcm1WZWN0b3JzOworICAgICAgICBpbnQzMl90IG1NYXhWZXJ0ZXhUZXh0dXJlVW5pdHM7CisKKyAgICAgICAgYm9vbCBPRVNfdGV4dHVyZV9ucG90OworICAgIH0gbUdMOworCit9OworCit9Cit9CisjZW5kaWYKZGlmZiAtLWdpdCBhL2xpYnMvcnMvcnNEZXZpY2UuY3BwIGIvbGlicy9ycy9yc0RldmljZS5jcHAKaW5kZXggYjY3MGFkNC4uYTk2YjExNCAxMDA2NDQKLS0tIGEvbGlicy9ycy9yc0RldmljZS5jcHAKKysrIGIvbGlicy9ycy9yc0RldmljZS5jcHAKQEAgLTE1LDcgKzE1LDExIEBACiAgKi8KIAogI2luY2x1ZGUgInJzRGV2aWNlLmgiCisjaWZuZGVmIEFORFJPSURfUlNfQlVJTERfRk9SX0hPU1QKICNpbmNsdWRlICJyc0NvbnRleHQuaCIKKyNlbHNlCisjaW5jbH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lbS0+bUhhc1JlZmVyZW5jZSkgeworICAgICAgICAgICAgICAgIGVsZW0tPm1IYXNSZWZlcmVuY2UgPSB0cnVlOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgLy8gV2UgbmVlZCB0byBjaGVjayBpZiB0aGlzIGFscmVhZHkgZXhpc3RzCisgICAgZm9yICh1aW50MzJfdCBjdD0wOyBjdCA8IHJzYy0+bVN0YXRlRWxlbWVudC5tRWxlbWVudHMuc2l6ZSgpOyBjdCsrKSB7CisgICAgICAgIEVsZW1lbnQgKmVlID0gcnNjLT5tU3RhdGVFbGVtZW50Lm1FbGVtZW50c1tjdF07CisKKyAgICAgICAgaWYgKCFlZS0+Z2V0RmllbGRDb3VudCgpICkgeworCisgICAgICAgICAgICBpZigoZWUtPmdldENvbXBvbmVudCgpLmdldFR5cGUoKSA9PSBlbGVtLT5nZXRDb21wb25lbnQoKS5nZXRUeXBlKCkpICYmCisgICAgICAgICAgICAgICAoZWUtPmdldENvbXBvbmVudCgpLmdldEtpbmQoKSA9PSBlbGVtLT5nZXRDb21wb25lbnQoKS5nZXRLaW5kKCkpICYmCisgICAgICAgICAgICAgICAoZWUtPmdldENvbXBvbmVudCgpLmdldElzTm9ybWFsaXplZCgpID09IGVsZW0tPmdldENvbXBvbmVudCgpLmdldElzTm9ybWFsaXplZCgpKSAmJgorICAgICAgICAgICAgICAgKGVlLT5nZXRDb21wb25lbnQoKS5nZXRWZWN0b3JTaXplKCkgPT0gZWxlbS0+Z2V0Q29tcG9uZW50KCkuZ2V0VmVjdG9yU2l6ZSgpKSkgeworICAgICAgICAgICAgICAgIC8vIE1hdGNoCisgICAgICAgICAgICAgICAgZGVsZXRlIGVsZW07CisgICAgICAgICAgICAgICAgZWUtPmluY1VzZXJSZWYoKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gZWU7CisgICAgICAgICAgICB9CisKKyAgICAgICAgfSBlbHNlIGlmIChlZS0+Z2V0RmllbGRDb3VudCgpID09IGVsZW0tPm1GaWVsZENvdW50KSB7CisKKyAgICAgICAgICAgIGJvb2wgbWF0Y2ggPSB0cnVlOworICAgICAgICAgICAgZm9yICh1aW50MzJfdCBpPTA7IGkgPCBlbGVtLT5tRmllbGRDb3VudDsgaSsrKSB7CisgICAgICAgICAgICAgICAgaWYgKChlZS0+bUZpZWxkc1tpXS5lLmdldCgpICE9IGVsZW0tPm1GaWVsZHNbaV0uZS5nZXQoKSkgfHwKKyAgICAgICAgICAgICAgICAgICAgKGVlLT5tRmllbGRzW2ldLm5hbWUubGVuZ3RoKCkgIT0gZWxlbS0+bUZpZWxkc1tpXS5uYW1lLmxlbmd0aCgpKSB8fAorICAgICAgICAgICAgICAgICAgICAoZWUtPm1GaWVsZHNbaV0ubmFtZSAhPSBlbGVtLT5tRmllbGRzW2ldLm5hbWUpIHx8CisgICAgICAgICAgICAgICAgICAgIChlZS0+bUZpZWxkc1tpXS5hcnJheVNpemUgIT0gZWxlbS0+bUZpZWxkc1tpXS5hcnJheVNpemUpKSB7CisgICAgICAgICAgICAgICAgICAgIG1hdGNoID0gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChtYXRjaCkgeworICAgICAgICAgICAgICAgIGRlbGV0ZSBlbGVtOworICAgICAgICAgICAgICAgIGVlLT5pbmNVc2VyUmVmKCk7CisgICAgICAgICAgICAgICAgcmV0dXJuIGVlOworICAgICAgICAgICAgfQorCisgICAgICAgIH0KKyAgICB9CisKKyAgICByc2MtPm1TdGF0ZUVsZW1lbnQubUVsZW1lbnRzLnB1c2goZWxlbSk7CisgICAgcmV0dXJuIGVsZW07Cit9CisKIAogY29uc3QgRWxlbWVudCAqIEVsZW1lbnQ6OmNyZWF0ZShDb250ZXh0ICpyc2MsIFJzRGF0YVR5cGUgZHQsIFJzRGF0YUtpbmQgZGssCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBpc05vcm0sIHVpbnQzMl90IHZlY1NpemUpCkBAIC0xMDQsMTIgKzE5NywxMyBAQAogICAgIEVsZW1lbnQgKmUgPSBuZXcgRWxlbWVudChyc2MpOwogICAgIGUtPm1Db21wb25lbnQuc2V0KGR0LCBkaywgaXNOb3JtLCB2ZWNTaXplKTsKICAgICBlLT5tQml0cyA9IGUtPm1Db21wb25lbnQuZ2V0Qml0cygpOworICAgIGUtPm1IYXNSZWZlcmVuY2UgPSBlLT5tQ29tcG9uZW50LmlzUmVmZXJlbmNlKCk7CiAgICAgcnNjLT5tU3RhdGVFbGVtZW50Lm1FbGVtZW50cy5wdXNoKGUpOwogICAgIHJldHVybiBlOwogfQogCiBjb25zdCBFbGVtZW50ICogRWxlbWVudDo6Y3JlYXRlKENvbnRleHQgKnJzYywgc2l6ZV90IGNvdW50LCBjb25zdCBFbGVtZW50ICoqZWluLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGNoYXIgKipuaW4sIGNvbnN0IHNpemVfdCAqIGxlbmd0aHMpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgY2hhciAqKm5pbiwgY29uc3Qgc2l6ZV90ICogbGVuZ3RocywgY29uc3QgdWludDMyX3QgKmFzaW4pCiB7CiAgICAgLy8gTG9vayBmb3IgYW4gZXhpc3RpbmcgbWF0Y2guCiAgICAgZm9yICh1aW50MzJfdCBjdD0wOyBjdCA8IHJzYy0+bVN0YXRlRWxlbWVudC5tRWxlbWVudHMuc2l6ZSgpOyBjdCsrKSB7CkBAIC0xMTksNyArMjEzLDggQEAKICAgICAgICAgICAgIGZvciAodWludDMyX3QgaT0wOyBpIDwgY291bnQ7IGkrKykgewogICAgICAgICAgICAgICAgIGlmICgoZWUtPm1GaWVsZHNbaV0uZS5nZXQoKSAhPSBlaW5baV0pIHx8CiAgICAgICAgICAgICAgICAgICAgIChlZS0+bUZpZWxkc1tpXS5uYW1lLmxlbmd0aCgpICE9IGxlbmd0aHNbaV0pIHx8Ci0gICAgICAgICAgICAgICAgICAgIChlZS0+bUZpZWxkc1tpXS5uYW1lICE9IG5pbltpXSkpIHsKKyAgICAgICAgICAgICAgICAgICAgKGVlLT5tRmllbGRzW2ldLm5hbWUgIT0gbmluW2ldKSB8fAorICAgICAgICAgICAgICAgICAgICAoZWUtPm1GaWVsZHNbaV0uYXJyYXlTaXplICE9IGFzaW5baV0pKSB7CiAgICAgICAgICAgICAgICAgICAgIG1hdGNoID0gZmFsc2U7CiAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgIH0KQEAgLTEzNCw1NCArMjI5LDIzIEBACiAgICAgRWxlbWVudCAqZSA9IG5ldyBFbGVtZW50KHJzYyk7CiAgICAgZS0+bUZpZWxkcyA9IG5ldyBFbGVtZW50RmllbGRfdCBbY291bnRdOwogICAgIGUtPm1GaWVsZENvdW50ID0gY291bnQ7CisgICAgc2l6ZV90IGJpdHMgPSAwOwogICAgIGZvciAoc2l6ZV90IGN0PTA7IGN0IDwgY291bnQ7IGN0KyspIHsKICAgICAgICAgZS0+bUZpZWxkc1tjdF0uZS5zZXQoZWluW2N0XSk7CiAgICAgICAgIGUtPm1GaWVsZHNbY3RdLm5hbWUuc2V0VG8obmluW2N0XSwgbGVuZ3Roc1tjdF0pOworICAgICAgICBlLT5tRmllbGRzW2N0XS5vZmZzZXRCaXRzID0gYml0czsKKyAgICAgICAgZS0+bUZpZWxkc1tjdF0uYXJyYXlTaXplID0gYXNpbltjdF07CisgICAgICAgIGJpdHMgKz0gZWluW2N0XS0+Z2V0U2l6ZUJpdHMoKTsKKworICAgICAgICBpZiAoZWluW2N0XS0+bUhhc1JlZmVyZW5jZSkgeworICAgICAgICAgICAgZS0+bUhhc1JlZmVyZW5jZSA9IHRydWU7CisgICAgICAgIH0KICAgICB9CiAKICAgICByc2MtPm1TdGF0ZUVsZW1lbnQubUVsZW1lbnRzLnB1c2goZSk7CiAgICAgcmV0dXJuIGU7CiB9CiAKLVN0cmluZzggRWxlbWVudDo6Z2V0Q1N0cnVjdEJvZHkodWludDMyX3QgaW5kZW50KSBjb25zdAotewotICAgIFN0cmluZzggc2k7Ci0gICAgZm9yICh1aW50MzJfdCBjdD0wOyBjdCA8IGluZGVudDsgY3QrKykgewotICAgICAgICBzaS5hcHBlbmQoIiAiKTsKLSAgICB9Ci0KLSAgICBTdHJpbmc4IHMoc2kpOwotICAgIHMuYXBwZW5kKCJ7XG4iKTsKLSAgICBmb3IgKHVpbnQzMl90IGN0ID0gMDsgY3QgPCBtRmllbGRDb3VudDsgY3QrKykgewotICAgICAgICBzLmFwcGVuZChzaSk7Ci0gICAgICAgIHMuYXBwZW5kKG1GaWVsZHNbY3RdLmUtPmdldENUeXBlKGluZGVudCs0KSk7Ci0gICAgICAgIHMuYXBwZW5kKCIgIik7Ci0gICAgICAgIHMuYXBwZW5kKG1GaWVsZHNbY3RdLm5hbWUpOwotICAgICAgICBzLmFwcGVuZCgiO1xuIik7Ci0gICAgfQotICAgIHMuYXBwZW5kKHNpKTsKLSAgICBzLmFwcGVuZCgifSIpOwotICAgIHJldHVybiBzOwotfQotCi1TdHJpbmc4IEVsZW1lbnQ6OmdldENUeXBlKHVpbnQzMl90IGluZGVudCkgY29uc3QKLXsKLSAgICBTdHJpbmc4IHM7Ci0gICAgZm9yICh1aW50MzJfdCBjdD0wOyBjdCA8IGluZGVudDsgY3QrKykgewotICAgICAgICBzLmFwcGVuZCgiICIpOwotICAgIH0KLQotICAgIGlmICghbUZpZWxkQ291bnQpIHsKLSAgICAgICAgLy8gQmFzaWMgY29tcG9uZW50LgotICAgICAgICBzLmFwcGVuZChtQ29tcG9uZW50LmdldENUeXBlKCkpOwotICAgIH0gZWxzZSB7Ci0gICAgICAgIHMuYXBwZW5kKCJzdHJ1Y3QgIik7Ci0gICAgICAgIHMuYXBwZW5kKGdldENTdHJ1Y3RCb2R5KGluZGVudCkpOwotICAgIH0KLQotICAgIHJldHVybiBzOwotfQotCiBTdHJpbmc4IEVsZW1lbnQ6OmdldEdMU0xUeXBlKHVpbnQzMl90IGluZGVudCkgY29uc3QKIHsKICAgICBTdHJpbmc4IHM7CkBAIC0yMDEsNiArMjY1LDUxIEBACiAgICAgcmV0dXJuIHM7CiB9CiAKK3ZvaWQgRWxlbWVudDo6aW5jUmVmcyhjb25zdCB2b2lkICpwdHIpIGNvbnN0Cit7CisgICAgaWYgKCFtRmllbGRDb3VudCkgeworICAgICAgICBpZiAobUNvbXBvbmVudC5pc1JlZmVyZW5jZSgpKSB7CisgICAgICAgICAgICBPYmplY3RCYXNlICpjb25zdCpvYnAgPSBzdGF0aWNfY2FzdDxPYmplY3RCYXNlICpjb25zdCo+KHB0cik7CisgICAgICAgICAgICBPYmplY3RCYXNlICpvYiA9IG9icFswXTsKKyAgICAgICAgICAgIGlmIChvYikgb2ItPmluY1N5c1JlZigpOworICAgICAgICB9CisgICAgICAgIHJldHVybjsKKyAgICB9CisKKyAgICBjb25zdCB1aW50OF90ICpwID0gc3RhdGljX2Nhc3Q8Y29uc3QgdWludDhfdCAqPihwdHIpOworICAgIGZvciAodWludDMyX3QgaT0wOyBpIDwgbUZpZWxkQ291bnQ7IGkrKykgeworICAgICAgICBpZiAobUZpZWxkc1tpXS5lLT5tSGFzUmVmZXJlbmNlKSB7CisgICAgICAgICAgICBwID0gJnBbbUZpZWxkc1tpXS5vZmZzZXRCaXRzID4+IDNdOworICAgICAgICAgICAgZm9yICh1aW50MzJfdCBjdD0wOyBjdCA8IG1GaWVsZHNbaV0uYXJyYXlTaXplOyBjdCsrKSB7CisgICAgICAgICAgICAgICAgbUZpZWxkc1tpXS5lLT5pbmNSZWZzKHApOworICAgICAgICAgICAgICAgIHAgKz0gbUZpZWxkc1tpXS5lLT5nZXRTaXplQnl0ZXMoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KK30KKwordm9pZCBFbGVtZW50OjpkZWNSZWZzKGNvbnN0IHZvaWQgKnB0cikgY29uc3QKK3sKKyAgICBpZiAoIW1GaWVsZENvdW50KSB7CisgICAgICAgIGlmIChtQ29tcG9uZW50LmlzUmVmZXJlbmNlKCkpIHsKKyAgICAgICAgICAgIE9iamVjdEJhc2UgKmNvbnN0Km9icCA9IHN0YXRpY19jYXN0PE9iamVjdEJhc2UgKmNvbnN0Kj4ocHRyKTsKKyAgICAgICAgICAgIE9iamVjdEJhc2UgKm9iID0gb2JwWzBdOworICAgICAgICAgICAgaWYgKG9iKSBvYi0+ZGVjU3lzUmVmKCk7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuOworICAgIH0KKworICAgIGNvbnN0IHVpbnQ4X3QgKnAgPSBzdGF0aWNfY2FzdDxjb25zdCB1aW50OF90ICo+KHB0cik7CisgICAgZm9yICh1aW50MzJfdCBpPTA7IGkgPCBtRmllbGRDb3VudDsgaSsrKSB7CisgICAgICAgIGlmIChtRmllbGRzW2ldLmUtPm1IYXNSZWZlcmVuY2UpIHsKKyAgICAgICAgICAgIHAgPSAmcFttRmllbGRzW2ldLm9mZnNldEJpdHMgPj4gM107CisgICAgICAgICAgICBmb3IgKHVpbnQzMl90IGN0PTA7IGN0IDwgbUZpZWxkc1tpXS5hcnJheVNpemU7IGN0KyspIHsKKyAgICAgICAgICAgICAgICBtRmllbGRzW2ldLmUtPmRlY1JlZnMocCk7CisgICAgICAgICAgICAgICAgcCArPSBtRmllbGRzW2ldLmUtPmdldFNpemVCeXRlcygpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorfQogCiAKIEVsZW1lbnRTdGF0ZTo6RWxlbWVudFN0YXRlKCkKQEAgLTIzNSwxNCArMzQ0LDQxIEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNpemVfdCBjb3VudCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgUnNFbGVtZW50ICogZWluLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBjaGFyICoqIG5hbWVzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzaXplX3QgKiBuYW1lTGVuZ3RocykKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgc2l6ZV90ICogbmFtZUxlbmd0aHMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHVpbnQzMl90ICogYXJyYXlTaXplcykKIHsKICAgICAvL0xPR0UoInJzaV9FbGVtZW50Q3JlYXRlMiAlaSIsIGNvdW50KTsKLSAgICBjb25zdCBFbGVtZW50ICplID0gRWxlbWVudDo6Y3JlYXRlKHJzYywgY291bnQsIChjb25zdCBFbGVtZW50ICoqKWVpbiwgbmFtZXMsIG5hbWVMZW5ndGhzKTsKKyAgICBjb25zdCBFbGVtZW50ICplID0gRWxlbWVudDo6Y3JlYXRlKHJzYywgY291bnQsIChjb25zdCBFbGVtZW50ICoqKWVpbiwgbmFtZXMsIG5hbWVMZW5ndGhzLCBhcnJheVNpemVzKTsKICAgICBlLT5pbmNVc2VyUmVmKCk7CiAgICAgcmV0dXJuIChSc0VsZW1lbnQpZTsKIH0KIAordm9pZCByc2lfRWxlbWVudEdldE5hdGl2ZURhdGEoQ29udGV4dCAqcnNjLCBSc0VsZW1lbnQgZWxlbSwgdWludDMyX3QgKmVsZW1EYXRhLCB1aW50MzJfdCBlbGVtRGF0YVNpemUpCit7CisgICAgcnNBc3NlcnQoZWxlbURhdGFTaXplID09IDUpOworICAgIC8vIHdlIHdpbGwgcGFjayBtVHlwZTsgbUtpbmQ7IG1Ob3JtYWxpemVkOyBtVmVjdG9yU2l6ZTsgTnVtU3ViRWxlbWVudHMKKyAgICBFbGVtZW50ICplID0gc3RhdGljX2Nhc3Q8RWxlbWVudCAqPihlbGVtKTsKKworICAgICgqZWxlbURhdGErKykgPSAodWludDMyX3QpZS0+Z2V0VHlwZSgpOworICAgICgqZWxlbURhdGErKykgPSAodWludDMyX3QpZS0+Z2V0S2luZCgpOworICAgICgqZWxlbURhdGErKykgPSBlLT5nZXRDb21wb25lbnQoKS5nZXRJc05vcm1hbGl6ZWQoKSA/IDEgOiAwOworICAgICgqZWxlbURhdGErKykgPSBlLT5nZXRDb21wb25lbnQoKS5nZXRWZWN0b3JTaXplKCk7CisgICAgKCplbGVtRGF0YSsrKSA9IGUtPmdldEZpZWxkQ291bnQoKTsKKworfQorCit2b2lkIHJzaV9FbGVtZW50R2V0U3ViRWxlbWVudHMoQ29udGV4dCAqcnNjLCBSc0VsZW1lbnQgZWxlbSwgdWludDMyX3QgKmlkcywgY29uc3QgY2hhciAqKm5hbWVzLCB1aW50MzJfdCBkYXRhU2l6ZSkKK3sKKyAgICBFbGVtZW50ICplID0gc3RhdGljX2Nhc3Q8RWxlbWVudCAqPihlbGVtKTsKKyAgICByc0Fzc2VydChlLT5nZXRGaWVsZENvdW50KCkgPT0gZGF0YVNpemUpOworCisgICAgZm9yKHVpbnQzMl90IGkgPSAwOyBpIDwgZGF0YVNpemU7IGkgKyspIHsKKyAgICAgICAgaWRzW2ldID0gKHVpbnQzMl90KWUtPmdldEZpZWxkKGkpOworICAgICAgICBuYW1lc1tpXSA9IGUtPmdldEZpZWxkTmFtZShpKTsKKyAgICB9CisKK30KKwogCiB9CiB9CmRpZmYgLS1naXQgYS9saWJzL3JzL3JzRWxlbWVudC5oIGIvbGlicy9ycy9yc0VsZW1lbnQuaAppbmRleCAwMmExY2EyLi40MmVlZjRhIDEwMDY0NAotLS0gYS9saWJzL3JzL3JzRWxlbWVudC5oCisrKyBiL2xpYnMvcnMvcnNFbGVtZW50LmgKQEAgLTQwLDkgKzQwLDExIEBACiAgICAgICAgIHJldHVybiAoZ2V0U2l6ZUJpdHMoKSArIDcpID4+IDM7CiAgICAgfQogCi0gICAgc2l6ZV90IGdldEZpZWxkT2Zmc2V0Qml0cyh1aW50MzJfdCBjb21wb25lbnROdW1iZXIpIGNvbnN0OworICAgIHNpemVfdCBnZXRGaWVsZE9mZnNldEJpdHModWludDMyX3QgY29tcG9uZW50TnVtYmVyKSBjb25zdCB7CisgICAgICAgIHJldHVybiBtRmll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Yml0ID0gJWkiLCBtVXNlNjRCaXRPZmZzZXRzKTsKKworICAgIHVpbnQzMl90IG51bUluZGV4RW50cmllcyA9IGhlYWRlclN0cmVhbS0+bG9hZFUzMigpOworICAgIGZvcih1aW50MzJfdCBpID0gMDsgaSA8IG51bUluZGV4RW50cmllczsgaSArKykgeworICAgICAgICBBM0RJbmRleEVudHJ5ICplbnRyeSA9IG5ldyBBM0RJbmRleEVudHJ5KCk7CisgICAgICAgIGhlYWRlclN0cmVhbS0+bG9hZFN0cmluZygmZW50cnktPm1PYmplY3ROYW1lKTsKKyAgICAgICAgTE9HRSgiSGVhZGVyIGRhdGEsIGVudHJ5IG5hbWUgPSAlcyIsIGVudHJ5LT5tT2JqZWN0TmFtZS5zdHJpbmcoKSk7CisgICAgICAgIGVudHJ5LT5tVHlwZSA9IChSc0EzRENsYXNzSUQpaGVhZGVyU3RyZWFtLT5sb2FkVTMyKCk7CisgICAgICAgIGlmKG1Vc2U2NEJpdE9mZnNldHMpeworICAgICAgICAgICAgZW50cnktPm1PZmZzZXQgPSBoZWFkZXJTdHJlYW0tPmxvYWRPZmZzZXQoKTsKKyAgICAgICAgICAgIGVudHJ5LT5tTGVuZ3RoID0gaGVhZGVyU3RyZWFtLT5sb2FkT2Zmc2V0KCk7CisgICAgICAgIH0KKyAgICAgICAgZWxzZSB7CisgICAgICAgICAgICBlbnRyeS0+bU9mZnNldCA9IGhlYWRlclN0cmVhbS0+bG9hZFUzMigpOworICAgICAgICAgICAgZW50cnktPm1MZW5ndGggPSBoZWFkZXJTdHJlYW0tPmxvYWRVMzIoKTsKKyAgICAgICAgfQorICAgICAgICBlbnRyeS0+bVJzT2JqID0gTlVMTDsKKyAgICAgICAgbUluZGV4LnB1c2goZW50cnkpOworICAgIH0KK30KKworYm9vbCBGaWxlQTNEOjpsb2FkKGNvbnN0IHZvaWQgKmRhdGEsIHNpemVfdCBsZW5ndGgpCit7CisgICAgTE9HRSgiTG9hZGluZyBkYXRhLiBTaXplOiAldSIsIGxlbmd0aCk7CisgICAgY29uc3QgdWludDhfdCAqbG9jYWxEYXRhID0gKGNvbnN0IHVpbnQ4X3QgKilkYXRhOworCisgICAgc2l6ZV90IGxlbmd0aFJlbWFpbmluZyA9IGxlbmd0aDsKKyAgICBzaXplX3QgbWFnaWNTdHJMZW4gPSAxMjsKKyAgICBpZiAoKGxlbmd0aCA8IG1hZ2ljU3RyTGVuKSB8fAorICAgICAgICBtZW1jbXAoZGF0YSwgIkFuZHJvaWQzRF9mZiIsIG1hZ2ljU3RyTGVuKSkgeworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgbG9jYWxEYXRhICs9IG1hZ2ljU3RyTGVuOworICAgIGxlbmd0aFJlbWFpbmluZyAtPSBtYWdpY1N0ckxlbjsKKworICAgIC8vIE5leHQgd2UgZ2V0IG91ciBoZWFkZXIgc2l6ZQorICAgIHVpbnQ2NF90IGhlYWRlclNpemUgPSAwOworICAgIGlmKGxlbmd0aFJlbWFpbmluZyA8IHNpemVvZihoZWFkZXJTaXplKSkgeworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgbWVtY3B5KCZoZWFkZXJTaXplLCBsb2NhbERhdGEsIHNpemVvZihoZWFkZXJTaXplKSk7CisgICAgbG9jYWxEYXRhICs9IHNpemVvZihoZWFkZXJTaXplKTsKKyAgICBsZW5ndGhSZW1haW5pbmcgLT0gc2l6ZW9mKGhlYWRlclNpemUpOworCisgICAgTE9HRSgiTG9hZGluZyBkYXRhLCBoZWFkZXJTaXplID0gJWxsaSIsIGhlYWRlclNpemUpOworCisgICAgaWYobGVuZ3RoUmVtYWluaW5nIDwgaGVhZGVyU2l6ZSkgeworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgdWludDhfdCAqaGVhZGVyRGF0YSA9ICh1aW50OF90ICopbWFsbG9jKGhlYWRlclNpemUpOworICAgIGlmKCFoZWFkZXJEYXRhKSB7CisgICAgICAgIHJldHVybiBmYWxzZTsK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6ZSgpKSB7CisgICAgICAgIHJldHVybiBOVUxMOwogICAgIH0KIAotICAgIExPR0UoInN0cmluZ3MgZG9uZSIpOwotICAgIHVpbnQzMl90IGluZGV4RW50cnlDb3VudCA9IGluZGV4LmxvYWRVMzIoKTsKLSAgICBMT0dFKCJpbmRleCBjb3VudCAlaSIsIGluZGV4RW50cnlDb3VudCk7Ci0gICAgbUluZGV4LnNldENhcGFjaXR5KGluZGV4RW50cnlDb3VudCk7Ci0gICAgZm9yICh1aW50MzJfdCBjdCA9IDA7IGN0IDwgaW5kZXhFbnRyeUNvdW50OyBjdCsrKSB7Ci0gICAgICAgIEEzREluZGV4RW50cnkgZTsKLSAgICAgICAgdWludDMyX3Qgc3RyaW5nSW5kZXggPSBpbmRleC5sb2FkVTMyKCk7Ci0gICAgICAgIExPR0UoImluZGV4ICVpIiwgY3QpOwotICAgICAgICBMT0dFKCIgIHN0cmluZyBpbmRleCAlaSIsIHN0cmluZ0luZGV4KTsKLSAgICAgICAgZS5tVHlwZSA9IChBM0RDaHVua1R5cGUpaW5kZXgubG9hZFUzMigpOwotICAgICAgICBMT0dFKCIgIHR5cGUgJWkiLCBlLm1UeXBlKTsKLSAgICAgICAgZS5tT2Zmc2V0ID0gaW5kZXgubG9hZE9mZnNldCgpOwotICAgICAgICBMT0dFKCIgIG9mZnNldCAweCUwMTZsbHgiLCBlLm1PZmZzZXQpOwotCi0gICAgICAgIGlmIChzdHJpbmdJbmRleCAmJiAoc3RyaW5nSW5kZXggPCBtU3RyaW5ncy5zaXplKCkpKSB7Ci0gICAgICAgICAgICBlLm1JRCA9IG1TdHJpbmdzW3N0cmluZ0luZGV4XTsKLSAgICAgICAgICAgIG1TdHJpbmdJbmRleFZhbHVlcy5lZGl0SXRlbUF0KHN0cmluZ0luZGV4KSA9IGN0OwotICAgICAgICAgICAgTE9HRSgiICBpZCAlcyIsIGUubUlELnN0cmluZygpKTsKLSAgICAgICAgfQotCi0gICAgICAgIG1JbmRleC5wdXNoKGUpOw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U3RyZWFtKTsKICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICBjYXNlIDE2OgotICAgICAgICAgICAgcC0+bUluZGljaWVzW2N0XSA9IGlvLT5sb2FkVTE2KCk7CisgICAgICAgIGNhc2UgUlNfQTNEX0NMQVNTX0lEX1RZUEU6CisgICAgICAgICAgICBlbnRyeS0+bVJzT2JqID0gVHlwZTo6Y3JlYXRlRnJvbVN0cmVhbShtUlNDLCBtUmVhZFN0cmVhbSk7CiAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgY2FzZSAzMjoKLSAgICAgICAgICAgIHAtPm1JbmRpY2llc1tjdF0gPSBpby0+bG9hZFUzMigpOworICAgICAgICBjYXNlIFJTX0EzRF9DTEFTU19JRF9FTEVNRU5UOgorICAgICAgICAgICAgZW50cnktPm1Sc09iaiA9IEVsZW1lbnQ6OmNyZWF0ZUZyb21TdHJlYW0obVJTQywgbVJlYWRTdHJlYW0pOwogICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgUlNfQTNEX0NMQVNTX0lEX0FMTE9DQVRJT046CisgICAgICAgICAgICBlbnRyeS0+bVJzT2JqID0gQWxsb2NhdGlvbjo6Y3JlYXRlRnJvbVN0cmVhbShtUlNDLCBtUmVhZFN0cmVhbSk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBSU19BM0RfQ0xBU1NfSURfUFJPR1JBTV9WRVJURVg6CisgICAgICAgICAgICBlbnRyeS0+bVJzT2JqID0gUHJvZ3JhbVZlcnRleDo6Y3JlYXRlRnJvbVN0cmVhbShtUlNDLCBtUmVhZFN0cmVhbSk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBSU19BM0RfQ0xBU1NfSURfUFJPR1JBTV9SQVNURVI6CisgICAgICAgICAgICBlbnRyeS0+bVJzT2JqID0gUHJvZ3JhbVJhc3Rlcjo6Y3JlYXRlRnJvbVN0cmVhbShtUlNDLCBtUmVhZFN0cmVhbSk7CisgICAgICAgICAg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dHJlYW0uYWRkVTMyKG1NYWpvclZlcnNpb24pOworICAgIGhlYWRlclN0cmVhbS5hZGRVMzIobU1pbm9yVmVyc2lvbik7CisgICAgdWludDMyX3QgaXM2NEJpdCA9IDA7CisgICAgaGVhZGVyU3RyZWFtLmFkZFUzMihpczY0Qml0KTsKKworICAgIHVpbnQzMl90IHdyaXRlSW5kZXhTaXplID0gbVdyaXRlSW5kZXguc2l6ZSgpOworICAgIGhlYWRlclN0cmVhbS5hZGRVMzIod3JpdGVJbmRleFNpemUpOworICAgIGZvcih1aW50MzJfdCBpID0gMDsgaSA8IHdyaXRlSW5kZXhTaXplOyBpICsrKSB7CisgICAgICAgIGhlYWRlclN0cmVhbS5hZGRTdHJpbmcoJm1Xcml0ZUluZGV4W2ldLT5tT2JqZWN0TmFtZSk7CisgICAgICAgIGhlYWRlclN0cmVhbS5hZGRVMzIoKHVpbnQzMl90KW1Xcml0ZUluZGV4W2ldLT5tVHlwZSk7CisgICAgICAgIGlmKG1Vc2U2NEJpdE9mZnNldHMpeworICAgICAgICAgICAgaGVhZGVyU3RyZWFtLmFkZE9mZnNldChtV3JpdGVJbmRleFtpXS0+bU9mZnNldCk7CisgICAgICAgICAgICBoZWFkZXJTdHJlYW0uYWRkT2Zmc2V0KG1Xcml0ZUluZGV4W2ldLT5tTGVuZ3RoKTsKICAgICAgICAgfQotICAgICAgICBMT0dFKCIgIGlkeCAlaSIsIHAtPm1JbmRpY2llc1tjdF0pOwotICAgIH0KLQotICAgIGlmIChwLT5tUmVzdGFydENvdW50cykgewotICAgICAgICBwLT5tUmVzdGFydHMgPSBuZXcgdWludDE2X3RbcC0+bVJlc3RhcnRDb3VudHNdOwotICAgICAgICBmb3IgKHVpbnQzMl90IGN0ID0gMDsgY3QgPCBwLT5tUmVzdGFydENvdW50czsgY3QrKykgewotICAgICAgICAgICAgc3dpdGNoKGJpdHMpIHsKLSAgICAgICAgICAgIGNhc2UgODoKLSAgICAgICAgICAgICAgICBwLT5tUmVzdGFydH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pOworCisgICAgaWYoZmEzZCkgeworICAgICAgICAqbnVtRW50cmllcyA9IGZhM2QtPmdldE51bUluZGV4RW50cmllcygpOworICAgIH0KKyAgICBlbHNlIHsKKyAgICAgICAgKm51bUVudHJpZXMgPSAwOworICAgIH0KK30KKwordm9pZCByc2lfRmlsZUEzREdldEluZGV4RW50cmllcyhDb250ZXh0ICpyc2MsIFJzRmlsZUluZGV4RW50cnkgKmZpbGVFbnRyaWVzLCB1aW50MzJfdCBudW1FbnRyaWVzLCBSc0ZpbGUgZmlsZSkKK3sKKyAgICBGaWxlQTNEICpmYTNkID0gc3RhdGljX2Nhc3Q8RmlsZUEzRCAqPihmaWxlKTsKKworICAgIGlmKCFmYTNkKSB7CisgICAgICAgIExPR0UoIkNhbid0IGxvYWQgaW5kZXggZW50cmllcy4gTm8gdmFsaWQgZmlsZSIpOworICAgICAgICByZXR1cm47CisgICAgfQorCisgICAgdWludDMyX3QgbnVtRmlsZUVudHJpZXMgPSBmYTNkLT5nZXROdW1JbmRleEVudHJpZXMoKTsKKyAgICBpZihudW1GaWxlRW50cmllcyAhPSBudW1FbnRyaWVzIHx8IG51bUVudHJpZXMgPT0gMCB8fCBmaWxlRW50cmllcyA9PSBOVUxMKSB7CisgICAgICAgIExPR0UoIkNhbid0IGxvYWQgaW5kZXggZW50cmllcy4gSW52YWxpZCBudW1iZXIgcmVxdWVzdGVkIik7CisgICAgICAgIHJldHVybjsKKyAgICB9CisKKyAgICBmb3IodWludDMyX3QgaSA9IDA7IGkgPCBudW1GaWxlRW50cmllczsgaSArKykgeworICAgICAgICBjb25zdCBGaWxlQTNEOjpBM0RJbmRleEVudHJ5ICplbnRyeSA9IGZhM2QtPmdldEluZGV4RW50cnkoaSk7CisgICAgICAgIGZpbGVFbnRyaWVzW2ldLmNsYXNzSUQgPSBlbnRyeS0+Z2V0VHlwZSgpOworICAgICAgICBmaWxlRW50cmllc1tpXS5vYmplY3ROYW1lID0gZW50cnktPmdldE9iamVjdE5hbWUoKS5z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pYzoKLSAgICBGaWxlQTNEKCk7CisgICAgRmlsZUEzRChDb250ZXh0ICpyc2MpOwogICAgIH5GaWxlQTNEKCk7CiAKICAgICB1aW50MzJfdCBtTWFqb3JWZXJzaW9uOwpAQCAtNDAsNzggKzQzLDUzIEBACiAgICAgdWludDY0X3QgbVN0cmluZ1RhYmxlT2Zmc2V0OwogICAgIGJvb2wgbVVzZTY0Qml0T2Zmc2V0czsKIAotICAgIHN0cnVjdCBBM0RJbmRleEVudHJ5IHsKLSAgICAgICAgU3RyaW5nOCBtSUQ7Ci0gICAgICAgIEEzRENodW5rVHlwZSBtVHlwZTsKKyAgICBjbGFzcyBBM0RJbmRleEVudHJ5IHsKKyAgICAgICAgU3RyaW5nOCBtT2JqZWN0TmFtZTsKKyAgICAgICAgUnNBM0RDbGFzc0lEIG1UeXBlOwogICAgICAgICB1aW50NjRfdCBtT2Zmc2V0OwotICAgICAgICB2b2lkICogbVJzT2JqOworICAgICAgICB1aW50NjRfdCBtTGVuZ3RoOworICAgICAgICBPYmplY3RCYXNlICptUnNPYmo7CisgICAgcHVibGljOgorICAgICAgICBmcmllbmQgY2xhc3MgRmlsZUEzRDsKKyAgICAgICAgY29uc3QgU3RyaW5nOCAmZ2V0T2JqZWN0TmFtZSgpIGNvbnN0IHsKKyAgICAgICAgICAgIHJldHVybiBtT2JqZWN0TmFtZTsKKyAgICAgICAgfQorICAgICAgICBSc0EzRENsYXNzSUQgZ2V0VHlwZSgpIGNvbnN0IHsKKyAgICAgICAgICAgIHJldHVybiBtVHlwZTsKKyAgICAgICAgfQogICAgIH07CiAKLSAgICBib29sIGxvYWQoQ29udGV4dCAqcnNjLCBGSUxFICpmKTsKKyAgICBib29sIGxvYWQoRklMRSAqZik7CisgICAgYm9vbCBsb2FkKGNvbnN0IHZvaWQgKmRhdGEsIHNpemVfdCBsZW5ndGgpOworCisgICAgc2l6ZV90IGdldE51bUluZGV4RW50cmllcygpIGNvbnN0OworICAgIGNvbnN0IEEzREluZGV4RW50cnkqIGdldEluZGV4RW50cnkoc2l6ZV90IGluZGV4KSBjb25zdDsKKyAgICBPYmplY3RCYXNlICppbml0aWFsaXplRnJvbUVudHJ5KHNpemVfdCBpbmRleCk7CisKKyAgICB2b2lkIGFwcGVuZFRvRmlsZShPYmplY3RCYXNlICpvYmopOworICAgIGJvb2wgd3JpdGVGaWxlKGNvbnN0IGNoYXIgKmZpbGVuYW1lKTsKKworICAgIC8vIEN1cnJlbnRseSBmaWxlcyBkbyBub3QgZ2V0IHNlcmlhbGl6ZWQsCisgICAgLy8gYnV0IHdlIG5lZWQgdG8gaW5oZXJpdCBmcm9tIE9iamVjdEJhc2UgZm9yIHJlZiB0cmFja2luZworICAgIHZpcnR1YWwgdm9pZCBzZXJpYWxpemUoT1N0cmVhbSAqc3RyZWFtKSBjb25zdCB7CisgICAgfQorICAgIHZpcnR1YWwgUnNBM0RDbGFzc0lEIGdldENsYXNzSWQoKSBjb25zdCB7CisgICAgICAgIHJldHVybiBSU19BM0RfQ0xBU1NfSURfVU5LTk9XTjsKKyAgICB9CiAKIHByb3RlY3RlZDoKLSAgICBjbGFzcyBJTwotICAgIHsKLSAgICBwdWJsaWM6Ci0gICAgICAgIElPKGNvbnN0IHVpbnQ4X3QgKiwgYm9vbCB1c2U2NCk7Ci0gICAgCi0gICAgICAgIGZsb2F0IGxvYWRGKCkgewotICAgICAgICAgICAgbVBvcyA9IChtUG9zICsgMykgJiAofjMpOwotICAgICAgICAgICAgZmxvYXQgdG1wID0gcmVpbnRlcnByZXRfY2FzdDxjb25zdCBmbG9hdCAqPigmbURhdGFbbVBvc10pWzBdOwotICAgICAgICAgICAgbVBvcyArPSBzaXplb2YoZmxvYXQpOwotICAgICAgICAgICAgcmV0dXJuIHRtcDsKLSAgICAgICAgfQotICAgICAgICBpbnQzMl90IGxvYWRJMzIoKSB7Ci0gICAgICAgICAgICBtUG9zID0gKG1Qb3MgKyAzKSAmICh+Myk7Ci0gICAgICAgICAgICBpbnQzMl90IHRtcCA9IHJlaW50ZXJwcmV0X2Nhc3Q8Y29uc3QgaW50MzJfdCAqPigmbURhdGFbbVBvc10pWzBdOwotICAgICAgICAgICAgbVBvcyArPSBzaXplb2YoaW50MzJfdCk7Ci0gICAgICAgICAgICByZXR1cm4gdG1wOwotICAgICAgICB9Ci0gICAgICAgIHVpbnQzMl90IGxvYWRVMzIoKSB7Ci0gICAgICAgICAgICBtUG9zID0gKG1Qb3MgKyAzKSAmICh+Myk7Ci0gICAgICAgICAgICB1aW50MzJfdCB0bXAgPSByZWludGVycHJldF9jYXN0PGNvbnN0IHVpbnQzMl90ICo+KCZtRGF0YVttUG9zXSlbMF07Ci0gICAgICAgICAgICBtUG9zICs9IHNpemVvZih1aW50MzJfdCk7Ci0gICAgICAgICAgICByZXR1cm4gdG1wOwotICAgICAgICB9Ci0gICAgICAgIHVpbnQxNl90IGxvYWRVMTYoKSB7Ci0gICAgICAgICAgICBtUG9zID0gKG1Qb3MgKyAxKSAmICh+MSk7Ci0gICAgICAgICAgICB1aW50MTZfdCB0bXAgPSByZWludGVycHJldF9jYXN0PGNvbnN0IHVpbnQxNl90ICo+KCZtRGF0YVttUG9zXSlbMF07Ci0gICAgICAgICAgICBtUG9zICs9IHNpemVvZih1aW50MTZfdCk7Ci0gICAgICAgICAgICByZXR1cm4gdG1wOwotICAgICAgICB9Ci0gICAgICAgIHVpbnQ4X3QgbG9hZFU4KCkgewotICAgICAgICAgICAgdWludDhfdCB0bXAgPSByZWludGVycHJldF9jYXN0PGNvbnN0IHVpbnQ4X3QgKj4oJm1EYXRhW21Qb3NdKVswXTsKLSAgICAgICAgICAgIG1Qb3MgKz0gc2l6ZW9mKHVpbnQ4X3QpOwotICAgICAgICAgICAgcmV0dXJuIHRtcDsKLSAgICAgICAgfQotICAgICAgICB1aW50NjRfdCBsb2FkT2Zmc2V0KCk7Ci0gICAgICAgIHZvaWQgbG9hZFN0cmluZyhTdHJpbmc4ICpzKTsKLSAgICAgICAgdWludDY0X3QgZ2V0UG9zKCkgY29uc3Qge3JldHVybiBtUG9zO30KLSAgICAgICAgY29uc3QgdWludDhfdCAqIGdldFB0cigpIGNvbnN0OwotICAgIHByb3RlY3RlZDoKLSAgICAgICAgY29uc3QgdWludDhfdCAqIG1EYXRhOwotICAgICAgICB1aW50NjRfdCBtUG9zOwotICAgICAgICBib29sIG1Vc2U2NDsKLSAgICB9OwogCi0KLSAgICBib29sIHByb2Nlc3MoQ29udGV4dCAqcnNjKTsKLSAgICBib29sIHByb2Nlc3NJbmRleChDb250ZXh0ICpyc2MsIEEzREluZGV4RW50cnkgKik7Ci0gICAgdm9pZCBwcm9jZXNzQ2h1bmtfTWVzaChDb250ZXh0ICpyc2MsIElPICppbywgQTNESW5kZXhFbnRyeSAqaWUpOwotICAgIHZvaWQgcHJvY2Vzc0NodW5rX1ByaW1pdGl2ZShDb250ZXh0ICpyc2MsIElPICppbywgQTNESW5kZXhFbnRyeSAqaWUpOwotICAgIHZvaWQgcHJvY2Vzc0NodW5rX1ZlcnRpY2llcyhDb250ZXh0ICpyc2MsIElPICppbywgQTNESW5kZXhFbnRyeSAqaWUpOwotICAgIHZvaWQgcHJvY2Vzc0NodW5rX0VsZW1lbnQoQ29udGV4dCAqcnNjLCBJTyAqaW8sIEEzREluZGV4RW50cnkgKmllKTsKLSAgICB2b2lkIHByb2Nlc3NDaHVua19FbGVtZW50U291cmNlKENvbnRleHQgKnJzYywgSU8gKmlvLCBBM0RJbmRleEVudHJ5ICppZSk7CisgICAgdm9pZCBwYXJzZUhlYWRlcihJU3RyZWFtICpoZWFkZXJTdHJlYW0pOwogCiAgICAgY29uc3QgdWludDhfdCAqIG1EYXRhOwogICAgIHZvaWQgKiBtQWxsb2M7CiAgICAgdWludDY0X3QgbURhdGFTaXplOwotICAgIENvbnRleHQgKiBtUnNjOwogCi0gICAgVmVjdG9yPEEzREluZGV4RW50cnk+IG1JbmRleDsKLSAgICBWZWN0b3I8U3RyaW5nOD4gbVN0cmluZ3M7Ci0gICAgVmVjdG9yPH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tRm9udE5hbWUgPSBuYW1lOworICAgIG1Gb250U2l6ZSA9IGZvbnRTaXplOworICAgIG1EcGkgPSBkcGk7CisKKyAgICBlcnJvciA9IEZUX1NldF9DaGFyX1NpemUobUZhY2UsIGZvbnRTaXplICogNjQsIDAsIGRwaSwgMCk7CisgICAgaWYoZXJyb3IpIHsKKyAgICAgICAgTE9HRSgiVW5hYmxlIHRvIHNldCBmb250IHNpemUgb24gJXMiLCBmdWxsUGF0aC5zdHJpbmcoKSk7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKKyAgICBtSGFzS2VybmluZyA9IEZUX0hBU19LRVJOSU5HKG1GYWNlKTsKKworICAgIG1Jbml0aWFsaXplZCA9IHRydWU7CisgICAgcmV0dXJuIHRydWU7Cit9CisKK3ZvaWQgRm9udDo6aW52YWxpZGF0ZVRleHR1cmVDYWNoZSgpCit7CisgICAgZm9yKHVpbnQzMl90IGkgPSAwOyBpIDwgbUNhY2hlZEdseXBocy5zaXplKCk7IGkgKyspIHsKKyAgICAgICAgbUNhY2hlZEdseXBocy52YWx1ZUF0KGkpLT5tSXNWYWxpZCA9IGZhbHNlOworICAgIH0KK30KKwordm9pZCBGb250OjpkcmF3Q2FjaGVkR2x5cGgoQ2FjaGVkR2x5cGhJbmZvICpnbHlwaCwgaW50IHgsIGludCB5KQoreworICAgIEZvbnRTdGF0ZSAqc3RhdGUgPSAmbVJTQy0+bVN0YXRlRm9udDsKKworICAgIGludCBuUGVuWCA9IHggKyBnbHlwaC0+bUJpdG1hcExlZnQ7CisgICAgaW50IG5QZW5ZID0geSAtIGdseXBoLT5tQml0bWFwVG9wICsgZ2x5cGgtPm1CaXRtYXBIZWlnaHQ7CisKKyAgICBzdGF0ZS0+YXBwZW5kTWVzaFF1YWQoblBlblgsIG5QZW5ZLCAwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdseXBoLT5tQml0bWFwTWluVSwgZ2x5cGgtPm1CaXRtYXBNYXhWLAorCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgblBlblggKyAoaW50KWdseXBoLT5tQml0bWFwV2lkdGgsIG5QZW5ZLCAwLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdseXBoLT5tQml0bWFwTWF4VSwgZ2x5cGgtPm1CaXRtYXBNYXhWLAorCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgblBlblggKyAoaW50KWdseXBoLT5tQml0bWFwV2lkdGgsIG5QZW5ZIC0gKGludClnbHlwaC0+bUJpdG1hcEhlaWdodCwgMCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBnbHlwaC0+bUJpdG1hcE1heFUsIGdseXBoLT5tQml0bWFwTWluViwKKworICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5QZW5YLCBuUGVuWSAtIChpbnQpZ2x5cGgtPm1CaXRtYXBIZWlnaHQsIDAsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2x5cGgtPm1CaXRtYXBNaW5VLCBnbHlwaC0+bUJpdG1hcE1pblYpOworfQorCit2b2lkIEZvbnQ6OnJlbmRlclVURihjb25zdCBjaGFyICp0ZXh0LCB1aW50MzJfdCBsZW4sIHVpbnQzMl90IHN0YXJ0LCBpbnQgbnVtR2x5cGhzLCBpbnQgeCwgaW50IHkpCit7CisgICAgaWYoIW1Jbml0aWFsaXplZCB8fCBudW1HbHlwaHMgPT0gMCB8fCB0ZXh0ID09IE5VTEwgfHwgbGVuID09IDApIHsKKyAgICAgICAgcmV0dXJuOworICAgIH0KKworICAgIGludCBwZW5YID0geCwgcGVuWSA9IHk7CisgICAgaW50IGdseXBoc0xlZnQgPSAxOworICAgIGlmKG51bUdseXBocyA+IDApIHsKKyAgICAgICAgZ2x5cGhzTGVmdCA9IG51bUdseXBoczsKKyAgICB9CisKKyAgICBzaXplX3QgaW5kZXggPSBzdGFydDsKKyAgICBzaXplX3QgbmV4dEluZGV4ID0gMDsKKworICAgIHdoaWxlIChnbHlwaHNMZWZ0ID4gMCkgeworCisgICAgICAgIGludDMyX3QgdXRmQ2hhciA9IHV0ZjMyX2F0KHRleHQsIGxlbiwgaW5kZXgsICZuZXh0SW5kZXgpOworCisgICAgICAgIC8vIFJlYWNoZWQgdGhlIGVuZCBvZiB0aGUgc3RyaW5nIG9yIGVuY291bnRlcmVkCisgICAgICAgIGlmKHV0ZkNoYXIgPCAwKSB7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorCisgICAgICAgIC8vIE1vdmUgdG8gdGhlIG5leHQgY2hhcmFjdGVyIGluIHRoZSBhcnJheQorICAgICAgICBpbmRleCA9IG5leHRJbmRleDsKKworICAgICAgICBDYWNoZWRHbHlwaEluZm8gKmNhY2hlZEdseXBoID0gZ2V0Q2FjaGVkVVRGQ2hhcih1dGZDaGFyKTsKKworICAgICAgICAvLyBJZiBpdCdzIHN0aWxsIG5vdCB2YWxpZCwgd2UgY291bGRuJ3QgY2FjaGUgaXQsIHNvIHdlIHNob3VsZG4ndCBkcmF3IGdhcmJhZ2UKKyAgICAgICAgaWYoY2FjaGVkR2x5cGgtPm1Jc1ZhbGlkKSB7CisgICAgICAgICAgICBkcmF3Q2FjaGVkR2x5cGgoY2FjaGVkR2x5cGgsIHBlblgsIHBlblkpOworICAgICAgICB9CisKKyAgICAgICAgcGVuWCArPSAoY2FjaGVkR2x5cGgtPm1BZHZhbmNlLnggPj4gNik7CisKKyAgICAgICAgLy8gSWYgd2Ugd2VyZSBnaXZlbiBhIHNwZWNpZmljIG51bWJlciBvZiBnbHlwaHMsIGRlY3JlbWVudAorICAgICAgICBpZihudW1HbHlwaHMgPiAwKSB7CisgICAgICAgICAgICBnbHlwaHNMZWZ0IC0tOworICAgICAgICB9CisgICAgfQorfQorCitGb250OjpDYWNoZWRHbHlwaEluZm8qIEZvbnQ6OmdldENhY2hlZFVURkNoYXIoaW50MzJfdCB1dGZDaGFyKSB7CisKKyAgICBDYWNoZWRHbHlwaEluZm8gKmNhY2hlZEdseXBoID0gbUNhY2hlZEdseXBocy52YWx1ZUZ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G5ld0ZvbnQtPmluaXQobmFtZSwgZm9udFNpemUsIGRwaSk7CisgICAgaWYoaXNJbml0aWFsaXplZCkgeworICAgICAgICBhY3RpdmVGb250cy5wdXNoKG5ld0ZvbnQpOworICAgICAgICByc2MtPm1TdGF0ZUZvbnQucHJlY2FjaGVMYXRpbihuZXdGb250KTsKKyAgICAgICAgcmV0dXJuIG5ld0ZvbnQ7CisgICAgfQorCisgICAgZGVsZXRlIG5ld0ZvbnQ7CisgICAgcmV0dXJuIE5VTEw7CisKK30KKworRm9udDo6fkZvbnQoKQoreworICAgIGlmKG1GYWNlKSB7CisgICAgICAgIEZUX0RvbmVfRmFjZShtRmFjZSk7CisgICAgfQorCisgICAgZm9yICh1aW50MzJfdCBjdCA9IDA7IGN0IDwgbVJTQy0+bVN0YXRlRm9udC5tQWN0aXZlRm9udHMuc2l6ZSgpOyBjdCsrKSB7CisgICAgICAgIGlmIChtUlNDLT5tU3RhdGVGb250Lm1BY3RpdmVGb250c1tjdF0gPT0gdGhpcykgeworICAgICAgICAgICAgbVJTQy0+bVN0YXRlRm9udC5tQWN0aXZlRm9udHMucmVtb3ZlQXQoY3QpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBmb3IodWludDMyX3QgaSA9IDA7IGkgPCBtQ2FjaGVkR2x5cGhzLnNpemUoKTsgaSArKykgeworICAgICAgICBDYWNoZWRHbHlwaEluZm8gKmdseXBoID0gbUNhY2hlZEdseXBocy52YWx1ZUF0KGkpOworICAgICAgICBkZWxldGUgZ2x5cGg7CisgICAgfQorfQorCitGb250U3RhdGU6OkZvbnRTdGF0ZSgpCit7CisgICAgbUluaXRpYWxpemVkID0gZmFsc2U7CisgICAgbU1heE51bWJlck9mUXVhZHMgPSAxMDI0OworICAgIG1DdXJyZW50UXVhZEluZGV4ID0gMDsKKyAgICBtUlNDID0gTlVMTDsKKyAgICBtTGlicmFyeSA9IE5VTEw7CisgICAgc2V0Rm9udENvbG9yKDAuMWYsIDAuMWYsIDAuMWYsIDEuMGYpOworfQorCitGb250U3RhdGU6On5Gb250U3RhdGUoKQoreworICAgIGZvcih1aW50MzJfdCBpID0gMDsgaSA8IG1DYWNoZUxpbmVzLnNpemUoKTsgaSArKykgeworICAgICAgICBkZWxldGUgbUNhY2hlTGluZXNbaV07CisgICAgfQorCisgICAgcnNBc3NlcnQoIW1BY3RpdmVGb250cy5zaXplKCkpOworfQorCitGVF9MaWJyYXJ5IEZvbnRTdGF0ZTo6Z2V0TGliKCkKK3sKKyAgICBpZighbUxpYnJhcnkpIHsKKyAgICAgICAgRlRfRXJyb3IgZXJyb3IgPSBGVF9Jbml0X0ZyZWVUeXBlKCZtTGlicmFyeSk7CisgICAgICAgIGlmKGVycm9yKSB7CisgICAgICAgICAgICBMT0dFKCJVbmFibGUgdG8gaW5pdGlhbGl6ZSBmcmVldHlwZSIpOworICAgICAgICAgICAgcmV0dXJuIE5VTEw7CisgICAgICAgIH0KKyAgICB9CisKKyAgICByZXR1cm4gbUxpYnJhcnk7Cit9CisKK3ZvaWQgRm9udFN0YXRlOjppbml0KENvbnRleHQgKnJzYykKK3sKKyAgICBtUlNDID0gcnNjOworfQorCit2b2lkIEZvbnRTdGF0ZTo6Zmx1c2hBbGxBbmRJbnZhbGlkYXRlKCkKK3sKKyAgICBpZihtQ3VycmVudFF1YWRJbmRleCAhPSAwKSB7CisgICAgICAgIGlzc3VlRHJhd0NvbW1hbmQoKTsKKyAgICAgICAgbUN1cnJlbnRRdWFkSW5kZXggPSAwOworICAgIH0KKyAgICBmb3IodWludDMyX3QgaSA9IDA7IGkgPCBtQWN0aXZlRm9udHMuc2l6ZSgpOyBpICsrKSB7CisgICAgICAgIG1BY3RpdmVGb250c1tpXS0+aW52YWxpZGF0ZVRleHR1cmVDYWNoZSgpOworICAgIH0KKyAgICBmb3IodWludDMyX3QgaSA9IDA7IGkgPCBtQ2FjaGVMaW5lcy5zaXplKCk7IGkgKyspIHsKKyAgICAgICAgbUNhY2hlTG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AgaWYoIWJpdG1hcEZpdCkgeworICAgICAgICBmbHVzaEFsbEFuZEludmFsaWRhdGUoKTsKKworICAgICAgICAvLyBUcnkgdG8gZml0IGl0IGFnYWluCisgICAgICAgIGZvcih1aW50MzJfdCBpID0gMDsgaSA8IG1DYWNoZUxpbmVzLnNpemUoKTsgaSArKykgeworICAgICAgICAgICAgYml0bWFwRml0ID0gbUNhY2hlTGluZXNbaV0tPmZpdEJpdG1hcChiaXRtYXAsICZzdGFydFgsICZzdGFydFkpOworICAgICAgICAgICAgaWYoYml0bWFwRml0KSB7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICAvLyBpZiB3ZSBzdGlsbCBkb24ndCBmaXQsIHNvbWV0aGluZyBpcyB3cm9uZyBhbmQgd2Ugc2hvdWxkbid0IGRyYXcKKyAgICAgICAgaWYoIWJpdG1hcEZpdCkgeworICAgICAgICAgICAgTE9HRSgiQml0bWFwIGRvZXNuJ3QgZml0IGluIGNhY2hlLiB3aWR0aCwgaGVpZ2h0ID0gJWksICVpIiwgKGludCliaXRtYXAtPndpZHRoLCAoaW50KWJpdG1hcC0+cm93cyk7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAqcmV0T3JpZ2luWCA9IHN0YXJ0WDsKKyAgICAqcmV0T3JpZ2luWSA9IHN0YXJ0WTsKKworICAgIHVpbnQzMl90IGVuZFggPSBzdGFydFggKyBiaXRtYXAtPndpZHRoOworICAgIHVpbnQzMl90IGVuZFkgPSBzdGFydFkgKyBiaXRtYXAtPnJvd3M7CisKKyAgICB1aW50MzJfdCBjYWNoZVdpZHRoID0gZ2V0Q2FjaGVUZXh0dXJlVHlwZSgpLT5nZXREaW1YKCk7CisKKyAgICB1bnNpZ25lZCBjaGFyICpjYWNoZUJ1ZmZlciA9ICh1bnNpZ25lZCBjaGFyKiltVGV4dFRleHR1cmUtPmdldFB0cigpOworICAg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UdORURfU0hPUlQsICh1aW50MTZfdCAqKSgwKSk7CisKKyAgICAvLyBSZXNldCB0aGUgc3RhdGUKKyAgICBtUlNDLT5zZXRWZXJ0ZXgoKFByb2dyYW1WZXJ0ZXggKil0bXBWLmdldCgpKTsKKyAgICBtUlNDLT5zZXRSYXN0ZXIoKFByb2dyYW1SYXN0ZXIgKil0bXBSLmdldCgpKTsKKyAgICBtUlNDLT5zZXRGcmFnbWVudCgoUHJvZ3JhbUZyYWdtZW50ICopdG1wRi5nZXQoKSk7CisgICAgbVJTQy0+c2V0RnJhZ21lbnRTdG9yZSgoUHJvZ3JhbVN0b3JlICopdG1wUFMuZ2V0KCkpOworfQorCit2b2lkIEZvbnRTdGF0ZTo6YXBwZW5kTWVzaFF1YWQoZmxvYXQgeDEsIGZsb2F0IHkxLCBmbG9hdCB6MSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB1MSwgZmxvYXQgdjEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgeDIsIGZsb2F0IHkyLCBmbG9hdCB6MiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB1MiwgZmxvYXQgdjIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgeDMsIGZsb2F0IHkzLCBmbG9hdCB6MywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB1MywgZmxvYXQgdjMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgeDQsIGZsb2F0IHk0LCBmbG9hdCB6NCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB1NCwgZmxvYXQgdjQpCit7CisgICAgY29uc3QgdWludDMyX3QgdmVydHNQZXJRdWFkID0gNDsKKyAgICBjb25zdCB1aW50MzJfdCBmbG9hdHNQZXJWZXJ0ID0gNTsKKyAgICBmbG9hdCAqY3VycmVudFBvcyA9IG1UZXh0TWVzaFB0ciArIG1DdXJyZW50UXVhZEluZGV4ICogdmVydHNQZXJRdWFkICogZmxvYXRzUGVyVmVydDsKKworICAgIC8vIEN1bGwgdGhpbmdzIHRoYXQgYXJlIG9mZiB0aGUgc2NyZWVuCisgICAgZmxvYXQgd2lkdGggPSAoZmxvYXQpbVJTQy0+Z2V0V2lkdGgoKTsKKyAgICBmbG9hdCBoZWlnaHQgPSAoZmxvYXQpbVJTQy0+Z2V0SGVpZ2h0KCk7CisKKyAgICBpZih4MSA+IHdpZHRoIHx8IHkxIDwgMC4wZiB8fCB4MiA8IDAgfHwgeTQgPiBoZWlnaHQpIHsKKyAgICAgICAgcmV0dXJuOworICAgIH0KKworICAgIC8qTE9HRSgiVjAgeDogJWYgeTogJWYgejogJWYiLCB4MSwgeTEsIHoxKTsKKyAgICBMT0dFKCJWMSB4OiAlZiB5OiAlZiB6OiAlZiIsIHgyLCB5MiwgejIpOworICAgIExPR0UoIlYyIHg6ICVmIHk6ICVmIHo6ICVmIiwgeDMsIHkzLCB6Myk7CisgICAgTE9HRSgiVjMgeDogJWYgeTogJWYgejogJWYiLCB4NCwgeTQsIHo0KTsqLworCisgICAgKCpjdXJyZW50UG9zKyspID0geDE7CisgICAgKCpjdXJyZW50UG9zKyspID0geTE7CisgICAgKCpjdXJyZW50UG9zKyspID0gejE7CisgICAgKCpjdXJyZW50UG9zKyspID0gdTE7CisgICAgKCpjdXJyZW50UG9zKyspID0gdjE7CisKKyAgICAoKmN1cnJlbnRQb3MrKykgPSB4MjsKKyAgICAoKmN1cnJlbnRQb3MrKykgPSB5MjsKKyAgICAoKmN1cnJlbnRQb3MrKykgPSB6MjsKKyAgICAoKmN1cnJlbnRQb3MrKykgPSB1MjsKKyAgICAoKmN1cnJlbnRQb3MrKykgPSB2MjsKKworICAgICgqY3VycmVudFBvcysrKSA9IHgzOworICAgICgqY3VycmVudFBvcysrKSA9IHkzOworICAgICgqY3VycmVudFBvcysrKSA9IHozOworICAgICgqY3VycmVudFBvcysrKSA9IHUzOworICAgICgqY3VycmVudFBvcysrKSA9IHYzOworCisgICAgKCpjdXJyZW50UG9zKyspID0geDQ7CisgICAgKCpjdXJyZW50UG9zKyspID0geTQ7CisgICAgKCpjdXJyZW50UG9zKyspID0gejQ7CisgICAgKCpjdXJyZW50UG9zKyspID0gdTQ7CisgICAgKCpjdXJyZW50UG9zKyspID0gdjQ7CisKKyAgICBtQ3VycmVudFF1YWRJbmRleCArKzsKKworICAgIGlmKG1DdXJyZW50UXVhZEluZGV4ID09IG1NYXhOdW1iZXJPZlF1YWRzKSB7CisgICAgICAgIGlzc3VlRHJhd0NvbW1hbmQoKTsKKyAgICAgICAgbUN1cnJlbnRRdWFkSW5kZXggPSAwOworICAgIH0KK30KKwordWludDMyX3QgRm9udFN0YXRlOjpnZXRSZW1haW5pbmdDYWNoZUNhcGFjaXR5KCkgeworICAgIHVpbnQzMl90IHJlbWFpbmluZ0NhcGFjaXR5ID0gMDsKKyAgICB1aW50MzJfdCB0b3RhbFBpeGVscyA9IDA7CisgICAgZm9yKHVpbnQzMl90IGkgPSAwOyBpIDwgbUNhY2hlTGluZXMuc2l6ZSgpOyBpICsrKSB7CisgICAgICAgICByZW1haW5pbmdDYXBhY2l0eSArPSAobUNhY2hlTGluZXNbaV0tPm1NYXhXaWR0aCAtIG1DYWNoZUxpbmVzW2ldLT5tQ3VycmVudENvbCk7CisgICAgICAgICB0b3RhbFBpeGVscyArPSBtQ2FjaGVMaW5lc1tpXS0+bU1heFdpZHRoOworICAgIH0KKyAgICByZW1haW5pbmdDYXBhY2l0eSA9IChyZW1haW5pbmdDYXBhY2l0eSAqIDEwMCkgLyB0b3RhbFBpeGVsczsKKyAgICByZXR1cm4gcmVtYWluaW5nQ2FwYWNpdHk7Cit9CisKK3ZvaWQgRm9udFN0YXRlOjpwcmVjYWNoZUxhdGluKEZvbnQgKmZvbnQpIHsKKyAgICAvLyBSZW1haW5pbmcgY2FwYWNpdHkgaXMgbWVhc3VyZWQgaW4gJQorICAgIHVpbnQzMl90IHJlbWFpbmluZ0NhcGFjaXR5ID0gZ2V0UmVtYWluaW5nQ2FjaGVDYXBhY2l0eSgpOworICAgIHVpbnQzMl90IHByZWNhY2hlSWR4ID0gMDsKKyAgICB3aGlsZShyZW1haW5pbmdDYXBhY2l0eSA+IDI1ICYmIHByZWNhY2hlSWR4IDwgbUxhdGluUHJlY2FjaGUuc2l6ZSgpKSB7CisgICAgICAgIGZvbnQtPmdldENhY2hlZFVURkNoYXIoKGludDMyX3QpbUxhdGluUHJlY2FjaGVbcHJlY2FjaGVJZHhdKTsKKyAgICAgICAgcmVtYWluaW5nQ2FwYWNpdHkgPSBnZXRSZW1haW5pbmdDYWNoZUNhcGFjaXR5KCk7CisgICAgICAgIHByZWNhY2hlSWR4ICsrOworICAgIH0KK30KKworCit2b2lkIEZvbnRTdGF0ZTo6cmVuZGVyVGV4dChjb25zdCBjaGFyICp0ZXh0LCB1aW50MzJfdCBsZW4sIHVpbnQzMl90IHN0YXJ0SW5kZXgsIGludCBudW1HbHlwaHMsIGludCB4LCBpbnQgeSkKK3sKKyAgICBjaGVja0luaXQoKTsKKworICAgIC8vIFJlbmRlciBjb2RlIGhlcmUKKyAgICBGb250ICpjdXJyZW50Rm9udCA9IG1SU0MtPmdldEZvbnQoKTsKKyAgICBpZighY3VycmVudEZvbnQpIHsKKyAgICAgICAgaWYoIW1EZWZhdWx0LmdldCgpKSB7CisgICAgICAgICAgICBtRGVmYXVsdC5zZXQoRm9udDo6Y3JlYXRlKG1SU0MsICJEcm9pZFNhbnMudHRmIiwgMTYsIDk2KSk7CisgICAgICAgIH0KKyAgICAgICAgY3VycmVudEZvbnQgPSBtRGVmYXVsdC5nZXQoKTsKKyAgICB9CisgICAgaWYoIWN1cnJlbnRGb250KSB7CisgICAgICAgIExPR0UoIlVuYWJsZSB0byBpbml0aWFsaXplIGFueSBmb250cyIpOworICAgICAgICByZXR1cm47CisgICAgfQorCisgICAgY3VycmVudEZvbnQtPnJlbmRlclVURih0ZXh0LCBsZW4sIHN0YXJ0SW5kZXgsIG51bUdseXBocywgeCwgeSk7CisKKyAgICBpZihtQ3VycmVudFF1YWRJbmRleCAhPSAwKSB7CisgICAgICAgIGlzc3VlRHJhd0NvbW1hbmQoKTsKKyAgICAgICAgbUN1cnJlbnRRdWFkSW5kZXggPSAwOworICAgIH0KK30KKwordm9pZCBGb250U3RhdGU6OnJlbmRlclRleHQoY29uc3QgY2hhciAqdGV4dCwgaW50IHgsIGludCB5KQoreworICAgIHNpemVfdCB0ZXh0TGVuID0gc3RybGVuKHRleHQpOworICAgIHJlbmRlclRleHQodGV4dCwgdGV4dExlbiwgMCwgLTEsIHgsIHkpOworfQorCit2b2lkIEZvbnRTdGF0ZTo6cmVuZGVyVGV4dChBbGxvY2F0aW9uICphbGxvYywgaW50IHgsIGludCB5KQoreworICAgIGlmKCFhbGxvYykgeworICAgICAgICByZXR1cm47CisgICAgfQorCisgICAgY29uc3QgY2hhciAqdGV4dCA9IChjb25zdCBjaGFyICopYWxsb2MtPmdldFB0cigpOworICAgIHNpemVfdCBhbGxvY1NpemUgPSBhbGxvYy0+Z2V0VHlwZSgpLT5nZXRTaXplQnl0ZXMoKTsKKyAgICByZW5kZXJUZXh0KHRleHQsIGFsbG9jU2l6ZSwgMCwgLTEsIHgsIHkpOworfQorCit2b2lkIEZvbnRTdGF0ZTo6cmVuZGVyVGV4dChBbGxvY2F0aW9uICphbGxvYywgdWludDMyX3Qgc3RhcnQsIGludCBsZW4sIGludCB4LCBpbnQgeSkKK3sKKyAgICBpZighYWxsb2MpIHsKKyAgICAgICAgcmV0dXJuOworICAgIH0KKworICAgIGNvbnN0IGNoYXIgKnRleHQgPSAoY29uc3QgY2hhciAqKWFsbG9jLT5nZXRQdHIoKTsKKyAgICBzaXplX3QgYWxsb2NTaXplID0gYWxsb2MtPmdldFR5cGUoKS0+Z2V0U2l6ZUJ5dGVzKCk7CisgICAgcmVuZGVyVGV4dCh0ZXh0LCBh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BtQWN0aXZlRm9udHM7CisgICAgZm9yKHVpbnQzMl90IGkgPSAwOyBpIDwgZm9udHNUb0RlcmVmZXJlbmNlLnNpemUoKTsgaSArKykgeworICAgICAgICBmb250c1RvRGVyZWZlcmVuY2VbaV0tPnplcm9Vc2VyUmVmKCk7CisgICAgfQorCisgICAgaWYobUxpYnJhcnkpIHsKKyAgICAgICAgRlRfRG9uZV9GcmVlVHlwZSggbUxpYnJhcnkgKTsKKyAgICAgICAgbUxpYnJhcnkgPSBOVUxMOworICAgIH0KK30KKworbmFtZXNwYWNlIGFuZHJvaWQgeworbmFtZXNwYWNlIHJlbmRlcnNjcmlwdCB7CisKK1JzRm9udCByc2lfRm9udENyZWF0ZUZyb21GaWxlKENvbnRleHQgKnJzYywgY2hhciBjb25zdCAqbmFtZSwgdWludDMyX3QgZm9udFNpemUsIHVpbnQzMl90IGRwaSkKK3sKKyAgICBGb250ICpuZXdGb250ID0gRm9udDo6Y3JlYXRlKHJzYywgbmFtZSwgZm9udFNpemUsIGRwaSk7CisgICAgaWYobmV3Rm9udCkgeworICAgICAgICBuZXdGb250LT5pbmNVc2VyUmVmKCk7CisgICAgfQorICAgIHJldHVybiBuZXdGb250OworfQorCit9IC8vIHJlbmRlcnNjcmlwdAorfSAvLyBhbmRyb2lkCmRpZmYgLS1naXQgYS9saWJzL3JzL3JzRm9udC5oIGIvbGlicy9ycy9yc0ZvbnQuaApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi5kZWZlMzhiCi0tLSAvZGV2L251bGwKKysrIGIvbGlicy9ycy9yc0ZvbnQuaApAQCAtMCwwICsxLDIyMSBAQAorLyoKKyAqIENvcHlyaWdodCAoQykgMjAwOSBUaGUgQW5kcm9pZCBPcGVuIFNvdXJjZSBQcm9qZWN0CisgKgorICogTGljZW5zZWQgdW5kZXIgdGhlIEFwYWNoZSBMaWNlbnNlLCBWZXJzaW9uIDIuMCAodGhlICJMaWNlbnNlIik7CisgKiB5b3UgbW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aW5nOCBtRm9udE5hbWU7CisgICAgdWludDMyX3QgbUZvbnRTaXplOworICAgIHVpbnQzMl90IG1EcGk7CisKKyAgICBGb250KENvbnRleHQgKnJzYyk7CisgICAgYm9vbCBpbml0KGNvbnN0IGNoYXIgKm5hbWUsIHVpbnQzMl90IGZvbnRTaXplLCB1aW50MzJfdCBkcGkpOworCisgICAgRlRfRmFjZSBtRmFjZTsKKyAgICBib29sIG1Jbml0aWFsaXplZDsKKyAgICBib29sIG1IYXNLZXJuaW5nOworCisgICAgRGVmYXVsdEtleWVkVmVjdG9yPHVpbnQzMl90LCBDYWNoZWRHbHlwaEluZm8qID4gbUNhY2hlZEdseXBoczsKKyAgICBDYWNoZWRHbHlwaEluZm8qIGdldENhY2hlZFVURkNoYXIoaW50MzJfdCB1dGZDaGFyKTsKKworICAgIENhY2hlZEdseXBoSW5mbyAqY2FjaGVHbHlwaCh1aW50MzJfdCBnbHlwaCk7CisgICAgdm9pZCB1cGRhdGVHbHlwaENhY2hlKENhY2hlZEdseXBoSW5mbyAqZ2x5cGgpOworICAgIHZvaWQgZHJhd0NhY2hlZEdseXBoKENhY2hlZEdseXBoSW5mbyAqZ2x5cGgsIGludCB4LCBpbnQgeSk7Cit9OworCitjbGFzcyBGb250U3RhdGUKK3sKK3B1YmxpYzoKKyAgICBGb250U3RhdGUoKTsKKyAgICB+Rm9udFN0YXRlKCk7CisKKyAgICB2b2lkIGluaXQoQ29udGV4dCAqcnNjKTsKKyAgICB2b2lkIGRlaW5pdChDb250ZXh0ICpyc2MpOworCisgICAgT2JqZWN0QmFzZVJlZjxGb250PiBtRGVmYXVsdDsKKyAgICBPYmplY3RCYXNlUmVmPEZvbnQ+IG1MYXN0OworCisgICAgdm9pZCByZW5kZXJUZXh0KGNvbnN0IGNoYXIgKnRleHQsIHVpbnQzMl90IGxlbiwgdWludDMyX3Qgc3RhcnRJbmRleCwgaW50IG51bUdseXBocywgaW50IHgsIGludCB5KTsKKyAgICB2b2lkIHJlbmRlclRleHQoY29uc3QgY2hhciAqdGV4dCwgaW50IHgsIGludCB5KTsKKyAgICB2b2lkIHJlbmRlclRleHQoQWxsb2NhdGlvbiAqYWxsb2MsIGludCB4LCBpbnQgeSk7CisgICAgdm9pZCByZW5kZXJUZXh0KEFsbG9jYXRpb24gKmFsbG9jLCB1aW50MzJfdCBzdGFydCwgaW50IGxlbiwgaW50IHgsIGludCB5KTsKKworICAgIHZvaWQgc2V0Rm9udENvbG9yKGZsb2F0IHIsIGZsb2F0IGcsIGZsb2F0IGIsIGZsb2F0IGEpOworICAgIHZvaWQgZ2V0Rm9udENvbG9yKGZsb2F0ICpyLCBmbG9hdCAqZywgZmxvYXQgKmIsIGZsb2F0ICphKSBjb25zdDsKKworcHJvdGVjdGVkOgorCisgICAgZnJpZW5kIGNsYXNzIEZvbnQ7CisKKyAgICBzdHJ1Y3QgQ2FjaGVUZXh0dXJlTGluZQorICAgIHsKKyAgICAgICAgdWludDMyX3QgbU1heEhlaWdodDsKKyAgICAgICAgdWludDMyX3QgbU1heFdpZHRoOworICAgICAgICB1aW50MzJfdCBtQ3VycmVudFJvdzsKKyAgICAgICAgdWludDMyX3QgbUN1cnJlbnRDb2w7CisgICAgICAgIGJvb2wgbURpcnR5OworCisgICAgICAgIENhY2hlVGV4dHVyZUxpbmUodWludDMyX3QgbWF4SGVpZ2h0LCB1aW50MzJfdCBtYXhXaWR0aCwgdWludDMyX3QgY3VycmVudFJvdywgdWludDMyX3QgY3VycmVudENvbCkgOgorICAgICAgICAgICAgbU1heEhlaWdodChtYXhIZWlnaHQpLCBtTWF4V2lkdGgobWF4V2lkdGgpLCBtQ3VycmVudFJvdyhjdXJyZW50Um93KSwgbUN1cnJlbnRDb2woY3VycmVudENvbCksCisgICAgICAgICAgICBtRGlydHkoZmFsc2UpICB7CisgICAgICAgIH0KKworICAgICAgICBib29sIGZpdEJpdG1hcChGVF9CaXRtYXAgKmJpdG1hcCwgdWludDMyX3QgKnJldE9yaWdpblgsIHVpbnQzMl90ICpyZXRPcmlnaW5ZKSB7CisgICAgICAgICAgICBpZigodWludDMyX3QpYml0bWFwLT5yb3dzID4gbU1heEhlaWdodCkgeworICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYobUN1cnJlbnRDb2wgKyAodWludDMyX3QpYml0bWFwLT53aWR0aCA8IG1NYXhXaWR0aCkgeworICAgICAgICAgICAgICAgKnJldE9yaWdpblggPSBtQ3VycmVudENvbDsKKyAgICAgICAgICAgICAgICpyZXRPcmlnaW5ZID0gbUN1cnJlbnRSb3c7CisgICAgICAgICAgICAgICBtQ3VycmVudENvbCArPSBiaXRtYXAtPndpZHRoOworICAgICAgICAgICAgICAgbURpcnR5ID0gdHJ1ZTsKKyAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKyAgICB9OworCisgICAgVmVjdG9yPENhY2hlVGV4dHVyZUxpbmUqPiBtQ2FjaGVMaW5lczsKKyAgICB1aW50MzJfdCBnZXRSZW1haW5pbmdDYWNoZUNhcGFjaXR5KCk7CisKKyAgICB2b2lkIHByZWNhY2hlTGF0aW4oRm9udCAqZm9udCk7CisgICAgU3RyaW5nOCBtTGF0aW5QcmVjYWNoZTsKKworICAgIENvbnRleHQgKm1SU0M7CisKKyAgICBmbG9hdCBtRm9udENvbG9yWzRdOworICAgIGJvb2wgbUZvbnRDb2xvckRpcnR5OworCisgICAgLy8gRnJlZSB0eXBlIGxpYnJhcnksIHdlIG9ubHkgbmVlZCBvbmUgY29weQorICAgIEZUX0xpYnJhcnkgbUxpYnJhcnk7CisgICAgRlRfTGlicmFyeSBnZXRMaWIoKTsKKyAgICBWZWN0b3I8Rm9udCo+IG1BY3RpdmVGb250czsKKworICAgIC8vIFJlbmRlciBzdGF0ZSBmb3IgdGhlIGZvbnQKKyAgICBPYmplY3RCYXNlUmVmPFByb2dyYW1G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WVEcmF3Q29tbWFuZCgpOworCisgICAgdm9pZCBhcHBlbmRNZXNoUXVhZChmbG9hdCB4MSwgZmxvYXQgeTEsIGZsb2F0IHoxLAorICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB1MSwgZmxvYXQgdjEsCisgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IHgyLCBmbG9hdCB5MiwgZmxvYXQgejIsCisgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IHUyLCBmbG9hdCB2MiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgeDMsIGZsb2F0IHkzLCBmbG9hdCB6MywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgdTMsIGZsb2F0IHYzLAorICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB4NCwgZmxvYXQgeTQsIGZsb2F0IHo0LAorICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB1NCwgZmxvYXQgdjQpOworCit9OworCisKK30KK30KKworI2VuZGlmCmRpZmYgLS1naXQgYS9saWJzL3JzL3JzSGFuZGNvZGUuaCBiL2xpYnMvcnMvcnNIYW5kY29kZS5oCmluZGV4IDgwMGVkZGQuLmMwMmZkNDIgMTAwNjQ0Ci0tLSBhL2xpYnMvcnMvcnNIYW5kY29kZS5oCisrKyBiL2xpYnMvcnMvcnNIYW5kY29kZS5oCkBAIC0xLDYgKzEsNTcgQEAKIAogI2RlZmluZSBEQVRBX1NZTkNfU0laRSAxMDI0CiAKK3N0YXRpYyBpbmxpbmUgdm9pZCByc0hDQVBJX0NvbnRleHRGaW5pc2ggKFJzQ29udGV4dCByc2MpCit7CisgICAgVGhyZWFkSU8gKmlvID0gJigoQ29udGV4dCAqKXJzYyktPm1JTzsKKyAgICB1aW50MzJfdCBzaXplID0gc2l6ZW9mKFJTX0NNRF9Db250ZXh0RmluaXNoKTsKKyAgICBSU19DTURfQ29udGV4dEZpbmlzaCAqY21kID0gc3RhdGljX2Nhc3Q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tpXTsKKyAgICAgICAgfQorICAgICAgICBkZWxldGVbXSBtUHJpbWl0aXZlczsKKyAgICB9CiB9CiAKK3ZvaWQgTWVzaDo6cmVuZGVyKENvbnRleHQgKnJzYykgY29uc3QKK3sKKyAgICBmb3IodWludDMyX3QgY3QgPSAwOyBjdCA8IG1QcmltaXRpdmVzQ291bnQ7IGN0ICsrKSB7CisgICAgICAgIHJlbmRlclByaW1pdGl2ZShyc2MsIGN0KTsKKyAgICB9Cit9CisKK3ZvaWQgTWVzaDo6cmVuZGVyUHJpbWl0aXZlKENvbnRleHQgKnJzYywgdWludDMyX3QgcHJpbUluZGV4KSBjb25zdCB7CisgICAgaWYgKHByaW1JbmRleCA+PSBtUHJpbWl0aXZlc0NvdW50KSB7CisgICAgICAgIExPR0UoIkludmFsaWQgcHJpbWl0aXZlIGluZGV4Iik7CisgICAgICAgIHJldHVybjsKKyAgICB9CisKKyAgICBQcmltaXRpdmVfdCAqcHJpbSA9IG1QcmltaXRpdmVzW3ByaW1JbmRleF07CisKKyAgICBpZiAocHJpbS0+bUluZGV4QnVmZmVyLmdldCgpKSB7CisgICAgICAgIHJlbmRlclByaW1pdGl2ZVJhbmdlKHJzYywgcHJpbUluZGV4LCAwLCBwcmltLT5tSW5kZXhCdWZmZXItPmdldFR5cGUoKS0+Z2V0RGltWCgpKTsKKyAgICAgICAgcmV0dXJuOworICAgIH0KKworICAgIHJlbmRlclByaW1pdGl2ZVJhbmdlKHJzYywgcHJpbUluZGV4LCAwLCBtVmVydGV4QnVmZmVyc1swXS0+Z2V0VHlwZSgpLT5nZXREaW1YKCkpOworfQorCit2b2lkIE1lc2g6OnJlbmRlclByaW1pdGl2ZVJhbmdlKENvbnRleHQgKnJzYywgdWludDMyX3QgcHJpbUluZGV4LCB1aW50MzJfdCBzdGFydCwgdWludDMyX3QgbGVuKSBjb25zdAoreworICAgIGlmIChsZW4gPCAxIHx8IHByaW1JbmRleCA+PSBtUHJpbWl0aXZlc0NvdW50KSB7CisgICAgIC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ICAgIG1lc2gtPm1QcmltaXRpdmVzID0gbmV3IFByaW1pdGl2ZV90ICpbbWVzaC0+bVByaW1pdGl2ZXNDb3VudF07CisKKyAgICAgICAgLy8gbG9hZCBhbGwgcHJpbWl0aXZlcworICAgICAgICBmb3IgKHVpbnQzMl90IHBDb3VudCA9IDA7IHBDb3VudCA8IG1lc2gtPm1QcmltaXRpdmVzQ291bnQ7IHBDb3VudCArKykgeworICAgICAgICAgICAgUHJpbWl0aXZlX3QgKiBwcmltID0gbmV3IFByaW1pdGl2ZV90OworICAgICAgICAgICAgbWVzaC0+bVByaW1pdGl2ZXNbcENvdW50XSA9IHByaW07CisKKyAgICAgICAgICAgIHByaW0tPm1QcmltaXRpdmUgPSAoUnNQcmltaXRpdmUpc3RyZWFtLT5sb2FkVTgoKTsKKworICAgICAgICAgICAgLy8gQ2hlY2sgdG8gc2VlIGlmIHRoZSBpbmRleCBidWZmZXIgd2FzIHN0b3JlZAorICAgICAgICAgICAgdWludDMyX3QgaXNJbmRleFByZXNlbnQgPSBzdHJlYW0tPmxvYWRVMzIoKTsKKyAgICAgICAgICAgIGlmKGlzSW5kZXhQcmVzZW50KSB7CisgICAgICAgICAgICAgICAgQWxsb2NhdGlvbiAqaW5kZXhBbGxvYyA9IEFsbG9jYXRpb246OmNyZWF0ZUZyb21TdHJlYW0ocnNjLCBzdHJlYW0pOworICAgICAgICAgICAgICAgIHByaW0tPm1JbmRleEJ1ZmZlci5zZXQoaW5kZXhBbGxvYyk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICBtZXNoLT51cGRhdGVHTFByaW1pdGl2ZXMoKTsKKyAgICBtZXNoLT51cGxvYWRBbGwocnNjKTsKKworICAgIHJldHVybiBtZXNoOworfQorCit2b2lkIE1lc2g6OmNvbXB1dGVCQm94KCkgeworICAgIGZsb2F0ICpwb3NQdHIgPSBOVUxMOworICAgIHVpbnQzMl90IHZlY3RvclNpemUgPSAwOworICAgIHVpbnQzMl90IHN0c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CisgICAgICAgIGlmKHBvc1B0cikgeworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBtQkJveE1pblswXSA9IG1CQm94TWluWzFdID0gbUJCb3hNaW5bMl0gPSAxZTY7CisgICAgbUJCb3hNYXhbMF0gPSBtQkJveE1heFsxXSA9IG1CQm94TWF4WzJdID0gLTFlNjsKKyAgICBpZighcG9zUHRyKSB7CisgICAgICAgIExPR0UoIlVuYWJsZSB0byBjb21wdXRlIGJvdW5kaW5nIGJveCIpOworICAgICAgICBtQkJveE1pblswXSA9IG1CQm94TWluWzFdID0gbUJCb3hNaW5bMl0gPSAwLjBmOworICAgICAgICBtQkJveE1heFswXSA9IG1CQm94TWF4WzFdID0gbUJCb3hNYXhbMl0gPSAwLjBmOworICAgICAgICByZXR1cm47CisgICAgfQorCisgICAgZm9yKHVpbnQzMl90IGkgPSAwOyBpIDwgbnVtVmVydHM7IGkgKyspIHsKKyAgICAgICAgZm9yKHVpbnQzMl90IHYgPSAwOyB2IDwgdmVjdG9yU2l6ZTsgdiArKykgeworICAgICAgICAgICAgbUJCb3hNaW5bdl0gPSByc01pbihtQkJveE1pblt2XSwgcG9zUHRyW3ZdKTsKKyAgICAgICAgICAgIG1CQm94TWF4W3ZdID0gcnNNYXgobUJCb3hNYXhbdl0sIHBvc1B0clt2XSk7CisgICAgICAgIH0KKyAgICAgICAgcG9zUHRyICs9IHN0cmlkZTsKKyAgICB9Cit9CiAKIAogTWVzaENvbnRleHQ6Ok1lc2hDb250ZXh0KCkKQEAgLTQ2LDMgKzI3Niw4MyBAQAogewogfQogCituYW1lc3BhY2UgYW5kcm9pZCB7CituYW1lc3BhY2UgcmVuZGVyc2NyaXB0IHsKKworUnNNZXNoIHJzaV9NZXNoQ3JlYXRlKENvbnRleHQgKnJzYywgdWludDMyX3QgdnR4Q291bnQsIHVpbnQzMl90IGlkeENvdW50KQoreworICAgIE1lc2ggKnNtID0gbmV3IE1lc2gocnNjKTsKKyAgICB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VzKENvbnRleHQgKnJzYywgUnNNZXNoIG12LCBSc0FsbG9jYXRpb24gKnZhLCB1aW50MzJfdCAqcHJpbVR5cGUsIHVpbnQzMl90IGlkeERhdGFDb3VudCkKK3sKKyAgICBNZXNoICpzbSA9IHN0YXRpY19jYXN0PE1lc2ggKj4obXYpOworICAgIHJzQXNzZXJ0KGlkeERhdGFDb3VudCA9PSBzbS0+bVByaW1pdGl2ZXNDb3VudCk7CisKKyAgICBmb3IodWludDMyX3QgY3QgPSAwOyBjdCA8IGlkeERhdGFDb3VudDsgY3QgKyspIHsKKyAgICAgICAgdmFbY3RdID0gc20tPm1QcmltaXRpdmVzW2N0XS0+bUluZGV4QnVmZmVyLmdldCgpOworICAgICAgICBwcmltVHlwZVtjdF0gPSBzbS0+bVByaW1pdGl2ZXNbY3RdLT5tUHJpbWl0aXZlOworICAgICAgICBpZihzbS0+bVByaW1pdGl2ZXNbY3RdLT5tSW5kZXhCdWZmZXIuZ2V0KCkpIHsKKyAgICAgICAgICAgIHNtLT5tUHJpbWl0aXZlc1tjdF0tPm1JbmRleEJ1ZmZlci0+aW5jVXNlclJlZigpOworICAgICAgICB9CisgICAgfQorCit9CisKKworCisKK319CmRpZmYgLS1naXQgYS9saWJzL3JzL3JzTWVzaC5oIGIvbGlicy9ycy9yc01lc2guaAppbmRleCA1MjAxYWJkLi5lZDAxYzM4IDEwMDY0NAotLS0gYS9saWJzL3JzL3JzTWVzaC5oCisrKyBiL2xpYnMvcnMvcnNNZXNoLmgKQEAgLTMyLDQ1ICszMiw0MCBAQAogICAgIE1lc2goQ29udGV4dCAqKTsKICAgICB+TWVzaCgpOwogCi0gICAgc3RydWN0IFZlcnRpY2llc190Ci0gICAgewotICAgICAgICBBbGxvY2F0aW9uICoqIG1BbGxvY2F0aW9uczsKLSAgICAgICAgdWludDMyX3QgbUFsbG9jYXRpb25Db3VudDsKKyAgICAvLyBDb250YWlucyB2ZXJ0ZXggZGF0YQorICAgIC8vIFBvc2l0aW9uLCBub3JtYWwsIHRleGNvb3JkLCBldGMgY291bGQgZWl0aGVyIGJlIHN0cmlkZWQgaW4gb25lIGFsbG9jYXRpb24KKyAgICAvLyBvZiBwcm92aWRlZCBzZXBhcmV0ZWx5IGluIG11bHRpcGxlIG9uZXMKKyAgICBPYmplY3RCYXNlUmVmPEFsbG9jYXRpb24+ICptVmVydGV4QnVmZmVyczsKKyAgICB1aW50MzJfdCBtVmVydGV4QnVmZmVyQ291bnQ7CiAKLSAgICAgICAgc2l6ZV90IG1WZXJ0ZXhEYXRhU2l6ZTsKLQotICAgICAgICBzaXplX3QgbU9mZnNldENvb3JkOwotICAgICAgICBzaXplX3QgbU9mZnNldFRleDsKLSAgICAgICAgc2l6ZV90IG1PZmZzZXROb3JtOwotCi0gICAgICAgIHNpemVfdCBtU2l6ZUNvb3JkOwotICAgICAgICBzaXplX3QgbVNpemVUZXg7Ci0gICAgICAgIHNpemVfdCBtU2l6ZU5vcm07Ci0KLSAgICAgICAgdWludDMyX3QgbUJ1ZmZlck9iamVjdDsKLSAgICB9OwotCisgICAgLy8gRWl0aGVyIG1JbmRleEJ1ZmZlciwgbVByaW1pdGl2ZUJ1ZmZlciBvciBib3RoIGNvdWxkIGhhdmUgYSBOVUxMIHJlZmVyZW5jZQorICAgIC8vIElmIGJvdGggYXJlIG51bGwsIG1QcmltaXRpdmUgb25seSB3b3VsZCBiZSB1c2VkIHRvIHJlbmRlciB0aGUgbWVzaAogICAgIHN0cnVjdCBQcmltaXRpdmVfdAogICAgIHsKLSAgICAgICAgUnNQcmltaXRpdmUgbVR5cGU7Ci0gICAgICAgIFZlcnRpY2llc190ICptVmVydGljaWVzOworICAgICAgICBPYmplY3RCYXNlUmVmPEFsbG9jYXRpb24+IG1JbmRleEJ1ZmZlcjsKIAotICAgICAgICB1aW50MzJfdCBtSW5kZXhDb3VudDsKLSAgICAgICAgdWludDE2X3QgKm1JbmRpY2llczsKLQotICAgICAgICB1aW50MzJfdCBtUmVzdGFydENvdW50czsKLSAgICA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c2lvbnMgYW5kCisgKiBsaW1pdGF0aW9ucyB1bmRlciB0aGUgTGljZW5zZS4KKyAqLworCisjaW5jbHVkZSAicnNNdXRleC5oIgorCit1c2luZyBuYW1lc3BhY2UgYW5kcm9pZDsKK3VzaW5nIG5hbWVzcGFjZSBhbmRyb2lkOjpyZW5kZXJzY3JpcHQ7CisKKworTXV0ZXg6Ok11dGV4KCkKK3sKK30KKworTXV0ZXg6On5NdXRleCgpCit7CisgICAgcHRocmVhZF9tdXRleF9kZXN0cm95KCZtTXV0ZXgpOworfQorCitib29sIE11dGV4Ojppbml0KCkKK3sKKyAgICBpbnQgc3RhdHVzID0gcHRocmVhZF9tdXRleF9pbml0KCZtTXV0ZXgsIE5VTEwpOworICAgIGlmIChzdGF0dXMpIHsKKyAgICAgICAgTE9HRSgiTXV0ZXg6Ok11dGV4IGluaXQgZmFpbHVyZSIpOworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorICAgIHJldHVybiB0cnVlOworfQorCitib29sIE11dGV4Ojpsb2NrKCkKK3sKKyAgICBpbnQgc3RhdHVzOworICAgIHN0YXR1cyA9IHB0aHJlYWRfbXV0ZXhfbG9jaygmbU11dGV4KTsKKyAgICBpZiAoc3RhdHVzKSB7CisgICAgICAgIExPR0UoIk11dGV4OiBlcnJvciAlaSBsb2NraW5nLiIsIHN0YXR1cyk7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisgICAgcmV0dXJuIHRydWU7Cit9CisKK2Jvb2wgTXV0ZXg6OnVubG9jaygpCit7CisgICAgaW50IHN0YXR1czsKKyAgICBzdGF0dXMgPSBwdGhyZWFkX211dGV4X3VubG9jaygmbU11dGV4KTsKKyAgICBpZiAoc3RhdHVzKSB7CisgICAgICAgIExPR0UoIk11dGV4IGVycm9yICVpIHVubG9ja2luZy4iLCBzdGF0dXMpOworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorICAgIHJldHVybiB0cnVlOworfQorCisKZGlmZiAtLWdpdCBhL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B9CisKKyAgICAgICAgICAgIC8vIENhbm5vdCBiZSBjb21wbGV4CisgICAgICAgICAgICByc0Fzc2VydCghZi0+Z2V0RmllbGRDb3VudCgpKTsKKyAgICAgICAgICAgIGlmKGYtPmdldFR5cGUoKSA9PSBSU19UWVBFX01BVFJJWF80WDQpIHsKKyAgICAgICAgICAgICAgICBtU2hhZGVyLmFwcGVuZCgidW5pZm9ybSBtYXQ0IFVOSV8iKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UgaWYoZi0+Z2V0VHlwZSgpID09IFJTX1RZUEVfTUFUUklYXzNYMykgeworICAgICAgICAgICAgICAgIG1TaGFkZXIuYXBwZW5kKCJ1bmlmb3JtIG1hdDMgVU5JXyIpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZSBpZihmLT5nZXRUeXBlKCkgPT0gUlNfVFlQRV9NQVRSSVhfMlgyKSB7CisgICAgICAgICAgICAgICAgbVNoYWRlci5hcHBlbmQoInVuaWZvcm0gbWF0MiBVTklfIik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlIHsKKyAgICAgICAgICAgICAgICBzd2l0Y2goZi0+Z2V0Q29tcG9uZW50KCkuZ2V0VmVjdG9yU2l6ZSgpKSB7CisgICAgICAgICAgICAgICAgY2FzZSAxOiBtU2hhZGVyLmFwcGVuZCgidW5pZm9ybSBmbG9hdCBVTklfIik7IGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgMjogbVNoYWRlci5hcHBlbmQoInVuaWZvcm0gdmVjMiBVTklfIik7IGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgMzogbVNoYWRlci5hcHBlbmQoInVuaWZvcm0gdmVjMyBVTklfIik7IGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgNDogbVNoYWRlci5hcHBlbmQoInVuaWZvcm0gdmVjNCBVTklfIik7IGJyZWFrOworICAgICAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgICAgIHJzQXNzZXJ0KDApOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgbVNoYWRlci5hcHBlbmQoZm4pOworICAgICAgICAgICAgbVNoYWRlci5hcHBlbmQoIjtcbiIpOworICAgICAgICB9CisgICAgfQorfQorCit2b2lkIFByb2dyYW06OnNldHVwVXNlckNvbnN0YW50cyhTaGFkZXJDYWNoZSAqc2MsIGJvb2wgaXNGcmFnbWVudCkgeworICAgIHVpbnQzMl90IHVpZHggPSAxOworICAgIGZvciAodWludDMyX3QgY3Q9MDsgY3QgPCBtQ29uc3RhbnRDb3VudDsgY3QrKykgeworICAgICAgICBBbGxvY2F0aW9uICphbGxvYyA9IG1Db25zdGFudHNbY3QrMV0uZ2V0KCk7CisgICAgICAgIGlmICghYWxsb2MpIHsKKyAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICB9CisKKyAgICAgICAgY29uc3QgdWludDhfdCAqZGF0YSA9IHN0YXRpY19jYXN0PGNvbnN0IHVpbnQ4X3QgKj4oYWxsb2MtPmdldFB0cigpKTsKKyAgICAgICAgY29uc3QgRWxlbWVudCAqZSA9IG1Db25zdGFudFR5cGVzW2N0XS0+Z2V0RWxlbWVudCgpOworICAgICAgICBmb3IgKHVpbnQzMl90IGZpZWxkPTA7IGZpZWxkIDwgZS0+Z2V0RmllbGRDb3VudCgpOyBmaWVsZCsrKSB7CisgICAgICAgICAgICBjb25zdCBFbGVtZW50ICpmID0gZS0+Z2V0RmllbGQoZmllbGQpOworICAgICAgICAgICAgY29uc3QgY2hhciAqZmllbGROYW1lID0gZS0+Z2V0RmllbGROYW1lKGZpZWxkKTsKKyAgICAgICAgICAgIC8vIElmIHRoaXMgZmllbGQgaXMgcGFkZGluZywgc2tpcCBpdAorICAgICAgICAgICAgaWYoZmllbGROYW1lWzBdID09ICcjJykgeworICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB1aW50MzJfdCBvZmZzZXQgPSBlLT5nZXRGaWVsZE9mZnNldEJ5dGVzKGZpZWxkKTsKKyAgICAgICAgICAgIGNvbnN0IGZsb2F0ICpmZCA9IHJlaW50ZXJwcmV0X2Nhc3Q8Y29uc3QgZmxvYXQgKj4oJmRhdGFbb2Zmc2V0XSk7CisKKyAgICAgICAgICAgIGludDMyX3Qgc2xvdCA9IC0xOworICAgICAgICAgICAgaWYoIWlzRnJhZ21lbnQpIHsKKyAgICAgICAgICAgICAgICBzbG90ID0gc2MtPnZ0eFVuaWZvcm1TbG90KHVpZHgpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZSB7CisgICAgICAgICAgICAgICAgc2xvdCA9IHNjLT5mcmFnVW5pZm9ybVNsb3QodWlkeCk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vTE9HRSgiVW5pZm9ybSAgc2xvdD0laSwgb2Zmc2V0PSVpLCBjb25zdGFudD0laSwgZmllbGQ9JWksIHVpZHg9JWksIG5hbWU9JXMiLCBzbG90LCBvZmZzZXQsIGN0LCBmaWVsZCwgdWlkeCwgZmllbGROYW1lKTsKKyAgICAgICAgICAgIGlmIChzbG90ID49IDApIHsKKyAgICAgICAgICAgICAgICBpZihmLT5nZXRUeXBlKCkgPT0gUlNfVFlQRV9NQVRSSVhfNFg0KSB7CisgICAgICAgICAgICAgICAgICAgIGdsVW5pZm9ybU1hdHJpeDRmdihzbG90LCAxLCBHTF9GQUxTRSwgZmQpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBlbHNlIGlmKGYtPmdldFR5cGUoKSA9PSBSU19UWVBFX01BVFJJWF8zWDMpIHsKKyAgICAgICAgICAgICAgICAgICAgZ2xVbmlmb3JtTWF0cml4M2Z2KHNsb3QsIDEsIEdMX0ZBTFNFLCBmZCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGVsc2UgaWYoZi0+Z2V0VHlwZSgpID09IFJTX1RZUEVfTUFUUklYXzJYMikgeworICAgICAgICAgICAgICAgICAgICBnbFVuaWZvcm1NYXRyaXgyZnYoc2xvdCwgMSwgR0xfRkFMU0UsIGZkKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIHN3aXRjaChmLT5nZXRDb21wb25lbnQoKS5nZXRWZWN0b3JTaXplKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSAxOgorICAgICAgICAgICAgICAgICAgICAgICAgLy9MT0dFKCJVbmlmb3JtIDEgPSAlZiIsIGZkWzBdKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGdsVW5pZm9ybTFmdihzbG90LCAxLCBmZCk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSAyOgorICAgICAgICAgICAgICAgICAgICAgICAgLy9MT0dFKCJVbmlmb3JtIDIgPSAlZiAlZiIsIGZkWzBdLCBmZFsxXSk7CisgICAgICAgICAgICAgICAgICAgICAgICBnbFVuaWZvcm0yZnYoc2xvdCwgMSwgZmQpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgMzoKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vTE9HRSgiVW5pZm9ybSAzID0gJWYgJWYgJWYiLCBmZFswXSwgZmRbMV0sIGZkWzJdKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGdsVW5pZm9ybTNmdihzbG90LCAxLCBmZCk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSA0OgorICAgICAgICAgICAgICAgICAgICAgICAgLy9MT0dFKCJVbmlmb3JtIDQgPSAlZiAlZiAlZiAlZiIsIGZkWzBdLCBmZFsxXSwgZmRbMl0sIGZkWzNdKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGdsVW5pZm9ybTRmdihzbG90LCAxLCBmZCk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgICAgIHJzQXNzZXJ0KDApOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgdWlkeCArKzsKKyAgICAgICAgfQorICAgIH0KK30KKwordm9pZCBQcm9ncmFtOjppbml0QWRkVXNlckVsZW1lbnQoY29uc3QgRWxlbWVudCAqZSwgU3RyaW5nOCAqbmFtZXMsIHVpbnQzMl90ICpjb3VudCwgY29uc3QgY2hhciAqcHJlZml4KQoreworICAgIHJzQXNzZXJ0KGUtPmdldEZpZWxkQ291bnQoKSk7CisgICAgZm9yICh1aW50MzJfdCBjdD0wOyBjdCA8IGUtPmdldEZpZWxkQ291bnQoKTsgY3QrKykgeworICAgICAgICBjb25zdCBFbGVtZW50ICpjZSA9IGUtPmdldEZpZWxkKGN0KTsKKyAgICAgICAgaWYgKGNlLT5nZXRGaWVsZENvdW50KCkpIHsKKyAgICAgICAgICAgIGluaXRBZGRVc2VyRWxlbWVudChjZSwgbmFtZXMsIGNvdW50LCBwcmVmaXgpOworICAgICAgICB9CisgICAgICAgIGVsc2UgaWYoZS0+Z2V0RmllbGROYW1lKGN0KVswXSAhPSAnIycpIHsKKyAgICAgICAgICAgIFN0cmluZzggdG1wKHByZWZpeCk7CisgICAgICAgICAgICB0bXAuYXBwZW5kKGUtPmdldEZpZWxkTmFtZShjdCkpOworICAgICAgICAgICAgbmFtZXNbKmNvdW50XS5zZXRUbyh0bXAuc3RyaW5nKCkpOworICAgICAgICAgICAgKCpjb3VudCkrKzsKKyAgICAgICAgfQorICAgIH0KK30KIAogbmFtZXNwYWNlIGFuZHJvaWQgewogbmFtZXNwYWNlIHJlbmRlcnNjcmlwdCB7CmRpZmYgLS1naXQgYS9saWJzL3JzL3JzUHJvZ3JhbS5oIGIvbGlicy9ycy9yc1Byb2dyYW0uaApp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Xh0dXJlc1tjdF0tPmdldFRleHR1cmVJRCgpKTsKLQotICAgICAgICBzd2l0Y2gobUVudk1vZGVzW2N0XSkgewotICAgICAgICBjYXNlIFJTX1RFWF9FTlZfTU9ERV9OT05FOgotICAgICAgICAgICAgcnNBc3NlcnQoMCk7Ci0gICAgICAgICAgICBicmVhazsKLSAgICAgICAgY2FzZSBSU19URVhfRU5WX01PREVfUkVQTEFDRToKLSAgICAgICAgICAgIGdsVGV4RW52ZihHTF9URVhUVVJFX0VOViwgR0xfVEVYVFVSRV9FTlZfTU9ERSwgR0xfUkVQTEFDRSk7Ci0gICAgICAgICAgICBicmVhazsKLSAgICAgICAgY2FzZSBSU19URVhfRU5WX01PREVfTU9EVUxBVEU6Ci0gICAgICAgICAgICBnbFRleEVudmYoR0xfVEVYVFVSRV9FTlYsIEdMX1RFWFRVUkVfRU5WX01PREUsIEdMX01PRFVMQVRFKTsKLSAgICAgICAgICAgIGJyZWFrOwotICAgICAgICBjYXNlIFJTX1RFWF9FTlZfTU9ERV9ERUNBTDoKLSAgICAgICAgICAgIGdsVGV4RW52ZihHTF9URVhUVVJFX0VOViwgR0xfVEVYVFVSRV9FTlZfTU9ERSwgR0xfREVDQUwpOwotICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgIH0KLQotICAgICAgICBpZiAobVNhbXBsZXJzW2N0XS5nZXQoKSkgewotICAgICAgICAgICAgbVNhbXBsZXJzW2N0XS0+c2V0dXBHTChyc2MsIG1UZXh0dXJlc1tjdF0tPmdldFR5cGUoKS0+Z2V0SXNOcDIoKSk7Ci0gICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICBnbFRleFBhcmFtZXRlcmkoR0xfVEVYVFVSRV8yRCwgR0xfVEVYVFVSRV9NSU5fRklMVEVSLCBHTF9ORUFSRVNUKTsKLSAgICAgICAgICAgIGdsVGV4UGFyYW1ldGVyaShHTF9URVhUVVJFXzJELCBHTF9URVhUVVJFX01BR19GSUxURVIsIEdMX05FQVJFU1QpO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0IENvbnRleHQgKnJzYywgUHJvZ3JhbVN0b3JlU3RhdGUgKnN0YXRlKQoreworICAgIGlmIChzdGF0ZS0+bUxhc3QuZ2V0KCkgPT0gdGhpcykgeworICAgICAgICByZXR1cm47CisgICAgfQorICAgIHN0YXRlLT5tTGFzdC5zZXQodGhpcyk7CisKKyAgICBnbENvbG9yTWFzayhtQ29sb3JSV3JpdGVFbmFibGUsCisgICAgICAgICAgICAgICAgbUNvbG9yR1dyaXRlRW5hYmxlLAorICAgICAgICAgICAgICAgIG1Db2xvckJXcml0ZUVuYWJsZSwKKyAgICAgICAgICAgICAgICBtQ29sb3JBV3JpdGVFbmFibGUpOworICAgIGlmIChtQmxlbmRFbmFibGUpIHsKKyAgICAgICAgZ2xFbmFibGUoR0xfQkxFTkQpOworICAgICAgICBnbEJsZW5kRnVuYyhtQmxlbmRTcmMsIG1CbGVuZERzdCk7CisgICAgfSBlbHNlIHsKKyAgICAgICAgZ2xEaXNhYmxlKEdMX0JMRU5EKTsKKyAgICB9CisKKyAgICAvL0xPR0UoInBmcyAgJWksICVpLCAleCIsIG1EZXB0aFdyaXRlRW5hYmxlLCBtRGVwdGhUZXN0RW5hYmxlLCBtRGVwdGhGdW5jKTsKKworICAgIGdsRGVwdGhNYXNrKG1EZXB0aFdyaXRlRW5hYmxlKTsKKyAgICBpZihtRGVwdGhUZXN0RW5hYmxlIHx8IG1EZXB0aFdyaXRlRW5hYmxlKSB7CisgICAgICAgIGdsRW5hYmxlKEdMX0RFUFRIX1RFU1QpOworICAgICAgICBnbERlcHRoRnVuYyhtRGVwdGhGdW5jKTsKKyAgICB9IGVsc2UgeworICAgICAgICBnbERpc2FibGUoR0xfREVQVEhfVEVTVCk7CisgICAgfQorCisgICAgaWYgKG1EaXRoZXJFbmFibGUpIHsKKyAgICAgICAgZ2xFbmFibGUoR0xfRElUSEVSKTsKKyAgICB9IGVsc2UgeworICAgICAgICBnbERpc2FibGUoR0xfRElUSEVSKTsKKyAgICB9Cit9CisKK3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hazsKKyAgICBjYXNlIFJTX0RFUFRIX0ZVTkNfRVFVQUw6CisgICAgICAgIG1EZXB0aEZ1bmMgPSBHTF9FUVVBTDsKKyAgICAgICAgYnJlYWs7CisgICAgY2FzZSBSU19ERVBUSF9GVU5DX05PVEVRVUFMOgorICAgICAgICBtRGVwdGhGdW5jID0gR0xfTk9URVFVQUw7CisgICAgICAgIGJyZWFrOworICAgIH0KK30KKwordm9pZCBQcm9ncmFtU3RvcmU6OnNldERlcHRoTWFzayhib29sIG1hc2spCit7CisgICAgbURlcHRoV3JpdGVFbmFibGUgPSBtYXNrOworfQorCit2b2lkIFByb2dyYW1TdG9yZTo6c2V0QmxlbmRGdW5jKFJzQmxlbmRTcmNGdW5jIHNyYywgUnNCbGVuZERzdEZ1bmMgZHN0KQoreworICAgIG1CbGVuZEVuYWJsZSA9IHRydWU7CisgICAgaWYgKChzcmMgPT0gUlNfQkxFTkRfU1JDX09ORSkgJiYKKyAgICAgICAgKGRzdCA9PSBSU19CTEVORF9EU1RfWkVSTykpIHsKKyAgICAgICAgbUJsZW5kRW5hYmxlID0gZmFsc2U7CisgICAgfQorCisgICAgc3dpdGNoKHNyYykgeworICAgIGNhc2UgUlNfQkxFTkRfU1JDX1pFUk86CisgICAgICAgIG1CbGVuZFNyYyA9IEdMX1pFUk87CisgICAgICAgIGJyZWFrOworICAgIGNhc2UgUlNfQkxFTkRfU1JDX09ORToKKyAgICAgICAgbUJsZW5kU3JjID0gR0xfT05FOworICAgICAgICBicmVhazsKKyAgICBjYXNlIFJTX0JMRU5EX1NSQ19EU1RfQ09MT1I6CisgICAgICAgIG1CbGVuZFNyYyA9IEdMX0RTVF9DT0xPUjsKKyAgICAgICAgYnJlYWs7CisgICAgY2FzZSBSU19CTEVORF9TUkNfT05FX01JTlVTX0RTVF9DT0xPUjoKKyAgICAgICAgbUJsZW5kU3JjID0gR0xfT05FX01JTlVTX0RTVF9DT0xPUjsKKyAgICAgICAgYnJlYWs7CisgICAgY2FzZSBSU19CTEVORF9TUkNfU1JDX0FMUEhBOgorICAgICAgICBtQmxlbmRTcmMgPSBHTF9TUkNfQUxQSEE7CisgICAgICAgIGJyZWFrOworICAgIGNhc2UgUlNfQkxFTkRfU1JDX09ORV9NSU5VU19TUkNfQUxQSEE6CisgICAgICAgIG1CbGVuZFNyYyA9IEdMX09ORV9NSU5VU19TUkNfQUxQSEE7CisgICAgICAgIGJyZWFrOworICAgIGNhc2UgUlNfQkxFTkRfU1JDX0RTVF9BTFBIQToKKyAgICAgICAgbUJsZW5kU3JjID0gR0xfRFNUX0FMUEhBOworICAgICAgICBicmVhazsKKyAgICBjYXNlIFJTX0JMRU5EX1NSQ19PTkVfTUlOVVNfRFNUX0FMUEhBOgorICAgICAgICBtQmxlbmRTcmMgPSBHTF9PTkVfTUlOVVNfRFNUX0FMUEhBOworICAgICAgICBicmVhazsKKyAgICBjYXNlIFJTX0JMRU5EX1NSQ19TUkNfQUxQSEFfU0FUVVJBVEU6CisgICAgICAgIG1CbGVuZFNyYyA9IEdMX1NSQ19BTFBIQV9TQVRVUkFURTsKKyAgICAgICAgYnJlYWs7CisgICAgfQorCisgICAgc3dpdGNoKGRzdCkgeworICAgIGNhc2UgUlNfQkxFTkRfRFNUX1pFUk86CisgICAgICAgIG1CbGVuZERzdCA9IEdMX1pFUk87CisgICAgICAgIGJyZWFrOworICAgIGNhc2UgUlNfQkxFTkRfRFNUX09ORToKKyAgICAgICAgbUJsZW5kRHN0ID0gR0xfT05FOworICAgICAgICBicmVhazsKKyAgICBjYXNlIFJTX0JMRU5EX0RTVF9TUkNfQ09MT1I6CisgICAgICAgIG1CbGVuZERzdCA9IEdMX1NSQ19DT0xPUjsKKyAgICAgICAgYnJlYWs7CisgICAgY2FzZSBSU19CTEVORF9EU1RfT05FX01JTlVTX1NSQ19DT0xPUjoKKyAgICAgICAgbUJsZW5kRHN0ID0gR0xfT05FX01JTlVTX1NSQ19DT0xPUjsKKyAgICAgICAgYnJlYWs7CisgICAgY2FzZSBSU19C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LmFwcGVuZCgiO1xuIik7CiAKLSAgICAgICAgZm9yICh1aW50MzJfdCBjdD0wOyBjdCA8IG1Db25zdGFudENvdW50OyBjdCsrKSB7Ci0gICAgICAgICAgICBjb25zdCBFbGVtZW50ICplID0gbUNvbnN0YW50VHlwZXNbY3RdLT5nZXRFbGVtZW50KCk7Ci0gICAgICAgICAgICBmb3IgKHVpbnQzMl90IGZpZWxkPTA7IGZpZWxkIDwgZS0+Z2V0RmllbGRDb3VudCgpOyBmaWVsZCsrKSB7Ci0gICAgICAgICAgICAgICAgY29uc3QgRWxlbWVudCAqZiA9IGUtPmdldEZpZWxkKGZpZWxkKTsKLQotICAgICAgICAgICAgICAgIC8vIENhbm5vdCBiZSBjb21wbGV4Ci0gICAgICAgICAgICAgICAgcnNBc3NlcnQoIWYtPmdldEZpZWxkQ291bnQoKSk7Ci0gICAgICAgICAgICAgICAgc3dpdGNoKGYtPmdldENvbXBvbmVudCgpLmdldFZlY3RvclNpemUoKSkgewotICAgICAgICAgICAgICAgIGNhc2UgMTogbVNoYWRlci5hcHBlbmQoInVuaWZvcm0gZmxvYXQgVU5JXyIpOyBicmVhazsKLSAgICAgICAgICAgICAgICBjYXNlIDI6IG1TaGFkZXIuYXBwZW5kKCJ1bmlmb3JtIHZlYzIgVU5JXyIpOyBicmVhazsKLSAgICAgICAgICAgICAgICBjYXNlIDM6IG1TaGFkZXIuYXBwZW5kKCJ1bmlmb3JtIHZlYzMgVU5JXyIpOyBicmVhazsKLSAgICAgICAgICAgICAgICBjYXNlIDQ6IG1TaGFkZXIuYXBwZW5kKCJ1bmlmb3JtIHZlYzQgVU5JXyIpOyBicmVhazsKLSAgICAgICAgICAgICAgICBkZWZhdWx0OgotICAgICAgICAgICAgICAgICAgICByc0Fzc2VydCgwKTsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBtU2hhZGVyLmFwcGVuZChlLT5nZXRGaWVsZE5hbWUoZmllbGQpKTsKLSAgICAgICAgICAgICAgICBtU2hhZGVyLmFwcGVuZCgiO1xuIik7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQorICAgICAgICBhcHBlbmRVc2VyQ29uc3RhbnRzKCk7CiAKICAgICAgICAgZm9yICh1aW50MzJfdCBjdD0wOyBjdCA8IG1JbnB1dENvdW50OyBjdCsrKSB7CiAgICAgICAgICAgICBjb25zdCBFbGVtZW50ICplID0gbUlucHV0RWxlbWVudHNbY3RdLmdldCgpOwogICAgICAgICAgICAgZm9yICh1aW50MzJfdCBmaWVsZD0wOyBmaWVsZCA8IGUtPmdldEZpZWxkQ291bnQoKTsgZmllbGQrKykgewogICAgICAgICAgICAgICAgIGNvbnN0IEVsZW1lbnQgKmYgPSBlLT5nZXRGaWVsZChmaWVsZCk7CisgICAgICAgICAgICAgICAgY29uc3QgY2hhciAqZm4gPSBlLT5nZXRGaWVsZE5hbWUoZmllbGQpOworCisgICAgICAgICAgICAgICAgaWYgKGZuWzBdID09ICcjJykgeworICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgICAgICB9CiAKICAgICAgICAgICAgICAgICAvLyBDYW5ub3QgYmUgY29tcGxleAogICAgICAgICAgICAgICAgIHJzQXNzZXJ0KCFmLT5nZXRGaWVsZENvdW50KCkpOwpAQCAtMTYyLDE3ICsxMTIsMTYgQEAKICAgICAgICAgICAgICAgICAgICAgcnNBc3NlcnQoMCk7CiAgICAgICAgICAgICAgICAgfQogCi0gICAgICAgICAgICAgICAgbVNoYWRlci5hcHBlbmQoZS0+Z2V0RmllbGROYW1lKGZpZWxkKSk7CisgICAgICAgICAgICAgICAgbVNoYWRlci5hcHBlbmQoZm4pOwogICAgICAgICAgICAgICAgIG1TaGFkZXIuYXBwZW5kKCI7XG4iKTsKICAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgICAgICBtU2hhZGVyLmFwcGVuZChtVXNlclNoYWRlcik7CiAgICAgfSBlbHNlIHsKLSAgICAgICAgbVNoYWRlci5hcHBlbmQoIm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gICAgICAgZ2xVbmlmb3JtMmZ2KHNsb3QsIDEsIGZkKTsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgY2FzZSAzOgotICAgICAgICAgICAgICAgICAgICAvL0xPR0UoIlVuaWZvcm0gMyA9ICVmICVmICVmIiwgZmRbMF0sIGZkWzFdLCBmZFsyXSk7Ci0gICAgICAgICAgICAgICAgICAgIGdsVW5pZm9ybTNmdihzbG90LCAxLCBmZCk7Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgIGNhc2UgNDoKLSAgICAgICAgICAgICAgICAgICAgLy9MT0dFKCJVbmlmb3JtIDQgPSAlZiAlZiAlZiAlZiIsIGZkWzBdLCBmZFsxXSwgZmRbMl0sIGZkWzNdKTsKLSAgICAgICAgICAgICAgICAgICAgZ2xVbmlmb3JtNGZ2KHNsb3QsIDEsIGZkKTsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgZGVmYXVsdDoKLSAgICAgICAgICAgICAgICAgICAgcnNBc3NlcnQoMCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICAgICAgdWlkeCArKzsKLSAgICAgICAgfQotICAgIH0KLQotICAgIGZvciAodWludDMyX3QgY3Q9MDsgY3QgPCBtQ29uc3RhbnRDb3VudDsgY3QrKykgewotICAgICAgICB1aW50MzJfdCBnbFNsb3QgPSBzYy0+dnR4VW5pZm9ybVNsb3QoY3QgKyAxKTsKLQotICAgIH0KKyAgICBzZXR1cFVzZXJDb25zdGFudHMoc2MsIGZhbHNlKTsKIAogICAgIHN0YXRlLT5tTGFzdC5zZXQodGhpcyk7CiAgICAgcnNjLT5jaGVja0Vycm9yKCJQcm9ncmFtVmVydGV4OjpzZXR1cEdMMiIpOwpAQCAtMzAzLDYgKzIwMiwxMiBAQAogICAgIG1EaXJ0eSA9IHRydWU7CiB9CiAKK3ZvaWQgUHJvZ3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rlcj4gbVJhc3RlcjsKLSAgICAgICAgT2JqZWN0QmFzZVJlZjxQcm9ncmFtRnJhZ21lbnRTdG9yZT4gbUZyYWdtZW50U3RvcmU7Ci0gICAgICAgIEludm9rZUZ1bmNfdCBtSW52b2thYmxlc1tNQVhfU0NSSVBUX0JBTktTXTsKKyAgICAgICAgT2JqZWN0QmFzZVJlZjxQcm9ncmFtU3RvcmU+IG1GcmFnbWVudFN0b3JlOworCisgICAgICAgIHVpbnQzMl90IG1JbnZva2VGdW5jdGlvbkNvdW50OworICAgICAgICBJbnZva2VGdW5jX3QgKm1JbnZva2VGdW5jdGlvbnM7CisgICAgICAgIHVpbnQzMl90IG1GaWVsZENvdW50OworICAgICAgICB2b2lkICoqIG1GaWVsZEFkZHJlc3M7CisKICAgICAgICAgY2hhciAqIG1TY3JpcHRUZXh0OwogICAgICAgICB1aW50MzJfdCBtU2NyaXB0VGV4dExlbmd0aDsKKworICAgICAgICBib29sIG1Jc1RocmVhZGFibGU7CiAgICAgfTsKICAgICBFbnZpcm9tZW50X3QgbUVudmlyb21lbnQ7CiAKLSAgICB1aW50MzJfdCBtQ291bnN0YW50QnVmZmVyQ291bnQ7Ci0KLQogICAgIE9iamVjdEJhc2VSZWY8QWxsb2NhdGlvbj4gbVNsb3RzW01BWF9TQ1JJUFRfQkFOS1NdOwogICAgIE9iamVjdEJhc2VSZWY8Y29uc3QgVHlwZT4gbVR5cGVzW01BWF9TQ1JJUFRfQkFOS1NdOwotICAgIFN0cmluZzggbVNsb3ROYW1lc1tNQVhfU0NSSVBUX0JBTktTXTsKICAgICBib29sIG1TbG90V3JpdGFibGVbTUFYX1NDUklQVF9CQU5LU107CiAKKyAgICB2b2lkIHNldFZhcih1aW50MzJfdCBzbG90LCBjb25zdCB2b2lkICp2YWwsIHVpbnQzMl90IGxlbik7CiAKKyAgICB2aXJ0dWFsIHZvaWQgcnVuRm9yRWFjaChDb250ZXh0ICpyc2MsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAg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GN0IDwgbUVudmlyb21lbnQubUZpZWxkQ291bnQ7IGN0KyspIHsKKyAgICAgICAgaWYgKCFtU2xvdHNbY3RdLmdldCgpKQorICAgICAgICAgICAgY29udGludWU7CisgICAgICAgIHZvaWQgKnB0ciA9IG1TbG90c1tjdF0tPmdldFB0cigpOworICAgICAgICB2b2lkICoqZGVzdCA9ICgodm9pZCAqKiopbUVudmlyb21lbnQubUZpZWxkQWRkcmVzcylbY3RdOworICAgICAgICAvL0xPR0UoInNldHVwU2NyaXB0ICVpICVwID0gJXAgICAgJXAgJWkiLCBjdCwgZGVzdCwgcHRyLCBtU2xvdHNbY3RdLT5nZXRUeXBlKCksIG1TbG90c1tjdF0tPmdldFR5cGUoKS0+Z2V0RGltWCgpKTsKKworICAgICAgICAvL2NvbnN0IHVpbnQzMl90ICpwMzIgPSAoY29uc3QgdWludDMyX3QgKilwdHI7CisgICAgICAgIC8vZm9yICh1aW50MzJfdCBjdDI9MDsgY3QyIDwgbVNsb3RzW2N0XS0+Z2V0VHlwZSgpLT5nZXREaW1YKCk7IGN0MisrKSB7CisgICAgICAgICAgICAvL0xPR0UoIiAgJWkgPSAweCUwOHggIiwgY3QyLCBwMzJbY3QyXSk7CisgICAgICAgIC8vfQorCisgICAgICAgIGlmIChkZXN0KSB7CisgICAgICAgICAgICAqZGVzdCA9IHB0cjsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIExPR0UoIlNjcmlwdEM6OnNldHVwU2NyaXB0LCBOVUxMIHZhciBiaW5kaW5nIGFkZHJlc3MuIik7CiAgICAgICAgIH0KICAgICB9CiB9CiAKLQotdWludDMyX3QgU2NyaXB0Qzo6cnVuKENvbnRleHQgKnJzYywgdWludDMyX3QgbGF1bmNoSW5kZXgpCitjb25zdCBBbGxvY2F0aW9uICpTY3JpcHRDOjpwdHJUb0FsbG9jYXRpb24oY29uc3Qgdm9pZCAqcHRyKSBjb25zdAogewotICAgIGlmIChtUHJvZ3JhbS5tU2NyaXB0ID09IE5VTEwpIHsKLSAgICAgICAgcnNjLT5zZXRFcnJvcihSU19FUlJPUl9CQURfU0NSSVBULCAiQXR0ZW1wdGVkIHRvIHJ1biBiYWQgc2NyaXB0Iik7Ci0gICAgICAgIHJldHVybiAwOworICAgIGlmICghcHRyKSB7CisgICAgICAgIHJldHVybiBOVUxMOwogICAgIH0KKyAgICBmb3IgKHVpbnQzMl90IGN0PTA7IGN0IDwgbUVudmlyb21lbnQubUZpZWxkQ291bnQ7IGN0KyspIHsKKyAgICAgICAgaWYgKCFtU2xvdHNbY3RdLmdldCgpKQorICAgICAgICAgICAgY29udGludWU7CisgICAgICAgIGlmIChtU2xvdHNbY3RdLT5nZXRQdHIoKSA9PSBwdHIpIHsKKyAgICAgICAgICAgIHJldHVybiBtU2xvdHNbY3RdLmdldCgpOworICAgICAgICB9CisgICAgfQorICAgIExPR0UoIlNjcmlwdEM6OnB0clRvQWxsb2NhdGlvbiwgZmFpbGVkIHRvIGZpbmQgJXAiLCBwdHIpOworICAgIHJldHVybiBOVUxMOworfQogCi0gICAgQ29udGV4dDo6U2NyaXB0VExTU3RydWN0ICogdGxzID0KLSAgICAoQ29udGV4dDo6U2NyaXB0VExTU3RydWN0ICopcHRocmVhZF9nZXRzcGVjaWZpYyhDb250ZXh0OjpnVGhyZWFkVExTS2V5KTsKK1NjcmlwdCAqIFNjcmlwdEM6OnNldFRMUyhTY3JpcHQgKnNjKQoreworICAgIENvbnRleHQ6OlNjcmlwdFRMU1N0cnVjdCAqIHRscyA9IChDb250ZXh0OjpTY3JpcHRUTFNTdHJ1Y3QgKikKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdGhyZWFkX2dldHNwZWNpZmljKENvbnRleHQ6OmdUaHJlYWRUTFNLZXkpOwogICAgIHJzQXNzZXJ0KHRscyk7CisgICAgU2NyaXB0ICpvbGQgPSB0bHMtPm1TY3JpcHQ7CisgICAgdGxzLT5tU2NyaXB0ID0gc2M7CisgICAgcmV0dXJuIG9sZDsK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M6OnJ1biAlcCIsIG1Qcm9ncmFtLm1Sb290KTsKKyAgICByZXQgPSBtUHJvZ3JhbS5tUm9vdCgpOworICAgIHNldFRMUyhvbGRUTFMpOworICAgIC8vTE9HRSgiU2NyaXB0Qzo6cnVuIHJldCAlaSIsIHJldCk7CiAgICAgcmV0dXJuIHJldDsKIH0KIAorCit0eXBlZGVmIHN0cnVjdCB7CisgICAgQ29udGV4dCAqcnNjOworICAgIFNjcmlwdEMgKnNjcmlwdDsKKyAgICBjb25zdCBBbGxvY2F0aW9uICogYWluOworICAgIEFsbG9jYXRpb24gKiBhb3V0OworICAgIGNvbnN0IHZvaWQgKiB1c3I7CisKKyAgICB1aW50MzJfdCBtU2xpY2VTaXplOworICAgIHZvbGF0aWxlIGludCBtU2xpY2VOdW07CisKKyAgICBjb25zdCB1aW50OF90ICpwdHJJbjsKKyAgICB1aW50MzJfdCBlU3RyaWRlSW47CisgICAgdWludDhfdCAqcHRyT3V0OworICAgIHVpbnQzMl90IGVTdHJpZGVPdXQ7CisKKyAgICB1aW50MzJfdCB4U3RhcnQ7CisgICAgdWludDMyX3QgeEVuZDsKKyAgICB1aW50MzJfdCB5U3RhcnQ7CisgICAgdWludDMyX3QgeUVuZDsKKyAgICB1aW50MzJfdCB6U3RhcnQ7CisgICAgdWludDMyX3QgekVuZDsKKyAgICB1aW50MzJfdCBhcnJheVN0YXJ0OworICAgIHVpbnQzMl90IGFycmF5RW5kOworCisgICAgdWludDMyX3QgZGltWDsKKyAgICB1aW50MzJfdCBkaW1ZOworICAgIHVpbnQzMl90IGRpbVo7CisgICAgdWludDMyX3QgZGltQXJyYXk7Cit9IE1UTGF1bmNoU3RydWN0OwordHlwZWRlZiBpbnQgKCpyc190KShjb25zdCB2b2lkICosIHZvaWQgKiwgY29uc3Qgdm9pZCAqLCB1aW50MzJfdCwgdWludDMyX3QsIHVpbnQzMl90LCB1aW50MzJfdCk7CisKK3N0YXRpYyB2b2lkIHdjX3h5KHZvaWQgKnVzciwgdWludDMyX3QgaWR4KQoreworICAgIE1UTGF1bmNoU3RydWN0ICptdGxzID0gKE1UTGF1bmNoU3RydWN0ICopdXNyOworCisgICAgd2hpbGUgKDEpIHsKKyAgICAgICAgdWludDMyX3Qgc2xpY2UgPSAodWludDMyX3QpYW5kcm9pZF9hdG9taWNfaW5jKCZtdGxzLT5tU2xpY2VOdW0pOworICAgICAgICB1aW50MzJfdCB5U3RhcnQgPSBtdGxzLT55U3RhcnQgKyBzbGljZSAqIG10bHMtPm1TbGljZVNpemU7CisgICAgICAgIHVpbnQzMl90IHlFbmQgPSB5U3RhcnQgKyBtdGxzLT5tU2xpY2VTaXplOworICAgICAgICB5RW5kID0gcnNNaW4oeUVuZCwgbXRscy0+eUVuZCk7CisgICAgICAgIGlmICh5RW5kIDw9IHlTdGFydCkgeworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisKKyAgICAgICAgLy9MT0dFKCJ1c3IgaWR4ICVpLCB4ICVpLCVpICB5ICVpLCVpIiwgaWR4LCBtdGxzLT54U3RhcnQsIG10bHMtPnhFbmQsIHlTdGFydCwgeUVuZCk7CisKKyAgICAgICAgZm9yICh1aW50MzJfdCB5ID0geVN0YXJ0OyB5IDwgeUVuZDsgeSsrKSB7CisgICAgICAgICAgICB1aW50MzJfdCBvZmZzZXQgPSBtdGxzLT5kaW1YICogeTsKKyAgICAgICAgICAgIHVpbnQ4X3QgKnhQdHJPdXQgPSBtdGxzLT5wdHJPdXQgKyAobXRscy0+ZVN0cmlkZU91dCAqIG9mZnNldCk7CisgICAgICAgICAgICBjb25zdCB1aW50OF90ICp4UHRySW4gPSBtdGxzLT5wdHJJbiArIChtdGxzLT5lU3RyaWRlSW4gKiBvZmZzZXQpOworCisgICAgICAgICAgICBmb3IgKHVpbnQzMl90IHggPSBtdGxzLT54U3RhcnQ7IHggPCBtdGxzLT54RW5kOyB4KyspIHsKKyAgICAgICAgICAgICAgICAoKHJzX3QpbXRscy0+c2NyaXB0LT5tUHJvZ3JhbS5tUm9vdCkgKHhQdHJJbiwgeFB0ck91dCwgbXRscy0+dXNyLCB4LCB5LCAwLCAwKTsKKyAgICAgICAgICAgICAgICB4UHRySW4gKz0gbXRscy0+ZVN0cmlkZUluOworICAgICAgICAgICAgICAgIHhQdHJPdXQgKz0gbXRscy0+ZVN0cmlkZU91dDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworfQorCit2b2lkIFNjcmlwdEM6OnJ1bkZvckVhY2goQ29udGV4dCAqcnNjLAorICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IEFsbG9jYXRpb24gKiBhaW4sCisgICAgICAgICAgICAgICAgICAgICAgICAgQWxsb2NhdGlvbiAqIGFvdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3Qgdm9pZCAqIHVzciwKKyAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBSc1NjcmlwdENhbGwgKnNjKQoreworICAgIE1UTGF1bmNoU3RydWN0IG10bHM7CisgICAgbWVtc2V0KCZtdGxzLCAwLCBzaXplb2YobXRscykpOworCisgICAgaWYgKGFpbikgeworICAgICAgICBtdGxzLmRpbVggPSBhaW4tPmdldFR5cGUoKS0+Z2V0RGltWCgpOworICAgICAgICBtdGxzLmRpbVkgPSBhaW4tPmdldFR5cGUoKS0+Z2V0RGltWSgpOworICAgICAgICBtdGxzLmRpbVogPSBhaW4tPmdldFR5cGUoKS0+Z2V0RGltWigpOworICAgICAgICAvL210bHMuZGltQXJyYXkgPSBhaW4tPmdldFR5cGUoKS0+Z2V0RGltQXJyYXkoKTsKKyAgICB9IGVsc2UgaWYgKGFvdXQpIHsKKyAgICAgICAgbXRscy5kaW1YID0gYW91dC0+Z2V0VHlwZSgpLT5nZXREaW1YKCk7CisgICAgICAgIG10bHMuZGltWSA9IGFvdXQtPmdldFR5cGUoKS0+Z2V0RGltWSgpOworICAgICAgICBtdGxzLmRpbVogPSBhb3V0LT5nZXRUeXBlKCktPmdldERpbVooKTsKKyAgICAgICAg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CBzYy0+eUVuZCk7CisgICAgICAgIGlmIChtdGxzLnlTdGFydCA+PSBtdGxzLnlFbmQpIHJldHVybjsKKyAgICB9CisKKyAgICBtdGxzLnhFbmQgPSByc01heCgodWludDMyX3QpMSwgbXRscy54RW5kKTsKKyAgICBtdGxzLnlFbmQgPSByc01heCgodWludDMyX3QpMSwgbXRscy55RW5kKTsKKyAgICBtdGxzLnpFbmQgPSByc01heCgodWludDMyX3QpMSwgbXRscy56RW5kKTsKKyAgICBtdGxzLmFycmF5RW5kID0gcnNNYXgoKHVpbnQzMl90KTEsIG10bHMuYXJyYXlFbmQpOworCisgICAgcnNBc3NlcnQoYWluLT5nZXRUeXBlKCktPmdldERpbVooKSA9PSAwKTsKKworICAgIHNldHVwU2NyaXB0KHJzYyk7CisgICAgU2NyaXB0ICogb2xkVExTID0gc2V0VExTKHRoaXMpOworCisKKyAgICBtdGxzLnJzYyA9IHJzYzsKKyAgICBtdGxzLmFpbiA9IGFpbjsKKyAgICBtdGxzLmFvdXQgPSBhb3V0OworICAgIG10bHMuc2NyaXB0ID0gdGhpczsKKyAgICBtdGxzLnVzciA9IHVzcjsKKyAgICBtdGxzLm1TbGljZVNpemUgPSAxMDsKKyAgICBtdGxzLm1TbGljZU51bSA9IDA7CisKKyAgICBtdGxzLnB0ckluID0gTlVMTDsKKyAgICBtdGxzLmVTdHJpZGVJbiA9IDA7CisgICAgaWYgKGFpbikgeworICAgICAgICBtdGxzLnB0ckluID0gKGNvbnN0IHVpbnQ4X3QgKilhaW4tPmdldFB0cigpOworICAgICAgICBtdGxzLmVTdHJpZGVJbiA9IGFpbi0+Z2V0VHlwZSgpLT5nZXRFbGVtZW50U2l6ZUJ5dGVzKCk7CisgICAgfQorCisgICAgbXRscy5wdHJPdXQgPSBOVUxMOworICAgIG10bHMuZVN0cmlkZU91dCA9IDA7CisgICAgaWYgKGFvdXQpIHsKKyAgICAgICAgbXRscy5wdHJPdXQgPSAodWludDhfdCAqKWFvdXQtPmdldFB0cigpOworICAgICAgICBtdGxzLmVTdHJpZGVPdXQgPSBhb3V0LT5nZXRUeXBlKCktPmdldEVsZW1lbnRTaXplQnl0ZXMoKTsKKyAgICB9CisKKworICAgIGlmICgocnNjLT5nZXRXb3JrZXJQb29sU2l6ZSgpID4gMSkgJiYgbUVudmlyb21lbnQubUlzVGhyZWFkYWJsZSAmJgorICAgICAgICAoKG10bHMuZGltWSAqIG10bHMuZGltWiAqIG10bHMuZGltQXJyYXkpID4gMSkpIHsKKworICAgICAgICAvL0xPR0UoImxhdW5jaCAxIik7CisgICAgICAgIHJzYy0+bGF1bmNoVGhyZWFkcyh3Y194eSwgJm10bHMpOworICAgICAgICAvL0xPR0UoImxhdW5jaCAyIik7CisgICAgfSBlbHNlIHsKKyAgICAgICAgZm9yICh1aW50MzJfdCBhciA9IG10bHMuYXJyYXlTdGFydDsgYXIgPCBtdGxzLmFycmF5RW5kOyBhcisrKSB7CisgICAgICAgICAgICBmb3IgKHVpbnQzMl90IHogPSBtdGxzLnpTdGFydDsgeiA8IG10bHMuekVuZDsgeisrKSB7CisgICAgICAgICAgICAgICAgZm9yICh1aW50MzJfdCB5ID0gbXRscy55U3RhcnQ7IHkgPCBtdGxzLnlFbmQ7IHkrKykgeworICAgICAgICAgICAgICAgICAgICB1aW50MzJfdCBvZmZzZXQgPSBtdGxzLmRpbVggKiBtdGxzLmRpbVkgKiBtdGxzLmRpbVogKiBhciArCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG10bHMuZGltWCAqIG10bHMuZGltWSAqIHogKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtdGxzLmRpbVggKiB5OworICAgICAgICAgICAgICAgICAgICB1aW50OF90ICp4UHRyT3V0ID0gbXRscy5wdHJPdXQgKyAobXRscy5lU3RyaWRlT3V0ICogb2Zmc2V0KTsKKyAgICAgICAgICAgICAgICAgICAgY29uc3QgdWludDhfdCAqeFB0ckluID0gbXRscy5wdHJJbiArIChtdGxzLmVTdHJpZGVJbiAqIG9mZnNldCk7CisKKyAgICAgICAgICAgICAgICAgICAgZm9yICh1aW50MzJfdCB4ID0gbXRscy54U3RhcnQ7IHggPCBtdGxzLnhFbmQ7IHgrKykgeworICAgICAgICAgICAgICAgICAgICAgICAgKChyc190KW1Qcm9ncmFtLm1Sb290KSAoeFB0ckluLCB4UHRyT3V0LCB1c3IsIHgsIHksIHosIGFyKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHhQdHJJbiArPSBtdGxzLmVTdHJpZGVJbjsKKyAgICAgICAgICAgICAgICAgICAgICAgIHhQdHJPdXQgKz0gbXRscy5lU3RyaWRlT3V0OworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgc2V0VExTKG9sZFRMUyk7Cit9CisKK3ZvaWQgU2NyaXB0Qzo6SW52b2tlKENvbnRleHQgKnJzYywgdWludDMyX3Qgc2xvdCwgY29uc3Qgdm9pZCAqZGF0YSwgdWludDMyX3QgbGVuKQoreworICAgIC8vTE9HRSgicnNpX1NjcmlwdEludm9rZSAlaSIsIHNsb3QpOworICAgIGlmICgoc2xvdCA+PSBtRW52aXJvbWVudC5tSW52b2tlRnVuY3Rpb25Db3VudCkgfHwKKyAgICAgICAgKG1FbnZpcm9tZW50Lm1JbnZva2VGdW5jdGlvbnNbc2xvdF0gPT0gTlVMTCkpIHsKKyAgICAgICAgcnNjLT5zZXRFcnJvcihSU19FUlJPUl9CQURfU0NSSVBULCAiQ2FsbGluZyBpbnZva2Ugb24gYmFkIHNjcmlwdCIpOworICAgICAgICByZXR1cm47CisgICAgfQorICAgIHNldHVwU2NyaXB0KHJzYyk7CisgICAgU2NyaXB0ICogb2xkVExTID0gc2V0VExTKHRoaXMpOworCisgICAgKCh2b2lkICgqKShjb25zdCB2b2lkICosIHVpbnQzMl90KSkKKyAgICAgICAgbUVudmlyb21lbnQubUludm9rZUZ1bmN0aW9uc1tzbG90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DApCisgICAgICAgIHMtPm1FbnZpcm9tZW50Lm1JbnZva2VGdW5jdGlvbnMgPSBOVUxMOworICAgIGVsc2UgeworICAgICAgICBzLT5tRW52aXJvbWVudC5tSW52b2tlRnVuY3Rpb25zID0gKFNjcmlwdDo6SW52b2tlRnVuY190KikgY2FsbG9jKHMtPm1FbnZpcm9tZW50Lm1JbnZva2VGdW5jdGlvbkNvdW50LCBzaXplb2YoU2NyaXB0OjpJbnZva2VGdW5jX3QpKTsKKyAgICAgICAgYmNjR2V0RXhwb3J0RnVuY3Mocy0+bUJjY1NjcmlwdCwgTlVMTCwgcy0+bUVudmlyb21lbnQubUludm9rZUZ1bmN0aW9uQ291bnQsIChCQ0N2b2lkICoqKSBzLT5tRW52aXJvbWVudC5tSW52b2tlRnVuY3Rpb25zKTsKICAgICB9CiAKLSAgICBmb3IgKGludCBjdD0wOyBjdCA8IE1BWF9TQ1JJUFRfQkFOS1M7IGN0KyspIHsKLSAgICAgICAgaWYgKG1JbnZva2FibGVOYW1lc1tjdF0ubGVuZ3RoKCkgPiAwKSB7Ci0gICAgICAgICAgICBhY2NHZXRTY3JpcHRMYWJlbChzLT5tQWNjU2NyaXB0LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUludm9rYWJsZU5hbWVzW2N0XS5zdHJpbmcoKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChBQ0N2b2lkKiopICZzLT5tRW52aXJvbWVudC5tSW52b2thYmxlc1tjdF0pOwotICAgICAgICB9CisgICAgYmNjR2V0RXhwb3J0VmFycyhzLT5tQmNjU2NyaXB0LCAoQkNDc2l6ZWkqKSAmcy0+bUVudmlyb21lbnQubUZpZWxkQ291bnQsIDAsIE5VTEwpOworICAgIGlmKHMtPm1FbnZpcm9tZW50Lm1GaWVsZENvdW50IDw9IDApCisgICAgICAgIHMtPm1FbnZpcm9tZW50Lm1GaWVsZEFkZHJlc3MgPSBOVUxMOworICAgIGVsc2UgeworICAgICAgICBzLT5tRW52a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TWF4ID0gMTY7Ci0gICAgICAgIEFDQ3NpemVpIHByYWdtYUNvdW50OwotICAgICAgICBBQ0NjaGFyICogc3RyW3ByYWdtYU1heF07Ci0gICAgICAgIGFjY0dldFByYWdtYXMocy0+bUFjY1NjcmlwdCwgJnByYWdtYUNvdW50LCBwcmFnbWFNYXgsICZzdHJbMF0pOworICAgICAgICBCQ0NzaXplaSBwcmFnbWFDb3VudDsKKyAgICAgICAgQkNDY2hhciAqIHN0cltwcmFnbWFNYXhdOworICAgICAgICBiY2NHZXRQcmFnbWFzKHMtPm1CY2NTY3JpcHQsICZwcmFnbWFDb3VudCwgcHJhZ21hTWF4LCAmc3RyWzBdKTsKIAogICAgICAgICBmb3IgKGludCBjdD0wOyBjdCA8IHByYWdtYUNvdW50OyBjdCs9MikgeworICAgICAgICAgICAgLy9MT0dFKCJwcmFnbWUgJXMgJXMiLCBzdHJbY3RdLCBzdHJbY3QrMV0pOwogICAgICAgICAgICAgaWYgKCFzdHJjbXAoc3RyW2N0XSwgInZlcnNpb24iKSkgewogICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgfQpAQCAtMjA4LDExICs0MjksNiBAQAogICAgICAgICAgICAgICAgICAgICBzLT5tRW52aXJvbWVudC5tVmVydGV4LmNsZWFyKCk7CiAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBQcm9ncmFtVmVydGV4ICogcHYgPSAoUHJvZ3JhbVZlcnRleCAqKXJzYy0+bG9va3VwTmFtZShzdHJbY3QrMV0pOwotICAgICAgICAgICAgICAgIGlmIChwdiAhPSBOVUxMKSB7Ci0gICAgICAgICAgICAgICAgICAgIHMtPm1FbnZpcm9tZW50Lm1WZXJ0ZXguc2V0KHB2KTsKLSAgICAgICAgICAgICAgICAgICAgY29udGludWU7Ci0gICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIExPR0UoIlVucmVjb25pemVkIHZhbHVlICVzIHBhc3NlZCB0byBzdGF0ZVZlcnRleCIsIHN0cltjdCsxXSk7CiAgICAgICAgICAgICB9CiAKQEAgLTIyNCwxMSArNDQwLDYgQEAKICAgICAgICAgICAgICAgICAgICAgcy0+bUVudmlyb21lbnQubVJhc3Rlci5jbGVhcigpOwogICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgUHJvZ3JhbVJhc3RlciAqIHByID0gKFByb2dyYW1SYXN0ZXIgKilyc2MtPmxvb2t1cE5hbWUoc3RyW2N0KzFdKTsKLSAgICAgICAgICAgICAgICBpZiAocHIgIT0gTlVMTCkgewotICAgICAgICAgICAgICAgICAgICBzLT5tRW52aXJvbWVudC5tUmFzdGVyLnNldChwcik7Ci0gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwotICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBMT0dFKCJVbnJlY29uaXplZCB2YWx1ZSAlcyBwYXNzZWQgdG8gc3RhdGVSYXN0ZXIiLCBzdHJbY3QrMV0pOwogICAgICAgICAgICAgfQogCkBAIC0yNDAsMTEgKzQ1MSw2IEBACiAgICAgICAgICAgICAgICAgICAgIHMtPm1FbnZpcm9tZW50Lm1GcmFnbWVudC5jbGVhcigpOwogICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgUHJvZ3JhbUZyYWdtZW50ICogcGYgPSAoUHJvZ3JhbUZyYWdtZW50ICopcnNjLT5sb29rdXBOYW1lKHN0cltjdCsxXSk7Ci0gICAgICAgICAgICAgICAgaWYgKHBmICE9IE5VTEwpIHsKLSAgICAgICAgICAgICAgICAgICAgcy0+bUVudmlyb21lbnQubUZyYWdtZW50LnNldChwZik7Ci0gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlOwotICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBMT0dFKCJVbnJlY29uaXplZCB2YWx1ZSAlcyBwYXNzZWQgdG8gc3RhdGVGcmFnbWVudCIsIHN0cltjdCsxXSk7CiAgICAgICAgICAgICB9CiAKQEAgLTI1NiwxMiArNDYyLDYgQEAKICAgICAgICAgICAgICAgICAgICAgcy0+bUVudmlyb21lbnQubUZyYWdtZW50U3RvcmUuY2xlYXIoKTsKICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIFByb2dyYW1GcmFnbWVudFN0b3JlICogcGZzID0KLSAgICAgICAgICAgICAgICAgICAgKFByb2dyYW1GcmFnbWVudFN0b3JlICopcnNjLT5sb29rdXBOYW1lKHN0cltjdCsxXSk7Ci0gICAgICAgICAgICAgICAgaWYgKHBmcyAhPSBOVUxMKSB7Ci0gICAgICAgICAgICAgICAgICAgIHMtPm1FbnZpcm9tZW50Lm1GcmFnbWVudFN0b3JlLnNldChwZnMpOwotICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKLSAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgTE9HRSgiVW5yZWNvbml6ZWQgdmFsdWUgJXMgcGFzc2VkIHRvIHN0YXRlU3RvcmUiLCBzdHJbY3QrMV0pOwogICAgICAgICAgICAgfQogCkBAIC0yNzMsMTExICs0NzMsNiBAQAogICAgIH0KIH0KIAotc3RhdGljIHZvaWQgYXBwZW5kRWxlbWVudEJvZHkoU3RyaW5nOCAqcywgY29uc3QgRWxlbWVudCAqZSkKLXsKLSAgICBzLT5hcHBlbmQoIiB7XG4iKTsKLSAgICBmb3IgKHNpemVfdCBjdDI9MDsgY3QyIDwgZS0+Z2V0RmllbGRDb3VudCgpOyBjdDIrKykgewotICAgICAgICBjb25zdCBFbGVtZW50ICpjID0gZS0+Z2V0RmllbGQoY3QyKTsKLSAgICAgICAgcy0+YXBwZW5kKCIgICAgIik7Ci0gICAgICAgIHMtPmFwcGVuZChjLT5nZXRDVHlwZSgpKTsKLSAgICAgICAgc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5nZXROYW1lKCkpIHsKLSAgICAgICAgICAgICAgICAvLyBVc2UgdGhlIG5hbWVkIHN0cnVjdAotICAgICAgICAgICAgICAgIHMuc2V0VG8oZS0+Z2V0TmFtZSgpKTsKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgLy8gY3JlYXRlIGFuIHN0cnVjdCBuYW1lZCBmcm9tIHRoZSBzbG90LgotICAgICAgICAgICAgICAgIHMuc2V0VG8oInN0cnVjdCAiKTsKLSAgICAgICAgICAgICAgICBzLmFwcGVuZChtU2xvdE5hbWVzW2N0XSk7Ci0gICAgICAgICAgICAgICAgcy5hcHBlbmQoIl9zIik7Ci0gICAgICAgICAgICAgICAgcy5hcHBlbmQoZS0+Z2V0Q1N0cnVjdEJvZHkoKSk7Ci0gICAgICAgICAgICAgICAgLy9hcHBlbmRFbGVtZW50Qm9keSgmcywgZSk7Ci0gICAgICAgICAgICAgICAgcy5hcHBlbmQoIjtcbiIpOwotICAgICAgICAgICAgICAgIHMuYXBwZW5kKCJzdHJ1Y3QgIik7Ci0gICAgICAgICAgICAgICAgcy5hcHBlbmQobVNsb3ROYW1lc1tjdF0pOwotICAgICAgICAgICAgICAgIHMuYXBwZW5kKCJfcyIpOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBzLmFwcGVuZCgiICogIik7Ci0gICAgICAgICAgICBzLmFwcGVuZChtU2xvdE5hbWVzW2N0XSk7Ci0gICAgICAgICAgICBzLmFwcGVuZCgiO1xuIik7Ci0gICAgICAgICAgICBpZiAocnNjLT5wcm9wcy5tTG9nU2NyaXB0cykgewotICAgICAgICAgICAgICAgIExPR1YoIiVzIiwgc3RhdGljX2Nhc3Q8Y29uc3QgY2hhcio+KHMpKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHN0ci0+YXBwZW5kKHMpOwotICAgICAgICB9Ci0gICAgfQotfQogCiAKIG5hbWVzcGFjZSBhbmRyb2lkIHsKQEAgLTQyMCw3ICs1MTUsN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LCB1aW50MzJfdCBsYXVuY2hJRCk7CisgICAgY29uc3QgQWxsb2NhdGlvbiAqcHRyVG9BbGxvY2F0aW9uKGNvbnN0IHZvaWQgKikgY29uc3Q7CisKKworICAgIHZpcnR1YWwgdm9pZCBJbnZva2UoQ29udGV4dCAqcnNjLCB1aW50MzJfdCBzbG90LCBjb25zdCB2b2lkICpkYXRhLCB1aW50MzJfdCBsZW4pOworCisgICAgdmlydHVhbCB1aW50MzJfdCBydW4oQ29udGV4dCAqKTsKKworICAgIHZpcnR1YWwgdm9pZCBydW5Gb3JFYWNoKENvbnRleHQgKnJzYywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBBbGxvY2F0aW9uICogYWluLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIEFsbG9jYXRpb24gKiBhb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHZvaWQgKiB1c3IsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgUnNTY3JpcHRDYWxsICpzYyA9IE5VTEwpOworCisgICAgdmlydHVhbCB2b2lkIHNlcmlhbGl6ZShPU3RyZWFtICpzdHJlYW0pIGNvbnN0IHsgICAgfQorICAgIHZpcnR1YWwgUnNBM0RDbGFzc0lEIGdldENsYXNzSWQoKSBjb25zdCB7IHJldHVybiBSU19BM0RfQ0xBU1NfSURfU0NSSVBUX0M7IH0KKyAgICBzdGF0aWMgVHlwZSAqY3JlYXRlRnJvbVN0cmVhbShDb250ZXh0ICpyc2MsIElTdHJlYW0gKnN0cmVhbSkgeyByZXR1cm4gTlVMTDsgfQorCitwcm90ZWN0ZWQ6CisgICAgdm9pZCBzZXR1cFNjcmlwdChDb250ZXh0ICopOworICAgIHZvaWQgc2V0dXBHTFN0YXRlKENvbnRleHQgKik7CisgICAgU2NyaXB0ICogc2V0VExTKFNjcmlwdCAqKTsKIH07CiAKIGNsYXNzIFNjcmlwdENTdGF0ZQpAQCAtNjcsMjcgKzgyLDIxIEBAC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m1hdCwgZmxvYXQgeCwgZmxvYXQgeSwgZmxvYXQgeikKLXsKLSAgICBNYXRyaXggKm0gPSByZWludGVycHJldF9jYXN0PE1hdHJpeCAqPihtYXQpOwotICAgIG0tPmxvYWRTY2FsZSh4LCB5LCB6KTsKLX0KLQotc3RhdGljIHZvaWQgU0NfbWF0cml4TG9hZFRyYW5zbGF0ZShyc2NfTWF0cml4ICptYXQsIGZsb2F0IHgsIGZsb2F0IHksIGZsb2F0IHopCi17Ci0gICAgTWF0cml4ICptID0gcmVpbnRlcnByZXRfY2FzdDxNYXRyaXggKj4obWF0KTsKLSAgICBtLT5sb2FkVHJhbnNsYXRlKHgsIHksIHopOwotfQotCi1zdGF0aWMgdm9pZCBTQ19tYXRyaXhMb2FkTXVsdGlwbHkocnNjX01hdHJpeCAqbWF0LCBjb25zdCByc2NfTWF0cml4ICpsaHMsIGNvbnN0IHJzY19NYXRyaXggKnJocykKLXsKLSAgICBNYXRyaXggKm0gPSByZWludGVycHJldF9jYXN0PE1hdHJpeCAqPihtYXQpOwotICAgIG0tPmxvYWRNdWx0aXBseShyZWludGVycHJldF9jYXN0PGNvbnN0IE1hdHJpeCAqPihsaHMpLAotICAgICAgICAgICAgICAgICAgICByZWludGVycHJldF9jYXN0PGNvbnN0IE1hdHJpeCAqPihyaHMpKTsKLX0KLQotc3RhdGljIHZvaWQgU0NfbWF0cml4TXVsdGlwbHkocnNjX01hdHJpeCAqbWF0LCBjb25zdCByc2NfTWF0cml4ICpyaHMpCi17Ci0gICAgTWF0cml4ICptID0gcmVpbnRlcnByZXRfY2FzdDxNYXRyaXggKj4obWF0KTsKLSAgICBtLT5tdWx0aXBseShyZWludGVycHJldF9jYXN0PGNvbnN0IE1hdHJpeCAqPihyaHMpKTsKLX0KLQotc3RhdGljIHZvaWQgU0NfbWF0cml4Um90YXRlKHJzY19NYXRyaXggKm1hdCwgZmxvYXQgcm90LCBmbG9hdCB4LCBmbG9hdCB5LCBmbG9hdCB6KQotewotICAgIE1hd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XJlKFJzUHJvZ3JhbUZyYWdtZW50IHZwZiwgdWludDMyX3Qgc2xvdCwgUnNBbGxvY2F0aW9uIHZhKQotewotICAgIEdFVF9UTFMoKTsKLSAgICByc2lfUHJvZ3JhbUJpbmRUZXh0dXJlKHJzYywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRpY19jYXN0PFByb2dyYW1GcmFnbWVudCAqPih2cGYpLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgc2xvdCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRpY19jYXN0PEFsbG9jYXRpb24gKj4odmEpKTsKLQotfQotCi1zdGF0aWMgdm9pZCBTQ19iaW5kU2FtcGxlcihSc1Byb2dyYW1GcmFnbWVudCB2cGYsIHVpbnQzMl90IHNsb3QsIFJzU2FtcGxlciB2cykKLXsKLSAgICBHRVRfVExTKCk7Ci0gICAgcnNpX1Byb2dyYW1CaW5kU2FtcGxlcihyc2MsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0aWNfY2FzdDxQcm9ncmFtRnJhZ21lbnQgKj4odnBmKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgIHNsb3QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0aWNfY2FzdDxTYW1wbGVyICo+KHZzKSk7Ci0KLX0KLQotc3RhdGljIHZvaWQgU0NfYmluZFByb2dyYW1GcmFnbWVudFN0b3JlKFJzUHJvZ3JhbUZyYWdtZW50U3RvcmUgcGZzKQotewotICAgIEdFVF9UTFMoKTsKLSAgICByc2lfQ29udGV4dEJpbmRQcm9ncmFtRnJhZ21lbnRTdG9yZShyc2MsIHBmcyk7Ci0KLX0KLQotc3RhdGljIHZvaWQgU0NfYmluZFByb2dyYW1GcmFnbWVudChSc1Byb2dyYW1GcmFnbWVudCBwZikKLXsKLSAgICBHRVRfVExTKCk7Ci0gICAgcnNpX0NvbnRleHRCaW5kUHJvZ3JhbUZyYWdtZW50KHJzYywgcGYpOwotCi19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GV4QXJyYXksICZyc2MtPm1TaGFkZXJDYWNoZSk7Ci0gICAgfSBlbHNlIHsKLSAgICAgICAgdmEuc2V0dXBHTChyc2MsICZyc2MtPm1TdGF0ZVZlcnRleEFycmF5KTsKLSAgICB9Ci0KLSAgICBnbERyYXdBcnJheXMoR0xfUE9JTlRTLCAwLCAxKTsKLX0KLQotc3RhdGljIHZvaWQgU0NfZHJhd1F1YWRUZXhDb29yZHMoZmxvYXQgeDEsIGZsb2F0IHkxLCBmbG9hdCB6MSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IHUxLCBmbG9hdCB2MSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IHgyLCBmbG9hdCB5MiwgZmxvYXQgejIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB1MiwgZmxvYXQgdjIsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB4MywgZmxvYXQgeTMsIGZsb2F0IHozLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgdTMsIGZsb2F0IHYzLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgeDQsIGZsb2F0IHk0LCBmbG9hdCB6NCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IHU0LCBmbG9hdCB2NCkKLXsKLSAgICBHRVRfVExTKCk7Ci0gICAgaWYgKCFyc2MtPnNldHVwQ2hlY2soKSkgewotICAgICAgICByZXR1cm47Ci0gICAgfQotCi0gICAgLy9MT0dFKCJRdWFkIik7Ci0gICAgLy9MT0dFKCIlNC4yZiwgJTQuMmYsICU0LjJmIiwgeDEsIHkxLCB6MSk7Ci0gICAgLy9MT0dFKCIlNC4yZiwgJTQuMmYsICU0LjJmIiwgeDIsIHkyLCB6Mik7Ci0gICAgLy9MT0dFKCIlNC4yZiwgJTQuMmYsICU0LjJmIiwgeDMsI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gPSBxdjsKLSAgICAgICAgICAgIGdyZWVuID0gejsKLSAgICAgICAgICAgIGJsdWUgPSBwdjsKLSAgICAgICAgICAgIGJyZWFrOwotICAgICAgICBjYXNlIDI6Ci0gICAgICAgICAgICByZWQgPSBwdjsKLSAgICAgICAgICAgIGdyZWVuID0gejsKLSAgICAgICAgICAgIGJsdWUgPSB0djsKLSAgICAgICAgICAgIGJyZWFrOwotICAgICAgICBjYXNlIDM6ICAgICAgICAgLy8gQmx1ZSBpcyB0aGUgZG9taW5hbnQgY29sb3IKLSAgICAgICAgICAgIHJlZCA9IHB2OwotICAgICAgICAgICAgZ3JlZW4gPSBxdjsKLSAgICAgICAgICAgIGJsdWUgPSB6OwotICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgIGNhc2UgNDoKLSAgICAgICAgICAgIHJlZCA9IHR2OwotICAgICAgICAgICAgZ3JlZW4gPSBwdjsKLSAgICAgICAgICAgIGJsdWUgPSB6OwotICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgIGNhc2UgNTogICAgICAgICAvLyBSZWQgaXMgdGhlIGRvbWluYW50IGNvbG9yCi0gICAgICAgICAgICByZWQgPSB6OwotICAgICAgICAgICAgZ3JlZW4gPSBwdjsKLSAgICAgICAgICAgIGJsdWUgPSBxdjsKLSAgICAgICAgICAgIGJyZWFrOwotICAgIH0KLQotICAgIHJnYlswXSA9IHJlZDsKLSAgICByZ2JbMV0gPSBncmVlbjsKLSAgICByZ2JbMl0gPSBibHVlOwotfQotCi1zdGF0aWMgaW50IFNDX2hzYlRvQWJncihmbG9hdCBoLCBmbG9hdCBzLCBmbG9hdCBiLCBmbG9hdCBhKQotewotICAgIGZsb2F0IHJnYlszXTsKLSAgICBTQ19oc2JUb1JnYihoLCBzLCBiLCByZ2IpOwotICAgIHJldHVybiBpbnQoYSAgICAgICogMjU1LjBmKSA8PCAyNCB8Ci0gICAgICAgICAgIGludChyZ2JbMl0gKiAyNTUuMGYpIDw8IDE2IHwKLSAgICAgICAg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gICAgICA6Oj0gdCAgIyB1bnNpZ25lZCBzaG9ydAorLy8gICAgICAgICAgICAgICAgIDo6PSBpICAjIGludAorLy8gICAgICAgICAgICAgICAgIDo6PSBqICAjIHVuc2lnbmVkIGludAorLy8gICAgICAgICAgICAgICAgIDo6PSBsICAjIGxvbmcKKy8vICAgICAgICAgICAgICAgICA6Oj0gbSAgIyB1bnNpZ25lZCBsb25nCisvLyAgICAgICAgICAgICAgICAgOjo9IHggICMgbG9uZyBsb25nLCBfX2ludDY0CisvLyAgICAgICAgICAgICAgICAgOjo9IHkgICMgdW5zaWduZWQgbG9uZyBsb25nLCBfX2ludDY0CisvLyAgICAgICAgICAgICAgICAgOjo9IGYgICMgZmxvYXQKKy8vICAgICAgICAgICAgICAgICA6Oj0gZCAgIyBkb3VibGUKIAotICAgIC8vIG1hdGgKLSAgICB7ICJtb2RmIiwgKHZvaWQgKikmZm1vZCwKLSAgICAgICAgImZsb2F0IiwgIihmbG9hdCwgZmxvYXQpIiB9LAotICAgIHsgImFicyIsICh2b2lkICopJmFicywKLSAgICAgICAgImludCIsICIoaW50KSIgfSwKLSAgICB7ICJhYnNmIiwgKHZvaWQgKikmZmFic2YsCi0gICAgICAgICJmbG9hdCIsICIoZmxvYXQpIiB9LAotICAgIHsgInNpbmZfZmFzdCIsICh2b2lkICopJlNDX3NpbmZfZmFzdCwKLSAgICAgICAgImZsb2F0IiwgIihmbG9hdCkiIH0sCi0gICAgeyAiY29zZl9mYXN0IiwgKHZvaWQgKikmU0NfY29zZl9mYXN0LAotICAgICAgICAiZmxvYXQiLCAiKGZsb2F0KSIgfSwKLSAgICB7ICJzaW5mIiwgKHZvaWQgKikmc2luZiwKLSAgICAgICAgImZsb2F0IiwgIihmbG9hdCkiIH0sCi0gICAgeyAiY29zZiIsICh2b2lkICopJmNvc2YsCi0gICAgICAgICJmbG9hdCIsICIoZmxvYXQpIiB9LAotICAgIHsgImFzaW5mIiwgKHZvaWQgKikmYXNpbmYsCi0gICAgICAgICJmbG9hdCIsICIoZmxvYXQpIiB9LAotICAgIHsgImFjb3NmIiwgKHZvaWQgKikmYWNvc2YsCi0gICAgICAgICJmbG9hdCIsICIoZmxvYXQpIiB9LAotICAgIHsgImF0YW5mIiwgKHZvaWQgKikmYXRhbmYsCi0gICAgICAgICJmbG9hdCIsICIoZmxvYXQpIiB9LAotICAgIHsgImF0YW4yZiIsICh2b2lkICopJmF0YW4yZiwKLSAgICAgICAgImZsb2F0IiwgIihmbG9hdCwgZmxvYXQpIiB9LAotICAgIHsgImZhYnNmIiwgKHZvaWQgKikmZmFic2YsCi0gICAgICAgICJmbG9hdCIsICIoZmxvYXQpIiB9LAotICAgIHsgInJhbmRmIiwgKHZvaWQgKikmU0NfcmFuZGYsCi0gICAgICAgICJmbG9hdCIsICIoZmxvYXQpIiB9LAotICAgIHsgInJhbmRmMiIsICh2b2lkICopJlNDX3JhbmRmMiwKLSAgICAgICAgImZsb2F0IiwgIihmbG9hdCwgZmxvYXQpIiB9LAotICAgIHsgImZsb29yZiIsICh2b2lkICopJmZsb29yZiwKLSAgICAgICAgImZsb2F0IiwgIihmbG9hdCkiIH0sCi0gICAgeyAiZnJhY2YiLCAodm9pZCAqKSZTQ19mcmFjZiwKLSAgICAgICAgImZsb2F0IiwgIihmbG9hdCkiIH0sCi0gICAgeyAiY2VpbGYiLCAodm9pZCAqKSZjZWlsZiwKLSAgICAgICAgImZsb2F0IiwgIihmbG9hdCkiIH0sCi0gICAgeyAicm91bmRmIiwgKHZvaWQgKikmU0Nfcm91bmRmLAotICAgICAgICAiZmxvYXQiLCAiKGZsb2F0KSIgfSwKLSAgICB7ICJleHBmIiwgKHZvaWQgKikmZXhwZiwKLSAgICAgICAgImZsb2F0IiwgIihmbG9hdCkiIH0sCi0gICAgeyAibG9nZiIsICh2b2lkICopJmxvZ2YsCi0gICAgICAgICJmbG9hdCIsICIoZmxvYXQpIiB9LAotICAgIHsgInBvd2YiLCAodm9pZCAqKSZwb3dmLAotICAgICAgICAiZmxvYXQiLCAiKGZsb2F0LCBmbG9hdCkiIH0sCi0gICAgeyAibWF4ZiIsICh2b2lkICopJlNDX21heGYsCi0gICAgICAgICJmbG9hdCIsICIoZmxvYXQsIGZsb2F0KSIgfSwKLSAgICB7ICJtaW5mIiwgKHZvaWQgKikmU0NfbWluZiwKLSAgICAgICAgImZsb2F0IiwgIihmbG9hdCwgZmxvYXQpIiB9LAotICAgIHsgInNxcnQiLCAodm9pZCAqKSZzcXJ0LAotICAgICAgICAiaW50IiwgIihpbnQpIiB9LAotICAgIHsgInNxcnRmIiwgKHZvaWQgKikmc3FydGYsCi0gICAgICAgICJmbG9hdCIsICIoZmxvYXQpIiB9LAotICAgIHsgInNxciIsICh2b2lkICopJlNDX3NxciwKLSAgICAgICAgImludCIsICIoaW50KSIgfSwKLSAgICB7ICJzcXJmIiwgKHZvaWQgKikmU0Nfc3FyZiwKLSAgICAgICAgImZsb2F0IiwgIihmbG9hdCkiIH0sCi0gICAgeyAic2lnbiIsICh2b2lkICopJlNDX3NpZ24sCi0gICAgICAgICJpbnQiLCAiKGludCkiIH0sCi0gICAgeyAic2lnbmYiLCAodm9pZCAqKSZTQ19zaWduZiwKLSAgICAgICAgImZsb2F0IiwgIihmbG9hdCkiIH0sCi0gICAgeyAiY2xhbXAiLCAodm9pZCAqKSZTQ19jbGFtcCwKLSAgICAgICAgImludCIsICIoaW50LCBpbnQsIGludCkiIH0sCi0gICAgeyAiY2xhbXBmIiwgKHZvaWQgKikmU0NfY2xhbXBmLAotICAgICAgICAiZmxvYXQiLCAiKGZsb2F0LCBmbG9hdCwgZmxvYXQpIiB9LAotICAgIHsgImRpc3RmMiIsICh2b2lkICopJlNDX2Rpc3RmMiwKLSAgICAgICAgImZsb2F0IiwgIihmbG9hdCwgZmxvYXQsIGZsb2F0LCBmbG9hdCkiIH0sCi0gICAgeyAiZGlzdGYzIiwgKHZvaWQgKikmU0NfZGlzdGYzLAotICAgICAgICAiZmxvYXQiLCAiKGZsb2F0LCBmbG9hdC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lYnVnUEtjUEsxMnJzX21hdHJpeDJ4MiIsICh2b2lkICopJlNDX2RlYnVnRk0ydjIgfSwKKyAgICB7ICJfWjdyc0RlYnVnUEtjaSIsICh2b2lkICopJlNDX2RlYnVnSTMyIH0sCisgICAgeyAiX1o3cnNEZWJ1Z1BLY2oiLCAodm9pZCAqKSZTQ19kZWJ1Z1UzMiB9LAorICAgIHsgIl9aN3JzRGVidWdQS2NQS3YiLCAodm9pZCAqKSZTQ19kZWJ1Z1AgfSwKKworICAgIC8vIFJTIE1hdGgKKyAgICB7ICJfWjZyc1JhbmRpIiwgKHZvaWQgKikmU0NfcmFuZGkgfSwKKyAgICB7ICJfWjZyc1JhbmRpaSIsICh2b2lkICopJlNDX3JhbmRpMiB9LAorICAgIHsgIl9aNnJzUmFuZGYiLCAodm9pZCAqKSZTQ19yYW5kZiB9LAorICAgIHsgIl9aNnJzUmFuZGZmIiwgKHZvaWQgKikmU0NfcmFuZGYyIH0sCisgICAgeyAiX1o2cnNGcmFjZiIsICh2b2lkICopJlNDX2ZyYWMgfSwKIAogICAgIC8vIHRpbWUKLSAgICB7ICJzZWNvbmQiLCAodm9pZCAqKSZTQ19zZWNvbmQsCi0gICAgICAgICJpbnQiLCAiKCkiIH0sCi0gICAgeyAibWludXRlIiwgKHZvaWQgKikmU0NfbWludXRlLAotICAgICAgICAiaW50IiwgIigpIiB9LAotICAgIHsgImhvdXIiLCAodm9pZCAqKSZTQ19ob3VyLAotICAgICAgICAiaW50IiwgIigpIiB9LAotICAgIHsgImRheSIsICh2b2lkICopJlNDX2RheSwKLSAgICAgICAgImludCIsICIoKSIgfSwKLSAgICB7ICJtb250aCIsICh2b2lkICopJlNDX21vbnRoLAotICAgICAgICAiaW50IiwgIigpIiB9LAotICAgIHsgInllYXIiLCAodm9pZCAqKSZTQ195ZWFyLAotICAgICAgICAiaW50IiwgIigpIiB9LAotICAgIHsgInVwdGltZU1pbGxpcyIsICh2b2lkKikmU0NfdXB0aW1lTWlsbGlzLAotIC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JlLAotICAgICAgICAidm9pZCIsICIoaW50LCBpbnQpIiB9LAotICAgIHsgInVwbG9hZFRvQnVmZmVyT2JqZWN0IiwgKHZvaWQgKikmU0NfdXBsb2FkVG9CdWZmZXJPYmplY3QsCi0gICAgICAgICJ2b2lkIiwgIihpbnQpIiB9LAotCi0gICAgeyAic3luY1RvR0wiLCAodm9pZCAqKSZTQ19zeW5jVG9HTCwKLSAgICAgICAgInZvaWQiLCAiKGludCkiIH0sCi0KLSAgICB7ICJjb2xvckZsb2F0UkdCQXRvVU5vcm04IiwgKHZvaWQgKikmU0NfY29sb3JGbG9hdFJHQkF0b1VOb3JtOCwKLSAgICAgICAgImludCIsICIoZmxvYXQsIGZsb2F0LCBmbG9hdCwgZmxvYXQpIiB9LAotICAgIHsgImNvbG9yRmxvYXRSR0J0bzU2NSIsICh2b2lkICopJlNDX2NvbG9yRmxvYXRSR0JBdG81NjUsCi0gICAgICAgICJpbnQiLCAiKGZsb2F0LCBmbG9hdCwgZmxvYXQpIiB9LAotCi0KLSAgICB7ICJnZXRXaWR0aCIsICh2b2lkICopJlNDX2dldFdpZHRoLAotICAgICAgICAiaW50IiwgIigpIiB9LAotICAgIHsgImdldEhlaWdodCIsICh2b2lkICopJlNDX2dldEhlaWdodCwKLSAgICAgICAgImludCIsICIoKSIgfSwKLQotICAgIHsgInNlbmRUb0NsaWVudCIsICh2b2lkICopJlNDX3RvQ2xpZW50LAotICAgICAgICAiaW50IiwgIih2b2lkICpkYXRhLCBpbnQgY21kSUQsIGludCBsZW4sIGludCB3YWl0Rm9yU3BhY2UpIiB9LAotCi0KLSAgICB7ICJkZWJ1Z0YiLCAodm9pZCAqKSZTQ19kZWJ1Z0YsCi0gICAgICAgICJ2b2lkIiwgIih2b2lkICosIGZsb2F0KSIgfSwKLSAgICB7ICJkZWJ1Z0kzMiIsICh2b2lkICopJlNDX2RlYnVnSTMyLAotICAgICAgICAidm9pZCIsICIodm9pZCAqLCBpbnQpIiB9LAotICAgIHsgImRlYn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3MgaW1wbGVtZW50YXRpb24KKy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLworCisvLyBsbHZtIG5hbWUgbWFuZ2xpbmcgcmVmCisvLyAgPGJ1aWx0aW4tdHlwZT4gOjo9IHYgICMgdm9pZAorLy8gICAgICAgICAgICAgICAgIDo6PSBiICAjIGJvb2wKKy8vICAgICAgICAgICAgICAgICA6Oj0gYyAgIyBjaGFyCisvLyAgICAgICAgICAgICAgICAgOjo9IGEgICMgc2lnbmVkIGNoYXIKKy8vICAgICAgICAgICAgICAgICA6Oj0gaCAgIyB1bnNpZ25lZCBjaGFyCisvLyAgICAgICAgICAgICAgICAgOjo9IHMgICMgc2hvcnQKKy8vICAgICAgICAgICAgICAgICA6Oj0gdCAgIyB1bnNpZ25lZCBzaG9ydAorLy8gICAgICAgICAgICAgICAgIDo6PSBpICAjIGludAorLy8gICAgICAgICAgICAgICAgIDo6PSBqICAjIHVuc2lnbmVkIGludAorLy8gICAgICAgICAgICAgICAgIDo6PSBsICAjIGxvbmcKKy8vICAgICAgICAgICAgICAgICA6Oj0gbSAgIyB1bnNpZ25lZCBsb25nCisvLyAgICAgICAgICAgICAgICAgOjo9IHggICMgbG9uZyBsb25nLCBfX2ludDY0CisvLyAgICAgICAgICAgICAgICAgOjo9IHkgICMgdW5zaWduZWQgbG9uZyBsb25nLCBfX2ludDY0CisvLyAgICAgICAgICAgICAgICAgOjo9IGYgICMgZmxvYXQKKy8vICAgICAgICAgICAgICAgICA6Oj0gZCAgIyBkb3VibGUKKworc3RhdGljIFNjcmlwdENTdGF0ZTo6U3ltYm9sVGFibGVfdCBnU3ltc1tdID0geworICAgIC8vIE9wZW5DTCBtYXRoCisgICAgeyAiX1o0YWNvc2YiLCAodm9pZCAqKSZhY29zZiB9LAorICAgIHsgIl9aNWFjb3NoZiIsICh2b2lkICopJmFjb3No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gIHJzYy0+Z2V0VmVydGV4KCktPmdldFByb2plY3Rpb25NYXRyaXgobSk7Cit9CisKKworLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vCisvLyBEcmF3aW5nCisvLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8KKworc3RhdGljIHZvaWQgU0NfZHJhd1F1YWRUZXhDb29yZHMoZmxvYXQgeDEsIGZsb2F0IHkxLCBmbG9hdCB6MSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IHUxLCBmbG9hdCB2MSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IHgyLCBmbG9hdCB5MiwgZmxvYXQgejIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB1MiwgZmxvYXQgdjIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbG9hdCB4MywgZmxvYXQgeTMsIGZsb2F0IHozLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgdTMsIGZsb2F0IHYzLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgeDQsIGZsb2F0IHk0LCBmbG9hdCB6NCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0IHU0LCBmbG9hdCB2NCkKK3sKKyAgICBHRVRfVExTKCk7CisgICAgaWYgKCFyc2MtPnNldHVwQ2hlY2soKSkgeworICAgICAgICByZXR1cm47CisgICAgfQorCisgICAgLy9MT0dFKCJRdWFkIik7CisgICAgLy9MT0dFKCIlNC4yZiwgJTQuMmYsICU0LjJmIiwgeDEsIHkxLCB6MSk7CisgICAgLy9MT0dFKCIlN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ZvdXQsIHZpbik7CisgICAgLy9MT0dFKCJkcyAgb3V0ICVmICVmICVmICVmIiwgdm91dFswXSwgdm91dFsxXSwgdm91dFsyXSwgdm91dFszXSk7CisgICAgdm91dFswXSAvPSB2b3V0WzNdOworICAgIHZvdXRbMV0gLz0gdm91dFszXTsKKyAgICB2b3V0WzJdIC89IHZvdXRbM107CisKKyAgICB2b3V0WzBdICo9IHJzYy0+Z2V0V2lkdGgoKSAvIDI7CisgICAgdm91dFsxXSAqPSByc2MtPmdldEhlaWdodCgpIC8gMjsKKyAgICB2b3V0WzBdICs9IHJzYy0+Z2V0V2lkdGgoKSAvIDI7CisgICAgdm91dFsxXSArPSByc2MtPmdldEhlaWdodCgpIC8gMjsKKworICAgIHZvdXRbMF0gLT0gdy8yOworICAgIHZvdXRbMV0gLT0gaC8yOworCisgICAgLy9MT0dFKCJkcyAgb3V0MiAlZiAlZiAlZiIsIHZvdXRbMF0sIHZvdXRbMV0sIHZvdXRbMl0pOworCisgICAgLy8gVSwgViwgVywgSAorICAgIFNDX2RyYXdTcHJpdGVTY3JlZW5zcGFjZSh2b3V0WzBdLCB2b3V0WzFdLCB6LCBoLCB3KTsKKyAgICAvL3JzYy0+c2V0dXBDaGVjaygpOworfQorKi8KKworc3RhdGljIHZvaWQgU0NfZHJhd1JlY3QoZmxvYXQgeDEsIGZsb2F0IHkxLAorICAgICAgICAgICAgICAgICAgICAgICAgZmxvYXQgeDIsIGZsb2F0IHkyLCBmbG9hdCB6KQoreworICAgIC8vTE9HRSgiU0NfZHJhd1JlY3QgJWYsJWYgICVmLCVmICAlZiIsIHgxLCB5MSwgeDIsIHkyLCB6KTsKKyAgICBTQ19kcmF3UXVhZCh4MSwgeTIsIHosCisgICAgICAgICAgICAgICAgeDIsIHkyLCB6LAorICAgICAgICAgICAgICAgIHgyLCB5MSwgeiwKKyAgICAgICAgICAgICAgICB4MSwgeTEsIHopOworfQorCitzdGF0aWMgdm9pZCBTQ19kcmF3TWVzaChSc01lc2ggdnNtKQoreworICAgIEdFVF9UTFMoKTsKKyAgICBNZXNoICpzbSA9IHN0YXRpY19jYXN0PE1lc2ggKj4odnNtKTsKKyAgICBpZiAoIXJzYy0+c2V0dXBDaGVjaygpKSB7CisgICAgICAgIHJldHVybjsKKyAgICB9CisgICAgc20tPnJlbmRlcihyc2MpOworfQorCitzdGF0aWMgdm9pZCBTQ19kcmF3TWVzaFByaW1pdGl2ZShSc01lc2ggdnNtLCB1aW50MzJfdCBwcmltSW5kZXgpCit7CisgICAgR0VUX1RMUygpOworICAgIE1lc2ggKnNtID0gc3RhdGljX2Nhc3Q8TWVzaCAqPih2c20pOworICAgIGlmICghcnNjLT5zZXR1cENoZWNrKCkpIHsKKyAgICAgICAgcmV0dXJuOworICAgIH0KKyAgICBzbS0+cmVuZGVyUHJpbWl0aXZlKHJzYywgcHJpbUluZGV4KTsKK30KKworc3RhdGljIHZvaWQgU0NfZHJhd01lc2hQcmltaXRpdmVSYW5nZShSc01lc2ggdnNtLCB1aW50MzJfdCBwcmltSW5kZXgsIHVpbnQzMl90IHN0YXJ0LCB1aW50MzJfdCBsZW4pCit7CisgICAgR0VUX1RMUygpOworICAgIE1lc2ggKnNtID0gc3RhdGljX2Nhc3Q8TWVzaCAqPih2c20pOworICAgIGlmICghcnNjLT5zZXR1cENoZWNrKCkpIHsKKyAgICAgICAgcmV0dXJuOworICAgIH0KKyAgICBzbS0+cmVuZGVyUHJpbWl0aXZlUmFuZ2UocnNjLCBwcmltSW5kZXgsIHN0YXJ0LCBsZW4pOworfQorCitzdGF0aWMgdm9pZCBTQ19tZXNoQ29tcHV0ZUJvdW5kaW5nQm94KFJzTWVzaCB2c20sIGZsb2F0ICptaW5YLCBmbG9hdCAqbWluWSwgZmxvYXQgKm1pblosCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsb2F0ICptYXhYLCBmbG9hdCAqbWF4WSwgZmxvYXQgKm1heFopCit7CisgICAgR0VUX1RMUygpOworICAgIE1lc2ggKnNtID0gc3RhdGljX2Nhc3Q8TWVzaCAqPih2c20pOworICAgIHNtLT5jb21wdXRlQkJveCgpOworICAgICptaW5YID0gc20tPm1CQm94TWluWzBdOworICAgICptaW5ZID0gc20tPm1CQm94TWluWzFdOworICAgICptaW5aID0gc20tPm1CQm94TWluWzJdOworICAgICptYXhYID0gc20tPm1CQm94TWF4WzBdOworICAgICptYXhZID0gc20tPm1CQm94TWF4WzFdOworICAgICptYXhaID0gc20tPm1CQm94TWF4WzJdOworfQorCisKKy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLworLy8KKy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLy8vLworCisKK3N0YXRpYyB2b2lkIFNDX2NvbG9yKGZsb2F0IHIsIGZsb2F0IGcsIGZsb2F0IGIsIGZsb2F0IGEpCit7CisgICAgR0VUX1RMUygpOworICAgIFByb2dyYW1GcmFnbWVudCAqcGYgPSAoUHJvZ3JhbUZyYWdtZW50ICopcnNjLT5nZXRGcmFnbWVudCgpOworICAgIHBmLT5zZXRDb25zdGFudENvbG9yKHIsIGcsIGIsIGEpOworfQorCitzdGF0aWMgdm9pZCBTQ191cGxvYWRUb1RleHR1cmUyKFJzQWxsb2NhdGlvbiB2YSwgdWludDMyX3QgYmFzZU1pcExldmVsKQoreworICAgIEdFVF9UTFMoKTsKKyAgICByc2lfQWxsb2NhdGlvblVwbG9hZFRvVGV4dHVyZShyc2MsIHZhLCBmYWxzZSwgYmFzZU1pcExldmVsKTsKK30KK3N0YXRpYyB2b2lkIFNDX3VwbG9hZFRvVGV4dHVyZShSc0FsbG9jYXRpb24gdmEpCit7CisgICAgR0VUX1RMUygpOworICAgIHJzaV9BbGxvY2F0aW9uVXBsb2FkVG9UZXh0dXJlKHJzYywgdmEsIGZhbHNlLCAwKTsKK30KKworc3RhdGljIHZvaWQgU0NfdXBsb2FkVG9CdWZmZXJPYmplY3QoUnNBbGxvY2F0aW9uIHZhKQoreworICAgIEdFVF9UTFMoKTsKKyAgICByc2lfQWxsb2NhdGlvblVwbG9hZFRvQnVmZmVyT2JqZWN0KHJzYywgdmEpOworfQorCitzdGF0aWMgdm9pZCBTQ19DbGVhckNvbG9yKGZsb2F0IHIsIGZsb2F0IGcsIGZsb2F0IGIsIGZsb2F0IGEpCit7CisgICAgR0VUX1RMUygpOworICAgIGlmICghcnNjLT5zZXR1cENoZWNrKCkpIHsKKyAgICAgICAgcmV0dXJuOworICAgIH0KKworICAgIGdsQ2xlYXJDb2xvcihyLCBnLCBiLCBhKTsKKyAgICBnbENsZWFyKEdMX0NPTE9SX0JVRkZFUl9CSVQpOworfQorCitzdGF0aWMgdm9pZCBTQ19DbGVhckRlcHRoKGZsb2F0IHYpCit7CisgICAgR0VUX1RMUygpOworICAgIGlmICghcnNjLT5zZXR1cENoZWNrKCkpIHsKKyAgICAgICAgcmV0dXJuOworICAgIH0KKworICAgIGdsQ2xlYXJEZXB0aGYodik7CisgICAgZ2xDbGVhcihHTF9ERVBUSF9CVUZGRVJfQklUKTsKK30KKworc3RhdGljIHVpbnQzMl90IFNDX2dldFdpZHRoKCkKK3sKKyAgICBHRVRfVExTKCk7CisgICAgcmV0dXJuIHJzYy0+Z2V0V2lkdGgoKTsKK30KKworc3RhdGljIHVpbnQzMl90IFNDX2dldEhlaWdodCgpCit7CisgICAgR0VUX1RMUygpOworICAgIHJldHVybiByc2MtPmdldEhlaWdodCgpOworfQorCitzdGF0aWMgdm9pZCBTQ19EcmF3VGV4dEFsbG9jKFJzQWxsb2NhdGlvbiB2YSwgaW50IHgsIGludCB5KQoreworICAgIEdFVF9UTFMoKTsKKyAgICBBbGxvY2F0aW9uICphbGxvYyA9IHN0YXRpY19jYXN0PEFsbG9j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Ojppbml0KCkKK3sKKyAgICBpbnQgc3RhdHVzID0gcHRocmVhZF9tdXRleF9pbml0KCZtTXV0ZXgsIE5VTEwpOworICAgIGlmIChzdGF0dXMpIHsKKyAgICAgICAgTE9HRSgiTG9ja2xlc3NGaWZvIG11dGV4IGluaXQgZmFpbHVyZSIpOworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgc3RhdHVzID0gcHRocmVhZF9jb25kX2luaXQoJm1Db25kaXRpb24sIE5VTEwpOworICAgIGlmIChzdGF0dXMpIHsKKyAgICAgICAgTE9HRSgiTG9ja2xlc3NGaWZvIGNvbmRpdGlvbiBpbml0IGZhaWx1cmUiKTsKKyAgICAgICAgcHRocmVhZF9tdXRleF9kZXN0cm95KCZtTXV0ZXgpOworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgcmV0dXJuIHRydWU7Cit9CisKK3ZvaWQgU2lnbmFsOjpzZXQoKQoreworICAgIGludCBzdGF0dXM7CisKKyAgICBzdGF0dXMgPSBwdGhyZWFkX211dGV4X2xvY2soJm1NdXRleCk7CisgICAgaWYgKHN0YXR1cykgeworICAgICAgICBMT0dFKCJMb2NrbGVzc0NvbW1hbmRGaWZvOiBlcnJvciAlaSBsb2NraW5nIGZvciBzZXQgY29uZGl0aW9uLiIsIHN0YXR1cyk7CisgICAgICAgIHJldHVybjsKKyAgICB9CisKKyAgICBtU2V0ID0gdHJ1ZTsKKworICAgIHN0YXR1cyA9IHB0aHJlYWRfY29uZF9zaWduYWwoJm1Db25kaXRpb24pOworICAgIGlmIChzdGF0dXMpIHsKKyAgICAgICAgTE9HRSgiTG9ja2xlc3NDb21tYW5kRmlmbzogZXJyb3IgJWkgb24gc2V0IGNvbmRpdGlvbi4iLCBzdGF0dXMpOworICAgIH0KKworICAgIHN0YXR1cyA9IHB0aHJlYWRfbXV0ZXhfdW5sb2NrKCZtTXV0ZXgpOworICAgIGlmIChzdGF0dXMpIHsKKyAgICAgICAgTE9HRSgiTG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5kZXIgdGhlIExpY2Vuc2UuCisgKi8KKworI2lmbmRlZiBBTkRST0lEX1JTX1NUUkVBTV9ICisjZGVmaW5lIEFORFJPSURfUlNfU1RSRUFNX0gKKworI2luY2x1ZGUgPHV0aWxzL1N0cmluZzguaD4KKyNpbmNsdWRlIDxzdGRpby5oPgorCisvLyAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KK25hbWVzcGFjZSBhbmRyb2lkIHsKK25hbWVzcGFjZSByZW5kZXJzY3JpcHQgeworCitjbGFzcyBJU3RyZWFtCit7CitwdWJsaWM6CisgICAgSVN0cmVhbShjb25zdCB1aW50OF90ICosIGJvb2wgdXNlNjQpOworCisgICAgZmxvYXQgbG9hZEYoKSB7CisgICAgICAgIG1Qb3MgPSAobVBvcyArIDMpICYgKH4zKTsKKyAgICAgICAgZmxvYXQgdG1wID0gcmVpbnRlcnByZXRfY2FzdDxjb25zdCBmbG9hdCAqPigmbURhdGFbbVBvc10pWzBdOworICAgICAgICBtUG9zICs9IHNpemVvZihmbG9hdCk7CisgICAgICAgIHJldHVybiB0bXA7CisgICAgfQorICAgIGludDMyX3QgbG9hZEkzMigpIHsKKyAgICAgICAgbVBvcyA9IChtUG9zICsgMykgJiAofjMpOworICAgICAgICBpbnQzMl90IHRtcCA9IHJlaW50ZXJwcmV0X2Nhc3Q8Y29uc3QgaW50MzJfdCAqPigmbURhdGFbbVBvc10pWzBdOworICAgICAgICBtUG9zICs9IHNpemVvZihpbnQzMl90KTsKKyAgICAgICAgcmV0dXJuIHRtcDsKKyAgICB9CisgICAgdWludDMyX3QgbG9hZFUzMigpIHsKKyAgICAgICAgbVBvcyA9IChtUG9zICsgMykgJiAofjMpOworICAgICAgICB1aW50MzJfdCB0bXAgPSByZWludGVycHJldF9jYXN0PGNvbnN0IHVpbnQzMl90ICo+KCZtRGF0YVttUG9zXSlbMF07CisgICAgICAgIG1Qb3MgKz0gc2l6ZW9mKHVpbnQzMl90KTsKKyAgICAgICAgcmV0dXJuIHRtcDsKKyAgICB9CisgICAgdWludDE2X3QgbG9hZFUxNigpIHsKKyAgICAgICAgbVBvcyA9IChtUG9zICsgMSkgJiAofjEpOworICAgICAgICB1aW50MTZfdCB0bXAgPSByZWludGVycHJldF9jYXN0PGNvbnN0IHVpbnQxNl90ICo+KCZtRGF0YVttUG9zXSlbMF07CisgICAgICAgIG1Qb3MgKz0gc2l6ZW9mKHVpbnQxNl90KTsKKyAgICAgICAgcmV0dXJuIHRtcDsKKyAgICB9CisgICAgaW5saW5lIHVpbnQ4X3QgbG9hZFU4KCkgeworICAgICAgICB1aW50OF90IHRtcCA9IHJlaW50ZXJwcmV0X2Nhc3Q8Y29uc3QgdWludDhfdCAqPigmbURhdGFbbVBvc10pWzBdOworICAgICAgICBtUG9zICs9IHNpemVvZih1aW50OF90KTsKKyAgICAgICAgcmV0dXJuIHRtcDsKKyAgICB9CisgICAgdm9pZCBsb2FkQnl0ZUFycmF5KHZvaWQgKmRlc3QsIHNpemVfdCBudW1CeXRlcyk7CisgICAgdWludDY0X3QgbG9hZE9mZnNldCgpOworICAgIHZvaWQgbG9hZFN0cmluZyhTdHJpbmc4ICpzKTsKKyAgICB1aW50NjRfdCBnZXRQb3MoKSBjb25zdCB7CisgICAgICAgIHJldHVybiBtUG9zOworICAgIH0KKyAgICB2b2lkIHJlc2V0KHVpbnQ2NF90IHBvcykgeworICAgICAgICBtUG9zID0gcG9zOworICAgIH0KKyAgICB2b2lkIHJlc2V0KCkgeworICAgICAgICBtUG9zID0gMDsKKyAgICB9CisgICAgCisgICAgY29uc3QgdWludDhfdCAqIGdldFB0cigpIGNvbnN0IHsKKyAgICAgICAgcmV0dXJuIG1EYXRhOworICAgIH0KK3Byb3RlY3RlZDoKKyAgICBjb25zdCB1aW50OF90ICogbURhdGE7CisgICAgdWludDY0X3QgbVBvczsKKyAgICBib29sIG1Vc2U2NDsKK307CisKK2NsYXNzIE9TdHJlYW0KK3sKK3B1YmxpYzoKKyAgICBPU3RyZWFtKHVpbnQ2NF90IGxlbmd0aCwgYm9vbCB1c2U2NCk7CisgICAgfk9TdHJlYW0oKTsKKyAgICAKKyAgICB2b2lkIGFsaWduKHVpbnQzMl90IGJ5dGVzKSB7CisgICAgICAgIG1Qb3MgPSAobVBvcyArIChieXRlcyAtIDEpKSAmICh+KGJ5dGVzIC0gMSkpOworICAgICAgICBpZihtUG9zID49IG1MZW5ndGgpIHsKKyAgICAgICAgICAgIGdyb3dTaXplKCk7CisgICAgICAgIH0KKyAgICB9CisgICAgCisgICAgdm9pZCBhZGRGKGZsb2F0IHYpIHsKKyAgICAgICAgdWludDMyX3QgdWludFYgPSAqcmVpbnRlcnByZXRfY2FzdDx1aW50MzJfdCo+ICgmdik7CisgICAgICAgIGFkZFUzMih1aW50Vik7CisgICAgfQorICAgIHZvaWQgYWRkSTMyKGludDMyX3QgdikgeworICAgICAgICBtUG9zID0gKG1Qb3MgKyAzKSAmICh+Myk7CisgICAgICAgIGlmKG1Qb3MgKyBzaXplb2YodikgPj0gbUxlbmd0aCkgeworICAgICAgICAgICAgZ3Jvd1NpemUoKTsKKyAgICAgICAgfQorICAgICAgICBtRGF0YVttUG9zKytdID0gKHVpbnQ4X3QpKHYgJiAweGZmKTsKKyAgICAgICAgbURhdGFbbVBvcysrXSA9ICh1aW50OF90KSgodiA+PiA4KSAmIDB4ZmYpOworICAgICAgICBtRGF0YVttUG9zKytdID0gKHVpbnQ4X3QpKCh2ID4+IDE2KSAmIDB4ZmYpOworICAgICAgICBtRGF0YVttUG9zKytdID0gKHVpbnQ4X3QpKCh2ID4+IDI0KSAmIDB4ZmYpOworICAgIH0KKyAgICB2b2lkIGFkZFUzMih1aW50MzJfdCB2KSB7CisgICAgICAgIG1Qb3MgPSAobVBvcyArIDMpICYgKH4zKTsKKyAgICAgICAgaWYobVBvcyArIHNpemVvZih2KSA+PSBtTGVuZ3RoKSB7CisgICAgICAgICAgICBncm93U2l6ZSgpOworICAgICAgICB9CisgICAgICAgIG1EYXRhW21Qb3MrK10gPSAodWludDhfdCkodiAmIDB4ZmYpOworICAgICAgICBtRGF0YVttUG9zKytdID0gKHVpbnQ4X3QpKCh2ID4+IDgpICYgMHhmZik7CisgICAgICAgIG1EYXRhW21Qb3MrK10gPSAodWludDhfdCkoKHYgPj4gMTYpICYgMHhmZik7CisgICAgICAgIG1EYXRhW21Qb3MrK10gPSAodWludDhfdCkoKHYgPj4gMjQpICYgMHhmZik7CisgICAgfQorICAgIHZvaWQgYWRkVTE2KHVpbnQxNl90IHYpIHsKKyAgICAgICAgbVBvcyA9IChtUG9zICsgMSkgJiAofjEpOworICAgICAgICBpZihtUG9zICsgc2l6ZW9mKHYpID49IG1MZW5ndGgpIHsKKyAgICAgICAgICAgIGdyb3dTaXplKCk7CisgICAgICAgIH0KKyAgICAgICAgbURhdGFbbVBvcysrXSA9ICh1aW50OF90KSh2ICYgMHhmZik7CisgICAgICAgIG1EYXRhW21Qb3MrK10gPSAodWludDhfdCkodiA+PiA4KTsKKyAgICB9CisgICAgaW5saW5lIHZvaWQgYWRkVTgodWludDhfdCB2KSB7CisgICAgICAgIGlmKG1Qb3MgKyAxID49IG1MZW5ndGgpIHsKKyAgICAgICAgICAgIGdyb3dTaXplKCk7CisgICAgICAgIH0KKyAgICAgICAgcmVpbnRlcnByZXRfY2FzdDx1aW50OF90ICo+KCZtRGF0YVttUG9zXSlbMF0gPSB2OworICAgICAgICBtUG9zICsrOworICAgIH0KKyAgICB2b2lkIGFkZEJ5dGVBcnJheShjb25zdCB2b2lkICpzcmMsIHNpemVfdCBudW1CeXRlcyk7CisgICAgdm9pZCBhZGRPZmZzZXQodWludDY0X3Qgdik7CisgICAgdm9pZCBhZGRTdHJpbmcoU3RyaW5nOCAqcyk7CisgICAgdWludDY0X3QgZ2V0UG9zKCkgY29uc3QgeworICAgICAgICByZXR1cm4gbVBvczsKKyAgICB9CisgICAgdm9p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FsbG9jYXRpb24gbWF5IGJlIHVzZWQgYXMgYSB2ZXJ0ZXgKLSAgICAvLyBzb3VyY2UuICBTbyB3ZSBjYW5ub3QgZGlzYWJsZSBhcnJheXMgdGhhdCBtYXkgaGF2ZSBiZWVuIGluIHVzZSBieQotICAgIC8vIGFub3RoZXIgYWxsb2NhdGlvbi4KLQotICAgIHVpbnQzMl90IHN0cmlkZSA9IG1FbGVtZW50LT5nZXRTaXplQnl0ZXMoKTsKLSAgICBpZiAobUdMLm1WdHguc2l6ZSkgewotICAgICAgICB2YS0+YWRkTGVnYWN5KG1HTC5tVnR4LnR5cGUsCi0gICAgICAgICAgICAgICAgICAgICAgbUdMLm1WdHguc2l6ZSwKLSAgICAgICAgICAgICAgICAgICAgICBzdHJpZGUsCi0gICAgICAgICAgICAgICAgICAgICAgUlNfS0lORF9QT1NJVElPTiwKLSAgICAgICAgICAgICAgICAgICAgICBmYWxzZSwKLSAgICAgICAgICAgICAgICAgICAgICBtR0wubVZ0eC5vZmZzZXQpOwotICAgIH0KLQotICAgIGlmIChtR0wubU5vcm0uc2l6ZSkgewotICAgICAgICB2YS0+YWRkTGVnYWN5KG1HTC5tTm9ybS50eXBlLAotICAgICAgICAgICAgICAgICAgICAgMywKLSAgICAgICAgICAgICAgICAgICAgIHN0cmlkZSwKLSAgICAgICAgICAgICAgICAgICAgIFJTX0tJTkRfTk9STUFMLAotICAgICAgICAgICAgICAgICAgICAgZmFsc2UsCi0gICAgICAgICAgICAgICAgICAgICBtR0wubU5vcm0ub2Zmc2V0KTsKLSAgICB9Ci0KLSAgICBpZiAobUdMLm1Db2xvci5zaXplKSB7Ci0gICAgICAgIHZhLT5hZGRMZWdhY3kobUdMLm1Db2xvci50eXBlLAotICAgICAgICAgICAgICAgICAgICAgbUdMLm1Db2xvci5zaXplLAotICAgICAgICAgICAgICAgICAgICAgc3RyaWRlLAotICAgICAgICAgICAgICAgICAgICAgUlNfS0lORF9DT0xPUiwKLSAgICAgICAgICAgICAgICAgICAgIHRydWUsCi0gICAgICAgICAgICAgICAgICAgICBtR0wubUNvbG9yLm9mZnNldCk7Ci0gICAgfQotCi0gICAgaWYgKG1HTC5tVGV4LnNpemUpIHsKLSAgICAgICAgdmEtPmFkZExlZ2FjeShtR0wubVRleC50eXBlLAotICAgICAgICAgICAgICAgICAgICAgbUdMLm1UZXguc2l6ZSwKLSAgICAgICAgICAgICAgICAgICAgIHN0cmlkZSwKLSAgICAgICAgICAgICAgICAgICAgIFJTX0tJTkRfVEVYVFVSRSwKLSAgICAgICAgICAgICAgICAgICAgIGZhbHNlLAotICAgICAgICAgICAgICAgICAgICAgbUdMLm1UZXgub2Zmc2V0KTsKLSAgICB9Ci0KLSAgICBpZiAobUdMLm1Qb2ludFNpemUuc2l6ZSkgewotICAgICAgICB2YS0+YWRkTGVnYWN5KG1HTC5tUG9pbnRTaXplLnR5cGUsCi0gICAgICAgICAgICAgICAgICAgICAxLAotICAgICAgICAgICAgICAgICAgICAgc3RyaWRlLAotICAgICAgICAgICAgICAgICAgICAgUlNfS0lORF9QT0lOVF9TSVpFLAotICAgICAgICAgICAgICAgICAgICAgZmFsc2UsCi0gICAgICAgICAgICAgICAgICAgICBtR0wubVBvaW50U2l6ZS5vZmZzZXQpOwotICAgIH0KLQotfQotCi12b2lkIFR5cGU6OmVuYWJsZUdMVmVydGV4QnVmZmVyMihWZXJ0ZXhBcnJheSAqdmEpIGNvbnN0Ci17Ci0gICAgLy8gRG8gbGVnYWN5IGJ1ZmZlcnMKLSAgICBlbmFibGVHTFZlcnRleEJ1ZmZlcih2YSk7Ci0KICAgICB1aW50MzJfdCBzdHJpZGUgPSBtRWxlbWVudC0+Z2V0U2l6ZUJ5dGVzKCk7CiAgICAgZm9yICh1aW50MzJfdCBjdD0wOyBjdCA8IFJTX01BWF9BVFRSSUJTOyBjdCsrKSB7Ci0gICAgICAgIGlmIChtR0wubVVzZXJbY3RdLnNpemUpIHsKLSAgICAgICAgICAgIHZhLT5hZGRVc2VyKG1HTC5tV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GxvYWRpbmcgc2tpcHBlZCBkdWUgdG8gaW52YWxpZCBjbGFzcyBpZFxuIik7CisgICAgICAgIHJldHVybiBOVUxMOworICAgIH0KKworICAgIFN0cmluZzggbmFtZTsKKyAgICBzdHJlYW0tPmxvYWRTdHJpbmcoJm5hbWUpOworCisgICAgRWxlbWVudCAqZWxlbSA9IEVsZW1lbnQ6OmNyZWF0ZUZyb21TdHJlYW0ocnNjLCBzdHJlYW0pOworICAgIGlmKCFlbGVtKSB7CisgICAgICAgIHJldHVybiBOVUxMOworICAgIH0KKworICAgIFR5cGUgKnR5cGUgPSBuZXcgVHlwZShyc2MpOworICAgIHR5cGUtPm1EaW1YID0gc3RyZWFtLT5sb2FkVTMyKCk7CisgICAgdHlwZS0+bURpbVkgPSBzdHJlYW0tPmxvYWRVMzIoKTsKKyAgICB0eXBlLT5tRGltWiA9IHN0cmVhbS0+bG9hZFUzMigpOworCisgICAgdWludDhfdCB0ZW1wID0gc3RyZWFtLT5sb2FkVTgoKTsKKyAgICB0eXBlLT5tRGltTE9EID0gdGVtcCAhPSAwOworCisgICAgdGVtcCA9IHN0cmVhbS0+bG9hZFU4KCk7CisgICAgdHlwZS0+bUZhY2VzID0gdGVtcCAhPSAwOworCisgICAgdHlwZS0+c2V0RWxlbWVudChlbGVtKTsKKworICAgIHJldHVybiB0eXBlOworfQorCiBib29sIFR5cGU6OmdldElzTnAyKCkgY29uc3QKIHsKICAgICB1aW50MzJfdCB4ID0gZ2V0RGltWCgpOwpAQCAtMzkxLDYgKzM0NCwyMiBAQAogICAgIHJldHVybiBzdDsKIH0KIAordm9pZCByc2lfVHlwZUdldE5hdGl2ZURhdGEoQ29udGV4dCAqcnNjLCBSc1R5cGUgdHlwZSwgdWludDMyX3QgKnR5cGVEYXRhLCB1aW50MzJfdCB0eXBlRGF0YVNpemUpCit7CisgICAgcnNBc3NlcnQodHlwZURhdGFTaXplID09IDYpOworICAgIC8vIFBhY2sgdGhlIGRhdGEgaW4gdGhlIGZvbGxv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Nhc2UgUlNfS0lORF9QT1NJVElPTjoKLSAgICAgICAgICAgIC8vbG9nQXR0cmliKFBPU0lUSU9OKTsKLSAgICAgICAgICAgIGdsRW5hYmxlQ2xpZW50U3RhdGUoR0xfVkVSVEVYX0FSUkFZKTsKLSAgICAgICAgICAgIGdsQmluZEJ1ZmZlcihHTF9BUlJBWV9CVUZGRVIsIG1BdHRyaWJzW2N0XS5idWZmZXIpOwotICAgICAgICAgICAgZ2xWZXJ0ZXhQb2ludGVyKG1BdHRyaWJzW2N0XS5zaXplLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1BdHRyaWJzW2N0XS50eXBlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1BdHRyaWJzW2N0XS5zdHJpZGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQgKiltQXR0cmlic1tjdF0ub2Zmc2V0KTsKLSAgICAgICAgICAgIGJyZWFrOwotCi0gICAgICAgIGNhc2UgUlNfS0lORF9OT1JNQUw6Ci0gICAgICAgICAgICAvL2xvZ0F0dHJpYihOT1JNQUwpOwotICAgICAgICAgICAgZ2xFbmFibGVDbGllbnRTdGF0ZShHTF9OT1JNQUxfQVJSQVkpOwotICAgICAgICAgICAgcnNBc3NlcnQobUF0dHJpYnNbY3RdLnNpemUgPT0gMyk7Ci0gICAgICAgICAgICBnbEJpbmRCdWZmZXIoR0xfQVJSQVlfQlVGRkVSLCBtQXR0cmlic1tjdF0uYnVmZmVyKTsKLSAgICAgICAgICAgIGdsTm9ybWFsUG9pbnRlcihtQXR0cmlic1tjdF0udHlwZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBtQXR0cmlic1tjdF0uc3RyaWRlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkICopbUF0dHJpYnNbY3RdLm9mZnNldCk7Ci0gICAgICAgICAgICBicmVhazsKLQotICAgICAgICBjYXNlIFJTX0tJTkRfQ09MT1I6Ci0gICAgICAgICAgICAvL2xvZ0F0dHJpYihDT0xPUik7Ci0gICAgICAgICAgICBnbEVuYWJsZUNsaWVudFN0YXRlKEdMX0NPTE9SX0FSUkFZKTsKLSAgICAgICAgICAgIGdsQmluZEJ1ZmZlcihHTF9BUlJBWV9CVUZGRVIsIG1BdHRyaWJzW2N0XS5idWZmZXIpOwotICAgICAgICAgICAgZ2xDb2xvclBvaW50ZXIobUF0dHJpYnNbY3RdLnNpemUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICBtQXR0cmlic1tjdF0udHlwZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgIG1BdHRyaWJzW2N0XS5zdHJpZGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCAqKW1BdHRyaWJzW2N0XS5vZmZzZXQpOwotICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgY2FzZSBSU19LSU5EX1RFWFRVUkU6Ci0gICAgICAgICAgICAvL2xvZ0F0dHJpYihURVhUVVJFKTsKLSAgICAgICAgICAgIGdsRW5hYmxlQ2xpZW50U3RhdGUoR0xfVEVYVFVSRV9DT09SRF9BUlJBWSk7Ci0gICAgICAgICAgICBnbEJpbmRCdWZmZXIoR0xfQVJSQVlfQlVGRkVSLCBtQXR0cmlic1tjdF0uYnVmZmVyKTsKLSAgICAgICAgICAgIGdsVGV4Q29vcmRQb2ludGVyKG1BdHRyaWJzW2N0XS5zaXplLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUF0dHJpYnNbY3RdLnR5cGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtQXR0cmlic1tjdF0uc3RyaWRlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHZvaWQgKiltQXR0cmlic1tjdF0ub2Zmc2V0KTsKLSAgICAgICAgICAgIGJyZWFrOwotCi0gICAgICAgIGNhc2UgUlNfS0lORF9QT0lOVF9TSVpFOgotICAgICAgICAgICAgLy9sb2dBdHRyaWIoUE9JTlRfU0laRSk7Ci0gICAgICAg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ciAodWludDMyX3QgY3Q9MDsgY3QgPCBtQ291bnQ7IGN0KyspIHsKLSAgICAgICAgdWludDMyX3Qgc2xvdCA9IDA7CisgICAgICAgIGludDMyX3Qgc2xvdCA9IDA7CisKKyAgICAgICAgaWYgKG1BdHRyaWJzW2N0XS5uYW1lWzBdID09ICcjJykgeworICAgICAgICAgICAgY29udGludWU7CisgICAgICAgIH0KKwogICAgICAgICBpZiAoc2MtPmlzVXNlclZlcnRleFByb2dyYW0oKSkgewogICAgICAgICAgICAgc2xvdCA9IHNjLT52dHhBdHRyaWJTbG90KGN0KTsKICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgIGlmIChtQXR0cmlic1tjdF0ua2luZCA9PSBSU19LSU5EX1VTRVIpIHsKKyAgICAgICAgICAgIGlmIChtQXR0cmlic1tjdF0ubmFtZSA9PSAicG9zaXRpb24iKSB7CisgICAgICAgICAgICAgICAgc2xvdCA9IDA7CisgICAgICAgICAgICB9IGVsc2UgaWYgKG1BdHRyaWJzW2N0XS5uYW1lID09ICJjb2xvciIpIHsKKyAgICAgICAgICAgICAgICBzbG90ID0gMTsKKyAgICAgICAgICAgIH0gZWxzZSBpZiAobUF0dHJpYnNbY3RdLm5hbWUgPT0gIm5vcm1hbCIpIHsKKyAgICAgICAgICAgICAgICBzbG90ID0gMjsKKyAgICAgICAgICAgIH0gZWxzZSBpZiAobUF0dHJpYnNbY3RdLm5hbWUgPT0gInRleHR1cmUwIikgeworICAgICAgICAgICAgICAgIHNsb3QgPSAzOworICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHNsb3QgPSBzYy0+dnR4QXR0cmliU2xvdChtQXR0cmlic1tjdF0ua2luZCk7CisgICAgICAgIH0KKyAgICAgICAgaWYoc2xvdCA8IDApIHsKKyAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICB9CiAKICAgICAgICAgLy9sb2dBdHRyaWIoY3QsIHNsb3QpOwogICAgICAgICBnbEVuYWJsZVZlcnRleEF0dHJpYkFycmF5KHNsb3QpOwogICAgICAgICBnbEJpbmRCdWZmZXIoR0xfQVJSQVlfQlVGRkVSLCBtQXR0cmlic1tjdF0uYnVmZmVyKTsKLQogICAgICAgICBnbFZlcnRleEF0dHJpYlBvaW50ZXIoc2xvdCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1BdHRyaWJzW2N0XS5zaXplLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUF0dHJpYnNbY3RdLnR5cGUsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtQXR0cmlic1tjdF0ubm9ybWFsaXplZCwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1BdHRyaWJzW2N0XS5zdHJpZGUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAodm9pZCAqKW1BdHRyaWJzW2N0XS5vZmZzZXQpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUF0dHJpYnNbY3RdLnB0ciArIG1BdHRyaWJzW2N0XS5vZmZzZXQpOwogICAgIH0KICAgICBzdGF0ZS0+bUxhc3RFbmFibGVDb3VudCA9IG1Db3VudDsKICAgICByc2MtPmNoZWNrRXJyb3IoIlZlcnRleEFycmF5OjpzZXR1cEdMMiBkb25lIik7CmRpZmYgLS1naXQgYS9saWJzL3JzL3JzVmVydGV4QXJyYXkuaCBiL2xpYnMvcnMvcnNWZXJ0ZXhBcnJheS5oCmluZGV4IDM5MDRjYjYuLjdjNjA5YjIgMTAwNjQ0Ci0tLSBhL2xpYnMvcnMvcnNWZXJ0ZXhBcnJheS5oCisrKyBiL2xpYnMvcnMvcnNWZXJ0ZXhBcnJheS5oCkBAIC0zNywxMyArMzcsMTMgQEAKICAgICBjbGFzcyBBdHRyaWIgewogICAgIHB1YmxpYzoKICAgICAgICAgdWludDMyX3QgYnVmZmVyOworICAgICAgICBjb25zdCB1aW50OF90ICogcHRyOwogICA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vdXQpdi56LCAodHlwZW91dCl2Lnd9OyBcCisgICAgcmV0dXJuIHI7IFwKK30KKworI2RlZmluZSBDVlRfRlVOQyh0eXBlKSAgICAgIENWVF9GVU5DXzIodHlwZSwgdWNoYXIpIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBDVlRfRlVOQ18yKHR5cGUsIGNoYXIpIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBDVlRfRlVOQ18yKHR5cGUsIHVzaG9ydCkgXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIENWVF9GVU5DXzIodHlwZSwgc2hvcnQpIFwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBDVlRfRlVOQ18yKHR5cGUsIGludCkgXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIENWVF9GVU5DXzIodHlwZSwgdWludCkgXAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIENWVF9GVU5DXzIodHlwZSwgZmxvYXQpCisKK0NWVF9GVU5DKGNoYXIpCitDVlRfRlVOQyh1Y2hhcikKK0NWVF9GVU5DKHNob3J0KQorQ1ZUX0ZVTkModXNob3J0KQorQ1ZUX0ZVTkMoaW50KQorQ1ZUX0ZVTkModWludCkKK0NWVF9GVU5DKGZsb2F0KQorCisKKworLy8gRmxvYXQgb3BzLCA2LjExLjIKKworI2RlZmluZSBERUZfRlVOQ18xKGZuYykgXAorc3RhdGljIGZsb2F0MiBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKSBmbmMoZmxvYXQyIHYpIHsgXAorICAgIGZsb2F0MiByOyBcCisgICAgci54ID0gZm5jKHYueCk7IFwKKyAgICByLnkgPSBmbmModi55KTsgXAorICAgIHJldHVybiByOyBcCit9IFwKK3N0YXRpYyBmbG9hdDMgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkgZm5jKGZsb2F0MyB2KSB7IFwKKyAgICBmbG9hdDMgcjsgXAorICAgIHIueCA9IGZuYyh2LngpOyBcCisgICAgci55ID0gZm5jKHYueSk7IFwKKyAgICByLnogPSBmbmModi56KTsgXAorICAgIHJldHVybiByOyBcCit9IFwKK3N0YXRpYyBmbG9hdDQgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkgZm5jKGZsb2F0NCB2KSB7IFwKKyAgICBmbG9hdDQgcjsgXAorICAgIHIueCA9IGZuYyh2LngpOyBcCisgICAgci55ID0gZm5jKHYueSk7IFwKKyAgICByLnogPSBmbmModi56KTsgXAorICAgIHIudyA9IGZuYyh2LncpOyBcCisgICAgcmV0dXJuIHI7IFwKK30KKworI2RlZmluZSBERUZfRlVOQ18yKGZuYykgXAorc3RhdGljIGZsb2F0MiBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKSBmbmMoZmxvYXQyIHYxLCBmbG9hdDIgdjIpIHsgXAorICAgIGZsb2F0MiByOyBcCisgICAgci54ID0gZm5jKHYxLngsIHYyLngpOyBcCisgICAgci55ID0gZm5jKHYxLnksIHYyLnkpOyBcCisgICAgcmV0dXJuIHI7IFwKK30gXAorc3RhdGljIGZsb2F0MyBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKSBmbmMoZmxvYXQzIHYxLCBmbG9hdDMgdjIpIHsgXAorICAgIGZsb2F0MyByOyBcCisgICAgci54ID0gZm5jKHYxLngsIHYyLngpOyBcCisgICAgci55ID0gZm5jKHYxLnksIHYyLnkpOyBcCisgICAgci56ID0gZm5jKHYxLnosIHYyLnopOyBcCisgICAgcmV0dXJuIHI7IFwKK30gXAorc3RhdGljIGZsb2F0NCBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKSBmbmMoZmxvYXQ0IHYxLCBmbG9hdDQgdjIpIHsgXAorICAgIGZsb2F0NCByOyBcCisgICAgci54ID0gZm5jKHYxLngsIHYyLngpOyBcCisgICAgci55ID0gZm5jKHYxLnksIHYyLnkpOyBcCisgICAgci56ID0gZm5jKHYxLnosIHYyLnopOyBcCisgICAgci53ID0gZm5jKH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pIHsKKyAgICBmbG9hdDIgcjsKKyAgICByLnggPSBhbW91bnQueCA8IGxvdy54ID8gbG93LnggOiAoYW1vdW50LnggPiBoaWdoLnggPyBoaWdoLnggOiBhbW91bnQueCk7CisgICAgci55ID0gYW1vdW50LnkgPCBsb3cueSA/IGxvdy55IDogKGFtb3VudC55ID4gaGlnaC55ID8gaGlnaC55IDogYW1vdW50LnkpOworICAgIHJldHVybiByOworfQorc3RhdGljIGZsb2F0MyBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKSBjbGFtcChmbG9hdDMgYW1vdW50LCBmbG9hdDMgbG93LCBmbG9hdDMgaGlnaCkgeworICAgIGZsb2F0MyByOworICAgIHIueCA9IGFtb3VudC54IDwgbG93LnggPyBsb3cueCA6IChhbW91bnQueCA+IGhpZ2gueCA/IGhpZ2gueCA6IGFtb3VudC54KTsKKyAgICByLnkgPSBhbW91bnQueSA8IGxvdy55ID8gbG93LnkgOiAoYW1vdW50LnkgPiBoaWdoLnkgPyBoaWdoLnkgOiBhbW91bnQueSk7CisgICAgci56ID0gYW1vdW50LnogPCBsb3cueiA/IGxvdy56IDogKGFtb3VudC56ID4gaGlnaC56ID8gaGlnaC56IDogYW1vdW50LnopOworICAgIHJldHVybiByOworfQorc3RhdGljIGZsb2F0NCBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKSBjbGFtcChmbG9hdDQgYW1vdW50LCBmbG9hdDQgbG93LCBmbG9hdDQgaGlnaCkgeworICAgIGZsb2F0NCByOworICAgIHIueCA9IGFtb3VudC54IDwgbG93LnggPyBsb3cueCA6IChhbW91bnQueCA+IGhpZ2gueCA/IGhpZ2gueCA6IGFtb3VudC54KTsKKyAgICByLnkgPSBhbW91bnQueSA8IGxvdy55ID8gbG93LnkgOiAoYW1vdW50LnkgPiBoaWdoLnkgPyBoaWdoLnkgOiBhbW91bnQueSk7CisgICAgci56ID0gYW1vdW50LnogPCBsb3cueiA/IGxvdy56IDogKGFtb3VudC56ID4gaGlnaC56ID8gaGlnaC56IDogYW1vdW50LnopOworICAgIHIudyA9IGFtb3VudC53IDwgbG93LncgPyBsb3cudyA6IChhbW91bnQudyA+IGhpZ2gudyA/IGhpZ2gudyA6IGFtb3VudC53KTsKKyAgICByZXR1cm4gcjsKK30KK3N0YXRpYyBmbG9hdDIgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkgY2xhbXAoZmxvYXQyIGFtb3VudCwgZmxvYXQgbG93LCBmbG9hdCBoaWdoKSB7CisgICAgZmxvYXQyIHI7CisgICAgci54ID0gYW1vdW50LnggPCBsb3cgPyBsb3cgOiAoYW1vdW50LnggPiBoaWdoID8gaGlnaCA6IGFtb3VudC54KTsKKyAgICByLnkgPSBhbW91bnQueSA8IGxvdyA/IGxvdyA6IChhbW91bnQueSA+IGhpZ2ggPyBoaWdoIDogYW1vdW50LnkpOworICAgIHJldHVybiByOworfQorc3RhdGljIGZsb2F0MyBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKSBjbGFtcChmbG9hdDMgYW1vdW50LCBmbG9hdCBsb3csIGZsb2F0IGhpZ2gpIHsKKyAgICBmbG9hdDMgcjsKKyAgICByLnggPSBhbW91bnQueCA8IGxvdyA/IGxvdyA6IChhbW91bnQueCA+IGhpZ2ggPyBoaWdoIDogYW1vdW50LngpOworICAgIHIueSA9IGFtb3VudC55IDwgbG93ID8gbG93IDogKGFtb3VudC55ID4gaGlnaCA/IGhpZ2ggOiBhbW91bnQueSk7CisgICAgci56ID0gYW1vdW50LnogPCBsb3cgPyBsb3cgOiAoYW1vdW50LnogPiBoaWdoID8gaGlnaCA6IGFtb3VudC56KTsKKyAgICByZXR1cm4gcjsKK30KK3N0YXRpYyBmbG9hdDQgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkgY2xhbXAoZmxvYXQ0IGFtb3VudCwgZmxvYXQgbG93LCBmbG9hdCBoaWdoKSB7CisgICAgZmxvYXQ0IHI7CisgICAgci54ID0gYW1vdW50LnggPCBsb3cgPyBsb3cgOiAoYW1vdW50LnggPiBoaWdoID8gaGlnaCA6IGFtb3VudC54KTsKKyAgICByLnkgPSBhbW91bnQueSA8IGxvdyA/IGxvdyA6IChhbW91bnQueSA+IGhpZ2ggPyBoaWdoIDogYW1vdW50LnkpOworICAgIHIueiA9IGFtb3VudC56IDwgbG93ID8gbG93IDogKGFtb3VudC56ID4gaGlnaCA/IGhpZ2ggOiBhbW91bnQueik7CisgICAgci53ID0gYW1vdW50LncgPCBsb3cgPyBsb3cgOiAoYW1vdW50LncgPiBoaWdoID8gaGlnaCA6IGFtb3VudC53KTsKKyAgICByZXR1cm4gcjsKK30KKworc3RhdGljIGZsb2F0IF9fYXR0cmlidXRlX18oKG92ZXJsb2FkYWJsZSkpIGRlZ3JlZXMoZmxvYXQgcmFkaWFucykgeworICAgIHJldHVybiByYWRpYW5zICogKDE4MC5mIC8gTV9QSSk7Cit9CitERUZfRlVOQ18xKGRlZ3JlZXMpCisKK3N0YXRpYyBmbG9hdCBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKSBtYXgoZmxvYXQgdjEsIGZsb2F0IHYyKSB7CisgICAgcmV0dXJuIHYxID4gdjIgPyB2MSA6IHYyOworfQorc3RhdGljIGZsb2F0MiBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKSBtYXgoZmxvYXQyIHYxLCBmbG9hdDIgdjIpIHsKKyAgICBmbG9hdDIgcjsKKyAgICByLnggPSB2MS54ID4gdjIueCA/IHYxLnggOiB2Mi54OworICAgIHIueSA9IHYxLnkgPiB2Mi55ID8gdjEueSA6IHYyLnk7CisgICAgcmV0dXJuIHI7Cit9CitzdGF0aWMgZmxvYXQzIF9fYXR0cmlidXRlX18oKG92ZXJsb2FkYWJsZSkpIG1heChmbG9hdDMgdjEsIGZsb2F0MyB2MikgeworICAgIGZsb2F0MyByOworICAgIHIueCA9IHYxLnggPiB2Mi54ID8gdjEueCA6IHYyLng7CisgICAgci55ID0gdjEueSA+IHYyLnkgPyB2MS55IDogdjIueTsKKyAgICByLnogPSB2MS56ID4gdjIueiA/IHYxLnogOiB2Mi56OworICAgIHJldHVybiByOworfQorc3RhdGljIGZsb2F0NCBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKSBtYXgoZmxvYXQ0IHYxLCBmbG9hdDQgdjIpIHsKKyAgICBmbG9hdDQgcjsKKyAgICByLnggPSB2MS54ID4gdjIueCA/IHYxLnggOiB2Mi54OworICAgIHIueSA9IHYxLnkgPiB2Mi55ID8gdjEueSA6IHYyLnk7CisgICAgci56ID0gdjEueiA+IHYyLnogPyB2MS56IDogdjIuejsKKyAgICByLncgPSB2MS53ID4gdjIudyA/IHYxLncgOiB2Mi53OworICAgIHJldHVybiByOworfQorc3RhdGljIGZsb2F0MiBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKSBtYXgoZmxvYXQyIHYxLCBmbG9hdCB2MikgeworICAgIGZsb2F0MiByOworICAgIHIueCA9IHYxLnggPiB2MiA/IHYxLnggOiB2MjsKKyAgICByLnkgPSB2MS55ID4gdjIgPyB2MS55IDogdjI7CisgICAgcmV0dXJuIHI7Cit9CitzdGF0aWMgZmxvYXQzIF9fYXR0cmlidXRlX18oKG92ZXJsb2FkYWJsZSkpIG1heChmbG9hdDMgdjEsIGZsb2F0IHYyKSB7CisgICAgZmxvYXQzIHI7CisgICAgci54ID0gdjEueCA+IHYyID8gdjEueCA6IHYyOworICAgIHIueSA9IHYxLnkgPiB2MiA/IHYxLnkgOiB2MjsKKyAgICByLnogPSB2MS56ID4gdjIgPyB2MS56IDogdjI7CisgICAgcmV0dXJuIHI7Cit9CitzdGF0aWMgZmxvYXQ0IF9fYXR0cmlidXRlX18oKG92ZXJsb2FkYWJsZSkpIG1heChmbG9hdDQgdjEsIGZsb2F0IHYyKSB7CisgICAgZmxvYXQ0IHI7CisgICAgci54ID0gdjEueCA+IHYyID8gdjEueCA6IHYyOworICAgIHIueSA9IHYxLnkgPiB2MiA/IHYxLnkgOiB2MjsKKyAgICByLnogPSB2MS56ID4gdjIgPyB2MS56IDogdjI7CisgICAgci53ID0gdjEudyA+IHYyID8gdjEudyA6IHYyOworICAgIHJldHVybiByOworfQorCitzdGF0aWMgZmxvYXQgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkgbWluKGZsb2F0IHYxLCBmbG9hdCB2MikgeworICAgIHJldHVybiB2MSA8IHYyID8gdjEgOiB2MjsKK30KK3N0YXRpYyBmbG9hdDIgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkgbWluKGZsb2F0MiB2MSwgZmxvYXQyIHYyKSB7CisgICAgZmxvYXQyIHI7CisgICAgci54ID0gdjEueCA8IHYyLnggPyB2MS54IDogdjIueDsKKyAgICByLnkgPSB2MS55IDwgdjIueSA/IHYxLnkgOiB2Mi55OworICAgIHJldHVybiByOworfQorc3RhdGljIGZsb2F0MyBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKSBtaW4oZmxvYXQzIHYxLCBmbG9hdDMgdjIpIHsKKyAgICBmbG9hdDMgcjsKKyAgICByLnggPSB2MS54IDwgdjIueCA/IHYxLnggOiB2Mi54OworICAgIHIueSA9IHYxLnkgPCB2Mi55ID8gdjEueSA6IHYyLnk7CisgICAgci56ID0gdjEueiA8IHYyLnogPyB2MS56IDogdjIuejsKKyAgICByZXR1cm4gcjsKK30KK3N0YXRpYyBmbG9hdDQgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkgbWluKGZsb2F0NCB2MSwgZmxvYXQ0IHYyKSB7CisgICAgZmxvYXQ0IHI7CisgICAgci54ID0gdjEueCA8IHYyLnggPyB2MS54IDogdjIueDsKKyAgICByLnkgPSB2MS55IDwgdjIueSA/IHYxLnkgOiB2Mi55OworICAgIHIueiA9IHYxLnogPCB2Mi56ID8gdjEueiA6IHYyLno7CisgICAgci53ID0gdjEudyA8IHYyLncgPyB2MS53IDogdjIudzsKKyAgICByZXR1cm4gcjsKK30KK3N0YXRpYyBmbG9hdDIgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkgbWluKGZsb2F0MiB2MSwgZmxvYXQgdjIpIHsKKyAgICBmbG9hdDIgcjsKKyAgICByLnggPSB2MS54IDwgdjIgPyB2MS54IDogdjI7CisgICAgci55ID0gdjEueSA8IHYyID8gdjEueSA6IHYyOworICAgIHJldHVybiByOworfQorc3RhdGljIGZsb2F0MyBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKSBtaW4oZmxvYXQzIHYxLCBmbG9hdCB2MikgeworICAgIGZsb2F0MyByOworICAgIHIueCA9IHYxLnggPCB2MiA/IHYxLnggOiB2MjsKKyAgICByLnkgPSB2MS55IDwgdjIgPyB2MS55IDogdjI7CisgICAgci56ID0gdjEueiA8IHYyID8gdjEueiA6IHYyOworICAgIHJldHVybiByOworfQorc3RhdGljIGZsb2F0NCBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKSBtaW4oZmxvYXQ0IHYxLCBmbG9hdCB2MikgeworICAgIGZsb2F0NCByOworICAgIHIueCA9IHYxLnggPCB2MiA/IHYxLnggOiB2MjsKKyAgICByLnkgPSB2MS55IDwgdjIgPyB2MS55IDogdjI7CisgICAgci56ID0gdjEueiA8IHYyID8gdjEueiA6IHYyOworICAgIHIudyA9IHYxLncgPCB2MiA/IHYxLncgOiB2MjsKKyAgICByZXR1cm4gcjsKK30KKworc3RhdGljIGZsb2F0IF9fYXR0cmlidXRlX18oKG92ZXJsb2FkYWJsZSkpIG1peChmbG9hdCBzdGFydCwgZmxvYXQgc3RvcCwgZmxvYXQgYW1vdW50KSB7CisgICAgcmV0dXJuIHN0YXJ0ICsgKHN0b3AgLSBzdGFydCkgKiBhbW91bnQ7Cit9CitzdGF0aWMgZmxvYXQyIF9fYXR0cmlidXRlX18oKG92ZXJsb2FkYWJsZSkpIG1peChmbG9hdDIgc3RhcnQsIGZsb2F0MiBzdG9wL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55ICAtIGxocy55ICogcmhzLng7CisgICAgcmV0dXJuIHI7Cit9CisKK3N0YXRpYyBmbG9hdDQgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkgY3Jvc3MoZmxvYXQ0IGxocywgZmxvYXQ0IHJocykgeworICAgIGZsb2F0NCByOworICAgIHIueCA9IGxocy55ICogcmhzLnogIC0gbGhzLnogKiByaHMueTsKKyAgICByLnkgPSBsaHMueiAqIHJocy54ICAtIGxocy54ICogcmhzLno7CisgICAgci56ID0gbGhzLnggKiByaHMueSAgLSBsaHMueSAqIHJocy54OworICAgIHIudyA9IDAuZjsKKyAgICByZXR1cm4gcjsKK30KKworc3RhdGljIGZsb2F0IF9fYXR0cmlidXRlX18oKG92ZXJsb2FkYWJsZSkpIGRvdChmbG9hdCBsaHMsIGZsb2F0IHJocykgeworICAgIHJldHVybiBsaHMgKiByaHM7Cit9CitzdGF0aWMgZmxvYXQgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkgZG90KGZsb2F0MiBsaHMsIGZsb2F0MiByaHMpIHsKKyAgICByZXR1cm4gbGhzLngqcmhzLnggKyBsaHMueSpyaHMueTsKK30KK3N0YXRpYyBmbG9hdCBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKSBkb3QoZmxvYXQzIGxocywgZmxvYXQzIHJocykgeworICAgIHJldHVybiBsaHMueCpyaHMueCArIGxocy55KnJocy55ICsgbGhzLnoqcmhzLno7Cit9CitzdGF0aWMgZmxvYXQgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkgZG90KGZsb2F0NCBsaHMsIGZsb2F0NCByaHMpIHsKKyAgICByZXR1cm4gbGhzLngqcmhzLnggKyBsaHMueSpyaHMueSArIGxocy56KnJocy56ICsgbGhzLncqcmhzLnc7Cit9CisKK3N0YXRpYyBmbG9hdCBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKSBsZW5ndGgoZmxvYXQgdikgeworICAgIHJld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HRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkgcnNEZWJ1Zyhjb25zdCBjaGFyICpzLCBmbG9hdDQgdikgeworICAgIHJzRGVidWcocywgdi54LCB2LnksIHYueiwgdi53KTsKK30KKworc3RhdGljIHVjaGFyNCBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKSByc1BhY2tDb2xvclRvODg4OChmbG9hdCByLCBmbG9hdCBnLCBmbG9hdCBiKQoreworICAgIHVjaGFyNCBjOworICAgIGMueCA9ICh1Y2hhcikociAqIDI1NS5mKTsKKyAgICBjLnkgPSAodWNoYXIpKGcgKiAyNTUuZik7CisgICAgYy56ID0gKHVjaGFyKShiICogMjU1LmYpOworICAgIGMudyA9IDI1NTsKKyAgICByZXR1cm4gYzsKK30KKworc3RhdGljIHVjaGFyNCBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKSByc1BhY2tDb2xvclRvODg4OChmbG9hdCByLCBmbG9hdCBnLCBmbG9hdCBiLCBmbG9hdCBhKQoreworICAgIHVjaGFyNCBjOworICAgIGMueCA9ICh1Y2hhcikociAqIDI1NS5mKTsKKyAgICBjLnkgPSAodWNoYXIpKGcgKiAyNTUuZik7CisgICAgYy56ID0gKHVjaGFyKShiICogMjU1LmYpOworICAgIGMudyA9ICh1Y2hhcikoYSAqIDI1NS5mKTsKKyAgICByZXR1cm4gYzsKK30KKworc3RhdGljIHVjaGFyNCBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKSByc1BhY2tDb2xvclRvODg4OChmbG9hdDMgY29sb3IpCit7CisgICAgY29sb3IgKj0gMjU1LmY7CisgICAgdWNoYXI0IGMgPSB7Y29sb3IueCwgY29sb3IueSwgY29sb3IueiwgMjU1fTsKKyAgICByZXR1cm4gYzsKK30KKworc3RhdGljIHVjaGFyNCBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKSByc1BhY2tDb2xvclRvODg4OChmbG9hdDQgY29sb3IpCit7CisgICAgY29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gICAgcmV0dXJuIG0tPm1bcm93ICogNCArIGNvbF07Cit9CisKK3N0YXRpYyB2b2lkIF9fYXR0cmlidXRlX18oKG92ZXJsb2FkYWJsZSkpCityc01hdHJpeFNldChyc19tYXRyaXgzeDMgKm0sIHVpbnQzMl90IHJvdywgdWludDMyX3QgY29sLCBmbG9hdCB2KSB7CisgICAgbS0+bVtyb3cgKiAzICsgY29sXSA9IHY7Cit9CisKK3N0YXRpYyBmbG9hdCBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKQorcnNNYXRyaXhHZXQoY29uc3QgcnNfbWF0cml4M3gzICptLCB1aW50MzJfdCByb3csIHVpbnQzMl90IGNvbCkgeworICAgIHJldHVybiBtLT5tW3JvdyAqIDMgKyBjb2xdOworfQorCitzdGF0aWMgdm9pZCBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKQorcnNNYXRyaXhTZXQocnNfbWF0cml4MngyICptLCB1aW50MzJfdCByb3csIHVpbnQzMl90IGNvbCwgZmxvYXQgdikgeworICAgIG0tPm1bcm93ICogMiArIGNvbF0gPSB2OworfQorCitzdGF0aWMgZmxvYXQgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkKK3JzTWF0cml4R2V0KGNvbnN0IHJzX21hdHJpeDJ4MiAqbSwgdWludDMyX3Qgcm93LCB1aW50MzJfdCBjb2wpIHsKKyAgICByZXR1cm4gbS0+bVtyb3cgKiAyICsgY29sXTsKK30KKworc3RhdGljIHZvaWQgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkKK3JzTWF0cml4TG9hZElkZW50aXR5KHJzX21hdHJpeDR4NCAqbSkgeworICAgIG0tPm1bMF0gPSAxLmY7CisgICAgbS0+bVsxXSA9IDAuZjsKKyAgICBtLT5tWzJdID0gMC5mOworICAgIG0tPm1bM10gPSAwLmY7CisgICAgbS0+bVs0XSA9IDAuZjsKKyAgICBtLT5tWzVdID0gMS5mOworICAgIG0tPm1bNl0gPS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PSB2WzVdOworICAgIG0tPm1bNl0gPSB2WzZdOworICAgIG0tPm1bN10gPSB2WzddOworICAgIG0tPm1bOF0gPSB2WzhdOworICAgIG0tPm1bOV0gPSB2WzldOworICAgIG0tPm1bMTBdID0gdlsxMF07CisgICAgbS0+bVsxMV0gPSB2WzExXTsKKyAgICBtLT5tWzEyXSA9IHZbMTJdOworICAgIG0tPm1bMTNdID0gdlsxM107CisgICAgbS0+bVsxNF0gPSB2WzE0XTsKKyAgICBtLT5tWzE1XSA9IHZbMTVdOworfQorCitzdGF0aWMgdm9pZCBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKQorcnNNYXRyaXhMb2FkKHJzX21hdHJpeDN4MyAqbSwgY29uc3QgZmxvYXQgKnYpIHsKKyAgICBtLT5tWzBdID0gdlswXTsKKyAgICBtLT5tWzFdID0gdlsxXTsKKyAgICBtLT5tWzJdID0gdlsyXTsKKyAgICBtLT5tWzNdID0gdlszXTsKKyAgICBtLT5tWzRdID0gdls0XTsKKyAgICBtLT5tWzVdID0gdls1XTsKKyAgICBtLT5tWzZdID0gdls2XTsKKyAgICBtLT5tWzddID0gdls3XTsKKyAgICBtLT5tWzhdID0gdls4XTsKK30KKworc3RhdGljIHZvaWQgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkKK3JzTWF0cml4TG9hZChyc19tYXRyaXgyeDIgKm0sIGNvbnN0IGZsb2F0ICp2KSB7CisgICAgbS0+bVswXSA9IHZbMF07CisgICAgbS0+bVsxXSA9IHZbMV07CisgICAgbS0+bVsyXSA9IHZbMl07CisgICAgbS0+bVszXSA9IHZbM107Cit9CisKK3N0YXRpYyB2b2lkIF9fYXR0cmlidXRlX18oKG92ZXJsb2FkYWJsZSkpCityc01hdHJpeExvYWQocnNfbWF0cml4NHg0ICptLCBjb25zdCByc19tYXRyaXg0eDQgKnYpIHsKKyAgICBtLT5tWzBdID0gdi0+bVswXTsKKyAgICBtLT5tWzFdID0gdi0+bVsxXTsKK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R0cmlidXRlX18oKG92ZXJsb2FkYWJsZSkpCityc01hdHJpeExvYWQocnNfbWF0cml4NHg0ICptLCBjb25zdCByc19tYXRyaXgyeDIgKnYpIHsKKyAgICBtLT5tWzBdID0gdi0+bVswXTsKKyAgICBtLT5tWzFdID0gdi0+bVsxXTsKKyAgICBtLT5tWzJdID0gMC5mOworICAgIG0tPm1bM10gPSAwLmY7CisgICAgbS0+bVs0XSA9IHYtPm1bM107CisgICAgbS0+bVs1XSA9IHYtPm1bNF07CisgICAgbS0+bVs2XSA9IDAuZjsKKyAgICBtLT5tWzddID0gMC5mOworICAgIG0tPm1bOF0gPSB2LT5tWzZdOworICAgIG0tPm1bOV0gPSB2LT5tWzddOworICAgIG0tPm1bMTBdID0gMS5mOworICAgIG0tPm1bMTFdID0gMC5mOworICAgIG0tPm1bMTJdID0gMC5mOworICAgIG0tPm1bMTNdID0gMC5mOworICAgIG0tPm1bMTRdID0gMC5mOworICAgIG0tPm1bMTVdID0gMS5mOworfQorCitzdGF0aWMgdm9pZCBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKQorcnNNYXRyaXhMb2FkKHJzX21hdHJpeDN4MyAqbSwgY29uc3QgcnNfbWF0cml4M3gzICp2KSB7CisgICAgbS0+bVswXSA9IHYtPm1bMF07CisgICAgbS0+bVsxXSA9IHYtPm1bMV07CisgICAgbS0+bVsyXSA9IHYtPm1bMl07CisgICAgbS0+bVszXSA9IHYtPm1bM107CisgICAgbS0+bVs0XSA9IHYtPm1bNF07CisgICAgbS0+bVs1XSA9IHYtPm1bNV07CisgICAgbS0+bVs2XSA9IHYtPm1bNl07CisgICAgbS0+bVs3XSA9IHYtPm1bN107CisgICAgbS0+bVs4XSA9IHYtPm1bOF07Cit9CisKK3N0YXRpYyB2b2lkIF9fYXR0cmlidXRlX18oKG92ZXJsb2FkYWJsZSkpCityc01hdHJpeExvYWQocnNfbWF0cml4MngyICptLCBjb25zdCByc19tYXRyaXgyeDIgKnYpIHsKKyAgICBtLT5tWzBdID0gdi0+bVswXTsKKyAgICBtLT5tWzFdID0gdi0+bVsxXTsKKyAgICBtLT5tWzJdID0gdi0+bVsyXTsKKyAgICBtLT5tWzNdID0gdi0+bVszXTsKK30KKworc3RhdGljIHZvaWQgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkKK3JzTWF0cml4TG9hZFJvdGF0ZShyc19tYXRyaXg0eDQgKm0sIGZsb2F0IHJvdCwgZmxvYXQgeCwgZmxvYXQgeSwgZmxvYXQgeikgeworICAgIGZsb2F0IGMsIHM7CisgICAgbS0+bVszXSA9IDA7CisgICAgbS0+bVs3XSA9IDA7CisgICAgbS0+bVsxMV09IDA7CisgICAgbS0+bVsxMl09IDA7CisgICAgbS0+bVsxM109IDA7CisgICAgbS0+bVsxNF09IDA7CisgICAgbS0+bVsxNV09IDE7CisgICAgcm90ICo9IChmbG9hdCkoTV9QSSAvIDE4MC4wZik7CisgICAgYyA9IGNvcyhyb3QpOworICAgIHMgPSBzaW4ocm90KTsKKworICAgIGNvbnN0IGZsb2F0IGxlbiA9IHgqeCArIHkqeSArIHoqejsKKyAgICBpZiAobGVuICE9IDEpIHsKKyAgICAgICAgY29uc3QgZmxvYXQgcmVjaXBMZW4gPSAxLmYgLyBzcXJ0KGxlbik7CisgICAgICAgIHggKj0gcmVjaXBMZW47CisgICAgICAgIHkgKj0gcmVjaXBMZW47CisgICAgICAgIHogKj0gcmVjaXBMZW47CisgICAgfQorICAgIGNvbnN0IGZsb2F0IG5jID0gMS4wZiAtIGM7CisgICAgY29uc3QgZmxvYXQgeHkgPSB4ICogeTsKKyAgICBjb25zdCBmbG9hdCB5eiA9IHkgKiB6OworICAgIGNvbnN0IGZsb2F0IHp4ID0geiAqIHg7CisgICAgY29uc3QgZmxvYXQgeHMgPSB4ICogczsKKyAgICBjb25zdCBmbG9hdCB5cyA9IHkgKiBzOworICAgIGNvbnN0IGZsb2F0IHpzID0geiAqIHM7CisgICAgbS0+bVsgMF0gPSB4KngqbmMgKyAgYzsKKyAgICBtLT5tWyA0XSA9ICB4eSpuYyAtIHpzOworICAgIG0tPm1bIDhdID0gIHp4Km5jICsgeXM7CisgICAgbS0+bVsgMV0gPSAgeHkqbmMgKyB6czsKKyAgICBtLT5tWyA1XSA9IHkqeSpuYyArICBjOworICAgIG0tPm1bIDldID0gIHl6Km5jIC0geHM7CisgICAgbS0+bVsgMl0gPSAgengqbmMgLSB5czsKKyAgICBtLT5tWyA2XSA9ICB5eipuYyArIHhzOworICAgIG0tPm1bMTBdID0geip6Km5jICsgIGM7Cit9CisKK3N0YXRpYyB2b2lkIF9fYXR0cmlidXRlX18oKG92ZXJsb2FkYWJsZSkpCityc01hdHJpeExvYWRTY2FsZShyc19tYXRyaXg0eDQgKm0sIGZsb2F0IHgsIGZsb2F0IHksIGZsb2F0IHopIHsKKyAgICByc01hdHJpeExvYWRJZGVudGl0eShtKTsKKyAgICBtLT5tWzBdID0geDsKKyAgICBtLT5tWzVdID0geTsKKyAgICBtLT5tWzEwXSA9IHo7Cit9CisKK3N0YXRpYyB2b2lkIF9fYXR0cmlidXRlX18oKG92ZXJsb2FkYWJsZSkpCityc01hdHJpeExvYWRUcmFuc2xhdGUocnNfbWF0cml4NHg0ICptLCBmbG9hdCB4LCBmbG9hdCB5LCBmbG9hdCB6KSB7CisgICAgcnNNYXRyaXhMb2FkSWRlbnRpdHkobSk7CisgICAgbS0+bVsxMl0gPSB4OworICAgIG0tPm1bMTNdID0geTsKKyAgICBtLT5tWzE0XSA9IHo7Cit9CisKK3N0YXRpYyB2b2lkIF9fYXR0cmlidXRlX18oKG92ZXJsb2FkYWJsZSkpCityc01hdHJpeExvYWRNdWx0aXBseShyc19tYXRyaXg0eDQgKm0sIGNvbnN0IHJzX21hdHJpeDR4NCAqbGhzLCBjb25zdCByc19tYXRyaXg0eDQgKnJocykgeworICAgIGZvciAoaW50IGk9MCA7IGk8NCA7IGkrKykgeworICAgICAgICBmbG9hdCByaTAgPSAwOworICAgICAgICBmbG9hdCByaTEgPSAwOworICAgICAgICBmbG9hdCByaTIgPSAwOworICAgICAgICBmbG9hdCByaTMgPSAwOworICAgICAgICBmb3IgKGludCBqPTAgOyBqPDQgOyBqKyspIHsKKyAgICAgICAgICAgIGNvbnN0IGZsb2F0IHJoc19paiA9IHJzTWF0cml4R2V0KHJocywgaSxqKTsKKyAgICAgICAgICAgIHJpMCArPSByc01hdHJpeEdldChsaHMsIGosIDApICogcmhzX2lqOworICAgICAgICAgICAgcmkxICs9IHJzTWF0cml4R2V0KGxocywgaiwgMSkgKiByaHNfaWo7CisgICAgICAgICAgICByaTIgKz0gcnNNYXRyaXhHZXQobGhzLCBqLCAyKSAqIHJoc19pajsKKyAgICAgICAgICAgIHJpMyArPSByc01hdHJpeEdldChsaHMsIGosIDMpICogcmhzX2lqOworICAgICAgICB9CisgICAgICAgIHJzTWF0cml4U2V0KG0sIGksIDAsIHJpMCk7CisgICAgICAgIHJzTWF0cml4U2V0KG0sIGksIDEsIHJpMSk7CisgICAgICAgIHJzTWF0cml4U2V0KG0sIGksIDIsIHJpMik7CisgICAgICAgIHJzTWF0cml4U2V0KG0sIGksIDMsIHJpMyk7CisgICAgfQorfQorCitzdGF0aWMgdm9pZCBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKQorcnNNYXRyaXhNdWx0aXBseShyc19tYXRyaXg0eDQgKm0sIGNvbnN0IHJzX21hdHJpeDR4NCAqcmhzKSB7CisgICAgcnNfbWF0cml4NHg0IG10OworICAgIHJzTWF0cml4TG9hZE11bHRpcGx5KCZtdCwgbSwgcmhzKTsKKyAgICByc01hdHJpeExvYWQobSwgJm10KTsKK30KKworc3RhdGljIHZvaWQgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkKK3JzTWF0cml4TG9hZE11bHRpcGx5KHJzX21hdHJpeDN4MyAqbSwgY29uc3QgcnNfbWF0cml4M3gzICpsaHMsIGNvbnN0IHJzX21hdHJpeDN4MyAqcmhzKSB7CisgICAgZm9yIChpbnQgaT0wIDsgaTwzIDsgaSsrKSB7CisgICAgICAgIGZsb2F0IHJpMCA9IDA7CisgICAgICAgIGZsb2F0IHJpMSA9IDA7CisgICAgICAgIGZsb2F0IHJpMiA9IDA7CisgICAgICAgIGZvciAoaW50IGo9MCA7IGo8MyA7IGorKykgeworICAgICAgICAgICAgY29uc3QgZmxvYXQgcmhzX2lqID0gcnNNYXRyaXhHZXQocmhzLCBpLGopOworICAgICAgICAgICAgcmkwICs9IHJzTWF0cml4R2V0KGxocywgaiwgMCkgKiByaHNfaWo7CisgICAgICAgICAgICByaTEgKz0gcnNNYXRyaXhHZXQobGhzLCBqLCAxKSAqIHJoc19pajsKKyAgICAgICAgICAgIHJpMiArPSByc01hdHJpeEdldChsaHMsIGosIDIpICogcmhzX2lqOworICAgICAgICB9CisgICAgICAgIHJzTWF0cml4U2V0KG0sIGksIDAsIHJpMCk7CisgICAgICAgIHJzTWF0cml4U2V0KG0sIGksIDEsIHJpMSk7CisgICAgICAgIHJzTWF0cml4U2V0KG0sIGksIDIsIHJpMik7CisgICAgfQorfQorCitzdGF0aWMgdm9pZCBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKQorcnNNYXRyaXhNdWx0aXBseShyc19tYXRyaXgzeDMgKm0sIGNvbnN0IHJzX21hdHJpeDN4MyAqcmhzKSB7CisgICAgcnNfbWF0cml4M3gzIG10OworICAgIHJzTWF0cml4TG9hZE11bHRpcGx5KCZtdCwgbSwgcmhzKTsKKyAgICByc01hdHJpeExvYWQobSwgJm10KTsKK30KKworc3RhdGljIHZvaWQgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkKK3JzTWF0cml4TG9hZE11bHRpcGx5KHJzX21hdHJpeDJ4MiAqbSwgY29uc3QgcnNfbWF0cml4MngyICpsaHMsIGNvbnN0IHJzX21hdHJpeDJ4MiAqcmhzKSB7CisgICAgZm9yIChpbnQgaT0wIDsgaTwyIDsgaSsrKSB7CisgICAgICAgIGZsb2F0IHJpMCA9IDA7CisgICAgICAgIGZsb2F0IHJpMSA9IDA7CisgICAgICAgIGZvciAoaW50IGo9MCA7IGo8MiA7IGorKykgeworICAgICAgICAgICAgY29uc3QgZmxvYXQgcmhzX2lqID0gcnNNYXRyaXhHZXQocmhzLCBpLGopOworICAgICAgICAgICAgcmkwICs9IHJzTWF0cml4R2V0KGxocywgaiwgMCkgKiByaHNfaWo7CisgICAgICAgICAgICByaTEgKz0gcnNNYXRyaXhHZXQobGhzLCBqLCAxKSAqIHJoc19pajsKKyAgICAgICAgfQorICAgICAgICByc01hdHJpeFNldChtLCBpLCAwLCByaTApOworICAgICAgICByc01hdHJpeFNldChtLCBpLCAxLCByaTEpOworICAgIH0KK30KKworc3RhdGljIHZvaWQgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkKK3JzTWF0cml4TXVsdGlwbHkocnNfbWF0cml4MngyICptLCBjb25zdCByc19tYXRyaXgyeDIgKnJocykgeworICAgIHJzX21hdHJpeDJ4MiBtdDsKKyAgICByc01hdHJpeExvYWRNdWx0aXBseSgmbXQsIG0sIHJocyk7CisgICAgcnNNYXRyaXhMb2FkKG0sICZtdCk7Cit9CisKK3N0YXRpYyB2b2lkIF9fYXR0cmlidXRlX18oKG92ZXJsb2FkYWJsZSkpCityc01hdHJpeFJvdGF0ZShyc19tYXRyaXg0eDQgKm0sIGZsb2F0IHJvdCwgZmxvYXQgeCwgZmxvYXQgeSwgZmxvYXQgeikgeworICAgIHJzX21hdHJpeDR4NCBtMTsKKyAgICByc01hdHJpeExvYWRSb3RhdGUoJm0xLCByb3QsIHgsIHksIHopOworICAgIHJzTWF0cml4TXVsdGlwbHkobSwgJm0xKTsKK30KKworc3RhdGljIHZvaWQgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkKK3JzTWF0cml4U2NhbGUocnNfbWF0cml4NHg0ICptLCBmbG9hdCB4LCBmbG9hdCB5LCBmbG9hdCB6KSB7CisgICAgcnNfbWF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KQorcnNNYXRyaXhNdWx0aXBseShyc19tYXRyaXg0eDQgKm0sIGZsb2F0NCBpbikgeworICAgIGZsb2F0NCByZXQ7CisgICAgcmV0LnggPSAobS0+bVswXSAqIGluLngpICsgKG0tPm1bNF0gKiBpbi55KSArIChtLT5tWzhdICogaW4ueikgKyAobS0+bVsxMl0gKiBpbi53KTsKKyAgICByZXQueSA9IChtLT5tWzFdICogaW4ueCkgKyAobS0+bVs1XSAqIGluLnkpICsgKG0tPm1bOV0gKiBpbi56KSArIChtLT5tWzEzXSAqIGluLncpOworICAgIHJldC56ID0gKG0tPm1bMl0gKiBpbi54KSArIChtLT5tWzZdICogaW4ueSkgKyAobS0+bVsxMF0gKiBpbi56KSArIChtLT5tWzE0XSAqIGluLncpOworICAgIHJldC53ID0gKG0tPm1bM10gKiBpbi54KSArIChtLT5tWzddICogaW4ueSkgKyAobS0+bVsxMV0gKiBpbi56KSArIChtLT5tWzE1XSAqIGluLncpOworICAgIHJldHVybiByZXQ7Cit9CisKK3N0YXRpYyBmbG9hdDQgX19hdHRyaWJ1dGVfXygob3ZlcmxvYWRhYmxlKSkKK3JzTWF0cml4TXVsdGlwbHkocnNfbWF0cml4NHg0ICptLCBmbG9hdDMgaW4pIHsKKyAgICBmbG9hdDQgcmV0OworICAgIHJldC54ID0gKG0tPm1bMF0gKiBpbi54KSArIChtLT5tWzRdICogaW4ueSkgKyAobS0+bVs4XSAqIGluLnopICsgbS0+bVsxMl07CisgICAgcmV0LnkgPSAobS0+bVsxXSAqIGluLngpICsgKG0tPm1bNV0gKiBpbi55KSArIChtLT5tWzldICogaW4ueikgKyBtLT5tWzEzXTsKKyAgICByZXQueiA9IChtLT5tWzJdICogaW4ueCkgKyAobS0+bVs2XSAqIGluLnkpICsgKG0tPm1bMTBdICogaW4ueikgKyBtLT5tWzE0XTsKKyAgICByZXQudyA9IChtLT5tWzNdICogaW4ueCkgKyAobS0+bVs3XSAqIGluLnkpICsgKG0tPm1bMTFdICogaW4ueikgKyBtLT5tWzE1XTsKKyAgICByZXR1cm4gcmV0OworfQorCitzdGF0aWMgZmxvYXQ0IF9fYXR0cmlidXRlX18oKG92ZXJsb2FkYWJsZSkpCityc01hdHJpeE11bHRpcGx5KHJzX21hdHJpeDR4NCAqbSwgZmxvYXQyIGluKSB7CisgICAgZmxvYXQ0IHJldDsKKyAgICByZXQueCA9IChtLT5tWzBdICogaW4ueCkgKyAobS0+bVs0XSAqIGluLnkpICsgbS0+bVsxMl07CisgICAgcmV0LnkgPSAobS0+bVsxXSAqIGluLngpICsgKG0tPm1bNV0gKiBpbi55KSArIG0tPm1bMTNdOworICAgIHJldC56ID0gKG0tPm1bMl0gKiBpbi54KSArIChtLT5tWzZdICogaW4ueSkgKyBtLT5tWzE0XTsKKyAgICByZXQudyA9IChtLT5tWzNdICogaW4ueCkgKyAobS0+bVs3XSAqIGluLnkpICsgbS0+bVsxNV07CisgICAgcmV0dXJuIHJldDsKK30KKworc3RhdGljIGZsb2F0MyBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKQorcnNNYXRyaXhNdWx0aXBseShyc19tYXRyaXgzeDMgKm0sIGZsb2F0MyBpbikgeworICAgIGZsb2F0MyByZXQ7CisgICAgcmV0LnggPSAobS0+bVswXSAqIGluLngpICsgKG0tPm1bM10gKiBpbi55KSArIChtLT5tWzZdICogaW4ueik7CisgICAgcmV0LnkgPSAobS0+bVsxXSAqIGluLngpICsgKG0tPm1bNF0gKiBpbi55KSArIChtLT5tWzddICogaW4ueik7CisgICAgcmV0LnogPSAobS0+bVsyXSAqIGluLngpICsgKG0tPm1bNV0gKiBpbi55KSArIChtLT5tWzhdICogaW4ueik7CisgICAgcmV0dXJuIHJldDsKK30KKworc3RhdGljIGZsb2F0MyBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKQorcnNNYXRyaXhNdWx0aXBseShyc19tYXRyaXgzeDMgKm0sIGZsb2F0MiBpbikgeworICAgIGZsb2F0MyByZXQ7CisgICAgcmV0LnggPSAobS0+bVswXSAqIGluLngpICsgKG0tPm1bM10gKiBpbi55KTsKKyAgICByZXQueSA9IChtLT5tWzFdICogaW4ueCkgKyAobS0+bVs0XSAqIGluLnkpOworICAgIHJldC56ID0gKG0tPm1bMl0gKiBpbi54KSArIChtLT5tWzVdICogaW4ueSk7CisgICAgcmV0dXJuIHJldDsKK30KKworc3RhdGljIGZsb2F0MiBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKQorcnNNYXRyaXhNdWx0aXBseShyc19tYXRyaXgyeDIgKm0sIGZsb2F0MiBpbikgeworICAgIGZsb2F0MiByZXQ7CisgICAgcmV0LnggPSAobS0+bVswXSAqIGluLngpICsgKG0tPm1bMl0gKiBpbi55KTsKKyAgICByZXQueSA9IChtLT5tWzFdICogaW4ueCkgKyAobS0+bVszXSAqIGluLnkpOworICAgIHJldHVybiByZXQ7Cit9CisKKy8vIFJldHVybnMgdHJ1ZSBpZiB0aGUgbWF0cml4IHdhcyBzdWNjZXNzZnVsbHkgaW52ZXJzZWQKK3N0YXRpYyBib29sIF9fYXR0cmlidXRlX18oKG92ZXJsb2FkYWJsZSkpCityc01hdHJpeEludmVyc2UocnNfbWF0cml4NHg0ICptKSB7CisgICAgcnNfbWF0cml4NHg0IHJlc3VsdDsKKworICAgIGludCBpLCBqOworICAgIGZvciAoaSA9IDA7IGkgPCA0OyArK2kpIHsKKyAgICAgICAgZm9yIChqID0gMDsgaiA8IDQ7ICsraikgeworICAgICAgICAgICAgLy8gY29tcHV0ZUNvZmFjdG9yIGZvciBpbnQgaSwgaW50IGoKKyAgICAgICAgICAgIGludCBjMCA9IChpKzEpICUgNDsKKyAgICAgICAgICAgIGludCBjMSA9IChpKzIpICUgNDsKKyAgICAgICAgICAgIGludCBjMiA9IChpKzMpICUgNDsKKyAgICAgICAgICAgIGludCByMCA9IChqKzEpICUgNDsKKyAgICAgICAgICAgIGludCByMSA9IChqKzIpICUgNDsKKyAgICAgICAgICAgIGludCByMiA9IChqKzMpICUgNDsKKworICAgICAgICAgICAgZmxvYXQgbWlub3IgPSAobS0+bVtjMCArIDQqcjBdICogKG0tPm1bYzEgKyA0KnIxXSAqIG0tPm1bYzIgKyA0KnIyXSAtIG0tPm1bYzEgKyA0KnIyXSAqIG0tPm1bYzIgKyA0KnIxXSkpCisgICAgICAgICAgICAgICAgICAgICAgICAgLSAobS0+bVtjMCArIDQqcjFdICogKG0tPm1bYzEgKyA0KnIwXSAqIG0tPm1bYzIgKyA0KnIyXSAtIG0tPm1bYzEgKyA0KnIyXSAqIG0tPm1bYzIgKyA0KnIwXSkpCisgICAgICAgICAgICAgICAgICAgICAgICAgKyAobS0+bVtjMCArIDQqcjJdICogKG0tPm1bYzEgKyA0KnIwXSAqIG0tPm1bYzIgKyA0KnIxXSAtIG0tPm1bYzEgKyA0KnIxXSAqIG0tPm1bYzIgKyA0KnIwXSkpOworCisgICAgICAgICAgICBmbG9hdCBjb2ZhY3RvciA9IChpK2opICYgMSA/IC1taW5vciA6IG1pbm9yOworCisgICAgICAgICAgICByZXN1bHQubVs0KmkgKyBqXSA9IGNvZmFjdG9yOworICAgICAgICB9CisgICAgfQorCisgICAgLy8gRG90IHByb2R1Y3Qgb2YgMHRoIGNvbHVtbiBvZiBzb3VyY2UgYW5kIDB0aCByb3cgb2YgcmVzdWx0CisgICAgZmxvYXQgZGV0ID0gbS0+bVswXSpyZXN1bHQubVswXSArIG0tPm1bNF0qcmVzdWx0Lm1bMV0gKworICAgICAgICAgICAgICAgICBtLT5tWzhdKnJlc3VsdC5tWzJdICsgbS0+bVsxMl0qcmVzdWx0Lm1bM107CisKKyAgICBpZiAoZmFicyhkZXQpIDwgMWUtNikgeworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgZGV0ID0gMS4wZiAvIGRldDsKKyAgICBmb3IgKGkgPSAwOyBpIDwgMTY7ICsraSkgeworICAgICAgICBtLT5tW2ldID0gcmVzdWx0Lm1baV0gKiBkZXQ7CisgICAgfQorCisgICAgcmV0dXJuIHRydWU7Cit9CisKKy8vIFJldHVybnMgdHJ1ZSBpZiB0aGUgbWF0cml4IHdhcyBzdWNjZXNzZnVsbHkgaW52ZXJzZWQKK3N0YXRpYyBib29sIF9fYXR0cmlidXRlX18oKG92ZXJsb2FkYWJsZSkpCityc01hdHJpeEludmVyc2VUcmFuc3Bvc2UocnNfbWF0cml4NHg0ICptKSB7CisgICAgcnNfbWF0cml4NHg0IHJlc3VsdDsKKworICAgIGludCBpLCBqOworICAgIGZvciAoaSA9IDA7IGkgPCA0OyArK2kpIHsKKyAgICAgICAgZm9yIChqID0gMDsgaiA8IDQ7ICsraikgeworICAgICAgICAgICAgLy8gY29tcHV0ZUNvZmFjdG9yIGZvciBpbnQgaSwgaW50IGoKKyAgICAgICAgICAgIGludCBjMCA9IChpKzEpICUgNDsKKyAgICAgICAgICAgIGludCBjMSA9IChpKzIpICUgNDsKKyAgICAgICAgICAgIGludCBjMiA9IChpKzMpICUgNDsKKyAgICAgICAgICAgIGludCByMCA9IChqKzEpICUgNDsKKyAgICAgICAgICAgIGludCByMSA9IChqKzIpICUgNDsKKyAgICAgICAgICAgIGludCByMiA9IChqKzMpICUgNDsKKworICAgICAgICAgICAgZmxvYXQgbWlub3IgPSAobS0+bVtjMCArIDQqcjBdICogKG0tPm1bYzEgKyA0KnIxXSAqIG0tPm1bYzIgKyA0KnIyXSAtIG0tPm1bYzEgKyA0KnIyXSAqIG0tPm1bYzIgKyA0KnIxXSkpCisgICAgICAgICAgICAgICAgICAgICAgICAgLSAobS0+bVtjMCArIDQqcjFdICogKG0tPm1bYzEgKyA0KnIwXSAqIG0tPm1bYzIgKyA0KnIyXSAtIG0tPm1bYzEgKyA0KnIyXSAqIG0tPm1bYzIgKyA0KnIwXSkpCisgICAgICAgICAgICAgICAgICAgICAgICAgKyAobS0+bVtjMCArIDQqcjJdICogKG0tPm1bYzEgKyA0KnIwXSAqIG0tPm1bYzIgKyA0KnIxXSAtIG0tPm1bYzEgKyA0KnIxXSAqIG0tPm1bYzIgKyA0KnIwXSkpOworCisgICAgICAgICAgICBmbG9hdCBjb2ZhY3RvciA9IChpK2opICYgMSA/IC1taW5vciA6IG1pbm9yOworCisgICAgICAgICAgICByZXN1bHQubVs0KmogKyBpXSA9IGNvZmFjdG9yOworICAgICAgICB9CisgICAgfQorCisgICAgLy8gRG90IHByb2R1Y3Qgb2YgMHRoIGNvbHVtbiBvZiBzb3VyY2UgYW5kIDB0aCBjb2x1bW4gb2YgcmVzdWx0CisgICAgZmxvYXQgZGV0ID0gbS0+bVswXSpyZXN1bHQubVswXSArIG0tPm1bNF0qcmVzdWx0Lm1bNF0gKworICAgICAgICAgICAgICAgICBtLT5tWzhdKnJlc3VsdC5tWzhdICsgbS0+bVsxMl0qcmVzdWx0Lm1bMTJdOworCisgICAgaWYgKGZhYnMoZGV0KSA8IDFlLTYpIHsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIGRldCA9IDEuMGYgLyBkZXQ7CisgICAgZm9yIChpID0gMDsgaSA8IDE2OyArK2kpIHsKKyAgICAgICAgbS0+bVtpXSA9IHJlc3VsdC5tW2ldICogZGV0OworICAgIH0KKworICAgIHJldHVybiB0cnVlOworfQorCitzdGF0aWMgdm9pZCBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKQorcnNNYXRyaXhUcmFuc3Bvc2UocnNfbWF0cml4NHg0ICptKSB7CisgICAgaW50IGksIGo7CisgICAgZmxvYXQgdGVtcDsKKyAgICBmb3IgKGkgPSAwOyBpIDwgMzsgKytpKSB7CisgICAgICAgIGZvciAoaiA9IGkgKyAxOyBqIDwgNDsgKytqKSB7CisgICAgICAgICAgICB0ZW1wID0gbS0+bVtpKjQgKyBqXTsKKyAgICAgICAgICAgIG0tPm1baSo0ICsgal0gPSBtLT5tW2oqNCArIGldOworICAgICAgICAgICAgbS0+bVtqKjQgKyBpXSA9IHRlbXA7CisgICAgICAgIH0KKyAgICB9Cit9CisKK3N0YXRpYyB2b2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3F1YXRlcm5pb24gKnEsIGNvbnN0IHJzX3F1YXRlcm5pb24gKnJocykgeworICAgIHEtPncgPSByaHMtPnc7CisgICAgcS0+eCA9IHJocy0+eDsKKyAgICBxLT55ID0gcmhzLT55OworICAgIHEtPnogPSByaHMtPno7Cit9CisKK3N0YXRpYyB2b2lkIF9fYXR0cmlidXRlX18oKG92ZXJsb2FkYWJsZSkpCityc1F1YXRlcm5pb25NdWx0aXBseShyc19xdWF0ZXJuaW9uICpxLCBmbG9hdCBzKSB7CisgICAgcS0+dyAqPSBzOworICAgIHEtPnggKj0gczsKKyAgICBxLT55ICo9IHM7CisgICAgcS0+eiAqPSBzOworfQorCitzdGF0aWMgdm9pZCBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKQorcnNRdWF0ZXJuaW9uTXVsdGlwbHkocnNfcXVhdGVybmlvbiAqcSwgY29uc3QgcnNfcXVhdGVybmlvbiAqcmhzKSB7CisgICAgcS0+dyA9IC1xLT54KnJocy0+eCAtIHEtPnkqcmhzLT55IC0gcS0+eipyaHMtPnogKyBxLT53KnJocy0+dzsKKyAgICBxLT54ID0gIHEtPngqcmhzLT53ICsgcS0+eSpyaHMtPnogLSBxLT56KnJocy0+eSArIHEtPncqcmhzLT54OworICAgIHEtPnkgPSAtcS0+eCpyaHMtPnogKyBxLT55KnJocy0+dyArIHEtPnoqcmhzLT56ICsgcS0+dypyaHMtPnk7CisgICAgcS0+eiA9ICBxLT54KnJocy0+eSAtIHEtPnkqcmhzLT54ICsgcS0+eipyaHMtPncgKyBxLT53KnJocy0+ejsKK30KKworc3RhdGljIHZvaWQKK3JzUXVhdGVybmlvbkFkZChyc19xdWF0ZXJuaW9uICpxLCBjb25zdCByc19xdWF0ZXJuaW9uICpyaHMpIHsKKyAgICBxLT53ICo9IHJocy0+dzsKKyAgICBxLT54ICo9IHJocy0+eDsKKyAgICBxLT55ICo9IHJocy0+eTsKKyAgICBxLT56ICo9IHJocy0+ejsKK30KKworc3RhdGljIHZ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DAuMDVmKSB7CisgICAgICAgIGlmICgxLjBmIC0gYW5nbGUgPj0gMC4wNWYpIHsKKyAgICAgICAgICAgIGZsb2F0IHRoZXRhID0gYWNvcyhhbmdsZSk7CisgICAgICAgICAgICBmbG9hdCBpbnZTaW5UaGV0YSA9IDEuMGYgLyBzaW4odGhldGEpOworICAgICAgICAgICAgc2NhbGUgPSBzaW4odGhldGEgKiAoMS4wZiAtIHQpKSAqIGludlNpblRoZXRhOworICAgICAgICAgICAgaW52U2NhbGUgPSBzaW4odGhldGEgKiB0KSAqIGludlNpblRoZXRhOworICAgICAgICB9CisgICAgICAgIGVsc2UgeworICAgICAgICAgICAgc2NhbGUgPSAxLjBmIC0gdDsKKyAgICAgICAgICAgIGludlNjYWxlID0gdDsKKyAgICAgICAgfQorICAgIH0KKyAgICBlbHNlIHsKKyAgICAgICAgcnNRdWF0ZXJuaW9uU2V0KCZ0ZW1wcTEsIHRlbXBxMC56LCAtdGVtcHEwLnksIHRlbXBxMC54LCAtdGVtcHEwLncpOworICAgICAgICBzY2FsZSA9IHNpbihNX1BJICogKDAuNWYgLSB0KSk7CisgICAgICAgIGludlNjYWxlID0gc2luKE1fUEkgKiB0KTsKKyAgICB9CisKKyAgICByc1F1YXRlcm5pb25TZXQocSwgdGVtcHEwLncqc2NhbGUgKyB0ZW1wcTEudyppbnZTY2FsZSwgdGVtcHEwLngqc2NhbGUgKyB0ZW1wcTEueCppbnZTY2FsZSwKKyAgICAgICAgICAgICAgICAgICAgICAgIHRlbXBxMC55KnNjYWxlICsgdGVtcHExLnkqaW52U2NhbGUsIHRlbXBxMC56KnNjYWxlICsgdGVtcHExLnoqaW52U2NhbGUpOworfQorCitzdGF0aWMgdm9pZCByc1F1YXRlcm5pb25HZXRNYXRyaXhVbml0KHJzX21hdHJpeDR4NCAqbSwgY29uc3QgcnNfcXVhdGVybmlvbiAqcSkgeworICAgIGZsb2F0IHgyID0gMi4wZiAqIHEtPnggKiBxLT54OworICAgIGZsb2F0IHkyID0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mlld1Byb2otPm1bN10gLSBtb2RlbFZpZXdQcm9qLT5tWzVdOworICAgIHRvcC0+eiA9IG1vZGVsVmlld1Byb2otPm1bMTFdIC0gbW9kZWxWaWV3UHJvai0+bVs5XTsKKyAgICB0b3AtPncgPSBtb2RlbFZpZXdQcm9qLT5tWzE1XSAtIG1vZGVsVmlld1Byb2otPm1bMTNdOworCisgICAgYm90dG9tLT54ID0gbW9kZWxWaWV3UHJvai0+bVszXSArIG1vZGVsVmlld1Byb2otPm1bMV07CisgICAgYm90dG9tLT55ID0gbW9kZWxWaWV3UHJvai0+bVs3XSArIG1vZGVsVmlld1Byb2otPm1bNV07CisgICAgYm90dG9tLT56ID0gbW9kZWxWaWV3UHJvai0+bVsxMV0gKyBtb2RlbFZpZXdQcm9qLT5tWzldOworICAgIGJvdHRvbS0+dyA9IG1vZGVsVmlld1Byb2otPm1bMTVdICsgbW9kZWxWaWV3UHJvai0+bVsxM107CisKKyAgICBuZWFyLT54ID0gbW9kZWxWaWV3UHJvai0+bVszXSArIG1vZGVsVmlld1Byb2otPm1bMl07CisgICAgbmVhci0+eSA9IG1vZGVsVmlld1Byb2otPm1bN10gKyBtb2RlbFZpZXdQcm9qLT5tWzZdOworICAgIG5lYXItPnogPSBtb2RlbFZpZXdQcm9qLT5tWzExXSArIG1vZGVsVmlld1Byb2otPm1bMTBdOworICAgIG5lYXItPncgPSBtb2RlbFZpZXdQcm9qLT5tWzE1XSArIG1vZGVsVmlld1Byb2otPm1bMTRdOworCisgICAgZmFyLT54ID0gbW9kZWxWaWV3UHJvai0+bVszXSAtIG1vZGVsVmlld1Byb2otPm1bMl07CisgICAgZmFyLT55ID0gbW9kZWxWaWV3UHJvai0+bVs3XSAtIG1vZGVsVmlld1Byb2otPm1bNl07CisgICAgZmFyLT56ID0gbW9kZWxWaWV3UHJvai0+bVsxMV0gLSBtb2RlbFZpZXdQcm9qLT5tWzEwXTsKKyAgICBmYXItPncgPSBtb2RlbFZpZXdQcm9qLT5tWzE1XSAtIG1vZGVsVmlld1Byb2otPm1bMTRdOworCisgICAgZmxvYXQgbGVuID0gbGVuZ3RoKGxlZnQtPnh5eik7CisgICAgKmxlZnQgLz0gbGVuOworICAgIGxlbiA9IGxlbmd0aChyaWdodC0+eHl6KTsKKyAgICAqcmlnaHQgLz0gbGVuOworICAgIGxlbiA9IGxlbmd0aCh0b3AtPnh5eik7CisgICAgKnRvcCAvPSBsZW47CisgICAgbGVuID0gbGVuZ3RoKGJvdHRvbS0+eHl6KTsKKyAgICAqYm90dG9tIC89IGxlbjsKKyAgICBsZW4gPSBsZW5ndGgobmVhci0+eHl6KTsKKyAgICAqbmVhciAvPSBsZW47CisgICAgbGVuID0gbGVuZ3RoKGZhci0+eHl6KTsKKyAgICAqZmFyIC89IGxlbjsKK30KKworYm9vbCBfX2F0dHJpYnV0ZV9fKChvdmVybG9hZGFibGUpKQorcnNJc1NwaGVyZUluRnJ1c3R1bShmbG9hdDQgKnNwaGVyZSwKKyAgICAgICAgICAgICAgICAgICAgICBmbG9hdDQgKmxlZnQsIGZsb2F0NCAqcmlnaHQsCisgICAgICAgICAgICAgICAgICAgICAgZmxvYXQ0ICp0b3AsIGZsb2F0NCAqYm90dG9tLAorICAgICAgICAgICAgICAgICAgICAgIGZsb2F0NCAqbmVhciwgZmxvYXQ0ICpmYXIpIHsKKworICAgIGZsb2F0IGRpc3RUb0NlbnRlciA9IGRvdChsZWZ0LT54eXosIHNwaGVyZS0+eHl6KSArIGxlZnQtPnc7CisgICAgaWYoZGlzdFRvQ2VudGVyIDwgLXNwaGVyZS0+dykgeworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorICAgIGRpc3RUb0NlbnRlciA9IGRvdChyaWdodC0+eHl6LCBzcGhlcmUtPnh5eikgKyByaWdodC0+dzsKKyAgICBpZihkaXN0VG9DZW50ZXIgPCAtc3BoZXJlLT53KSB7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisgICAgZGlzdFRvQ2VudGVyID0gZG90K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YXQgJWRcbiIsCkBAIC0xODc4LDYgKzE4ODQsMTIgQEAKICAgICAgICAgb3V0TmFtZS0+dHlwZSA9IGdycC0+YmFzZVBhY2thZ2UtPnR5cGVTdHJpbmdzLnN0cmluZ0F0KHQsICZvdXROYW1lLT50eXBlTGVuKTsKICAgICAgICAgb3V0TmFtZS0+bmFtZSA9IGdycC0+YmFzZVBhY2thZ2UtPmtleVN0cmluZ3Muc3RyaW5nQXQoCiAgICAgICAgICAgICBkdG9obChlbnRyeS0+a2V5LmluZGV4KSwgJm91dE5hbWUtPm5hbWVMZW4pOworCisgICAgICAgIC8vIElmIHdlIGhhdmUgYSBiYWQgaW5kZXggZm9yIHNvbWUgcmVhc29uLCB3ZSBzaG91bGQgYWJvcnQuCisgICAgICAgIGlmIChvdXROYW1lLT50eXBlID09IE5VTEwgfHwgb3V0TmFtZS0+bmFtZSA9PSBOVUxMKSB7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKwogICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICB9CiAKQEAgLTI2MDksNiArMjYyMSwyNCBAQAogICAgICAgICAqb3V0VHlwZSA9ICpkZWZUeXBlOwogICAgIH0KICAgICAqb3V0TmFtZSA9IFN0cmluZzE2KHAsIGVuZC1wKTsKKyAgICBpZigqKm91dFBhY2thZ2UgPT0gMCkgeworICAgICAgICBpZihvdXRFcnJvck1zZykgeworICAgICAgICAgICAgKm91dEVycm9yTXNnID0gIlJlc291cmNlIHBhY2thZ2UgY2Fubm90IGJlIGFuIGVtcHR5IHN0cmluZyI7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKyAgICBpZigqKm91dFR5cGUgPT0gMCkgeworICAgICAgICBpZihvdXRFcnJvck1zZykgeworICAgICAgICAgICAgKm91dEVycm9yTXNnID0gIlJlc291cmNlIHR5cGUgY2Fubm90IGJlIGFuIGVtcHR5IHN0cmluZyI7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKyAgICBpZigqKm91dE5hbWUgPT0gMCkgeworICAgICAgICBpZihvdXRFcnJvck1zZykgeworICAgICAgICAgICAgKm91dEVycm9yTXNnID0gIlJlc291cmNlIGlkIGNhbm5vdCBiZSBhbiBlbXB0eSBzdHJpbmciOworICAgICAgICB9CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CiAgICAgcmV0dXJuIHRydWU7CiB9CiAKQEAgLTQxMjcsMTMgKzQxNTcsMTYgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgKDB4MDBmZjAwMDAgJiAoKHR5cGVJbmRleCsxKTw8MTYpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAoMHgwMDAwZmZmZiAmIChlbnRyeUluZGV4KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICByZXNvdXJjZV9uYW1lIHJlc05hbWU7Ci0gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLT5nZXRSZXNvdXJjZU5hbWUocmVzSUQsICZyZXNOYW1lKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIHByaW50ZigiICAgICAgc3BlYyByZXNvdXJjZSAweCUwOHggJXM6JXMvJXM6IGZsYWdzPTB4JTA4eFxuIiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXNJRCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBDSEFSMTZfVE9fQ1NUUihyZXNOYW1lLnBhY2thZ2UsIHJlc05hbWUucGFja2FnZUxlbiksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgQ0hBUjE2X1RPX0NTVFIocmVzTmFtZS50eXBlLCByZXNOYW1lLnR5cGVMZW4pLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIENIQVIxNl9UT19DU1RSKHJlc05hbWUubmFtZSwgcmVzTmFtZS5uYW1lTGVuKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBkdG9obCh0eXBlQ29uZmlncy0+dHlwZVNwZWNGbGFnc1tlbnRyeUluZGV4XSkpOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHRoaXMtPmdldFJlc291cmNlTmFtZShyZXNJRCwgJnJlc05hbWUpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRmKCIgICAgICBzcGVjIHJlc291cmNlIDB4JTA4eCAlczolcy8lczogZmxhZ3M9MHglMDh4XG4iLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXNJRCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ0hBUjE2X1RPX0NTVFIocmVzTmFtZS5wYWNrYWdlLCByZXNOYW1lLnBhY2thZ2VMZW4pLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDSEFSMTZfVE9fQ1NUUihyZXNOYW1lLnR5cGUsIHJlc05hbWUudHlwZUxlbiksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENIQVIxNl9UT19DU1RSKHJlc05hbWUubmFtZSwgcmVzTmFtZS5uYW1lTGVuKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZHRvaGwodHlwZUNvbmZpZ3MtPnR5cGVTcGVjRmxhZ3NbZW50cnlJbmRleF0pKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRmKCIgICAgICBJTlZBTElEIFRZUEUgQ09ORklHIEZPUiBSRVNPVVJDRSAweCUwOHhcbiIsIHJlc0lEKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBmb3IgKHNpemVfdCBjb25maWdJbmRleD0wOyBjb25maWdJbmRleDxOVEM7IGNvbmZpZ0luZGV4KyspIHsKQEAgLTQzNDAsMTEgKzQzNzMsMTQgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgKDB4MDBmZjAwMDAgJiAoKHR5cGVJbmRleCsxKTw8MTYpKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAoMHgwMDAwZmZmZiAmIChlbnRyeUluZGV4KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICByZXNvdXJjZV9uYW1lIHJlc05hbWU7Ci0gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLT5nZXRSZXNvdXJjZU5hbWUocmVzSUQsICZyZXNOYW1lKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIHByaW50ZigiICAgICAgICByZXNvdXJjZSAweCUwOHggJXM6JXMvJXM6ICIsIHJlc0lELAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDSEFSMTZfVE9fQ1NUUihyZXNOYW1lLnBhY2thZ2UsIHJlc05hbWUucGFja2FnZUxlbiksCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENIQVIxNl9UT19DU1RSKHJlc05hbWUudHlwZSwgcmVzTmFtZS50eXBlTGVuKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ0hBUjE2X1RPX0NTVFIocmVzTmFtZS5uYW1lLCByZXNOYW1lLm5hbWVMZW4pKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0aGlzLT5nZXRSZXNvdXJjZU5hbWUocmVzSUQsICZyZXNOYW1lKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByaW50ZigiICAgICAgICByZXNvdXJjZSAweCUwOHggJXM6JXMvJXM6ICIsIHJlc0lELAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ0hBUjE2X1RPX0NTVFIocmVzTmFtZS5wYWNrYWdlLCByZXNOYW1lLnBhY2thZ2VMZW4pLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ0hBUjE2X1RPX0NTVFIocmVzTmFtZS50eXBlLCByZXNOYW1lLnR5cGVMZW4pLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ0hBUjE2X1RPX0NTVFIocmVzTmFtZS5uYW1lLCByZXNOYW1lLm5hbWVMZW4pKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRmKCIgICAgICAgIElOVkFMSUQgUkVTT1VSQ0UgMHglMDh4OiAiLCByZXNJRCk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoKHRoaXNPZmZzZXQmMHgzKSAhPSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRmKCJOT04tSU5URUdFUiBPRkZTRVQ6ICVwXG4iLCAodm9pZCopdGhpc09mZnNldCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CkBAIC00NDAyLDE4ICs0NDM4LDE5IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByaW50X3ZhbHVlKHBrZywgdmFsdWUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoYmFnUHRyICE9IE5VTEwpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgaW50IE4gPSBkdG9obChiYWdQdHItPmNvdW50KTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgUmVzVGFibGVfbWFwKiBtYXBQdHIgPSAoY29uc3QgUmVzVGFibGVfbWFwKikKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoKChjb25zdCB1aW50OF90KillbnQpICsgZXNpemUpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCB1aW50OF90KiBiYXNlTWFwUHRyID0gKGNvbnN0IHVpbnQ4X3QqKWVudDsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZV90IG1hcE9mZnNldCA9IGVzaXplOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBSZXNUYWJsZV9tYXAqIG1hcFB0ciA9IChSZXNUYWJsZV9tYXAqKShiYXNlTWFwUHRyK21hcE9mZnNldCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByaW50ZigiICAgICAgICAgIFBhcmVudD0weCUwOHgsIENvdW50PSVkXG4iLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZHRvaGwoYmFnUHRyLT5wYXJlbnQuaWRlbnQpLCBOKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChpbnQgaT0wOyBpPE47IGkrKykgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGludCBpPTA7IGk8TiAmJiBtYXBPZmZzZXQgPCAodHlwZVNpemUtc2l6ZW9mKFJlc1RhYmxlX21hcCkpOyBpKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByaW50ZigiICAgICAgICAgICMlaSAoS2V5PTB4JTA4eCk6ICIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSwgZHRvaGwobWFwUHRyLT5uYW1lLmlkZW50KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZS5jb3B5RnJvbV9kdG9oKG1hcFB0ci0+dmFsdWUpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRfdmFsdWUocGtnLCB2YWx1ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBzaXplX3Qgc2l6ZSA9IGR0b2hzKG1hcFB0ci0+dmFsdWUuc2l6ZSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXBQdHIgPSAoUmVzVGFibGVfbWFwKikoKChjb25zdCB1aW50OF90KiltYXBQdHIpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA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JLID0gMDsKKworICAgIC8qKgorICAgICAqIFRoZSBjb3VudHJ5IGNvZGUgY2FtZSBmcm9tIHRoZSBsb2NhdGlvbiBzZXJ2aWNlCisgICAgICovCisgICAgcHVibGljIHN0YXRpYyBmaW5hbCBpbnQgQ09VTlRSWV9TT1VSQ0VfTE9DQVRJT04gPSAxOworCisgICAgLyoqCisgICAgICogVGhlIGNvdW50cnkgY29kZSB3YXMgcmVhZCBmcm9tIHRoZSBTSU0gY2FyZAorICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IENPVU5UUllfU09VUkNFX1NJTSA9IDI7CisKKyAgICAvKioKKyAgICAgKiBUaGUgY291bnRyeSBjb2RlIGNhbWUgZnJvbSB0aGUgc3lzdGVtIGxvY2FsZSBzZXR0aW5nCisgICAgICovCisgICAgcHVibGljIHN0YXRpYyBmaW5hbCBpbnQgQ09VTlRSWV9TT1VSQ0VfTE9DQUxFID0gMzsKKworICAgIC8qKgorICAgICAqIFRoZSBJU08gMzE2Ni0xIHR3byBsZXR0ZXJzIGNvdW50cnkgY29kZS4KKyAgICAgKi8KKyAgICBwcml2YXRlIGZpbmFsIFN0cmluZyBtQ291bnRyeUlzbzsKKworICAgIC8qKgorICAgICAqIFdoZXJlIHRoZSBjb3VudHJ5IGNvZGUgY2FtZSBmcm9tLgorICAgICAqLworICAgIHByaXZhdGUgZmluYWwgaW50IG1Tb3VyY2U7CisKKyAgICBwcml2YXRlIGludCBtSGFzaENvZGU7CisgICAgLyoqCisgICAgICoKKyAgICAgKiBAcGFyYW0gY291bnRyeUlzbyB0aGUgSVNPIDMxNjYtMSB0d28gbGV0dGVycyBjb3VudHJ5IGNvZGUuCisgICAgICogQHBhcmFtIHNvdXJjZSB3aGVyZSB0aGUgY291bnRyeUlzbyBjYW1lIGZyb20sIGNvdWxkIGJlIG9uZSBvZiBiZWxvdworICAgICAqICAgICAgICB2YWx1ZXMKKyAgICAgKiAgICAgICAgPHA+CisgICAgICogICAgICAgIDx1bD4KKyAgICAgKiAgICAgICAgPGxpPntAbGluayAjQ09VTlRSWV9TT1VSQ0VfTkVUV09SS308L2xpPgorICAgICAqICAgICAgICA8bGk+e0BsaW5rICNDT1VOVFJZX1NPVVJDRV9MT0NBVElPTn08L2xpPgorICAgICAqICAgICAgICA8bGk+e0BsaW5rICNDT1VOVFJZX1NPVVJDRV9TSU19PC9saT4KKyAgICAgKiAgICAgICAgPGxpPntAbGluayAjQ09VTlRSWV9TT1VSQ0VfTE9DQUxFfTwvbGk+CisgICAgICogICAgICAgIDwvdWw+CisgICAgICovCisgICAgcHVibGljIENvdW50cnkoZmluYWwgU3RyaW5nIGNvdW50cnlJc28sIGZpbmFsIGludCBzb3VyY2UpIHsKKyAgICAgICAgaWYgKGNvdW50cnlJc28gPT0gbnVsbCB8fCBzb3VyY2UgPCBDT1VOVFJZX1NPVVJDRV9ORVRXT1JLCisgICAgICAgICAgICAgICAgfHwgc291cmNlID4gQ09VTlRSWV9TT1VSQ0VfTE9DQUxFKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCk7CisgICAgICAgIH0KKyAgICAgICAgbUNvdW50cnlJc28gPSBjb3VudHJ5SXNvLnRvTG93ZXJDYXNlKCk7CisgICAgICAgIG1Tb3VyY2UgPSBzb3VyY2U7CisgICAgfQorCisgICAgcHVibGljIENvdW50cnkoQ291bnRyeSBjb3VudHJ5KSB7CisgICAgICAgIG1Db3VudHJ5SXNvID0gY291bnRyeS5tQ291bnRyeUlzbzsKKyAgICAgICAgbVNvdXJjZSA9IGNvdW50cnkubVNvdXJjZTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBAcmV0dXJuIHRoZSBJU08gMzE2Ni0xIHR3byBsZXR0ZXJzIGNvdW50cnkgY29kZQorICAgICAqLworICAgIHB1YmxpYyBmaW5hbCBTdHJpbmcgZ2V0Q291bnRyeUlzbygpIHsKKyAgICAgICAgcmV0dXJuIG1Db3VudHJ5SXNvOworICAgIH0KKworICAgIC8qKgorICAgICAqIEByZXR1cm4gd2hlcmUgdGhlIGNvdW50cnkgY29kZSBjYW1lIGZyb20sIGNvdWxkIGJlIG9uZSBvZiBiZWxvdyB2YWx1ZXMKKyAgICAgKiAgICAgICAgIDxwPgorICAgICAqICAgICAgICAgPHVsPgorICAgICAqICAgICAgICAgPGxpPntAbGluayAjQ09VTlRSWV9TT1VSQ0VfTkVUV09SS308L2xpPgorICAgICAqICAgICAgICAgPGxpPntAbGluayAjQ09VTlRSWV9TT1VSQ0VfTE9DQVRJT059PC9saT4KKyAgICAgKiAgICAgICAgIDxsaT57QGxpbmsgI0NPVU5UUllfU09VUkNFX1NJTX08L2xpPgorICAgICAqICAgICAgICAgPGxpPntAbGluayAjQ09VTlRSWV9TT1VSQ0VfTE9DQUxFfTwvbGk+CisgICAgICogICAgICAgICA8L3VsPgorICAgICAqLworICAgIHB1YmxpYyBmaW5hbCBpbnQgZ2V0U291cmNlKCkgeworICAgICAgICByZXR1cm4gbVNvdXJjZTsKKyAgICB9CisKKyAgICBwdWJsaWMgc3RhdGljIGZpbmFsIFBhcmNlbGFibGUuQ3JlYXRvcjxDb3VudHJ5PiBDUkVBVE9SID0gbmV3IFBhcmNlbGFibGUuQ3JlYXRvcjxDb3VudHJ5PigpIHsKKyAgICAgICAgcHVibGljIENvdW50cnkgY3JlYXRlRnJvbVBhcmNlbChQYXJjZWwgaW4pIHsKKyAgICAgICAgICAgIHJldHVybiBuZXcgQ291bnRyeShpbi5yZWFkU3RyaW5nKCksIGluLnJlYWRJbnQoKSk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgQ291bnRyeVtdIG5ld0FycmF5KGludCBzaXplKSB7CisgICAgICAgICAgICByZXR1cm4gbmV3IENvdW50cnlbc2l6ZV07CisgICAgICAgIH0KKyAgICB9OworCisgICAgcHVibGljIGludCBkZXNjcmliZUNvbnRlbnRzKCkgeworICAgICAgICByZXR1cm4gMDsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB3cml0ZVRvUGFyY2VsKFBhcmNlbCBwYXJjZWwsIGludCBmbGFncykgeworICAgICAgICBwYXJjZWwud3JpdGVTdHJpbmcobUNvdW50cnlJc28pOworICAgICAgICBwYXJjZWwud3JpdGVJbnQobVNvdXJjZSk7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIGJvb2xlYW4gZXF1YWxzKE9iamVjdCBvYmplY3QpIHsKKyAgICAgICAgaWYgKG9iamVjdCA9PSB0aGlzKSB7CisgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgfQorICAgICAgICBpZiAob2JqZWN0IGluc3RhbmNlb2YgQ291bnRyeSkgeworICAgICAgICAgICAgQ291bnRyeSBjID0gKENvdW50cnkpIG9iamVjdDsKKyAgICAgICAgICAgIHJldHVybiBtQ291bnRyeUlzby5lcXVhbHMoYy5nZXRDb3VudHJ5SXNvKCkpICYmIG1Tb3VyY2UgPT0gYy5nZXRTb3VyY2UoKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIGludCBoYXNoQ29kZSgpIHsKKyAgICAgICAgaW50IGhhc2ggPSBtSGFzaENvZGU7CisgICAgICAgIGlmIChoYXNoID09IDApIHsKKyAgICAgICAgICAgIGhhc2ggPSAxNzsKKyAgICAgICAgICAgIGhhc2ggPSBoYXNoICogMTMgKyBtQ291bnRyeUlzby5oYXNoQ29kZSgpOworICAgICAgICAgICAgaGFzaCA9IGhhc2ggKiAxMyArIG1Tb3VyY2U7CisgICAgICAgICAgICBtSGFzaENvZGUgPSBoYXNoOworICAgICAgICB9CisgICAgICAgIHJldHVybiBtSGFzaENvZGU7CisgICAgfQorCisgICAgLyoqCisgICAgICogQ29tcGFyZSB0aGUgc3BlY2lmaWVkIGNvdW50cnkgdG8gdGhpcyBjb3VudHJ5IG9iamVjdCBpZ25vcmluZyB0aGUgbVNvdXJjZ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dpbGwgYmUgbm90aWZpZWQgdGhyb3VnaCB0aGUgc3BlY2lmaWMKKyAgICAgKiBsb29wZXIgb25jZSB0aGUgY291bnRyeSBjaGFuZ2VkIGFuZCBkZXRlY3RlZC4KKyAgICAgKi8KKyAgICBwcml2YXRlIGZpbmFsIHN0YXRpYyBjbGFzcyBMaXN0ZW5lclRyYW5zcG9ydCBleHRlbmRzIElDb3VudHJ5TGlzdGVuZXIuU3R1YiB7CisKKyAgICAgICAgcHJpdmF0ZSBmaW5hbCBDb3VudHJ5TGlzdGVuZXIgbUxpc3RlbmVyOworCisgICAgICAgIHByaXZhdGUgZmluYWwgSGFuZGxlciBtSGFuZGxlcjsKKworICAgICAgICBwdWJsaWMgTGlzdGVuZXJUcmFuc3BvcnQoQ291bnRyeUxpc3RlbmVyIGxpc3RlbmVyLCBMb29wZXIgbG9vcGVyKSB7CisgICAgICAgICAgICBtTGlzdGVuZXIgPSBsaXN0ZW5lcjsKKyAgICAgICAgICAgIGlmIChsb29wZXIgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIG1IYW5kbGVyID0gbmV3IEhhbmRsZXIobG9vcGVyKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgbUhhbmRsZXIgPSBuZXcgSGFuZGxlcigpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgb25Db3VudHJ5RGV0ZWN0ZWQoZmluYWwgQ291bnRyeSBjb3VudHJ5KSB7CisgICAgICAgICAgICBtSGFuZGxlci5wb3N0KG5ldyBSdW5uYWJsZSgpIHsKKyAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgICAgICAgICAgICAgIG1MaXN0ZW5lci5vbkNvdW50cnlEZXRlY3RlZChjb3VudHJ5KTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9KTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgZmluYWwgc3Rhd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bmVyVHJhbnNwb3J0IHRyYW5zcG9ydCA9IG5ldyBMaXN0ZW5lclRyYW5zcG9ydChsaXN0ZW5lciwgbG9vcGVyKTsKKyAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICBtU2VydmljZS5hZGRDb3VudHJ5TGlzdGVuZXIodHJhbnNwb3J0KTsKKyAgICAgICAgICAgICAgICAgICAgbUxpc3RlbmVycy5wdXQobGlzdGVuZXIsIHRyYW5zcG9ydCk7CisgICAgICAgICAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAgICAgTG9nLmUoVEFHLCAiYWRkQ291bnRyeUxpc3RlbmVyOiBSZW1vdGVFeGNlcHRpb24iLCBlKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZW1vdmUgdGhlIGxpc3RlbmVyCisgICAgICovCisgICAgcHVibGljIHZvaWQgcmVtb3ZlQ291bnRyeUxpc3RlbmVyKENvdW50cnlMaXN0ZW5lciBsaXN0ZW5lcikgeworICAgICAgICBzeW5jaHJvbml6ZWQgKG1MaXN0ZW5lcnMpIHsKKyAgICAgICAgICAgIExpc3RlbmVyVHJhbnNwb3J0IHRyYW5zcG9ydCA9IG1MaXN0ZW5lcnMuZ2V0KGxpc3RlbmVyKTsKKyAgICAgICAgICAgIGlmICh0cmFuc3BvcnQgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgIG1MaXN0ZW5lcnMucmVtb3ZlKGxpc3RlbmVyKTsKKyAgICAgICAgICAgICAgICAgICAgbVNlcnZpY2UucmVtb3ZlQ291bnRyeUxpc3RlbmVyKHRyYW5zcG9ydCk7CisgICAgICAgICAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAgICAgTG9nLm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B2YWx1ZS5pbnRWYWx1ZSgpKTsKICAgICB9CiAKKyAgICBwdWJsaWMgc3RhdGljIGludCBnZXRGb3JtYXRDb2RlKFN0cmluZyBmaWxlTmFtZSwgU3RyaW5nIG1pbWVUeXBlKSB7CisgICAgICAgIGlmIChtaW1lVHlwZSAhPSBudWxsKSB7CisgICAgICAgICAgICBJbnRlZ2VyIHZhbHVlID0gc01pbWVUeXBlVG9Gb3JtYXRNYXAuZ2V0KG1pbWVUeXBlKTsKKyAgICAgICAgICAgIGlmICh2YWx1ZSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIHZhbHVlLmludFZhbHVlKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgaW50IGxhc3REb3QgPSBmaWxlTmFtZS5sYXN0SW5kZXhPZignLicpOworICAgICAgICBpZiAobGFzdERvdCA+IDApIHsKKyAgICAgICAgICAgIFN0cmluZyBleHRlbnNpb24gPSBmaWxlTmFtZS5zdWJzdHJpbmcobGFzdERvdCArIDEpOworICAgICAgICAgICAgSW50ZWdlciB2YWx1ZSA9IHNGaWxlVHlwZVRvRm9ybWF0TWFwLmdldChleHRlbnNpb24pOworICAgICAgICAgICAgaWYgKHZhbHVlICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gdmFsdWUuaW50VmFsdWUoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4gTXRwQ29uc3RhbnRzLkZPUk1BVF9VTkRFRklORUQ7CisgICAgfQorCisgICAgcHVibGljIHN0YXRpYyBTdHJpbmcgZ2V0TWltZVR5cGVGb3JGb3JtYXRDb2RlKGludCBmb3JtYXRDb2RlKSB7CisgICAgICAgIHJldHVybiBzRm9ybWF0VG9NaW1lVHlwZU1hcC5nZXQoZm9ybWF0Q29kZSk7CisgICAgfQogfQpkaWZmIC0tZ2l0IGEvbWVkaWEvamF2YS9hbmRyb2lkL21lZGlhL01lZGlhUmVjb3JkZXI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Ugdm9pZCBfcHJlcGFyZSgpIHRocm93cyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24sIElPRXhjZXB0aW9uOwogCiAgICAgLyoqCkBAIC01MDMsNiArNjE3LDIyIEBACiAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICB0aHJvdyBuZXcgSU9FeGNlcHRpb24oIk5vIHZhbGlkIG91dHB1dCBmaWxlIik7CiAgICAgICAgIH0KKworICAgICAgICBpZiAobVByZXBhcmVBdXhpbGlhcnlGaWxlKSB7CisgICAgICAgICAgICBpZiAobVBhdGhBdXggIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIEZpbGVPdXRwdXRTdHJlYW0gZm9zID0gbmV3IEZpbGVPdXRwdXRTdHJlYW0obVBhdGhBdXgpOworICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgIF9zZXRPdXRwdXRGaWxlQXV4KGZvcy5nZXRGRCgpKTsKKyAgICAgICAgICAgICAgICB9IGZpbmFsbHkgeworICAgICAgICAgICAgICAgICAgICBmb3MuY2xvc2UoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGVsc2UgaWYgKG1GZEF1eCAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgX3NldE91dHB1dEZpbGVBdXgobUZkQXV4KTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElPRXhjZXB0aW9uKCJObyB2YWxpZCBvdXRwdXQgZmlsZSIpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKICAgICAgICAgX3ByZXBhcmUoKTsKICAgICB9CiAKZGlmZiAtLWdpdCBhL21lZGlhL2phdmEvYW5kcm9pZC9tZWRpYS9NZWRpYVNjYW5uZXIuamF2YSBiL21lZGlhL2phdmEvYW5kcm9pZC9tZWRpYS9NZWRpYVNjYW5uZXIuamF2YQppbmRleCAzMzMzMjY4Li43ZDhlZjU4IDEwMDY0NAotLS0gYS9tZWRpYS9q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N0ZW5lciBsaXN0ZW5lcikgeworICAgICAgICBuYXRpdmVfc2V0dXAoKTsKKyAgICAgICAgaWYgKGxpc3RlbmVyID09IG51bGwpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBOdWxsUG9pbnRlckV4Y2VwdGlvbigiTXRwQ2xpZW50OiBsaXN0ZW5lciBpcyBudWxsIik7CisgICAgICAgIH0KKyAgICAgICAgbUxpc3RlbmVyID0gbGlzdGVuZXI7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHJvdGVjdGVkIHZvaWQgZmluYWxpemUoKSB0aHJvd3MgVGhyb3dhYmxlIHsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIG5hdGl2ZV9maW5hbGl6ZSgpOworICAgICAgICB9IGZpbmFsbHkgeworICAgICAgICAgICAgc3VwZXIuZmluYWxpemUoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyBib29sZWFuIHN0YXJ0KCkgeworICAgICAgICByZXR1cm4gbmF0aXZlX3N0YXJ0KCk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc3RvcCgpIHsKKyAgICAgICAgbmF0aXZlX3N0b3AoKTsKKyAgICB9CisKKyAgICBwdWJsaWMgYm9vbGVhbiBkZWxldGVPYmplY3QoaW50IGRldmljZUlELCBpbnQgb2JqZWN0SUQpIHsKKyAgICAgICAgcmV0dXJuIG5hdGl2ZV9kZWxldGVfb2JqZWN0KGRldmljZUlELCBvYmplY3RJRCk7CisgICAgfQorCisgICAgcHVibGljIGludCBnZXRQYXJlbnQoaW50IGRldmljZUlELCBpbnQgb2JqZWN0SUQpIHsKKyAgICAgICAgcmV0dXJuIG5hdGl2ZV9nZXRfcGFyZW50KGRldmljZUlELCBvYmplY3RJRCk7CisgICAgfQorCisgICAgcHVibGljIGludCBnZXRTdG9yYWdlSUQoaW50IGRldmljZUlELCBpbnQgb2JqZWN0SUQpIHsKKyAgICAgICAgcmV0dXJuIG5hdGl2ZV9nZXRfc3RvcmFnZV9pZChkZXZpY2VJRCwgb2JqZWN0SUQpOworICAgIH0KKworICAgIC8vIGNyZWF0ZSBhIGZpbGUgZGVzY3JpcHRvciBmb3IgcmVhZGluZyB0aGUgY29udGVudHMgb2YgYW4gb2JqZWN0IG92ZXIgTVRQCisgICAgcHVibGljIFBhcmNlbEZpbGVEZXNjcmlwdG9yIG9wZW5GaWxlKGludCBkZXZpY2VJRCwgaW50IG9iamVjdElEKSB7CisgICAgICAgIHJldHVybiBuYXRpdmVfb3Blbl9maWxlKGRldmljZUlELCBvYmplY3RJRCk7CisgICAgfQorCisgICAgcHVibGljIGludGVyZmFjZSBMaXN0ZW5lciB7CisgICAgICAgIC8vIGNhbGxlZCB3aGVuIGEgbmV3IE1UUCBkZXZpY2UgaGFzIGJlZW4gZGlzY292ZXJlZAorICAgICAgICB2b2lkIGRldmljZUFkZGVkKGludCBpZCk7CisKKyAgICAgICAgLy8gY2FsbGVkIHdoZW4gYW4gTVRQIGRldmljZSBoYXMgYmVlbiByZW1vdmVkCisgICAgICAgIHZvaWQgZGV2aWNlUmVtb3ZlZChpbnQgaWQpOworICAgIH0KKworICAgIC8vIGNhbGxlZCBmcm9tIG5hdGl2ZSBjb2RlCisgICAgcHJpdmF0ZSB2b2lkIGRldmljZUFkZGVkKGludCBpZCkgeworICAgICAgICBMb2cuZChUQUcsICJkZXZpY2VBZGRlZCAiICsgaWQpOworICAgICAgICBtTGlzdGVuZXIuZGV2aWNlQWRkZWQoaWQpOworICAgIH0KKworICAgIC8vIGNhbGxlZCBmcm9tIG5hdGl2ZSBjb2RlCisgICAgcHJpdmF0ZSB2b2lkIGRldmljZVJlbW92ZWQoaW50IGlkKSB7CisgICAgICAgIExvZy5kKFRBRywgImRldmljZVJlbW92ZWQgIiArIGlkKTsKKyAgICAgICAgbUxpc3RlbmVyLmRldmljZVJlbW92ZWQoaWQpOworICAgIH0KKworICAgIC8vIHVzZWQgYnkgdGhlIEpOSSBjb2RlCisgICAgcHJpdmF0ZSBpb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KyAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBERVZJQ0UgICAgICAgICAgICAgID0gMTsKKyAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBERVZJQ0VfSUQgICAgICAgICAgID0gMjsKKyAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBTVE9SQUdFICAgICAgICAgICAgID0gMzsKKyAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBTVE9SQUdFX0lEICAgICAgICAgID0gNDsKKyAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBPQkpFQ1QgICAgICAgICAgICAgID0gNTsKKyAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBPQkpFQ1RfSUQgICAgICAgICAgID0gNjsKKyAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBTVE9SQUdFX0NISUxEUkVOICAgID0gNzsKKyAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBPQkpFQ1RfQ0hJTERSRU4gICAgID0gODsKKworICAgIHByaXZhdGUgaW50IG1RdWVyeVR5cGU7CisgICAgcHJpdmF0ZSBpbnQgbURldmljZUlEOworICAgIHByaXZhdGUgaW50IG1TdG9yYWdlSUQ7CisgICAgcHJpdmF0ZSBpbnQgbVFiamVjdElEOworCisgICAgLyoqIFRoZSBuYW1lcyBvZiB0aGUgY29sdW1ucyBpbiB0aGUgcHJvamVjdGlvbiAqLworICAgIHByaXZhdGUgU3RyaW5nW10gbUNvbHVtbnM7CisKKyAgICAvKiogVGhlIG51bWJlciBvZiByb3dzIGluIHRoZSBjdXJzb3IgKi8KKyAgICBwcml2YXRlIGludCBtQ291bnQgPSBOT19DT1VOVDsKKworICAgIHByaXZhdGUgZmluYWwgTXRwQ2xpZW50IG1DbGllbnQ7CisKKyAgICBwdWJsaWMgTXRwQ3Vyc29yKE10cENsaWVudCBjbGllbnQsIGludCBxdWVyeVR5cGUsIGludCBkZXZpY2VJRCwgaW50IHN0b3JhZ2VJRCwgaW50IG9iamVjdElELAorICAgICAgICAgICAgU3RyaW5nW10gcHJvamVjdGlvbikgeworCisgICAgICAgIG1DbGllbnQgPSBjbGllbnQ7CisgICAgICAgIG1RdWVyeVR5cGUgPSBxdWVyeVR5cGU7CisgICAgICAgIG1EZXZpY2VJRCA9IGRldmljZUlEOworICAgICAgICBtU3RvcmFnZUlEID0gc3RvcmFnZUlEOworICAgICAgICBtUWJqZWN0SUQgPSBvYmplY3RJRDsKKyAgICAgICAgbUNvbHVtbnMgPSBwcm9qZWN0aW9uOworCisgICAgICAgIEhhc2hNYXA8U3RyaW5nLCBJbnRlZ2VyPiBtYXA7CisgICAgICAgIHN3aXRjaCAocXVlcnlUeXBlKSB7CisgICAgICAgICAgICBjYXNlIERFVklDRToKKyAgICAgICAgICAgIGNhc2UgREVWSUNFX0lEOgorICAgICAgICAgICAgICAgIG1hcCA9IHNEZXZpY2VQcm9qZWN0aW9uTWFwOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBTVE9SQUdFOgorICAgICAgICAgICAgY2FzZSBTVE9SQUdFX0lEOgorICAgICAgICAgICAgICAgIG1hcCA9IHNTdG9yYWdlUHJvamVjdGlvbk1hcDsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgT0JKRUNUOgorICAgICAgICAgICAgY2FzZSBPQkpFQ1RfSUQ6CisgICAgICAgICAgICBjYXNlIFNUT1JBR0VfQ0hJTERSRU46CisgICAgICAgICAgICBjYXNlIE9CSkVDVF9DSElMRFJFTjoKKyAgICAgICAgICAgICAgICBtYXAgPSBzT2JqZWN0UHJvamVjdGlvbk1hcDsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigidW5rbm93biBxdWVyeSB0eXBlICIgICsgcXVlcnlUeXBlKTsKKyAgICAgICAgfQorCisgICAgICAgIGludFtdIGNvbHVtbnMgPSBuZXcgaW50W3Byb2plY3Rpb24ubGVuZ3RoXTsKKyAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBwcm9qZWN0aW9uLmxlbmd0aDsgaSsrKSB7CisgICAgICAgICAgICBJbnRlZ2VyIGlkID0gbWFwLmdldChwcm9qZWN0aW9uW2ldKTsKKyAgICAgICAgICAgIGlmIChpZCA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigidW5rbm93biBjb2x1bW4gIiAgKyBwcm9qZWN0aW9uW2ldKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNvbHVtbnNbaV0gPSBpZC5pbnRWYWx1ZSgpOworICAgICAgICB9CisgICAgICAgIG5hdGl2ZV9zZXR1cChjbGllbnQsIHF1ZXJ5VHlwZSwgZGV2aWNlSUQsIHN0b3JhZ2VJRCwgb2JqZWN0SUQsIGNvbHVtbnMpOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHByb3RlY3RlZCB2b2lkIGZpbmFsaXplKCkgeworICAgICAgICB0cnkgeworICAgICAgICAgICAgbmF0aXZlX2ZpbmFsaXplKCk7CisgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICBzdXBlci5maW5hbGl6ZSgpOworICAgICAgICB9CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIGludCBnZXRDb3VudCgpIHsKKyAgICAgICAgaWYgKG1Db3VudCA9PSBOT19DT1VOVCkgeworICAgICAgICAgICAgZmlsbFdpbmRvdygwKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbUNvdW50OworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyBib29sZWFuIHJlcXVlcnkoKSB7CisgICAgICAgIExvZy5kKFRBRywgInJlcXVlcnkiKTsKKyAgICAgICAgbUNvdW50ID0gTk9fQ09VTlQ7CisgICAgICAgIGlmIChtV2luZG93ICE9IG51bGwpIHsKKyAgICAgICAgICAgIG1XaW5kb3cuY2xlYXIoKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gc3VwZXIucmVxdWVyeSgpOworICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBmaWxsV2luZG93KGludCBzdGFydFBvcykgeworICAgICAgICBpZiAobVdpbmRvdyA9PSBudWxsKSB7CisgICAgICAgICAgICAvLyBJZiB0aGVyZSBpc24ndCBhIHdpbmRvdyBzZXQgYWxyZWFkeSBpdCB3aWxsIG9ubHkgYmUgYWNjZXNzZWQgbG9jYWxseQorICAgICAgICAgICAgbVdpbmRvdyA9IG5ldyBDdXJzb3JXaW5kb3codHJ1ZSAvKiB0aGUgd2luZG93IGlzIGxvY2FsIG9ubHkgKi8pOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIG1XaW5kb3cuY2xlYXIoKTsKKyAgICAgICAgfQorICAgICAgICBtV2luZG93LnNldFN0YXJ0UG9zaXRpb24oc3RhcnRQb3MpOworICAgICAgICBtQ291bnQgPSBuYXRpdmVfZmlsbF93aW5kb3cobVdpbmRvdywgc3RhcnRQb3MpOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyBTdHJpbmdbXSBnZXRDb2x1bW5OYW1lcygpIHsKKyAgICAgICAgTG9nLmQoVEFHLCAiZ2V0Q29sdW1uTmFtZXMgcmV0dXJuaW5nICIgKyBtQ29sdW1ucyk7CisgICAgICAgIHJldHVybiBtQ29sdW1uczsKKyAgICB9CisKKyAgICAvKiBEZXZpY2UgQ29sdW1uIElEcyAqLworICAgICAvKiBUaGVzZSBtdXN0IG1hdGNoIHRoZSB2YWx1ZXMgaW4gTXRwQ3Vyc29yLmNwcCAqLworICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IERFVklDRV9ST1dfSUQgICAgICAgICAgPSAxOworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBERVZJQ0VfTUFOVUZBQ1RVUkV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YmplY3RDb2x1bW5zLlNJWkUsIC8vIDIKKyAgICB9OworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIFN0cmluZ1tdIE9CSkVDVF9JTkZPX1BST0pFQ1RJT04gPSBuZXcgU3RyaW5nW10geworICAgICAgICAgICAgTXRwT2JqZWN0cy5PYmplY3RDb2x1bW5zLl9JRCwgLy8gMAorICAgICAgICAgICAgTXRwT2JqZWN0cy5PYmplY3RDb2x1bW5zLkRBVEEsIC8vIDEKKyAgICAgICAgICAgIE10cE9iamVjdHMuT2JqZWN0Q29sdW1ucy5GT1JNQVQsIC8vIDIKKyAgICAgICAgICAgIE10cE9iamVjdHMuT2JqZWN0Q29sdW1ucy5QQVJFTlQsIC8vIDMKKyAgICAgICAgICAgIE10cE9iamVjdHMuT2JqZWN0Q29sdW1ucy5TSVpFLCAvLyA0CisgICAgICAgICAgICBNdHBPYmplY3RzLk9iamVjdENvbHVtbnMuREFURV9NT0RJRklFRCwgLy8gNQorICAgIH07CisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgU3RyaW5nIElEX1dIRVJFID0gTXRwT2JqZWN0cy5PYmplY3RDb2x1bW5zLl9JRCArICI9PyI7CisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgU3RyaW5nIFBBVEhfV0hFUkUgPSBNdHBPYmplY3RzLk9iamVjdENvbHVtbnMuREFUQSArICI9PyI7CisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgU3RyaW5nIFBBUkVOVF9XSEVSRSA9IE10cE9iamVjdHMuT2JqZWN0Q29sdW1ucy5QQVJFTlQgKyAiPT8iOworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIFN0cmluZyBQQVJFTlRfRk9STUFUX1dIRVJFID0gUEFSRU5UX1dIRVJFICsgIiBBTkQgIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIE10cE9iamVjdHMuT2JqZWN0Q29sdW1ucy5GT1JNQVQgKyAiPT8iOworCisgICA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CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgb3BlbkRldmljZVByb3BlcnRpZXNEYXRhYmFzZShDb250ZXh0IGNvbnRleHQpIHsKKyAgICAgICAgbURldmljZVByb3BEYiA9IGNvbnRleHQub3Blbk9yQ3JlYXRlRGF0YWJhc2UoImRldmljZS1wcm9wZXJ0aWVzIiwgQ29udGV4dC5NT0RFX1BSSVZBVEUsIG51bGwpOworICAgICAgICBpbnQgdmVyc2lvbiA9IG1EZXZpY2VQcm9wRGIuZ2V0VmVyc2lvbigpOworCisgICAgICAgIC8vIGluaXRpYWxpemUgaWYgbmVjZXNzYXJ5CisgICAgICAgIGlmICh2ZXJzaW9uICE9IERFVklDRV9QUk9QRVJUSUVTX0RBVEFCQVNFX1ZFUlNJT04pIHsKKyAgICAgICAgICAgIG1EZXZpY2VQcm9wRGIuZXhlY1NRTCgiQ1JFQVRFIFRBQkxFIHByb3BlcnRpZXMgKCIgKworICAgICAgICAgICAgICAgICAgICAiX2lkIElOVEVHRVIgUFJJTUFSWSBLRVkgQVVUT0lOQ1JFTUVOVCwiICsKKyAgICAgICAgICAgICAgICAgICAgImNvZGUgSU5URUdFUiBVTklRVUUgT04gQ09ORkxJQ1QgUkVQTEFDRSwiICsKKyAgICAgICAgICAgICAgICAgICAgInZhbHVlIFRFWFQiICsKKyAgICAgICAgICAgICAgICAgICAgIik7Iik7CisgICAgICAgICAgICBtRGV2aWNlUHJvcERiLmV4ZWNTUUwoIkNSRUFURSBJTkRFWCBwcm9wZXJ0eV9pbmRleCBPTiBwcm9wZXJ0aWVzIChjb2RlKTsiKTsKKyAgICAgICAgICAgIG1EZXZpY2VQcm9wRGIuc2V0VmVyc2lvbihERVZJQ0VfUFJPUEVSVElFU19EQVRBQkFTRV9WRVJTSU9OKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgaW50IGJlZ2luU2VuZE9iamVjdChTdHJpbmcgcGF0aCwgaW50IGZvcm1hdCwgaW50IHBhcmVudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICBpbnQgc3RvcmFnZSwgbG9uZyBzaXplLCBsb25nIG1vZGlmaWVkKSB7CisgICAgICAgIG1EYXRhYmFzZU1vZGlmaWVkID0gdHJ1ZTsKKyAgICAgICAgQ29udGVudFZhbHVlcyB2YWx1ZXMgPSBuZXcgQ29udGVudFZhbHVlcygpOworICAgICAgICB2YWx1ZXMucHV0KE10cE9iamVjdHMuT2JqZWN0Q29sdW1ucy5EQVRBLCBwYXRoKTsKKyAgICAgICAgdmFsdWVzLnB1dChNdHBPYmplY3RzLk9iamVjdENvbHVtbnMuRk9STUFULCBmb3JtYXQpOworICAgICAgICB2YWx1ZXMucHV0KE10cE9iamVjdHMuT2JqZWN0Q29sdW1ucy5QQVJFTlQsIHBhcmVudCk7CisgICAgICAgIC8vIHN0b3JhZ2UgaXMgaWdub3JlZCBmb3Igbm93CisgICAgICAgIHZhbHVlcy5wdXQoTXRwT2JqZWN0cy5PYmplY3RDb2x1bW5zLlNJWkUsIHNpemUpOworICAgICAgICB2YWx1ZXMucHV0KE10cE9iamVjdHMuT2JqZWN0Q29sdW1ucy5EQVRFX01PRElGSUVELCBtb2RpZmllZCk7CisKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIFVyaSB1cmkgPSBtTWVkaWFQcm92aWRlci5pbnNlcnQobU9iamVjdHNVcmksIHZhbHVlcyk7CisgICAgICAgICAgICBpZiAodXJpICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gSW50ZWdlci5wYXJzZUludCh1cmkuZ2V0UGF0aFNlZ21lbnRzKCkuZ2V0KDIpKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIC0xOworICAgICAgICAgICAgfQorICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgTG9nLmUoVEFHLCAiUmVtb3RlRXhjZXB0aW9uIGluIGJlZ2luU2VuZE9iamVjdCIsIGUpOworICAgICAgICAgICAgcmV0dXJuIC0xOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIGVuZFNlbmRPYmplY3QoU3RyaW5nIHBhdGgsIGludCBoYW5kbGUsIGludCBmb3JtYXQsIGJvb2xlYW4gc3VjY2VlZGVkKSB7CisgICAgICAgIGlmIChzdWNjZWVkZWQpIHsKKyAgICAgICAgICAgIC8vIGhhbmRsZSBhYnN0cmFjdCBwbGF5bGlzdHMgc2VwYXJhdGVseQorICAgICAgICAgICAgLy8gdGhleSBkbyBub3QgZXhpc3QgaW4gdGhlIGZpbGUgc3lzdGVtIHNvIGRvbid0IHVzZSB0aGUgbWVkaWEgc2Nhbm5lciBoZXJlCisgICAgICAgICAgICBpZiAoZm9ybWF0ID09IE10cENvbnN0YW50cy5GT1JNQVRfQUJTVFJBQ1RfQVZfUExBWUxJU1QpIHsKKyAgICAgICAgICAgICAgICAvLyBTdHJpcCBXaW5kb3dzIE1lZGlhIFBsYXllciBmaWxlIGV4dGVuc2lvbgorICAgICAgICAgICAgICAgIGlmIChwYXRoLmVuZHNXaXRoKCIucGxhIikpIHsKKyAgICAgICAgICAgICAgICAgICAgcGF0aCA9IHBhdGguc3Vic3RyaW5nKDAsIHBhdGgubGVuZ3RoKCkgLSA0KTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAvLyBleHRyYWN0IG5hbWUgZnJvbSBwYXRoCisgICAgICAgICAgICAgICAgU3RyaW5nIG5hbWUgPSBwYXRoOworICAgICAgICAgICAgICAgIGludCBsYXN0U2xhc2ggPSBuYW1lLmxhc3RJbmRleE9mKCcvJyk7CisgICAgICAgICAgICAgICAgaWYgKGxhc3RTbGFzaCA+PSAwKSB7CisgICAgICAgICAgICAgICAgICAgIG5hbWUgPSBuYW1lLnN1YnN0cmluZyhsYXN0U2xhc2ggKyAxKTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBDb250ZW50VmFsdWVzIHZhbHVlcyA9IG5ldyBDb250ZW50VmFsdWVzKDEpOworICAgICAgICAgICAgICAgIHZhbHVlcy5wdXQoQXVkaW8uUGxheWxpc3RzLkRBVEEsIHBhdGgpOworICAgICAgICAgICAgICAgIHZhbHVlcy5wdXQoQXVkaW8uUGxheWxpc3RzLk5BTUUsIG5hbWUpOworICAgICAgICAgICAgICAgIHZhbHVlcy5wdXQoTWVkaWFDb2x1bW5zLk1FRElBX1NDQU5ORVJfTkVXX09CSkVDVF9JRCwgaGFuZGxlKTsKKyAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICBVcmkgdXJpID0gbU1lZGlhUHJvdmlkZXIuaW5zZXJ0KEF1ZGlvLlBsYXlsaXN0cy5FWFRFUk5BTF9DT05URU5UX1VSSSwgdmFsdWVzKTsKKyAgICAgICAgICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICBMb2cuZShUQUcsICJSZW1vdGVFeGNlcHRpb24gaW4gZW5kU2VuZE9iamVjdCIsIGUpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgVXJpIHVyaSA9IG1NZWRpYVNjYW5uZXIuc2Nhbk10cEZpbGUocGF0aCwgbVZvbHVtZU5hbWUsIGhhbmRsZSwgZm9ybWF0KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGRlbGV0ZUZpbGUoaGFuZGxlKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgaW50W10gZ2V0T2JqZWN0TGlzdChpbnQgc3RvcmFnZUlELCBpbnQgZm9ybWF0LCBpbnQgcGFyZW50KSB7CisgICAgICAgIC8vIHdlIGNhbiBpZ25vcmUgc3RvcmFnZUlEIHVudGlsIHdlIHN1cHBvcnQgbXVsdGlwbGUgc3RvcmFnZXMKKyAgICAgICAgTG9nLmQoVEFHLCAiZ2V0T2JqZWN0TGlzdCBwYXJlbnQ6ICIgKyBwYXJlbnQpOworICAgICAgICBDdXJzb3IgYyA9IG51bGw7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBpZiAoZm9ybWF0ICE9IDApIHsKKyAgICAgICAgICAgICAgICBjID0gbU1lZGlhUHJvdmlkZXIucXVlcnkobU9iamVjdHNVcmksIElEX1BST0pFQ1RJT04sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgUEFSRU5UX0ZPUk1BVF9XSEVSRSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXcgU3RyaW5nW10geyBJbnRlZ2VyLnRvU3RyaW5nKHBhcmVudCksIEludGVnZXIudG9TdHJpbmcoZm9ybWF0KSB9LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBudWxsKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgYyA9IG1NZWRpYVByb3ZpZGVyLnF1ZXJ5KG1PYmplY3RzVXJpLCBJRF9QUk9KRUNUSU9OLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBBUkVOVF9XSEVSRSwgbmV3IFN0cmluZ1tdIHsgSW50ZWdlci50b1N0cmluZyhwYXJlbnQpIH0sIG51bGwpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKGMgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIExvZy5kKFRBRywgIm51bGwgY3Vyc29yIik7CisgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpbnQgY291bnQgPSBjLmdldENvdW50KCk7CisgICAgICAgICAgICBpZiAoY291bnQgPiAwKSB7CisgICAgICAgICAgICAgICAgaW50W10gcmVzdWx0ID0gbmV3IGludFtjb3VudF07CisgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBjb3VudDsgaSsrKSB7CisgICAgICAgICAgICAgICAgICAgIGMubW92ZVRvTmV4dCgpOworICAgICAgICAgICAgICAgICAgICByZXN1bHRbaV0gPSBjLmdldEludCgwKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAicmV0dXJuaW5nICIgKyByZXN1bHQpOworICAgICAgICAgICAgICAgIHJldHVybiByZXN1bHQ7CisgICAgICAgICAgICB9CisgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICBMb2cuZShUQUcsICJSZW1vdGVFeGNlcHRpb24gaW4gZ2V0T2JqZWN0TGlzdCIsIGUpOworICAgICAgICB9IGZpbmFsbHkgeworICAgICAgICAgICAgaWYgKGMgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGMuY2xvc2UoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbnVsbDsKKyAgICB9CisKKyAgICBwcml2YXRlIGludCBnZXROdW1PYmplY3RzKGludCBzdG9yYWdlSUQsIGludCBmb3JtYXQsIGludCBwYXJlbnQpIHsKKyAgICAgICAgLy8gd2UgY2FuIGlnbm9yZSBzdG9yYWdlSUQgdW50aWwgd2Ugc3VwcG9ydCBtdWx0aXBsZSBzdG9yYWdlcworICAgICAgICBMb2cuZChUQUcsICJnZXRPYmplY3RMaXN0IHBhcmVudDogIiArIHBhcmVudCk7CisgICAgICAgIEN1cnNvciBjID0gbnVsbDsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIGlmIChmb3JtYXQgIT0gMCkgeworICAgICAgICAgICAgICAgIGMgPSBtTWVkaWFQcm92aWRlci5xdWVyeShtT2JqZWN0c1VyaSwgSURfUFJPSkVDVElPTiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBQQVJFTlRfRk9STUFUX1dIRVJFLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBTdHJpbmdbXSB7IEludGVnZXIudG9TdHJpbmcocGFyZW50KSwgSW50ZWdlci50b1N0cmluZyhmb3JtYXQpIH0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBjID0gbU1lZGlhUHJvdmlkZXIucXVlcnkobU9iamVjdHNVcmksIElEX1BST0pFQ1RJT04sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgUEFSRU5UX1dIRVJFLCBuZXcgU3RyaW5nW10geyBJbnRlZ2VyLnRvU3RyaW5nKHBhcmVudCkgfSwgbnVsbCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoYyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIGMuZ2V0Q291bnQoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIExvZy5lKFRBRywgIlJlbW90ZUV4Y2VwdGlvbiBpbiBnZXROdW1PYmplY3RzIiwgZSk7CisgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICBpZiAoYyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgYy5jbG9zZSgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiAtMTsKKyAgICB9CisKKyAgICBwcml2YXRlIGludFtdIGdldFN1cHBvcnRlZFBsYXliYWNrRm9ybWF0cygpIHsKKyAgICAgICAgcmV0dXJuIG5ldyBpbnRbXSB7CisgICAgICAgICAgICBNdHBDb25zdGFudHMuRk9STUFUX0FTU09DSUFUSU9OLAorICAgICAgICAgICAgTXRwQ29uc3RhbnRzLkZPUk1BVF9NUDMsCisgICAgICAgICAgICBNdHBDb25zdGFudHMuRk9STUFUX01QRUcsCisgICAgICAgICAgICBNdHBDb25zdGFudHMuRk9STUFUX0VYSUZfSlBFRywKKyAgICAgICAgICAgIE10cENvbnN0YW50cy5GT1JNQVRfVElGRl9FUCwKKyAgICAgICAgICAgIE10cENvbnN0YW50cy5GT1JNQVRfR0lGLAorICAgICAgICAgICAgTXRwQ29uc3RhbnRzLkZPUk1BVF9KRklGLAorICAgICAgICAgICAgTXRwQ29uc3RhbnRzLkZPUk1BVF9QTkcsCisgICAgICAgICAgICBNdHBDb25zdGFudHMuRk9STUFUX1RJRkYsCisgICAgICAgICAgICBNdHBDb25zdGFudHMuRk9STUFUX1dNQSwKKyAgICAgICAgICAgIE10cENvbnN0YW50cy5GT1JNQVRfT0dHLAorICAgICAgICAgICAgTXRwQ29uc3RhbnRzLkZPUk1BVF9BQUMsCisgICAgICAgICAgICBNdHBDb25zdGFudHMuRk9STUFUX01QNF9DT05UQUlORVIsCisgICAgICAgICAgICBNdHBDb25zdGFudHMuRk9STUFUX01QMiwKKyAgICAgICAgICAgIE10cENvbnN0YW50cy5GT1JNQVRfM0dQX0NPTlRBSU5FUiwKKyAgICAgICAgICAgIE10cENvbnN0YW50cy5GT1JNQVRfQUJTVFJBQ1RfQVZfUExBWUxJU1QsCisgICAgICAgICAgICBNdHBDb25zdGFudHMuRk9STUFUX1dQTF9QTEFZTElTVCwKKyAgICAgICAgICAgIE10cENvbnN0YW50cy5GT1JNQVRfTTNVX1BMQVlMSVNULAorICAgICAgICAgICAgTXRwQ29uc3RhbnRzLkZPUk1BVF9QTFNfUExBWUxJU1QsCisgICAgICAgIH07CisgICAgfQorCisgICAgcHJpdmF0ZSBpbnRbXSBnZXRTdXBwb3J0ZWRDYXB0dXJlRm9ybWF0cygpIHsKKyAgICAgICAgLy8gbm8gY2FwdHVyZSBmb3JtYXRzIHlldAorICAgICAgICByZXR1cm4gbnVsbDsKKyAgICB9CisKKyAgICBwcml2YXRlIGludFtdIGdldFN1cHBvcnRlZE9iamVjdFByb3BlcnRpZXMoaW50IGhhbmRsZSkgeworICAgICAgICByZXR1cm4gbmV3IGludFtdIHsKKyAgICAgICAgICAgIE10cENvbnN0YW50cy5QUk9QRVJUWV9TVE9SQUdFX0lELAorICAgICAgICAgICAgTXRwQ29uc3RhbnRzLlBST1BFUlRZX09CSkVDVF9GT1JNQVQsCisgICAgICAgICAgICBNdHBDb25zdGFudHMuUFJPUEVSVFlfT0JKRUNUX1NJWkUsCisgICAgICAgICAgICBNdHBDb25zdGFudHMuUFJPUEVSVFlfT0JKRUNUX0ZJTEVfTkFNRSwKKyAgICAgICAgICAgIE10cENvbnN0YW50cy5QUk9QRVJUWV9QQVJFTlRfT0JKRUNULAorICAgICAgICB9OworICAgIH0KKworICAgIHByaXZhdGUgaW50W10gZ2V0U3VwcG9ydGVkRGV2aWNlUHJvcGVydGllcygpIHsKKyAgICAgICAgcmV0dXJuIG5ldyBpbnRbXSB7CisgICAgICAgICAgICBNdHBDb25zdGFudHMuREVWSUNFX1BST1BFUlRZX1NZTkNIUk9OSVpBVElPTl9QQVJUTkVSLAorICAgICAgICAgICAgTXRwQ29uc3RhbnRzLkRFVklDRV9QUk9QRVJUWV9ERVZJQ0VfRlJJRU5ETFlfTkFNRSwKKyAgICAgICAgfTsKKyAgICB9CisKKyAgICBwcml2YXRlIGludCBnZXRPYmplY3RQcm9wZXJ0eShpbnQgaGFuZGxlLCBpbnQgcHJvcGVydHksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbG9uZ1tdIG91dEludFZhbHVlLCBjaGFyW10gb3V0U3RyaW5nVmFsdWUpIHsKKyAgICAgICAgTG9nLmQoVEFHLCAiZ2V0T2JqZWN0UHJvcGVydHk6ICIgKyBwcm9wZXJ0eSk7CisgICAgICAgIFN0cmluZyBjb2x1bW4gPSBudWxsOworICAgICAgICBib29sZWFuIGlzU3RyaW5nID0gZmFsc2U7CisKKyAgICAgICAgc3dpdGNoIChwcm9wZXJ0eSkgeworICAgICAgICAgICAgY2FzZSBNdHBDb25zdGFudHMuUFJPUEVSVFlfU1RPUkFHRV9JRDoKKyAgICAgICAgICAgICAgICBvdXRJbnRWYWx1ZVswXSA9IG1TdG9yYWdlSUQ7CisgICAgICAgICAgICAgICAgcmV0dXJuIE10cENvbnN0YW50cy5SRVNQT05TRV9PSzsKKyAgICAgICAgICAgIGNhc2UgTXRwQ29uc3RhbnRzLlBST1BFUlRZX09CSkVDVF9GT1JNQVQ6CisgICAgICAgICAgICAgICAgY29sdW1uID0gTXRwT2JqZWN0cy5PYmplY3RDb2x1bW5zLkZPUk1BVDsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgTXRwQ29uc3RhbnRzLlBST1BFUlRZX1BST1RFQ1RJT05fU1RBVFVTOgorICAgICAgICAgICAgICAgIC8vIHByb3RlY3Rpb24gc3RhdHVzIGlzIGFsd2F5cyAwCisgICAgICAgICAgICAgICAgb3V0SW50VmFsdWVbMF0gPSAwOworICAgICAgICAgICAgICAgIHJldHVybiBNdHBDb25zdGFudHMuUkVTUE9OU0VfT0s7CisgICAgICAgICAgICBjYXNlIE10cENvbnN0YW50cy5QUk9QRVJUWV9PQkpFQ1RfU0laRToKKyAgICAgICAgICAgICAgICBjb2x1bW4gPSBNdHBPYmplY3RzLk9iamVjdENvbHVtbnMuU0laRTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgTXRwQ29uc3RhbnRzLlBST1BFUlRZX09CSkVDVF9GSUxFX05BTUU6CisgICAgICAgICAgICAgICAgY29sdW1uID0gTXRwT2JqZWN0cy5PYmplY3RDb2x1bW5zLkRBVEE7CisgICAgICAgICAgICAgICAgaXNTdHJpbmcgPSB0cnVlOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBNdHBDb25zdGFudHMuUFJPUEVSVFlfREFURV9NT0RJRklFRDoKKyAgICAgICAgICAgICAgICBjb2x1bW4gPSBNdHBPYmplY3RzLk9iamVjdENvbHVtbnMuREFURV9NT0RJRklFRDsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgTXRwQ29uc3RhbnRzLlBST1BFUlRZX1BBUkVOVF9PQkpFQ1Q6CisgICAgICAgICAgICAgICAgY29sdW1uID0gTXRwT2JqZWN0cy5PYmplY3RDb2x1bW5zLlBBUkVOVDsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgTXRwQ29uc3RhbnRzLlBST1BFUlRZX1BFUlNJU1RFTlRfVUlEOgorICAgICAgICAgICAgICAgIC8vIFBVSUQgaXMgY29uY2F0ZW5hdGlvbiBvZiBzdG9yYWdlSUQgYW5kIG9iamVjdCBoYW5kbGUKKyAgICAgICAgICAgICAgICBsb25nIHB1aWQgPSBtU3RvcmFnZUlEOworICAgICAgICAgICAgICAgIHB1aWQgPDw9IDMyOworICAgICAgICAgICAgICAgIHB1aWQgKz0gaGFuZGxlOworICAgICAgICAgICAgICAgIG91dEludFZhbHVlWzBdID0gcHVpZDsKKyAgICAgICAgICAgICAgICByZXR1cm4gTXRwQ29uc3RhbnRzLlJFU1BPTlNFX09LOworICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICByZXR1cm4gTXRwQ29uc3RhbnRzLlJFU1BPTlNFX09CSkVDVF9QUk9QX05PVF9TVVBQT1JURUQ7CisgICAgICAgIH0KKworICAgICAgICBDdXJzb3IgYyA9IG51bGw7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICAvLyBmb3Igbm93IHdlIGFyZSBvbmx5IHJlYWRpbmcgcHJvcGVydGllcyBmcm9tIHRoZSAib2JqZWN0cyIgdGFibGUKKyAgICAgICAgICAgIGMgPSBtTWVkaWFQcm92aWRlci5xdWVyeShtT2JqZWN0c1VyaSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXcgU3RyaW5nIFtdIHsgTXRwT2JqZWN0cy5PYmplY3RDb2x1bW5zLl9JRCwgY29sdW1uIH0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgSURfV0hFUkUsIG5ldyBTdHJpbmdbXSB7IEludGVnZXIudG9TdHJpbmcoaGFuZGxlKSB9LCBudWxsKTsKKyAgICAgICAgICAgIGlmIChjICE9IG51bGwgJiYgYy5tb3ZlVG9OZXh0KCkpIHsKKyAgICAgICAgICAgICAgICBpZiAoaXNTdHJpbmcpIHsKKyAgICAgICAgICAgICAgICAgICAgU3RyaW5nIHZhbHVlID0gYy5nZXRTdHJpbmcoMSk7CisgICAgICAgICAgICAgICAgICAgIGludCBzdGFydCA9IDA7CisKKyAgICAgICAgICAgICAgICAgICAgaWYgKHByb3BlcnR5ID09IE10cENvbnN0YW50cy5QUk9QRVJUWV9PQkpFQ1RfRklMRV9OQU1FKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAvLyBleHRyYWN0IG5hbWUgZnJvbSBmdWxsIHBhdGgKKyAgICAgICAgICAgICAgICAgICAgICAgIGludCBsYXN0U2xhc2ggPSB2YWx1ZS5sYXN0SW5kZXhPZignLycpOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGxhc3RTbGFzaCA+PSAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhcnQgPSBsYXN0U2xhc2ggKyAxOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGludCBlbmQgPSB2YWx1ZS5sZW5ndGgoKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGVuZCAtIHN0YXJ0ID4gMjU1KSB7CisgICAgICAgICAgICAgICAgICAgICAgICBlbmQgPSBzdGFydCArIDI1NTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB2YWx1ZS5nZXRDaGFycyhzdGFydCwgZW5kLCBvdXRTdHJpbmdWYWx1ZSwgMCk7CisgICAgICAgICAgICAgICAgICAgIG91dFN0cmluZ1ZhbHVlW2VuZCAtIHN0YXJ0XSA9IDA7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgb3V0SW50VmFsdWVbMF0gPSBjLmdldExvbmcoMSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHJldHVybiBNdHBDb25zdGFudHMuUkVTUE9OU0VfT0s7CisgICAgICAgICAgICB9CisgICAgICAgIH0gY2F0Y2ggKEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICByZXR1cm4gTXRwQ29uc3RhbnRzLlJFU1BPTlNFX0dFTkVSQUxfRVJST1I7CisgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICBpZiAoYyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgYy5jbG9zZSgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIC8vIHF1ZXJ5IGZhaWxlZCBpZiB3ZSBnZXQgaGVyZQorICAgICAgICByZXR1cm4gTXRwQ29uc3RhbnRzLlJFU1BPTlNFX0lOVkFMSURfT0JKRUNUX0hBTkRMRTsKKyAgICB9CisKKyAgICBwcml2YXRlIGludCBzZXRPYmplY3RQcm9wZXJ0eShpbnQgaGFuZGxlLCBpbnQgcHJvcGVydHksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbG9uZyBpbnRWYWx1ZSwgU3RyaW5nIHN0cmluZ1ZhbHVlKSB7CisgICAgICAgIExvZy5kKFRBRywgInNldE9iamVjdFByb3BlcnR5OiAiICsgcHJvcGVydHkpOworICAgICAgICByZXR1cm4gTXRwQ29uc3RhbnRzLlJFU1BPTlNFX09CSkVDVF9QUk9QX05PVF9TVVBQT1JURUQ7CisgICAgfQorCisgICAgcHJpdmF0ZSBpbnQgZ2V0RGV2aWNlUHJvcGVydHkoaW50IHByb3BlcnR5LCBsb25nW10gb3V0SW50VmFsdWUsIGNoYXJbXSBvdXRTdHJpbmdWYWx1ZSkgeworICAgICAgICBMb2cuZChUQUcsICJnZXREZXZpY2VQcm9wZXJ0eTogIiArIHByb3BlcnR5KTsKKworICAgICAgICBzd2l0Y2ggKHByb3BlcnR5KSB7CisgICAgICAgICAgICBjYXNlIE10cENvbnN0YW50cy5ERVZJQ0VfUFJPUEVSVFlfU1lOQ0hST05JWkFUSU9OX1BBUlRORVI6CisgICAgICAgICAgICBjYXNlIE10cENvbnN0YW50cy5ERVZJQ0VfUFJPUEVSVFlfREVWSUNFX0ZSSUVORExZX05BTUU6CisgICAgICAgICAgICAgICAgLy8gd3JpdGFibGUgc3RyaW5nIHByb3BlcnRpZXMga2VwdCBpbiBvdXIgZGV2aWNlIHByb3BlcnR5IGRhdGFiYXNlCisgICAgICAgICAgICAgICAgQ3Vyc29yIGMgPSBudWxsOworICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgIGMgPSBtRGV2aWNlUHJvcERiLnF1ZXJ5KCJwcm9wZXJ0aWVzIiwgREVWSUNFX1BST1BFUlRZX1BST0pFQ1RJT04sCisgICAgICAgICAgICAgICAgICAgICAgICBERVZJQ0VfUFJPUEVSVFlfV0hFUkUsIG5ldyBTdHJpbmdbXSB7ICBJbnRlZ2VyLnRvU3RyaW5nKHByb3BlcnR5KSB9LAorICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwgbnVsbCwgbnVsbCk7CisKKyAgICAgICAgICAgICAgICAgICAgaWYgKGMgIT0gbnVsbCAmJiBjLm1vdmVUb05leHQoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgU3RyaW5nIHZhbHVlID0gYy5nZXRTdHJpbmcoMSk7CisgICAgICAgICAgICAgICAgICAgICAgICBpbnQgbGVuZ3RoID0gdmFsdWUubGVuZ3RoKCk7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAobGVuZ3RoID4gMjU1KSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGVuZ3RoID0gMjU1OworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWUuZ2V0Q2hhcnMoMCwgbGVuZ3RoLCBvdXRTdHJpbmdWYWx1ZSwgMCk7CisgICAgICAgICAgICAgICAgICAgICAgICBvdXRTdHJpbmdWYWx1ZVtsZW5ndGhdID0gMDsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG91dFN0cmluZ1ZhbHVlWzBdID0gMDsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICByZXR1cm4gTXRwQ29uc3RhbnRzLlJFU1BPTlNFX09LOworICAgICAgICAgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICAgICAgICAgIGlmIChjICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGMuY2xvc2UoKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiBNdHBDb25zdGFudHMuUkVTUE9OU0VfREVWSUNFX1BST1BfTk9UX1NVUFBPUlRFRDsKKyAgICB9CisKKyAgICBwcml2YXRlIGludCBzZXREZXZpY2VQcm9wZXJ0eShpbnQgcHJvcGVydHksIGxvbmcgaW50VmFsdWUsIFN0cmluZyBzdHJpbmdWYWx1ZSkgeworICAgICAgICBMb2cuZChUQUcsICJzZXREZXZpY2VQcm9wZXJ0eTogIiArIHByb3BlcnR5ICsgIiA6ICIgKyBzdHJpbmdWYWx1ZSk7CisKKyAgICAgICAgc3dpdGNoIChwcm9wZXJ0eSkgeworICAgICAgICAgICAgY2FzZSBNdHBDb25zdGFudHMuREVWSUNFX1BST1BFUlRZX1NZTkNIUk9OSVpBVElPTl9QQVJUTkVSOgorICAgICAgICAgICAgY2FzZSBNdHBDb25zdGFudHMuREVWSUNFX1BST1BFUlRZX0RFVklDRV9GUklFTkRMWV9OQU1FOgorICAgICAgICAgICAgICAgIC8vIHdyaXRhYmxlIHN0cmluZyBwcm9wZXJ0aWVzIGtlcHQgaW4gb3VyIGRldmljZSBwcm9wZXJ0eSBkYXRhYmFzZQorICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgIENvbnRlbnRWYWx1ZXMgdmFsdWVzID0gbmV3IENvbnRlbnRWYWx1ZXMoKTsKKyAgICAgICAgICAgICAgICAgICAgdmFsdWVzLnB1dCgiY29kZSIsIHByb3BlcnR5KTsKKyAgICAgICAgICAgICAgICAgICAgdmFsdWVzLnB1dCgidmFsdWUiLCBzdHJpbmdWYWx1ZSk7CisgICAgICAgICAgICAgICAgICAgIG1EZXZpY2VQcm9wRGIuaW5zZXJ0KCJwcm9wZXJ0aWVzIiwgImNvZGUiLCB2YWx1ZXMpOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gTXRwQ29uc3RhbnRzLlJFU1BPTlNFX09LOworICAgICAgICAgICAgICAgIH0gY2F0Y2ggKEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBNdHBDb25zdGFudHMuUkVTUE9OU0VfR0VORVJBTF9FUlJPUjsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gTXRwQ29uc3RhbnRzLlJFU1BPTlNFX0RFVklDRV9QUk9QX05PVF9TVVBQT1JURUQ7CisgICAgfQorCisgICAgcHJpdmF0ZSBib29sZWFuIGdldE9iamVjdEluZm8oaW50IGhhbmRsZSwgaW50W10gb3V0U3RvcmFnZUZvcm1hdFBhcmVudCwKKyAgICAgICAgICAgICAgICAgICAgICAgIGNoYXJbXSBvdXROYW1lLCBsb25nW10gb3V0U2l6ZU1vZGlmaWVkKSB7CisgICAgICAgIExvZy5kKFRBRywgImdldE9iamVjdEluZm86ICIgKyBoYW5kbGUpOworICAgICAgICBDdXJzb3IgYyA9IG51bGw7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBjID0gbU1lZGlhUHJvdmlkZXIucXVlcnkobU9iamVjdHNVcmksIE9CSkVDVF9JTkZPX1BST0pFQ1RJT04sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgSURfV0hFUkUsIG5ldyBTdHJpbmdbXSB7ICBJbnRlZ2VyLnRvU3RyaW5nKGhhbmRsZSkgfSwgbnVsbCk7CisgICAgICAgICAgICBpZiAoYyAhPSBudWxsICYmIGMubW92ZVRvTmV4dCgpKSB7CisgICAgICAgICAgICAgICAgb3V0U3RvcmFnZUZvcm1hdFBhcmVudFswXSA9IG1TdG9yYWdlSUQ7CisgICAgICAgICAgICAgICAgb3V0U3RvcmFnZUZvcm1hdFBhcmVudFsxXSA9IGMuZ2V0SW50KDIpOworICAgICAgICAgICAgICAgIG91dFN0b3JhZ2VGb3JtYXRQYXJlbnRbMl0gPSBjLmdldEludCgzKTsKKworICAgICAgICAgICAgICAgIC8vIGV4dHJhY3QgbmFtZSBmcm9tIHBhdGgKKyAgICAgICAgICAgICAgICBTdHJpbmcgcGF0aCA9IGMuZ2V0U3RyaW5nKDEpOworICAgICAgICAgICAgICAgIGludCBsYXN0U2xhc2ggPSBwYXRoLmxhc3RJbmRleE9mKCcvJyk7CisgICAgICAgICAgICAgICAgaW50IHN0YXJ0ID0gKGxhc3RTbGFzaCA+PSAwID8gbGFzdFNsYXNoICsgMSA6IDApOworICAgICAgICAgICAgICAgIGludCBlbmQgPSBwYXRoLmxlbmd0aCgpOworICAgICAgICAgICAgICAgIGlmIChlbmQgLSBzdGFydCA+IDI1NSkgeworICAgICAgICAgICAgICAgICAgICBlbmQgPSBzdGFydCArIDI1NTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcGF0aC5nZXRDaGFycyhzdGFydCwgZW5kLCBvdXROYW1lLCAwKTsKKyAgICAgICAgICAgICAgICBvdXROYW1lW2VuZCAtIHN0YXJ0XSA9IDA7CisKKyAgICAgICAgICAgICAgICBvdXRTaXplTW9kaWZpZWRbMF0gPSBjLmdldExvbmcoNCk7CisgICAgICAgICAgICAgICAgb3V0U2l6ZU1vZGlmaWVkWzFdID0gYy5nZXRMb25nKDUpOworICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgfQorICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgTG9nLmUoVEFHLCAiUmVtb3RlRXhjZXB0aW9uIGluIGdldE9iamVjdFByb3BlcnR5IiwgZSk7CisgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICBpZiAoYyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgYy5jbG9zZSgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKKyAgICBwcml2YXRlIGludCBnZXRPYmplY3RGaWxlUGF0aChpbnQgaGFuZGxlLCBjaGFyW10gb3V0RmlsZVBhdGgsIGxvbmdbXSBvdXRGaWxlTGVuZ3RoKSB7CisgICAgICAgIExvZy5kKFRBRywgImdldE9iamVjdEZpbGVQYXRoOiAiICsgaGFuZGxlKTsKKyAgICAgICAgQ3Vyc29yIGMgPSBudWxsOworICAgICAgICB0cnkgeworICAgICAgICAgICAgYyA9IG1NZWRpYVByb3ZpZGVyLnF1ZXJ5KG1PYmplY3RzVXJpLCBQQVRIX1NJWkVfUFJPSkVDVElPTiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBJRF9XSEVSRSwgbmV3IFN0cmluZ1tdIHsgIEludGVnZXIudG9TdHJpbmcoaGFuZGxlKSB9LCBudWxsKTsKKyAgICAgICAgICAgIGlmIChjICE9IG51bGwgJiYgYy5tb3ZlVG9OZXh0KCkpIHsKKyAgICAgICAgICAgICAgICBTdHJpbmcgcGF0aCA9IGMuZ2V0U3RyaW5nKDEpOworICAgICAgICAgICAgICAgIHBhdGguZ2V0Q2hhcnMoMCwgcGF0aC5sZW5ndGgoKSwgb3V0RmlsZVBhdGgsIDApOworICAgICAgICAgICAgICAgIG91dEZpbGVQYXRoW3BhdGgubGVuZ3RoKCldID0gMDsKKyAgICAgICAgICAgICAgICBvdXRGaWxlTGVuZ3RoWzBdID0gYy5nZXRMb25nKDIpOworICAgICAgICAgICAgICAgIHJldHVybiBNdHBDb25zdGFudHMuUkVTUE9OU0VfT0s7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHJldHVybiBNdHBDb25zdGFudHMuUkVTUE9OU0VfSU5WQUxJRF9PQkpFQ1RfSEFORExFOworICAgICAgICAgICAgfQorICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgTG9nLmUoVEFHLCAiUmVtb3RlRXhjZXB0aW9uIGluIGdldE9iamVjdEZpbGVQYXRoIiwgZSk7CisgICAgICAgICAgICByZXR1cm4gTXRwQ29uc3RhbnRzLlJFU1BPTlNFX0dFTkVSQUxfRVJST1I7CisgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICBpZiAoYyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgYy5jbG9zZSgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSBpbnQgZGVsZXRlRmlsZShpbnQgaGFuZGxlKSB7CisgICAgICAgIExvZy5kKFRBRywgImRlbGV0ZUZpbGU6ICIgKyBoYW5kbGUpOworICAgICAgICBtRGF0YWJhc2VNb2RpZmllZCA9IHRydWU7CisgICAgICAgIFVyaSB1cmkgPSBNdHBPYmplY3RzLmdldENvbnRlbnRVcmkobVZvbHVtZU5hbWUsIGhhbmRsZSk7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBpZiAobU1lZGlhUHJvdmlkZXIuZGVsZXRlKHVyaSwgbnVsbCwgbnVsbCkgPT0gMSkgeworICAgICAgICAgICAgICAgIHJldHVybiBNdHBDb25zdGFudHMuUkVTUE9OU0VfT0s7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHJldHVybiBNdHBDb25zdGFudHMuUkVTUE9OU0VfSU5WQUxJRF9PQkpFQ1RfSEFORExFOworICAgICAgICAgICAgfQorICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgTG9nLmUoVEFHLCAiUmVtb3RlRXhjZXB0aW9uIGluIGRlbGV0ZUZpbGUiLCBlKTsKKyAgICAgICAgICAgIHJldHVybiBNdHBDb25zdGFudHMuUkVTUE9OU0VfR0VORVJBTF9FUlJPUjsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgaW50W10gZ2V0T2JqZWN0UmVmZXJlbmNlcyhpbnQgaGFuZGxlKSB7CisgICAgICAgIExvZy5kKFRBRywgImdldE9iamVjdFJlZmVyZW5jZXMgZm9yOiAiICsgaGFuZGxlKTsKKyAgICAgICAgVXJpIHVyaSA9IE10cE9iamVjdHMuZ2V0UmVmZXJlbmNlc1VyaShtVm9sdW1lTmFtZSwgaGFuZGxlKTsKKyAgICAgICAgQ3Vyc29yIGMgPSBudWxsOworICAgICAgICB0cnkgeworICAgICAgICAgICAgYyA9IG1NZWRpYVByb3ZpZGVyLnF1ZXJ5KHVyaSwgSURfUFJPSkVDVElPTiwgbnVsbCwgbnVsbCwgbnVsbCk7CisgICAgICAgICAgICBpZiAoYyA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpbnQgY291bnQgPSBjLmdldENvdW50KCk7CisgICAgICAgICAgICBpZiAoY291bnQgPiAwKSB7CisgICAgICAgICAgICAgICAgaW50W10gcmVzdWx0ID0gbmV3IGludFtjb3VudF07CisgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBjb3VudDsgaSsrKSB7CisgICAgICAgICAgICAgICAgICAgIGMubW92ZVRvTmV4dCgpOworICAgICAgICAgICAgICAgICAgICByZXN1bHRbaV0gPSBjLmdldEludCgwKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcmV0dXJuIHJlc3VsdDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIExvZy5lKFRBRywgIlJlbW90ZUV4Y2VwdGlvbiBpbiBnZXRPYmplY3RMaXN0IiwgZSk7CisgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICBpZiAoYyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgYy5jbG9zZSgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiBudWxsOworICAgIH0KKworICAgIHByaXZhdGUgaW50IHNldE9iamVjdFJlZmVyZW5jZXMoaW50IGhhbmRsZSwgaW50W10gcmVmZXJlbmNlcykgeworICAgICAgICBtRGF0YWJhc2VNb2RpZmllZCA9IHRydWU7CisgICAgICAgIFVyaSB1cmkgPSBNdHBPYmplY3RzLmdldFJlZmVyZW5jZXNVcmkobVZvbHVtZU5hbWUsIGhhbmRsZSk7CisgICAgICAgIGludCBjb3VudCA9IHJlZmVyZW5jZXMubGVuZ3RoOworICAgICAgICBDb250ZW50VmFsdWVzW10gdmFsdWVzTGlzdCA9IG5ldyBDb250ZW50VmFsdWVzW2NvdW50XTsKKyAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBjb3VudDsgaSsrKSB7CisgICAgICAgICAgICBDb250ZW50VmFsdWVzIHZhbHVlcyA9IG5ldyBDb250ZW50VmFsdWVzKCk7CisgICAgICAgICAgICB2YWx1ZXMucHV0KE10cE9iamVjdHMuT2JqZWN0Q29sdW1ucy5fSUQsIHJlZmVyZW5jZXNbaV0pOworICAgICAgICAgICAgdmFsdWVzTGlzdFtpXSA9IHZhbHVlczsKKyAgICAgICAgfQorICAgICAgICB0cnkgeworICAgICAgICAgICAgaWYgKGNvdW50ID09IG1NZWRpYVByb3ZpZGVyLmJ1bGtJbnNlcnQodXJpLCB2YWx1ZXNMaXN0KSkgeworICAgICAgICAgICAgICAgIHJldHVybiBNdHBDb25zdGFudHMuUkVTUE9OU0VfT0s7CisgICAgICAgICAgICB9CisgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICBMb2cuZShUQUcsICJSZW1vdGVFeGNlcHRpb24gaW4gc2V0T2JqZWN0UmVmZXJlbmNl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AaGlkZX0KKyAqLworcHVibGljIGNsYXNzIE10cFNlcnZlciB7CisKKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBTdHJpbmcgVEFHID0gIk10cFNlcnZlciI7CisKKyAgICBzdGF0aWMgeworICAgICAgICBTeXN0ZW0ubG9hZExpYnJhcnkoIm1lZGlhX2puaSIpOworICAgIH0KKworICAgIHB1YmxpYyBNdHBTZXJ2ZXIoTXRwRGF0YWJhc2UgZGF0YWJhc2UsIFN0cmluZyBzdG9yYWdlUGF0aCkgeworICAgICAgICBuYXRpdmVfc2V0dXAoZGF0YWJhc2UsIHN0b3JhZ2VQYXRoKTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwcm90ZWN0ZWQgdm9pZCBmaW5hbGl6ZSgpIHRocm93cyBUaHJvd2FibGUgeworICAgICAgICB0cnkgeworICAgICAgICAgICAgbmF0aXZlX2ZpbmFsaXplKCk7CisgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICBzdXBlci5maW5hbGl6ZSgpOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc3RhcnQoKSB7CisgICAgICAgIG5hdGl2ZV9zdGFydCgpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHN0b3AoKSB7CisgICAgICAgIG5hdGl2ZV9zdG9wKCk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc2VuZE9iamVjdEFkZGVkKGludCBoYW5kbGUpIHsKKyAgICAgICAgbmF0aXZlX3NlbmRfb2JqZWN0X2FkZGVkKGhhbmRsZSk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc2VuZE9iamVjdFJlbW92ZWQoaW50IGhhbmRsZSkgeworICAgICAgICBuYXRpdmVfc2VuZF9vYmplY3RfcmVtb3ZlZChoYW5kbGUpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHNldFB0cE1vZGUoYm9vbGVhbiB1c2VQdHApIHsKKyAgICAgICAgbmF0aXZlX3NldF9wdHB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gICBqZmllbGRJRCBtRGVzY3JpcHRvcjsKK30gZ0ZpbGVEZXNjcmlwdG9yT2Zmc2V0czsKKworc3RhdGljIHN0cnVjdCBwYXJjZWxfZmlsZV9kZXNjcmlwdG9yX29mZnNldHNfdAoreworICAgIGpjbGFzcyBtQ2xhc3M7CisgICAgam1ldGhvZElEIG1Db25zdHJ1Y3RvcjsKK30gZ1BhcmNlbEZpbGVEZXNjcmlwdG9yT2Zmc2V0czsKKworI2lmZGVmIEhBVkVfQU5EUk9JRF9PUworCitzdGF0aWMgdm9pZCBjaGVja0FuZENsZWFyRXhjZXB0aW9uRnJvbUNhbGxiYWNrKEpOSUVudiogZW52LCBjb25zdCBjaGFyKiBtZXRob2ROYW1lKSB7CisgICAgaWYgKGVudi0+RXhjZXB0aW9uQ2hlY2soKSkgeworICAgICAgICBMT0dFKCJBbiBleGNlcHRpb24gd2FzIHRocm93biBieSBjYWxsYmFjayAnJXMnLiIsIG1ldGhvZE5hbWUpOworICAgICAgICBMT0dFX0VYKGVudik7CisgICAgICAgIGVudi0+RXhjZXB0aW9uQ2xlYXIoKTsKKyAgICB9Cit9CisKK2NsYXNzIE15Q2xpZW50IDogcHVibGljIE10cENsaWVudCB7Citwcml2YXRlOgorICAgIHZpcnR1YWwgdm9pZCAgICBkZXZpY2VBZGRlZChNdHBEZXZpY2UgKmRldmljZSk7CisgICAgdmlydHVhbCB2b2lkICAgIGRldmljZVJlbW92ZWQoTXRwRGV2aWNlICpkZXZpY2UpOworCisgICAgam9iamVjdCAgICAgICAgIG1DbGllbnQ7CisgICAgTXRwRGV2aWNlKiAgICAgIG1FdmVudERldmljZTsKKworcHVibGljOgorICAgICAgICAgICAgICAgICAgICBNeUNsaWVudChKTklFbnYgKmVudiwgam9iamVjdCBjbGllbnQpOworICAgIHZvaWQgICAgICAgICAgICBjbGVhbnVwKEpOSUVudiAqZW52KTsKK307CisKK010cENsaWVudCogZ2V0X2NsaWVudF9mcm9tX29iamVjdChKTklFbnYqIGVudiwgam9iamVjdCBqYXZhQ2xpZW50KQoreworICAgIHJldHVybiAoTXRwQ2xpZW50KillbnYtPkdldEludEZpZWxkKGphdmFDbGllbnQsIGZpZWxkX2NvbnRleHQpOworfQorCisKK015Q2xpZW50OjpNeUNsaWVudChKTklFbnYgKmVudiwgam9iamVjdCBjbGllbnQpCisgICAgOiAgIG1DbGllbnQoZW52LT5OZXdHbG9iYWxSZWYoY2xpZW50KSkKK3sKK30KKwordm9pZCBNeUNsaWVudDo6Y2xlYW51cChKTklFbnYgKmVudikgeworICAgIGVudi0+RGVsZXRlR2xvYmFsUmVmKG1DbGllbnQpOworfQorCit2b2lkIE15Q2xpZW50OjpkZXZpY2VBZGRlZChNdHBEZXZpY2UgKmRldmljZSkgeworICAgIEpOSUVudiogZW52ID0gQW5kcm9pZFJ1bnRpbWU6OmdldEpOSUVudigpOworICAgIGNvbnN0IGNoYXIqIG5hbWUgPSBkZXZpY2UtPmdldERldmljZU5hbWUoKTsKKyAgICBMT0dEKCJNeUNsaWVudDo6ZGV2aWNlQWRkZWQgJXNcbiIsIG5hbWUpOworCisgICAgZW52LT5DYWxsVm9pZE1ldGhvZChtQ2xpZW50LCBtZXRob2RfZGV2aWNlQWRkZWQsIGRldmljZS0+Z2V0SUQoKSk7CisKKyAgICBjaGVja0FuZENsZWFyRXhjZXB0aW9uRnJvbUNhbGxiYWNrKGVudiwgX19GVU5DVElPTl9fKTsKK30KKwordm9pZCBNeUNsaWVudDo6ZGV2aWNlUmVtb3ZlZChNdHBEZXZpY2UgKmRldmljZSkgeworICAgIEpOSUVudiogZW52ID0gQW5kcm9pZFJ1bnRpbWU6OmdldEpOSUVudigpOworICAgIGNvbnN0IGNoYXIqIG5hbWUgPSBkZXZpY2UtPmdldERldmljZU5hbWUoKTsKKyAgICBMT0dEKCJNeUNsaWVudDo6ZGV2aWNlUmVtb3ZlZCAlc1xuIiwgbmFtZSk7CisKKyAgICBlbnYtPkNhbGxWb2lkTWV0aG9kKG1DbGllbnQsIG1ld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W52ICplbnYsIGpvYmplY3QgdGhpeikKK3sKKyNpZmRlZiBIQVZFX0FORFJPSURfT1MKKyAgICBMT0dEKCJzdGFydFxuIik7CisgICAgTXlDbGllbnQgKmNsaWVudCA9IChNeUNsaWVudCAqKWVudi0+R2V0SW50RmllbGQodGhpeiwgZmllbGRfY29udGV4dCk7CisgICAgcmV0dXJuIGNsaWVudC0+c3RhcnQoKTsKKyNlbHNlCisgICAgcmV0dXJuIGZhbHNlOworI2VuZGlmCit9CisKK3N0YXRpYyB2b2lkCithbmRyb2lkX21lZGlhX010cENsaWVudF9zdG9wKEpOSUVudiAqZW52LCBqb2JqZWN0IHRoaXopCit7CisjaWZkZWYgSEFWRV9BTkRST0lEX09TCisgICAgTE9HRCgic3RvcFxuIik7CisgICAgTXlDbGllbnQgKmNsaWVudCA9IChNeUNsaWVudCAqKWVudi0+R2V0SW50RmllbGQodGhpeiwgZmllbGRfY29udGV4dCk7CisgICAgY2xpZW50LT5zdG9wKCk7CisjZW5kaWYKK30KKworc3RhdGljIGpib29sZWFuCithbmRyb2lkX21lZGlhX010cENsaWVudF9kZWxldGVfb2JqZWN0KEpOSUVudiAqZW52LCBqb2JqZWN0IHRoaXosCisgICAgICAgIGppbnQgZGV2aWNlX2lkLCBqaW50IG9iamVjdF9pZCkKK3sKKyNpZmRlZiBIQVZFX0FORFJPSURfT1MKKyAgICBNeUNsaWVudCAqY2xpZW50ID0gKE15Q2xpZW50ICopZW52LT5HZXRJbnRGaWVsZCh0aGl6LCBmaWVsZF9jb250ZXh0KTsKKyAgICBNdHBEZXZpY2UqIGRldmljZSA9IGNsaWVudC0+Z2V0RGV2aWNlKGRldmljZV9pZCk7CisgICAgaWYgKGRldmljZSkKKyAgICAgICAgcmV0dXJuIGRldmljZS0+ZGVsZXRlT2JqZWN0KG9iamVjdF9pZCk7CisgICAgZWxzZQorICNlbmRpZgorICAgICAgICByZXR1cm4gTlVMTDsKK30KKworc3RhdGljIGppbnQKK2FuZHJvaWRfbWVkaWFfTXRwQ2xpZW50X2dldF9wYXJlbnQoSk5JRW52ICplbnYsIGpvYmplY3QgdGhpeiwKKyAgICAgICAgamludCBkZXZpY2VfaWQsIGppbnQgb2JqZWN0X2lkKQoreworI2lmZGVmIEhBVkVfQU5EUk9JRF9PUworICAgIE15Q2xpZW50ICpjbGllbnQgPSAoTXlDbGllbnQgKillbnYtPkdldEludEZpZWxkKHRoaXosIGZpZWxkX2NvbnRleHQpOworICAgIE10cERldmljZSogZGV2aWNlID0gY2xpZW50LT5nZXREZXZpY2UoZGV2aWNlX2lkKTsKKyAgICBpZiAoZGV2aWNlKQorICAgICAgICByZXR1cm4gZGV2aWNlLT5nZXRQYXJlbnQob2JqZWN0X2lkKTsKKyAgICBlbHNlCisjZW5kaWYKKyAgICAgICAgcmV0dXJuIC0xOworfQorCitzdGF0aWMgamludAorYW5kcm9pZF9tZWRpYV9NdHBDbGllbnRfZ2V0X3N0b3JhZ2VfaWQoSk5JRW52ICplbnYsIGpvYmplY3QgdGhpeiwKKyAgICAgICAgamludCBkZXZpY2VfaWQsIGppbnQgb2JqZWN0X2lkKQoreworICNpZmRlZiBIQVZFX0FORFJPSURfT1MKKyAgICBNeUNsaWVudCAqY2xpZW50ID0gKE15Q2xpZW50ICopZW52LT5HZXRJbnRGaWVsZCh0aGl6LCBmaWVsZF9jb250ZXh0KTsKKyAgICBNdHBEZXZpY2UqIGRldmljZSA9IGNsaWVudC0+Z2V0RGV2aWNlKGRldmljZV9pZCk7CisgICAgaWYgKGRldmljZSkKKyAgICAgICAgcmV0dXJuIGRldmljZS0+Z2V0U3RvcmFnZUlEKG9iamVjdF9pZCk7CisgICAgZWxzZQorI2VuZGlmCisgICAgICAgIHJldHVybiAtMTsKK30KKworc3RhdGljIGpvYmplY3QKK2FuZHJvaWRfbWVkaWFfTXRwQ2xpZW50X29wZW5fZmlsZShKTklFbnYgKmVudiwgam9iamVjdCB0aGl6LAorICAgICAgICBqaW50IGRldmljZV9pZCwgamludCBvYmplY3RfaW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IHF1ZXJ5VHlwZSwgZGV2aWNlSUQsIHN0b3JhZ2VJRCwgb2JqZWN0SUQpOworCisgICAgaW50KiBjb2x1bW5zID0gTlVMTDsKKyAgICBpbnQgY29sdW1uQ291bnQgPSAwOworICAgIGlmIChqYXZhQ29sdW1ucykgeworICAgICAgICBjb2x1bW5zID0gZW52LT5HZXRJbnRBcnJheUVsZW1lbnRzKGphdmFDb2x1bW5zLCAwKTsKKyAgICAgICAgY29sdW1uQ291bnQgPSBlbnYtPkdldEFycmF5TGVuZ3RoKGphdmFDb2x1bW5zKTsKKyAgICB9CisKKyAgICBNdHBDbGllbnQqIGNsaWVudCA9IGdldF9jbGllbnRfZnJvbV9vYmplY3QoZW52LCBqYXZhQ2xpZW50KTsKKyAgICBNdHBDdXJzb3IqIGN1cnNvciA9IG5ldyBNdHBDdXJzb3IoY2xpZW50LCBxdWVyeVR5cGUsCisgICAgICAgICAgICBkZXZpY2VJRCwgc3RvcmFnZUlELCBvYmplY3RJRCwgY29sdW1uQ291bnQsIGNvbHVtbnMpOworCisgICAgaWYgKGNvbHVtbnMpCisgICAgICAgIGVudi0+UmVsZWFzZUludEFycmF5RWxlbWVudHMoamF2YUNvbHVtbnMsIGNvbHVtbnMsIDApOworICAgIGVudi0+U2V0SW50RmllbGQodGhpeiwgZmllbGRfY29udGV4dCwgKGludCljdXJzb3IpOworI2VuZGlmCit9CisKK3N0YXRpYyB2b2lkCithbmRyb2lkX21lZGlhX010cEN1cnNvcl9maW5hbGl6ZShKTklFbnYgKmVudiwgam9iamVjdCB0aGl6KQoreworI2lmZGVmIEhBVkVfQU5EUk9JRF9PUworICAgIExPR0QoImZpbmFsaXplXG4iKTsKKyAgICBNdHBDdXJzb3IgKmN1cnNvciA9IChNdHBDdXJzb3IgKillbnYtPkdldEludEZpZWxkKHRoaXosIGZpZWxkX2NvbnRleHQpOworICAgIGRlbGV0ZSBjdXJzb3I7CisjZW5kaWYKK30KKworc3RhdGljIGppbnQKK2FuZHJvaWRfbWV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FsaXplIiwgICAgICAgICAiKClWIiwgICh2b2lkICopYW5kcm9pZF9tZWRpYV9NdHBDdXJzb3JfZmluYWxpemV9LAorICAgIHsibmF0aXZlX2ZpbGxfd2luZG93IiwgICAgICAiKExhbmRyb2lkL2RhdGFiYXNlL0N1cnNvcldpbmRvdztJKUkiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICh2b2lkICopYW5kcm9pZF9tZWRpYV9NdHBDdXJzb3JfZmlsbF93aW5kb3d9LAorCit9OworCitzdGF0aWMgY29uc3QgY2hhciogY29uc3Qga0NsYXNzUGF0aE5hbWUgPSAiYW5kcm9pZC9tZWRpYS9NdHBDdXJzb3IiOworCitpbnQgcmVnaXN0ZXJfYW5kcm9pZF9tZWRpYV9NdHBDdXJzb3IoSk5JRW52ICplbnYpCit7CisgICAgamNsYXNzIGNsYXp6OworCisgICAgTE9HRCgicmVnaXN0ZXJfYW5kcm9pZF9tZWRpYV9NdHBDdXJzb3JcbiIpOworCisgICAgY2xhenogPSBlbnYtPkZpbmRDbGFzcygiYW5kcm9pZC9tZWRpYS9NdHBDdXJzb3IiKTsKKyAgICBpZiAoY2xhenogPT0gTlVMTCkgeworICAgICAgICBMT0dFKCJDYW4ndCBmaW5kIGFuZHJvaWQvbWVkaWEvTXRwQ3Vyc29yIik7CisgICAgICAgIHJldHVybiAtMTsKKyAgICB9CisgICAgZmllbGRfY29udGV4dCA9IGVudi0+R2V0RmllbGRJRChjbGF6eiwgIm1OYXRpdmVDb250ZXh0IiwgIkkiKTsKKyAgICBpZiAoZmllbGRfY29udGV4dCA9PSBOVUxMKSB7CisgICAgICAgIExPR0UoIkNhbid0IGZpbmQgTXRwQ3Vyc29yLm1OYXRpdmVDb250ZXh0Iik7CisgICAgICAgIHJldHVybiAtMTsKKyAgICB9CisKKyAgICByZXR1cm4gQW5kcm9pZFJ1bnRpbWU6OnJlZ2lzdGVyTmF0aXZlTWV0aG9kcyhlbnYsCisgICAgICAgICAgICAgICAg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pZWxkX2NvbnRleHQpOworfQorCisjaWZkZWYgSEFWRV9BTkRST0lEX09TCisvLyAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tCisKK2NsYXNzIE15TXRwRGF0YWJhc2UgOiBwdWJsaWMgTXRwRGF0YWJhc2UgeworcHJpdmF0ZToKKyAgICBqb2JqZWN0ICAgICAgICAgbURhdGFiYXNlOworICAgIGppbnRBcnJheSAgICAgICBtSW50QnVmZmVyOworICAgIGpsb25nQXJyYXkgICAgICBtTG9uZ0J1ZmZlcjsKKyAgICBqY2hhckFycmF5ICAgICAgbVN0cmluZ0J1ZmZlcjsKKworcHVibGljOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTXlNdHBEYXRhYmFzZShKTklFbnYgKmVudiwgam9iamVjdCBjbGllbnQpOworICAgIHZpcnR1YWwgICAgICAgICAgICAgICAgICAgICAgICAgfk15TXRwRGF0YWJhc2UoKTsKKyAgICB2b2lkICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFudXAoSk5JRW52ICplbnYpOworCisgICAgdmlydHVhbCBNdHBPYmplY3RIYW5kbGUgICAgICAgICBiZWdpblNlbmRPYmplY3QoY29uc3QgY2hhciogcGF0aCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTXRwT2JqZWN0Rm9ybWF0IGZvcm1hdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTXRwT2JqZWN0SGFuZGxlIHBhcmVudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTXRwU3RvcmFnZUlEIHN0b3JhZ2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQ2NF90IHNpemUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpbWVfdCBtb2RpZmllZCk7CisKKyAgICB2aXJ0dWFsIHZvaWQgICAgICAgICAgICAgICAgICAgIGVuZFNlbmRPYmplY3QoY29uc3QgY2hhciogcGF0aCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTXRwT2JqZWN0SGFuZGxlIGhhbmRsZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTXRwT2JqZWN0Rm9ybWF0IGZvcm1hdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBzdWNjZWVkZWQpOworCisgICAgdmlydHVhbCBNdHBPYmplY3RIYW5kbGVMaXN0KiAgICBnZXRPYmplY3RMaXN0KE10cFN0b3JhZ2VJRCBzdG9yYWdlSUQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBPYmplY3RGb3JtYXQgZm9ybWF0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTXRwT2JqZWN0SGFuZGxlIHBhcmVudCk7CisKKyAgICB2aXJ0dWFsIGludCAgICAgICAgICAgICAgICAgICAgIGdldE51bU9iamVjdHMoTXRwU3RvcmFnZUlEIHN0b3JhZ2VJRCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTXRwT2JqZWN0Rm9ybWF0IGZvcm1hdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTXRwT2JqZWN0SGFuZGxlIHBhcmVudCk7CisKKyAgICAvLyBjYWxsZWUgc2hvdWxkIGRlbGV0ZVtdIHRoZSByZXN1bHRzIGZyb20gdGhlc2UKKyAgICAvLyByZXN1bHRzIGNhbiBiZSBOVUxMCisgICAgdmlydHVhbCBNdHBPYmplY3RGb3JtYXRMaXN0KiAgICBnZXRTdXBwb3J0ZWRQbGF5YmFja0Zvcm1hdHMoKTsKKyAgICB2aXJ0dWFsIE10cE9iamVjdEZvcm1hdExpc3QqICAgIGdldFN1cHBvcnRlZENhcHR1cmVGb3JtYXRzKCk7CisgICAgdmlydHVhbCBNdHBPYmplY3RQcm9wZXJ0eUxpc3QqICBnZXRTdXBwb3J0ZWRPYmplY3RQcm9wZXJ0aWVzKE10cE9iamVjdEZvcm1hdCBmb3JtYXQpOworICAgIHZpcnR1YWwgTXRwRGV2aWNlUHJvcGVydHlMaXN0KiAgZ2V0U3VwcG9ydGVkRGV2aWNlUHJvcGVydGllcygpOworCisgICAgdmlydHVhbCBNdHBSZXNwb25zZUNvZGUgICAgICAgICBnZXRPYmplY3RQcm9wZXJ0eVZhbHVlKE10cE9iamVjdEhhbmRsZSBoYW5kbGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE10cE9iamVjdFByb3BlcnR5IHByb3BlcnR5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBEYXRhUGFja2V0JiBwYWNrZXQpOworCisgICAgdmlydHVhbCBNdHBSZXNwb25zZUNvZGUgICAgICAgICBzZXRPYmplY3RQcm9wZXJ0eVZhbHVlKE10cE9iamVjdEhhbmRsZSBoYW5kbGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE10cE9iamVjdFByb3BlcnR5IHByb3BlcnR5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBEYXRhUGFja2V0JiBwYWNrZXQpOworCisgICAgdmlydHVhbCBNdHBSZXNwb25zZUNvZGUgICAgICAgICBnZXREZXZpY2VQcm9wZXJ0eVZhbHVlKE10cERldmljZVByb3BlcnR5IHByb3BlcnR5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBEYXRhUGFja2V0JiBwYWNrZXQpOworCisgICAgdmlydHVhbCBNdHBSZXNwb25zZUNvZGUgICAgICAgICBzZXREZXZpY2VQcm9wZXJ0eVZhbHVlKE10cERldmljZVByb3BlcnR5IHByb3BlcnR5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBEYXRhUGFja2V0JiBwYWNrZXQpOworCisgICAgdmlydHVhbCBNdHBSZXNwb25zZUNvZGUgICAgICAgICByZXNldERldmljZVByb3BlcnR5KE10cERldmljZVByb3BlcnR5IHByb3BlcnR5KTsKKworICAgIHZpcnR1YWwgTXRwUmVzcG9uc2VDb2RlICAgICAgICAgZ2V0T2JqZWN0SW5mbyhNdHBPYmplY3RIYW5kbGUgaGFuZGxlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBEYXRhUGFja2V0JiBwYWNrZXQpOworCisgICAgdmlydHVhbCBNdHBSZXNwb25zZUNvZGUgICAgICAgICBnZXRPYmplY3RGaWxlUGF0aChNdHBPYmplY3RIYW5kbGUgaGFuZGxlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBTdHJpbmcmIGZpbGVQYXRoLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnQ2NF90JiBmaWxlTGVuZ3RoKTsKKyAgICB2aXJ0dWFsIE10cFJlc3BvbnNlQ29kZSAgICAgICAgIGRlbGV0ZUZpbGUoTXRwT2JqZWN0SGFuZGxlIGhhbmRsZSk7CisKKyAgICBib29sICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldE9iamVjdFByb3BlcnR5SW5mbyhNdHBPYmplY3RQcm9wZXJ0eSBwcm9wZXJ0eSwgaW50JiB0eXBlKTsKKyAgICBib29sICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldERldmljZVByb3BlcnR5SW5mbyhNdHBEZXZpY2VQcm9wZXJ0eSBwcm9wZXJ0eSwgaW50JiB0eXBlKTsKKworICAgIHZpcnR1YWwgTXRwT2JqZWN0SGFuZGxlTGlzdCogICAgZ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kTmFtZSk7CisgICAgICAgIExPR0VfRVgoZW52KTsKKyAgICAgICAgZW52LT5FeGNlcHRpb25DbGVhcigpOworICAgIH0KK30KKworLy8gLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQorCitNeU10cERhdGFiYXNlOjpNeU10cERhdGFiYXNlKEpOSUVudiAqZW52LCBqb2JqZWN0IGNsaWVudCkKKyAgICA6ICAgbURhdGFiYXNlKGVudi0+TmV3R2xvYmFsUmVmKGNsaWVudCkpLAorICAgICAgICBtSW50QnVmZmVyKE5VTEwpLAorICAgICAgICBtTG9uZ0J1ZmZlcihOVUxMKSwKKyAgICAgICAgbVN0cmluZ0J1ZmZlcihOVUxMKQoreworICAgIGppbnRBcnJheSBpbnRBcnJheTsKKyAgICBqbG9uZ0FycmF5IGxvbmdBcnJheTsKKyAgICBqY2hhckFycmF5IGNoYXJBcnJheTsKKworICAgIC8vIGNyZWF0ZSBidWZmZXJzIGZvciBvdXQgYXJndW1lbnRzCisgICAgLy8gd2UgZG9uJ3QgbmVlZCB0byBiZSB0aHJlYWQtc2FmZSBzbyB0aGlzIGlzIE9LCisgICAgaW50QXJyYXkgPSBlbnYtPk5ld0ludEFycmF5KDMpOworICAgIGlmICghaW50QXJyYXkpCisgICAgICAgIGdvdG8gb3V0X29mX21lbW9yeTsKKyAgICBtSW50QnVmZmVyID0gKGppbnRBcnJheSllbnYtPk5ld0dsb2JhbFJlZihpbnRBcnJheSk7CisgICAgbG9uZ0FycmF5ID0gZW52LT5OZXdMb25nQXJyYXkoMik7CisgICAgaWYgKCFsb25nQXJyYXkpCisgICAgICAgIGdvdG8gb3V0X29mX21lbW9yeTsKKyAgICBtTG9uZ0J1ZmZlciA9IChqbG9uZ0FycmF5KWVudi0+TmV3R2xvYmFsUmVmKGxvbmdBcnJheSk7CisgICAgY2hhckFycmF5ID0gZW52LT5OZXdDaGFyQXJyYXkoMjU2KTsKKyAgICBpZiAoIWNoYXJBcnJheSkKKyAgICAgICAgZ290byBvdXRfb2ZfbWVtb3J5OworICAgIG1TdHJpbmdCdWZmZXIgPSAoamNoYXJBcnJheSllbnYtPk5ld0dsb2JhbFJlZihjaGFyQXJyYXkpOworICAgIHJldHVybjsKKworb3V0X29mX21lbW9yeToKKyAgICBlbnYtPlRocm93TmV3KGVudi0+RmluZENsYXNzKCJqYXZhL2xhbmcvT3V0T2ZNZW1vcnlFcnJvciIpLCBOVUxMKTsKK30KKwordm9pZCBNeU10cERhdGFiYXNlOjpjbGVhbnVwKEpOSUVudiAqZW52KSB7CisgICAgZW52LT5EZWxldGVHbG9iYWxSZWYobURhdGFiYXNlKTsKKyAgICBlbnYtPkRlbGV0ZUdsb2JhbFJlZihtSW50QnVmZmVyKTsKKyAgICBlbnYtPkRlbGV0ZUdsb2JhbFJlZihtTG9uZ0J1ZmZlcik7CisgICAgZW52LT5EZWxldGVHbG9iYWxSZWYobVN0cmluZ0J1ZmZlcik7Cit9CisKK015TXRwRGF0YWJhc2U6On5NeU10cERhdGFiYXNlKCkgeworfQorCitNdHBPYmplY3RIYW5kbGUgTXlNdHBEYXRhYmFzZTo6YmVnaW5TZW5kT2JqZWN0KGNvbnN0IGNoYXIqIHBhdGgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE10cE9iamVjdEZvcm1hdCBmb3JtYXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE10cE9iamVjdEhhbmRsZSBwYXJlbnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE10cFN0b3JhZ2VJRCBzdG9yYWdlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1aW50NjRfdCBzaXplLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aW1lX3QgbW9kaWZpZ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JRCBzdG9yYWdlSUQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBPYmplY3RGb3JtYXQgZm9ybWF0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTXRwT2JqZWN0SGFuZGxlIHBhcmVudCkgeworICAgIEpOSUVudiogZW52ID0gQW5kcm9pZFJ1bnRpbWU6OmdldEpOSUVudigpOworICAgIGppbnRBcnJheSBhcnJheSA9IChqaW50QXJyYXkpZW52LT5DYWxsT2JqZWN0TWV0aG9kKG1EYXRhYmFzZSwgbWV0aG9kX2dldE9iamVjdExpc3QsCisgICAgICAgICAgICAgICAgKGppbnQpc3RvcmFnZUlELCAoamludClmb3JtYXQsIChqaW50KXBhcmVudCk7CisgICAgaWYgKCFhcnJheSkKKyAgICAgICAgcmV0dXJuIE5VTEw7CisgICAgTXRwT2JqZWN0SGFuZGxlTGlzdCogbGlzdCA9IG5ldyBNdHBPYmplY3RIYW5kbGVMaXN0KCk7CisgICAgamludCogaGFuZGxlcyA9IGVudi0+R2V0SW50QXJyYXlFbGVtZW50cyhhcnJheSwgMCk7CisgICAganNpemUgbGVuZ3RoID0gZW52LT5HZXRBcnJheUxlbmd0aChhcnJheSk7CisgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBsZW5ndGg7IGkrKykKKyAgICAgICAgbGlzdC0+cHVzaChoYW5kbGVzW2ldKTsKKyAgICBlbnYtPlJlbGVhc2VJbnRBcnJheUVsZW1lbnRzKGFycmF5LCBoYW5kbGVzLCAwKTsKKworICAgIGNoZWNrQW5kQ2xlYXJFeGNlcHRpb25Gcm9tQ2FsbGJhY2soZW52LCBfX0ZVTkNUSU9OX18pOworICAgIHJldHVybiBsaXN0OworfQorCitpbnQgTXlNdHBEYXRhYmFzZTo6Z2V0TnVtT2JqZWN0cyhNdHBTdG9yYWdlSUQgc3RvcmFnZUlELAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBPYmplY3RGb3JtYXQgZm9ybWF0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBPYmplY3RIYW5kbGUgcGFyZW50KSB7CisgICAgSk5JRW52KiBlbnYgPSBBbmRyb2lkUnVudGltZTo6Z2V0Sk5JRW52KCk7CisgICAgaW50IHJlc3VsdCA9IGVudi0+Q2FsbEludE1ldGhvZChtRGF0YWJhc2UsIG1ldGhvZF9nZXROdW1PYmplY3RzLAorICAgICAgICAgICAgICAgIChqaW50KXN0b3JhZ2VJRCwgKGppbnQpZm9ybWF0LCAoamludClwYXJlbnQpOworCisgICAgY2hlY2tBbmRDbGVhckV4Y2VwdGlvbkZyb21DYWxsYmFjayhlbnYsIF9fRlVOQ1RJT05fXyk7CisgICAgcmV0dXJuIHJlc3VsdDsKK30KKworTXRwT2JqZWN0Rm9ybWF0TGlzdCogTXlNdHBEYXRhYmFzZTo6Z2V0U3VwcG9ydGVkUGxheWJhY2tGb3JtYXRzKCkgeworICAgIEpOSUVudiogZW52ID0gQW5kcm9pZFJ1bnRpbWU6OmdldEpOSUVudigpOworICAgIGppbnRBcnJheSBhcnJheSA9IChqaW50QXJyYXkpZW52LT5DYWxsT2JqZWN0TWV0aG9kKG1EYXRhYmFzZSwKKyAgICAgICAgICAgIG1ldGhvZF9nZXRTdXBwb3J0ZWRQbGF5YmFja0Zvcm1hdHMpOworICAgIGlmICghYXJyYXkpCisgICAgICAgIHJldHVybiBOVUxMOworICAgIE10cE9iamVjdEZvcm1hdExpc3QqIGxpc3QgPSBuZXcgTXRwT2JqZWN0Rm9ybWF0TGlzdCgpOworICAgIGppbnQqIGZvcm1hdHMgPSBlbnYtPkdldEludEFycmF5RWxlbWVudHMoYXJyYXksIDApOworICAgIGpzaXplIGxlbmd0aCA9IGVudi0+R2V0QXJyYXlMZW5ndGgoYXJyYXkpOworICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbGVuZ3RoOyBpKyspCisgICAgICAgIGxpc3QtPnB1c2goZm9ybWF0c1tpXSk7CisgICAgZW52LT5S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VydGllcyhNdHBPYmplY3RGb3JtYXQgZm9ybWF0KSB7CisgICAgSk5JRW52KiBlbnYgPSBBbmRyb2lkUnVudGltZTo6Z2V0Sk5JRW52KCk7CisgICAgamludEFycmF5IGFycmF5ID0gKGppbnRBcnJheSllbnYtPkNhbGxPYmplY3RNZXRob2QobURhdGFiYXNlLAorICAgICAgICAgICAgbWV0aG9kX2dldFN1cHBvcnRlZE9iamVjdFByb3BlcnRpZXMsIChqaW50KWZvcm1hdCk7CisgICAgaWYgKCFhcnJheSkKKyAgICAgICAgcmV0dXJuIE5VTEw7CisgICAgTXRwT2JqZWN0UHJvcGVydHlMaXN0KiBsaXN0ID0gbmV3IE10cE9iamVjdFByb3BlcnR5TGlzdCgpOworICAgIGppbnQqIHByb3BlcnRpZXMgPSBlbnYtPkdldEludEFycmF5RWxlbWVudHMoYXJyYXksIDApOworICAgIGpzaXplIGxlbmd0aCA9IGVudi0+R2V0QXJyYXlMZW5ndGgoYXJyYXkpOworICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbGVuZ3RoOyBpKyspCisgICAgICAgIGxpc3QtPnB1c2gocHJvcGVydGllc1tpXSk7CisgICAgZW52LT5SZWxlYXNlSW50QXJyYXlFbGVtZW50cyhhcnJheSwgcHJvcGVydGllcywgMCk7CisKKyAgICBjaGVja0FuZENsZWFyRXhjZXB0aW9uRnJvbUNhbGxiYWNrKGVudiwgX19GVU5DVElPTl9fKTsKKyAgICByZXR1cm4gbGlzdDsKK30KKworTXRwRGV2aWNlUHJvcGVydHlMaXN0KiBNeU10cERhdGFiYXNlOjpnZXRTdXBwb3J0ZWREZXZpY2VQcm9wZXJ0aWVzKCkgeworICAgIEpOSUVudiogZW52ID0gQW5kcm9pZFJ1bnRpbWU6OmdldEpOSUVudigpOworICAgIGppbnRBcnJheSBhcnJheSA9IChqaW50QXJyYXkpZW52LT5DYWxsT2JqZWN0TWV0aG9kKG1EYXRhYmFzZSwKKyAgICAgICAgICAgIG1ldGhvZF9nZXRTdXB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VfSU5UODoKKyAgICAgICAgICAgIHBhY2tldC5wdXRJbnQ4KGxvbmdWYWx1ZSk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9VSU5UODoKKyAgICAgICAgICAgIHBhY2tldC5wdXRVSW50OChsb25nVmFsdWUpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX1RZUEVfSU5UMTY6CisgICAgICAgICAgICBwYWNrZXQucHV0SW50MTYobG9uZ1ZhbHVlKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIE1UUF9UWVBFX1VJTlQxNjoKKyAgICAgICAgICAgIHBhY2tldC5wdXRVSW50MTYobG9uZ1ZhbHVlKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIE1UUF9UWVBFX0lOVDMyOgorICAgICAgICAgICAgcGFja2V0LnB1dEludDMyKGxvbmdWYWx1ZSk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9VSU5UMzI6CisgICAgICAgICAgICBwYWNrZXQucHV0VUludDMyKGxvbmdWYWx1ZSk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9JTlQ2NDoKKyAgICAgICAgICAgIHBhY2tldC5wdXRJbnQ2NChsb25nVmFsdWUpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX1RZUEVfVUlOVDY0OgorICAgICAgICAgICAgcGFja2V0LnB1dFVJbnQ2NChsb25nVmFsdWUpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX1RZUEVfSU5UMTI4OgorICAgICAgICAgICAgcGFja2V0LnB1dEludDEyOChsb25nVmFsdWUpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX1RZUEVfVUlOVDEyODoKKyAgICAgICAgICAgIHBhY2tldC5wdXRJbnQxMjgobG9uZ1ZhbHVlKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIE1UUF9UWVBFX1NUUjoKKyAgICAgICAgeworICAgICAgICAgICAgamNoYXIqIHN0ciA9IGVudi0+R2V0Q2hhckFycmF5RWxlbWVudHMobVN0cmluZ0J1ZmZlciwgMCk7CisgICAgICAgICAgICBwYWNrZXQucHV0U3RyaW5nKHN0cik7CisgICAgICAgICAgICBlbnYtPlJlbGVhc2VDaGFyQXJyYXlFbGVtZW50cyhtU3RyaW5nQnVmZmVyLCBzdHIsIDApOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICB9CisgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICBMT0dFKCJ1bnN1cHBvcnRlZCB0eXBlIGluIGdldE9iamVjdFByb3BlcnR5VmFsdWVcbiIpOworICAgICAgICAgICAgcmV0dXJuIE1UUF9SRVNQT05TRV9JTlZBTElEX09CSkVDVF9QUk9QX0ZPUk1BVDsKKyAgICB9CisKKyAgICBjaGVja0FuZENsZWFyRXhjZXB0aW9uRnJvbUNhbGxiYWNrKGVudiwgX19GVU5DVElPTl9fKTsKKyAgICByZXR1cm4gTVRQX1JFU1BPTlNFX09LOworfQorCitNdHBSZXNwb25zZUNvZGUgTXlNdHBEYXRhYmFzZTo6c2V0T2JqZWN0UHJvcGVydHlWYWx1ZShNdHBPYmplY3RIYW5kbGUgaGFuZGxlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBPYmplY3RQcm9wZXJ0eSBwcm9wZXJ0eSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTXRwRGF0YVBhY2tldCYgcGFja2V0KSB7CisgICAgaW50ICAgICAgICAgdHlwZTsKKworICAgIGlmICghZ2V0T2JqZWN0UHJvcGVydHlJbmZvKHByb3BlcnR5LCB0eXBlKSkKKyAgICAgICAgcmV0dXJuIE1UUF9SRVNQT05TRV9PQkpFQ1RfUFJPUF9OT1RfU1VQUE9SVEVEOworCisgICAgSk5JRW52KiBlbnYgPSBBbmRyb2lkUnVudGltZTo6Z2V0Sk5JRW52KCk7CisgICAgamxvbmcgbG9uZ1ZhbHVlID0gMDsKKyAgICBqc3RyaW5nIHN0cmluZ1ZhbHVlID0gTlVMTDsKKworICAgIHN3aXRjaCAodHlwZSkgeworICAgICAgICBjYXNlIE1UUF9UWVBFX0lOVDg6CisgICAgICAgICAgICBsb25nVmFsdWUgPSBwYWNrZXQuZ2V0SW50OCgpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX1RZUEVfVUlOVDg6CisgICAgICAgICAgICBsb25nVmFsdWUgPSBwYWNrZXQuZ2V0VUludDgoKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIE1UUF9UWVBFX0lOVDE2OgorICAgICAgICAgICAgbG9uZ1ZhbHVlID0gcGFja2V0LmdldEludDE2KCk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9VSU5UMTY6CisgICAgICAgICAgICBsb25nVmFsdWUgPSBwYWNrZXQuZ2V0VUludDE2KCk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9JTlQzMjoKKyAgICAgICAgICAgIGxvbmdWYWx1ZSA9IHBhY2tldC5nZXRJbnQzMigpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX1RZUEVfVUlOVDMyOgorICAgICAgICAgICAgbG9uZ1ZhbHVlID0gcGFja2V0LmdldFVJbnQzMigpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX1RZUEVfSU5UNjQ6CisgICAgICAgICAgICBsb25nVmFsdWUgPSBwYWNrZXQuZ2V0SW50NjQoKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIE1UUF9UWVBFX1VJTlQ2NDoKKyAgICAgICAgICAgIGxvbmdWYWx1ZSA9IHBhY2tldC5nZXRVSW50NjQoKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIE1UUF9UWVBFX1NUUjoKKyAgICAgICAgeworICAgICAgICAgICAgTXRwU3RyaW5nQnVmZmVyIGJ1ZmZlcjsKKyAgICAgICAgICAgIHBhY2tldC5nZXRTdHJpbmcoYnVmZmVyKTsKKyAgICAgICAgICAgIHN0cmluZ1ZhbHVlID0gZW52LT5OZXdTdHJpbmdVVEYoKGNvbnN0IGNoYXIgKilidWZmZXIpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICB9CisgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICBMT0dFKCJ1bnN1cHBvcnRlZCB0eXBlIGluIGdldE9iamVjdFByb3BlcnR5VmFsdWVcbiIpOworICAgICAgICAgICAgcmV0dXJuIE1UUF9SRVNQT05TRV9JTlZBTElEX09CSkVDVF9QUk9QX0ZPUk1BVDsKKyAgICB9CisKKyAgICBqaW50IHJlc3VsdCA9IGVudi0+Q2FsbEludE1ldGhvZChtRGF0YWJhc2UsIG1ldGhvZF9zZXRPYmplY3RQcm9wZXJ0eSwKKyAgICAgICAgICAgICAgICAoamludCloYW5kbGUsIChqaW50KXByb3BlcnR5LCBsb25nVmFsdWUsIHN0cmluZ1ZhbHVlKTsKKworICAgIGNoZWNrQW5kQ2xlYXJFeGNlcHRpb25Gcm9tQ2FsbGJhY2soZW52LCBfX0ZVTkNUSU9OX18pOworICAgIHJldHVybiByZXN1bHQ7Cit9CisKK010cFJlc3BvbnNlQ29kZSBNeU10cERhdGFiYXNlOjpnZXREZXZpY2VQcm9wZXJ0eVZhbHVlKE10cERldmljZVByb3BlcnR5IHByb3BlcnR5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBEYXRhUGFja2V0JiBwYWNrZXQpIHsKKworICAgIGludCAgICAgICAgIHR5cGU7CisKKyAgICBpZiAoIWdldERldmljZVByb3BlcnR5SW5mbyhwcm9wZXJ0eSwgdHlwZSkpCisgICAgICAgIHJldHVybiBNVFBfUkVTUE9OU0VfREVWSUNFX1BST1BfTk9UX1NVUFBPUlRFRDsKKworICAgIEpOSUVudiogZW52ID0gQW5kcm9pZFJ1bnRpbWU6OmdldEpOSUVudigpOworICAgIGppbnQgcmVzdWx0ID0gZW52LT5DYWxsSW50TWV0aG9kKG1EYXRhYmFzZSwgbWV0aG9kX2dldERldmljZVByb3BlcnR5LAorICAgICAgICAgICAgICAgIChqaW50KXByb3BlcnR5LCBtTG9uZ0J1ZmZlciwgbVN0cmluZ0J1ZmZlcik7CisgICAgaWYgKHJlc3VsdCAhPSBNVFBfUkVTUE9OU0VfT0spIHsKKyAgICAgICAgY2hlY2tBbmRDbGVhckV4Y2VwdGlvbkZyb21DYWxsYmFjayhlbnYsIF9fRlVOQ1RJT05fXyk7CisgICAgICAgIHJldHVybiByZXN1bHQ7CisgICAgfQorCisgICAgamxvbmcqIGxvbmdWYWx1ZXMgPSBlbnYtPkdldExvbmdBcnJheUVsZW1lbnRzKG1Mb25nQnVmZmVyLCAwKTsKKyAgICBqbG9uZyBsb25nVmFsdWUgPSBsb25nVmFsdWVzWzBdOworICAgIGVudi0+UmVsZWFzZUxvbmdBcnJheUVsZW1lbnRzKG1Mb25nQnVmZmVyLCBsb25nVmFsdWVzLCAwKTsKKworICAgIHN3aXRjaCAodHlwZSkgeworICAgICAgICBjYXNlIE1UUF9UWVBFX0lOVDg6CisgICAgICAgICAgICBwYWNrZXQucHV0SW50OChsb25nVmFsdWUpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX1RZUEVfVUlOVDg6CisgICAgICAgICAgICBwYWNrZXQucHV0VUludDgobG9uZ1ZhbHVlKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIE1UUF9UWVBFX0lOVDE2OgorICAgICAgICAgICAgcGFja2V0LnB1dEludDE2KGxvbmdWYWx1ZSk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9VSU5UMTY6CisgICAgICAgICAgICBwYWNrZXQucHV0VUludDE2KGxvbmdWYWx1ZSk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9JTlQzMjoKKyAgICAgICAgICAgIHBhY2tldC5wdXRJbnQzMihsb25nVmFsdWUpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX1RZUEVfVUlOVDMyOgorICAgICAgICAgICAgcGFja2V0LnB1dFVJbnQzMihsb25nVmFsdWUpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX1RZUEVfSU5UNjQ6CisgICAgICAgICAgICBwYWNrZXQucHV0SW50NjQobG9uZ1ZhbHVlKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIE1UUF9UWVBFX1VJTlQ2NDoKKyAgICAgICAgICAgIHBhY2tldC5wdXRVSW50NjQobG9uZ1ZhbHVlKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIE1UUF9UWVBFX0lOVDEyODoKKyAgICAgICAgICAgIHBhY2tldC5wdXRJbnQxMjgobG9uZ1ZhbHVlKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIE1UUF9UWVBFX1VJTlQxMjg6CisgICAgICAgICAgICBwYWNrZXQucHV0SW50MTI4KGxvbmdWYWx1ZSk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9TVFI6CisgICAgICAgIHsKKyAgICAgICAgICAgIGpjaGFyKiBzdHIgPSBlbnYtPkdldENoYXJBcnJheUVsZW1lbnRzKG1TdHJpbmdCdWZmZXIsIDApOworICAgICAgICAgICAgcGFja2V0LnB1dFN0cmluZyhzdHIpOworICAgICAgICAgICAgZW52LT5SZWxlYXNlQ2hhckFycmF5RWxlbWVudHMobVN0cmluZ0J1ZmZlciwgc3RyLCAwKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgfQorICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgTE9HRSgidW5zdXBwb3J0ZWQgdHlwZSBpbiBnZXREZXZpY2VQcm9wZXJ0eVZhbHVlXG4iKTsKKyAgICAgICAgICAgIHJldHVybiBNVFBfUkVTUE9OU0VfSU5WQUxJRF9ERVZJQ0VfUFJPUF9GT1JNQVQ7CisgICAgfQorCisgICAgY2hlY2tBbmRDbGVhckV4Y2VwdGlvbkZyb21DYWxsYmFjayhlbnYsIF9fRlVOQ1RJT05fXyk7CisgICAgcmV0dXJuIE1UUF9SRVNQT05TRV9PSzsKK30KKworTXRwUmVzcG9uc2VDb2RlIE15TXRwRGF0YWJhc2U6OnNldERldmljZVByb3BlcnR5VmFsdWUoTXRwRGV2aWNlUHJvcGVydHkgcHJvcGVydHksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE10cERhdGFQYWNrZXQmIHBhY2tldCkgeworICAgIGludCAgICAgICAgIHR5cGU7CisKKyAgICBpZiAoIWdldERldmljZVByb3BlcnR5SW5mbyhwcm9wZXJ0eSwgdHlwZSkpCisgICAgICAgIHJldHVybiBNVFBfUkVTUE9OU0VfREVWSUNFX1BST1BfTk9UX1NVUFBPUlRFRDsKKworICAgIEpOSUVudiogZW52ID0gQW5kcm9pZFJ1bnRpbWU6OmdldEpOSUVudigpOworICAgIGpsb25nIGxvbmdWYWx1ZSA9IDA7CisgICAganN0cmluZyBzdHJpbmdWYWx1ZSA9IE5VTEw7CisKKyAgICBzd2l0Y2ggKHR5cGUpIHsKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9JTlQ4OgorICAgICAgICAgICAgbG9uZ1ZhbHVlID0gcGFja2V0LmdldEludDgoKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIE1UUF9UWVBFX1VJTlQ4OgorICAgICAgICAgICAgbG9uZ1ZhbHVlID0gcGFja2V0LmdldFVJbnQ4KCk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9JTlQxNjoKKyAgICAgICAgICAgIGxvbmdWYWx1ZSA9IHBhY2tldC5nZXRJbnQxNigpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX1RZUEVfVUlOVDE2OgorICAgICAgICAgICAgbG9uZ1ZhbHVlID0gcGFja2V0LmdldFVJbnQxNigpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX1RZUEVfSU5UMzI6CisgICAgICAgICAgICBsb25nVmFsdWUgPSBwYWNrZXQuZ2V0SW50MzIoKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIE1UUF9UWVBFX1VJTlQzMjoKKyAgICAgICAgICAgIGxvbmdWYWx1ZSA9IHBhY2tldC5nZXRVSW50MzIoKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIE1UUF9UWVBFX0lOVDY0OgorICAgICAgICAgICAgbG9uZ1ZhbHVlID0gcGFja2V0LmdldEludDY0KCk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9VSU5UNjQ6CisgICAgICAgICAgICBsb25nVmFsdWUgPSBwYWNrZXQuZ2V0VUludDY0KCk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9TVFI6CisgICAgICAgIHsKKyAgICAgICAgICAgIE10cFN0cmluZ0J1ZmZlciBidWZmZXI7CisgICAgICAgICAgICBwYWNrZXQuZ2V0U3RyaW5nKGJ1ZmZlcik7CisgICAgICAgICAgICBzdHJpbmdWYWx1ZSA9IGVudi0+TmV3U3RyaW5nVVRGKChjb25zdCBjaGFyICopYnVmZmVyKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgfQorICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgTE9HRSgidW5zdXBwb3J0ZWQgdHlwZSBpbiBzZXREZXZpY2V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ORExFOworCisgICAgamludCogaW50VmFsdWVzID0gZW52LT5HZXRJbnRBcnJheUVsZW1lbnRzKG1JbnRCdWZmZXIsIDApOworICAgIE10cFN0b3JhZ2VJRCBzdG9yYWdlSUQgPSBpbnRWYWx1ZXNbMF07CisgICAgTXRwT2JqZWN0Rm9ybWF0IGZvcm1hdCA9IGludFZhbHVlc1sxXTsKKyAgICBNdHBPYmplY3RIYW5kbGUgcGFyZW50ID0gaW50VmFsdWVzWzJdOworICAgIGVudi0+UmVsZWFzZUludEFycmF5RWxlbWVudHMobUludEJ1ZmZlciwgaW50VmFsdWVzLCAwKTsKKworICAgIGpsb25nKiBsb25nVmFsdWVzID0gZW52LT5HZXRMb25nQXJyYXlFbGVtZW50cyhtTG9uZ0J1ZmZlciwgMCk7CisgICAgdWludDY0X3Qgc2l6ZSA9IGxvbmdWYWx1ZXNbMF07CisgICAgdWludDY0X3QgbW9kaWZpZWQgPSBsb25nVmFsdWVzWzFdOworICAgIGVudi0+UmVsZWFzZUxvbmdBcnJheUVsZW1lbnRzKG1Mb25nQnVmZmVyLCBsb25nVmFsdWVzLCAwKTsKKworLy8gICAgaW50IGFzc29jaWF0aW9uVHlwZSA9IChmb3JtYXQgPT0gTVRQX0ZPUk1BVF9BU1NPQ0lBVElPTiA/CisvLyAgICAgICAgICAgICAgICAgICAgICAgICAgICBNVFBfQVNTT0NJQVRJT05fVFlQRV9HRU5FUklDX0ZPTERFUiA6CisvLyAgICAgICAgICAgICAgICAgICAgICAgICAgICBNVFBfQVNTT0NJQVRJT05fVFlQRV9VTkRFRklORUQpOworICAgIGludCBhc3NvY2lhdGlvblR5cGUgPSBNVFBfQVNTT0NJQVRJT05fVFlQRV9VTkRFRklORUQ7CisKKyAgICBwYWNrZXQucHV0VUludDMyKHN0b3JhZ2VJRCk7CisgICAgcGFja2V0LnB1dFVJbnQxNihmb3JtYXQpOworICAgIHBhY2tldC5wdXRVSW50MTYoMCk7ICAgLy8gcHJvdGVjdGlvbiBzdGF0dXM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KGRhdGUpOyAgIC8vIGRhdGUgbW9kaWZpZWQKKyAgICBwYWNrZXQucHV0RW1wdHlTdHJpbmcoKTsgICAvLyBrZXl3b3JkcworCisgICAgY2hlY2tBbmRDbGVhckV4Y2VwdGlvbkZyb21DYWxsYmFjayhlbnYsIF9fRlVOQ1RJT05fXyk7CisgICAgcmV0dXJuIE1UUF9SRVNQT05TRV9PSzsKK30KKworTXRwUmVzcG9uc2VDb2RlIE15TXRwRGF0YWJhc2U6OmdldE9iamVjdEZpbGVQYXRoKE10cE9iamVjdEhhbmRsZSBoYW5kbGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE10cFN0cmluZyYgZmlsZVBhdGgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDY0X3QmIGZpbGVMZW5ndGgpIHsKKyAgICBKTklFbnYqIGVudiA9IEFuZHJvaWRSdW50aW1lOjpnZXRKTklFbnYoKTsKKyAgICBqaW50IHJlc3VsdCA9IGVudi0+Q2FsbEludE1ldGhvZChtRGF0YWJhc2UsIG1ldGhvZF9nZXRPYmplY3RGaWxlUGF0aCwKKyAgICAgICAgICAgICAgICAoamludCloYW5kbGUsIG1TdHJpbmdCdWZmZXIsIG1Mb25nQnVmZmVyKTsKKyAgICBpZiAocmVzdWx0ICE9IE1UUF9SRVNQT05TRV9PSykgeworICAgICAgICBjaGVja0FuZENsZWFyRXhjZXB0aW9uRnJvbUNhbGxiYWNrKGVudiwgX19GVU5DVElPTl9fKTsKKyAgICAgICAgcmV0dXJuIHJlc3VsdDsKKyAgICB9CisKKyAgICBqY2hhciogc3RyID0gZW52LT5HZXRDaGFyQXJyYXlFbGVtZW50cyhtU3RyaW5nQnVmZmVyLCAwKTsKKyAgICBmaWxlUGF0aC5zZXRUbyhzdHIsIHN0cmxlbjE2KHN0cikpOworICAgIGVudi0+UmVsZWFzZUNoYXJBcnJheUVsZW1lbnRzKG1TdHJpbmdCdWZmZXIsI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lwZTsKKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9CisgICAgfQorICAgIHJldHVybiBmYWxzZTsKK30KKworYm9vbCBNeU10cERhdGFiYXNlOjpnZXREZXZpY2VQcm9wZXJ0eUluZm8oTXRwRGV2aWNlUHJvcGVydHkgcHJvcGVydHksIGludCYgdHlwZSkgeworICAgIGludCBjb3VudCA9IHNpemVvZihrRGV2aWNlUHJvcGVydHlUYWJsZSkgLyBzaXplb2Yoa0RldmljZVByb3BlcnR5VGFibGVbMF0pOworICAgIGNvbnN0IFByb3BlcnR5VGFibGVFbnRyeSogZW50cnkgPSBrRGV2aWNlUHJvcGVydHlUYWJsZTsKKyAgICBmb3IgKGludCBpID0gMDsgaSA8IGNvdW50OyBpKyssIGVudHJ5KyspIHsKKyAgICAgICAgaWYgKGVudHJ5LT5wcm9wZXJ0eSA9PSBwcm9wZXJ0eSkgeworICAgICAgICAgICAgdHlwZSA9IGVudHJ5LT50eXBlOworICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgIH0KKyAgICB9CisgICAgcmV0dXJuIGZhbHNlOworfQorCitNdHBPYmplY3RIYW5kbGVMaXN0KiBNeU10cERhdGFiYXNlOjpnZXRPYmplY3RSZWZlcmVuY2VzKE10cE9iamVjdEhhbmRsZSBoYW5kbGUpIHsKKyAgICBKTklFbnYqIGVudiA9IEFuZHJvaWRSdW50aW1lOjpnZXRKTklFbnYoKTsKKyAgICBqaW50QXJyYXkgYXJyYXkgPSAoamludEFycmF5KWVudi0+Q2FsbE9iamVjdE1ldGhvZChtRGF0YWJhc2UsIG1ldGhvZF9nZXRPYmplY3RSZWZlcmVuY2VzLAorICAgICAgICAgICAgICAgIChqaW50KWhhbmRsZSk7CisgICAgaWYgKCFhcnJheSkKKyAgICAgICAgcmV0dXJuIE5VTEw7CisgICAgTXRwT2JqZWN0SGFuZGxlTGlzdCogbGlzdCA9IG5ldyBNdHBPYmplY3RIYW5kbGVMaXN0KCk7CisgICAgamludCogaGFuZGxlcyA9IGVudi0+R2V0SW50QXJyYXlFbGVtZW50cyhhcnJheSwgMCk7CisgICAganNpemUgbGVuZ3RoID0gZW52LT5HZXRBcnJheUxlbmd0aChhcnJheSk7CisgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBsZW5ndGg7IGkrKykKKyAgICAgICAgbGlzdC0+cHVzaChoYW5kbGVzW2ldKTsKKyAgICBlbnYtPlJlbGVhc2VJbnRBcnJheUVsZW1lbnRzKGFycmF5LCBoYW5kbGVzLCAwKTsKKworICAgIGNoZWNrQW5kQ2xlYXJFeGNlcHRpb25Gcm9tQ2FsbGJhY2soZW52LCBfX0ZVTkNUSU9OX18pOworICAgIHJldHVybiBsaXN0OworfQorCitNdHBSZXNwb25zZUNvZGUgTXlNdHBEYXRhYmFzZTo6c2V0T2JqZWN0UmVmZXJlbmNlcyhNdHBPYmplY3RIYW5kbGUgaGFuZGxlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE10cE9iamVjdEhhbmRsZUxpc3QqIHJlZmVyZW5jZXMpIHsKKyAgICBKTklFbnYqIGVudiA9IEFuZHJvaWRSdW50aW1lOjpnZXRKTklFbnYoKTsKKyAgICBpbnQgY291bnQgPSByZWZlcmVuY2VzLT5zaXplKCk7CisgICAgamludEFycmF5IGFycmF5ID0gZW52LT5OZXdJbnRBcnJheShjb3VudCk7CisgICAgaWYgKCFhcnJheSkgeworICAgICAgICBMT0dFKCJvdXQgb2YgbWVtb3J5IGluIHNldE9iamVjdFJlZmVyZW5jZXMiKTsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKyAgICBqaW50KiBoYW5kbGVzID0gZW52LT5HZXRJbnRBcnJheUVsZW1lbnRzKGFycmF5LCAwKTsKKyAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBjb3VudDsgaSsrKQorICAgICAgICBoYW5kbGVzW2ldID0gKCpyZWZlcmVuY2VzKVtpXTsKKyAgICBlbnYtP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TSVpFOgorICAgICAgICAgICAgcmVzdWx0ID0gbmV3IE10cFByb3BlcnR5KHByb3BlcnR5LCBNVFBfVFlQRV9VSU5UNjQpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX1BST1BFUlRZX1BFUlNJU1RFTlRfVUlEOgorICAgICAgICAgICAgcmVzdWx0ID0gbmV3IE10cFByb3BlcnR5KHByb3BlcnR5LCBNVFBfVFlQRV9VSU5UMTI4KTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIE1UUF9QUk9QRVJUWV9PQkpFQ1RfRklMRV9OQU1FOgorICAgICAgICBjYXNlIE1UUF9QUk9QRVJUWV9EQVRFX01PRElGSUVEOgorICAgICAgICAgICAgcmVzdWx0ID0gbmV3IE10cFByb3BlcnR5KHByb3BlcnR5LCBNVFBfVFlQRV9TVFIpOworICAgICAgICAgICAgYnJlYWs7CisgICAgfQorCisgICAgcmV0dXJuIHJlc3VsdDsKK30KKworTXRwUHJvcGVydHkqIE15TXRwRGF0YWJhc2U6OmdldERldmljZVByb3BlcnR5RGVzYyhNdHBEZXZpY2VQcm9wZXJ0eSBwcm9wZXJ0eSkgeworICAgIE10cFByb3BlcnR5KiByZXN1bHQgPSBOVUxMOworICAgIHN3aXRjaCAocHJvcGVydHkpIHsKKyAgICAgICAgY2FzZSBNVFBfREVWSUNFX1BST1BFUlRZX1NZTkNIUk9OSVpBVElPTl9QQVJUTkVSOgorICAgICAgICBjYXNlIE1UUF9ERVZJQ0VfUFJPUEVSVFlfREVWSUNFX0ZSSUVORExZX05BTUU6CisgICAgICAgICAgICAvLyB3cml0ZWFibGUgc3RyaW5nIHByb3BlcnRpZXMKKyAgICAgICAgICAgIHJlc3VsdCA9IG5ldyBNdHBQcm9wZXJ0eShwcm9wZXJ0eSwgTVRQX1RZUEVfU1RSLCB0cnVlKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgIH0KKworICAgIHJldHVybiByZXN1bHQ7Cit9CisKK3Zv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yAgICBqY2xhc3MgY2xheno7CisKKyAgICBMT0dEKCJyZWdpc3Rlcl9hbmRyb2lkX21lZGlhX010cERhdGFiYXNlXG4iKTsKKworICAgIGNsYXp6ID0gZW52LT5GaW5kQ2xhc3MoImFuZHJvaWQvbWVkaWEvTXRwRGF0YWJhc2UiKTsKKyAgICBpZiAoY2xhenogPT0gTlVMTCkgeworICAgICAgICBMT0dFKCJDYW4ndCBmaW5kIGFuZHJvaWQvbWVkaWEvTXRwRGF0YWJhc2UiKTsKKyAgICAgICAgcmV0dXJuIC0xOworICAgIH0KKyAgICBtZXRob2RfYmVnaW5TZW5kT2JqZWN0ID0gZW52LT5HZXRNZXRob2RJRChjbGF6eiwgImJlZ2luU2VuZE9iamVjdCIsICIoTGphdmEvbGFuZy9TdHJpbmc7SUlJSkopSSIpOworICAgIGlmIChtZXRob2RfYmVnaW5TZW5kT2JqZWN0ID09IE5VTEwpIHsKKyAgICAgICAgTE9HRSgiQ2FuJ3QgZmluZCBiZWdpblNlbmRPYmplY3QiKTsKKyAgICAgICAgcmV0dXJuIC0xOworICAgIH0KKyAgICBtZXRob2RfZW5kU2VuZE9iamVjdCA9IGVudi0+R2V0TWV0aG9kSUQoY2xhenosICJlbmRTZW5kT2JqZWN0IiwgIihMamF2YS9sYW5nL1N0cmluZztJSVopViIpOworICAgIGlmIChtZXRob2RfZW5kU2VuZE9iamVjdCA9PSBOVUxMKSB7CisgICAgICAgIExPR0UoIkNhbid0IGZpbmQgZW5kU2VuZE9iamVjdCIpOworICAgICAgICByZXR1cm4gLTE7CisgICAgfQorICAgIG1ldGhvZF9nZXRPYmplY3RMaXN0ID0gZW52LT5HZXRNZXRob2RJRChjbGF6eiwgImdldE9iamVjdExpc3QiLCAiKElJSSlbSSIpOworICAgIGlmIChtZXRob2RfZ2V0T2JqZWN0TGlzdCA9PSBOVUxMKSB7CisgICAgICAgIExPR0UoIkNhbid0IGZpbmQgZ2V0T2JqZWN0TGlzdCIpOworICAgICAgICByZXR1cm4g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Y2xhenosICJnZXREZXZpY2VQcm9wZXJ0eSIsICIoSVtKW0MpSSIpOworICAgIGlmIChtZXRob2RfZ2V0RGV2aWNlUHJvcGVydHkgPT0gTlVMTCkgeworICAgICAgICBMT0dFKCJDYW4ndCBmaW5kIGdldERldmljZVByb3BlcnR5Iik7CisgICAgICAgIHJldHVybiAtMTsKKyAgICB9CisgICAgbWV0aG9kX3NldERldmljZVByb3BlcnR5ID0gZW52LT5HZXRNZXRob2RJRChjbGF6eiwgInNldERldmljZVByb3BlcnR5IiwgIihJSkxqYXZhL2xhbmcvU3RyaW5nOylJIik7CisgICAgaWYgKG1ldGhvZF9zZXREZXZpY2VQcm9wZXJ0eSA9PSBOVUxMKSB7CisgICAgICAgIExPR0UoIkNhbid0IGZpbmQgc2V0RGV2aWNlUHJvcGVydHkiKTsKKyAgICAgICAgcmV0dXJuIC0xOworICAgIH0KKyAgICBtZXRob2RfZ2V0T2JqZWN0SW5mbyA9IGVudi0+R2V0TWV0aG9kSUQoY2xhenosICJnZXRPYmplY3RJbmZvIiwgIihJW0lbQ1tKKVoiKTsKKyAgICBpZiAobWV0aG9kX2dldE9iamVjdEluZm8gPT0gTlVMTCkgeworICAgICAgICBMT0dFKCJDYW4ndCBmaW5kIGdldE9iamVjdEluZm8iKTsKKyAgICAgICAgcmV0dXJuIC0xOworICAgIH0KKyAgICBtZXRob2RfZ2V0T2JqZWN0RmlsZVBhdGggPSBlbnYtPkdldE1ldGhvZElEKGNsYXp6LCAiZ2V0T2JqZWN0RmlsZVBhdGgiLCAiKElbQ1tKKUkiKTsKKyAgICBpZiAobWV0aG9kX2dldE9iamVjdEZpbGVQYXRoID09IE5VTEwpIHsKKyAgICAgICAgTE9HRSgiQ2FuJ3QgZmluZCBnZXRPYmplY3RGaWxlUGF0aCIpOworICAgICAgICByZXR1cm4gLTE7CisgICAgfQorICAgIG1ldGhvZF9kZWxldGVGaWxlID0gZW52LT5HZXRNZXRob2RJRChjbGF6eiwgImRlbGV0ZUZpbGU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QgamF2YVNlcnZlcikKKyAgICAgICAgOiAgIG1EYXRhYmFzZShkYXRhYmFzZSksCisgICAgICAgICAgICBtU2VydmVyKE5VTEwpLAorICAgICAgICAgICAgbVN0b3JhZ2VQYXRoKHN0b3JhZ2VQYXRoKSwKKyAgICAgICAgICAgIG1KYXZhU2VydmVyKGphdmFTZXJ2ZXIpLAorICAgICAgICAgICAgbUZkKC0xKQorICAgIHsKKyAgICB9CisKKyAgICB2b2lkIHNldFB0cE1vZGUoYm9vbCB1c2VQdHApIHsKKyAgICAgICAgc011dGV4LmxvY2soKTsKKyAgICAgICAgaWYgKG1GZCA+PSAwKSB7CisgICAgICAgICAgICBpb2N0bChtRmQsIE1UUF9TRVRfSU5URVJGQUNFX01PREUsCisgICAgICAgICAgICAgICAgICAgICh1c2VQdHAgPyBNVFBfSU5URVJGQUNFX01PREVfUFRQIDogTVRQX0lOVEVSRkFDRV9NT0RFX01UUCkpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgaW50IGZkID0gb3BlbigiL2Rldi9tdHBfdXNiIiwgT19SRFdSKTsKKyAgICAgICAgICAgIGlmIChmZCA+PSAwKSB7CisgICAgICAgICAgICAgICAgaW9jdGwoZmQsIE1UUF9TRVRfSU5URVJGQUNFX01PREUsCisgICAgICAgICAgICAgICAgICAgICAgICAodXNlUHRwID8gTVRQX0lOVEVSRkFDRV9NT0RFX1BUUCA6IE1UUF9JTlRFUkZBQ0VfTU9ERV9NVFApKTsKKyAgICAgICAgICAgICAgICBjbG9zZShmZCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgc011dGV4LnVubG9jaygpOworICAgIH0KKworICAgIHZpcnR1YWwgYm9vbCB0aHJlYWRMb29wKCkgeworICAgICAgICBzTXV0ZXgubG9jaygpOworICAgICAgICBtRmQgPSBvcGVuKCIvZGV2L210cF91c2IiLCBPX1JEV1IpOworICAgICAgICBwcmludGYoIm9wZW4gcmV0dXJuZWQgJWRcbiIsIG1GZCk7CisgICAgICAgIGlmIChtRmQgPCAwKSB7CisgICAgICAgICAgICBMT0dFKCJjb3VsZCBub3Qgb3BlbiBNVFAgZHJpdmVyXG4iKTsKKyAgICAgICAgICAgIHNNdXRleC51bmxvY2soKTsKKyAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgfQorCisgICAgICAgIG1TZXJ2ZXIgPSBuZXcgTXRwU2VydmVyKG1GZCwgbURhdGFiYXNlLCBBSURfU0RDQVJEX1JXLCAwNjY0LCAwNzc1KTsKKyAgICAgICAgbVNlcnZlci0+YWRkU3RvcmFnZShtU3RvcmFnZVBhdGgpOworICAgICAgICBzTXV0ZXgudW5sb2NrKCk7CisKKyAgICAgICAgTE9HRCgiTXRwVGhyZWFkIG1TZXJ2ZXItPnJ1biIpOworICAgICAgICBtU2VydmVyLT5ydW4oKTsKKworICAgICAgICBzTXV0ZXgubG9jaygpOworICAgICAgICBjbG9zZShtRmQpOworICAgICAgICBtRmQgPSAtMTsKKyAgICAgICAgZGVsZXRlIG1TZXJ2ZXI7CisgICAgICAgIG1TZXJ2ZXIgPSBOVUxMOworCisgICAgICAgIEpOSUVudiogZW52ID0gQW5kcm9pZFJ1bnRpbWU6OmdldEpOSUVudigpOworICAgICAgICBlbnYtPlNldEludEZpZWxkKG1KYXZhU2VydmVyLCBmaWVsZF9jb250ZXh0LCAwKTsKKyAgICAgICAgZW52LT5EZWxldGVHbG9iYWxSZWYobUphdmFTZXJ2ZXIpOworICAgICAgICBzTXV0ZXgudW5sb2NrKCk7CisKKyAgICAgICAgTE9HRCgidGhyZWFkTG9vcCByZXR1cm5pbmciKTsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIHZvaWQgc2VuZE9iamVjdEFkZGVkKE10cE9iamVjdEhhbmRsZSBoYW5kbGUpIHsKKyAgICAgICAgc011dGV4LmxvY2soKTsKKyAgICAgICAgaWYgKG1TZXJ2ZXIpCisgICAgICAgICAgICBtU2VydmVyLT5zZW5kT2JqZWN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JbnQzMigpOwogICAgIH0KIAorICAgIHN0YXR1c190IHNldE91dHB1dEZpbGVBdXhpbGlhcnkoaW50IGZkKSB7CisgICAgICAgIExPR1YoInNldE91dHB1dEZpbGVBdXhpbGlhcnkoJWQpIiwgZmQpOworICAgICAgICBQYXJjZWwgZGF0YSwgcmVwbHk7CisgICAgICAgIGRhdGEud3JpdGVJbnRlcmZhY2VUb2tlbihJTWVkaWFSZWNvcmRlcjo6Z2V0SW50ZXJmYWNlRGVzY3JpcHRvcigpKTsKKyAgICAgICAgZGF0YS53cml0ZUZpbGVEZXNjcmlwdG9yKGZkKTsKKyAgICAgICAgcmVtb3RlKCktPnRyYW5zYWN0KFNFVF9PVVRQVVRfRklMRV9BVVhJTElBUllfRkQsIGRhdGEsICZyZXBseSk7CisgICAgICAgIHJldHVybiByZXBseS5yZWFkSW50MzIoKTsKKyAgICB9CisKICAgICBzdGF0dXNfdCBzZXRWaWRlb1NpemUoaW50IHdpZHRoLCBpbnQgaGVpZ2h0KQogICAgIHsKICAgICAgICAgTE9HVigic2V0VmlkZW9TaXplKCVkeCVkKSIsIHdpZHRoLCBoZWlnaHQpOwpAQCAtMzc3LDYgKzM4NywxMyBAQAogICAgICAgICAgICAgOjpjbG9zZShmZCk7CiAgICAgICAgICAgICByZXR1cm4gTk9fRVJST1I7CiAgICAgICAgIH0gYnJlYWs7CisgICAgICAgIGNhc2UgU0VUX09VVFBVVF9GSUxFX0FVWElMSUFSWV9GRDogeworICAgICAgICAgICAgTE9HVigiU0VUX09VVFBVVF9GSUxFX0FVWElMSUFSWV9GRCIpOworICAgICAgICAgICAgQ0hFQ0tfSU5URVJGQUNFKElNZWRpYVJlY29yZGVyLCBkYXRhLCByZXBseSk7CisgICAgICAgICAgICBpbnQgZmQgPSBkdXAoZGF0YS5yZWFkRmlsZURlc2NyaXB0b3IoKSk7CisgICAgICAgICAgICByZXBseS0+d3JpdGVJbnQzMihzZXRPdXRwdXRGaWxlQXV4aWxpYXJ5KGZkKSk7Cis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AgICAgfQogCisKKyAgICB2aXJ0dWFsIHN0YXR1c190IHVzZUdyYXBoaWNCdWZmZXIoCisgICAgICAgICAgICBub2RlX2lkIG5vZGUsIE9NWF9VMzIgcG9ydF9pbmRleCwKKyAgICAgICAgICAgIGNvbnN0IHNwPEdyYXBoaWNCdWZmZXI+ICZncmFwaGljQnVmZmVyLCBidWZmZXJfaWQgKmJ1ZmZlcikgeworICAgICAgICBQYXJjZWwgZGF0YSwgcmVwbHk7CisgICAgICAgIGRhdGEud3JpdGVJbnRlcmZhY2VUb2tlbihJT01YOjpnZXRJbnRlcmZhY2VEZXNjcmlwdG9yKCkpOworICAgICAgICBkYXRhLndyaXRlSW50UHRyKChpbnRwdHJfdClub2RlKTsKKyAgICAgICAgZGF0YS53cml0ZUludDMyKHBvcnRfaW5kZXgpOworICAgICAgICBkYXRhLndyaXRlKCpncmFwaGljQnVmZmVyKTsKKyAgICAgICAgcmVtb3RlKCktPnRyYW5zYWN0KFVTRV9HUkFQSElDX0JVRkZFUiwgZGF0YSwgJnJlcGx5KTsKKworICAgICAgICBzdGF0dXNfdCBlcnIgPSByZXBseS5yZWFkSW50MzIoKTsKKyAgICAgICAgaWYgKGVyciAhPSBPSykgeworICAgICAgICAgICAgKmJ1ZmZlciA9IDA7CisKKyAgICAgICAgICAgIHJldHVybiBlcnI7CisgICAgICAgIH0KKworICAgICAgICAqYnVmZmVyID0gKHZvaWQqKXJlcGx5LnJlYWRJbnRQdHIoKTsKKworICAgICAgICByZXR1cm4gZXJyOworICAgIH0KKwogICAgIHZpcnR1YWwgc3RhdHVzX3QgYWxsb2NhdGVCdWZmZXIoCiAgICAgICAgICAgICBub2RlX2lkIG5vZGUsIE9NWF9VMzIgcG9ydF9pbmRleCwgc2l6ZV90IHNpemUsCiAgICAgICAgICAgICBidWZmZXJfaWQgKmJ1ZmZlciwgdm9pZCAqKmJ1ZmZlcl9kYXRhKSB7CkBAIC01NDEsNiArNTc5LDIwIEBACiAgICAgICAgICAgICByZXR1cm4gTk9fRVJST1I7CiAgICAgICAgIH0KIAorICAgICAgICBjYXNlIEVOQUJMRV9HUkFQSElDX0JVRkZFUlM6CisgICAgICAgIHsKKyAgICAgICAgICAgIENIRUNLX0lOVEVSRkFDRShJT01YLCBkYXRhLCByZXBseSk7CisKKyAgICAgICAgICAgIG5vZGVfaWQgbm9kZSA9ICh2b2lkKilkYXRhLnJlYWRJbnRQdHIoKTsKKyAgICAgICAgICAgIE9NWF9VMzIgcG9ydF9pbmRleCA9IGRhdGEucmVhZEludDMyKCk7CisgICAgICAgICAgICBPTVhfQk9PTCBlbmFibGUgPSAoT01YX0JPT0wpZGF0YS5yZWFkSW50MzIoKTsKKworICAgICAgICAgICAgc3RhdHVzX3QgZXJyID0gZW5hYmxlR3JhcGhpY0J1ZmZlcnMobm9kZSwgcG9ydF9pbmRleCwgZW5hYmxlKTsKKyAgICAgICAgICAgIHJlcGx5LT53cml0ZUludDMyKGVycik7CisKKyAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKKyAgICAgICAgfQorCiAgICAgICAgIGNhc2UgVVNFX0JVRkZFUjoKICAgICAgICAgewogICAgICAgICAgICAgQ0hFQ0tfSU5URVJGQUNFKElPTVgsIGRhdGEsIHJlcGx5KTsKQEAgLTU2MSw2ICs2MTMsMjcgQEAKICAgICAgICAgICAgIHJldHVybiBOT19FUlJPUjsKICAgICAgICAgfQogCisgICAgICAgIGNhc2UgVVNFX0dSQVBISUNfQlVGRkVSOgorICAgICAgICB7CisgICAgICAgICAgICBDSEVDS19JTlRFUkZBQ0UoSU9NWCwgZGF0YSwgcmVwbHkpOworCisgICAgICAgICAgICBub2RlX2lkIG5vZGUgPSAodm9pZCopZGF0YS5yZWFkSW50UHRyKCk7CisgICAgICAgICAgICBPTVhfVTMyIHBvcnRfaW5kZXggPSBkYXRhLnJlYWRJbnQzMigpOworICAgICAgICAgICAgc3A8R3JhcGhpY0J1ZmZlcj4gZ3JhcGhpY0J1ZmZlciA9IG5ldyBHcmFwaGljQnVmZmVyKCk7CisgICAgICAgICAgICBkYXRhLnJlYWQoKmdyYXBoaWNCdWZmZXIpOworCisgICAgICAgICAgICBidWZmZXJfaWQgYnVmZmVyOworICAgICAgICAgICAgc3RhdHVzX3QgZXJyID0gdXNlR3JhcGhpY0J1ZmZlcigKKyAgICAgICAgICAgICAgICAgICAgbm9kZSwgcG9ydF9pbmRleCwgZ3JhcGhpY0J1ZmZlciwgJmJ1ZmZlcik7CisgICAgICAgICAgICByZXBseS0+d3JpdGVJbnQzMihlcnIpOworCisgICAgICAgICAgICBpZiAoZXJyID09IE9LKSB7CisgICAgICAgICAgICAgICAgcmVwbHktPndyaXRlSW50UHRyKChpbnRwdHJfdClidWZmZXIpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICByZXR1cm4gTk9fRVJST1I7CisgICAgICAgIH0KKwogICAgICAgICBjYXNlIEFMTE9DX0JVRkZFUjoKICAgICAgICAgewogICAgICAgICAgICAgQ0hFQ0tfSU5URVJGQUNFKElPTVgsIGRhdGEsIHJlcGx5KTsKZGlmZiAtLWdpdCBhL21lZGlhL2xpYm1lZGlhL01lZGlhU2Nhbm5lci5jcHAgYi9tZWRpYS9saWJtZWRpYS9NZWRpYVNjYW5uZXIuY3BwCmluZGV4IGM1MTEyYTUuLmJhOThmMDQgMTAwNjQ0Ci0tLSBhL21lZGlhL2xpYm1lZGlhL01lZGlhU2Nhbm5lci5jcHAKKysrIGIvbWVkaWEvbGlibWVkaWEvTWVkaWFTY2FubmVyLmNwcApAQCAtMTMzLDYgKzEzMywxMyBAQAogICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgIH0KIAorICAgICAgICBpbnQgbmFtZUxlbmd0aCA9IHN0cmxlbihuYW1lKTsKKyAgICAgICAgaWYgKG5hbWVMZW5ndGggKyAxID4gcGF0aFJlbWFpbmluZykgeworICAgICAgICAgICAgLy8gcGF0aCB0b28gbG9uZyEKKyAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICB9CisgICAgICAgIHN0cmNweShmaWxlU3BvdCwgbmFtZSk7CisKICAgICAgICAgaW50IHR5cGUgPSBlbnRyeS0+ZF90eXBlOwogICAgICAgICBpZiAodHlwZSA9PSBEVF9VTktOT1dOKSB7CiAgICAgICAgICAgICAvLyBJZiB0aGUgdHlwZSBpcyB1bmtub3duLCBzdGF0KCkgdGhlIGZpbGUgaW5zdGVhZC4KQEAgLTE1MCwxNiArMTU3LDcgQEAKICAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgICAgICBpZiAodHlwZSA9PSBEVF9SRUcgfHwgdHlwZSA9PSBEVF9ESVIpIHsKLSAgICAgICAgICAgIGludCBuYW1lTGVuZ3RoID0gc3RybGVuKG5hbWUpOwotICAgICAgICAgICAgYm9vbCBpc0RpcmVjdG9yeSA9ICh0eXBlID09IERUX0RJUik7Ci0KLSAgICAgICAgICAgIGlmIChuYW1lTGVuZ3RoID4gcGF0aFJlbWFpbmluZyB8fCAoaXNEaXJlY3RvcnkgJiYgbmFtZUxlbmd0aCArIDEgPiBwYXRoUmVtYWluaW5nKSkgewotICAgICAgICAgICAgICAgIC8vIHBhdGggdG9vIGxvbmchCi0gICAgICAgICAgICAgICAgY29udGludWU7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIHN0cmNweShmaWxlU3BvdCwgbmFtZSk7Ci0gICAgICAgICAgICBpZiAoaXNEaXJlY3RvcnkpIHsKKyAgICAgICAgICAgIGlmICh0eXBlID09IERUX0RJUikgewogICAgICAgICAgICAgICAgIC8vIGlnbm9yZSBkaXJlY3RvcmllcyB3aXRoIGEgbmFtZSB0aGF0IHN0YXJ0cyB3aXRoICcuJwogICAgICAgICAgICAgICAgIC8vIGZvciBleGFtcGxlLCB0aGUgTWFjICIuVHJhc2hlcyIgZGlyZWN0b3J5CiAgICAgICAgICAgICAgICAgaWYgKG5hbWVbMF0gPT0gJy4nKSBjb250aW51ZTsKZGlmZiAtLWdpdCBhL21lZGlhL2xpYm1lZGlhL21lZGlhcGxheWVyLm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9CisgICAgICAgIGlmIChlcnIgIT0gT0spIHsKKyAgICAgICAgICAgIHJldHVybiBlcnI7CisgICAgICAgIH0KKwogICAgICAgICBzcDxNZWRpYVNvdXJjZT4gZW5jb2RlcjsKLSAgICAgICAgZXJyID0gc2V0dXBWaWRlb0VuY29kZXIoJmVuY29kZXIpOwotICAgICAgICBpZiAoZXJyICE9IE9LKSByZXR1cm4gZXJyOworICAgICAgICBlcnIgPSBzZXR1cFZpZGVvRW5jb2RlcihjYW1lcmFNZWRpYVNvdXJjZSwgdmlkZW9CaXRSYXRlLCAmZW5jb2Rlcik7CisgICAgICAgIGlmIChlcnIgIT0gT0spIHsKKyAgICAgICAgICAgIHJldHVybiBlcnI7CisgICAgICAgIH0KKwogICAgICAgICB3cml0ZXItPmFkZFNvdXJjZShlbmNvZGVyKTsKLSAgICAgICAgdG90YWxCaXRSYXRlICs9IG1WaWRlb0JpdFJhdGU7CisgICAgICAgICp0b3RhbEJpdFJhdGUgKz0gdmlkZW9CaXRSYXRlOwogICAgIH0KIAogICAgIGlmIChtSW50ZXJsZWF2ZUR1cmF0aW9uVXMgPiAwKSB7CiAgICAgICAgIHJlaW50ZXJwcmV0X2Nhc3Q8TVBFRzRXcml0ZXIgKj4od3JpdGVyLmdldCgpKS0+CiAgICAgICAgICAgICBzZXRJbnRlcmxlYXZlRHVyYXRpb24obUludGVybGVhdmVEdXJhdGlvblVzKTsKICAgICB9Ci0KICAgICBpZiAobU1heEZpbGVEdXJhdGlvblVzICE9IDApIHsKICAgICAgICAgd3JpdGVyLT5zZXRNYXhGaWxlRHVyYXRpb24obU1heEZpbGVEdXJhdGlvblVzKTsKICAgICB9CiAgICAgaWYgKG1NYXhGaWxlU2l6ZUJ5dGVzICE9IDApIHsKICAgICAgICAgd3JpdGVyLT5zZXRNYXhGaWxlU2l6ZShtTWF4RmlsZVNpemVCeXRlcyk7CiAgICAgfQotICAgIHNwPE1ldGFEYXRhPiBtZXRhID0gbmV3IE1ldGFEYXRhOwotICAg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W9IZWlnaHQsCisgICAgICAgICAgICBtVmlkZW9CaXRSYXRlLCAmdG90YWxCaXRSYXRlLCAmbVdyaXRlcik7CisgICAgaWYgKGVyciAhPSBPSykgeworICAgICAgICByZXR1cm4gZXJyOworICAgIH0KKworICAgIGludDY0X3Qgc3RhcnRUaW1lVXMgPSBzeXN0ZW1UaW1lKCkgLyAxMDAwOworICAgIHNwPE1ldGFEYXRhPiBtZXRhID0gbmV3IE1ldGFEYXRhOworICAgIHNldHVwTVBFRzRNZXRhRGF0YShzdGFydFRpbWVVcywgdG90YWxCaXRSYXRlLCAmbWV0YSk7CisKKyAgICBlcnIgPSBtV3JpdGVyLT5zdGFydChtZXRhLmdldCgpKTsKKyAgICBpZiAoZXJyICE9IE9LKSB7CisgICAgICAgIHJldHVybiBlcnI7CisgICAgfQorCisgICAgaWYgKG1DYXB0dXJlQXV4VmlkZW8pIHsKKyAgICAgICAgQ0hFQ0sobU91dHB1dEZkQXV4ID49IDApOworICAgICAgICBpZiAobVdyaXRlckF1eCAhPSBOVUxMKSB7CisgICAgICAgICAgICBMT0dFKCJBdXhpbGlhcnkgRmlsZSB3cml0ZXIgaXMgbm90IGF2YWlhbGJsZSIpOworICAgICAgICAgICAgcmV0dXJuIFVOS05PV05fRVJST1I7CisgICAgICAgIH0KKworICAgICAgICBpbnQzMl90IHRvdGFsQml0cmF0ZUF1eDsKKyAgICAgICAgZXJyID0gc2V0dXBNUEVHNFJlY29yZGluZyhtQ2FwdHVyZUF1eFZpZGVvLAorICAgICAgICAgICAgICAgIG1PdXRwdXRGZEF1eCwgbUF1eFZpZGVvV2lkdGgsIG1BdXhWaWRlb0hlaWdodCwKKyAgICAgICAgICAgICAgICBtQXV4VmlkZW9CaXRSYXRlLCAmdG90YWxCaXRyYXRlQXV4LCAmbVdyaXRlckF1eCk7CisgICAgICAgIGlmIChlcnIgIT0gT0spIHsKKyAgICAgICAgICAgIHJldHVybiBlcnI7CisgICAgICAgIH0KKworICAgICAgICBzcDxNZXRhRGF0YT4gbWV0YUF1eCA9IG5ldyBNZXRhRGF0YTsKKyAgICAgICAgc2V0dXBNUEVHNE1ldGFEYXRhKHN0YXJ0VGltZVVzLCB0b3RhbEJpdHJhdGVBdXgsICZtZXRhQXV4KTsKKworICAgICAgICByZXR1cm4gbVdyaXRlckF1eC0+c3RhcnQobWV0YUF1eC5nZXQoKSk7CisgICAgfQorCisgICAgcmV0dXJuIE9LOwogfQogCiBzdGF0dXNfdCBTdGFnZWZyaWdodFJlY29yZGVyOjpwYXVzZSgpIHsKQEAgLTEwNjYsMTIgKzEzMDIsMjggQEAKICAgICAgICAgcmV0dXJuIFVOS05PV05fRVJST1I7CiAgICAgfQogICAgIG1Xcml0ZXItPnBhdXNlKCk7CisKKyAgICBpZiAobUNhcHR1cmVBdXhWaWRlbykgeworICAgICAgICBpZiAobVdyaXRlckF1eCA9PSBOVUxMKSB7CisgICAgICAgICAgICByZXR1cm4gVU5LTk9XTl9FUlJPUjsKKyAgICAgICAgfQorICAgICAgICBtV3JpdGVyQXV4LT5wYXVzZSgpOworICAgIH0KKwogICAgIHJldHVybiBPSzsKIH0KIAogc3RhdHVzX3QgU3RhZ2VmcmlnaHRSZWNvcmRlcjo6c3RvcCgpIHsKICAgICBMT0dWKCJzdG9wIik7CiAgICAgc3RhdHVzX3QgZXJyID0gT0s7CisKKyAgICBpZiAobUNhcHR1cmVBdXhWaWRlbykgeworICAgICAgICBpZiAobVdyaXRlckF1eCAhPSBOVUxMKSB7CisgICAgICAgICAgICBtV3JpdGVyQXV4LT5zdG9wKCk7CisgICAgICAgICAgICBtV3JpdGVyQXV4LmNsZWFyKCk7CisgICAgICAgIH0KKyAgICB9CisKICAgICBpZiAobVdyaXRlciAhPSBOVUxMKSB7CiAgICAgICAgIGVyciA9IG1Xcml0ZXItPnN0b3AoKTsKICAgICAgICAgbVdyaXRlci5jbGVhcigpOwpAQCAtMTA5NSw2ICsxMzQ3LDEzIEBACiAgICAgICAgIG1PdXRwdXRGZCA9IC0xO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2aXJ0dWFsIHN0YXR1c190IHNldFZpZGVvSVN1cmZhY2UoY29uc3QgYW5kcm9pZDo6c3A8YW5kcm9pZDo6SVN1cmZhY2U+JiBzKSAgeworICAgICAgICByZXR1cm4gbVBsYXllci0+c2V0VmlkZW9JU3VyZmFjZShzKTsKKyAgICB9CisgICAgdmlydHVhbCBzdGF0dXNfdCBzZXRWaWRlb1N1cmZhY2UoY29uc3QgYW5kcm9pZDo6c3A8YW5kcm9pZDo6U3VyZmFjZT4mIHMpICB7CiAgICAgICAgIHJldHVybiBtUGxheWVyLT5zZXRWaWRlb1N1cmZhY2Uocyk7CiAgICAgfQogICAgIHZpcnR1YWwgc3RhdHVzX3QgcHJlcGFyZSgpIHtyZXR1cm4gbVBsYXllci0+cHJlcGFyZSgpO30KZGlmZiAtLWdpdCBhL21lZGlhL2xpYnN0YWdlZnJpZ2h0L0FuZHJvaWQubWsgYi9tZWRpYS9saWJzdGFnZWZyaWdodC9BbmRyb2lkLm1rCmluZGV4IDg2ZmE2NjguLjBkMTFiMzMgMTAwNjQ0Ci0tLSBhL21lZGlhL2xpYnN0YWdlZnJpZ2h0L0FuZHJvaWQubWsKKysrIGIvbWVkaWEvbGlic3RhZ2VmcmlnaHQvQW5kcm9pZC5tawpAQCAtMTAsNiArMTAsOCBAQAogICAgICAgICBBdWRpb1NvdXJjZS5jcHAgICAgICAgICAgICAgICAgICAgXAogICAgICAgICBBd2Vzb21lUGxheWVyLmNwcCAgICAgICAgICAgICAgICAgXAogICAgICAgICBDYW1lcmFTb3VyY2UuY3BwICAgICAgICAgICAgICAgICAgXAorICAgICAgICBDYW1lcmFTb3VyY2VUaW1lTGFwc2UuY3BwICAgICAgICAgXAorICAgICAgICBWaWRlb1NvdXJjZURvd25TYW1wbGVyLmNwcCAgICAgICAgXAogICAgICAgICBEYXRhU291cmNlLmNwcCAgICAgICAgICAgICAgICAgICAgXAogICAgICAgICBFU0RTLmNwcCAgICAgICAgICAgICAgICAgICAgICAgICAgXAogICAgICAgICBGaWxlU291cmNlLmNwcCAgICAgICAgICAgICAgICAgICAgXApAQCAtMjMsNiArMjUsNyBAQAogICAgICAgICBNZWRpYURlZnMuY3BwICAgICAgICAgICAgICAgICAgICAgXAogICAgICAgICBNZWRpYUV4dHJhY3Rvci5jcHAgICAgICAgICAgICAgICAgXAogICAgICAgICBNZWRpYVNvdXJjZS5jcHAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICBNZWRpYVNvdXJjZVNwbGl0dGVyLmNwcCAgICAgICAgICAgXAogICAgICAgICBNZXRhRGF0YS5jcHAgICAgICAgICAgICAgICAgICAgICAgXAogICAgICAgICBOdUNhY2hlZFNvdXJjZTIuY3BwICAgICAgICAgICAgICAgXAogICAgICAgICBOdUhUVFBEYXRhU291cmNlLmNwcCAgICAgICAgICAgICAgXApAQCAtNTgsNiArNjEsNyBAQAogICAgICAgICBsaWJzb25pdm94ICAgICAgICBcCiAgICAgICAgIGxpYnZvcmJpc2lkZWMgICAgIFwKICAgICAgICAgbGlic3VyZmFjZWZsaW5nZXJfY2xpZW50IFwKKyAgICAgICAgbGlic3RhZ2VmcmlnaHRfeXV2IFwKICAgICAgICAgbGliY2FtZXJhX2NsaWVudAogCiBMT0NBTF9TVEFUSUNfTElCUkFSSUVTIDo9IFwKZGlmZiAtLWdpdCBhL21lZGlhL2xpYnN0YWdlZnJpZ2h0L0F3ZXNvbWVQbGF5ZXIuY3BwIGIvbWVkaWEvbGlic3RhZ2VmcmlnaHQvQXdlc29tZVBsYXllci5jcHAKaW5kZXggODUwN2FmYy4uZmQ1ZjMwYiAxMDA2NDQKLS0tIGEvbWVkaWEvbGlic3RhZ2VmcmlnaHQvQXdlc29tZVBsYXllci5jcHAKKysrIGIvbWVkaWEvbGlic3RhZ2VmcmlnaHQvQXdlc29tZVBsYXllci5jcHAKQEAgLTQ0LDcgKzQ0LDcgQEAKICNpbmNsdWRlIDxtZWRpYS9zdGFnZWZyaWdodC9NZXRhRGF0YS5oPgogI2luY2x1ZGUgP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TM4LDcgKzEzOSw4IEBACiAgICAgICAgICAgICBib29sIHByZXZpZXdPbmx5LAogICAgICAgICAgICAgY29uc3QgY2hhciAqY29tcG9uZW50TmFtZSwKICAgICAgICAgICAgIE9NWF9DT0xPUl9GT1JNQVRUWVBFIGNvbG9yRm9ybWF0LAotICAgICAgICAgICAgY29uc3Qgc3A8SVN1cmZhY2U+ICZzdXJmYWNlLAorICAgICAgICAgICAgY29uc3Qgc3A8SVN1cmZhY2U+ICZpc3VyZmFjZSwKKyAgICAgICAgICAgIGNvbnN0IHNwPFN1cmZhY2U+ICZzdXJmYWNlLAogICAgICAgICAgICAgc2l6ZV90IGRpc3BsYXlXaWR0aCwgc2l6ZV90IGRpc3BsYXlIZWlnaHQsCiAgICAgICAgICAgICBzaXplX3QgZGVjb2RlZFdpZHRoLCBzaXplX3QgZGVjb2RlZEhlaWdodCk7CiAKQEAgLTE1MCw3ICsxNTIsOCBAQAogICAgICAgICBib29sIHByZXZpZXdPbmx5LAogICAgICAgICBjb25zdCBjaGFyICpjb21wb25lbnROYW1lLAogICAgICAgICBPTVhfQ09MT1JfRk9STUFUVFlQRSBjb2xvckZvcm1hdCwKLSAgICAgICAgY29uc3Qgc3A8SVN1cmZhY2U+ICZzdXJmYWNlLAorICAgICAgICBjb25zdCBzcDxJU3VyZmFjZT4gJmlzdXJmYWNlLAorICAgICAgICBjb25zdCBzcDxTdXJmYWNlPiAmc3VyZmFjZSwKICAgICAgICAgc2l6ZV90IGRpc3BsYXlXaWR0aCwgc2l6ZV90IGRpc3BsYXlIZWlnaHQsCiAgICAgICAgIHNpemVfdCBkZWNvZGVkV2lkdGgsIHNpemVfdCBkZWNvZGVkSGVpZ2h0KSB7CiAgICAgaWYgKCFwcmV2aWV3T25seSkgewpAQCAtMTc2LDcgKzE3OSw3IEBACiAKICAgICAgICAgICAgIGlmIChmdW5jKSB7CiAgICAgICAgICAgICAgICAgbVRhcmdldCA9Ci0gICAgICAgICAgICAgICAgICAgICgqZnVuYykoc3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C8vIGJlZm9yZSBjcmVhdGluZyBhIG5ldyBvbmUuCiAgICAgICAgIElQQ1RocmVhZFN0YXRlOjpzZWxmKCktPmZsdXNoQ29tbWFuZHMoKTsKIAotICAgICAgICBpZiAoIXN0cm5jbXAoIk9NWC4iLCBjb21wb25lbnQsIDQpKSB7CisgICAgICAgIGlmIChtU3VyZmFjZSAhPSBOVUxMKSB7CisgICAgICAgICAgICAvLyBPdGhlciBkZWNvZGVycyBhcmUgaW5zdGFudGlhdGVkIGxvY2FsbHkgYW5kIGFzIGEgY29uc2VxdWVuY2UKKyAgICAgICAgICAgIC8vIGFsbG9jYXRlIHRoZWlyIGJ1ZmZlcnMgaW4gbG9jYWwgYWRkcmVzcyBzcGFjZS4KKyAgICAgICAgICAgIG1WaWRlb1JlbmRlcmVyID0gbmV3IEF3ZXNvbWVMb2NhbFJlbmRlcmVyKAorICAgICAgICAgICAgICAgIGZhbHNlLCAgLy8gcHJldmlld09ubHkKKyAgICAgICAgICAgICAgICBjb21wb25lbnQsCisgICAgICAgICAgICAgICAgKE9NWF9DT0xPUl9GT1JNQVRUWVBFKWZvcm1hdCwKKyAgICAgICAgICAgICAgICBtSVN1cmZhY2UsCisgICAgICAgICAgICAgICAgbVN1cmZhY2UsCisgICAgICAgICAgICAgICAgbVZpZGVvV2lkdGgsIG1WaWRlb0hlaWdodCwKKyAgICAgICAgICAgICAgICBkZWNvZGVkV2lkdGgsIGRlY29kZWRIZWlnaHQpOworICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgLy8gT3VyIE9NWCBjb2RlY3MgYWxsb2NhdGUgYnVmZmVycyBvbiB0aGUgbWVkaWFfc2VydmVyIHNpZGUKICAgICAgICAgICAgIC8vIHRoZXJlZm9yZSB0aGV5IHJlcXVpcmUgYSByZW1vdGUgSU9NWFJlbmRlcmVyIHRoYXQga25vd3MgaG93CiAgICAgICAgICAgICAvLyB0byBkaXNwbGF5IHRoZW0uCkBAIC03MjIsMTYgKzc0Niw2IEBACiAgICAg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dXRvTG9jayhtTG9jayk7CisKKyAgICBMT0dWKCJzdGFydCBjbGllbnQgKCVkKSIsIGNsaWVudElkKTsKKyAgICBpZiAobUNsaWVudHNTdGFydGVkW2NsaWVudElkXSkgeworICAgICAgICByZXR1cm4gT0s7CisgICAgfQorCisgICAgbU51bWJlck9mQ2xpZW50c1N0YXJ0ZWQrKzsKKworICAgIGlmICghbVNvdXJjZVN0YXJ0ZWQpIHsKKyAgICAgICAgTE9HVigiU3RhcnRpbmcgcmVhbCBzb3VyY2UgZnJvbSBjbGllbnQgKCVkKSIsIGNsaWVudElkKTsKKyAgICAgICAgc3RhdHVzX3QgZXJyID0gbVNvdXJjZS0+c3RhcnQocGFyYW1zKTsKKworICAgICAgICBpZiAoZXJyID09IE9LKSB7CisgICAgICAgICAgICBtU291cmNlU3RhcnRlZCA9IHRydWU7CisgICAgICAgICAgICBtQ2xpZW50c1N0YXJ0ZWQuZWRpdEl0ZW1BdChjbGllbnRJZCkgPSB0cnVlOworICAgICAgICAgICAgbUNsaWVudHNEZXNpcmVkUmVhZEJpdC5lZGl0SXRlbUF0KGNsaWVudElkKSA9ICFtQ3VycmVudFJlYWRCaXQ7CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gZXJyOworICAgIH0gZWxzZSB7CisgICAgICAgIG1DbGllbnRzU3RhcnRlZC5lZGl0SXRlbUF0KGNsaWVudElkKSA9IHRydWU7CisgICAgICAgIGlmIChtTGFzdFJlYWRDb21wbGV0ZWQpIHsKKyAgICAgICAgICAgIC8vIExhc3QgcmVhZCB3YXMgY29tcGxldGVkLiBTbyBqb2luIGluIHRoZSB0aHJlYWRzIGZvciB0aGUgbmV4dCByZWFkLgorICAgICAgICAgICAgbUNsaWVudHNEZXNpcmVkUmVhZEJpdC5lZGl0SXRlbUF0KGNsaWVudElkKSA9ICFtQ3VycmVudFJlYWRCaXQ7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAvLyBMYXN0IHJlYWQgaXMgb25nb2luZy4gU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IGNvbnN0IE1lZGlhU291cmNlOjpSZWFkT3B0aW9ucyAqb3B0aW9ucykgeworICAgIE11dGV4OjpBdXRvbG9jayBhdXRvTG9jayhtTG9jayk7CisKKyAgICBDSEVDSyhjbGllbnRJZCA+PSAwICYmIGNsaWVudElkIDwgbU51bWJlck9mQ2xpZW50cyk7CisKKyAgICBMT0dWKCJyZWFkIGNsaWVudCAoJWQpIiwgY2xpZW50SWQpOworICAgICpidWZmZXIgPSBOVUxMOworCisgICAgaWYgKCFtQ2xpZW50c1N0YXJ0ZWRbY2xpZW50SWRdKSB7CisgICAgICAgIHJldHVybiBPSzsKKyAgICB9CisKKyAgICBpZiAobUN1cnJlbnRSZWFkQml0ICE9IG1DbGllbnRzRGVzaXJlZFJlYWRCaXRbY2xpZW50SWRdKSB7CisgICAgICAgIC8vIERlc2lyZWQgYnVmZmVyIGhhcyBub3QgYmVlbiByZWFkIGZyb20gc291cmNlIHlldC4KKworICAgICAgICAvLyBJZiB0aGUgY3VycmVudCBjbGllbnQgaXMgdGhlIHNwZWNpYWwgY2xpZW50IHdpdGggY2xpZW50SWQgPSAwCisgICAgICAgIC8vIHRoZW4gcmVhZCBmcm9tIHNvdXJjZSwgZWxzZSB3YWl0IHVudGlsIHRoZSBjbGllbnQgMCBoYXMgZmluaXNoZWQKKyAgICAgICAgLy8gcmVhZGluZyBmcm9tIHNvdXJjZS4KKyAgICAgICAgaWYgKGNsaWVudElkID09IDApIHsKKyAgICAgICAgICAgIC8vIFdhaXQgZm9yIGFsbCBjbGllbnQncyBsYXN0IHJlYWQgdG8gY29tcGxldGUgZmlyc3Qgc28gYXMgdG8gbm90CisgICAgICAgICAgICAvLyBjb3JydXB0IHRoZSBidWZmZXIgYXQgbUxhc3RSZWFkTWVkaWFCdWZmZXIuCisgICAgICAgICAgICB3YWl0Rm9yQWxsQ2xpZW50c0xhc3RSZWFkX2xvY2soY2xpZW50SWQpOworCisgICAgICAgICAgICByZWFkRnJvbVNvdXJjZV9sb2NrKG9w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VVWSW1hZ2UgeXV2RG93blNhbXBsZWRJbWFnZSh5dXZGb3JtYXQsCisgICAgICAgICAgICBtV2lkdGgsIG1IZWlnaHQsCisgICAgICAgICAgICAodWludDhfdCAqKSgqYnVmZmVyKS0+ZGF0YSgpKTsKKyAgICBZVVZDYW52YXMgeXV2Q2FudmFzRG93blNhbXBsZSh5dXZEb3duU2FtcGxlZEltYWdlKTsKKworICAgIFlVVkltYWdlIHl1dkltYWdlU291cmNlKHl1dkZvcm1hdCwKKyAgICAgICAgICAgIG1SZWFsU291cmNlV2lkdGgsIG1SZWFsU291cmNlSGVpZ2h0LAorICAgICAgICAgICAgKHVpbnQ4X3QgKilzb3VyY2VCdWZmZXIuZGF0YSgpKTsKKyAgICB5dXZDYW52YXNEb3duU2FtcGxlLmRvd25zYW1wbGUobURvd25TYW1wbGVPZmZzZXRYLCBtRG93blNhbXBsZU9mZnNldFksCisgICAgICAgICAgICBtRG93blNhbXBsZVNraXBYLCBtRG93blNhbXBsZVNraXBZLAorICAgICAgICAgICAgeXV2SW1hZ2VTb3VyY2UpOworfQorCitzdGF0dXNfdCBWaWRlb1NvdXJjZURvd25TYW1wbGVyOjpzdGFydChNZXRhRGF0YSAqcGFyYW1zKSB7CisgICAgTE9HVigic3RhcnQiKTsKKyAgICByZXR1cm4gbVJlYWxWaWRlb1NvdXJjZS0+c3RhcnQoKTsKK30KKworc3RhdHVzX3QgVmlkZW9Tb3VyY2VEb3duU2FtcGxlcjo6c3RvcCgpIHsKKyAgICBMT0dWKCJzdG9wIik7CisgICAgcmV0dXJuIG1SZWFsVmlkZW9Tb3VyY2UtPnN0b3AoKTsKK30KKworc3A8TWV0YURhdGE+IFZpZGVvU291cmNlRG93blNhbXBsZXI6OmdldEZvcm1hdCgpIHsKKyAgICBMT0dWKCJnZXRGb3JtYXQiKTsKKyAgICByZXR1cm4gbU1ldGE7Cit9CisKK3N0YXR1c190IFZpZGVvU291cmNlRG93blNhbXBsZXI6OnJlYWQoCisgICAgICAgIE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kFMTE9DX1VTQUdFX1NXX1dSSVRFX09GVEVOLCBib3VuZHMsICZkc3QpKTsKKworICAgIGlmIChtQ29udmVydGVyKSB7CisgICAgICAgIG1Db252ZXJ0ZXItPmNvbnZlcnQoCisgICAgICAgICAgICAgICAgbURlY29kZWRXaWR0aCwgbURlY29kZWRIZWlnaHQsCisgICAgICAgICAgICAgICAgZGF0YSwgMCwgZHN0LCBidWYtPnN0cmlkZSAqIDIpOworICAgIH0gZWxzZSBpZiAobVlVVk1vZGUgPT0gWVVWNDIwc3BUb1lVVjQyMHNwKSB7CisgICAgICAgIC8vIElucHV0IGFuZCBvdXRwdXQgYXJlIGJvdGggWVVWNDIwc3AsIGJ1dCB0aGUgYWxpZ25tZW50IHJlcXVpcmVtZW50cworICAgICAgICAvLyBhcmUgZGlmZmVyZW50LgorICAgICAgICBzaXplX3Qgc3JjWVN0cmlkZSA9IG1EZWNvZGVkV2lkdGg7CisgICAgICAgIGNvbnN0IHVpbnQ4X3QgKnNyY1kgPSAoY29uc3QgdWludDhfdCAqKWRhdGE7CisgICAgICAgIHVpbnQ4X3QgKmRzdFkgPSAodWludDhfdCAqKWRzdDsKKyAgICAgICAgZm9yIChzaXplX3QgaSA9IDA7IGkgPCBtRGVjb2RlZEhlaWdodDsgKytpKSB7CisgICAgICAgICAgICBtZW1jcHkoZHN0WSwgc3JjWSwgbURlY29kZWRXaWR0aCk7CisgICAgICAgICAgICBzcmNZICs9IHNyY1lTdHJpZGU7CisgICAgICAgICAgICBkc3RZICs9IGJ1Zi0+c3RyaWRlOworICAgICAgICB9CisKKyAgICAgICAgc2l6ZV90IHNyY1VWU3RyaWRlID0gKG1EZWNvZGVkV2lkdGggKyAxKSAmIH4xOworICAgICAgICBzaXplX3QgZHN0VVZTdHJpZGUgPSBBTElHTihtRGVjb2RlZFdpZHRoIC8gMiwgMzIpICogMjsKKworICAgICAgICBjb25zdCB1aW50OF90ICpzcmNVViA9IChjb25zdCB1aW50OF90ICopZGF0YQorICAgICAgIC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9IGJ1Zi0+c3RyaWRlOworICAgICAgICB9CisKKyAgICAgICAgc2l6ZV90IHNyY1VWU3RyaWRlID0gKG1EZWNvZGVkV2lkdGggKyAxKSAvIDI7CisgICAgICAgIHNpemVfdCBkc3RVVlN0cmlkZSA9IEFMSUdOKG1EZWNvZGVkV2lkdGggLyAyLCAzMikgKiAyOworCisgICAgICAgIGNvbnN0IHVpbnQ4X3QgKnNyY1UgPSAoY29uc3QgdWludDhfdCAqKWRhdGEKKyAgICAgICAgICAgICsgbURlY29kZWRIZWlnaHQgKiBtRGVjb2RlZFdpZHRoOworCisgICAgICAgIGNvbnN0IHVpbnQ4X3QgKnNyY1YgPQorICAgICAgICAgICAgc3JjVSArICgobURlY29kZWRXaWR0aCArIDEpIC8gMikgKiAoKG1EZWNvZGVkSGVpZ2h0ICsgMSkgLyAyKTsKKworICAgICAgICBzaXplX3QgZHN0VVZPZmZzZXQgPSBBTElHTihBTElHTihtRGVjb2RlZEhlaWdodCwgMzIpICogYnVmLT5zdHJpZGUsIDQwOTYpOworICAgICAgICB1aW50OF90ICpkc3RVViA9ICh1aW50OF90ICopZHN0ICsgZHN0VVZPZmZzZXQ7CisKKyAgICAgICAgZm9yIChzaXplX3QgaSA9IDA7IGkgPCAobURlY29kZWRIZWlnaHQgKyAxKSAvIDI7ICsraSkgeworICAgICAgICAgICAgZm9yIChzaXplX3QgaiA9IDA7IGogPCAobURlY29kZWRXaWR0aCArIDEpIC8gMjsgKytqKSB7CisgICAgICAgICAgICAgICAgZHN0VVZbMiAqIGogKyAxXSA9IHNyY1Vbal07CisgICAgICAgICAgICAgICAgZHN0VVZbMiAqIGpdID0gc3JjVltqXTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHNyY1UgKz0gc3JjVVZTdHJpZGU7CisgICAgICAgICAgICBzcmNWICs9IHNyY1VWU3RyaWRlOworICAgICAgICAgICAgZHN0VVYgKz0gZHN0VVZTdHJpZGU7CisgICAgICAgIH0KKyAgICB9IGVsc2Uge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PTVhfRXJyb3JOb25lKSB7CisgICAgICAgIExPR0UoIk9NWF9FbmFibGVBbmRyb2lkTmF0aXZlQnVmZmVycyBmYWlsZWQgd2l0aCBlcnJvciAlZCAoMHglMDh4KSIsCisgICAgICAgICAgICAgICAgZXJyLCBlcnIpOworCisgICAgICAgIHJldHVybiBVTktOT1dOX0VSUk9SOworICAgIH0KKworICAgIHJldHVybiBPSzsKK30KKwogc3RhdHVzX3QgT01YTm9kZUluc3RhbmNlOjp1c2VCdWZmZXIoCiAgICAgICAgIE9NWF9VMzIgcG9ydEluZGV4LCBjb25zdCBzcDxJTWVtb3J5PiAmcGFyYW1zLAogICAgICAgICBPTVg6OmJ1ZmZlcl9pZCAqYnVmZmVyKSB7CkBAIC0yNzMsNiArMzE3LDYwIEBACiAgICAgcmV0dXJuIE9LOwogfQogCitzdGF0dXNfdCBPTVhOb2RlSW5zdGFuY2U6OnVzZUdyYXBoaWNCdWZmZXIoCisgICAgICAgIE9NWF9VMzIgcG9ydEluZGV4LCBjb25zdCBzcDxHcmFwaGljQnVmZmVyPiYgZ3JhcGhpY0J1ZmZlciwKKyAgICAgICAgT01YOjpidWZmZXJfaWQgKmJ1ZmZlcikgeworICAgIE11dGV4OjpBdXRvbG9jayBhdXRvTG9jayhtTG9jayk7CisKKyAgICBPTVhfSU5ERVhUWVBFIGluZGV4OworICAgIE9NWF9FUlJPUlRZUEUgZXJyID0gT01YX0dldEV4dGVuc2lvbkluZGV4KAorICAgICAgICAgICAgbUhhbmRsZSwKKyAgICAgICAgICAgIGNvbnN0X2Nhc3Q8T01YX1NUUklORz4oIk9NWC5nb29nbGUuYW5kcm9pZC5pbmRleC51c2VBbmRyb2lkTmF0aXZlQnVmZmVyIiksCisgICAgICAgICAgICAmaW5kZXgpOworCisgICAgaWYgKGVyciAhPSBPTVhfRXJyb3JOb25lKSB7CisgICAgICAgIExPR0UoIk9NWF9HZXRFeHRlbnNpb25JbmRleCBmYWlsZWQiKTsKKworICAgICAgICByZXR1cm4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udCwgJnZEZXN0T2Zmc2V0SW5jcmVtZW50KTsKKworICAgIC8vIENvcHkgWQorICAgIHsKKyAgICAgICAgc2l6ZV90IG51bWJlck9mWUJ5dGVzUGVyUm93ID0gKHNpemVfdCkgd2lkdGg7CisgICAgICAgIHVpbnQ4X3QgKnlTcmNBZGRyID0geVNyY0FkZHJCYXNlOworICAgICAgICB1aW50OF90ICp5RGVzdEFkZHIgPSB5RGVzdEFkZHJCYXNlOworICAgICAgICBmb3IgKGludDMyX3Qgb2Zmc2V0WSA9IDA7IG9mZnNldFkgPCBoZWlnaHQ7ICsrb2Zmc2V0WSkgeworICAgICAgICAgICAgbWVtY3B5KHlEZXN0QWRkciwgeVNyY0FkZHIsIG51bWJlck9mWUJ5dGVzUGVyUm93KTsKKworICAgICAgICAgICAgeVNyY0FkZHIgKz0geVNyY09mZnNldEluY3JlbWVudDsKKyAgICAgICAgICAgIHlEZXN0QWRkciArPSB5RGVzdE9mZnNldEluY3JlbWVudDsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8vIENvcHkgVQorICAgIHsKKyAgICAgICAgc2l6ZV90IG51bWJlck9mVUJ5dGVzUGVyUm93ID0gKHNpemVfdCkgKHdpZHRoID4+IDEpOworICAgICAgICB1aW50OF90ICp1U3JjQWRkciA9IHVTcmNBZGRyQmFzZTsKKyAgICAgICAgdWludDhfdCAqdURlc3RBZGRyID0gdURlc3RBZGRyQmFzZTsKKyAgICAgICAgLy8gRXZlcnkgb3RoZXIgcm93IGhhcyBhbiBlbnRyeSBmb3IgVS9WIGNoYW5uZWwgdmFsdWVzLiBIZW5jZSBvbmx5CisgICAgICAgIC8vIGdvIGhhbGYgdGhlIGhlaWdodC4KKyAgICAgICAgZm9yIChpbnQzMl90IG9mZnNldFkgPSAwOyBvZmZzZXRZIDwgKGhlaWdodCA+PiAxKTsgKytvZmZzZXRZKSB7CisgICAgICAgICAgICBtZW1jcHkodURlc3RBZGRyLCB1U3JjQWRkciwgbnVtYmVyT2ZVQnl0ZXNQZXJSb3cpOworCisgICAgICAgICAgICB1U3JjQWRkciArPSB1U3JjT2Zmc2V0SW5jcmVtZW50OworICAgICAgICAgICAgdURlc3RBZGRyICs9IHVEZXN0T2Zmc2V0SW5jcmVtZW50OworICAgICAgICB9CisgICAgfQorCisgICAgLy8gQ29weSBWCisgICAgeworICAgICAgICBzaXplX3QgbnVtYmVyT2ZWQnl0ZXNQZXJSb3cgPSAoc2l6ZV90KSAod2lkdGggPj4gMSk7CisgICAgICAgIHVpbnQ4X3QgKnZTcmNBZGRyID0gdlNyY0FkZHJCYXNlOworICAgICAgICB1aW50OF90ICp2RGVzdEFkZHIgPSB2RGVzdEFkZHJCYXNlOworICAgICAgICAvLyBFdmVyeSBvdGhlciBwaXhlbCByb3cgaGFzIGEgVS9WIGRhdGEgcm93LiBIZW5jZSBvbmx5IGdvIGhhbGYgdGhlIGhlaWdodC4KKyAgICAgICAgZm9yIChpbnQzMl90IG9mZnNldFkgPSAwOyBvZmZzZXRZIDwgKGhlaWdodCA+PiAxKTsgKytvZmZzZXRZKSB7CisgICAgICAgICAgICBtZW1jcHkodkRlc3RBZGRyLCB2U3JjQWRkciwgbnVtYmVyT2ZWQnl0ZXNQZXJSb3cpOworCisgICAgICAgICAgICB2U3JjQWRkciArPSB2U3JjT2Zmc2V0SW5jcmVtZW50OworICAgICAgICAgICAgdkRlc3RBZGRyICs9IHZEZXN0T2Zmc2V0SW5jcmVtZW50OworICAgICAgICB9CisgICAgfQorfQorCit2b2lkIFlVVkltYWdlOjpmYXN0Q29weVJlY3RhbmdsZTQyMFNlbWlQbGFuYXIoCisgICAgICAgIGNvbnN0IFJlY3QmIHNyY1JlY3QsCisgICAgICAgIGludDMyX3QgZGVzdFN0YXJ0WCwgaW50MzJfdCBkZXN0U3RhcnRZLAorICAgICAgICBjb25zdCBZVVZJbWFnZSAmc3JjSW1hZ2UsIFlVVkltYWdlICZkZXN0SW1hZ2UpIHsKKyAgICBDSEVDSyhzcmNJbWFnZS5tWVVWRm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iKSBjb25zdCB7CisgICAgKnIgPSB5VmFsdWUgKyAoMS4zNzA3MDUgKiAodlZhbHVlLTEyOCkpOworICAgICpnID0geVZhbHVlIC0gKDAuNjk4MDAxICogKHZWYWx1ZS0xMjgpKSAtICgwLjMzNzYzMyAqICh1VmFsdWUtMTI4KSk7CisgICAgKmIgPSB5VmFsdWUgKyAoMS43MzI0NDYgKiAodVZhbHVlLTEyOCkpOworCisgICAgKnIgPSBjbGFtcCgqciwgMCwgMjU1KTsKKyAgICAqZyA9IGNsYW1wKCpnLCAwLCAyNTUpOworICAgICpiID0gY2xhbXAoKmIsIDAsIDI1NSk7Cit9CisKK2Jvb2wgWVVWSW1hZ2U6OndyaXRlVG9QUE0oY29uc3QgY2hhciAqZmlsZW5hbWUpIGNvbnN0IHsKKyAgICBGSUxFICpmcCA9IGZvcGVuKGZpbGVuYW1lLCAidyIpOworICAgIGlmIChmcCA9PSBOVUxMKSB7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisgICAgZnByaW50ZihmcCwgIlAzXG4iKTsKKyAgICBmcHJpbnRmKGZwLCAiJWQgJWRcbiIsIG1XaWR0aCwgbUhlaWdodCk7CisgICAgZnByaW50ZihmcCwgIjI1NVxuIik7CisgICAgZm9yIChpbnQzMl90IHkgPSAwOyB5IDwgbUhlaWdodDsgKyt5KSB7CisgICAgICAgIGZvciAoaW50MzJfdCB4ID0gMDsgeCA8IG1XaWR0aDsgKyt4KSB7CisgICAgICAgICAgICB1aW50OF90IHlWYWx1ZTsKKyAgICAgICAgICAgIHVpbnQ4X3QgdVZhbHVlOworICAgICAgICAgICAgdWludDhfdCB2VmFsdWU7CisgICAgICAgICAgICBnZXRQaXhlbFZhbHVlKHgsIHksICZ5VmFsdWUsICZ1VmFsdWUsICYgdlZhbHVlKTsKKworICAgICAgICAgICAgdWludDhfdCByVmFsdWU7CisgICAgICAgICAgICB1aW50OF90IGdWYWx1ZTsKKyAgICAgICAgICAgIHVpbnQ4X3QgYlZhbHV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ZCBvbiBhbiAiQVMgSVMiIEJBU0lTLAorIyBXSVRIT1VUIFdBUlJBTlRJRVMgT1IgQ09ORElUSU9OUyBPRiBBTlkgS0lORCwgZWl0aGVyIGV4cHJlc3Mgb3IgaW1wbGllZC4KKyMgU2VlIHRoZSBMaWNlbnNlIGZvciB0aGUgc3BlY2lmaWMgbGFuZ3VhZ2UgZ292ZXJuaW5nIHBlcm1pc3Npb25zIGFuZAorIyBsaW1pdGF0aW9ucyB1bmRlciB0aGUgTGljZW5zZS4KKyMKKworTE9DQUxfUEFUSDo9ICQoY2FsbCBteS1kaXIpCisKK2lmbmVxICgkKFRBUkdFVF9TSU1VTEFUT1IpLHRydWUpCisKK2luY2x1ZGUgJChDTEVBUl9WQVJTKQorCitMT0NBTF9TUkNfRklMRVM6PSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgIE10cENsaWVudC5jcHAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgTXRwQ3Vyc29yLmNwcCAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICBNdHBEYXRhUGFja2V0LmNwcCAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgIE10cERlYnVnLmNwcCAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgTXRwRGV2aWNlLmNwcCAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICBNdHBFdmVudFBhY2tldC5jcHAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgIE10cERldmljZUluZm8uY3BwICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgTXRwT2JqZWN0SW5mby5jcHAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICBNdHBQYWNrZXQuY3BwICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgIE10cFByb3BlcnR5LmNwcCAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgTXRwUmVxdWVzdFBhY2tldC5jcHAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICBNdHBSZXNwb25zZVBhY2tldC5jcHAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgIE10cFNlcnZlci5jcHAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgTXRwU3RvcmFnZUluZm8uY3BwICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICBNdHBTdHJpbmdCdWZmZXIuY3BwICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgIE10cFN0b3JhZ2UuY3BwICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgTXRwVXRpbHMuY3BwICAgICAgICAgICAgICAgICAgICAgICAgICBcCisKK0xPQ0FMX01PRFVMRTo9IGxpYm10cAorCitMT0NBTF9DRkxBR1MgOj0gLURNVFBfREVWSUNFIC1ETVRQX0hPU1QKKworaW5jbHVkZSAkKEJVSUxEX1NUQVRJQ19MSUJSQVJZKQorCitlbmRpZgorCitpZmVxICgkKEhPU1RfT1MpLGxpbnV4KQorCitpbmNsdWRlICQoQ0xFQVJfVkFSUykKKworTE9DQUxfU1JDX0ZJTEVTOj0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICBNdHBDbGllbnQuY3BwICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgIE10cEN1cnNvci5jcHAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgTXRwRGF0YVBhY2tldC5jcHAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICBNdHBEZWJ1Zy5jcHAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgIE10cERldmljZS5jcHAgICAgICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgTXRwRXZlbnRQYWNrZXQuY3BwICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICBNdHBEZXZpY2VJbmZvLmNwcCAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgIE10cE9iamVjdEluZm8uY3BwICAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgTXRwUGFja2V0LmNwcCAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICBNdHBQcm9wZXJ0eS5jcHAgICAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgIE10cFJlcXVlc3RQYWNrZXQuY3BwICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgTXRwUmVzcG9uc2VQYWNrZXQuY3BwICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICBNdHBTdG9yYWdlSW5mby5jcHAgICAgICAgICAgICAgICAgICAgIFwKKyAgICAgICAgICAgICAgICAgIE10cFN0cmluZ0J1ZmZlci5jcHAgICAgICAgICAgICAgICAgICAgXAorICAgICAgICAgICAgICAgICAgTXRwU3RvcmFnZS5jcHAgICAgICAgICAgICAgICAgICAgICAgICBcCisgICAgICAgICAgICAgICAgICBNdHBVdGlscy5jcHAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKworTE9DQUxfTU9EVUxFOj0gbGlibXRwCisKK0xPQ0FMX0NGTEFHUyA6PSAtRE1UUF9IT1NUCisKK2luY2x1ZGUgJChCVUlMRF9IT1NUX1NUQVRJQ19MSUJSQVJZKQorCitlbmRpZgpkaWZmIC0tZ2l0IGEvbWVkaWEvbXRwL010cENsaWVudC5jcHAgYi9tZWRpYS9tdHAvTXRwQ2xpZW50LmNwcApuZXcgZmlsZSBtb2RlIDEwM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B0aHJlYWRMb29wKCkgeworICAgICAgICByZXR1cm4gbUNsaWVudC0+dGhyZWFkTG9vcCgpOworICAgIH0KK307CisKKworTXRwQ2xpZW50OjpNdHBDbGllbnQoKQorICAgIDogICBtVGhyZWFkKE5VTEwpLAorICAgICAgICBtVXNiSG9zdENvbnRleHQoTlVMTCksCisgICAgICAgIG1Eb25lKGZhbHNlKQoreworfQorCitNdHBDbGllbnQ6On5NdHBDbGllbnQoKSB7CisgICAgdXNiX2hvc3RfY2xlYW51cChtVXNiSG9zdENvbnRleHQpOworfQorCitib29sIE10cENsaWVudDo6c3RhcnQoKSB7CisgICAgTXV0ZXg6OkF1dG9sb2NrIGF1dG9Mb2NrKG1NdXRleCk7CisKKyAgICBpZiAobVRocmVhZCkKKyAgICAgICAgcmV0dXJuIHRydWU7CisKKyAgICBtVXNiSG9zdENvbnRleHQgPSB1c2JfaG9zdF9pbml0KCk7CisgICAgaWYgKCFtVXNiSG9zdENvbnRleHQpCisgICAgICAgIHJldHVybiBmYWxzZTsKKworICAgIG1UaHJlYWQgPSBuZXcgTXRwQ2xpZW50VGhyZWFkKHRoaXMpOworICAgIG1UaHJlYWQtPnJ1bigiTXRwQ2xpZW50VGhyZWFkIik7CisgICAgLy8gd2FpdCBmb3IgdGhlIHRocmVhZCB0byBkbyBpbml0aWFsIGRldmljZSBkaXNjb3ZlcnkgYmVmb3JlIHJldHVybmluZworICAgIG1UaHJlYWRTdGFydENvbmRpdGlvbi53YWl0KG1NdXRleCk7CisKKyAgICByZXR1cm4gdHJ1ZTsKK30KKwordm9pZCBNdHBDbGllbnQ6OnN0b3AoKSB7CisgICAgbURvbmUgPSB0cnVlOworfQorCitNdHBEZXZpY2UqIE10cENsaWVudDo6Z2V0RGV2aWNlKGludCBpZCkgeworICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbURldmljZUxpc3Quc2l6ZSgpOyBpKyspIHsKKyAgICAgICAgTXRwRGV2aWNlKiBkZXZpY2UgPSBtRGV2aWNlTGlzd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NlLT5iSW50ZXJmYWNlUHJvdG9jb2wgPT0gMSkgICAgIC8vIFBpY3R1cmUgVHJhbnNmZXIgUHJvdG9jb2wgKFBJTUEgMTU0NzApCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgICAgTE9HRCgiRm91bmQgY2FtZXJhOiBcIiVzXCIgXCIlc1wiXG4iLCB1c2JfZGV2aWNlX2dldF9tYW51ZmFjdHVyZXJfbmFtZShkZXZpY2UpLAorICAgICAgICAgICAgICAgICAgICAgICAgdXNiX2RldmljZV9nZXRfcHJvZHVjdF9uYW1lKGRldmljZSkpOworICAgICAgICAgICAgfSBlbHNlIGlmIChpbnRlcmZhY2UtPmJJbnRlcmZhY2VDbGFzcyA9PSAweEZGICYmCisgICAgICAgICAgICAgICAgICAgIGludGVyZmFjZS0+YkludGVyZmFjZVN1YkNsYXNzID09IDB4RkYgJiYKKyAgICAgICAgICAgICAgICAgICAgaW50ZXJmYWNlLT5iSW50ZXJmYWNlUHJvdG9jb2wgPT0gMCkgeworICAgICAgICAgICAgICAgIGNoYXIqIGludGVyZmFjZU5hbWUgPSB1c2JfZGV2aWNlX2dldF9zdHJpbmcoZGV2aWNlLCBpbnRlcmZhY2UtPmlJbnRlcmZhY2UpOworICAgICAgICAgICAgICAgIGlmICghaW50ZXJmYWNlTmFtZSB8fCBzdHJjbXAoaW50ZXJmYWNlTmFtZSwgIk1UUCIpKQorICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgICAgICAvLyBMb29rcyBsaWtlIGFuIGFuZHJvaWQgc3R5bGUgTVRQIGRldmljZQorICAgICAgICAgICAgICAgIExPR0QoIkZvdW5kIE1UUCBkZXZpY2U6IFwiJXNcIiBcIiVzXCJcbiIsIHVzYl9kZXZpY2VfZ2V0X21hbnVmYWN0dXJlcl9uYW1lKGRldmljZSksCisgICAgICAgICAgICAgICAgICAgICAgICB1c2JfZGV2aWNlX2dldF9wcm9kdWN0X25hbWUoZGV2aWNlKSk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIC8vIGxvb2sgZm9yIHNwZWNpYWwgY2FzZWQgZGV2aWNlcyBiYXNlZCBvbiB2ZW5kb3IvcHJvZHVjdCBJRAorICAgICAgICAgICAgICAgIC8vIHdlIGFyZSBkb2luZyB0aGlzIG1haW5seSBmb3IgdGVzdGluZyBwdXJwb3NlcworICAgICAgICAgICAgICAgIHVpbnQxNl90IHZlbmRvciA9IHVzYl9kZXZpY2VfZ2V0X3ZlbmRvcl9pZChkZXZpY2UpOworICAgICAgICAgICAgICAgIHVpbnQxNl90IHByb2R1Y3QgPSB1c2JfZGV2aWNlX2dldF9wcm9kdWN0X2lkKGRldmljZSk7CisgICAgICAgICAgICAgICAgaWYgKCFpc010cERldmljZSh2ZW5kb3IsIHByb2R1Y3QpKSB7CisgICAgICAgICAgICAgICAgICAgIC8vIG5vdCBhbiBNVFAgb3IgUFRQIGRldmljZQorICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgLy8gcmVxdWVzdCBNVFAgT1Mgc3RyaW5nIGFuZCBkZXNjcmlwdG9yCisgICAgICAgICAgICAgICAgLy8gc29tZSBtdXNpYyBwbGF5ZXJzIG5lZWQgdG8gc2VlIHRoaXMgYmVmb3JlIGVudGVyaW5nIE1UUCBtb2RlLgorICAgICAgICAgICAgICAgIGNoYXIgYnVmZmVyWzI1Nl07CisgICAgICAgICAgICAgICAgbWVtc2V0KGJ1ZmZlciwgMCwgc2l6ZW9mKGJ1ZmZlcikpOworICAgICAgICAgICAgICAgIGludCByZXQgPSB1c2JfZGV2aWNlX3NlbmRfY29udHJvbChkZXZpY2UsCisgICAgICAgICAgICAgICAgICAgICAgICBVU0JfRElSX0lOfFVTQl9SRUNJUF9ERVZJQ0V8VVNCX1RZUEVfU1RBTkRBUkQsCisgICAgICAgICAgICAgICAgICAgICAgICBVU0JfUkVRX0dFVF9ERVNDUklQVE9SLCAoVVNCX0RUX1NUUklORyA8PCA4KSB8IDB4RUUsCisgICAgICAgICAgICAgICAgICAgICAgICAwLCBzaXplb2YoYnVmZmVyKSwgYnVmZmVyKTsKKyAgICAgICAgICAgICAgICBwcmludGYoInVzYl9kZXZpY2Vfc2VuZF9jb250cm9sIHJldHVybmVkICVkIGVycm5vOiAlZFxuIiwgcmV0LCBlcnJubyk7CisgICAgICAgICAgICAgICAgaWYgKHJldCA+IDApIHsKKyAgICAgICAgICAgICAgICAgICAgcHJpbnRmKCJnb3QgTVRQIHN0cmluZyAlc1xuIiwgYnVmZmVyKTsKKyAgICAgICAgICAgICAgICAgICAgcmV0ID0gdXNiX2RldmljZV9zZW5kX2NvbnRyb2woZGV2aWNlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIFVTQl9ESVJfSU58VVNCX1JFQ0lQX0RFVklDRXxVU0JfVFlQRV9WRU5ET1IsIDEsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCwgNCwgc2l6ZW9mKGJ1ZmZlciksIGJ1ZmZlcik7CisgICAgICAgICAgICAgICAgICAgIHByaW50ZigiT1MgZGVzY3JpcHRvciBnb3QgJWRcbiIsIHJldCk7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgcHJpbnRmKCJubyBNVFAgc3RyaW5nXG4iKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIGlmIHdlIGdvdCBoZXJlLCB0aGVuIHdlIGhhdmUgYSBsaWtlbHkgTVRQIG9yIFBUUCBkZXZpY2UKKworICAgICAgICAgICAgLy8gaW50ZXJmYWNlIHNob3VsZCBiZSBmb2xsb3dlZCBieSB0aHJlZSBlbmRwb2ludHMKKyAgICAgICAgICAgIHN0cnVjdCB1c2JfZW5kcG9pbnRfZGVzY3JpcHRvciAqZXA7CisgICAgICAgICAgICBzdHJ1Y3QgdXNiX2VuZHBvaW50X2Rlc2NyaXB0b3IgKmVwX2luX2Rlc2MgPSBOVUxMOworICAgICAgICAgICAgc3RydWN0IHVzYl9lbmRwb2ludF9kZXNjcmlwdG9yICplcF9vdXRfZGVzYyA9IE5VTEw7CisgICAgICAgICAgICBzdHJ1Y3QgdXNiX2VuZHBvaW50X2Rlc2NyaXB0b3IgKmVwX2ludHJfZGVzYyA9IE5VTEw7CisgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IDM7IGkrKykgeworICAgICAgICAgICAgICAgIGVwID0gKHN0cnVjdCB1c2JfZW5kcG9pbnRfZGVzY3JpcHRvciAqKXVzYl9kZXNjcmlwdG9yX2l0ZXJfbmV4dCgmaXRlcik7CisgICAgICAgICAgICAgICAgaWYgKCFlcCB8fCBlcC0+YkRlc2NyaXB0b3JUeXBlICE9IFVTQl9EVF9FTkRQT0lOVCkgeworICAgICAgICAgICAgICAgICAgICBMT0dFKCJlbmRwb2ludHMgbm90IGZvdW5kXG4iKTsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG1Eb25lOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBpZiAoZXAtPmJtQXR0cmlidXRlcyA9PSBVU0JfRU5EUE9JTlRfWEZFUl9CVUxLKSB7CisgICAgICAgICAgICAgICAgICAgIGlmIChlcC0+YkVuZHBvaW50QWRkcmVzcyAmIFVTQl9FTkRQT0lOVF9ESVJfTUFTSykKKyAgICAgICAgICAgICAgICAgICAgICAgIGVwX2luX2Rlc2MgPSBlcDsKKyAgICAgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgICAgICAgICAgZXBfb3V0X2Rlc2MgPSBlcDsKKyAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGVwLT5ibUF0dHJpYnV0ZXMgPT0gVVNCX0VORFBPSU5UX1hGRVJfSU5UICYmCisgICAgICAgICAgICAgICAgICAgIGVwLT5iRW5kcG9pbnRBZGRyZXNzICYgVVNCX0VORFBPSU5UX0RJUl9NQVNLKSB7CisgICAgICAgICAgICAgICAgICAgIGVwX2ludHJfZGVzYyA9IGVwOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmICghZXBfaW5fZGVzYyB8fCAhZXBfb3V0X2Rlc2MgfHwgIWVwX2ludHJfZGVzYykgeworICAgICAgICAgICAgICAgIExPR0UoImVuZHBvaW50cyBub3QgZm91bmRcbiIpOworICAgICAgICAgICAgICAgIHJldHVybiBtRG9uZTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgc3RydWN0IHVzYl9lbmRwb2ludCAqZXBfaW4gPSB1c2JfZW5kcG9pbnRfb3BlbihkZXZpY2UsIGVwX2luX2Rlc2MpOworICAgICAgICAgICAgc3RydWN0IHVzYl9lbmRwb2ludCAqZXBfb3V0ID0gdXNiX2VuZHBvaW50X29wZW4oZGV2aWNlLCBlcF9vdXRfZGVzYyk7CisgICAgICAgICAgICBzdHJ1Y3QgdXNiX2VuZHBvaW50ICplcF9pbnRyID0gdXNiX2VuZHBvaW50X29wZW4oZGV2aWNlLCBlcF9pbnRyX2Rlc2MpOworCisgICAgICAgICAgICBpZiAodXNiX2RldmljZV9jbGFpbV9pbnRlcmZhY2UoZGV2aWNlLCBpbnRlcmZhY2UtPmJJbnRlcmZhY2VOdW1iZXIpKSB7CisgICAgICAgICAgICAgICAgTE9HRSgidXNiX2RldmljZV9jbGFpbV9pbnRlcmZhY2UgZmFpbGVkIGVycm5vOiAlZFxuIiwgZXJybm8pOworICAgICAgICAgICAgICAgIHVzYl9lbmRwb2ludF9jbG9zZShlcF9pbik7CisgICAgICAgICAgICAgICAgdXNiX2VuZHBvaW50X2Nsb3NlKGVwX291dCk7CisgICAgICAgICAgICAgICAgdXNiX2VuZHBvaW50X2Nsb3NlKGVwX2ludHIpOworICAgICAgICAgICAgICAgIHJldHVybiBtRG9uZTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgTXRwRGV2aWNlKiBtdHBEZXZpY2UgPSBuZXcgTXRwRGV2aWNlKGRldmljZSwgaW50ZXJmYWNlLT5iSW50ZXJmYWNlTnVtYmVyLAorICAgICAgICAgICAgICAgICAgICAgICAgZXBfaW4sIGVwX291dCwgZXBfaW50cik7CisgICAgICAgICAgICBtRGV2aWNlTGlzdC5hZGQobXRwRGV2aWNlKTsKKyAgICAgICAgICAgIG10cERldmljZS0+aW5pdGlhbGl6ZSgpOworICAgICAgICAgICAgZGV2aWNlQWRkZWQobXRwRGV2aWNlKTsKKyAgICAgICAgICAgIHJldHVybiBtRG9uZTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHVzYl9kZXZpY2VfY2xvc2UoZGV2aWNlKTsKKyAgICByZXR1cm4gbURvbmU7Cit9CisKK2Jvb2wgTXRwQ2xpZW50Ojp1c2JEZXZpY2VSZW1vdmVkKGNvbnN0IGNoYXIgKmRldm5hbWUpIHsKKyAgICBmb3IgKGludCBpID0gMDsgaSA8IG1EZXZpY2VMaXN0LnNpemUoKTsgaSsrKSB7CisgICAgICAgIE10cERldmljZSogZGV2aWNlID0gbURldmljZUxpc3RbaV07CisgICAgICAgIGlmICghc3RyY21wKGRldm5hbWUsIGRldmljZS0+Z2V0RGV2aWNlTmFtZSgpKSkgeworICAgICAgICAgICAgZGV2aWNlUmVtb3ZlZChkZXZpY2UpOworICAgICAgICAgICAgbURldmljZUxpc3QucmVtb3ZlQXQoaSk7CisgICAgICAgICAgICBkZWxldGUgZGV2aWNlOworICAgICAgICAgICAgTE9HRCgiQ2FtZXJhIHJlbW92ZWQhXG4iKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgfQorICAgIHJldHVybiBtRG9uZTsKK30KKworYm9vbCBNdHBDbGllbnQ6OnVzYkRpc2NvdmVyeURvbmUoKSB7CisgICAgTXV0ZXg6OkF1dG9sb2NrIGF1dG9Mb2NrKG1NdXRleCk7CisgICAgbVRocmVhZFN0YXJ0Q29uZGl0aW9uLnNpZ25hbCgpOworICAgIHJldHVybiBtRG9uZTsKK30KKworYm9vbC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fY29udGV4dDsKKworbmFtZXNwYWNlIGFuZHJvaWQgeworCitjbGFzcyBNdHBDbGllbnRUaHJlYWQ7CisKK2NsYXNzIE10cENsaWVudCB7Citwcml2YXRlOgorICAgIE10cERldmljZUxpc3QgICAgICAgICAgICAgICBtRGV2aWNlTGlzdDsKKyAgICBNdHBDbGllbnRUaHJlYWQqICAgICAgICAgICAgbVRocmVhZDsKKyAgICBDb25kaXRpb24gICAgICAgICAgICAgICAgICAgbVRocmVhZFN0YXJ0Q29uZGl0aW9uOworICAgIE11dGV4ICAgICAgICAgICAgICAgICAgICAgICBtTXV0ZXg7CisgICAgc3RydWN0IHVzYl9ob3N0X2NvbnRleHQqICAgIG1Vc2JIb3N0Q29udGV4dDsKKyAgICBib29sICAgICAgICAgICAgICAgICAgICAgICAgbURvbmU7CisKK3B1YmxpYzoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBDbGllbnQoKTsKKyAgICB2aXJ0dWFsICAgICAgICAgICAgICAgICB+TXRwQ2xpZW50KCk7CisKKyAgICBib29sICAgICAgICAgICAgICAgICAgICBzdGFydCgpOworICAgIHZvaWQgICAgICAgICAgICAgICAgICAgIHN0b3AoKTsKKworICAgIGlubGluZSBNdHBEZXZpY2VMaXN0JiAgIGdldERldmljZUxpc3QoKSB7IHJldHVybiBtRGV2aWNlTGlzdDsgfQorICAgIE10cERldmljZSogICAgICAgICAgICAgIGdldERldmljZShpbnQgaWQpOworCisKKyAgICB2aXJ0dWFsIHZvaWQgICAgICAgICAgICBkZXZpY2VBZGRlZChNdHBEZXZpY2UgKmRldmljZSkgPSAwOworICAgIHZpcnR1YWwgdm9pZCAgICAgICAgICAgIGRldmljZVJlbW92ZWQoTXRwRGV2aWNlICpkZXZpY2UpID0gMDsKKworcHJpdmF0ZToKKyAgICAvLyB0aGVzZSByZXR1cm4gdHJ1ZSBpZiB3ZSBzaG91bGQgc3RvcCBtb25pdG9yaW5nIFVTQiBhbmQgY2xlYW4gdXAKKyAgICBib29sIC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X1dJRFRIICAgICAgICAgIDIxMAorI2RlZmluZSBPQkpFQ1RfSU1BR0VfSEVJR0hUICAgICAgICAgMjExCisjZGVmaW5lIE9CSkVDVF9JTUFHRV9ERVBUSCAgICAgICAgICAyMTIKKyNkZWZpbmUgT0JKRUNUX1BBUkVOVCAgICAgICAgICAgICAgIDIxMworI2RlZmluZSBPQkpFQ1RfQVNTT0NJQVRJT05fVFlQRSAgICAgMjE0CisjZGVmaW5lIE9CSkVDVF9BU1NPQ0lBVElPTl9ERVNDICAgICAyMTUKKyNkZWZpbmUgT0JKRUNUX1NFUVVFTkNFX05VTUJFUiAgICAgIDIxNgorI2RlZmluZSBPQkpFQ1RfTkFNRSAgICAgICAgICAgICAgICAgMjE3CisjZGVmaW5lIE9CSkVDVF9EQVRFX0NSRUFURUQgICAgICAgICAyMTgKKyNkZWZpbmUgT0JKRUNUX0RBVEVfTU9ESUZJRUQgICAgICAgIDIxOQorI2RlZmluZSBPQkpFQ1RfS0VZV09SRFMgICAgICAgICAgICAgMjIwCisjZGVmaW5lIE9CSkVDVF9USFVNQiAgICAgICAgICAgICAgICAyMjEKKworTXRwQ3Vyc29yOjpNdHBDdXJzb3IoTXRwQ2xpZW50KiBjbGllbnQsIGludCBxdWVyeVR5cGUsIGludCBkZXZpY2VJRCwKKyAgICAgICAgICAgICAgICBpbnQgc3RvcmFnZUlELCBpbnQgb2JqZWN0SUQsIGludCBjb2x1bW5Db3VudCwgaW50KiBjb2x1bW5zKQorICAgICAgICA6ICAgbUNsaWVudChjbGllbnQpLAorICAgICAgICAgICAgbVF1ZXJ5VHlwZShxdWVyeVR5cGUpLAorICAgICAgICAgICAgbURldmljZUlEKGRldmljZUlEKSwKKyAgICAgICAgICAgIG1TdG9yYWdlSUQoc3RvcmFnZUlEKSwKKyAgICAgICAgICAgIG1RYmplY3RJRChvYmplY3RJRCksCisgICAgICAgICAgICBtQ29sdW1uQ291bnQoY29sdW1uQ291bnQpLAorICAgICAgICAgICAgbUNvbHVtbnMoTlVMTCkKK3sKKyAgICBpZiAoY29sdW1ucykgeworICAgICAgICBtQ29sdW1ucyA9IG5ldyBpbnRbY29sdW1uQ291bnRdOworICAgICAgICBtZW1jcHkobUNvbHVtbnMsIGNvbHVtbnMsIGNvbHVtbkNvdW50ICogc2l6ZW9mKGludCkpOworICAgIH0KK30KKworTXRwQ3Vyc29yOjp+TXRwQ3Vyc29yKCkgeworICAgIGRlbGV0ZVtdIG1Db2x1bW5zOworfQorCitpbnQgTXRwQ3Vyc29yOjpmaWxsV2luZG93KEN1cnNvcldpbmRvdyogd2luZG93LCBpbnQgc3RhcnRQb3MpIHsKKyAgICBMT0dEKCJNdHBDdXJzb3I6OmZpbGxXaW5kb3cgbVF1ZXJ5VHlwZTogJWRcbiIsIG1RdWVyeVR5cGUpOworCisgICAgc3dpdGNoIChtUXVlcnlUeXBlKSB7CisgICAgICAgIGNhc2UgREVWSUNFOgorICAgICAgICAgICAgcmV0dXJuIGZpbGxEZXZpY2VzKHdpbmRvdywgc3RhcnRQb3MpOworICAgICAgICBjYXNlIERFVklDRV9JRDoKKyAgICAgICAgICAgIHJldHVybiBmaWxsRGV2aWNlKHdpbmRvdywgc3RhcnRQb3MpOworICAgICAgICBjYXNlIFNUT1JBR0U6CisgICAgICAgICAgICByZXR1cm4gZmlsbFN0b3JhZ2VzKHdpbmRvdywgc3RhcnRQb3MpOworICAgICAgICBjYXNlIFNUT1JBR0VfSUQ6CisgICAgICAgICAgICByZXR1cm4gZmlsbFN0b3JhZ2Uod2luZG93LCBzdGFydFBvcyk7CisgICAgICAgIGNhc2UgT0JKRUNUOgorICAgICAgICAgICAgcmV0dXJuIGZpbGxPYmplY3RzKHdpbmRvdywgMCwgc3RhcnRQb3MpOworICAgICAgICBjYXNlIE9CSkVDVF9JRDoKKyAgICAgICAgICAgIHJldHVybiBmaWxsT2JqZWN0KHdpbmRvdywgc3RhcnRQb3MpOworICAgICAgICBjYXNlIFNUT1JBR0VfQ0hJTERSRU46CisgICAgICAgICAgICByZXR1cm4gZmlsbE9iamVjdHMod2luZG93LCAtMSwgc3RhcnRQb3MpOworICAgICAgICBjYXNlIE9CSkVDVF9DSElMRFJFTjoKKyAgICAgICAgICAgIHJldHVybiBmaWxsT2JqZWN0cyh3aW5kb3csIG1RYmplY3RJRCwgc3RhcnRQb3MpOworICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgTE9HRSgiTXRwQ3Vyc29yOjpmaWxsV2luZG93OiB1bmtub3duIHF1ZXJ5IHR5cGUgJWRcbiIsIG1RdWVyeVR5cGUpOworICAgICAgICAgICAgcmV0dXJuIDA7CisgICAgfQorfQorCitpbnQgTXRwQ3Vyc29yOjpmaWxsRGV2aWNlcyhDdXJzb3JXaW5kb3cqIHdpbmRvdywgaW50IHN0YXJ0UG9zKSB7CisgICAgaW50IGNvdW50ID0gMDsKKyAgICBNdHBEZXZpY2VMaXN0JiBkZXZpY2VMaXN0ID0gbUNsaWVudC0+Z2V0RGV2aWNlTGlzdCgpOworICAgIGZvciAoaW50IGkgPSAwOyBpIDwgZGV2aWNlTGlzdC5zaXplKCk7IGkrKykgeworICAgICAgICBNdHBEZXZpY2UqIGRldmljZSA9IGRldmljZUxpc3RbaV07CisgICAgICAgIGlmIChmaWxsRGV2aWNlKHdpbmRvdywgZGV2aWNlLCBzdGFydFBvcykpIHsKKyAgICAgICAgICAgIGNvdW50Kys7CisgICAgICAgICAgICBzdGFydFBvcysrOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICB9CisgICAgcmV0dXJuIGNvdW50OworfQorCitpbnQgTXRwQ3Vyc29yOjpmaWxsRGV2aWNlKEN1cnNvcldpbmRvdyogd2luZG93LCBpbnQgc3RhcnRQb3MpIHsKKyAgICBNdHBEZXZpY2UqIGRldmljZSA9IG1DbGllbnQtPmdldERldmljZShtRGV2aWNlSUQpOworICAgIGlmIChkZXZpY2UgJiYgZmlsbERldmljZSh3aW5kb3csIGRldmljZSwgc3RhcnRQb3MpKQorICAgICAgICByZXR1cm4gMTsKKyAgICBlbHNlCisgICAgICAgIHJldHVybiAwOworfQorCitpbnQgTXRwQ3Vyc29yOjpmaWxsU3RvcmFnZXMoQ3Vyc29yV2luZG93KiB3aW5kb3csIGludCBzdGFydFBvcykgeworICAgIGludCBjb3VudCA9IDA7CisgICAgTXRwRGV2aWNlKiBkZXZpY2UgPSBtQ2xpZW50LT5nZXREZXZpY2UobURldmljZUlEKTsKKyAgICBpZiAoIWRldmljZSkKKyAgICAgICAgcmV0dXJuIDA7CisgICAgTXRwU3RvcmFnZUlETGlzdCogc3RvcmFnZUlEcyA9IGRldmljZS0+Z2V0U3RvcmFnZUlEcygpOworICAgIGlmICghc3RvcmFnZUlEcykKKyAgICAgICAgcmV0dXJuIDA7CisKKyAgICBmb3IgKGludCBpID0gMDsgaSA8IHN0b3JhZ2VJRHMtPnNpemUoKTsgaSsrKSB7CisgICAgICAgIE10cFN0b3JhZ2VJRCBzdG9yYWdlSUQgPSAoKnN0b3JhZ2VJRHMpW2ldOworICAgICAgICBpZiAoZmlsbFN0b3JhZ2Uod2luZG93LCBkZXZpY2UsIHN0b3JhZ2VJRCwgc3RhcnRQb3MpKSB7CisgICAgICAgICAgICBjb3VudCsrOworICAgICAgICAgICAgc3RhcnRQb3MrKzsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgfQorICAgIGRlbGV0ZSBzdG9yYWdlSURzOworICAgIHJldHVybiBjb3VudDsKK30KKworaW50IE10cEN1cnNvcjo6ZmlsbFN0b3JhZ2UoQ3Vyc29yV2luZG93KiB3aW5kb3csIGludCBzdGFydFBvcykgeworICAgIE10cERldmljZSogZGV2aWNlID0gbUNsaWVudC0+Z2V0RGV2aWNlKG1EZXZpY2VJRCk7CisgICAgaWYgKGRldmljZSAmJiBmaWxsU3RvcmFnZSh3aW5kb3csIGRldmljZSwgbVN0b3JhZ2VJRCwgc3RhcnRQb3MpKQorICAgICAgICByZXR1cm4gMTsKKyAgICBlbHNlCisgICAgICAgIHJldHVybiAwOworfQorCitpbnQgTXRwQ3Vyc29yOjpmaWxsT2JqZWN0cyhDdXJzb3JXaW5kb3cqIHdpbmRvdywgaW50IHBhcmVudCwgaW50IHN0YXJ0UG9zKSB7CisgICAgaW50IGNvdW50ID0gMDsKKyAgICBNdHBEZXZpY2UqIGRldmljZSA9IG1DbGllbnQtPmdldERldmljZShtRGV2aWNlSUQpOworICAgIGlmICghZGV2aWNlKQorICAgICAgICByZXR1cm4gMDsKKyAgICBNdHBPYmplY3RIYW5kbGVMaXN0KiBoYW5kbGVzID0gZGV2aWNlLT5nZXRPYmplY3RIYW5kbGVzKG1TdG9yYWdlSUQsIDAsIHBhcmVudCk7CisgICAgaWYgKCFoYW5kbGVzKQorICAgICAgICByZXR1cm4gMDsKKworICAgIGZvciAoaW50IGkgPSAwOyBpIDwgaGFuZGxlcy0+c2l6ZSgpOyBpKyspIHsKKyAgICAgICAgTXRwT2JqZWN0SGFuZGxlIGhhbmRsZSA9ICgqaGFuZGxlcylbaV07CisgICAgICAgIGlmIChmaWxsT2JqZWN0KHdpbmRvdywgZGV2aWNlLCBoYW5kbGUsIHN0YXJ0UG9zKSkgeworICAgICAgICAgICAgY291bnQrKzsKKyAgICAgICAgICAgIHN0YXJ0UG9zKys7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgfQorICAgIH0KKyAgICBkZWxldGUgaGFuZGxlczsKKyAgICByZXR1cm4gY291bnQ7Cit9CisKK2ludCBNdHBDdXJzb3I6OmZpbGxPYmplY3QoQ3Vyc29yV2luZG93KiB3aW5kb3csIGludCBzdGFydFBvcykgeworICAgIE10cERldmljZSogZGV2aWNlID0gbUNsaWVudC0+Z2V0RGV2aWNlKG1EZXZpY2VJRCk7CisgICAgaWYgKGRldmljZSAmJiBmaWxsT2JqZWN0KHdpbmRvdywgZGV2aWNlLCBtUWJqZWN0SUQsIHN0YXJ0UG9zKSkKKyAgICAgICAgcmV0dXJuIDE7CisgICAgZWxzZQorICAgICAgICByZXR1cm4gMDsKK30KKworYm9vbCBNdHBDdXJzb3I6OmZpbGxEZXZpY2UoQ3Vyc29yV2luZG93KiB3aW5kb3csIE10cERldmljZSogZGV2aWNlLCBpbnQgcm93KSB7CisgICAgTXRwRGV2aWNlSW5mbyogZGV2aWNlSW5mbyA9IGRldmljZS0+Z2V0RGV2aWNlSW5mbygpOworICAgIGlmICghZGV2aWNlSW5mbykKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIGlmICghcHJlcGFyZVJvdyh3aW5kb3cpKQorICAgICAgICByZXR1cm4gZmFsc2U7CisKKyAgICBmb3IgKGludCBpID0gMDsgaSA8IG1Db2x1bW5Db3VudDsgaSsrKSB7CisgICAgICAgIHN3aXRjaCAobUNvbHVtbnNbaV0pIHsKKyAgICAgICAgICAgIGNhc2UgREVWSUNFX1JPV19JRDoKKyAgICAgICAgICAgICAgICBpZiAoIXB1dExvbmcod2luZG93LCBkZXZpY2UtPmdldElEKCksIHJvdywgaSkpCisgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIERFVklDRV9NQU5VRkFDVFVSRVI6CisgICAgICAgICAgICAgICAgaWYgKCFwdXRTdHJpbmcod2luZG93LCBkZXZpY2VJbmZvLT5tTWFudWZhY3R1cmVyLCByb3csIGkpKQorICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBERVZJQ0VfTU9ERUw6CisgICAgICAgICAgICAgICAgaWYgKCFwdXRTdHJpbmcod2luZG93LCBkZXZpY2VJbmZvLT5tTW9kZWwsIHJvdywgaSkpCisgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgIExPR0UoImZpbGxEZXZpY2U6IHVua25vd24gY29sdW1uICVkXG4iLCBtQ29sdW1uc1tpXSk7CisgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgfQorCisgICAgcmV0dXJuIHRydWU7Cit9CisKK2Jvb2wgTXRwQ3Vyc29yOjpmaWxsU3RvcmFnZShDdXJzb3JXaW5kb3cqIHdpbmRvdywgTXRwRGV2aWNlKiBkZXZpY2UsCisgICAgICAgIE10cFN0b3JhZ2VJRCBzdG9yYWdlSUQsIGludCByb3cpIHsKKworTE9HRCgiZmlsbFN0b3JhZ2UgJWRcbiIsIHN0b3JhZ2VJRCk7CisKKyAgICBNdHBTdG9yYWdlSW5mbyogc3RvcmFnZUluZm8gPSBkZXZpY2UtPmdldFN0b3JhZ2VJbmZvKHN0b3JhZ2VJRCk7CisgICAgaWYgKCFzdG9yYWdlSW5mbykKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIGlmICghcHJlcGFyZVJvdyh3aW5kb3cpKSB7CisgICAgICAgIGRlbGV0ZSBzdG9yYWdlSW5mbzsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIGNvbnN0IGNoYXIqIHRleHQ7CisgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBtQ29sdW1uQ291bnQ7IGkrKykgeworICAgICAgICBzd2l0Y2ggKG1Db2x1bW5zW2ldKSB7CisgICAgICAgICAgICBjYXNlIFNUT1JBR0VfUk9XX0lEOgorICAgICAgICAgICAgICAgIGlmICghcHV0TG9uZyh3aW5kb3csIHN0b3JhZ2VJRCwgcm93LCBpKSkKKyAgICAgICAgICAgICAgICAgICAgZ290byBmYWlsOworICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgU1RPUkFHRV9JREVOVElGSUVSOgorICAgICAgICAgICAgICAgIHRleHQgPSBzdG9yYWdlSW5mby0+bVZvbHVtZUlkZW50aWZpZXI7CisgICAgICAgICAgICAgICAgaWYgKCF0ZXh0IHx8ICF0ZXh0WzBdKQorICAgICAgICAgICAgICAgICAgICB0ZXh0ID0gIkNhbWVyYSBTdG9yYWdlIjsKKyAgICAgICAgICAgICAgICBpZiAoIXB1dFN0cmluZyh3aW5kb3csIHRleHQsIHJvdywgaSkpCisgICAgICAgICAgICAgICAgICAgIGdvdG8gZmFpbDsKKyAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIFNUT1JBR0VfREVTQ1JJUFRJT046CisgICAgICAgICAgICAgICAgdGV4dCA9IHN0b3JhZ2VJbmZvLT5tU3RvcmFnZURlc2NyaXB0aW9uOworICAgICAgICAgICAgICAgIGlmICghdGV4dCB8fCAhdGV4dFswXSkKKyAgICAgICAgICAgICAgICAgICAgdGV4dCA9ICJTdG9yYWdlIERlc2NyaXB0aW9uIjsKKyAgICAgICAgICAgICAgICBpZiAoIXB1dFN0cmluZyh3aW5kb3csIHRleHQsIHJvdywgaSkpCisgICAgICAgICAgICAgICAgICAgIGdvdG8gZmFpbDsKKyAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgIExPR0UoImZpbGxTdG9yYWdlOiB1bmtub3duIGNvbHVtbiAlZFxuIiwgbUNvbHVtbnNbaV0pOworICAgICAgICAgICAgICAgIGdvdG8gZmFpbDsKKyAgICAgICAgfQorICAgIH0KKworICAgIGRlbGV0ZSBzdG9yYWdlSW5mbzsKKyAgICByZXR1cm4gdHJ1ZTsKKworZmFpbDoKKyAgICBkZWxldGUgc3RvcmFnZUluZm87CisgICAgcmV0dXJuIGZhbHNlOworfQorCitib29sIE10cEN1cnNvcjo6ZmlsbE9iamVjdChDdXJzb3JXaW5kb3cqIHdpbmRvdywgTXRwRGV2aWNlKiBkZXZpY2UsCisgICAgICAgIE10cE9iamVjdEhhbmRsZSBvYmplY3RJRCwgaW50IHJvdykgeworCisgICAgTXRwT2JqZWN0SW5mbyogb2JqZWN0SW5mbyA9IGRldmljZS0+Z2V0T2JqZWN0SW5mbyhvYmplY3RJRCk7CisgICAgaWYgKCFvYmplY3RJbmZvKQorICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgLy8gb2JqZWN0SW5mby0+cHJpbnQoKTsKKyAgICBpZiAoIXByZXBhcmVSb3cod2luZG93KSkgeworICAgICAgICBkZWxldGUgb2JqZWN0SW5mbzsKKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbUNvbHVtbkNvdW50OyBpKyspIHsKKyAgICAgICAgc3dpdGNoIChtQ29sdW1uc1tpXSkgeworICAgICAgICAgICAgY2FzZSBPQkpFQ1RfUk9XX0lEOgorICAgICAgICAgICAgICAgIGlmICghcHV0TG9uZyh3aW5kb3csIG9iamVjdElELCByb3csIGkpKQorICAgICAgICAgICAgICAgICAgICBnb3RvIGZhaWw7CisgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBPQkpFQ1RfU1RPUkFHRV9JRDoKKyAgICAgICAgICAgICAgICBpZiAoIXB1dExvbmcod2luZG93LCBvYmplY3RJbmZvLT5tU3RvcmFnZUlELCByb3csIGkpKQorICAgICAgICAgICAgICAgICAgICBnb3RvIGZhaWw7CisgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBPQkpFQ1RfRk9STUFUOgorICAgICAgICAgICAgICAgIGlmICghcHV0TG9uZyh3aW5kb3csIG9iamVjdEluZm8tPm1Gb3JtYXQsIHJvdywgaSkpCisgICAgICAgICAgICAgICAgICAgIGdvdG8gZmFpbDsKKyAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIE9CSkVDVF9QUk9URUNUSU9OX1NUQVRVUzoKKyAgICAgICAgICAgICAgICBpZiAoIXB1dExvbmcod2luZG93LCBvYmplY3RJbmZvLT5tUHJvdGVjdGlvblN0YXR1cywgcm93LCBpKSkKKyAgICAgICAgICAgICAgICAgICAgZ290byBmYWlsOworICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgT0JKRUNUX1NJWkU6CisgICAgICAgICAgICAgICAgaWYgKCFwdXRMb25nKHdpbmRvdywgb2JqZWN0SW5mby0+bUNvbXByZXNzZWRTaXplLCByb3csIGkpKQorICAgICAgICAgICAgICAgICAgICBnb3RvIGZhaWw7CisgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBPQkpFQ1RfVEhVTUJfRk9STUFUOgorICAgICAgICAgICAgICAgIGlmICghcHV0TG9uZyh3aW5kb3csIG9iamVjdEluZm8tPm1UaHVtYkZvcm1hdCwgcm93LCBpKSkKKyAgICAgICAgICAgICAgICAgICAgZ290byBmYWlsOworICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgT0JKRUNUX1RIVU1CX1NJWkU6CisgICAgICAgICAgICAgICAgaWYgKCFwdXRMb25nKHdpbmRvdywgb2JqZWN0SW5mby0+bVRodW1iQ29tcHJlc3NlZFNpemUsIHJvdywgaSkpCisgICAgICAgICAgICAgICAgICAgIGdvdG8gZmFpbDsKKyAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIE9CSkVDVF9USFVNQl9XSURUSDoKKyAgICAgICAgICAgICAgICBpZiAoIXB1dExvbmcod2luZG93LCBvYmplY3RJbmZvLT5tVGh1bWJQaXhXaWR0aCwgcm93LCBpKSkKKyAgICAgICAgICAgICAgICAgICAgZ290byBmYWlsOworICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgT0JKRUNUX1RIVU1CX0hFSUdIVDoKKyAgICAgICAgICAgICAgICBpZiAoIXB1dExvbmcod2luZG93LCBvYmplY3RJbmZvLT5tVGh1bWJQaXhIZWlnaHQsIHJvdywgaSkpCisgICAgICAgICAgICAgICAgICAgIGdvdG8gZmFpbDsKKyAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIE9CSkVDVF9JTUFHRV9XSURUSDoKKyAgICAgICAgICAgICAgICBpZiAoIXB1dExvbmcod2luZG93LCBvYmplY3RJbmZvLT5tSW1hZ2VQaXhXaWR0aCwgcm93LCBpKSkKKyAgICAgICAgICAgICAgICAgICAgZ290byBmYWlsOworICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgT0JKRUNUX0lNQUdFX0hFSUdIVDoKKyAgICAgICAgICAgICAgICBpZiAoIXB1dExvbmcod2luZG93LCBvYmplY3RJbmZvLT5tSW1hZ2VQaXhIZWlnaHQsIHJvdywgaSkpCisgICAgICAgICAgICAgICAgICAgIGdvdG8gZmFpbDsKKyAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIE9CSkVDVF9JTUFHRV9ERVBUSDoKKyAgICAgICAgICAgICAgICBpZiAoIXB1dExvbmcod2luZG93LCBvYmplY3RJbmZvLT5tSW1hZ2VQaXhEZXB0aCwgcm93LCBpKSkKKyAgICAgICAgICAgICAgICAgICAgZ290byBmYWlsOworICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgT0JKRUNUX1BBUkVOVDoKKyAgICAgICAgICAgICAgICBpZiAoIXB1dExvbmcod2luZG93LCBvYmplY3RJbmZvLT5tUGFyZW50LCByb3csIGkpKQorICAgICAgICAgICAgICAgICAgICBnb3RvIGZhaWw7CisgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBPQkpFQ1RfQVNTT0NJQVRJT05fVFlQRToKKyAgICAgICAgICAgICAgICBpZiAoIXB1dExvbmcod2luZG93LCBvYmplY3RJbmZvLT5tQXNzb2NpYXRpb25UeXBlLCByb3csIGkpKQorICAgICAgICAgICAgICAgICAgICBnb3RvIGZhaWw7CisgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBPQkpFQ1RfQVNTT0NJQVRJT05fREVTQzoKKyAgICAgICAgICAgICAgICBpZiAoIXB1dExvbmcod2luZG93LCBvYmplY3RJbmZvLT5tQXNzb2NpYXRpb25EZXNjLCByb3csIGkpKQorICAgICAgICAgICAgICAgICAgICBnb3RvIGZhaWw7CisgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBPQkpFQ1RfU0VRVUVOQ0VfTlVNQkVSOgorICAgICAgICAgICAgICAgIGlmICghcHV0TG9uZyh3aW5kb3csIG9iamVjdEluZm8tPm1TZXF1ZW5jZU51bWJlciwgcm93LCBpKSkKKyAgICAgICAgICAgICAgICAgICAgZ290byBmYWlsOworICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgT0JKRUNUX05BTUU6CisgICAgICAgICAgICAgICAgaWYgKCFwdXRTdHJpbmcod2luZG93LCBvYmplY3RJbmZvLT5tTmFtZSwgcm93LCBpKSkKKyAgICAgICAgICAgICAgICAgICAgZ290byBmYWlsOworICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgT0JKRUNUX0RBVEVfQ1JFQVRFRDoKKyAgICAgICAgICAgICAgICBpZiAoIXB1dExvbmcod2luZG93LCBvYmplY3RJbmZvLT5tRGF0ZUNyZWF0ZWQsIHJvdywgaSkpCisgICAgICAgICAgICAgICAgICAgIGdvdG8gZmFpbDsKKyAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIE9CSkVDVF9EQVRFX01PRElGSUVEOgorICAgICAgICAgICAgICAgIGlmICghcHV0TG9uZyh3aW5kb3csIG9iamVjdEluZm8tPm1EYXRlTW9kaWZpZWQsIHJvdywgaSkpCisgICAgICAgICAgICAgICAgICAgIGdvdG8gZmFpbDsKKyAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIE9CSkVDVF9LRVlXT1JEUzoKKyAgICAgICAgICAgICAgICBpZiAoIXB1dFN0cmluZyh3aW5kb3csIG9iamVjdEluZm8tPm1LZXl3b3Jkcywgcm93LCBpKSkKKyAgICAgICAgICAgICAgICAgICAgZ290byBmYWlsOworICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgT0JKRUNUX1RIVU1COgorICAgICAgICAgICAgICAgIGlmICghcHV0VGh1bWJuYWlsKHdpbmRvdywgb2JqZWN0SUQsIG9iamVjdEluZm8tPm1Gb3JtYXQsIHJvdywgaSkpCisgICAgICAgICAgICAgICAgICAgIGdvdG8gZmFpbDsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgTE9HRSgiZmlsbFN0b3JhZ2U6IHVua25vd24gY29sdW1uICVkXG4iLCBtQ29sdW1uc1tpXSk7CisgICAgICAgICAgICAgICAgZ290byBmYWlsOworICAgICAgICB9CisgICAgfQorCisgICAgZGVsZXRlIG9iamVjdEluZm87CisgICAgcmV0dXJuIHRydWU7CisKK2ZhaWw6CisgICAgZGVsZXRlIG9iamVjdEluZm87CisgICAgcmV0dXJuIGZhbHNlOworfQorCitib29sIE10cEN1cnNvcjo6cHJlcGFyZVJvdyhDdXJzb3JXaW5kb3cqIHdpbmRvdykgeworICAgIGlmICghd2luZG93LT5zZXROdW1Db2x1bW5zKG1Db2x1bW5Db3VudCkpIHsKKyAgICAgICAgTE9HRSgiRmFpbGVkIHRvIGNoYW5nZSBjb2x1bW4gY291bnQgZnJvbSAlZCB0byAlZCIsIHdpbmRvdy0+Z2V0TnVtQ29sdW1ucygpLCBtQ29sdW1uQ291bnQpOworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorICAgIGZpZWxkX3Nsb3RfdCAqIGZpZWxkRGlyID0gd2luZG93LT5hbGxvY1JvdygpOworICAgIGlmICghZmllbGREaXIpIHsKKyAgICAgICAgTE9HRSgiRmFpbGVkIGFsbG9jYXRpbmcgZmllbGREaXIiKTsKKyAgICAgICAgcm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WxkX3Nsb3RfdCAqIGZpZWxkU2xvdCA9IHdpbmRvdy0+Z2V0RmllbGRTbG90KHJvdywgY29sdW1uKTsKKyAgICBmaWVsZFNsb3QtPnR5cGUgPSBGSUVMRF9UWVBFX1NUUklORzsKKyAgICBmaWVsZFNsb3QtPmRhdGEuYnVmZmVyLm9mZnNldCA9IG9mZnNldDsKKyAgICBmaWVsZFNsb3QtPmRhdGEuYnVmZmVyLnNpemUgPSBzaXplOworICAgIHJldHVybiB0cnVlOworfQorCitib29sIE10cEN1cnNvcjo6cHV0VGh1bWJuYWlsKEN1cnNvcldpbmRvdyogd2luZG93LCBpbnQgb2JqZWN0SUQsIGludCBmb3JtYXQsIGludCByb3csIGludCBjb2x1bW4pIHsKKyAgICBNdHBEZXZpY2UqIGRldmljZSA9IG1DbGllbnQtPmdldERldmljZShtRGV2aWNlSUQpOworICAgIHZvaWQqIHRodW1ibmFpbDsKKyAgICBpbnQgc2l6ZSwgb2Zmc2V0OworICAgIGlmIChmb3JtYXQgPT0gTVRQX0ZPUk1BVF9BU1NPQ0lBVElPTikgeworICAgICAgICB0aHVtYm5haWwgPSBOVUxMOworICAgICAgICBzaXplID0gb2Zmc2V0ID0gMDsKKyAgICB9IGVsc2UgeworICAgICAgICB0aHVtYm5haWwgPSBkZXZpY2UtPmdldFRodW1ibmFpbChvYmplY3RJRCwgc2l6ZSk7CisKKyAgICAgICAgTE9HVigicHV0VGh1bWJuYWlsOiAlcCwgc2l6ZTogJWRcbiIsIHRodW1ibmFpbCwgc2l6ZSk7CisgICAgICAgIG9mZnNldCA9IHdpbmRvdy0+YWxsb2Moc2l6ZSk7CisgICAgICAgIGlmICghb2Zmc2V0KSB7CisgICAgICAgICAgICB3aW5kb3ctPmZyZWVMYXN0Um93KCk7CisgICAgICAgICAgICBMT0dFKCJGYWlsZWQgYWxsb2NhdGluZyAldSBieXRlcyBmb3IgdGh1bWJuYWlsIiwgc2l6ZSk7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7C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W91IG1heSBvYnRhaW4gYSBjb3B5IG9mIHRoZSBMaWNlbnNlIGF0CisgKgorICogICAgICBodHRwOi8vd3d3LmFwYWNoZS5vcmcvbGljZW5zZXMvTElDRU5TRS0yLjAKKyAqCisgKiBVbmxlc3MgcmVxdWlyZWQgYnkgYXBwbGljYWJsZSBsYXcgb3IgYWdyZWVkIHRvIGluIHdyaXRpbmcsIHNvZnR3YXJlCisgKiBkaXN0cmlidXRlZCB1bmRlciB0aGUgTGljZW5zZSBpcyBkaXN0cmlidXRlZCBvbiBhbiAiQVMgSVMiIEJBU0lTLAorICogV0lUSE9VVCBXQVJSQU5USUVTIE9SIENPTkRJVElPTlMgT0YgQU5ZIEtJTkQsIGVpdGhlciBleHByZXNzIG9yIGltcGxpZWQuCisgKiBTZWUgdGhlIExpY2Vuc2UgZm9yIHRoZSBzcGVjaWZpYyBsYW5ndWFnZSBnb3Zlcm5pbmcgcGVybWlzc2lvbnMgYW5kCisgKiBsaW1pdGF0aW9ucyB1bmRlciB0aGUgTGljZW5zZS4KKyAqLworCisjaWZuZGVmIF9NVFBfQ1VSU09SX0gKKyNkZWZpbmUgX01UUF9DVVJTT1JfSAorCisjaW5jbHVkZSAiTXRwVHlwZXMuaCIKKworbmFtZXNwYWNlIGFuZHJvaWQgeworCitjbGFzcyBDdXJzb3JXaW5kb3c7CisKK2NsYXNzIE10cEN1cnNvciB7Citwcml2YXRlOgorICAgIGVudW0geworICAgICAgICBERVZJQ0UgICAgICAgICAgICAgID0gMSwKKyAgICAgICAgREVWSUNFX0lEICAgICAgICAgICA9IDIsCisgICAgICAgIFNUT1JBR0UgICAgICAgICAgICAgPSAzLAorICAgICAgICBTVE9SQUdFX0lEICAgICAgICAgID0gNCwKKyAgICAgICAgT0JKRUNUICAgICAgICAgICAgICA9IDUsCisgICAgICAgIE9CSkVDVF9JRCAgICAgICAgICAgPSA2LAorICAgICAgICBTVE9SQUdFX0NISUxEUkVOICAgID0gNywKKyAgICAgICAgT0JKRUNUX0NISUxEUkVOICAgICA9IDgsCisgICAgfTsKKworICAgIE10cENsaWVudCogIG1DbGllbnQ7CisgICAgaW50ICAgICAgICAgbVF1ZXJ5VHlwZTsKKyAgICBpbnQgICAgICAgICBtRGV2aWNlSUQ7CisgICAgaW50ICAgICAgICAgbVN0b3JhZ2VJRDsKKyAgICBpbnQgICAgICAgICBtUWJqZWN0SUQ7CisgICAgaW50ICAgICAgICAgbUNvbHVtbkNvdW50OworICAgIGludCogICAgICAgIG1Db2x1bW5zOworCitwdWJsaWM6CisgICAgICAgICAgICAgICAgTXRwQ3Vyc29yKE10cENsaWVudCogY2xpZW50LCBpbnQgcXVlcnlUeXBlLCBpbnQgZGV2aWNlSUQsCisgICAgICAgICAgICAgICAgICAgICAgICBpbnQgc3RvcmFnZUlELCBpbnQgb2JqZWN0SUQsIGludCBjb2x1bW5Db3VudCwgaW50KiBjb2x1bW5zKTsKKyAgICB2aXJ0dWFsICAgICB+TXRwQ3Vyc29yKCk7CisKKyAgICBpbnQgICAgICAgICBmaWxsV2luZG93KEN1cnNvcldpbmRvdyogd2luZG93LCBpbnQgc3RhcnRQb3MpOworCitwcml2YXRlOgorICAgIGludCAgICAgICAgIGZpbGxEZXZpY2VzKEN1cnNvcldpbmRvdyogd2luZG93LCBpbnQgc3RhcnRQb3MpOworICAgIGludCAgICAgICAgIGZpbGxEZXZpY2UoQ3Vyc29yV2luZG93KiB3aW5kb3csIGludCBzdGFydFBvcyk7CisgICAgaW50ICAgICAgICAgZmlsbFN0b3JhZ2VzKEN1cnNvcldpbmRvdyogd2luZG93LCBpbnQgc3RhcnRQb3MpOworICAgIGludCAgICAgICAgIGZpbGxTdG9yYWdlKEN1cnNvcldpbmRvdyogd2luZG93LCBpbnQgc3RhcnRQb3MpOworICAgIGludCAgICAgICAgIGZpbGxPYmplY3RzKEN1cnNvcldpbmRvdyogd2luZG93LCBpbnQgcGFyZW50LCBpbnQgc3RhcnRQb3MpOworICAgIGludCAgICAgICAgIGZpbGxPYmplY3QoQ3Vyc29yV2luZG93KiB3aW5kb3csIGludCBzdGFydFBvcyk7CisKKyAgICBib29sICAgICAgICBmaWxsRGV2aWNlKEN1cnNvcldpbmRvdyogd2luZG93LCBNdHBEZXZpY2UqIGRldmljZSwgaW50IHN0YXJ0UG9zKTsKKyAgICBib29sICAgICAgICBmaWxsU3RvcmFnZShDdXJzb3JXaW5kb3cqIHdpbmRvdywgTXRwRGV2aWNlKiBkZXZpY2UsCisgICAgICAgICAgICAgICAgICAgICAgICBNdHBTdG9yYWdlSUQgc3RvcmFnZUlELCBpbnQgcm93KTsKKyAgICBib29sICAgICAgICBmaWxsT2JqZWN0KEN1cnNvcldpbmRvdyogd2luZG93LCBNdHBEZXZpY2UqIGRldmljZSwKKyAgICAgICAgICAgICAgICAgICAgICAgIE10cE9iamVjdEhhbmRsZSBvYmplY3RJRCwgaW50IHJvdyk7CisKKyAgICBib29sICAgICAgICBwcmVwYXJlUm93KEN1cnNvcldpbmRvdyogd2luZG93KTsKKyAgICBib29sICAgICAgICBwdXRMb25nKEN1cnNvcldpbmRvdyogd2luZG93LCBpbnQgdmFsdWUsIGludCByb3csIGludCBjb2x1bW4pOworICAgIGJvb2wgICAgICAgIHB1dFN0cmluZyhDdXJzb3JXaW5kb3cqIHdpbmRvdywgY29uc3QgY2hhciogdGV4dCwgaW50IHJvdywgaW50IGNvbHVtbik7CisgICAgYm9vbCAgICAgICAgcHV0VGh1bWJuYWlsKEN1cnNvcldpbmRvdyogd2luZG93LCBpbnQgb2JqZWN0SUQsIGludCBmb3JtYXQsIGludCByb3csIGludCBjb2x1bW4pOworfTsKKworfTsgLy8gbmFtZXNwYWNlIGFuZHJvaWQKKworI2VuZGlmIC8vIF9NVFBfQ1VSU09SX0gKZGlmZiAtLWdpdCBhL21lZGlhL210cC9NdHBEYXRhUGFja2V0LmNwcCBiL21lZGlhL210cC9NdHBEYXRhUGFja2V0LmNwcApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi5l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CisgICAgdmFsdWVbMV0gPSBnZXRVSW50MzIoKTsKKyAgICB2YWx1ZVsyXSA9IGdldFVJbnQzMigpOworICAgIHZhbHVlWzNdID0gZ2V0VUludDMyKCk7Cit9CisKK3ZvaWQgTXRwRGF0YVBhY2tldDo6Z2V0U3RyaW5nKE10cFN0cmluZ0J1ZmZlciYgc3RyaW5nKQoreworICAgIHN0cmluZy5yZWFkRnJvbVBhY2tldCh0aGlzKTsKK30KKworSW50OExpc3QqIE10cERhdGFQYWNrZXQ6OmdldEFJbnQ4KCkgeworICAgIEludDhMaXN0KiByZXN1bHQgPSBuZXcgSW50OExpc3Q7CisgICAgaW50IGNvdW50ID0gZ2V0VUludDMyKCk7CisgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBjb3VudDsgaSsrKQorICAgICAgICByZXN1bHQtPnB1c2goZ2V0SW50OCgpKTsKKyAgICByZXR1cm4gcmVzdWx0OworfQorCitVSW50OExpc3QqIE10cERhdGFQYWNrZXQ6OmdldEFVSW50OCgpIHsKKyAgICBVSW50OExpc3QqIHJlc3VsdCA9IG5ldyBVSW50OExpc3Q7CisgICAgaW50IGNvdW50ID0gZ2V0VUludDMyKCk7CisgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBjb3VudDsgaSsrKQorICAgICAgICByZXN1bHQtPnB1c2goZ2V0VUludDgoKSk7CisgICAgcmV0dXJuIHJlc3VsdDsKK30KKworSW50MTZMaXN0KiBNdHBEYXRhUGFja2V0OjpnZXRBSW50MTYoKSB7CisgICAgSW50MTZMaXN0KiByZXN1bHQgPSBuZXcgSW50MTZMaXN0OworICAgIGludCBjb3VudCA9IGdldFVJbnQzMigpOworICAgIGZvciAoaW50IGkgPSAwOyBpIDwgY291bnQ7IGkrKykKKyAgICAgICAgcmVzdWx0LT5wdXNoKGdldEludDE2KCkpOworICAgIHJldHVybiByZXN1bHQ7Cit9CisKK1VJbnQxNkxpc3QqIE10cERhdGFQYWNrZXQ6OmdldEFVSW50MTYoKSB7CisgICAgVUludDE2TGlzdCogcmVzdWx0ID0gbmV3IFVJbnQxNkxpc3Q7CisgICAgaW50IGNvdW50ID0gZ2V0VUludDMyKCk7CisgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBjb3VudDsgaSsrKQorICAgICAgICByZXN1bHQtPnB1c2goZ2V0VUludDE2KCkpOworICAgIHJldHVybiByZXN1bHQ7Cit9CisKK0ludDMyTGlzdCogTXRwRGF0YVBhY2tldDo6Z2V0QUludDMyKCkgeworICAgIEludDMyTGlzdCogcmVzdWx0ID0gbmV3IEludDMyTGlzdDsKKyAgICBpbnQgY291bnQgPSBnZXRVSW50MzIoKTsKKyAgICBmb3IgKGludCBpID0gMDsgaSA8IGNvdW50OyBpKyspCisgICAgICAgIHJlc3VsdC0+cHVzaChnZXRJbnQzMigpKTsKKyAgICByZXR1cm4gcmVzdWx0OworfQorCitVSW50MzJMaXN0KiBNdHBEYXRhUGFja2V0OjpnZXRBVUludDMyKCkgeworICAgIFVJbnQzMkxpc3QqIHJlc3VsdCA9IG5ldyBVSW50MzJMaXN0OworICAgIGludCBjb3VudCA9IGdldFVJbnQzMigpOworICAgIGZvciAoaW50IGkgPSAwOyBpIDwgY291bnQ7IGkrKykKKyAgICAgICAgcmVzdWx0LT5wdXNoKGdldFVJbnQzMigpKTsKKyAgICByZXR1cm4gcmVzdWx0OworfQorCitJbnQ2NExpc3QqIE10cERhdGFQYWNrZXQ6OmdldEFJbnQ2NCgpIHsKKyAgICBJbnQ2NExpc3QqIHJlc3VsdCA9IG5ldyBJbnQ2NExpc3Q7CisgICAgaW50IGNvdW50ID0gZ2V0VUludDMyKCk7CisgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBjb3VudDsgaSsrKQorICAgICAgICByZXN1bHQtPnB1c2goZ2V0SW50NjQoKSk7CisgICAgcmV0dXJuIHJlc3VsdDsKK30KKworVUludDY0TGlzdCogTXRwRGF0YVBhY2tldDo6Z2V0QVVJbnQ2NCgpIHsKKyAgICBVSW50NjRMaXN0KiBy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wRGF0YVBhY2tldDo6cHV0QVVJbnQxNihjb25zdCBVSW50MTZMaXN0KiB2YWx1ZXMpIHsKKyAgICBzaXplX3QgY291bnQgPSAodmFsdWVzID8gdmFsdWVzLT5zaXplKCkgOiAwKTsKKyAgICBwdXRVSW50MzIoY291bnQpOworICAgIGZvciAoc2l6ZV90IGkgPSAwOyBpIDwgY291bnQ7IGkrKykKKyAgICAgICAgcHV0VUludDE2KCgqdmFsdWVzKVtpXSk7Cit9CisKK3ZvaWQgTXRwRGF0YVBhY2tldDo6cHV0QUludDMyKGNvbnN0IGludDMyX3QqIHZhbHVlcywgaW50IGNvdW50KSB7CisgICAgcHV0VUludDMyKGNvdW50KTsKKyAgICBmb3IgKGludCBpID0gMDsgaSA8IGNvdW50OyBpKyspCisgICAgICAgIHB1dEludDMyKCp2YWx1ZXMrKyk7Cit9CisKK3ZvaWQgTXRwRGF0YVBhY2tldDo6cHV0QVVJbnQzMihjb25zdCB1aW50MzJfdCogdmFsdWVzLCBpbnQgY291bnQpIHsKKyAgICBwdXRVSW50MzIoY291bnQpOworICAgIGZvciAoaW50IGkgPSAwOyBpIDwgY291bnQ7IGkrKykKKyAgICAgICAgcHV0VUludDMyKCp2YWx1ZXMrKyk7Cit9CisKK3ZvaWQgTXRwRGF0YVBhY2tldDo6cHV0QVVJbnQzMihjb25zdCBVSW50MzJMaXN0KiBsaXN0KSB7CisgICAgaWYgKCFsaXN0KSB7CisgICAgICAgIHB1dEVtcHR5QXJyYXkoKTsKKyAgICB9IGVsc2UgeworICAgICAgICBzaXplX3Qgc2l6ZSA9IGxpc3QtPnNpemUoKTsKKyAgICAgICAgcHV0VUludDMyKHNpemUpOworICAgICAgICBmb3IgKHNpemVfdCBpID0gMDsgaSA8IHNpemU7IGkrKykKKyAgICAgICAgICAgIHB1dFVJbnQzMigoKmxpc3QpW2ldKTsKKyAgICB9Cit9CisKK3ZvaWQgTXRwRGF0YVBhY2tldDo6cHV0QUludDY0KGNvbnN0IGludDY0X3QqIHZhbHVlcywgaW50IGNvdW50KSB7CisgICAgcHV0VUludDMyKGNvdW50KTsKKyAgICBmb3IgKGludCBpID0gMDsgaSA8IGNvdW50OyBpKyspCisgICAgICAgIHB1dEludDY0KCp2YWx1ZXMrKyk7Cit9CisKK3ZvaWQgTXRwRGF0YVBhY2tldDo6cHV0QVVJbnQ2NChjb25zdCB1aW50NjRfdCogdmFsdWVzLCBpbnQgY291bnQpIHsKKyAgICBwdXRVSW50MzIoY291bnQpOworICAgIGZvciAoaW50IGkgPSAwOyBpIDwgY291bnQ7IGkrKykKKyAgICAgICAgcHV0VUludDY0KCp2YWx1ZXMrKyk7Cit9CisKK3ZvaWQgTXRwRGF0YVBhY2tldDo6cHV0U3RyaW5nKGNvbnN0IE10cFN0cmluZ0J1ZmZlciYgc3RyaW5nKSB7CisgICAgc3RyaW5nLndyaXRlVG9QYWNrZXQodGhpcyk7Cit9CisKK3ZvaWQgTXRwRGF0YVBhY2tldDo6cHV0U3RyaW5nKGNvbnN0IGNoYXIqIHMpIHsKKyAgICBNdHBTdHJpbmdCdWZmZXIgc3RyaW5nKHMpOworICAgIHN0cmluZy53cml0ZVRvUGFja2V0KHRoaXMpOworfQorCit2b2lkIE10cERhdGFQYWNrZXQ6OnB1dFN0cmluZyhjb25zdCB1aW50MTZfdCogc3RyaW5nKSB7CisgICAgaW50IGNvdW50ID0gMDsKKyAgICBmb3IgKGludCBpID0gMDsgaSA8IDI1NjsgaSsrKSB7CisgICAgICAgIGlmIChzdHJpbmdbaV0pCisgICAgICAgICAgICBjb3VudCsrOworICAgICAgICBlbHNlCisgICAgICAgICAgICBicmVhazsKKyAgICB9CisgICAgcHV0VUludDgoY291bnQgPiAwID8gY291bnQgKyAxIDogMCk7CisgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBjb3VudDsgaSsrKQorICAgICAgICBwdXRVSW50MTYoc3RyaW5nW2ldKTsKKyAgICAvLyBvbmx5IHRlcm1pbmF0ZSB3aXRoIHplcm8gaWYgc3RyaW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CA+IDApIHsKKyAgICAgICAgaW50IHdyaXRlID0gKGxlbmd0aCA+IHBhY2tldFNpemUgPyBwYWNrZXRTaXplIDogbGVuZ3RoKTsKKyAgICAgICAgaW50IHJldCA9IHRyYW5zZmVyKGVwLCBidWZmZXIsIHdyaXRlKTsKKyAgICAgICAgaWYgKHJldCA8IDApCisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgbGVuZ3RoIC09IHJldDsKKyAgICB9CisgICAgcmV0dXJuIChyZXQgPCAwID8gcmV0IDogMCk7Cit9CisKKyNlbmRpZiAvLyBNVFBfSE9TVAorCit2b2lkKiBNdHBEYXRhUGFja2V0OjpnZXREYXRhKGludCYgb3V0TGVuZ3RoKSBjb25zdCB7CisgICAgaW50IGxlbmd0aCA9IG1QYWNrZXRTaXplIC0gTVRQX0NPTlRBSU5FUl9IRUFERVJfU0laRTsKKyAgICBpZiAobGVuZ3RoID4gMCkgeworICAgICAgICB2b2lkKiByZXN1bHQgPSBtYWxsb2MobGVuZ3RoKTsKKyAgICAgICAgaWYgKHJlc3VsdCkgeworICAgICAgICAgICAgbWVtY3B5KHJlc3VsdCwgbUJ1ZmZlciArIE1UUF9DT05UQUlORVJfSEVBREVSX1NJWkUsIGxlbmd0aCk7CisgICAgICAgICAgICBvdXRMZW5ndGggPSBsZW5ndGg7CisgICAgICAgICAgICByZXR1cm4gcmVzdWx0OworICAgICAgICB9CisgICAgfQorICAgIG91dExlbmd0aCA9IDA7CisgICAgcmV0dXJuIE5VTEw7Cit9CisKK30gIC8vIG5hbWVzcGFjZSBhbmRyb2lkCmRpZmYgLS1naXQgYS9tZWRpYS9tdHAvTXRwRGF0YVBhY2tldC5oIGIvbWVkaWEvbXRwL010cERhdGFQYWNrZXQuaApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi5mYWI2YTA3Ci0tLSAvZGV2L251bGwKKysrIGIvbWVkaWEvbXRwL010cERhdGFQYWNrZXQuaApAQCAtMCwwICsxLDExOCBAQ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V0IDogcHVibGljIE10cFBhY2tldCB7Citwcml2YXRlOgorICAgIC8vIGN1cnJlbnQgb2Zmc2V0IGZvciBnZXQvcHV0IG1ldGhvZHMKKyAgICBpbnQgICAgICAgICAgICAgICAgIG1PZmZzZXQ7CisKK3B1YmxpYzoKKyAgICAgICAgICAgICAgICAgICAgICAgIE10cERhdGFQYWNrZXQoKTsKKyAgICB2aXJ0dWFsICAgICAgICAgICAgIH5NdHBEYXRhUGFja2V0KCk7CisKKyAgICB2aXJ0dWFsIHZvaWQgICAgICAgIHJlc2V0KCk7CisKKyAgICB2b2lkICAgICAgICAgICAgICAgIHNldE9wZXJhdGlvbkNvZGUoTXRwT3BlcmF0aW9uQ29kZSBjb2RlKTsKKyAgICB2b2lkICAgICAgICAgICAgICAgIHNldFRyYW5zYWN0aW9uSUQoTXRwVHJhbnNhY3Rpb25JRCBpZCk7CisKKyAgICBpbmxpbmUgdWludDhfdCAgICAgIGdldFVJbnQ4KCkgeyByZXR1cm4gKHVpbnQ4X3QpbUJ1ZmZlclttT2Zmc2V0KytdOyB9CisgICAgaW5saW5lIGludDhfdCAgICAgICBnZXRJbnQ4KCkgeyByZXR1cm4gKGludDhfdCltQnVmZmVyW21PZmZzZXQrK107IH0KKyAgICB1aW50MTZfdCAgICAgICAgICAgIGdldFVJbnQxNigpOworICAgIGlubGluZSBpbnQxNl90ICAgICAgZ2V0SW50MTYoKSB7IHJldHVybiAoaW50MTZfdClnZXRVSW50MTYoKTsgfQorICAgIHVpbnQzMl90ICAgICAgICAgICAgZ2V0VUludDMyKCk7CisgICAgaW5saW5lIGludDMyX3QgICAgICBnZXRJbnQzMigpIHsgcmV0dXJuIChpbnQzMl90KWdldFVJbnQzMigpOyB9CisgICAgdWludDY0X3QgICAgICAgICAgICBnZXRVSW50NjQoKTsKKyAgICBpbmxpbmUgaW50NjRfdCAgICAgIGdldEludDY0KCkgeyByZXR1cm4gKGludDY0X3QpZ2V0VUludDY0KCk7IH0KKyAgICB2b2lkICAgICAgICAgICAgICAgIGdldFVJbnQxMjgodWludDEyOF90JiB2YWx1ZSk7CisgICAgaW5saW5lIHZvaWQgICAgICAgICBnZXRJbnQxMjgoaW50MTI4X3QmIHZhbHVlKSB7IGdldFVJbnQxMjgoKHVpbnQxMjhfdCYpdmFsdWUpOyB9CisgICAgdm9pZCAgICAgICAgICAgICAgICBnZXRTdHJpbmcoTXRwU3RyaW5nQnVmZmVyJiBzdHJpbmcpOworCisgICAgSW50OExpc3QqICAgICAgICAgICBnZXRBSW50OCgpOworICAgIFVJbnQ4TGlzdCogICAgICAgICAgZ2V0QVVJbnQ4KCk7CisgICAgSW50MTZMaXN0KiAgICAgICAgICBnZXRBSW50MTYoKTsKKyAgICBVSW50MTZMaXN0KiAgICAgICAgIGdldEFVSW50MTYoKTsKKyAgICBJbnQzMkxpc3QqICAgICAgICAgIGdldEFJbnQzMigpOworICAgIFVJbnQzMkxpc3QqICAgICAgICAgZ2V0QVVJbnQzMigpOworICAgIEludDY0TGlzdCogICAgICAgICAgZ2V0QUludDY0KCk7CisgICAgVUludDY0TGlzdCogICAgICAgICBnZXRBVUludDY0KCk7CisKKyAgICB2b2lkICAgICAgICAgICAgICAgIHB1dEludDgoaW50OF90IHZhbHVlKTsKKyAgICB2b2lkICAgICAgICAgICAgICAgIHB1dFVJbnQ4KHVpbnQ4X3QgdmFsdWUpOworICAgIHZvaWQgICAgICAgICAgICAgICAgcHV0SW50MTYoaW50MTZfdCB2YWx1ZSk7CisgICAgdm9pZCAgICAgICAgICAgICAgICBwdXRVSW50MTYodWludDE2X3QgdmFsdWUpOworICAgIHZvaWQgICAgICAgICAgICAgICAgcHV0SW50MzIoaW50MzJfdCB2YWx1ZSk7CisgICAgdm9pZCAgICAgICAgICAgICAgICBwdXRVSW50MzIodWludDMyX3QgdmFsdWUpOworICAgIHZvaWQgICAgICAgICAgICAgICAgcHV0SW50NjQoaW50NjRfdCB2YWx1ZSk7CisgICAgdm9pZCAgICAgICAgICAgICAgICBwdXRVSW50NjQodWludDY0X3QgdmFsdWUpOworICAgIHZvaWQgICAgICAgICAgICAgICAgcHV0SW50MTI4KGNvbnN0IGludDEyOF90JiB2YWx1ZSk7CisgICAgdm9pZCAgICAgICAgICAgICAgICBwdXRVSW50MTI4KGNvbnN0IHVpbnQxMjhfdCYgdmFsdWUpOworICAgIHZvaWQgICAgICAgICAgICAgICAgcHV0SW50MTI4KGludDY0X3QgdmFsdWUpOworICAgIHZvaWQgICAgICAgICAgICAgICAgcHV0VUludDEyOCh1aW50NjRfdCB2YWx1ZSk7CisKKyAgICB2b2lkICAgICAgICAgICAgICAgIHB1dEFJbnQ4KGNvbnN0IGludDhfdCogdmFsdWVzLCBpbnQgY291bnQpOworICAgIHZvaWQgICAgICAgICAgICAgICAgcHV0QVVJbnQ4KGNvbnN0IHVpbnQ4X3QqIHZhbHVlcywgaW50IGNvdW50KTsKKyAgICB2b2lkICAgICAgICAgICAgICAgIHB1dEFJbnQxNihjb25zdCBpbnQxNl90KiB2YWx1ZXMsIGludCBjb3VudCk7CisgICAgdm9pZCAgICAgICAgICAgICAgICBwdXRBVUludDE2KGNvbnN0IHVpbnQxNl90KiB2YWx1ZXMsIGludCBjb3VudCk7CisgICAgdm9pZCAgICAgICAgICAgICAgICBwdXRBVUludDE2KGNvbnN0IFVJbnQxNkxpc3QqIHZhbHVlcyk7CisgICAgdm9pZCAgICAgICAgICAgICAgICBwdXRBSW50MzIoY29uc3QgaW50MzJfdCogdmFsdWVzLCBpbnQgY291bnQpOworICAgIHZvaWQgICAgICAgICAgICAgICAgcHV0QVVJbnQzMihjb25zdCB1aW50MzJfdCogdmFsdWVzLCBpbnQgY291bnQpOworICAgIHZvaWQgICAgICAgICAgICAgICAgcHV0QVVJbnQzMihjb25zdCBVSW50MzJMaXN0KiBsaXN0KTsKKyAgICB2b2lkICAgICAgICAgICAgICAgIHB1dEFJbnQ2NChjb25zdCBpbnQ2NF90KiB2YWx1ZXMsIGludCBjb3VudCk7CisgICAgdm9pZCAgICAgICAgICAgICAgICBwdXRBVUludDY0KGNvbnN0IHVpbnQ2NF90KiB2YWx1ZXMsIGludCBjb3VudCk7CisgICAgdm9pZCAgICAgICAgICAgICAgICBwdXRTdHJpbmcoY29uc3QgTXRwU3RyaW5nQnVmZmVyJiBzdHJpbmcpOworICAgIHZvaWQgICAgICAgICAgICAgICAgcHV0U3RyaW5nKGNvbnN0IGNoYXIqIHN0cmluZyk7CisgICAgdm9pZCAgICAgICAgICAgICAgICBwdXRTdHJpbmcoY29uc3QgdWludDE2X3QqIHN0cmluZyk7CisgICAgaW5saW5lIHZvaWQgICAgICAgICBwdXRFbXB0eVN0cmluZygpIHsgcHV0VUludDgoMCk7IH0KKyAgICBpbmxpbmUgdm9pZCAgICAgICAgIHB1dEVtcHR5QXJyYXkoKSB7IHB1dFVJbnQzMigwKTsgfQorCisKKyNpZmRlZiBNVFBfREVWSUNFCisgICAgLy8gZmlsbCBvdXIgYnVmZmVyIHdpdGggZGF0YSBmcm9tIHRoZSBnaXZlbiBmaWxlIGRlc2NyaXB0b3IKKyAgICBpbnQgICAgICAgICAgICAgICAgIHJlYWQoaW50IGZkKTsKKyAgICBpbnQgICAgICAgICAgICAgICAgIHJlYWREYXRhSGVhZGVyKGludCBmZCk7CisKKyAgICAvLyB3cml0ZSBvdXIgZGF0YSB0byB0aGUgZ2l2ZW4gZmlsZSBkZXNjcmlwdG9yCisgICAgaW50ICAgICAgICAgICAgICAgICB3cml0ZShpbnQgZmQpOworICAgIGludCAgICAgICAgICAgICAgICAgd3JpdGVEYXRhSGVhZGVyKGludCBmZCwgdWludDMyX3QgbGVuZ3RoKTsKKyNlbmRpZgorCisjaWZkZWYgTVRQX0hPU1QKKyAgICBpbnQgICAgICAgICAgICAgICAgIHJlYWQoc3RydWN0IHVzYl9lbmRwb2ludCAqZXApOworICAgIGludCAgICAgICAgICAgICAgICAgcmVhZERhdGEoc3RydWN0IHVzYl9lbmRwb2ludCAqZXAsIHZvaWQqIGJ1ZmZlciwgaW50IGxlb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BNdHBPYmplY3RIYW5kbGUgICAgICAgICBiZWdpblNlbmRPYmplY3QoY29uc3QgY2hhciogcGF0aCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTXRwT2JqZWN0Rm9ybWF0IGZvcm1hdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTXRwT2JqZWN0SGFuZGxlIHBhcmVudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTXRwU3RvcmFnZUlEIHN0b3JhZ2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQ2NF90IHNpemUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpbWVfdCBtb2RpZmllZCkgPSAwOworCisgICAgLy8gY2FsbGVkIHRvIHJlcG9ydCBzdWNjZXNzIG9yIGZhaWx1cmUgb2YgdGhlIFNlbmRPYmplY3QgZmlsZSB0cmFuc2ZlcgorICAgIC8vIHN1Y2Nlc3Mgc2hvdWxkIHNpZ25hbCBhIG5vdGlmaWNhdGlvbiBvZiB0aGUgbmV3IG9iamVjdCdzIGNyZWF0aW9uLAorICAgIC8vIGZhaWx1cmUgc2hvdWxkIHJlbW92ZSB0aGUgZGF0YWJhc2UgZW50cnkgY3JlYXRlZCBpbiBiZWdpblNlbmRPYmplY3QKKyAgICB2aXJ0dWFsIHZvaWQgICAgICAgICAgICAgICAgICAgIGVuZFNlbmRPYmplY3QoY29uc3QgY2hhciogcGF0aCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTXRwT2JqZWN0SGFuZGxlIGhhbmRsZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTXRwT2JqZWN0Rm9ybWF0IGZvcm1hdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCBzdWNjZWVkZWQpID0gMDsKKworICAgIHZpcnR1YWwgTXRwT2JqZWN0SGFuZGxlTGlzdCogICAgZ2V0T2JqZWN0TGlzdChNdHBTdG9yYWdlSUQgc3RvcmFnZUlELAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBPYmplY3RGb3JtYXQgZm9ybWF0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBPYmplY3RIYW5kbGUgcGFyZW50KSA9IDA7CisKKyAgICB2aXJ0dWFsIGludCAgICAgICAgICAgICAgICAgICAgIGdldE51bU9iamVjdHMoTXRwU3RvcmFnZUlEIHN0b3JhZ2VJRCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTXRwT2JqZWN0Rm9ybWF0IGZvcm1hdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTXRwT2JqZWN0SGFuZGxlIHBhcmVudCkgPSAwOworCisgICAgLy8gY2FsbGVlIHNob3VsZCBkZWxldGVbXSB0aGUgcmVzdWx0cyBmcm9tIHRoZXNlCisgICAgLy8gcmVzdWx0cyBjYW4gYmUgTlVMTAorICAgIHZpcnR1YWwgTXRwT2JqZWN0Rm9ybWF0TGlzdCogICAgZ2V0U3VwcG9ydGVkUGxheWJhY2tGb3JtYXRzKCkgPSAwOworICAgIHZpcnR1YWwgTXRwT2JqZWN0Rm9ybWF0TGlzdCogICAgZ2V0U3VwcG9ydGVkQ2FwdHVyZUZvcm1hdHMoKSA9IDA7CisgICAgdmlydHVhbCBNdHBPYmplY3RQcm9wZXJ0eUxpc3QqICBnZXRTdXBwb3J0ZWRPYmplY3RQcm9wZXJ0aWVzKE10cE9iamVjdEZvcm1hdCBmb3JtYXQpID0gMDsKKyAgICB2aXJ0dWFsIE10cERldmljZVByb3BlcnR5TGlzdCogIGdldFN1cHBvcnRlZERldmljZVByb3BlcnRpZXMoKSA9IDA7CisKKyAgICB2aXJ0dWFsIE10cFJlc3BvbnNlQ29kZSAgICAgICAgIGdldE9iamVjdFByb3BlcnR5VmFsdWUoTXRwT2JqZWN0SGFuZGxlIGhhbmRsZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTXRwT2JqZWN0UHJvcGVydHkgcHJvcGVydHksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE10cERhdGFQYWNrZXQmIHBhY2tldCkgPSAwOworCisgICAgdmlydHVhbCBNdHBSZXNwb25zZUNvZGUgICAgICAgICBzZXRPYmplY3RQcm9wZXJ0eVZhbHVlKE10cE9iamVjdEhhbmRsZSBoYW5kbGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE10cE9iamVjdFByb3BlcnR5IHByb3BlcnR5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBEYXRhUGFja2V0JiBwYWNrZXQpID0gMDsKKworICAgIHZpcnR1YWwgTXRwUmVzcG9uc2VDb2RlICAgICAgICAgZ2V0RGV2aWNlUHJvcGVydHlWYWx1ZShNdHBEZXZpY2VQcm9wZXJ0eSBwcm9wZXJ0eSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTXRwRGF0YVBhY2tldCYgcGFja2V0KSA9IDA7CisKKyAgICB2aXJ0dWFsIE10cFJlc3BvbnNlQ29kZSAgICAgICAgIHNldERldmljZVByb3BlcnR5VmFsdWUoTXRwRGV2aWNlUHJvcGVydHkgcHJvcGVydHksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE10cERhdGFQYWNrZXQmIHBhY2tldCkgPSAwOworCisgICAgdmlydHVhbCBNdHBSZXNwb25zZUNvZGUgICAgICAgICByZXNldERldmljZVByb3BlcnR5KE10cERldmljZVByb3BlcnR5IHByb3BlcnR5KSA9IDA7CisKKyAgICB2aXJ0dWFsIE10cFJlc3BvbnNlQ29kZSAgICAgICAgIGdldE9iamVjdEluZm8oTXRwT2JqZWN0SGFuZGxlIGhhbmRsZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTXRwRGF0YVBhY2tldCYgcGFja2V0KSA9IDA7CisKKyAgICB2aXJ0dWFsIE10cFJlc3BvbnNlQ29kZSAgICAgICAgIGdldE9iamVjdEZpbGVQYXRoKE10cE9iamVjdEhhbmRsZSBoYW5kbGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE10cFN0cmluZyYgZmlsZVBhdGgsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludDY0X3QmIGZpbGVMZW5ndGgpID0gMDsKKworICAgIHZpcnR1YWwgTXRwUmVzcG9uc2VDb2RlICAgICAgICAgZGVsZXRlRmlsZShNdHBPYmplY3RIYW5kbGUgaGFuZGxlKSA9IDA7CisKKyAgICB2aXJ0dWFsIE10cE9iamVjdEhhbmRsZUxpc3QqICAgIGdldE9iamVjdFJlZmVyZW5jZXMoTXRwT2JqZWN0SGFuZGxlIGhhbmRsZSkgPSAwOworCisgICAgdmlydHVhbCBNdHBSZXNwb25zZUNvZGUgICAgICAgICBzZXRPYmplY3RSZWZlcmVuY2VzKE10cE9iamVjdEhhbmRsZSBoYW5kbGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIE10cE9iamVjdEhhbmRsZUxpc3QqIHJlZmVyZW5jZXMpID0gMDsKKworICAgIHZpcnR1YWwgTXRwUHJvcGVydHkqICAgICAgICAgICAgZ2V0T2JqZWN0UHJvcGVydHlEZXNjKE10cE9iamVjdFByb3BlcnR5IHByb3BlcnR5LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBPYmplY3RGb3JtYXQgZm9ybWF0KSA9IDA7CisKKyAgICB2aXJ0dWFs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NyB9LAorICAgIHsgIk1UUF9PUEVSQVRJT05fR0VUX09CSkVDVF9JTkZPIiwgICAgICAgICAgICAgIDB4MTAwOCB9LAorICAgIHsgIk1UUF9PUEVSQVRJT05fR0VUX09CSkVDVCIsICAgICAgICAgICAgICAgICAgIDB4MTAwOSB9LAorICAgIHsgIk1UUF9PUEVSQVRJT05fR0VUX1RIVU1CIiwgICAgICAgICAgICAgICAgICAgIDB4MTAwQSB9LAorICAgIHsgIk1UUF9PUEVSQVRJT05fREVMRVRFX09CSkVDVCIsICAgICAgICAgICAgICAgIDB4MTAwQiB9LAorICAgIHsgIk1UUF9PUEVSQVRJT05fU0VORF9PQkpFQ1RfSU5GTyIsICAgICAgICAgICAgIDB4MTAwQyB9LAorICAgIHsgIk1UUF9PUEVSQVRJT05fU0VORF9PQkpFQ1QiLCAgICAgICAgICAgICAgICAgIDB4MTAwRCB9LAorICAgIHsgIk1UUF9PUEVSQVRJT05fSU5JVElBVEVfQ0FQVFVSRSIsICAgICAgICAgICAgIDB4MTAwRSB9LAorICAgIHsgIk1UUF9PUEVSQVRJT05fRk9STUFUX1NUT1JFIiwgICAgICAgICAgICAgICAgIDB4MTAwRiB9LAorICAgIHsgIk1UUF9PUEVSQVRJT05fUkVTRVRfREVWSUNFIiwgICAgICAgICAgICAgICAgIDB4MTAxMCB9LAorICAgIHsgIk1UUF9PUEVSQVRJT05fU0VMRl9URVNUIiwgICAgICAgICAgICAgICAgICAgIDB4MTAxMSB9LAorICAgIHsgIk1UUF9PUEVSQVRJT05fU0VUX09CSkVDVF9QUk9URUNUSU9OIiwgICAgICAgIDB4MTAxMiB9LAorICAgIHsgIk1UUF9PUEVSQVRJT05fUE9XRVJfRE9XTiIsICAgICAgICAgICAgICAgICAgIDB4MTAxMyB9LAorICAgIHsgIk1UUF9PUEVSQVRJT05fR0VUX0RFVklDRV9QUk9QX0RFU0MiLCAgICAgICAgIDB4MTAxNCB9LAorICAgIHsgIk1UUF9PUEVSQVRJT05fR0VUX0RF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SRUZFUkVOQ0VTIiwgICAgICAgIDB4OTgxMSB9LAorICAgIHsgIk1UUF9PUEVSQVRJT05fU0tJUCIsICAgICAgICAgICAgICAgICAgICAgICAgIDB4OTgyMCB9LAorICAgIHsgMCwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAgICAgICB9LAorfTsKKworc3RhdGljIGNvbnN0IENvZGVFbnRyeSBzRm9ybWF0Q29kZXNbXSA9IHsKKyAgICB7ICJNVFBfT1BFUkFUSU9OX0dFVF9ERVZJQ0VfSU5GTyIsICAgICAgICAgICAgICAweDEwMDEgfSwKKyAgICB7ICJNVFBfRk9STUFUX1VOREVGSU5FRCIsICAgICAgICAgICAgICAgICAgICAgICAweDMwMDAgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FTU09DSUFUSU9OIiwgICAgICAgICAgICAgICAgICAgICAweDMwMDEgfSwKKyAgICB7ICJNVFBfRk9STUFUX1NDUklQVCIsICAgICAgICAgICAgICAgICAgICAgICAgICAweDMwMDIgfSwKKyAgICB7ICJNVFBfRk9STUFUX0VYRUNVVEFCTEUiLCAgICAgICAgICAgICAgICAgICAgICAweDMwMDMgfSwKKyAgICB7ICJNVFBfRk9STUFUX1RFWFQiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDMwMDQgfSwKKyAgICB7ICJNVFBfRk9STUFUX0hUTUwiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDMwMDUgfSwKKyAgICB7ICJNVFBfRk9STUFUX0RQT0YiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDMwMDYgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FJRkYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDMwMDcgfSwKKyAgICB7ICJNVFBfRk9STUFUX1dBViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDMwMDggfSwKKyAgICB7ICJNVFBfRk9STUFUX01QMyIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDMwMDkgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FWSSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDMwMEEgfSwKKyAgICB7ICJNVFBfRk9STUFUX01QRUciLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDMwMEIgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FTRiIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDMwMEMgfSwKKyAgICB7ICJNVFBfRk9STUFUX0RFRklORUQiLCAgICAgICAgICAgICAgICAgICAgICAgICAweDM4MDAgfSwKKyAgICB7ICJNVFBfRk9STUFUX0VYSUZfSlBFRyIsICAgICAgICAgICAgICAgICAgICAgICAweDM4MDEgfSwKKyAgICB7ICJNVFBfRk9STUFUX1RJRkZfRVAiLCAgICAgICAgICAgICAgICAgICAgICAgICAweDM4MDIgfSwKKyAgICB7ICJNVFBfRk9STUFUX0ZMQVNIUElYIiwgICAgICAgICAgICAgICAgICAgICAgICAweDM4MDMgfSwKKyAgICB7ICJNVFBfRk9STUFUX0JNUCIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDM4MDQgfSwKKyAgICB7ICJNVFBfRk9STUFUX0NJRkYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDM4MDUgfSwKKyAgICB7ICJNVFBfRk9STUFUX0dJRiIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDM4MDcgfSwKKyAgICB7ICJNVFBfRk9STUFUX0pGSUYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDM4MDggfSwKKyAgICB7ICJNVFBfRk9STUFUX0NEIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDM4MDkgfSwKKyAgICB7ICJNVFBfRk9STUFUX1BJQ1QiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDM4MEEgfSwKKyAgICB7ICJNVFBfRk9STUFUX1BORyIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDM4MEIgfSwKKyAgICB7ICJNVFBfRk9STUFUX1RJRkYiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDM4MEQgfSwKKyAgICB7ICJNVFBfRk9STUFUX1RJRkZfSVQiLCAgICAgICAgICAgICAgICAgICAgICAgICAweDM4MEUgfSwKKyAgICB7ICJNVFBfRk9STUFUX0pQMiIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDM4MEYgfSwKKyAgICB7ICJNVFBfRk9STUFUX0pQWCIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDM4MTAgfSwKKyAgICB7ICJNVFBfRk9STUFUX1VOREVGSU5FRF9GSVJNV0FSRSIsICAgICAgICAgICAgICAweEI4MDIgfSwKKyAgICB7ICJNVFBfRk9STUFUX1dJTkRPV1NfSU1BR0VfRk9STUFUIiwgICAgICAgICAgICAweEI4ODEgfSwKKyAgICB7ICJNVFBfRk9STUFUX1VOREVGSU5FRF9BVURJTyIsICAgICAgICAgICAgICAgICAweEI5MDAgfSwKKyAgICB7ICJNVFBfRk9STUFUX1dNQSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweEI5MDEgfSwKKyAgICB7ICJNVFBfRk9STUFUX09HRyIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweEI5MDIgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FBQyIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweEI5MDMgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FVRElCTEUiLCAgICAgICAgICAgICAgICAgICAgICAgICAweEI5MDQgfSwKKyAgICB7ICJNVFBfRk9STUFUX0ZMQUMiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAweEI5MDYgfSwKKyAgICB7ICJNVFBfRk9STUFUX1VOREVGSU5FRF9WSURFTyIsICAgICAgICAgICAgICAgICAweEI5ODAgfSwKKyAgICB7ICJNVFBfRk9STUFUX1dNViIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweEI5ODEgfSwKKyAgICB7ICJNVFBfRk9STUFUX01QNF9DT05UQUlORVIiLCAgICAgICAgICAgICAgICAgICAweEI5ODIgfSwKKyAgICB7ICJNVFBfRk9STUFUX01QMiIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweEI5ODMgfSwKKyAgICB7ICJNVFBfRk9STUFUXzNHUF9DT05UQUlORVIiLCAgICAgICAgICAgICAgICAgICAweEI5ODQgfSwKKyAgICB7ICJNVFBfRk9STUFUX1VOREVGSU5FRF9DT0xMRUNUSU9OIiwgICAgICAgICAgICAweEJBMDAgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FCU1RSQUNUX01VTFRJTUVESUFfQUxCVU0iLCAgICAgICAweEJBMDEgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FCU1RSQUNUX0lNQUdFX0FMQlVNIiwgICAgICAgICAgICAweEJBMDIgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FCU1RSQUNUX0FVRElPX0FMQlVNIiwgICAgICAgICAgICAweEJBMDMgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FCU1RSQUNUX1ZJREVPX0FMQlVNIiwgICAgICAgICAgICAweEJBMDQgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FCU1RSQUNUX0FWX1BMQVlMSVNUIiwgICAgICAgICAgICAweEJBMDUgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FCU1RSQUNUX0NPTlRBQ1RfR1JPVVAiLCAgICAgICAgICAweEJBMDYgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FCU1RSQUNUX01FU1NBR0VfRk9MREVSIiwgICAgICAgICAweEJBMDcgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FCU1RSQUNUX0NIQVBURVJFRF9QUk9EVUNUSU9OIiwgICAweEJBMDggfSwKKyAgICB7ICJNVFBfRk9STUFUX0FCU1RSQUNUX0FVRElPX1BMQVlMSVNUIiwgICAgICAgICAweEJBMDkgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FCU1RSQUNUX1ZJREVPX1BMQVlMSVNUIiwgICAgICAgICAweEJBMEEgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FCU1RSQUNUX01FRElBQ0FTVCIsICAgICAgICAgICAgICAweEJBMEIgfSwKKyAgICB7ICJNVFBfRk9STUFUX1dQTF9QTEFZTElTVCIsICAgICAgICAgICAgICAgICAgICAweEJBMTAgfSwKKyAgICB7ICJNVFBfRk9STUFUX00zVV9QTEFZTElTVCIsICAgICAgICAgICAgICAgICAgICAweEJBMTEgfSwKKyAgICB7ICJNVFBfRk9STUFUX01QTF9QTEFZTElTVCIsICAgICAgICAgICAgICAgICAgICAweEJBMTIgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FTWF9QTEFZTElTVCIsICAgICAgICAgICAgICAgICAgICAweEJBMTMgfSwKKyAgICB7ICJNVFBfRk9STUFUX1BMU19QTEFZTElTVCIsICAgICAgICAgICAgICAgICAgICAweEJBMTQgfSwKKyAgICB7ICJNVFBfRk9STUFUX1VOREVGSU5FRF9ET0NVTUVOVCIsICAgICAgICAgICAgICAweEJBODAgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FCU1RSQUNUX0RPQ1VNRU5UIiwgICAgICAgICAgICAgICAweEJBODEgfSwKKyAgICB7ICJNVFBfRk9STUFUX1hNTF9ET0NVTUVOVCIsICAgICAgICAgICAgICAgICAgICAweEJBODIgfSwKKyAgICB7ICJNVFBfRk9STUFUX01TX1dPUkRfRE9DVU1FTlQiLCAgICAgICAgICAgICAgICAweEJBODMgfSwKKyAgICB7ICJNVFBfRk9STUFUX01IVF9DT01QSUxFRF9IVE1MX0RPQ1VNRU5UIiwgICAgICAweEJBODQgfSwKKyAgICB7ICJNVFBfRk9STUFUX01TX0VYQ0VMX1NQUkVBRFNIRUVUIiwgICAgICAgICAgICAweEJBODUgfSwKKyAgICB7ICJNVFBfRk9STUFUX01TX1BPV0VSUE9JTlRfUFJFU0VOVEFUSU9OIiwgICAgICAweEJBODYgfSwKKyAgICB7ICJNVFBfRk9STUFUX1VOREVGSU5FRF9NRVNTQUdFIiwgICAgICAgICAgICAgICAweEJCMDAgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FCU1RSQUNUX01FU1NTQUdFIiwgICAgICAgICAgICAgICAweEJCMDEgfSwKKyAgICB7ICJNVFBfRk9STUFUX1VOREVGSU5FRF9DT05UQUNUIiwgICAgICAgICAgICAgICAweEJCODAgfSwKKyAgICB7ICJNVFBfRk9STUFUX0FCU1RSQUNUX0NPTlRBQ1QiLCAgICAgICAgICAgICAgICAweEJCODEgfSwKKyAgICB7ICJNVFBfRk9STUFUX1ZDQVJEXzIiLCAgICAgICAgICAgICAgICAgICAgICAgICAweEJCODIgfSwKKyAgICB7IDAsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAwICAgICAgfSwKK307CisKK3N0YXRpYyBjb25zdCBDb2RlRW50cnkgc09iamVjdFByb3BDb2Rlc1tdID0geworICAgIHsgIk1UUF9QUk9QRVJUWV9TVE9SQUdFX0lEIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REMwMSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9PQkpFQ1RfRk9STUFUIiwgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REMwMiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QUk9URUNUSU9OX1NUQVRVUyIsICAgICAgICAgICAgICAgICAgICAgIDB4REMwMyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9PQkpFQ1RfU0laRSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REMwNCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9BU1NPQ0lBVElPTl9UWVBFIiwgICAgICAgICAgICAgICAgICAgICAgIDB4REMwNSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9BU1NPQ0lBVElPTl9ERVNDIiwgICAgICAgICAgICAgICAgICAgICAgIDB4REMwNiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9PQkpFQ1RfRklMRV9OQU1FIiwgICAgICAgICAgICAgICAgICAgICAgIDB4REMwNyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9EQVRFX0NSRUFURUQiLCAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REMwOCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9EQVRFX01PRElGSUVEIiwgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REMwOSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9LRVlXT1JEUyIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REMwQSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QQVJFTlRfT0JKRUNUIiwgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REMwQiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9BTExPV0VEX0ZPTERFUl9DT05URU5UUyIsICAgICAgICAgICAgICAgIDB4REMwQyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9ISURERU4iLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REMwRCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9TWVNURU1fT0JKRUNUIiwgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REMwRSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QRVJTSVNURU5UX1VJRCIsICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM0MSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9TWU5DX0lEIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM0MiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QUk9QRVJUWV9CQUciLCAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM0MyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9OQU1FIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM0NCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9DUkVBVEVEX0JZIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM0NSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9BUlRJU1QiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM0NiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9EQVRFX0FVVEhPUkVEIiwgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM0NyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9ERVNDUklQVElPTiIsICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM0OCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9VUkxfUkVGRVJFTkNFIiwgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM0OSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9MQU5HVUFHRV9MT0NBTEUiLCAgICAgICAgICAgICAgICAgICAgICAgIDB4REM0QSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9DT1BZUklHSFRfSU5GT1JNQVRJT04iLCAgICAgICAgICAgICAgICAgIDB4REM0QiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9TT1VSQ0UiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM0QyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9PUklHSU5fTE9DQVRJT04iLCAgICAgICAgICAgICAgICAgICAgICAgIDB4REM0RCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9EQVRFX0FEREVEIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM0RSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9OT05fQ09OU1VNQUJMRSIsICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM0RiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9DT1JSVVBUX1VOUExBWUFCTEUiLCAgICAgICAgICAgICAgICAgICAgIDB4REM1MCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QUk9EVUNFUl9TRVJJQUxfTlVNQkVSIiwgICAgICAgICAgICAgICAgIDB4REM1MSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9SRVBSRVNFTlRBVElWRV9TQU1QTEVfRk9STUFUIiwgICAgICAgICAgIDB4REM4MSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9SRVBSRVNFTlRBVElWRV9TQU1QTEVfU0laRSIsICAgICAgICAgICAgIDB4REM4MiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9SRVBSRVNFTlRBVElWRV9TQU1QTEVfSEVJR0hUIiwgICAgICAgICAgIDB4REM4MyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9SRVBSRVNFTlRBVElWRV9TQU1QTEVfV0lEVEgiLCAgICAgICAgICAgIDB4REM4NCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9SRVBSRVNFTlRBVElWRV9TQU1QTEVfRFVSQVRJT04iLCAgICAgICAgIDB4REM4NSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9SRVBSRVNFTlRBVElWRV9TQU1QTEVfREFUQSIsICAgICAgICAgICAgIDB4REM4NiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9XSURUSCIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM4NyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9IRUlHSFQiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM4OCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9EVVJBVElPTiIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM4OSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9SQVRJTkciLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM4QSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9UUkFDSyIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM4QiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9HRU5SRSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM4QyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9DUkVESVRTIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM4RCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9MWVJJQ1MiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM4RSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9TVUJTQ1JJUFRJT05fQ09OVEVOVF9JRCIsICAgICAgICAgICAgICAgIDB4REM4RiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QUk9EVUNFRF9CWSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM5MCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9VU0VfQ09VTlQiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM5MSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9TS0lQX0NPVU5UIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM5MiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9MQVNUX0FDQ0VTU0VEIiwgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM5MyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QQVJFTlRBTF9SQVRJTkciLCAgICAgICAgICAgICAgICAgICAgICAgIDB4REM5NCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9NRVRBX0dFTlJFIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM5NSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9DT01QT1NFUiIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM5NiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9FRkZFQ1RJVkVfUkFUSU5HIiwgICAgICAgICAgICAgICAgICAgICAgIDB4REM5NyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9TVUJUSVRMRSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM5OCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9PUklHSU5BTF9SRUxFQVNFX0RBVEUiLCAgICAgICAgICAgICAgICAgIDB4REM5OSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9BTEJVTV9OQU1FIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM5QSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9BTEJVTV9BUlRJU1QiLCAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM5QiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9NT09EIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM5QyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9EUk1fU1RBVFVTIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM5RCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9TVUJfREVTQ1JJUFRJT04iLCAgICAgICAgICAgICAgICAgICAgICAgIDB4REM5RSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9JU19DUk9QUEVEIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4RENEMSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9JU19DT0xPVVJfQ09SUkVDVEVEIiwgICAgICAgICAgICAgICAgICAgIDB4RENEMiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9JTUFHRV9CSVRfREVQVEgiLCAgICAgICAgICAgICAgICAgICAgICAgIDB4RENEMyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9GX05VTUJFUiIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4RENENCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9FWFBPU1VSRV9USU1FIiwgICAgICAgICAgICAgICAgICAgICAgICAgIDB4RENENSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9FWFBPU1VSRV9JTkRFWCIsICAgICAgICAgICAgICAgICAgICAgICAgIDB4RENENiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9UT1RBTF9CSVRSQVRFIiwgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REU5MSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9CSVRSQVRFX1RZUEUiLCAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REU5MiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9TQU1QTEVfUkFURSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REU5MyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9OVU1CRVJfT0ZfQ0hBTk5FTFMiLCAgICAgICAgICAgICAgICAgICAgIDB4REU5NCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9BVURJT19CSVRfREVQVEgiLCAgICAgICAgICAgICAgICAgICAgICAgIDB4REU5NSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9TQ0FOX1RZUEUiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REU5NyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9BVURJT19XQVZFX0NPREVDIiwgICAgICAgICAgICAgICAgICAgICAgIDB4REU5OSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9BVURJT19CSVRSQVRFIiwgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REU5QSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9WSURFT19GT1VSQ0NfQ09ERUMiLCAgICAgICAgICAgICAgICAgICAgIDB4REU5QiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9WSURFT19CSVRSQVRFIiwgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REU5QyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9GUkFNRVNfUEVSX1RIT1VTQU5EX1NFQ09ORFMiLCAgICAgICAgICAgIDB4REU5RCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9LRVlGUkFNRV9ESVNUQU5DRSIsICAgICAgICAgICAgICAgICAgICAgIDB4REU5RSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9CVUZGRVJfU0laRSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REU5RiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9FTkNPRElOR19RVUFMSVRZIiwgICAgICAgICAgICAgICAgICAgICAgIDB4REVBMCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9FTkNPRElOR19QUk9GSUxFIiwgICAgICAgICAgICAgICAgICAgICAgIDB4REVBMSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9ESVNQTEFZX05BTUUiLCAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4RENFMCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9CT0RZX1RFWFQiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4RENFMSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9TVUJKRUNUIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4RENFMiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QUklPUklUWSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4RENFMyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9HSVZFTl9OQU1FIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQwMCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9NSURETEVfTkFNRVMiLCAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQwMSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9GQU1JTFlfTkFNRSIsICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQwMiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QUkVGSVgiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQwMyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9TVUZGSVgiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQwNCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QSE9ORVRJQ19HSVZFTl9OQU1FIiwgICAgICAgICAgICAgICAgICAgIDB4REQwNSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QSE9ORVRJQ19GQU1JTFlfTkFNRSIsICAgICAgICAgICAgICAgICAgIDB4REQwNiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9FTUFJTF9QUklNQVJZIiwgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQwNyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9FTUFJTF9QRVJTT05BTF8xIiwgICAgICAgICAgICAgICAgICAgICAgIDB4REQwOCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9FTUFJTF9QRVJTT05BTF8yIiwgICAgICAgICAgICAgICAgICAgICAgIDB4REQwOSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9FTUFJTF9CVVNJTkVTU18xIiwgICAgICAgICAgICAgICAgICAgICAgIDB4REQwQSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9FTUFJTF9CVVNJTkVTU18yIiwgICAgICAgICAgICAgICAgICAgICAgIDB4REQwQiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9FTUFJTF9PVEhFUlMiLCAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQwQyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QSE9ORV9OVU1CRVJfUFJJTUFSWSIsICAgICAgICAgICAgICAgICAgIDB4REQwRCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QSE9ORV9OVU1CRVJfUEVSU09OQUwiLCAgICAgICAgICAgICAgICAgIDB4REQwRSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QSE9ORV9OVU1CRVJfUEVSU09OQUxfMiIsICAgICAgICAgICAgICAgIDB4REQwRiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QSE9ORV9OVU1CRVJfQlVTSU5FU1MiLCAgICAgICAgICAgICAgICAgIDB4REQxMCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QSE9ORV9OVU1CRVJfQlVTSU5FU1NfMiIsICAgICAgICAgICAgICAgIDB4REQxMSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QSE9ORV9OVU1CRVJfTU9CSUxFIiwgICAgICAgICAgICAgICAgICAgIDB4REQxMiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QSE9ORV9OVU1CRVJfTU9CSUxFXzIiLCAgICAgICAgICAgICAgICAgIDB4REQxMyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9GQVhfTlVNQkVSX1BSSU1BUlkiLCAgICAgICAgICAgICAgICAgICAgIDB4REQxNCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9GQVhfTlVNQkVSX1BFUlNPTkFMIiwgICAgICAgICAgICAgICAgICAgIDB4REQxNSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9GQVhfTlVNQkVSX0JVU0lORVNTIiwgICAgICAgICAgICAgICAgICAgIDB4REQxNiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QQUdFUl9OVU1CRVIiLCAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQxNyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QSE9ORV9OVU1CRVJfT1RIRVJTIiwgICAgICAgICAgICAgICAgICAgIDB4REQxOCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QUklNQVJZX1dFQl9BRERSRVNTIiwgICAgICAgICAgICAgICAgICAgIDB4REQxOSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QRVJTT05BTF9XRUJfQUREUkVTUyIsICAgICAgICAgICAgICAgICAgIDB4REQxQSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9CVVNJTkVTU19XRUJfQUREUkVTUyIsICAgICAgICAgICAgICAgICAgIDB4REQxQiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9JTlNUQU5UX01FU1NBTkdFUl9BRERSRVNTIiwgICAgICAgICAgICAgIDB4REQxQyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9JTlNUQU5UX01FU1NBT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4REQzNCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9QSE9ORVRJQ19PUkdBTklaQVRJT05fTkFNRSIsICAgICAgICAgICAgIDB4REQzNSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9ST0xFIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQzNiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9CSVJUSERBVEUiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQzNyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9NRVNTQUdFX1RPIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ0MCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9NRVNTQUdFX0NDIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ0MSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9NRVNTQUdFX0JDQyIsICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ0MiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9NRVNTQUdFX1JFQUQiLCAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ0MyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9NRVNTQUdFX1JFQ0VJVkVEX1RJTUUiLCAgICAgICAgICAgICAgICAgIDB4REQ0NCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9NRVNTQUdFX1NFTkRFUiIsICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ0NSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9BQ1RJVklUWV9CRUdJTl9USU1FIiwgICAgICAgICAgICAgICAgICAgIDB4REQ1MCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9BQ1RJVklUWV9FTkRfVElNRSIsICAgICAgICAgICAgICAgICAgICAgIDB4REQ1MSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9BQ1RJVklUWV9MT0NBVElPTiIsICAgICAgICAgICAgICAgICAgICAgIDB4REQ1MiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9BQ1RJVklUWV9SRVFVSVJFRF9BVFRFTkRFRVMiLCAgICAgICAgICAgIDB4REQ1NCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9BQ1RJVklUWV9PUFRJT05BTF9BVFRFTkRFRVMiLCAgICAgICAgICAgIDB4REQ1NSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9BQ1RJVklUWV9SRVNPVVJDRVMiLCAgICAgICAgICAgICAgICAgICAgIDB4REQ1NiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9BQ1RJVklUWV9BQ0NFUFRFRCIsICAgICAgICAgICAgICAgICAgICAgIDB4REQ1NyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9BQ1RJVklUWV9URU5UQVRJVkUiLCAgICAgICAgICAgICAgICAgICAgIDB4REQ1OCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9BQ1RJVklUWV9ERUNMSU5FRCIsICAgICAgICAgICAgICAgICAgICAgIDB4REQ1OSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9BQ1RJVklUWV9SRU1BSU5ERVJfVElNRSIsICAgICAgICAgICAgICAgIDB4REQ1QSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9BQ1RJVklUWV9PV05FUiIsICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ1QiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9BQ1RJVklUWV9TVEFUVVMiLCAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ1QyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9PV05FUiIsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ1RCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9FRElUT1IiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ1RSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9XRUJNQVNURVIiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ1RiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9VUkxfU09VUkNFIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ2MCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9VUkxfREVTVElOQVRJT04iLCAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ2MSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9USU1FX0JPT0tNQVJLIiwgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ2MiB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9PQkpFQ1RfQk9PS01BUksiLCAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ2MyB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9CWVRFX0JPT0tNQVJLIiwgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ2NCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9MQVNUX0JVSUxEX0RBVEUiLCAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ3MCB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9USU1FX1RPX0xJVkUiLCAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ3MSB9LAorICAgIHsgIk1UUF9QUk9QRVJUWV9NRURJQV9HVUlEIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ3MiB9LAorICAgIHsgMCwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAgICAgICB9LAorfTsKKworc3RhdGljIGNvbnN0IENvZGVFbnRyeSBzRGV2aWNlUHJvcENvZGVzW10gPSB7CisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9VTkRFRklORUQiLCAgICAgICAgICAgICAgICAgICAgICAgMHg1MDAwIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9CQVRURVJZX0xFVkVMIiwgICAgICAgICAgICAgICAgICAgMHg1MDAxIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9GVU5DVElPTkFMX01PREUiLCAgICAgICAgICAgICAgICAgMHg1MDAyIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9JTUFHRV9TSVpFIiwgICAgICAgICAgICAgICAgICAgICAgMHg1MDAzIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9DT01QUkVTU0lPTl9TRVRUSU5HIiwgICAgICAgICAgICAgMHg1MDA0IH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9XSElURV9CQUxBTkNFIiwgICAgICAgICAgICAgICAgICAgMHg1MDA1IH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9SR0JfR0FJTiIsICAgICAgICAgICAgICAgICAgICAgICAgMHg1MDA2IH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9GX05VTUJFUiIsICAgICAgICAgICAgICAgICAgICAgICAgMHg1MDA3IH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9GT0NBTF9MRU5HVEgiLCAgICAgICAgICAgICAgICAgICAgMHg1MDA4IH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9GT0NVU19ESVNUQU5DRSIsICAgICAgICAgICAgICAgICAgMHg1MDA5IH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9GT0NVU19NT0RFIiwgICAgICAgICAgICAgICAgICAgICAgMHg1MDBBIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9FWFBPU1VSRV9NRVRFUklOR19NT0RFIiwgICAgICAgICAgMHg1MDBCIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9GTEFTSF9NT0RFIiwgICAgICAgICAgICAgICAgICAgICAgMHg1MDBDIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9FWFBPU1VSRV9USU1FIiwgICAgICAgICAgICAgICAgICAgMHg1MDBEIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9FWFBPU1VSRV9QUk9HUkFNX01PREUiLCAgICAgICAgICAgMHg1MDBFIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9FWFBPU1VSRV9JTkRFWCIsICAgICAgICAgICAgICAgICAgMHg1MDBGIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9FWFBPU1VSRV9CSUFTX0NPTVBFTlNBVElPTiIsICAgICAgMHg1MDEwIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9EQVRFVElNRSIsICAgICAgICAgICAgICAgICAgICAgICAgMHg1MDExIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9DQVBUVVJFX0RFTEFZIiwgICAgICAgICAgICAgICAgICAgMHg1MDEyIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9TVElMTF9DQVBUVVJFX01PREUiLCAgICAgICAgICAgICAgMHg1MDEzIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9DT05UUkFTVCIsICAgICAgICAgICAgICAgICAgICAgICAgMHg1MDE0IH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9TSEFSUE5FU1MiLCAgICAgICAgICAgICAgICAgICAgICAgMHg1MDE1IH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9ESUdJVEFMX1pPT00iLCAgICAgICAgICAgICAgICAgICAgMHg1MDE2IH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9FRkZFQ1RfTU9ERSIsICAgICAgICAgICAgICAgICAgICAgMHg1MDE3IH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9CVVJTVF9OVU1CRVIiLCAgICAgICAgICAgICAgICAgICAgMHg1MDE4IH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9CVVJTVF9JTlRFUlZBTCIsICAgICAgICAgICAgICAgICAgMHg1MDE5IH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9USU1FTEFQU0VfTlVNQkVSIiwgICAgICAgICAgICAgICAgMHg1MDFBIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9USU1FTEFQU0VfSU5URVJWQUwiLCAgICAgICAgICAgICAgMHg1MDFCIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9GT0NVU19NRVRFUklOR19NT0RFIiwgICAgICAgICAgICAgMHg1MDFDIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9VUExPQURfVVJMIiwgICAgICAgICAgICAgICAgICAgICAgMHg1MDFEIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9BUlRJU1QiLCAgICAgICAgICAgICAgICAgICAgICAgICAgMHg1MDFFIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9DT1BZUklHSFRfSU5GTyIsICAgICAgICAgICAgICAgICAgMHg1MDFGIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9TWU5DSFJPTklaQVRJT05fUEFSVE5FUiIsICAgICAgICAgMHhENDAxIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9ERVZJQ0VfRlJJRU5ETFlfTkFNRSIsICAgICAgICAgICAgMHhENDAyIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9WT0xVTUUiLCAgICAgICAgICAgICAgICAgICAgICAgICAgMHhENDAzIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9TVVBQT1JURURfRk9STUFUU19PUkRFUkVEIiwgICAgICAgMHhENDA0IH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9ERVZJQ0VfSUNPTiIsICAgICAgICAgICAgICAgICAgICAgMHhENDA1IH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9QTEFZQkFDS19SQVRFIiwgICAgICAgICAgICAgICAgICAgMHhENDEwIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9QTEFZQkFDS19PQkpFQ1QiLCAgICAgICAgICAgICAgICAgMHhENDExIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9QTEFZQkFDS19DT05UQUlORVJfSU5ERVgiLCAgICAgICAgMHhENDEyIH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9TRVNTSU9OX0lOSVRJQVRPUl9WRVJTSU9OX0lORk8iLCAgMHhENDA2IH0sCisgICAgeyAiTVRQX0RFVklDRV9QUk9QRVJUWV9QRVJDRUlWRURfREVWSUNFX1RZUEUiLCAgICAgICAgICAgMHhENDA3IH0sCisgICAgeyAwLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMCAgICAgIH0sCit9OworCitzdGF0aWMgY29uc3QgY2hhciogZ2V0Q29kZU5hbWUodWludDE2X3QgY29kZSwgY29uc3QgQ29kZUVudHJ5KiB0YWJsZSkgeworICAgIGNvbnN0IENvZGVFbnRyeSogZW50cnkgPSB0YWJsZTsKKyAgICB3aGlsZSAoZW50cnktPm5hbWUpIHsKKyAgICAgICAgaWYgKGVudHJ5LT5jb2RlID09IGNvZGUpCisgICAgICAgICAgICByZXR1cm4gZW50cnktPm5hbWU7CisgICAgICAgIGVudHJ5Kys7CisgICAgfQorICAgIHJldHVybiAiVU5LTk9XTiI7Cit9CisKK2NvbnN0IGNoYXIqIE10cERlYnVnOjpnZXRPcGVyYXRpb25Db2RlTmFtZShNdHBPcGVyYXRpb25Db2RlIGNvZGUpIHsKKyAgICByZXR1cm4gZ2V0Q29kZU5hbWUoY29kZSwgc09wZXJhdGlvbkNvZGVzKTsKK30KKworY29uc3QgY2hhciogTXRwRGVidWc6OmdldEZvcm1hdENvZGVOYW1lKE10cE9wZXJhdGlvbkNvZGUgY29kZSkgeworICAgIHJldHVybiBnZXRDb2RlTmFtZShjb2Rl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gICAgIG1TZXNzaW9uSUQoMCksCisgICAgICAgIG1UcmFuc2FjdGlvbklEKDApCit7Cit9CisKK010cERldmljZTo6fk10cERldmljZSgpIHsKKyAgICBjbG9zZSgpOworICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbURldmljZVByb3BlcnRpZXMuc2l6ZSgpOyBpKyspCisgICAgICAgIGRlbGV0ZSBtRGV2aWNlUHJvcGVydGllc1tpXTsKK30KKwordm9pZCBNdHBEZXZpY2U6OmluaXRpYWxpemUoKSB7CisgICAgb3BlblNlc3Npb24oKTsKKyAgICBtRGV2aWNlSW5mbyA9IGdldERldmljZUluZm8oKTsKKyAgICBpZiAobURldmljZUluZm8pIHsKKyAgICAgICAgbURldmljZUluZm8tPnByaW50KCk7CisKKyAgICAgICAgaWYgKG1EZXZpY2VJbmZvLT5tRGV2aWNlUHJvcGVydGllcykgeworICAgICAgICAgICAgaW50IGNvdW50ID0gbURldmljZUluZm8tPm1EZXZpY2VQcm9wZXJ0aWVzLT5zaXplKCk7CisgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IGNvdW50OyBpKyspIHsKKyAgICAgICAgICAgICAgICBNdHBEZXZpY2VQcm9wZXJ0eSBwcm9wQ29kZSA9ICgqbURldmljZUluZm8tPm1EZXZpY2VQcm9wZXJ0aWVzKVtpXTsKKyAgICAgICAgICAgICAgICBNdHBQcm9wZXJ0eSogcHJvcGVydHkgPSBnZXREZXZpY2VQcm9wRGVzYyhwcm9wQ29kZSk7CisgICAgICAgICAgICAgICAgaWYgKHByb3BlcnR5KSB7CisgICAgICAgICAgICAgICAgICAgIHByb3BlcnR5LT5wcmludCgpOworICAgICAgICAgICAgICAgICAgICBtRGV2aWNlUHJvcGVydGllcy5wdXNoKHByb3BlcnR5KTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9Cit9CisKK3ZvaWQgTXRwRGV2aWNlOjpjbG9zZSgpIHsKKyAgICBpZiAobURldmljZS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KyAgICByZXR1cm4gdHJ1ZTsKK30KKworYm9vbCBNdHBEZXZpY2U6OmNsb3NlU2Vzc2lvbigpIHsKKyAgICAvLyBGSVhNRQorICAgIHJldHVybiB0cnVlOworfQorCitNdHBEZXZpY2VJbmZvKiBNdHBEZXZpY2U6OmdldERldmljZUluZm8oKSB7CisgICAgTXV0ZXg6OkF1dG9sb2NrIGF1dG9Mb2NrKG1NdXRleCk7CisKKyAgICBtUmVxdWVzdC5yZXNldCgpOworICAgIGlmICghc2VuZFJlcXVlc3QoTVRQX09QRVJBVElPTl9HRVRfREVWSUNFX0lORk8pKQorICAgICAgICByZXR1cm4gTlVMTDsKKyAgICBpZiAoIXJlYWREYXRhKCkpCisgICAgICAgIHJldHVybiBOVUxMOworICAgIE10cFJlc3BvbnNlQ29kZSByZXQgPSByZWFkUmVzcG9uc2UoKTsKKyAgICBpZiAocmV0ID09IE1UUF9SRVNQT05TRV9PSykgeworICAgICAgICBNdHBEZXZpY2VJbmZvKiBpbmZvID0gbmV3IE10cERldmljZUluZm87CisgICAgICAgIGluZm8tPnJlYWQobURhdGEpOworICAgICAgICByZXR1cm4gaW5mbzsKKyAgICB9CisgICAgcmV0dXJuIE5VTEw7Cit9CisKK010cFN0b3JhZ2VJRExpc3QqIE10cERldmljZTo6Z2V0U3RvcmFnZUlEcygpIHsKKyAgICBNdXRleDo6QXV0b2xvY2sgYXV0b0xvY2sobU11dGV4KTsKKworICAgIG1SZXF1ZXN0LnJlc2V0KCk7CisgICAgaWYgKCFzZW5kUmVxdWVzdChNVFBfT1BFUkFUSU9OX0dFVF9TVE9SQUdFX0lEUykpCisgICAgICAgIHJldHVybiBOVUxMOworICAgIGlmICghcmVhZERhdGEoKSkKKyAgICAgICAgcmV0dXJuIE5VTEw7CisgICAgTXRwUmVzcG9uc2VDb2RlIHJldCA9IHJlYWRSZXNwb25zZSgpOworICAgIGlmIChyZXQgPT0gTVRQX1JFU1BPTlNFX09LKSB7CisgICAgICAgIHJldHVybiBtRGF0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yLCBmb3JtYXQpOworICAgIG1SZXF1ZXN0LnNldFBhcmFtZXRlcigzLCBwYXJlbnQpOworICAgIGlmICghc2VuZFJlcXVlc3QoTVRQX09QRVJBVElPTl9HRVRfT0JKRUNUX0hBTkRMRVMpKQorICAgICAgICByZXR1cm4gTlVMTDsKKyAgICBpZiAoIXJlYWREYXRhKCkpCisgICAgICAgIHJldHVybiBOVUxMOworICAgIE10cFJlc3BvbnNlQ29kZSByZXQgPSByZWFkUmVzcG9uc2UoKTsKKyAgICBpZiAocmV0ID09IE1UUF9SRVNQT05TRV9PSykgeworICAgICAgICByZXR1cm4gbURhdGEuZ2V0QVVJbnQzMigpOworICAgIH0KKyAgICByZXR1cm4gTlVMTDsKK30KKworTXRwT2JqZWN0SW5mbyogTXRwRGV2aWNlOjpnZXRPYmplY3RJbmZvKE10cE9iamVjdEhhbmRsZSBoYW5kbGUpIHsKKyAgICBNdXRleDo6QXV0b2xvY2sgYXV0b0xvY2sobU11dGV4KTsKKworICAgIC8vIEZJWE1FIC0gd2UgbWlnaHQgd2FudCB0byBhZGQgc29tZSBjYWNoaW5nIGhlcmUKKworICAgIG1SZXF1ZXN0LnJlc2V0KCk7CisgICAgbVJlcXVlc3Quc2V0UGFyYW1ldGVyKDEsIGhhbmRsZSk7CisgICAgaWYgKCFzZW5kUmVxdWVzdChNVFBfT1BFUkFUSU9OX0dFVF9PQkpFQ1RfSU5GTykpCisgICAgICAgIHJldHVybiBOVUxMOworICAgIGlmICghcmVhZERhdGEoKSkKKyAgICAgICAgcmV0dXJuIE5VTEw7CisgICAgTXRwUmVzcG9uc2VDb2RlIHJldCA9IHJlYWRSZXNwb25zZSgpOworICAgIGlmIChyZXQgPT0gTVRQX1JFU1BPTlNFX09LKSB7CisgICAgICAgIE10cE9iamVjdEluZm8qIGluZm8gPSBuZXcgTXRwT2JqZWN0SW5mbyhoYW5kbGUpOworICAgICAgICBpbmZvLT5yZWFkKG1EYXRhKTsKKyAgICAgICAgcmV0dXJuIGluZm87CisgICAgfQorICAgIHJldHVybiBOVUxMOworfQorCit2b2lkKiBNdHBEZXZpY2U6OmdldFRodW1ibmFpbChNdHBPYmplY3RIYW5kbGUgaGFuZGxlLCBpbnQmIG91dExlbmd0aCkgeworICAgIE11dGV4OjpBdXRvbG9jayBhdXRvTG9jayhtTXV0ZXgpOworCisgICAgbVJlcXVlc3QucmVzZXQoKTsKKyAgICBtUmVxdWVzdC5zZXRQYXJhbWV0ZXIoMSwgaGFuZGxlKTsKKyAgICBpZiAoc2VuZFJlcXVlc3QoTVRQX09QRVJBVElPTl9HRVRfVEhVTUIpICYmIHJlYWREYXRhKCkpIHsKKyAgICAgICAgTXRwUmVzcG9uc2VDb2RlIHJldCA9IHJlYWRSZXNwb25zZSgpOworICAgICAgICBpZiAocmV0ID09IE1UUF9SRVNQT05TRV9PSykgeworICAgICAgICAgICAgcmV0dXJuIG1EYXRhLmdldERhdGEob3V0TGVuZ3RoKTsKKyAgICAgICAgfQorICAgIH0KKyAgICBvdXRMZW5ndGggPSAwOworICAgIHJldHVybiBOVUxMOworfQorCitNdHBPYmplY3RIYW5kbGUgTXRwRGV2aWNlOjpzZW5kT2JqZWN0SW5mbyhNdHBPYmplY3RJbmZvKiBpbmZvKSB7CisgICAgTXV0ZXg6OkF1dG9sb2NrIGF1dG9Mb2NrKG1NdXRleCk7CisKKyAgICBtUmVxdWVzdC5yZXNldCgpOworICAgIE10cE9iamVjdEhhbmRsZSBwYXJlbnQgPSBpbmZvLT5tUGFyZW50OworICAgIGlmIChwYXJlbnQgPT0gMCkKKyAgICAgICAgcGFyZW50ID0gTVRQX1BBUkVOVF9ST09UOworCisgICAgbVJlcXVlc3Quc2V0UGFyYW1ldGVyKDEsIGluZm8tPm1TdG9yYWdlSUQpOworICAgIG1SZXF1ZXN0LnNldFBhcmFtZXRlcigyLCBpbmZvLT5tUGFyZW50KTsKKworICAgIG1EYXRhLnB1dFVJbnQzMihpbmZvLT5tU3RvcmFnZUlEKTsKKyAgICBtRGF0Y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HV0U3RyaW5nKGNyZWF0ZWQpOworICAgIG1EYXRhLnB1dFN0cmluZyhtb2RpZmllZCk7CisgICAgaWYgKGluZm8tPm1LZXl3b3JkcykKKyAgICAgICAgbURhdGEucHV0U3RyaW5nKGluZm8tPm1LZXl3b3Jkcyk7CisgICAgZWxzZQorICAgICAgICBtRGF0YS5wdXRFbXB0eVN0cmluZygpOworCisgICBpZiAoc2VuZFJlcXVlc3QoTVRQX09QRVJBVElPTl9TRU5EX09CSkVDVF9JTkZPKSAmJiBzZW5kRGF0YSgpKSB7CisgICAgICAgIE10cFJlc3BvbnNlQ29kZSByZXQgPSByZWFkUmVzcG9uc2UoKTsKKyAgICAgICAgaWYgKHJldCA9PSBNVFBfUkVTUE9OU0VfT0spIHsKKyAgICAgICAgICAgIGluZm8tPm1TdG9yYWdlSUQgPSBtUmVzcG9uc2UuZ2V0UGFyYW1ldGVyKDEpOworICAgICAgICAgICAgaW5mby0+bVBhcmVudCA9IG1SZXNwb25zZS5nZXRQYXJhbWV0ZXIoMik7CisgICAgICAgICAgICBpbmZvLT5tSGFuZGxlID0gbVJlc3BvbnNlLmdldFBhcmFtZXRlcigzKTsKKyAgICAgICAgICAgIHJldHVybiBpbmZvLT5tSGFuZGxlOworICAgICAgICB9CisgICAgfQorICAgIHJldHVybiAoTXRwT2JqZWN0SGFuZGxlKS0xOworfQorCitib29sIE10cERldmljZTo6c2VuZE9iamVjdChNdHBPYmplY3RJbmZvKiBpbmZvLCBpbnQgc3JjRkQpIHsKKyAgICBNdXRleDo6QXV0b2xvY2sgYXV0b0xvY2sobU11dGV4KTsKKworICAgIGludCByZW1haW5pbmcgPSBpbmZvLT5tQ29tcHJlc3NlZFNpemU7CisgICAgbVJlcXVlc3QucmVzZXQoKTsKKyAgICBtUmVxdWVzdC5zZXRQYXJhbWV0ZXIoMSwgaW5mby0+bUhhbmRsZSk7CisgICAgaWYgKHNlbmRSZXF1ZXN0KE1UUF9PUEVSQVRJT05fU0VORF9PQkpFQ1QpKSB7CisgICAgICAgIC8vIHNlbmQgZGF0YSBoZWFkZXIKKyAgICAgICAgd3JpdGVEYXRhSGVhZGVyKE1UUF9PUEVSQVRJT05fU0VORF9PQkpFQ1QsIHJlbWFpbmluZyk7CisKKyAgICAgICAgY2hhciBidWZmZXJbNjU1MzZdOworICAgICAgICB3aGlsZSAocmVtYWluaW5nID4gMCkgeworICAgICAgICAgICAgaW50IGNvdW50ID0gcmVhZChzcmNGRCwgYnVmZmVyLCBzaXplb2YoYnVmZmVyKSk7CisgICAgICAgICAgICBpZiAoY291bnQgPiAwKSB7CisgICAgICAgICAgICAgICAgaW50IHdyaXR0ZW4gPSBtRGF0YS53cml0ZShtRW5kcG9pbnRPdXQsIGJ1ZmZlciwgY291bnQpOworICAgICAgICAgICAgICAgIC8vIEZJWE1FIGNoZWNrIGVycm9yCisgICAgICAgICAgICAgICAgcmVtYWluaW5nIC09IGNvdW50OworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKyAgICBNdHBSZXNwb25zZUNvZGUgcmV0ID0gcmVhZFJlc3BvbnNlKCk7CisgICAgcmV0dXJuIChyZW1haW5pbmcgPT0gMCAmJiByZXQgPT0gTVRQX1JFU1BPTlNFX09LKTsKK30KKworYm9vbCBNdHBEZXZpY2U6OmRlbGV0ZU9iamVjdChNdHBPYmplY3RIYW5kbGUgaGFuZGxlKSB7CisgICAgTXV0ZXg6OkF1dG9sb2NrIGF1dG9Mb2NrKG1NdXRleCk7CisKKyAgICBtUmVxdWVzdC5yZXNldCgpOworICAgIG1SZXF1ZXN0LnNldFBhcmFtZXRlcigxLCBoYW5kbGUpOworICAgIGlmIChzZW5kUmVxdWVzdChNVFBfT1BFUkFUSU9OX0RFTEVURV9PQkpFQ1QpKSB7CisgICAgICAgIE10cFJlc3BvbnNlQ29kZSByZXQgPSByZWFkUmVzcG9uc2UoKTsKKyAgICAgICAgaWYgKH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RV9PSykgeworICAgICAgICBNdHBQcm9wZXJ0eSogcHJvcGVydHkgPSBuZXcgTXRwUHJvcGVydHk7CisgICAgICAgIHByb3BlcnR5LT5yZWFkKG1EYXRhKTsKKyAgICAgICAgcmV0dXJuIHByb3BlcnR5OworICAgIH0KKyAgICByZXR1cm4gTlVMTDsKK30KKworY2xhc3MgUmVhZE9iamVjdFRocmVhZCA6IHB1YmxpYyBUaHJlYWQgeworcHJpdmF0ZToKKyAgICBNdHBEZXZpY2UqICAgICAgICAgIG1EZXZpY2U7CisgICAgTXRwT2JqZWN0SGFuZGxlICAgICBtSGFuZGxlOworICAgIGludCAgICAgICAgICAgICAgICAgbU9iamVjdFNpemU7CisgICAgdm9pZCogICAgICAgICAgICAgICBtSW5pdGlhbERhdGE7CisgICAgaW50ICAgICAgICAgICAgICAgICBtSW5pdGlhbERhdGFMZW5ndGg7CisgICAgaW50ICAgICAgICAgICAgICAgICBtRkQ7CisKK3B1YmxpYzoKKyAgICBSZWFkT2JqZWN0VGhyZWFkKE10cERldmljZSogZGV2aWNlLCBNdHBPYmplY3RIYW5kbGUgaGFuZGxlLCBpbnQgb2JqZWN0U2l6ZSkKKyAgICAgICAgOiBtRGV2aWNlKGRldmljZSksCisgICAgICAgICAgbUhhbmRsZShoYW5kbGUpLAorICAgICAgICAgIG1PYmplY3RTaXplKG9iamVjdFNpemUpLAorICAgICAgICAgIG1Jbml0aWFsRGF0YShOVUxMKSwKKyAgICAgICAgICBtSW5pdGlhbERhdGFMZW5ndGgoMCkKKyAgICB7CisgICAgfQorCisgICAgdmlydHVhbCB+UmVhZE9iamVjdFRocmVhZCgpIHsKKyAgICAgICAgaWYgKG1GRCA+PSAwKQorICAgICAgICAgICAgY2xvc2UobUZEKTsKKyAgICAgICAgZnJlZShtSW5pdGlhbERhdGEpOworICAgIH0KKworICAgIC8vIHJldHVybnMgZmlsZSBkZXNjcmlwdG9yCisgICAgaW50IGluaXQoKSB7CisgICAgICAgIG1EZXZpY2UtPm1SZXF1ZXN0LnJlc2V0KCk7CisgICAgICAgIG1EZXZpY2UtPm1SZXF1ZXN0LnNldFBhcmFtZXRlcigxLCBtSGFuZGxlKTsKKyAgICAgICAgaWYgKG1EZXZpY2UtPnNlbmRSZXF1ZXN0KE1UUF9PUEVSQVRJT05fR0VUX09CSkVDVCkKKyAgICAgICAgICAgICAgICAmJiBtRGV2aWNlLT5tRGF0YS5yZWFkRGF0YUhlYWRlcihtRGV2aWNlLT5tRW5kcG9pbnRJbikpIHsKKworICAgICAgICAgICAgLy8gbURhdGEgd2lsbCBjb250YWluIGhlYWRlciBhbmQgcG9zc2libHkgdGhlIGJlZ2lubmluZyBvZiB0aGUgb2JqZWN0IGRhdGEKKyAgICAgICAgICAgIG1Jbml0aWFsRGF0YSA9IG1EZXZpY2UtPm1EYXRhLmdldERhdGEobUluaXRpYWxEYXRhTGVuZ3RoKTsKKworICAgICAgICAgICAgLy8gY3JlYXRlIGEgcGlwZSBmb3IgdGhlIGNsaWVudCB0byByZWFkIGZyb20KKyAgICAgICAgICAgIGludCBwaXBlZmRbMl07CisgICAgICAgICAgICBpZiAocGlwZShwaXBlZmQpIDwgMCkgeworICAgICAgICAgICAgICAgIExPR0UoInBpcGUgZmFpbGVkICglcykiLCBzdHJlcnJvcihlcnJubykpOworICAgICAgICAgICAgICAgIHJldHVybiAtMTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgbUZEID0gcGlwZWZkWzFdOworICAgICAgICAgICAgcmV0dXJuIHBpcGVmZFswXTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgcmV0dXJuIC0xOworICAgICAgICB9CisgICAgfQorCisgICAgdmlydHVhbCBib29sIHRocmVhZExvb3AoKSB7CisgICAgICAgIGludCByZW1haW5pbmcgPSBtT2JqZWN0U2l6ZTsKKyAgICAgICAgaWYgKG1Jbml0aWFsRGF0YSkgeworICAgICAgICAgICAgd3JpdGUobUZELCBtSW5pdGlhbERhdGEsIG1Jbml0aWFsRGF0YUxlbmd0aCk7CisgICAgICAgICAgICByZW1haW5pbmcgLT0gbUluaXRpYWxEYXRhTGVuZ3RoOworICAgICAgICAgICAgZnJlZShtSW5pdGlhbERhdGEpOworICAgICAgICAgICAgbUluaXRpYWxEYXRhID0gTlVMTDsKKyAgICAgICAgfQorCisgICAgICAgIGNoYXIgYnVmZmVyWzE2Mzg0XTsKKyAgICAgICAgd2hpbGUgKHJlbWFpbmluZyA+IDApIHsKKyAgICAgICAgICAgIGludCByZWFkU2l6ZSA9IChyZW1haW5pbmcgPiBzaXplb2YoYnVmZmVyKSA/IHNpemVvZihidWZmZXIpIDogcmVtYWluaW5nKTsKKyAgICAgICAgICAgIGludCBjb3VudCA9IG1EZXZpY2UtPm1EYXRhLnJlYWREYXRhKG1EZXZpY2UtPm1FbmRwb2ludEluLCBidWZmZXIsIHJlYWRTaXplKTsKKyAgICAgICAgICAgIGludCB3cml0dGVuOworICAgICAgICAgICAgaWYgKGNvdW50ID49IDApIHsKKyAgICAgICAgICAgICAgICBpbnQgd3JpdHRlbiA9IHdyaXRlKG1GRCwgYnVmZmVyLCBjb3VudCk7CisgICAgICAgICAgICAgICAgLy8gRklYTUUgY2hlY2sgZXJyb3IKKyAgICAgICAgICAgICAgICByZW1haW5pbmcgLT0gY291bnQ7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgTXRwUmVzcG9uc2VDb2RlIHJldCA9IG1EZXZpY2UtPnJlYWRSZXNwb25zZSgpOworICAgICAgICBtRGV2aWNlLT5tTXV0ZXgudW5sb2NrKCk7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9Cit9OworCisgICAgLy8gcmV0dXJucyB0aGUgZmlsZSBkZXNjcmlwdG9yIGZvciBhIHBpcGUgdG8gcmVhZCB0aGUgb2JqZWN0J3MgZGF0YQoraW50IE10cERldmljZTo6cmVhZE9iamVjdChNdHBPYmplY3RIYW5kb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b25JRCgpKTsKKyAgICBpbnQgcmV0ID0gbURhdGEud3JpdGUobUVuZHBvaW50T3V0KTsKKyAgICBtRGF0YS5kdW1wKCk7CisgICAgcmV0dXJuIChyZXQgPiAwKTsKK30KKworYm9vbCBNdHBEZXZpY2U6OnJlYWREYXRhKCkgeworICAgIG1EYXRhLnJlc2V0KCk7CisgICAgaW50IHJldCA9IG1EYXRhLnJlYWQobUVuZHBvaW50SW4pOworICAgIExPR1YoInJlYWREYXRhIHJldHVybmVkICVkXG4iLCByZXQpOworICAgIGlmIChyZXQgPj0gTVRQX0NPTlRBSU5FUl9IRUFERVJfU0laRSkgeworICAgICAgICBtRGF0YS5kdW1wKCk7CisgICAgICAgIHJldHVybiB0cnVlOworICAgIH0KKyAgICBlbHNlIHsKKyAgICAgICAgTE9HVigicmVhZFJlc3BvbnNlIGZhaWxlZFxuIik7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9Cit9CisKK2Jvb2wgTXRwRGV2aWNlOjp3cml0ZURhdGFIZWFkZXIoTXRwT3BlcmF0aW9uQ29kZSBvcGVyYXRpb24sIGludCBkYXRhTGVuZ3RoKSB7CisgICAgbURhdGEuc2V0T3BlcmF0aW9uQ29kZShvcGVyYXRpb24pOworICAgIG1EYXRhLnNldFRyYW5zYWN0aW9uSUQobVJlcXVlc3QuZ2V0VHJhbnNhY3Rpb25JRCgpKTsKKyAgICByZXR1cm4gKCFtRGF0YS53cml0ZURhdGFIZWFkZXIobUVuZHBvaW50T3V0LCBkYXRhTGVuZ3RoKSk7Cit9CisKK010cFJlc3BvbnNlQ29kZSBNdHBEZXZpY2U6OnJlYWRSZXNwb25zZSgpIHsKKyAgICBMT0dWKCJyZWFkUmVzcG9uc2VcbiIpOworICAgIGludCByZXQgPSBtUmVzcG9uc2UucmVhZChtRW5kcG9pbnRJbik7CisgICAgaWYgKHJldCA+PSBNVFBfQ09OVEFJTkVSX0hFQURFUl9TSVpFKSB7CisgICAgICAgIG1SZXNwb25zZS5kdW1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CBlaXRoZXIgZXhwcmVzcyBvciBpbXBsaWVkLgorICogU2VlIHRoZSBMaWNlbnNlIGZvciB0aGUgc3BlY2lmaWMgbGFuZ3VhZ2UgZ292ZXJuaW5nIHBlcm1pc3Npb25zIGFuZAorICogbGltaXRhdGlvbnMgdW5kZXIgdGhlIExpY2Vuc2UuCisgKi8KKworI2lmbmRlZiBfTVRQX0RFVklDRV9ICisjZGVmaW5lIF9NVFBfREVWSUNFX0gKKworI2luY2x1ZGUgIk10cFJlcXVlc3RQYWNrZXQuaCIKKyNpbmNsdWRlICJNdHBEYXRhUGFja2V0LmgiCisjaW5jbHVkZSAiTXRwUmVzcG9uc2VQYWNrZXQuaCIKKyNpbmNsdWRlICJNdHBUeXBlcy5oIgorCisjaW5jbHVkZSA8dXRpbHMvdGhyZWFkcy5oPgorCitzdHJ1Y3QgdXNiX2RldmljZTsKKworbmFtZXNwYWNlIGFuZHJvaWQgeworCitjbGFzcyBNdHBEZXZpY2VJbmZvOworY2xhc3MgTXRwT2JqZWN0SW5mbzsKK2NsYXNzIE10cFN0b3JhZ2VJbmZvOworCitjbGFzcyBNdHBEZXZpY2UgeworcHJpdmF0ZToKKyAgICBzdHJ1Y3QgdXNiX2RldmljZSogICAgICBtRGV2aWNlOworICAgIGludCAgICAgICAgICAgICAgICAgICAgIG1JbnRlcmZhY2U7CisgICAgc3RydWN0IHVzYl9lbmRwb2ludCogICAgbUVuZHBvaW50SW47CisgICAgc3RydWN0IHVzYl9lbmRwb2ludCogICAgbUVuZHBvaW50T3V0OworICAgIHN0cnVjdCB1c2JfZW5kcG9pbnQqICAgIG1FbmRwb2ludEludHI7CisgICAgTXRwRGV2aWNlSW5mbyogICAgICAgICAgbURldmljZUluZm87CisgICAgTXRwUHJvcGVydHlMaXN0ICAgICAgICAgbURldmljZVByb3BlcnRpZXM7CisKKyAgICAvLyBhIHVuaXF1ZSBJRCBmb3IgdGhlIGRldmljZQorICAgIGludCAgICAgICAgICAgICAgICAgICAgIG1JRDsKKworICAgIC8vIGN1cnJlbnQgc2Vzc2lvbiBJRAorICAgIE10cFNlc3Npb25JRCAgICAgICAgICAgIG1TZXNzaW9uSUQ7CisgICAgLy8gY3VycmVudCB0cmFuc2FjdGlvbiBJRAorICAgIE10cFRyYW5zYWN0aW9uSUQgICAgICAgIG1UcmFuc2FjdGlvbklEOworCisgICAgTXRwUmVxdWVzdFBhY2tldCAgICAgICAgbVJlcXVlc3Q7CisgICAgTXRwRGF0YVBhY2tldCAgICAgICAgICAgbURhdGE7CisgICAgTXRwUmVzcG9uc2VQYWNrZXQgICAgICAgbVJlc3BvbnNlOworCisgICAgLy8gdG8gZW5zdXJlIG9ubHkgb25lIE1UUCB0cmFuc2FjdGlvbiBhdCBhIHRpbWUKKyAgICBNdXRleCAgICAgICAgICAgICAgICAgICBtTXV0ZXg7CisKK3B1YmxpYzoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBEZXZpY2Uoc3RydWN0IHVzYl9kZXZpY2UqIGRldmljZSwgaW50IGludGVyZmFjZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0cnVjdCB1c2JfZW5kcG9pbnQgKmVwX2luLCBzdHJ1Y3QgdXNiX2VuZHBvaW50ICplcF9vdXQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJ1Y3QgdXNiX2VuZHBvaW50ICplcF9pbnRyKTsKKyAgICB2aXJ0dWFsICAgICAgICAgICAgICAgICB+TXRwRGV2aWNlKCk7CisKKyAgICBpbmxpbmUgaW50ICAgICAgICAgICAgICBnZXRJRCgpIGNvbnN0IHsgcmV0dXJuIG1JRDsgfQorCisgICAgdm9pZCAgICAgICAgICAgICAgICAgICAgaW5pdGlhbGl6ZSgpOworICAgIHZvaWQgICAgICAgICAgICAgICAgICAgIGNsb3NlKCk7CisgICAgY29uc3QgY2hhciogICAgICAgICAgICAgZ2V0RGV2aWNlTmFtZSgpOworCisgICAgYm9vbCAgICAgICAgICAgICAgICAgICAgb3BlblNlc3Npb24oKTsKKyAgICBib29sICAgICAgICAgICAgICAgICAgICBjbG9zZVNlc3Npb24oKTsKKworICAgIE10cERldmljZUluZm8qICAgICAgICAgIGdldERldmljZUluZm8oKTsKKyAgICBNdHBTdG9yYWdlSURMaXN0KiAgICAgICBnZXRTdG9yYWdlSURzKCk7CisgICAgTXRwU3RvcmFnZUluZm8qICAgICAgICAgZ2V0U3RvcmFnZUluZm8oTXRwU3RvcmFnZUlEIHN0b3JhZ2VJRCk7CisgICAgTXRwT2JqZWN0SGFuZGxlTGlzdCogICAgZ2V0T2JqZWN0SGFuZGxlcyhNdHBTdG9yYWdlSUQgc3RvcmFnZUlELCBNdHBPYmplY3RGb3JtYXQgZm9ybWF0LCBNdHBPYmplY3RIYW5kbGUgcGFyZW50KTsKKyAgICBNdHBPYmplY3RJbmZvKiAgICAgICAgICBnZXRPYmplY3RJbmZvKE10cE9iamVjdEhhbmRsZSBoYW5kbGUpOworICAgIHZvaWQqICAgICAgICAgICAgICAgICAgIGdldFRodW1ibmFpbChNdHBPYmplY3RIYW5kbGUgaGFuZGxlLCBpbnQmIG91dExlbmd0aCk7CisgICAgTXRwT2JqZWN0SGFuZGxlICAgICAgICAgc2VuZE9iamVjdEluZm8oTXRwT2JqZWN0SW5mbyogaW5mbyk7CisgICAgYm9vbCAgICAgICAgICAgICAgICAgICAgc2VuZE9iamVjdChNdHBPYmplY3RJbmZvKiBpbmZvLCBpbnQgc3JjRkQpOworICAgIGJvb2wgICAgICAgICAgICAgICAgICAgIGRlbGV0ZU9iamVjdChNdHBPYmplY3RIYW5kbGUgaGFuZGxlKTsKKyAgICBNdHBPYmplY3RIYW5kbGUgICAgICAgICBnZXRQYXJlbnQoTXRwT2JqZWN0SGFuZGxlIGhhbmRsZSk7CisgICAgTXRwT2JqZWN0SGFuZGxlICAgICAgICAgZ2V0U3RvcmFnZUlEKE10cE9iamVjdEhhbmRsZSBoYW5kbGUpOworCisgICAgTXRwUHJvcGVydHkqICAgICAgICAgICAgZ2V0RGV2aWNlUHJvcERlc2MoTXRwRGV2aWNlUHJvcGVydHkgY29kZSk7CisKKyAgICAvLyByZXR1cm5zIHRoZSBmaWxlIGRlc2NyaXB0b3IgZm9yIGEgcGlwZSB0byByZWFkIHRoZSBvYmplY3QncyBkYXRhCisgICAgaW50ICAgICAgICAgICAgICAgICAgICAgcmVhZE9iamVjdChNdHBPYmplY3RIYW5kbGUgaGFuZGxlLCBpbnQgb2JqZWN0U2l6ZSk7CisKK3ByaXZhdGU6CisgICAgZnJpZW5kIGNsYXNzIFJlYWRPYmplY3RUaHJlYWQ7CisKKyAgICBib29sICAgICAgICAgICAgICAgICAgICBzZW5kUmVxdWVzdChNdHBPcGVyYXRpb25Db2RlIG9wZXJhdGlvbik7CisgICAgYm9vbCAgICAgICAgICAgICAgICAgICAgc2VuZERhdGEoKTsKKyAgICBib29sICAgICAgICAgICAgICAgICAgICByZWFkRGF0YSgpOworICAgIGJvb2wgICAgICAgICAgICAgICAgICAgIHdyaXRlRGF0YUhlYWRlcihNdHBPcGVyYXRpb25Db2RlIG9wZXJhdGlvbiwgaW50IGRhdGFMZW5ndGgpOworICAgIE10cFJlc3BvbnNlQ29kZSAgICAgICAgIHJlYWRSZXNwb25zZSgpOworCit9OworCit9OyAvLyBuYW1lc3BhY2UgYW5kcm9pZAorCisjZW5kaWYgLy8gX01UUF9ERVZJQ0VfSApkaWZmIC0tZ2l0IGEvbWVkaWEvbXRwL010cERldmljZUluZm8uY3BwIGIvbWVkaWEvbXRwL010cERldmljZUluZm8uY3BwCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLjVhOTMyMmUKLS0tIC9kZXYvbnVsbAorKysgYi9tZWRpYS9tdHAvTXRwRGV2aWNlSW5mby5jcHAKQEAgLTAsMCArMSw5NyBAQAorLyoKKyAqIENvcHlyaWdodCAoQykgMjAxMCBUaGUgQW5kcm9pZCBPcGVuIFNvdXJjZSBQcm9qZWN0CisgKgor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oYXIqICAgICAgICAgICAgICAgICAgIG1WZW5kb3JFeHRlbnNpb25EZXNjOworICAgIHVpbnQxNl90ICAgICAgICAgICAgICAgIG1GdW5jdGlvbmFsQ29kZTsKKyAgICBVSW50MTZMaXN0KiAgICAgICAgICAgICBtT3BlcmF0aW9uczsKKyAgICBVSW50MTZMaXN0KiAgICAgICAgICAgICBtRXZlbnRzOworICAgIE10cERldmljZVByb3BlcnR5TGlzdCogIG1EZXZpY2VQcm9wZXJ0aWVzOworICAgIE10cE9iamVjdEZvcm1hdExpc3QqICAgIG1DYXB0dXJlRm9ybWF0czsKKyAgICBNdHBPYmplY3RGb3JtYXRMaXN0KiAgICBtUGxheWJhY2tGb3JtYXRzOworICAgIGNoYXIqICAgICAgICAgICAgICAgICAgIG1NYW51ZmFjdHVyZXI7CisgICAgY2hhciogICAgICAgICAgICAgICAgICAgbU1vZGVsOworICAgIGNoYXIqICAgICAgICAgICAgICAgICAgIG1WZXJzaW9uOworICAgIGNoYXIqICAgICAgICAgICAgICAgICAgIG1TZXJpYWw7CisKK3B1YmxpYzoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBEZXZpY2VJbmZvKCk7CisgICAgdmlydHVhbCAgICAgICAgICAgICAgICAgfk10cERldmljZUluZm8oKTsKKworICAgIHZvaWQgICAgICAgICAgICAgICAgICAgIHJlYWQoTXRwRGF0YVBhY2tldCYgcGFja2V0KTsKKworICAgIHZvaWQgICAgICAgICAgICAgICAgICAgIHByaW50KCk7Cit9OworCit9OyAvLyBuYW1lc3BhY2UgYW5kcm9pZAorCisjZW5kaWYgLy8gX01UUF9ERVZJQ0VfSU5GT19ICmRpZmYgLS1naXQgYS9tZWRpYS9tdHAvTXRwRXZlbnRQYWNrZXQuY3BwIGIvbWVkaWEvbXRwL010cEV2ZW50UGFja2V0LmNwcApuZXcgZmlsZSBtb2RlIDEwMDY0NAppbmRleCAwMDAwMDAwLi5mYzc0NTQyCi0tLSAvZGV2L251bGwKKysrIGIvbWVka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gbGFuZ3VhZ2UgZ292ZXJuaW5nIHBlcm1pc3Npb25zIGFuZAorICogbGltaXRhdGlvbnMgdW5kZXIgdGhlIExpY2Vuc2UuCisgKi8KKworI2lmbmRlZiBfTVRQX0VWRU5UX1BBQ0tFVF9ICisjZGVmaW5lIF9NVFBfRVZFTlRfUEFDS0VUX0gKKworI2luY2x1ZGUgIk10cFBhY2tldC5oIgorI2luY2x1ZGUgIm10cC5oIgorCituYW1lc3BhY2UgYW5kcm9pZCB7CisKK2NsYXNzIE10cEV2ZW50UGFja2V0IDogcHVibGljIE10cFBhY2tldCB7CisKK3B1YmxpYzoKKyAgICAgICAgICAgICAgICAgICAgICAgIE10cEV2ZW50UGFja2V0KCk7CisgICAgdmlydHVhbCAgICAgICAgICAgICB+TXRwRXZlbnRQYWNrZXQoKTsKKworI2lmZGVmIE1UUF9ERVZJQ0UKKyAgICAvLyB3cml0ZSBvdXIgZGF0YSB0byB0aGUgZ2l2ZW4gZmlsZSBkZXNjcmlwdG9yCisgICAgaW50ICAgICAgICAgICAgICAgICB3cml0ZShpbnQgZmQpOworI2VuZGlmCisKKyNpZmRlZiBNVFBfSE9TVAorICAgIC8vIHJlYWQgb3VyIGJ1ZmZlciBmcm9tIHRoZSBnaXZlbiBlbmRwb2ludAorICAgIGludCAgICAgICAgICAgICAgICAgcmVhZChzdHJ1Y3QgdXNiX2VuZHBvaW50ICplcCk7CisjZW5kaWYKKworICAgIGlubGluZSBNdHBFdmVudENvZGUgICAgIGdldEV2ZW50Q29kZSgpIGNvbnN0IHsgcmV0dXJuIGdldENvbnRhaW5lckNvZGUoKTsgfQorICAgIGlubGluZSB2b2lkICAgICAgICAgICAgIHNldEV2ZW50Q29kZShNdHBFdmVudENvZGUgY29kZSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeyByZXR1cm4gc2V0Q29udGFpbmVyQ29kZShjb2RlKTsgfQorfTsKKworfTsgLy8gbmFtZXNwYWNlI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GFuZAorICogbGltaXRhdGlvbnMgdW5kZXIgdGhlIExpY2Vuc2UuCisgKi8KKworI2RlZmluZSBMT0dfVEFHICJNdHBPYmplY3RJbmZvIgorCisjaW5jbHVkZSAiTXRwRGVidWcuaCIKKyNpbmNsdWRlICJNdHBEYXRhUGFja2V0LmgiCisjaW5jbHVkZSAiTXRwT2JqZWN0SW5mby5oIgorI2luY2x1ZGUgIk10cFN0cmluZ0J1ZmZlci5oIgorI2luY2x1ZGUgIk10cFV0aWxzLmgiCisKK25hbWVzcGFjZSBhbmRyb2lkIHsKKworTXRwT2JqZWN0SW5mbzo6TXRwT2JqZWN0SW5mbyhNdHBPYmplY3RIYW5kbGUgaGFuZGxlKQorICAgIDogICBtSGFuZGxlKGhhbmRsZSksCisgICAgICAgIG1TdG9yYWdlSUQoMCksCisgICAgICAgIG1Gb3JtYXQoMCksCisgICAgICAgIG1Qcm90ZWN0aW9uU3RhdHVzKDApLAorICAgICAgICBtQ29tcHJlc3NlZFNpemUoMCksCisgICAgICAgIG1UaHVtYkZvcm1hdCgwKSwKKyAgICAgICAgbVRodW1iQ29tcHJlc3NlZFNpemUoMCksCisgICAgICAgIG1UaHVtYlBpeFdpZHRoKDApLAorICAgICAgICBtVGh1bWJQaXhIZWlnaHQoMCksCisgICAgICAgIG1JbWFnZVBpeFdpZHRoKDApLAorICAgICAgICBtSW1hZ2VQaXhIZWlnaHQoMCksCisgICAgICAgIG1JbWFnZVBpeERlcHRoKDApLAorICAgICAgICBtUGFyZW50KDApLAorICAgICAgICBtQXNzb2NpYXRpb25UeXBlKDApLAorICAgICAgICBtQXNzb2NpYXRpb25EZXNjKDApLAorICAgICAgICBtU2VxdWVuY2VOdW1iZXIoMCksCisgICAgICAgIG1OYW1lKE5VTEwpLAorICAgICAgICBtRGF0ZUNyZWF0ZWQoMCksCisgICAgICAgIG1EYXRlTW9kaWZpZWQoMCksCisgICAgICAgIG1LZXl3b3JkcyhOVUxMKQoreworfQorCitNdHBPYmplY3RJbmZvOjp+TXRwT2JqZWN0SW5mbygpIHsKKyAgICBpZiAobU5hbWUpCisgICAgICAgIGZyZWUobU5hbWUpOworICAgIGlmIChtS2V5d29yZHMpCisgICAgICAgIGZyZWUobUtleXdvcmRzKTsKK30KKwordm9pZCBNdHBPYmplY3RJbmZvOjpyZWFkKE10cERhdGFQYWNrZXQmIHBhY2tldCkgeworICAgIE10cFN0cmluZ0J1ZmZlciBzdHJpbmc7CisgICAgdGltZV90IHRpbWU7CisKKyAgICBtU3RvcmFnZUlEID0gcGFja2V0LmdldFVJbnQzMigpOworICAgIG1Gb3JtYXQgPSBwYWNrZXQuZ2V0VUludDE2KCk7CisgICAgbVByb3RlY3Rpb25TdGF0dXMgPSBwYWNrZXQuZ2V0VUludDE2KCk7CisgICAgbUNvbXByZXNzZWRTaXplID0gcGFja2V0LmdldFVJbnQzMigpOworICAgIG1UaHVtYkZvcm1hdCA9IHBhY2tldC5nZXRVSW50MTYoKTsKKyAgICBtVGh1bWJDb21wcmVzc2VkU2l6ZSA9IHBhY2tldC5nZXRVSW50MzIoKTsKKyAgICBtVGh1bWJQaXhXaWR0aCA9IHBhY2tldC5nZXRVSW50MzIoKTsKKyAgICBtVGh1bWJQaXhIZWlnaHQgPSBwYWNrZXQuZ2V0VUludDMyKCk7CisgICAgbUltYWdlUGl4V2lkdGggPSBwYWNrZXQuZ2V0VUludDMyKCk7CisgICAgbUltYWdlUGl4SGVpZ2h0ID0gcGFja2V0LmdldFVJbnQzMigpOworICAgIG1JbWFnZVBpeERlcHRoID0gcGFja2V0LmdldFVJbnQzMigpOworICAgIG1QYXJlbnQgPSBwYWNrZXQuZ2V0VUludDMyKCk7CisgICAgbUFzc29jaWF0aW9uVHlwZSA9IHBhY2tldC5nZXRVSW50MTYoKTsKKyAgICBtQXNzb2NpYXRpb25EZXNjID0gcGFja2V0LmdldFVJbnQzMigpOworICAgIG1TZXF1ZW5jZU51bWJlciA9IHBhY2tldC5nZXRVSW50MzIoKTsKKworICAgIHBhY2tld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BNdHBPYmplY3RGb3JtYXQgICAgIG1UaHVtYkZvcm1hdDsKKyAgICB1aW50MzJfdCAgICAgICAgICAgIG1UaHVtYkNvbXByZXNzZWRTaXplOworICAgIHVpbnQzMl90ICAgICAgICAgICAgbVRodW1iUGl4V2lkdGg7CisgICAgdWludDMyX3QgICAgICAgICAgICBtVGh1bWJQaXhIZWlnaHQ7CisgICAgdWludDMyX3QgICAgICAgICAgICBtSW1hZ2VQaXhXaWR0aDsKKyAgICB1aW50MzJfdCAgICAgICAgICAgIG1JbWFnZVBpeEhlaWdodDsKKyAgICB1aW50MzJfdCAgICAgICAgICAgIG1JbWFnZVBpeERlcHRoOworICAgIE10cE9iamVjdEhhbmRsZSAgICAgbVBhcmVudDsKKyAgICB1aW50MTZfdCAgICAgICAgICAgIG1Bc3NvY2lhdGlvblR5cGU7CisgICAgdWludDMyX3QgICAgICAgICAgICBtQXNzb2NpYXRpb25EZXNjOworICAgIHVpbnQzMl90ICAgICAgICAgICAgbVNlcXVlbmNlTnVtYmVyOworICAgIGNoYXIqICAgICAgICAgICAgICAgbU5hbWU7CisgICAgdGltZV90ICAgICAgICAgICAgICBtRGF0ZUNyZWF0ZWQ7CisgICAgdGltZV90ICAgICAgICAgICAgICBtRGF0ZU1vZGlmaWVkOworICAgIGNoYXIqICAgICAgICAgICAgICAgbUtleXdvcmRzOworCitwdWJsaWM6CisgICAgICAgICAgICAgICAgICAgICAgICBNdHBPYmplY3RJbmZvKE10cE9iamVjdEhhbmRsZSBoYW5kbGUpOworICAgIHZpcnR1YWwgICAgICAgICAgICAgfk10cE9iamVjdEluZm8oKTsKKworICAgIHZvaWQgICAgICAgICAgICAgICAgcmVhZChNdHBEYXRhUGFja2V0JiBwYWNrZXQpOworCisgICAgdm9pZCAgICAgICAgICAgICAgICBwcmludCgpOworfTsKKworfTsgLy8gbmFtZXNwYWNlIGFuZHJvaWQKKworI2VuZGlmIC8vIF9NVFBfT0JKRUNUX0lORk9fSApkaWZmIC0tZ2l0IGE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b25JbmNyZW1lbnQ7CisgICAgICAgIG1CdWZmZXIgPSAodWludDhfdCAqKXJlYWxsb2MobUJ1ZmZlciwgbmV3TGVuZ3RoKTsKKyAgICAgICAgaWYgKCFtQnVmZmVyKSB7CisgICAgICAgICAgICBMT0dFKCJvdXQgb2YgbWVtb3J5ISIpOworICAgICAgICAgICAgYWJvcnQoKTsKKyAgICAgICAgfQorICAgICAgICBtQnVmZmVyU2l6ZSA9IG5ld0xlbmd0aDsKKyAgICB9Cit9CisKK3ZvaWQgTXRwUGFja2V0OjpkdW1wKCkgeworI2RlZmluZSBEVU1QX0JZVEVTX1BFUl9ST1cgIDE2CisgICAgY2hhciBidWZmZXJbNTAwXTsKKyAgICBjaGFyKiBidWZwdHIgPSBidWZmZXI7CisKKyAgICBmb3IgKGludCBpID0gMDsgaSA8IG1QYWNrZXRTaXplOyBpKyspIHsKKyAgICAgICAgc3ByaW50ZihidWZwdHIsICIlMDJYICIsIG1CdWZmZXJbaV0pOworICAgICAgICBidWZwdHIgKz0gc3RybGVuKGJ1ZnB0cik7CisgICAgICAgIGlmIChpICUgRFVNUF9CWVRFU19QRVJfUk9XID09IChEVU1QX0JZVEVTX1BFUl9ST1cgLSAxKSkgeworICAgICAgICAgICAgTE9HVigiJXMiLCBidWZmZXIpOworICAgICAgICAgICAgYnVmcHRyID0gYnVmZmVyOworICAgICAgICB9CisgICAgfQorICAgIGlmIChidWZwdHIgIT0gYnVmZmVyKSB7CisgICAgICAgIC8vIHByaW50IGxhc3QgbGluZQorICAgICAgICBMT0dWKCIlcyIsIGJ1ZmZlcik7CisgICAgfQorICAgIExPR1YoIlxuIik7Cit9CisKK3VpbnQxNl90IE10cFBhY2tldDo6Z2V0VUludDE2KGludCBvZmZzZXQpIGNvbnN0IHsKKyAgICByZXR1cm4gKCh1aW50MTZfdCltQnVmZmVyW29mZnNldCArIDFdIDw8IDgpIHwgKHVpbnQxNl90KW1CdWZmZXJbb2Zmc2V0XTsKK30KKwordWludDMyX3QgTXR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0NPTlRBSU5FUl9DT0RFX09GRlNFVCwgY29kZSk7Cit9CisKK010cFRyYW5zYWN0aW9uSUQgTXRwUGFja2V0OjpnZXRUcmFuc2FjdGlvbklEKCkgY29uc3QgeworICAgIHJldHVybiBnZXRVSW50MzIoTVRQX0NPTlRBSU5FUl9UUkFOU0FDVElPTl9JRF9PRkZTRVQpOworfQorCit2b2lkIE10cFBhY2tldDo6c2V0VHJhbnNhY3Rpb25JRChNdHBUcmFuc2FjdGlvbklEIGlkKSB7CisgICAgcHV0VUludDMyKE1UUF9DT05UQUlORVJfVFJBTlNBQ1RJT05fSURfT0ZGU0VULCBpZCk7Cit9CisKK3VpbnQzMl90IE10cFBhY2tldDo6Z2V0UGFyYW1ldGVyKGludCBpbmRleCkgY29uc3QgeworICAgIGlmIChpbmRleCA8IDEgfHwgaW5kZXggPiA1KSB7CisgICAgICAgIExPR0UoImluZGV4ICVkIG91dCBvZiByYW5nZSBpbiBNdHBSZXF1ZXN0UGFja2V0OjpnZXRQYXJhbWV0ZXIiLCBpbmRleCk7CisgICAgICAgIHJldHVybiAwOworICAgIH0KKyAgICByZXR1cm4gZ2V0VUludDMyKE1UUF9DT05UQUlORVJfUEFSQU1FVEVSX09GRlNFVCArIChpbmRleCAtIDEpICogc2l6ZW9mKHVpbnQzMl90KSk7Cit9CisKK3ZvaWQgTXRwUGFja2V0OjpzZXRQYXJhbWV0ZXIoaW50IGluZGV4LCB1aW50MzJfdCB2YWx1ZSkgeworICAgIGlmIChpbmRleCA8IDEgfHwgaW5kZXggPiA1KSB7CisgICAgICAgIExPR0UoImluZGV4ICVkIG91dCBvZiByYW5nZSBpbiBNdHBSZXNwb25zZVBhY2tldDo6c2V0UGFyYW1ldGVyIiwgaW5kZXgpOworICAgICAgICByZXR1cm47CisgICAgfQorICAgIGludCBvZmZzZXQgPSBNVFBfQ09OVEFJTkVSX1BBUkFNRVRFUl9PRkZTRVQgKyAoaW5kZXggLSAxKSAqIHNpemVvZih1aW50MzJfdCk7Cis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2F0aW9uSW5jcmVtZW50OworICAgIC8vIHNpemUgb2YgdGhlIGRhdGEgaW4gdGhlIHBhY2tldAorICAgIGludCAgICAgICAgICAgICAgICAgbVBhY2tldFNpemU7CisKK3B1YmxpYzoKKyAgICAgICAgICAgICAgICAgICAgICAgIE10cFBhY2tldChpbnQgYnVmZmVyU2l6ZSk7CisgICAgdmlydHVhbCAgICAgICAgICAgICB+TXRwUGFja2V0KCk7CisKKyAgICAvLyBzZXRzIHBhY2tldCBzaXplIHRvIHRoZSBkZWZhdWx0IGNvbnRhaW5lciBzaXplIGFuZCBzZXRzIGJ1ZmZlciB0byB6ZXJvCisgICAgdmlydHVhbCB2b2lkICAgICAgICByZXNldCgpOworCisgICAgdm9pZCAgICAgICAgICAgICAgICBhbGxvY2F0ZShpbnQgbGVuZ3RoKTsKKyAgICB2b2lkICAgICAgICAgICAgICAgIGR1bXAoKTsKKworICAgIHVpbnQxNl90ICAgICAgICAgICAgZ2V0Q29udGFpbmVyQ29kZSgpIGNvbnN0OworICAgIHZvaWQgICAgICAgICAgICAgICAgc2V0Q29udGFpbmVyQ29kZSh1aW50MTZfdCBjb2RlKTsKKworICAgIE10cFRyYW5zYWN0aW9uSUQgICAgZ2V0VHJhbnNhY3Rpb25JRCgpIGNvbnN0OworICAgIHZvaWQgICAgICAgICAgICAgICAgc2V0VHJhbnNhY3Rpb25JRChNdHBUcmFuc2FjdGlvbklEIGlkKTsKKworICAgIHVpbnQzMl90ICAgICAgICAgICAgZ2V0UGFyYW1ldGVyKGludCBpbmRleCkgY29uc3Q7CisgICAgdm9pZCAgICAgICAgICAgICAgICBzZXRQYXJhbWV0ZXIoaW50IGluZGV4LCB1aW50MzJfdCB2YWx1ZSk7CisKKyNpZmRlZiBNVFBfSE9TVAorICAgIGludCAgICAgICAgICAgICAgICAgdHJhbnNmZXIoc3RydWN0IHVzYl9lbmRwb2ludCAqZXAsIHZvaWQqIGJ1ZmZlciwgaW50IGxlbmd0aCk7CisjZW5kaWYKKworcH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Uuc3RyID0gTlVMTDsKKyAgICBtTWluaW11bVZhbHVlLnN0ciA9IE5VTEw7CisgICAgbU1heGltdW1WYWx1ZS5zdHIgPSBOVUxMOworfQorCitNdHBQcm9wZXJ0eTo6TXRwUHJvcGVydHkoTXRwUHJvcGVydHlDb2RlIHByb3BDb2RlLAorICAgICAgICAgICAgICAgICAgICAgICAgIE10cERhdGFUeXBlIHR5cGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgYm9vbCB3cml0ZWFibGUsCisgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGRlZmF1bHRWYWx1ZSkKKyAgICA6ICAgbUNvZGUocHJvcENvZGUpLAorICAgICAgICBtVHlwZSh0eXBlKSwKKyAgICAgICAgbVdyaXRlYWJsZSh3cml0ZWFibGUpLAorICAgICAgICBtRGVmYXVsdEFycmF5TGVuZ3RoKDApLAorICAgICAgICBtRGVmYXVsdEFycmF5VmFsdWVzKE5VTEwpLAorICAgICAgICBtQ3VycmVudEFycmF5TGVuZ3RoKDApLAorICAgICAgICBtQ3VycmVudEFycmF5VmFsdWVzKE5VTEwpLAorICAgICAgICBtR3JvdXBDb2RlKDApLAorICAgICAgICBtRm9ybUZsYWcoa0Zvcm1Ob25lKSwKKyAgICAgICAgbUVudW1MZW5ndGgoMCksCisgICAgICAgIG1FbnVtVmFsdWVzKE5VTEwpCit7CisgICAgbWVtc2V0KCZtRGVmYXVsdFZhbHVlLCAwLCBzaXplb2YobURlZmF1bHRWYWx1ZSkpOworICAgIG1lbXNldCgmbUN1cnJlbnRWYWx1ZSwgMCwgc2l6ZW9mKG1DdXJyZW50VmFsdWUpKTsKKyAgICBtZW1zZXQoJm1NaW5pbXVtVmFsdWUsIDAsIHNpemVvZihtTWluaW11bVZhbHVlKSk7CisgICAgbWVtc2V0KCZtTWF4aW11bVZhbHVlLCAwLCBzaXplb2YobU1heGltdW1WYWx1ZSkpOworCisgICAgaWYgKGRlZmF1bHRWYWx1ZSkgeworICAgICAgICBzd2l0Y2ggKHR5cGUpIHsKKyAgICAgICAgICAgIGNhc2UgTVRQX1RZUEVfSU5UODoKKyAgICAgICAgICAgICAgICBtRGVmYXVsdFZhbHVlLmk4ID0gZGVmYXVsdFZhbHVlOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBNVFBfVFlQRV9VSU5UODoKKyAgICAgICAgICAgICAgICBtRGVmYXVsdFZhbHVlLnU4ID0gZGVmYXVsdFZhbHVlOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBNVFBfVFlQRV9JTlQxNjoKKyAgICAgICAgICAgICAgICBtRGVmYXVsdFZhbHVlLmkxNiA9IGRlZmF1bHRWYWx1ZTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgTVRQX1RZUEVfVUlOVDE2OgorICAgICAgICAgICAgICAgIG1EZWZhdWx0VmFsdWUudTE2ID0gZGVmYXVsdFZhbHVlOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBNVFBfVFlQRV9JTlQzMjoKKyAgICAgICAgICAgICAgICBtRGVmYXVsdFZhbHVlLmkzMiA9IGRlZmF1bHRWYWx1ZTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgTVRQX1RZUEVfVUlOVDMyOgorICAgICAgICAgICAgICAgIG1EZWZhdWx0VmFsdWUudTMyID0gZGVmYXVsdFZhbHVlOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBNVFBfVFlQRV9JTlQ2NDoKKyAgICAgICAgICAgICAgICBtRGVmYXVsdFZhbHVlLmk2NCA9IGRlZmF1bHRWYWx1ZTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIGNhc2UgTVRQX1RZUEVfVUlOVDY0OgorICAgICAgICAgICAgICAgIG1EZWZhdWx0VmFsdWUudTY0ID0gZGVmYXVsdFZhbHVlOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICBMT0dFKCJ1bmtub3duIHR5cGUgJTA0WCBpbiBNdHBQcm9wZXJ0eTo6TXRwUHJvcGVydHkiLCB0eXBlKTsKKyAgICAgICAgfQorICAgIH0KK30KKworTXRwUHJvcGVydHk6On5NdHBQcm9wZXJ0eSgpIHsKKyAgICBpZiAobVR5cGUgPT0gTVRQX1RZUEVfU1RSKSB7CisgICAgICAgIC8vIGZyZWUgYWxsIHN0cmluZ3MKKyAgICAgICAgZnJlZShtRGVmYXVsdFZhbHVlLnN0cik7CisgICAgICAgIGZyZWUobUN1cnJlbnRWYWx1ZS5zdHIpOworICAgICAgICBmcmVlKG1NaW5pbXVtVmFsdWUuc3RyKTsKKyAgICAgICAgZnJlZShtTWF4aW11bVZhbHVlLnN0cik7CisgICAgICAgIGlmIChtRGVmYXVsdEFycmF5VmFsdWVzKSB7CisgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IG1EZWZhdWx0QXJyYXlMZW5ndGg7IGkrKykKKyAgICAgICAgICAgICAgICBmcmVlKG1EZWZhdWx0QXJyYXlWYWx1ZXNbaV0uc3RyKTsKKyAgICAgICAgfQorICAgICAgICBpZiAobUN1cnJlbnRBcnJheVZhbHVlcykgeworICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBtQ3VycmVudEFycmF5TGVuZ3RoOyBpKyspCisgICAgICAgICAgICAgICAgZnJlZShtQ3VycmVudEFycmF5VmFsdWVzW2ldLnN0cik7CisgICAgICAgIH0KKyAgICAgICAgaWYgKG1FbnVtVmFsdWVzKSB7CisgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IG1FbnVtTGVuZ3RoOyBpKyspCisgICAgICAgICAgICAgICAgZnJlZShtRW51bVZhbHVlc1tpXS5zdHIpOworICAgICAgICB9CisgICAgfQorICAgIGRlbGV0ZVtdIG1EZWZhdWx0QXJyYXlWYWx1ZXM7CisgICAgZ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gICAgICAgICAgICAgICAgcmVhZFZhbHVlKHBhY2tldCwgbUN1cnJlbnRWYWx1ZSk7CisgICAgfQorICAgIG1Hcm91cENvZGUgPSBwYWNrZXQuZ2V0VUludDMyKCk7CisgICAgbUZvcm1GbGFnID0gcGFja2V0LmdldFVJbnQ4KCk7CisKKyAgICBpZiAobUZvcm1GbGFnID09IGtGb3JtUmFuZ2UpIHsKKyAgICAgICAgICAgIHJlYWRWYWx1ZShwYWNrZXQsIG1NaW5pbXVtVmFsdWUpOworICAgICAgICAgICAgcmVhZFZhbHVlKHBhY2tldCwgbU1heGltdW1WYWx1ZSk7CisgICAgICAgICAgICByZWFkVmFsdWUocGFja2V0LCBtU3RlcFNpemUpOworICAgIH0gZWxzZSBpZiAobUZvcm1GbGFnID09IGtGb3JtRW51bSkgeworICAgICAgICBtRW51bUxlbmd0aCA9IHBhY2tldC5nZXRVSW50MTYoKTsKKyAgICAgICAgbUVudW1WYWx1ZXMgPSBuZXcgTXRwUHJvcGVydHlWYWx1ZVttRW51bUxlbmd0aF07CisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbUVudW1MZW5ndGg7IGkrKykKKyAgICAgICAgICAgIHJlYWRWYWx1ZShwYWNrZXQsIG1FbnVtVmFsdWVzW2ldKTsKKyAgICB9Cit9CisKK3ZvaWQgTXRwUHJvcGVydHk6OndyaXRlKE10cERhdGFQYWNrZXQmIHBhY2tldCkgeworICAgIHBhY2tldC5wdXRVSW50MTYobUNvZGUpOworICAgIHBhY2tldC5wdXRVSW50MTYobVR5cGUpOworICAgIHBhY2tldC5wdXRVSW50OChtV3JpdGVhYmxlID8gMSA6IDApOworCisgICAgc3dpdGNoIChtVHlwZSkgeworICAgICAgICBjYXNlIE1UUF9UWVBFX0FJTlQ4OgorICAgICAgICBjYXNlIE1UUF9UWVBFX0FVSU5UODoKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9BSU5UMTY6CisgICAgICAgIGNhc2UgTVRQX1RZUEVfQVVJTlQxN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MT0dWKCJNdHBQcm9wZXJ0eSAlMDRYXG4iLCBtQ29kZSk7CisgICAgTE9HVigiICAgIHR5cGUgJTA0WFxuIiwgbVR5cGUpOworICAgIExPR1YoIiAgICB3cml0ZWFibGUgJXNcbiIsIChtV3JpdGVhYmxlID8gInRydWUiIDogImZhbHNlIikpOworfQorCit2b2lkIE10cFByb3BlcnR5OjpyZWFkVmFsdWUoTXRwRGF0YVBhY2tldCYgcGFja2V0LCBNdHBQcm9wZXJ0eVZhbHVlJiB2YWx1ZSkgeworICAgIE10cFN0cmluZ0J1ZmZlciBzdHJpbmdCdWZmZXI7CisKKyAgICBzd2l0Y2ggKG1UeXBlKSB7CisgICAgICAgIGNhc2UgTVRQX1RZUEVfSU5UODoKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9BSU5UODoKKyAgICAgICAgICAgIHZhbHVlLmk4ID0gcGFja2V0LmdldEludDgoKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIE1UUF9UWVBFX1VJTlQ4OgorICAgICAgICBjYXNlIE1UUF9UWVBFX0FVSU5UODoKKyAgICAgICAgICAgIHZhbHVlLnU4ID0gcGFja2V0LmdldFVJbnQ4KCk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9JTlQxNjoKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9BSU5UMTY6CisgICAgICAgICAgICB2YWx1ZS5pMTYgPSBwYWNrZXQuZ2V0SW50MTYoKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIE1UUF9UWVBFX1VJTlQxNjoKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9BVUlOVDE2OgorICAgICAgICAgICAgdmFsdWUudTE2ID0gcGFja2V0LmdldFVJbnQxNigpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX1RZUEVfSU5UMzI6CisgICAgICAgIGNhc2UgTVRQX1RZUEVfQUlOVDMyOgorICAgICAgICAgICAgdmFsdWUuaTMyID0gcGFja2V0LmdldEludDMyKCk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9VSU5UMzI6CisgICAgICAgIGNhc2UgTVRQX1RZUEVfQVVJTlQzMjoKKyAgICAgICAgICAgIHZhbHVlLnUzMiA9IHBhY2tldC5nZXRVSW50MzIoKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIE1UUF9UWVBFX0lOVDY0OgorICAgICAgICBjYXNlIE1UUF9UWVBFX0FJTlQ2NDoKKyAgICAgICAgICAgIHZhbHVlLmk2NCA9IHBhY2tldC5nZXRJbnQ2NCgpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX1RZUEVfVUlOVDY0OgorICAgICAgICBjYXNlIE1UUF9UWVBFX0FVSU5UNjQ6CisgICAgICAgICAgICB2YWx1ZS51NjQgPSBwYWNrZXQuZ2V0VUludDY0KCk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9JTlQxMjg6CisgICAgICAgIGNhc2UgTVRQX1RZUEVfQUlOVDEyODoKKyAgICAgICAgICAgIHBhY2tldC5nZXRJbnQxMjgodmFsdWUuaTEyOCk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9VSU5UMTI4OgorICAgICAgICBjYXNlIE1UUF9UWVBFX0FVSU5UMTI4OgorICAgICAgICAgICAgcGFja2V0LmdldFVJbnQxMjgodmFsdWUudTEyOCk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9TVFI6CisgICAgICAgICAgICBwYWNrZXQuZ2V0U3RyaW5nKHN0cmluZ0J1ZmZlcik7CisgICAgICAgICAgICB2YWx1ZS5zdHIgPSBzdHJkdXAoc3RyaW5nQnVmZmVyKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgTE9HRSgidW5rbm93biB0eXBlICUwNFggaW4gTXRwUHJvcGVydHk6OnJlYWRWYWx1ZSIsIG1UeXBlKTsKKyAgICB9Cit9CisKK3ZvaWQgTXRwUHJvcGVydHk6OndyaXRlVmFsdWUoTXRwRGF0YVBhY2tldCYgcGFja2V0LCBNdHBQcm9wZXJ0eVZhbHVlJiB2YWx1ZSkgeworICAgIE10cFN0cmluZ0J1ZmZlciBzdHJpbmdCdWZmZXI7CisKKyAgICBzd2l0Y2ggKG1UeXBlKSB7CisgICAgICAgIGNhc2UgTVRQX1RZUEVfSU5UODoKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9BSU5UODoKKyAgICAgICAgICAgIHBhY2tldC5wdXRJbnQ4KHZhbHVlLmk4KTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIE1UUF9UWVBFX1VJTlQ4OgorICAgICAgICBjYXNlIE1UUF9UWVBFX0FVSU5UODoKKyAgICAgICAgICAgIHBhY2tldC5wdXRVSW50OCh2YWx1ZS51OCk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9JTlQxNjoKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9BSU5UMTY6CisgICAgICAgICAgICBwYWNrZXQucHV0SW50MTYodmFsdWUuaTE2KTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIE1UUF9UWVBFX1VJTlQxNjoKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9BVUlOVDE2OgorICAgICAgICAgICAgcGFja2V0LnB1dFVJbnQxNih2YWx1ZS51MTYpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX1RZUEVfSU5UMzI6CisgICAgICAgIGNhc2UgTVRQX1RZUEVfQUlOVDMyOgorICAgICAgICAgICAgcGFja2V0LnB1dEludDMyKHZhbHVlLmkzMik7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9VSU5UMzI6CisgICAgICAgIGNhc2UgTVRQX1RZUEVfQVVJTlQzMjoKKyAgICAgICAgICAgIHBhY2tldC5wdXRVSW50MzIodmFsdWUudTMyKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIE1UUF9UWVBFX0lOVDY0OgorICAgICAgICBjYXNlIE1UUF9UWVBFX0FJTlQ2NDoKKyAgICAgICAgICAgIHBhY2tldC5wdXRJbnQ2NCh2YWx1ZS5pNjQpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX1RZUEVfVUlOVDY0OgorICAgICAgICBjYXNlIE1UUF9UWVBFX0FVSU5UNjQ6CisgICAgICAgICAgICBwYWNrZXQucHV0VUludDY0KHZhbHVlLnU2NCk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9JTlQxMjg6CisgICAgICAgIGNhc2UgTVRQX1RZUEVfQUlOVDEyODoKKyAgICAgICAgICAgIHBhY2tldC5wdXRJbnQxMjgodmFsdWUuaTEyOCk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9VSU5UMTI4OgorICAgICAgICBjYXNlIE1UUF9UWVBFX0FVSU5UMTI4OgorICAgICAgICAgICAgcGFja2V0LnB1dFVJbnQxMjgodmFsdWUudTEyOCk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfVFlQRV9TVFI6CisgICAgICAgICAgICBpZiAodmFsdWUuc3RyKQorICAgICAgICAgICAgICAgIHBhY2tldC5wdXRTdHJpbmcodmFsdWUuc3RyKTsKKyAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICBwYWNrZXQucHV0RW1wdHlTdHJpbmcoKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgTE9HRSgidW5rbm93biB0eXBlICUwNFggaW4gTXRwUHJvcGVydHk6OndyaXRlVmFsdWUiLCBtVHl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GVydHlWYWx1ZSAgICBtRGVmYXVsdFZhbHVlOworICAgIE10cFByb3BlcnR5VmFsdWUgICAgbUN1cnJlbnRWYWx1ZTsKKworICAgIC8vIGZvciBhcnJheSB0eXBlcworICAgIGludCAgICAgICAgICAgICAgICAgbURlZmF1bHRBcnJheUxlbmd0aDsKKyAgICBNdHBQcm9wZXJ0eVZhbHVlKiAgIG1EZWZhdWx0QXJyYXlWYWx1ZXM7CisgICAgaW50ICAgICAgICAgICAgICAgICBtQ3VycmVudEFycmF5TGVuZ3RoOworICAgIE10cFByb3BlcnR5VmFsdWUqICAgbUN1cnJlbnRBcnJheVZhbHVlczsKKworICAgIGVudW0geworICAgICAgICBrRm9ybU5vbmUgPSAwLAorICAgICAgICBrRm9ybVJhbmdlID0gMSwKKyAgICAgICAga0Zvcm1FbnVtID0gMiwKKyAgICB9OworCisgICAgdWludDMyX3QgICAgICAgICAgICBtR3JvdXBDb2RlOworICAgIHVpbnQ4X3QgICAgICAgICAgICAgbUZvcm1GbGFnOworCisgICAgLy8gZm9yIHJhbmdlIGZvcm0KKyAgICBNdHBQcm9wZXJ0eVZhbHVlICAgIG1NaW5pbXVtVmFsdWU7CisgICAgTXRwUHJvcGVydHlWYWx1ZSAgICBtTWF4aW11bVZhbHVlOworICAgIE10cFByb3BlcnR5VmFsdWUgICAgbVN0ZXBTaXplOworCisgICAgLy8gZm9yIGVudW0gZm9ybQorICAgIGludCAgICAgICAgICAgICAgICAgbUVudW1MZW5ndGg7CisgICAgTXRwUHJvcGVydHlWYWx1ZSogICBtRW51bVZhbHVlczsKKworcHVibGljOgorICAgICAgICAgICAgICAgICAgICAgICAgTXRwUHJvcGVydHkoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIE10cFByb3BlcnR5KE10cFByb3BlcnR5Q29kZSBwcm9wQ29kZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNdHBEYXRhVHlwZSB0eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvb2wgd3JpdGVhYmxlID0gZmFsc2UsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW50IGRlZmF1bHRWYWx1ZSA9IDApOworICAgIHZpcnR1YWwgICAgICAgICAgICAgfk10cFByb3BlcnR5KCk7CisKKyAgICBpbmxpbmUgTXRwUHJvcGVydHlDb2RlIGdldFByb3BlcnR5Q29kZSgpIGNvbnN0IHsgcmV0dXJuIG1Db2RlOyB9CisKKyAgICB2b2lkICAgICAgICAgICAgICAgIHJlYWQoTXRwRGF0YVBhY2tldCYgcGFja2V0KTsKKyAgICB2b2lkICAgICAgICAgICAgICAgIHdyaXRlKE10cERhdGFQYWNrZXQmIHBhY2tldCk7CisKKyAgICB2b2lkICAgICAgICAgICAgICAgIHByaW50KCk7CisKKyAgICBpbmxpbmUgYm9vbCAgICAgICAgIGlzRGV2aWNlUHJvcGVydHkoKSBjb25zdCB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICggICAoKG1Db2RlICYgMHhGMDAwKSA9PSAweDUwMDApCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8fCAoKG1Db2RlICYgMHhGODAwKSA9PSAweEQwMDApKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKworcHJpdmF0ZToKKyAgICB2b2lkICAgICAgICAgICAgICAgIHJlYWRWYWx1ZShNdHBEYXRhUGFja2V0JiBwYWNrZXQsIE10cFByb3BlcnR5VmFsdWUmIHZhbHVlKTsKKyAgICB2b2lkICAgICAgICAgICAgICAgIHdyaXRlVmFsdWUoTXRwRGF0YVBhY2tldCYgcGFja2V0LCBNdHBQcm9wZXJ0eVZhbHVlJiB2YWx1ZSk7CisgICAgTXRwUHJvcGVydHlWYWx1ZSogICByZWFkQXJyYXlWYWx1ZXMoTXRwRGF0YVBhY2tldCYgcGFja2V0LCBpbnQmIGxlbmd0aCk7CisgICAgdm9pZCAgICAgICAgICAgICAgICB3cml0ZUFycm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OworCisgICAgd2hpbGUgKDEpIHsKKyAgICAgICAgaW50IHJldCA9IG1SZXF1ZXN0LnJlYWQoZmQpOworICAgICAgICBpZiAocmV0IDwgMCkgeworICAgICAgICAgICAgTE9HRSgicmVxdWVzdCByZWFkIHJldHVybmVkICVkLCBlcnJubzogJWQiLCByZXQsIGVycm5vKTsKKyAgICAgICAgICAgIGlmIChlcnJubyA9PSBFQ0FOQ0VMRUQpIHsKKyAgICAgICAgICAgICAgICAvLyByZXR1cm4gdG8gdG9wIG9mIGxvb3AgYW5kIHdhaXQgZm9yIG5leHQgY29tbWFuZAorICAgICAgICAgICAgICAgIGNvbnRpbnVlOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICAgICAgTXRwT3BlcmF0aW9uQ29kZSBvcGVyYXRpb24gPSBtUmVxdWVzdC5nZXRPcGVyYXRpb25Db2RlKCk7CisgICAgICAgIE10cFRyYW5zYWN0aW9uSUQgdHJhbnNhY3Rpb24gPSBtUmVxdWVzdC5nZXRUcmFuc2FjdGlvbklEKCk7CisKKyAgICAgICAgTE9HVigib3BlcmF0aW9uOiAlcyIsIE10cERlYnVnOjpnZXRPcGVyYXRpb25Db2RlTmFtZShvcGVyYXRpb24pKTsKKyAgICAgICAgbVJlcXVlc3QuZHVtcCgpOworCisgICAgICAgIC8vIEZJWE1FIG5lZWQgdG8gZ2VuZXJhbGl6ZSB0aGlzCisgICAgICAgIGJvb2wgZGF0YUluID0gKG9wZXJhdGlvbiA9PSBNVFBfT1BFUkFUSU9OX1NFTkRfT0JKRUNUX0lORk8KKyAgICAgICAgICAgICAgICAgICAgfHwgb3BlcmF0aW9uID09IE1UUF9PUEVSQVRJT05fU0VUX09CSkVDVF9SRUZFUkVOQ0VTCisgICAgICAgICAgICAgICAgICAgIHx8IG9wZXJhdGlvbiA9PSBNVFBfT1BFUkFUSU9OX1NFVF9PQkpFQ1RfUFJPUF9WQUxVRQorICAgICAgICAgICAgICAgICAgICB8fCBvcGVyYXRpb24gPT0gTVRQX09QRVJBVElPTl9TRVRfREVWSUNFX1BST1BfVkFMVUUpOworICAgICAgICBpZiAoZGF0YUluKSB7CisgICAgICAgICAgICBpbnQgcmV0ID0gbURhdGEucmVhZChmZCk7CisgICAgICAgICAgICBpZiAocmV0IDwgMCkgeworICAgICAgICAgICAgICAgIExPR0UoImRhdGEgcmVhZCByZXR1cm5lZCAlZCwgZXJybm86ICVkIiwgcmV0LCBlcnJubyk7CisgICAgICAgICAgICAgICAgaWYgKGVycm5vID09IEVDQU5DRUxFRCkgeworICAgICAgICAgICAgICAgICAgICAvLyByZXR1cm4gdG8gdG9wIG9mIGxvb3AgYW5kIHdhaXQgZm9yIG5leHQgY29tbWFuZAorICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBMT0dWKCJyZWNlaXZlZCBkYXRhOiIpOworICAgICAgICAgICAgbURhdGEuZHVtcCgpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgbURhdGEucmVzZXQoKTsKKyAgICAgICAgfQorCisgICAgICAgIGlmIChoYW5kbGVSZXF1ZXN0KCkpIHsKKyAgICAgICAgICAgIGlmICghZGF0YUluICYmIG1EYXRhLmhhc0RhdGEoKSkgeworICAgICAgICAgICAgICAgIG1EYXRhLnNldE9wZXJhdGlvbkNvZGUob3BlcmF0aW9uKTsKKyAgICAgICAgICAgICAgICBtRGF0YS5zZXRUcmFuc2FjdGlvbklEKHRyYW5zYWN0aW9uKTsKKyAgICAgICAgICAgICAgICBMT0dWKCJzZW5kaW5nIGRhdGE6Iik7CisgICAgICAgICAgICAgICAgcmV0ID0gbURhdGEud3JpdGUoZmQpOworICAgICAgICAgICAgICAgIGlmIChyZXQgPCAwKSB7CisgICAgICAgICAgICAgICAgICAgIExPR0UoInJlcXVlc3Qgd3JpdGUgcmV0dXJuZWQgJWQsIGVycm5vOiAlZCIsIHJldCwgZXJybm8pOworICAgICAgICAgICAgICAgICAgICBpZiAoZXJybm8gPT0gRUNBTkNFTEVEKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAvLyByZXR1cm4gdG8gdG9wIG9mIGxvb3AgYW5kIHdhaXQgZm9yIG5leHQgY29tbWFuZAorICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCisgICAgICAgICAgICBtUmVzcG9uc2Uuc2V0VHJhbnNhY3Rpb25JRCh0cmFuc2FjdGlvbik7CisgICAgICAgICAgICBMT0dWKCJzZW5kaW5nIHJlc3BvbnNlICUwNFgiLCBtUmVzcG9uc2UuZ2V0UmVzcG9uc2VDb2RlKCkpOworICAgICAgICAgICAgcmV0ID0gbVJlc3BvbnNlLndyaXRlKGZkKTsKKyAgICAgICAgICAgIGlmIChyZXQgPCAwKSB7CisgICAgICAgICAgICAgICAgTE9HRSgicmVxdWVzdCB3cml0ZSByZXR1cm5lZCAlZCwgZXJybm86ICVkIiwgcmV0LCBlcnJubyk7CisgICAgICAgICAgICAgICAgaWYgKGVycm5vID09IEVDQU5DRUxFRCkgeworICAgICAgICAgICAgICAgICAgICAvLyByZXR1cm4gdG8gdG9wIG9mIGxvb3AgYW5kIHdhaXQgZm9yIG5leHQgY29tbWFuZAorICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBMT0dWKCJza2lwcGluZyByZXNwb25zZVxuIik7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBpZiAobVNlc3Npb25PcGVuKQorICAgICAgICBtRGF0YWJhc2UtPnNlc3Npb25FbmRlZCgpOworfQorCit2b2lkIE10cFNl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GVyYXRpb24gPSBtUmVxdWVzdC5nZXRPcGVyYXRpb25Db2RlKCk7CisgICAgTXRwUmVzcG9uc2VDb2RlIHJlc3BvbnNlOworCisgICAgbVJlc3BvbnNlLnJlc2V0KCk7CisKKyAgICBpZiAobVNlbmRPYmplY3RIYW5kbGUgIT0ga0ludmFsaWRPYmplY3RIYW5kbGUgJiYgb3BlcmF0aW9uICE9IE1UUF9PUEVSQVRJT05fU0VORF9PQkpFQ1QpIHsKKyAgICAgICAgLy8gRklYTUUgLSBuZWVkIHRvIGRlbGV0ZSBtU2VuZE9iamVjdEhhbmRsZSBmcm9tIHRoZSBkYXRhYmFzZQorICAgICAgICBMT0dFKCJleHBlY3RlZCBTZW5kT2JqZWN0IGFmdGVyIFNlbmRPYmplY3RJbmZvIik7CisgICAgICAgIG1TZW5kT2JqZWN0SGFuZGxlID0ga0ludmFsaWRPYmplY3RIYW5kbGU7CisgICAgfQorCisgICAgc3dpdGNoIChvcGVyYXRpb24pIHsKKyAgICAgICAgY2FzZSBNVFBfT1BFUkFUSU9OX0dFVF9ERVZJQ0VfSU5GTzoKKyAgICAgICAgICAgIHJlc3BvbnNlID0gZG9HZXREZXZpY2VJbmZvKCk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfT1BFUkFUSU9OX09QRU5fU0VTU0lPTjoKKyAgICAgICAgICAgIHJlc3BvbnNlID0gZG9PcGVuU2Vzc2lvbigpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX09QRVJBVElPTl9DTE9TRV9TRVNTSU9OOgorICAgICAgICAgICAgcmVzcG9uc2UgPSBkb0Nsb3NlU2Vzc2lvbigpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX09QRVJBVElPTl9HRVRfU1RPUkFHRV9JRFM6CisgICAgICAgICAgICByZXNwb25zZSA9IGRvR2V0U3RvcmFnZUlEcygpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICBjYXNlIE1UUF9PUEVSQVRJT05fR0VUX1NUT1JBR0VfSU5GTzoKKyAgICAgICAgICAgIHJlc3BvbnNlID0gZG9HZXRTdG9yYWdlSW5mbygpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX09QRVJBVElPTl9HRVRfT0JKRUNUX1BST1BTX1NVUFBPUlRFRDoKKyAgICAgICAgICAgIHJlc3BvbnNlID0gZG9HZXRPYmplY3RQcm9wc1N1cHBvcnRlZCgpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX09QRVJBVElPTl9HRVRfT0JKRUNUX0hBTkRMRVM6CisgICAgICAgICAgICByZXNwb25zZSA9IGRvR2V0T2JqZWN0SGFuZGxlcygpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX09QRVJBVElPTl9HRVRfTlVNX09CSkVDVFM6CisgICAgICAgICAgICByZXNwb25zZSA9IGRvR2V0TnVtT2JqZWN0cygpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX09QRVJBVElPTl9HRVRfT0JKRUNUX1JFRkVSRU5DRVM6CisgICAgICAgICAgICByZXNwb25zZSA9IGRvR2V0T2JqZWN0UmVmZXJlbmNlcygpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX09QRVJBVElPTl9TRVRfT0JKRUNUX1JFRkVSRU5DRVM6CisgICAgICAgICAgICByZXNwb25zZSA9IGRvU2V0T2JqZWN0UmVmZXJlbmNlcygpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX09QRVJBVElPTl9HRVRfT0JKRUNUX1BST1BfVkFMVUU6CisgICAgICAgICAgICByZXNwb25zZSA9IGRvR2V0T2JqZWN0UHJvcFZhbHVlKCk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfT1BFUkFUSU9OX1NFVF9PQkpFQ1RfUFJPUF9WQUxVRToKKyAgICAgICAgICAgIHJlc3BvbnNlID0gZG9TZXRPYmplY3RQcm9wVmFsdWUoKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIE1UUF9PUEVSQVRJT05fR0VUX0RFVklDRV9QUk9QX1ZBTFVFOgorICAgICAgICAgICAgcmVzcG9uc2UgPSBkb0dldERldmljZVByb3BWYWx1ZSgpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX09QRVJBVElPTl9TRVRfREVWSUNFX1BST1BfVkFMVUU6CisgICAgICAgICAgICByZXNwb25zZSA9IGRvU2V0RGV2aWNlUHJvcFZhbHVlKCk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfT1BFUkFUSU9OX1JFU0VUX0RFVklDRV9QUk9QX1ZBTFVFOgorICAgICAgICAgICAgcmVzcG9uc2UgPSBkb1Jlc2V0RGV2aWNlUHJvcFZhbHVlKCk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfT1BFUkFUSU9OX0dFVF9PQkpFQ1RfSU5GTzoKKyAgICAgICAgICAgIHJlc3BvbnNlID0gZG9HZXRPYmplY3RJbmZvKCk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfT1BFUkFUSU9OX0dFVF9PQkpFQ1Q6CisgICAgICAgICAgICByZXNwb25zZSA9IGRvR2V0T2JqZWN0KCk7CisgICAgICAgICAgICBicmVhazsKKyAgICAgICAgY2FzZSBNVFBfT1BFUkFUSU9OX1NFTkRfT0JKRUNUX0lORk86CisgICAgICAgICAgICByZXNwb25zZSA9IGRvU2VuZE9iamVjdEluZm8oKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICBjYXNlIE1UUF9PUEVSQVRJT05fU0VORF9PQkpFQ1Q6CisgICAgICAgICAgICByZXNwb25zZSA9IGRvU2VuZE9iamVjdCgpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX09QRVJBVElPTl9ERUxFVEVfT0JKRUNUOgorICAgICAgICAgICAgcmVzcG9uc2UgPSBkb0RlbGV0ZU9iamVjdCgpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX09QRVJBVElPTl9HRVRfT0JKRUNUX1BST1BfREVTQzoKKyAgICAgICAgICAgIHJlc3BvbnNlID0gZG9HZXRPYmplY3RQcm9wRGVzYygpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGNhc2UgTVRQX09QRVJBVElPTl9HRVRfREVWSUNFX1BST1BfREVTQzoKKyAgICAgICAgICAgIHJlc3BvbnNlID0gZG9HZXREZXZpY2VQcm9wRGVzYygpOworICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICByZXNwb25zZSA9IE1UUF9SRVNQT05TRV9PUEVSQVRJT05fTk9UX1NVUFBPUlRFRDsKKyAgICAgICAgICAgIGJyZWFrOworICAgIH0KKworICAgIGlmIChyZXNwb25zZSA9PSBNVFBfUkVTUE9OU0VfVFJBTlNBQ1RJT05fQ0FOQ0VMTEVEKQorICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgbVJlc3BvbnNlLnNldFJlc3BvbnNlQ29kZShyZXNwb25zZSk7CisgICAgcmV0dXJuIHRydWU7Cit9CisKK010cFJlc3BvbnNlQ29kZSBNdHBTZXJ2ZXI6OmRvR2V0RGV2aWNlSW5mbygpIHsKKyAgICBNdHBTdHJpbmdCdWZmZXIgICBzdHJpbmc7CisgICAgY2hhciBwcm9wX3ZhbHVlW1BST1BFUlRZX1ZBTFVFX01BWF07CisKKyAgICBNdHBPYmplY3RGb3JtYXRMaXN0KiBwbGF5YmFja0Zvcm1hdHMgPSBtRGF0YWJhc2UtPmdldFN1cHBvcnRlZFBsYXliYWNrRm9ybWF0cygpOworICAgIE10cE9iamVjdEZvcm1hdExpc3QqIGNhcHR1cmVGb3JtYXRzID0gbURhdGFiYXNlLT5nZXRTdXBwb3J0ZW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QgICAgICAgICAgICAgICAgIG1GRDsKKworICAgIE10cERhdGFiYXNlKiAgICAgICAgbURhdGFiYXNlOworCisgICAgLy8gZ3JvdXAgdG8gb3duIG5ldyBmaWxlcyBhbmQgZm9sZGVycworICAgIGludCAgICAgICAgICAgICAgICAgbUZpbGVHcm91cDsKKyAgICAvLyBwZXJtaXNzaW9ucyBmb3IgbmV3IGZpbGVzIGFuZCBkaXJlY3RvcmllcworICAgIGludCAgICAgICAgICAgICAgICAgbUZpbGVQZXJtaXNzaW9uOworICAgIGludCAgICAgICAgICAgICAgICAgbURpcmVjdG9yeVBlcm1pc3Npb247CisKKyAgICAvLyBjdXJyZW50IHNlc3Npb24gSUQKKyAgICBNdHBTZXNzaW9uSUQgICAgICAgIG1TZXNzaW9uSUQ7CisgICAgLy8gdHJ1ZSBpZiB3ZSBoYXZlIGFuIG9wZW4gc2Vzc2lvbiBhbmQgbVNlc3Npb25JRCBpcyB2YWxpZAorICAgIGJvb2wgICAgICAgICAgICAgICAgbVNlc3Npb25PcGVuOworCisgICAgTXRwUmVxdWVzdFBhY2tldCAgICBtUmVxdWVzdDsKKyAgICBNdHBEYXRhUGFja2V0ICAgICAgIG1EYXRhOworICAgIE10cFJlc3BvbnNlUGFja2V0ICAgbVJlc3BvbnNlOworICAgIE10cEV2ZW50UGFja2V0ICAgICAgbUV2ZW50OworCisgICAgTXRwU3RvcmFnZUxpc3QgICAgICBtU3RvcmFnZXM7CisKKyAgICAvLyBoYW5kbGUgZm9yIG5ldyBvYmplY3QsIHNldCBieSBTZW5kT2JqZWN0SW5mbyBhbmQgdXNlZCBieSBTZW5kT2JqZWN0CisgICAgTXRwT2JqZWN0SGFuZGxlICAgICBtU2VuZE9iamVjdEhhbmRsZTsKKyAgICBNdHBPYmplY3RGb3JtYXQgICAgIG1TZW5kT2JqZWN0Rm9ybWF0OworICAgIE10cFN0cmluZyAgICAgICAgICAgbVNlbmRPYmplY3RGaWxlUGF0aDsKKyAgICBzaXplX3QgICAgICAgICAgICAgIG1TZW5kT2JqZWN0RmlsZVNpemU7CisKK3B1YmxpYzoKKyAgICAgICAgICAgICAgICAgICAgICAgIE10cFNlcnZlcihpbnQgZmQsIE10cERhdGFiYXNlKiBkYXRhYmFzZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCBmaWxlR3JvdXAsIGludCBmaWxlUGVybSwgaW50IGRpcmVjdG9yeVBlcm0pOworICAgIHZpcnR1YWwgICAgICAgICAgICAgfk10cFNlcnZlcigpOworCisgICAgdm9pZCAgICAgICAgICAgICAgICBhZGRTdG9yYWdlKGNvbnN0IGNoYXIqIGZpbGVQYXRoKTsKKyAgICBpbmxpbmUgdm9pZCAgICAgICAgIGFkZFN0b3JhZ2UoTXRwU3RvcmFnZSogc3RvcmFnZSkgeyBtU3RvcmFnZXMucHVzaChzdG9yYWdlKTsgfQorICAgIE10cFN0b3JhZ2UqICAgICAgICAgZ2V0U3RvcmFnZShNdHBTdG9yYWdlSUQgaWQpOworICAgIHZvaWQgICAgICAgICAgICAgICAgcnVuKCk7CisKKyAgICB2b2lkICAgICAgICAgICAgICAgIHNlbmRPYmplY3RBZGRlZChNdHBPYmplY3RIYW5kbGUgaGFuZGxlKTsKKyAgICB2b2lkICAgICAgICAgICAgICAgIHNlbmRPYmplY3RSZW1vdmVkKE10cE9iamVjdEhhbmRsZSBoYW5kbGUpOworCitwcml2YXRlOgorICAgIGJvb2wgICAgICAgICAgICAgICAgaGFuZGxlUmVxdWVzdCgpOworCisgICAgTXRwUmVzcG9uc2VDb2RlICAgICBkb0dldERldmljZUluZm8oKTsKKyAgICBNdHBSZXNwb25zZUNvZGUgICAgIGRvT3BlblNlc3Npb24oKTsKKyAgICBNdHBSZXNwb25zZUNvZGUgICAgIGRvQ2xvc2VTZXNzaW9uKCk7CisgICAgTXRwUmVzcG9uc2VDb2RlICAgICBkb0dldFN0b3JhZ2VJRHMoKTsKKyAgICBNdHBSZXNwb25zZUNvZGUgICAgIGRvR2V0U3Rv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nZUlEOworICAgIGNvbnN0IGNoYXIqICAgICAgICAgICAgIG1GaWxlUGF0aDsKKyAgICBNdHBEYXRhYmFzZSogICAgICAgICAgICBtRGF0YWJhc2U7CisgICAgdWludDY0X3QgICAgICAgICAgICAgICAgbU1heENhcGFjaXR5OworCitwdWJsaWM6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgTXRwU3RvcmFnZShNdHBTdG9yYWdlSUQgaWQsIGNvbnN0IGNoYXIqIGZpbGVQYXRoLCBNdHBEYXRhYmFzZSogZGIpOworICAgIHZpcnR1YWwgICAgICAgICAgICAgICAgIH5NdHBTdG9yYWdlKCk7CisKKyAgICBpbmxpbmUgTXRwU3RvcmFnZUlEICAgICBnZXRTdG9yYWdlSUQoKSBjb25zdCB7IHJldHVybiBtU3RvcmFnZUlEOyB9CisgICAgaW50ICAgICAgICAgICAgICAgICAgICAgZ2V0VHlwZSgpIGNvbnN0OworICAgIGludCAgICAgICAgICAgICAgICAgICAgIGdldEZpbGVTeXN0ZW1UeXBlKCkgY29uc3Q7CisgICAgaW50ICAgICAgICAgICAgICAgICAgICAgZ2V0QWNjZXNzQ2FwYWJpbGl0eSgpIGNvbnN0OworICAgIHVpbnQ2NF90ICAgICAgICAgICAgICAgIGdldE1heENhcGFjaXR5KCk7CisgICAgdWludDY0X3QgICAgICAgICAgICAgICAgZ2V0RnJlZVNwYWNlKCk7CisgICAgY29uc3QgY2hhciogICAgICAgICAgICAgZ2V0RGVzY3JpcHRpb24oKSBjb25zdDsKKyAgICBpbmxpbmUgY29uc3QgY2hhciogICAgICBnZXRQYXRoKCkgY29uc3QgeyByZXR1cm4gbUZpbGVQYXRoOyB9Cit9OworCit9OyAvLyBuYW1lc3BhY2UgYW5kcm9pZAorCisjZW5kaWYgLy8gX01UUF9TVE9SQUdFX0gKZGlmZiAtLWdpdCBhL21lZGlhL210cC9NdHBTdG9yYWdlSW5mby5jcHAgYi9tZWRpYS9tdHAvTXRwU3RvcmFnZUluZm8uY3BwCm5ldy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NlLgorICovCisKKyNpZm5kZWYgX01UUF9TVE9SQUdFX0lORk9fSAorI2RlZmluZSBfTVRQX1NUT1JBR0VfSU5GT19ICisKKyNpbmNsdWRlICJNdHBUeXBlcy5oIgorCituYW1lc3BhY2UgYW5kcm9pZCB7CisKK2NsYXNzIE10cERhdGFQYWNrZXQ7CisKK2NsYXNzIE10cFN0b3JhZ2VJbmZvIHsKK3B1YmxpYzoKKyAgICBNdHBTdG9yYWdlSUQgICAgICAgIG1TdG9yYWdlSUQ7CisgICAgdWludDE2X3QgICAgICAgICAgICBtU3RvcmFnZVR5cGU7CisgICAgdWludDE2X3QgICAgICAgICAgICBtRmlsZVN5c3RlbVR5cGU7CisgICAgdWludDE2X3QgICAgICAgICAgICBtQWNjZXNzQ2FwYWJpbGl0eTsKKyAgICB1aW50NjRfdCAgICAgICAgICAgIG1NYXhDYXBhY2l0eTsKKyAgICB1aW50NjRfdCAgICAgICAgICAgIG1GcmVlU3BhY2VCeXRlczsKKyAgICB1aW50MzJfdCAgICAgICAgICAgIG1GcmVlU3BhY2VPYmplY3RzOworICAgIGNoYXIqICAgICAgICAgICAgICAgbVN0b3JhZ2VEZXNjcmlwdGlvbjsKKyAgICBjaGFyKiAgICAgICAgICAgICAgIG1Wb2x1bWVJZGVudGlmaWVyOworCitwdWJsaWM6CisgICAgICAgICAgICAgICAgICAgICAgICBNdHBTdG9yYWdlSW5mbyhNdHBTdG9yYWdlSUQgaWQpOworICAgIHZpcnR1YWwgICAgICAgICAgICAgfk10cFN0b3JhZ2VJbmZvKCk7CisKKyAgICB2b2lkICAgICAgICAgICAgICAgIHJlYWQoTXRwRGF0YVBhY2tldCYgcGFja2V0KTsKKworICAgIHZvaWQgICAgICAgICAgICAgICAgcHJpbnQoKTsKK307CisKK307IC8vIG5hbWVzcGFjZSBhbmRyb2lkCisKKyNlbmRpZiAvLyBfTVRQX1NUT1JBR0VfSU5GT19ICmRpZmYgLS1naXQgYS9tZWRpYS9tdHAvTXRwU3RyaW5nQ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CisgICAgY2hhciBjaDsKKyAgICB3aGlsZSAoKGNoID0gKnNyYysrKSAhPSAwKSB7CisgICAgICAgIGlmICgoY2ggJiAweDgwKSA9PSAwKSB7CisgICAgICAgICAgICAvLyBzaW5nbGUgYnl0ZSBjaGFyYWN0ZXIKKyAgICAgICAgfSBlbHNlIGlmICgoY2ggJiAweEUwKSA9PSAweEMwKSB7CisgICAgICAgICAgICAvLyB0d28gYnl0ZSBjaGFyYWN0ZXIKKyAgICAgICAgICAgIGlmICghICpzcmMrKykgeworICAgICAgICAgICAgICAgIC8vIGxhc3QgY2hhcmFjdGVyIHdhcyB0cnVuY2F0ZWQsIHNvIGlnbm9yZSBsYXN0IGJ5dGUKKyAgICAgICAgICAgICAgICBsZW5ndGgtLTsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBlbHNlIGlmICgoY2ggJiAweEYwKSA9PSAweEUwKSB7CisgICAgICAgICAgICAvLyAzIGJ5dGUgY2hhcgorICAgICAgICAgICAgaWYgKCEgKnNyYysrKSB7CisgICAgICAgICAgICAgICAgLy8gbGFzdCBjaGFyYWN0ZXIgd2FzIHRydW5jYXRlZCwgc28gaWdub3JlIGxhc3QgYnl0ZQorICAgICAgICAgICAgICAgIGxlbmd0aC0tOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKCEgKnNyYysrKSB7CisgICAgICAgICAgICAgICAgLy8gbGFzdCBjaGFyYWN0ZXIgd2FzIHRydW5jYXRlZCwgc28gaWdub3JlIGxhc3QgdHdvIGJ5dGVzCisgICAgICAgICAgICAgICAgbGVuZ3RoIC09IDI7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgY291bnQrKzsKKyAgICB9CisKKyAgICBtQnl0ZUNvdW50ID0gbGVuZ3RoICsgMTsKKyAgICBtQnVmZmVyW2xlbmd0aF0gPSAwOworICAgIG1DaGFyQ291bnQgPSBjb3VudDsKK30KKwordm9pZCBNdHBTdHJpbmdCdWZmZXI6OnJlYWRGcm9tUGFja2V0KE10cERhdGFQYWNrZXQqIHBhY2tldCkgeworICAgIGludCBjb3VudCA9IHBhY2tldC0+Z2V0VUludDgoKTsKKyAgICB1aW50OF90KiBkZXN0ID0gbUJ1ZmZlcjsKKyAgICBmb3IgKGludCBpID0gMDsgaSA8IGNvdW50OyBpKyspIHsKKyAgICAgICAgdWludDE2X3QgY2ggPSBwYWNrZXQtPmdldFVJbnQxNigpOworICAgICAgICBpZiAoY2ggPj0gMHgwODAwKSB7CisgICAgICAgICAgICAqZGVzdCsrID0gKHVpbnQ4X3QpKDB4RTAgfCAoY2ggPj4gMTIpKTsKKyAgICAgICAgICAgICpkZXN0KysgPSAodWludDhfdCkoMHg4MCB8ICgoY2ggPj4gNikgJiAweDNGKSk7CisgICAgICAgICAgICAqZGVzdCsrID0gKHVpbnQ4X3QpKDB4ODAgfCAoY2ggJiAweDNGKSk7CisgICAgICAgIH0gZWxzZSBpZiAoY2ggPj0gMHg4MCkgeworICAgICAgICAgICAgKmRlc3QrKyA9ICh1aW50OF90KSgweEMwIHwgKGNoID4+IDYpKTsKKyAgICAgICAgICAgICpkZXN0KysgPSAodWludDhfdCkoMHg4MCB8IChjaCAmIDB4M0YpKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICpkZXN0KysgPSBjaDsKKyAgICAgICAgfQorICAgIH0KKyAgICAqZGVzdCsrID0gMDsKKyAgICBtQ2hhckNvdW50ID0gY291bnQ7CisgICAgbUJ5dGVDb3VudCA9IGRlc3QgLSBtQnVmZmVyOworfQorCit2b2lkIE10cFN0cmluZ0J1ZmZlcjo6d3JpdGVUb1BhY2tldChNdHBEYXRhUGFja2V0KiBwYWNrZXQpIGNvbnN0IHsKKyAgICBpbnQgY291bnQgPSBtQ2hhckNvdW50OworICAgIGNvbnN0IHVpbnQ4X3QqIHNyYyA9IG1CdWZmZXI7CisgICAgcGFja2V0LT5wdXRVSW50OChjb3VudCA+IDAgPyBjb3VudCArIDEgOiAwKTsKKworICAgIC8vIGV4cGFuZCB1dGY4IHRvIDE2IGJpdCBjaGFycworICAgIGZvciAoaW50IGkgPSAwOyBpIDwgY291bnQ7IGkrKykgeworICAgICAgICB1aW50MTZfdCBjaDsKKyAgICAgICAgdWludDE2X3QgY2gxID0gKnNyYysrOworICAgICAgICBpZiAoKGNoMSAmIDB4ODApID09IDApIHsKKyAgICAgICAgICAgIC8vIHNpbmdsZSBieXRlIGNoYXJhY3RlcgorICAgICAgICAgICAgY2ggPSBjaDE7CisgICAgICAgIH0gZWxzZSBpZiAoKGNoMSAmIDB4RTApID09IDB4QzApIHsKKyAgICAgICAgICAgIC8vIHR3byBieXRlIGNoYXJhY3RlcgorICAgICAgICAgICAgdWludDE2X3QgY2gyID0gKnNyYysrOworICAgICAgICAgICAgY2ggPSAoKGNoMSAmIDB4MUYpIDw8IDYpIHwgKGNoMiAmIDB4M0YpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgLy8gdGhyZWUgYnl0ZSBjaGFyYWN0ZXIKKyAgICAgICAgICAgIHVpbnQxNl90IGNoMiA9ICpzcmMrKzsKKyAgICAgICAgICAgIHVpbnQxNl90IGNoMyA9ICpzcmMrKzsKKyAgICAgICAgICAgIGNoID0gKChjaDEgJiAweDBGKSA8PCAxMikgfCAoKGNoMiAmIDB4M0YpIDw8IDYpIHwgKGNoMyAmIDB4M0YpOworICAgICAgICB9CisgICAgICAgIHBhY2tldC0+cHV0VUludDE2KGNoKTsKKyAgICB9CisgICAgLy8gb25seSB0ZXJtaW5hdGUgd2l0aCB6ZXJvIGlmIHN0cmluZyBpcyBub3QgZW1wdHkKKyAgICBpZiAoY291bnQgPiAwKQorICAgICAgICBwYWNrZXQtPnB1dFVJbnQxNigwKTsKK30KKworfSAgLy8gbmFtZXNwYWNlIGFuZHJvaWQKZGlmZiAtLWdpdCBhL21lZGlhL210cC9NdHB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Ul9ICisjZGVmaW5lIF9NVFBfU1RSSU5HX0JVRkZFUl9ICisKKyNpbmNsdWRlIDxzdGRpbnQuaD4KKworbmFtZXNwYWNlIGFuZHJvaWQgeworCitjbGFzcyBNdHBEYXRhUGFja2V0OworCisvLyBSZXByZXNlbnRzIGEgdXRmOCBzdHJpbmcsIHdpdGggYSBtYXhpbXVtIG9mIDI1NSBjaGFyYWN0ZXJzCitjbGFzcyBNdHBTdHJpbmdCdWZmZXIgeworCitwcml2YXRlOgorICAgIC8vIG1heGltdW0gMyBieXRlcy9jaGFyYWN0ZXIsIHdpdGggMSBleHRyYSBmb3IgemVybyB0ZXJtaW5hdGlvbgorICAgIHVpbnQ4X3QgICAgICAgICBtQnVmZmVyWzI1NSAqIDMgKyAxXTsKKyAgICBpbnQgICAgICAgICAgICAgbUNoYXJDb3VudDsKKyAgICBpbnQgICAgICAgICAgICAgbUJ5dGVDb3VudDsKKworcHVibGljOgorICAgICAgICAgICAgICAgICAgICBNdHBTdHJpbmdCdWZmZXIoKTsKKyAgICAgICAgICAgICAgICAgICAgTXRwU3RyaW5nQnVmZmVyKGNvbnN0IGNoYXIqIHNyYyk7CisgICAgICAgICAgICAgICAgICAgIE10cFN0cmluZ0J1ZmZlcihjb25zdCBNdHBTdHJpbmdCdWZmZXImIHNyYyk7CisgICAgdmlydHVhbCAgICAgICAgIH5NdHBTdHJpbmdCdWZmZXIoKTsKKworICAgIHZvaWQgICAgICAgICAgICBzZXQoY29uc3QgY2hhciogc3JjKTsKKworICAgIHZvaWQgICAgICAgICAgICByZWFkRnJvbVBhY2tldChNdHBEYXRhUGFja2V0KiBwYWNrZXQpOworICAgIHZvaWQgICAgICAgICAgICB3cml0ZVRvUGFja2V0KE10cERhdGFQYWNrZXQqIHBhY2tldCkgY29uc3Q7CisKKyAgICBpbmxpbmUgaW50ICAgICAgZ2V0Q2hhckNvdW50KCkgY29uc3QgeyByZXR1cm4gbUNoYXJDb3VudDsgfQorICAgIGlubGluZSBpbnQgICAg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HNlOworICAgIGNvbnN0IGNoYXIqIHRhaWwgPSBkYXRlVGltZSArIDE1OworICAgIC8vIHNraXAgb3B0aW9uYWwgdGVudGggb2Ygc2Vjb25kCisgICAgaWYgKHRhaWxbMF0gPT0gJy4nICYmIHRhaWxbMV0pCisgICAgICAgIHRhaWwgKz0gMjsKKyAgICAvL0ZJWE1FIC0gc3VwcG9ydCArLy1oaG1tCisgICAgYm9vbCB1c2VVVEMgPSAodGFpbFswXSA9PSAnWicpOworCisgICAgLy8gaGFjayB0byBjb21wdXRlIHRpbWV6b25lCisgICAgdGltZV90IGR1bW15OworICAgIGxvY2FsdGltZV9yKCZkdW1teSwgJnRtKTsKKworICAgIHRtLnRtX3NlYyA9IHNlY29uZDsKKyAgICB0bS50bV9taW4gPSBtaW51dGU7CisgICAgdG0udG1faG91ciA9IGhvdXI7CisgICAgdG0udG1fbWRheSA9IGRheTsKKyAgICB0bS50bV9tb24gPSBtb250aDsKKyAgICB0bS50bV95ZWFyID0geWVhciAtIDE5MDA7CisgICAgdG0udG1fd2RheSA9IDA7CisgICAgdG0udG1faXNkc3QgPSAtMTsKKyAgICBpZiAodXNlVVRDKQorICAgICAgICBvdXRTZWNvbmRzID0gbWt0aW1lKCZ0bSk7CisgICAgZWxzZQorICAgICAgICBvdXRTZWNvbmRzID0gbWt0aW1lX3R6KCZ0bSwgdG0udG1fem9uZSk7CisKKyAgICByZXR1cm4gdHJ1ZTsKK30KKwordm9pZCBmb3JtYXREYXRlVGltZSh0aW1lX3Qgc2Vjb25kcywgY2hhciogYnVmZmVyLCBpbnQgYnVmZmVyTGVuZ3RoKSB7CisgICAgc3RydWN0IHRtIHRtOworCisgICAgbG9jYWx0aW1lX3IoJnNlY29uZHMsICZ0bSk7CisgICAgc25wcmludGYoYnVmZmVyLCBidWZmZXJMZW5ndGgsICIlMDRkJTAyZCUwMmRUJTAyZCUwMmQlMDJkIiwKKyAgICAgICAgdG0udG1feWVhciArIDE5MDAsIHRtLnRtX21vbiwgdG0ud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aW50ZWdlcnMKKyNkZWZpbmUgTVRQX1RZUEVfQUlOVDEyOCAgICAgICAgMHg0MDA5ICAgICAgICAgIC8vIEFycmF5IG9mIHNpZ25lZCAxMjgtYml0IGludGVnZXJzCisjZGVmaW5lIE1UUF9UWVBFX0FVSU5UMTI4ICAgICAgIDB4NDAwQSAgICAgICAgICAvLyBBcnJheSBvZiB1bnNpZ25lZCAxMjgtYml0IGludGVnZXJzCisjZGVmaW5lIE1UUF9UWVBFX1NUUiAgICAgICAgICAgIDB4RkZGRiAgICAgICAgICAvLyBWYXJpYWJsZS1sZW5ndGggVW5pY29kZSBzdHJpbmcKKworLy8gTVRQIEZvcm1hdCBDb2RlcworI2RlZmluZSBNVFBfRk9STUFUX1VOREVGSU5FRCAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDMwMDAgICAvLyBVbmRlZmluZWQgb2JqZWN0CisjZGVmaW5lIE1UUF9GT1JNQVRfQVNTT0NJQVRJT04gICAgICAgICAgICAgICAgICAgICAgICAgIDB4MzAwMSAgIC8vIEFzc29jaWF0aW9uIChmb3IgZXhhbXBsZSwgYSBmb2xkZXIpCisjZGVmaW5lIE1UUF9GT1JNQVRfU0NSSVBUICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4MzAwMiAgIC8vIERldmljZSBtb2RlbC1zcGVjaWZpYyBzY3JpcHQKKyNkZWZpbmUgTVRQX0ZPUk1BVF9FWEVDVVRBQkxFICAgICAgICAgICAgICAgICAgICAgICAgICAgMHgzMDAzICAgLy8gRGV2aWNlIG1vZGVsLXNwZWNpZmljIGJpbmFyeSBleGVjdXRhYmxlCisjZGVmaW5lIE1UUF9GT1JNQVRfVEVYVCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4MzAwNCAgIC8vIFRleHQgZmlsZQorI2RlZmluZSBNVFBfRk9STUFUX0hUTUwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDMwMDUgICAvLyBIeXBlcnRleHQgTWFya3VwIExhbmd1YWdlIGZpbGUgKHRleHQpCisjZGVmaW5lIE1UUF9GT1JNQVRfRFBPRiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4MzAwNiAgIC8vIERpZ2l0YWwgUHJpbnQgT3JkZXIgRm9ybWF0IGZpbGUgKHRleHQpCisjZGVmaW5lIE1UUF9GT1JNQVRfQUlGRiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4MzAwNyAgIC8vIEF1ZGlvIGNsaXAKKyNkZWZpbmUgTVRQX0ZPUk1BVF9XQVYgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHgzMDA4ICAgLy8gQXVkaW8gY2xpcAorI2RlZmluZSBNVFBfRk9STUFUX01QMyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDMwMDkgICAvLyBBdWRpbyBjbGlwCisjZGVmaW5lIE1UUF9GT1JNQVRfQVZJICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4MzAwQSAgIC8vIFZpZGVvIGNsaXAKKyNkZWZpbmUgTVRQX0ZPUk1BVF9NUEVHICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHgzMDBCICAgLy8gVmlkZW8gY2xpcAorI2RlZmluZSBNVFBfRk9STUFUX0FTRiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDMwMEMgICAvLyBNaWNyb3NvZnQgQWR2YW5jZWQgU3RyZWFtaW5nIEZvcm1hdCAodmlkZW8pCisjZGVmaW5lIE1UUF9GT1JNQVRfREVGSU5FRCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4MzgwMCAgIC8vIFVua25vd24gaW1hZ2Ugb2JqZWN0CisjZGVmaW5lIE1UUF9GT1JNQVRfRVhJRl9KUEVHICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4MzgwMSAgIC8vIEV4Y2hhbmdlYWJsZSBGaWxlIEZvcm1hdCwgSkVJREEgc3RhbmRhcmQKKyNkZWZpbmUgTVRQX0ZPUk1BVF9USUZGX0VQICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHgzODAyICAgLy8gVGFnIEltYWdlIEZpbGUgRm9ybWF0IGZvciBFbGVjdHJvbmljIFBob3RvZ3JhcGh5CisjZGVmaW5lIE1UUF9GT1JNQVRfRkxBU0hQSVggICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4MzgwMyAgIC8vIFN0cnVjdHVyZWQgU3RvcmFnZSBJbWFnZSBGb3JtYXQKKyNkZWZpbmUgTVRQX0ZPUk1BVF9CTVAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHgzODA0ICAgLy8gTWljcm9zb2Z0IFdpbmRvd3MgQml0bWFwIGZpbGUKKyNkZWZpbmUgTVRQX0ZPUk1BVF9DSUZGICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHgzODA1ICAgLy8gQ2Fub24gQ2FtZXJhIEltYWdlIEZpbGUgRm9ybWF0CisjZGVmaW5lIE1UUF9GT1JNQVRfR0lGICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4MzgwNyAgIC8vIEdyYXBoaWNzIEludGVyY2hhbmdlIEZvcm1hdAorI2RlZmluZSBNVFBfRk9STUFUX0pGSUYgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDM4MDggICAvLyBKUEVHIEZpbGUgSW50ZXJjaGFuZ2UgRm9ybWF0CisjZGVmaW5lIE1UUF9GT1JNQVRfQ0QgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4MzgwOSAgIC8vIFBob3RvQ0QgSW1hZ2UgUGFjCisjZGVmaW5lIE1UUF9GT1JNQVRfUElDVCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4MzgwQSAgIC8vIFF1aWNrZHJhdyBJbWFnZSBGb3JtYXQKKyNkZWZpbmUgTVRQX0ZPUk1BVF9QTkcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHgzODBCICAgLy8gUG9ydGFibGUgTmV0d29yayBHcmFwaGljcworI2RlZmluZSBNVFBfRk9STUFUX1RJRkYgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDM4MEQgICAvLyBUYWcgSW1hZ2UgRmlsZSBGb3JtYXQKKyNkZWZpbmUgTVRQX0ZPUk1BVF9USUZGX0lUICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHgzODBFICAgLy8gVGFnIEltYWdlIEZpbGUgRm9ybWF0IGZvciBJbmZvcm1hdGlvbiBUZWNobm9sb2d5IChncmFwaGljIGFydHMpCisjZGVmaW5lIE1UUF9GT1JNQVRfSlAyICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4MzgwRiAgIC8vIEpQRUcyMDAwIEJhc2VsaW5lIEZpbGUgRm9ybWF0CisjZGVmaW5lIE1UUF9GT1JNQVRfSlBYICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4MzgxMCAgIC8vIEpQRUcyMDAwIEV4dGVuZGVkIEZpbGUgRm9ybWF0CisjZGVmaW5lIE1UUF9GT1JNQVRfVU5ERUZJTkVEX0ZJUk1XQVJFICAgICAgICAgICAgICAgICAgIDB4QjgwMgorI2RlZmluZSBNVFBfRk9STUFUX1dJTkRPV1NfSU1BR0VfRk9STUFUICAgICAgICAgICAgICAgICAweEI4ODEKKyNkZWZpbmUgTVRQX0ZPUk1BVF9VTkRFRklORURfQVVESU8gICAgICAgICAgICAgICAgICAgICAgMHhCOTAwCisjZGVmaW5lIE1UUF9GT1JNQVRfV01BICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4QjkwMQorI2RlZmluZSBNVFBfRk9STUFUX09HRyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweEI5MDIKKyNkZWZpbmUgTVRQX0ZPUk1BVF9BQUMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhCOTAzCisjZGVmaW5lIE1UUF9GT1JNQVRfQVVESUJMRSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4QjkwNAorI2RlZmluZSBNVFBfRk9STUFUX0ZMQUMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweEI5MDYKKyNkZWZpbmUgTVRQX0ZPUk1BVF9VTkRFRklORURfVklERU8gICAgICAgICAgICAgICAgICAgICAgMHhCOTgwCisjZGVmaW5lIE1UUF9GT1JNQVRfV01WICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4Qjk4MQorI2RlZmluZSBNVFBfRk9STUFUX01QNF9DT05UQUlORVIgICAgICAgICAgICAgICAgICAgICAgICAweEI5ODIgIC8vIElTTyAxNDQ5Ni0xCisjZGVmaW5lIE1UUF9GT1JNQVRfTVAyICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4Qjk4MworI2RlZmluZSBNVFBfRk9STUFUXzNHUF9DT05UQUlORVIgICAgICAgICAgICAgICAgICAgICAgICAweEI5ODQgIC8vIDNHUFAgZmlsZSBmb3JtYXQuIERldGFpbHM6IGh0dHA6Ly93d3cuM2dwcC5vcmcvZnRwL1NwZWNzL2h0bWwtaW5mby8yNjI0NC5odG0gKHBhZ2UgdGl0bGUgLSBcdTIwMWNUcmFuc3BhcmVudCBlbmQtdG8tZW5kIHBhY2tldCBzd2l0Y2hlZCBzdHJlYW1pbmcgc2VydmljZSwgM0dQUCBmaWxlIGZvcm1hdFx1MjAxZCkuCisjZGVmaW5lIE1UUF9GT1JNQVRfVU5ERUZJTkVEX0NPTExFQ1RJT04gICAgICAgICAgICAgICAgIDB4QkEwMAorI2RlZmluZSBNVFBfRk9STUFUX0FCU1RSQUNUX01VTFRJTUVESUFfQUxCVU0gICAgICAgICAgICAweEJBMDEKKyNkZWZpbmUgTVRQX0ZPUk1BVF9BQlNUUkFDVF9JTUFHRV9BTEJVTSAgICAgICAgICAgICAgICAgMHhCQTAyCisjZGVmaW5lIE1UUF9GT1JNQVRfQUJTVFJBQ1RfQVVESU9fQUxCVU0gICAgICAgICAgICAgICAg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AgICAgICAgICAgICAgICAgICAgICAweEJBMTMKKyNkZWZpbmUgTVRQX0ZPUk1BVF9QTFNfUExBWUxJU1QgICAgICAgICAgICAgICAgICAgICAgICAgMHhCQTE0CisjZGVmaW5lIE1UUF9GT1JNQVRfVU5ERUZJTkVEX0RPQ1VNRU5UICAgICAgICAgICAgICAgICAgIDB4QkE4MAorI2RlZmluZSBNVFBfRk9STUFUX0FCU1RSQUNUX0RPQ1VNRU5UICAgICAgICAgICAgICAgICAgICAweEJBODEKKyNkZWZpbmUgTVRQX0ZPUk1BVF9YTUxfRE9DVU1FTlQgICAgICAgICAgICAgICAgICAgICAgICAgMHhCQTgyCisjZGVmaW5lIE1UUF9GT1JNQVRfTVNfV09SRF9ET0NVTUVOVCAgICAgICAgICAgICAgICAgICAgIDB4QkE4MworI2RlZmluZSBNVFBfRk9STUFUX01IVF9DT01QSUxFRF9IVE1MX0RPQ1VNRU5UICAgICAgICAgICAweEJBODQKKyNkZWZpbmUgTVRQX0ZPUk1BVF9NU19FWENFTF9TUFJFQURTSEVFVCAgICAgICAgICAgICAgICAgMHhCQTg1CisjZGVmaW5lIE1UUF9GT1JNQVRfTVNfUE9XRVJQT0lOVF9QUkVTRU5UQVRJT04gICAgICAgICAgIDB4QkE4NgorI2RlZmluZSBNVFBfRk9STUFUX1VOREVGSU5FRF9NRVNTQUdFICAgICAgICAgICAgICAgICAgICAweEJCMDAKKyNkZWZpbmUgTVRQX0ZPUk1BVF9BQlNUUkFDVF9NRVNTU0FHRSAgICAgICAgICAgICAgICAgICAgMHhCQjAxCisjZGVmaW5lIE1UUF9GT1JNQVRfVU5ERUZJTkVEX0NPTlRBQ1QgICAgICAgICAgICAgICAgICAgIDB4QkI4MAorI2RlZmluZSBNVFBfRk9STUFUX0FCU1RSQUNUX0NPTlRBQ1QgICAgICAgICAgICAgICAgICAgICAweEJCODEKKyNkZWZpbmUgTVRQX0ZPUk1BVF9WQ0FSRF8yICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhCQjgyCisKKy8vIE1UUCBPYmplY3QgUHJvcGVydHkgQ29kZXMKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1NUT1JBR0VfSUQgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REMwMQorI2RlZmluZSBNVFBfUFJPUEVSVFlfT0JKRUNUX0ZPUk1BVCAgICAgICAgICAgICAgICAgICAgICAgICAgMHhEQzAyCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9QUk9URUNUSU9OX1NUQVRVUyAgICAgICAgICAgICAgICAgICAgICAweERDMDMKKyNkZWZpbmUgTVRQX1BST1BFUlRZX09CSkVDVF9TSVpFICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REMwNAorI2RlZmluZSBNVFBfUFJPUEVSVFlfQVNTT0NJQVRJT05fVFlQRSAgICAgICAgICAgICAgICAgICAgICAgMHhEQzA1CisjZGVmaW5lIE1UUF9QUk9QRVJUWV9BU1NPQ0lBVElPTl9ERVNDICAgICAgICAgICAgICAgICAgICAgICAweERDMDYKKyNkZWZpbmUgTVRQX1BST1BFUlRZX09CSkVDVF9GSUxFX05BTUUgICAgICAgICAgICAgICAgICAgICAgIDB4REMwNworI2RlZmluZSBNVFBfUFJPUEVSVFlfREFURV9DUkVBVEVEICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhEQzA4CisjZGVmaW5lIE1UUF9QUk9QRVJUWV9EQVRFX01PRElGSUVEICAgICAgICAgICAgICAgICAgICAgICAgICAweERDMDkKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0tFWVdPUkRTICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REMwQQorI2RlZmluZSBNVFBfUFJPUEVSVFlfUEFSRU5UX09CSkVDVCAgICAgICAgICAgICAgICAgICAgICAgICAgMHhEQzBCCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9BTExPV0VEX0ZPTERFUl9DT05URU5UUyAgICAgICAgICAgICAgICAweERDMEMKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0hJRERFTiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REMwRAorI2RlZmluZSBNVFBfUFJPUEVSVFlfU1lTVEVNX09CSkVDVCAgICAgICAgICAgICAgICAgICAgICAgICAgMHhEQzBFCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9QRVJTSVNURU5UX1VJRCAgICAgICAgICAgICAgICAgICAgICAgICAweERDNDEKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1NZTkNfSUQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM0MgorI2RlZmluZSBNVFBfUFJPUEVSVFlfUFJPUEVSVFlfQkFHICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhEQzQzCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9OQU1FICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweERDNDQKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0NSRUFURURfQlkgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM0NQorI2RlZmluZSBNVFBfUFJPUEVSVFlfQVJUSVNUICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhEQzQ2CisjZGVmaW5lIE1UUF9QUk9QRVJUWV9EQVRFX0FVVEhPUkVEICAgICAgICAgICAgICAgICAgICAgICAgICAweERDNDcKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0RFU0NSSVBUSU9OICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM0OAorI2RlZmluZSBNVFBfUFJPUEVSVFlfVVJMX1JFRkVSRU5DRSAgICAgICAgICAgICAgICAgICAgICAgICAgMHhEQzQ5CisjZGVmaW5lIE1UUF9QUk9QRVJUWV9MQU5HVUFHRV9MT0NBTEUgICAgICAgICAgICAgICAgICAgICAgICAweERDNEEKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0NPUFlSSUdIVF9JTkZPUk1BVElPTiAgICAgICAgICAgICAgICAgIDB4REM0QgorI2RlZmluZSBNVFBfUFJPUEVSVFlfU09VUkNFICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhEQzRDCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9PUklHSU5fTE9DQVRJT04gICAgICAgICAgICAgICAgICAgICAgICAweERDNEQKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0RBVEVfQURERUQgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM0RQorI2RlZmluZSBNVFBfUFJPUEVSVFlfTk9OX0NPTlNVTUFCTEUgICAgICAgICAgICAgICAgICAgICAgICAgMHhEQzRGCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9DT1JSVVBUX1VOUExBWUFCTEUgICAgICAgICAgICAgICAgICAgICAweERDNTAKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1BST0RVQ0VSX1NFUklBTF9OVU1CRVIgICAgICAgICAgICAgICAgIDB4REM1MQorI2RlZmluZSBNVFBfUFJPUEVSVFlfUkVQUkVTRU5UQVRJVkVfU0FNUExFX0ZPUk1BVCAgICAgICAgICAgMHhEQzgxCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9SRVBSRVNFTlRBVElWRV9TQU1QTEVfU0laRSAgICAgICAgICAgICAweERDODIKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1JFUFJFU0VOVEFUSVZFX1NBTVBMRV9IRUlHSFQgICAgICAgICAgIDB4REM4MworI2RlZmluZSBNVFBfUFJPUEVSVFlfUkVQUkVTRU5UQVRJVkVfU0FNUExFX1dJRFRIICAgICAgICAgICAgMHhEQzg0CisjZGVmaW5lIE1UUF9QUk9QRVJUWV9SRVBSRVNFTlRBVElWRV9TQU1QTEVfRFVSQVRJT04gICAgICAgICAweERDODUKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1JFUFJFU0VOVEFUSVZFX1NBTVBMRV9EQVRBICAgICAgICAgICAgIDB4REM4NgorI2RlZmluZSBNVFBfUFJPUEVSVFlfV0lEVEggICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhEQzg3CisjZGVmaW5lIE1UUF9QUk9QRVJUWV9IRUlHSFQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweERDODgKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0RVUkFUSU9OICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM4OQorI2RlZmluZSBNVFBfUFJPUEVSVFlfUkFUSU5HICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhEQzhBCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9UUkFDSyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweERDOEIKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0dFTlJFICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM4QworI2RlZmluZSBNVFBfUFJPUEVSVFlfQ1JFRElUUyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhEQzhECisjZGVmaW5lIE1UUF9QUk9QRVJUWV9MWVJJQ1MgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweERDOEUKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1NVQlNDUklQVElPTl9DT05URU5UX0lEICAgICAgICAgICAgICAgIDB4REM4RgorI2RlZmluZSBNVFBfUFJPUEVSVFlfUFJPRFVDRURfQlkgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhEQzkwCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9VU0VfQ09VTlQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweERDOTEKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1NLSVBfQ09VTlQgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM5MgorI2RlZmluZSBNVFBfUFJPUEVSVFlfTEFTVF9BQ0NFU1NFRCAgICAgICAgICAgICAgICAgICAgICAgICAgMHhEQzkzCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9QQVJFTlRBTF9SQVRJTkcgICAgICAgICAgICAgICAgICAgICAgICAweERDOTQKKyNkZWZpbmUgTVRQX1BST1BFUlRZX01FVEFfR0VOUkUgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM5NQorI2RlZmluZSBNVFBfUFJPUEVSVFlfQ09NUE9TRVIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhEQzk2CisjZGVmaW5lIE1UUF9QUk9QRVJUWV9FRkZFQ1RJVkVfUkFUSU5HICAgICAgICAgICAgICAgICAgICAgICAweERDOTcKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1NVQlRJVExFICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM5OAorI2RlZmluZSBNVFBfUFJPUEVSVFlfT1JJR0lOQUxfUkVMRUFTRV9EQVRFICAgICAgICAgICAgICAgICAgMHhEQzk5CisjZGVmaW5lIE1UUF9QUk9QRVJUWV9BTEJVTV9OQU1FICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweERDOUEKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0FMQlVNX0FSVElTVCAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REM5QgorI2RlZmluZSBNVFBfUFJPUEVSVFlfTU9PRCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhEQzlDCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9EUk1fU1RBVFVTICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweERDOUQKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1NVQl9ERVNDUklQVElPTiAgICAgICAgICAgICAgICAgICAgICAgIDB4REM5RQorI2RlZmluZSBNVFBfUFJPUEVSVFlfSVNfQ1JPUFBFRCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhEQ0QxCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9JU19DT0xPVVJfQ09SUkVDVEVEICAgICAgICAgICAgICAgICAgICAweERDRDIKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0lNQUdFX0JJVF9ERVBUSCAgICAgICAgICAgICAgICAgICAgICAgIDB4RENEMworI2RlZmluZSBNVFBfUFJPUEVSVFlfRl9OVU1CRVIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhEQ0Q0CisjZGVmaW5lIE1UUF9QUk9QRVJUWV9FWFBPU1VSRV9USU1FICAgICAgICAgICAgICAgICAgICAgICAgICAweERDRDUKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0VYUE9TVVJFX0lOREVYICAgICAgICAgICAgICAgICAgICAgICAgIDB4RENENgorI2RlZmluZSBNVFBfUFJPUEVSVFlfVE9UQUxfQklUUkFURSAgICAgICAgICAgICAgICAgICAgICAgICAgMHhERTkxCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9CSVRSQVRFX1RZUEUgICAgICAgICAgICAgICAgICAgICAgICAgICAweERFOTIKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1NBTVBMRV9SQVRFICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REU5MworI2RlZmluZSBNVFBfUFJPUEVSVFlfTlVNQkVSX09GX0NIQU5ORUxTICAgICAgICAgICAgICAgICAgICAgMHhERTk0CisjZGVmaW5lIE1UUF9QUk9QRVJUWV9BVURJT19CSVRfREVQVEggICAgICAgICAgICAgICAgICAgICAgICAweERFOTUKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1NDQU5fVFlQRSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REU5NworI2RlZmluZSBNVFBfUFJPUEVSVFlfQVVESU9fV0FWRV9DT0RFQyAgICAgICAgICAgICAgICAgICAgICAgMHhERTk5CisjZGVmaW5lIE1UUF9QUk9QRVJUWV9BVURJT19CSVRSQVRFICAgICAgICAgICAgICAgICAgICAgICAgICAweERFOUEKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1ZJREVPX0ZPVVJDQ19DT0RFQyAgICAgICAgICAgICAgICAgICAgIDB4REU5QgorI2RlZmluZSBNVFBfUFJPUEVSVFlfVklERU9fQklUUkFURSAgICAgICAgICAgICAgICAgICAgICAgICAgMHhERTlDCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9GUkFNRVNfUEVSX1RIT1VTQU5EX1NFQ09ORFMgICAgICAgICAgICAweERFOUQKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0tFWUZSQU1FX0RJU1RBTkNFICAgICAgICAgICAgICAgICAgICAgIDB4REU5RQorI2RlZmluZSBNVFBfUFJPUEVSVFlfQlVGRkVSX1NJWkUgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhERTlGCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9FTkNPRElOR19RVUFMSVRZICAgICAgICAgICAgICAgICAgICAgICAweERFQTAKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0VOQ09ESU5HX1BST0ZJTEUgICAgICAgICAgICAgICAgICAgICAgIDB4REVBMQorI2RlZmluZSBNVFBfUFJPUEVSVFlfRElTUExBWV9OQU1FICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhEQ0UwCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9CT0RZX1RFWFQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweERDRTEKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1NVQkpFQ1QgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4RENFMgorI2RlZmluZSBNVFBfUFJPUEVSVFlfUFJJT1JJVFkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhEQ0UzCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9HSVZFTl9OQU1FICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweEREMDAKKyNkZWZpbmUgTVRQX1BST1BFUlRZX01JRERMRV9OQU1FUyAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQwMQorI2RlZmluZSBNVFBfUFJPUEVSVFlfRkFNSUxZX05BTUUgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhERDAyCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9QUkVGSVggICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweEREMDMKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1NVRkZJWCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQwNAorI2RlZmluZSBNVFBfUFJPUEVSVFlfUEhPTkVUSUNfR0lWRU5fTkFNRSAgICAgICAgICAgICAgICAgICAgMHhERDA1CisjZGVmaW5lIE1UUF9QUk9QRVJUWV9QSE9ORVRJQ19GQU1JTFlfTkFNRSAgICAgICAgICAgICAgICAgICAweEREMDYKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0VNQUlMX1BSSU1BUlkgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQwNworI2RlZmluZSBNVFBfUFJPUEVSVFlfRU1BSUxfUEVSU09OQUxfMSAgICAgICAgICAgICAgICAgICAgICAgMHhERDA4CisjZGVmaW5lIE1UUF9QUk9QRVJUWV9FTUFJTF9QRVJTT05BTF8yICAgICAgICAgICAgICAgICAgICAgICAweEREMDkKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0VNQUlMX0JVU0lORVNTXzEgICAgICAgICAgICAgICAgICAgICAgIDB4REQwQQorI2RlZmluZSBNVFBfUFJPUEVSVFlfRU1BSUxfQlVTSU5FU1NfMiAgICAgICAgICAgICAgICAgICAgICAgMHhERDBCCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9FTUFJTF9PVEhFUlMgICAgICAgICAgICAgICAgICAgICAgICAgICAweEREMEMKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1BIT05FX05VTUJFUl9QUklNQVJZICAgICAgICAgICAgICAgICAgIDB4REQwRAorI2RlZmluZSBNVFBfUFJPUEVSVFlfUEhPTkVfTlVNQkVSX1BFUlNPTkFMICAgICAgICAgICAgICAgICAgMHhERDBFCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9QSE9ORV9OVU1CRVJfUEVSU09OQUxfMiAgICAgICAgICAgICAgICAweEREMEYKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1BIT05FX05VTUJFUl9CVVNJTkVTUyAgICAgICAgICAgICAgICAgIDB4REQxMAorI2RlZmluZSBNVFBfUFJPUEVSVFlfUEhPTkVfTlVNQkVSX0JVU0lORVNTXzIgICAgICAgICAgICAgICAgMHhERDExCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9QSE9ORV9OVU1CRVJfTU9CSUxFICAgICAgICAgICAgICAgICAgICAweEREMTIKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1BIT05FX05VTUJFUl9NT0JJTEVfMiAgICAgICAgICAgICAgICAgIDB4REQxMworI2RlZmluZSBNVFBfUFJPUEVSVFlfRkFYX05VTUJFUl9QUklNQVJZICAgICAgICAgICAgICAgICAgICAgMHhERDE0CisjZGVmaW5lIE1UUF9QUk9QRVJUWV9GQVhfTlVNQkVSX1BFUlNPTkFMICAgICAgICAgICAgICAgICAgICAweEREMTUKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0ZBWF9OVU1CRVJfQlVTSU5FU1MgICAgICAgICAgICAgICAgICAgIDB4REQxNgorI2RlZmluZSBNVFBfUFJPUEVSVFlfUEFHRVJfTlVNQkVSICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhERDE3CisjZGVmaW5lIE1UUF9QUk9QRVJUWV9QSE9ORV9OVU1CRVJfT1RIRVJTICAgICAgICAgICAgICAgICAgICAweEREMTgKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1BSSU1BUllfV0VCX0FERFJFU1MgICAgICAgICAgICAgICAgICAgIDB4REQxOQorI2RlZmluZSBNVFBfUFJPUEVSVFlfUEVSU09OQUxfV0VCX0FERFJFU1MgICAgICAgICAgICAgICAgICAgMHhERDFBCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9CVVNJTkVTU19XRUJfQUREUkVTUyAgICAgICAgICAgICAgICAgICAweEREMUIKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0lOU1RBTlRfTUVTU0FOR0VSX0FERFJFU1MgICAgICAgICAgICAgIDB4REQxQworI2RlZmluZSBNVFBfUFJPUE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VTSU5FU1NfQ0lUWSAgICAgICAgICAgMHhERDI5CisjZGVmaW5lIE1UUF9QUk9QRVJUWV9QT1NUQUxfQUREUkVTU19CVVNJTkVTU19SRUdJT04gICAgICAgICAweEREMkEKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1BPU1RBTF9BRERSRVNTX0JVU0lORVNTX1BPU1RBTF9DT0RFICAgIDB4REQyQgorI2RlZmluZSBNVFBfUFJPUEVSVFlfUE9TVEFMX0FERFJFU1NfQlVTSU5FU1NfQ09VTlRSWSAgICAgICAgMHhERDJDCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9QT1NUQUxfQUREUkVTU19PVEhFUl9GVUxMICAgICAgICAgICAgICAweEREMkQKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1BPU1RBTF9BRERSRVNTX09USEVSX0xJTkVfMSAgICAgICAgICAgIDB4REQyRQorI2RlZmluZSBNVFBfUFJPUEVSVFlfUE9TVEFMX0FERFJFU1NfT1RIRVJfTElORV8yICAgICAgICAgICAgMHhERDJGCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9QT1NUQUxfQUREUkVTU19PVEhFUl9DSVRZICAgICAgICAgICAgICAweEREMzAKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1BPU1RBTF9BRERSRVNTX09USEVSX1JFR0lPTiAgICAgICAgICAgIDB4REQzMQorI2RlZmluZSBNVFBfUFJPUEVSVFlfUE9TVEFMX0FERFJFU1NfT1RIRVJfUE9TVEFMX0NPREUgICAgICAgMHhERDMyCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9QT1NUQUxfQUREUkVTU19PVEhFUl9DT1VOVFJZICAgICAgICAgICAweEREMzMKKyNkZWZpbmUgTVRQX1BST1BFUlRZX09SR0FOSVpBVElPTl9OQU1FICAgICAgICAgICAgICAgICAgICAgIDB4REQzNAorI2RlZmluZSBNVFBfUFJPUEVSVFlfUEhPTkVUSUNfT1JHQU5JWkFUSU9OX05BTUUgICAgICAgICAgICAgMHhERDM1CisjZGVmaW5lIE1UUF9QUk9QRVJUWV9ST0xFICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweEREMzYKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0JJUlRIREFURSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQzNworI2RlZmluZSBNVFBfUFJPUEVSVFlfTUVTU0FHRV9UTyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhERDQwCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9NRVNTQUdFX0NDICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweERENDEKKyNkZWZpbmUgTVRQX1BST1BFUlRZX01FU1NBR0VfQkNDICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ0MgorI2RlZmluZSBNVFBfUFJPUEVSVFlfTUVTU0FHRV9SRUFEICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhERDQzCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9NRVNTQUdFX1JFQ0VJVkVEX1RJTUUgICAgICAgICAgICAgICAgICAweERENDQKKyNkZWZpbmUgTVRQX1BST1BFUlRZX01FU1NBR0VfU0VOREVSICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ0NQorI2RlZmluZSBNVFBfUFJPUEVSVFlfQUNUSVZJVFlfQkVHSU5fVElNRSAgICAgICAgICAgICAgICAgICAgMHhERDUwCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9BQ1RJVklUWV9FTkRfVElNRSAgICAgICAgICAgICAgICAgICAgICAweERENTEKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0FDVElWSVRZX0xPQ0FUSU9OICAgICAgICAgICAgICAgICAgICAgIDB4REQ1MgorI2RlZmluZSBNVFBfUFJPUEVSVFlfQUNUSVZJVFlfUkVRVUlSRURfQVRURU5ERUVTICAgICAgICAgICAgMHhERDU0CisjZGVmaW5lIE1UUF9QUk9QRVJUWV9BQ1RJVklUWV9PUFRJT05BTF9BVFRFTkRFRVMgICAgICAgICAgICAweERENTUKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0FDVElWSVRZX1JFU09VUkNFUyAgICAgICAgICAgICAgICAgICAgIDB4REQ1NgorI2RlZmluZSBNVFBfUFJPUEVSVFlfQUNUSVZJVFlfQUNDRVBURUQgICAgICAgICAgICAgICAgICAgICAgMHhERDU3CisjZGVmaW5lIE1UUF9QUk9QRVJUWV9BQ1RJVklUWV9URU5UQVRJVkUgICAgICAgICAgICAgICAgICAgICAweERENTgKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0FDVElWSVRZX0RFQ0xJTkVEICAgICAgICAgICAgICAgICAgICAgIDB4REQ1OQorI2RlZmluZSBNVFBfUFJPUEVSVFlfQUNUSVZJVFlfUkVNQUlOREVSX1RJTUUgICAgICAgICAgICAgICAgMHhERDVBCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9BQ1RJVklUWV9PV05FUiAgICAgICAgICAgICAgICAgICAgICAgICAweERENUIKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0FDVElWSVRZX1NUQVRVUyAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ1QworI2RlZmluZSBNVFBfUFJPUEVSVFlfT1dORVIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhERDVECisjZGVmaW5lIE1UUF9QUk9QRVJUWV9FRElUT1IgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweERENUUKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1dFQk1BU1RFUiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ1RgorI2RlZmluZSBNVFBfUFJPUEVSVFlfVVJMX1NPVVJDRSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhERDYwCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9VUkxfREVTVElOQVRJT04gICAgICAgICAgICAgICAgICAgICAgICAweERENjEKKyNkZWZpbmUgTVRQX1BST1BFUlRZX1RJTUVfQk9PS01BUksgICAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ2MgorI2RlZmluZSBNVFBfUFJPUEVSVFlfT0JKRUNUX0JPT0tNQVJLICAgICAgICAgICAgICAgICAgICAgICAgMHhERDYzCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9CWVRFX0JPT0tNQVJLICAgICAgICAgICAgICAgICAgICAgICAgICAweERENjQKKyNkZWZpbmUgTVRQX1BST1BFUlRZX0xBU1RfQlVJTERfREFURSAgICAgICAgICAgICAgICAgICAgICAgIDB4REQ3MAorI2RlZmluZSBNVFBfUFJPUEVSVFlfVElNRV9UT19MSVZFICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhERDcxCisjZGVmaW5lIE1UUF9QUk9QRVJUWV9NRURJQV9HVUlEICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweERENzIKKworLy8gTVRQIERldmljZSBQcm9wZXJ0eSBDb2RlcworI2RlZmluZSBNVFBfREVWSUNFX1BST1BFUlRZX1VOREVGSU5FRCAgICAgICAgICAgICAgICAgICAgICAgMHg1MDAwCisjZGVmaW5lIE1UUF9ERVZJQ0VfUFJPUEVSVFlfQkFUVEVSWV9MRVZFTCAgICAgICAgICAgICAgICAgICAweDUwMDEKKyNkZWZpbmUgTVRQX0RFVklDRV9QUk9QRVJUWV9GVU5DVElPTkFMX01PREUgICAgICAgICAgICAgICAgIDB4NTAwMgorI2RlZmluZSBNVFBfREVWSUNFX1BST1BFUlRZX0lNQUdFX1NJWkUgICAgICAgICAgICAgICAgICAgICAgMHg1MDAzCisjZGVmaW5lIE1UUF9ERVZJQ0VfUFJPUEVSVFlfQ09NUFJFU1NJT05fU0VUVElORyAgICAgICAgICAgICAweDUwMDQKKyNkZWZpbmUgTVRQX0RFVklDRV9QUk9QRVJUWV9XSElURV9CQUxBTkNFICAgICAgICAgICAgICAgICAgIDB4NTAwNQorI2RlZmluZSBNVFBfREVWSUNFX1BST1BFUlRZX1JHQl9HQUlOICAgICAgICAgICAgICAgICAgICAgICAgMHg1MDA2CisjZGVmaW5lIE1UUF9ERVZ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0RFICAgICAgICAgICAgICAweDUwMTMKKyNkZWZpbmUgTVRQX0RFVklDRV9QUk9QRVJUWV9DT05UUkFTVCAgICAgICAgICAgICAgICAgICAgICAgIDB4NTAxNAorI2RlZmluZSBNVFBfREVWSUNFX1BST1BFUlRZX1NIQVJQTkVTUyAgICAgICAgICAgICAgICAgICAgICAgMHg1MDE1CisjZGVmaW5lIE1UUF9ERVZJQ0VfUFJPUEVSVFlfRElHSVRBTF9aT09NICAgICAgICAgICAgICAgICAgICAweDUwMTYKKyNkZWZpbmUgTVRQX0RFVklDRV9QUk9QRVJUWV9FRkZFQ1RfTU9ERSAgICAgICAgICAgICAgICAgICAgIDB4NTAxNworI2RlZmluZSBNVFBfREVWSUNFX1BST1BFUlRZX0JVUlNUX05VTUJFUiAgICAgICAgICAgICAgICAgICAgMHg1MDE4CisjZGVmaW5lIE1UUF9ERVZJQ0VfUFJPUEVSVFlfQlVSU1RfSU5URVJWQUwgICAgICAgICAgICAgICAgICAweDUwMTkKKyNkZWZpbmUgTVRQX0RFVklDRV9QUk9QRVJUWV9USU1FTEFQU0VfTlVNQkVSICAgICAgICAgICAgICAgIDB4NTAxQQorI2RlZmluZSBNVFBfREVWSUNFX1BST1BFUlRZX1RJTUVMQVBTRV9JTlRFUlZBTCAgICAgICAgICAgICAgMHg1MDFCCisjZGVmaW5lIE1UUF9ERVZJQ0VfUFJPUEVSVFlfRk9DVVNfTUVURVJJTkdfTU9ERSAgICAgICAgICAgICAweDUwMUMKKyNkZWZpbmUgTVRQX0RFVklDRV9QUk9QRVJUWV9VUExPQURfVVJMICAgICAgICAgICAgICAgICAgICAgIDB4NTAxRAorI2RlZmluZSBNVFBfREVWSUNFX1BST1BFUlRZX0FSVElTVCAgICAgICAgICAgICAgICAgICAgICAgICAgMHg1MDFFCisjZGVmaW5lIE1UUF9ERVZJQ0VfUFJPUEVSVFlfQ09QWVJJR0hUX0lORk8gICAgICAgICAgICAgICAgICAweDUwMUYKKyNkZWZpbmUgTVRQX0R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kFUSU9OX0NMT1NFX1NFU1NJT04gICAgICAgICAgICAgICAgICAgICAgICAgMHgxMDAzCisjZGVmaW5lIE1UUF9PUEVSQVRJT05fR0VUX1NUT1JBR0VfSURTICAgICAgICAgICAgICAgICAgICAgICAweDEwMDQKKyNkZWZpbmUgTVRQX09QRVJBVElPTl9HRVRfU1RPUkFHRV9JTkZPICAgICAgICAgICAgICAgICAgICAgIDB4MTAwNQorI2RlZmluZSBNVFBfT1BFUkFUSU9OX0dFVF9OVU1fT0JKRUNUUyAgICAgICAgICAgICAgICAgICAgICAgMHgxMDA2CisjZGVmaW5lIE1UUF9PUEVSQVRJT05fR0VUX09CSkVDVF9IQU5ETEVTICAgICAgICAgICAgICAgICAgICAweDEwMDcKKyNkZWZpbmUgTVRQX09QRVJBVElPTl9HRVRfT0JKRUNUX0lORk8gICAgICAgICAgICAgICAgICAgICAgIDB4MTAwOAorI2RlZmluZSBNVFBfT1BFUkFUSU9OX0dFVF9PQkpFQ1QgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHgxMDA5CisjZGVmaW5lIE1UUF9PUEVSQVRJT05fR0VUX1RIVU1CICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDEwMEEKKyNkZWZpbmUgTVRQX09QRVJBVElPTl9ERUxFVEVfT0JKRUNUICAgICAgICAgICAgICAgICAgICAgICAgIDB4MTAwQgorI2RlZmluZSBNVFBfT1BFUkFUSU9OX1NFTkRfT0JKRUNUX0lORk8gICAgICAgICAgICAgICAgICAgICAgMHgxMDBDCisjZGVmaW5lIE1UUF9PUEVSQVRJT05fU0VORF9PQkpFQ1QgICAgICAgICAgICAgICAgICAgICAgICAgICAweDEwMEQKKyNkZWZpbmUgTVRQX09QRVJBVElPTl9JTklUSUFURV9DQVBUVVJFICAgICAgICAgICAgICAgICAgICAgIDB4MTAwRQorI2RlZmluZSBNVFBfT1BFUkFUSU9OX0ZPUk1BVF9TVE9SRSAgICAgICAgICAgICAgICAgICAgICAgICAgMHgxMDBGCisjZGVmaW5lIE1UUF9PUEVSQVRJT05fUkVTRVRfREVWSUNFICAgICAgICAgICAgICAgICAgICAgICAgICAweDEwMTAKKyNkZWZpbmUgTVRQX09QRVJBVElPTl9TRUxGX1RFU1QgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4MTAxMQorI2RlZmluZSBNVFBfT1BFUkFUSU9OX1NFVF9PQkpFQ1RfUFJPVEVDVElPTiAgICAgICAgICAgICAgICAgMHgxMDEyCisjZGVmaW5lIE1UUF9PUEVSQVRJT05fUE9XRVJfRE9XTiAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDEwMTMKKyNkZWZpbmUgTVRQX09QRVJBVElPTl9HRVRfREVWSUNFX1BST1BfREVTQyAgICAgICAgICAgICAgICAgIDB4MTAxNAorI2RlZmluZSBNVFBfT1BFUkFUSU9OX0dFVF9ERVZJQ0VfUFJPUF9WQUxVRSAgICAgICAgICAgICAgICAgMHgxMDE1CisjZGVmaW5lIE1UUF9PUEVSQVRJT05fU0VUX0RFVklDRV9QUk9QX1ZBTFVFICAgICAgICAgICAgICAgICAweDEwMTYKKyNkZWZpbmUgTVRQX09QRVJBVElPTl9SRVNFVF9ERVZJQ0VfUFJPUF9WQUxVRSAgICAgICAgICAgICAgIDB4MTAxNworI2RlZmluZSBNVFBfT1BFUkFUSU9OX1RFUk1JTkFURV9PUEVOX0NBUFRVUkUgICAgICAgICAgICAgICAgMHgxMDE4CisjZGVmaW5lIE1UUF9PUEVSQVRJT05fTU9WRV9PQkpFQ1QgICAgICAgICAgICAgICAgICAgICAgICAgICAweDEwMTkKKyNkZWZpbmUgTVRQX09QRVJBVElPTl9DT1BZX09CSkVDVCAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4MTAxQQorI2RlZmluZSBNVFBfT1BFUkFUSU9OX0dFVF9QQVJUSUFMX09CSkVDVCAgICAgICAgICAgICAgICAgICAgMHgxMDFCCisjZGVmaW5lIE1UUF9PUEVSQVRJT05fSU5JVElBVEVfT1BFTl9DQVBUVVJFICAgICAgICAgICAgICAgICAweDEwMUMKKyNkZWZpbmUgTVRQX09QRVJBVElPTl9HRVRfT0JKRUNUX1BST1BTX1NVUFBPUlRFRCAgICAgICAgICAgIDB4OTgwMQorI2RlZmluZSBNVFBfT1BFUkFUSU9OX0dFVF9PQkpFQ1RfUFJPUF9ERVNDICAgICAgICAgICAgICAgICAgMHg5ODAyCisjZGVmaW5lIE1UUF9PUEVSQVRJT05fR0VUX09CSkVDVF9QUk9QX1ZBTFVFICAgICAgICAgICAgICAgICAweDk4MDMKKyNkZWZpbmUgTVRQX09QRVJBVElPTl9TRVRfT0JKRUNUX1BST1BfVkFMVUUgICAgICAgICAgICAgICAgIDB4OTgwNAorI2RlZmluZSBNVFBfT1BFUkFUSU9OX0dFVF9PQkpFQ1RfUkVGRVJFTkNFUyAgICAgICAgICAgICAgICAgMHg5ODEwCisjZGVmaW5lIE1UUF9PUEVSQVRJT05fU0VUX09CSkVDVF9SRUZFUkVOQ0VTICAgICAgICAgICAgICAgICAweDk4MTEKKyNkZWZpbmUgTVRQX09QRVJBVElPTl9TS0lQICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDB4OTgyMAorCisvLyBNVFAgUmVzcG9uc2UgQ29kZXMKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX1VOREVGSU5FRCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDIwMDAKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX09LICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDIwMDEKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX0dFTkVSQUxfRVJST1IgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDIwMDIKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX1NFU1NJT05fTk9UX09QRU4gICAgICAgICAgICAgICAgICAgICAgICAgICAweDIwMDMKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX0lOVkFMSURfVFJBTlNBQ1RJT05fSUQgICAgICAgICAgICAgICAgICAgICAweDIwMDQKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX09QRVJBVElPTl9OT1RfU1VQUE9SVEVEICAgICAgICAgICAgICAgICAgICAweDIwMDUKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX1BBUkFNRVRFUl9OT1RfU1VQUE9SVEVEICAgICAgICAgICAgICAgICAgICAweDIwMDYKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX0lOQ09NUExFVEVfVFJBTlNGRVIgICAgICAgICAgICAgICAgICAgICAgICAweDIwMDcKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX0lOVkFMSURfU1RPUkFHRV9JRCAgICAgICAgICAgICAgICAgICAgICAgICAweDIwMDgKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX0lOVkFMSURfT0JKRUNUX0hBTkRMRSAgICAgICAgICAgICAgICAgICAgICAweDIwMDkKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX0RFVklDRV9QUk9QX05PVF9TVVBQT1JURUQgICAgICAgICAgICAgICAgICAweDIwMEEKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX0lOVkFMSURfT0JKRUNUX0ZPUk1BVF9DT0RFICAgICAgICAgICAgICAgICAweDIwMEIKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX1NUT1JBR0VfRlVMTCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDIwMEMKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX09CSkVDVF9XUklURV9QUk9URUNURUQgICAgICAgICAgICAgICAgICAgICAweDIwMEQKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX1NUT1JFX1JFQURfT05MWSAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDIwMEUKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX0FDQ0VTU19ERU5JRUQgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDIwMEYKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX05PX1RIVU1CTkFJTF9QUkVTRU5UICAgICAgICAgICAgICAgICAgICAgICAweDIwMTAKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX1NFTEZfVEVTVF9GQUlMRUQgICAgICAgICAgICAgICAgICAgICAgICAgICAweDIwMTEKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX1BBUlRJQUxfREVMRVRJT04gICAgICAgICAgICAgICAgICAgICAgICAgICAweDIwMTIKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX1NUT1JFX05PVF9BVkFJTEFCTEUgICAgICAgICAgICAgICAgICAgICAgICAweDIwMTMKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX1NQRUNJRklDQVRJT05fQllfRk9STUFUX1VOU1VQUE9SVEVEICAgICAgICAweDIwMTQKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX05PX1ZBTElEX09CSkVDVF9JTkZPICAgICAgICAgICAgICAgICAgICAgICAweDIwMTUKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX0lOVkFMSURfQ09ERV9GT1JNQVQgICAgICAgICAgICAgICAgICAgICAgICAweDIwMTYKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX1VOS05PV05fVkVORE9SX0NPREUgICAgICAgICAgICAgICAgICAgICAgICAweDIwMTcKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX0NBUFRVUkVfQUxSRUFEWV9URVJNSU5BVEVEICAgICAgICAgICAgICAgICAweDIwMTgKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX0RFVklDRV9CVVNZICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAweDIwMTkKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX0lOVkFMSURfUEFSRU5UX09CSkVDVCAgICAgICAgICAgICAgICAgICAgICAweDIwMUEKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX0lOVkFMSURfREVWSUNFX1BST1BfRk9STUFUICAgICAgICAgICAgICAgICAweDIwMUIKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX0lOVkFMSURfREVWSUNFX1BST1BfVkFMVUUgICAgICAgICAgICAgICAgICAweDIwMUMKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX0lOVkFMSURfUEFSQU1FVEVSICAgICAgICAgICAgICAgICAgICAgICAgICAweDIwMUQKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX1NFU1NJT05fQUxSRUFEWV9PUEVOICAgICAgICAgICAgICAgICAgICAgICAweDIwMUUKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX1RSQU5TQUNUSU9OX0NBTkNFTExFRCAgICAgICAgICAgICAgICAgICAgICAweDIwMUYKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX1NQRUNJRklDQVRJT05fT0ZfREVTVElOQVRJT05fVU5TVVBQT1JURUQgICAweDIwMjAKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX0lOVkFMSURfT0JKRUNUX1BST1BfQ09ERSAgICAgICAgICAgICAgICAgICAweEE4MDEKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX0lOVkFMSURfT0JKRUNUX1BST1BfRk9STUFUICAgICAgICAgICAgICAgICAweEE4MDIKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX0lOVkFMSURfT0JKRUNUX1BST1BfVkFMVUUgICAgICAgICAgICAgICAgICAweEE4MDMKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX0lOVkFMSURfT0JKRUNUX1JFRkVSRU5DRSAgICAgICAgICAgICAgICAgICAweEE4MDQKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX0dST1VQX05PVF9TVVBQT1JURUQgICAgICAgICAgICAgICAgICAgICAgICAweEE4MDUKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX0lOVkFMSURfREFUQVNFVCAgICAgICAgICAgICAgICAgICAgICAgICAgICAweEE4MDYKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX1NQRUNJRklDQVRJT05fQllfR1JPVVBfVU5TVVBQT1JURUQgICAgICAgICAweEE4MDcKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX1NQRUNJRklDQVRJT05fQllfREVQVEhfVU5TVVBQT1JURUQgICAgICAgICAweEE4MDgKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX09CSkVDVF9UT09fTEFSR0UgICAgICAgICAgICAgICAgICAgICAgICAgICAweEE4MDkKKyNkZWZpbmUgTVRQX1JFU1BPTlNFX09CSkVDVF9QUk9QX05PVF9TVVBQT1JURUQgICAgICAgICAgICAgICAgICAweEE4MEEKKworLy8gTVRQIEV2ZW50IENvZGVzCisjZGVmaW5lIE1UUF9FVkVOVF9VTkRFRklORUQgICAgICAgICAgICAgICAgICAgICAgICAgMHg0MDAwCisjZGVmaW5lIE1UUF9FVkVOVF9DQU5DRUxfVFJBTlNBQ1RJT04gICAgICAgICAgICAgICAgMHg0MDAxCisjZGVmaW5lIE1UUF9FVkVOVF9PQkpFQ1RfQURERUQgICAgICAgICAgICAgICAgICAgICAgMHg0MDAyCisjZGVmaW5lIE1UUF9FVkVOVF9PQkpFQ1RfUkVNT1ZFRCAgICAgICAgICAgICAgICAgICAgMHg0MDAzCisjZGVmaW5lIE1UUF9FVkVOVF9TVE9SRV9BRERFRCAgICAgICAgICAgICAgICAgICAgICAgMHg0MDA0CisjZGVmaW5lIE1UUF9FVkVOVF9TVE9SRV9SRU1PVkVEICAgICAgICAgICAgICAgICAgICAgMHg0MDA1CisjZGVmaW5lIE1UUF9FVkVOVF9ERVZJQ0VfUFJPUF9DSEFOR0VEICAgICAgICAgICAgICAgMHg0MDA2CisjZGVmaW5lIE1UUF9FVkVOVF9PQkpFQ1RfSU5GT19DSEFOR0VEICAgICAgICAgICAgICAgMHg0MDA3CisjZGVmaW5lIE1UUF9FVkVOVF9ERVZJQ0VfSU5GT19DSEFOR0VEICAgICAgICAgICAgICAgMHg0MDA4CisjZGVmaW5lIE1UUF9FVkVOVF9SRVFVRVNUX09CSkVDVF9UUkFOU0ZFUiAgICAgICAgICAgMHg0MDA5CisjZGVmaW5lIE1UUF9FVkVOVF9TVE9SRV9GVUxMICAgICA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ICAgICAgIG5ldyBTdHJpbmdbXSB7IE10cC5EZXZpY2UuX0lELCBNdHAuRGV2aWNlLk1BTlVGQUNUVVJFUiwgTXRwLkRldmljZS5NT0RFTCB9OworCisgICAgQE92ZXJyaWRlCisgICAgcHJvdGVjdGVkIHZvaWQgb25DcmVhdGUoQnVuZGxlIHNhdmVkSW5zdGFuY2VTdGF0ZSkgeworICAgICAgICBzdXBlci5vbkNyZWF0ZShzYXZlZEluc3RhbmNlU3RhdGUpOworICAgICAgICBtUmVzb2x2ZXIgPSBnZXRDb250ZW50UmVzb2x2ZXIoKTsKKyAgICAgICAgbURldmljZU9ic2VydmVyID0gbmV3IERldmljZU9ic2VydmVyKG5ldyBIYW5kbGVyKCkpOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHByb3RlY3RlZCB2b2lkIG9uUmVzdW1lKCkgeworICAgICAgICBzdXBlci5vblJlc3VtZSgpOworCisgICAgICAgIEN1cnNvciBjID0gZ2V0Q29udGVudFJlc29sdmVyKCkucXVlcnkoTXRwLkRldmljZS5DT05URU5UX1VSSSwKKyAgICAgICAgICAgICAgICBERVZJQ0VfQ09MVU1OUywgbnVsbCwgbnVsbCwgbnVsbCk7CisgICAgICAgIExvZy5kKFRBRywgInF1ZXJ5IHJldHVybmVkICIgKyBjKTsKKyAgICAgICAgc3RhcnRNYW5hZ2luZ0N1cnNvcihjKTsKKyAgICAgICAgbUN1cnNvciA9IGM7CisKKyAgICAgICAgLy8gTWFwIEN1cnNvciBjb2x1bW5zIHRvIHZpZXdzIGRlZmluZWQgaW4gc2ltcGxlX2xpc3RfaXRlbV8yLnhtbAorICAgICAgICBtQWRhcHRlciA9IG5ldyBTaW1wbGVDdXJzb3JBZGFwdGVyKHRoaXMsCisgICAgICAgICAgICAgICAgYW5kcm9pZC5SLmxheW91dC5zaW1wbGVfbGlzdF9pdGVtXzIsIGMsCisgICAgICAgICAgICAgICAgICAgICAgICBuZXcgU3RyaW5nW10geyBNdHAuRGV2aWNlLk1BT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SUQgPSBnZXRJbnRlbnQoKS5nZXRJbnRFeHRyYSgib2JqZWN0IiwgMCk7CisgICAgICAgIGlmIChtRGV2aWNlSUQgIT0gMCAmJiBtU3RvcmFnZUlEICE9IDApIHsKKyAgICAgICAgICAgIEN1cnNvciBjOworICAgICAgICAgICAgVXJpIHVyaTsKKyAgICAgICAgICAgIGlmIChtT2JqZWN0SUQgPT0gMCkgeworICAgICAgICAgICAgICAgIHVyaSA9IE10cC5PYmplY3QuZ2V0Q29udGVudFVyaUZvclN0b3JhZ2VDaGlsZHJlbihtRGV2aWNlSUQsIG1TdG9yYWdlSUQpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICB1cmkgPSBNdHAuT2JqZWN0LmdldENvbnRlbnRVcmlGb3JPYmplY3RDaGlsZHJlbihtRGV2aWNlSUQsIG1PYmplY3RJRCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBMb2cuZChUQUcsICJxdWVyeSAiICsgdXJpKTsKKyAgICAgICAgICAgIGMgPSBnZXRDb250ZW50UmVzb2x2ZXIoKS5xdWVyeSh1cmksIE9CSkVDVF9DT0xVTU5TLCBudWxsLCBudWxsLCBudWxsKTsKKyAgICAgICAgICAgIHN0YXJ0TWFuYWdpbmdDdXJzb3IoYyk7CisgICAgICAgICAgICBtQ3Vyc29yID0gYzsKKworICAgICAgICAgICAgLy8gTWFwIEN1cnNvciBjb2x1bW5zIHRvIHZpZXdzIGRlZmluZWQgaW4gc2ltcGxlX2xpc3RfaXRlbV8xLnhtbAorICAgICAgICAgICAgbUFkYXB0ZXIgPSBuZXcgT2JqZWN0Q3Vyc29yQWRhcHRlcih0aGlzLCBjKTsKKyAgICAgICAgICAgIHNldExpc3RBZGFwdGVyKG1BZGFwdGVyKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHByb3RlY3RlZCB2b2lkIG9uTGlzdEl0ZW1DbGljayhMaXN0VmlldyBsLCBWaWV3IHYsIGludCBwb3NpdGlvbiwgbG9uZyBpZCkgeworICAgICAgICBpbnQgcm93SUQgPSAoaW50KW1BZGFwdGVyLmdldEl0ZW1JZChwb3NpdGlvbik7CisgICAgICAgIEN1cnNvciBjID0gZ2V0Q29udGVudFJlc29sdmVyKCkucXVlcnkoCisgICAgICAgICAgICAgICAgICAgICAgICBNdHAuT2JqZWN0LmdldENvbnRlbnRVcmkobURldmljZUlELCByb3dJRCksCisgICAgICAgICAgICAgICAgICAgICAgICBPQkpFQ1RfQ09MVU1OUywgbnVsbCwgbnVsbCwgbnVsbCk7CisgICAgICAgIExvZy5kKFRBRywgInF1ZXJ5IHJldHVybmVkICIgKyBjICsgIiBjb3VudDogIiArIGMuZ2V0Q291bnQoKSk7CisgICAgICAgIGxvbmcgZm9ybWF0ID0gMDsKKyAgICAgICAgaWYgKGMgIT0gbnVsbCAmJiBjLmdldENvdW50KCkgPT0gMSkgeworICAgICAgICAgICAgYy5tb3ZlVG9GaXJzdCgpOworICAgICAgICAgICAgbG9uZyByb3dJZCA9IGMuZ2V0TG9uZyhJRF9DT0xVTU4pOworICAgICAgICAgICAgU3RyaW5nIG5hbWUgPSBjLmdldFN0cmluZyhOQU1FX0NPTFVNTik7CisgICAgICAgICAgICBmb3JtYXQgPSBjLmdldExvbmcoRk9STUFUX0NPTFVNTik7CisgICAgICAgICAgICBMb2cuZChUQUcsICJyb3dJZDogIiArIHJvd0lkICsgIiBuYW1lOiAiICsgbmFtZSArICIgZm9ybWF0OiAiICsgZm9ybWF0KTsKKyAgICAgICAgfQorICAgICAgICBpZiAoZm9ybWF0ID09IE10cENvbnN0YW50cy5GT1JNQVRfSkZJRikgeworICAgICAgICAgICAgSW50ZW50IGludGVudCA9IG5ldyBJbnRlbnQodGhpcywgT2JqZWN0Vmlld2VyLmNsYXNzKTsKKyAgICAgICAgICAgIGludGVudC5wdXRFeHRyYSgiZGV2aWNlIiwgbURldmljZUlEKTsKKyAgICAgICAgICAgIGludGVudC5wdXRFeHRyYSgic3RvcmFnZSIsIG1TdG9yYWdlSUQpOworICAgICAgICAgICAgaW50ZW50LnB1dEV4dHJhKCJvYmplY3QiLHJvd0lEKTsKKyAgICAgICAgICAgIHN0YXJ0QWN0aXZpdHkoaW50ZW50KTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIEludGVudCBpbnRlbnQgPSBuZXcgSW50ZW50KHRoaXMsIE9iamVjdEJyb3dzZXIuY2xhc3MpOworICAgICAgICAgICAgaW50ZW50LnB1dEV4dHJhKCJkZXZpY2UiLCBtRGV2aWNlSUQpOworICAgICAgICAgICAgaW50ZW50LnB1dEV4dHJhKCJzdG9yYWdlIiwgbVN0b3JhZ2VJRCk7CisgICAgICAgICAgICBpbnRlbnQucHV0RXh0cmEoIm9iamVjdCIsIHJvd0lEKTsKKyAgICAgICAgICAgIHN0YXJ0QWN0aXZpdHkoaW50ZW50KTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgY2xhc3MgT2JqZWN0Q3Vyc29yQWRhcHRlciBleHRlbmRzIFJlc291cmNlQ3Vyc29yQWRhcHRlciB7CisKKyAgICAgICAgcHVibGljIE9iamVjdEN1cnNvckFkYXB0ZXIoQ29udGV4dCBjb250ZXh0LCBDdXJzb3IgYykgeworICAgICAgICAgICAgc3VwZXIoY29udGV4dCwgUi5sYXlvdXQub2JqZWN0X2xpc3QsIGMpOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIGJpbmRWaWV3KFZpZXcgdmlldywgQ29udGV4dCBjb250ZXh0LCBDdXJzb3IgY3Vyc29yKSB7CisgICAgICAgICAgICBJbWFnZVZpZXcgdGh1bWJWaWV3ID0gKEltYWdlVmlldyl2aWV3LmZpbmRWaWV3QnlJZChSLmlkLnRodW1ibmFpbCk7CisgICAgICAgICAgICBUZXh0VmlldyBuYW1lVmlldyA9IChUZXh0Vmlldyl2aWV3LmZpbmRWaWV3QnlJZChSLmlkLm5hbWUpOworCisgICAgICAgICAgICAvLyBnZXQgdGhlIHRodW1ibmFpbAorICAgICAgICAgICAgYnl0ZVtdIHRodW1ibmFpbCA9IGN1cnNvci5nZXRCbG9iKFRIVU1CX0NPTFVNTik7CisgICAgICAgICAgICBpZiAodGh1bWJuYWlsICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBCaXRtYXAgYml0bWFwID0gQml0bWFwRmFjdG9yeS5kZWNvZGVCeXRlQXJyYXkodGh1bWJuYWlsLCAwLCB0aHVtYm5haWwubGVuZ3RoKTsKKyAgICAgICAgICAgICAgICBpZiAoYml0bWFwICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgdGh1bWJWaWV3LnNldEltYWdlQml0bWFwKGJpdG1hcCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvLyBnZXQgdGhlIG5hbWUKKyAgICAgICAgICAgIFN0cmluZyBuYW1lID0gY3Vyc29yLmdldFN0cmluZyhOQU1FX0NPTFVNTik7CisgICAgICAgICAgICBpZiAobmFtZSA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgbmFtZSA9ICIiOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbmFtZVZpZXcuc2V0VGV4dChuYW1lKTsKKyAgICAgICAgfQorICAgIH0KK30KZGlmZiAtLWdpdCBhL21lZGlhL3Rlc3RzL0NhbWVyYUJyb3dzZXIvc3JjL2NvbS9hbmRyb2lkL2NhbWVyYWJyb3dzZXIvT2JqZWN0Vmlld2VyLmphdmEgYi9tZWRpYS90ZXN0cy9DYW1lcmFCcm93c2VyL3NyYy9jb20vYW5kcm9pZC9jYW1lcmFicm93c2VyL09iamVjdFZpZXdlci5qYXZhCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAwMDAwMDAuLmFhNDljZDgKLS0tIC9kZXYvbnVsbAorKysgYi9tZWRpYS90ZXN0cy9DYW1lcmFCcm93c2VyL3NyYy9jb20vYW5kcm9pZC9jYW1lc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ml0eSB7CisKKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBTdHJpbmcgVEFHID0gIk9iamVjdFZpZXdlciI7CisKKyAgICBwcml2YXRlIGludCBtRGV2aWNlSUQ7CisgICAgcHJpdmF0ZSBpbnQgbVN0b3JhZ2VJRDsKKyAgICBwcml2YXRlIGludCBtT2JqZWN0SUQ7CisKKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBTdHJpbmdbXSBPQkpFQ1RfQ09MVU1OUyA9CisgICAgICAgIG5ldyBTdHJpbmdbXSB7ICBNdHAuT2JqZWN0Ll9JRCwKKyAgICAgICAgICAgICAgICAgICAgICAgIE10cC5PYmplY3QuTkFNRSwKKyAgICAgICAgICAgICAgICAgICAgICAgIE10cC5PYmplY3QuU0laRSwKKyAgICAgICAgICAgICAgICAgICAgICAgIE10cC5PYmplY3QuVEhVTUJfV0lEVEgsCisgICAgICAgICAgICAgICAgICAgICAgICBNdHAuT2JqZWN0LlRIVU1CX0hFSUdIVCwKKyAgICAgICAgICAgICAgICAgICAgICAgIE10cC5PYmplY3QuVEhVTUJfU0laRSwKKyAgICAgICAgICAgICAgICAgICAgICAgIE10cC5PYmplY3QuSU1BR0VfV0lEVEgsCisgICAgICAgICAgICAgICAgICAgICAgICBNdHAuT2JqZWN0LklNQUdFX0hFSUdIVCwKKyAgICAgICAgICAgICAgICAgICAgICAgIE10cC5PYmplY3QuSU1BR0VfREVQVEgsCisgICAgICAgICAgICAgICAgICAgICAgICBNdHAuT2JqZWN0LlNFUVVFTkNFX05VTUJFUiwKKyAgICAgICAgICAgICAgICAgICAgICAgIE10cC5PYmplY3QuREFURV9DUkVBVEVELAorICAgICAgICAgICAgICAgICAgICAgICAgTXRwLk9iamVjdC5EQVRFX01PRElGSUVELAorICAgICAgICAgICAgICAgICAgICAgICAgTXRwLk9iamVjdC5LRVlXT1JEUywKKyAgICAgICAgICAgICAgICAgICAgICAgIE10cC5PYmplY3QuVEhVTUIsCisgICAgICAgICAgICAgICAgICAgICAgICB9OworCisgICAgQE92ZXJyaWRlCisgICAgcHJvdGVjdGVkIHZvaWQgb25DcmVhdGUoQnVuZGxlIHNhdmVkSW5zdGFuY2VTdGF0ZSkgeworICAgICAgICBzdXBlci5vbkNyZWF0ZShzYXZlZEluc3RhbmNlU3RhdGUpOworCisgICAgICAgIHNldENvbnRlbnRWaWV3KFIubGF5b3V0Lm9iamVjdF9pbmZvKTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwcm90ZWN0ZWQgdm9pZCBvblJlc3VtZSgpIHsKKyAgICAgICAgc3VwZXIub25SZXN1bWUoKTsKKworICAgICAgICBtRGV2aWNlSUQgPSBnZXRJbnRlbnQoKS5nZXRJbnRFeHRyYSgiZGV2aWNlIiwgMCk7CisgICAgICAgIG1TdG9yYWdlSUQgPSBnZXRJbnRlbnQoKS5nZXRJbnRFeHRyYSgic3RvcmFnZSIsIDApOworICAgICAgICBtT2JqZWN0SUQgPSBnZXRJbnRlbnQoKS5nZXRJbnRFeHRyYSgib2JqZWN0IiwgMCk7CisKKyAgICAgICAgaWYgKG1EZXZpY2VJRCAhPSAwICYmIG1PYmplY3RJRCAhPSAwKSB7CisgICAgICAgIEN1cnNvciBjID0gZ2V0Q29udGVudFJlc29sdmVyKCkucXVlcnkoCisgICAgICAgICAgICAgICAgICAgICAgICBNdHAuT2JqZWN0LmdldENvbnRlbnRVcmkobURldmljZUlELCBtT2JqZWN0SUQpLAorICAgICAgICAgICAgICAgICAgICAgICAgT0JKRUNUX0NPTFVNTlMsIG51bGwsIG51bGwsIG51bGwpOworICAgICAgICAgICAgYy5tb3ZlVG9GaXJzdCgpOworICAgICAgICAgICAgVGV4dFZpZXcgdmlldyA9IChUZXh0VmlldylmaW5kVmlld0J5SWQoUi5pZC5uYW1lKTsKKyAgICAgICAgICAgIHZpZXcuc2V0VGV4dChjLmdldFN0cmluZygxKSk7CisgICAgICAgICAgICB2aWV3ID0gKFRleHRWaWV3KWZpbmRWaWV3QnlJZChSLmlkLnNpemUpOworICAgICAgICAgICAgdmlldy5zZXRUZXh0KExvbmcudG9TdHJpbmcoYy5nZXRMb25nKDIpKSk7CisgICAgICAgICAgICB2aWV3ID0gKFRleHRWaWV3KWZpbmRWaWV3QnlJZChSLmlkLnRodW1iX3dpZHRoKTsKKyAgICAgICAgICAgIHZpZXcuc2V0VGV4dChMb25nLnRvU3RyaW5nKGMuZ2V0TG9uZygzKSkpOworICAgICAgICAgICAgdmlldyA9IChUZXh0VmlldylmaW5kVmlld0J5SWQoUi5pZC50aHVtYl9oZWlnaHQpOworICAgICAgICAgICAgdmlldy5zZXRUZXh0KExvbmcudG9TdHJpbmcoYy5nZXRMb25nKDQpKSk7CisgICAgICAgICAgICB2aWV3ID0gKFRleHRWaWV3KWZpbmRWaWV3QnlJZChSLmlkLnRodW1iX3NpemUpOworICAgICAgICAgICAgdmlldy5zZXRUZXh0KExvbmcudG9TdHJpbmcoYy5nZXRMb25nKDUpKSk7CisgICAgICAgICAgICB2aWV3ID0gKFRleHRWaWV3KWZpbmRWaWV3QnlJZChSLmlkLndpZHRoKTsKKyAgICAgICAgICAgIHZpZXcuc2V0VGV4dChMb25nLnRvU3RyaW5nKGMuZ2V0TG9uZyg2KSkpOworICAgICAgICAgICAgdmlldyA9IChUZXh0VmlldylmaW5kVmlld0J5SWQoUi5pZC5oZWlnaHQpOworICAgICAgICAgICAgdmlldy5zZXRUZXh0KExvbmcudG9TdHJpbmcoYy5nZXRMb25nKDcpKSk7CisgICAgICAgICAgICB2aWV3ID0gKFRleHRWaWV3KWZpbmRWaWV3QnlJZChSLmlkLmRlcHRoKTsKKyAgICAgICAgICAgIHZpZXcuc2V0VGV4dChMb25nLnRvU3RyaW5nKGMuZ2V0TG9uZyg4KSkpOworICAgICAgICAgICAgdmlldyA9IChUZXh0VmlldylmaW5kVmlld0J5SWQoUi5pZC5zZXF1ZW5jZSk7CisgICAgICAgICAgICB2aWV3LnNldFRleHQoTG9uZy50b1N0cmluZyhjLmdldExvbmcoOSkpKTsKKyAgICAgICAgICAgIHZpZXcgPSAoVGV4dFZpZXcpZmluZFZpZXdCeUlkKFIuaWQuY3JlYXRlZCk7CisgICAgICAgICAgICBEYXRlIGRhdGUgPSBuZXcgRGF0ZShjLmdldExvbmcoMTApICogMTAwMCk7CisgICAgICAgICAgICB2aWV3LnNldFRleHQoZGF0ZS50b1N0cmluZygpKTsKKyAgICAgICAgICAgIHZpZXcgPSAoVGV4dFZpZXcpZmluZFZpZXdCeUlkKFIuaWQubW9kaWZpZWQpOworICAgICAgICAgICAgZGF0ZSA9IG5ldyBEYXRlKGMuZ2V0TG9uZygxMSkgKiAxMDAwKTsKKyAgICAgICAgICAgIHZpZXcuc2V0VGV4dChkYXRlLnRvU3RyaW5nKCkpOworICAgICAgICAgICAgdmlldyA9IChUZXh0VmlldylmaW5kVmlld0J5SWQoUi5pZC5rZXl3b3Jkcyk7CisgICAgICAgICAgICB2aWV3LnNldFRleHQoYy5nZXRTdHJpbmcoMTIpKTsKKyAgICAgICAgICAgIGJ5dGVbXSB0aHVtYm5haWwgPSBjLmdldEJsb2IoMTMpOworICAgICAgICAgICAgaWYgKHRodW1ibmFpbCAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgSW1hZ2VWaWV3IHRodW1iVmlldyA9IChJbWFnZVZpZXcpZmluZFZpZXdCeUlkKFIuaWQudGh1bWJuYWlsKTsKKyAgICAgICAgICAgICAgICBCaXRtYXAgYml0bWFwID0gQml0bWFwRmFjdG9yeS5kZWNvZGVCeXRlQXJyYXkodGh1bWJuYWlsLCAwLCB0aHVtYm5haWwubGVuZ3RoKTsKKyAgICAgICAgICAgICAgICBpZiAoYml0bWFwICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgdGh1bWJWaWV3LnNldEltYWdlQml0bWFwKGJpdG1hcCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIGJvb2xlYW4gb25DcmVhdGVPcHRpb25zTWVudShNZW51IG1lbnUpIHsKKyAgICAgICAgTWVudUluZmxhdGVyIGluZmxhdGVyID0gZ2V0TWVudUluZmxhdGVyKCk7CisgICAgICAgIGluZmxhdGVyLmluZmxhdGUoUi5tZW51Lm9iamVjdF9tZW51LCBtZW51KTsKKyAgICAgICAgcmV0dXJuIHRydWU7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIGJvb2xlYW4gb25QcmVwYXJlT3B0aW9uc01lbnUoTWVudSBtZW51KSB7CisgICAgICAgIE1lbnVJdGVtIGl0ZW0gPSBtZW51LmZpbmRJdGVtKFIuaWQuc2F2ZSk7CisgICAgICAgIGl0ZW0uc2V0RW5hYmxlZCh0cnVlKTsKKyAgICAgICAgaXRlbSA9IG1lbnUuZmluZEl0ZW0oUi5pZC5kZWxldGUpOworICAgICAgICBpdGVtLnNldEVuYWJsZWQodHJ1ZSk7CisgICAgICAgIHJldHVybiB0cnVlOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyBib29sZWFuIG9uT3B0aW9uc0l0ZW1TZWxlY3RlZChNZW51SXRlbSBpdGVtKSB7CisgICAgICAgIHN3aXRjaCAoaXRlbS5nZXRJdGVtSWQoKSkgeworICAgICAgICAgICAgY2FzZSBSLmlkLnNhdmU6CisgICAgICAgICAgICAgICAgc2F2ZSgpOworICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgY2FzZSBSLmlkLmRlbGV0ZToKKyAgICAgICAgICAgICAgICBkZWxldGUoKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgcHJpdmF0ZSBzdGF0aWMgU3RyaW5nIGdldFRpbWVzdGFtcCgpIHsKKyAgICAgICAgQ2FsZW5kYXIgYyA9IENhbGVuZGFyLmdldEluc3RhbmNlKCk7CisgICAgICAgIGMuc2V0VGltZUluTWlsbGlzKFN5c3RlbS5jdXJyZW50VGltZU1pbGxpcygpKTsKKyAgICAgICAgcmV0dXJuIFN0cmluZy5mb3JtYXQoIiV0WS0ldG0tJXRkLSV0SC0ldE0tJXRTIiwgYywgYywgYywgYywgYywgYyk7CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIHNhdmUoKSB7CisgICAgICAgIGJvb2xlYW4gc3VjY2VzcyA9IGZhbHNlOworICAgICAgICBVcmkgdXJpID0gTXRwLk9iamVjdC5nZXRDb250ZW50VXJpKG1EZXZpY2VJRCwgbU9iamVjdElEKTsKKyAgICAgICAgRmlsZSBkZXN0RmlsZSA9IG51bGw7CisgICAgICAgIFBhcmNlbEZpbGVEZXNjcmlwdG9yIHBmZCA9IG51bGw7CisgICAgICAgIEZpbGVJbnB1dFN0cmVhbSBmaXMgPSBudWxsOworICAgICAgICBGaWxlT3V0cHV0U3RyZWFtIGZvcyA9IG51bGw7CisKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIHBmZCA9IGdldENvbnRlbnRSZXNvbHZlcigpLm9wZW5GaWxlRGVzY3JpcHRvcih1cmksICJyIik7CisgICAgICAgICAgICBMb2cuZChUQUcsICJzYXZlIGdvdCBwZmQgIiArIHBmZCk7CisgICAgICAgICAgICBpZiAocGZkICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBmaXMgPSBuZXcgRmlsZUlucHV0U3RyZWFtKHBmZC5nZXRGaWxlRGVzY3JpcHRvcigpKTsKKyAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJzYXZlIGdvdCBmaXMgIiArIGZpcyk7CisgICAgICAgICAgICAgICAgRmlsZSBkZXN0RGlyID0gRW52aXJvbm1lbnQuZ2V0RXh0ZXJuYWxTdG9yYWdlUHVibGljRGlyZWN0b3J5KAorICAgICAgICAgICAgICAgICAgICAgICAgRW52aXJvbm1lbnQuRElSRUNUT1JZX0RDSU0pOworICAgICAgICAgICAgICAgIGRlc3REaXIubWtkaXJzKCk7CisgICAgICAgICAgICAgICAgZGVzdEZpbGUgPSBuZXcgRmlsZShkZXN0RGlyLCAiQ2FtZXJhQnJvd3Nlci0iICsgZ2V0VGltZXN0YW1wKCkgKyAiLmpwZWciKTsKKworCisgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAic2F2ZSBnb3QgZGVzdEZpbGUgIiArIGRlc3RGaWxlKTsKKworICAgICAgICAgICAgICAgIGlmIChkZXN0RmlsZS5leGlzdHMoKSkgeworICAgICAgICAgICAgICAgICAgICBkZXN0RmlsZS5kZWxldGUoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZm9zID0gbmV3IEZpbGVPdXRwdXRTdHJlYW0oZGVzdEZpbGUpOworCisgICAgICAgICAgICAgICAgYnl0ZVtdIGJ1ZmZlciA9IG5ldyBieXRlWzY1NTM2XTsKKyAgICAgICAgICAgICAgICBpbnQgYnl0ZXNSZWFkOworICAgICAgICAgICAgICAgIHdoaWxlICgoYnl0ZXNSZWFkID0gZmlzLnJlYWQoYnVmZmVyKSkgPj0gMCkgeworICAgICAgICAgICAgICAgICAgICBmb3Mud3JpdGUoYnVmZmVyLCAwLCBieXRlc1JlYWQpOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIC8vIHRlbXBvcmFyeSB3b3JrYXJvdW5kIHVudGlsIHdlIHN0cmFpZ2h0ZW4gb3V0IHBlcm1pc3Npb25zIGluIC9kYXRhL21lZGlhCisgICAgICAgICAgICAgICAgLy8gMTAxNSBpcyBBSURfU0RDQVJEX1JXCisgICAgICAgICAgICAgICAgRmlsZVV0aWxzLnNldFBlcm1pc3Npb25zKGRlc3REaXIuZ2V0UGF0aCgpLCAwNzc1LCBQcm9jZXNzLm15VWlkKCksIDEwMTUpOworICAgICAgICAgICAgICAgIEZpbGVVdGlscy5zZXRQZXJtaXNzaW9ucyhkZXN0RmlsZS5nZXRQYXRoKCksIDA2NjQsIFByb2Nlc3MubXlVaWQoKSwgMTAxNSk7CisKKyAgICAgICAgICAgICAgICBzdWNjZXNzID0gdHJ1ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBjYXRjaCAoRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIExvZy5lKFRBRywgIkV4Y2VwdGlvbiBpbiBPYmplY3RWaWV3LnNhdmUiLCBlKTsKKyAgICAgICAgfSBmaW5hbGx5IHsKKyAgICAgICAgICAgIGlmIChmaXMgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgIGZpcy5jbG9zZSgpOworICAgICAgICAgICAgICAgIH0gY2F0Y2ggKEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKGZvcyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAgICAgZm9zLmNsb3NlKCk7CisgICAgICAgICAgICAgICAgfSBjYXRjaCAoRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAocGZkICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICBwZmQuY2xvc2UoKTsKKyAgICAgICAgICAgICAgICB9IGNhdGNoIChFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGlmIChzdWNjZXNzKSB7CisgICAgICAgICAgICBJbnRlbnQgaW50ZW50ID0gbmV3IEludGVudChJbnRlbnQuQUNUSU9OX01FRElBX1NDQU5ORVJfU0NBTl9GSUxFKTsKKyAgICAgICAgICAgIGludGVudC5zZXREYXRhKFVyaS5mcm9tRmlsZShkZXN0RmlsZSkpOworICAgICAgICAgICAgc2VuZEJyb2FkY2FzdChpbnRlbnQpOworICAgICAgICAgICAgVG9hc3QubWFrZVRleH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zdGFuY2VTdGF0ZSkgeworICAgICAgICBzdXBlci5vbkNyZWF0ZShzYXZlZEluc3RhbmNlU3RhdGUpOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHByb3RlY3RlZCB2b2lkIG9uUmVzdW1lKCkgeworICAgICAgICBzdXBlci5vblJlc3VtZSgpOworCisgICAgICAgIG1EZXZpY2VJRCA9IGdldEludGVudCgpLmdldEludEV4dHJhKCJkZXZpY2UiLCAwKTsKKyAgICAgICAgaWYgKG1EZXZpY2VJRCAhPSAwKSB7CisgICAgICAgICAgICBDdXJzb3IgYyA9IGdldENvbnRlbnRSZXNvbHZlcigpLnF1ZXJ5KE10cC5TdG9yYWdlLmdldENvbnRlbnRVcmkobURldmljZUlEKSwKKyAgICAgICAgICAgICAgICAgICAgU1RPUkFHRV9DT0xVTU5TLCBudWxsLCBudWxsLCBudWxsKTsKKyAgICAgICAgICAgIExvZy5kKFRBRywgInF1ZXJ5IHJldHVybmVkICIgKyBjKTsKKyAgICAgICAgICAgIHN0YXJ0TWFuYWdpbmdDdXJzb3IoYyk7CisKKyAgICAgICAgICAgIC8vIE1hcCBDdXJzb3IgY29sdW1ucyB0byB2aWV3cyBkZWZpbmVkIGluIHNpbXBsZV9saXN0X2l0ZW1fMS54bWwKKyAgICAgICAgICAgIG1BZGFwdGVyID0gbmV3IFNpbXBsZUN1cnNvckFkYXB0ZXIodGhpcywKKyAgICAgICAgICAgICAgICAgICAgYW5kcm9pZC5SLmxheW91dC5zaW1wbGVfbGlzdF9pdGVtXzEsIGMsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3IFN0cmluZ1tdIHsgTXRwLlN0b3JhZ2UuREVTQ1JJUFRJT04gfSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXcgaW50W10geyBhbmRyb2lkLlIuaWQudGV4dDEsIGFuZHJvaWQuUi5pZC50ZXh0MiB9KTsKKyAgICAgICAgICAgIHNldExpc3RBZGFwdGVyKG1BZGFwdGVyKTsKK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IiOworCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgb25SZWNlaXZlKENvbnRleHQgY29udGV4dCwgSW50ZW50IGludGVudCkgeworICAgICAgICBMb2cuZChUQUcsICJvblJlY2VpdmUgIiArIGludGVudCk7CisgICAgICAgIGlmIChVc2IuQUNUSU9OX1VTQl9DQU1FUkFfQVRUQUNIRUQuZXF1YWxzKGludGVudC5nZXRBY3Rpb24oKSkpIHsKKyAgICAgICAgICAgIFVyaSB1cmkgPSBpbnRlbnQuZ2V0RGF0YSgpOworICAgICAgICAgICAgaW50ZW50ID0gbmV3IEludGVudChjb250ZXh0LCBTdG9yYWdlQnJvd3Nlci5jbGFzcyk7CisgICAgICAgICAgICBpbnRlbnQuc2V0RmxhZ3MoSW50ZW50LkZMQUdfQUNUSVZJVFlfTkVXX1RBU0spOworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAvLyBUT0RPIC0gYWRkIGEgd3JhcHBlciB0byBNdHAuRGV2aWNlIGZvciB0aGlzCisgICAgICAgICAgICAgICAgaW50IGlkID0gSW50ZWdlci5wYXJzZUludCh1cmkuZ2V0UGF0aFNlZ21lbnRzKCkuZ2V0KDEpKTsKKyAgICAgICAgICAgICAgICBpbnRlbnQucHV0RXh0cmEoImRldmljZSIsIGlkKTsKKyAgICAgICAgICAgICAgICBjb250ZXh0LnN0YXJ0QWN0aXZpdHkoaW50ZW50KTsKKyAgICAgICAgICAgIH0gY2F0Y2ggKE51bWJlckZvcm1hdEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgTG9nLmUoVEFHLCAiYmFkIGRldmljZSBVcmkgIiArIHVyaSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9Cit9CmRpZmYgLS1naXQgYS9tZWRpYS90ZXN0cy9tdHAvQW5kcm9pZC5tayBiL21lZGlhL3Rlc3RzL210cC9BbmRyb2lkLm1rCm5ldyBmaWxlIG1vZGUgMTAwNjQ0CmluZGV4IDAw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EZpbGU6Ok10cEZpbGUoTXRwRGV2aWNlKiBkZXZpY2UsIE10cFN0b3JhZ2VJRCBzdG9yYWdlKQorICAgIDogICBtRGV2aWNlKGRldmljZSksCisgICAgICAgIG1TdG9yYWdlKHN0b3JhZ2UpLAorICAgICAgICBtSGFuZGxlKDApCit7Cit9CisKK010cEZpbGU6Ok10cEZpbGUoTXRwRGV2aWNlKiBkZXZpY2UsIE10cFN0b3JhZ2VJRCBzdG9yYWdlLCBNdHBPYmplY3RIYW5kbGUgaGFuZGxlKQorICAgIDogICBtRGV2aWNlKGRldmljZSksCisgICAgICAgIG1TdG9yYWdlKHN0b3JhZ2UpLAorICAgICAgICBtSGFuZGxlKGhhbmRsZSkKK3sKK30KKworTXRwRmlsZTo6TXRwRmlsZShNdHBGaWxlKiBmaWxlKQorICAgIDogICBtRGV2aWNlKGZpbGUtPm1EZXZpY2UpLAorICAgICAgICBtU3RvcmFnZShmaWxlLT5tU3RvcmFnZSksCisgICAgICAgIG1IYW5kbGUoZmlsZS0+bUhhbmRsZSkKK3sKK30KKworTXRwRmlsZTo6fk10cEZpbGUoKSB7Cit9CisKK3ZvaWQgTXRwRmlsZTo6cHJpbnQoKSB7CisgICAgaWYgKG1IYW5kbGUpIHsKKworICAgIH0gZWxzZSBpZiAobVN0b3JhZ2UpIHsKKyAgICAgICAgcHJpbnRmKCIleFxuIiwgbVN0b3JhZ2UpOworICAgIH0gZWxzZSB7CisgICAgICAgIGludCBpZCA9IG1EZXZpY2UtPmdldElEKCk7CisgICAgICAgIE10cERldmljZUluZm8qIGluZm8gPSBtRGV2aWNlLT5nZXREZXZpY2VJbmZvKCk7CisgICAgICAgIGlmIChpbmZvKQorICAgICAgICAgICAgcHJpbnRmKCIlZFx0JXMgJXMgJXNcbiIsIGlkLCBpbmZvLT5tTWFudWZhY3R1cmVyLCBpbmZvLT5tTW9kZWwsIGluZm8tPm1TZXJpYWwpOworICAgICAgICBlbHNlCisgICAgICAgICAgICBwcmludGYoIiVkXHQobm8gZGV2aWNlIGluZm8gYXZhaWxhYmxlKVxuIiwgaWQpOworICAgICAgICBkZWxldGUgaW5mbzsKKyAgICB9Cit9CisKK010cE9iamVjdEluZm8qIE10cEZpbGU6OmdldE9iamVjdEluZm8oKSB7CisgICAgcmV0dXJuIG1EZXZpY2UtPmdldE9iamVjdEluZm8obUhhbmRsZSk7Cit9CisKK3ZvaWQgTXRwRmlsZTo6bGlzdCgpIHsKKyAgICBpZiAobVN0b3JhZ2UpIHsKKyAgICAgICAgTXRwT2JqZWN0SGFuZGxlTGlzdCogaGFuZGxlcyA9IG1EZXZpY2UtPmdldE9iamVjdEhhbmRsZXMobVN0b3JhZ2UsIDAsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAobUhhbmRsZSA/IG1IYW5kbGUgOiAtMSkpOworICAgICAgICBpZiAoaGFuZGxlcykgeworICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBoYW5kbGVzLT5zaXplKCk7IGkrKykgeworICAgICAgICAgICAgICAgIE10cE9iamVjdEhhbmRsZSBoYW5kbGUgPSAoKmhhbmRsZXMpW2ldOworICAgICAgICAgICAgICAgIE10cE9iamVjdEluZm8qIGluZm8gPSBtRGV2aWNlLT5nZXRPYmplY3RJbmZvKGhhbmRsZSk7CisgICAgICAgICAgICAgICAgaWYgKGluZm8pIHsKKyAgICAgICAgICAgICAgICAgICAgY2hhciBtb2RpZmllZFsxMDBdOworICAgICAgICAgICAgICAgICAgICBzdHJ1Y3QgdG0gdG07CisKKyAgICAgICAgICAgICAgICAgICAgZ210aW1lX3IoJmluZm8tPm1EYXRlTW9kaWZpZWQsICZ0bSk7CisgICAgICAgICAgICAgICAgICAgIHN0cmZ0aW1lKG1vZGlmaWVkLCBzaXplb2YobW9kaWZpZWQpLCAiJWEgJWIgJWUgJUg6JU06JVMgR01UICVZIiwgJnRtKTsKKyAgICAgICAgICAgICAgICAgICAgcHJpbnRmKCIlcyBIYW5kbGU6ICVkIEZvcm1hdDogJTA0WCBTaXplOiAlZCBNb2RpZmllZDogJXNcbiIsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW5mby0+bU5hbWUsIGhhbmRsZSwgaW5mby0+bUZvcm1hdCwgaW5mby0+bUNvbXByZXNzZWRTaXplLCBtb2RpZmllZCk7CisgICAgICAgICAgICAgICAgICAgIGRlbGV0ZSBpbmZvOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGRlbGV0ZSBoYW5kbGVzOworICAgICAgICB9CisgICAgfSBlbHNlIHsKKyAgICAgICAgLy8gbGlzdCBzdG9yYWdlIHVuaXRzIGZvciBkZXZpY2UKKyAgICAgICAgTXRwU3RvcmFnZUlETGlzdCogc3RvcmFnZUxpc3QgPSBtRGV2aWNlLT5nZXRTdG9yYWdlSURzKCk7CisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgc3RvcmFnZUxpc3QtPnNpemUoKTsgaSsrKSB7CisgICAgICAgICAgICBNdHBTdG9yYWdlSUQgc3RvcmFnZUlEID0gKCpzdG9yYWdlTGlzdClbaV07CisgICAgICAgICAgICBwcmludGYoIiV4XG4iLCBzdG9yYWdlSUQpOworICAgICAgICB9CisgICAgfQorfQorCit2b2lkIE10cEZpbGU6OmluaXQoTXRwQ2xpZW50KiBjbGllbnQpIHsKKyAgICBzQ2xpZW50ID0gY2xpZW50OworfQorCitNdHBGaWxlKiBNdHBGaWxlOjpwYXJzZVBhdGgoTXRwRmlsZSogYmFzZSwgY2hhciogcGF0aCkgeworICAgIE10cERldmljZSogZGV2aWNlID0gTlVMTDsKKyAgICBNdHBTdG9yYWdlSUQgc3RvcmFnZSA9IDA7CisgICAgTXRwT2JqZWN0SGFuZGxlIGhhbmRsZSA9IDA7CisKKyAgICBpZiAocGF0aFswXSAhPSAnLycgJiYgYmFzZSkgeworICAgICAgICBkZXZpY2UgPSBiYXNlLT5tRGV2aWNlOworICAgICAgICBzdG9yYWdlID0gYmFzZS0+bVN0b3JhZ2U7CisgICAgICAgIGhhbmRsZSA9IGJhc2UtPm1IYW5kbGU7CisgICAgfQorCisgICAgLy8gcGFyc2UgYW4gYWJzb2x1dGUgcGF0aAorICAgIGlmIChwYXRoWzBdID09ICcvJykKKyAgICAgICAgcGF0aCsrOworICAgIGNoYXIqIHRvayA9IHN0cnRvayhwYXRoLCAiLyIpOworICAgIHdoaWxlICh0b2spIHsKKyAgICAgICAgaWYgKHN0b3JhZ2UpIHsKKyAgICAgICAgICAgIC8vIGZpbmQgY2hpbGQgb2YgY3VycmVudCBoYW5kbGUKKyAgICAgICAgICAgIE10cE9iamVjdEhhbmRsZUxpc3QqIGhhbmRsZXMgPSBkZXZpY2UtPmdldE9iamVjdEhhbmRsZXMoc3RvcmFnZSwgMCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoaGFuZGxlID8gaGFuZGxlIDogLTEpKTsKKyAgICAgICAgICAgIE10cE9iamVjdEhhbmRsZSBjaGlsZEhhbmRsZSA9IDA7CisKKyAgICAgICAgICAgIGlmIChoYW5kbGVzKSB7CisgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBoYW5kbGVzLT5zaXplKCkgJiYgIWNoaWxkSGFuZGxlOyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgTXRwT2JqZWN0SGFuZGxlIGhhbmRsZSA9ICgqaGFuZGxlcylbaV07CisgICAgICAgICAgICAgICAgICAgIE10cE9iamVjdEluZm8qIGluZm8gPSBkZXZpY2UtPmdldE9iamVjdEluZm8oaGFuZGxlKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGluZm8gJiYgIXN0cmNtcCh0b2ssIGluZm8tPm1OYW1lKSkKKyAgICAgICAgICAgICAgICAgICAgICAgIGNoaWxkSGFuZGxlID0gaGFuZGxlOworICAgICAgICAgICAgICAgICAgICBkZWxldGUgaW5mbzsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZGVsZXRlIGhhbmRsZXM7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoY2hpbGRIYW5kbGUpCisgICAgICAgICAgICAgICAgaGFuZGxlID0gY2hpbGRIYW5kbGU7CisgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgcmV0dXJuIE5VTEw7CisgICAgICAgIH0gZWxzZSBpZiAoZGV2aWNlKSB7CisgICAgICAgICAgICB1bnNpZ25lZCBpbnQgaWQ7CisgICAgICAgICAgICAvLyBmaW5kIHN0b3JhZ2UgZm9yIHRoZSBkZXZpY2UKKyAgICAgICAgICAgIGlmIChzc2NhbmYodG9rLCAiJXgiLCAmaWQpID09IDEpIHsKKyAgICAgICAgICAgICAgICBNdHBTdG9yYWdlSURMaXN0KiBzdG9yYWdlTGlzdCA9IGRldmljZS0+Z2V0U3RvcmFnZUlEcygpOworICAgICAgICAgICAgICAgIGJvb2wgZm91bmQgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IHN0b3JhZ2VMaXN0LT5zaXplKCk7IGkrKykgeworICAgICAgICAgICAgICAgICAgICBpZiAoKCpzdG9yYWdlTGlzdClbaV0gPT0gaWQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZvdW5kID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGlmIChmb3VuZCkKKyAgICAgICAgICAgICAgICAgICAgc3RvcmFnZSA9IGlkOworICAgICAgICAgICAgICAgIGVsc2UKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE5VTEw7CisgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAvLyBmaW5kIGRldmljZQorICAgICAgICAgICAgdW5zaWduZWQgaW50IGlkOworICAgICAgICAgICAgaWYgKHNzY2FuZih0b2ssICIlZ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aWVudCogc0NsaWVudCA9IE5VTEw7CisKKy8vIGN1cnJlbnQgd29ya2luZyBkaXJlY3RvcnkgaW5mb3JtYXRpb24gZm9yIGludGVyYWN0aXZlIHNoZWxsCitzdGF0aWMgTXRwRmlsZSogc0N1cnJlbnREaXJlY3RvcnkgPSBOVUxMOworCitzdGF0aWMgTXRwRmlsZSogcGFyc2VfcGF0aChjaGFyKiBwYXRoKSB7CisgICAgcmV0dXJuIE10cEZpbGU6OnBhcnNlUGF0aChzQ3VycmVudERpcmVjdG9yeSwgcGF0aCk7Cit9CisKK2NsYXNzIE15Q2xpZW50IDogcHVibGljIE10cENsaWVudCB7Citwcml2YXRlOgorICAgIHZpcnR1YWwgdm9pZCBkZXZpY2VBZGRlZChNdHBEZXZpY2UgKmRldmljZSkgeworICAgIH0KKworICAgIHZpcnR1YWwgdm9pZCBkZXZpY2VSZW1vdmVkKE10cERldmljZSAqZGV2aWNlKSB7CisgICAgfQorCitwdWJsaWM6Cit9OworCitzdGF0aWMgdm9pZCBpbml0KCkgeworICAgIHNDbGllbnQgPSBuZXcgTXlDbGllbnQ7CisgICAgc0NsaWVudC0+c3RhcnQoKTsKKyAgICBNdHBGaWxlOjppbml0KHNDbGllbnQpOworfQorCitzdGF0aWMgaW50IHNldF9jd2QoaW50IGFyZ2MsIGNoYXIqIGFyZ3ZbXSkgeworICAgIGlmIChhcmdjICE9IDEpIHsKKyAgICAgICAgZnByaW50ZihzdGRlcnIsICJjZCBzaG91bGQgaGF2ZSBvbmUgYXJndW1lbnRcbiIpOworICAgICAgICByZXR1cm4gLTE7CisgICAgfQorICAgIGlmICghc3RyY21wKGFyZ3ZbMF0sICIvIikpIHsKKyAgICAgICAgZGVsZXRlIHNDdXJyZW50RGlyZWN0b3J5OworICAgICAgICBzQ3VycmVudERpcmVjdG9yeSA9IE5VTEw7CisgICAgfQorICAgIGVsc2UgeworICAgICAgICBNdHBGaWxlKiBmaWxlID0gcGFyc2VfcGF0aChhcmd2WzBdKTsKKyAgICAgICAgaWYgKGZpbGUpIHsKKyAgICAgICAgICAgIGRlbGV0ZSBzQ3VycmVudERpcmVjdG9yeTsKKyAgICAgICAgICAgIHNDdXJyZW50RGlyZWN0b3J5ID0gZmlsZTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGZwcmludGYoc3RkZXJyLCAiY291bGQgbm90IGZpbmQgJXNcbiIsIGFyZ3ZbMF0pOworICAgICAgICAgICAgcmV0dXJuIC0xOworICAgICAgICB9CisgICAgfQorICAgIHJldHVybiAwOworfQorCitzdGF0aWMgdm9pZCBsaXN0X2RldmljZXMoKSB7CisgICAgLy8gVE9ETyAtIG5lZWQgdG8gbWFrZSBzdXJlIHRoZSBsaXN0IHdpbGwgbm90IGNoYW5nZSB3aGlsZSBpdGVyYXRpbmcKKyAgICBNdHBEZXZpY2VMaXN0JiBkZXZpY2VzID0gc0NsaWVudC0+Z2V0RGV2aWNlTGlzdCgpOworICAgIGZvciAoaW50IGkgPSAwOyBpIDwgZGV2aWNlcy5zaXplKCk7IGkrKykgeworICAgICAgICBNdHBEZXZpY2UqIGRldmljZSA9IGRldmljZXNbaV07CisgICAgICAgIE10cEZpbGUqIGZpbGUgPSBuZXcgTXRwRmlsZShkZXZpY2UpOworICAgICAgICBmaWxlLT5wcmludCgpOworICAgICAgICBkZWxldGUgZmlsZTsKKyAgICB9Cit9CisKK3N0YXRpYyBpbnQgbGlzdChpbnQgYXJnYywgY2hhciogYXJndltdKSB7CisgICAgaWYgKGFyZ2MgPT0gMCkgeworICAgICAgICAvLyBsaXN0IGN3ZAorICAgICAgICBpZiAoc0N1cnJlbnREaXJlY3RvcnkpIHsKKyAgICAgICAgICAgIHNDdXJyZW50RGlyZWN0b3J5LT5saXN0KCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBsaXN0X2RldmljZXMoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIGZvciAoaW50IGkgPSAwOyBpIDwgYXJnYzsgaSsrKSB7CisgICAgICAgIGNoYXIqIHBhdGggPSBhcmd2W2ldOworICAgICAgICBpZiAoIXN0cmNtcChwYXRoLCAiLyIpKSB7CisgICAgICAgICAgICBsaXN0X2RldmljZXMoKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIE10cEZpbGUqIGZpbGUgPSBwYXJzZV9wYXRoKHBhdGgpOworICAgICAgICAgICAgaWYgKCFmaWxlKSB7CisgICAgICAgICAgICAgICAgZnByaW50ZihzdGRlcnIsICJjb3VsZCBub3QgZmluZCAlc1xuIiwgcGF0aCk7CisgICAgICAgICAgICAgICAgcmV0dXJuIC0xOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZmlsZS0+bGlzdCgpOworICAgICAgICB9CisgICAgfQorCisgICAgcmV0dXJuIDA7Cit9CisKK3N0YXRpYyBpbnQgZ2V0X2ZpbGUoaW50IGFyZ2MsIGNoYXIqIGFyZ3ZbXSkgeworICAgIGludCByZXQgPSAtMTsKKyAgICBpbnQgc3JjRkQgPSAtMTsKKyAgICBpbnQgZGVzdEZEID0gLTE7CisgICAgTXRwRmlsZSogc3JjRmlsZSA9IE5VTEw7CisgICAgTXRwT2JqZWN0SW5mbyogaW5mbyA9IE5VTEw7CisgICAgY2hhciogZGVzdDsKKworICAgIGlmIChhcmdjIDwgMSkgeworICAgICAgICBmcHJpbnRmKHN0ZGVyciwgIm5vdCBlbm91Z2ggYXJndW1lbnRzXG4iKTsKKyAgICAgICAgcmV0dXJuIC0xOworICAgIH0gZWxzZSBpZiAoYXJnYyA+IDIpIHsKKyAgICAgICAgZnByaW50ZihzdGRlcnIsICJ0b28gbWFueSBhcmd1bWVudHNcbiIpOworICAgICAgICByZXR1cm4gLTE7CisgICAgfQorCisgICAgLy8gZmluZCBzb3VyY2Ugb2JqZWN0CisgICAgY2hhciogc3JjID0gYXJndlswXTsKKyAgICBzcmNGaWxlID0gcGFyc2VfcGF0aChzcmMpOworICAgIGlmICghc3JjRmlsZSkgeworICAgICAgICBmcHJpbnRmKHN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VyKSk7CisgICAgICAgIGlmIChjb3VudCA8PSAwKQorICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIHdyaXRlKGRlc3RGRCwgYnVmZmVyLCBjb3VudCk7CisgICAgfQorICAgIC8vIEZJWE1FIC0gZXJyb3IgY2hlY2tpbmcgYW5kIHJlcG9ydGluZworICAgIHJldCA9IDA7CisKK2ZhaWw6CisgICAgZGVsZXRlIHNyY0ZpbGU7CisgICAgZGVsZXRlIGluZm87CisgICAgaWYgKHNyY0ZEID49IDApCisgICAgICAgIGNsb3NlKHNyY0ZEKTsKKyAgICBpZiAoZGVzdEZEID49IDApCisgICAgICAgIGNsb3NlKGRlc3RGRCk7CisgICAgcmV0dXJuIHJldDsKK30KKworc3RhdGljIGludCBwdXRfZmlsZShpbnQgYXJnYywgY2hhciogYXJndltdKSB7CisgICAgaW50IHJldCA9IC0xOworICAgIGludCBzcmNGRCA9IC0xOworICAgIE10cEZpbGUqIGRlc3RGaWxlID0gTlVMTDsKKyAgICBNdHBPYmplY3RJbmZvKiBzcmNJbmZvID0gTlVMTDsKKyAgICBNdHBPYmplY3RJbmZvKiBkZXN0SW5mbyA9IE5VTEw7CisgICAgTXRwT2JqZWN0SGFuZGxlIGhhbmRsZTsKKyAgICBzdHJ1Y3Qgc3RhdCBzdGF0YnVmOworICAgIGNvbnN0IGNoYXIqIGxhc3RTbGFzaDsKKworICAgIGlmIChhcmdjIDwgMSkgeworICAgICAgICBmcHJpbnRmKHN0ZGVyciwgIm5vdCBlbm91Z2ggYXJndW1lbnRzXG4iKTsKKyAgICAgICAgcmV0dXJuIC0xOworICAgIH0gZWxzZSBpZiAoYXJnYyA+IDIpIHsKKyAgICAgICAgZnByaW50ZihzdGRlcnIsICJ0b28gbWFueSBhcmd1bWVudHNcbiIpOworICAgICAgICByZXR1cm4gLTE7CisgICAgfQorICAgIGNvbnN0IGNoYXIqIHNyYyA9IGFyZ3ZbMF07CisgICAgc3JjRkQgPSBvcGVuKHNyYywgT19SRE9OTFkpOworICAgIGlmIChzcmNGRCA8IDApIHsKKyAgICAgICAgZnByaW50ZihzdGRlcnIsICJjb3VsZCBub3Qgb3BlbiAlc1xuIiwgc3JjKTsKKyAgICAgICAgZ290byBmYWlsOworICAgIH0KKyAgICBpZiAoYXJnYyA9PSAyKSB7CisgICAgICAgICBjaGFyKiBkZXN0ID0gYXJndlsxXTsKKyAgICAgICAgZGVzdEZpbGUgPSBwYXJzZV9wYXRoKGRlc3QpOworICAgICAgICBpZiAoIWRlc3RGaWxlKSB7CisgICAgICAgICAgICBmcHJpbnRmKHN0ZGVyciwgImNvdWxkIG5vdCBmaW5kICVzXG4iLCBkZXN0KTsKKyAgICAgICAgICAgIGdvdG8gZmFpbDsKKyAgICAgICAgfQorICAgIH0gZWxzZSB7CisgICAgICAgIGlmICghc0N1cnJlbnREaXJlY3RvcnkpIHsKKyAgICAgICAgICAgIGZwcmludGYoc3RkZXJyLCAiY3VycmVudCB3b3JraW5nIGRpcmVjdG9yeSBub3Qgc2V0XG4iKTsKKyAgICAgICAgICAgIGdvdG8gZmFpbDsKKyAgICAgICAgfQorICAgICAgICBkZXN0RmlsZSA9IG5ldyBNdHBGaWxlKHNDdXJyZW50RGlyZWN0b3J5KTsKKyAgICB9CisKKyAgICBkZXN0SW5mbyA9IGRlc3RGaWxlLT5nZXRPYmplY3RJbmZvKCk7CisgICAgaWYgKCFkZXN0SW5mbykgeworICAgICAgICBmcHJpbnRmKHN0ZGVyciwgImNvdWxkIG5vdCBmaW5kIG9iamVjdCBpbmZvIGRlc3RpbmF0aW9uIGRpcmVjdG9yeVxuIik7CisgICAgICAgIGdvdG8gZmFpbDsKKyAgICB9CisgICAgaWYgKGRlc3RJbmZvLT5tRm9ybWF0ICE9IE1UUF9GT1JNQVRfQVNTT0NJQVRJT04pIHsKKyAgICAgICAgZnByaW50ZihzdGRlcnIsICJkZXN0aW5hdGlvbiBub3QgYSBkaXJlY3RvcnlcbiIpOworICAgICAgICBnb3RvIGZhaWw7CisgICAgfQ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IHJldCk7CisgICAgcmV0dXJuIHJldDsKK30KKwordHlwZWRlZiBpbnQgKCogY29tbWFuZF9mdW5jKShpbnQgYXJnYywgY2hhciogYXJndltdKTsKKworc3RydWN0IGNvbW1hbmRfdGFibGVfZW50cnkgeworICAgIGNvbnN0IGNoYXIqIG5hbWU7CisgICAgY29tbWFuZF9mdW5jIGZ1bmM7Cit9OworCitjb25zdCBjb21tYW5kX3RhYmxlX2VudHJ5IGNvbW1hbmRfbGlzdFtdID0geworICAgIHsgICAiY2QiLCAgICAgICBzZXRfY3dkICAgICAgICAgfSwKKyAgICB7ICAgImxzIiwgICAgICAgbGlzdCAgICAgICAgICAgIH0sCisgICAgeyAgICJnZXQiLCAgICAgIGdldF9maWxlICAgICAgICB9LAorICAgIHsgICAicHV0IiwgICAgICBwdXRfZmlsZSAgICAgICAgfSwKKyAgICB7ICAgTlVMTCwgICAgICAgTlVMTCAgICAgICAgICAgIH0sCit9OworCisKK3N0YXRpYyBpbnQgZG9fY29tbWFuZChpbnQgYXJnYywgY2hhciogYXJndltdKSB7CisgICAgY29uc3QgY29tbWFuZF90YWJsZV9lbnRyeSogY29tbWFuZCA9IGNvbW1hbmRfbGlzdDsKKyAgICBjb25zdCBjaGFyKiBuYW1lID0gKmFyZ3YrKzsKKyAgICBhcmdjLS07CisKKyAgICB3aGlsZSAoY29tbWFuZC0+bmFtZSkgeworICAgICAgICBpZiAoIXN0cmNtcChjb21tYW5kLT5uYW1lLCBuYW1lKSkKKyAgICAgICAgICAgIHJldHVybiBjb21tYW5kLT5mdW5jKGFyZ2MsIGFyZ3YpOworICAgICAgICBlbHNlCisgICAgICAgICAgICBjb21tYW5kKys7CisgICAgfQorICAgIGZwcmludGYoc3RkZXJyLCAidW5rbm93biBjb21tYW5kICVzXG4iLCBuYW1lKTsKKyAgICByZXR1cm4gLTE7Cit9CisKK3N0YXRpYyBpbnQgc2hlbGwoKSB7CisgICAgaW50IGFyZ2M7CisgICAgaW50IHJlc3VsdCA9IDA7CisjZGVmaW5lIE1BWF9BUkdTICAgIDEwMAorICAgIGNoYXIqIGFyZ3ZbTUFYX0FSR1NdOworCisjaWYgSEFWRV9SRUFETElORQorICAgIHVzaW5nX2hpc3RvcnkoKTsKKyNlbmRpZgorCisgICAgd2hpbGUgKDEpIHsKKyNpZiBIQVZFX1JFQURMSU5FCisgICAgICAgIGNoYXIqIGxpbmUgPSByZWFkbGluZShQUk9NUFQpOworICAgICAgICBpZiAoIWxpbmUpIHsKKyAgICAgICAgICAgIHByaW50ZigiXG4iKTsKKyAgICAgICAgICAgIGV4aXQoMCk7CisgICAgICAgIH0KKyNlbHNlCisgICAgICAgIGNoYXIgICAgYnVmZmVyWzEwMDBdOworICAgICAgICBwcmludGYoIiVzIiwgUFJPTVBUKTsKKyAgICAgICAgY2hhciogbGluZSA9IE5VTEw7CisgICAgICAgIHNpemVfdCBsZW5ndGggPSAwOworCisgICAgICAgIGJ1ZmZlclswXSA9IDA7CisgICAgICAgIGZnZXRzKGJ1ZmZlciwgc2l6ZW9mKGJ1ZmZlciksIHN0ZGluKTsKKyAgICAgICAgaW50IGNvdW50ID0gc3RybGVuKGJ1ZmZlcik7CisgICAgICAgIGlmIChjb3VudCA+IDAgJiYgYnVmZmVyWzBdID09IEVPRikgeworICAgICAgICAgICAgcHJpbnRmKCJcbiIpOworICAgICAgICAgICAgZXhpdCgwKTsKKyAgICAgICAgfQorICAgICAgICBpZiAoY291bnQgPiAwICYmIGxpbmVbY291bnQgLSAxXSA9PSAnXG4nKQorICAgICAgICAgICAgbGluZVtjb3VudCAtIDFdID09IDA7CisjZW5kaWYKKyAgICAgICAgY2hhciogdG9rID0gc3RydG9rKGxpbmUsICIgXHRcblxyIik7CisgICAgICAgIGlmICghdG9rKQorICAgICAgICAgICAgY29udGludWU7CisgICAgICAgIGlmICghc3RyY21wKHRvaywgInF1aXQiKSB8fCAhc3RyY21wKHRvaywgImV4aXQiKSkgeworICAgICAgICAgICAgZXhpdCgwKTsKKyAgICAgICAgfQorI2lmIEhBVkVfUkVBRExJTkUKKyAgICAgICAgYWRkX2hpc3RvcnkobGluZSk7CisjZW5kaWYKKyAgICAgICAgYXJnYyA9IDA7CisgICAgICAgIHdoaWxlICh0b2spIHsKKyAgICAgICAgICAgIGlmIChhcmdjICsgMSA9PSBNQVhfQVJHUykgeworICAgICAgICAgICAgICAgIGZwcmludGYoc3RkZXJyLCAidG9vIG1hbnkgYXJndW1lbnRzXG4iKTsKKyAgICAgICAgICAgICAgICByZXN1bHQgPSAtMTsKKyAgICAgICAgICAgICAgICBnb3RvIGJvdHRvbV9vZl9sb29wOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBhcmd2W2FyZ2MrK10gPSBzdHJkdXAodG9rKTsKKyAgICAgICAgICAgIHRvayA9IHN0cnRvayhOVUxMLCAiIFx0XG5cciIpOworICAgICAgICB9CisKKyAgICAgICAgcmVzdWx0ID0gZG9fY29tbWFuZChhcmdjLCBhcmd2KTsKKworYm90dG9tX29mX2xvb3A6CisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgYXJnYzsgaSsrKQorICAgICAgICAgICAgZnJlZShhcmd2W2ldKTsKKyAgICAgICAgZnJlZShsaW5lKTsKKyAgICB9CisKKyAgICByZXR1cm4gcmVzdWx0OworfQorCitpbnQgbWFpbihpbnQgYXJnYywgY2hhciogYXJndltdKSB7CisgICAgaW5pdCgpOworCisgICAgaWYgKGFyZ2MgPT0gMSkKKyAgICAgICAgcmV0dXJuIHNoZWxsKCk7CisgICAgZWxzZQorICAgICAgICByZXR1cm4gZG9fY29tbWFuZChhcmdjIC0gMSwgYXJndiArIDEpOworfQpkaWZmIC0tZ2l0IGEvbWVkaWEvdGVzdHMvcGxheWVycy9pbnZva2VfbW9ja19tZWRpYV9wbGF5ZXIuY3BwIGIvbWVkaWEvdGVzdHMvcGxheWVycy9pbnZva2VfbW9ja19tZWRpYV9wbGF5ZXIuY3BwCmluZGV4IGIzY2M4YjYuLjUzMzA4YmUgMTAwNjQ0Ci0t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hcmFtIFtpbm91dF0gaW50OF90IComICAgICAtIEEgYnVmZmVyIG9mIGF1ZGlvIGRhdGEgb25seSB2YWxpZCBkdXJpbmcgdGhlCisvLyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhlY3V0aW9uIG9mIHRoZSBjYWxsYmFjaworLy8gQHBhcmFtIFtpbm91dF0gc2l6ZV90ICAmICAgICAtIFRoZSBzaXplIG9mIHRoZSBidWZmZXIKKy8vIEBwYXJhbSBbaW5dIHR0c19zeW50aF9zdGF0dXMgLSBpbmRpY2F0ZSB3aGV0aGVyIHRoZSBzeW50aGVzaXMgaXMgZG9uZSwgb3IKKy8vICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgbW9yZSBkYXRhIGlzIHRvIGJlIHN5bnRoZXNpemVkLgorLy8gQHJldHVybiBUVFNfQ0FMTEJBQ0tfSEFMVCB0byBpbmRpY2F0ZSB0aGUgc3ludGhlc2lzIG11c3Qgc3RvcCwKKy8vICAgICAgICAgVFRTX0NBTExCQUNLX0NPTlRJTlVFIHRvIGluZGljYXRlIHRoZSBzeW50aGVzaXMgbXVzdCBjb250aW51ZSBpZgorLy8gICAgICAgICAgICB0aGVyZSBpcyBtb3JlIGRhdGEgdG8gcHJvZHVjZS4KK3R5cGVkZWYgYW5kcm9pZF90dHNfY2FsbGJhY2tfc3RhdHVzX3QgKCphbmRyb2lkX3R0c19zeW50aF9jYl90KQorICAgICAgICAgICAgKHZvaWQgKipwVXNlckRhdGEsCisgICAgICAgICAgICAgdWludDMyX3QgdHJhY2tTYW1wbGluZ0h6LAorICAgICAgICAgICAgIGFuZHJvaWRfdHRzX2F1ZGlvX2Zvcm1hdF90IGF1ZGlvRm9ybWF0LAorICAgICAgICAgICAgIGludCBjaGFubmVsQ291bnQsCisgICAgICAgICAgICAgaW50OF90ICoqcEF1ZGlvQnVmZmVyLAorICAgICAgICAgICAgIHNpemVfdCAqcEJ1ZmZlclNpemUsCisgICAgICAgICAgICAgYW5kcm9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UuIFRoZSBjYWxsYmFjayBpcyBjYWxsZWQgcmVwZWF0ZWRseSB1bnRpbCB0aGUgZW5naW5lCisgICAgLy8gaGFzIGdlbmVyYXRlZCBhbGwgdGhlIGF1ZGlvIGRhdGEgY29ycmVzcG9uZGluZyB0byB0aGUgdGV4dC4KKyAgICAvLyBOb3RlIGFib3V0IHRoZSBmb3JtYXQgb2YgdGhlIGlucHV0OiB0aGUgdGV4dCBwYXJhbWV0ZXIgbWF5IHVzZSB0aGUKKyAgICAvLyBmb2xsb3dpbmcgZWxlbWVudHMKKyAgICAvLyBhbmQgdGhlaXIgcmVzcGVjdGl2ZSBhdHRyaWJ1dGVzIGFzIGRlZmluZWQgaW4gdGhlIFNTTUwgMS4wIHNwZWNpZmljYXRpb246CisgICAgLy8gICAgKiBsYW5nCisgICAgLy8gICAgKiBzYXktYXM6CisgICAgLy8gICAgICAgICAgbyBpbnRlcnByZXQtYXMKKyAgICAvLyAgICAqIHBob25lbWUKKyAgICAvLyAgICAqIHZvaWNlOgorICAgIC8vICAgICAgICAgIG8gZ2VuZGVyLAorICAgIC8vICAgICAgICAgIG8gYWdlLAorICAgIC8vICAgICAgICAgIG8gdmFyaWFudCwKKyAgICAvLyAgICAgICAgICBvIG5hbWUKKyAgICAvLyAgICAqIGVtcGhhc2lzCisgICAgLy8gICAgKiBicmVhazoKKyAgICAvLyAgICAgICAgICBvIHN0cmVuZ3RoLAorICAgIC8vICAgICAgICAgIG8gdGltZQorICAgIC8vICAgICogcHJvc29keToKKyAgICAvLyAgICAgICAgICBvIHBpdGNoLAorICAgIC8vICAgICAgICAgIG8gY29udG91ciwKKyAgICAvLyAgICAgICAgICBvIHJhbmdlLAorICAgIC8vICAgICAgICAgIG8gcmF0ZSwKKyAgICAvLyAgICAgICAgICBvIGR1cmF0aW9uLAorICAgIC8vICAgICAgICAgIG8gdm9sdW1lCisgICAgLy8gICAgKiBtYXJrCisgICAgLy8gRGlmZmVyZW5jZXMgYmV0d2VlbiB0aGlzIHR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E5VTEwpOworICAgICAgICBnbENvbXBpbGVTaGFkZXIoc2hhZGVyKTsKKyAgICAgICAgR0xpbnQgY29tcGlsZWQgPSAwOworICAgICAgICBnbEdldFNoYWRlcml2KHNoYWRlciwgR0xfQ09NUElMRV9TVEFUVVMsICZjb21waWxlZCk7CisgICAgICAgIGlmICghY29tcGlsZWQpIHsKKyAgICAgICAgICAgIEdMaW50IGluZm9MZW4gPSAwOworICAgICAgICAgICAgZ2xHZXRTaGFkZXJpdihzaGFkZXIsIEdMX0lORk9fTE9HX0xFTkdUSCwgJmluZm9MZW4pOworICAgICAgICAgICAgaWYgKGluZm9MZW4pIHsKKyAgICAgICAgICAgICAgICBjaGFyKiBidWYgPSAoY2hhciopIG1hbGxvYyhpbmZvTGVuKTsKKyAgICAgICAgICAgICAgICBpZiAoYnVmKSB7CisgICAgICAgICAgICAgICAgICAgIGdsR2V0U2hhZGVySW5mb0xvZyhzaGFkZXIsIGluZm9MZW4sIE5VTEwsIGJ1Zik7CisgICAgICAgICAgICAgICAgICAgIExPR0UoIkNvdWxkIG5vdCBjb21waWxlIHNoYWRlciAlZDpcbiVzXG4iLCBzaGFkZXJUeXBlLCBidWYpOworICAgICAgICAgICAgICAgICAgICBmcmVlKGJ1Zik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGdsRGVsZXRlU2hhZGVyKHNoYWRlcik7CisgICAgICAgICAgICAgICAgc2hhZGVyID0gMDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKyAgICByZXR1cm4gc2hhZGVyOworfQorCitlbnVtIHsKKyAgICBBX1BPUywKKyAgICBBX0NPTE9SLAorICAgIEFfVEVYMCwKKyAgICBBX1RFWDEKK307CisKK0dMdWludCBjcmVhdGVQcm9ncmFtKGNvbnN0IGNoYXIqIHBWZXJ0ZXhTb3VyY2UsIGNvbnN0IGNoYXIqIHBGcmFnbWVudFNvdXJjZSkgeworICAgIEdMdWludCB2ZXJ0ZXhTaGFkZXIgPS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gICAgICBpZiAobGlua1N0YXR1cyAhPSBHTF9UUlVFKSB7CisgICAgICAgICAgICBHTGludCBidWZMZW5ndGggPSAwOworICAgICAgICAgICAgZ2xHZXRQcm9ncmFtaXYocHJvZ3JhbSwgR0xfSU5GT19MT0dfTEVOR1RILCAmYnVmTGVuZ3RoKTsKKyAgICAgICAgICAgIGlmIChidWZMZW5ndGgpIHsKKyAgICAgICAgICAgICAgICBjaGFyKiBidWYgPSAoY2hhciopIG1hbGxvYyhidWZMZW5ndGgpOworICAgICAgICAgICAgICAgIGlmIChidWYpIHsKKyAgICAgICAgICAgICAgICAgICAgZ2xHZXRQcm9ncmFtSW5mb0xvZyhwcm9ncmFtLCBidWZMZW5ndGgsIE5VTEwsIGJ1Zik7CisgICAgICAgICAgICAgICAgICAgIExPR0UoIkNvdWxkIG5vdCBsaW5rIHByb2dyYW06XG4lc1xuIiwgYnVmKTsKKyAgICAgICAgICAgICAgICAgICAgZnJlZShidWYpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGdsRGVsZXRlUHJvZ3JhbShwcm9ncmFtKTsKKyAgICAgICAgICAgIHByb2dyYW0gPSAwOworICAgICAgICB9CisgICAgfQorICAgIGNoZWNrR2xFcnJvcigiY3JlYXRlUHJvZ3JhbSIpOworICAgIGdsVXNlUHJvZ3JhbShwcm9ncmFtKTsKKyAgICByZXR1cm4gcHJvZ3JhbTsKK30KKwordWludDY0X3QgZ2V0VGltZSgpIHsKKyAgICBzdHJ1Y3QgdGltZXNwZWMgdDsKKyAgICBjbG9ja19nZXR0aW1lKENMT0NLX01PTk9UT05JQywgJnQpOworICAgIHJldHVybiB0LnR2X25zZWMgKyAoKHVpbnQ2NF90KXQudHZfc2VjICogMTAwMCAqIDEwMDAgKiAxMDAwKTsKK30KKwordWludDY0X3QgZ1RpbWU7Cit2b2lkIHN0YXJ0VGltZXIoKSB7CisgICAgZ1RpbWUgPSBnZXRUaW1lKCk7Cit9CisKK3Z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9CVUZGRVJfQklUIHwgR0xfQ09MT1JfQlVGRkVSX0JJVCk7CisgICAgICAgIGdsRHJhd0FycmF5cyhHTF9UUklBTkdMRV9TVFJJUCwgMCwgNCk7CisgICAgICAgIHB0U3dhcCgpOworICAgICAgICBnbEZpbmlzaCgpOworICAgICAgICByZXR1cm47CisgICAgfQorCisgICAgc3RhcnRUaW1lcigpOworICAgIGdsQ2xlYXIoR0xfREVQVEhfQlVGRkVSX0JJVCB8IEdMX0NPTE9SX0JVRkZFUl9CSVQpOworICAgIGZvciAoaW50IGN0PTA7IGN0IDwgMTAwOyBjdCsrKSB7CisgICAgICAgIHJhbmRVbmlmb3JtKHBnbSwgInVfY29sb3IiKTsKKyAgICAgICAgcmFuZFVuaWZvcm0ocGdtLCAidV8wIik7CisgICAgICAgIHJhbmRVbmlmb3JtKHBnbSwgInVfMSIpOworICAgICAgICByYW5kVW5pZm9ybShwZ20sICJ1XzIiKTsKKyAgICAgICAgcmFuZFVuaWZvcm0ocGdtLCAidV8zIik7CisgICAgICAgIGdsRHJhd0FycmF5cyhHTF9UUklBTkdMRV9TVFJJUCwgMCwgNCk7CisgICAgfQorICAgIHB0U3dhcCgpOworICAgIGdsRmluaXNoKCk7CisgICAgZW5kVGltZXIoc3RyLCB3LCBoLCAxLCAxMDApOworfQorCit2b2lkIGdlblRleHR1cmVzKCkgeworICAgIHVpbnQzMl90ICptID0gKHVpbnQzMl90ICopbWFsbG9jKDEwMjQqMTAyNCo0KTsKKyAgICBmb3IgKGludCB5PTA7IHkgPCAxMDI0OyB5KyspeworICAgICAgICBmb3IgKGludCB4PTA7IHggPCAxMDI0OyB4KyspeworICAgICAgICAgICAgbVt5KjEwMjQgKyB4XSA9IDB4ZmYwMDAwZmYgfCAoKHggJiAweGZmKSA8PCA4KSB8ICh5IDw8IDE2KTsKKyAgICAgICAgfQorICAgIH0KKyAgICBnbEJpbmRUZXh0dXJlKEdMX1RFWFRVUkVfMkQsIDEpOworICAgIGdsVGV4SW1hZ2U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gICB1c2VWYXJDb2xvciwgdGV4Q291bnQsIG1vZHVsYXRlRmlyc3RUZXgsIGV4dHJhTWF0aCwgdGV4MCk7CisgICAgZG9Mb29wKHRydWUsIHBnbSwgdywgaCwgc3RyMik7CisgICAgZG9Mb29wKGZhbHNlLCBwZ20sIHcsIGgsIHN0cjIpOworfQorCitib29sIGRvVGVzdCh1aW50MzJfdCB3LCB1aW50MzJfdCBoKSB7CisgICAgc2V0dXBWQSgpOworICAgIGdlblRleHR1cmVzKCk7CisKKyAgICBwcmludGYoIlxudmFyQ29sb3IsIHRleENvdW50LCBtb2R1bGF0ZSwgZXh0cmFNYXRoLCB0ZXhTaXplLCBibGVuZCwgTXBwcywgREM2MFxuIik7CisKKyAgICBmb3IgKGludCB0ZXhDb3VudCA9IDA7IHRleENvdW50IDwgMjsgdGV4Q291bnQrKykgeworICAgICAgICBmb3IgKGludCBleHRyYU1hdGggPSAwOyBleHRyYU1hdGggPCA1OyBleHRyYU1hdGgrKykgeworCisgICAgICAgICAgICBkb1NpbmdsZVRlc3QodywgaCwgZmFsc2UsIHRleENvdW50LCBmYWxzZSwgZXh0cmFNYXRoLCAxLCAxKTsKKyAgICAgICAgICAgIGRvU2luZ2xlVGVzdCh3LCBoLCB0cnVlLCB0ZXhDb3VudCwgZmFsc2UsIGV4dHJhTWF0aCwgMSwgMSk7CisgICAgICAgICAgICBpZiAodGV4Q291bnQpIHsKKyAgICAgICAgICAgICAgICBkb1NpbmdsZVRlc3QodywgaCwgZmFsc2UsIHRleENvdW50LCB0cnVlLCBleHRyYU1hdGgsIDEsIDEpOworICAgICAgICAgICAgICAgIGRvU2luZ2xlVGVzdCh3LCBoLCB0cnVlLCB0ZXhDb3VudCwgdHJ1ZSwgZXh0cmFNYXRoLCAxLCAxKTsKKworICAgICAgICAgICAgICAgIGRvU2luZ2xlVGVzdCh3LCBoLCBmYWxzZSwgdGV4Q291bnQsIGZhbHNlLCBleHRyYU1hdGgsIDIsIDIpOworICAgICAgICAgICAgICA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UdMaW50IGVycm9yID0gZWdsR2V0RXJyb3IoKTsgZXJyb3IgIT0gRUdMX1NVQ0NFU1M7IGVycm9yCisgICAgICAgICAgICA9IGVnbEdldEVycm9yKCkpIHsKKyAgICAgICAgZnByaW50ZihzdGRlcnIsICJhZnRlciAlcygpIGVnbEVycm9yICVzICgweCV4KVxuIiwgb3AsIEVHTFV0aWxzOjpzdHJlcnJvcihlcnJvciksCisgICAgICAgICAgICAgICAgZXJyb3IpOworICAgIH0KK30KKworc3RhdGljIHZvaWQgY2hlY2tHbEVycm9yKGNvbnN0IGNoYXIqIG9wKSB7CisgICAgZm9yIChHTGludCBlcnJvciA9IGdsR2V0RXJyb3IoKTsgZXJyb3I7IGVycm9yCisgICAgICAgICAgICA9IGdsR2V0RXJyb3IoKSkgeworICAgICAgICBmcHJpbnRmKHN0ZGVyciwgImFmdGVyICVzKCkgZ2xFcnJvciAoMHgleClcbiIsIG9wLCBlcnJvcik7CisgICAgfQorfQorCitib29sIGRvVGVzdCh1aW50MzJfdCB3LCB1aW50MzJfdCBoKTsKKworc3RhdGljIEVHTERpc3BsYXkgZHB5Oworc3RhdGljIEVHTFN1cmZhY2Ugc3VyZmFjZTsKKworaW50IG1haW4oaW50IGFyZ2MsIGNoYXIqKiBhcmd2KSB7CisgICAgRUdMQm9vbGVhbiByZXR1cm5WYWx1ZTsKKyAgICBFR0xDb25maWcgbXlDb25maWcgPSB7MH07CisKKyAgICBFR0xpbnQgY29udGV4dF9hdHRyaWJzW10gPSB7IEVHTF9DT05URVhUX0NMSUVOVF9WRVJTSU9OLCAyLCBFR0xfTk9ORSB9OworICAgIEVHTGludCBzX2NvbmZpZ0F0dHJpYnNbXSA9IHsKKyAgICAgICAgICAgIEVHTF9TVVJGQUNFX1RZUEUsIEVHTF9XSU5ET1dfQklULAorICAgICAgICAgICAgRUdMX1JFTkRFUkFCTEVfVFlQRSwgRUdMX09QRU5HTF9FUzJfQklULAorICAgICAgICAgICAgRUdMX05PTkUgfTsKKyAgICBFR0xpbnQgbWFqb3JWZXJzaW9uOworICAgIEVHTGludCBtaW5vclZlcnNpb247CisgICAgRUdMQ29udGV4dCBjb250ZXh0OworICAgIEVHTGludCB3LCBoOworCisKKyAgICBjaGVja0VnbEVycm9yKCI8aW5pdD4iKTsKKyAgICBkcHkgPSBlZ2xHZXREaXNwbGF5KEVHTF9ERUZBVUxUX0RJU1BMQVkpOworICAgIGNoZWNrRWdsRXJyb3IoImVnbEdldERpc3BsYXkiKTsKKyAgICBpZiAoZHB5ID09IEVHTF9OT19ESVNQTEFZKSB7CisgICAgICAgIHByaW50ZigiZWdsR2V0RGlzcGxheSByZXR1cm5lZCBFR0xfTk9fRElTUExBWS5cbiIpOworICAgICAgICByZXR1cm4gMDsKKyAgICB9CisKKyAgICByZXR1cm5WYWx1ZSA9IGVnbEluaXRpYWxpemUoZHB5LCAmbWFqb3JWZXJzaW9uLCAmbWlub3JWZXJzaW9uKTsKKyAgICBjaGVja0VnbEVycm9yKCJlZ2xJbml0aWFsaXplIiwgcmV0dXJuVmFsdWUpOworICAgIGlmIChyZXR1cm5WYWx1ZSAhPSBFR0xfVFJVRSkgeworICAgICAgICBwcmludGYoImVnbEluaXRpYWxpemUgZmFpbGVkXG4iKTsKKyAgICAgICAgcmV0dXJuIDA7CisgICAgfQorCisgICAgRUdMTmF0aXZlV2luZG93VHlwZSB3aW5kb3cgPSBhbmRyb2lkX2NyZWF0ZURpc3BsYXlTdXJmYWNlKCk7DQorICAgIHJldHVyblZhbHVlID0gRUdMVXRpbHM6OnNlbGVjdENvbmZpZ0Zvck5hdGl2ZVdpbmRvdyhkcHksIHNfY29uZmlnQXR0cmlicywgd2luZG93LCAmbXlDb25maWcpOworICAgIGlmIChyZXR1cm5WYWx1ZSkgeworICAgICAgICBwcmludGYoIkVHTFV0aWxzOjpzZWxlY3RDb25maWdGb3JOYXRpdmVXaW5kb3coKSByZXR1cm5lZCAlZCIsIHJldHVyblZhbHVlKTsKKyAgICAgICAgcmV0dXJuIDA7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hDb3VudE5TdWJUZXN0Q291bnQgPSA4OworCisgICAgaWYgKCB0ZXN0U3RhdGUgPCBleHRyYU1hdGhDb3VudCAqIHRleENvdW50MFN1YlRlc3RDb3VudCkgeworICAgICAgIHRleENvdW50ID0gMDsgLy8gT25seSAxMCB0ZXN0cyBmb3IgdGV4Q291bnQgMAorICAgICAgIGV4dHJhTWF0aCA9ICh0ZXN0U3RhdGUgLyB0ZXhDb3VudDBTdWJUZXN0Q291bnQpICUgZXh0cmFNYXRoQ291bnQ7CisgICAgICAgdGVzdFN1YlN0YXRlID0gdGVzdFN0YXRlICUgdGV4Q291bnQwU3ViVGVzdENvdW50OworICAgIH0gZWxzZSB7CisgICAgICAgdGV4Q291bnQgPSAxICsgKHRlc3RTdGF0ZSAtIGV4dHJhTWF0aENvdW50ICogdGV4Q291bnQwU3ViVGVzdENvdW50KSAvIChleHRyYU1hdGhDb3VudCAqIHRleENvdW50TlN1YlRlc3RDb3VudCk7CisgICAgICAgZXh0cmFNYXRoID0gKHRlc3RTdGF0ZSAvIHRleENvdW50TlN1YlRlc3RDb3VudCkgJSBleHRyYU1hdGhDb3VudDsKKyAgICAgICB0ZXN0U3ViU3RhdGUgPSB0ZXN0U3RhdGUgJSB0ZXhDb3VudE5TdWJUZXN0Q291bnQ7CisgICAgfQorICAgIGlmICh0ZXhDb3VudCA+PSAzKSB7CisgICAgICAgTE9HSSgiZG9uZVxuIik7CisgICAgICAgaWYgKGZPdXQpIHsKKyAgICAgICAgICAgZmNsb3NlKGZPdXQpOworICAgICAgICAgICBmT3V0ID0gTlVMTDsKKyAgICAgICB9CisgICAgICAgZG9uZSA9IHRydWU7CisgICAgICAgcmV0dXJuOworICAgIH0KKworCisgICAgLy8gTE9HSSgiZG9UZXN0ICVkICVkICVkXG4iLCB0ZXhDb3VudCwgZXh0cmFNYXRoLCB0ZXN0U3ViU3RhdGUpOworCisgICAgc3dpdGNoKHRlc3RTdWJTdGF0ZSkgeworCWNhc2UgMDoKKyAgICAgICAg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9IDQ7CisgICAgICAgIHByaXZhdGUgc3RhdGljIGludFtdIHNfY29uZmlnQXR0cmliczIgPQorICAgICAgICB7CisgICAgICAgICAgICBFR0wxMC5FR0xfUkVEX1NJWkUsIDQsCisgICAgICAgICAgICBFR0wxMC5FR0xfR1JFRU5fU0laRSwgNCwKKyAgICAgICAgICAgIEVHTDEwLkVHTF9CTFVFX1NJWkUsIDQsCisgICAgICAgICAgICBFR0wxMC5FR0xfUkVOREVSQUJMRV9UWVBFLCBFR0xfT1BFTkdMX0VTMl9CSVQsCisgICAgICAgICAgICBFR0wxMC5FR0xfTk9ORQorICAgICAgICB9OworCisgICAgICAgIHB1YmxpYyBDb25maWdDaG9vc2VyKGludCByLCBpbnQgZywgaW50IGIsIGludCBhLCBpbnQgZGVwdGgsIGludCBzdGVuY2lsKSB7CisgICAgICAgICAgICBtUmVkU2l6ZSA9IHI7CisgICAgICAgICAgICBtR3JlZW5TaXplID0gZzsKKyAgICAgICAgICAgIG1CbHVlU2l6ZSA9IGI7CisgICAgICAgICAgICBtQWxwaGFTaXplID0gYTsKKyAgICAgICAgICAgIG1EZXB0aFNpemUgPSBkZXB0aDsKKyAgICAgICAgICAgIG1TdGVuY2lsU2l6ZSA9IHN0ZW5jaWw7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgRUdMQ29uZmlnIGNob29zZUNvbmZpZyhFR0wxMCBlZ2wsIEVHTERpc3BsYXkgZGlzcGxheSkgeworCisgICAgICAgICAgICBpbnRbXSBudW1fY29uZmlnID0gbmV3IGludFsxXTsKKyAgICAgICAgICAgIGVnbC5lZ2xDaG9vc2VDb25maWcoZGlzcGxheSwgc19jb25maWdBdHRyaWJzMiwgbnVsbCwgMCwgbnVtX2NvbmZpZyk7CisKKyAgICAgICAgICAgIGludCBudW1Db25maWdzID0gbnVtX2NvbmZpZ1swXTsKKworICAgICAgICAgICAgaWYgKG51bUNvbmZpZ3MgPD0gMCkgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oIk5vIGNvbmZpZ3MgbWF0Y2ggY29uZmlnU3BlYyIpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgRUdMQ29uZmlnW10gY29uZmlncyA9IG5ldyBFR0xDb25maWdbbnVtQ29uZmlnc107CisgICAgICAgICAgICBlZ2wuZWdsQ2hvb3NlQ29uZmlnKGRpc3BsYXksIHNfY29uZmlnQXR0cmliczIsIGNvbmZpZ3MsIG51bUNvbmZpZ3MsIG51bV9jb25maWcpOworICAgICAgICAgICAgLy8gcHJpbnRDb25maWdzKGVnbCwgZGlzcGxheSwgY29uZmlncyk7CisgICAgICAgICAgICByZXR1cm4gY2hvb3NlQ29uZmlnKGVnbCwgZGlzcGxheSwgY29uZmlncyk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgRUdMQ29uZmlnIGNob29zZUNvbmZpZyhFR0wxMCBlZ2wsIEVHTERpc3BsYXkgZGlzcGxheSwKKyAgICAgICAgICAgICAgICBFR0xDb25maWdbXSBjb25maWdzKSB7CisgICAgICAgICAgICBFR0xDb25maWcgY2xvc2VzdENvbmZpZyA9IG51bGw7CisgICAgICAgICAgICBpbnQgY2xvc2VzdERpc3RhbmNlID0gMTAwMDsKKyAgICAgICAgICAgIGZvcihFR0xDb25maWcgY29uZmlnIDogY29uZmlncykgeworICAgICAgICAgICAgICAgIGludCBkID0gZmluZENvbmZpZ0F0dHJpYihlZ2wsIGRpc3BsYXksIGNvbmZpZywKKyAgICAgICAgICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9ERVBUSF9TSVpFLCAwKTsKKyAgICAgICAgICAgICAgICBpbnQgcyA9IGZpbmRDb25maWdBdHRyaWIoZWdsLCBkaXNwbGF5LCBjb25maWcsCisgICAgICAgICAgICAgICAgICAgICAgICBFR0wxMC5FR0xfU1RFTkNJTF9TSVpFLCAwKTsKKyAgICAgICAgICAgICAgICBpZiAoZCA+PSBtRGVwdGhTaXplICYmIHM+PSBtU3RlbmNpbFNpemUpIHsKKyAgICAgICAgICAgICAgICAgICAgaW50IHIgPSBmaW5kQ29uZmlnQXR0cmliKGVnbCwgZGlzcGxheSwgY29uZmlnLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9SRURfU0laRSwgMCk7CisgICAgICAgICAgICAgICAgICAgIGludCBnID0gZmluZENvbmZpZ0F0dHJpYihlZ2wsIGRpc3BsYXksIGNvbmZpZywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRUdMMTAuRUdMX0dSRUVOX1NJWkUsIDApOworICAgICAgICAgICAgICAgICAgICBpbnQgYiA9IGZpbmRDb25maWdBdHRyaWIoZWdsLCBkaXNwbGF5LCBjb25maWcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBFR0wxMC5FR0xfQkxVRV9TSVpFLCAwKTsKKyAgICAgICAgICAgICAgICAgICAgaW50IGEgPSBmaW5kQ29uZmlnQXR0cmliKGVnbCwgZGlzcGxheSwgY29uZmlnLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9BTFBIQV9TSVpFLCAwKTsKKyAgICAgICAgICAgICAgICAgICAgaW50IGRpc3RhbmNlID0gTWF0aC5hYnMociAtIG1SZWRTaXplKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIE1hdGguYWJzKGcgLSBtR3JlZW5TaXplKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIE1hdGguYWJzKGIgLSBtQmx1ZVNpemUpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgTWF0aC5hYnMoYSAtIG1BbHBoYVNpemUpOworICAgICAgICAgICAgICAgICAgICBpZiAoZGlzdGFuY2UgPCBjbG9zZXN0RGlzdGFuY2UpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGNsb3Nlc3REaXN0YW5jZSA9IGRpc3RhbmNlOworICAgICAgICAgICAgICAgICAgICAgICAgY2xvc2VzdENvbmZpZyA9IGNvbmZpZzsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiBjbG9zZXN0Q29uZmlnOworICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSBpbnQgZmluZENvbmZpZ0F0dHJpYihFR0wxMCBlZ2wsIEVHTERpc3BsYXkgZGlzcGxheSwKKyAgICAgICAgICAgICAgICBFR0xDb25maWcgY29uZmlnLCBpbnQgYXR0cmlidXRlLCBpbnQgZGVmYXVsdFZhbHVlKSB7CisKKyAgICAgICAgICAgIGlmIChlZ2wuZWdsR2V0Q29uZmlnQXR0cmliKGRpc3BsYXksIGNvbmZpZywgYXR0cmlidXRlLCBtVmFsdWUpKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIG1WYWx1ZVswXTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiBkZWZhdWx0VmFsdWU7CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIHZvaWQgcHJpbnRDb25maWdzKEVHTDEwIGVnbCwgRUdMRGlzcGxheSBkaXNwbGF5LAorICAgICAgICAgICAgRUdMQ29uZmlnW10gY29uZmlncykgeworICAgICAgICAgICAgaW50IG51bUNvbmZpZ3MgPSBjb25maWdzLmxlbmd0aDsKKyAgICAgICAgICAgIExvZy53KFRBRywgU3RyaW5nLmZvcm1hdCgiJWQgY29uZmlndXJhdGlvbnMiLCBudW1Db25maWdzKSk7CisgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IG51bUNvbmZpZ3M7IGkrKykgeworICAgICAgICAgICAgICAgIExvZy53KFRBRywgU3RyaW5nLmZvcm1hdCgiQ29uZmlndXJhdGlvbiAlZDpcbiIsIGkpKTsKKyAgICAgICAgICAgICAgICBwcmludENvbmZpZyhlZ2wsIGRpc3BsYXksIGNvbmZpZ3NbaV0pOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSB2b2lkIHByaW50Q29uZmlnKEVHTDEwIGVnbCwgRUdMRGlzcGxheSBkaXNwbGF5LAorICAgICAgICAgICAgICAgIEVHTENvbmZpZyBjb25maWcpIHsKKyAgICAgICAgICAgIGludFtdIGF0dHJpYnV0ZXMgPSB7CisgICAgICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9CVUZGRVJfU0laRSwKKyAgICAgICAgICAgICAgICAgICAgRUdMMTAuRUdMX0FMUEhBX1NJWkUsCisgICAgICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9CTFVFX1NJWkUsCisgICAgICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9HUkVFTl9TSVpFLAorICAgICAgICAgICAgICAgICAgICBFR0wxMC5FR0xfUkVEX1NJWkUsCisgICAgICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9ERVBUSF9TSVpFLAorICAgICAgICAgICAgICAgICAgICBFR0wxMC5FR0xfU1RFTkNJTF9TSVpFLAorICAgICAgICAgICAgICAgICAgICBFR0wxMC5FR0xfQ09ORklHX0NBVkVBVCwKKyAgICAgICAgICAgICAgICAgICAgRUdMMTAuRUdMX0NPTkZJR19JRCwKKyAgICAgICAgICAgICAgICAgICAgRUdMMTAuRUdMX0xFVkVMLAorICAgICAgICAgICAgICAgICAgICBFR0wxMC5FR0xfTUFYX1BCVUZGRVJfSEVJR0hULAorICAgICAgICAgICAgICAgICAgICBFR0wxMC5FR0xfTUFYX1BCVUZGRVJfUElYRUxTLAorICAgICAgICAgICAgICAgICAgICBFR0wxMC5FR0xfTUFYX1BCVUZGRVJfV0lEVEgsCisgICAgICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9OQVRJVkVfUkVOREVSQUJMRSwKKyAgICAgICAgICAgICAgICAgICAgRUdMMTAuRUdMX05BVElWRV9WSVNVQUxfSUQsCisgICAgICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9OQVRJVkVfVklTVUFMX1RZUEUsCisgICAgICAgICAgICAgICAgICAgIDB4MzAzMCwgLy8gRUdMMTAuRUdMX1BSRVNFUlZFRF9SRVNPVVJDRVMsCisgICAgICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9TQU1QTEVTLAorICAgICAgICAgICAgICAgICAgICBFR0wxMC5FR0xfU0FNUExFX0JVRkZFUlMsCisgICAgICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9TVVJGQUNFX1RZUEUsCisgICAgICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9UUkFOU1BBUkVOVF9UWVBFLAorICAgICAgICAgICAgICAgICAgICBFR0wxMC5FR0xfVFJBTlNQQVJFTlRfUkVEX1ZBTFVFLAorICAgICAgICAgICAgICAgICAgICBFR0wxMC5FR0xfVFJBTlNQQVJFTlRfR1JFRU5fVkFMVUUsCisgICAgICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9UUkFOU1BBUkVOVF9CTFVFX1ZBTFVFLAorICAgICAgICAgICAgICAgICAgICAweDMwMzksIC8vIEVHTDEwLkVHTF9CSU5EX1RPX1RFWFRVUkVfUkdCLAorICAgICAgICAgICAgICAgICAgICAweDMwM0EsIC8vIEVHTDEwLkVHTF9CSU5EX1RPX1RFWFRVUkVfUkdCQSwKKyAgICAgICAgICAgICAgICAgICAgMHgzMDNCLCAvLyBFR0wxMC5FR0xfTUlOX1NXQVBfSU5URVJWQUwsCisgICAgICAgICAgICAgICAgICAgIDB4MzAzQywgLy8gRUdMMTAuRUdMX01BWF9TV0FQX0lOVEVSVkFMLAorICAgICAgICAgICAgICAgICAgICBFR0wxMC5FR0xfTFVNSU5BTkNFX1NJWkUsCisgICAgICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9BTFBIQV9NQVNLX1NJWkUsCisgICAgICAgICAgICAgICAgICAgIEVHTDEwLkVHTF9DT0xPUl9CVUZGRVJfVFlQRSwKKyAgICAgICAgICAgICAgICAgICAgRUdMMTAuRUdMX1JFTkRFUkFCTEVfVFlQRSwKKyAgICAgICAgICAgICAgICAgICAgMHgzMDQyIC8vIEVHTDEwLkVHTF9DT05GT1JNQU5UCisgICAgICAgICAgICB9OworICAgICAgICAgICAgU3RyaW5nW10gbmFtZXMgPSB7CisgICAgICAgICAgICAgICAgICAgICJFR0xfQlVGRkVSX1NJWkUiLAorICAgICAgICAgICAgICAgICAgICAiRUdMX0FMUEhBX1NJWkUiLAorICAgICAgICAgICAgICAgICAgICAiRUdMX0JMVUVfU0laRSIsCisgICAgICAgICAgICAgICAgICAgICJFR0xfR1JFRU5fU0laRSIsCisgICAgICAgICAgICAgICAgICAgICJFR0xfUkVEX1NJWkUiLAorICAgICAgICAgICAgICAgICAgICAiRUdMX0RFUFRIX1NJWkUiLAorICAgICAgICAgICAgICAgICAgICAiRUdMX1NURU5DSUxfU0laRSIsCisgICAgICAgICAgICAgICAgICAgICJFR0xfQ09ORklHX0NBVkVBVCIsCisgICAgICAgICAgICAgICAgICAgICJFR0xfQ09ORklHX0lEIiwKKyAgICAgICAgICAgICAgICAgICAgIkVHTF9MRVZFTCIsCisgICAgICAgICAgICAgICAgICAgICJFR0xfTUFYX1BCVUZGRVJfSEVJR0hUIiwKKyAgICAgICAgICAgICAgICAgICAgIkVHTF9NQVhfUEJVRkZFUl9QSVhFTFMiLAorICAgICAgICAgICAgICAgICAgICAiRUdMX01BWF9QQlVGRkVSX1dJRFRIIiwKKyAgICAgICAgICAgICAgICAgICAgIkVHTF9OQVRJVkVfUkVOREVSQUJMRSIsCisgICAgICAgICAgICAgICAgICAgICJFR0xfTkFUSVZFX1ZJU1VBTF9JRCIsCisgICAgICAgICAgICAgICAgICAgICJFR0xfTkFUSVZFX1ZJU1VBTF9UWVBFIiwKKyAgICAgICAgICAgICAgICAgICAgIkVHTF9QUkVTRVJWRURfUkVTT1VSQ0VTIiwKKyAgICAgICAgICAgICAgICAgICAgIkVHTF9TQU1QTEVTIiwKKyAgICAgICAgICAgICAgICAgICAgIkVHTF9TQU1QTEVfQlVGRkVSUyIsCisgICAgICAgICAgICAgICAgICAgICJFR0xfU1VSRkFDRV9UWVBFIiwKKyAgICAgICAgICAgICAgICAgICAgIkVHTF9UUkFOU1BBUkVOVF9UWVBFIiwKKyAgICAgICAgICAgICAgICAgICAgIkVHTF9UUkFOU1BBUkVOVF9SRURfVkFMVUUiLAorICAgICAgICAgICAgICAgICAgICAiRUdMX1RSQU5TUEFSRU5UX0dSRUVOX1ZBTFVFIiwKKyAgICAgICAgICAgICAgICAgICAgIkVHTF9UUkFOU1BBUkVOVF9CTFVFX1ZBTFVFIiwKKyAgICAgICAgICAgICAgICAgICAgIkVHTF9CSU5EX1RPX1RFWFRVUkVfUkdCIiwKKyAgICAgICAgICAgICAgICAgICAgIkVHTF9CSU5EX1RPX1RFWFRVUkVfUkdCQSIsCisgICAgICAgICAgICAgICAgICAgICJFR0xfTUlOX1NXQVBfSU5URVJWQUwiLAorICAgICAgICAgICAgICAgICAgICAiRUdMX01BWF9TV0FQX0lOVEVSVkFMIiwKKyAgICAgICAgICAgICAgICAgICAgIkVHTF9MVU1JTkFOQ0VfU0laRSIsCisgICAgICAgICAgICAgICAgICAgICJFR0xfQUxQSEFfTUFTS19TSVpFIiwKKyAgICAgICAgICAgICAgICAgICAgIkVHTF9DT0xPUl9CVUZGRVJfVFlQRSIsCisgICAgICAgICAgICAgICAgICAgICJFR0xfUkVOREVSQUJMRV9UWVBFIiwKKyAgICAgICAgICAgICAgICAgICAgIkVHTF9DT05GT1JNQU5UIgorICAgICAgICAgICAgfTsKKyAgICAgICAgICAgIGludFtdIHZhbHVlID0gbmV3IGludFsxXTsKKyAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgYXR0cmlidXRlcy5sZW5ndGg7IGkrKykgeworICAgICAgICAgICAgICAgIGludCBhdHRyaWJ1dGUgPSBhdHRyaWJ1dGVzW2ldOworICAgICAgICAgICAgICAgIFN0cmluZyBuYW1lID0gbmFtZXNbaV07CisgICAgICAgICAgICAgICAgaWYgKCBlZ2wuZWdsR2V0Q29uZmlnQXR0cmliKGRpc3BsYXksIGNvbmZpZywgYXR0cmlidXRlLCB2YWx1ZSkpIHsKKyAgICAgICAgICAgICAgICAgICAgTG9nLncoVEFHLCBTdHJpbmcuZm9ybWF0KCIgICVzOiAlZFxuIiwgbmFtZSwgdmFsdWVbMF0pKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAvLyBMb2cudyhUQUcsIFN0cmluZy5mb3JtYXQoIiAgJXM6IGZhaWxlZFxuIiwgbmFtZSkpOworICAgICAgICAgICAgICAgICAgICB3aGlsZSAoZWdsLmVnbEdldEVycm9yKCkgIT0gRUdMMTAuRUdMX1NVQ0NFU1MpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIC8vIFN1YmNsYXNzZXMgY2FuIGFkanVzdCB0aGVzZSB2YWx1ZXM6CisgICAgICAgIHByb3RlY3RlZCBpbnQgbVJlZFNpemU7CisgICAgICAgIHByb3RlY3RlZCBpbnQgbUdyZWVuU2l6ZTsKKyAgICAgICAgcHJvdGVjdGVkIGludCBtQmx1ZVNpemU7CisgICAgICAgIHByb3RlY3RlZCBpbnQgbUFscGhhU2l6ZTsKKyAgICAgICAgcHJvdGVjdGVkIGludCBtRGVwdGhTaXplOworICAgICAgICBwcm90ZWN0ZWQgaW50IG1TdGVuY2lsU2l6ZTsKKyAgICAgICAgcHJpdmF0ZSBpbnRbXSBtVmFsdWUgPSBuZXcgaW50WzFdOworICAgIH0KKworICAgIHByaXZhdGUgc3RhdGljIGNsYXNzIFJlbmRlcmVyIGltcGxlbWVudHMgR0xTdXJmYWNlVmlldy5SZW5kZXJlciB7CisgICAgICAgIHB1YmxpYyB2b2lkIG9uRHJhd0ZyYW1lKEdMMTAgZ2wpIHsKKyAgICAgICAgICAgIEdMUGVyZkxpYi5zdGVwKCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBvblN1cmZhY2VDaGFuZ2VkKEdMMTAgZ2wsIGludCB3aWR0aCwgaW50IGhla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W50OworCisgICAgICAgcHVibGljIEdyaWQoaW50IHcsIGludCBoKSB7CisgICAgICAgICAgIGlmICh3IDwgMCB8fCB3ID49IDY1NTM2KSB7CisgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJ3Iik7CisgICAgICAgICAgIH0KKyAgICAgICAgICAgaWYgKGggPCAwIHx8IGggPj0gNjU1MzYpIHsKKyAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oImgiKTsKKyAgICAgICAgICAgfQorICAgICAgICAgICBpZiAodyAqIGggPj0gNjU1MzYpIHsKKyAgICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oIncgKiBoID49IDY1NTM2Iik7CisgICAgICAgICAgIH0KKworICAgICAgICAgICBtVyA9IHc7CisgICAgICAgICAgIG1IID0gaDsKKyAgICAgICAgICAgaW50IHNpemUgPSB3ICogaDsKKworICAgICAgICAgICBtVmVydGV4Qnl0ZUJ1ZmZlciA9IEJ5dGVCdWZmZXIuYWxsb2NhdGVEaXJlY3QoVkVSVEVYX1NJWkUgKiBzaXplKQorICAgICAgICAgICAgICAgLm9yZGVyKEJ5dGVPcmRlci5uYXRpdmVPcmRlcigpKTsKKyAgICAgICAgICAgbVZlcnRleEJ1ZmZlciA9IG1WZXJ0ZXhCeXRlQnVmZmVyLmFzRmxvYXRCdWZmZXIoKTsKKworICAgICAgICAgICBpbnQgcXVhZFcgPSBtVyAtIDE7CisgICAgICAgICAgIGludCBxdWFkSCA9IG1IIC0gMTsKKyAgICAgICAgICAgaW50IHF1YWRDb3VudCA9IHF1YWRXICogcXVhZEg7CisgICAgICAgICAgIGludCBpbmRleENvdW50ID0gcXVhZENvdW50ICogNjsKKyAgICAgICAgICAgbUluZGV4Q291bnQgPSBpbmRleENvdW50OworICAgICAgICAgICBtSW5kZXhCdWZmZXIgPSBCeXRlQnVmZmVyLmFsbG9jYXRlRGlyZWN0KENIQVJfU0laRSAqIGluZGV4Q291bnQpCisgICAgICAgICAgICAgICAub3JkZXIoQnl0ZU9yZGVyLm5hdGl2ZU9yZGVyKCkpLmFzQ2hhckJ1ZmZlcigpOworCisgICAgICAgICAgIC8qCisgICAgICAgICAgICAqIEluaXRpYWxpemUgdHJpYW5nbGUgbGlzdCBtZXNoLgorICAgICAgICAgICAgKgorICAgICAgICAgICAgKiAgICAgWzBdLS0tLS1bICAxXSAuLi4KKyAgICAgICAgICAgICogICAgICB8ICAgIC8gICB8CisgICAgICAgICAgICAqICAgICAgfCAgIC8gICAgfAorICAgICAgICAgICAgKiAgICAgIHwgIC8gICAgIHwKKyAgICAgICAgICAgICogICAgIFt3XS0tLS0tW3crMV0gLi4uCisgICAgICAgICAgICAqICAgICAgfCAgICAgICB8CisgICAgICAgICAgICAqCisgICAgICAgICAgICAqLworCisgICAgICAgICAgIHsKKyAgICAgICAgICAgICAgIGludCBpID0gMDsKKyAgICAgICAgICAgICAgIGZvciAoaW50IHkgPSAwOyB5IDwgcXVhZEg7IHkrKykgeworICAgICAgICAgICAgICAgICAgIGZvciAoaW50IHggPSAwOyB4IDwgcXVhZFc7IHgrKykgeworICAgICAgICAgICAgICAgICAgICAgICBjaGFyIGEgPSAoY2hhcikgKHkgKiBtVyArIHgpOworICAgICAgICAgICAgICAgICAgICAgICBjaGFyIGIgPSAoY2hhcikgKHkgKiBtVyArIHggKyAxKTsKKyAgICAgICAgICAgICAgICAgICAgICAgY2hhciBjID0gKGNoYXIpICgoeSArIDEpICogbVcgKyB4KTsKKyAgICAgICAgICAgICAgICAgICAgICAgY2hhciBkID0gKGNoYXIpICgoeSArIDEpICogbVcgKyB4ICsgMSk7CisKKyAgICAgICAgICAgICAgICAgICAgICAgbUluZGV4QnVmZmVyLnB1dChpKyssIGEpOworICAgICAgICAgICAgICAgICAgICAgICBtSW5kZXhCdWZmZXIucHV0KGkrKywgYyk7CisgICAgICAgICAgICAgICAgICAgICAgIG1JbmRleEJ1ZmZlci5wdXQoaSsrLCBiKTsKKworICAgICAgICAgICAgICAgICAgICAgICBtSW5kZXhCdWZmZXIucHV0KGkrKywgYik7CisgICAgICAgICAgICAgICAgICAgICAgIG1JbmRleEJ1ZmZlci5wdXQoaSsrLCBjKTsKKyAgICAgICAgICAgICAgICAgICAgICAgbUluZGV4QnVmZmVyLnB1dChpKyssIGQpOworICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgfQorCisgICAgICAgfQorCisgICAgICAgcHVibGljIHZvaWQgc2V0KGludCBpLCBpbnQgaiwgZmxvYXQgeCwgZmxvYXQgeSwgZmxvYXQgeikgeworICAgICAgICAgICBpZiAoaSA8IDAgfHwgaSA+PSBtVykgeworICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiaSIpOworICAgICAgICAgICB9CisgICAgICAgICAgIGlmIChqIDwgMCB8fCBqID49IG1IKSB7CisgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJqIik7CisgICAgICAgICAgIH0KKworICAgICAgICAgICBpbnQgaW5kZXggPSBtVyAqIGogKyBpOworCisgICAgICAgICAgIG1WZXJ0ZXhCdWZmZXIucG9zaXRpb24oaW5kZXggKiBWRVJURVhfU0laRSAvIEZMT0FUX1NJWkUpOworICAgICAgICAgICBtVmVydGV4QnVmZmVyLnB1dCh4KTsKKyAgICAgICAgICAgbVZlcnRleEJ1ZmZlci5wdXQoeSk7CisgICAgICAgICAgIG1WZXJ0ZXhCdWZmZXIucHV0KHopOworICAgICAgIH0KKworICAgICAgIHB1YmxpYyB2b2lkIGNyZWF0ZUJ1ZmZlck9iamVjdHMoR0wgZ2wpIHsKKyAgICAgICAgICAgLy8gR2VuZXJhdGUgYSB0aGUgdmVydGV4IGFuZCBlbGVtZW50IGJ1ZmZlciBJRHMKKyAgICAgICAg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kZGluZ0xlZnQ9IjZkaXAiCisgICAgICAgICAgICBhbmRyb2lkOmdyYXZpdHk9ImNlbnRlcl92ZXJ0aWNhbCIKKyAgICAgICAgICAgIGFuZHJvaWQ6b3JpZW50YXRpb249Imhvcml6b250YWwiCisgICAgICAgICAgICA+CisgICAgICAgICAgICA8dmlldworICAgICAgICAgICAgICAgIGNsYXNzPSJjb20uYW5kcm9pZC5zeXN0ZW11aS5zdGF0dXNiYXIudGFibGV0Lk5vdGlmaWNhdGlvbkljb25BcmVhJEljb25MYXlvdXQiCisgICAgICAgICAgICAgICAgYW5kcm9pZDppZD0iQCtpZC9pY29ucyIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0iQCphbmRyb2lkOmRpbWVuL3N0YXR1c19iYXJfaWNvbl9zaXplIgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X21hcmdpbkxlZnQ9IjhkaXAiCisgICAgICAgICAgICAgICAgLz4KKyAgICAgICAgICAgIDx2aWV3CisgICAgICAgICAgICAgICAgY2xhc3M9ImNvbS5hbmRyb2lkLnN5c3RlbXVpLnN0YXR1c2Jhci50YWJsZXQuTm90aWZpY2F0aW9uSWNvbkFyZWEkRHJhZ2dlclZpZXciCisgICAgICAgICAgICAgICAgYW5kcm9pZDppZD0iQCtpZC9oYW5kbGUiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2lkdGg9IjMyZGlwIgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0ibWF0Y2hfcGFyZW50IgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6YmFja2dyb3VuZD0iQGRyYXdhYmxlL3N5c2Jhcl9oaWRlbm90aWZpY2F0aW9uX2hhbmRsZSIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9tYXJnaW5MZWZ0PSI4ZGlwIgorICAgICAgICAgICAgICAgIC8+CisgICAgICAgICAgICA8SW1hZ2VWaWV3CisgICAgICAgICAgICAgICAgY2xhc3M9ImNvbS5hbmRyb2lkLnN5c3RlbXVpLnN0YXR1c2Jhci50YWJsZXQuTm90aWZpY2F0aW9uSWNvbkFyZWEkTW9yZVZpZXciCisgICAgICAgICAgICAgICAgYW5kcm9pZDppZD0iQCtpZC9leHBhbmQiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2lkdGg9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOnNyYz0iQGRyYXdhYmxlL2ljX3N5c2Jhcl9vcGVuIgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6b25DbGljaz0ibm90aWZpY2F0aW9uSWNvbnNDbGlja2VkIgorICAgICAgICAgICAgICAgIC8+CisKKyAgICAgICAgPC9jb20uYW5kcm9pZC5zeXN0ZW11aS5zdGF0dXNiYXIudGFibGV0Lk5vdGlmaWNhdGlvbkljb25BcmVhPgorCisgICAgICAgIDxMaW5lYXJMYXlvdXQgYW5kcm9pZDppZD0iQCtpZC90aWNrZXIiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0iMzAwZGlwIgorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfaGVpZ2h0PSJtYXRjaF9wYXJlbnQiCisgICAgICAgICAgICBhbmRyb2lkOnBhZGRpbmdMZWZ0PSI2ZGlwIgorICAgICAgICAgICAgYW5kcm9pZDphbmltYXRpb25DYWNoZT0iZmFsc2UiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9hbGlnbkxlZnQ9IkBpZC9ub3RpZmljYXRpb25JY29ucyIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2FsaWduVG9wPSJAaWQvbm90aWZpY2F0aW9uSWNvbnMiCisgICAgICAgICAgICBhbmRyb2lkOm9yaWVudGF0aW9uPSJob3Jpem9udGFsIgorICAgICAgICAgICAgYW5kcm9pZDp2aXNpYmlsaXR5PSJnb25lIgorICAgICAgICAgICAgPgorICAgICAgICAgICAgPEltYWdlVmlldyBhbmRyb2lkOmlkPSJAK2lkL3RpY2tlckljb24iCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2lkdGg9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9Im1hdGNoX3BhcmVudCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9tYXJnaW5SaWdodD0iOGRpcCIKKyAgICAgICAgICAgICAgICAvPgorICAgICAgICAgICAgPGNvbS5hbmRyb2lkLnN5c3RlbXVpLnN0YXR1c2Jhci5UaWNrZXJWaWV3IGFuZHJvaWQ6aWQ9IkAraWQvdGlja2VyVGV4dCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0iMGRpcCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93ZWlnaHQ9IjEiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfaGVpZ2h0PSJ3cmFwX2NvbnRlbnQiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpwYWRkaW5nVG9wPSIyZGlwIgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6cGFkZGluZ1JpZ2h0PSIxMGRpcCI+CisgICAgICAgICAgICAgICAgPFRleHRWaWV3CisgICAgICAgICAgICAgICAgICAgIGFuZHJvaWQ6dGV4dEFwcGVhcmFuY2U9IkAqYW5kcm9pZDpzdHlsZS9UZXh0QXBwZWFyYW5jZS5TdGF0dXNCYXIuVGlja2VyIgorICAgICAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0ibWF0Y2hfcGFyZW50IgorICAgICAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgICAgICAgICAgYW5kcm9pZDpzaW5nbGVMaW5lPSJ0cnVlIgorICAgICAgICAgICAgICAgICAgICAvPgorICAgICAgICAgICAgICAgIDxUZXh0VmlldworICAgICAgICAgICAgICAgICAgICBhbmRyb2lkOnRleHRBcHBlYXJhbmNlPSJAKmFuZHJvaWQ6c3R5bGUvVGV4dEFwcGVhcmFuY2UuU3RhdHVzQmFyLlRpY2tlciIKKyAgICAgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2lkdGg9Im1hdGNoX3BhcmVudCIKKyAgICAgICAgICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfaGVpZ2h0PSJ3cmFwX2NvbnRlbnQiCisgICAgICAgICAgICAgICAgICAgIGFuZHJvaWQ6c2luZ2xlTGluZT0idHJ1ZSIKKyAgICAgICAgICAgICAgICAgICAgLz4KKyAgICAgICAgICAgIDwvY29tLmFuZHJvaWQuc3lzdGVtdWkuc3RhdHVzYmFyLlRpY2tlclZpZXc+CisgICAgICAgIDwvTGluZWFyTGF5b3V0PgorCisgICAgICAgIDxpbmNsdWRlIGxheW91dD0iQGxheW91dC9zdGF0dXNfYmFyX2NlbnRlciIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dpZHRoPSIyNTZkaXAiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9Im1hdGNoX3BhcmVudCIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2NlbnRlckluUGFyZW50PSJ0cnVlIgorICAgICAgICAgICAgLz4KKworICAgICAgICA8Y29tLmFuZHJvaWQuc3lzdGVtdWkuc3RhdHVzYmFyLktleUJ1dHRvblZpZXcgYW5kcm9pZDppZD0iQCtpZC9tZW51IgorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfd2lkdGg9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b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KKyAgICAgICAgICAgIC8+CisKKyAgICAgICAgPFJlbGF0aXZlTGF5b3V0CisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0iMjU2ZGlwIgorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfaGVpZ2h0PSIxOTJkaXAiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9hbGlnblBhcmVudFJpZ2h0PSJ0cnVlIgorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfbWFyZ2luUmlnaHQ9IjQ4ZGlwIgorICAgICAgICAgICAgPgorICAgICAgICAgICAgPEltYWdlVmlldyBhbmRyb2lkOmlkPSJAK2lkL3NpZ25hbF9tZXRlciIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0iMjU2ZGlwIgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2FsaWduUGFyZW50Qm90dG9tPSJ0cnVlIgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6c2NhbGVUeXBlPSJjZW50ZXJDcm9wIgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6c3JjPSJAZHJhd2FibGUvc3lzYmFyX3NpZ25hbCIKKyAgICAgICAgICAgICAgICAvPgorCisgICAgICAgICAgICA8VGV4dFZpZXcgYW5kcm9pZDppZD0iQCtpZC9zaWduYWxfaW5mbyIKKyAgICAgICAgICAgICAgICBzdHlsZT0iQHN0eWxlL1RleHRBcHBlYXJhbmNlLlN0YXR1c0Jhci5TeXN0ZW1QYW5lbCIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0ibWF0Y2hfcGFyZW50IgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0iMjRkaXAiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpncmF2aXR5PSJjZW50ZXIiCisgICAg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mxlL2ljX3N5c2Jhcl93aWZpX29uIgorICAgICAgICAgICAgLz4KKyAgICA8L1JlbGF0aXZlTGF5b3V0PgorCisgICAgPCEtLSBib3R0b20gcm93OiB0cmFuc2llbnQgaW5kaWNhdG9ycywgc2V0dGluZ3MgYnV0dG9uIC0tPgorICAgIDxWaWV3CisgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dpZHRoPSJtYXRjaF9wYXJlbnQiCisgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0iMXNwIgorICAgICAgICBhbmRyb2lkOmJhY2tncm91bmQ9IkBhbmRyb2lkOmRyYXdhYmxlL2RpdmlkZXJfaG9yaXpvbnRhbF9kYXJrIgorICAgICAgICAvPgorICAgIDxSZWxhdGl2ZUxheW91dAorICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0ibWF0Y2hfcGFyZW50IgorICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9IjQ4ZGlwIgorICAgICAgICA+CisgICAgICAgIDxMaW5lYXJMYXlvdXQKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dpZHRoPSJ3cmFwX2NvbnRlbnQiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2FsaWduUGFyZW50TGVmdD0idHJ1ZSIKKyAgICAgICAgICAgIGFuZHJvaWQ6b3JpZW50YXRpb249Imhvcml6b250YWwiCisgICAgICAgICAgICA+CisgICAgICAgICAgICA8IS0tIFRPRE86IGFsYXJtIC0tPgorICAgICAgICAgICAgPCEtLSBUT0RPOiBzeW5jIC0tPgorICAgICAgICAgICAgPFRleHRWaWV3IGFuZHJvaWQ6aWQ9IkAraWQvZGF0ZSIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X2hlaWdodD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgICAgIC8+CisgICAgICAgIDwvTGluZWFyTGF5b3V0PgorCisgICAgICAgIDxUZXh0VmlldyBhbmRyb2lkOmlkPSJAK2lkL3NldHRpbmdzX2J1dHRvbiIKKyAgICAgICAgICAgIHN0eWxlPSJAc3R5bGUvVGV4dEFwcGVhcmFuY2UuU3RhdHVzQmFyLlRleHRCdXR0b24iCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0id3JhcF9jb250ZW50IgorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfaGVpZ2h0PSJ3cmFwX2NvbnRlbnQiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9hbGlnblBhcmVudFJpZ2h0PSJ0cnVlIgorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfY2VudGVyVmVydGljYWw9InRydWUiCisgICAgICAgICAgICBhbmRyb2lkOnBhZGRpbmdSaWdodD0iMzJkaXAiCisgICAgICAgICAgICBhbmRyb2lkOnBhZGRpbmdMZWZ0PSIzMmRpcCIKKyAgICAgICAgICAgIGFuZHJvaWQ6dGV4dFNpemU9IjIwc3AiCisgICAgICAgICAgICBhbmRyb2lkOnRleHQ9IkBzdHJpbmcvc3lzdGVtX3BhbmVsX3NldHRpbmdzX2J1dHRvbiIKKyAgICAgICAgICAgIC8+CisgICAgICAgIDxWaWV3CisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9Im1hdGNoX3BhcmVudCIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dpZHRoPSIxc3AiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF90b0xlZnRPZj0iQGlkL3NldHRpbmdzX2J1dHRvbiIKKyAgICAgICAgICAgIGFuZHJvaWQ6YmFja2dyb3VuZD0iQCphbmRyb2lkOmRyYXdhYmxlL2RpdmlkZXJfdmVydGljYWxfZGFyayIKKyAgICAgICAgICAgIC8+CisKKyAg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V9TWVNURU0KKyAgICAgICAgICAgICAgICAgICAgICAgIHwgS2V5RXZlbnQuRkxBR19WSVJUVUFMX0hBUkRfS0VZCisgICAgICAgICAgICAgICAgICAgICAgICB8IEtleUV2ZW50LkZMQUdfTE9OR19QUkVTUyk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9OworCisgICAgcHVibGljIEtleUJ1dHRvblZpZXcoQ29udGV4dCBjb250ZXh0LCBBdHRyaWJ1dGVTZXQgYXR0cnMpIHsKKyAgICAgICAgdGhpcyhjb250ZXh0LCBhdHRycywgMCk7CisgICAgfQorCisgICAgcHVibGljIEtleUJ1dHRvblZpZXcoQ29udGV4dCBjb250ZXh0LCBBdHRyaWJ1dGVTZXQgYXR0cnMsIGludCBkZWZTdHlsZSkgeworICAgICAgICBzdXBlcihjb250ZXh0LCBhdHRycyk7CisKKyAgICAgICAgVHlwZWRBcnJheSBhID0gY29udGV4dC5vYnRhaW5TdHlsZWRBdHRyaWJ1dGVzKGF0dHJzLCBSLnN0eWxlYWJsZS5LZXlCdXR0b25WaWV3LAorICAgICAgICAgICAgICAgIGRlZlN0eWxlLCAwKTsKKworICAgICAgICBtQ29kZSA9IGEuZ2V0SW50ZWdlcihSLnN0eWxlYWJsZS5LZXlCdXR0b25WaWV3X2tleUNvZGUsIDApOworICAgICAgICBpZiAobUNvZGUgPT0gMCkgeworICAgICAgICAgICAgU2xvZy53KFN0YXR1c0JhclNlcnZpY2UuVEFHLCAiS2V5QnV0dG9uVmlldyB3aXRob3V0IGtleSBjb2RlIGlkPTB4IgorICAgICAgICAgICAgICAgICAgICArIEludGVnZXIudG9IZXhTdHJpbmcoZ2V0SWQoKSkpOworICAgICAgICB9CisgICAgICAgIAorICAgICAgICBhLnJlY3ljbGUoKTsKKworICAgICAgICBtV2luZG93TWFuYWdlciA9IElXaW5kb3dNYW5hZ2VyLlN0dWIuYXNJbnRlcmZhY2UoCisgICAgICAgICAgICAgICAgU2VydmljZU1hbmFnZXIuZ2V0U2VydmljZShDb250ZXh0LldJTkRPV19TRVJWSUNFKSk7CisgICAgfQorCisgICAgcHVibGljIGJvb2xlYW4gb25Ub3VjaEV2ZW50KE1vdGlvbkV2ZW50IGV2KSB7CisgICAgICAgIGZpbmFsIGludCBhY3Rpb24gPSBldi5nZXRBY3Rpb24oKTsKKyAgICAgICAgaW50IHgsIHk7CisKKyAgICAgICAgc3dpdGNoIChhY3Rpb24pIHsKKyAgICAgICAgICAgIGNhc2UgTW90aW9uRXZlbnQuQUNUSU9OX0RPV046CisgICAgICAgICAgICAgICAgU2xvZy5kKCJLZXlCdXR0b25WaWV3IiwgInByZXNzIik7CisgICAgICAgICAgICAgICAgbURvd25UaW1lID0gU3lzdGVtQ2xvY2sudXB0aW1lTWlsbGlzKCk7CisgICAgICAgICAgICAgICAgbVJlcGVhdCA9IDA7CisgICAgICAgICAgICAgICAgbVNlbmRpbmcgPSB0cnVlOworICAgICAgICAgICAgICAgIG1Mb25nUHJlc3NlZCA9IGZhbHNlOworICAgICAgICAgICAgICAgIHNlbmRFdmVudChLZXlFdmVudC5BQ1RJT05fRE9XTiwKKyAgICAgICAgICAgICAgICAgICAgICAgIEtleUV2ZW50LkZMQUdfRlJPTV9TWVNURU0gfCBLZXlFdmVudC5GTEFHX1ZJUlRVQUxfSEFSRF9LRVksIG1Eb3duVGltZSk7CisgICAgICAgICAgICAgICAgc2V0UHJlc3NlZCh0cnVlKTsKKyAgICAgICAgICAgICAgICByZW1vdmVDYWxsYmFja3MobUNoZWNrTG9uZ1ByZXNzKTsKKyAgICAgICAgICAgICAgICBwb3N0RGVsYXllZChtQ2hlY2tMb25nUHJlc3MsIFZpZXdDb25maWd1cmF0aW9uLmdldExvbmdQcmVzc1RpbWVvdXQoKSk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICBjYXNlIE1vdGlvbkV2ZW50LkFDVElPTl9NT1ZFOgorICAgICAgICAgICAgICAgIGlmIChtU2VuZGluZykgeworICAgICAgICAgICAgICAgICAgICB4ID0gKGludClldi5nZXRYKCk7CisgICAgICAgICAgICAgICAgICAgIHkgPSAoaW50KWV2LmdldFkoKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKHggPCAwIHx8IHggPj0gZ2V0V2lkdGgoKSB8fCB5IDwgMCB8fCB5ID49IGdldEhlaWdodCgpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtU2VuZGluZyA9IGZhbHNlOworICAgICAgICAgICAgICAgICAgICAgICAgc2VuZEV2ZW50KEtleUV2ZW50LkFDVElPTl9VUCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgS2V5RXZlbnQuRkxBR19GUk9NX1NZU1RFTSB8IEtleUV2ZW50LkZMQUdfVklSVFVBTF9IQVJEX0tFWQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgS2V5RXZlbnQuRkxBR19DQU5DRUxFRCk7CisgICAgICAgICAgICAgICAgICAgICAgICBzZXRQcmVzc2VkKGZhbHNlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJlbW92ZUNhbGxiYWNrcyhtQ2hlY2tMb25nUHJlc3MpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBNb3Rpb25FdmVudC5BQ1RJT05fVVA6CisgICAgICAgICAgICBjYXNlIE1vdGlvbkV2ZW50LkFDVElPTl9DQU5DRUw6CisgICAgICAgICAgICAgICAgc2V0UHJlc3NlZChmYWxzZSk7CisgICAgICAgICAgICAgICAgaWYgKG1TZW5kaW5nICYmICFtTG9uZ1ByZXNzZWQpIHsKKyAgICAgICAgICAgICAgICAgICAgbVNlbmRpbmcgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICAgICAgc2VuZEV2ZW50KEtleUV2ZW50LkFDVElPTl9VUCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBLZXlFdmVudC5GTEFHX0ZST01fU1lTVEVN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SBpYzsKKyAgICAgICAgfQogICAgIH0KICAgICBwcml2YXRlIGZpbmFsIEFycmF5TGlzdDxFbnRyeT4gbUVudHJpZXMgPSBuZXcgQXJyYXlMaXN0PEVudHJ5PigpOworICAgIHByaXZhdGUgZmluYWwgQ29tcGFyYXRvcjxFbnRyeT4gbUVudHJ5Q21wID0gbmV3IENvbXBhcmF0b3I8RW50cnk+KCkgeworICAgICAgICBwdWJsaWMgaW50IGNvbXBhcmUoRW50cnkgYSwgRW50cnkgYikgeworICAgICAgICAgICAgcmV0dXJuIChpbnQpKGEubm90aWZpY2F0aW9uLm5vdGlmaWNhdGlvbi53aGVuIC0gYi5ub3RpZmljYXRpb24ubm90aWZpY2F0aW9uLndoZW4pOworICAgICAgICB9CisgICAgfTsKIAogICAgIHB1YmxpYyBpbnQgc2l6ZSgpIHsKICAgICAgICAgcmV0dXJuIG1FbnRyaWVzLnNpemUoKTsKICAgICB9CiAKLSAgICBwdWJsaWMgRW50cnkgZ2V0RW50cnlBdChpbnQgaW5kZXgpIHsKLSAgICAgICAgcmV0dXJuIG1FbnRyaWVzLmdldChpbmRleCk7CisgICAgcHVibGljIEVudHJ5IGdldChpbnQgaSkgeworICAgICAgICByZXR1cm4gbUVudHJpZXMuZ2V0KGkpOwogICAgIH0KIAotICAgIHB1YmxpYyBpbnQgZmluZEVudHJ5KElCaW5kZXIga2V5KSB7Ci0gICAgICAgIGZpbmFsIGludCBOID0gbUVudHJpZXMuc2l6ZSgpOwotICAgICAgICBmb3IgKGludCBpPTA7IGk8TjsgaSsrKSB7Ci0gICAgICAgICAgICBFbnRyeSBlbnRyeSA9IG1FbnRyaWVzLmdldChpKTsKLSAgICAgICAgICAgIGlmIChlbnRyeS5rZXkgPT0ga2V5KSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIGk7CisgICAgcHVibGljIEVudHJ5IGZpbmRCeUtleShJQmluZGVyIGtleSkgeworICAgICAgICBmb3IgKEVudHJ5IGUgOiBtRW50cmllcykgeworICAgICAgICAgICAgaWYgKGUua2V5ID09IGtleSkgeworICAgICAgICAgICAgICAgIHJldHVybiBlOwogICAgICAgICAgICAgfQogICAgICAgICB9Ci0gICAgICAgIHJldHVybiAtMTsKKyAgICAgICAgcmV0dXJuIG51bGw7CisgICAgfQorCisgICAgcHVibGljIGludCBhZGQoRW50cnkgZW50cnkpIHsKKyAgICAgICAgaW50IGk7CisgICAgICAgIGludCBOID0gbUVudHJpZXMuc2l6ZSgpOworICAgICAgICBmb3IgKGk9MDsgaTxOOyBpKyspIHsKKyAgICAgICAgICAgIGlmIChtRW50cnlDbXAuY29tcGFyZShtRW50cmllcy5nZXQoaSksIGVudHJ5KSA+IDApIHsKKyAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBtRW50cmllcy5hZGQoaSwgZW50cnkpOworICAgICAgICByZXR1cm4gaTsKICAgICB9CiAKICAgICBwdWJsaWMgaW50IGFkZChJQmluZGVyIGtleSwgU3RhdHVzQmFyTm90aWZpY2F0aW9uIG5vdGlmaWNhdGlvbiwgVmlldyByb3csIFZpZXcgY29udGVudCwKQEAgLTY2LDQyICs4OCwyMyBAQAogICAgICAgICBlbnRyeS5jb250ZW50ID0gY29udGVudDsKICAgICAgICAgZW50cnkuZXhwYW5kZWQgPSBleHBhbmRlZDsKICAgICAgICAgZW50cnkuaWNvbiA9IGljb247Ci0gICAgICAgIGZpbmFsIGludCBpbmRleCA9IGNob29zZUluZGV4KG5vdGlmaWNhdGlvbi5ub3RpZmljYXRpb24ud2hlbik7Ci0gICAgICAgIG1FbnRyaWVzLmFkZChpbmRleCwgZW50cnkpOwotICAgICAgICByZXR1cm4gaW5kZXg7CisgICAgICAgIHJldHVybiBhZGQoZW50cnkpOwogICAgIH0KIAogICAgIHB1YmxpYyBFbnRyeSByZW1vdmUoSUJpbmRlciBrZXkpIHsKLSAgICAgICAgZmluYWwgaW50IE4gPSBtRW50cmllcy5zaXplKCk7Ci0gICAgICAgIGZvciAoaW50IGk9MDsgaTxOOyBpKyspIHsKLSAgICAgICAgICAgIEVudHJ5IGVudHJ5ID0gbUVudHJpZXMuZ2V0KGkpOwotICAgICAgICAgICAgaWYgKGVudHJ5LmtleSA9PSBrZXkpIHsKLSAgICAgICAgICAgICAgICBtRW50cmllcy5yZW1vdmUoaSk7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIGVudHJ5OwotICAgICAgICAgICAgfQorICAgICAgICBFbnRyeSBlID0gZmluZEJ5S2V5KGtleSk7CisgICAgICAgIGlmIChlICE9IG51bGwpIHsKKyAgICAgICAgICAgIG1FbnRyaWVzLnJlbW92ZShlKTsKICAgICAgICAgfQotICAgICAgICByZXR1cm4gbnVsbDsKLSAgICB9Ci0KLSAgICBwcml2YXRlIGludCBjaG9vc2VJbmRleChmaW5hbCBsb25nIHdoZW4pIHsKLSAgICAgICAgZmluYWwgaW50IE4gPSBtRW50cmllcy5zaXplKCk7Ci0gICAgICAgIGZvciAoaW50IGk9MDsgaTxOOyBpKyspIHsKLSAgICAgICAgICAgIEVudHJ5IGVudHJ5ID0gbUVudHJpZXMuZ2V0KGkpOwotICAgICAgICAgICAgaWYgKGVudHJ5Lm5vdGlmaWNhdGlvbi5ub3RpZmljYXRpb24ud2hlbiA+IHdoZW4pIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gaTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgICAgICByZXR1cm4gTjsKKyAgICAgICAgcmV0dXJuIGU7CiAgICAgfQogCiAgICAgLyoqCiAgICAgICogUmV0dXJuIHdoZXRoZXIgdGhlcmUgYXJlIGFueSB2aXNpYmxlIGl0ZW1zIChpLmUuIGl0ZW1zIHdpdGhvdXQgYW4gZXJyb3IpLgogICAgICAqLwogICAgIHB1YmxpYyBib29sZWFuIGhhc1Zpc2libGVJdGVtcygpIHsKLSAgICAgICAgZmluYWwgaW50IE4gPSBtRW50cmllcy5zaXplKCk7Ci0gICAgICAgIGZvciAoaW50IGk9MDs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T04gPSAoMTAwMC82MCk7CisKKyAgICBib29sZWFuIG1BbmltYXRpbmc7CisgICAgbG9uZyBtQ3VyQW5pbWF0aW9uVGltZTsKKyAgICBmbG9hdCBtRGlzcGxheUhlaWdodDsKKyAgICBmbG9hdCBtQW5pbVk7CisgICAgZmxvYXQgbUFuaW1WZWw7CisgICAgZmxvYXQgbUFuaW1BY2NlbDsKKyAgICBsb25nIG1BbmltTGFzdFRpbWU7CisgICAgYm9vbGVhbiBtQW5pbWF0aW5nUmV2ZWFsID0gZmFsc2U7CisgICAgaW50IG1WaWV3RGVsdGE7CisgICAgaW50W10gbUFic1BvcyA9IG5ldyBpbnRbMl07CisKKyAgICAvLyBmb3IgZGlzYWJsaW5nIHRoZSBzdGF0dXMgYmFyCisgICAgaW50IG1EaXNhYmxlZCA9IDA7CisKKyAgICBwcml2YXRlIGNsYXNzIEV4cGFuZGVkRGlhbG9nIGV4dGVuZHMgRGlhbG9nIHsKKyAgICAgICAgRXhwYW5kZWREaWFsb2coQ29udGV4dCBjb250ZXh0KSB7CisgICAgICAgICAgICBzdXBlcihjb250ZXh0LCBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlLlRoZW1lX0xpZ2h0X05vVGl0bGVCYXIpOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBib29sZWFuIGRpc3BhdGNoS2V5RXZlbnQoS2V5RXZlbnQgZXZlbnQpIHsKKyAgICAgICAgICAgIGJvb2xlYW4gZG93biA9IGV2ZW50LmdldEFjdGlvbigpID09IEtleUV2ZW50LkFDVElPTl9ET1dOOworICAgICAgICAgICAgc3dpdGNoIChldmVudC5nZXRLZXlDb2RlKCkpIHsKKyAgICAgICAgICAgIGNhc2UgS2V5RXZlbnQuS0VZQ09ERV9CQUNLOgorICAgICAgICAgICAgICAgIGlmICghZG93bikgeworICAgICAgICAgICAgICAgICAgICBhbmltYXRlQ29sbGFwc2UoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gc3VwZXIuZGlzcGF0Y2hLZXlFdmVudChldmVudCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCBvbkNyZWF0ZSgpIHsKKyAgICAgICAgbURpc3BsYXkgPSAoKFdpbmRvd01hbmFnZXIpZ2V0U3lzdGVtU2VydmljZShDb250ZXh0LldJTkRPV19TRVJWSUNFKSkuZ2V0RGVmYXVsdERpc3BsYXkoKTsKKworICAgICAgICBzdXBlci5vbkNyZWF0ZSgpOworCisgICAgICAgIGFkZEludHJ1ZGVyVmlldygpOworCisgICAgICAgIC8vIExhc3RseSwgY2FsbCB0byB0aGUgaWNvbiBwb2xpY3kgdG8gaW5zdGFsbC91cGRhdGUgYWxsIHRoZSBpY29ucy4KKyAgICAgICAgbUljb25Qb2xpY3kgPSBuZXcgU3RhdHVzQmFyUG9saWN5KHRoaXMpOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIG9uRGVzdHJveSgpIHsKKyAgICAgICAgLy8gd2UncmUgbmV2ZXIgZGVzdHJveWVkCisgICAgfQorCisgICAgLy8gPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KKyAgICAvLyBDb25zdHJ1Y3RpbmcgdGhlIHZpZXcKKyAgICAvLyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQorICAgIHByb3RlY3RlZCBWaWV3IG1ha2VTdGF0dXNCYXJWaWV3KCkgeworICAgICAgICBmaW5hbCBDb250ZXh0IGNvbnRleHQgPSB0aGlzOworCisgICAgICAgIFJlc291cmNlcyByZXMgPSBjb250ZXh0LmdldFJlc291cmNl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bHRlci5hZGRBY3Rpb24oSW50ZW50LkFDVElPTl9TQ1JFRU5fT0ZGKTsKKyAgICAgICAgY29udGV4dC5yZWdpc3RlclJlY2VpdmVyKG1Ccm9hZGNhc3RSZWNlaXZlciwgZmlsdGVyKTsKKworICAgICAgICByZXR1cm4gc2I7CisgICAgfQorCisgICAgcHJvdGVjdGVkIGludCBnZXRTdGF0dXNCYXJHcmF2aXR5KCkgeworICAgICAgICByZXR1cm4gR3Jhdml0eS5UT1AgfCBHcmF2aXR5LkZJTExfSE9SSVpPTlRBTDsKKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgYWRkSW50cnVkZXJWaWV3KCkgeworICAgICAgICBmaW5hbCBSZXNvdXJjZXMgcmVzID0gZ2V0UmVzb3VyY2VzKCk7CisgICAgICAgIGZpbmFsIGludCBoZWlnaHQ9IHJlcy5nZXREaW1lbnNpb25QaXhlbFNpemUoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5kaW1lbi5zdGF0dXNfYmFyX2hlaWdodCk7CisKKyAgICAgICAgV2luZG93TWFuYWdlci5MYXlvdXRQYXJhbXMgbHAgPSBuZXcgV2luZG93TWFuYWdlci5MYXlvdXRQYXJhbXMoCisgICAgICAgICAgICAgICAgVmlld0dyb3VwLkxheW91dFBhcmFtcy5NQVRDSF9QQVJFTlQsCisgICAgICAgICAgICAgICAgVmlld0dyb3VwLkxheW91dFBhcmFtcy5XUkFQX0NPTlRFTlQsCisgICAgICAgICAgICAgICAgV2luZG93TWFuYWdlci5MYXlvdXRQYXJhbXMuVFlQRV9TVEFUVVNfQkFSX1BBTkVMLAorICAgICAgICAgICAgICAgIFdpbmRvd01hbmFnZXIuTGF5b3V0UGFyYW1zLkZMQUdfTEFZT1VUX0lOX1NDUkVFTgorICAgICAgICAgICAgICAgICAgICB8IFdpbmRvd01hbmFnZXIuTGF5b3V0UGFyYW1zLkZMQUdfTEFZT1VUX05PX0xJTUlUUworICAgICAgICAgICAgICAgICAgICB8IFdpbmRvd01hbmFnZXIuTGF5b3V0UGFyYW1zLkZMQUdfTk9UX1RPVUNIX01PREFMCisgICAgICAgICAgICAgICAgICAgIHwgV2luZG93TWFuYWdlci5MYXlvdXRQYXJhbXMuRkxBR19OT1RfRk9DVVNBQkxFCisgICAgICAgICAgICAgICAgICAgIHwgV2luZG93TWFuYWdlci5MYXlvdXRQYXJhbXMuRkxBR19BTFRfRk9DVVNBQkxFX0lNLAorICAgICAgICAgICAgICAgIFBpeGVsRm9ybWF0LlRSQU5TTFVDRU5UKTsKKyAgICAgICAgbHAuZ3Jhdml0eSA9IEdyYXZpdHkuVE9QIHwgR3Jhdml0eS5GSUxMX0hPUklaT05UQUw7CisgICAgICAgIGxwLnkgKz0gaGVpZ2h0ICogMS41OyAvLyBGSVhNRQorICAgICAgICBscC5zZXRUaXRsZSgiSW50cnVkZXJBbGVydCIpOworICAgICAgICBscC53aW5kb3dBbmltYXRpb25zID0gY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZS5BbmltYXRpb25fU3RhdHVzQmFyX0ludHJ1ZGVyQWxlcnQ7CisKKyAgICAgICAgV2luZG93TWFuYWdlckltcGwuZ2V0RGVmYXVsdCgpLmFkZFZpZXcobUludHJ1ZGVyQWxlcnRWaWV3LCBscCk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgYWRkSWNvbihTdHJpbmcgc2xvdCwgaW50IGluZGV4LCBpbnQgdmlld0luZGV4LCBTdGF0dXNCYXJJY29uIGljb24pIHsKKyAgICAgICAgaWYgKFNQRVcpIFNsb2cuZChUQUcsICJhZGRJY29uIHNsb3Q9IiArIHNsb3QgKyAiIGluZGV4PSIgKyBpbmRleCArICIgdmlld0luZGV4PSIgKyB2aWV3SW5kZXgKKyAgICAgICAgICAgICAgICArICIgaWNvbj0iICsgaWNvbik7CisgICAgICAgIFN0YXR1c0Jhckljb25WaWV3IHZpZXcgPSBuZXcgU3RhdHVzQmFySWNvblZpZXcodGhpcywgc2xvdCk7CisgICAgICAgIHZpZXcuc2V0KGljb24pOworICAgICAgICBtU3RhdHVzSWNvbnMuYWRkVmlldyh2aWV3LCB2aWV3SW5kZXgsIG5ldyBMaW5lYXJMYXlvdXQuTGF5b3V0UGFyYW1zKG1JY29uU2l6ZSwgbUljb25TaXplKSk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdXBkYXRlSWNvbihTdHJpbmcgc2xvdCwgaW50IGluZGV4LCBpbnQgdmlld0luZGV4LAorICAgICAgICAgICAgU3RhdHVzQmFySWNvbiBvbGQsIFN0YXR1c0Jhckljb24gaWNvbikgeworICAgICAgICBpZiAoU1BFVykgU2xvZy5kKFRBRywgInVwZGF0ZUljb24gc2xvdD0iICsgc2xvdCArICIgaW5kZXg9IiArIGluZGV4ICsgIiB2aWV3SW5kZXg9IiArIHZpZXdJbmRleAorICAgICAgICAgICAgICAgICsgIiBvbGQ9IiArIG9sZCArICIgaWNvbj0iICsgaWNvbik7CisgICAgICAgIFN0YXR1c0Jhckljb25WaWV3IHZpZXcgPSAoU3RhdHVzQmFySWNvblZpZXcpbVN0YXR1c0ljb25zLmdldENoaWxkQXQodmlld0luZGV4KTsKKyAgICAgICAgdmlldy5zZXQoaWNvbik7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgcmVtb3ZlSWNvbihTdHJpbmcgc2xvdCwgaW50IGluZGV4LCBpbnQgdmlld0luZGV4KSB7CisgICAgICAgIGlmIChTUEVXKSBTbG9nLmQoVEFHLCAicmVtb3ZlSWNvbiBzbG90PSIgKyBzbG90ICsgIiBpbmRleD0iICsgaW5kZXggKyAiIHZpZXdJbmRleD0iICsgdmlld0luZGV4KTsKKyAgICAgICAgbVN0YXR1c0ljb25zLnJlbW92ZVZpZXdBdCh2aWV3SW5kZXgpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGFkZE5vdGlmaWNhdGlvbihJQmluZGVyIGtleSwgU3RhdHVzQmFyTm90aWZpY2F0aW9uIG5vdGlmaWNhdGlvbikgeworICAgICAgICBTdGF0dXNCYXJJY29uVmlldyBpY29uVmlldyA9IGFkZE5vdGlmaWNhdGlvblZpZXdzKGtleSwgbm90aWZpY2F0aW9uKTsKKyAgICAgICAgaWYgKGljb25WaWV3ID09IG51bGwpIHJldHVybjsKKworICAgICAgICBib29sZWFuIGltbWVyc2l2ZSA9IGZhbHNlOworICAgICAgICB0cnkgeworICAgICAgICAgICAgaW1tZXJzaXZlID0gQWN0aXZpdHlNYW5hZ2VyTmF0aXZlLmdldERlZmF1bHQoKS5pc1RvcEFjdGl2aXR5SW1tZXJzaXZlKCk7CisgICAgICAgICAgICBTbG9nLmQoVEFHLCAiVG9wIGFjdGl2aXR5IGlzICIgKyAoaW1tZXJzaXZlPyJpbW1lcnNpdmUiOiJub3QgaW1tZXJzaXZlIikpOworICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZXgpIHsKKyAgICAgICAgfQorICAgICAgICBpZiAoaW1tZXJzaXZlKSB7CisgICAgICAgICAgICBpZiAoKG5vdGlmaWNhdGlvbi5ub3RpZmljYXRpb24uZmxhZ3MgJiBOb3RpZmljYXRpb24uRkxBR19ISUdIX1BSSU9SSVRZKSAhPSAwKSB7CisgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgIlByZXNlbnRpbmcgaGlnaC1wcmlvcml0eSBub3RpZmljYXRpb24gaW4gaW1tZXJzaXZlIGFjdGl2aXR5Iik7CisgICAgICAgICAgICAgICAgLy8gc3BlY2lhbCBuZXcgdHJhbnNpZW50IHRpY2tlciBtb2RlCisgICAgICAgICAgICAgICAgLy8gMS4gUG9wdWxhdGUgbUludHJ1ZGVyQWxlcnRWaWV3CisKKyAgICAgICAgICAgICAgICBJbWFnZVZpZXcgYWxlcnRJY29uID0gKEltYWdlVmlldykgbUludHJ1ZGVyQWxlcnRWaWV3LmZpbmRWaWV3QnlJZChSLmlkLmFsZXJ0SWNvbik7CisgICAgICAgICAgICAgICAgVGV4dFZpZXcgYWxlcnRUZXh0ID0gKFRleHRWaWV3KSBtSW50cnVkZXJBbGVydFZpZXcuZmluZFZpZXdCeUlkKFIuaWQuYWxlcnRUZXh0KTsKKyAgICAgICAgICAgICAgICBhbGVydEljb24uc2V0SW1hZ2VEcmF3YWJsZShTdGF0dXNCYXJJY29uVmlldy5nZXRJY29uKAorICAgICAgICAgICAgICAgICAgICBhbGVydEljb24uZ2V0Q29udGV4dCgpLAorICAgICAgICAgICAgICAgICAgICBpY29uVmlldy5nZXRTdGF0dXNCYXJJY29uKCkpKTsKKyAgICAgICAgICAgICAgICBhbGVydFRleHQuc2V0VGV4dChub3RpZmljYXRpb24ubm90aWZpY2F0aW9uLnRpY2tlclRleHQpOworCisgICAgICAgICAgICAgICAgVmlldyBidXR0b24gPSBtSW50cnVkZXJBbGVydFZpZXcuZmluZFZpZXdCeUlkKFIuaWQuaW50cnVkZXJfYWxlcnRfY29udGVudCk7CisgICAgICAgICAgICAgICAgYnV0dG9uLnNldE9uQ2xpY2tMaXN0ZW5lcigKKyAgICAgICAgICAgICAgICAgICAgbmV3IExhdW5jaGVyKG5vdGlmaWNhdGlvbi5ub3RpZmljYXRpb24uY29udGVudEludGVudCwKKyAgICAgICAgICAgICAgICAgICAgICAgIG5vdGlmaWNhdGlvbi5wa2csIG5vdGlmaWNhdGlvbi50YWcsIG5vdGlmaWNhdGlvbi5pZCkpOworCisgICAgICAgICAgICAgICAgLy8gMi4gQW5pbWF0ZSBtSW50cnVkZXJBbGVydFZpZXcgaW4KKyAgICAgICAgICAgICAgICBtSGFuZGxlci5zZW5kRW1wdHlNZXNzYWdlKE1TR19TSE9XX0lOVFJVREVSKTsKKworICAgICAgICAgICAgICAgIC8vIDMuIFNldCBhbGFybSB0byBhZ2UgdGhlIG5vdGlmaWNhdGlvbiBvZmYgKFRPRE8pCisgICAgICAgICAgICAgICAgbUhhbmRsZXIucmVtb3ZlTWVzc2FnZXMoTVNHX0hJREVfSU5UUlVERVIpOworICAgICAgICAgICAgICAgIG1IYW5kbGVyLnNlbmRFbXB0eU1lc3NhZ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05FKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB1cGRhdGVOb3RpZmljYXRpb24oSUJpbmRlciBrZXksIFN0YXR1c0Jhck5vdGlmaWNhdGlvbiBub3RpZmljYXRpb24pIHsKKyAgICAgICAgU2xvZy5kKFRBRywgInVwZGF0ZU5vdGlmaWNhdGlvbiBrZXk9IiArIGtleSArICIgbm90aWZpY2F0aW9uPSIgKyBub3RpZmljYXRpb24pOworCisgICAgICAgIE5vdGlmaWNhdGlvbkRhdGEgb2xkTGlzdDsKKyAgICAgICAgTm90aWZpY2F0aW9uRGF0YS5FbnRyeSBvbGRFbnRyeSA9IG1PbmdvaW5nLmZpbmRCeUtleShrZXkpOworICAgICAgICBpZiAob2xkRW50cnkgIT0gbnVsbCkgeworICAgICAgICAgICAgb2xkTGlzdCA9IG1PbmdvaW5nOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgb2xkRW50cnkgPSBtTGF0ZXN0LmZpbmRCeUtleShrZXkpOworICAgICAgICAgICAgaWYgKG9sZEVudHJ5ID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICBTbG9nLncoVEFHLCAidXBkYXRlTm90aWZpY2F0aW9uIGZvciB1bmtub3duIGtleTogIiArIGtleSk7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorICAgICAgICAgICAgb2xkTGlzdCA9IG1MYXRlc3Q7CisgICAgICAgIH0KKyAgICAgICAgZmluYWwgU3RhdHVzQmFyTm90aWZpY2F0aW9uIG9sZE5vdGlmaWNhdGlvbiA9IG9sZEVudHJ5Lm5vdGlmaWNhdGlvbjsKKyAgICAgICAgZmluYWwgUmVtb3RlVmlld3Mgb2xkQ29udGVudFZpZXcgPSBvbGROb3RpZmljYXRpb24ubm90aWZpY2F0aW9uLmNvbnRlbnRWaWV3OworCisgICAgICAgIGZpbmFsIFJlbW90ZVZpZXdzIGNvbnRlbnRWaWV3ID0gbm90aWZpY2F0aW9uLm5vdGlmaWNhdGlvbi5jb250ZW50VmlldzsKKworICAgICAgICBpZiAoZmFsc2UpIHsKKyAgICAgICAgICAgIFNsb2cuZChUQUcsICJvbGQgbm90aWZpY2F0aW9uOiB3aGVuPSIgKyBvbGROb3RpZmljYXRpb24ubm90aWZpY2F0aW9uLndoZW4KKyAgICAgICAgICAgICAgICAgICAgKyAiIG9uZ29pbmc9IiArIG9sZE5vdGlmaWNhdGlvbi5pc09uZ29pbmcoKQorICAgICAgICAgICAgICAgICAgICArICIgZXhwYW5kZWQ9IiArIG9sZEVudHJ5LmV4cGFuZGVkCisgICAgICAgICAgICAgICAgICAgICsgIiBjb250ZW50Vmlldz0iICsgb2xkQ29udGVudFZpZXcpOworICAgICAgICAgICAgU2xvZy5kKFRBRywgIm5ldyBub3RpZmljYXRpb246IHdoZW49IiArIG5vdGlmaWNhdGlvbi5ub3RpZmljYXRpb24ud2hlbgorICAgICAgICAgICAgICAgICAgICArICIgb25nb2luZz0iICsgb2xkTm90aWZpY2F0aW9uLmlzT25nb2luZygpCisgICAgICAgICAgICAgICAgICAgICsgIiBjb250ZW50Vmlldz0iICsgY29udGVudFZpZXcpOworICAgICAgICB9CisKKyAgICAgICAgLy8gQ2FuIHdlIGp1c3QgcmVhcHBseSB0aGUgUmVtb3RlVmlld3MgaW4gcGxhY2U/ICBJZiB3aGVuIGRpZG4ndCBjaGFuZ2UsIHRoZSBvcmRlcgorICAgICAgICAvLyBkaWRuJ3QgY2hhbmdlLgorICAgICAgICBpZiAobm90aWZpY2F0aW9uLm5vdGlmaWNhdGlvbi53aGVuID09IG9sZE5vdGlmaWNhdGlvbi5ub3RpZmljYXRpb24ud2hlbgorICAgICAgICAgICAgICAgICYmIG5vdGlmaWNhdGlvbi5pc09uZ29pbmcoKSA9PSBvbGROb3RpZmljYXRpb24uaXNPbmdvaW5nKCkKKyAgICAgICAgICAgICAgICAmJiBvbGRFbnRyeS5leHBhbmRlZCAhPSBudWxsCisgICAgICAgICAgICAgICAgJiYgY29udGVudFZpZXcgIT0gbnVsbCAmJiBvbGRDb250ZW50VmlldyAhPSBudWxsCisgICAgICAgICAgICAgICAgJiYgY29udGVudFZpZXcuZ2V0UGFja2FnZSgpICE9IG51bGwKKyAgICAgICAgICAgICAgICAmJiBvbGRDb250ZW50Vmlldy5nZXRQYWNrYWdlKCkgIT0gbnVsbAorICAgICAgICAgICAgICAgICYmIG9sZENvbnRlbnRWaWV3LmdldFBhY2thZ2UoKS5lcXVhbHMoY29udGVudFZpZXcuZ2V0UGFja2FnZSgpKQorICAgICAgICAgICAgICAgICYmIG9sZENvbnRlbnRWaWV3LmdldExheW91dElkKCkgPT0gY29udGVudFZpZXcuZ2V0TGF5b3V0SWQoKSkgeworICAgICAgICAgICAgaWYgKFNQRVcpIFNsb2cuZChUQUcsICJyZXVzaW5nIG5vdGlmaWNhdGlvbiIpOworICAgICAgICAgICAgb2xkRW50cnkubm90aWZpY2F0aW9uID0gbm90aWZpY2F0aW9uOworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAvLyBSZWFwcGx5IHRoZSBSZW1vdGVWaWV3cworICAgICAgICAgICAgICAgIGNvbnRlbnRWaWV3LnJlYXBwbHkodGhpcywgb2xkRW50cnkuY29udGVudCk7CisgICAgICAgICAgICAgICAgLy8gdXBkYXRlIHRoZSBjb250ZW50SW50ZW50CisgICAgICAgICAgICAgICAgZmluYWwgUGVuZGluZ0ludGVudCBjb250ZW50SW50ZW50ID0gbm90aWZpY2F0aW9uLm5vdGlmaWNhdGlvbi5jb250ZW50SW50ZW50OworICAgICAgICAgICAgICAgIGlmIChjb250ZW50SW50ZW50ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgb2xkRW50cnkuY29udGVudC5zZXRPbkNsaWNrTGlzdGVuZXIobmV3IExhdW5jaGVyKGNvbnRlbnRJbnRlbnQsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5vdGlmaWNhdGlvbi5wa2csIG5vdGlmaWNhdGlvbi50YWcsIG5vdGlmaWNhdGlvbi5pZCkpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAvLyBVcGRhdGUgdGhlIGljb24uCisgICAgICAgICAgICAgICAgZmluYWwgU3RhdHVzQmFySWNvbiBpYyA9IG5ldyBTdGF0dXNCYXJJY29uKG5vdGlmaWNhdGlvbi5wa2csCisgICAgICAgICAgICAgICAgICAgICAgICBub3RpZmljYXRpb24ubm90aWZpY2F0aW9uLmljb24sIG5vdGlmaWNhdGlvbi5ub3RpZmljYXRpb24uaWNvbkxldmVsLAorICAgICAgICAgICAgICAgICAgICAgICAgbm90aWZpY2F0aW9uLm5vdGlmaWNhdGlvbi5udW1iZXIpOworICAgICAgICAgICAgICAgIGlmICghb2xkRW50cnkuaWNvbi5zZXQoaWMpKSB7CisgICAgICAgICAgICAgICAgICAgIGhhbmRsZU5vdGlmaWNhdGlvbkVycm9yKGtleSwgbm90aWZpY2F0aW9uLCAiQ291bGRuJ3QgdXBkYXRlIGljb246ICIgKyBpYyk7CisgICAgICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBjYXRjaCAoUnVudGltZUV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgLy8gSXQgZmFpbGVkIHRvIGFkZCBjbGVhbmx5LiAgTG9nLCBhbmQgcmVtb3ZlIHRoZSB2aWV3IGZyb20gdGhlIHBhbmVsLgorICAgICAgICAgICAgICAgIFNsb2cudyhUQUcsICJDb3VsZG4ndCByZWFwcGx5IHZpZXdzIGZvciBwYWNrYWdlICIgKyBjb250ZW50Vmlldy5nZXRQYWNrYWdlKCksIGUpOworICAgICAgICAgICAgICAgIHJlbW92ZU5vdGlmaWNhdGlvblZpZXdzKGtleSk7CisgICAgICAgICAgICAgICAgYWRkTm90aWZpY2F0aW9uVmlld3Moa2V5LCBub3RpZmljYXRpb24pOworICAgICAgICAgICAgfQorICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgaWYgKFNQRVcpIFNsb2cuZChUQUcsICJub3QgcmV1c2luZyBub3RpZmljYXRpb24iKTsKKyAgICAgICAgICAgIHJlbW92ZU5vdGlmaWNhdGlvblZpZXdzKGtleSk7CisgICAgICAgICAgICBhZGROb3RpZmljYXRpb25WaWV3cyhrZXksIG5vdGlmaWNhdGlvbik7CisgICAgICAgIH0KKworICAgICAgICAvLyBSZXN0YXJ0IHRoZSB0aWNrZXIgaWYgaXQncyBzdGlsbCBydW5uaW5nCisgICAgICAgIGlmIChub3RpZmljYXRpb24ubm90aWZpY2F0aW9uLnRpY2tlclRleHQgIT0gbnVsbAorICAgICAgICAgICAgICAgICYmICFUZXh0VXRpbHMuZXF1YWxzKG5vdGlmaWNhdGlvbi5ub3RpZmljYXRpb24udGlja2VyVGV4dCwKKyAgICAgICAgICAgICAgICAgICAgb2xkRW50cnkubm90aWZpY2F0aW9uLm5vdGlmaWNhdGlvbi50aWNrZXJUZXh0KSkgeworICAgICAgICAgICAgdGljayhub3RpZmljYXRpb24pOworICAgICAgICB9CisKKyAgICAgICAgLy8gUmVjYWxjdWxhdGUgdGhlIHBvc2l0aW9uIG9mIHRoZSBzbGlkaW5nIHdpbmRvd3MgYW5kIHRoZSB0aXRsZXMuCisgICAgICAgIHNldEFyZVRoZXJlTm90aWZpY2F0aW9ucygpOworICAgICAgICB1cGRhdGVFeHBhbmRlZFZpZXdQb3MoRVhQQU5ERURfTEVBVkVfQUxPTkUpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHJlbW92ZU5vdGlmaWNhdGlvbihJQmluZGVyIGtleSkgeworICAgICAgICBpZiAoU1BFVykgU2xvZy5kKFRBRywgInJlbW92ZU5vdGlmaWNhdGlvbiBrZXk9IiArIGtleSk7CisgICAgICAgIFN0YXR1c0Jhck5vdGlmaWNhdGlvbiBvbGQgPSByZW1vdmVOb3RpZmljYXRpb25WaWV3cyhrZXkpOworCisgICAgICAgIGlmIChvbGQgIT0gbnVsbCkgeworICAgICAgICAgICAgLy8gQ2FuY2VsIHRoZSB0aWNrZXIgaWYgaXQncyBzdGlsbCBydW5uaW5nCisgICAgICAgICAgICBtVGlja2VyLnJlbW92ZUVudHJ5KG9sZCk7CisKKyAgICAgICAgICAgIC8vIFJlY2FsY3VsYXRlIHRoZSBwb3NpdGlvbiBvZiB0aGUgc2xpZGluZyB3aW5kb3dzIGFuZCB0aGUgdGl0bGVzLgorICAgICAgICAgICAgc2V0QXJlVGhlcmVOb3RpZmljYXRpb25zKCk7CisgICAgICAgICAgICB1cGRhdGVFeHBhbmRlZFZpZXdQb3MoRVhQQU5ERURfTEVBVkVfQUxPTkUpOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSBpbnQgY2hvb3NlSWNvbkluZGV4KGJvb2xlYW4gaXNPbmdvaW5nLCBpbnQgdmlld0luZGV4KSB7CisgICAgICAgIGZpbmFsIGludCBsYXRlc3RTaXplID0gbUxhdGVzdC5zaXplKCk7CisgICAgICAgIGlmIChpc09uZ29pbmcpIHsKKyAgICAgICAgICAgIHJldHVybiBsYXRlc3RTaXplICsgKG1PbmdvaW5nLnNpemUoKSAtIHZpZXdJbmRleCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICByZXR1cm4gbGF0ZXN0U2l6ZSAtIHZpZXdJbmRleDsKKyAgICAgICAgfQorICAgIH0KKworICAgIFZpZXdbXSBtYWtlTm90aWZpY2F0aW9uVmlldyhTdGF0dXNCYXJOb3RpZmljYXRpb24gbm90aWZpY2F0aW9uLCBWaWV3R3JvdXAgcGFyZW50KSB7CisgICAgICAgIE5vdGlmaWNhdGlvbiBuID0gbm90aWZpY2F0aW9uLm5vdGlmaWNhdGlvbjsKKyAgICAgICAgUmVtb3RlVmlld3MgcmVtb3RlVmlld3MgPSBuLmNvbnRlbnRWaWV3OworICAgICAgICBpZiAocmVtb3RlVmlld3MgPT0gbnVsbCkgeworICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgIH0KKworICAgICAgICAvLyBjcmVhdGUgdGhlIHJvdyB2aWV3CisgICAgICAgIExheW91dEluZmxhdGVyIGluZmxhdGVyID0gKExheW91dEluZmxhdGVyKWdldFN5c3RlbVNlcnZpY2UoQ29udGV4dC5MQVlPVVRfSU5GTEFURVJfU0VSVklDRSk7CisgICAgICAgIFZpZXcgcm93ID0gaW5mbGF0ZXIuaW5mbGF0ZShSLmxheW91dC5zdGF0dXNfYmFyX2xhdGVzdF9ldmVudCwgcGFyZW50LCBmYWxzZSk7CisKKyAgICAgICAgLy8gYmluZCB0aGUgY2xpY2sgZXZlbnQgdG8gdGhlIGNvbnRlbnQgYXJlYQorICAgICAgICBWaWV3R3JvdXAgY29udGVudCA9IChWaWV3R3JvdXApcm93LmZpbmRWaWV3QnlJZChSLmlkLmNvbnRlbnQpOworICAgICAgICBjb250ZW50LnNldERlc2NlbmRhbnRGb2N1c2FiaWxpdHkoVmlld0dyb3VwLkZPQ1VTX0JMT0NLX0RFU0NFTkRBTlRTKTsKKyAgICAgICAgY29udGVudC5zZXRPbkZvY3VzQ2hhbmdlTGlzdGVuZXIobUZvY3VzQ2hhbmdlTGlzdGVuZXIpOworICAgICAgICBQZW5kaW5nSW50ZW50IGNvbnRlbnRJbnRlbnQgPSBuLmNvbnRlbnRJbnRlbnQ7CisgICAgICAgIGlmIChjb250ZW50SW50ZW50ICE9IG51bGwpIHsKKyAgICAgICAgICAgIGNvbnRlbnQuc2V0T25DbGlja0xpc3RlbmVyKG5ldyBMYXVuY2hlcihjb250ZW50SW50ZW50LCBub3RpZmljYXRpb24ucGtnLAorICAgICAgICAgICAgICAgICAgICAgICAgbm90aWZpY2F0aW9uLnRhZywgbm90aWZpY2F0aW9uLmlkKSk7CisgICAgICAgIH0KKworICAgICAgICBWaWV3IGV4cGFuZGVkID0gbnVsbDsKKyAgICAgICAgRXhjZXB0aW9uIGV4Y2VwdGlvbiA9IG51bGw7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBleHBhbmRlZCA9IHJlbW90ZVZpZXdzLmFwcGx5KHRoaXMsIGNvbnRlbnQpOworICAgICAgICB9CisgICAgICAgIGNhdGNoIChSdW50aW1lRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIGV4Y2VwdGlvbiA9IGU7CisgICAgICAgIH0KKyAgICAgICAgaWYgKGV4cGFuZGVkID09IG51bGwpIHsKKyAgICAgICAgICAgIFN0cmluZyBpZGVudCA9IG5vdGlmaWNhdGlvbi5wa2cgKyAiLzB4IiArIEludGVnZXIudG9IZXhTdHJpbmcobm90aWZpY2F0aW9uLmlkKTsKKyAgICAgICAgICAgIFNsb2cuZShUQUcsICJjb3VsZG4ndCBpbmZsYXRlIHZpZXcgZm9yIG5vdGlmaWNhdGlvbiAiICsgaWRlbnQsIGV4Y2VwdGlvbik7CisgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGNvbnRlbnQuYWRkVmlldyhleHBhbmRlZCk7CisgICAgICAgICAgICByb3cuc2V0RHJhd2luZ0NhY2hlRW5hYmxlZCh0cnVlKTsKKyAgICAgICAgfQorCisgICAgICAgIHJldHVybiBuZXcgVmlld1tdIHsgcm93LCBjb250ZW50LCBleHBhbmRlZCB9OworICAgIH0KKworICAgIFN0YXR1c0Jhckljb25WaWV3IGFkZE5vdGlmaWNhdGlvblZpZXdzKElCaW5kZXIga2V5LCBTdGF0dXNCYXJOb3RpZmljYXRpb24gbm90aWZpY2F0aW9uKSB7CisgICAgICAgIE5vdGlmaWNhdGlvbkRhdGEgbGlzdDsKKyAgICAgICAgVmlld0dyb3VwIHBhcmVudDsKKyAgICAgICAgZmluYWwgYm9vbGVhbiBpc09uZ29pbmcgPSBub3RpZmljYXRpb24uaXNPbmdvaW5nKCk7CisgICAgICAgIGlmIChpc09uZ29pbmcpIHsKKyAgICAgICAgICAgIGxpc3QgPSBtT25nb2luZzsKKyAgICAgICAgICAgIHBhcmVudCA9IG1PbmdvaW5nSXRlbXM7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBsaXN0ID0gbUxhdGVzdDsKKyAgICAgICAgICAgIHBhcmVudCA9IG1MYXRlc3RJdGVtczsKKyAgICAgICAgfQorICAgICAgICAvLyBDb25zdHJ1Y3QgdGhlIGV4cGFuZGVkIHZpZXcuCisgICAgICAgIGZpbmFsIFZpZXdbXSB2aWV3cyA9IG1ha2VOb3RpZmljYXRpb25WaWV3KG5vdGlmaWNhdGlvbiwgcGFyZW50KTsKKyAgICAgICAgaWYgKHZpZXdzID09IG51bGwpIHsKKyAgICAgICAgICAgIGhhbmRsZU5vdGlmaWNhdGlvbkVycm9yKGtleSwgbm90aWZpY2F0aW9uLCAiQ291bGRuJ3QgZXhwYW5kIFJlbW90ZVZpZXdzIGZvcjogIgorICAgICAgICAgICAgICAgICAgICArIG5vdGlmaWNhdGlvbik7CisgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgfQorICAgICAgICBmaW5hbCBWaWV3IHJvdyA9IHZpZXdzWzBdOworICAgICAgICBmaW5hbCBWaWV3IGNvbnRlbnQgPSB2aWV3c1sxXTsKKyAgICAgICAgZmluYWwgVmlldyBleHBhbmRlZCA9IHZpZXdzWzJdOworICAgICAgICAvLyBDb25zdHJ1Y3QgdGhlIGljb24uCisgICAgICAgIGZpbmFsIFN0YXR1c0Jhckljb25WaWV3IGljb25WaWV3ID0gbmV3IFN0YXR1c0Jhckljb25WaWV3KHRoaXMsCisgICAgICAgICAgICAgICAgbm90aWZpY2F0aW9uLnBrZyArICIvMHgiICsgSW50ZWdlci50b0hleFN0cmluZyhub3RpZmljYXRpb24uaWQpKTsKKyAgICAgICAgZmluYWwgU3RhdHVzQmFySWNvbiBpYyA9IG5ldyBTdGF0dXNCYXJJY29uKG5vdGlmaWNhdGlvbi5wa2csIG5vdGlmaWNhdGlvbi5ub3RpZmljYXRpb24uaWNvbiwKKyAgICAgICAgICAgICAgICAgICAgbm90aWZpY2F0aW9uLm5vdGlmaWNhdGlvbi5pY29uTGV2ZWwsIG5vdGlmaWNhdGlvbi5ub3RpZmljYXRpb24ubnVtYmVyKTsKKyAgICAgICAgaWYgKCFpY29uVmlldy5zZXQoaWMpKSB7CisgICAgICAgICAgICBoYW5kbGVOb3RpZmljYXRpb25FcnJvcihrZXksIG5vdGlmaWNhdGlvbiwgIkNvdWxkaW5nIGNyZWF0ZSBpY29uOiAiICsgaWMpOworICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgIH0KKyAgICAgICAgLy8gQWRkIHRoZSBleHBhbmRlZCB2aWV3LgorICAgICAgICBmaW5hbCBpbnQgdmlld0luZGV4ID0gbGlzdC5hZGQoa2V5LCBub3RpZmljYXRpb24sIHJvdywgY29udGVudCwgZXhwYW5kZWQsIGljb25WaWV3KTsKKyAgICAgICAgcGFyZW50LmFkZFZpZXcocm93LCB2aWV3SW5kZXgpOworICAgICAgICAvLyBBZGQgdGhlIGljb24uCisgICAgICAgIGZpbmFsIGludCBpY29uSW5kZXggPSBjaG9vc2VJY29uSW5kZXgoaXNPbmdvaW5nLCB2aWV3SW5kZXgpOworICAgICAgICBtTm90aWZpY2F0aW9uSWNvbnMuYWRkVmlldyhpY29uVmlldywgaWNvbkluZGV4LAorICAgICAgICAgICAgICAgIG5ldyBMaW5lYXJMYXlvdXQuTGF5b3V0UGFyYW1zKG1JY29uU2l6ZSwgbUljb25TaXplKSk7CisgICAgICAgIHJldHVybiBpY29uVmlldzsKKyAgICB9CisKKyAgICBTdGF0dXNCYXJOb3RpZmljYXRpb24gcmVtb3ZlTm90aWZpY2F0aW9uVmlld3MoSUJpbmRlciBrZXkpIHsKKyAgICAgICAgTm90aWZpY2F0aW9uRGF0YS5FbnRyeSBlbnRyeSA9IG1PbmdvaW5nLnJlbW92ZShrZXkpOworICAgICAgICBpZiAoZW50cnkgPT0gbnVsbCkgeworICAgICAgICAgICAgZW50cnkgPSBtTGF0ZXN0LnJlbW92ZShrZXkpOworICAgICAgICAgICAgaWYgKGVudHJ5ID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICBTbG9nLncoVEFHLCAicmVtb3ZlTm90aWZpY2F0aW9uIGZvciB1bmtub3duIGtleTogIiArIGtleSk7CisgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgLy8gUmVtb3ZlIHRoZSBleHBhbmRlZCB2aWV3LgorICAgICAgICAoKFZpZXdHcm91cCllbnRyeS5yb3cuZ2V0UGFyZW50KCkpLnJlbW92ZVZpZXcoZW50cnkucm93KTsKKyAgICAgICAgLy8gUmVtb3ZlIHRoZSBpY29uLgorICAgICAgICAoKFZpZXdHcm91cCllbnRyeS5pY29uLmdldFBhcmVudCgpKS5yZW1vdmVWaWV3KGVudHJ5Lmljb24pOworCisgICAgICAgIHJldHVybiBlbnRyeS5ub3RpZmljYXRpb247CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIHNldEFyZVRoZXJlTm90aWZpY2F0aW9ucygpIHsKKyAgICAgICAgYm9vbGVhbiBvbmdvaW5nID0gbU9uZ29pbmcuaGFzVmlzaWJsZUl0ZW1zKCk7CisgICAgICAgIGJvb2xlYW4gbGF0ZXN0ID0gbUxhdGVzdC5oYXNWaXNpYmxlSXRlbXMoKTsKKworICAgICAgICAvLyAobm8gb25nb2luZyBub3RpZmljYXRpb25zIGFyZSBjbGVhcmFibGUpCisgICAgICAgIGlmIChtTGF0ZXN0Lmhhc0NsZWFyYWJsZUl0ZW1zKCkpIHsKKyAgICAgICAgICAgIG1DbGVhckJ1dHRvbi5zZXRWaXNpYmlsaXR5KFZpZXcuVklTSUJMRSk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBtQ2xlYXJCdXR0b24uc2V0VmlzaWJpbGl0eShWaWV3LklOVklTSUJMRSk7CisgICAgICAgIH0KKworICAgICAgICBtT25nb2luZ1RpdGxlLnNldFZpc2liaWxpdHkob25nb2luZyA/IFZpZXcuVklTSUJMRSA6IFZpZXcuR09ORSk7CisgICAgICAgIG1MYXRlc3RUaXRsZS5zZXRWaXNpYmlsaXR5KGxhdGVzdCA/IFZpZXcuVklTSUJMRSA6IFZpZXcuR09ORSk7CisKKyAgICAgICAgaWYgKG9uZ29pbmcgfHwgbGF0ZXN0KSB7CisgICAgICAgICAgICBtTm9Ob3RpZmljYXRpb25zVGl0bGUuc2V0VmlzaWJpbGl0eShWaWV3LkdPTkUpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgbU5vTm90aWZpY2F0aW9uc1RpdGxlLnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKKyAgICAgICAgfQorICAgIH0KKworCisgICAgLyoqCisgICAgICogU3RhdGUgaXMgb25lIG9yIG1vcmUgb2YgdGhlIERJU0FCTEUgY29uc3RhbnRzIGZyb20gU3RhdHVzQmFyTWFuYWdlci4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBkaXNhYmxlKGludCBzdGF0ZSkgeworICAgICAgICBmaW5hbCBpbnQgb2xkID0gbURpc2FibGVkOworICAgICAgICBmaW5hbCBpbnQgZGlmZiA9IHN0YXRlIF4gb2xkOworICAgICAgICBtRGlzYWJsZWQgPSBzdGF0ZTsKKworICAgICAgICBpZiAoKGRpZmYgJiBTdGF0dXNCYXJNYW5hZ2VyLkRJU0FCTEVfRVhQQU5EKSAhPSAwKSB7CisgICAgICAgICAgICBpZiAoKHN0YXRlICYgU3RhdHVzQmFyTWFuYWdlci5ESVNBQkxFX0VYUEFORCkgIT0gMCkgeworICAgICAgICAgICAgICAgIFNsb2cuZChUQUcsICJESVNBQkxFX0VYUEFORDogeWVzIik7CisgICAgICAgICAgICAgICAgYW5pbWF0ZUNvbGxhcHNlKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgaWYgKChkaWZmICYgU3RhdHVzQmFyTWFuYWdlci5ESVNBQkxFX05PVElGSUNBVElPTl9JQ09OUykgIT0gMCkgeworICAgICAgICAgICAgaWYgKChzdGF0ZSAmIFN0YXR1c0Jhck1hbmFnZXIuRElTQUJMRV9OT1RJRklDQVRJT05fSUNPTlMpICE9IDApIHsKKyAgICAgICAgICAgICAgICBTbG9nLmQoVEFHLCAiRElTQUJMRV9OT1RJRklDQVRJT05fSUNPTlM6IHllcyIpOworICAgICAgICAgICAgICAgIGlmIChtVGlja2luZykgeworICAgICAgICAgICAgICAgICAgICBtVGlja2VyLmhhbHQoKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICBzZXROb3RpZmljYXRpb25JY29uVmlzaWJpbGl0eShmYWxzZSwgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5hbmltLmZhZGVfb3V0KTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIFNsb2cuZChUQUcsICJESVNBQkxFX05PVElGSUNBVElPTl9JQ09OUzogbm8iKTsKKyAgICAgICAgICAgICAgICBpZiAoIW1FeHBhbmRlZFZpc2libGUpIHsKKyAgICAgICAgICAgICAgICAgICAgc2V0Tm90aWZpY2F0aW9uSWNvblZpc2liaWxpdHkodHJ1ZSwgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5hbmltLmZhZGVfaW4pOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBlbHNlIGlmICgoZGlmZiAmIFN0YXR1c0Jhck1hbmFnZXIuRElTQUJMRV9OT1RJRklDQVRJT05fVElDS0VSKSAhPSAwKSB7CisgICAgICAgICAgICBpZiAobVRpY2tpbmcgJiYgKHN0YXRlICYgU3RhdHVzQmFyTWFuYWdlci5ESVNBQkxFX05PVElGSUNBVElPTl9USUNLRVIpICE9IDApIHsKKyAgICAgICAgICAgICAgICBTbG9nLmQoVEFHLCAiRElTQUJMRV9OT1RJRklDQVRJT05fVElDS0VSOiB5ZXMiKTsKKyAgICAgICAgICAgICAgICBtVGlja2VyLmhhbHQoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIEFsbCBjaGFuZ2VzIHRvIHRoZSBzdGF0dXMgYmFyIGFuZCBub3RpZmljYXRpb25zIGZ1bm5lbCB0aHJvdWdoIGhlcmUgYW5kIGFyZSBiYXRjaGVkLgorICAgICAqLworICAgIHByaXZhdGUgY2xhc3MgSCBleHRlbmRzIEhhbmRsZXIgeworICAgICAgICBwdWJsaWMgdm9pZCBoYW5kbGVNZXNzYWdlKE1lc3NhZ2UgbSkgeworICAgICAgICAgICAgc3dpdGNoIChtLndoYXQpIHsKKyAgICAgICAgICAgICAgICBjYXNlIE1TR19BTklNQVRFOgorICAgICAgICAgICAgICAgICAgICBkb0FuaW1hdGlvbigpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIE1TR19BTklNQVRFX1JFVkVBTDoKKyAgICAgICAgICAgICAgICAgICAgZG9SZXZlYWxBbmltYXRpb24oKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBNU0dfU0hPV19JTlRSVURFUjoKKyAgICAgICAgICAgICAgICAgICAgc2V0SW50cnVkZXJBbGVydFZpc2liaWxpdHkodHJ1ZSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgTVNHX0hJREVfSU5UUlVERVI6CisgICAgICAgICAgICAgICAgICAgIHNldEludHJ1ZGVyQWxlcnRWaXNpYmlsaXR5KGZhbHNlKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICBWaWV3Lk9uRm9jdXNDaGFuZ2VMaXN0ZW5lciBtRm9jdXNDaGFuZ2VMaXN0ZW5lciA9IG5ldyBWaWV3Lk9uRm9jdXNDaGFuZ2VMaXN0ZW5lcigpIHsKKyAgICAgICAgcHVibGljIHZvaWQgb25Gb2N1c0NoYW5nZ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T0NVU19GT1JXQVJEKTsKKyAgICAgICAgbVRyYWNraW5nVmlldy5zZXRWaXNpYmlsaXR5KFZpZXcuVklTSUJMRSk7CisKKyAgICAgICAgaWYgKCFtVGlja2luZykgeworICAgICAgICAgICAgc2V0RGF0ZVZpZXdWaXNpYmlsaXR5KHRydWUsIGNvbS5hbmRyb2lkLmludGVybmFsLlIuYW5pbS5mYWRlX2luKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGFuaW1hdGVFeHBhbmQoKSB7CisgICAgICAgIGlmIChTUEVXKSBTbG9nLmQoVEFHLCAiQW5pbWF0ZSBleHBhbmQ6IGV4cGFuZGVkPSIgKyBtRXhwYW5kZWQpOworICAgICAgICBpZiAoKG1EaXNhYmxlZCAmIFN0YXR1c0Jhck1hbmFnZXIuRElTQUJMRV9FWFBBTkQpICE9IDApIHsKKyAgICAgICAgICAgIHJldHVybiA7CisgICAgICAgIH0KKyAgICAgICAgaWYgKG1FeHBhbmRlZCkgeworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisKKyAgICAgICAgcHJlcGFyZVRyYWNraW5nKDAsIHRydWUpOworICAgICAgICBwZXJmb3JtRmxpbmcoMCwgMjAwMC4wZiwgdHJ1ZSk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgYW5pbWF0ZUNvbGxhcHNlKCkgeworICAgICAgICBpZiAoU1BFVykgeworICAgICAgICAgICAgU2xvZy5kKFRBRywgImFuaW1hdGVDb2xsYXBzZSgpOiBtRXhwYW5kZWQ9IiArIG1FeHBhbmRlZAorICAgICAgICAgICAgICAgICAgICArICIgbUV4cGFuZGVkVmlzaWJsZT0iICsgbUV4cGFuZGVkVmlzaWJsZQorICAgICAgICAgICAgICAgICAgICArICIgbUV4cGFuZGVkPSIgKyBtRXhwYW5kZWQKKyAgICAgICAgICAgICAgICAgICAgKyAiIG1BbmltYXRpbmc9IiArIG1BbmltYXRpbmcKKyAgICAgICAgICAgICAgICAgICAgKyAiIG1BbmltWT0iICsgbUFuaW1ZCisgICAgICAgICAgICAgICAgICAgICsgIiBtQW5pbVZlbD0iICsgbUFuaW1WZWwpOworICAgICAgICB9CisKKyAgICAgICAgaWYgKCFtRXhwYW5kZWRWaXNpYmxlKSB7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKworICAgICAgICBpbnQgeTsKKyAgICAgICAgaWYgKG1BbmltYXRpbmcpIHsKKyAgICAgICAgICAgIHkgPSAoaW50KW1BbmltWTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIHkgPSBtRGlzcGxheS5nZXRIZWlnaHQoKS0xOworICAgICAgICB9CisgICAgICAgIC8vIExldCB0aGUgZmxpbmcgdGhpbmsgdGhhdCB3ZSdyZSBvcGVuIHNvIGl0IGdvZXMgaW4gdGhlIHJpZ2h0IGRpcmVjdGlvbgorICAgICAgICAvLyBhbmQgZG9lc24ndCB0cnkgdG8gcmUtb3BlbiB0aGUgd2luZG93c2hhZGUuCisgICAgICAgIG1FeHBhbmRlZCA9IHRydWU7CisgICAgICAgIHByZXBhcmVUcmFja2luZyh5LCBmYWxzZSk7CisgICAgICAgIHBlcmZvcm1GbGluZyh5LCAtMjAwMC4wZiwgdHJ1ZSk7CisgICAgfQorCisgICAgdm9pZCBwZXJmb3JtRXhwYW5kKCkgeworICAgICAgICBpZiAoU1BFVykgU2xvZy5kKFRBRywgInBlcmZvcm1FeHBhbmQ6IG1FeHBhbmRlZD0iICsgbUV4cGFuZGVkKTsKKyAgICAgICAgaWYgKChtRGlzYWJsZWQgJiBTdGF0dXNCYXJNYW5hZ2VyLkRJU0FCTEVfRVhQQU5EKSAhPSAwKSB7CisgICAgICAgICAgICByZXR1cm4gOworICAgICAgICB9CisgICAgICAgIGlmIChtRXhwYW5kZWQpIHsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorCisgICAgICAgIG1FeHBhbmRlZCA9IHRydWU7CisgICAgICAgIG1ha2VFeHBhbmRlZFZpc2libG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HJvaWQuaW50ZXJuYWwuUi5hbmltLmZhZGVfaW4pOworICAgICAgICB9CisgICAgICAgIHNldERhdGVWaWV3VmlzaWJpbGl0eShmYWxzZSwgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5hbmltLmZhZGVfb3V0KTsKKworICAgICAgICBpZiAoIW1FeHBhbmRlZCkgeworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisgICAgICAgIG1FeHBhbmRlZCA9IGZhbHNlOworICAgIH0KKworICAgIHZvaWQgZG9BbmltYXRpb24oKSB7CisgICAgICAgIGlmIChtQW5pbWF0aW5nKSB7CisgICAgICAgICAgICBpZiAoU1BFVykgU2xvZy5kKFRBRywgImRvQW5pbWF0aW9uIik7CisgICAgICAgICAgICBpZiAoU1BFVykgU2xvZy5kKFRBRywgImRvQW5pbWF0aW9uIGJlZm9yZSBtQW5pbVk9IiArIG1BbmltWSk7CisgICAgICAgICAgICBpbmNyZW1lbnRBbmltKCk7CisgICAgICAgICAgICBpZiAoU1BFVykgU2xvZy5kKFRBRywgImRvQW5pbWF0aW9uIGFmdGVyICBtQW5pbVk9IiArIG1BbmltWSk7CisgICAgICAgICAgICBpZiAobUFuaW1ZID49IG1EaXNwbGF5LmdldEhlaWdodCgpLTEpIHsKKyAgICAgICAgICAgICAgICBpZiAoU1BFVykgU2xvZy5kKFRBRywgIkFuaW1hdGlvbiBjb21wbGV0ZWQgdG8gZXhwYW5kZWQgc3RhdGUuIik7CisgICAgICAgICAgICAgICAgbUFuaW1hdGluZyA9IGZhbHNlOworICAgICAgICAgICAgICAgIHVwZGF0ZUV4cGFuZGVkVmlld1BvcyhFWFBBTkRFRF9GVUxMX09QRU4pOworICAgICAgICAgICAgICAgIHBlcmZvcm1FeHBhbmQoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UgaWYgKG1BbmltWSA8IG1TdGF0dXNCYXJWaWV3LmdldEhlaWdodCgpKSB7CisgICAgICAgICAgICAgICAgaWYgKFNQRVcpIFNsb2cuZChUQUcsICJBbmltYXRpb24gY29tcGxldGVkIHRvIGNvbGxhcHNlZCBzdGF0ZS4iKTsKKyAgICAgICAgICAgICAgICBtQW5pbWF0aW5nID0gZmFsc2U7CisgICAgICAgICAgICAgICAgdXBkYXRlRXhwYW5kZWRWaWV3UG9zKDApOworICAgICAgICAgICAgICAgIHBlcmZvcm1Db2xsYXBzZSgpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZSB7CisgICAgICAgICAgICAgICAgdXBkYXRlRXhwYW5kZWRWaWV3UG9zKChpbnQpbUFuaW1ZKTsKKyAgICAgICAgICAgICAgICBtQ3VyQW5pbWF0aW9uVGltZSArPSBBTklNX0ZSQU1FX0RVUkFUSU9OOworICAgICAgICAgICAgICAgIG1IYW5kbGVyLnNlbmRNZXNzYWdlQXRUaW1lKG1IYW5kbGVyLm9idGFpbk1lc3NhZ2UoTVNHX0FOSU1BVEUpLCBtQ3VyQW5pbWF0aW9uVGltZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICB2b2lkIHN0b3BUcmFja2luZygpIHsKKyAgICAgICAgbVRyYWNraW5nID0gZmFsc2U7CisgICAgICAgIG1WZWxvY2l0eVRyYWNrZXIucmVjeWNsZSgpOworICAgICAgICBtVmVsb2NpdHlUcmFja2VyID0gbnVsbDsKKyAgICB9CisKKyAgICB2b2lkIGluY3JlbWVudEFuaW0oKSB7CisgICAgICAgIGxvbmcgbm93ID0gU3lzdGVtQ2xvY2sudXB0aW1lTWlsbGlzKCk7CisgICAgICAgIGZsb2F0IHQgPSAoKGZsb2F0KShub3cgLSBtQW5pbUxhc3RUaW1lKSkgLyAxMDAwOyAgICAgICAgICAgIC8vIG1zIC0+IHMKKyAgICAgICAgZmluYWwgZmxvYXQgeSA9IG1BbmltWTsKKyAgICAgICAgZmluYWwgZmxvYXQgdiA9IG1BbmltVmVsOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gcHgvcworICAgICAgICBmaW5hbCBmbG9hdCBhID0gbUFuaW1BY2NlbDsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBweC9zL3MKKyAgICAgICAgbUFuaW1ZID0geSArICh2KnQpICsgKDAuNWYqYSp0KnQpOyAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gcHgKKyAgICAgICAgbUFuaW1WZWwgPSB2ICsgKGEqdCk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gcHgvcworICAgICAgICBtQW5pbUxhc3RUaW1lID0gbm93OyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBtcworICAgICAgICAvL1Nsb2cuZChUQUcsICJ5PSIgKyB5ICsgIiB2PSIgKyB2ICsgIiBhPSIgKyBhICsgIiB0PSIgKyB0ICsgIiBtQW5pbVk9IiArIG1BbmltWQorICAgICAgICAvLyAgICAgICAgKyAiIG1BbmltQWNjZWw9IiArIG1BbmltQWNjZWwpOworICAgIH0KKworICAgIHZvaWQgZG9SZXZlYWxBbmltYXRpb24oKSB7CisgICAgICAgIGZpbmFsIGludCBoID0gbUNsb3NlVmlldy5nZXRIZWlnaHQoKSArIG1TdGF0dXNCYXJWaWV3LmdldEhlaWdodCgpOworICAgICAgICBpZiAobUFuaW1hdGluZ1JldmVhbCAmJiBtQW5pbWF0aW5nICYmIG1BbmltWSA8IGgpIHsKKyAgICAgICAgICAgIGluY3JlbWVudEFuaW0oKTsKKyAgICAgICAgICAgIGlmIChtQW5pbVkgPj0gaCkgeworICAgICAgICAgICAgICAgIG1BbmltWSA9IGg7CisgICAgICAgICAgICAgICAgdXBkYXRlRXhwYW5kZWRWaWV3UG9zKChpbnQpbUFuaW1ZKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgdXBkYXRlRXhwYW5kZWRWaWV3UG9zKChpbnQpbUFuaW1ZKTsKKyAgICAgICAgICAgICAgICBtQ3VyQW5pbWF0aW9uVGltZSArPSBBTklNX0ZSQU1FX0RVUkFUSU9OOworICAgICAgICAgICAgICAgIG1IYW5kbGVyLnNlbmRNZXNzYWdlQXRUaW1lKG1IYW5kbGVyLm9idGFpbk1lc3NhZ2UoTVNHX0FOSU1BVEVfUkVWRUFMKSwKKyAgICAgICAgICAgICAgICAgICAgICAgIG1DdXJBbmltYXRpb25UaW1lKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIHZvaWQgcHJlcGFyZVRyYWNraW5nKGludCB5LCBib29sZWFuIG9wZW5pbmcpIHsKKyAgICAgICAgbVRyYWNraW5nID0gdHJ1ZTsKKyAgICAgICAgbVZlbG9jaXR5VHJhY2tlciA9IFZlbG9jaXR5VHJhY2tlci5vYnRhaW4oKTsKKyAgICAgICAgaWYgKG9wZW5pbmcpIHsKKyAgICAgICAgICAgIG1BbmltQWNjZWwgPSAyMDAwLjBmOworICAgICAgICAgICAgbUFuaW1WZWwgPSAyMDA7CisgICAgICAgICAgICBtQW5pbVkgPSBtU3RhdHVzQmFyVmlldy5nZXRIZWlnaHQoKTsKKyAgICAgICAgICAgIHVwZGF0ZUV4cGFuZGVkVmlld1BvcygoaW50KW1BbmltWSk7CisgICAgICAgICAgICBtQW5pbWF0aW5nID0gdHJ1ZTsKKyAgICAgICAgICAgIG1BbmltYXRpbmdSZXZlYWwgPSB0cnVlOworICAgICAgICAgICAgbUhhbmRsZXIucmVtb3ZlTWVzc2FnZXMoTVNHX0FOSU1BVEUpOworICAgICAgICAgICAgbUhhbmRsZXIucmVtb3ZlTWVzc2FnZXMoTVNHX0FOSU1BVEVfUkVWRUFMKTsKKyAgICAgICAgICAgIGxvbmcgbm93ID0gU3lzdGVtQ2xvY2sudXB0aW1lTWlsbGlzKCk7CisgICAgICAgICAgICBtQW5pbUxhc3RUaW1lID0gbm93OworICAgICAgICAgICAgbUN1ckFuaW1hdGlvblRpbWUgPSBub3cgKyBBTklNX0ZSQU1FX0RVUkFUSU9OOworICAgICAgICAgICAgbUFuaW1hdGluZyA9IHRydWU7CisgICAgICAgICAgICBtSGFuZGxlci5zZW5kTWVzc2FnZUF0VGltZShtSGFuZGxlci5vYnRhaW5NZXNzYWdlKE1TR19BTklNQVRFX1JFVkVBTCksCisgICAgICAgICAgICAgICAgICAgIG1DdXJBbmltYXRpb25UaW1lKTsKKyAgICAgICAgICAgIG1ha2VFeHBhbmRlZFZpc2libGUoKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIC8vIGl0J3Mgb3BlbiwgY2xvc2UgaXQ/CisgICAgICAgICAgICBpZiAobUFuaW1hdGluZykgeworICAgICAgICAgICAgICAgIG1BbmltYXRpbmcgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICBtSGFuZGxlci5yZW1vdmVNZXNzYWdlcyhNU0dfQU5JTUFURSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICB1cGRhdGVFeHBhbmRlZFZpZXdQb3MoeSArIG1WaWV3RGVsdGEpOworICAgICAgICB9CisgICAgfQorCisgICAgdm9pZCBwZXJmb3JtRmxpbmcoaW50IHksIGZsb2F0IHZlbCwgYm9vbGVhbiBhbHdheXMpIHsKKyAgICAgICAgbUFuaW1hdGluZ1JldmVhbCA9IGZhbHNlOworICAgICAgICBtRGlzcGxheUhlaWdodCA9IG1EaXNwbGF5LmdldEhlaWdodCgpOworCisgICAgICAgIG1BbmltWSA9IHk7CisgICAgICAgIG1BbmltVmVsID0gdmVsOworCisgICAgICAgIC8vU2xvZy5kKFRBRywgInN0YXJ0aW5nIHdpdGggbUFuaW1ZPSIgKyBtQW5pbVkgKyAiIG1BbmltVmVsPSIgKyBtQW5pbVZlbCk7CisKKyAgICAgICAgaWYgKG1FeHBhbmRlZCkgeworICAgICAgICAgICAgaWYgKCFhbHdheXMgJiYgKAorICAgICAgICAgICAgICAgICAgICB2ZWwgPiAyMDAuMGYKKyAgICAgICAgICAgICAgICAgICAgfHwgKHkgPiAobURpc3BsYXlIZWlnaHQtMjUpICYmIHZlbCA+IC0yMDAuMGYpKSkgeworICAgICAgICAgICAgICAgIC8vIFdlIGFyZSBleHBhbmRlZCwgYnV0IHRoZXkgZGlkbid0IG1vdmUgc3VmZmljaWVudGx5IHRvIGNhdXNlCisgICAgICAgICAgICAgICAgLy8gdXMgdG8gcmV0cmFjdC4gIEFuaW1hdGUgYmFjayB0byB0aGUgZXhwYW5kZWQgcG9zaXRpb24uCisgICAgICAgICAgICAgICAgbUFuaW1BY2NlbCA9IDIwMDAuMGY7CisgICAgICAgICAgICAgICAgaWYgKHZlbCA8IDApIHsKKyAgICAgICAgICAgICAgICAgICAgbUFuaW1WZWwgPSAwOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UgeworICAgICAgICAgICAgICAgIC8vIFdlIGFyZSBleHBhbmRlZCBhbmQgYXJlIG5vdyBnb2luZyB0byBhbmltYXRlIGF3YXkuCisgICAgICAgICAgICAgICAgbUFuaW1BY2NlbCA9IC0yMDAwLjBmOworICAgICAgICAgICAgICAgIGlmICh2ZWwgPiAwKSB7CisgICAgICAgICAgICAgICAgICAgIG1BbmltVmVsID0gMDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBpZiAoYWx3YXlzIHx8ICgKKyAgICAgICAgICAgICAgICAgICAgdmVsID4gMjAwLjBmCisgICAgICAgICAgICAgICAgICAgIHx8ICh5ID4gKG1EaXNwbGF5SGVpZ2h0LzIpICYmIHZlbCA+IC0yMDAuMGYpKSkgeworICAgICAgICAgICAgICAgIC8vIFdlIGFyZSBjb2xsYXBzZWQsIGFuZCB0aGV5IG1vdmVkIGVub3VnaCB0byBhbGxvdyB1cyB0bworICAgICAgICAgICAgICAgIC8vIGV4cGFuZC4gIEFuaW1hdGUgaW4gdGhlIG5vdGlmaWNhdGlvbnMuCisgICAgICAgICAgICAgICAgbUFuaW1BY2NlbCA9IDIwMDAuMGY7CisgICAgICAgICAgICAgICAgaWYgKHZlbCA8IDApIHsKKyAgICAgICAgICAgICAgICAgICAgbUFuaW1WZWwgPSAwOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGVsc2UgeworICAgICAgICAgICAgICAgIC8vIFdlIGFyZSBjb2xsYXBzZWQsIGJ1dCB0aGV5IGRpZG4ndCBtb3ZlIHN1ZmZpY2llbnRseSB0byBjYXVzZQorICAgICAgICAgICAgICAgIC8vIHVzIHRvIHJldHJhY3QuICBBbmltYXRlIGJhY2sgdG8gdGhlIGNvbGxhcHNlZCBwb3NpdGlvbi4KKyAgICAgICAgICAgICAgICBtQW5pbUFjY2VsID0gLTIwMDAuMGY7CisgICAgICAgICAgICAgICAgaWYgKHZlbCA+IDApIHsKKyAgICAgICAgICAgICAgICAgICAgbUFuaW1WZWwgPSAwOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICAvL1Nsb2cuZChUQUcsICJtQW5pbVk9IiArIG1BbmltWSArICIgbUFuaW1WZWw9IiArIG1BbmltVmVsCisgICAgICAgIC8vICAgICAgICArICIgbUFuaW1BY2NlbD0iICsgbUFuaW1BY2NlbCk7CisKKyAgICAgICAgbG9uZyBub3cgPSBTeXN0ZW1DbG9jay51cHRpbWVNaWxsaXMoKTsKKyAgICAgICAgbUFuaW1MYXN0VGltZSA9IG5vdzsKKyAgICAgICAgbUN1ckFuaW1hdGlvblRpbWUgPSBub3cgKyBBTklNX0ZSQU1FX0RVUkFUSU9OOworICAgICAgICBtQW5pbWF0aW5nID0gdHJ1ZTsKKyAgICAgICAgbUhhbmRsZXIucmVtb3ZlTWVzc2FnZXMoTVNHX0FOSU1BVEUpOworICAgICAgICBtSGFuZGxlci5yZW1vdmVNZXNzYWdlcyhNU0dfQU5JTUFURV9SRVZFQUwpOworICAgICAgICBtSGFuZGxlci5zZW5kTWVzc2FnZUF0VGltZShtSGFuZGxlci5vYnRhaW5NZXNzYWdlKE1TR19BTklNQVRFKSwgbUN1ckFuaW1hdGlvblRpbWUpOworICAgICAgICBzdG9wVHJhY2tpbmcoKTsKKyAgICB9CisKKyAgICBib29sZWFuIGludGVyY2VwdFRvdWNoRXZlbnQoTW90aW9uRXZlbnQgZXZlbnQpIHsKKyAgICAgICAgaWYgKFNQRVcpIHsKKyAgICAgICAgICAgIFNsb2cuZChUQUcsICJUb3VjaDogcmF3WT0iICsgZXZlbnQuZ2V0UmF3WSgpICsgIiBldmVudD0iICsgZXZlbnQgKyAiIG1EaXNhYmxlZD0iCisgICAgICAgICAgICAgICAgKyBtRGlzYWJsZWQpOworICAgICAgICB9CisKKyAgICAgICAgaWYgKChtRGlzYWJsZWQgJiBTdGF0dXNCYXJNYW5hZ2VyLkRJU0FCTEVfRVhQQU5EKSAhPSAwKSB7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKworICAgICAgICBmaW5hbCBpbnQgc3RhdHVzQmFyU2l6ZSA9IG1TdGF0dXNCYXJWaWV3LmdldEhlaWdodCgpOworICAgICAgICBmaW5hbCBpbnQgaGl0U2l6ZSA9IHN0YXR1c0JhclNpemUqMjsKKyAgICAgICAgaWYgKGV2ZW50LmdldEFjdGlvbigpID09IE1vdGlvbkV2ZW50LkFDVElPTl9ET1dOKSB7CisgICAgICAgICAgICBmaW5hbCBpbnQgeSA9IChpbnQpZXZlbnQuZ2V0UmF3WSgpOworCisgICAgICAgICAgICBpZiAoIW1FeHBhbmRlZCkgeworICAgICAgICAgICAgICAgIG1WaWV3RGVsdGEgPSBzdGF0dXNCYXJTaXplIC0geTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgbVRyYWNraW5nVmlldy5nZXRMb2NhdGlvbk9uU2NyZWVuKG1BYnNQb3MpOworICAgICAgICAgICAgICAgIG1WaWV3RGVsdGEgPSBtQWJzUG9zWzFdICsgbVRyYWNraW5nVmlldy5nZXRIZWlnaHQoKSAtIHk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoKCFtRXhwYW5kZWQgJiYgeSA8IGhpdFNpemUpIHx8CisgICAgICAgICAgICAgICAgICAgIChtRXhwYW5kZWQgJiYgeSA+IChtRGlzcGxheS5nZXRIZWlnaHQoKS1oaXRTaXplKSkpIHsKKworICAgICAgICAgICAgICAgIC8vIFdlIGRyb3AgZXZlbnRzIGF0IHRoZSBlZGdlIG9mIHRoZSBzY3JlZW4gdG8gbWFrZSB0aGUgd2luZG93c2hhZGUgY29tZQorICAgICAgICAgICAgICAgIC8vIGRvd24gYnkgYWNjaWRlbnQgbGVzcywgZXNwZWNpYWxseSB3aGVuIHB1c2hpbmcgb3BlbiBhIGRldmljZSB3aXRoIGEga2V5Ym9hcmQKKyAgICAgICAgICAgICAgICAvLyB0aGF0IHJvdGF0ZXMgKGxpa2UgZzEgYW5kIGRyb2lkKQorICAgICAgICAgICAgICAgIGludCB4ID0gKGludClldmVudC5nZXRSYXdYKCk7CisgICAgICAgICAgICAgICAgZmluYWwgaW50IGVkZ2VCb3JkZXIgPSBtRWRnZUJvcmRlcjsKKyAgICAgICAgICAgICAgICBpZiAoeCA+PSBlZGdlQm9yZGVyICYmIHggPCBtRGlzcGxheS5nZXRXaWR0aCgpIC0gZWRnZUJvcmRlcikgeworICAgICAgICAgICAgICAgICAgICBwcmVwYXJlVHJhY2tpbmcoeSwgIW1FeHBhbmRlZCk7Ly8gb3BlbmluZyBpZiB3ZSdyZSBub3QgYWxyZWFkeSBmdWxseSB2aXNpYmxlCisgICAgICAgICAgICAgICAgICAgIG1WZWxvY2l0eVRyYWNrZXIuYWRkTW92ZW1lbnQoZXZlbnQpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBlbHNlIGlmIChtVHJhY2tpbmcpIHsKKyAgICAgICAgICAgIG1WZWxvY2l0eVRyYWNrZXIuYWRkTW92ZW1lbnQoZXZlbnQpOworICAgICAgICAgICAgZmluYWwgaW50IG1pblkgPSBzdGF0dXNCYXJTaXplICsgbUNsb3NlVmlldy5nZXRIZWlnaHQoKTsKKyAgICAgICAgICAgIGlmIChldmVudC5nZXRBY3Rpb24oKSA9PSBNb3Rpb25FdmVudC5BQ1RJT05fTU9WRSkgeworICAgICAgICAgICAgICAgIGludCB5ID0gKGludClldmVudC5nZXRSYXdZKCk7CisgICAgICAgICAgICAgICAgaWYgKG1BbmltYXRpbmdSZXZlYWwgJiYgeSA8IG1pblkpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gbm90aGluZworICAgICAgICAgICAgICAgIH0gZWxzZSAgeworICAgICAgICAgICAgICAgICAgICBtQW5pbWF0aW5nUmV2ZWFsID0gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgIHVwZGF0ZUV4cGFuZGVkVmlld1Bvcyh5ICsgbVZpZXdEZWx0YSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSBlbHNlIGlmIChldmVudC5nZXRBY3Rpb24oKSA9PSBNb3Rpb25FdmVudC5BQ1RJT05fVVApIHsKKyAgICAgICAgICAgICAgICBtVmVsb2NpdHlUcmFja2VyLmNvbXB1dGVDdXJyZW50VmVsb2NpdHkoMTAwMCk7CisKKyAgICAgICAgICAgICAgICBmbG9hdCB5VmVsID0gbVZlbG9jaXR5VHJhY2tlci5nZXRZVmVsb2NpdHkoKTsKKyAgICAgICAgICAgICAgICBib29sZWFuIG5lZ2F0aXZlID0geVZlbCA8IDA7CisKKyAgICAgICAgICAgICAgICBmbG9hdCB4VmVsID0gbVZlbG9jaXR5VHJhY2tlci5nZXRYVmVsb2NpdHkoKTsKKyAgICAgICAgICAgICAgICBpZiAoeFZlbCA8IDApIHsKKyAgICAgICAgICAgICAgICAgICAgeFZlbCA9IC14VmVsOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBpZiAoeFZlbCA+IDE1MC4wZikgeworICAgICAgICAgICAgICAgICAgICB4VmVsID0gMTUwLjBmOyAvLyBsaW1pdCBob3cgbXVjaCB3ZSBjYXJlIGFib3V0IHRoZSB4IGF4aXMKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBmbG9hdCB2ZWwgPSAoZmxvYXQpTWF0aC5oeXBvdCh5VmVsLCB4VmVsKTsKKyAgICAgICAgICAgICAgICBpZiAobmVnYXRpdmUpIHsKKyAgICAgICAgICAgICAgICAgICAgdmVsID0gLXZlbDsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBwZXJmb3JtRmxpbmcoKGludClldmVudC5nZXRSYXdZKCksIHZlbCwgZmFsc2UpOworICAgICAgICAgICAgfQorCisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0KKworICAgIHByaXZhdGUgY2xhc3MgTGF1bmNoZXIgaW1wbGVtZW50cyBWaWV3Lk9uQ2xpY2tMaXN0ZW5lciB7CisgICAgICAgIHByaXZhdGUgUGVuZGluZ0ludGVudCBtSW50ZW50OworICAgICAgICBwcml2YXRlIFN0cmluZyBtUGtnOworICAgICAgICBwcml2YXRlIFN0cmluZyBtVGFnOworICAgICAgICBwcml2YXRlIGludCBtSWQ7CisKKyAgICAgICAgTGF1bmNoZXIoUGVuZGluZ0ludGVudCBpbnRlbnQsIFN0cmluZyBwa2csIFN0cmluZyB0YWcsIGludCBpZCkgeworICAgICAgICAgICAgbUludGVudCA9IGludGVudDsKKyAgICAgICAgICAgIG1Qa2cgPSBwa2c7CisgICAgICAgICAgICBtVGFnID0gdGFnOworICAgICAgICAgICAgbUlkID0gaWQ7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBvbkNsaWNrKFZpZXcgdikgeworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAvLyBUaGUgaW50ZW50IHdlIGFyZSBzZW5kaW5nIGlzIGZvciB0aGUgYXBwbGljYXRpb24sIHdoaWNoCisgICAgICAgICAgICAgICAgLy8gd29uJ3QgaGF2ZSBwZXJtaXNzaW9uIHRvIGltbWVkaWF0ZWx5IHN0YXJ0IGFuIGFjdGl2aXR5IGFmdGVyCisgICAgICAgICAgICAgICAgLy8gdGhlIHVzZXIgc3dpdGNoZXMgdG8gaG9tZS4gIFdlIGtub3cgaXQgaXMgc2FmZSB0byBkbyBhdCB0aGlzCisgICAgICAgICAgICAgICAgLy8gcG9pbnQsIHNvIG1ha2Ugc3VyZSBuZXcgYWN0aXZpdHkgc3dpdGNoZXMgYXJlIG5vdyBhbGxvd2VkLgorICAgICAgICAgICAgICAgIEFjdGl2aXR5TWFuYWdlck5hdGl2ZS5nZXREZWZhdWx0KCkucmVzdW1lQXBwU3dpdGNoZXMoKTsKKyAgICAgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmIChtSW50ZW50ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBpbnRbXSBwb3MgPSBuZXcgaW50WzJdOworICAgICAgICAgICAgICAgIHYuZ2V0TG9jYXRpb25PblNjcmVlbihwb3MpOworICAgICAgICAgICAgICAgIEludGVudCBvdmVybGF5ID0gbmV3IEludGVudCgpOworICAgICAgICAgICAgICAgIG92ZXJsYXkuc2V0U291cmNlQm91bmRzKAorICAgICAgICAgICAgICAgICAgICAgICAgbmV3IFJlY3QocG9zWzBdLCBwb3NbMV0sIHBvc1swXSt2LmdldFdpZHRoKCksIHBvc1sxXSt2LmdldEhlaWdodCgpKSk7CisgICAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAgICAgbUludGVudC5zZW5kKFBob25lU3RhdHVzQmFyU2VydmljZS50aGlzLCAwLCBvdmVybGF5KTsKKyAgICAgICAgICAgICAgICB9IGNhdGNoIChQZW5kaW5nSW50ZW50LkNhbmNlbGVkRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gdGhlIHN0YWNrIHRyYWNlIGlzbid0IHZlcnkgaGVscGZ1b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HRyeWluZyB0bworICAgICAgICAvLyBydW4gYSB0aWNrZXIgd2l0aG91dCBiZWluZyBhdHRhY2hlZCB3aWxsIGNyYXNoIQorICAgICAgICBpZiAobi5ub3RpZmljYXRpb24udGlja2VyVGV4dCAhPSBudWxsICYmIG1TdGF0dXNCYXJWaWV3LmdldFdpbmRvd1Rva2VuKCkgIT0gbnVsbCkgeworICAgICAgICAgICAgaWYgKDAgPT0gKG1EaXNhYmxlZCAmIChTdGF0dXNCYXJNYW5hZ2VyLkRJU0FCTEVfTk9USUZJQ0FUSU9OX0lDT05TCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCBTdGF0dXNCYXJNYW5hZ2VyLkRJU0FCTEVfTk9USUZJQ0FUSU9OX1RJQ0tFUikpKSB7CisgICAgICAgICAgICAgICAgbVRpY2tlci5hZGRFbnRyeShuKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIENhbmNlbCB0aGlzIG5vdGlmaWNhdGlvbiBhbmQgdGVsbCB0aGUgU3RhdHVzQmFyTWFuYWdlclNlcnZpY2UgLyBOb3RpZmljYXRpb25NYW5hZ2VyU2VydmljZQorICAgICAqIGFib3V0IHRoZSBmYWlsdXJlLgorICAgICAqCisgICAgICogV0FSTklORzogdGhpcyB3aWxsIGNhbGwgYmFjayBpbnRvIHVzLiAgRG9uJ3QgaG9sZCBhbnkgbG9ja3MuCisgICAgICovCisgICAgdm9pZCBoYW5kbGVOb3RpZmljYXRpb25FcnJvcihJQmluZGVyIGtleSwgU3RhdHVzQmFyTm90aWZpY2F0aW9uIG4sIFN0cmluZyBtZXNzYWdlKSB7CisgICAgICAgIHJlbW92ZU5vdGlmaWNhdGlvbihrZXkpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgbUJhclNlcnZpY2Uub25Ob3RpZmljYXRpb25FcnJvcihuLnBrZywgbi50YWcsIG4uaWQsIG4udWlkLCBuLmluaXRpYWxQaWQsIG1lc3NhZ2UpOworICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZXgpIHsKKyAgICAgICAgICAgIC8vIFRoZSBlbmQgaXMgbmlnaC4KKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgY2xhc3MgTXlUaWNrZXIgZXh0ZW5kcyBUaWNrZXIgeworICAgICAgICBNeVRpY2tlcihDb250ZXh0IGNvbnRleHQsIFZpZXcgc2IpIHsKKyAgICAgICAgICAgIHN1cGVyKGNvbnRleHQsIHNiKTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgdm9pZCB0aWNrZXJTdGFydGluZygpIHsKKyAgICAgICAgICAgIG1UaWNraW5nID0gdHJ1ZTsKKyAgICAgICAgICAgIG1JY29ucy5zZXRWaXNpYmlsaXR5KFZpZXcuR09ORSk7CisgICAgICAgICAgICBtVGlja2VyVmlldy5zZXRWaXNpYmlsaXR5KFZpZXcuVklTSUJMRSk7CisgICAgICAgICAgICBtVGlja2VyVmlldy5zdGFydEFuaW1hdGlvbihsb2FkQW5pbShjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmFuaW0ucHVzaF91cF9pbiwgbnVsbCkpOworICAgICAgICAgICAgbUljb25zLnN0YXJ0QW5pbWF0aW9uKGxvYWRBbmltKGNvbS5hbmRyb2lkLmludGVybmFsLlIuYW5pbS5wdXNoX3VwX291dCwgbnVsbCkpOworICAgICAgICAgICAgaWYgKG1FeHBhbmRlZFZpc2libGUpIHsKKyAgICAgICAgICAgICAgICBzZXREYXRlVmlld1Zpc2liaWxpdHkoZmFsc2UsIGNvbS5hbmRyb2lkLmludGVybmFsLlIuYW5pbS5wdXNoX3VwX291dCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgdGlja2VyRG9uZSgpIHsKKyAgICAgICAgICAgIG1JY29ucy5zZXRWaXNpYmlsaXR5KFZpZXcuVklTSUJMRSk7CisgICAgICAgICAgICBtVGlja2VyVmlldy5zZXRWaXNpYmlsaXR5KFZpZXcuR09ORSk7CisgICAgICAgICAgICBtSWNvbnMuc3RhcnRBbmltYXRpb24obG9hZEFuaW0oY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5hbmltLnB1c2hfZG93bl9pbiwgbnVsbCkpOworICAgICAgICAgICAgbVRpY2tlclZpZXcuc3RhcnRBbmltYXRpb24obG9hZEFuaW0oY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5hbmltLnB1c2hfZG93bl9vdXQsCisgICAgICAgICAgICAgICAgICAgICAgICBtVGlja2luZ0RvbmVMaXN0ZW5lcikpOworICAgICAgICAgICAgaWYgKG1FeHBhbmRlZFZpc2libGUpIHsKKyAgICAgICAgICAgICAgICBzZXREYXRlVmlld1Zpc2liaWxpdHkodHJ1ZSwgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5hbmltLnB1c2hfZG93bl9pbik7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCB0aWNrZXJIYWx0aW5nKCkgeworICAgICAgICAgICAgbUljb25zLnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKKyAgICAgICAgICAgIG1UaWNrZXJWaWV3LnNldFZpc2liaWxpdHkoVmlldy5HT05FKTsKKyAgICAgICAgICAgIG1JY29ucy5zdGFydEFuaW1hdGlvbihsb2FkQW5pbShjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmFuaW0uZmFkZV9pbiwgbnVsbCkpOworICAgICAgICAgICAgbVRpY2tlclZpZXcuc3RhcnRBbmltYXRpb24obG9hZEFuaW0oY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5hbmltLmZhZGVfb3V0LAorICAgICAgICAgICAgICAgICAgICAgICAgbVRpY2tpbmdEb25lTGlzdGVuZXIpKTsKKyAgICAgICAgICAgIGlmIChtRXhwYW5kZWRWaXNpYmxlKSB7CisgICAgICAgICAgICAgICAgc2V0RGF0ZVZpZXdWaXNpYmlsaXR5KHRydWUsIGNvbS5hbmRyb2lkLmludGVybmFsLlIuYW5pbS5mYWRlX2luKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIEFuaW1hdGlvbi5BbmltYXRpb25MaXN0ZW5lciBtVGlja2luZ0RvbmVMaXN0ZW5lciA9IG5ldyBBbmltYXRpb24uQW5pbWF0aW9uTGlzdGVuZXIoKSB7OworICAgICAgICBwdWJsaWMgdm9pZCBvbkFuaW1hdGlvbkVuZChBbmltYXRpb24gYW5pbWF0aW9uKSB7CisgICAgICAgICAgICBtVGlja2luZyA9IGZhbHNlOworICAgICAgICB9CisgICAgICAgIHB1YmxpYyB2b2lkIG9uQW5pbWF0aW9uUmVwZWF0KEFuaW1hdGlvbiBhbmltYXRpb24pIHsKKyAgICAgICAgfQorICAgICAgICBwdWJsaWMgdm9pZCBvbkFuaW1hdGlvblN0YXJ0KEFuaW1hdGlvbiBhbmltYXRpb24pIHsKKyAgICAgICAgfQorICAgIH07CisKKyAgICBwcml2YXRlIEFuaW1hdGlvbiBsb2FkQW5pbShpbnQgaWQsIEFuaW1hdGlvbi5BbmltYXRpb25MaXN0ZW5lciBsaXN0ZW5lcikgeworICAgICAgICBBbmltYXRpb24gYW5pbSA9IEFuaW1hdGlvblV0aWxzLmxvYWRBbmltYXRpb24oUGhvbmVTdGF0dXNCYXJTZXJ2aWNlLnRoaXMsIGlkKTsKKyAgICAgICAgaWYgKGxpc3RlbmVyICE9IG51bGwpIHsKKyAgICAgICAgICAgIGFuaW0uc2V0QW5pbWF0aW9uTGlzdGVuZXIobGlzdGVuZXIpOworICAgICAgICB9CisgICAgICAgIHJldHVybiBhbmltOworICAgIH0KKworICAgIHB1YmxpYyBTdHJpbmcgdmlld0luZm8oVmlldyB2KSB7CisgICAgICAgIHJldHVybiAiKCIgKyB2LmdldExlZnQoKSArICIsIiArIHYuZ2V0VG9wKCkgKyAiKSgiICsgdi5nZXRSaWdodCgpICsgIiwiICsgdi5nZXRCb3R0b20oKQorICAgICAgICAgICAgICAgICsgIiAiICsgdi5nZXRXaWR0aCgpICsgIngiICsgdi5nZXRIZWlnaHQoKSArICIpIjsKKyAgICB9CisKKyAgICBwcm90ZWN0ZWQgdm9pZCBkdW1wKEZpbGVEZXNjcmlwdG9yIGZkLCBQcmludFdyaXRlciBwdywgU3RyaW5nW10gYXJncykgeworICAgICAgICBpZiAoY2hlY2tDYWxsaW5nT3JTZWxmUGVybWlzc2lvbihhbmRyb2lkLk1hbmlmZXN0LnBlcm1pc3Npb24uRFVNUCkKKyAgICAgICAgICAgICAgICAhPSBQYWNrYWdlTWFuYWdlci5QRVJNSVNTSU9OX0dSQU5URUQpIHsKKyAgICAgICAgICAgIHB3LnByaW50bG4oIlBlcm1pc3Npb24gRGVuaWFsOiBjYW4ndCBkdW1wIFN0YXR1c0JhciBmcm9tIGZyb20gcGlkPSIKKyAgICAgICAgICAgICAgICAgICAgKyBCaW5kZXIuZ2V0Q2FsbGluZ1BpZCgpCisgICAgICAgICAgICAgICAgICAgICsgIiwgdWlkPSIgKyBCaW5kZXIuZ2V0Q2FsbGluZ1VpZCgpKTsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorCisgICAgICAgIHN5bmNocm9uaXplZCAobVF1ZXVlTG9jaykgeworICAgICAgICAgICAgcHcucHJpbnRsbigiQ3VycmVudCBTdGF0dXMgQmFyIHN0YXRlOiIpOworICAgICAgICAgICAgcHcucHJpbnRsbigiICBtRXhwYW5kZWQ9IiArIG1FeHBhbmRlZAorICAgICAgICAgICAgICAgICAgICArICIsIG1FeHBhbmRlZFZpc2libGU9IiArIG1FeHBhbmRlZFZpc2libGUpOworICAgICAgICAgICAgcHcucHJpbnRsbigiICBtVGlja2luZz0iICsgbVRpY2tpbmcpOworICAgICAgICAgICAgcHcucHJpbnRsbigiICBtVHJhY2tpbmc9IiArIG1UcmFja2luZyk7CisgICAgICAgICAgICBwdy5wcmludGxuKCIgIG1BbmltYXRpbmc9IiArIG1BbmltYXRpbmcKKyAgICAgICAgICAgICAgICAgICAgKyAiLCBtQW5pbVk9IiArIG1BbmltWSArICIsIG1BbmltVmVsPSIgKyBtQW5pbVZlbAorICAgICAgICAgICAgICAgICAgICArICIsIG1BbmltQWNjZWw9IiArIG1BbmltQWNjZWwpOworICAgICAgICAgICAgcHcucHJpbnRsbigiICBtQ3VyQW5pbWF0aW9uVGltZT0iICsgbUN1ckFuaW1hdGlvblRpbWUKKyAgICAgICAgICAgICAgICAgICAgKyAiIG1BbmltTGFzdFRpbWU9IiArIG1BbmltTGFzdFRpbWUpOworICAgICAgICAgICAgcHcucHJpbnRsbigiICBtRGlzcGxheUhlaWdodD0iICsgbURpc3BsYXlIZWlnaHQKKyAgICAgICAgICAgICAgICAgICAgKyAiIG1BbmltYXRpbmdSZXZlYWw9IiArIG1BbmltYXRpbmdSZXZlYWwKKyAgICAgICAgICAgICAgICAgICAgKyAiIG1WaWV3RGVsdGE9IiArIG1WaWV3RGVsdGEpOworICAgICAgICAgICAgcHcucHJpbnRsbigiICBtRGlzcGxheUhlaWdodD0iICsgbURpc3BsYXlIZWlnaHQpOworICAgICAgICAgICAgcHcucHJpbnRsbigiICBtRXhwYW5kZWRQYXJhbXM6ICIgKyBtRXhwYW5kZWRQYXJhbXMpOworICAgICAgICAgICAgcHcucHJpbnRsbigiICBtRXhwYW5kZWRWaWV3OiAiICsgdmlld0luZm8obUV4cGFuZGVkVmlldykpOworICAgICAgICAgICAgcHcucHJpbnRsbigiICBtRXhwYW5kZWREaWFsb2c6ICIgKyBtRXhwYW5kZWREaWFsb2cpOworICAgICAgICAgICAgcHcucHJpbnRsbigiICBtVHJhY2tpbmdQYXJhbXM6ICIgKyBtVHJhY2tpbmdQYXJhbXMpOworICAgICAgICAgICAgcHcucHJpbnRsbigiICBtVHJhY2tpbmdWaWV3OiAiICsgdmlld0luZm8obVRyYWNraW5nVmlldykpOworICAgICAgICAgICAgcHcucHJpbnRsbigiICBtT25nb2luZ1RpdGxlOiAiICsgdmlld0luZm8obU9uZ29pbmdUaXRsZSkpOworICAgICAgICAgICAgcHcucHJpbnRsbigiICBtT25nb2luZ0l0ZW1zOiAiICsgdmlld0luZm8obU9uZ29pbmdJdGVtcykpOworICAgICAgICAgICAgcHcucHJpbnRsbigiICBtTGF0ZXN0VGl0bGU6ICIgKyB2aWV3SW5mbyhtTGF0ZXN0VGl0bGUpKTsKKyAgICAgICAgICAgIHB3LnByaW50bG4oIiAgbUxhdGVzdEl0ZW1zOiAiICsgdmlld0luZm8obUxhdGVzdEl0ZW1zKSk7CisgICAgICAgICAgICBwdy5wcmludGxuKCIgIG1Ob05vdGlmaWNhdGlvbnNUaXRsZTogIiArIHZpZXdJbmZvKG1Ob05vdGlmaWNhdGlvbnNUaXRsZSkpOworICAgICAgICAgICAgcHcucHJpbnRsbigiICBtQ2xvc2VWaWV3OiAiICsgdmlld0luZm8obUNsb3NlVmlldykpOworICAgICAgICAgICAgcHcucHJpbnRsbigiICBtVGlja2VyVmlldzogIiArIHZpZXdJbmZvKG1UaWNrZXJWaWV3KSk7CisgICAgICAgICAgICBwdy5wcmludGxuKCIgIG1TY3JvbGxWaWV3OiAiICsgdmlld0luZm8obVNjcm9sbFZpZXcpCisgICAgICAgICAgICAgICAgICAgICsgIiBzY3JvbGwgIiArIG1TY3JvbGxWaWV3LmdldFNjcm9sbFgoKSArICIsIiArIG1TY3JvbGxWaWV3LmdldFNjcm9sbFkoKSk7CisgICAgICAgICAgICBwdy5wcmludGxuKCJtTm90aWZpY2F0aW9uTGluZWFyTGF5b3V0OiAiICsgdmlld0luZm8obU5vdGlmaWNhdGlvbkxpbmVhckxheW91dCkpOworICAgICAgICB9CisgICAgICAgIC8qCisgICAgICAgIHN5bmNocm9uaXplZCAobU5vdGlmaWNhdGlvbkRhdGEpIHsKKyAgICAgICAgICAgIGludCBOID0gbU5vdGlmaWNhdGlvbkRhdGEub25nb2luZ0NvdW50KCk7CisgICAgICAgICAgICBwdy5wcmludGxuKCIgIG9uZ29pbmdDb3VudC5zaXplPSIgKyBOKTsKKyAgICAgICAgICAgIGZvciAoaW50IGk9MDsgaTxOOyBpKyspIHsKKyAgICAgICAgICAgICAgICBTdGF0dXNCYXJOb3RpZmljYXRpb24gbiA9IG1Ob3RpZmljYXRpb25EYXRhLmdldE9uZ29pbmcoaSk7CisgICAgICAgICAgICAgICAgcHcucHJpbnRsbigiICAgIFsiICsgaSArICJdIGtleT0iICsgbi5rZXkgKyAiIHZpZXc9IiArIG4udmlldyk7CisgICAgICAgICAgICAgICAgcHcucHJpbnRsbigiICAgICAgICAgICBkYXRhPSIgKyBuLmRhdGEpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgTiA9IG1Ob3RpZmljYXRpb25EYXRhLmxhdGVzdENvdW50KCk7CisgICAgICAgICAgICBwdy5wcmludGxuKCIgIG9uZ29pbmdDb3VudC5zaXplPSIgKyBOKTsKKyAgICAgICAgICAgIGZvciAoaW50IGk9MDsgaTxOOyBpKyspIHsKKyAgICAgICAgICAgICAgICBTdGF0dXNCYXJOb3RpZmljYXRpb24gbiA9IG1Ob3RpZmljYXRpb25EYXRhLmdldExhdGVzdChpKTsKKyAgICAgICAgICAgICAgICBwdy5wcmludGxuKCIgICAgWyIgKyBpICsgIl0ga2V5PSIgKyBuLmtleSArICIgdmlldz0iICsgbi52aWV3KTsKKyAgICAgICAgICAgICAgICBwdy5wcmludGxuKCIgICAgICAgICAgIGRhdGE9IiArIG4uZGF0YSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgKi8KKworICAgICAgICBpZiAoZmFsc2UpIHsKKyAgICAgICAgICAgIHB3LnByaW50bG4oInNlZSB0aGUgbG9nY2F0IGZvciBhIGR1bXAgb2YgdGhlIHZpZXdzIHdlIGhhdmUgY3JlYXRlZC4iKTsKKyAgICAgICAgICAgIC8vIG11c3QgaGFwcGVuIG9uIHVpIHRocmVhZAorICAgICAgICAgICAgbUhhbmRsZXIucG9zdChuZXcgUnVubmFibGUoKSB7CisgICAgICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIHJ1bigpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1TdGF0dXNCYXJWaWV3LmdldExvY2F0aW9uT25TY3JlZW4obUFic1Bvcyk7CisgICAgICAgICAgICAgICAgICAgICAgICBTbG9nLmQoVEFHLCAibVN0YXR1c0JhclZpZXc6IC0tLS0tICgiICsgbUFic1Bvc1swXSArICIsIiArIG1BYnNQb3NbMV0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiKSAiICsgbVN0YXR1c0JhclZpZXcuZ2V0V2lkdGgoKSArICJ4IgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIG1TdGF0dXNCYXJWaWV3LmdldEhlaWdodCgpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1TdGF0dXNCYXJWaWV3LmRlYnVnKCk7CisKKyAgICAgICAgICAgICAgICAgICAgICAgIG1FeHBhbmRlZFZpZXcuZ2V0TG9jYXRpb25PblNjcmVlbihtQWJzUG9zKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIFNsb2cuZChUQUcsICJtRXhwYW5kZWRWaWV3OiAtLS0tLSAoIiArIG1BYnNQb3NbMF0gKyAiLCIgKyBtQWJzUG9zWzFdCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgIikgIiArIG1FeHBhbmRlZFZpZXcuZ2V0V2lkdGgoKSArICJ4IgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIG1FeHBhbmRlZFZpZXcuZ2V0SGVpZ2h0KCkpOworICAgICAgICAgICAgICAgICAgICAgICAgbUV4cGFuZGVkVmlldy5kZWJ1ZygpOworCisgICAgICAgICAgICAgICAgICAgICAgICBtVHJhY2tpbmdWaWV3LmdldExvY2F0aW9uT25TY3JlZW4obUFic1Bvcyk7CisgICAgICAgICAgICAgICAgICAgICAgICBTbG9nLmQoVEFHLCAibVRyYWNraW5nVmlldzogLS0tLS0gKCIgKyBtQWJzUG9zWzBdICsgIiwiICsgbUFic1Bvc1sxXQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArICIpICIgKyBtVHJhY2tpbmdWaWV3LmdldFdpZHRoKCkgKyAieCIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyBtVHJhY2tpbmdWaWV3LmdldEhlaWdodCgpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1UcmFja2luZ1ZpZXcuZGVidWcoKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0pOworICAgICAgICB9CisgICAgfQorCisgICAgdm9pZCBvbkJhclZpZXdBdHRhY2hlZCgpIHsKKyAgICAgICAgV2luZG93TWFuYWdlci5MYXlvdXRQYXJhbXMgbHA7CisgICAgICAgIGludCBwaXhlbEZvcm1hdDsKKyAgICAgICAgRHJhd2FibGUgYmc7CisKKyAgICAgICAgLy8vIC0tLS0tLS0tLS0gVHJhY2tpbmcgVmlldyAtLS0tLS0tLS0tLS0tLQorICAgICAgICBwaXhlbEZvcm1hdCA9IFBpeGVsRm9ybWF0LlJHQlhfODg4ODsKKyAgICAgICAgYmcgPSBtVHJhY2tpbmdWaWV3LmdldEJhY2tncm91bmQoKTsKKyAgICAgICAgaWYgKGJnICE9IG51bGwpIHsKKyAgICAgICAgICAgIHBpeGVsRm9ybWF0ID0gYmcuZ2V0T3BhY2l0eSgpOworICAgICAgICB9CisKKyAgICAgICAgbHAgPSBuZXcgV2luZG93TWFuYWdlci5MYXlvdXRQYXJhbXMoCisgICAgICAgICAgICAgICAgVmlld0dyb3VwLkxheW91dFBhcmFtcy5NQVRDSF9QQVJFTlQsCisgICAgICAgICAgICAgICAgVmlld0dyb3VwLkxheW91dFBhcmFtcy5NQVRDSF9QQVJFTlQsCisgICAgICAgICAgICAgICAgV2luZG93TWFuYWdlci5MYXlvdXRQYXJhbXMuVFlQRV9TVEFUVVNfQkFSX1BBTkVMLAorICAgICAgICAgICAgICAgIF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zZXRGb3JtYXQocGl4ZWxGb3JtYXQpOworICAgICAgICBtRXhwYW5kZWRQYXJhbXMgPSBscDsKKworICAgICAgICBtRXhwYW5kZWREaWFsb2cuZ2V0V2luZG93KCkucmVxdWVzdEZlYXR1cmUoV2luZG93LkZFQVRVUkVfTk9fVElUTEUpOworICAgICAgICBtRXhwYW5kZWREaWFsb2cuc2V0Q29udGVudFZpZXcobUV4cGFuZGVkVmlldywKKyAgICAgICAgICAgICAgICBuZXcgVmlld0dyb3VwLkxheW91dFBhcmFtcyhWaWV3R3JvdXAuTGF5b3V0UGFyYW1zLk1BVENIX1BBUkVOVCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBWaWV3R3JvdXAuTGF5b3V0UGFyYW1zLk1BVENIX1BBUkVOVCkpOworICAgICAgICBtRXhwYW5kZWREaWFsb2cuZ2V0V2luZG93KCkuc2V0QmFja2dyb3VuZERyYXdhYmxlKG51bGwpOworICAgICAgICBtRXhwYW5kZWREaWFsb2cuc2hvdygpOworICAgICAgICBGcmFtZUxheW91dCBoYWNrID0gKEZyYW1lTGF5b3V0KW1FeHBhbmRlZFZpZXcuZ2V0UGFyZW50KCk7CisgICAgfQorCisgICAgdm9pZCBzZXREYXRlVmlld1Zpc2liaWxpdHkoYm9vbGVhbiB2aXNpYmxlLCBpbnQgYW5pbSkgeworICAgICAgICBtRGF0ZVZpZXcuc2V0VXBkYXRlcyh2aXNpYmxlKTsKKyAgICAgICAgbURhdGVWaWV3LnNldFZpc2liaWxpdHkodmlzaWJsZSA/IFZpZXcuVklTSUJMRSA6IFZpZXcuSU5WSVNJQkxFKTsKKyAgICAgICAgbURhdGVWaWV3LnN0YXJ0QW5pbWF0aW9uKGxvYWRBbmltKGFuaW0sIG51bGwpKTsKKyAgICB9CisKKyAgICB2b2lkIHNldE5vdGlmaWNhdGlvbkljb25WaXNpYmlsaXR5KGJvb2xlYW4gdmlzaWJsZSwgaW50IGFuaW0pIHsKKyAgICAgICAgaW50IG9sZCA9IG1Ob3RpZmljYXRpb25JY29ucy5nZXRWaXNpYmlsaXR5KCk7CisgICAgICAgIGludCB2ID0gdmlzaWJsZSA/IFZpZXcuVklTSUJMRSA6IFZpZXcuSU5WSVNJQkxFOworICAgICAgICBpZiAob2xkICE9IHYpIHsKKyAgICAgICAgICAgIG1Ob3RpZmljYXRpb25JY29ucy5zZXRWaXNpYmlsaXR5KHYpOworICAgICAgICAgICAgbU5vdGlmaWNhdGlvbkljb25zLnN0YXJ0QW5pbWF0aW9uKGxvYWRBbmltKGFuaW0sIG51bGwpKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHZvaWQgdXBkYXRlRXhwYW5kZWRWaWV3UG9zKGludCBleHBhbmRlZFBvc2l0aW9uKSB7CisgICAgICAgIGlmIChTUEVXKSB7CisgICAgICAgICAgICBTbG9nLmQoVEFHLCAidXBkYXRlRXhwYW5kZWRWaWV3UG9zIGJlZm9yZSBleHBhbmRlZFBvc2l0aW9uPSIgKyBleHBhbmRlZFBvc2l0aW9uCisgICAgICAgICAgICAgICAgICAgICsgIiBtVHJhY2tpbmdQYXJhbXMueT0iICsgbVRyYWNraW5nUGFyYW1zLnkKKyAgICAgICAgICAgICAgICAgICAgKyAiIG1UcmFja2luZ1Bvc2l0aW9uPSIgKyBtVHJhY2tpbmdQb3NpdGlvbik7CisgICAgICAgIH0KKworICAgICAgICBpbnQgaCA9IG1TdGF0dXNCYXJWaWV3LmdldEhlaWdodCgpOworICAgICAgICBpbnQgZGlzcGggPSBtRGlzcGxheS5nZXRIZWlnaHQoKTsKKworICAgICAgICAvLyBJZiB0aGUgZXhwYW5kZWQgdmlldyBpcyBub3QgdmlzaWJsZSwgbWFrZSBzdXJlIHRoZXkncmUgc3RpbGwgb2ZmIHNjcmVlbi4KKyAgICAgICAgLy8gTWF5YmUgdGhlIHZpZXcgd2FzIHJlc2l6ZWQuCisgICAgICAgIGlmICghbUV4cGFuZGVkVmlzaWJsZSkgeworICAgICAgICAgICAgaWYgKG1UcmFja2luZ1ZpZXcgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIG1UcmFja2luZ1Bvc2l0aW9uID0gLWRpc3BoOworICAgICAgICAgICAgICAgIGlmIChtVHJhY2tpbmdQYXJhbXMgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBtVHJhY2tpbmdQYXJhbXMueSA9IG1UcmFja2luZ1Bvc2l0aW9uOworICAgICAgICAgICAgICAgICAgICBXaW5kb3dNYW5hZ2VySW1wbC5nZXREZWZhdWx0KCkudXBkYXRlVmlld0xheW91dChtVHJhY2tpbmdWaWV3LCBtVHJhY2tpbmdQYXJhbXMpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChtRXhwYW5kZWRQYXJhbXMgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIG1FeHBhbmRlZFBhcmFtcy55ID0gLWRpc3BoOworICAgICAgICAgICAgICAgIG1FeHBhbmRlZERpYWxvZy5nZXRXaW5kb3coKS5zZXRBdHRyaWJ1dGVzKG1FeHBhbmRlZFBhcmFtcyk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKworICAgICAgICAvLyB0cmFja2luZyB2aWV3Li4uCisgICAgICAgIGludCBwb3M7CisgICAgICAgIGlmIChleHBhbmRlZFBvc2l0aW9uID09IEVYUEFOREVEX0ZVTExfT1BFTikgeworICAgICAgICAgICAgcG9zID0gaDsKKyAgICAgICAgfQorICAgICAgICBlbHNlIGlmIChleHBhbmRlZFBvc2l0aW9uID09IEVYUEFOREVEX0xFQVZFX0FMT05FKSB7CisgICAgICAgICAgICBwb3MgPSBtVHJhY2tpbmdQb3NpdGlvbjsKKyAgICAgICAgfQorICAgICAgICBlbHNlIHsKKyAgICAgICAgICAgIGlmIChleHBhbmRlZFBvc2l0aW9uIDw9IGRpc3BoKSB7CisgICAgICAgICAgICAgICAgcG9zID0gZXhwYW5kZWRQb3NpdGlvbjsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgcG9zID0gZGlzcGg7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBwb3MgLT0gZGlzcGgtaDsKKyAgICAgICAgfQorICAgICAgICBtVHJhY2tpbmdQb3NpdGlvbiA9IG1UcmFja2luZ1BhcmFtcy55ID0gcG9zOworICAgICAgICBtVHJhY2tpbmdQYXJhbXMuaGVpZ2h0ID0gZGlzcGgtaDsKKyAgICAgICAgV2luZG93TWFuYWdlckltcGwuZ2V0RGVmYXVsdCgpLnVwZGF0ZVZpZXdMYXlvdXQobVRyYWNraW5nVmlldywgbVRyYWNraW5nUGFyYW1zKTsKKworICAgICAgICBpZiAobUV4cGFuZGVkUGFyYW1zICE9IG51bGwpIHsKKyAgICAgICAgICAgIG1DbG9zZVZpZXcuZ2V0TG9jYXRpb25JbldpbmRvdyhtUG9zaXRpb25UbXApOworICAgICAgICAgICAgZmluYWwgaW50IGNsb3NlUG9zID0gbVBvc2l0aW9uVG1wWzFdOworCisgICAgICAgICAgICBtRXhwYW5kZWRDb250ZW50cy5nZXRMb2NhdGlvbkluV2luZG93KG1Qb3NpdGlvblRtcCk7CisgICAgICAgICAgICBmaW5hbCBpbnQgY29udGVudHNCb3R0b20gPSBtUG9zaXRpb25UbXBbMV0gKyBtRXhwYW5kZWRDb250ZW50cy5nZXRIZWlnaHQoKTsKKworICAgICAgICAgICAgbUV4cGFuZGVkUGFyYW1zLnkgPSBwb3MgKyBtVHJhY2tpbmdWaWV3LmdldEhlaWdodCgpCisgICAgICAgICAgICAgICAgICAgIC0gKG1UcmFja2luZ1BhcmFtcy5oZWlnaHQtY2xvc2VQb3MpIC0gY29udGVudHNCb3R0b207CisgICAgICAgICAgICBpbnQgbWF4ID0gaDsKKyAgICAgICAgICAgIGlmIChtRXhwYW5kZWRQYXJhbXMueSA+IG1heCkgeworICAgICAgICAgICAgICAgIG1FeHBhbmRlZFBhcmFtcy55ID0gbWF4OworICAgICAgICA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GFuZGVkUG9zaXRpb24gIT0gRVhQQU5ERURfTEVBVkVfQUxPTkUpIHsKKyAgICAgICAgICAgICAgICBpZiAoU1BFVykgU2xvZy5kKFRBRywgInVwZGF0ZUV4cGFuZGVkVmlld1BvcyB2aXNpYmlsaXR5Q2hhbmdlZCgiICsgdmlzaWJsZSArICIpIik7CisgICAgICAgICAgICAgICAgdmlzaWJpbGl0eUNoYW5nZWQodmlzaWJsZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBpZiAoU1BFVykgeworICAgICAgICAgICAgU2xvZy5kKFRBRywgInVwZGF0ZUV4cGFuZGVkVmlld1BvcyBhZnRlciAgZXhwYW5kZWRQb3NpdGlvbj0iICsgZXhwYW5kZWRQb3NpdGlvbgorICAgICAgICAgICAgICAgICAgICArICIgbVRyYWNraW5nUGFyYW1zLnk9IiArIG1UcmFja2luZ1BhcmFtcy55CisgICAgICAgICAgICAgICAgICAgICsgIiBtVHJhY2tpbmdQb3NpdGlvbj0iICsgbVRyYWNraW5nUG9zaXRpb24KKyAgICAgICAgICAgICAgICAgICAgKyAiIG1FeHBhbmRlZFBhcmFtcy55PSIgKyBtRXhwYW5kZWRQYXJhbXMueQorICAgICAgICAgICAgICAgICAgICArICIgbUV4cGFuZGVkUGFyYW1zLmhlaWdodD0iICsgbUV4cGFuZGVkUGFyYW1zLmhlaWdodCk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBpbnQgZ2V0RXhwYW5kZWRIZWlnaHQoKSB7CisgICAgICAgIHJldHVybiBtRGlzcGxheS5nZXRIZWlnaHQoKSAtIG1TdGF0dXNCYXJWaWV3LmdldEhlaWdodCgpIC0gbUNsb3NlVmlldy5nZXRIZWlnaHQoKTsKKyAgICB9CisKKyAgICB2b2lkIHVwZGF0ZUV4cGFuZGVkSGVpZ2h0KCkgeworICAgICAgICBpZiAobUV4cGFuZGVkVmlldyAhPSBudWxsKSB7CisgICAgICAgICAgICBtRXhwYW5kZWRQYXJhbXMuaGV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gICAgICAgICAgICAvLyBXb24ndCBmYWlsIHVubGVzcyB0aGUgd29ybGQgaGFzIGVuZGVkLgorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgdm9pZCBwZXJmb3JtRGlzYWJsZUFjdGlvbnMoaW50IG5ldCkgeworICAgICAgICBpbnQgb2xkID0gbURpc2FibGVkOworICAgICAgICBpbnQgZGlmZiA9IG5ldCBeIG9sZDsKKyAgICAgICAgbURpc2FibGVkID0gbmV0OworCisgICAgICAgIC8vIGFjdCBhY2NvcmRpbmdseQorICAgICAgICBpZiAoKGRpZmYgJiBTdGF0dXNCYXJNYW5hZ2VyLkRJU0FCTEVfRVhQQU5EKSAhPSAwKSB7CisgICAgICAgICAgICBpZiAoKG5ldCAmIFN0YXR1c0Jhck1hbmFnZXIuRElTQUJMRV9FWFBBTkQpICE9IDApIHsKKyAgICAgICAgICAgICAgICBTbG9nLmQoVEFHLCAiRElTQUJMRV9FWFBBTkQ6IHllcyIpOworICAgICAgICAgICAgICAgIGFuaW1hdGVDb2xsYXBzZSgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGlmICgoZGlmZiAmIFN0YXR1c0Jhck1hbmFnZXIuRElTQUJMRV9OT1RJRklDQVRJT05fSUNPTlMpICE9IDApIHsKKyAgICAgICAgICAgIGlmICgobmV0ICYgU3RhdHVzQmFyTWFuYWdlci5ESVNBQkxFX05PVElGSUNBVElPTl9JQ09OUykgIT0gMCkgeworICAgICAgICAgICAgICAgIFNsb2cuZChUQUcsICJESVNBQkxFX05PVElGSUNBVElPTl9JQ09OUzogeWVzIik7CisgICAgICAgICAgICAgICAgaWYgKG1UaWNraW5nKSB7CisgICAgICAgICAgICAgICAgICAgIG1Ob3RpZmljYXRpb25JY29ucy5zZXRWaXNpYmlsaXR5KFZpZXcuSU5WSVNJQkxFKTsKKyAgICAgICAgICAgICAgICAgICAgbVRpY2tlci5oYWx0KCk7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgc2V0Tm90aWZpY2F0aW9uSWNvblZpc2liaWxpdHkoZmFsc2UsIGNvbS5hbmRyb2lkLmludGVybmFsLlIuYW5pbS5mYWRlX291dCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBTbG9nLmQoVEFHLCAiRElTQUJMRV9OT1RJRklDQVRJT05fSUNPTlM6IG5vIik7CisgICAgICAgICAgICAgICAgaWYgKCFtRXhwYW5kZWRWaXNpYmxlKSB7CisgICAgICAgICAgICAgICAgICAgIHNldE5vdGlmaWNhdGlvbkljb25WaXNpYmlsaXR5KHRydWUsIGNvbS5hbmRyb2lkLmludGVybmFsLlIuYW5pbS5mYWRlX2luKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSBpZiAoKGRpZmYgJiBTdGF0dXNCYXJNYW5hZ2VyLkRJU0FCTEVfTk9USUZJQ0FUSU9OX1RJQ0tFUikgIT0gMCkgeworICAgICAgICAgICAgaWYgKG1UaWNraW5nICYmIChuZXQgJiBTdGF0dXNCYXJNYW5hZ2VyLkRJU0FCTEVfTk9USUZJQ0FUSU9OX1RJQ0tFUikgIT0gMCkgeworICAgICAgICAgICAgICAgIG1UaWNrZXIuaGFsdCgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSBWaWV3Lk9uQ2xpY2tMaXN0ZW5lciBtQ2xlYXJCdXR0b25MaXN0ZW5lciA9IG5ldyBWaWV3Lk9uQ2xpY2tMaXN0ZW5lcigpIHsKKyAgICAgICAgcHVibGljIHZvaWQgb25DbGljayhWaWV3IHYpIHsKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgbUJhclNlcnZpY2Uub25DbGVhckFsbE5vdGlmaWNhdGlvbnMoKTsKKyAgICAgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBleCkgeworICAgICAgICAgICAgICAgIC8vIHN5c3RlbSBwcm9jZXNzIGlzIGRlYWQgaWYgd2UncmUgaGVyZS4KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGFuaW1hdGVDb2xsYXBzZSgpOworICAgICAgICB9CisgICAgfTsKKworICAgIHByaXZhdGUgQnJvYWRjYXN0UmVjZWl2ZXIgbUJyb2FkY2FzdFJlY2VpdmVyID0gbmV3IEJyb2FkY2FzdFJlY2VpdmVyKCkgeworICAgICAgICBwdWJsaWMgdm9pZCBvblJlY2VpdmUoQ29udGV4dCBjb250ZXh0LCBJbnRlbnQgaW50ZW50KSB7CisgICAgICAgICAgICBTdHJpbmcgYWN0aW9uID0gaW50ZW50LmdldEFjdGlvbigpOworICAgICAgICAgICAgaWYgKEludGVudC5BQ1RJT05fQ0xPU0VfU1lTVEVNX0RJQUxPR1MuZXF1YWxzKGFjdGlvbikKKyAgICAgICAgICAgICAgICAgICAgfHwgSW50ZW50LkFDVElPTl9TQ1JFRU5fT0ZGLmVxdWFscyhhY3Rpb24pKSB7CisgICAgICAgICAgICAgICAgYW5pbWF0ZUNvbGxhcHNlKCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlIGlmIChJbnRlbnQuQUNUSU9OX0NPTkZJR1VSQVRJT05fQ0hBTkdFRC5lcXVhbHMoYWN0aW9uKSkgeworICAgICAgICAgICAgICAgIHVwZGF0ZVJlc291cmNlcygpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfTsKKworICAgIHByaXZhdGUgdm9pZCBzZXRJbnRydWRlckFsZXJ0VmlzaWJpbGl0eShib29sZWFuIHZpcykgeworICAgICAgICBtSW50cnVkZXJBbGVydFZpZXcuc2V0VmlzaWJpbGl0eSh2aXMgPyBWaWV3LlZJU0lCTEUgOiBWaWV3LkdPTkUpOworICAgIH0KKworICAgIC8qKgorICAgICAqIFJlbG9hZCBzb21lIG9mIG91ciByZXNvdXJjZXMgd2hlbiB0aGUgY29uZmlndXJh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AgIC8vCisKKyAgICB2b2lkIHBvc3RTdGFydFRyYWNpbmcoKSB7CisgICAgICAgIG1IYW5kbGVyLnBvc3REZWxheWVkKG1TdGFydFRyYWNpbmcsIDMwMDApOworICAgIH0KKworICAgIHZvaWQgdmlicmF0ZSgpIHsKKyAgICAgICAgYW5kcm9pZC5vcy5WaWJyYXRvciB2aWIgPSAoYW5kcm9pZC5vcy5WaWJyYXRvcilnZXRTeXN0ZW1TZXJ2aWNlKENvbnRleHQuVklCUkFUT1JfU0VSVklDRSk7CisgICAgICAgIHZpYi52aWJyYXRlKDI1MCk7CisgICAgfQorCisgICAgUnVubmFibGUgbVN0YXJ0VHJhY2luZyA9IG5ldyBSdW5uYWJsZSgpIHsKKyAgICAgICAgcHVibGljIHZvaWQgcnVuKCkgeworICAgICAgICAgICAgdmlicmF0ZSgpOworICAgICAgICAgICAgU3lzdGVtQ2xvY2suc2xlZXAoMjUwKTsKKyAgICAgICAgICAgIFNsb2cuZChUQUcsICJzdGFydFRyYWNpbmciKTsKKyAgICAgICAgICAgIGFuZHJvaWQub3MuRGVidWcuc3RhcnRNZXRob2RUcmFjaW5nKCIvZGF0YS9zdGF0dXNiYXItdHJhY2VzL3RyYWNlIik7CisgICAgICAgICAgICBtSGFuZGxlci5wb3N0RGVsYXllZChtU3RvcFRyYWNpbmcsIDEwMDAwKTsKKyAgICAgICAgfQorICAgIH07CisKKyAgICBSdW5uYWJsZSBtU3RvcFRyYWNpbmcgPSBuZXcgUnVubmFibGUoKSB7CisgICAgICAgIHB1YmxpYyB2b2lkIHJ1bigpIHsKKyAgICAgICAgICAgIGFuZHJvaWQub3MuRGVidWcuc3RvcE1ldGhvZFRyYWNpbmcoKTsKKyAgICAgICAgICAgIFNsb2cuZChUQUcsICJzdG9wVHJhY2luZyIpOworICAgICAgICAgICAgdmlicmF0ZSgpOworICAgICAgICB9CisgICAgfTsKK30KKwpkaWZmIC0tZ2l0IGEvcGFja2FnZXMvU3lzdGVtVUkvc3JjL2NvbS9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50YXRpb24KKyAgICAgICAgaW50IHBvc2l0aW9uOyAvLyBwb3NpdGlvbiBpbiBsaXN0CisKKyAgICAgICAgcHVibGljIEFjdGl2aXR5RGVzY3JpcHRpb24oQml0bWFwIF90aHVtYm5haWwsCisgICAgICAgICAgICAgICAgRHJhd2FibGUgX2ljb24sIFN0cmluZyBfbGFiZWwsIFN0cmluZyBfZGVzYywgaW50IF9pZCwgaW50IF9wb3MpCisgICAgICAgIHsKKyAgICAgICAgICAgIHRodW1ibmFpbCA9IF90aHVtYm5haWw7CisgICAgICAgICAgICBpY29uID0gX2ljb247CisgICAgICAgICAgICBsYWJlbCA9IF9sYWJlbDsKKyAgICAgICAgICAgIGRlc2NyaXB0aW9uID0gX2Rlc2M7CisgICAgICAgICAgICBpZCA9IF9pZDsKKyAgICAgICAgICAgIHBvc2l0aW9uID0gX3BvczsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyB2b2lkIGNsZWFyKCkgeworICAgICAgICAgICAgaWNvbiA9IG51bGw7CisgICAgICAgICAgICB0aHVtYm5haWwgPSBudWxsOworICAgICAgICAgICAgbGFiZWwgPSBudWxsOworICAgICAgICAgICAgZGVzY3JpcHRpb24gPSBudWxsOworICAgICAgICAgICAgaW50ZW50ID0gbnVsbDsKKyAgICAgICAgICAgIG1hdHJpeCA9IG51bGw7CisgICAgICAgICAgICBpZCA9IC0xOworICAgICAgICAgICAgcG9zaXRpb24gPSAtMTsKKyAgICAgICAgfQorICAgIH07CisKKyAgICBwcml2YXRlIEFjdGl2aXR5RGVzY3JpcHRpb24gZmluZEFjdGl2aXR5RGVzY3JpcHRpb24oaW50IGlkKSB7CisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbUFjdGl2aXR5RGVzY3JpcHRpb25zLnNpemUoKTsgaSsrKSB7CisgICAgICAgICAgICBBY3Rpdml0eURlc2NyaXB0aW9uIGl0ZW0gPSBtQWN0aXZpdHlEZXNjcmlwdGlvbnMuZ2V0KGkpOworICAgICAgICAgICAgaWYgKGl0ZW0gIT0gbnVsbCAmJiBpdGVtLmlkID09IGlkKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIGl0ZW07CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIG51bGw7CisgICAgfQorCisgICAgZmluYWwgQ2Fyb3VzZWxDYWxsYmFjayBtQ2Fyb3VzZWxDYWxsYmFjayA9IG5ldyBDYXJvdXNlbENhbGxiYWNrKCkgeworCisgICAgICAgIHB1YmxpYyB2b2lkIG9uQW5pbWF0aW9uRmluaXNoZWQoKSB7CisKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyB2b2lkIG9uQW5pbWF0aW9uU3RhcnRlZCgpIHsKKworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgb25DYXJkU2VsZWN0ZWQoaW50IG4pIHsKKyAgICAgICAgICAgIGlmIChuIDwgbUFjdGl2aXR5RGVzY3JpcHRpb25zLnNpemUoKSkgeworICAgICAgICAgICAgICAgIEFjdGl2aXR5RGVzY3JpcHRpb24gaXRlbSA9IG1BY3Rpdml0eURlc2NyaXB0aW9ucy5nZXQobik7CisgICAgICAgICAgICAgICAgLy8gcHJlcGFyZSBhIGxhdW5jaCBpbnRlbnQgYW5kIHNlbmQgaXQKKyAgICAgICAgICAgICAgICBpZiAoaXRlbS5pbnRlbnQgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBpdGVtLmludGVudC5hZGRGbGFncyhJbnRlbnQuRkxBR19BQ1RJVklUWV9MQVVOQ0hFRF9GUk9NX0hJU1RPUlkpOworICAgICAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKERCRykgTG9nLnYoVEFHLCAiU3RhcnRpbmcgaW50ZW50ICIgKyBpdGVtLmludGVudCk7CisgICAgICAgICAgICAgICAgICAgICAgICBzdGFydEFjdGl2aXR5KGl0ZW0uaW50ZW50KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vb3ZlcnJpZGVQZW5kaW5nVHJhbnNpdGlvbihSLmFuaW0uem9vbV9lbnRlciwgUi5hbmltLnpvb21fZXhpdCk7CisgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKEFjdGl2aXR5Tm90Rm91bmRFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKERCRykgTG9nLncoIlJlY2VudCIsICJVbmFibGUgdG8gbGF1bmNoIHJlY2VudCB0YXNrIiwgZSk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgZmluaXNoKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgb25JbnZhbGlkYXRlVGV4dHVyZShpbnQgbikgeworCisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBvblJlcXVlc3RHZW9tZXRyeShpbnQgbikgeworCisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBvbkludmFsaWRhdGVHZW9tZXRyeShpbnQgbikgeworCisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBvblJlcXVlc3RUZXh0dXJlKGZpbmFsIGludCBuKSB7CisgICAgICAgICAgICBpZiAoREJHKSBMb2cudihUQUcsICJvblJlcXVlc3RUZXh0dXJlKCIgKyBuICsgIikiKTsKKyAgICAgICAgICAgIGlmIChuIDwgbUFjdGl2aXR5RGVzY3JpcHRpb25zLnNpemUoKSkgeworICAgICAgICAgICAgICAgIG1DYXJvdXNlbFZpZXcucG9zdChuZXcgUnVubmFibGUoKSB7CisgICAgICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIHJ1bigpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIEFjdGl2aXR5RGVzY3JpcHRpb24gaW5mbyA9IG1BY3Rpdml0eURlc2NyaXB0aW9ucy5nZXQobik7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaW5mbyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKERCRykgTG9nLnYoVEFHLCAiRk9VTkQgQUNUSVZJVFkgVEhVTUJOQUlMICIgKyBpbmZvLnRodW1ibmFpbCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgQml0bWFwIGJpdG1hcCA9IGluZm8udGh1bWJuYWlsID09IG51bGwgPyBtQmxhbmtCaXRtYXAgOiBpbmZvLnRodW1ibmFpbDsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtQ2Fyb3VzZWxWaWV3LnNldFRleHR1cmVGb3JJdGVtKG4sIGJpdG1hcCk7CisgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChEQkcpIExvZy52KFRBRywgIkZBSUxFRCBUTyBHRVQgQUNUSVZJVFkgVEhVTUJOQUlMIEZPUiBJVEVNICIgKyBuKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0pOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfTsKKworICAgIHByaXZhdGUgZmluYWwgSVRodW1ibmFpbFJlY2VpdmVyIG1UaHVtYm5haWxSZWNlaXZlciA9IG5ldyBJVGh1bWJuYWlsUmVjZWl2ZXIuU3R1YigpIHsKKworICAgICAgICBwdWJsaWMgdm9pZCBmaW5pc2hlZCgpIHRocm93cyBSZW1vdGVFeGNlcHRpb24geworCisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBuZXdUaHVtYm5haWwoZmluYWwgaW50IGlkLCBmaW5hbCBCaXRtYXAgYml0bWFwLCBDaGFyU2VxdWVuY2UgZGVzY3JpcHRpb24pCisgICAgICAgICAgICAgICAgdGhyb3dzIFJlbW90ZUV4Y2VwdGlvbiB7CisgICAgICAgICAgICBpbnQgdyA9IGJpdG1hcC5nZXRXaWR0aCgpOworICAgICAgICAgICAgaW50IGggPSBiaXRtYXAuZ2V0SGVpZ2h0KCk7CisgICAgICAgICAgICBpZiAoREJHKSBMb2cudihUQUcsICJOZXcgdGh1bWJuYWlsIGZvciBpZD0iICsgaWQgKyAiLCBkaW1lbnNpb25zPSIgKyB3ICsgIngiICsgaAorICAgICAgICAgICAgICAgICAgICArICIgZGVzY3JpcHRpb24gJyIgKyBkZXNjcmlwdGlvbiArICInIik7CisgICAgICAgICAgICBBY3Rpdml0eURlc2NyaXB0aW9uIGluZm8gPSBmaW5kQWN0aXZpdHlEZXNjcmlwdGlvbihpZCk7CisgICAgICAgICAgICBpZiAoaW5mbyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgaW5mby50aHVtYm5haWwgPSBiaXRtYXA7CisgICAgICAgICAgICAgICAgZmluYWwgaW50IHRodW1iV2lkdGggPSBiaXRtYXAuZ2V0V2lkdGgoKTsKKyAgICAgICAgICAgICAgICBmaW5hbCBpbnQgdGh1bWJIZWlnaHQgPSBiaXRtYXAuZ2V0SGVpZ2h0KCk7CisgICAgICAgICAgICAgICAgaWYgKChtUG9ydHJhaXRNb2RlICYmIHRodW1iV2lkdGggPiB0aHVtYkhlaWdodCkKKyAgICAgICAgICAgICAgICAgICAgICAgIHx8ICghbVBvcnRyYWl0TW9kZSAmJiB0aHVtYldpZHRoIDwgdGh1bWJIZWlnaHQpKSB7CisgICAgICAgICAgICAgICAgICAgIE1hdHJpeCBtYXRyaXggPSBuZXcgTWF0cml4KCk7CisgICAgICAgICAgICAgICAgICAgIG1hdHJpeC5zZXRSb3RhdGUoOTAuMGYsIChmbG9hdCkgdGh1bWJXaWR0aCAvIDIsIChmbG9hdCkgdGh1bWJIZWlnaHQgLyAyKTsKKyAgICAgICAgICAgICAgICAgICAgaW5mby5tYXRyaXggPSBtYXRyaXg7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgaW5mby5tYXRyaXggPSBudWxsOworICAgICAgICAgICAgICAgIH0KKyAg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2VkKG5ld0NvbmZpZyk7CisgICAgICAgIG1Qb3J0cmFpdE1vZGUgPSBuZXdDb25maWcub3JpZW50YXRpb24gPT0gQ29uZmlndXJhdGlvbi5PUklFTlRBVElPTl9QT1JUUkFJVDsKKyAgICAgICAgaWYgKERCRykgTG9nLnYoVEFHLCAiQ09ORklHIENIQU5HRSwgbVBvcnRyYWl0TW9kZSA9ICIgKyBtUG9ydHJhaXRNb2RlKTsKKyAgICAgICAgcmVmcmVzaCgpOworICAgIH0KKworICAgIHZvaWQgdXBkYXRlUnVubmluZ1Rhc2tzKCkgeworICAgICAgICBtUnVubmluZ1Rhc2tMaXN0ID0gbUFjdGl2aXR5TWFuYWdlci5nZXRSdW5uaW5nVGFza3MoTUFYX1RBU0tTLCAwLCBtVGh1bWJuYWlsUmVjZWl2ZXIpOworICAgICAgICBpZiAoREJHKSBMb2cudihUQUcsICJQb3J0cmFpdDogIiArIG1Qb3J0cmFpdE1vZGUpOworICAgICAgICBmb3IgKFJ1bm5pbmdUYXNrSW5mbyByIDogbVJ1bm5pbmdUYXNrTGlzdCkgeworICAgICAgICAgICAgaWYgKHIudGh1bWJuYWlsICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBpbnQgdGh1bWJXaWR0aCA9IHIudGh1bWJuYWlsLmdldFdpZHRoKCk7CisgICAgICAgICAgICAgICAgaW50IHRodW1iSGVpZ2h0ID0gci50aHVtYm5haWwuZ2V0SGVpZ2h0KCk7CisgICAgICAgICAgICAgICAgaWYgKERCRykgTG9nLnYoVEFHLCAiR290IHRodW1ibmFpbCAiICsgdGh1bWJXaWR0aCArICJ4IiArIHRodW1iSGVpZ2h0KTsKKyAgICAgICAgICAgICAgICBBY3Rpdml0eURlc2NyaXB0aW9uIGRlc2MgPSBmaW5kQWN0aXZpdHlEZXNjcmlwdGlvbihyLmlkKTsKKyAgICAgICAgICAgICAgICBpZiAoZGVzYyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIGRlc2MudGh1bWJuYWlsID0gci50aHVtYm5haWw7CisgICAgICAgICAgICAgICAgICAgIGRlc2MubGFiZWwgPSByLnRvcEFjdGl2aXR5LmZsYXR0ZW5Ub1Nob3J0U3RyaW5nKCk7CisgICAgICAgICAgICAgICAgICAgIGlmICgobVBvcnRyYWl0TW9kZSAmJiB0aHVtYldpZHRoID4gdGh1bWJIZWlnaHQpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfHwgKCFtUG9ydHJhaXRNb2RlICYmIHRodW1iV2lkdGggPCB0aHVtYkhlaWdodCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIE1hdHJpeCBtYXRyaXggPSBuZXcgTWF0cml4KCk7CisgICAgICAgICAgICAgICAgICAgICAgICBtYXRyaXguc2V0Um90YXRlKDkwLjBmLCAoZmxvYXQpIHRodW1iV2lkdGggLyAyLCAoZmxvYXQpIHRodW1iSGVpZ2h0IC8gMik7CisgICAgICAgICAgICAgICAgICAgICAgICBkZXNjLm1hdHJpeCA9IG1hdHJpeDsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIGlmIChEQkcpIExvZy52KFRBRywgIkNvdWxkbid0IGZpbmQgQWN0aXZpdHlEZXNjIGZvciBpZD0iICsgci5pZCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBpZiAoREJHKSBMb2cudihUQUcsICIqKiogUlVOTklORyBUSFVNQk5BSUwgV0FTIE5VTEwgKioqIik7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgbUNhcm91c2VsVmlldy5jcmVhdGVDYXJkcyhtQWN0aXZpdHlEZXNjcmlwdGlvbnMuc2l6ZSgpKTsKKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgdXBkYXRlUmVjZW50VGFza3MoKSB7CisgICAgICAgIGZpbmFsIFBhY2thZ2VNYW5hZ2VyIHBtID0gZ2V0UGFja2FnZU1hbmFnZXIoKTsKKyAgICAgICAgZmluYWwgQWN0aXZpdHlNYW5hZ2VyIGFtID0gKEFjdGl2aXR5TWFuYWdlcikgZ2V0U3lzdGVtU2VydmljZShDb250ZXh0LkFDVElWSVRZX1NFUlZJQ0UpOworCisgICAgICAgIGZpbmFsIExpc3Q8QWN0aXZpdHlNYW5hZ2VyLlJlY2VudFRhc2tJbmZvPiByZWNlbnRUYXNrcyA9CisgICAgICAgICAgICAgICAgYW0uZ2V0UmVjZW50VGFza3MoTUFYX1RBU0tTLCBBY3Rpdml0eU1hbmFnZXIuUkVDRU5UX0lHTk9SRV9VTkFWQUlMQUJMRSk7CisKKyAgICAgICAgQWN0aXZpdHlJbmZvIGhvbWVJbmZvID0gbmV3IEludGVudChJbnRlbnQuQUNUSU9OX01BSU4pLmFkZENhdGVnb3J5KEludGVudC5DQVRFR09SWV9IT01FKQorICAgICAgICAgICAgICAgICAgICAucmVzb2x2ZUFjdGl2aXR5SW5mbyhwbSwgMCk7CisKKyAgICAgICAgLy8gSWNvblV0aWxpdGllcyBpY29uVXRpbGl0aWVzID0gbmV3IEljb25VdGlsaXRpZXModGhpcyk7IC8vIEZJWE1FCisKKyAgICAgICAgaW50IG51bVRhc2tzID0gcmVjZW50VGFza3Muc2l6ZSgpOworICAgICAgICBtQWN0aXZpdHlEZXNjcmlwdGlvbnMuY2xlYXIoKTsKKyAgICAgICAgZm9yIChpbnQgaSA9IDAsIGluZGV4ID0gMDsgaSA8IG51bVRhc2tzICYmIChpbmRleCA8IE1BWF9UQVNLUyk7ICsraSkgeworICAgICAgICAgICAgZmluYWwgQWN0aXZpdHlNYW5hZ2VyLlJlY2VudFRhc2tJbmZvIHJlY2VudEluZm8gPSByZWNlbnRUYXNrcy5nZXQoaSk7CisKKyAgICAgICAgICAgIEludGVudCBpbnRlbnQgPSBuZXcgSW50ZW50KHJlY2VudEluZm8uYmFzZUludGVudCk7CisgICAgICAgICAgICBpZiAocmVjZW50SW5mby5vcmlnQWN0aXZpdHkgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGludGVudC5zZXRDb21wb25lbnQocmVjZW50SW5mby5vcmlnQWN0aXZpdHkpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvLyBTa2lwIHRoZSBjdXJyZW50IGhvbWUgYWN0aXZpdHkuCisgICAgICAgICAgICBpZiAoaG9tZUluZm8gIT0gbnVsbAorICAgICAgICAgICAgICAgICAgICAmJiBob21lSW5mby5wYWNrYWdlTmFtZS5lcXVhbHMoaW50ZW50LmdldENvbXBvbmVudCgpLmdldFBhY2thZ2VOYW1lKCkpCisgICAgICAgICAgICAgICAgICAgICYmIGhvbWVJbmZvLm5hbWUuZXF1YWxzKGludGVudC5nZXRDb21wb25lbnQoKS5nZXRDbGFzc05hbWUoKSkpIHsKKyAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaW50ZW50LnNldEZsYWdzKChpbnRlbnQuZ2V0RmxhZ3MoKSZ+SW50ZW50LkZMQUdfQUNUSVZJVFlfUkVTRVRfVEFTS19JRl9ORUVERUQpCisgICAgICAgICAgICAgICAgICAgIHwgSW50ZW50LkZMQUdfQUNUSVZJVFlfTkVXX1RBU0spOworICAgICAgICAgICAgZmluYWwgUmVzb2x2ZUluZm8gcmVzb2x2ZUluZm8gPSBwbS5yZXNvbHZlQWN0aXZpdHkoaW50ZW50LCAwKTsKKyAgICAgICAgICAgIGlmIChyZXNvbHZlSW5mbyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgZmluYWwgQWN0aXZpdHlJbmZvIGluZm8gPSByZXNvbHZlSW5mby5hY3Rpdml0eUluZm87CisgICAgICAgICAgICAgICAgZmluYWwgU3RyaW5nIHRpdGxlID0gaW5mby5sb2FkTGFiZWwocG0pLnRvU3RyaW5nKCk7CisgICAgICAgICAgICAgICAgRHJhd2FibGUgaWNvbiA9IGluZm8ubG9hZEljb24ocG0pOworCisgICAgICAgICAgICAgICAgaW50IGlkID0gcmVjZW50VGFza3MuZ2V0KGkpLmlkOworICAgICAgICAgICAgICAgIGlmIChpZCAhPSAtMSAmJiB0aXRsZSAhPSBudWxsICYmIHRpdGxlLmxlbmd0aCgpID4gMCAmJiBpY29uICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gaWNvbiA9IG51bGw7IEZJWE1FOiBpY29uVXRpbGl0aWVzLmNyZWF0ZUljb25EcmF3YWJsZShpY29uKTsKKyAgICAgICAgICAgICAgICAgICAgQWN0aXZpdHlEZXNjcmlwdGlvbiBpdGVtID0gbmV3IEFjdGl2aXR5RGVzY3JpcHRpb24oCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCwgaWNvbiwgdGl0bGUsIG51bGwsIGlkLCBpbmRleCk7CisgICAgICAgICAgICAgICAgICAgIGl0ZW0uaW50ZW50ID0gaW50ZW50OworICAgICAgICAgICAgICAgICAgICBtQWN0aXZpdHlEZXNjcmlwdGlvbnMuYWRkKGl0ZW0pOworICAgICAgICAgICAgICAgICAgICBpZiAoREJHKSBMb2cudihUQUcsICJBZGRlZCBpdGVtWyIgKyBpbmRleAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgIl0sIGlkPSIgKyBpdGVtLmlkCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiLCB0aXRsZT0iICsgaXRlbS5sYWJlbCk7CisgICAgICAgICAgICAgICAgICAgICsraW5kZXg7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKERCRykgTG9nLnYoVEFHLCAiU0tJUFBJTkcgaXRlbSAiICsgaWQpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgdm9pZCByZWZyZXNoKCkgeworICAgICAgICB1cGRhdGVSZWNlbnRUYXNrcygpOworICAgICAgICB1cGRhdGVSdW5uaW5nVGFza3MoKTsKKyAgICAgICAga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lCi0gICAgICAgIHB1YmxpYyBib29sZWFuIGRpc3BhdGNoS2V5RXZlbnQoS2V5RXZlbnQgZXZlbnQpIHsKLSAgICAgICAgICAgIGJvb2xlYW4gZG93biA9IGV2ZW50LmdldEFjdGlvbigpID09IEtleUV2ZW50LkFDVElPTl9ET1dOOwotICAgICAgICAgICAgc3dpdGNoIChldmVudC5nZXRLZXlDb2RlKCkpIHsKLSAgICAgICAgICAgIGNhc2UgS2V5RXZlbnQuS0VZQ09ERV9CQUNLOgotICAgICAgICAgICAgICAgIGlmICghZG93bikgewotICAgICAgICAgICAgICAgICAgICBhbmltYXRlQ29sbGFwc2UoKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICByZXR1cm4gc3VwZXIuZGlzcGF0Y2hLZXlFdmVudChldmVudCk7Ci0gICAgICAgIH0KKyAgICAvKioKKyAgICAgKiBOb2JvZHkgYmluZHMgdG8gdXMuCisgICAgICovCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIElCaW5kZXIgb25CaW5kKEludGVudCBpbnRlbnQpIHsKKyAgICAgICAgcmV0dXJuIG51bGw7CiAgICAgfQogCi0KICAgICBAT3ZlcnJpZGUKICAgICBwdWJsaWMgdm9pZCBvbkNyZWF0ZSgpIHsKICAgICAgICAgLy8gRmlyc3Qgc2V0IHVwIG91ciB2aWV3cyBhbmQgc3R1ZmYuCi0gICAgICAgIG1EaXNwbGF5ID0gKChXaW5kb3dNYW5hZ2VyKWdldFN5c3RlbVNlcnZpY2UoQ29udGV4dC5XSU5ET1dfU0VSVklDRSkpLmdldERlZmF1bHREaXNwbGF5KCk7Ci0gICAgICAgIG1ha2VTdGF0dXNCYXJWaWV3KHRoaXMpOworICAgICAgICBWaWV3IHNiID0gbWFrZVN0YXR1c0JhclZpZXcoKTsKIAogICAgICAgICAvLyBDb25uZWN0IGluIHRvIHRoZSBzdGF0dXMgYmFyIG1hbmFnZXIgc2VydmljZQogICAgICAgICBTdGF0dXNCYXJJY29uTGlzdCBpY29uTGlzdCA9IG5ldyBTdGF0dXNCYXJJY29uTGlzdCgpOwpAQCAtMjMyLDEzMDYgKzEwMSwyMiBAQAogICAgICAgICB9CiAKICAgICAgICAgLy8gUHV0IHVwIHRoZSB2aWV3Ci0gICAgICAgIGFkZFN0YXR1c0JhclZpZXcoKTsKLQotICAgICAgICAvLyBMYXN0bHksIGNhbGwgdG8gdGhlIGljb24gcG9saWN5IHRvIGluc3RhbGwvdXBkYXRlIGFsbCB0aGUgaWNvbnMuCi0gICAgICAgIG1JY29uUG9saWN5ID0gbmV3IFN0YXR1c0JhclBvbGljeSh0aGlzKTsKLSAgICB9Ci0KLSAgICBAT3ZlcnJpZGUKLSAgICBwdWJsaWMgdm9pZCBvbkRlc3Ryb3koKSB7Ci0gICAgICAgIC8vIHdlJ3JlIG5ldmVyIGRlc3Ryb3llZAotICAgIH0KLQotICAgIC8qKgotICAgICAqIE5vYm9keSBiaW5kcyB0byB1cy4KLSAgICAgKi8KLSAgICBAT3ZlcnJpZGUKLSAgICBwdWJsaWMgSUJpbmRlciBvbkJpbmQoSW50ZW50IGludGVudCkgewotICAgICAgICByZXR1cm4gbnVsbDsKLSAgICB9Ci0KLSAgICAvLyA9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotICAgIC8vIENvbnN0cnVjdGluZyB0aGUgdmlldwotICAgIC8vID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0gICAgcHJpdmF0ZSB2b2lkIG1ha2VTdGF0dXNCYXJWaWV3KENvbnRleHQgY29udGV4dCkgewotICAgICAgICBSZXNvdXJjZXMgcmVzID0gY29udGV4dC5nZXRSZXNvdXJjZXMoKTsKLQotICAgICAgICBtSWNvblNpemU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JhciIpOwogICAgICAgICAvLyBUT0RPIGxwLndpbmRvd0FuaW1hdGlvbnMgPSBSLnN0eWxlLkFuaW1hdGlvbl9TdGF0dXNCYXI7CisgICAgICAgIFdpbmRvd01hbmFnZXJJbXBsLmdldERlZmF1bHQoKS5hZGRWaWV3KHNiLCBscCk7CiAKLSAgICAgICAgV2luZG93TWFuYWdlckltcGwuZ2V0RGVmYXVsdCgpLmFkZFZpZXcodmlldywgbHApOworICAgICAgICBTbG9nLmQoVEFHLCAiQWRkZWQgc3RhdHVzIGJhciB2aWV3IHcvIGdyYXZpdHkgMHgiICsgSW50ZWdlci50b0hleFN0cmluZyhscC5ncmF2aXR5KSk7CiAgICAgfQotCi0gICAgcHVibGljIHZvaWQgYWRkSWNvbihTdHJpbmcgc2xvdCwgaW50IGluZGV4LCBpbnQgdmlld0luZGV4LCBTdGF0dXNCYXJJY29uIGljb24pIHsKLSAgICAgICAgaWYgKFNQRVcpIFNsb2cuZChUQUcsICJhZGRJY29uIHNsb3Q9IiArIHNsb3QgKyAiIGluZGV4PSIgKyBpbmRleCArICIgdmlld0luZGV4PSIgKyB2aWV3SW5kZXgKLSAgICAgICAgICAgICAgICArICIgaWNvbj0iICsgaWNvbik7Ci0gICAgICAgIFN0YXR1c0Jhckljb25WaWV3IHZpZXcgPSBuZXcgU3RhdHVzQmFySWNvblZpZXcodGhpcywgc2xvdCk7Ci0gICAgICAgIHZpZXcuc2V0KGljb24pOwotICAgICAgICBtU3RhdHVzSWNvbnMuYWRkVmlldyh2aWV3LCB2aWV3SW5kZXgsIG5ldyBMaW5lYXJMYXlvdXQuTGF5b3V0UGFyYW1zKG1JY29uU2l6ZSwgbUljb25TaXplKSk7Ci0gICAgfQotCi0gICAgcHVibGljIHZvaWQgdXBkYXRlSWNvbihTdHJpbmcgc2xvdCwgaW50IGluZGV4LCBpbnQgdmlld0luZGV4LAotICAgICAgICAgICAgU3RhdHVzQmFySWNvbiBvbGQsIFN0YXR1c0Jhckljb24gaWNvbikgewotICAgICAgICBpZiAoU1BFVykgU2xvZy5kKFRBRywgInVwZGF0ZUljb24gc2xvdD0iICsgc2xvdCArICIgaW5kZXg9IiArIGluZGV4ICsgIiB2aWV3SW5kZXg9IiArIHZpZXdJbmRleAotICAgICAgICAgICAgICAgICsgIiBvbGQ9IiArIG9sZCArICIgaWNvbj0iICsgaWNvbik7Ci0gICAgICAgIFN0YXR1c0Jhckljb25WaWV3IHZpZXcgPSAoU3RhdHVzQmFySWNvblZpZXcpbVN0YXR1c0ljb25zLmdldENoaWxkQXQodmlld0luZGV4KTsKLSAgICAgICAgdmlldy5zZXQoaWNvbik7Ci0gICAgfQotCi0gICAgcHVibGljIHZvaWQgcmVtb3ZlSWNvbihTdHJpbmcgc2xvdCwgaW50IGluZGV4LCBpbnQgdmlld0luZGV4KSB7Ci0gICAgICAgIGlmIChTUEVXKSBTbG9nLmQoVEFHLCAicmVtb3ZlSWNvbiBzbG90PSIgKyBzbG90ICsgIiBpbmRleD0iICsgaW5kZXggKyAiIHZpZXdJbmRleD0iICsgdmlld0luZGV4KTsKLSAgICAgICAgbVN0YXR1c0ljb25zLnJlbW92ZVZpZXdBdCh2aWV3SW5kZXgpOwotICAgIH0KLQotICAgIHB1YmxpYyB2b2lkIGFkZE5vdGlmaWNhdGlvbihJQmluZGVyIGtleSwgU3RhdHVzQmFyTm90aWZpY2F0aW9uIG5vdGlmaWNhdGlvbikgewotICAgICAgICBib29sZWFuIHNob3VsZFRpY2sgPSB0cnVlOwotICAgICAgICBpZiAobm90aWZpY2F0aW9uLm5vdGlmaWNhdGlvbi5mdWxsU2NyZWVuSW50ZW50ICE9IG51bGwpIHsKLSAgICAgICAgICAgIHNob3VsZFRpY2sgPSBmYWxzZTsKLSAgICAgICAgICAgIFNsb2cuZChUQUcsICJOb3RpZmljYXRpb24gaGFzIGZ1bGxTY3JlZW5JbnRlbnQ7IHNlbmRpbmcgZnVsbFNjcmVlbkludGVudCIpOwotICAgICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgICBub3RpZmljYXRpb24ubm90aWZpY2F0aW9uLmZ1bGxTY3JlZW5JbnRlbnQuc2VuZCgpOwotICAgICAgICAgICAgfSBjYXRjaCAoUGVuZGluZ0ludGVudC5DYW5jZWxlZEV4Y2VwdGlvbiBlKSB7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0gCi0KLSAgICAgICAgU3RhdHVzQmFySWNvblZpZXcgaWNvblZpZXcgPSBhZGROb3RpZmljYXRpb25WaWV3cyhrZXksIG5vdGlmaWNhdGlvbik7Ci0gICAgICAgIGlmIChpY29uVmlldyA9PSBudWxsKSByZXR1cm47Ci0KLSAgICAgICAgaWYgKHNob3VsZFRpY2spIHsKLSAgICAgICAgICAgIHRpY2sobm90aWZpY2F0aW9uKTsKLSAgICAgICAgfQotICAgICAgICAKLSAgICAgICAgLy8gUmVjYWxjdWxhdGUgdGhlIHBvc2l0aW9uIG9mIHRoZSBzbGlkaW5nIHdpbmRvd3MgYW5kIHRoZSB0aXRsZXMuCi0gICAgICAgIHNldEFyZVRoZXJlTm90aWZpY2F0aW9ucygpOwotICAgICAgICB1cGRhdGVFeHBhbmRlZFZpZXdQb3MoRVhQQU5ERURfTEVBVkVfQUxPTkUpOwotICAgIH0KLQotICAgIHB1YmxpYyB2b2lkIHVwZGF0ZU5vdGlmaWNhdGlvbihJQmluZGVyIGtleSwgU3RhdHVzQmFyTm90aWZpY2F0aW9uIG5vdGlmaWNhdGlvbikgewotICAgICAgICBTbG9nLmQoVEFHLCAidXBkYXRlTm90aWZpY2F0aW9uIGtleT0iICsga2V5ICsgIiBub3RpZmljYXRpb249IiArIG5vdGlmaWNhdGlvbik7Ci0KLSAgICAgICAgTm90aWZpY2F0aW9uRGF0YSBvbGRMaXN0OwotICAgICAgICBpbnQgb2xkSW5kZXggPSBtT25nb2luZy5maW5kRW50cnkoa2V5KTsKLSAgICAgICAgaWYgKG9sZEluZGV4ID49IDApIHsKLSAgICAgICAgICAgIG9sZExpc3QgPSBtT25nb2luZzsKLSAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgIG9sZEluZGV4ID0gbUxhdGVzdC5maW5kRW50cnkoa2V5KTsKLSAgICAgICAgICAgIGlmIChvbGRJbmRleCA8IDApIHsKLSAgICAgICAgICAgICAgICBTbG9nLncoVEFHLCAidXBkYXRlTm90aWZpY2F0aW9uIGZvciB1bmtub3duIGtleTogIiArIGtleSk7Ci0gICAgICAgICAgICAgICAgcmV0dXJuOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgb2xkTGlzdCA9IG1MYXRlc3Q7Ci0gICAgICAgIH0KLSAgICAgICAgZmluYWwgTm90aWZpY2F0aW9uRGF0YS5FbnRyeSBvbGRFbnRyeSA9IG9sZExpc3QuZ2V0RW50cnlBdChvbGRJbmRleCk7Ci0gICAgICAgIGZpbmFsIFN0YXR1c0Jhck5vdGlmaWNhdGlvbiBvbGROb3RpZmljYXRpb24gPSBvbGRFbnRyeS5ub3RpZmljYXRpb247Ci0gICAgICAgIGZpbmFsIFJlbW90ZVZpZXdzIG9sZENvbnRlbnRWaWV3ID0gb2xkTm90aWZpY2F0aW9uLm5vdGlmaWNhdGlvbi5jb250ZW50VmlldzsKLQotICAgICAgICBmaW5hbCBSZW1vdGVWaWV3cyBjb250ZW50VmlldyA9IG5vdGlmaWNhdGlvbi5ub3RpZmljYXRpb24uY29udGVudFZpZXc7Ci0KLSAgICAgICAgaWYgKGZhbHNlKSB7Ci0gICAgICAgICAgICBTbG9nLmQoVEFHLCAib2xkIG5vdGlmaWNhdGlvbjogd2hlbj0iICsgb2xkTm90aWZpY2F0aW9uLm5vdGlmaWNhdGlvbi53aGVuCi0gICAgICAgICAgICAgICAgICAgICsgIiBvbmdvaW5nPSIgKyBvbGROb3RpZmljYXRpb24uaXNPbmdvaW5nKCkKLSAgICAgICAgICAgICAgICAgICAgKyAiIGV4cGFuZGVkPSIgKyBvbGRFbnRyeS5leHBhbmRlZAotICAgICAgICAgICAgICAgICAgICArICIgY29udGVudFZpZXc9IiArIG9sZENvbnRlbnRWaWV3KTsKLSAgICAgICAgICAgIFNsb2cuZChUQUcsICJuZXcgbm90aWZpY2F0aW9uOiB3aGVuPSIgKyBub3RpZmljYXRpb24ubm90aWZpY2F0aW9uLndoZW4KLSAgICAgICAgICAgICAgICAgICAgKyAiIG9uZ29pbmc9IiArIG9sZE5vdGlmaWNhdGlvbi5pc09uZ29pbmcoKQotICAgICAgICAgICAgICAgICAgICArICIgY29udGVudFZpZXc9IiArIGNvbnRlbnRWaWV3KTsKLSAgICAgICAgfQotCi0gICAgICAgIC8vIENhbiB3ZSBqdXN0IHJlYXBwbHkgdGhlIFJlbW90ZVZpZXdzIGluIHBsYWNlPyAgSWYgd2hlbiBkaWRuJ3QgY2hhbmdlLCB0aGUgb3JkZXIKLSAgICAgICAgLy8gZGlkbid0IGNoYW5nZS4KLSAgICAgICAgaWYgKG5vdGlmaWNhdGlvbi5ub3RpZmljYXRpb24ud2hlbiA9PSBvbGROb3RpZmljYXRpb24ubm90aWZpY2F0aW9uLndoZW4KLSAgICAgICAgICAgICAgICAmJiBub3RpZmljYXRpb24uaXNPbmdvaW5nKCkgPT0gb2xkTm90aWZpY2F0aW9uLmlzT25nb2luZygpCi0gICAgICAgICAgICAgICAgJiYgb2xkRW50cnkuZXhwYW5kZWQgIT0gbnVsbAotICAgICAgICAgICAgICAgICYmIGNvbnRlbnRWaWV3ICE9IG51bGwgJiYgb2xkQ29udGVudFZpZXcgIT0gbnVsbAotICAgICAgICAgICAgICAgICYmIGNvbnRlbnRWaWV3LmdldFBhY2thZ2UoKSAhPSBudWxsCi0gICAgICAgICAgICAgICAgJiYgb2xkQ29udGVudFZpZXcuZ2V0UGFja2FnZSgpICE9IG51bGwKLSAgICAgICAgICAgICAgICAmJiBvbGRDb250ZW50Vmlldy5nZXRQYWNrYWdlKCkuZXF1YWxzKGNvbnRlbnRWaWV3LmdldFBhY2thZ2UoKSkKLSAgICAgICAgICAgICAgICAmJiBvbGRDb250ZW50Vmlldy5nZXRMYXlvdXRJZCgpID09IGNvbnRlbnRWaWV3LmdldExheW91dElkKCkpIHsKLSAgICAgICAgICAgIGlmIChTUEVXKSBTbG9nLmQoVEFHLCAicmV1c2luZyBub3RpZmljYXRpb24iKTsKLSAgICAgICAgICAgIG9sZEVudHJ5Lm5vdGlmaWNhdGlvbiA9IG5vdGlmaWNhdGlvbjsKLSAgICAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICAgICAgLy8gUmVhcHBseSB0aGUgUmVtb3RlVmlld3MKLSAgICAgICAgICAgICAgICBjb250ZW50Vmlldy5yZWFwcGx5KHRoaXMsIG9sZEVudHJ5LmNvbnRlbnQpOwotICAgICAgICAgICAgICAgIC8vIHVwZGF0ZSB0aGUgY29udGVudEludGVudAotICAgICAgICAgICAgICAgIGZpbmFsIFBlbmRpbmdJbnRlbnQgY29udGVudEludGVudCA9IG5vdGlmaWNhdGlvbi5ub3RpZmljYXRpb24uY29udGVudEludGVudDsKLSAgICAgICAgICAgICAgICBpZiAoY29udGVudEludGVudCAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIG9sZEVudHJ5LmNvbnRlbnQuc2V0T25DbGlja0xpc3RlbmVyKG5ldyBMYXVuY2hlcihjb250ZW50SW50ZW50LAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBub3RpZmljYXRpb24ucGtnLCBub3RpZmljYXRpb24udGFnLCBub3RpZmljYXRpb24uaWQpKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgLy8gVXBkYXRlIHRoZSBpY29uLgotICAgICAgICAgICAgICAgIGZpbmFsIFN0YXR1c0Jhckljb24gaWMgPSBuZXcgU3RhdHVzQmFySWNvbihub3RpZmljYXRpb24ucGtnLAotICAgICAgICAgICAgICAgICAgICAgICAgbm90aWZpY2F0aW9uLm5vdGlmaWNhdGlvbi5pY29uLCBub3RpZmljYXRpb24ubm90aWZpY2F0aW9uLmljb25MZXZlbCwKLSAgICAgICAgICAgICAgICAgICAgICAgIG5vdGlmaWNhdGlvbi5ub3RpZmljYXRpb24ubnVtYmVyKTsKLSAgICAgICAgICAgICAgICBpZiAoIW9sZEVudHJ5Lmljb24uc2V0KGljKSkgewotICAgICAgICAgICAgICAgICAgICBoYW5kbGVOb3RpZmljYXRpb25FcnJvcihrZXksIG5vdGlmaWNhdGlvbiwgIkNvdWxkbid0IHVwZGF0ZSBpY29uOiAiICsgaWMpOwotICAgICAgICAgICAgICAgICAgICByZXR1cm47Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICAgICAgY2F0Y2ggKFJ1bnRpbWVFeGNlcHRpb24gZSkgewotICAgICAgICAgICAgICAgIC8vIEl0IGZhaWxlZCB0byBhZGQgY2xlYW5seS4gIExvZywgYW5kIHJlbW92ZSB0aGUgdmlldyBmcm9tIHRoZSBwYW5lbC4KLSAgICAgICAgICAgICAgICBTbG9nLncoVEFHLCAiQ291bGRuJ3QgcmVhcHBseSB2aWV3cyBmb3IgcGFja2FnZSAiICsgY29udGVudFZpZXcuZ2V0UGFja2FnZSgpLCBlKTsKLSAgICAgICAgICAgICAgICByZW1vdmVOb3RpZmljYXRpb25WaWV3cyhrZXkpOwotICAgICAgICAgICAgICAgIGFkZE5vdGlmaWNhdGlvblZpZXdzKGtleSwgbm90aWZpY2F0aW9uKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgIGlmIChTUEVXKSBTbG9nLmQoVEFHLCAibm90IHJldXNpbmcgbm90aWZpY2F0aW9uIik7Ci0gICAgICAgICAgICByZW1vdmVOb3RpZmljYXRpb25WaWV3cyhrZXkpOwotICAgICAgICAgICAgYWRkTm90aWZpY2F0aW9uVmlld3Moa2V5LCBub3RpZmljYXRpb24pOwotICAgICAgICB9Ci0KLSAgICAgICAgLy8gUmVzdGFydCB0aGUgdGlja2VyIGlmIGl0J3Mgc3RpbGwgcnVubmluZwotICAgICAgICBpZiAobm90aWZpY2F0a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AgICAgICAgdXBkYXRlRXhwYW5kZWRWaWV3UG9zKEVYUEFOREVEX0xFQVZFX0FMT05FKTsKLSAgICAgICAgfQotICAgIH0KLQotICAgIHByaXZhdGUgaW50IGNob29zZUljb25JbmRleChib29sZWFuIGlzT25nb2luZywgaW50IHZpZXdJbmRleCkgewotICAgICAgICBmaW5hbCBpbnQgbGF0ZXN0U2l6ZSA9IG1MYXRlc3Quc2l6ZSgpOwotICAgICAgICBpZiAoaXNPbmdvaW5nKSB7Ci0gICAgICAgICAgICByZXR1cm4gbGF0ZXN0U2l6ZSArIChtT25nb2luZy5zaXplKCkgLSB2aWV3SW5kZXgpOwotICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgcmV0dXJuIGxhdGVzdFNpemUgLSB2aWV3SW5kZXg7Ci0gICAgICAgIH0KLSAgICB9Ci0KLSAgICBWaWV3W10gbWFrZU5vdGlmaWNhdGlvblZpZXcoU3RhdHVzQmFyTm90aWZpY2F0aW9uIG5vdGlmaWNhdGlvbiwgVmlld0dyb3VwIHBhcmVudCkgewotICAgICAgICBOb3RpZmljYXRpb24gbiA9IG5vdGlmaWNhdGlvbi5ub3RpZmljYXRpb247Ci0gICAgICAgIFJlbW90ZVZpZXdzIHJlbW90ZVZpZXdzID0gbi5jb250ZW50VmlldzsKLSAgICAgICAgaWYgKHJlbW90ZVZpZXdzID09IG51bGwpIHsKLSAgICAgICAgICAgIHJldHVybiBudWxsOwotICAgICAgICB9Ci0KLSAgICAgICAgLy8gY3JlYXRlIHRoZSByb3cgdmlldwotICAgICAgICBMYXlvdXRJbmZsYXRlciBpbmZsYXRlciA9IChMYXlvdXRJbmZsYXRlcilnZXRTeXN0ZW1TZXJ2aWNlKENvbnRleHQuTEFZT1VUX0lORkxBVEVSX1NFUlZJQ0UpOwotICAgICAgICBWaWV3IHJvdyA9IGluZmxhdGVyLmluZmxhdGUoUi5sYXlvdXQuc3RhdHVzX2Jhcl9sYXRlc3RfZXZlbnQsIHBhcmVudCwgZmFsc2UpOwotCi0gICAgICAgIC8vIGJpbmQgdGhlIGNsaWNrIGV2ZW50IHRvIHRoZSBjb250ZW50IGFyZWEKLSAgICAgICAgVmlld0dyb3VwIGNvbnRlbnQgPSAoVmlld0dyb3VwKXJvdy5maW5kVmlld0J5SWQoUi5pZC5jb250ZW50KTsKLSAgICAgICAgY29udGVudC5zZXREZXNjZW5kYW50Rm9jdXNhYmlsaXR5KFZpZXdHcm91cC5GT0NVU19CTE9DS19ERVNDRU5EQU5UUyk7Ci0gICAgICAgIGNvbnRlbnQuc2V0T25Gb2N1c0NoYW5nZUxpc3RlbmVyKG1Gb2N1c0NoYW5nZUxpc3RlbmVyKTsKLSAgICAgICAgUGVuZGluZ0ludGVudCBjb250ZW50SW50ZW50ID0gbi5jb250ZW50SW50ZW50OwotICAgICAgICBpZiAoY29udGVudEludGVudCAhPSBudWxsKSB7Ci0gICAgICAgICAgICBjb250ZW50LnNldE9uQ2xpY2tMaXN0ZW5lcihuZXcgTGF1bmNoZXIoY29udGVudEludGVudCwgbm90aWZpY2F0aW9uLnBrZywKLSAgICAgICAgICAgICAgICAgICAgICAgIG5vdGlmaWNhdGlvbi50YWcsIG5vdGlmaWNhdGlvbi5pZCkpOwotICAgICAgICB9Ci0KLSAgICAgICAgVmlldyBleHBhbmRlZCA9IG51bGw7Ci0gICAgICAgIEV4Y2VwdGlvbiBleGNlcHRpb24gPSBudWxsOwotICAgICAgICB0cnkgewotICAgICAgICAgICAgZXhwYW5kZWQgPSByZW1vdGVWaWV3cy5hcHBseSh0aGlzLCBjb250ZW50KTsKLSAgICAgICAgfQotICAgICAgICBjYXRjaCAoUnVudGltZUV4Y2VwdGlvbiBlKSB7Ci0gICAgICAgICAgICBleGNlcHRpb24gPSBlOwotICAgICAgICB9Ci0gICAgICAgIGlmIChleHBhbmRlZCA9PSBudWxsKSB7Ci0gICAgICAgICAgICBTdHJpbmcgaWRlbnQgPSBub3RpZmljYXRpb24ucGtnICsgIi8weCIgKyBJbnRlZ2VyL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ci0gICAgICAgIGlmICh2aWV3cyA9PSBudWxsKSB7Ci0gICAgICAgICAgICBoYW5kbGVOb3RpZmljYXRpb25FcnJvcihrZXksIG5vdGlmaWNhdGlvbiwgIkNvdWxkbid0IGV4cGFuZCBSZW1vdGVWaWV3cyBmb3I6ICIKLSAgICAgICAgICAgICAgICAgICAgKyBub3RpZmljYXRpb24pOwotICAgICAgICAgICAgcmV0dXJuIG51bGw7Ci0gICAgICAgIH0KLSAgICAgICAgZmluYWwgVmlldyByb3cgPSB2aWV3c1swXTsKLSAgICAgICAgZmluYWwgVmlldyBjb250ZW50ID0gdmlld3NbMV07Ci0gICAgICAgIGZpbmFsIFZpZXcgZXhwYW5kZWQgPSB2aWV3c1syXTsKLSAgICAgICAgLy8gQ29uc3RydWN0IHRoZSBpY29uLgotICAgICAgICBmaW5hbCBTdGF0dXNCYXJJY29uVmlldyBpY29uVmlldyA9IG5ldyBTdGF0dXNCYXJJY29uVmlldyh0aGlzLAotICAgICAgICAgICAgICAgIG5vdGlmaWNhdGlvbi5wa2cgKyAiLzB4IiArIEludGVnZXIudG9IZXhTdHJpbmcobm90aWZpY2F0aW9uLmlkKSk7Ci0gICAgICAgIGZpbmFsIFN0YXR1c0Jhckljb24gaWMgPSBuZXcgU3RhdHVzQmFySWNvbihub3RpZmljYXRpb24ucGtnLCBub3RpZmljYXRpb24ubm90aWZpY2F0aW9uLmljb24sCi0gICAgICAgICAgICAgICAgICAgIG5vdGlmaWNhdGlvbi5ub3RpZmljYXRpb24uaWNvbkxldmVsLCBub3RpZmljYXRpb24ubm90aWZpY2F0aW9uLm51bWJlcik7Ci0gICAgICAgIGlmICghaWNvblZpZXcuc2V0KGljKSkgewotICAgICAgICAgICAgaGFuZGxlTm90aWZpY2F0aW9uRXJyb3Ioa2V5LCBub3RpZmljYXRpb24sICJDb3VsZGluZyBjcmVhdGUgaWNvbjogIiArIGljKTsKLSAgICAgICAgICAgIHJldHVybiBudWxsOwotICAgICAgICB9Ci0gICAgICAgIC8vIEFkZCB0aGUgZXhwYW5kZWQgdmlldy4KLSAgICAgICAgZmluYWwgaW50IHZpZXdJbmRleCA9IGxpc3QuYWRkKGtleSwgbm90aWZpY2F0aW9uLCByb3csIGNvbnRlbnQsIGV4cGFuZGVkLCBpY29uVmlldyk7Ci0gICAgICAgIHBhcmVudC5hZGRWaWV3KHJvdywgdmlld0luZGV4KTsKLSAgICAgICAgLy8gQWRkIHRoZSBpY29uLgotICAgICAgICBmaW5hbCBpbnQgaWNvbkluZGV4ID0gY2hvb3NlSWNvbkluZGV4KGlzT25nb2luZywgdmlld0luZGV4KTsKLSAgICAgICAgbU5vdGlmaWNhdGlvbkljb25zLmFkZFZpZXcoaWNvblZpZXcsIGljb25JbmRleCwKLSAgICAgICAgICAgICAgICBuZXcgTGluZWFyTGF5b3V0LkxheW91dFBhcmFtcyhtSWNvblNpemUsIG1JY29uU2l6ZSkpOwotICAgICAgICByZXR1cm4gaWNvblZpZXc7Ci0gICAgfQotCi0gICAgU3RhdHVzQmFyTm90aWZpY2F0aW9uIHJlbW92ZU5vdGlmaWNhdGlvblZpZXdzKElCaW5kZXIga2V5KSB7Ci0gICAgICAgIE5vdGlmaWNhdGlvbkRhdGEuRW50cnkgZW50cnkgPSBtT25nb2luZy5yZW1vdmUoa2V5KTsKLSAgICAgICAgaWYgKGVudHJ5ID09IG51bGwpIHsKLSAgICAgICAgICAgIGVudHJ5ID0gbUxhdGVzdC5yZW1vdmUoa2V5KTsKLSAgICAgICAgICAgIGlmIChlbnRyeSA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgU2xvZy53KFRBRywgInJlbW92ZU5vdGlmaWNhdGlvbiBmb3IgdW5rbm93biBrZXk6ICIgKyBrZXkpOwotICAgICAgICAgICAgICAgIHJldHVybiBudWxsOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgICAgIC8vIFJlbW92ZSB0aGUgZXhwYW5kZWQgdmlldy4KLSAgICAgICAgKChWaWV3R3JvdXApZW50cnkucm93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TdGF0dXNCYXJNYW5hZ2VyLkRJU0FCTEVfRVhQQU5EKSAhPSAwKSB7Ci0gICAgICAgICAgICByZXR1cm4gOwotICAgICAgICB9Ci0gICAgICAgIGlmIChtRXhwYW5kZWQpIHsKLSAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgfQotCi0gICAgICAgIHByZXBhcmVUcmFja2luZygwLCB0cnVlKTsKLSAgICAgICAgcGVyZm9ybUZsaW5nKDAsIDIwMDAuMGYsIHRydWUpOwotICAgIH0KLQotICAgIHB1YmxpYyB2b2lkIGFuaW1hdGVDb2xsYXBzZSgpIHsKLSAgICAgICAgaWYgKFNQRVcpIHsKLSAgICAgICAgICAgIFNsb2cuZChUQUcsICJhbmltYXRlQ29sbGFwc2UoKTogbUV4cGFuZGVkPSIgKyBtRXhwYW5kZWQKLSAgICAgICAgICAgICAgICAgICAgKyAiIG1FeHBhbmRlZFZpc2libGU9IiArIG1FeHBhbmRlZFZpc2libGUKLSAgICAgICAgICAgICAgICAgICAgKyAiIG1FeHBhbmRlZD0iICsgbUV4cGFuZGVkCi0gICAgICAgICAgICAgICAgICAgICsgIiBtQW5pbWF0aW5nPSIgKyBtQW5pbWF0aW5nCi0gICAgICAgICAgICAgICAgICAgICsgIiBtQW5pbVk9IiArIG1BbmltWQotICAgICAgICAgICAgICAgICAgICArICIgbUFuaW1WZWw9IiArIG1BbmltVmVsKTsKLSAgICAgICAgfQotCi0gICAgICAgIGlmICghbUV4cGFuZGVkVmlzaWJsZSkgewotICAgICAgICAgICAgcmV0dXJuOwotICAgICAgICB9Ci0KLSAgICAgICAgaW50IHk7Ci0gICAgICAgIGlmIChtQW5pbWF0aW5nKSB7Ci0gICAgICAgICAgICB5ID0gKGludCltQW5pbVk7Ci0gICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICB5ID0gbURpc3BsYXkuZ2V0SGVpZ2h0KCktMTsKLSAgICAgICAgfQotICAgICAgICAvLyBMZXQgdGhlIGZsaW5nIHRoaW5rIHRoY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HBhbmRlZCA9IGZhbHNlOwotICAgIH0KLQotICAgIHZvaWQgZG9BbmltYXRpb24oKSB7Ci0gICAgICAgIGlmIChtQW5pbWF0aW5nKSB7Ci0gICAgICAgICAgICBpZiAoU1BFVykgU2xvZy5kKFRBRywgImRvQW5pbWF0aW9uIik7Ci0gICAgICAgICAgICBpZiAoU1BFVykgU2xvZy5kKFRBRywgImRvQW5pbWF0aW9uIGJlZm9yZSBtQW5pbVk9IiArIG1BbmltWSk7Ci0gICAgICAgICAgICBpbmNyZW1lbnRBbmltKCk7Ci0gICAgICAgICAgICBpZiAoU1BFVykgU2xvZy5kKFRBRywgImRvQW5pbWF0aW9uIGFmdGVyICBtQW5pbVk9IiArIG1BbmltWSk7Ci0gICAgICAgICAgICBpZiAobUFuaW1ZID49IG1EaXNwbGF5LmdldEhlaWdodCgpLTEpIHsKLSAgICAgICAgICAgICAgICBpZiAoU1BFVykgU2xvZy5kKFRBRywgIkFuaW1hdGlvbiBjb21wbGV0ZWQgdG8gZXhwYW5kZWQgc3RhdGUuIik7Ci0gICAgICAgICAgICAgICAgbUFuaW1hdGluZyA9IGZhbHNlOwotICAgICAgICAgICAgICAgIHVwZGF0ZUV4cGFuZGVkVmlld1BvcyhFWFBBTkRFRF9GVUxMX09QRU4pOwotICAgICAgICAgICAgICAgIHBlcmZvcm1FeHBhbmQoKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGVsc2UgaWYgKG1BbmltWSA8IG1TdGF0dXNCYXJWaWV3LmdldEhlaWdodCgpKSB7Ci0gICAgICAgICAgICAgICAgaWYgKFNQRVcpIFNsb2cuZChUQUcsICJBbmltYXRpb24gY29tcGxldGVkIHRvIGNvbGxhcHNlZCBzdGF0ZS4iKTsKLSAgICAgICAgICAgICAgICBtQW5pbWF0aW5nID0gZmFsc2U7Ci0gICAgICAgICAgICAgICAgdXBkYXRlRXhwYW5kZWRWaWV3UG9zKDApOwotICAgICAgICAgICAgICAgIHBlcmZvcm1Db2xsYXBzZSgpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZWxzZSB7Ci0gICAgICAgICAgICAgICAgdXBkYXRlRXhwYW5kZWRWaWV3UG9zKChpbnQpbUFuaW1ZKTsKLSAgICAgICAgICAgICAgICBtQ3VyQW5pbWF0aW9uVGltZSArPSBBTklNX0ZSQU1FX0RVUkFUSU9OOwotICAgICAgICAgICAgICAgIG1IYW5kbGVyLnNlbmRNZXNzYWdlQXRUaW1lKG1IYW5kbGVyLm9idGFpbk1lc3NhZ2UoTVNHX0FOSU1BVEUpLCBtQ3VyQW5pbWF0aW9uVGltZSk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICB9Ci0KLSAgICB2b2lkIHN0b3BUcmFja2luZygpIHsKLSAgICAgICAgbVRyYWNraW5nID0gZmFsc2U7Ci0gICAgICAgIG1WZWxvY2l0eVRyYWNrZXIucmVjeWNsZSgpOwotICAgICAgICBtVmVsb2NpdHlUcmFja2VyID0gbnVsbDsKLSAgICB9Ci0KLSAgICB2b2lkIGluY3JlbWVudEFuaW0oKSB7Ci0gICAgICAgIGxvbmcgbm93ID0gU3lzdGVtQ2xvY2sudXB0aW1lTWlsbGlzKCk7Ci0gICAgICAgIGZsb2F0IHQgPSAoKGZsb2F0KShub3cgLSBtQW5pbUxhc3RUaW1lKSkgLyAxMDAwOyAgICAgICAgICAgIC8vIG1zIC0+IHMKLSAgICAgICAgZmluYWwgZmxvYXQgeSA9IG1BbmltWTsKLSAgICAgICAgZmluYWwgZmxvYXQgdiA9IG1BbmltVmVsOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gcHgvcwotICAgICAgICBmaW5hbCBmbG9hdCBhID0gbUFuaW1BY2NlbDsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBweC9zL3MKLSAgICAgICAgbUFuaW1ZID0geSArICh2KnQpICsgKDAuNWYqYSp0KnQpOyAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gcHgKLSAgICAgICAgbUFuaW1WZWwgPSB2ICsgKGEqdCk7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gcHgvcwotICAgICAgICBtQW5pbUxhc3RUaW1lID0gbm93OyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBtcwotICAgICAgICAvL1Nsb2cuZChUQUcsICJ5PSIgKyB5ICsgIiB2PSIgKyB2ICsgIiBhPSIgKyBhICsgIiB0PSIgKyB0ICsgIiBtQW5pbVk9IiArIG1BbmltWQotICAgICAgICAvLyAgICAgICAgKyAiIG1BbmltQWNjZWw9IiArIG1BbmltQWNjZWwpOwotICAgIH0KLQotICAgIHZvaWQgZG9SZXZlYWxBbmltYXRpb24oKSB7Ci0gICAgICAgIGZpbmFsIGludCBoID0gbUNsb3NlVmlldy5nZXRIZWlnaHQoKSArIG1TdGF0dXNCYXJWaWV3LmdldEhlaWdodCgpOwotICAgICAgICBpZiAobUFuaW1hdGluZ1JldmVhbCAmJiBtQW5pbWF0aW5nICYmIG1BbmltWSA8IGgpIHsKLSAgICAgICAgICAgIGluY3JlbWVudEFuaW0oKTsKLSAgICAgICAgICAgIGlmIChtQW5pbVkgPj0gaCkgewotICAgICAgICAgICAgICAgIG1BbmltWSA9IGg7Ci0gICAgICAgICAgICAgICAgdXBkYXRlRXhwYW5kZWRWaWV3UG9zKChpbnQpbUFuaW1ZKTsKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgdXBkYXRlRXhwYW5kZWRWaWV3UG9zKChpbnQpbUFuaW1ZKTsKLSAgICAgICAgICAgICAgICBtQ3VyQW5pbWF0aW9uVGltZSArPSBBTklNX0ZSQU1FX0RVUkFUSU9OOwotICAgICAgICAgICAgICAgIG1IYW5kbGVyLnNlbmRNZXNzYWdlQXRUaW1lKG1IYW5kbGVyLm9idGFpbk1lc3NhZ2UoTVNHX0FOSU1BVEVfUkVWRUFMKSwKLSAgICAgICAgICAgICAgICAgICAgICAgIG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bmltYXRpb25UaW1lKTsKLSAgICAgICAgICAgIG1ha2VFeHBhbmRlZFZpc2libGUoKTsKLSAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgIC8vIGl0J3Mgb3BlbiwgY2xvc2UgaXQ/Ci0gICAgICAgICAgICBpZiAobUFuaW1hdGluZykgewotICAgICAgICAgICAgICAgIG1BbmltYXRpbmcgPSBmYWxzZTsKLSAgICAgICAgICAgICAgICBtSGFuZGxlci5yZW1vdmVNZXNzYWdlcyhNU0dfQU5JTUFURSk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICB1cGRhdGVFeHBhbmRlZFZpZXdQb3MoeSArIG1WaWV3RGVsdGEpOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgdm9pZCBwZXJmb3JtRmxpbmcoaW50IHksIGZsb2F0IHZlbCwgYm9vbGVhbiBhbHdheXMpIHsKLSAgICAgICAgbUFuaW1hdGluZ1JldmVhbCA9IGZhbHNlOwotICAgICAgICBtRGlzcGxheUhlaWdodCA9IG1EaXNwbGF5LmdldEhlaWdodCgpOwotCi0gICAgICAgIG1BbmltWSA9IHk7Ci0gICAgICAgIG1BbmltVmVsID0gdmVsOwotCi0gICAgICAgIC8vU2xvZy5kKFRBRywgInN0YXJ0aW5nIHdpdGggbUFuaW1ZPSIgKyBtQW5pbVkgKyAiIG1BbmltVmVsPSIgKyBtQW5pbVZlbCk7Ci0KLSAgICAgICAgaWYgKG1FeHBhbmRlZCkgewotICAgICAgICAgICAgaWYgKCFhbHdheXMgJiYgKAotICAgICAgICAgICAgICAgICAgICB2ZWwgPiAyMDAuMGYKLSAgICAgICAgICAgICAgICAgICAgfHwgKHkgPiAobURpc3BsYXlIZWlnaHQtMjUpICYmIHZlbCA+IC0yMDAuMGYpKSkgewotICAgICAgICAgICAgICAgIC8vIFdlIGFyZSBleHBhbmRlZCwgYnV0IHRoZXkgZGlkbid0IG1vdmUgc3VmZmljaWVudGx5IHRvIGNhdXNlCi0gICAgICAgICAgICAgICAgLy8gdXMgdG8gcmV0cmFjdC4gIEFuaW1hdGUgYmFjayB0byB0aGUgZXhwYW5kZWQgcG9zaXRpb24uCi0gICAgICAgICAgICAgICAgbUFuaW1BY2NlbCA9IDIwMDAuMGY7Ci0gICAgICAgICAgICAgICAgaWYgKHZlbCA8IDApIHsKLSAgICAgICAgICAgICAgICAgICAgbUFuaW1WZWwgPSAwOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGVsc2UgewotICAgICAgICAgICAgICAgIC8vIFdlIGFyZSBleHBhbmRlZCBhbmQgYXJlIG5vdyBnb2luZyB0byBhbmltYXRlIGF3YXkuCi0gICAgICAgICAgICAgICAgbUFuaW1BY2NlbCA9IC0yMDAwLjBmOwotICAgICAgICAgICAgICAgIGlmICh2ZWwgPiAwKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1BbmltVmVsID0gMDsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICBpZiAoYWx3YXlzIHx8ICgKLSAgICAgICAgICAgICAgICAgICAgdmVsID4gMjAwLjBmCi0gICAgICAgICAgICAgICAgICAgIHx8ICh5ID4gKG1EaXNwbGF5SGVpZ2h0LzIpICYmIHZlbCA+IC0yMDAuMGYpKSkgewotICAgICAgICAgICAgICAgIC8vIFdlIGFyZSBjb2xsYXBzZWQsIGFuZCB0aGV5IG1vdmVkIGVub3VnaCB0byBhbGxvdyB1cyB0bwotICAgICAgICAgICAgICAgIC8vIGV4cGFuZC4gIEFuaW1hdGUgaW4gdGhlIG5vdGlmaWNhdGlvbnMuCi0gICAgICAgICAgICAgICAgbUFuaW1BY2NlbCA9IDIwMDAuMGY7Ci0gICAgICAgICAgICAgICAgaWYgKHZlbCA8IDApIHsKLSAgICAgICAgICAgICAgICAgICAgbUFuaW1WZWwgPSAwOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGVsc2UgewotICAgICAgICAgICAgICAgIC8vIFdlIGFyZSBjb2xsYXBzZWQsIGJ1dCB0aGV5IGRpZG4ndCBtb3ZlIHN1ZmZpY2llbnRseSB0byBjYXVzZQotICAgICAgICAgICAgICAgIC8vIHVzIHRvIHJldHJhY3QuICBBbmltYXRlIGJhY2sgdG8gdGhlIGNvbGxhcHNlZCBwb3NpdGlvbi4KLSAgICAgICAgICAgICAgICBtQW5pbUFjY2VsID0gLTIwMDAuMGY7Ci0gICAgICAgICAgICAgICAgaWYgKHZlbCA+IDApIHsKLSAgICAgICAgICAgICAgICAgICAgbUFuaW1WZWwgPSAwOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgICAgICAvL1Nsb2cuZChUQUcsICJtQW5pbVk9IiArIG1BbmltWSArICIgbUFuaW1WZWw9IiArIG1BbmltVmVsCi0gICAgICAgIC8vICAgICAgICArICIgbUFuaW1BY2NlbD0iICsgbUFuaW1BY2NlbCk7Ci0KLSAgICAgICAgbG9uZyBub3cgPSBTeXN0ZW1DbG9jay51cHRpbWVNaWxsaXMoKTsKLSAgICAgICAgbUFuaW1MYXN0VGltZSA9IG5vdzsKLSAgICAgICAgbUN1ckFuaW1hdGlvblRpbWUgPSBub3cgKyBBTklNX0ZSQU1FX0RVUkFUSU9OOwotICAgICAgICBtQW5pbWF0aW5nID0gdHJ1ZTsKLSAgICAgICAgbUhhbmRsZXIucmVtb3ZlTWVzc2FnZXMoTVNHX0FOSU1BVEUpOwotICAgICAgICBtSGFuZGxlci5yZW1vdmVNZXNzYWdlcyhNU0dfQU5JTUFURV9SRVZFQUwpOwotICAgICAgICBtSGFuZGxlci5zZW5kTWVzc2FnZUF0VGltZShtSGFuZGxlci5vYnRhaW5NZXNzYWdlKE1TR19BTklNQVRFKSwgbUN1ckFuaW1hdGlvblRpbWUpOwotICAgICAgICBzdG9wVHJhY2tpbmcoKTsKLSAgICB9Ci0KLSAgICBib29sZWFu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AgICAgICAgICAgICAgIChtRXhwYW5kZWQgJiYgeSA+IChtRGlzcGxheS5nZXRIZWlnaHQoKS1oaXRTaXplKSkpIHsKLQotICAgICAgICAgICAgICAgIC8vIFdlIGRyb3AgZXZlbnRzIGF0IHRoZSBlZGdlIG9mIHRoZSBzY3JlZW4gdG8gbWFrZSB0aGUgd2luZG93c2hhZGUgY29tZQotICAgICAgICAgICAgICAgIC8vIGRvd24gYnkgYWNjaWRlbnQgbGVzcywgZXNwZWNpYWxseSB3aGVuIHB1c2hpbmcgb3BlbiBhIGRldmljZSB3aXRoIGEga2V5Ym9hcmQKLSAgICAgICAgICAgICAgICAvLyB0aGF0IHJvdGF0ZXMgKGxpa2UgZzEgYW5kIGRyb2lkKQotICAgICAgICAgICAgICAgIGludCB4ID0gKGludClldmVudC5nZXRSYXdYKCk7Ci0gICAgICAgICAgICAgICAgZmluYWwgaW50IGVkZ2VCb3JkZXIgPSBtRWRnZUJvcmRlcjsKLSAgICAgICAgICAgICAgICBpZiAoeCA+PSBlZGdlQm9yZGVyICYmIHggPCBtRGlzcGxheS5nZXRXaWR0aCgpIC0gZWRnZUJvcmRlcikgewotICAgICAgICAgICAgICAgICAgICBwcmVwYXJlVHJhY2tpbmcoeSwgIW1FeHBhbmRlZCk7Ly8gb3BlbmluZyBpZiB3ZSdyZSBub3QgYWxyZWFkeSBmdWxseSB2aXNpYmxlCi0gICAgICAgICAgICAgICAgICAgIG1WZWxvY2l0eVRyYWNrZXIuYWRkTW92ZW1lbnQoZXZlbnQpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfSBlbHNlIGlmIChtVHJhY2tpbmcpIHsKLSAgICAgICAgICAgIG1WZWxvY2l0eVRyYWNrZXIuYWRkTW92ZW1lbnQoZXZlbnQpOwotICAgICAgICAgICAgZmluYWwgaW50IG1pblkgPSBzdGF0dXNCYXJTaXplICsgbUNsb3NlVmlldy5nZXRIZWlnaHQoKTsKLSAgICAgICAgICAgIGlmIChldmVudC5nZXRBY3Rpb24oKSA9PSBNb3Rpb25FdmVudC5BQ1RJT05fTU9WRSkgewotICAgICAgICAgICAgICAgIGludCB5ID0gKGludClldmVudC5nZXRSYXdZKCk7Ci0gICAgICAgICAgICAgICAgaWYgKG1BbmltYXRpbmdSZXZlYWwgJiYgeSA8IG1pblkpIHsKLSAgICAgICAgICAgICAgICAgICAgLy8gbm90aGluZwotICAgICAgICAgICAgICAgIH0gZWxzZSAgewotICAgICAgICAgICAgICAgICAgICBtQW5pbWF0aW5nUmV2ZWFsID0gZmFsc2U7Ci0gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUV4cGFuZGVkVmlld1Bvcyh5ICsgbVZpZXdEZWx0YSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfSBlbHNlIGlmIChldmVudC5nZXRBY3Rpb24oKSA9PSBNb3Rpb25FdmVudC5BQ1RJT05fVVApIHsKLSAgICAgICAgICAgICAgICBtVmVsb2NpdHlUcmFja2VyLmNvbXB1dGVDdXJyZW50VmVsb2NpdHkoMTAwMCk7Ci0KLSAgICAgICAgICAgICAgICBmbG9hdCB5VmVsID0gbVZlbG9jaXR5VHJhY2tlci5nZXRZVmVsb2NpdHkoKTsKLSAgICAgICAgICAgICAgICBib29sZWFuIG5lZ2F0aXZlID0geVZlbCA8IDA7Ci0KLSAgICAgICAgICAgICAgICBmbG9hdCB4VmVsID0gbVZlbG9jaXR5VHJhY2tlci5nZXRYVmVsb2NpdHkoKTsKLSAgICAgICAgICAgICAgICBpZiAoeFZlbCA8IDApIHsKLSAgICAgICAgICAgICAgICAgICAgeFZlbCA9IC14VmVsOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBpZiAoeFZlbCA+IDE1MC4wZikgewotICAgICAgICAgICAgICAgICAgICB4VmVsID0gMTUwLjBmOyAvLyBsaW1pdCBob3cgbXVjaCB3ZSBjYXJlIGFib3V0IHRoZSB4IGF4aXMKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBmbG9hdCB2ZWwgPSAoZmxvYXQpTWF0aC5oeXBvdCh5VmVsLCB4VmVsKTsKLSAgICAgICAgICAgICAgICBpZiAobmVnYXRpdmUpIHsKLSAgICAgICAgICAgICAgICAgICAgdmVsID0gLXZlbDsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBwZXJmb3JtRmxpbmcoKGludClldmVudC5nZXRSYXdZKCksIHZlbCwgZmFsc2UpOwotICAgICAgICAgICAgfQotCi0gICAgICAgIH0KLSAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgIH0KLQotICAgIHByaXZhdGUgY2xhc3MgTGF1bmNoZXIgaW1wbGVtZW50cyBWaWV3Lk9uQ2xpY2tMaXN0ZW5lciB7Ci0gICAgICAgIHByaXZhdGUgUGVuZGluZ0ludGVudCBtSW50ZW50OwotICAgICAgICBwcml2YXRlIFN0cmluZyBtUGtnOwotICAgICAgICBwcml2YXRlIFN0cmluZyBtVGFnOwotICAgICAgICBwcml2YXRlIGludCBtSWQ7Ci0KLSAgICAgICAgTGF1bmNoZXIoUGVuZGluZ0ludGVudCBpbnRlbnQsIFN0cmluZyBwa2csIFN0cmluZyB0YWcsIGludCBpZCkgewotICAgICAgICAgICAgbUludGVudCA9IGludGVudDsKLSAgICAgICAgICAgIG1Qa2cgPSBwa2c7Ci0gICAgICAgICAgICBtVGFnID0gdGFnOwotICAgICAgICAgICAgbUlkID0gaWQ7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgdm9pZCBvbkNsaWNrKFZpZXcgdikgewotICAgICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgICAvLyBUaGUgaW50ZW50IHdlIGFyZSBzZW5kaW5nIGlzIGZvciB0aGUgYXBwbGljYXRpb24sIHdoaWNoCi0gICAgICAgICAgICAgICAgLy8gd29uJ3QgaGF2ZSBwZXJtaXNzaW9uIHRvIGltbWVkaWF0ZWx5IHN0YXJ0IGFuIGFjdGl2aXR5IGFmdGVyCi0gICAgICAgICAgICAgICAgLy8gdGhlIHVzZXIgc3dpdGNoZXMgdG8gaG9tZS4gIFdlIGtub3cgaXQgaXMgc2FmZSB0byBkbyBhdCB0aGlzCi0gICAgICAgICAgICAgICAgLy8gcG9pbnQsIHNvIG1ha2Ugc3VyZSBuZXcgYWN0aXZpdHkgc3dpdGNoZXMgYXJlIG5vdyBhbGxvd2VkLgotICAgICAgICAgICAgICAgIEFjdGl2aXR5TWFuYWdlck5hdGl2ZS5nZXREZWZhdWx0KCkucmVzdW1lQXBwU3dpdGNoZXMoKTsKLSAgICAgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGlmIChtSW50ZW50ICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICBpbnRbXSBwb3MgPSBuZXcgaW50WzJdOwotICAgICAgICAgICAgICAgIHYuZ2V0TG9jYXRpb25PblNjcmVlbihwb3MpOwotICAgICAgICAgICAgICAgIEludGVudCBvdmVybGF5ID0gbmV3IEludGVudCgpOwotICAgICAgICAgICAgICAgIG92ZXJsYXkuc2V0U291cmNlQm91bmRzKAotICAgICAgICAgICAgICAgICAgICAgICAgbmV3IFJlY3QocG9zWzBdLCBwb3NbMV0sIHBvc1swXSt2LmdldFdpZHRoKCksIHBvc1sxXSt2LmdldEhlaWdodCgpKSk7Ci0gICAgICAgICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgICAgICAgbUludGVudC5zZW5kKFN0YXR1c0JhclNlcnZpY2UudGhpcywgMCwgb3ZlcmxheSk7Ci0gICAgICAgICAgICAgICAgfSBjYXRjaCAoUGVuZGluZ0ludGVudC5DYW5jZWxlZEV4Y2VwdGlvbiBlKSB7Ci0gICAgICAgICAgICAgICAgICAgIC8vIHRoZSBzdGFjayB0cmFjZSBpc24ndCB2ZXJ5IGhlbHBmdWwgaGVyZS4gIEp1c3QgbG9nIHRoZ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AgICBNeVRpY2tlcihDb250ZXh0IGNvbnRleHQsIFN0YXR1c0JhclZpZXcgc2IpIHsKLSAgICAgICAgICAgIHN1cGVyKGNvbnRleHQsIHNiKTsKLSAgICAgICAgfQotCi0gICAgICAgIEBPdmVycmlkZQotICAgICAgICB2b2lkIHRpY2tlclN0YXJ0aW5nKCkgewotICAgICAgICAgICAgaWYgKFNQRVcpIFNsb2cuZChUQUcsICJ0aWNrZXJTdGFydGluZyIpOwotICAgICAgICAgICAgbVRpY2tpbmcgPSB0cnVlOwotICAgICAgICAgICAgbUljb25zLnNldFZpc2liaWxpdHkoVmlldy5HT05FKTsKLSAgICAgICAgICAgIG1UaWNrZXJWaWV3LnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKLSAgICAgICAgICAgIG1UaWNrZXJWaWV3LnN0YXJ0QW5pbWF0aW9uKGxvYWRBbmltKGNvbS5hbmRyb2lkLmludGVybmFsLlIuYW5pbS5wdXNoX3VwX2luLCBudWxsKSk7Ci0gICAgICAgICAgICBtSWNvbnMuc3RhcnRBbmltYXRpb24obG9hZEFuaW0oY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5hbmltLnB1c2hfdXBfb3V0LCBudWxsKSk7Ci0gICAgICAgICAgICBpZiAobUV4cGFuZGVkVmlzaWJsZSkgewotICAgICAgICAgICAgICAgIHNldERhdGVWaWV3VmlzaWJpbGl0eShmYWxzZSwgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5hbmltLnB1c2hfdXBfb3V0KTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIEBPdmVycmlkZQotICAgICAgICB2b2lkIHRpY2tlckRvbmUoKSB7Ci0gICAgICAgICAgICBpZiAoU1BFVykgU2xvZy5kKFRBRywgInRpY2tlckRvbmUiKTsKLSAgICAgICAgICAgIG1UaWNraW5nID0gZmFsc2U7Ci0gICAgICAgICAgICBtSWNvbnMuc2V0VmlzaWJpbGl0eShWaWV3LlZJU0lCTEUpOwotICAgICAgICAgICAgbVRpY2tlclZpZXcuc2V0VmlzaWJpbGl0eShWaWV3LkdPTkUpOwotICAgICAgICAgICAgbUljb25zLnN0YXJ0QW5pbWF0aW9uKGxvYWRBbmltKGNvbS5hbmRyb2lkLmludGVybmFsLlIuYW5pbS5wdXNoX2Rvd25faW4sIG51bGwpKTsKLSAgICAgICAgICAgIG1UaWNrZXJWaWV3LnN0YXJ0QW5pbWF0aW9uKGxvYWRBbmltKGNvbS5hbmRyb2lkLmludGVybmFsLlIuYW5pbS5wdXNoX2Rvd25fb3V0LCBudWxsKSk7Ci0gICAgICAgICAgICBpZiAobUV4cGFuZGVkVmlzaWJsZSkgewotICAgICAgICAgICAgICAgIHNldERhdGVWaWV3VmlzaWJpbGl0eSh0cnVlLCBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmFuaW0ucHVzaF9kb3duX2luKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIHZvaWQgdGlja2VySGFsdGluZygpIHsKLSAgICAgICAgICAgIGlmIChTUEVXKSBTbG9nLmQoVEFHLCAidGlja2VySGFsdGluZyIpOwotICAgICAgICAgICAgbVRpY2tpbmcgPSBmYWxzZTsKLSAgICAgICAgICAgIG1JY29ucy5zZXRWaXNpYmlsaXR5KFZpZXcuVklTSUJMRSk7Ci0gICAgICAgICAgICBtVGlja2VyVmlldy5zZXRWaXNpYmlsaXR5KFZpZXcuR09ORSk7Ci0gICAgICAgICAgICBtSWNvbnMuc3RhcnRBbmltYXRpb24obG9hZEFuaW0oY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5hbmltLmZhZGVfaW4sIG51bGwpKTsKLSAgICAgICAgICAgIG1UaWNrZXJWaWV3LnN0YXJ0QW5pbWF0aW9uKGxvYWRBbmltKGNvbS5hbmRyb2lkLmludGVybmFsLlIuYW5pbS5mYWRlX291dCwgbnVsbCkpOwotICAgICAgICAgICAgaWYgKG1FeHBhbmRlZFZpc2libGUpIHsKLSAgICAgICAgICAg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ybWlzc2lvbiBEZW5pYWw6IGNhbid0IGR1bXAgU3RhdHVzQmFyIGZyb20gZnJvbSBwaWQ9IgotICAgICAgICAgICAgICAgICAgICArIEJpbmRlci5nZXRDYWxsaW5nUGlkKCkKLSAgICAgICAgICAgICAgICAgICAgKyAiLCB1aWQ9IiArIEJpbmRlci5nZXRDYWxsaW5nVWlkKCkpOwotICAgICAgICAgICAgcmV0dXJuOwotICAgICAgICB9Ci0KLSAgICAgICAgc3luY2hyb25pemVkIChtUXVldWVMb2NrKSB7Ci0gICAgICAgICAgICBwdy5wcmludGxuKCJDdXJyZW50IFN0YXR1cyBCYXIgc3RhdGU6Iik7Ci0gICAgICAgICAgICBwdy5wcmludGxuKCIgIG1FeHBhbmRlZD0iICsgbUV4cGFuZGVkCi0gICAgICAgICAgICAgICAgICAgICsgIiwgbUV4cGFuZGVkVmlzaWJsZT0iICsgbUV4cGFuZGVkVmlzaWJsZSk7Ci0gICAgICAgICAgICBwdy5wcmludGxuKCIgIG1UaWNraW5nPSIgKyBtVGlja2luZyk7Ci0gICAgICAgICAgICBwdy5wcmludGxuKCIgIG1UcmFja2luZz0iICsgbVRyYWNraW5nKTsKLSAgICAgICAgICAgIHB3LnByaW50bG4oIiAgbUFuaW1hdGluZz0iICsgbUFuaW1hdGluZwotICAgICAgICAgICAgICAgICAgICArICIsIG1BbmltWT0iICsgbUFuaW1ZICsgIiwgbUFuaW1WZWw9IiArIG1BbmltVmVsCi0gICAgICAgICAgICAgICAgICAgICsgIiwgbUFuaW1BY2NlbD0iICsgbUFuaW1BY2NlbCk7Ci0gICAgICAgICAgICBwdy5wcmludGxuKCIgIG1DdXJBbmltYXRpb25UaW1lPSIgKyBtQ3VyQW5pbWF0aW9uVGltZQotICAgICAgICAgICAgICAgICAgICArICIgbUFuaW1MYXN0VGltZT0iICsgbUFuaW1MYXN0VGltZSk7Ci0gICAgICAgICAgICBwdy5wcmludGxuKCIgIG1EaXNwbGF5SGVpZ2h0PSIgKyBtRGlzcGxhe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5vTm90aWZpY2F0aW9uc1RpdGxlOiAiICsgdmlld0luZm8obU5vTm90aWZpY2F0aW9uc1RpdGxlKSk7Ci0gICAgICAgICAgICBwdy5wcmludGxuKCIgIG1DbG9zZVZpZXc6ICIgKyB2aWV3SW5mbyhtQ2xvc2VWaWV3KSk7Ci0gICAgICAgICAgICBwdy5wcmludGxuKCIgIG1UaWNrZXJWaWV3OiAiICsgdmlld0luZm8obVRpY2tlclZpZXcpKTsKLSAgICAgICAgICAgIHB3LnByaW50bG4oIiAgbVNjcm9sbFZpZXc6ICIgKyB2aWV3SW5mbyhtU2Nyb2xsVmlldykKLSAgICAgICAgICAgICAgICAgICAgKyAiIHNjcm9sbCAiICsgbVNjcm9sbFZpZXcuZ2V0U2Nyb2xsWCgpICsgIiwiICsgbVNjcm9sbFZpZXcuZ2V0U2Nyb2xsWSgpKTsKLSAgICAgICAgICAgIHB3LnByaW50bG4oIm1Ob3RpZmljYXRpb25MaW5lYXJMYXlvdXQ6ICIgKyB2aWV3SW5mbyhtTm90aWZpY2F0aW9uTGluZWFyTGF5b3V0KSk7Ci0gICAgICAgIH0KLSAgICAgICAgLyoKLSAgICAgICAgc3luY2hyb25pemVkIChtTm90aWZpY2F0aW9uRGF0YSkgewotICAgICAgICAgICAgaW50IE4gPSBtTm90aWZpY2F0aW9uRGF0YS5vbmdvaW5nQ291bnQoKTsKLSAgICAgICAgICAgIHB3LnByaW50bG4oIiAgb25nb2luZ0NvdW50LnNpemU9IiArIE4pOwotICAgICAgICAgICAgZm9yIChpbnQgaT0wOyBpPE47IGkrKykgewotICAgICAgICAgICAgICAgIFN0YXR1c0Jhck5vdGlmaWNhdGlvbiBuID0gbU5vdGlmaWNhdGlvbkRhdGEuZ2V0T25nb2luZyhpKTsKLSAgICAgICAgICAgICAgICBwdy5wcmludGxuKCIgICAgWyIgKyBpICsgIl0ga2V5PSIgKyBuLmtleSArICIgdmlldz0iICsgbi52aWV3KTsKLSAgICAgICAgICAgICAgICBwdy5wcmludGxuKCIgICAgICAgICAgIGRhdGE9IiArIG4uZGF0YSk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBOID0gbU5vdGlmaWNhdGlvbkRhdGEubGF0ZXN0Q291bnQoKTsKLSAgICAgICAgICAgIHB3LnByaW50bG4oIiAgb25nb2luZ0NvdW50LnNpemU9IiArIE4pOwotICAgICAgICAgICAgZm9yIChpbnQgaT0wOyBpPE47IGkrKykgewotICAgICAgICAgICAgICAgIFN0YXR1c0Jhck5vdGlmaWNhdGlvbiBuID0gbU5vdGlmaWNhdGlvbkRhdGEuZ2V0TGF0ZXN0KGkpOwotICAgICAgICAgICAgICAgIHB3LnByaW50bG4oIiAgICBbIiArIGkgKyAiXSBrZXk9IiArIG4ua2V5ICsgIiB2aWV3PSIgKyBuLnZpZXcpOwotICAgICAgICAgICAgICAgIHB3LnByaW50bG4oIiAgICAgICAgICAgZGF0YT0iICsgbi5kYXRhKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgICAgICAqLwotCi0gICAgICAgIGlmIChmYWxzZSkgewotICAgICAgICAgICAgcHcucHJpbnRsbigic2VlIHRoZSBsb2djYXQgZm9yIGEgZHVtcCBvZiB0aGUgdmlld3Mgd2UgaGF2ZSBjcmVhdGVkLiIpOwotICAgICAgICAgICAgLy8gbXVzdCBoYXBwZW4gb24gdWkgdGhyZWFkCi0gICAgICAgICAgICBtSGFuZGxlci5wb3N0KG5ldyBSdW5uYWJsZSgpIHsKLSAgICAgICAgICAgICAgICAgICAgcHVibGljIHZvaWQgcnVuKCkgewotICAgICAgICAgICAgICAgICAgICAgICAgbVN0YXR1c0JhclZpZXcuZ2V0TG9jYXRpb25PblNjcmVlbihtQWJzUG9zKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIFNsb2cuZChUQUcsICJtU3RhdHVzQmFyVmlldzogLS0tLS0gKCIgKyBtQWJzUG9zWzBdICsgIiwiICsgbUFic1Bvc1sxXQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArICIpICIgKyBtU3RhdHVzQmFyVmlldy5nZXRXaWR0aCgpICsgIngiCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgbVN0YXR1c0JhclZpZXcuZ2V0SGVpZ2h0KCkpOwotICAgICAgICAgICAgICAgICAgICAgICAgbVN0YXR1c0JhclZpZXcuZGVidWcoKTsKLQotICAgICAgICAgICAgICAgICAgICAgICAgbUV4cGFuZGVkVmlldy5nZXRMb2NhdGlvbk9uU2NyZWVuKG1BYnNQb3MpOwotICAgICAgICAgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgIm1FeHBhbmRlZFZpZXc6IC0tLS0tICgiICsgbUFic1Bvc1swXSArICIsIiArIG1BYnNQb3NbMV0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiKSAiICsgbUV4cGFuZGVkVmlldy5nZXRXaWR0aCgpICsgIngiCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgbUV4cGFuZGVkVmlldy5nZXRIZWlnaHQoKSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBtRXhwYW5kZWRWaWV3LmRlYnVnKCk7Ci0KLSAgICAgICAgICAgICAgICAgICAgICAgIG1UcmFja2luZ1ZpZXcuZ2V0TG9jYXRpb25PblNjcmVlbihtQWJzUG9zKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIFNsb2cuZChUQUcsICJtVHJhY2tpbmdWaWV3OiAtLS0tLSAoIiArIG1BYnNQb3NbMF0gKyAiLCIgKyBtQWJzUG9zWzFdCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgIikgIiArIG1UcmFja2luZ1ZpZXcuZ2V0V2lkdGgoKSArICJ4IgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIG1UcmFja2luZ1ZpZXcuZ2V0SGVpZ2h0KCkpOwotICAgICAgICAgICAgICAgICAgICAgICAgbVRyYWNraW5nVmlldy5kZWJ1ZygpOwotICAgICAgICAgICAgICAgICAgICB9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2liaWxpdHkodik7Ci0gICAgICAgICAgICBtTm90aWZpY2F0aW9uSWNvbnMuc3RhcnRBbmltYXRpb24obG9hZEFuaW0oYW5pbSwgbnVsbCkpOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgdm9pZCB1cGRhdGVFeHBhbmRlZFZpZXdQb3MoaW50IGV4cGFuZGVkUG9zaXRpb24pIHsKLSAgICAgICAgaWYgKFNQRVcpIHsKLSAgICAgICAgICAgIFNsb2cuZChUQUcsICJ1cGRhdGVFeHBhbmRlZFZpZXdQb3MgYmVmb3JlIGV4cGFuZGVkUG9zaXRpb249IiArIGV4cGFuZGVkUG9zaXRpb24KLSAgICAgICAgICAgICAgICAgICAgKyAiIG1UcmFja2luZ1BhcmFtcy55PSIgCi0gICAgICAgICAgICAgICAgICAgICsgKChtVHJhY2tpbmdQYXJhbXMgPT0gbnVsbCkgPyAiPz8/IiA6IG1UcmFja2luZ1BhcmFtcy55KQotICAgICAgICAgICAgICAgICAgICArICIgbVRyYWNraW5nUG9zaXRpb249IiArIG1UcmFja2luZ1Bvc2l0aW9uKTsKLSAgICAgICAgfQotCi0gICAgICAgIGludCBoID0gbVN0YXR1c0JhclZpZXcuZ2V0SGVpZ2h0KCk7Ci0gICAgICAgIGludCBkaXNwaCA9IG1EaXNwbGF5LmdldEhlaWdodCgpOwotCi0gICAgICAgIC8vIElmIHRoZSBleHBhbmRlZCB2aWV3IGlzIG5vdCB2aXNpYmxlLCBtYWtlIHN1cmUgdGhleSdyZSBzdGlsbCBvZmYgc2NyZWVuLgotICAgICAgICAvLyBNYXliZSB0aGUgdmlldyB3YXMgcmVzaXplZC4KLSAgICAgICAgaWYgKCFtRXhwYW5kZWRWaXNpYmxlKSB7Ci0gICAgICAgICAgICBpZiAobVRyYWNraW5nVmlldyAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgbVRyYWNraW5nUG9zaXRpb24gPSAtZGlzcGg7Ci0gICAgICAgICAgICAgICAgaWYgKG1UcmFja2luZ1BhcmFtcyAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1UcmFja2luZ1BhcmFtcy55ID0gbVRyYWNraW5nUG9zaXRpb247Ci0gICAgICAgICAgICAgICAgICAgIFdpbmRvd01hbmFnZXJJbXBsLmdldERlZmF1bHQoKS51cGRhdGVWaWV3TGF5b3V0KG1UcmFja2luZ1ZpZXcsIG1UcmFja2luZ1BhcmFtcyk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKG1FeHBhbmRlZFBhcmFtcyAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgbUV4cGFuZGVkUGFyYW1zLnkgPSAtZGlzcGg7Ci0gICAgICAgICAgICAgICAgbUV4cGFuZGVkRGlhbG9nLmdldFdpbmRvdygpLnNldEF0dHJpYnV0ZXMobUV4cGFuZGVkUGFyYW1zKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgfQotCi0gICAgICAgIC8vIHRyYWNraW5nIHZpZXcuLi4KLSAgICAgICAgaW50IHBvczsKLSAgICAgICAgaWYgKGV4cGFuZGVkUG9zaXRpb24gPT0gRVhQQU5ERURfRlVMTF9PUEVOKSB7Ci0gICAgICAgICAgICBwb3MgPSBoOwotICAgICAgICB9Ci0gICAgICAgIGVsc2UgaWYgKGV4cGFuZGVkUG9zaXRpb24gPT0gRVhQQU5ERURfTEVBVkVfQUxPTkUpIHsKLSAgICAgICAgICAgIHBvcyA9IG1UcmFja2luZ1Bvc2l0aW9uOwotICAgICAgICB9Ci0gICAgICAgIGVsc2UgewotICAgICAgICAgICAgaWYgKGV4cGFuZGVkUG9zaXRpb24gPD0gZGlzcGgpIHsKLSAgICAgICAgICAgICAgICBwb3MgPSBleHBhbmRlZFBvc2l0aW9uOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBwb3MgPSBkaXNwaDsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH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c2UgewotICAgICAgICAgICAgICAgICAgICBzZXROb3RpZmljYXRpb25JY29uVmlzaWJpbGl0eShmYWxzZSwgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5hbmltLmZhZGVfb3V0KTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIFNsb2cuZChUQUcsICJESVNBQkxFX05PVElGSUNBVElPTl9JQ09OUzogbm8iKTsKLSAgICAgICAgICAgICAgICBpZiAoIW1FeHBhbmRlZFZpc2libGUpIHsKLSAgICAgICAgICAgICAgICAgICAgc2V0Tm90aWZpY2F0aW9uSWNvblZpc2liaWxpdHkodHJ1ZSwgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5hbmltLmZhZGVfaW4pOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfSBlbHNlIGlmICgoZGlmZiAmIFN0YXR1c0Jhck1hbmFnZXIuRElTQUJMRV9OT1RJRklDQVRJT05fVElDS0VSKSAhPSAwKSB7Ci0gICAgICAgICAgICBTbG9nLmQoVEFHLCAiRElTQUJMRV9OT1RJRklDQVRJT05fVElDS0VSOiAiCi0gICAgICAgICAgICAgICAgKyAoKChuZXQgJiBTdGF0dXNCYXJNYW5hZ2VyLkRJU0FCTEVfTk9USUZJQ0FUSU9OX1RJQ0tFUikgIT0gMCkKLSAgICAgICAgICAgICAgICAgICAgPyAieWVzIiA6ICJubyIpKTsKLSAgICAgICAgICAgIGlmIChtVGlja2luZyAmJiAobmV0ICYgU3RhdHVzQmFyTWFuYWdlci5ESVNBQkxFX05PVElGSUNBVElPTl9USUNLRVIpICE9IDApIHsKLSAgICAgICAgICAgICAgICBtVGlja2VyLmhhbHQoKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgIH0KLQotICAgIHByaXZhdGUgVmlldy5PbkNsaWNrTGlzdGVuZXIgbUNsZWFyQnV0dG9uTGlzdGVuZXIgPSBuZXcgVmlldy5PbkNsaWNrTGlzdGVuZXIoKSB7Ci0gICAgICAgIHB1YmxpYyB2b2lkIG9uQ2xpY2soVmlldyB2KSB7Ci0gICAgICAgICAgICB0cnkgewotICAgICAgICAgICAgICAgIG1CYXJTZXJ2aWNlLm9uQ2xlYXJBbGxOb3RpZmljYXRpb25zKCk7Ci0gICAgICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZXgpIHsKLSAgICAgICAgICAgICAgICAvLyBzeXN0ZW0gcHJvY2VzcyBpcyBkZWFkIGlmIHdlJ3JlIGhlcmUuCi0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBhbmltYXRlQ29sbGFwc2UoKTsKLSAgICAgICAgfQotICAgIH07Ci0KLSAgICBwcml2YXRlIEJyb2FkY2FzdFJlY2VpdmVyIG1Ccm9hZGNhc3RSZWNlaXZlciA9IG5ldyBCcm9hZGNhc3RSZWNlaXZlcigpIHsKLSAgICAgICAgcHVibGljIHZvaWQgb25SZWNlaXZlKENvbnRleHQgY29udGV4dCwgSW50ZW50IGludGVudCkgewotICAgICAgICAgICAgU3RyaW5nIGFjdGlvbiA9IGludGVudC5nZXRBY3Rpb24oKTsKLSAgICAgICAgICAgIGlmIChJbnRlbnQuQUNUSU9OX0NMT1NFX1NZU1RFTV9ESUFMT0dTLmVxdWFscyhhY3Rpb24pCi0gICAgICAgICAgICAgICAgICAgIHx8IEludGVudC5BQ1RJT05fU0NSRUVOX09GRi5lcXVhbHMoYWN0aW9uKSkgewotICAgICAgICAgICAgICAgIGFuaW1hdGVDb2xsYXBzZSgpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgZWxzZSBpZiAoSW50ZW50LkFDVElPTl9DT05GSUdVUkFUSU9OX0NIQU5HRUQuZXF1YWxzKGFjdGlvbikpIHsKLSAgICAgICAgICAgICAgICB1cGRhdGVSZXNvdXJjZXMoKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgIH07Ci0KLSAgICAvKioKLSAgICAgKiBSZW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F0aW9uSWNvbkFyZWEgZXh0ZW5kcyBMaW5lYXJMYXlvdXQgeworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIFN0cmluZyBUQUcgPSAiTm90aWZpY2F0aW9uSWNvbkFyZWEiOworCisgICAgSWNvbkxheW91dCBtSWNvbkxheW91dDsKKyAgICBEcmFnZ2VyVmlldyBtRHJhZ2dlclZpZXc7CisKKyAgICBwdWJsaWMgTm90aWZpY2F0aW9uSWNvbkFyZWEoQ29udGV4dCBjb250ZXh0LCBBdHRyaWJ1dGVTZXQgYXR0cnMpIHsKKyAgICAgICAgc3VwZXIoY29udGV4dCwgYXR0cnMpOworCisgICAgICAgIG1JY29uTGF5b3V0ID0gKEljb25MYXlvdXQpZmluZFZpZXdCeUlkKFIuaWQuaWNvbnMpOworICAgICAgICBtRHJhZ2dlclZpZXcgPSAoRHJhZ2dlclZpZXcpIGZpbmRWaWV3QnlJZChSLmlkLmhhbmRsZSk7CisgICAgfQorCisgICAgc3RhdGljIGNsYXNzIEljb25MYXlvdXQgZXh0ZW5kcyBMaW5lYXJMYXlvdXQgeworICAgICAgICBwdWJsaWMgSWNvbkxheW91dChDb250ZXh0IGNvbnRleHQsIEF0dHJpYnV0ZVNldCBhdHRycykgeworICAgICAgICAgICAgc3VwZXIoY29udGV4dCwgYXR0cnMpOworICAgICAgICB9CisgICAgfQorCisgICAgc3RhdGljIGNsYXNzIERyYWdnZXJWaWV3IGV4dGVuZHMgVmlldyB7CisgICAgICAgIHB1YmxpYyBEcmFnZ2VyVmlldyhDb250ZXh0IGNvbnRleHQsIEF0dHJpYnV0ZVNldCBhdHRycykgeworICAgICAgICAgICAgc3VwZXIoY29udGV4dCwgYXR0cnMpOworICAgICAgICB9CisgICAgfQorfQorCmRpZmYgLS1naXQgYS9wYWNrYWdlcy9TeXN0ZW1VSS9zcmMvY29tL2FuZHJvaWQvc3lzdGVtdWkvc3RhdHVzYmFyL3RhYmxldC9TeXN0ZW1QYW5lbC5qYXZhIGIvcGFja2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uKCk7CisgICAgICAgICAgICBpZiAoYWN0aW9uLmVxdWFscyhBdWRpb01hbmFnZXIuUklOR0VSX01PREVfQ0hBTkdFRF9BQ1RJT04pKSB7CisgICAgICAgICAgICAgICAgcmVmcmVzaFNvdW5kKCk7CisgICAgICAgICAgICB9IGVsc2UgaWYgKGFjdGlvbi5lcXVhbHMoSW50ZW50LkFDVElPTl9CQVRURVJZX0NIQU5HRUQpKSB7CisgICAgICAgICAgICAgICAgdXBkYXRlQmF0dGVyeShpbnRlbnQpOworICAgICAgICAgICAgfSBlbHNlIGlmIChhY3Rpb24uZXF1YWxzKFdpZmlNYW5hZ2VyLlJTU0lfQ0hBTkdFRF9BQ1RJT04pCisgICAgICAgICAgICAgICAgICAgIHx8IGFjdGlvbi5lcXVhbHMoV2lmaU1hbmFnZXIuV0lGSV9TVEFURV9DSEFOR0VEX0FDVElPTikKKyAgICAgICAgICAgICAgICAgICAgfHwgYWN0aW9uLmVxdWFscyhXaWZpTWFuYWdlci5TVVBQTElDQU5UX1NUQVRFX0NIQU5HRURfQUNUSU9OKQorICAgICAgICAgICAgICAgICAgICB8fCBhY3Rpb24uZXF1YWxzKFdpZmlNYW5hZ2VyLk5FVFdPUktfU1RBVEVfQ0hBTkdFRF9BQ1RJT04pKSB7CisgICAgICAgICAgICAgICAgdXBkYXRlV2lmaVN0YXRlKGludGVudCk7CisgICAgICAgICAgICB9IGVsc2UgaWYgKGFjdGlvbi5lcXVhbHMoVGVsZXBob255SW50ZW50cy5BQ1RJT05fU0lNX1NUQVRFX0NIQU5HRUQpKSB7CisgICAgICAgICAgICAgICAgdXBkYXRlU2ltU3RhdGUoaW50ZW50KTsKKyAgICAgICAgICAgIH0gZWxzZSBpZiAoYWN0aW9uLmVxdWFscyhCbHVldG9vdGhBZGFwdGVyLkFDVElPTl9TVEFURV9DSEFOR0VEKSkgeworICAgICAgICAgICAgICAgIHJlZnJlc2hCbHVldG9vdGgoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQ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ZS5QVUtfUkVRVUlSRUQ7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBlbHNlIHsKKyAgICAgICAgICAgICAgICBtU2ltU3RhdGUgPSBJY2NDYXJkLlN0YXRlLk5FVFdPUktfTE9DS0VEOworICAgICAgICAgICAgfQorICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgbVNpbVN0YXRlID0gSWNjQ2FyZC5TdGF0ZS5VTktOT1dOOworICAgICAgICB9CisgICAgICAgIHVwZGF0ZURhdGFTdGF0ZSgpOworICAgIH0KKworICAgIHByaXZhdGUgYm9vbGVhbiBpc0NkbWEoKSB7CisgICAgICAgIHJldHVybiAobVNpZ25hbFN0cmVuZ3RoICE9IG51bGwpICYmICFtU2lnbmFsU3RyZW5ndGguaXNHc20oKTsKKyAgICB9CisKKyAgICBwcml2YXRlIGJvb2xlYW4gaXNFdmRvKCkgeworICAgICAgICByZXR1cm4gKCAobVNlcnZpY2VTdGF0ZSAhPSBudWxsKQorICAgICAgICAgICAgICAgICAmJiAoKG1TZXJ2aWNlU3RhdGUuZ2V0UmFkaW9UZWNobm9sb2d5KCkKKyAgICAgICAgICAgICAgICAgICAgICAgID09IFNlcnZpY2VTdGF0ZS5SQURJT19URUNITk9MT0dZX0VWRE9fMCkKKyAgICAgICAgICAgICAgICAgICAgIHx8IChtU2VydmljZVN0YXRlLmdldFJhZGlvVGVjaG5vbG9neSgpCisgICAgICAgICAgICAgICAgICAgICAgICA9PSBTZXJ2aWNlU3RhdGUuUkFESU9fVEVDSE5PTE9HWV9FVkRPX0EpCisgICAgICAgICAgICAgICAgICAgICB8fCAobVNlcnZpY2VTdGF0ZS5nZXRSYWRpb1RlY2hub2xvZ3koKQorICAgICAgICAgICAgICAgICAgICAgICAgPT0gU2VydmljZVN0YXRlLlJBRElPX1RFQ0hOT0xPR1lfRVZET19CKSkpOworICAgIH0KKworICAgIHByaXZhdGUgYm9vbGVhbiBoYXNTZXJ2aWNlKCkgeworICAgICAgICBpZiAobVNlcnZpY2VTdGF0ZSAhPSBudWxsKSB7CisgICAgICAgICAgICBzd2l0Y2ggKG1TZXJ2aWNlU3RhdGUuZ2V0U3RhdGUoKSkgeworICAgICAgICAgICAgICAgIGNhc2UgU2VydmljZVN0YXRlLlNUQVRFX09VVF9PRl9TRVJWSUNFOgorICAgICAgICAgICAgICAgIGNhc2UgU2VydmljZVN0YXRlLlNUQVRFX1BPV0VSX09GRjoKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgfQorICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSBpbnQgZ2V0Q2RtYUxldmVsKCkgeworICAgICAgICBpZiAobVNpZ25hbFN0cmVuZ3RoID09IG51bGwpIHJldHVybiAwOworICAgICAgICBmaW5hbCBpbnQgY2RtYURibSA9IG1TaWduYWxTdHJlbmd0aC5nZXRDZG1hRGJtKCk7CisgICAgICAgIGZpbmFsIGludCBjZG1hRWNpbyA9IG1TaWduYWxTdHJlbmd0aC5nZXRDZG1hRWNpbygpOworICAgICAgICBpbnQgbGV2ZWxEYm0gPSAwOworICAgICAgICBpbnQgbGV2ZWxFY2lvID0gMDsKKworICAgICAgICBpZiAoY2RtYURibSA+PSAtNzUpIGxldmVsRGJtID0gNDsKKyAgICAgICAgZWxzZSBpZiAoY2RtYURibSA+PSAtODUpIGxldmVsRGJtID0gMzsKKyAgICAgICAgZWxzZSBpZiAoY2RtYURibSA+PSAtOTUpIGxldmVsRGJtID0gMjsKKyAgICAgICAgZWxzZSBpZiAoY2RtYURibSA+PSAtMTAwKSBsZXZlbERibSA9IDE7CisgICAgICAgIGVsc2UgbGV2ZWxEYm0gPSAwOworCisgICAgICAgIC8vIEVjL0lvIGFyZSBpbiBkQioxMAorICAgICAgICBpZiAoY2R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yZW5ndGgoKTsKKworICAgICAgICAgICAgLy8gYXN1IG9uIFswLDMxXTsgOTkgPSB1bmtub3duCisgICAgICAgICAgICAvLyBBbmRyb2lkIGhhcyBoaXN0b3JpY2FsbHkgc2hvd24gYW55dGhpbmcgPj0xMiBhcyAiZnVsbCIKKyAgICAgICAgICAgIC8vIFhYWDogdHVuZSB0aGlzIGJhc2VkIG9uIEluZHVzdHJ5IEJlc3QgUHJhY3RpY2VzKFRNKQorICAgICAgICAgICAgaWYgKGFzdSA8PSAyIHx8IGFzdSA9PSA5OSkgbURhdGFMZXZlbCA9IDA7CisgICAgICAgICAgICBlbHNlIG1EYXRhTGV2ZWwgPSAoaW50KSgoKGZsb2F0KU1hdGgubWF4KGFzdSwgMTUpIC8gMTUpICogMTAwKTsKKworICAgICAgICAgICAgbURhdGFSb2FtaW5nID0gbVBob25lLmlzTmV0d29ya1JvYW1pbmcoKTsKKworICAgICAgICAgICAgbURhdGFDb25uZWN0ZWQgPSBtRGF0YUNvbm5lY3RlZAorICAgICAgICAgICAgICAgICYmIChtU2ltU3RhdGUgPT0gSWNjQ2FyZC5TdGF0ZS5SRUFEWSB8fCBtU2ltU3RhdGUgPT0gSWNjQ2FyZC5TdGF0ZS5VTktOT1dOKTsKKyAgICAgICAgfQorCisgICAgICAgIGlmIChERUJVR19TSUdOQUwgfHwgREVCVUcpIHsKKyAgICAgICAgICAgIFNsb2cuZChUQUcsICJ1cGRhdGVEYXRhU3RhdGU6IGNvbm5lY3RlZD0iICsgbURhdGFDb25uZWN0ZWQgCisgICAgICAgICAgICAgICAgICAgICsgIiBsZXZlbD0iICsgbURhdGFMZXZlbAorICAgICAgICAgICAgICAgICAgICArICIgaXNFdmRvPSIgKyBpc0V2ZG8oKQorICAgICAgICAgICAgICAgICAgICArICIgaXNDZG1hPSIgKyBpc0NkbWEoKQorICAgICAgICAgICAgICAgICAgICArICIgbVBob25lU3RhdGU9IiArIG1QaG9uZVN0YXRlCisgICAgICAgICAgICAgICAgICAgIC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REVCVUcpCisgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgInVwZGF0ZVdpZmlTdGF0ZToganVzdCBjb25uZWN0ZWQ6IGluZm89IiArIGluZm8pOworCisgICAgICAgICAgICBpZiAoaW5mbyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgLy8gZ3JhYiB0aGUgaW5pdGlhbCBzaWduYWwgc3RyZW5ndGgKKyAgICAgICAgICAgICAgICBtV2lmaUxldmVsID0gV2lmaU1hbmFnZXIuY2FsY3VsYXRlU2lnbmFsTGV2ZWwoaW5mby5nZXRSc3NpKCksIDEwMSk7CisKKyAgICAgICAgICAgICAgICAvLyBmaW5kIHRoZSBTU0lECisgICAgICAgICAgICAgICAgbVdpZmlTc2lkID0gaW5mby5nZXRTU0lEKCk7CisgICAgICAgICAgICAgICAgaWYgKG1XaWZpU3NpZCA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIC8vIE9LLCBpdCdzIG5vdCBpbiB0aGUgY29ubmVjdGlvbkluZm87IHdlIGhhdmUgdG8gZ28gaHVudGluZyBmb3IgaXQKKyAgICAgICAgICAgICAgICAgICAgTGlzdDxXaWZpQ29uZmlndXJhdGlvbj4gbmV0d29ya3MgPSBtV2lmaU1hbmFnZXIuZ2V0Q29uZmlndXJlZE5ldHdvcmtzKCk7CisgICAgICAgICAgICAgICAgICAgIGZvciAoV2lmaUNvbmZpZ3VyYXRpb24gbmV0IDogbmV0d29ya3MpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuZXQubmV0d29ya0lkID09IGluZm8uZ2V0TmV0d29ya0lkKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtV2lmaVNzaWQgPSBuZXQuU1NJRDsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHJlZnJlc2hTaWduYWxNZXRlcnMoKTsKKyAgICB9CisKKyAgICAvLyBmaWd1cmUgb3V0IHdoYXQgdG8gc2hvdzogZmlyc3Qgd2lmaSwgdGhlbiAzRywgdGhlbiBub3RoaW5nCisgICAgdm9pZCByZWZyZXNoU2lnbmFsTWV0ZXJzKCkgeworICAgICAgICBpZiAobVNpZ25hbE1ldGVyID09IG51bGwpIHJldHVybjsgLy8gbm8gVUkgeWV0CisKKyAgICAgICAgQ29udGV4dCBjdHh0ID0gZ2V0Q29udGV4dCgpOworCisgICAgICAgIFN0cmluZyB0ZXh0ID0gbnVsbDsKKyAgICAgICAgaW50IGxldmVsID0gMDsKKworICAgICAgICBpZiAobVdpZmlDb25uZWN0ZWQpIHsKKyAgICAgICAgICAgIGlmIChtV2lmaVNzaWQgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIHRleHQgPSBjdHh0LmdldFN0cmluZyhSLnN0cmluZy5zeXN0ZW1fcGFuZWxfc2lnbmFsX21ldGVyX3dpZmlfbm9zc2lkKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgdGV4dCA9IGN0eHQuZ2V0U3RyaW5nKFIuc3RyaW5nLnN5c3RlbV9wYW5lbF9zaWduYWxfbWV0ZXJfd2lmaV9zc2lkX2Zvcm1hdCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVdpZmlTc2lkKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGxldmVsID0gbVdpZmlMZXZlbDsKKyAgICAgICAgfSBlbHNlIGlmIChtRGF0YUNvbm5lY3RlZCkgeworICAgICAgICAgICAgdGV4dCA9IGN0eHQuZ2V0U3RyaW5nKFIuc3RyaW5nLnN5c3RlbV9wYW5lbF9zaWduYWxfbWV0ZXJfZGF0YV9jb25uZWN0ZWQpOworICAgICAgICAgICAgbGV2ZWwgPSBtRGF0YUxldmVsOworICAgICAgICB9IGVsc2UgeworICA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1hdCwgbGV2ZWwpKTsKKworICAgICAgICAvLyBoYWNrIGZvciBub3cKKyAgICAgICAgbUJhci5zZXRCYXR0ZXJ5TWV0ZXIobGV2ZWwsIHBsdWdnZWQpOworICAgIH0KKyAgICAKKyAgICBwdWJsaWMgU3lzdGVtUGFuZWwoQ29udGV4dCBjb250ZXh0LCBBdHRyaWJ1dGVTZXQgYXR0cnMpIHsKKyAgICAgICAgdGhpcyhjb250ZXh0LCBhdHRycywgMCk7CisgICAgfQorCisgICAgcHVibGljIFN5c3RlbVBhbmVsKENvbnRleHQgY29udGV4dCwgQXR0cmlidXRlU2V0IGF0dHJzLCBpbnQgZGVmU3R5bGUpIHsKKyAgICAgICAgc3VwZXIoY29udGV4dCwgYXR0cnMsIGRlZlN0eWxlKTsKKworICAgICAgICAvLyBnZXQgbm90aWZpZWQgb2YgcGhvbmUgc3RhdGUgY2hhbmdlcworICAgICAgICBUZWxlcGhvbnlNYW5hZ2VyIHRlbGVwaG9ueU1hbmFnZXIgPQorICAgICAgICAgICAgICAgIChUZWxlcGhvbnlNYW5hZ2VyKSBjb250ZXh0LmdldFN5c3RlbVNlcnZpY2UoQ29udGV4dC5URUxFUEhPTllfU0VSVklDRSk7CisgICAgICAgIHRlbGVwaG9ueU1hbmFnZXIubGlzdGVuKG1QaG9uZVN0YXRlTGlzdGVuZXIsCisgICAgICAgICAgICAgICAgICAgICAgICAgIFBob25lU3RhdGVMaXN0ZW5lci5MSVNURU5fU0VSVklDRV9TVEFURQorICAgICAgICAgICAgICAgICAgICAgICAgfCBQaG9uZVN0YXRlTGlzdGVuZXIuTElTVEVOX1NJR05BTF9TVFJFTkdUSFMKKyAgICAgICAgICAgICAgICAgICAgICAgIHwgUGhvbmVTdGF0ZUxpc3RlbmVyLkxJU1RFTl9DQUxMX1NUQVRFCisgICAgICAgICAgICAgICAgICAgICAgICB8IFBob25lU3RhdGVMaXN0ZW5lci5MSVNURU5fREFUQV9DT05ORUNUSU9OX1NUQVRFCisgICAgICAgICAgICAgICAgICAgICAgICB8IFBob25lU3RhdGVMaXN0ZW5lci5MSVNURU5fREFUQV9BQ1RJVklUWSk7CisKKyAgICAgICAgLy8gd2lmaSBzdGF0dXMgaW5mbworICAgICAgICBtV2lmaU1hbmFnZXIgPSAoV2lmaU1hbmFnZXIpIGNvbnRleHQuZ2V0U3lzdGVtU2VydmljZShDb250ZXh0LldJRklfU0VSVklDRSk7CisgICAgICAgIAorICAgICAgICAvLyBhdWRpbyBzdGF0dXMgCisgICAgICAgIG1BdWRpb01hbmFnZXIgPSAoQXVkaW9NYW5hZ2VyKSBtQ29udGV4dC5nZXRTeXN0ZW1TZXJ2aWNlKENvbnRleHQuQVVESU9fU0VSVklDRSk7CisKKyAgICAgICAgLy8gbW9iaWxlIGRhdGEgCisgICAgICAgIG1QaG9uZSA9IChUZWxlcGhvbnlNYW5hZ2VyKWNvbnRleHQuZ2V0U3lzdGVtU2VydmljZShDb250ZXh0LlRFTEVQSE9OWV9TRVJWSUNFKTsKKworICAgICAgICAvLyBCbHVldG9vdGgKKyAgICAgICAgbUJsdWV0b290aEFkYXB0ZXIgPSBCbHVldG9vdGhBZGFwdGVyLmdldERlZmF1bHRBZGFwdGVyKCk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgb25BdHRhY2hlZFRvV2luZG93KCkgeworICAgICAgICBUZXh0VmlldyBzZXR0aW5nc0J1dHRvbiA9IChUZXh0VmlldylmaW5kVmlld0J5SWQoUi5pZC5zZXR0aW5nc19idXR0b24pOworICAgICAgICBzZXR0aW5nc0J1dHRvbi5zZXRPbkNsaWNrTGlzdGVuZXIobmV3IFZpZXcuT25DbGlja0xpc3RlbmVyKCkgeworICAgICAgICAgICAgcHVibGljIHZvaWQgb25DbGljayhWaWV3IHYpIHsKKyAgICAgICAgICAgICAgICBnZXRDb250ZXh0KCkuc3RhcnRBY3Rpdml0eShuZXcgSW50ZW50KGFuZHJvaWQucHJvdmlkZXIuU2V0dGluZ3MuQUNUSU9OX1NFVFRJTkdTKQorICAgICAgICAgICAgICAgICAgICAgICAgLnNldEZsYWdzKEludGVudC5GTEFHX0FDVElWSVRZX05FV19UQVNLKSk7CisgICAgICAgICAgICAgICAgbUJhci5hbmltYXRlQ29sbGFwc2UoKTsKKyAgICAgICAgICAgIH19KTsKKworICAgICAgICBtQnJpZ2h0bmVzc0J1dHRvbiA9IChJbWFnZUJ1dHRvbilmaW5kVmlld0J5SWQoUi5pZC5icmlnaHRuZXNzKTsKKyAgICAgICAgbUJyaWdodG5lc3NCdXR0b24uc2V0T25DbGlja0xpc3RlbmVyKG5ldyBWaWV3Lk9uQ2xpY2tMaXN0ZW5lcigpIHsKKyAgICAgICAgICAgIHB1YmxpYyB2b2lkIG9uQ2xpY2soVmlldyB2KSB7CisgICAgICAgICAgICAgICAgcm90YXRlQnJpZ2h0bmVzcygpOworICAgICAgICAgICAgfQorICAgICAgICB9KTsKKworICAgICAgICBtU291bmRCdXR0b24gPSAoSW1hZ2VCdXR0b24pZmluZFZpZXdCeUlkKFIuaWQuc291bmQpOworICAgICAgICBtU291bmRCdXR0b24uc2V0T25DbGlja0xpc3RlbmVyKG5ldyBWaWV3Lk9uQ2xpY2tMaXN0ZW5lcigpIHsKKyAgICAgICAgICAgIHB1YmxpYyB2b2lkIG9uQ2xpY2soVmlldyB2KSB7CisgICAgICAgICAgICAgICAgc2V0U2lsZW50TW9kZSghZ2V0U2lsZW50TW9kZSgpKTsKKyAgICAgICAgICAgICAgICBtU291bmRCdXR0b24uc2V0QWxwaGEoZ2V0U2lsZW50TW9kZSgpID8gMHg3RiA6IDB4RkYpOworICAgICAgICAgICAgfQorICAgICAgICB9KTsKKyAgICAgICAgbU9yaWVudGF0aW9uQnV0dG9uID0gKEltYWdlQnV0dG9uKWZpbmRWaWV3QnlJZChSLmlkLm9yaWVudGF0aW9uKTsKKyAgICAgICAgbU9yaWVudGF0aW9uQnV0dG9uLnNldE9uQ2xpY2tMaXN0ZW5lcihuZXcgVmlldy5PbkNsaWNrTGlzdGVuZXIoKSB7CisgICAgICAgICAgICBwdWJsaWMgdm9pZCBvbkNsaWNrKFZpZXcgdikgeworICAgICAgICAgICAgICAgIFRvYXN0Lm1ha2VUZXh0KGdldENvbnRleHQoKSwgIk9yaWVudGF0aW9uIGNvbnRyb2wgbm90IGltcGxlbWVudGVkOyBwbGVhc2UgYWRqdXN0IG5lY2sgYW5nbGUuIiwgVG9hc3QuTEVOR1RIX1NIT1JUKS5zaG93KCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0pOworCisgICAgICAgIG1BaXJwbGFuZUJ1dHRvbiA9IChJbWFnZUJ1dHRvbilmaW5kVmlld0J5SWQoUi5pZC5haXJwbGFuZSk7CisgICAgICAgIG1BaXJwbGFuZUJ1dHRvbi5zZXRBbHBoYShtQWlycGxhbmVNb2RlID8gMHhGRiA6IDB4N0YpOworICAgICAgICBtQWlycGxhbmVCdXR0b24uc2V0T25DbGlja0xpc3RlbmVyKG5ldyBWaWV3Lk9uQ2xpY2tMaXN0ZW5lcigpIHsKKyAgICAgICAgICAgIHB1YmxpYyB2b2lkIG9uQ2xpY2soVmlldyB2KSB7CisgICAgICAgICAgICAgICAgYm9vbGVhbiBuZXdNb2RlID0gIWdldEFpcnBsYW5lTW9kZSgpOworICAgICAgICAgICAgICAgIFRvYXN0Lm1ha2VUZXh0KGdldENvbnRleHQoKSwgIkF0dGVtcHRpbmcgdG8gdHVybiAiCisgICAgICAgICAgICAgICAgICAgICsgKG5ld01vZGUgPyAib24iIDogIm9mZiIpICsgIiBhaXJwbGFuZSBtb2RlIChmbGFreSkuIiwKKyAgICAgICAgICAgICAgICAgICAgVG9hc3QuTEVOR1RIX1NIT1JUKS5zaG93KCk7CisgICAgICAgICAgICAgICAgc2V0QWlycGxhbmVNb2RlKG5ld01vZGUpOworICAgICAgICAgICAgfQorICAgICAgICB9KTsKKworICAgICAgICBtR3BzQnV0dG9uID0gKEltYWdlQnV0dG9uKWZpbmRWaWV3QnlJZChSLmlkLmdwcyk7CisgICAgICAgIG1HcHNCdXR0b24uc2V0T25DbGlja0xpc3RlbmVyKG5ldyBWaWV3Lk9uQ2xpY2tMaXN0ZW5lcigpIHsKKyAgICAgICAgICAgIHB1YmxpYyB2b2lkIG9uQ2xpY2soVmlldyB2KSB7CisgICAgICAgICAgICAgICAgdG9nZ2xlR3BzKCk7CisgICAgICAgICAgICAgICAgcmVmcmVzaEdwcygpOworICAgICAgICAgICAgfQorICAgICAgICB9KTsKKworICAgICAgICBtQmx1ZXRvb3RoQnV0dG9uID0gKEltYWdlQnV0dG9uKWZpbmRWaWV3QnlJZChSLmlkLmJsdWV0b290aCk7CisgICAgICAgIG1CbHVldG9vdGhCdXR0b24uc2V0T25DbGlja0xpc3RlbmVyKG5ldyBWaWV3Lk9uQ2xpY2tMaXN0ZW5lcigpIHsKKyAgICAgICAgICAgIHB1YmxpYyB2b2lkIG9uQ2xpY2soVmlldyB2KSB7CisgICAgICAgICAgICAgICAgdG9nZ2xlQmx1ZXRvb3RoKCk7CisgICAgICAgICAgICAgICAgcmVmcmVzaEJsdWV0b290aCgpOworICAgICAgICAgICAgfQorICAgICAgICB9KTsKKworICAgICAgICAvLyByZWdpc3RlciBmb3IgYnJvYWRjYXN0cworICAgICAgICBJbnRlbnRGaWx0ZXIgZmlsdGVyID0gbmV3IEludGVudEZpbHRlcigpOworICAgICAgICBmaWx0ZXIuYWRkQWN0aW9uKEF1ZGlvTWFuYWdlci5SSU5HRVJfTU9ERV9DSEFOR0VEX0FDVElPTik7CisgICAgICAgIGZpbHRlci5hZGRBY3Rpb24oSW50ZW50LkFDVElPTl9CQVRURVJZX0NIQU5HRUQpOworICAgICAgICBmaWx0ZXIuYWRkQWN0aW9uKFdpZmlNYW5hZ2VyLldJRklfU1RBVEVfQ0hBTkdFRF9BQ1RJT04pOworICAgICAgICBmaWx0ZXIuYWRkQWN0aW9uKFdpZmlNYW5hZ2VyLlNVUFBMSUNBTlRfU1RBVEVfQ0hBTkdFRF9BQ1RJT04pOworICAgICAgICBmaWx0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mZvKTsKKworICAgICAgICByZWZyZXNoU2lnbmFsTWV0ZXJzKCk7CisgICAgICAgIHJlZnJlc2hCbHVldG9vdGgoKTsKKyAgICAgICAgcmVmcmVzaEdwcygpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIG9uRGV0YWNoZWRGcm9tV2luZG93KCkgeworICAgICAgICBnZXRDb250ZXh0KCkudW5yZWdpc3RlclJlY2VpdmVyKG1SZWNlaXZlcik7CisgICAgfQorCisgICAgLy8gLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQorCisvLyAgICBwcml2YXRlIGJvb2xlYW4gaXNBdXRvQnJpZ2h0bmVzcygpIHsKKy8vICAgICAgICBDb250ZXh0IGNvbnRleHQgPSBnZXRDb250ZXh0KCk7CisvLyAgICAgICAgdHJ5IHsKKy8vICAgICAgICAgICAgSVBvd2VyTWFuYWdlciBwb3dlciA9IElQb3dlck1hbmFnZXIuU3R1Yi5hc0ludGVyZmFjZSgKKy8vICAgICAgICAgICAgICAgICAgICBTZXJ2aWNlTWFuYWdlci5nZXRTZXJ2aWNlKCJwb3dlciIpKTsKKy8vICAgICAgICAgICAgaWYgKHBvd2VyICE9IG51bGwpIHsKKy8vICAgICAgICAgICAgICAgIGludCBicmlnaHRuZXNzTW9kZSA9IFNldHRpbmdzLlN5c3RlbS5nZXRJbnQoY29udGV4dC5nZXRDb250ZW50UmVzb2x2ZXIoKSwKKy8vICAgICAgICAgICAgICAgICAgICAgICAgU2V0dGluZ3MuU3lzdGVtLlNDUkVFTl9CUklHSFRORVNTX01PREUpOworLy8gICAgICAgICAgICAgICAgcmV0dXJuIGJyaWdodG5lc3NNb2RlID09IFNldHRpbmdzLlN5c3RlbS5TQ1JFRU5fQlJJR0hUTkVTU19NT0RFX0FVVE9NQVRJQzsKKy8vICAgICAgICAgICAgfQorLy8gICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7CisvLyAgICAgICAgfSBjYXRjaCAoU2V0dGluZ3MuU2V0dGluZ05vdEZvdW5kRXhjZXB0aW9uIGUpIHsKKy8vICAgICAgICB9CisvLyAgICAgICAgcmV0dXJuIGZhbHNlOworLy8gICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIHJvdGF0ZUJyaWdodG5lc3MoKSB7CisgICAgICAgIGludCBpY29uID0gUi5kcmF3YWJsZS5pY19zeXNiYXJfYnJpZ2h0bmVzczsKKyAgICAgICAgaW50IGJnID0gUi5kcmF3YWJsZS5zeXNiYXJfdG9nZ2xlX2JnX29uOworICAgICAgICBDb250ZXh0IGNvbnRleHQgPSBnZXRDb250ZXh0KCk7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBJUG93ZXJNYW5hZ2VyIHBvd2VyID0gSVBvd2VyTWFuYWdlci5TdHViLmFzSW50ZXJmYWNlKAorICAgICAgICAgICAgICAgICAgICBTZXJ2aWNlTWFuYWdlci5nZXRTZXJ2aWNlKCJwb3dlciIpKTsKKyAgICAgICAgICAgIGlmIChwb3dlciAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgQ29udGVudFJlc29sdmVyIGNyID0gY29udGV4dC5nZXRDb250ZW50UmVzb2x2ZXIoKTsKKyAgICAgICAgICAgICAgICBpbnQgYnJpZ2h0bmVzcyA9IFNldHRpbmdzLlN5c3RlbS5nZXRJbnQoY3IsCisgICAgICAgICAgICAgICAgICAgICAgICBTZXR0aW5ncy5TeXN0ZW0uU0NSRUVOX0JSSUdIVE5FU1MpOworICAgICAgICAgICAgICAgIGludCBicmlnaHRuZXNzTW9kZSA9IFNldHRpbmdzLlN5c3RlbS5TQ1JFRU5fQlJJR0hUTkVTU19NT0RFX01BTlVBTDsKKyAgICAgICAgICAgICAgICAvL09ubHkgZ2V0IGJyaWdodG5lc3Mgc2V0dGluZyBpZiBhdmFpbGFibGUKKyAgICAgICAgICAgICAgICBpZiAoY29udGV4dC5nZXRSZXNvdXJjZXMoKS5nZXRCb29sZWFuKAorICAgICAgICAgICAgICAgICAgICAgICAgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5ib29sLmNvbmZpZ19hdXRvbWF0aWNfYnJpZ2h0bmVzc19hdmFpbGFibGUpKSB7CisgICAgICAgICAgICAgICAgICAgIGJyaWdodG5lc3NNb2RlID0gU2V0dGluZ3MuU3lzdGVtLmdldEludChjciwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBTZXR0aW5ncy5TeXN0ZW0uU0NSRUVOX0JSSUdIVE5FU1NfTU9ERSk7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgLy8gUm90YXRlIEFVVE8gLT4gTUlOSU1VTSAtPiBERUZBVUxUIC0+IE1BWElNVU0KKyAgICAgICAgICAgICAgICAvLyBUZWNobmljYWxseSwgbm90IGEgdG9nZ2xlLi4uCisgICAgICAgICAgICAgICAgaWYgKGJyaWdodG5lc3NNb2RlID09IFNldHRpbmdzLlN5c3RlbS5TQ1JFRU5fQlJJR0hUTkVTU19NT0RFX0FVVE9NQVRJQykgeworICAgICAgICAgICAgICAgICAgICBicmlnaHRuZXNzID0gTUlOSU1VTV9CQUNLTElHSFQ7CisgICAgICAgICAgICAgICAgICAgIGljb24gPSBSLmRyYXdhYmxlLmljX3N5c2Jhcl9icmlnaHRuZXNzX2xvdzsKKyAgICAgICAgICAgICAgICAgICAgYnJpZ2h0bmVzc01vZGUgPSBTZXR0aW5ncy5TeXN0ZW0uU0NSRUVOX0JSSUdIVE5FU1NfTU9ERV9NQU5VQUw7CisgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChicmlnaHRuZXNzIDwgREVGQVVMVF9CQUNLTElHSFQpIHsKKyAgICAgICAgICAgICAgICAgICAgYnJpZ2h0bmVzcyA9IERFRkFVTFRfQkFDS0xJR0hUOworICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoYnJpZ2h0bmVzcyA8IE1BWElNVU1fQkFDS0xJR0hUKSB7CisgICAgICAgICAgICAgICAgICAgIGJyaWdodG5lc3MgPSBNQVhJTVVNX0JBQ0tMSUdIVDsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICBicmlnaHRuZXNzTW9kZSA9IFNldHRpbmdzLlN5c3RlbS5TQ1JFRU5fQlJJR0hUTkVTU19NT0RFX0FVVE9NQVRJQzsKKyAgICAgICAgICAgICAgICAgICAgYnJpZ2h0bmVzcyA9IE1JTklNVU1fQkFDS0xJR0hUOworICAgICAgICAgICAgICAgICAgICBpY29uID0gUi5kcmF3YWJsZS5pY19zeXNiYXJfYnJpZ2h0bmVzc19hdXRvOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIGlmIChjb250ZXh0LmdldFJlc291cmNlcygpLmdldEJvb2xlYW4oCisgICAgICAgICAgICAgICAgICAgICAgICBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmJvb2wuY29uZmlnX2F1dG9tYXRpY19icmlnaHRuZXNzX2F2YWlsYWJsZSkpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gU2V0IHNjcmVlbiBicmlnaHRuZXNzIG1vZGUgKGF1dG9tYXRpYyBvciBtYW51YWwpCisgICAgICAgICAgICAgICAgICAgIFNldHRpbmdzLlN5c3RlbS5wdXRJbnQoY29udGV4dC5nZXRDb250ZW50UmVzb2x2ZXIoKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBTZXR0aW5ncy5TeXN0ZW0uU0NSRUVOX0JSSUdIVE5FU1NfTU9ERSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmlnaHRuZXNzTW9kZSk7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gTWFrZSBzdXJlIHdlIHNldCB0aGUgYnJpZ2h0bmVzcyBpZiBhdXRvbWF0aWMgbW9kZSBpc24ndCBhdmFpbGFibGUKKyAgICAgICAgICAgICAgICAgICAgYnJpZ2h0bm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bmdlZDogIiArIHNlcnZpY2VTdGF0ZS5nZXRTdGF0ZSgpKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1TZXJ2aWNlU3RhdGUgPSBzZXJ2aWNlU3RhdGU7CisgICAgICAgICAgICBtQWlycGxhbmVNb2RlID0gc2VydmljZVN0YXRlLmdldFN0YXRlKCkgPT0gU2VydmljZVN0YXRlLlNUQVRFX1BPV0VSX09GRjsKKyAgICAgICAgICAgIGlmIChtQWlycGxhbmVCdXR0b24gIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIG1BaXJwbGFuZUJ1dHRvbi5zZXRJbWFnZVJlc291cmNlKG1BaXJwbGFuZU1vZGUgCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPyBSLmRyYXdhYmxlLmljX3N5c2Jhcl9haXJwbGFuZV9vbgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogUi5kcmF3YWJsZS5pY19zeXNiYXJfYWlycGxhbmVfb2ZmKTsKKyAgICAgICAgICAgICAgICBtQWlycGxhbmVCdXR0b24uc2V0QmFja2dyb3VuZFJlc291cmNlKG1BaXJwbGFuZU1vZGUgCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPyBSLmRyYXdhYmxlLnN5c2Jhcl90b2dnbGVfYmdfb24KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6IFIuZHJhd2FibGUuc3lzYmFyX3RvZ2dsZV9iZ19vZmYpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgdXBkYXRlRGF0YVN0YXRlKCk7CisgICAgICAgIH0KKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIG9uU2lnbmFsU3RyZW5ndGhzQ2hhbmdlZChTaWduYWxTdHJlbmd0aCBzaWduYWxTdHJlbmd0aCkgeworICAgICAgICAgICAgaWYgKERFQlVHX1NJR05BTCB8fCBERUJVRykgeworICAgICAgICAgICAgICAgIFNsb2cuZChUQUcsICJvblNpZ25hbFN0cmVuZ3Roc0NoYW5nZWQ6ICIgKyBzaWduYWxTdHJlbmd0aCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBtU2lnbmFsU3RyZW5ndGggPSBzaWduYWxTdHJlbmd0aDsKKyAgICAgICAgICAgIHVwZGF0ZURhdGFTdGF0ZSgpOworICAgICAgICB9CisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgdm9pZCBvbkNhbGxTdGF0ZUNoYW5nZWQoaW50IHN0YXRlLCBTdHJpbmcgaW5jb21pbmdOdW1iZXIpIHsKKyAgICAgICAgICAgIG1QaG9uZVN0YXRlID0gc3RhdGU7CisgICAgICAgICAgICAvLyBJbiBjZG1hLCBpZiBhIHZvaWNlIGNhbGwgaXMgbWFkZSwgUlNTSSBzaG91bGQgc3dpdGNoIHRvIDF4LgorICAgICAgICAgICAgaWYgKGlzQ2RtYSgpKSB7CisgICAgICAgICAgICAgICAgdXBkYXRlRGF0YVN0YXRlKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgb25EYXRhQ29ubmVjdGlvblN0YXRlQ2hhbmdlZChpbnQgc3RhdGUsIGludCBuZXR3b3JrVHlwZSkgeworICAgICAgICAgICAgaWYgKERFQlVHX1NJR05BTCB8fCBERUJVRykgeworICAgICAgICAgICAgICAgIFNsb2cuZChUQUcsICJvbkRhdGFDb25uZWN0aW9uU3RhdGVDaGFuZ2VkOiBzdGF0ZT0iICsgc3RhdGUgCisgICAgICAgICAgICAgICAgICAgICAgICArICIgdHlwZT0iICsgbmV0d29ya1R5cGUpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbURhdGFTdGF0ZSA9IHN0YXRlOworLy8gICAgICAgICAgICB1cGRhdGVEYXRhTmV0VHlwZShuZXR3b3JrVHlwZSk7CisgICAgICAgICAgICB1cGRhdGVEYXRhU3RhdGUoKTsKKyAgICAgICAgfQorICAgIH07CisKKyAgICBwcml2YXRlIGJvb2xlYW4gZ2V0QWlycGxhbmVNb2RlKCkgeworICAgICAgICByZXR1cm4gbUFpcnBsYW5lTW9kZTsKKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgc2V0QWlycGxhbmVNb2RlKGJvb2xlYW4gb24pIHsKKyAgICAgICAgU2V0dGluZ3MuU3lzdGVtLnB1dEludCgKKyAgICAgICAgICAgICAgICBtQ29udGV4dC5nZXRDb250ZW50UmVzb2x2ZXIoKSwKKyAgICAgICAgICAgICAgICBTZXR0aW5ncy5TeXN0ZW0uQUlSUExBTkVfTU9ERV9PTiwKKyAgICAgICAgICAgICAgICBvbiA/IDEgOiAwKTsKKyAgICAgICAgSW50ZW50IGludGVudCA9IG5ldyBJbnRlbnQoSW50ZW50LkFDVElPTl9BSVJQTEFORV9NT0RFX0NIQU5HRUQpOworICAgICAgICBpbnRlbnQuYWRkRmxhZ3MoSW50ZW50LkZMQUdfUkVDRUlWRVJfUkVQTEFDRV9QRU5ESU5HKTsKKyAgICAgICAgaW50ZW50LnB1dEV4dHJhKCJzdGF0ZSIsIG9uKTsKKyAgICAgICAgZ2V0Q29udGV4dCgpLnNlbmRCcm9hZGNhc3QoaW50ZW50KTsKKyAgICB9CisKKyAgICBib29sZWFuIGdldFNpbGVudE1vZGUoKSB7CisgICAgICAgIHJldHVybiBtQXVkaW9NYW5hZ2VyLmdldFJpbmdlck1vZGUoKSAhPSBBdWRpb01hbmFnZXIuUklOR0VSX01PREVfTk9STUFMOworICAgIH0KKworICAgIHZvaWQgc2V0U2lsZW50TW9kZShib29sZWFuIG9uKSB7CisgICAgICAgIGlmIChvbikgeworICAgICAgICAgICAgbUF1ZGlvTWFuYWdlci5zZXRSaW5nZXJNb2RlKChTZXR0aW5ncy5TeXN0ZW0uZ2V0SW50KG1Db250ZXh0LmdldENvbnRlbnRSZXNvbHZlcigpLAorICAgICAgICAgICAgICAgIFNldHRpbmdzLlN5c3RlbS5WSUJSQVRFX0lOX1NJTEVOVCwgMSkgPT0gMSkKKyAgICAgICAgICAgICAgICA/IEF1ZGlvTWFuYWdlci5SSU5HRVJfTU9ERV9WSUJSQVRFCisgICAgICAgICAgICAgICAgOiBBdWRpb01hbmFnZXIuUklOR0VSX01PREVfU0lMRU5UKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIG1BdWRpb01hbmFnZXIuc2V0UmluZ2VyTW9kZShBdWRpb01hbmFnZXIuUklOR0VSX01PREVfTk9STUFMKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHZvaWQgcmVmcmVzaFNvdW5kKCkgeworICAgICAgICBib29sZWFuIHNpbGVudCA9IGdldFNpbGVudE1vZGUoKTsKKyAgICAgICAgbVNvdW5kQnV0dG9uLnNldEltYWdlUmVzb3VyY2UoIXNpbGVudCAKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPyBSLmRyYXdhYmxlLmljX3N5c2Jhcl9zb3VuZF9vbgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6IFIuZHJhd2FibGUuaWNfc3lzYmFyX3NvdW5kX29mZik7CisgICAgICAgIG1Tb3VuZEJ1dHRvbi5zZXRCYWNrZ3JvdW5kUmVzb3VyY2UoIXNpbGVudCAKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPyBSLmRyYXdhYmxlLnN5c2Jhcl90b2dnbGVfYmdfb24KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOiBSLmRyYXdhYmxlLnN5c2Jhcl90b2dnbGVfYmdfb2ZmKTsKKyAgICB9CisKKyAgICB2b2lkIHRvZ2dsZUJsdWV0b290aCgpIHsKKyAgICAgICAgaWYgKG1CbHVldG9vdGhBZGFwdGVyID09IG51bGwpIHJldHVybjsKKyAgICAgICAgaWYgKG1CbHVldG9vdGhBZGFwdGVyLmlzRW5hYmxlZCgpKSB7CisgICAgICAgICAgICBtQmx1ZXRvb3RoQWRhcHRlci5kaXNhYmxlKCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBtQmx1ZXRvb3RoQWRhcHRlci5lbmFibGUoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHZvaWQgcmVmcmVzaEJsdWV0b290aCgpIHsKKyAgICAgICAgYm9vbGVhbiBvbiA9IG1CbHVldG9vdGhBZGFwdGVyICE9IG51bGwgJiYgbUJsdWV0b290aEFkYXB0ZXIuaXNFbmFibGVkKCk7CisgICAgICAgIG1CbHVldG9vdGhCdXR0b24uc2V0SW1hZ2VSZXNvdXJjZShvbiA/IFIuZHJhd2FibGUuaWNfc3lzYmFyX2JsdWV0b290aF9vbgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOiBSLmRyYXdhYmxlLmljX3N5c2Jhcl9ibHVldG9vdGhfb2ZmKTsKKyAgICAgICAgbUJsdWV0b290aEJ1dHRvbi5zZXRCYWNrZ3JvdW5kUmVzb3VyY2Uob24KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPyBSLmRyYXdhYmxlLnN5c2Jhcl90b2dnbGVfYmdfb24KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOiBSLmRyYXdhYmxlLnN5c2Jhcl90b2dnbGVfYmdfb2ZmKTsKKyAgICB9CisKKyAgICBwcml2YXRlIGJvb2xlYW4gaXNHcHNFbmFibGVkKCkgeworICAgICAgICBDb250ZW50UmVzb2x2ZXIgcmVzID0gbUNvbnRleHQuZ2V0Q29udGVudFJlc29sdmVyKCk7CisgICAgICAgIHJldHVybiBTZXR0aW5ncy5TZWN1cmUuaXNMb2NhdGlvblByb3ZpZGVyRW5hYmxlZCgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzLCBMb2NhdGlvbk1hbmFnZXIuR1BTX1BST1ZJREVSKTsKKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgdG9nZ2xlR3BzKCkgeworICAgICAgICBTZXR0aW5ncy5TZWN1cmUuc2V0TG9jYXRpb25Qcm92aWRlckVuYWJsZWQobUNvbnRleHQuZ2V0Q29udGVudFJlc29sdmVyKCksCisgICAgICAgICAgICAgICAgTG9jYXRpb25NYW5hZ2VyLkdQU19QUk9WSURFUiwgIWlzR3BzRW5hYmxlZCgpKTsKKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgcmVmcmVzaEdwcygpIHsKKyAgICAgICAgYm9vbGVhbiBvbiA9IGlzR3BzRW5hYmxlZCgpOworICAgICAgICBtR3BzQnV0dG9uLnNldEltYWdlUmVzb3VyY2Uob24gPyBSLmRyYXdhYmxlLmljX3N5c2Jhcl9ncHNfb24KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogUi5kcmF3YWJsZS5pY19zeXNiYXJfZ3BzX29mZik7CisgICAgICAgIG1HcHNCdXR0b24uc2V0QmFja2dyb3VuZFJlc291cmNlKG9uCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgID8gUi5kcmF3YWJsZS5zeXNiYXJfdG9nZ2xlX2JnX29uCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogUi5kcmF3YWJsZS5zeXNiYXJfdG9nZ2xlX2JnX29mZik7CisgICAgfQorfQpkaWZmIC0tZ2l0IGEvcGFja2FnZXMvU3lzdGVtVUkvc3JjL2NvbS9hbmRyb2lkL3N5c3RlbXVpL3N0YXR1c2Jhci90YWJsZXQvVGFibGV0U3RhdHVzQmFyU2VydmljZS5qYXZhIGIvcGFja2FnZXMvU3lzdGVtVUkvc3JjL2NvbS9hbmRyb2lkL3N5c3RlbXVpL3N0YXR1c2Jhci90YWJsZXQvVGFibGV0U3RhdHVzQmFyU2VydmljZS5qYXZhCm5ldyBmaWxlIG1vZGUgMTAwNj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UdFX0xFVkVMID0gMTAwMDA7CisKKworCisgICAgaW50IG1JY29uU2l6ZTsKKworICAgIEggbUhhbmRsZXIgPSBuZXcgSCgpOworCisgICAgLy8gdHJhY2tpbmcgYWxsIGN1cnJlbnQgbm90aWZpY2F0aW9ucworICAgIHByaXZhdGUgTm90aWZpY2F0aW9uRGF0YSBtTm90bnMgPSBuZXcgTm90aWZpY2F0aW9uRGF0YSgpOworICAgIAorICAgIFZpZXcgbVN0YXR1c0JhclZpZXc7CisgICAgTm90aWZpY2F0aW9uSWNvbkFyZWEgbU5vdGlmaWNhdGlvbkljb25BcmVhOworCisgICAgVmlldyBtTm90aWZpY2F0aW9uUGFuZWw7CisgICAgU3lzdGVtUGFuZWwgbVN5c3RlbVBhbmVsOworCisgICAgVmlld0dyb3VwIG1QaWxlOworICAgIFRleHRWaWV3IG1DbGVhckJ1dHRvbjsKKworICAgIEltYWdlVmlldyBtQmF0dGVyeU1ldGVyOworICAgIEltYWdlVmlldyBtU2lnbmFsTWV0ZXI7CisgICAgSW1hZ2VWaWV3IG1TaWduYWxJY29uOworCisgICAgVmlldyBtQmFyQ29udGVudHM7CisgICAgVmlldyBtQ3VydGFpbnM7CisKKyAgICBOb3RpZmljYXRpb25JY29uQXJlYS5JY29uTGF5b3V0IG1JY29uTGF5b3V0OworCisgICAgS2lja2VyQ29udHJvbGxlciBtS2lja2VyOworICAgIFZpZXcgbUtpY2tlclZpZXc7CisgICAgYm9vbGVhbiBtVGlja2luZzsKKyAgICBib29sZWFuIG1FeHBhbmRlZFZpc2libGU7CisKKyAgICAvLyBmb3IgZGlzYWJsaW5nIHRoZSBzdGF0dXMgYmFyCisgICAgaW50IG1EaXNhYmxlZCA9IDA7CisKKyAgICBwcm90ZWN0ZWQgdm9pZCBhZGRQYW5lbFdpbmRvd3MoKSB7CisgICAgICAgIGZpbmFsIFJlc291cmNlcyByZXMgPSBnZXRSZXNvdXJjZXMoKTsKKyAgICAgICAgZmluYWwgaW50IGJhckhlaWdodD0g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jhdml0eS5GSUxMX0hPUklaT05UQUw7CisgICAgfQorCisgICAgcHJpdmF0ZSBjbGFzcyBIIGV4dGVuZHMgSGFuZGxlciB7CisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IE1TR19PUEVOX05PVElGSUNBVElPTl9QQU5FTCA9IDEwMDA7CisgICAgICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgaW50IE1TR19DTE9TRV9OT1RJRklDQVRJT05fUEFORUwgPSAxMDAxOworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBNU0dfT1BFTl9TWVNURU1fUEFORUwgPSAxMDEwOworICAgICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBNU0dfQ0xPU0VfU1lTVEVNX1BBTkVMID0gMTAxMTsKKyAgICAgICAgcHVibGljIHZvaWQgaGFuZGxlTWVzc2FnZShNZXNzYWdlIG0pIHsKKyAgICAgICAgICAgIHN3aXRjaCAobS53aGF0KSB7CisgICAgICAgICAgICAgICAgY2FzZSBNU0dfT1BFTl9OT1RJRklDQVRJT05fUEFORUw6CisgICAgICAgICAgICAgICAgICAgIGlmIChERUJVRykgU2xvZy5kKFRBRywgIm9wZW5pbmcgbm90aWZpY2F0aW9ucyBwYW5lbCIpOworICAgICAgICAgICAgICAgICAgICBtTm90aWZpY2F0aW9uUGFuZWwuc2V0VmlzaWJpbGl0eShWaWV3LlZJU0lCTEUpOworICAgICAgICAgICAgICAgICAgICBtRXhwYW5kZWRWaXNpYmxlID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBNU0dfQ0xPU0VfTk9USUZJQ0FUSU9OX1BBTkVMOgorICAgICAgICAgICAgICAgICAgICBpZiAoREVCVUcpIFNsb2cuZChUQUcsICJjbG9zaW5nIG5vdGlmaWNhdGlvbnMgcGFuZWwiKTsKKyAgICAgICAgICAgICAgICAgICAgbU5vdGlmaWNhdGlvblBhbmVsLnNldFZpc2liaWxpdHkoVmlldy5HT05FKTsKKyAgICAgICAgICAgICAgICAgICAgbUV4cGFuZGVkVmlzaWJsZSA9IGZhbHNlOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIE1TR19PUEVOX1NZU1RFTV9QQU5FTDoKKyAgICAgICAgICAgICAgICAgICAgaWYgKERFQlVHKSBTbG9nLmQoVEFHLCAib3BlbmluZyBzeXN0ZW0gcGFuZWwiKTsKKyAgICAgICAgICAgICAgICAgICAgbVN5c3RlbVBhbmVsLnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBNU0dfQ0xPU0VfU1lTVEVNX1BBTkVMOgorICAgICAgICAgICAgICAgICAgICBpZiAoREVCVUcpIFNsb2cuZChUQUcsICJjbG9zaW5nIHN5c3RlbSBwYW5lbCIpOworICAgICAgICAgICAgICAgICAgICBtU3lzdGVtUGFuZWwuc2V0VmlzaWJpbGl0eShWaWV3LkdPTkUpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKyAgICAKKyAgICBwdWJsaWMgdm9pZCBzZXRCYXR0ZXJ5TWV0ZXIoaW50IGxldmVsLCBib29sZWFuIHBsdWdnZWQpIHsKKyAgICAgICAgaWYgKERFQlVHKSBTbG9nLmQoVEFHLCAiYmF0dGVyeT0iICsgbGV2ZWwgKyAocGx1Z2dlZCA/ICIgLSBwbHVnZ2VkIiA6ICIgLSB1bnBsdWdnZWQiKSk7CisgICAgICAgIG1CYXR0ZXJ5TWV0ZXIuc2V0SW1hZ2VSZXNvdXJjZShSLmRyYXdhYmxlLnN5c2Jhcl9iYXR0ZXJ5bWluaSk7CisgICAgICAgIC8vIGFkanVzdCBwZXJjZW50IHRvIHBlcm15cmlhZCBmb3IgQ2xpcERyYXdhYmxlJ3Mgc2FrZQorICAgICAgICBtQmF0dGVyeU1ldGVyLnNldEltYWdlTGV2ZWwobGV2ZWwgKiAoTUFYX0lNQUdFX0xFVkVMIC8gMTAwKSk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc2V0U2lnbmFsTWV0ZXIoaW50IGxldmVsLCBib29sZWFuIGlzV2lmaSkgeworICAgICAgICBpZiAoREVCVUcpIFNsb2cuZChUQUcsICJzaWduYWw9IiArIGxldmVsKTsKKyAgICAgICAgaWYgKGxldmVsIDwgMCkgeworICAgICAgICAgICAgbVNpZ25hbE1ldGVyLnNldEltYWdlRHJhd2FibGUobnVsbCk7CisgICAgICAgICAgICBtU2lnbmFsTWV0ZXIuc2V0SW1hZ2VMZXZlbCgwKTsKKyAgICAgICAgICAgIG1TaWduYWxJY29uLnNldEltYWdlRHJhd2FibGUobnVsbCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBtU2lnbmFsTWV0ZXIuc2V0SW1hZ2VSZXNvdXJjZShSLmRyYXdhYmxlLnN5c2Jhcl93aWZpbWluaSk7CisgICAgICAgICAgICAvLyBhZGp1c3QgdG8gcGVybXlyaWFkCisgICAgICAgICAgICBtU2lnbmFsTWV0ZXIuc2V0SW1hZ2VMZXZlbChsZXZlbCAqIChNQVhfSU1BR0VfTEVWRUwgLyAxMDApKTsKKyAgICAgICAgICAgIG1TaWduYWxJY29uLnNldEltYWdlUmVzb3VyY2UoaXNXaWZpID8gUi5kcmF3YWJsZS5pY19zeXNiYXJfd2lmaV9taW5pIAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOiBSLmRyYXdhYmxlLmljX3N5c2Jhcl93aWZpX21pbmkpOyAvLyBYWFgKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGFkZEljb24oU3RyaW5nIHNsb3QsIGludCBpbmRleCwgaW50IHZpZXdJbmRleCwgU3RhdHVzQmFySWNvbiBpY29uKSB7CisgICAgICAgIGlmIChERUJVRykgU2xvZy5kKFRBRywgImFkZEljb24oIiArIHNsb3QgKyAiKSAtPiAiICsgaWNvbik7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdXBkYXRlSWNvbihTdHJpbmcgc2xvdCwgaW50IGluZGV4LCBpbnQgdmlld0luZGV4LAorICAgICAgICAgICAgU3RhdHVzQmFySWNvbiBvbGQsIFN0YXR1c0Jhckljb24gaWNvbikgeworICAgICAgICBpZiAoREVCVUcpIFNsb2cuZChUQUcsICJ1cGRhdGVJY29uKCIgKyBzbG90ICsgIikgLT4gIiArIGljb24pOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHJlbW92ZUljb24oU3RyaW5nIHNsb3QsIGludCBpbmRleCwgaW50IHZpZXdJbmRleCkgeworICAgICAgICBpZiAoREVCVUcpIFNsb2cuZChUQUcsICJyZW1vdmVJY29uKCIgKyBzbG90ICsgIikiKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBhZGROb3RpZmljYXRpb24oSUJpbmRlciBrZXksIFN0YXR1c0Jhck5vdGlmaWNhdGlvbiBub3RpZmljYXRpb24pIHsKKyAgICAgICAgaWYgKERFQlVHKSBTbG9nLmQoVEFHLCAiYWRkTm90aWZpY2F0aW9uKCIgKyBrZXkgKyAiIC0+ICIgKyBub3RpZmljYXRpb24gKyAiKSIpOworICAgICAgICBhZGROb3RpZmljYXRpb25WaWV3cyhrZXksIG5vdGlmaWNhdGlvbik7CisKKyAgICAgICAgYm9vbGVhbiBpbW1lcnNpdmUgPSBmYWxzZTsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIGltbWVyc2l2ZSA9IEFjdGl2aXR5TWFuYWdlck5hdGl2ZS5nZXREZWZhdWx0KCkuaXNUb3BBY3Rpdml0eUltbWVyc2l2ZSgpOworICAgICAgICAgICAgU2xvZy5kKFRBRywgIlRvcCBhY3Rpdml0eSBpcyAiICsgKGltbWVyc2l2ZT8iaW1tZXJzaXZlIjoibm90IGltbWVyc2l2ZSIpKTsKKyAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGV4KSB7CisgICAgICAgIH0KKyAgICAgICAgaWYgKGltbWVyc2l2ZSkgeworICAgICAgICAgICAgLy8gVE9ETzogaW1tZXJzaXZlIG1vZGUgcG9wdXBzIGZvciB0YWJsZXQKKyAgICAgICAgfSBlbHNlIGlmIChub3RpZmljYXRpb24ubm90aWZpY2F0aW9uLmZ1bGxTY3JlZW5JbnRlbnQgIT0gbnVsbCkgeworICAgICAgICAgICAgLy8gbm90IGltbWVyc2l2ZSAmIGEgZnVsbC1zY3JlZW4gYWxlcnQgc2hvdWxkIGJlIHNob3duCisgICAgICAgICAgICBTbG9nLmQoVEFHLCAiTm90aWZpY2F0aW9uIGhhcyBmdWxsU2NyZWVuSW50ZW50IGFuZCBhY3Rpdml0eSBpcyBub3QgaW1tZXJzaXZlOyIKKyAgICAgICAgICAgICAgICAgICAgKyAiIHNlbmRpbmcgZnVsbFNjcmVlbkludGVudCIpOworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICBub3RpZmljYXRpb24ubm90aWZpY2F0aW9uLmZ1bGxTY3JlZW5JbnRlbnQuc2VuZCgpOworICAgICAgICAgICAgfSBjYXRjaCAoUGVuZGluZ0ludGVudC5DYW5jZWxlZEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAvLyB0aWNrKCkKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHVwZGF0ZU5vdGlmaWNhdGlvbihJQmluZGVyIGtleSwgU3RhdHVzQmFyTm90aWZpY2F0aW9uIG5vdGlmaWNhdGlvbikgeworICAgICAgICBpZiAoREVCVUcpIFNsb2cuZChUQUcsICJ1cGRhdGVOb3RpZmljYXRpb24oIiArIGtleSArICIgLT4gIiArIG5vdGlmaWNhdGlvbiArICIpIC8vIFRPRE8iKTsKKyAgICAgICAgCisgICAgICAgIGZpbmFsIE5vdGlmaWNhdGlvbkRhdGEuRW50cnkgb2xkRW50cnkgPSBtTm90bnMuZmluZEJ5S2V5KGtleSk7CisgICAgICAgIGlmIChvbGRFbnRyeSA9PSBudWxsKSB7CisgICAgICAgICAgICBTbG9nLncoVEFHLCAidXBkYXRlTm90aWZpY2F0aW9uIGZvciB1bmtub3duIGtleTogIiArIGtleSk7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKworICAgICAgICBmaW5hbCBTdGF0dXNCYXJOb3RpZmljYXRpb24gb2xkTm90aWZpY2F0aW9uID0gb2xkRW50cnkubm90aWZpY2F0aW9uOworICAgICAgICBmaW5hbCBSZW1vdGVWaWV3cyBvbGRDb250ZW50VmlldyA9IG9sZE5vdGlmaWNhdGlvbi5ub3RpZmljYXRpb24uY29udGVudFZpZXc7CisKKyAgICAgICAgZmluYWwgUmVtb3RlVmlld3MgY29udGVudFZpZXcgPSBub3RpZmljYXRpb24ubm90aWZpY2F0aW9uLmNvbnRlbnRWaWV3OworCisgICAgICAgIGlmIChmYWxzZSkgeworICAgICAgICAgICAgU2xvZy5kKFRBRywgIm9sZCBub3RpZmljYXRpb246IHdoZW49IiArIG9sZE5vdGlmaWNhdGlvbi5ub3RpZmljYXRpb24ud2hlbgorICAgICAgICAgICAgICAgICAgICArICIgb25nb2luZz0iICsgb2xkTm90aWZpY2F0aW9uLmlzT25nb2luZygpCisgICAgICAgICAgICAgICAgICAgICsgIiBleHBhbmRlZD0iICsgb2xkRW50cnkuZXhwYW5kZWQKKyAgICAgICAgICAgICAgICAgICAgKyAiIGNvbnRlbnRWaWV3PSIgKyBvbGRDb250ZW50Vmlldyk7CisgICAgICAgICAgICBTbG9nLmQoVEFHLCAibmV3IG5vdGlmaWNhdGlvbjogd2hlbj0iICsgbm90aWZpY2F0aW9uLm5vdGlmaWNhdGlvbi53aGVuCisgICAgICAgICAgICAgICAgICAgICsgIiBvbmdvaW5nPSIgKyBvbGROb3RpZmljYXRpb24uaXNPbmdvaW5nKCkKKyAgICAgICAgICAgICAgICAgICAgKyAiIGNvbnRlbnRWaWV3PSIgKyBjb250ZW50Vmlldyk7CisgICAgICAgIH0KKworICAgICAgICAvLyBDYW4gd2UganVzdCByZWFwcGx5IHRoZSBSZW1vdGVWaWV3cyBpbiBwbGFjZT8gIElmIHdoZW4gZGlkbid0IGNoYW5nZSwgdGhlIG9yZGVyCisgICAgICAgIC8vIGRpZG4ndCBjaGFuZ2UuCisgICAgICAgIGlmIChub3RpZmljYXRpb24ubm90aWZpY2F0aW9uLndoZW4gPT0gb2xkTm90aWZpY2F0aW9uLm5vdGlmaWNhdGlvbi53aGVuCisgICAgICAgICAgICAgICAgJiYgbm90aWZpY2F0aW9uLmlzT25nb2luZygpID09IG9sZE5vdGlmaWNhdGlvbi5pc09uZ29pbmcoKQorICAgICAgICAgICAgICAgICYmIG9sZEVudHJ5LmV4cGFuZGVkICE9IG51bGwKKyAgICAgICAgICAgICAgICAmJiBjb250ZW50VmlldyAhPSBudWxsCisgICAgICAgICAgICAgICAgJiYgb2xkQ29udGVudFZpZXcgIT0gbnVsbAorICAgICAgICAgICAgICAgICYmIGNvbnRlbnRWaWV3LmdldFBhY2thZ2UoKSAhPSBudWxsCisgICAgICAgICAgICAgICAgJiYgb2xkQ29udGVudFZpZXcuZ2V0UGFja2FnZSgpICE9IG51bGwKKyAgICAgICAgICAgICAgICAmJiBvbGRDb250ZW50Vmlldy5nZXRQYWNrYWdlKCkuZXF1YWxzKGNvbnRlbnRWaWV3LmdldFBhY2thZ2UoKSkKKyAgICAgICAgICAgICAgICAmJiBvbGRDb250ZW50Vmlldy5nZXRMYXlvdXRJZCgpID09IGNvbnRlbnRWaWV3LmdldExheW91dElkKCkpIHsKKyAgICAgICAgICAgIGlmIChERUJVRykgU2xvZy5kKFRBRywgInJldXNpbmcgbm90aWZpY2F0aW9uIGZvciBrZXk6ICIgKyBrZXkpOworICAgICAgICAgICAgb2xkRW50cnkubm90aWZpY2F0aW9uID0gbm90aWZpY2F0aW9uOworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAvLyBSZWFwcGx5IHRoZSBSZW1vdGVWaWV3cworICAgICAgICAgICAgICAgIGNvbnRlbnRWaWV3LnJlYXBwbHkodGhpcywgb2xkRW50cnkuY29udGVudCk7CisgICAgICAgICAgICAgICAgLy8gdXBkYXRlIHRoZSBjb250ZW50SW50ZW50CisgICAgICAgICAgICAgICAgZmluYWwgUGVuZGluZ0ludGVudCBjb250ZW50SW50ZW50ID0gbm90aWZpY2F0aW9uLm5vdGlmaWNhdGlvbi5jb250ZW50SW50ZW50OworICAgICAgICAgICAgICAgIGlmIChjb250ZW50SW50ZW50ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgb2xkRW50cnkuY29udGVudC5zZXRPbkNsaWNrTGlzdGVuZXIobmV3IE5vdGlmaWNhdGlvbkNsaWNrZXIoY29udGVudEludGVudCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbm90aWZpY2F0aW9uLnBrZywgbm90aWZpY2F0aW9uLnRhZywgbm90aWZpY2F0aW9uLmlkKSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIC8vIFVwZGF0ZSB0aGUgaWNvbi4KKyAgICAgICAgICAgICAgICBmaW5hbCBTdGF0dXNCYXJJY29uIGljID0gbmV3IFN0YXR1c0Jhckljb24obm90aWZpY2F0aW9uLnBrZywKKyAgICAgICAgICAgICAgICAgICAgICAgIG5vdGlmaWNhdGlvbi5ub3RpZmljYXRpb24uaWNvbiwgbm90aWZpY2F0aW9uLm5vdGlmaWNhdGlvbi5pY29uTGV2ZWwsCisgICAgICAgICAgICAgICAgICAgICAgICBub3RpZmljYXRpb24ubm90aWZpY2F0aW9uLm51bWJlcik7CisgICAgICAgICAgICAgICAgaWYgKCFvbGRFbnRyeS5pY29uLnNldChpYykpIHsKKyAgICAgICAgICAgICAgICAgICAgaGFuZGxlTm90aWZpY2F0aW9uRXJyb3Ioa2V5LCBub3RpZmljYXRpb24sICJDb3VsZG4ndCB1cGRhdGUgaWNvbjogIiArIGljKTsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGNhdGNoIChSdW50aW1lRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAvLyBJdCBmYWlsZWQgdG8gYWRkIGNsZWFubHkuICBMb2csIGFuZCByZW1vdmUgdGhlIHZpZXcgZnJvbSB0aGUgcGFuZWwuCisgICAgICAgICAgICAgICAgU2xvZy53KFRBRywgIkNvdWxkbid0IHJlYXBwbHkgdmlld3MgZm9yIHBhY2thZ2UgIiArIGNvbnRlbnRWaWV3LmdldFBhY2thZ2UoKSwgZSk7CisgICAgICAgICAgICAgICAgcmVtb3ZlTm90aWZpY2F0aW9uVmlld3Moa2V5KTsKKyAgICAgICAgICAgICAgICBhZGROb3RpZmljYXRpb25WaWV3cyhrZXksIG5vdGlmaWNhdGlvbik7CisgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBpZiAoREVCVUcpIFNsb2cuZChUQUcsICJub3QgcmV1c2luZyBub3RpZmljYXRpb24gZm9yIGtleTogIiArIGtleSk7CisgICAgICAgICAgICByZW1vdmVOb3RpZmljYXRpb25WaWV3cyhrZXkpOworICAgICAgICAgICAgYWRkTm90aWZpY2F0aW9uVmlld3Moa2V5LCBub3RpZmljYXRpb24pOworICAgICAgICB9CisgICAgICAgIC8vIFRPRE86IGtpY2tlcjsgaW1tZXJzaXZlIG1vZGUKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCByZW1vdmVOb3RpZmljYXRpb24oSUJpbmRlciBrZXkpIHsKKyAgICAgICAgaWYgKERFQlVHKSBTbG9nLmQoVEFHLCAicmVtb3ZlTm90aWZpY2F0aW9uKCIgKyBrZXkgKyAiKSAvLyBUT0RPIik7CisgICAgICAgIHJlbW92ZU5vdGlmaWNhdGlvblZpZXdzKGtleSk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgZGlzYWJsZShpbnQgc3RhdGUpIHsKKyAgICAgICAgLyoKKyAgICAgICAgZmluYWwgaW50IG9sZCA9IG1EaXNhYmxlZDsKKyAgICAgICAgZmluYWwgaW50IGRpZmYgPSBzdGF0ZSBeIG9sZDsKKyAgICAgICAgbURpc2FibGVkID0gc3RhdGU7CisKKyAgICAgICAgaWYgKChkaWZmICYgU3RhdHVzQmFyTWFuYWdlci5ESVNBQkxFX0VYUEFORCkgIT0gMCkgeworICAgICAgICAgICAgaWYgKChzdGF0ZSAmIFN0YXR1c0Jhck1hbmFnZXIuRElTQUJMRV9FWFBBTkQpICE9IDApIHsKKyAgICAgICAgICAgICAgICBTbG9nLmQoVEFHLCAiRElTQUJMRV9FWFBBTkQ6IHllcyIpOworICAgICAgICAgICAgICAgIGFuaW1hdGVDb2xsYXBzZSgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIGlmICgoZGlmZiAmIFN0YXR1c0Jhck1hbmFnZXIuRElTQUJMRV9OT1RJRklDQVRJT05fSUNPTlMpICE9IDApIHsKKyAgICAgICAgICAgIGlmICgoc3RhdGUgJiBTdGF0dXNCYXJNYW5hZ2VyLkRJU0FCTEVfTk9USUZJQ0FUSU9OX0lDT05TKSAhPSAwKSB7CisgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgIkRJU0FCTEVfTk9USUZJQ0FUSU9OX0lDT05TOiB5ZXMiKTsKKyAgICAgICAgICAgICAgICBpZiAobVRpY2tpbmcpIHsKKyAgICAgICAgICAgICAgICAgICAgbUtpY2tlci5oYWx0KCk7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgbU5vdGlmaWNhdGlvbkljb25BcmVhLnNldFZpc2liaWxpdHkoVmlldy5JTlZJU0lCTEUpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgIkRJU0FCTEVfTk9USUZJQ0FUSU9OX0lDT05TOiBubyIpOworICAgICAgICAgICAgICAgIGlmICghbUV4cGFuZGVkVmlzaWJsZSkgeworICAgICAgICAgICAgICAgICAgICBtTm90aWZpY2F0aW9uSWNvbkFyZWEuc2V0VmlzaWJpbGl0eShWaWV3LlZJU0lCTEUpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBlbHNlIGlmICgoZGlmZiAmIFN0YXR1c0Jhck1hbmFnZXIuRElTQUJMRV9OT1RJRklDQVRJT05fVElDS0VSKSAhPSAwKSB7CisgICAgICAgICAgICBpZiAobVRpY2tpbmcgJiYgKHN0YXRlICYgU3RhdHVzQmFyTWFuYWdlci5ESVNBQkxFX05PVElGSUNBVElPTl9USUNLRVIpICE9IDApIHsKKyAgICAgICAgICAgICAgICBTbG9nLmQoVEFHLCAiRElTQUJMRV9OT1RJRklDQVRJT05fVElDS0VSOiB5ZXMiKTsKKyAgICAgICAgICAgICAgICBtS2lja2VyLmhhbHQoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICAqLworICAgIH0KKworICAgIHZvaWQgcGVyZm9ybURpc2FibGVBY3Rpb25zKGludCBuZXQpIHsKKyAgICAgICAgLyoKKyAgICAgICAgaW50IG9sZCA9IG1EaXNhYmxlZDsKKyAgICAgICAgaW50IGRpZmYgPSBuZXQgXiBvbGQ7CisgICAgICAgIG1EaXNhYmxlZCA9IG5ldDsKKworICAgICAgICAvLyBhY3QgYWNjb3JkaW5nbHkKKyAgICAgICAgaWYgKChkaWZmICYgU3RhdHVzQmFyTWFuYWdlci5ESVNBQkxFX0VYUEFORCkgIT0gMCkgeworICAgICAgICAgICAgaWYgKChuZXQgJiBTdGF0dXNCYXJNYW5hZ2VyLkRJU0FCTEVfRVhQQU5EKSAhPSAwKSB7CisgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgIkRJU0FCTEVfRVhQQU5EOiB5ZXMiKTsKKyAgICAgICAgICAgICAgICBhbmltYXRlQ29sbGFwc2UoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBpZiAoKGRpZmYgJiBTdGF0dXNCYXJNYW5hZ2VyLkRJU0FCTEVfTk9USUZJQ0FUSU9OX0lDT05TKSAhPSAwKSB7CisgICAgICAgICAgICBpZiAoKG5ldCAmIFN0YXR1c0Jhck1hbmFnZXIuRElTQUJMRV9OT1RJRklDQVRJT05fSUNPTlMpICE9IDApIHsKKyAgICAgICAgICAgICAgICBTbG9nLmQoVEFHLCAiRElTQUJMRV9OT1RJRklDQVRJT05fSUNPTlM6IHllcyIpOworICAgICAgICAgICAgICAgIGlmIChtVGlja2luZykgeworICAgICAgICAgICAgICAgICAgICBtTm90aWZpY2F0aW9uSWNvbkFyZWEuc2V0VmlzaWJpbGl0eShWaWV3LklOVklTSUJMRSk7CisgICAgICAgICAgICAgICAgICAgIG1LaWNrZXIuaGFsdCgpOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIG1Ob3RpZmljYXRpb25JY29uQXJlYS5zZXRWaXNpYmlsaXR5KFZpZXcuSU5WSVNJQkxFKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIFNsb2cuZChUQUcsICJESVNBQkxFX05PVElGSUNBVElPTl9JQ09OUzogbm8iKTsKKyAgICAgICAgICAgICAgICBpZiAoIW1FeHBhbmRlZFZpc2libGUpIHsKKyAgICAgICAgICAgICAgICAgICAgbU5vdGlmaWNhdGlvbkljb25BcmVhLnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0gZWxzZSBpZiAoKGRpZmYgJiBTdGF0dXNCYXJNYW5hZ2VyLkRJU0FCTEVfTk9USUZJQ0FUSU9OX1RJQ0tFUikgIT0gMCkgeworICAgICAgICAgICAgaWYgKG1UaWNraW5nICYmIChuZXQgJiBTdGF0dXNCYXJNYW5hZ2VyLkRJU0FCTEVfTk9USUZJQ0FUSU9OX1RJQ0tFUikgIT0gMCkgeworICAgICAgICAgICAgICAgIG1LaWNrZXIuaGFsdCgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgICovCisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIHRpY2soU3RhdHVzQmFyTm90aWZpY2F0aW9uIG4pIHsKKyAgICAgICAgLy8gU2hvdyB0aGUgdGlja2VyIGlmIG9uZSBpcyByZXF1ZXN0ZWQuIEFsc28gZG9uJ3QgZG8gdGhpcworICAgICAgICAvLyB1bnRpbCBzdGF0dXMgYmFyIHdpbmRvdyBpcyBhdHRhY2hlZCB0byB0aGUgd2luZG93IG1hbmFnZXIsCisgICAgICAgIC8vIGJlY2F1c2UuLi4gIHdlbGwsIHdoYXQncyB0aGUgcG9pbnQgb3RoZXJ3aXNlPyAgQW5kIHRyeWluZyB0bworICAgICAgICAvLyBydW4gYSB0aWNrZXIgd2l0aG91dCBiZWluZyBhdHRhY2hlZCB3aWxsIGNyYXNoIQorICAgICAgICBpZiAobi5ub3RpZmljYXRpb24udGlja2VyVGV4dCAhPSBudWxsICYmIG1TdGF0dXNCYXJWaWV3LmdldFdpbmRvd1Rva2VuKCkgIT0gbnVsbCkgeworICAgICAgICAgICAgaWYgKDAgPT0gKG1EaXNhYmxlZCAmIChTdGF0dXNCYXJNYW5hZ2VyLkRJU0FCTEVfTk9USUZJQ0FUSU9OX0lDT05TCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCBTdGF0dXNCYXJNYW5hZ2VyLkRJU0FCTEVfTk9USUZJQ0FUSU9OX1RJQ0tFUikpKSB7CisgICAgICAgICAgICAgICAgbUtpY2tlci5hZGRFbnRyeShuKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgY2xhc3MgS2lja2VyQ29udHJvbGxlciB7CisgICAgICAgIFZpZXcgbVZpZXc7CisgICAgICAgIEltYWdlVmlldyBtS2lja2VySWNvbjsKKyAgICAgICAgVGV4dFN3aXRjaGVyIG1LaWNrZXJUZXh0OworCisgICAgICAgIHB1YmxpYyBLaWNrZXJDb250cm9sbGVyKENvbnRleHQgY29udGV4dCwgVmlldyBzYikgeworICAgICAgICAgICAgbVZpZXcgPSBzYi5maW5kVmlld0J5SWQoUi5pZC50aWNrZXIpOworICAgICAgICAgICAgbUtpY2tlckljb24gPSAoSW1hZ2VWaWV3KSBtVmlldy5maW5kVmlld0J5SWQoUi5pZC50aWNrZXJJY29uKTsKKyAgICAgICAgICAgIG1LaWNrZXJUZXh0ID0gKFRleHRTd2l0Y2hlcikgbVZpZXcuZmluZFZpZXdCeUlkKFIuaWQudGlja2VyVGV4dCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBoYWx0KCkgeworICAgICAgICAgICAgdGlja2VySGFsdGluZygpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgYWRkRW50cnkoU3RhdHVzQmFyTm90aWZpY2F0aW9uIG4pIHsKKyAgICAgICAgICAgIG1LaWNrZXJJY29uLnNldEltYWdlUmVzb3VyY2Uobi5ub3RpZmljYXRpb24uaWNvbik7CisgICAgICAgICAgICBtS2lja2VyVGV4dC5zZXRDdXJyZW50VGV4dChuLm5vdGlmaWNhdGlvbi50aWNrZXJUZXh0KTsKKyAgICAgICAgICAgIHRpY2tlclN0YXJ0aW5nKCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCB0aWNrZXJTdGFydGluZygpIHsKKyAgICAgICAgICAgIG1UaWNraW5nID0gdHJ1ZTsKKyAgICAgICAgICAgIG1JY29uTGF5b3V0LnNldFZpc2liaWxpdHkoVmlldy5HT05FKTsKKyAgICAgICAgICAgIG1LaWNrZXJWaWV3LnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyB2b2lkIHRpY2tlckRvbmUoKSB7CisgICAgICAgICAgICBtSWNvbkxheW91dC5zZXRWaXNpYmlsaXR5KFZpZXcuVklTSUJMRSk7CisgICAgICAgICAgICBtS2lja2VyVmlldy5zZXRWaXNpYmlsaXR5KFZpZXcuR09ORSk7CisgICAgICAgICAgICBtVGlja2luZyA9IGZhbHNlOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgdGlja2VySGFsdGluZygpIHsKKyAgICAgICAgICAgIG1JY29uTGF5b3V0LnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKKyAgICAgICAgICAgIG1LaWNrZXJWaWV3LnNldFZpc2liaWxpdHkoVmlldy5HT05FKTsKKyAgICAgICAgICAgIG1UaWNraW5nID0gZmFsc2U7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBhbmltYXRlRXhwYW5kKCkgeworICAgICAgICBtSGFuZGxlci5yZW1vdmVNZXNzYWdlcyhILk1TR19PUEVOX05PVElGSUNBVElPTl9QQU5FTCk7CisgICAgICAgIG1IYW5kbGVyLnNlbmRFbXB0eU1lc3NhZ2UoSC5NU0dfT1BFTl9OT1RJRklDQVRJT05fUEFORUwpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGFuaW1hdGVDb2xsYXBzZSgpIHsKKyAgICAgICAgbUhhbmRsZXIucmVtb3ZlTWVzc2FnZXMoSC5NU0dfQ0xPU0VfTk9USUZJQ0FUSU9OX1BBTkVMKTsKKyAgICAgICAgbUhhbmRsZXIuc2VuZEVtcHR5TWVzc2FnZShILk1TR19DTE9TRV9OT1RJRklDQVRJT05fUEFORUwpOworICAgICAgICBtSGFuZGxlci5yZW1vdmVNZXNzYWdlcyhILk1TR19DTE9TRV9TWVNURU1fUEFORUwpOworICAgICAgICBtSGFuZGxlci5zZW5kRW1wdHlNZXNzYWdlKEguTVNHX0NMT1NFX1NZU1RFTV9QQU5FTCk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgbm90aWZpY2F0aW9uSWNvbnNDbGlja2VkKFZpZXcgdikgeworICAgICAgICBpZiAoREVCVUcpIFNsb2cuZChUQUcsICJjbGlja2VkIG5vdGlmaWNhdGlvbiBpY29ucyIpOworICAgICAgICBtSGFuZGxlci5yZW1vdmVNZXNzYWdlcyhILk1TR19DTE9TRV9TWVNURU1fUEFORUwpOworICAgICAgICBtSGFuZGxlci5zZW5kRW1wdHlNZXNzYWdlKEguTVNHX0NMT1NFX1NZU1RFTV9QQU5FTCk7CisKKyAgICAgICAgaW50IG1zZyA9IChtTm90aWZpY2F0aW9uUGFuZWwuZ2V0VmlzaWJpbGl0eSgpID09IFZpZXcuR09ORSkgCisgICAgICAgICAgICA/IEguTVNHX09QRU5fTk9USUZJQ0FUSU9OX1BBTkVMCisgICAgICAgICAgICA6IEguTVNHX0NMT1NFX05PVElGSUNBVElPTl9QQU5FTDsKKyAgICAgICAgbUhhbmRsZXIucmVtb3ZlTWVzc2FnZXMobXNnKTsKKyAgICAgICAgbUhhbmRsZXIuc2VuZEVtcHR5TWVzc2FnZShtc2cpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHN5c3RlbUluZm9DbGlja2VkKFZpZXcgdikgeworICAgICAgICBpZiAoREVCVUcpIFNsb2cuZChUQUcsICJjbGlja2VkIHN5c3RlbSBpbmZvIik7CisgICAgICAgIG1IYW5kbGVyLnJlbW92ZU1lc3NhZ2VzKEguTVNHX0NMT1NFX05PVElGSUNBVElPTl9QQU5FTCk7CisgICAgICAgIG1IYW5kbGVyLnNlbmRFbXB0eU1lc3NhZ2UoSC5NU0dfQ0xPU0VfTk9USUZJQ0FUSU9OX1BBTkVMKTsKKworICAgICAgICBpbnQgbXNnID0gKG1TeXN0ZW1QYW5lbC5nZXRWaXNpYmlsaXR5KCkgPT0gVmlldy5HT05FKSAKKyAgICAgICAgICAgID8gSC5NU0dfT1BFTl9TWVNURU1fUEFORUwKKyAgICAgICAgICAgIDogSC5NU0dfQ0x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jaCAoUmVtb3RlRXhjZXB0aW9uIGV4KSB7CisgICAgICAgICAgICAvLyBUaGUgZW5kIGlzIG5pZ2guCisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIFZpZXcuT25DbGlja0xpc3RlbmVyIG1DbGVhckJ1dHRvbkxpc3RlbmVyID0gbmV3IFZpZXcuT25DbGlja0xpc3RlbmVyKCkgeworICAgICAgICBwdWJsaWMgdm9pZCBvbkNsaWNrKFZpZXcgdikgeworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICBtQmFyU2VydmljZS5vbkNsZWFyQWxsTm90aWZpY2F0aW9ucygpOworICAgICAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGV4KSB7CisgICAgICAgICAgICAgICAgLy8gc3lzdGVtIHByb2Nlc3MgaXMgZGVhZCBpZiB3ZSdyZSBoZXJlLgorICAgICAgICAgICAgfQorICAgICAgICAgICAgYW5pbWF0ZUNvbGxhcHNlKCk7CisgICAgICAgIH0KKyAgICB9OworCisgICAgcHJpdmF0ZSBjbGFzcyBOb3RpZmljYXRpb25DbGlja2VyIGltcGxlbWVudHMgVmlldy5PbkNsaWNrTGlzdGVuZXIgeworICAgICAgICBwcml2YXRlIFBlbmRpbmdJbnRlbnQgbUludGVudDsKKyAgICAgICAgcHJpdmF0ZSBTdHJpbmcgbVBrZzsKKyAgICAgICAgcHJpdmF0ZSBTdHJpbmcgbVRhZzsKKyAgICAgICAgcHJpdmF0ZSBpbnQgbUlkOworCisgICAgICAgIE5vdGlmaWNhdGlvbkNsaWNrZXIoUGVuZGluZ0ludGVudCBpbnRlbnQsIFN0cmluZyBwa2csIFN0cmluZyB0YWcsIGludCBpZCkgeworICAgICAgICAgICAgbUludGVudCA9IGludGVudDsKKyAgICAgICAgICAgIG1Qa2cgPSBwa2c7CisgICAgICAgICAgICBtVGFnID0gdGFnOworICAgICAgICAgICAgbUlkID0gaWQ7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCBvbkNsaWNrKFZpZXcgdikgeworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAvLyBUaGUgaW50ZW50IHdlIGFyZSBzZW5kaW5nIGlzIGZvciB0aGUgYXBwbGljYXRpb24sIHdoaWNoCisgICAgICAgICAgICAgICAgLy8gd29uJ3QgaGF2ZSBwZXJtaXNzaW9uIHRvIGltbWVkaWF0ZWx5IHN0YXJ0IGFuIGFjdGl2aXR5IGFmdGVyCisgICAgICAgICAgICAgICAgLy8gdGhlIHVzZXIgc3dpdGNoZXMgdG8gaG9tZS4gIFdlIGtub3cgaXQgaXMgc2FmZSB0byBkbyBhdCB0aGlzCisgICAgICAgICAgICAgICAgLy8gcG9pbnQsIHNvIG1ha2Ugc3VyZSBuZXcgYWN0aXZpdHkgc3dpdGNoZXMgYXJlIG5vdyBhbGxvd2VkLgorICAgICAgICAgICAgICAgIEFjdGl2aXR5TWFuYWdlck5hdGl2ZS5nZXREZWZhdWx0KCkucmVzdW1lQXBwU3dpdGNoZXMoKTsKKyAgICAgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmIChtSW50ZW50ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBpbnRbXSBwb3MgPSBuZXcgaW50WzJdOworICAgICAgICAgICAgICAgIHYuZ2V0TG9jYXRpb25PblNjcmVlbihwb3MpOworICAgICAgICAgICAgICAgIEludGVudCBvdmVybGF5ID0gbmV3IEludGVudCgpOworICAgICAgICAgICAgICAgIG92ZXJsYXkuc2V0U291cmNlQm91bmRzKAorICAgICAgICAgICAgICAgICAgICAgICAgbmV3IFJlY3QocG9zWzBdLCBwb3NbMV0sIHBvc1swXSt2LmdldFdpZHRoKCksIHBvc1sxXSt2LmdldEhlaWdodCgpKSk7CisgICAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAgICAgbUludGVudC5zZW5kKFRhYmxldFN0YXR1c0JhclNlcnZpY2UudGhpcywgMCwgb3ZlcmxheSk7CisgICAgICAgICAgICAgICAgfSBjYXRjaCAoUGVuZGluZ0ludGVudC5DYW5jZWxlZEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgICAgIC8vIHRoZSBzdGFjayB0cmFjZSBpc24ndCB2ZXJ5IGhlbHBmdWwgaGVyZS4gIEp1c3QgbG9nIHRoZSBleGNlcHRpb24gbWVzc2FnZS4KKyAgICAgICAgICAgICAgICAgICAgU2xvZy53KFRBRywgIlNlbmRpbmcgY29udGVudEludGVudCBmYWlsZWQ6ICIgKyBlKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgbUJhclNlcnZpY2Uub25Ob3RpZmljYXRpb25DbGljayhtUGtnLCBtVGFnLCBtSWQpOworICAgICAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGV4KSB7CisgICAgICAgICAgICAgICAgLy8gc3lzdGVtIHByb2Nlc3MgaXMgZGVhZCBpZiB3ZSdyZSBoZXJlLgorICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvLyBjbG9zZSB0aGUgc2hhZGUgaWYgaXQgd2FzIG9wZW4KKyAgICAgICAgICAgIGFuaW1hdGVDb2xsYXBzZSgpOworCisgICAgICAgICAgICAvLyBJZiB0aGlzIGNsaWNrIHdhcyBvbiB0aGUgaW50cnVkZXIgYWxlcnQsIGhpZGUgdGhhdCBpbnN0ZWFkCisvLyAgICAgICAgICAgIG1IYW5kbGVyLnNlbmRFbXB0eU1lc3NhZ2UoTVNHX0hJREVfSU5UUlVERVIpOworICAgICAgICB9CisgICAgfQorCisgICAgU3RhdHVzQmFyTm90aWZpY2F0aW9uIHJlbW92ZU5vdGlmaWNhdGlvblZpZXdzKElCaW5kZXIga2V5KSB7CisgICAgICAgIE5vdGlmaWNhdGlvbkRhdGEuRW50cnkgZW50cnkgPSBtTm90bnMucmVtb3ZlKGtleSk7CisgICAgICAgIGlmIChlbnRyeSA9PSBudWxsKSB7CisgICAgICAgICAgICBTbG9nLncoVEFHLCAicmVtb3ZlTm90aWZpY2F0aW9uIGZvciB1bmtub3duIGtleTogIiArIGtleSk7CisgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgfQorICAgICAgICAvLyBSZW1vdmUgdGhlIGV4cGFuZGVkIHZpZXcuCisgICAgICAgIFZpZXdHcm91cCByb3dQYXJlbnQgPSAoVmlld0dyb3VwKWVudHJ5LnJvdy5nZXRQYXJlbnQoKTsKKyAgICAgICAgaWYgKHJvd1BhcmVudCAhPSBudWxsKSByb3dQYXJlbnQucmVtb3ZlVmlldyhlbnRyeS5yb3cpOworICAgICAgICAvLyBSZW1vdmUgdGhlIGljb24uCisvLyAgICAgICAgVmlld0dyb3VwIGljb25QYXJlbnQgPSAoVmlld0dyb3VwKWVudHJ5Lmljb24uZ2V0UGFyZW50KCk7CisvLyAgICAgICAgaWYgKGljb25QYXJlbnQgIT0gbnVsbCkgaWNvblBhcmVudC5yZW1vdmVWaWV3KGVudHJ5Lmljb24pOworICAgICAgICByZWZyZXNoSWNvbnMoKTsKKworICAgICAgICByZXR1cm4gZW50cnkubm90aWZpY2F0aW9uOworICAgIH0KKworICAgIFN0YXR1c0Jhckljb25WaWV3IGFkZE5vdGlmaWNhdGlvblZpZXdzKElCaW5kZXIga2V5LCBTdGF0dXNCYXJOb3RpZmljYXRpb24gbm90aWZpY2F0aW9uKSB7CisgICAgICAgIGlmIChERUJVRykgeworICAgICAgICAgICAgU2xvZy5kKFRBRywgImFkZE5vdGlmaWNhdGlvblZpZXdzKGtleT0iICsga2V5ICsgIiwgbm90aWZpY2F0aW9uPSIgKyBub3RpZmljYXRpb24pOworICAgICAgICB9CisgICAgICAgIC8vIENvbnN0cnVjdCB0aGUgaWNvbi4KKyAgICAgICAgZmluYWwgU3RhdHVzQmFySWNvblZpZXcgaWNvblZpZXcgPSBuZXcgU3RhdHVzQmFySWNvblZpZXcodGhpcywKKyAgICAgICAgICAgICAgICBub3RpZmljYXRpb24ucGtnICsgIi8weCIgKyBJbnRlZ2VyLnRvSGV4U3RyaW5nKG5vdGlmaWNhdGlvbi5pZCkpOworICAgICAgICBpY29uVmlldy5zZXRTY2FsZVR5cGUoSW1hZ2VWaWV3LlNjYWxlVHlwZS5DRU5URVJfSU5TSURFKTsKKworICAgICAgICBmaW5hbCBTdGF0dXNCYXJJY29uIGljID0gbmV3IFN0YXR1c0Jhckljb24obm90aWZpY2F0aW9uLnBrZywKKyAgICAgICAgICAgICAgICAgICAgbm90aWZpY2F0aW9uLm5vdGlmaWNhdGlvbi5pY29uLAorICAgICAgICAgICAgICAgICAgICBub3RpZmljYXRpb24ubm90aWZpY2F0aW9uLmljb25MZXZlbCwKKyAgICAgICAgICAgICAgICAgICAgbm90aWZpY2F0aW9uLm5vdGlmaWNhdGlvbi5udW1iZXIpOworICAgICAgICBpZiAoIWljb25WaWV3LnNldChpYykpIHsKKyAgICAgICAgICAgIGhhbmRsZU5vdGlmaWNhdGlvbkVycm9yKGtleSwgbm90aWZpY2F0aW9uLCAiQ291bGRuJ3QgYXR0YWNoIFN0YXR1c0Jhckljb246ICIgKyBpYyk7CisgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgfQorICAgICAgICAvLyBDb25zdHJ1Y3QgdGhlIGV4cGFuZGVkIHZpZXcuCisgICAgICAgIE5vdGlmaWNhdGlvbkRhdGEuRW50cnkgZW50cnkgPSBuZXcgTm90aWZpY2F0aW9uRGF0YS5FbnRyeShrZXksIG5vdGlmaWNhdGlvbiwgaWNvblZpZXcpOworICAgICAgICBpZiAoIWluZmxhdGVWaWV3cyhlbnRyeSwgbVBpbGUpKSB7CisgICAgICAgICAgICBoYW5kbGVOb3RpZmljYXRpb25FcnJvcihrZXksIG5vdGlmaWNhdGlvbiwgIkNvdWxkbid0IGV4cGFuZCBSZW1vdGVWaWV3cyBmb3I6ICIKKyAgICAgICAgICAgICAgICAgICAgKyBub3RpZmljYXRpb24pOworICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgIH0KKyAgICAgICAgLy8gQWRkIHRoZSBpY29uLgorICAgICAgICBtTm90bnMuYWRkKGVudHJ5KTsKKyAgICAgICAgcmVmcmVzaEljb25zKCk7CisKKyAgICAgICAgcmV0dXJuIGljb25WaWV3OworICAgIH0KKworICAgIHByaXZhdGUgdm9pZCByZWZyZXNoSWNvbnMoKSB7CisgICAgICAgIC8vIFhYWDogbmVlZCB0byBpbXBsZW1lbnQgYSBuZXcgbGltaXRlZCBsaW5lYXIgbGF5b3V0IGNsYXNzCisgICAgICAgIC8vIHRvIGF2b2lkIHJlbW92aW5nICYgcmVhZGRpbmcgZXZlcnl0aGluZworCisgICAgICAgIGludCBOID0gbU5vdG5zLnNpemUoKTsKKyAgICAgICAgTGluZWFyTGF5b3V0LkxheW91dFBhcmFtcyBwYXJhbXMgPSBuZXcgTGluZWFyTGF5b3V0LkxheW91dFBhcmFtcyhtSWNvblNpemUsIG1JY29uU2l6ZSk7CisKKyAgICAgICAgaWYgKERFQlVHKSB7CisgICAgICAgICAgICBTbG9nLmQoVEFHLCAicmVmcmVzaGluZyBpY29ucyAoIiArIE4gKyAiIG5vdGlmaWNhdGlvbnMsIG1JY29uTGF5b3V0PSIKKyAgICAgICAgICAgICAgICAgICAgKyBtSWNvbkxheW91dCArICIsIG1QaWxlPSIgKyBtUGlsZSk7CisgICAgICAgIH0KKworICAgICAgICBtSWNvbkxheW91dC5yZW1vdmVBbGxWaWV3cygpOworICAgICAgICBmb3IgKGludCBpPTA7IGk8NDsgaSsrKSB7CisgICAgICAgICAgICBpZiAoaT49TikgYnJlYWs7CisgICAgICAgICAgICBtSWNvbkxheW91dC5hZGRWaWV3KG1Ob3Rucy5nZXQoTi1pLTEpLmljb24sIGksIHBhcmFtcyk7CisgICAgICAgIH0KKworICAgICAgICBtUGlsZS5yZW1vdmVBbGxW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XIoKSB7IAorICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIG9uQ2xpY2soVmlldyB2KSB7CisgICAgICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtQmFyU2VydmljZS5vbk5vdGlmaWNhdGlvbkNsZWFyKF9wa2csIF90YWcsIF9pZCk7CisgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBleCkgeworICAgICAgICAgICAgICAgICAgICAgICAgLy8gc3lzdGVtIHByb2Nlc3MgaXMgZGVhZCBpZiB3ZSdyZSBoZXJlLgorICAgICAgICAgICAgICAgICAgICB9CisvLyAgICAgICAgICAgICAgICAgICAgYW5pbWF0ZUNvbGxhcHNlKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSk7CisKKyAgICAgICAgLy8gYmluZCB0aGUgY2xpY2sgZXZlbnQgdG8gdGhlIGNvbnRlbnQgYXJlYQorICAgICAgICBWaWV3R3JvdXAgY29udGVudCA9IChWaWV3R3JvdXApcm93LmZpbmRWaWV3QnlJZChSLmlkLmNvbnRlbnQpOworICAgICAgICAvLyBYWFg6IHVwZGF0ZSB0byBhbGxvdyBjb250cm9scyB3aXRoaW4gbm90aWZpY2F0aW9uIHZpZXdzCisgICAgICAgIGNvbnRlbnQuc2V0RGVzY2VuZGFudEZvY3VzYWJpbGl0eShWaWV3R3JvdXAuRk9DVVNfQkxPQ0tfREVTQ0VOREFOVFMpOworLy8gICAgICAgIGNvbnRlbnQuc2V0T25Gb2N1c0NoYW5nZUxpc3RlbmVyKG1Gb2N1c0NoYW5nZUxpc3RlbmVyKTsKKyAgICAgICAgUGVuZGluZ0ludGVudCBjb250ZW50SW50ZW50ID0gc2JuLm5vdGlmaWNhdGlvbi5jb250ZW50SW50ZW50OworICAgICAgICBpZiAoY29udGVudEludGVudCAhPSBudWxsKSB7CisgICAgICAgICAgICBjb250ZW50LnNldE9uQ2xpY2tMaXN0ZW5lcihuZXcgTm90aWZpY2F0aW9uQ2xpY2tlcihjb250ZW50SW50ZW50LAorICAgICAgICAgICAgICAgICAgICAgICAgc2JuLnBrZywgc2JuLnRhZywgc2JuLmlkKSk7CisgICAgICAgIH0KKworICAgICAgICBWaWV3IGV4cGFuZGVkID0gbnVsbDsKKyAgICAgICAgRXhjZXB0aW9uIGV4Y2VwdGlvbiA9IG51bGw7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBleHBhbmRlZCA9IHJlbW90ZVZpZXdzLmFwcGx5KHRoaXMsIGNvbnRlbnQpOworICAgICAgICB9CisgICAgICAgIGNhdGNoIChSdW50aW1lRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIGV4Y2VwdGlvbiA9IGU7CisgICAgICAgIH0KKyAgICAgICAgaWYgKGV4cGFuZGVkID09IG51bGwpIHsKKyAgICAgICAgICAgIFN0cmluZyBpZGVudCA9IHNibi5wa2cgKyAiLzB4IiArIEludGVnZXIudG9IZXhTdHJpbmcoc2JuLmlkKTsKKyAgICAgICAgICAgIFNsb2cuZShUQUcsICJjb3VsZG4ndCBpbmZsYXRlIHZpZXcgZm9yIG5vdGlmaWNhdGlvbiAiICsgaWRlbnQsIGV4Y2VwdGlvbik7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBjb250ZW50LmFkZFZpZXcoZXhwYW5kZWQpOworICAgICAgICAgICAgcm93LnNldERyYXdpbmdDYWNoZUVuYWJsZWQodHJ1ZSk7CisgICAgICAgIH0KKworICAgICAgICBlbnRyeS5yb3cgPSByb3c7CisgICAgICAgIGVudHJ5LmNvbnRlbnQgPSBjb250ZW50OworICAgICAgICBlbnRyeS5leHBhbmRlZCA9IGV4cGFuZGVkOworCisgICAgICAgIHJldHVybiB0cnVlOworICAgIH0KKworICAgIHByb3RlY3RlZCB2b2lkIHNldExpZ2h0c091dChib29sZWFuIG91dCkgeworICAgICAgICBpZiAob3V0KSB7CisgICAgICAgICAgICBtQ3VydGFpbnMuc2V0QW5pbWF0aW9uKEFuaW1hdGlvblV0aWxzLmxvYWRBbmltYXRpb24oKENvbnRleHQpdGhpcywKKyAgICAgICAgICAgICAgICAgICAgICAgIFIuYW5pbS5saWdodHNfb3V0X2luKSk7CisgICAgICAgICAgICBtQ3VydGFpbnMuc2V0VmlzaWJpbGl0eShWaWV3LlZJU0lCTEUpOworICAgICAgICAgICAgbUJhckNvbnRlbnRzLnNldEFuaW1hdGlvbihBbmltYXRpb25VdGlscy5sb2FkQW5pbWF0aW9uKChDb250ZXh0KXRoaXMsCisgICAgICAgICAgICAgICAgICAgICAgICBSLmFuaW0uc3RhdHVzX2Jhcl9vdXQpKTsKKyAgICAgICAgICAgIG1CYXJDb250ZW50cy5zZXRWaXNpYmlsaXR5KFZpZXcuR09ORSk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBtQ3VydGFpbnMuc2V0QW5pbWF0aW9uKEFuaW1hdGlvblV0aWxzLmxvYWRBbmltYXRpb24oKENvbnRleHQpdGhpcywKKyAgICAgICAgICAgICAgICAgICAgICAgIFIuYW5pbS5saWdodHNfb3V0X291dCkpOworICAgICAgICAgICAgbUN1cnRhaW5zLnNldFZpc2liaWxpdHkoVmlldy5HT05FKTsKKyAgICAgICAgICAgIG1CYXJDb250ZW50cy5zZXRBbmltYXRpb24oQW5pbWF0aW9uVXRpbHMubG9hZEFuaW1hdGlvbigoQ29udGV4dCl0aGlzLAorICAgICAgICAgICAgICAgICAgICAgICAgUi5hbmltLnN0YXR1c19iYXJfaW4pKTsKKyAgICAgICAgICAgIG1CYXJDb250ZW50cy5zZXRWaXNpYmlsaXR5KFZpZXcuVklTSUJMRSk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB0b2dnbGVMaWdodHNPdXQoVmlldyB2KSB7CisgICAgICAgIHNldExpZ2h0c091dChtQ3VydGFpbnMuZ2V0VmlzaWJpbGl0eSgpICE9IFZpZXc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mVMaWJIYW5kbGUgPSBOVUxMOwogICAgICAgICAgICAgbUF1ZGlvT3V0ID0gTlVMTDsKICAgICAgICAgICAgIG1QbGF5U3RhdGUgPSAgU1lOVEhQTEFZU1RBVEVfSVNfU1RPUFBFRDsKQEAgLTE4NCw5ICsxODQsOSBAQAogICAgICAgICB+U3ludGhQcm94eUpuaVN0b3JhZ2UoKSB7CiAgICAgICAgICAgICAvL0xPR1YoImVudGVyaW5nIH5TeW50aFByb3h5Sm5pU3RvcmFnZSgpIik7CiAgICAgICAgICAgICBraWxsQXVkaW8oKTsKLSAgICAgICAgICAgIGlmIChtTmF0aXZlU3ludGhJbnRlcmZhY2UpIHsKLSAgICAgICAgICAgICAgICBtTmF0aXZlU3ludGhJbnRlcmZhY2UtPnNodXRkb3duKCk7Ci0gICAgICAgICAgICAgICAgbU5hdGl2ZVN5bnRoSW50ZXJmYWNlID0gTlVMTDsKKyAgICAgICAgICAgIGlmIChtRW5naW5lKSB7CisgICAgICAgICAgICAgICAgbUVuZ2luZS0+ZnVuY3MtPnNodXRkb3duKG1FbmdpbmUpOworICAgICAgICAgICAgICAgIG1FbmdpbmUgPSBOVUxMOwogICAgICAgICAgICAgfQogICAgICAgICAgICAgaWYgKG1FbmdpbmVMaWJIYW5kbGUpIHsKICAgICAgICAgICAgICAgICAvL0xPR0UoIn5TeW50aFByb3h5Sm5pU3RvcmFnZSgpOiBiZWZvcmUgY2xvc2UgbGlicmFyeSIpOwpAQCAtMjczLDI4ICsyNzMsNDUgQEAKICAqIENhbGxiYWNrIGZyb20gVFRTIGVuZ2luZS4KICAqIERpcmVjdGx5IHNwZWFrcyB1c2luZyBBdWRpb1RyYWNrIG9yIHdyaXRlIHRvIGZpbGUKICAqLwotc3RhdGljIHR0c19jYWxsYmFja19zdGF0dXMgdHRzU3ludGhEb25lQ0Iodm9pZCAqJiB1c2VyZGF0YSwgdWludDMyX3QgcmF0ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgIHVpbnQzMl90IG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zvcm1hdClmb3JtYXQsIGNoYW5uZWwpOworICAgICAgICBpZiAoKnBCdWZmZXJTaXplID4gMCkgeworICAgICAgICAgICAgcHJlcEF1ZGlvVHJhY2socEpuaURhdGEsIHBGb3JBZnRlci0+c3RyZWFtVHlwZSwgcmF0ZSwgZW5jb2RpbmcsIGNoYW5uZWwpOwogICAgICAgICAgICAgaWYgKHBKbmlEYXRhLT5tQXVkaW9PdXQpIHsKICAgICAgICAgICAgICAgICBwSm5pRGF0YS0+bVBsYXlMb2NrLmxvY2soKTsKICAgICAgICAgICAgICAgICBpZihwSm5pRGF0YS0+bUF1ZGlvT3V0LT5zdG9wcGVkKCkKQEAgLTMwMywyOCArMzIwLDMxIEBACiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIHBKbmlEYXRhLT5tUGxheUxvY2sudW5sb2NrKCk7CiAgICAgICAgICAgICAgICAgaWYgKGJVc2VGaWx0ZXIpIHsKLSAgICAgICAgICAgICAgICAgICAgYXBwbHlGaWx0ZXIoKGludDE2X3QqKXdhdiwgYnVmZmVyU2l6ZS8yKTsKKyAgICAgICAgICAgICAgICAgICAgYXBwbHlGaWx0ZXIoKGludDE2X3QqKSpwV2F2LCAqcEJ1ZmZlclNpemUvMik7CiAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIHBKbmlEYXRhLT5tQXVkaW9PdXQtPndyaXRlKHdhdiwgYnVmZmVyU2l6ZSk7Ci0gICAgICAgICAgICAgICAgbWVtc2V0KHdhdiwgMCwgYnVmZmVyU2l6ZSk7CisgICAgICAgICAgICAgICAgcEpuaURhdGEtPm1BdWRpb091dC0+d3JpdGUoKnBXYXYsICpwQnVmZmVyU2l6ZSk7CisgICAgICAgICAgICAgICAgbWVtc2V0KCpwV2F2LCAwLCAqcEJ1ZmZlclNpemUpOwogICAgICAgICAgICAgICAgIC8vTE9HVigiQXVkaW9UcmFjayB3cm90ZTogJWQgYnl0ZXMiLCBidWZmZXJTaXplKTsKICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgTE9HRSgiQ2FuJ3QgcGxheSwgbnVsbCBhdWRpb3RyYWNrIik7CisgICAgICAgICAgICAgICAgZGVsZXRlIHBGb3JBZnRlcjsKKyAgICAgICAgICAgICAgICBwRm9yQWZ0ZXIgPSBOVUxMOworICAgICAgICAgICAgICAgIHJldHVybiBBTkRST0lEX1RUU19DQUxMQkFDS19IQUxUOwogICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgfSBlbHNlICBpZiAocEZvckFmdGVyLT51c2FnZU1vZGUgPT0gVVNBR0VNT0RFX1dSSVRFX1RPX0ZJTEUpIHsKICAgICAgICAgLy9MT0dWKCJTYXZlIHRvIGZpbGUiKTsKLSAgICAgICAgaWYgKHdhdiA9PSBOVUxMKSB7CisgICAgICAgIGlmICgqcFdhdiA9PSBOVUxMKSB7CiAgICAgICAgICAgICBkZWxldGUgcEZvckFmdGVyOwogICAgICAgICAgICAgTE9HVigiTnVsbDogc3BlZWNoIGhhcyBjb21wbGV0ZWQiKTsKLSAgICAgICAgICAgIHJldHVybiBUVFNfQ0FMTEJBQ0tfSEFMVDsKKyAgICAgICAgICAgIHJldHVybiBBTkRST0lEX1RUU19DQUxMQkFDS19IQUxUOwogICAgICAgICB9Ci0gICAgICAgIGlmIChidWZmZXJTaXplID4gMCl7CisgICAgICAgIGlmICgqcEJ1ZmZlclNpemUgPiAwKXsKICAgICAgICAgICAgIGlmIChiVXNlRmlsdGVyKSB7Ci0gICAgICAgICAgICAgICAgYXBwbHlGaWx0ZXIoKGludDE2X3QqKXdhdiwgYnVmZmVyU2l6ZS8yKTsKKyAgICAgICAgICAgICAgICBhcHBseUZpbHRlcigoaW50MTZfdCopKnBXYXYsICpwQnVmZmVyU2l6ZS8yKTsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGZ3cml0ZSh3YXYsIDEsIGJ1ZmZlclNpemUsIHBGb3JBZnRlci0+b3V0cHV0RmlsZSk7Ci0gICAgICAg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VN5bnRoSW50ZXJmYWNlKSB7CisgICAgaWYgKHBTeW50aERhdGEtPm1FbmdpbmUpIHsKICAgICAgICAgc2l6ZV90IGJ1ZlNpemUgPSAxMDA7CiAgICAgICAgIGNoYXIgbGFuZ1tidWZTaXplXTsKICAgICAgICAgY2hhciBjb3VudHJ5W2J1ZlNpemVdOwpAQCAtODM5LDcgKzg5MCw5IEBACiAgICAgICAgIG1lbXNldCh2YXJpYW50LCAwLCBidWZTaXplKTsKICAgICAgICAgam9iamVjdEFycmF5IHJldExvY2FsZSA9IChqb2JqZWN0QXJyYXkpZW52LT5OZXdPYmplY3RBcnJheSgzLAogICAgICAgICAgICAgICAgIGVudi0+RmluZENsYXNzKCJqYXZhL2xhbmcvU3RyaW5nIiksIGVudi0+TmV3U3RyaW5nVVRGKCIiKSk7Ci0gICAgICAgIHBTeW50aERhdGEtPm1OYXRpdmVTeW50aEludGVyZmFjZS0+Z2V0TGFuZ3VhZ2UobGFuZywgY291bnRyeSwgdmFyaWFudCk7CisKKyAgICAgICAgYW5kcm9pZF90dHNfZW5naW5lX3QgKmVuZ2luZSA9IHBTeW50aERhdGEtPm1FbmdpbmU7CisgICAgICAgIGVuZ2luZS0+ZnVuY3MtPmdldExhbmd1YWdlKGVuZ2luZSwgbGFuZywgY291bnRyeSwgdmFyaWFudCk7CiAgICAgICAgIGVudi0+U2V0T2JqZWN0QXJyYXlFbGVtZW50KHJldExvY2FsZSwgMCwgZW52LT5OZXdTdHJpbmdVVEYobGFuZykpOwogICAgICAgICBlbnYtPlNldE9iamVjdEFycmF5RWxlbWVudChyZXRMb2NhbGUsIDEsIGVudi0+TmV3U3RyaW5nVVRGKGNvdW50cnkpKTsKICAgICAgICAgZW52LT5TZXRPYmplY3RBcnJheUVsZW1lbnQocmV0TG9jYWxlLCAyLCBlbnYtPk5ld1N0cmluZ1VURih2YXJpYW50KSk7CkBAIC04NjQsOCArOTE3LDkgQEAKICAgICBjaGFyIGJ1ZltidWZTaXplXTsKICAgICBtZ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gY2VydGFpbiB3aW5kb3cgd2l0aG91dAogICAgICAgICAgICAgICAgIC8vIGhhdmluZyB0byB1bmxvY2sgdGhlIHNjcmVlbikKLSAgICAgICAgICAgICAgICBsb25nIHdoZW4gPSBTeXN0ZW1DbG9jay5lbGFwc2VkUmVhbHRpbWUoKSArIEtFWUdVQVJEX0RFTEFZX01TOwotICAgICAgICAgICAgICAgIEludGVudCBpbnRlbnQgPSBuZXcgSW50ZW50KERFTEFZRURfS0VZR1VBUkRfQUNUSU9OKTsKLSAgICAgICAgICAgICAgICBpbnRlbnQucHV0RXh0cmEoInNlcSIsIG1EZWxheWVkU2hvd2luZ1NlcXVlbmNlKTsKLSAgICAgICAgICAgICAgICBQZW5kaW5nSW50ZW50IHNlbmRlciA9IFBlbmRpbmdJbnRlbnQuZ2V0QnJvYWRjYXN0KG1Db250ZXh0LAotICAgICAgICAgICAgICAgICAgICAgICAgMCwgaW50ZW50LCBQZW5kaW5nSW50ZW50LkZMQUdfQ0FOQ0VMX0NVUlJFTlQpOwotICAgICAgICAgICAgICAgIG1BbGFybU1hbmFnZXIuc2V0KEFsYXJtTWFuYWdlci5FTEFQU0VEX1JFQUxUSU1FX1dBS0VVUCwgd2hlbiwKLSAgICAgICAgICAgICAgICAgICAgICAgIHNlbmRlcik7Ci0gICAgICAgICAgICAgICAgaWYgKERFQlVHKSBMb2cuZChUQUcsICJzZXR0aW5nIGFsYXJtIHRvIHR1cm4gb2ZmIGtleWd1YXJkLCBzZXEgPSAiCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIG1EZWxheWVkU2hvd2luZ1NlcXVlbmNlKTsKKyAgICAgICAgICAgICAgICBmaW5hbCBDb250ZW50UmVzb2x2ZXIgY3IgPSBtQ29udGV4dC5nZXRDb250ZW50UmVzb2x2ZXIoKTsKKworICAgICAgICAgICAgICAgIC8vIEZyb20gRGlzcGxheVNldHRpbmdzCisgICAgICAgICAgICAgICAgbG9uZyBkaXNwbGF5VGltZW91dCA9IFNldHRpbmdzLlN5c3RlbS5nZXRJbnQoY3IsIFNDUkVFTl9PRkZfVElNRU9VVCwKKyAgICAgICAgICAgICAgICAgICAgICAgIEtFWUdVQVJEX0RJU1BMQVlfVElNRU9VVF9ERUxBWV9ERUZBVUxUKTsKKworICAgICAgICAgICAgICAgIC8vIEZyb20gU2VjdXJpdHlTZXR0aW5ncworICAgICAgICAgICAgICAgIGZpbmFsIGxvbmcgbG9ja0FmdGVyVGltZW91dCA9IFNldHRpbmdzLlNlY3VyZS5nZXRJbnQoY3IsCisgICAgICAgICAgICAgICAgICAgICAgICBTZXR0aW5ncy5TZWN1cmUuTE9DS19TQ1JFRU5fTE9DS19BRlRFUl9USU1FT1VULAorICAgICAgICAgICAgICAgICAgICAgICAgS0VZR1VBUkRfTE9DS19BRlRFUl9ERUxBWV9ERUZBVUxUKTsKKworICAgICAgICAgICAgICAgIC8vIEZyb20gRGV2aWNlUG9saWN5QWRtaW4KKyAgICAgICAgICAgICAgICBmaW5hbCBsb25nIHBvbGljeVRpbWVvdXQgPSBtTG9ja1BhdHRlcm5VdGlscy5nZXREZXZpY2VQb2xpY3lNYW5hZ2VyKCkKKyAgICAgICAgICAgICAgICAgICAgICAgIC5nZXRNYXhpbXVtVGltZVRvTG9jayhudWxsKTsKKworICAgICAgICAgICAgICAgIGxvbmcgdGltZW91dDsKKyAgICAgICAgICAgICAgICBpZiAocG9saWN5VGltZW91dCA+IDApIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gcG9saWN5IGluIGVmZmVjdC4gTWFrZSBzdXJlIHdlIGRvbid0IGdvIGJleW9uZCBwb2xpY3kgbGltaXQuCisgICAgICAgICAgICAgICAgICAgIGRpc3BsYXlUaW1lb3V0ID0gTWF0aC5tYXgoZGlzcGxheVRpbWVvdXQsIDApOyAvLyBpZ25vcmUgbmVnYXRpdmUgdmFsdWVzCisgICAgICAgICAgICAgICAgICAgIHRpbWVvdXQgPSBNYXRoLm1pbihwb2xpY3lUaW1lb3V0IC0gZGlzcGxheVRpbWVvdXQsIGxvY2tBZnRlclRpbWVvdXQpOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIHRpbWVvdXQgPSBsb2NrQWZ0ZXJUaW1lb3V0OworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIGlmICh0aW1lb3V0IDw9IDApIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gTG9jayBub3cKKyAgICAgICAgICAgICAgICAgICAgbVN1cHByZXNzTmV4dExvY2tTb3VuZCA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgIGRvS2V5Z3VhcmQoKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAvLyBMb2NrIGluIHRoZSBmdXR1cmUKKyAgICAgICAgICAgICAgICAgICAgbG9uZyB3aGVuID0gU3lzdGVtQ2xvY2suZWxhcHNlZFJlYWx0aW1lKCkgKyB0aW1lb3V0OworICAgICAgICAgICAgICAgICAgICBJbnRlbnQgaW50ZW50ID0gbmV3IEludGVudChERUxBWUVEX0tFWUdVQVJEX0FDVElPTik7CisgICAgICAgICAgICAgICAgICAgIGludGVudC5wdXRFeHRyYSgic2VxIiwgbURlbGF5ZWRTaG93aW5nU2VxdWVuY2UpOworICAgICAgICAgICAgICAgICAgICBQZW5kaW5nSW50ZW50IHNlbmRlciA9IFBlbmRpbmdJbnRlbnQuZ2V0QnJvYWRjYXN0KG1Db250ZXh0LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIDAsIGludGVudCwgUGVuZGluZ0ludGVudC5GTEFHX0NBTkNFTF9DVVJSRU5UKTsKKyAgICAgICAgICAgICAgICAgICAgbUFsYXJtTWFuYWdlci5zZXQoQWxhcm1NYW5hZ2VyLkVMQVBTRURfUkVBTFRJTUVfV0FLRVVQLCB3aGVuLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbmRlcik7CisgICAgICAgICAgICAgICAgICAgIGlmIChERUJVRykgTG9nLm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tQYXR0ZXJuVXRpbHMuZ2V0S2V5Z3VhcmRTdG9yZWRQYXNzd29yZFF1YWxpdHkoKQogICAgICAgICAgICAgICAgICAgICA9PSBEZXZpY2VQb2xpY3lNYW5hZ2VyLlBBU1NXT1JEX1FVQUxJVFlfU09NRVRISU5HOwotICAgICAgICAgICAgaWYgKGlzU2VjdXJlKCkgJiYgdXNpbmdMb2NrUGF0dGVybikgeworCisgICAgICAgICAgICBib29sZWFuIHNob3dTbGlkaW5nVGFiID0gZ2V0UmVzb3VyY2VzKCkuZ2V0Qm9vbGVhbihSLmJvb2wuY29uZmlnX2VuYWJsZVNsaWRpbmdUYWJGaXJzdCk7CisgICAgICAgICAgICBpZiAoaXNTZWN1cmUoKSAmJiAodXNpbmdMb2NrUGF0dGVybiB8fCAhc2hvd1NsaWRpbmdUYWIpKSB7CiAgICAgICAgICAgICAgICAgcmV0dXJuIE1vZGUuVW5sb2NrU2NyZWVuOwogICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICByZXR1cm4gTW9kZS5Mb2NrU2NyZWVuOwpAQCAtNjY3LDYgKzY2OSw3IEBACiAgICAgICAgICAgICAgICAgY2FzZSBEZXZpY2VQb2xpY3lNYW5hZ2VyLlBBU1NXT1JEX1FVQUxJVFlfTlVNRVJJQzoKICAgICAgICAgICAgICAgICBjYXNlIERldmljZVBvbGljeU1hbmFnZXIuUEFTU1dPUkRfUVVBTElUWV9BTFBIQUJFVElDOgogICAgICAgICAgICAgICAgIGNhc2UgRGV2aWNlUG9saWN5TWFuYWdlci5QQVNTV09SRF9RVUFMSVRZX0FMUEhBTlVNRVJJQzoKKyAgICAgICAgICAgICAgICBjYXNlIERldmljZVBvbGljeU1hbmFnZXIuUEFTU1dPUkRfUVVBTElUWV9DT01QTEVYOgogICAgICAgICAgICAgICAgICAgICBjdXJyZW50TW9kZSA9IFVubG9ja01vZGUuUGFzc3dvcmQ7CiAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgIC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nNldFZpc2liaWxpdHkoVmlldy5JTlZJU0lCTEUpOwotICAgICAgICB9IGVsc2UgaWYgKG1DaGFyZ2luZyAhPSBudWxsICYmIG1OZXh0QWxhcm0gPT0gbnVsbCkgewotICAgICAgICAgICAgLy8gY2hhcmdpbmcgb25seQotICAgICAgICAgICAgbVN0YXR1czEuc2V0VmlzaWJpbGl0eShWaWV3LlZJU0lCTEUpOwotICAgICAgICAgICAgbVN0YXR1czIuc2V0VmlzaWJpbGl0eShWaWV3LklOVklTSUJMRSk7Ci0KLSAgICAgICAgICAgIG1TdGF0dXMxLnNldFRleHQobUNoYXJnaW5nKTsKLSAgICAgICAgICAgIG1TdGF0dXMxLnNldENvbXBvdW5kRHJhd2FibGVzV2l0aEludHJpbnNpY0JvdW5kcyhtQ2hhcmdpbmdJY29uLCBudWxsLCBudWxsLCBudWxsKTsKLSAgICAgICAgfSBlbHNlIGlmIChtTmV4dEFsYXJtICE9IG51bGwgJiYgbUNoYXJnaW5nID09IG51bGwpIHsKLSAgICAgICAgICAgIC8vIG5leHQgYWxhcm0gb25seQotICAgICAgICAgICAgbVN0YXR1czEuc2V0VmlzaWJpbGl0eShWaWV3LlZJU0lCTEUpOwotICAgICAgICAgICAgbVN0YXR1czIuc2V0VmlzaWJpbGl0eShWaWV3LklOVklTSUJMRSk7Ci0KLSAgICAgICAgICAgIG1TdGF0dXMxLnNldFRleHQobU5leHRBbGFybSk7Ci0gICAgICAgICAgICBtU3RhdHVzMS5zZXRDb21wb3VuZERyYXdhYmxlc1dpdGhJbnRyaW5zaWNCb3VuZHMobUFsYXJtSWNvbiwgbnVsbCwgbnVsbCwgbnVsbCk7Ci0gICAgICAgIH0gZWxzZSBpZiAobUNoYXJnaW5nICE9IG51bGwgJiYgbU5leHRBbGFybSAhPSBudWxsKSB7Ci0gICAgICAgICAgICAvLyBib3RoIGNoYXJnaW5nIGFuZCBuZXh0IGFsYXJtCi0gICAgICAgICAgICBtU3RhdHVzMS5zZXRWaXNpYmlsaXR5KFZpZXcuVklTSUJMRSk7Ci0gICAgICAgICAgICBtU3RhdHVzMi5zZXRWaXNpYmlsaXR5KFZpZXcuVklTSUJMRSk7Ci0KLSAgICAgICAgICAgIG1TdGF0dXMxLnNldFRleHQobUNoYXJnaW5nKTsKLSAgICAgICAgICAgIG1TdGF0dXMxLnNldENvbXBvdW5kRHJhd2FibGVzV2l0aEludHJpbnNpY0JvdW5kcyhtQ2hhcmdpbmdJY29uLCBudWxsLCBudWxsLCBudWxsKTsKLSAgICAgICAgICAgIG1TdGF0dXMyLnNldFRleHQobU5leHRBbGFybSk7Ci0gICAgICAgICAgICBtU3RhdHVzMi5zZXRDb21wb3VuZERyYXdhYmxlc1dpdGhJbnRyaW5zaWNCb3VuZHMobUFsYXJtSWNvbiwgbnVsbCwgbnVsbCwgbnVsbCk7Ci0gICAgICAgIH0KKyAgICAgICAgbVN0YXR1c1ZpZXcudXBkYXRlU3RhdHVzTGluZXMobVN0YXR1cy5zaG93U3RhdHVzTGluZXMoKSwgbUNoYXJnaW5nLCBtQ2hhcmdpbmdJY29uLCBtQWxhcm1JY29uKTsKICAgICB9CiAKICAgICAvKioge0Bpbmhlcml0RG9jfSAqLwpAQCAtNTA5LDcgKzQ3MSw3IEBACiAgICAgICAgIHN3aXRjaCAoc3RhdHVzKSB7CiAgICAgICAgICAgICBjYXNlIE5vcm1hbDoKICAgICAgICAgICAgICAgICAvLyB0ZXh0Ci0gICAgICAgICAgICAgICAgbUNhcnJpZXIuc2V0VGV4dCgKKyAgICAgICAgICAgICAgICBtU3RhdHVzVmlldy5zZXRDYXJyaWVyVGV4dCgKICAgICAgICAgICAgICAgICAgICAgICAgIGdldENhcnJpZXJTdHJpbmcoCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1VcGRhdGVNb25pdG9yLmdldFRlbGVwaG9ueVBsbW4oKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVVwZGF0ZU1vbml0b3IuZ2V0VGVsZXBob255U3BuKCkpKTsKQEAgLTUxOCwxNCArNDgwLDE0IEBACiAgICAgICAgICAgICAgICAgbVNjcmVlbkxvY2tlZC5zZXRUZXh0KCIiKTsKIAogICAgICAgICAgICAgICAgIC8vIGxheW91dAotICAgICAgICAgICAgICAgIG1TY3JlZW5Mb2NrZWQuc2V0VmlzaWJpbGl0eShWaWV3LlZJU0lCTEUpOworICAgICAgICAgICAgICAgIG1TY3JlZW5Mb2NrZWQuc2V0VmlzaWJpbGl0eShWaWV3LklOVklTSUJMRSk7CiAgICAgICAgICAgICAgICAgbVNlbGVjdG9yLnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKICAgICAgICAgICAgICAgICBtRW1lcmdlbmN5Q2FsbFRleHQuc2V0VmlzaWJpbGl0eShWaWV3LkdPTkUpOwogICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgY2FzZSBOZXR3b3JrTG9ja2VkOgogICAgICAgICAgICAgICAgIC8vIFRoZSBjYXJyaWVyIHN0cmluZyBzaG93cyBib3RoIHNpbSBjYXJkIHN0YXR1cyAoaS5lLiBObyBTaW0gQ2FyZCkgYW5kCiAgICAgICAgICAgICAgICAgLy8gY2FycmllcidzIG5hbWUgYW5kL29yICJFbWVyZ2VuY3kgQ2FsbHMgT25seSIgc3RhdHVzCi0gICAgICAgICAgICAgICAgbUNhcnJpZXIuc2V0VGV4dCgKKyAgICAgICAgICAgICAgICBtU3RhdHVzVmlldy5zZXRDYXJyaWVyVGV4dCgKICAgICAgICAgICAgICAgICAgICAgICAgIGdldENhcnJpZXJTdHJpbmcoCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1VcGRhdGVNb25pdG9yLmdldFRlbGVwaG9ueVBsbW4oKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0Q29udGV4dCgpLmdldFRleHQoUi5zdHJpbmcubG9ja3NjcmVlbl9uZXR3b3JrX2xvY2tlZF9tZXNzYWdlKSkpOwpAQCAtNTM4LDcgKzUwMCw3IEBACiAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICBjYXNlIFNpbU1pc3Npbmc6CiAgICAgICAgICAgICAgICAgLy8gdGV4dAotICAgICAgICAgICAgICAgIG1DYXJyaWVyLnNldFRleHQoUi5zdHJpbmcubG9ja3NjcmVlbl9taXNzaW5nX3NpbV9tZXNzYWdlX3Nob3J0KTsKKyAgICAgICAgICAgICAgICBtU3RhdHVzVmlldy5zZXRDYXJyaWVyVGV4dChSLnN0cmluZy5sb2Nrc2NyZWVuX21pc3Npbmdfc2ltX21lc3NhZ2Vfc2hvcnQpOwogICAgICAgICAgICAgICAgIG1TY3JlZW5Mb2NrZWQuc2V0VGV4dChSLnN0cmluZy5sb2Nrc2NyZWVuX21pc3Npbmdfc2ltX2luc3RydWN0aW9ucyk7CiAKICAgICAgICAgICAgICAgICAvLyBsYXlvdXQKQEAgLTU0OSw3ICs1MTEsNyBAQAogICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgY2FzZSBTaW1NaXNzaW5nTG9ja2VkOgogICAgICAgICAgICAgICAgIC8vIHRleHQKLSAgICAgICAgICAgICAgICBtQ2Fycmllci5zZXRUZXh0KAorICAgICAgICAgICAgICAgIG1TdGF0dXNWaWV3LnNldENhcnJpZXJUZXh0KAogICAgICAgICAgICAgICAgICAgICAgICAgZ2V0Q2FycmllclN0cmluZygKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVVwZGF0ZU1vbml0b3IuZ2V0VGVsZXBob255UGxtbigpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRDb250ZXh0KCkuZ2V0VGV4dChSLnN0cmluZy5sb2Nrc2NyZWVuX21pc3Npbmdfc2ltX21lc3NhZ2Vfc2hvcnQpKSk7CkBAIC01NjMsNyArNTI1LDcgQEAKICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIGNhc2UgU2ltTG9ja2VkOgogICAgICAgICAgICAgICAgIC8vIHRleHQKLSAgICAgICAgICAgICAgICBtQ2Fycmllci5zZXRUZXh0KAorICAgICAgICAgICAgICAgIG1TdGF0dXNWaWV3LnNldENhcnJpZXJUZXh0KAogICAgICAgICAgICAgICAgICAgICAgICAgZ2V0Q2FycmllclN0cmluZygKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVVwZGF0ZU1vbml0b3IuZ2V0VGVsZXBob255UGxtbigpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRDb250ZXh0KCkuZ2V0VGV4dChSLnN0cmluZy5sb2Nrc2NyZWVuX3NpbV9sb2NrZWRfbWVzc2FnZSkpKTsKQEAgLTU3NSw3ICs1MzcsNyBAQAogICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgY2FzZSBTaW1QdWtMb2NrZWQ6CiAgICAgICAgICAgICAgICAgLy8gdGV4dAotICAgICAgICAgICAgICAgIG1DYXJyaWVyLnNldFRleHQoCisgICAgICAgICAgICAgICAgbVN0YXR1c1ZpZXcuc2V0Q2FycmllclRleHQoCiAgICAgICAgICAgICAgICAgICAgICAgICBnZXRDYXJyaWVyU3RyaW5nKAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtVXBkYXRlTW9uaXRvci5nZXRUZWxlcGhvbnlQbG1uKCksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldENvbnRleHQoKS5nZXRUZXh0KFIuc3RyaW5nLmxvY2tzY3JlZW5fc2ltX3B1a19sb2NrZWRfbWVzc2FnZSkpKTsKQEAgLTY1OCw3ICs2MjAsNiBAQAogICAgIC8qKiB7QGluaGVyaXREb2N9ICovCiAgICAgcHVibGljIHZvaWQgb25SZXN1bWUoKSB7CiAgICAgICAgIHJlc2V0U3RhdHVzSW5mbyhtVXBkYXRlTW9uaXRvcik7Ci0gICAgICAgIG1Mb2NrUGF0dGVyblV0aWxzLnVwZGF0ZUVtZXJnZW5jeUNhbGxCdXR0b25TdGF0ZShtRW1lcmd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ld0J5SWQoUi5pZC5lbnRlcl9wYXNzd29yZF9sYWJlbCk7CiAKLSAgICAgICAgbUtleWJvYXJkSGVscGVyID0gbmV3IFBhc3N3b3JkRW50cnlLZXlib2FyZEhlbHBlcihjb250ZXh0LCBtS2V5Ym9hcmRWaWV3LCB0aGlzKTsKLSAgICAgICAgbUtleWJvYXJkSGVscGVyLnNldEtleWJvYXJkTW9kZShpc0FscGhhID8gUGFzc3dvcmRFbnRyeUtleWJvYXJkSGVscGVyLktFWUJPQVJEX01PREVfQUxQSEEKLSAgICAgICAgICAgICAgICA6IFBhc3N3b3JkRW50cnlLZXlib2FyZEhlbHBlci5LRVlCT0FSRF9NT0RFX05VTUVSSUMpOworICAgICAgICBtS2V5Ym9hcmRIZWxwZXIgPSBuZXcgUGFzc3dvcmRFbnRyeUtleWJvYXJkSGVscGVyKGNvbnRleHQsIG1LZXlib2FyZFZpZXcsIHRoaXMsIGZhbHNlKTsKKyAgICAgICAgaWYgKG1LZXlib2FyZFZpZXdBbHBoYSA9PSBudWxsIHx8ICFtSXNBbHBoYSkgeworICAgICAgICAgICAgbUtleWJvYXJkSGVscGVyLnNldEtleWJvYXJkTW9kZShtSXNBbHBoYSA/CisgICAgICAgICAgICAgICAgICAgIFBhc3N3b3JkRW50cnlLZXlib2FyZEhlbHBlci5LRVlCT0FSRF9NT0RFX0FMUEhBCisgICAgICAgICAgICAgICAgICAgIDogUGFzc3dvcmRFbnRyeUtleWJvYXJkSGVscGVyLktFWUJPQVJEX01PREVfTlVNRVJJQyk7CisgICAgICAgICAgICBtS2V5Ym9hcmRWaWV3LnNldFZpc2liaWxpdHkoCisgICAgICAgICAgICAgICAgICAgIG1DcmVhdGlvbkhhcmRLZXlib2FyZEhpZGRlbiA9PSBDb25maWd1cmF0aW9uLkhBUkRLRVlCT0FSREhJRERFTl9OTworICAgICAgICAgICAgICAgICAgICA/IFZpZXcuSU5WSVNJQkxFIDogVmlldy5WSVNJQkxFKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIG1LZXlib2FyZEhlbHBlckFscGhhID0gbmV3IFBhc3N3b3JkRW50cnlLZXlib2FyZEhlbHBlcihjb250ZXh0LCBtS2V5Ym9hcmRWaWV3QWxwaGEsCisgICAgICAgICAgICAgICAgICAgIHRoaXMsIGZhbHNlKTsKKyAgICAgICAgICAgIG1LZXlib2FyZEhlbHBlci5zZXRLZXlib2FyZE1vZGUoUGFzc3dvcmRFbnRyeUtleWJvYXJkSGVscGVyLktFWUJPQVJEX01PREVfTlVNRVJJQyk7CisgICAgICAgICAgICBtS2V5Ym9hcmRIZWxwZXJBbHBoYS5zZXRLZXlib2FyZE1vZGUoUGFzc3dvcmRFbnRyeUtleWJvYXJkSGVscGVyLktFWUJPQVJEX01PREVfQUxQSEEpOworICAgICAgICAgICAgbUtleWJvYXJkVmlldy5zZXRWaXNpYmlsaXR5KFZpZXcuR09ORSk7CisgICAgICAgICAgICBtS2V5Ym9hcmRWaWV3QWxwaGEuc2V0VmlzaWJpbGl0eSgKKyAgICAgICAgICAgICAgICAgICAgbUNyZWF0aW9uSGFyZEtleWJvYXJkSGlkZGVuID09IENvbmZpZ3VyYXRpb24uSEFSREtFWUJPQVJESElEREVOX05PCisgICAgICAgICAgICAgICAgICAgID8gVmlldy5JTlZJU0lCTEUgOiBWaWV3LlZJU0lCTEUpOworICAgICAgICAgICAgbVBhc3N3b3JkRW50cnkuc2V0V2lkdGgobUtleWJvYXJkVmlld0FscGhhLmdldExheW91dFBhcmFtcygpLndpZHRoKTsKKyAgICAgICAgfQogCi0gICAgICAgIG1LZXlib2FyZFZpZXcuc2V0VmlzaWJpbGl0eShtQ3JlYXRpb25IYXJkS2V5Ym9hcmRIaWRkZW4gPT0gQ29uZmlndXJhdGlvbi5IQVJES0VZQk9BUkRISURERU5fTk8KLSAgICAgICAgICAgICAgICA/IFZpZXcuSU5WSVNJQkxFIDogVmlldy5WSVNJQkxFKTsKKyAgICAgICAgbVBhc3N3b3JkRW50cnkuc2V0Q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V0VmlicmF0ZVBhdHRlcm4obUxvY2tQYXR0ZXJuVXRpbHMuaXNUYWN0aWxlRmVlZGJhY2tFbmFibGVkKCkgPworICAgICAgICAgICAgICAgICAgICBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmFycmF5LmNvbmZpZ192aXJ0dWFsS2V5VmliZVBhdHRlcm4gOiAwKTsKKyAgICAgICAgfQorCisgICAgICAgIC8vIHVudGlsIHdlIGdldCBhbiB1cGRhdGUuLi4KKyAgICAgICAgbVN0YXR1c1ZpZXcuc2V0Q2FycmllclRleHQoTG9ja1NjcmVlbi5nZXRDYXJyaWVyU3RyaW5nKAorICAgICAgICAgICAgICAgICAgICAgICAgbVVwZGF0ZU1vbml0b3IuZ2V0VGVsZXBob255UGxtbigpLAorICAgICAgICAgICAgICAgICAgICAgICAgbVVwZGF0ZU1vbml0b3IuZ2V0VGVsZXBob255U3BuKCkpKTsKICAgICB9CiAKICAgICBAT3ZlcnJpZGUKQEAgLTEzNiw4ICsxNzIsMTIgQEAKIAogICAgIC8qKiB7QGluaGVyaXREb2N9ICovCiAgICAgcHVibGljIHZvaWQgb25SZXN1bWUoKSB7CisgICAgICAgIC8vIHJlc2V0IHN0YXR1cworICAgICAgICBtU3RhdHVzVmlldy5yZXNldFN0YXR1c0luZm8obVVwZGF0ZU1vbml0b3IsIG1Mb2NrUGF0dGVyblV0aWxzKTsKKwogICAgICAgICAvLyBzdGFydCBmcmVzaAogICAgICAgICBtUGFzc3dvcmRFbnRyeS5zZXRUZXh0KCIiKTsKKyAgICAgICAgcmVzZXRTdGF0dXNJbmZvKCk7CiAgICAgICAgIG1QYXNzd29yZEVudHJ5LnJlcXVlc3RGb2N1cygpOwogICAgICAgICBtTG9ja1BhdHRlcm5VdGlscy51cGRhdGVFbWVyZ2VuY3lDYWxsQnV0dG9uU3RhdGUobUVtZXJnZW5jeUNhbGxCdXR0b24pOwogCkBAIC0xNzQsNiArMjE0LDkgQEAKICAgICAgICAgICAgICAgICBsb25nIGRlYWRsaW5lID0gbUxvY2tQYXR0ZXJuVXRpbHMuc2V0TG9ja291dEF0dGVtcHREZWFkbGluZSgpOwogICAgICAgICAgICAgICAgIGhhbmRsZUF0dGVtcHRMb2Nrb3V0KGRlYWRsaW5lKTsKICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1TdGF0dXNWaWV3LnNldEluc3RydWN0aW9uVGV4dChSLnN0cmluZy5sb2Nrc2NyZWVuX3Bhc3N3b3JkX3dyb25nKTsKKyAgICAgICAgfSBlbHNlIGlmIChlbnRyeS5sZW5ndGgoKSA+IDApIHsKKyAgICAgICAgICAgIG1TdGF0dXNWaWV3LnNldEluc3RydWN0aW9uVGV4dChSLnN0cmluZy5sb2Nrc2NyZWVuX3Bhc3N3b3JkX3dyb25nKTsKICAgICAgICAgfQogICAgICAgICBtUGFzc3dvcmRFbnRyeS5zZXRUZXh0KCIiKTsKICAgICB9CkBAIC0xOTEsMTQgKzIzNCwxNCBAQAogICAgICAgICAgICAgICAgIFN0cmluZyBpbnN0cnVjdGlvbnMgPSBnZXRDb250ZXh0KCkuZ2V0U3RyaW5nKAogICAgICAgICAgICAgICAgICAgICAgICAgUi5zdHJpbmcubG9ja3NjcmVlbl90b29fbWFueV9mYWlsZWRfYXR0ZW1wdHNfY291bnRkb3duLAogICAgICAgICAgICAgICAgICAgICAgICAgc2Vjb25kc1JlbWFpbmluZyk7Ci0gICAgICAgICAgICAgICAgbVRpdGxlLnNldFRleHQoaW5zdHJ1Y3Rpb25zKTsKKyAgICAgICAgICAgICAgICBtU3RhdHVzVmlldy5zZXRJbnN0cnVjdGlvblRleHQoaW5zdHJ1Y3Rpb25zKTsKICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgQE92ZXJyaWRlCiAgICAgICAgICAgICBwdWJsaWMgdm9pZCBvbkZpbmlzaCgpIHsKICAgICAgICAgICAgICAgICBtUGFzc3dvcmRFbnRyeS5zZXRFbmFibGVkKHRydWUpOwotICAgICAgICAgICAgICAgIG1UaXRsZS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DE4IEBACiAgICAgcHJpdmF0ZSB2b2lkIHVwZGF0ZUZvb3RlcihGb290ZXJNb2RlIG1vZGUpIHsKICAgICAgICAgc3dpdGNoIChtb2RlKSB7CiAgICAgICAgICAgICBjYXNlIE5vcm1hbDoKKyAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJtb2RlIG5vcm1hbCIpOwogICAgICAgICAgICAgICAgIG1Gb290ZXJOb3JtYWwuc2V0VmlzaWJpbGl0eShWaWV3LlZJU0lCTEUpOwogICAgICAgICAgICAgICAgIG1Gb290ZXJGb3Jnb3RQYXR0ZXJuLnNldFZpc2liaWxpdHkoVmlldy5HT05FKTsKICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIGNhc2UgRm9yZ290TG9ja1BhdHRlcm46CisgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAibW9kZSBGb3Jnb3RMb2NrUGF0dGVybiIpOwogICAgICAgICAgICAgICAgIG1Gb290ZXJOb3JtYWwuc2V0VmlzaWJpbGl0eShWaWV3LkdPTkUpOwogICAgICAgICAgICAgICAgIG1Gb290ZXJGb3Jnb3RQYXR0ZXJuLnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKICAgICAgICAgICAgICAgICBtRm9yZ290UGF0dGVybkJ1dHRvbi5zZXRWaXNpYmlsaXR5KFZpZXcuVklTSUJMRSk7CiAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICBjYXNlIFZlcmlmeVVubG9ja2VkOgorICAgICAgICAgICAgICAgIExvZy5kKFRBRywgIm1vZGUgVmVyaWZ5VW5sb2NrZWQiKTsKICAgICAgICAgICAgICAgICBtRm9vdGVyTm9ybWFsLnNldFZpc2liaWxpdHkoVmlldy5HT05FKTsKICAgICAgICAgICAgICAgICBtRm9vdGVyRm9yZ290UGF0dGVybi5zZXRWaXNpYmlsaXR5KFZpZXcuR09ORSk7CiAgICAgICAgIH0KQEAgLTE4MCwyNCArMTU5LDE2IEBACiAgICAgICAgIG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gICAgICAgICAgICAgICAgIFIuZHJhd2FibGUuaWNfbG9ja19pZGxlX2xvY2ssIDAsIDAsIDApOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBtU3RhdHVzMS5zZXRWaXNpYmlsaXR5KFZpZXcuVklTSUJMRSk7Ci0gICAgICAgICAgICBtU3RhdHVzU2VwLnNldFZpc2liaWxpdHkoVmlldy5HT05FKTsKLSAgICAgICAgICAgIG1TdGF0dXMyLnNldFZpc2liaWxpdHkoVmlldy5HT05FKTsKLSAgICAgICAgfSBlbHNlIGlmIChtU2hvd2luZ0JhdHRlcnlJbmZvICYmIG1OZXh0QWxhcm0gPT0gbnVsbCkgewotICAgICAgICAgICAgLy8gYmF0dGVyeSBvbmx5Ci0gICAgICAgICAgICBpZiAobVBsdWdnZWRJbikgewotICAgICAgICAgICAgICBpZiAobUJhdHRlcnlMZXZlbCA+PSAxMDApIHsKLSAgICAgICAgICAgICAgICBtU3RhdHVzMS5zZXRUZXh0KGdldENvbnRleHQoKS5nZXRTdHJpbmcoUi5zdHJpbmcubG9ja3NjcmVlbl9jaGFyZ2VkKSk7Ci0gICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICBtU3RhdHVzMS5zZXRUZXh0KGdldENvbnRleHQoKS5nZXRTdHJpbmcoUi5zdHJpbmcubG9ja3NjcmVlbl9wbHVnZ2VkX2luLCBtQmF0dGVyeUxldmVsKSk7Ci0gICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgbVN0YXR1czEuc2V0VGV4dChnZXRDb250ZXh0KCkuZ2V0U3RyaW5nKFIuc3RyaW5nLmxvY2tzY3JlZW5fbG93X2JhdHRlcnkpKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIG1TdGF0dXMxLnNldENvbXBvdW5kRHJhd2FibGVzV2l0aEludHJpbnNpY0JvdW5kcyhSLmRyYXdhYmxlLmljX2xvY2tfaWRsZV9jaG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BACiAgICAgICAgICAgICBpZiAobUxvY2tQYXR0ZXJuVXRpbHMuY2hlY2tQYXR0ZXJuKHBhdHRlcm4pKSB7CiAgICAgICAgICAgICAgICAgbUxvY2tQYXR0ZXJuVmlldwogICAgICAgICAgICAgICAgICAgICAgICAgLnNldERpc3BsYXlNb2RlKExvY2tQYXR0ZXJuVmlldy5EaXNwbGF5TW9kZS5Db3JyZWN0KTsKLSAgICAgICAgICAgICAgICBtSW5zdHJ1Y3Rpb25zID0gIiI7Ci0gICAgICAgICAgICAgICAgdXBkYXRlU3RhdHVzTGluZXMoKTsKKyAgICAgICAgICAgICAgICBtU3RhdHVzVmlldy5zZXRJbnN0cnVjdGlvbnMoIiIpOworICAgICAgICAgICAgICAgIG1TdGF0dXNWaWV3LnVwZGF0ZVN0YXR1c0xpbmVzKCk7CiAgICAgICAgICAgICAgICAgbUNhbGxiYWNrLmtleWd1YXJkRG9uZSh0cnVlKTsKICAgICAgICAgICAgICAgICBtQ2FsbGJhY2sucmVwb3J0U3VjY2Vzc2Z1bFVubG9ja0F0dGVtcHQoKTsKICAgICAgICAgICAgIH0gZWxzZSB7CkBAIC01MzMsOCArNDE0LDkgQEAKICAgICAgICAgICAgICAgICAgICAgaGFuZGxlQXR0ZW1wdExvY2tvdXQoZGVhZGxpbmUpOwogICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgIC8vIFRPRE8gbVVubG9ja0ljb24uc2V0VmlzaWJpbGl0eShWaWV3LlZJU0lCTEUpOwotICAgICAgICAgICAgICAgICAgICBtSW5zdHJ1Y3Rpb25zID0gZ2V0Q29udGV4dCgpLmdldFN0cmluZyhSLnN0cmluZy5sb2Nrc2NyZWVuX3BhdHRlcm5fd3JvbmcpOwotICAgICAgICAgICAgICAgICAgICB1cGRhdGVTdGF0dXNMaW5lcygpOworICAgICAgICAgICAgICAgICAgICBtU3RhdHVzVmlldy5zZXRJbnN0cnVjdGlvbnMoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZ2V0Q29udGV4dCgpLmdldFN0cmluZyhSLnN0cmluZy5sb2Nrc2NyZWVuX3BhdHRlcm5fd3JvbmcpKTsKKyAgICAgICAgICAgICAgICAgICAgbVN0YXR1c1ZpZXcudXBkYXRlU3RhdHVzTGluZXMoKTsKICAgICAgICAgICAgICAgICAgICAgbUxvY2tQYXR0ZXJuVmlldy5wb3N0RGVsYXllZCgKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtQ2FuY2VsUGF0dGVyblJ1bm5hYmxlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBBVFRFUk5fQ0xFQVJfVElNRU9VVF9NUyk7CkBAIC01NTIsMTcgKzQzNCwxOCBAQAogICAgICAgICAgICAgQE92ZXJyaWRlCiAgICAgICAgICAgICBwdWJsaWMgdm9pZCBvblRpY2sobG9uZyBtaWxsaXNVbnRpbEZpbmlzaGVkKSB7CiAgICAgICAgICAgICAgICAgaW50IHNlY29uZHNSZW1haW5pbmcgPSAoaW50KSAobWlsbGlzVW50aWxGaW5pc2hlZCAvIDEwMDApOwotICAgICAgICAgICAgICAgIG1JbnN0cnVjdGlvbnMgPSBnZXRDb250ZXh0KCkuZ2V0U3RyaW5nKAorICAgICAgICAgICAgICAgIG1TdGF0dXNWaWV3LnNldEluc3RydWN0aW9ucyhnZXRDb250ZXh0KCkuZ2V0U3RyaW5nKAogICAgICAgICAgICAgICAgICAgICAgICAgUi5zdHJpbmcubG9ja3NjcmVlbl90b29fbWFueV9mYWlsZWRfYXR0ZW1wdHNfY291bnRkb3duLAotICAgICAgICAgICAgICAgICAgICAgICAgc2Vjb25kc1JlbWFpbmluZyk7Ci0gICAgICAgICAgICAgICAgdXBkYXRlU3RhdHVzTGluZXMoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHNlY29uZHNSZW1haW5pbmcpKTsKKyAgICAgICAgICAgICAgICBtU3RhdHVzVmlldy51cGRhdGVTdGF0dXNMaW5lcygpOwogICAgICAgICAgICAgfQogC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FBhbmVsIGlzIHByZXBhcmVkIGFuZCBwb3NzaWJseSBvcGVuLCBzbyBjbG9zZSBpdAogICAgICAgICAgICAgY2xvc2VQYW5lbChtUHJlcGFyZWRQYW5lbCwgZmFsc2UpOwpAQCAtMzE1LDkgKzMyOSwxMSBAQAogCiAgICAgICAgIGlmIChzdC5jcmVhdGVkUGFuZWxWaWV3ID09IG51bGwpIHsKICAgICAgICAgICAgIC8vIEluaXQgdGhlIHBhbmVsIHN0YXRlJ3MgbWVudS0tcmV0dXJuIGZhbHNlIGlmIGluaXQgZmFpbGVkCi0gICAgICAgICAgICBpZiAoc3QubWVudSA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgaWYgKCFpbml0aWFsaXplUGFuZWxNZW51KHN0KSB8fCAoc3QubWVudSA9PSBudWxsKSkgewotICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICBpZiAoc3QubWVudSA9PSBudWxsIHx8IHN0LnJlZnJlc2hNZW51Q29udGVudCkgeworICAgICAgICAgICAgICAgIGlmIChzdC5tZW51ID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKCFpbml0aWFsaXplUGFuZWxNZW51KHN0KSB8fCAoc3QubWVudSA9PSBudWxsKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIC8vIENhbGwgY2FsbGJhY2ssIGFuZCByZXR1cm4gaWYgaXQgZG9lc24ndCB3YW50IHRvIGRpc3BsYXkgbWVudQogICAgICAgICAgICAgICAgIGlmICgoY2IgPT0gbnVsbCkgfHwgIWNiLm9uQ3JlYXRlUGFuZWxNZW51KHN0LmZlYXR1cmVJZCwgc3QubWVudSkpIHsKQEAgLTMyNiw2ICszNDIsMTIgQEAKIAogICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIAorICAgICAgICAgICAgICAgIHN0LnJlZnJlc2hNZW51Q29udGVudCA9IGZhbHNlOworCisgICAgICAgICAgICAgICAgaWYgKG1BY3Rpb25CYXIgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBtQWN0aW9uQmFyLnNldE1lbnUoc3QubWVudSk7CisgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogCiAgICAgICAgICAgICAvLyBDYWxsYmFjayBhbmQgcmV0dXJuIGlmIHRoZSBjYWxsYmFjayBkb2VzIG5vdCB3YW50IHRvIHNob3cgdGhlIG1lbnUKQEAgLTM0OSwzNiArMzcxLDM3IEBACiAKICAgICBAT3ZlcnJpZGUKICAgICBwdWJsaWMgdm9pZCBvbkNvbmZpZ3VyYXRpb25DaGFuZ2VkKENvbmZpZ3VyYXRpb24gbmV3Q29uZmlnKSB7Ci0gICAgICAgIFBhbmVsRmVhdHVyZVN0YXRlIHN0ID0gZ2V0UGFuZWxTdGF0ZShGRUFUVVJFX09QVElPTlNfUEFORUwsIGZhbHNlKTsKLSAgICAgICAgaWYgKChzdCAhPSBudWxsKSAmJiAoc3QubWVudSAhPSBudWxsKSkgewotICAgICAgICAgICAgZmluYWwgTWVudUJ1aWxkZXIgbWVudUJ1aWxkZXIgPSAoTWVudUJ1aWxkZXIpIHN0Lm1lbnU7CisgICAgICAgIC8vIEFjdGlvbiBiYXJzIGhhbmRsZSB0aGVpciBvd24gbWVudSBzdGF0ZQorICAgICAgICBpZiAobUFjdGlvbkJhciA9PSBudWxsKSB7CisgICAgICAgICAgICBQYW5lbEZlYXR1cmVTdGF0ZSBzdCA9IGdldFBhbmVsU3RhdGUoRkVBVFVSRV9PUFRJT05TX1BBTkVMLCBmYWxzZSk7CisgICAgICAgICAgICBpZiAoKHN0ICE9IG51bGwpICYmIChzdC5tZW51ICE9IG51bGwpKSB7CisgICAgICAgICAgICAgICAgZmluYWwgTWVudUJ1aWxkZXIgbWVudUJ1aWxkZXIgPSAoTWVudUJ1aWxkZXIpIHN0Lm1lbnU7CiAKLSAgICAgICAgICAgIGlmIChzdC5pc09wZW4pIHsKLSAgICAgICAgICAgICAgICAvLyBGcmVlemUgc3RhdGUKLSAgICAgICAgICAgICAgICBmaW5hbCBCdW5kbGUgc3RhdGUgPSBuZXcgQnVuZGxlKCk7Ci0gICAgICAgICAgICAgICAgbWVudUJ1aWxkZXIuc2F2ZUhpZXJhcmNoeVN0YXRlKHN0YXRlKTsKKyAgICAgICAgICAgICAgICBpZiAoc3QuaXNPcGVuKSB7CisgICAgICAgICAgICAgICAgICAgIC8vIEZyZWV6ZSBzdGF0ZQorICAgICAgICAgICAgICAgICAgICBmaW5hbCBCdW5kbGUgc3RhdGUgPSBuZXcgQnVuZGxlKCk7CisgICAgICAgICAgICAgICAgICAgIG1lbnVCdWlsZGVyLnNhdmVIaWVyYXJjaHlTdGF0ZShzdGF0ZSk7CiAKLSAgICAgICAgICAgICAgICAvLyBSZW1vdmUgdGhlIG1lbnUgdmlld3Mgc2luY2UgdGhleSBuZWVkIHRvIGJlIHJlY3JlYXRlZAotICAgICAgICAgICAgICAgIC8vIGFjY29yZGluZyB0byB0aGUgbmV3IGNvbmZpZ3VyYXRpb24KLSAgICAgICAgICAgICAgICBjbGVhck1lbnVWaWV3cyhzdCk7CisgICAgICAgICAgICAgICAgICAgIC8vIFJlbW92ZSB0aGUgbWVudSB2aWV3cyBzaW5jZSB0aGV5IG5lZWQgdG8gYmUgcmVjcmVhdGVkCisgICAgICAgICAgICAgICAgICAgIC8vIGFjY29yZGluZyB0byB0aGUgbmV3IGNvbmZpZ3VyYXRpb24KKyAgICAgICAgICAgICAgICAgICAgY2xlYXJNZW51Vmlld3Moc3QpOwogCi0gICAgICAgICAgICAgICAgLy8gUmUtb3BlbiB0aGUgc2FtZSBtZW51Ci0gICAgICAgICAgICAgICAgcmVvcGVuTWVudShmYWxzZSk7CisgICAgICAgICAgICAgICAgICAgIC8vIFJlLW9wZW4gdGhlIHNhbWUgbWVudQorICAgICAgICAgICAgICAgICAgICByZW9wZW5NZW51KGZhbHNlKTsKIAotICAgICAgICAgICAgICAgIC8vIFJlc3RvcmUgc3RhdGUKLSAgICAgICAgICAgICAgICBtZW51QnVpbGRlci5yZXN0b3JlSGllcmFyY2h5U3RhdGUoc3RhdGUpOworICAgICAgICAgICAgICAgICAgICAvLyBSZXN0b3JlIHN0YXRlCisgICAgICAgICAgICAgICAgICAgIG1lbnVCdWlsZGVyLnJlc3RvcmVIaWVyYXJjaHlTdGF0ZShzdGF0ZSk7CiAKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgLy8gQ2xlYXIgbWVudSB2aWV3cyBzbyBvbiBuZXh0IG1lbnUgb3BlbmluZywgaXQgd2lsbCB1c2UKLSAgICAgICAgICAgICAgICAvLyB0aGUgcHJvcGVyIGxheW91dAotICAgICAgICAgICAgICAgIGNsZWFyTWVudVZpZXdzKHN0KTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAvLyBDbGVhciBtZW51IHZpZXdzIHNvIG9uIG5leHQgbWVudSBvcGVuaW5nLCBpdCB3aWxsIHVzZQorICAgICAgICAgICAgICAgICAgICAvLyB0aGUgcHJvcGVyIGxheW91dAorICAgICAgICAgICAgICAgICAgICBjbGVhck1lbnVWaWV3cyhzdCk7CisgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICB9Ci0KICAgICB9CiAKICAgICBwcml2YXRlIHN0YXRpYyB2b2lkIGNsZWFyTWVudVZpZXdzKFBhbmVsRmVhdHVyZVN0YXRlIHN0KSB7Ci0KICAgICAgICAgLy8gVGhpcyBjYW4gYmUgY2FsbGVkIG9uIGNvbmZpZyBjaGFuZ2VzLCBzbyB3ZSBzaG91bGQgbWFrZSBzdXJlCiAgICAgICAgIC8vIHRoZSB2aWV3cyB3aWxsIGJlIHJlY29uc3RydWN0ZWQgYmFzZWQgb24gdGhlIG5ldy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KTsKKyAgICAgICAgfSBlbHNlIGlmIChmZWF0dXJlSWQgPT0gRkVBVFVSRV9DT05URVhUX01FTlUpIHsKICAgICAgICAgICAgIGNsb3NlQ29udGV4dE1lbnUoKTsKICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgIGNsb3NlUGFuZWwoZ2V0UGFuZWxTdGF0ZShmZWF0dXJlSWQsIHRydWUpLCB0cnVlKTsKQEAgLTU0NSw2ICs1NzYsMjYgQEAKICAgICAgICAgfQogICAgIH0KIAorICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIGludmFsaWRhdGVQYW5lbE1lbnUoaW50IGZlYXR1cmVJZCkgeworICAgICAgICBQYW5lbEZlYXR1cmVTdGF0ZSBzdCA9IGdldFBhbmVsU3RhdGUoZmVhdHVyZUlkLCB0cnVlKTsKKyAgICAgICAgaWYgKHN0Lm1lbnUgIT0gbnVsbCkgeworICAgICAgICAgICAgc3QubWVudS5jbGVhcigpOworICAgICAgICB9CisgICAgICAgIHN0LnJlZnJlc2hNZW51Q29udGVudCA9IHRydWU7CisgICAgICAgIHN0LnJlZnJlc2hEZWNvclZpZXcgPSB0cnVlOworICAgICAgICAKKyAgICAgICAgLy8gUHJlcGFyZSB0aGUgb3B0aW9ucyBwYW5lbCBpZiB3ZSBoYXZlIGFuIGFjdGlvbiBiYXIKKyAgICAgICAgaWYgKChmZWF0dXJlSWQgPT0gRkVBVFVSRV9BQ1RJT05fQkFSIHx8IGZlYXR1cmVJZCA9PSBGRUFUVVJFX09QVElPTlNfUEFORUwpCisgICAgICAgICAgICAgICAgJiYgbUFjdGlvbkJhciAhPSBudWxsKSB7CisgICAgICAgICAgICBzdCA9IGdldFBhbmVsU3RhdGUoV2luZG93LkZFQVRVUkVfT1BUSU9OU19QQU5FTCwgZmFsc2UpOworICAgICAgICAgICAgaWYgKHN0ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBzdC5pc1ByZXBhcmVkID0gZmFsc2U7CisgICAgICAgICAgICAgICAgcHJlcGFyZVBhbmVsKHN0LCBudWxsKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKyAgICAKICAgICAvKioKICAgICAgKiBDYWxsZWQgd2hlbiB0aGUgcGFuZWwga2V5IGlzIHB1c2hlZCBkb3duLgogICAgICAqIEBwYXJhbSBmZWF0dXJlSWQgVGhlIGZlYXR1cmUgSUQgb2YgdGhlIHJlbGV2YW50IHBhbmVsIChkZWZhdWx0cyB0byBGRUFUVVJFX09QVElPTlNfUEFORUx9LgpAQCAtNTU4LDcgKzYwOSw3IEBACiAgICAgICAgICAgICAvLyBUaGUgcGFuZWwga2V5IHdhcyBwdXNoZWQsIHNvIHNldCB0aGUgY2hvcmRpbmcga2V5CiAgICAgICAgICAgICBtUGFuZWxDaG9yZGluZ0tleSA9IGtleUNvZGU7CiAgICAgICAgICAgICBtUGFuZWxNYXlMb25nUHJlc3MgPSBmYWxzZTsKLSAgICAgICAgICAgIAorCiAgICAgICAgICAgICBQYW5lbEZlYXR1cmVTdGF0ZSBzdCA9IGdldFBhbmVsU3RhdGUoZmVhdHVyZUlkLCB0cnVlKTsKICAgICAgICAgICAgIGlmICghc3QuaXNPcGVuKSB7CiAgICAgICAgICAgICAgICAgaWYgKGdldENvbnRleHQoKS5nZXRSZXNvdXJjZXMoKS5nZXRDb25maWd1cmF0aW9uKCkua2V5Ym9hcmQKQEAgLTU2Nyw3ICs2MTgsNiBAQAogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICByZXR1cm4gcHJlcGFyZVBhbmVsKHN0LCBldmVudCk7CiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAKICAgICAgICAgfSBlbHNlIGlmIChtUGFuZWxNYXlMb25nUHJlc3MgJiYgbVBhbmVsQ2hvcmRpbmdLZXkgPT0ga2V5Q29kZQogICAgICAgICAgICAgICAgICYmIChldmVudC5nZXRGbGFncygpJktleUV2ZW50LkZMQUdfTE9OR19QUkVTUykgIT0gMCkgewogICAgICAgICAgICAgLy8gV2UgaGF2ZSBoYWQgYSBsb25nIHByZXNzIHdoaWxlIGluIGEgc3RhdGUgd2hlcmUgdGhpcwpAQCAtNjAyLDI1ICs2NTIsMzggQEAKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIAogICAgICAgICAgICAgYm9vbGVhbiBwbGF5U291bmRFZmZlY3QgPSBmYWxzZTsKLSAgICAgICAgICAgIFBhbmVsRmVhdHVyZVN0YXRlIHN0ID0gZ2V0UGFuZWxTdGF0ZShmZWF0dXJlSWQsIHRydWUpOwotICAgICAgICAgICAgaWYgKHN0LmlzT3BlbiB8fCBzdC5pc0hhbmRsZWQpIHsKKyAgICAgICAgICAgIGZpbmFsIFBhbmVsRmVhdHVyZVN0YXRlIHN0ID0gZ2V0UGFuZWxTdGF0ZShmZWF0dXJlSWQsIHRydWUpOworICAgICAgICAgICAgaWYgKGZlYXR1cmVJZCA9PSBGRUFUVVJFX09QVElPTlNfUEFORUwgJiYgbUFjdGlvbkJhciAhPSBudWxsICYmCisgICAgICAgICAgICAgICAgICAgIG1BY3Rpb25CYXIuaXNPdmVyZmxvd1Jlc2VydmVkKCkpIHsKKyAgICAgICAgICAgICAgICBpZiAoIW1BY3Rpb25CYXIuaXNPdmVyZmxvd01lbnVTaG93aW5nKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgZmluYWwgQ2FsbGJhY2sgY2IgPSBnZXRDYWxsYmFjaygpOworICAgICAgICAgICAgICAgICAgICBpZiAoY2IgIT0gbnVsbCAmJgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNiLm9uUHJlcGFyZVBhbmVsKGZlYXR1cmVJZCwgc3QuY3JlYXRlZFBhbmVsVmlldywgc3QubWVudSkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHBsYXlTb3VuZEVmZmVjdCA9IG1BY3Rpb25CYXIuc2hvd092ZXJmbG93TWVudSgpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgcGxheVNvdW5kRWZmZWN0ID0gbUFjdGlvbkJhci5oaWRlT3ZlcmZsb3dNZW51KCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBpZiAoc3QuaXNPcGVuIHx8IHN0LmlzSGFuZGxlZCkgewogCi0gICAgICAgICAgICAgICAgLy8gUGxheSB0aGUgc291bmQgZWZmZWN0IGlmIHRoZSB1c2VyIGNsb3NlZCBhbiBvcGVuIG1lbnUgKGFuZCBub3QgaWYKLSAgICAgICAgICAgICAgICAvLyB0aGV5IGp1c3QgcmVsZWFzZWQgYSBtZW51IHNob3J0Y3V0KQotICAgICAgICAgICAgICAgIHBsYXlTb3VuZEVmZmVjdCA9IHN0LmlzT3BlbjsKKyAgICAgICAgICAgICAgICAgICAgLy8gUGxheSB0aGUgc291bmQgZWZmZWN0IGlmIHRoZSB1c2VyIGNsb3NlZCBhbiBvcGVuIG1lbnUgKGFuZCBub3QgaWYKKyAgICAgICAgICAgICAgICAgICAgLy8gdGhleSBqdXN0IHJlbGVhc2VkIGEgbWVudSBzaG9ydGN1dCkKKyAgICAgICAgICAgICAgICAgICAgcGxheVNvdW5kRWZmZWN0ID0gc3QuaXNPcGVuOwogCi0gICAgICAgICAgICAgICAgLy8gQ2xvc2UgbWVudQotICAgICAgICAgICAgICAgIGNsb3NlUGFuZWwoc3QsIHRydWUpOworICAgICAgICAgICAgICAgICAgICAvLyBDbG9zZSBtZW51CisgICAgICAgICAgICAgICAgICAgIGNsb3NlUGFuZWwoc3QsIHRydWUpOwogCi0gICAgICAgICAgICB9IGVsc2UgaWYgKHN0LmlzUHJlcGFyZWQpIHsKKyAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHN0LmlzUHJlcGFyZWQpIHsKIAotICAgICAgICAgICAgICAgIC8vIFdyaXRlICdtZW51IG9wZW5lZCcgdG8gZXZlbnQgbG9nCi0gICAgICAgICAgICAgICAgRXZlbnRMb2cud3JpdGVFdmVudCg1MDAwMSwgMCk7CisgICAgICAgICAgICAgICAgICAgIC8vIFdyaXRlICdtZW51IG9wZW5lZCcgdG8gZXZlbnQgbG9nCisgICAgICAgICAgICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoNTAwMDEsIDApOwogCi0gICAgICAgICAgICAgICAgLy8gU2hvdyBtZW51Ci0gICAgICAgICAgICAgICAgb3BlblBhbmVsKHN0LCBldmVudCk7CisgICAgICAgICAgICAgICAgICAgIC8vIFNob3cgbWVudQorICAgICAgICAgICAgICAgICAgICBvcGVuUGFuZWwoc3QsIGV2ZW50KTsKIAotICAgICAgICAgICAgICAgIHBsYXlTb3VuZEVmZmVjdCA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgIHBsYXlTb3VuZEVmZmVjdCA9IHRydWU7CisgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogCiAgICAgICAgICAgICBpZiAocGxheVNvdW5kRWZmZWN0KSB7CkBAIC03NzcsOCArODQwLDIwIEBACiAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgfQogCi0gICAgICAgIC8vIFRoZSB3aW5kb3cgbWFuYWdlciB3aWxsIGdpdmUgdXMgYSB2YWxpZCB3aW5kb3cgdG9rZW4KLSAgICAgICAgbmV3IE1lbnVEaWFsb2dIZWxwZXIoc3ViTWVudSkuc2hvdyhudWxsKTsKKyAgICAgICAgZmluYWwgTWVudSBwYXJlbnRNZW51ID0gc3ViTWVudS5nZXRSb290TWVudSgpOworICAgICAgICBmaW5hbCBQYW5lbEZlYXR1cmVTdGF0ZSBwYW5lbCA9IGZpbmRNZW51UGFuZWwocGFyZW50TWVudSk7CisKKyAgICAgICAgLyoKKyAgICAgICAgICogVXNlIHRoZSBwYW5lbCBvcGVuIHN0YXRlIHRvIGRldGVybWluZSB3aGV0aGVyIHRoaXMgaXMgY29taW5nIGZyb20gYW4gb3BlbiBwYW5lbAorICAgICAgICAgKiBvciBhbiBhY3Rpb24gYnV0dG9uLiBJZiBpdCdzIGFuIG9wZW4gcGFuZWwgd2Ugd2FudCB0byB1c2UgTWVudURpYWxvZ0hlbHBlci4KKyAgICAgICAgICogSWYgaXQncyBjbG9zZWQgd2Ugd2FudCB0byBncmFiIHRoZSByZWxldmFudCB2aWV3IGFuZCBjcmVhdGUgYSBwb3B1cCBhbmNob3JlZCB0byBpdC4KKyAgICAgICAgICovCisgICAgICAgIGlmIChwYW5lbC5pc09wZW4pIHsKKyAgICAgICAgICAgIC8vIFRoZSB3aW5kb3cgbWFuYWdlciB3aWxsIGdpdmUgdXMgYSB2YWxpZCB3aW5kb3cgdG9rZW4KKyAgICAgICAgICAgIG5ldyBNZW51RGlhbG9nSGVscGVyKHN1Yk1lbnUpLnNob3cobnVsbCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBuZXcgTWVudVBvcHVwSGVscGVyKGdldENvbnRleHQoKSwgc3ViTWVudSkuc2hvdygpOworICAgICAgICB9CiAKICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgfQpAQCAtNzg4LDYgKzg2MywyMSBAQAogICAgIH0KIAogICAgIHByaXZhdGUgdm9pZCByZW9wZW5NZW51KGJvb2xlYW4gdG9nZ2xlTWVudU1vZGUpIHsKKyAgICAgICAgaWYgKG1BY3Rpb25CYXIgIT0gbnVsbCkgeworICAgICAgICAgICAgaWYgKCFtQWN0aW9uQmFyLmlzT3ZlcmZsb3dNZW51U2hvd2luZygpIHx8ICF0b2dnbGVNZW51TW9kZSkgeworICAgICAgICAgICAgICAgIGZpbmFsIENhbGxiYWNrIGNiID0gZ2V0Q2FsbGJhY2soKTsKKyAgICAgICAgICAgICAgICBpZiAoY2IgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBmaW5hbCBQYW5lbEZlYXR1cmVTdGF0ZSBzdCA9IGdldFBhbmVsU3RhdGUoRkVBVFVSRV9PUFRJT05TX1BBTkVMLCB0cnVlKTsKKyAgICAgICAgICAgICAgICAg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RhdGUucHV0U3BhcnNlUGFyY2VsYWJsZUFycmF5KFBBTkVMU19UQUcsIHBhbmVsU3RhdGVzKTsKICAgICAgICAgfQogCisgICAgICAgIGlmIChtQWN0aW9uQmFyICE9IG51bGwpIHsKKyAgICAgICAgICAgIG91dFN0YXRlLnB1dEJvb2xlYW4oQUNUSU9OX0JBUl9UQUcsIG1BY3Rpb25CYXIuaXNPdmVyZmxvd01lbnVTaG93aW5nKCkpOworICAgICAgICB9CisKICAgICAgICAgcmV0dXJuIG91dFN0YXRlOwogICAgIH0KIApAQCAtMTUwMiw2ICsxNTk3LDEwIEBACiAgICAgICAgIGlmIChwYW5lbFN0YXRlcyAhPSBudWxsKSB7CiAgICAgICAgICAgICByZXN0b3JlUGFuZWxTdGF0ZShwYW5lbFN0YXRlcyk7CiAgICAgICAgIH0KKworICAgICAgICBpZiAobUFjdGlvbkJhciAhPSBudWxsICYmIHNhdmVkSW5zdGFuY2VTdGF0ZS5nZXRCb29sZWFuKEFDVElPTl9CQVJfVEFHKSkgeworICAgICAgICAgICAgbUFjdGlvbkJhci5wb3N0U2hvd092ZXJmbG93TWVudSgpOworICAgICAgICB9CiAgICAgfQogCiAgICAgLyoqCkBAIC0xNTkyLDYgKzE2OTEsOSBAQAogICAgICAgICBwcml2YXRlIGJvb2xlYW4gbVdhdGNoaW5nRm9yTWVudTsKICAgICAgICAgcHJpdmF0ZSBpbnQgbURvd25ZOwogCisgICAgICAgIHByaXZhdGUgQWN0aW9uTW9kZSBtQWN0aW9uTW9kZTsKKyAgICAgICAgcHJpdmF0ZSBBY3Rpb25CYXJDb250ZXh0VmlldyBtQWN0aW9uTW9kZVZpZXc7CisKICAgICAgICAgcHVibGljIERlY29yVmlldyhDb250ZXh0IGNvbnRleHQsIGludCBmZWF0dXJlSWQpIHsKICAgICAgICAgICAgIHN1cGVyKGNvbnRleHQpOwogICAgICAgICAgICAgbUZlYXR1cmVJZCA9IGZlYXR1cmVJZDsKQEAgLTE2MDAsNyArMTcwMiw4IEBACiAgICAgICAgIEBPdmVycmlkZQogICAgICAgICBwdWJsaWMgYm9vbGVhbiBkaXNwYXRjaEtleUV2ZW50KEtleUV2ZW50IGV2ZW50KSB7CiAgICAgICAgICAgICBmaW5hbCBpbnQga2V5Q29kZSA9IGV2ZW50LmdldEtleUNvZGUoKTsKLSAgICAgICAgICAgIGZpbmFsIGJvb2xlYW4gaXNEb3duID0gZXZlbnQuZ2V0QWN0aW9uKCkgPT0gS2V5RXZlbnQuQUNUSU9OX0RPV047CisgICAgICAgICAgICBmaW5hbCBpbnQgYWN0aW9uID0gZXZlbnQuZ2V0QWN0aW9uKCk7CisgICAgICAgICAgICBmaW5hbCBib29sZWFuIGlzRG93biA9IGFjdGlvbiA9PSBLZXlFdmVudC5BQ1RJT05fRE9XTjsKIAogICAgICAgICAgICAgLyoKICAgICAgICAgICAgICAqIElmIHRoZSB1c2VyIGhpdHMgYW5vdGhlciBrZXkgd2l0aGluIHRoZSBwbGF5IHNvdW5kIGRlbGF5LCB0aGVuCkBAIC0xNjU3LDYgKzE3NjAsMTQgQEAKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAKKyAgICAgICAgICAgIC8vIEJhY2sgY2FuY2VscyBhY3Rpb24gbW9kZXMgZmlyc3QuCisgICAgICAgICAgICBpZiAobUFjdGlvbk1vZGUgIT0gbnVsbCAmJiBrZXlDb2RlID09IEtleUV2ZW50LktFWUNPREVfQkFDSykgeworICAgICAgICAgICAgICAgIGlmIChhY3Rpb24gPT0gS2V5RXZlbnQuQUNUSU9OX1VQKSB7CisgICAgICAgICAgICAgICAgICAgIG1BY3Rpb25Nb2RlLmZpbmlzaCgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgIH0KKwogICAgICAgICAgICAgZmluYWwgQ2FsbGJhY2sgY2IgPSBnZXRDYWxsYmFjaygpOwogICAgICAgICAgICAgZmluYWwgYm9vbGVhbiBoYW5k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25Nb2RlIG1vZGUgPSBnZXRDYWxsYmFjaygpLm9uU3RhcnRBY3Rpb25Nb2RlKHdyYXBwZWRDYWxsYmFjayk7CisgICAgICAgICAgICBpZiAobW9kZSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgbUFjdGlvbk1vZGUgPSBtb2RlOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBpZiAobUFjdGlvbk1vZGVWaWV3ID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKGhhc0ZlYXR1cmUoRkVBVFVSRV9BQ1RJT05fTU9ERV9PVkVSTEFZKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgbUFjdGlvbk1vZGVWaWV3ID0gbmV3IEFjdGlvbkJhckNvbnRleHRWaWV3KG1Db250ZXh0KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIEZyYW1lTGF5b3V0LkxheW91dFBhcmFtcyBwYXJhbXMgPSBuZXcgRnJhbWVMYXlvdXQuTGF5b3V0UGFyYW1zKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBNQVRDSF9QQVJFTlQsIFdSQVBfQ09OVEVOVCk7CisgICAgICAgICAgICAgICAgICAgICAgICBhZGRWaWV3KG1BY3Rpb25Nb2RlVmlldywgcGFyYW1zKTsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIFZpZXdTdHViIHN0dWIgPSAoVmlld1N0dWIpIGZpbmRWaWV3QnlJZCgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5pZC5hY3Rpb25fbW9kZV9iYXJfc3R1Yik7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoc3R1YiAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbUFjdGlvbk1vZGVWaWV3ID0gKEFjdGlvbkJhckNvbnRleHRWaWV3KSBzdHViLmluZmxhdGUoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIGlmIChtQWN0aW9uTW9kZVZpZXcgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBtb2RlID0gbmV3IFN0YW5kYWxvbmVBY3Rpb25Nb2RlKGdldENvbnRleHQoKSwgbUFjdGlvbk1vZGVWaWV3LCB3cmFwcGVkQ2FsbGJhY2spOworICAgICAgICAgICAgICAgICAgICBpZiAoY2FsbGJhY2sub25DcmVhdGVBY3Rpb25Nb2RlKG1vZGUsIG1vZGUuZ2V0TWVudSgpKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgbW9kZS5pbnZhbGlkYXRlKCk7CisgICAgICAgICAgICAgICAgICAgICAgICBtQWN0aW9uTW9kZVZpZXcuaW5pdEZvck1vZGUobW9kZSk7CisgICAgICAgICAgICAgICAgICAgICAgICBtQWN0aW9uTW9kZVZpZXcuc2V0VmlzaWJpbGl0eShWaWV3LlZJU0lCTEUpOworICAgICAgICAgICAgICAgICAgICAgICAgbUFjdGlvbk1vZGUgPSBtb2RlOworICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgbUFjdGlvbk1vZGUgPSBudWxsOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIG1BY3Rpb25Nb2RlOworICAgICAgICB9CisKICAgICAgICAgcHVibGljIHZvaWQgc3RhcnRDaGFuZ2luZygpIHsKICAgICAgICAgICAgIG1DaGFuZ2luZyA9IHRydWU7CiAgICAgICAgIH0KQEAgLTIwNTgsNiArMjIxOCwzNyBAQAogICAgICAgICAgICAgaWYgKGtlZXBPbikgUGhvbmVXaW5kb3cudGhpcy5hZGRGbGFncyhXaW5kb3dNYW5hZ2VyLkxheW91dFBhcmFtcy5GTEFHX0t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25BY3Rpb25JdGVtQ2xpY2tlZChBY3Rpb25Nb2RlIG1vZGUsIE1lbnVJdGVtIGl0ZW0pIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gbVdyYXBwZWQub25BY3Rpb25JdGVtQ2xpY2tlZChtb2RlLCBpdGVtKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgcHVibGljIHZvaWQgb25EZXN0cm95QWN0aW9uTW9kZShBY3Rpb25Nb2RlIG1vZGUpIHsKKyAgICAgICAgICAgICAgICBtV3JhcHBlZC5vbkRlc3Ryb3lBY3Rpb25Nb2RlKG1vZGUpOworICAgICAgICAgICAgICAgIGlmIChtQWN0aW9uTW9kZVZpZXcgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBtQWN0aW9uTW9kZVZpZXcucmVtb3ZlQWxsVmlld3MoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgbUFjdGlvbk1vZGUgPSBudWxsOworICAgICAgICAgICAgfQorICAgICAgICB9CiAgICAgfQogCiAgICAgcHJvdGVjdGVkIERlY29yVmlldyBnZW5lcmF0ZURlY29yKCkgewpAQCAtMjEwNiw2ICsyMjk3LDE3IEBACiAKICAgICAgICAgaWYgKGEuZ2V0Qm9vbGVhbihjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0eWxlYWJsZS5XaW5kb3dfd2luZG93Tm9UaXRsZSwgZmFsc2UpKSB7CiAgICAgICAgICAgICByZXF1ZXN0RmVhdHVyZShGRUFUVVJFX05PX1RJVExFKTsKKyAgICAgICAgfSBlbHNlIGlmIChhLmdldEJvb2xlYW4oY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5zdHlsZWFibGUuV2luZG93X3dpbmRvd0FjdGlvbkJhciwgZmFsc2UpKSB7CisgICAgICAgICAgICAvLyBEb24ndCBhbGxvdyBhbiBhY3Rpb24gYmFyIGlmIHRoZXJlIGlzIG5vIHRpdGxlLgorICAgICAgICAgICAgcmVxdWVzdEZlYXR1cmUo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UVVJFX0FDVElPTl9CQVIpOwogICAgICAgICB9IGVsc2UgaWYgKChmZWF0dXJlcyAmICgxIDw8IEZFQVRVUkVfTk9fVElUTEUpKSA9PSAwKSB7CiAgICAgICAgICAgICAvLyBJZiBubyBvdGhlciBmZWF0dXJlcyBhbmQgbm90IGVtYmVkZGVkLCBvbmx5IG5lZWQgYSB0aXRsZS4KICAgICAgICAgICAgIC8vIElmIHRoZSB3aW5kb3cgaXMgZmxvYXRpbmcsIHdlIG5lZWQgYSBkaWFsb2cgbGF5b3V0CiAgICAgICAgICAgICBpZiAobUlzRmxvYXRpbmcpIHsKICAgICAgICAgICAgICAgICBsYXlvdXRSZXNvdXJjZSA9IGNvbS5hbmRyb2lkLmludGVybmFsLlIubGF5b3V0LmRpYWxvZ190aXRsZTsKKyAgICAgICAgICAgIH0gZWxzZSBpZiAoKGZlYXR1cmVzICYgKDEgPDwgRkVBVFVSRV9BQ1RJT05fQkFSKSkgIT0gMCkgeworICAgICAgICAgICAgICAgIGlmICgoZmVhdHVyZXMgJiAoMSA8PCBGRUFUVVJFX0FDVElPTl9CQVJfT1ZFUkxBWSkpICE9IDApIHsKKyAgICAgICAgICAgICAgICAgICAgbGF5b3V0UmVzb3VyY2UgPSBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmxheW91dC5zY3JlZW5fYWN0aW9uX2Jhcl9vdmVybGF5OworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIGxheW91dFJlc291cmNlID0gY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5sYXlvdXQuc2NyZWVuX2FjdGlvbl9iYXI7CisgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICBsYXlvdXRSZXNvdXJjZSA9IGNvbS5hbmRyb2lkLmludGVybmFsLlIubGF5b3V0LnNjcmVlbl90aXRsZTsKICAgICAgICAgICAgIH0KQEAgLTIyNzMsNiArMjQ4NywyMiBAQAogICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgIG1UaXRsZVZpZXcuc2V0VGV4dChtVGl0bGUpOwogICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgbUFjdGlvbkJhciA9IChBY3Rpb25CYXJWaWV3KSBmaW5kVmlld0J5SWQoY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5pZC5hY3Rpb25fYmFyKTsKKyAgICAgICAgICAgICAgICBpZiAobUFjdGlvbkJhciAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIGlmIChtQWN0aW9uQmFyLmdldFRpdGxlKCkgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgbUFjdGlvbkJhci5zZXRXaW5kb3dUaXRsZShtVGl0bGUpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIC8vIFBvc3QgdGhlIHBhbmVsIGludmFsaWRhdGUgZm9yIGxhdGVyOyBhdm9pZCBhcHBsaWNhdGlvbiBvbkNyZWF0ZU9wdGlvbnNNZW51CisgICAgICAgICAgICAgICAgICAgIC8vIGJlaW5nIGNhbGxlZCBpbiB0aGUgbWlkZGxlIG9mIG9uQ3JlYXRlIG9yIHNpbWlsYXIuCisgICAgICAgICAgICAgICAgICAgIG1EZWNvci5wb3N0KG5ldyBSdW5uYWJsZSgpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIHJ1bigpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWlzRGVzdHJveWVkKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaW52YWxpZGF0ZVBhbmVsTWVudShGRUFUVVJFX0FDVElPTl9CQVIpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfSk7CisgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgfQpAQCAtMjYyNiw2ICsyODU2LDggQEAKIAogICAgICAgICBib29sZWFuIHJlZnJlc2hEZWNvclZpZXc7CiAKKyAgICAgICAgYm9vbGVhbiByZWZyZXNoTWVudUNvbnRlbnQ7CisgICAgICAgIAogICAgICAgICBib29sZWFuIHdhc0xhc3RPcGVuOwogICAgICAgICAKICAgICAgICAgYm9vbGVhbiB3YXNMYXN0RXhwYW5kZWQ7CkBAIC0yNzQ4LDExICsyOTgwLDExIEBACiAgICAgICogPGxpPiBDYWxscyBiYWNrIHRvIHRoZSBjYWxsYmFjaydzIG9uTWVudUl0ZW1TZWxlY3RlZCB3aGVuIGFuIGl0ZW0gaXMKICAgICAgKiBzZWxlY3RlZC4KICAgICAgKi8KLSAgICBwcml2YXRlIGZpbmFsIGNsYXNzIENvbnRleHRNZW51Q2FsbGJhY2sgaW1wbGVtZW50cyBNZW51QnVpbGRlci5DYWxsYmFjayB7CisgICAgcHJpdmF0ZSBmaW5hbCBjbGFzcyBEaWFsb2dNZW51Q2FsbGJhY2sgaW1wbGVtZW50cyBNZW51QnVpbGRlci5DYWxsYmFjayB7CiAgICAgICAgIHByaXZhdGUgaW50IG1GZWF0dXJlSWQ7CiAgICAgICAgIHByaXZhdGUgTWVudURpYWxvZ0hlbHBlciBtU3ViTWVudUhlbHBlcjsKIAotICAgICAgICBwdWJsaWMgQ29udGV4dE1lbnVDYWxsYmFjayhpbnQgZmVhdHVyZUlkKSB7CisgICAgICAgIHB1YmxpYyBEaWFsb2dNZW51Q2FsbGJhY2soaW50IGZlYXR1cmVJZCkgewogICAgICAgICAgICAgbUZlYXR1cmVJZCA9IGZlYXR1cmVJZDsKICAgICAgICAgfQogCmRpZmYgLS1naXQgYS9wb2xpY3kvc3JjL2NvbS9hbmRyb2lkL2ludGVybmFsL3BvbGljeS9pbXBsL1Bob25lV2luZG93TWFuYWdlci5qYXZhIGIvcG9saWN5L3NyYy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AorICAgICAgICAgICAgICAgICAgICAgICAgImNvbS5hbmRyb2lkLnN5c3RlbXVpLnN0YXR1c2Jhci5SZWNlbnRBcHBsaWNhdGlvbnNBY3Rpdml0eSIpOworICAgICAgICAgICAgICAgIGludGVudC5zZXRGbGFncyhJbnRlbnQuRkxBR19BQ1RJVklUWV9ORVdfVEFTSyAKKyAgICAgICAgICAgICAgICAgICAgICAgIHwgSW50ZW50LkZMQUdfQUNUSVZJVFlfRVhDTFVERV9GUk9NX1JFQ0VOVFMpOworICAgICAgICAgICAgICAgIG1Db250ZXh0LnN0YXJ0QWN0aXZpdHkoaW50ZW50KTsKKyAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICB9IGNhdGNoIChBY3Rpdml0eU5vdEZvdW5kRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICBMb2cuZShUQUcsICJGYWlsZWQgdG8gbGF1bmNoIFJlY2VudEFwcHNJbnRlbnQiLCBlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIC8vIEZhbGxiYWNrIHRvIGRpYWxvZyBpZiB3ZSBmYWlsIHRvIGxhdW5jaCB0aGUgYWJvdmUuCiAgICAgICAgIGlmIChtUmVjZW50QXBwc0RpYWxvZyA9PSBudWxsKSB7CiAgICAgICAgICAgICBtUmVjZW50QXBwc0RpYWxvZyA9IG5ldyBSZWNlbnRBcHBsaWNhdGlvbnNEaWFsb2cobUNvbnRleHQpOwogICAgICAgICB9CkBAIC01MjEsNiArNTQ3LDcgQEAKICAgICAgICAgbURlc2tEb2NrSW50ZW50LmFkZENhdGVnb3J5KEludGVudC5DQVRFR09SWV9ERVNLX0RPQ0spOwogICAgICAgICBtRGVza0RvY2tJbnRlbnQuYWRkRmxhZ3MoSW50ZW50LkZMQUdfQUNUSVZJVFlfTkVXX1RBU0sKICAgICAgICAgICAgICAgICB8IEludGVudC5GTEFHX0FDVElWSVRZX1JFU0VUX1RBU0tfSUZfTkVFREVEKTsKKwog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3VyQm90dG9tKTsKQEAgLTEyNjYsMTAgKzEzMDEsMTcgQEAKICAgICAgICAgICAgIGlmIChtU3RhdHVzQmFyLmlzVmlzaWJsZUx3KCkpIHsKICAgICAgICAgICAgICAgICAvLyBJZiB0aGUgc3RhdHVzIGJhciBpcyBoaWRkZW4sIHdlIGRvbid0IHdhbnQgdG8gY2F1c2UKICAgICAgICAgICAgICAgICAvLyB3aW5kb3dzIGJlaGluZCBpdCB0byBzY3JvbGwuCi0gICAgICAgICAgICAgICAgbURvY2tUb3AgPSBtQ29udGVudFRvcCA9IG1DdXJUb3AgPSBtU3RhdHVzQmFyLmdldEZyYW1lTHcoKS5ib3R0b207Ci0gICAgICAgICAgICAgICAgaWYgKERFQlVHX0xBWU9VVCkgTG9nLnYoVEFHLCAiU3RhdHVzIGJhcjogbURvY2tCb3R0b209IgotICAgICAgICAgICAgICAgICAgICAgICAgKyBtRG9ja0JvdHRvbSArICIgbUNvbnRlbnRCb3R0b209IgotICAgICAgICAgICAgICAgICAgICAgICAgKyBtQ29udGVudEJvdHRvbSArICIgbUN1ckJvdHRvbT0iICsgbUN1ckJvdHRvbSk7CisgICAgICAgICAgICAgICAgZmluYWwgUmVjdCByID0gbVN0YXR1c0Jhci5nZXRGcmFtZUx3KCk7CisgICAgICAgICAgICAgICAgaWYgKG1Eb2NrVG9wID09IHIudG9wKSBtRG9ja1RvcCA9IHIuYm90dG9tOworICAgICAgICAgICAgICAgIGVsc2UgaWYgKG1Eb2NrQm90dG9tID09IHIuYm90dG9tKSBtRG9ja0JvdHRvbSA9IHIudG9wOworICAgICAgICAgICAgICAgIG1Db250ZW50VG9wID0gbUN1clRvcCA9IG1Eb2NrVG9wOworICAgICAgICAgICAgICAgIG1Db250ZW50Qm90dG9tID0gbUN1ckJvdHRvbSA9IG1Eb2NrQm90dG9tOworICAgICAgICAgICAgICAgIGlmIChERUJVR19MQVlPVVQpIExvZy52KFRBRywgIlN0YXR1cyBiYXI6IG1Eb2NrVG9wPSIgKyBtRG9ja1RvcAorICAgICAgICAgICAgICAgICAgICAgICAgKyAiIG1Db250ZW50VG9wPSIgKyBtQ29udGVudFRvcAorICAgICAgICAgICAgICAgICAgICAgICAgKyAiIG1DdXJUb3A9IiArIG1DdXJUb3AKKyAgICAgICAgICAgICAgICAgICAgICAgICsgIiBtRG9ja0JvdHRvbT0iICsgbURvY2tCb3R0b20KKyAgICAgICAgICAgICAgICAgICAgICAgICsgIiBtQ29udGVudEJvdHRvbT0iICsgbUNvbnRlbnRCb3R0b20KKyAgICAgICAgICAgICAgICAgICAgICAgICsgIiBtQ3VyQm90dG9tPSIgKyBtQ3VyQm90dG9tKTsKICAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgIH0KQEAgLTEzNTQsNyArMTM5Niw3IEBACiAgICAgICAgICAgICBhdHRycy5ncmF2aXR5ID0gR3Jhdml0eS5CT1RUT007CiAgICAgICAgICAgICBtRG9ja0xheWVyID0gd2luLmdldFN1cmZhY2VMYXllcigpOwogICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgaWYgKChmbCAmCisgICAgICAgICAgICBpZiAobVN0YXR1c0JhckNhbkhpZGUgJiYgKGZsICYKICAgICAgICAgICAgICAgICAgICAgKEZMQUdfTEFZT1VUX0lOX1NDUkVFTiB8IEZMQUdfRlVMTFNDUkVFTiB8IEZMQUdfTEFZT1VUX0lOU0VUX0RFQ09SKSkKICAgICAgICAgICAgICAgICAgICAgPT0gKEZMQUdfTEFZT1VUX0lOX1NDUkVFTiB8IEZMQUdfTEFZT1VUX0lOU0VUX0RFQ09SKSkgewogICAgICAgICAgICAgICAgIC8vIFRoaXMgaXMgdGhlIGNhc2UgZm9yIGEgbm9ybWFsIGFjdGl2aXR5IHdpbmRvdzogd2Ugd2FudCBpdApAQCAtMTM4Niw3ICsxNDI4LDcgQEAKICAgICAgICAgICAgICAgICAgICAgdmYucmlnaHQgPSBtQ3VyUmlnaHQ7CiAgICAgICAgICAgICAgICAgICAgIHZmLmJvdHRvbSA9IG1DdXJCb3R0b207CiAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfSBlbHNlIGlmICgoZmwgJiBGTEFHX0xBWU9VVF9JTl9TQ1JFRU4pICE9IDApIHsKKyAgICAgICAgICAgIH0gZWxzZSBpZiAobVN0YXR1c0JhckNhbkhpZGUgJiYgKGZsICYgRkxBR19MQVlPVVRfSU5fU0NSRUVOKSAhPSAwKSB7CiAgICAgICAgICAgICAgICAgLy8gQSB3aW5kb3cgdGhhdCBoYXMgcmVxdWVzdGVkIHRvIGZpbGwgdGhlIGVudGlyZSBzY3JlZW4ganVzdAogICAgICAgICAgICAgICAgIC8vIGdldHMgZXZlcnl0aGluZywgcGVyaW9kLgogICAgICAgICAgICAgICAgIHBmLmxlZnQgPSBkZi5sZWZ0ID0gY2YubGVmdCA9IDA7CkBAIC0xNTMwLDkgKzE1NzIsMTMgQEAKICAgICAgICAgICAgICAgICBib29sZWFuIGhpZGVTdGF0dXNCYXIgPQogICAgICAgICAgICAgICAgICAgICAobHAuZmxhZ3MgJiBXaW5kb3dNYW5hZ2VyLkxheW91dFBhcmFtcy5GTEFHX0ZVTExTQ1JFRU4pICE9IDA7CiAgICAgICAgICAgICAgICAgaWYgKGhpZGVTdGF0dXNCYXIpIHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKERFQlVHX0xBWU9VVCkgTG9nLnYoVEFHLCAiSGlkaW5nIHN0YXR1cyBiYXIiKTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKG1TdGF0dXNCYXIuaGlkZUx3KHRydWUpKSBjaGFuZ2VzIHw9IEZJTklTSF9MQVlPVVRfUkVET19MQVlPVVQ7Ci0gICAgICAgICAgICAgICAgICAgIGhpZGluZyA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgIGlmIChtU3RhdHVzQmFyQ2FuSGlkZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKERFQlVHX0xBWU9VVCkgTG9nLnYoVEFHLCAiSGlkaW5nIHN0YXR1cyBiYXI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sdWdnZWRJbjsKKyAgICAgICAgbUJhdHRlcnlMZXZlbCA9IGJhdHRlcnlMZXZlbDsKKyAgICAgICAgdXBkYXRlU3RhdHVzTGluZXMoKTsKKyAgICB9CisKKyAgICB2b2lkIG9uVGltZUNoYW5nZWQoKSB7CisgICAgICAgIHJlZnJlc2hUaW1lQW5kRGF0ZURpc3BsYXkoKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBvblJpbmdlck1vZGVDaGFuZ2VkKGludCBzdGF0ZSkgeworICAgIH0KKworICAgIHZvaWQgb25SZWZyZXNoQ2FycmllckluZm8oQ2hhclNlcXVlbmNlIHBsbW4sIENoYXJTZXF1ZW5jZSBzcG4pIHsKKyAgICAgICAgc2V0Q2FycmllclRleHQoTG9ja1NjcmVlbi5nZXRDYXJyaWVyU3RyaW5nKHBsbW4sIHNwbikpOworICAgIH0KKworICAgIHB1YmxpYyBTdGF0dXNWaWV3KFZpZXcgdmlldywgS2V5Z3VhcmRVcGRhdGVNb25pdG9yIHVwZGF0ZU1vbml0b3IsCisgICAgICAgICAgICAgICAgICBMb2NrUGF0dGVyblV0aWxzIGxvY2tQYXR0ZXJuVXRpbHMpIHsKKyAgICAgICAgbVZpZXcgPSB2aWV3OworICAgICAgICBtQ2FycmllciA9IChUZXh0VmlldykgZmluZFZpZXdCeUlkKFIuaWQuY2Fycmllcik7CisgICAgICAgIG1IYXNDYXJyaWVyID0gKG1DYXJyaWVyICE9IG51bGwpOworICAgICAgICBtRGF0ZSA9IChUZXh0VmlldykgZmluZFZpZXdCeUlkKFIuaWQuZGF0ZSk7CisgICAgICAgIG1IYXNEYXRlID0gKG1EYXRlICE9IG51bGwpOworICAgICAgICBtRGF0ZUZvcm1hdFN0cmluZyA9IGdldENvbnRleHQoKS5nZXRTdHJpbmcoUi5zdHJpbmcuZnVsbF93ZGF5X21vbnRoX2RheV9ub195ZWFyKTsKKworICAgICAgICByZWZyZXNoVGltZUFuZERhdGVEaXNwbGF5KCk7CisKKyAgIC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J0eSkgeworICAgICAgICAgICAgLy8gVE9ETyBHZXQgYWN0dWFsIG5hbWUgJiBlbWFpbAorICAgICAgICAgICAgU3RyaW5nIG5hbWUgPSAiSm9obiBTbWl0aCI7CisgICAgICAgICAgICBTdHJpbmcgZW1haWwgPSAianNtaXRoQGdtYWlsLmNvbSI7CisgICAgICAgICAgICBtUHJvcGVydHlPZi5zZXRUZXh0KCJQcm9wZXJ0eSBvZjpcbiIgKyBuYW1lICsgIlxuIiArIGVtYWlsKTsKKyAgICAgICAgICAgIG1Qcm9wZXJ0eU9mLnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKKyAgICAgICAgfQorCisgICAgICAgIGlmICghbUhhc1N0YXR1czIpIHJldHVybjsKKworICAgICAgICBpZiAobUluc3RydWN0aW9ucyAhPSBudWxsKSB7CisgICAgICAgICAgICAvLyBpbnN0cnVjdGlvbnMgb25seQorICAgICAgICAgICAgbVN0YXR1czEuc2V0VGV4dChtSW5zdHJ1Y3Rpb25zKTsKKyAgICAgICAgICAgIGlmIChUZXh0VXRpbHMuaXNFbXB0eShtSW5zdHJ1Y3Rpb25zKSkgeworICAgICAgICAgICAgICAgIG1TdGF0dXMxLnNldENvbXBvdW5kRHJhd2FibGVzV2l0aEludHJpbnNpY0JvdW5kcygwLCAwLCAwLCAwKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgbVN0YXR1czEuc2V0Q29tcG91bmREcmF3YWJsZXNXaXRoSW50cmluc2ljQm91bmRzKAorICAgICAgICAgICAgICAgICAgICAgICAgUi5kcmF3YWJsZS5pY19sb2NrX2lkbGVfbG9jaywgMCwgMCwgMCk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIG1TdGF0dXMxLnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKKyAgICAgICAgICAgIG1TdGF0dXMyLnNldFZpc2liaWxpdHkoVmlldy5JTlZJU0lCTEUpOworICAgICAgICB9IGVsc2UgaWYgKG1TaG93aW5nQmF0dGVyeUluZm8gJiYgbU5leHRBbGFybSA9PSBudWxsKSB7CisgICAgICAgICAgICAvLyBiYXR0ZXJ5IG9ubHkKKyAgICAgICAgICAgIGlmIChtUGx1Z2dlZEluKSB7CisgICAgICAgICAgICAgIGlmIChtQmF0dGVyeUxldmVsID49IDEwMCkgeworICAgICAgICAgICAgICAgIG1TdGF0dXMxLnNldFRleHQoZ2V0Q29udGV4dCgpLmdldFN0cmluZyhSLnN0cmluZy5sb2Nrc2NyZWVuX2NoYXJnZWQpKTsKKyAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgIG1TdGF0dXMxLnNldFRleHQoZ2V0Q29udGV4dCgpLmdldFN0cmluZyhSLnN0cmluZy5sb2Nrc2NyZWVuX3BsdWdnZWRfaW4sCisgICAgICAgICAgICAgICAgICAgICAgICAgIG1CYXR0ZXJ5TGV2ZWwpKTsKKyAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBtU3RhdHVzMS5zZXRUZXh0KGdldENvbnRleHQoKS5nZXRTdHJpbmcoUi5zdHJpbmcubG9ja3NjcmVlbl9sb3dfYmF0dGVyeSkpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgbVN0YXR1czEuc2V0Q29tcG91bmREcmF3YWJsZXNXaXRoSW50cmluc2ljQm91bmRzKFIuZHJhd2FibGUuaWNfbG9ja19pZGxlX2NoYXJnaW5nLCAwLAorICAgICAgICAgICAgICAgICAgICAwLCAwKTsKKworICAgICAgICAgICAgbVN0YXR1czEuc2V0VmlzaWJpbGl0eShWaWV3LlZJU0lCTEUpOworICAgICAgICAgICAgbVN0YXR1czIuc2V0VmlzaWJpbGl0eShWaWV3LklOVklTSUJMRSk7CisKKyAgICAgICAgfSBlbHNlIGlmIChtTmV4dEFsYXJtICE9IG51bGwgJiYgIW1TaG93aW5nQmF0dGVyeUluZm8pIHsKKyAgICAgICAgICAgIC8vIGFsYXJtIG9ubHkKKyAgICAgICAgICAgIG1TdGF0dXMxLnNldFRleHQobU5leHRBbGFybSk7CisgICAgICAgICAgICBtU3RhdHVzMS5zZXRDb21wb3VuZERyYXdhYmxlc1dpdGhJbnRyaW5zaWNCb3VuZHMoUi5kcmF3YWJsZS5pY19sb2NrX2lkbGVfYWxhcm0sIDAsCisgICAgICAgICAgICAgICAgICAgIDAsIDApOworCisgICAgICAgICAgICBtU3RhdHVzMS5zZXRWaXNpYmlsaXR5KFZpZXcuVklTSUJMRSk7CisgICAgICAgICAgICBtU3RhdHVzMi5zZXRWaXNpYmlsaXR5KFZpZXcuSU5WSVNJQkxFKTsKKyAgICAgICAgfSBlbHNlIGlmIChtTmV4dEFsYXJtICE9IG51bGwgJiYgbVNob3dpbmdCYXR0ZXJ5SW5mbykgeworICAgICAgICAgICAgLy8gYm90aCBiYXR0ZXJ5IGFuZCBuZXh0IGFsYXJtCisgICAgICAgICAgICBtU3RhdHVzMS5zZXRUZXh0KG1OZXh0QWxhcm0pOworICAgICAgICAgICAgbVN0YXR1czIuc2V0VGV4dChnZXRDb250ZXh0KCkuZ2V0U3RyaW5nKAorICAgICAgICAgICAgICAgICAgICBSLnN0cmluZy5sb2Nrc2NyZWVuX2JhdHRlcnlfc2hvcnQsCisgICAgICAgICAgICAgICAgICAgIE1hdGgubWluKDEwMCwgbUJhdHRlcnlMZXZlbCkpKTsKKyAgICAgICAgICAgIG1TdGF0dXMxLnNldENvbXBvdW5kRHJhd2FibGVzV2l0aEludHJpbnNpY0JvdW5kcyhSLmRyYXdhYmxlLmljX2xvY2tfaWRsZV9hbGFybSwgMCwKKyAgICAgICAgICAgICAgICAgICAgMCwgMCk7CisgICAgICAgICAgICBpZiAobVBsdWdnZWRJbikgeworICAgICAgICAgICAgICAgIG1TdGF0dXMyLnNldENvbXBvdW5kRHJhd2FibGVzV2l0aEludHJpbnNpY0JvdW5kcyhSLmRyYXdhYmxlLmljX2xvY2tfaWRsZV9jaGFyZ2luZywKKyAgICAgICAgICAgICAgICAgICAgICAgIDAsIDAsIDApOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBtU3RhdHVzMi5zZXRDb21wb3VuZERyYXdhYmxlc1dpdGhJbnRyaW5zaWNCb3VuZHMoMCwgMCwgMCwgMCk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIG1TdGF0dXMxLnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKKyAgICAgICAgICAgIG1TdGF0dXMyLnNldFZpc2liaWxpdHkoVmlldy5WSVNJQkxFKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIC8vIG5vdGhpbmcgc3BlY2lmaWMgdG8gc2hvdzsgc2hvdyBnZW5lcmFsIGluc3RydWN0aW9ucworICAgICAgICAgICAgbVN0YXR1czEuc2V0VGV4dChSLnN0cmluZy5sb2Nrc2NyZWVuX3BhdHRlcm5faW5zdHJ1Y3Rpb25zKTsKKyAgICAgICAgICAgIG1TdGF0dXMxLnNldENvbXBvdW5kRHJhd2FibGVzV2l0aEludHJpbnNpY0JvdW5kcyhSLmRyYXdhYmxlLmljX2xvY2tfaWRsZV9sb2NrLCAwLAorICAgICAgICAgICAgICAgICAgICAwLCAwKTsKKworICAgICAgICAgICAgbVN0YXR1czEuc2V0VmlzaWJpbGl0eShWaWV3LlZJU0lCTEUpOworICAgICAgICAgICAgbVN0YXR1czIuc2V0VmlzaWJpbGl0eShWaWV3LklOVklTSUJMRSk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKiogT3JpZ2luYXRlZCBmcm9tIExvY2tTY3JlZW4gKiovCisgICAgLy8gVE9ETyBNZXJnZSB3aXRoIGZ1bmN0aW9uIGFib3ZlCisgICAgdm9pZCB1cGRhdGVTdGF0dXNMaW5lcyhib29sZWFuIHNob3dTdGF0dXNMaW5lcywgU3RyaW5nIGNoYXJnaW5nLCBEcmF3YWJsZSBjaGFyZ2luZ0ljb24sCisgICAgICAgICAgICBEcmF3YWJsZSBhbGFybUljb24pIHsKKyAgICAgICAgaWYgKCFzaG93U3RhdHVzTGluZXMgfHwgKGNoYXJnaW5nID09IG51bGwgJiYgbU5leHRBbGFybSA9PSBudWxsKSkgeworICAgICAgICAgICAgbVN0YXR1czEuc2V0VmlzaWJpbGl0eShWaWV3LklOVklTSUJMRSk7CisgICAgICAgICAgICBtU3RhdHVzMi5zZXRWaXNpYmlsaXR5KFZpZXcuSU5WSVNJQkxFKTsKKyAgICAgICAgfSBlbHNlIGlmIChjaGFyZ2luZyAhPSBudWxsICYmIG1OZXh0QWxhcm0gPT0gbnVsbCkgeworICAgICAgICAgICAgLy8gY2hhcmdpbmcgb25seQorICAgICAgICAgICAgbVN0YXR1czEuc2V0VmlzaWJpbGl0eShWaWV3LlZJU0lCTEUpOworICAgICAgICAgICAgbVN0YXR1czIuc2V0VmlzaWJpbGl0eShWaWV3LklOVklTSUJMRSk7CisKKyAgICAgICAgICAgIG1TdGF0dXMxLnNldFRleHQoY2hhcmdpbmcpOworICAgICAgICAgICAgbVN0YXR1czEuc2V0Q29tcG91bmREcmF3YWJsZXNXaXRoSW50cmluc2ljQm91bmRzKGNoYXJnaW5nSWNvbiwgbnVsbCwgbnVsbCwgbnVsbCk7CisgICAgICAgIH0gZWxzZSBpZiAobU5leHRBbGFybSAhPSBudWxsICYmIGNoYXJnaW5nID09IG51bGwpIHsKKyAgICAgICAgICAgIC8vIG5leHQgYWxhcm0gb25seQorICAgICAgICAgICAgbVN0YXR1czEuc2V0VmlzaWJpbGl0eShWaWV3LlZJU0lCTEUpOworICAgICAgICAgICAgbVN0YXR1czIuc2V0VmlzaWJpbGl0eShWaWV3LklOVklTSUJMRSk7CisKKyAgICAgICAgICAgIG1TdGF0dXMxLnNldFRleHQobU5leHRBbGFybSk7CisgICAgICAgICAgICBtU3RhdHVzMS5zZXRDb21wb3VuZERyYXdhYmxlc1dpdGhJbnRyaW5zaWNCb3VuZHMoYWxhcm1JY29uLCBudWxsLCBudWxsLCBudWx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sKKyAgICAgICAgICAgIGlmIChtU3VyZmFjZSA9PSAwICYmIG1QcmV2aWV3V2luZG93ID09IDApIHsKICAgICAgICAgICAgICAgICBMT0cxKCJtU3VyZmFjZSBpcyBub3Qgc2V0IHlldC4iKTsKICAgICAgICAgICAgICAgICAvLyBzdGlsbCBhYmxlIHRvIHN0YXJ0IHByZXZpZXcgaW4gdGhpcyBjYXNlLgogICAgICAgICAgICAgfQogICAgICAgICAgICAgcmV0dXJuIHN0YXJ0UHJldmlld01vZGUoKTsKICAgICAgICAgY2FzZSBDQU1FUkFfUkVDT1JESU5HX01PREU6Ci0gICAgICAgICAgICBpZiAobVN1cmZhY2UgPT0gMCkgewotICAgICAgICAgICAgICAgIExPR0UoIm1TdXJmYWNlIG11c3QgYmUgc2V0IGJlZm9yZSBzdGFydFJlY29yZGluZ01vZGUuIik7CisgICAgICAgICAgICBpZiAobVN1cmZhY2UgPT0gMCAmJiBtUHJldmlld1dpbmRvdyA9PSAwKSB7CisgICAgICAgICAgICAgICAgTE9HRSgibVN1cmZhY2Ugb3IgbVByZXZpZXdXaW5kb3cgbXVzdCBiZSBzZXQgYmVmb3JlIHN0YXJ0UmVjb3JkaW5nTW9kZS4iKTsKICAgICAgICAgICAgICAgICByZXR1cm4gSU5WQUxJRF9PUEVSQVRJT047CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICByZXR1cm4gc3RhcnRSZWNvcmRpbmdNb2RlKCk7CkBAIC02NTcsMTYgKzYzNCwxMCBAQAogICAgICAgICBpZiAocmVzdWx0ICE9IE5PX0VSUk9SKSByZXR1cm4gcmVzdWx0OwogICAgICAgICByZXN1bHQgPSBtSGFyZHdhcmUtPnN0YXJ0UHJldmlldygpOwogICAgIH0gZWxzZSB7CisgICAgICAgIC8vIFhYWDogU2V0IHRoZSBvcmllbnRhdGlvbiBvZiB0aGUgQU5hdGl2ZVdpbmRvdy4KKyAgICAgICAgbUhhcmR3YXJlLT5zZXRQcmV2aWV3V2luZG93KG1QcmV2aWV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GF0YUNoYW5nZWQoaW50W10gYXBwV2lkZ2V0SWRzLCBpbnQgdmlld0lkKSB7CisgICAgICAgIGlmIChhcHBXaWRnZXRJZHMgPT0gbnVsbCkgeworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisgICAgICAgIGlmIChhcHBXaWRnZXRJZHMubGVuZ3RoID09IDApIHsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorICAgICAgICBmaW5hbCBpbnQgTiA9IGFwcFdpZGdldElkcy5sZW5ndGg7CisKKyAgICAgICAgc3luY2hyb25pemVkIChtQXBwV2lkZ2V0SWRzKSB7CisgICAgICAgICAgICBmb3IgKGludCBpPTA7IGk8TjsgaSsrKSB7CisgICAgICAgICAgICAgICAgQXBwV2lkZ2V0SWQgaWQgPSBsb29rdXBBcHBXaWRnZXRJZExvY2tlZChhcHBXaWRnZXRJZHNbaV0pOworICAgICAgICAgICAgICAgIG5vdGlmeUFwcFdpZGdldFZpZXdEYXRhQ2hhbmdlZEluc3RhbmNlTG9ja2VkKGlkLCB2aWV3SWQpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCiAgICAgcHVibGljIHZvaWQgdXBkYXRlQXBwV2lkZ2V0UHJvdmlkZXIoQ29tcG9uZW50TmFtZSBwcm92aWRlciwgUmVtb3RlVmlld3Mgdmlld3MpIHsKICAgICAgICAgc3luY2hyb25pemVkIChtQXBwV2lkZ2V0SWRzKSB7CiAgICAgICAgICAgICBQcm92aWRlciBwID0gbG9va3VwUHJvdmlkZXJMb2NrZWQocHJvdmlkZXIpOwpAQCAtNDQzLDExICs0NzcsMTcgQEAKICAgICB9CiAKICAgICB2b2lkIHVwZGF0ZUFwcFdpZGdldEluc3RhbmNlTG9ja2VkKEFwcFdpZGdldElkIGlkLCBSZW1vdGVWaWV3cyB2aWV3cykgeworICAgICAgICB1cGRhdGVBcHBXaWRnZXRJbnN0YW5jZUxvY2tlZChpZCwgdmlld3MsIGZhbHNlKTsKKyAgICB9CisK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3MKKyAgICAgICAgLy8gbG9va3VwIGFsc28gY2hlY2tzIHRoYXQgdGhlIGNhbGxpbmcgcHJvY2VzcyBjYW4gYWNjZXNzIHRoZSBhcHBXaWRnZXRJZAorICAgICAgICAvLyBkcm9wIHVuYm91bmQgYXBwV2lkZ2V0SWRzIChzaG91bGRuJ3QgYmUgcG9zc2libGUgdW5kZXIgbm9ybWFsIGNpcmN1bXN0YW5jZXMpCisgICAgICAgIGlmIChpZCAhPSBudWxsICYmIGlkLnByb3ZpZGVyICE9IG51bGwgJiYgIWlkLnByb3ZpZGVyLnpvbWJpZSAmJiAhaWQuaG9zdC56b21iaWUpIHsKKyAgICAgICAgICAgIC8vIGlzIGFueW9uZSBsaXN0ZW5pbmc/CisgICAgICAgICAgICBpZiAoaWQuaG9zdC5jYWxsYmFja3MgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgIC8vIHRoZSBsb2NrIGlzIGhlbGQsIGJ1dCB0aGlzIGlzIGEgb25ld2F5IGNhbGwKKyAgICAgICAgICAgICAgICAgICAgaWQuaG9zdC5jYWxsYmFja3Mudmlld0RhdGFDaGFuZ2VkKGlkLmFwcFdpZGdldElkLCB2aWV3SWQpOworICAgICAgICAgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgICAgIC8vIEl0IGZhaWxlZDsgcmVtb3ZlIHRoZSBjYWxsYmFjay4gTm8gbmVlZCB0byBwcnVuZSBiZWNhdXNlCisgICAgICAgICAgICAgICAgICAgIC8vIHdlIGtub3cgdGhhdCB0aGlzIGhvc3QgaXMgc3RpbGwgcmVmZXJlbmNlZCBieSB0aGlzIGluc3RhbmNlLgorICAgICAgICAgICAgICAgICAgICBpZC5ob3N0LmNhbGxiYWNrcyA9IG51bGw7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCiAgICAgcHVibGljIGlud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B0YWtlIGNhcmUgb2YgcmVtb3ZpbmcKKyAgICAgICAgICAgICAgICAgICAgLy8gdGhlIGRlYWQgb2JqZWN0IGZvciB1cy4KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBtUHJpbWFyeUNsaXBMaXN0ZW5lcnMuZmluaXNoQnJvYWRjYXN0KCk7CisgICAgICAgIH0KKyAgICB9CiAgICAgCi0gICAgICAgICAgICBtQ2xpcGJvYXJkID0gdGV4dDsKLSAgICAgICAgfQotICAgIH0KLQotICAgIC8vIGphdmFkb2MgZnJvbSBpbnRlcmZhY2UKLSAgICBwdWJsaWMgQ2hhclNlcXVlbmNlIGdldENsaXBib2FyZFRleHQoKSB7CisgICAgcHVibGljIENsaXBEYXRhIGdldFByaW1hcnlDbGlwKCkgewogICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKLSAgICAgICAgICAgIHJldHVybiBtQ2xpcGJvYXJkOworICAgICAgICAgICAgcmV0dXJuIG1QcmltYXJ5Q2xpcDsKICAgICAgICAgfQogICAgIH0KIAotICAgIC8vIGphdmFkb2MgZnJvbSBpbnRlcmZhY2UKKyAgICBwdWJsaWMgQ2xpcERlc2NyaXB0aW9uIGdldFByaW1hcnlDbGlwRGVzY3JpcHRpb24oKSB7CisgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgeworICAgICAgICAgICAgcmV0dXJuIG5ldyBDbGlwRGVzY3JpcHRpb24obVByaW1hcnlDbGlwKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyBib29sZWFuIGhhc1ByaW1hcnlDbGlwKCkgeworICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKKyAgICAgICAgICAgIHJldHVybiBtUHJpbWFyeUNsaXAgIT0gbnVsbDsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGFkZFByaW1hcnlDbGlwQ2hhbmdlZExpc3RlbmVyKElPblByaW1hcnlDbGlwQ2hhbmdlZExpc3RlbmVyIGxpc3RlbmVyKSB7CisgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgeworICAgICAgICAgICAgbVByaW1hcnlDbGlwTGlzdGVuZXJzLnJlZ2lzdGVyKGxpc3RlbmVyKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHJlbW92ZVByaW1hcnlDbGlwQ2hhbmdlZExpc3RlbmVyKElPblByaW1hcnlDbGlwQ2hhbmdlZExpc3RlbmVyIGxpc3RlbmVyKSB7CisgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgeworICAgICAgICAgICAgbVByaW1hcnlDbGlwTGlzdGVuZXJzLnVucmVnaXN0ZXIobGlzdGVuZXIpOworICAgICAgICB9CisgICAgfQorCiAgICAgcHVibGljIGJvb2xlYW4gaGFzQ2xpcGJvYXJkVGV4dCgpIHsKICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7Ci0gICAgICAgICAgICByZXR1cm4gbUNsaXBib2FyZC5sZW5ndGgoKSA+IDA7CisgICAgICAgICAgICBpZiAobVByaW1hcnlDbGlwICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBDaGFyU2VxdWVuY2UgdGV4dCA9IG1QcmltYXJ5Q2xpcC5nZXRJdGVtKDApLmdldFRleHQoKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gdGV4dCAhPSBudWxsICYmIHRleHQubGVuZ3RoKCkgPiAwOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICB9CiAgICAgfQogfQpkaWZmIC0tZ2l0IGEvc2VydmljZXMvamF2YS9jb20vYW5kcm9pZC9zZXJ2ZXIvQ29ubmVjdGl2aXR5U2VydmljZS5qYXZhIGIvc2VydmljZXMvamF2YS9jb20vYW5kcm9pZC9zZXJ2ZXIvQ29ubmVjdGl2aXR5U2VydmljZS5qYXZhCmluZGV4IDRjODEzODAuLmI2ZDcyNWYgMTAwNjQ0Ci0tLSBhL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PSBjb250ZXh0OworICAgIHB1YmxpYyBzdGF0aWMgc3luY2hyb25pemVkIENvbm5lY3Rpdml0eVNlcnZpY2UgZ2V0SW5zdGFuY2UoQ29udGV4dCBjb250ZXh0KSB7CisgICAgICAgIGlmIChzU2VydmljZUluc3RhbmNlID09IG51bGwpIHsKKyAgICAgICAgICAgIHNTZXJ2aWNlSW5zdGFuY2UgPSBuZXcgQ29ubmVjdGl2aXR5U2VydmljZShjb250ZXh0KTsKICAgICAgICAgfQotCi0gICAgICAgIEBPdmVycmlkZQotICAgICAgICBwdWJsaWMgdm9pZCBydW4oKSB7Ci0gICAgICAgICAgICBMb29wZXIucHJlcGFyZSgpOwotICAgICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7Ci0gICAgICAgICAgICAgICAgc1NlcnZpY2VJbnN0YW5jZSA9IG5ldyBDb25uZWN0aXZpdHlTZXJ2aWNlKG1Db250ZXh0KTsKLSAgICAgICAgICAgICAgICBub3RpZnlBbGwoKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIExvb3Blci5sb29wKCk7Ci0gICAgICAgIH0KLQotICAgICAgICBwdWJsaWMgc3RhdGljIENvbm5lY3Rpdml0eVNlcnZpY2UgZ2V0U2VydmljZUluc3RhbmNlKENvbnRleHQgY29udGV4dCkgewotICAgICAgICAgICAgQ29ubmVjdGl2aXR5VGhyZWFkIHRocmVhZCA9IG5ldyBDb25uZWN0aXZpdHlUaHJlYWQoY29udGV4dCk7Ci0gICAgICAgICAgICB0aHJlYWQuc3RhcnQoKTsKLQotICAgICAgICAgICAgc3luY2hyb25pemVkICh0aHJlYWQpIHsKLSAgICAgICAgICAgICAgICB3aGlsZSAoc1NlcnZpY2VJbnN0YW5jZSA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAvLyBXYWl0IHVudGlsIHNTZXJ2aWNlSW5zdGFuY2UgaGFzIGJlZW4gaW5pdGlhbGl6ZWQuCi0gICAgICAgICAgICAgICAgICAgICAgICB0aHJlYWQud2FpdCgpOwotICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChJbnRlcnJ1cHRlZEV4Y2VwdGlvbiBpZ25vcmUpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIFNsb2cuZShUQUcsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIlVuZXhwZWN0ZWQgSW50ZXJydXB0ZWRFeGNlcHRpb24gd2hpbGUgd2FpdGluZyIrCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIiBmb3IgQ29ubmVjdGl2aXR5U2VydmljZSB0aHJlYWQiKTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgcmV0dXJuIHNTZXJ2aWNlSW5zdGFuY2U7Ci0gICAgICAgIH0KLSAgICB9Ci0KLSAgICBwdWJsaWMgc3RhdGljIENvbm5lY3Rpdml0eVNlcnZpY2UgZ2V0SW5zdGFuY2UoQ29udGV4dCBjb250ZXh0KSB7Ci0gICAgICAgIHJldHVybiBDb25uZWN0aXZpdHlUaHJlYWQuZ2V0U2VydmljZUluc3RhbmNlKGNvbnRleHQpOworICAgICAgICByZXR1cm4gc1NlcnZpY2VJbnN0YW5jZTsKICAgICB9CiAKICAgICBwcml2YXRlIENvbm5lY3Rpdml0eVNlcnZpY2UoQ29udGV4dCBjb250ZXh0KSB7CiAgICAgICAgIGlmIChEQkcpIFNsb2cudihUQUcsICJDb25uZWN0aXZpdHlTZXJ2aWNlIHN0YXJ0aW5nIHVwIik7CiAKKyAgICAgICAgSGFuZGxlclRocmVhZCBoYW5kbGVyVGhyZWFkID0gbmV3IEhhbmRsZXJUaHJlYWQoIkNvbm5lY3Rpdml0eVNlcnZpY2VUaHJlYWQiKTsKKyAgICAgICAgaGFuZGxlclRocmVhZC5zdGFydCgpOworICAgICAgICBtSGFuZGxlciA9IG5ldyBNeUhhbmRsZXIoaGFuZGxlclRocmVhZC5nZXRMb29wZXIoKSk7CisKICAgICAgICAgLy8gc2V0dXAgb3VyIHVuaXF1ZSBkZXZpY2UgbmFtZQogICAgICAgICBTdHJpbmcgaWQgPSBTZXR0aW5ncy5TZWN1cmUuZ2V0U3RyaW5nKGNvbnRleHQuZ2V0Q29udGVudFJlc29sdmVyKCksCiAgICAgICAgICAgICAgICAgU2V0dGluZ3MuU2VjdXJlLkFORFJPSURfSUQpOwpAQCAtMTk2LDEwICsxODEsMjggQEAKICAgICAgICAgICAgIFN5c3RlbVByb3BlcnRpZXMuc2V0KCJuZXQuaG9zdG5hbWUiLCBuYW1lKTsKICAgICAgICAgfQogCisgICAgICAgIC8vIHJlYWQgb3VyIGRlZmF1bHQgZG5zIHNlcnZlciBpcAorICAgICAgICBTdHJpbmcgZG5zID0gU2V0dGluZ3MuU2VjdXJlLmdldFN0cmluZyhjb250ZXh0LmdldENvbnRlbnRSZXNvbHZlcigpLAorICAgICAgICAgICAgICAgIFNldHRpbmdzLlNlY3VyZS5ERUZBVUxUX0ROU19TRVJWRVIpOworICAgICAgICBpZiAoZG5zID09IG51bGwgfHwgZG5zLmxlbmd0aCgpID09IDApIHsKKyAgICAgICAgICAgIGRucyA9IGNvbnRleHQuZ2V0UmVzb3VyY2VzKCkuZ2V0U3RyaW5nKAorICAgICAgICAgICAgICAgICAgICBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0cmluZy5jb25maWdfZGVmYXVsdF9kbnNfc2VydmVyKTsKKyAgICAgICAgfQorICAgICAgICB0cnkgeworICAgICAgICAgICAgbURlZmF1bHREbnMgPSBJbmV0QWRkcmVzcy5nZXRCeU5hbWUoZG5zKTsKKyAgICAgICAgfSBjYXRjaCAoVW5rbm93bkhvc3RFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgU2xvZy5lKFRBRywgIkVycm9yIHNldHRpbmcgZGVmYXVsdERucyB1c2luZyAiICsgZG5zKTsKKyAgICAgICAgfQorCiAgICAgICAgI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9iaWxlRGF0YVN0YXRlVHJhY2tlcihjb250ZXh0LCBtSGFuZGxlciwKLSAgICAgICAgICAgICAgICAgICAgbmV0VHlwZSwgbU5ldEF0dHJpYnV0ZXNbbmV0VHlwZV0ubU5hbWUpOwotICAgICAgICAgICAgICAgIG1OZXRUcmFja2Vyc1tuZXRUeXBlXS5zdGFydE1vbml0b3JpbmcoKTsKKyAgICAgICAgICAgICAgICBtTmV0VHJhY2tlcnNbbmV0VHlwZV0gPSBuZXcgTW9iaWxlRGF0YVN0YXRlVHJhY2tlcihuZXRUeXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgbU5ldEF0dHJpYnV0ZXNbbmV0VHlwZV0ubU5hbWUpOworICAgICAgICAgICAgICAgIG1OZXRUcmFja2Vyc1tuZXRUeXBlXS5zdGFydE1vbml0b3JpbmcoY29udGV4dCwgbUhhbmRsZXIpOwogICAgICAgICAgICAgICAgIGlmIChub01vYmlsZURhdGEpIHsKICAgICAgICAgICAgICAgICAgICAgaWYgKERCRykgU2xvZy5kKFRBRywgInRlYXJpbmcgZG93biBNb2JpbGUgbmV0d29ya3MgZHVlIHRvIHNldHRpbmciKTsKICAgICAgICAgICAgICAgICAgICAgbU5ldFRyYWNrZXJzW25ldFR5cGVdLnRlYXJkb3duKCk7CkBAIC0zMjQsNyArMzMwLDggQEAKICAgICAgICAgbVRldGhlcmluZ0NvbmZpZ1ZhbGlkID0gKCgobU5ldFRyYWNrZXJzW0Nvbm5lY3Rpdml0eU1hbmFnZXIuVFlQRV9NT0JJTEVfRFVOXSAhPSBudWxsKSB8fAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICFtVGV0aGVyaW5nLmlzRHVuUmVxdWlyZWQoKSkgJiYKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChtVGV0aGVyaW5nLmdldFRldGhlcmFibGVVc2JSZWdleHMoKS5sZW5ndGggIT0gMCB8fAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1UZXRoZXJpbmcuZ2V0VGV0aGVyYWJsZVdpZmlSZWdleHMoKS5sZW5ndGggIT0gMCkgJiYKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtVGV0aGVyaW5nLmdldFRldGhlcmFibGVXaWZpUmVnZXhzKCkubGVuZ3RoICE9IDAgfHwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtVGV0aGVyaW5nLmdldFRldGhlcmFibGVCbHVldG9vdGhSZWdleHMoKS5sZW5ndGggIT0gMCkgJiYKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1UZXRoZXJpbmcuZ2V0VXBzdHJlYW1JZmFjZVJlZ2V4cygpLmxlbmd0aCAhPSAwKTsKIAogICAgIH0KQEAgLTYwMCwxNSArNjA3LDcgQEAKICAgICAgICAgICAgICAgICBuZXR3b3JrLnJlY29ubmVjdCgpOwogICAgICAgICAgICAgICAgIHJldHVybiBQaG9uZS5BUE5fUkVRVUVTVF9TVEFSVEVEOwogICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBzeW5jaHJvbml6ZWQodGhpcykgewotICAgICAgICAgICAgICAgICAgICBtRmVhdHVyZVVzZXJzLmFkZChmKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgbUhhbmRsZXIuc2VuZE1lc3NhZ2VEZWxheWVkKG1IYW5kbGVyLm9idGFpbk1lc3NhZ2UoCi0gICAgICAgICAgICAgICAgICAgICAgICBOZXR3b3JrU3RhdGVUcmFja2VyLkVWRU5UX1JFU1RPUkVfREVGQVVMVF9ORVRXT1JLLAotICAgICAgICAgICAgICAgICAgICAgICAgZiksIGdldFJlc3RvcmVEZWZhdWx0TmV0d29ya0RlbGF5KCkpOwotCi0gICAgICAgICAgICAgICAgcmV0dXJuIG5ldHdvcmsuc3RhcnRVc2luZ05ldHdvcmtGZWF0dXJlKGZlYXR1cmUsCi0gICAgICAgICAgICAgICAgICAgICAgICBnZXRDYWxsaW5nUGlkKCksIGdldENhbGxpbmdVaWQoKSk7CisgICAgICAgICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgICAgIHJldHVybiBQaG9uZS5BUE5fVFlQRV9OT1RfQVZBSUxBQkxFOwpAQCAtNzI3LDggKzcyNiw3IEBACiAgICAgICAgICAgICB0cmFja2VyLnRlYXJkb3duKCk7CiAgICAgICAgICAgICByZXR1cm4gMTsKICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgIC8vIGRvIGl0IHRoZSBvbGQgZmFzaGlvbmVkIHdheQotICAgICAgICAgICAgcmV0dXJuIHRyYWNrZXIuc3RvcFVzaW5nTmV0d29ya0ZlYXR1cmUoZmVhdHVyZSwgcGlkLCB1aWQpOworICAgICAgICAgICAgcmV0dXJuIC0xOwogICAgICAgICB9CiAgICAgfQogCkBAIC03NzcsMTEgKzc3NSwzNyBAQAogICAgICAgICAgICAgfQogICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgICAgICB9Ci0KICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgIEluZXRBZGRyZXNzIGluZXRBZGRyZXNzID0gSW5ldEFkZHJlc3MuZ2V0QnlBZGRyZXNzKGhvc3RBZGRyZXNzKTsKLSAgICAgICAgICAgIHJldHVybiB0cmFja2VyLnJlcXVlc3RSb3V0ZVRvSG9zdChpbmV0QWRkcmVzcyk7Ci0gICAgICAgIH0gY2F0Y2ggKFVua25vd25Ib3N0RXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIEluZXRBZGRyZXNzIGFkZHIgPSBJbmV0QWRkcmVzcy5nZXRCeUFkZHJlc3MoaG9zdEFkZHJlc3MpOworICAgICAgICAgICAgcmV0dXJuIGFkZEhvc3RSb3V0ZSh0cmFja2VyLCBhZGRyKTsKKyAgICAgICAgfSBjYXRjaCAoVW5rbm93bkhvc3RFeGNlcHRpb24gZSkge30KKyAgICAgICAgcmV0dXJuIGZhbHNlOworICAgIH0K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VyZmFjZU5hbWUgIT0gbnVsbCkgeworICAgICAgICAgICAgcmV0dXJuIE5ldHdvcmtVdGlscy5hZGRIb3N0Um91dGUoaW50ZXJmYWNlTmFtZSwgaG9zdEFkZHJlc3MsIG51bGwpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgaWYgKERCRykgU2xvZy5lKFRBRywgImFkZEhvc3RSb3V0ZSBmYWlsZWQgZHVlIHRvIG51bGwgaW50ZXJmYWNlIG5hbWUiKTsKICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICAgfQogICAgIH0KQEAgLTg5MCw2ICs5MTQsMTIgQEAKICAgICAgICAgICAgICAgICAiQ29ubmVjdGl2aXR5U2VydmljZSIpOwogICAgIH0KIAorICAgIHByaXZhdGUgdm9pZCBlbmZvcmNlQ29ubmVjdGl2aXR5SW50ZXJuYWxQZXJtaXNzaW9uKCkgeworICAgICAgICBtQ29udGV4dC5lbmZvcmNlQ2FsbGluZ09yU2VsZlBlcm1pc3Npb24oCisgICAgICAgICAgICAgICAgYW5kcm9pZC5NYW5pZmVzdC5wZXJtaXNzaW9uLkNPTk5FQ1RJVklUWV9JTlRFUk5BTCwKKyAgICAgICAgICAgICAgICAiQ29ubmVjdGl2aXR5U2VydmljZSIpOworICAgIH0KKwogICAgIC8qKgogICAgICAqIEhhbmRsZSBhIHtAY29kZSBESVNDT05ORUNURUR9IGV2ZW50LiBJZiB0aGlzIHBlcnRhaW5zIHRvIHRoZSBub24tYWN0aXZlCiAgICAgICogbmV0d29yaywgd2UgaWdub3JlIGl0LiBJZiBpdCBpcyBmb3IgdGhlIGFjdGl2ZSBuZXR3b3JrLCB3ZSBzZW5kIG91dCBhCkBAIC0xMTU5LDQ0ICsxMTg5LDMwIEBACiAgICAgICAgICAgICAgICAgICAgICAgICBTbG9nLmUoVEFHLCAiTmV0d29yayBkZWNsaW5lZCB0ZWFyZG93biByZXF1ZXN0Iik7CiAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgaWYgKGlzRmFpbG92ZXIpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIG90aGVyTmV0LnJlbGVhc2VXYWtlTG9jaygpOwotICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgc3luY2hyb25pemVkIChDb25uZWN0aXZpdHlTZXJ2aWNlLnRoaXMpIHsKKyAgICAgICAgICAgICAgICAvLyBoYXZlIGEgbmV3IGRlZmF1bHQgbmV0d29yaywgcmVsZWFzZSB0aGUgdHJhbnNpdGlvbiB3YWtlbG9jayBpbiBhIHNlY29uZAorICAgICAgICAgICAgICAgIC8vIGlmIGl0J3MgaGVsZC4gIFRoZSBzZWNvbmQgcGF1c2UgaXMgdG8gYWxsb3cgYXBwcyB0byByZWNvbm5lY3Qgb3ZlciB0aGUKKyAgICAgICAgICAgICAgICAvLyBuZXcgbmV0d29yaworICAgICAgICAgICAgICAgIGlmIChtTmV0VHJhbnNpdGlvbldha2VMb2NrLmlzSGVsZCgpKSB7CisgICAgICAgICAgICAgICAgICAgIG1IYW5kbGVyLnNlbmRNZXNzYWdlRGVsYXllZChtSGFuZGxlci5vYnRhaW5NZXNzYWdlKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIE5ldHdvcmtTdGF0ZVRyYWNrZXIuRVZFTlRfQ0xFQVJfTkVUX1RSQU5TSVRJT05fV0FLRUxPQ0ssCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbU5ldFRyYW5zaXRpb25XYWtlTG9ja1NlcmlhbE51bWJlciwgMCksCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgMTAwMCk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICAgICAgbUFjdGl2ZURlZmF1bHROZXR3b3JrID0gdHlwZTsKICAgICAgICAgfQogICAgICAgICB0aGlzTmV0LnNldFRlYXJkb3duUmV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ZV0uYWRkRGVmYXVsdFJvdXRlKCk7CisgICAgICAgICAgICAgICAgYWRkRGVmYXVsdFJvdXRlKG1OZXRUcmFja2Vyc1tuZXRUeXBlXSk7CiAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIG1OZXRUcmFja2Vyc1tuZXRUeXBlXS5hZGRQcml2YXRlRG5zUm91dGVzKCk7CisgICAgICAgICAgICAgICAgYWRkUHJpdmF0ZURuc1JvdXRlcyhtTmV0VHJhY2tlcnNbbmV0VHlwZV0pOwogICAgICAgICAgICAgfQogICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgaWYgKG1OZXRBdHRyaWJ1dGVzW25ldFR5cGVdLmlzRGVmYXVsdCgpKSB7Ci0gICAgICAgICAgICAgICAgbU5ldFRyYWNrZXJzW25ldFR5cGVdLnJlbW92ZURlZmF1bHRSb3V0ZSgpOworICAgICAgICAgICAgICAgIHJlbW92ZURlZmF1bHRSb3V0ZShtTmV0VHJhY2tlcnNbbmV0VHlwZV0pOwogICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICBtTmV0VHJhY2tlcnNbbmV0VHlwZV0ucmVtb3ZlUHJpdmF0ZURuc1JvdXRlcygpOworICAgICAgICAgICAgICAgIHJlbW92ZVByaXZhdGVEbnNSb3V0ZXMobU5ldFRyYWNrZXJzW25ldFR5cGVdKTsKICAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgIH0KIAorICAgIHByaXZhdGUgdm9pZCBhZGRQcml2YXRlRG5zUm91dGVzKE5ldHdvcmtTdGF0ZVRyYWNrZXIgbnQpIHsKKyAgICAgICAgYm9vbGVhbiBwcml2YXRlRG5zUm91dGVTZXQgPSBudC5pc1ByaXZhdGVEbnNSb3V0ZVNldCgpOworICAgICAgICBMaW5rUHJvcGVydGllcyBwID0gbnQuZ2V0TGlua1Byb3BlcnRpZXMoKTsKKyAgICAgICAgaWYgKHAgPT0gbnVsbCkgcmV0dXJuOworICAgICAgICBTdHJpbmcgaW50ZXJmYWNlTmFtZSA9IHAuZ2V0SW50ZXJmYWNlTmFtZSgpOworCisgICAgICAgIGlmIChEQkcpIHsKKyAgICAgICAgICAgIFNsb2cuZChUQUcsICJhZGRQcml2YXRlRG5zUm91dGVzIGZvciAiICsgbnQgKworICAgICAgICAgICAgICAgICAgICAiKCIgKyBpbnRlcmZhY2VOYW1lICsgIikgLSBtUHJpdmF0ZURuc1JvdXRlU2V0ID0gIiArIHByaXZhdGVEbnNSb3V0ZVNldCk7CisgICAgICAgIH0KKyAgICAgICAgaWYgKGludGVyZmFjZU5hbWUgIT0gbnVsbCAmJiAhcHJpdmF0ZURuc1JvdXRlU2V0KSB7CisgICAgICAgICAgICBDb2xsZWN0aW9uPEluZXRBZGRyZXNzPiBkbnNMaXN0ID0gcC5nZXREbnNlcygpOworICAgICAgICAgICAgZm9yIChJbmV0QWRkcmVzcyBkbnMgOiBkbnNMaXN0KSB7CisgICAgICAgICAgICAgICAgaWYgKERCRykgU2xvZy5kKFRBRywgIiAgYWRkaW5nICIgKyBkbnMpOworICAgICAgICAgICAgICAgIE5ldHdvcmtVdGlscy5hZGRIb3N0Um91dGUoaW50ZXJmYWNlTmFtZSwgZG5zLCBudWxsKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG50LnByaXZhdGVEbnNSb3V0ZVNldCh0cnVlKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgdm9pZCByZW1vdmVQcml2YXRlRG5zUm91dGVzKE5ldHdvcmtTdGF0ZVRyYWNrZXIgbnQpIHsKKyAgICAgICAgLy8gVE9ETyAtIHdlIHNob3VsZCBkbyB0aGlzIGV4cGxpY2l0bHkgYnV0IHRoZSBOZXRVdGlscyBhcGkgZG9lc250CisgICAgICAgIC8vIHN1cHBvcnQgdGhpcyB5ZXQgLSBtdXN0IHJlbW92ZSBhbGwuICBObyB3b3JzZSB0aGFuIGJlZm9yZQorICAgICAgICBMaW5rUHJvcGVydGllcyBwID0gbnQuZ2V0TGlua1Byb3BlcnRpZXMoKTsKKyAgICAgICAgaWYgKHAgPT0gbnVsbCkgcmV0dXJuOworICAgICAgICBTdHJpbmcgaW50ZXJmYWNlTmFtZSA9IHAuZ2V0SW50ZXJmYWNlTmFtZSgpOworICAgICAgICBib29sZWFuIHByaXZhdGVEbnNSb3V0ZVNldCA9IG50LmlzUHJpdmF0ZURuc1JvdXRlU2V0KCk7CisgICAgICAgIGlmIChpbnRlcmZhY2VOYW1lICE9IG51bGwgJiYgcHJpdmF0ZURuc1JvdXRlU2V0KSB7CisgICAgICAgICAgICBpZiAoREJHKSB7CisgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgInJlbW92ZVByaXZhdGVEbnNSb3V0ZXMgZm9yICIgKyBudC5nZXROZXR3b3JrSW5mbygpLmdldFR5cGVOYW1lKCkgKworICAgICAgICAgICAgICAgICAgICAgICAgIiAoIiArIGludGVyZmFjZU5hbWUgKyAiKSIpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgTmV0d29ya1V0aWxzLnJlbW92ZUhvc3RSb3V0ZXMoaW50ZXJmYWNlTmFtZSk7CisgICAgICAgICAgICBudC5wcml2YXRlRG5zUm91dGVTZXQoZmFsc2UpOworICAgICAgICB9CisgICAgfQorCisKKyAgICBwcml2YXRlIHZvaWQgYWRkRGVmYXVsdFJvdXRlKE5ldHdvcmtTdGF0ZVRyYWNrZXIgbnQpIHsKKyAgICAgICAgTGlua1Byb3BlcnRpZXMgcCA9IG50LmdldExpbmtQcm9wZXJ0aWVzKCk7CisgICAgICAgIGlmIChwID09IG51bGwpIHJldHVybjsKKyAgICAgICAgU3RyaW5nIGludGVyZmFjZU5hbWUgPSBwLmdldEludGVyZmFjZU5hbWUoKTsKKyAgICAgICAgSW5ldEFkZHJlc3MgZGVmYXVsdEdhdGV3YXlBZGRyID0gcC5nZXRHYXRld2F5KCk7CisKKyAgICAgICAgaWYgKChpbnRlcmZhY2VOYW1lICE9IG51bGwpICYmIChkZWZhdWx0R2F0ZXdheUFkZHIgIT0gbnVsbCApKSB7CisgICAgICAgICAgICBpZiAoIU5ldHdvcmtVdGlscy5hZGREZWZhdWx0Um91dGUoaW50ZXJmYWNlTmFtZSwgZGVmYXVsdEdhdGV3YXlBZGRyKSAmJiBEQkcpIHsKKyAgICAgICAgICAgICAgICBOZXR3b3JrSW5mbyBuZXR3b3JrSW5mbyA9IG50LmdldE5ldHdvcmtJbmZvKCk7CisgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgImFkZERlZmF1bHRSb3V0ZSBmb3IgIiArIG5ldHdvcmtJbmZvLmdldFR5cGVOYW1lKCkgKworICAgICAgICAgICAgICAgICAgICAgICAgIiAoIiArIGludGVyZmFjZU5hbWUgKyAiKSwgR2F0ZXdheUFkZHI9IiArIGRlZmF1bHRHYXRld2F5QWRkcik7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKworICAgIHB1YmxpYyB2b2lkIHJlbW92ZURlZmF1bHRSb3V0ZShOZXR3b3JrU3RhdGVUcmFja2VyIG50KSB7CisgICAgICAgIExpbmtQcm9wZXJ0aWVzIHAgPSBudC5nZXRMaW5rUHJvcGVydGllcygpOworICAgICAgICBpZiAocCA9PSBudWxsKSByZXR1cm47CisgICAgICAgIFN0cmluZyBpbnRlcmZhY2VOYW1lID0gcC5nZXRJbnRlcmZhY2VOYW1lKCk7CisKKyAgICAgICAgaWYgKGludGVyZmFjZU5hbWUgIT0gbnVsbCkgeworICAgICAgICAgICAgaWYgKChOZXR3b3JrVXRpbHMucmVtb3ZlRGVmYXVsdFJvdXRlKGludGVyZmFjZU5hbWUpID49IDApICYmIERCRykgeworICAgICAgICAgICAgICAgIE5ldHdvcmtJbmZvIG5ldHdvcmtJbmZvID0gbnQuZ2V0TmV0d29ya0luZm8oKTsKKyAgICAgICAgICAgICAgICBTbG9nLmQoVEFHLCAicmVtb3ZlRGVmYXVsdFJvdXRlIGZvciAiICsgbmV0d29ya0luZm8uZ2V0VHlwZU5hbWUoKSArIC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oKSAhPSAwKSB7CisgICAgICAgICAgICBpZiAoREJHKSB7CisgICAgICAgICAgICAgICAgU2xvZy52KFRBRywgIlNldHRpbmcgVENQIHZhbHVlczogWyIgKyBidWZmZXJTaXplcworICAgICAgICAgICAgICAgICAgICAgICAgKyAiXSB3aGljaCBjb21lcyBmcm9tIFsiICsga2V5ICsgIl0iKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHNldEJ1ZmZlclNpemUoYnVmZmVyU2l6ZXMpOworICAgICAgICB9CisgICAgfQorCisgICAvKioKKyAgICAgKiBXcml0ZXMgVENQIGJ1ZmZlciBzaXplcyB0byAvc3lzL2tlcm5lbC9pcHY0L3RjcF9bci93XW1lbV9bbWluL2RlZi9tYXhdCisgICAgICogd2hpY2ggbWFwcyB0byAvcHJvYy9zeXMvbmV0L2lwdjQvdGNwX3JtZW0gYW5kIHRjcHdtZW0KKyAgICAgKgorICAgICAqIEBwYXJhbSBidWZmZXJTaXplcyBpbiB0aGUgZm9ybWF0IG9mICJyZWFkTWluLCByZWFkSW5pdGlhbCwgcmVhZE1heCwKKyAgICAgKiAgICAgICAgd3JpdGVNaW4sIHdyaXRlSW5pdGlhbCwgd3JpdGVNYXgiCisgICAgICovCisgICAgcHJpdmF0ZSB2b2lkIHNldEJ1ZmZlclNpemUoU3RyaW5nIGJ1ZmZlclNpemVzKSB7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBTdHJpbmdbXSB2YWx1ZXMgPSBidWZmZXJTaXplcy5zcGxpdCgiLCIpOworCisgICAgICAgICAgICBpZiAodmFsdWVzLmxlbmd0aCA9PSA2KSB7CisgICAgICAgICAgICAgIGZpbmFsIFN0cmluZyBwcmVmaXggPSAiL3N5cy9rZXJuZWwvaXB2NC90Y3BfIjsKKyAgICAgICAgICAgICAgICBzdHJpbmdUb0ZpbGUocHJlZml4ICsgInJtZW1fbWluIiwgdmFsdWVzWzBdKTsKKyAgICAgICAgICAgICAgICBzdHJpbmdUb0ZpbGUocHJlZ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AgICAgICAgICAgb3V0LndyaXRlKHN0cmluZyk7CisgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICBvdXQuY2xvc2UoKTsKKyAgICAgICAgfQorICAgIH0KKworCiAgICAgLyoqCiAgICAgICogQWRqdXN0IHRoZSBwZXItcHJvY2VzcyBkbnMgZW50cmllcyAobmV0LmRuczx4Pi48cGlkPikgYmFzZWQKICAgICAgKiBvbiB0aGUgaGlnaGVzdCBwcmlvcml0eSBhY3RpdmUgbmV0IHdoaWNoIHRoaXMgcHJvY2VzcyByZXF1ZXN0ZWQuCkBAIC0xMjM3LDEyICsxMzkyLDE0IEBACiAgICAgICAgICAgICBOZXR3b3JrU3RhdGVUcmFja2VyIG50ID0gbU5ldFRyYWNrZXJzW2ldOwogICAgICAgICAgICAgaWYgKG50LmdldE5ldHdvcmtJbmZvKCkuaXNDb25uZWN0ZWQoKSAmJgogICAgICAgICAgICAgICAgICAgICAhbnQuaXNUZWFyZG93blJlcXVlc3RlZCgpKSB7CisgICAgICAgICAgICAgICAgTGlua1Byb3BlcnRpZXMgcCA9IG50LmdldExpbmtQcm9wZXJ0aWVzKCk7CisgICAgICAgICAgICAgICAgaWYgKHAgPT0gbnVsbCkgY29udGludWU7CiAgICAgICAgICAgICAgICAgTGlzdCBwaWRzID0gbU5ldFJlcXVlc3RlcnNQaWRzW2ldOwogICAgICAgICAgICAgICAgIGZvciAoaW50IGo9MDsgajxwaWRzLnNpemUoKTsgaisrKSB7CiAgICAgICAgICAgICAgICAgICAgIEludGVnZXIgcGlkID0gKEludGVnZXIpcGlkcy5nZXQoaik7CiAgICAgICAgICAgICAgICAgICAgIGlmIChwaWQuaW50VmFsdWUoKSA9PSBteVBpZCkgewotICAgICAgICAgICAgICAgICAgICAgICAgU3RyaW5nW10gZG5zTGlzdCA9IG50LmdldE5hbWVTZXJ2ZXJzKCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB3cml0ZVBpZERucyhkbnNMaXN0LCBteVBpZCk7CisgICAgICAgICAgICAgICAgICAgICAgICBDb2xsZWN0aW9uPEluZXRBZGRyZXNzPiBkbnNlcyA9IHAuZ2V0RG5zZXMoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHdyaXRlUGlkRG5zKGRuc2VzLCBteVBpZCk7CiAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZG9CdW1wKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnVtcERucygpOwogICAgICAgICAgICAgICAgICAgICAgICAgfQpAQCAtMTI2NCwxMiArMTQyMSwxMCBAQAogICAgICAgICB9CiAgICAgfQogCi0gICAgcHJpdmF0ZSB2b2lkIHdyaXRlUGlkRG5zKFN0cmluZ1tdIGRuc0xpc3QsIGludCBwaWQpIHsKKyAgICBwcml2YXRlIHZvaWQgd3JpdGVQaWREbnMoQ29sbGVjdGlvbiA8SW5ldEFkZHJlc3M+IGRuc2VzLCBpbnQgcGlkKSB7CiAgICAgICAgIGludCBqID0gMTsKLSAgICAgICAgZm9yIChTdHJpbmcgZG5zIDogZG5zTGlzdCkgewotICAgICAgICAgICAgaWYgKGRucyAhPSBudWxsICYmICFUZXh0VXRpbHMuZXF1YWxzKGRucywgIjAuMC4wLjAiKSkgewotICAgICAgICAgICAgICAgIFN5c3RlbVByb3BlcnRpZXMuc2V0KCJuZXQuZG5zIiArIGorKyArICIuIiArIHBpZCwgZG5zKTsKLSAgICAgICAgICAgIH0KKyAgICAgICAgZm9yIChJbmV0QWRkcmVzcyBkbnMgOiBkbnNlcykgeworICAgICAgICAgICAgU3lzdGVtUHJvcGVydGllcy5zZXQoIm5ldC5kbnMiICsgaisrICsgIi4iICsgcGlkLCBkbnMuZ2V0SG9zdEFkZHJlc3MoKSk7CiAgICAgICAgIH0KICAgICB9CiAKQEAgLTEyOTIsMTYgKzE0NDcsMjQgQEAKICAgICAgICAgLy8gYWRkIGRlZmF1bHQgbmV0J3MgZG5zIGVudHJpZXMKICAgICAgICAgTmV0d29ya1N0YXRlVHJhY2tlciBudCA9IG1OZXRUcmFja2Vyc1tuZXRUeXBlXTsKICAgICAgICAgaWYgKG50ICE9IG51bGwgJiYgbnQuZ2V0TmV0d29ya0luZm8oKS5pc0Nvbm5lY3RlZCgpICYmICFudC5pc1RlYXJkb3duUmVxdWVzdGVkKCkpIHsKLSAgICAgICAgICAgIFN0cmluZ1tdIGRuc0xpc3QgPSBudC5nZXROYW1lU2VydmVycygpOworICAgICAgICAgICAgTGlua1Byb3BlcnRpZXMgcCA9IG50LmdldExpbmtQcm9wZXJ0aWVzKCk7CisgICAgICAgICAgICBpZiAocCA9PSBudWxsKSByZXR1cm47CisgICAgICAgICAgICBDb2xsZWN0aW9uPEluZXRBZGRyZXNzPiBkbnNlcyA9IHAuZ2V0RG5zZXMoKTsKICAgICAgICAgICAgIGlmIChtTmV0QXR0cmlidXRlc1tuZXRUeXBlXS5pc0RlZmF1bHQoKSkgewogICAgICAgICAgICAgICAgIGludCBqID0gMTsKLSAgICAgICAgICAgICAgICBmb3IgKFN0cmluZyBkbnMgOiBkbnNMaXN0KSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChkbnMgIT0gbnVsbCAmJiAhVGV4dFV0aWxzLmVxdWFscyhkbnMsICIwLjAuMC4wIikpIHsKKyAgICAgICAgICAgICAgICBpZiAoZG5zZXMuc2l6ZSgpID09IDAgJiYgbURlZmF1bHREbnMgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBpZiAoREJHKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBTbG9nLmQoVEFHLCAibm8gZG5zIHByb3ZpZGVkIC0gdXNpbmcgIiArIG1EZWZhdWx0RG5zLmdldEhvc3RBZGRyZXNzKCkpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIFN5c3RlbVByb3BlcnRpZXMuc2V0KCJuZXQuZG5zMSIsIG1EZWZhdWx0RG5zLmdldEhvc3RBZGRyZXNzKCkpOworICAgICAgICAgICAgICAgICAgICBqKys7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgZm9yIChJbmV0QWRkcmVzcyBkbnMgOiBkbnNlcykgewogICAgICAgICAgICAgICAgICAgICAgICAgaWYgKERCRykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNsb2cuZChUQUcsICJhZGRpbmcgZG5zICIgKyBkbnMgKyAiIGZvciAiICsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG50LmdldE5ldHdvcmtJbmZvKCkuZ2V0VHlwZU5hbWUoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICBTeXN0ZW1Qcm9wZXJ0aWVzLnNldCgibmV0LmRucyIgKyBqKyssIGRucyk7CisgICAgICAgICAgICAgICAgICAgICAgICBTeXN0ZW1Qcm9wZXJ0aWVzLnNldCgibmV0LmRucyIgKyBqKyssIGRucy5nZXRIb3N0QWRkcmVzcygpKTsKICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBmb3IgKGludCBrPWogOyBrPG1OdW1EbnNFbnRyaWVzOyBrKyspIHsKQEAgLTEzMTQsMTEgKzE0NzcsMTEgQEAKICAgICAgICAgICAgICAgICBMaXN0IHBpZHMgPSBtTmV0UmVxdWVzdGVyc1BpZHNbbmV0VHlwZV07CiAgICAgICAgICAgICAgICAgZm9yIChpbnQgeT0wOyB5PCBwaWRzLnNpemUoKTsgeSsrKSB7CiAgICAgICAgICAgICAgICAgICAgIEludGVnZXIgcGlkID0gKEludGVnZXIpcGlkcy5nZXQoeSk7Ci0gICAgICAgICAgICAgICAgICAgIHdyaXRlUGlkRG5zKGRuc0xpc3QsIHBpZC5pbnRWYWx1ZSgpKTsKKyAgICAgICAgICAgICAgICAgICAgd3JpdGVQaWREbnMoZG5zZXMsIHBpZC5pbnRWYWx1ZSgpKTsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CisgICAgICAgICAgICBidW1wRG5zKCk7CiAgICAgICAgIH0KLSAgICAgICAgYnVtcERucygpOwogICAgIH0KIAogICAgIHByaXZhdGUgaW50IGdldFJlc3RvcmVEZWZhdWx0TmV0d29ya0RlbGF5KCkgewpAQCAtMTM3MywxMSArMTUzNiwyMiBAQAogICAgICAgICB9CiAgICAgICAgIHB3LnByaW50bG4oKTsKIAorICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKKyAgICAgICAgICAgIHB3LnByaW50bG4oIk5ldHdvcmtUcmFuc3Rpb25XYWtlTG9jayBpcyBjdXJyZW50bHkgIiArCisgICAgICAgICAgICAgICAgICAgIChtTmV0VHJhbnNpdGlvbldha2VMb2NrLmlzSGVsZCgpID8gIiIgOiAibm90ICIpICsgImhlbGQuIik7CisgICAgICAgICAgICBwdy5wcmludGxuKCJJdCB3YXMgbGFzdCByZXF1ZXN0ZWQgZm9yICIrbU5ldFRyYW5zaXRpb25XYWtlTG9ja0NhdXNlZEJ5KTsKKyAgICAgICAgfQorICAgICAgICBwdy5wcmludGxuKCk7CisKICAgICAgICAgbVRldGhlcmluZy5kdW1wKGZkLCBwdywgYXJncyk7CiAgICAgfQogCiAgICAgLy8gbXVzdCBiZSBzdGF0ZWxlc3MgLSB0aGluZ3MgY2hhbmdlIHVuZGVyIHVzLgogICAgIHByaXZhdGUgY2xhc3MgTXlIYW5kbGVyIGV4dGVuZHMgSGFuZGxlciB7CisgICAgICAgIHB1YmxpYyBNeUhhbmRsZXIoTG9vcGVyIGxvb3BlcikgeworICAgICAgICAgICAgc3VwZXIobG9vcGVyKTsKKyAgICAgICAgfQorCiAgICAgICAgIEBPdmVycmlkZQogICAgICAgICBwdWJsaWMgdm9pZCBoYW5kbGVNZXNzYWdlKE1lc3NhZ2UgbXNnKSB7CiAgICAgICAgICAgICBOZXR3b3JrSW5mbyBpbmZvOwpAQCAtMTQzOSwzNCArMTYxMywzMCBAQAogICAgICAgICAgICAgICAgICAgICAgICAgaGFuZGxlQ29ubmVjdChpbmZvKTsKICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICBicmVhazsKLQotICAgICAgICAgICAgICAgIGNhc2UgTmV0d29ya1N0YXRlVHJhY2tlci5FVkVOVF9TQ0FOX1JFU1VMVFNfQVZBSUxBQkxFOgotICAgICAgICAgICAgICAgICAgICBpbmZvID0gKE5ldHdvcmtJbmZvKSBtc2cub2JqOwotICAgICAgICAgICAgICAgICAgICBoYW5kbGVTY2FuUmVzdWx0c0F2YWlsYWJsZShpbmZvKTsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgICAgICAgICBjYXNlIE5ldHdvcmtTdGF0ZVRyYWNrZXIuRVZFTlRfTk9USUZJQ0FUSU9OX0NIQU5HRUQ6Ci0gICAgICAgICAgICAgICAgICAgIGhhbmRsZU5vdGlmaWNhdGlvbkNoYW5nZShtc2cuYXJnMSA9PSAxLCBtc2cuYXJnMiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTm90aWZpY2F0aW9uKSBtc2cub2JqKTsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0KICAgICAgICAgICAgICAgICBjYXNlIE5ldHdvcmtTdGF0ZVRyYWNrZXIuRVZFTlRfQ09ORklHVVJBVElPTl9DSEFOR0VEOgorICAgICAgICAgICAgICAgICAgICAvLyBUT0RPIC0gbWFrZSB0aGlzIGhhbmRsZSBpcC9wcm94eS9nYXRld2F5L2RucyBjaGFuZ2VzCiAgICAgICAgICAgICAgICAgICAgIGluZm8gPSAoTmV0d29ya0luZm8pIG1zZy5vYmo7CiAgICAgICAgICAgICAgICAgICAgIHR5cGUgPSBpbmZvLmdldFR5cGUoKTsKICAgICAgICAgICAgICAgICAgICAgaGFuZGxlRG5zQ29uZmlndXJhdGlvbkNoYW5nZSh0eXBlKTsKICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgICAgICAgICBjYXNlIE5ldHdvcmtTdGF0ZVRyYWNrZXIuRVZFTlRfUk9BTUlOR19DSEFOR0VEOgotICAgICAgICAgICAgICAgICAgICAvLyBmaWxsIG1lIGluCi0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotCi0gICAgICAgICAgICAgICAgY2FzZSBOZXR3b3JrU3RhdGVUcmFja2VyLkVWRU5UX05FVFdPUktfU1VCVFlQRV9DSEFOR0VEOgotICAgICAgICAgICAgICAgICAgICAvLyBmaWxsIG1lIGluCi0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgIGNhc2UgTmV0d29ya1N0YXRlVHJhY2tlci5FVkVOVF9SRVNUT1JFX0RFRkFVTFRfTkVUV09SSzoKICAgICAgICAgICAgICAgICAgICAgRmVhdHVyZVVzZXIgdSA9IChGZWF0dXJlVXNlciltc2cub2JqOwogICAgICAgICAgICAgICAgICAgICB1LmV4cGlyZSgpOwogICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIE5ldHdvcmtTdGF0ZVRyYWNrZXIuRVZFTlRfQ0xFQVJfTkVUX1RSQU5TSVRJT05fV0FLRUxPQ0s6CisgICAgICAgICAgICAgICAgICAgIFN0cmluZyBjYXVzZWRCeSA9IG51bGw7CisgICAgICAgICAgICAgICAgICAgIHN5bmNocm9uaXplZCAoQ29ubmVjdGl2aXR5U2VydmljZS50aGlzKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAobXNnLmFyZzEgPT0gbU5ldFRyYW5zaXRpb25XYWtlTG9ja1NlcmlhbE51bWJlciAmJgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtTmV0VHJhbnNpdGlvbldha2VMb2NrLmlzSGVsZCgpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbU5ldFRyYW5zaXRpb25XYWtlTG9jay5yZWxlYXNlKCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2F1c2VkQnkgPSBtTmV0VHJhbnNpdGlvbldha2VMb2NrQ2F1c2VkQnk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgaWYgKGNhdXNlZEJ5ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIFNsb2cuZChUQUcsICJOZXRUcmFuc2l0aW9uIFdha2Vsb2NrIGZvciAiICsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2F1c2VkQnkgKyAiIHJlbGVhc2VkIGJ5IHRpbWVvdXQiKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgIH0KQEAgLTE1MjMsNiArMTY5MywxNSBAQAogICAgICAgICB9CiAgICAgfQogCisgICAgcHVibGljIFN0cmluZ1tdIGdldFRldGhlcmFibGVCbHVldG9vdGhSZWdleHMoKSB7CisgICAgICAgIGVuZm9yY2VUZXRoZXJBY2Nlc3NQZXJtaXNzaW9uKCk7CisgICAgICAgIGlmIChpc1RldGhlcmluZ1N1cHBvcnRlZCgpKSB7CisgICAgICAgICAgICByZXR1cm4gbVRldGhlcmluZy5nZXRUZXRoZXJhYmxlQmx1ZXRvb3RoUmVnZXhzKCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICByZXR1cm4gbmV3IFN0cmluZ1swXTsKKyAgICAgICAgfQorICAgIH0KKwogICAgIC8vIFRPRE8gLSBtb3ZlIGlmYWNlIGxpc3RpbmcsIHF1ZXJpZXMsIGV0YyB0byBuZXcgbW9kdWxlCiAgICAgLy8gamF2YWRvYyBmcm9tIGludGVyZmFjZQogICAgIHB1YmxpYyBTdHJpbmdbXSBnZXRUZXRoZXJhYmxlSWZhY2VzKCkgewpAQCAtMTU1MCw0ICsxNzI5LDIzIEBACiAgICAgICAgICAgICAgICAgU2V0dGluZ3MuU2VjdXJlLlRFVEhFUl9TVVBQT1JURUQsIGRlZmF1bHR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uY2VvZiBSZWNlaXZlcikgeworICAgICAgICAgICAgICAgIHJldHVybiBtS2V5LmVxdWFscygoKFJlY2VpdmVyKSBvdGhlck9iaikubUtleSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIGludCBoYXNoQ29kZSgpIHsKKyAgICAgICAgICAgIHJldHVybiBtS2V5Lmhhc2hDb2RlKCk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgSUNvdW50cnlMaXN0ZW5lciBnZXRMaXN0ZW5lcigpIHsKKyAgICAgICAgICAgIHJldHVybiBtTGlzdGVuZXI7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIGZpbmFsIHN0YXRpYyBTdHJpbmcgVEFHID0gIkNvdW50cnlEZXRlY3RvclNlcnZpY2UiOworCisgICAgcHJpdmF0ZSBmaW5hbCBIYXNoTWFwPElCaW5kZXIsIFJlY2VpdmVyPiBtUmVjZWl2ZXJzOworICAgIHByaXZhdGUgZmluYWwgQ29udGV4dCBtQ29udGV4dDsKKyAgICBwcml2YXRlIENvbXByZWhlbnNpdmVDb3VudHJ5RGV0ZWN0b3IgbUNvdW50cnlEZXRlY3RvcjsKKyAgICBwcml2YXRlIGJvb2xlYW4gbVN5c3RlbVJlYWR5OworICAgIHByaXZhdGUgSGFuZGxlciBtSGFuZGxlcjsKKyAgICBwcml2YXRlIENvdW50cnlMaXN0ZW5lciBtTG9jYXRpb25CYXNlZERldGVjdG9yTGlzdGVuZXI7CisKKyAgICBwdWJsaWMgQ291bnRyeURldGVjdG9yU2VydmljZShDb250ZXh0IGNvbnRleHQpIHsKKyAgICAgICAgc3VwZXIoKTsKKyAgICAgICAgbVJlY2VpdmVycyA9IG5ldyBIYXNoTWFwPElCaW5kZXIsIFJlY2VpdmVyPigpOworICAgICAgICBtQ29udGV4dCA9IGNvbnRleHQ7CisgICAgfQorCisgICA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ml2YXRlIHZvaWQgYWRkTGlzdGVuZXIoSUNvdW50cnlMaXN0ZW5lciBsaXN0ZW5lcikgeworICAgICAgICBzeW5jaHJvbml6ZWQgKG1SZWNlaXZlcnMpIHsKKyAgICAgICAgICAgIFJlY2VpdmVyIHIgPSBuZXcgUmVjZWl2ZXIobGlzdGVuZXIpOworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICBsaXN0ZW5lci5hc0JpbmRlcigpLmxpbmtUb0RlYXRoKHIsIDApOworICAgICAgICAgICAgICAgIG1SZWNlaXZlcnMucHV0KGxpc3RlbmVyLmFzQmluZGVyKCksIHIpOworICAgICAgICAgICAgICAgIGlmIChtUmVjZWl2ZXJzLnNpemUoKSA9PSAxKSB7CisgICAgICAgICAgICAgICAgICAgIFNsb2cuZChUQUcsICJUaGUgZmlyc3QgbGlzdGVuZXIgaXMgYWRkZWQiKTsKKyAgICAgICAgICAgICAgICAgICAgc2V0Q291bnRyeUxpc3RlbmVyKG1Mb2NhdGlvbkJhc2VkRGV0ZWN0b3JMaXN0ZW5lcik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICBTbG9nLmUoVEFHLCAibGlua1RvRGVhdGggZmFpbGVkOiIsIGUpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIHJlbW92ZUxpc3RlbmVyKElCaW5kZXIga2V5KSB7CisgICAgICAgIHN5bmNocm9uaXplZCAobVJlY2VpdmVycykgeworICAgICAgICAgICAgbVJlY2VpdmVycy5yZW1vdmUoa2V5KTsKKyAgICAgICAgICAgIGlmIChtUmVjZWl2ZXJzLmlzRW1wdHkoKSkgeworICAgICAgICAgICAgICAgIHNldENvdW50cnlMaXN0ZW5lcihudWxsKTsKKyAgICAgICAgICAgICAgICBTbG9nLmQoVEFHLCAiTm8gbGlzdGVuZXIgaXMgbGVmdCIpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisKKyAgICBwcm90ZWN0ZWQgdm9pZCBub3RpZnlSZWNlaXZlcnMoQ291bnRyeSBjb3VudHJ5KSB7CisgICAgICAgIHN5bmNocm9uaXplZChtUmVjZWl2ZXJzKSB7CisgICAgICAgICAgICBmb3IgKFJlY2VpdmVyIHJlY2VpdmVyIDogbVJlY2VpdmVycy52YWx1ZXMoKSkgeworICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgIHJlY2VpdmVyLmdldExpc3RlbmVyKCkub25Db3VudHJ5RGV0ZWN0ZWQoY291bnRyeSk7CisgICAgICAgICAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAgICAgLy8gVE9ETzogU2hhbGwgd2UgcmVtb3ZlIHRoZSByZWNlaXZlcj8KKyAgICAgICAgICAgICAgICAgICAgU2xvZy5lKFRBRywgIm5vdGlmeVJlY2VpdmVycyBmYWlsZWQ6IiwgZSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgdm9pZCBzeXN0ZW1SZWFkeSgpIHsKKyAgICAgICAgLy8gU2hhbGwgd2Ugd2FpdCBmb3IgdGhlIGluaXRpYWxpemF0aW9uIGZpbmlzaC4KKyAgICAgICAgVGhyZWFkIHRocmVhZCA9IG5ldyBUaHJlYWQodGhpcywgIkNvdW50cnlEZXRlY3RvclNlcnZpY2UiKTsKKyAgICAgICAgdGhyZWFkLnN0YXJ0KCk7CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIGluaXRpYWxpemUoKSB7CisgICAgICAgIG1Db3VudHJ5RGV0ZWN0b3IgPSBuZXcgQ29tcHJlaGVuc2l2ZUNvdW50cnlEZXRlY3RvcihtQ29udGV4dCk7CisgICAgICAgIG1Mb2NhdGlvbkJhc2VkRGV0ZWN0b3JMaXN0ZW5lciA9IG5ldyBDb3VudHJ5TGlzdGVuZXIoKSB7CisgICAgICAgICAgICBwdWJsaWMgdm9pZCBvbkNvdW50cnlEZXRlY3RlZChmaW5hbCBDb3VudHJ5IGNvdW50cnkpIHsKKyAgICAgICAgICAgICAgICBtSGFuZGxlci5wb3N0KG5ldyBSdW5uYWJsZSgpIHsKKyAgICAgICAgICAgICAgICAgICAgcHVibGljIHZvaWQgcnVuKCkgeworICAgICAgICAgICAgICAgICAgICAgICAgbm90aWZ5UmVjZWl2ZXJzKGNvdW50cnkpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfSk7CisgICAgICAgICAgICB9CisgICAgICAgIH07CisgICAgfQorCisgICAgcHVibGljIHZvaWQgcnVuKCkgeworICAgICAgICBQcm9jZXNzLnNldFRocmVhZFByaW9yaXR5KFByb2Nlc3MuVEhSRUFEX1BSSU9SSVRZX0JBQ0tHUk9VTkQpOworICAgICAgICBMb29wZXIucHJlcGFyZSgpOworICAgICAgICBtSGFuZGxlciA9IG5ldyBIYW5kbGVyKCk7CisgICAgICAgIGluaXRpYWxpemUoKTsKKyAgICAgICAgbVN5c3RlbVJlYWR5ID0gdHJ1ZTsKKyAgICAgICAgTG9vcGVyLmxvb3AoKTsKKyAgICB9CisKKyAgICBwcm90ZWN0ZWQgdm9pZCBzZXRDb3VudHJ5TGlzdGVuZXIoZmluYWwgQ291bnRyeUxpc3RlbmVyIGxpc3RlbmVyKSB7CisgICAgICAgIG1IYW5kbGVyLnBvc3QobmV3IFJ1bm5hYmxlKCkgeworICAgICAgICAgICAgQE92ZXJyaWRlCisgICAgICAgICAgICBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgICAgICAgICAgbUNvdW50cnlEZXRlY3Rvci5zZXRDb3VudHJ5TGlzdGVuZXIobGlzdGVuZXIpOworICAgICAgICAgICAgfQorICAgICAgICB9KTsKKyAgICB9CisKKyAgICAvLyBGb3IgdGVzdGluZworICAgIGJvb2xlYW4gaXNTeXN0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bHVlcyBpbWFnZXYgPSBuZXcgQ29udGVudFZhbHVlcygpOwotICAgICAgICBpbWFnZXYucHV0KCJuYW1lIiwgbmFtZSk7Ci0KLSAgICAgICAgVXJpIHVybCA9IG51bGw7Ci0KLSAgICAgICAgQXNzZXRNYW5hZ2VyIGFzcyA9IEFzc2V0TWFuYWdlci5nZXRTeXN0ZW0oKTsKLSAgICAgICAgSW5wdXRTdHJlYW0gaW4gPSBudWxsOwotICAgICAgICBPdXRwdXRTdHJlYW0gb3V0ID0gbnVsbDsKLSAgICAgICAgCi0gICAgICAgIHRyeQotICAgICAgICB7Ci0gICAgICAgICAgICBpbiA9IGFzcy5vcGVuKGZpbGUudG9TdHJpbmcoKSk7Ci0KLSAgICAgICAgICAgIHVybCA9IG1Db250ZW50UmVzb2x2ZXIuaW5zZXJ0KEltYWdlcy5NZWRpYS5JTlRFUk5BTF9DT05URU5UX1VSSSwgaW1hZ2V2KTsKLSAgICAgICAgICAgIG91dCA9IG1Db250ZW50UmVzb2x2ZXIub3Blbk91dHB1dFN0cmVhbSh1cmwpOwotCi0gICAgICAgICAgICBmaW5hbCBpbnQgc2l6ZSA9IDggKiAxMDI0OwotICAgICAgICAgICAgYnl0ZVtdIGJ1ZiA9IG5ldyBieXRlW3NpemVdOwotCi0gICAgICAgICAgICBpbnQgY291bnQgPSAwOwotICAgICAgICAgICAgZG8KLSAgICAgICAgICAgIHsKLSAgICAgICAgICAgICAgICBjb3VudCA9IGluLnJlYWQoYnVmLCAwLCBzaXplKTsKLSAgICAgICAgICAgICAgICBpZiAoY291bnQgPiAwKSB7Ci0gICAgICAgICAgICAgICAgICAgIG91dC53cml0ZShidWYsIDAsIGNvdW50KTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9IHdoaWxlIChjb3VudCA+IDApOwotICAgICAgICB9Ci0gICAgICAgIGNhdGNoIChFeGNlcHRpb24gZSkKLSAgICAgICAgewotICAgICAgICAgICAgU2xvZy5lKExPR19UQUcsICJGYWls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KCk7CiAgICAgZmluYWwgQXJyYXlMaXN0PEFjdGl2ZUFkbWluPiBtQWRtaW5MaXN0CiAgICAgICAgICAgICA9IG5ldyBBcnJheUxpc3Q8QWN0aXZlQWRtaW4+KCk7Ci0gICAgCisKICAgICBzdGF0aWMgY2xhc3MgQWN0aXZlQWRtaW4gewogICAgICAgICBmaW5hbCBEZXZpY2VBZG1pbkluZm8gaW5mbzsKLSAgICAgICAgCisKICAgICAgICAgaW50IHBhc3N3b3JkUXVhbGl0eSA9IERldmljZVBvbGljeU1hbmFnZXIuUEFTU1dPUkRfUVVBTElUWV9VTlNQRUNJRklFRDsKICAgICAgICAgaW50IG1pbmltdW1QYXNzd29yZExlbmd0aCA9IDA7CisgICAgICAgIGludCBwYXNzd29yZEhpc3RvcnlMZW5ndGggPSAwOworICAgICAgICBpbnQgbWluaW11bVBhc3N3b3JkVXBwZXJDYXNlID0gMDsKKyAgICAgICAgaW50IG1pbmltdW1QYXNzd29yZExvd2VyQ2FzZSA9IDA7CisgICAgICAgIGludCBtaW5pbXVtUGFzc3dvcmRMZXR0ZXJzID0gMTsKKyAgICAgICAgaW50IG1pbmltdW1QYXNzd29yZE51bWVyaWMgPSAxOworICAgICAgICBpbnQgbWluaW11bVBhc3N3b3JkU3ltYm9scyA9IDE7CisgICAgICAgIGludCBtaW5pbXVtUGFzc3dvcmROb25MZXR0ZXIgPSAwOwogICAgICAgICBsb25nIG1heGltdW1UaW1lVG9VbmxvY2sgPSAwOwogICAgICAgICBpbnQgbWF4aW11bUZhaWxlZFBhc3N3b3Jkc0ZvcldpcGUgPSAwOwotICAgICAgICAKKworICAgICAgICAvLyBUT0RPOiByZXZpZXcgaW1wbGVtZW50YXRpb24gZGVjaXNpb25zIHdpdGggZnJhbWV3b3JrcyB0ZWFtCisgICAgICAgIGJvb2xlYW4gc3BlY2lmaWVzR2xvYmFsUHJveHkgPSBmYWxzZTsKKyAgICAgICAgU3RyaW5nIGdsb2JhbFByb3h5U3BlYyA9IG51bGw7CisgICAgICAgIFN0cmluZyBnbG9iYWxQcm94eUV4Y2x1c2lvbkxpc3QgPSBudWxsOworCiAgICAgICAgIEFjdGl2ZUFkbWluKERldmljZUFkbWluSW5mbyBfaW5mbykgewogICAgICAgICAgICAgaW5mbyA9IF9pbmZvOwogICAgICAgICB9Ci0gICAgICAgIAorCiAgICAgICAgIGludCBnZXRVaWQoKSB7IHJldHVybiBpbmZvLmdldEFjdGl2aXR5SW5mbygpLmFwcGxpY2F0aW9uSW5mby51aWQ7IH0KLSAgICAgICAgCisKICAgICAgICAgdm9pZCB3cml0ZVRvWG1sKFhtbFNlcmlhbGl6ZXIgb3V0KQogICAgICAgICAgICAgICAgIHRocm93cyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24sIElsbGVnYWxTdGF0ZUV4Y2VwdGlvbiwgSU9FeGNlcHRpb24gewogICAgICAgICAgICAgb3V0LnN0YXJ0VGFnKG51bGwsICJwb2xpY2llcyIpOwpAQCAtMTEwLDcgKzEzMyw0MiBAQAogICAgICAgICAgICAgICAgIGlmIChtaW5pbXVtUGFzc3dvcmRMZW5ndGggPiAwKSB7CiAgICAgICAgICAgICAgICAgICAgIG91dC5zdGFydFRhZyhudWxsLCAibWluLXBhc3N3b3JkLWxlbmd0aCIpOwogICAgICAgICAgICAgICAgICAgICBvdXQuYXR0cmlidXRlKG51bGwsICJ2YWx1ZSIsIEludGVnZXIudG9TdHJpbmcobWluaW11bVBhc3N3b3JkTGVuZ3RoKSk7Ci0gICAgICAgICAgICAgICAgICAgIG91dC5lbmRUYWcobnVsbCwgIm1uLXBhc3N3b3JkLWxlbmd0aCIpOworICAgICAgICAgICAgICAgICAgICBvdXQuZW5kVGFnKG51bGwsICJtaW4tcGFzc3dvcmQtbGVuZ3RoIik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGlmKHBhc3N3b3JkSGlzdG9yeUxlbmd0aCA+IDApIHsKKyAgICAgICAgICAgICAgICAgICAgb3V0LnN0YXJ0VGFnKG51bGwsICJwYXNzd29yZC1oaXN0b3J5LWxlbmd0aCIpOworICAgICAgICAgICAgICAgICAgICBvdXQuYXR0cmlidXRlKG51bGwsICJ2YWx1ZSIsIEludGVnZXIudG9TdHJpbmcocGFzc3dvcmRIaXN0b3J5TGVuZ3RoKSk7CisgICAgICAgICAgICAgICAgICAgIG91dC5lbmRUYWcobnVsbCwgInBhc3N3b3JkLWhpc3RvcnktbGVuZ3RoIik7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGlmIChtaW5pbXVtUGFzc3dvcmRVcHBlckNhc2UgPiAwKSB7CisgICAgICAgICAgICAgICAgICAgIG91dC5zdGFydFRhZyhudWxsLCAibWluLXBhc3N3b3JkLXVwcGVyY2FzZSIpOworICAgICAgICAgICAgICAgICAgICBvdXQuYXR0cmlidXRlKG51bGwsICJ2YWx1ZSIsIEludGVnZXIudG9TdHJpbmcobWluaW11bVBhc3N3b3JkVXBwZXJDYXNlKSk7CisgICAgICAgICAgICAgICAgICAgIG91dC5lbmRUYWcobnVsbCwgIm1pbi1wYXNzd29yZC11cHBlcmNhc2UiKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKG1pbmltdW1QYXNzd29yZExvd2VyQ2FzZSA+IDApIHsKKyAgICAgICAgICAgICAgICAgICAgb3V0LnN0YXJ0VGFnKG51bGwsICJtaW4tcGFzc3dvcmQtbG93ZXJjYXNlIik7CisgICAgICAgICAgICAgICAgICAgIG91dC5hdHRyaWJ1dGUobnVsbCwgInZhbHVlIiwgSW50ZWdlci50b1N0cmluZyhtaW5pbXVtUGFzc3dvcmRMb3dlckNhc2UpKTsKKyAgICAgICAgICAgICAgICAgICAgb3V0LmVuZFRhZyhudWxsLCAibWluLXBhc3N3b3JkLWxvd2VyY2FzZSIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBpZiAobWluaW11bVBhc3N3b3JkTGV0dGVycyA+IDApIHsKKyAgICAgICAgICAgICAgICAgICAgb3V0LnN0YXJ0VGFnKG51bGwsICJtaW4tcGFzc3dvcmQtbGV0dGVycyIpOworICAgICAgICAgICAgICAgICAgICBvdXQuYXR0cmlidXRlKG51bGwsICJ2YWx1ZSIsIEludGVnZXIudG9TdHJpbmcobWluaW11bVBhc3N3b3JkTGV0dGVycykpOworICAgICAgICAgICAgICAgICAgICBvdXQuZW5kVGFnKG51bGwsICJtaW4tcGFzc3dvcmQtbGV0dGVycyIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBpZiAobWluaW11bVBhc3N3b3JkTnVtZXJpYyA+IDApIHsKKyAgICAgICAgICAgICAgICAgICAgb3V0LnN0YXJ0VGFnKG51bGwsICJtaW4tcGFzc3dvcmQtbnVtZXJpYyIpOworICAgICAgICAgICAgICAgICAgICBvdXQuYXR0cmlidXRlKG51bGwsICJ2YWx1ZSIsIEludGVnZXIudG9TdHJpbmcobWluaW11bVBhc3N3b3JkTnVtZXJpYykpOworICAgICAgICAgICAgICAgICAgICBvdXQuZW5kVGFnKG51bGwsICJtaW4tcGFzc3dvcmQtbnVtZXJpYyIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBpZiAobWluaW11bVBhc3N3b3JkU3ltYm9scyA+IDApIHsKKyAgICAgICAgICAgICAgICAgICAgb3V0LnN0YXJ0VGFnKG51bGwsICJtaW4tcGFzc3dvcmQtc3ltYm9scyIpOworICAgICAgICAgICAgICAgICAgICBvdXQuYXR0cmlidXRlKG51bGwsICJ2YWx1ZSIsIEludGVnZXIudG9TdHJpbmcobWluaW11bVBhc3N3b3JkU3ltYm9scykpOworICAgICAgICAgICAgICAgICAgICBvdXQuZW5kVGFnKG51bGwsICJtaW4tcGFzc3dvcmQtc3ltYm9scyIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBpZiAobWluaW11bVBhc3N3b3JkTm9uTGV0dGVyID4gMCkgeworICAgICAgICAgICAgICAgICAgICBvdXQuc3RhcnRUYWcobnVsbCwgIm1pbi1wYXNzd29yZC1ub25sZXR0ZXIiKTsKKyAgICAgICAgICAgICAgICAgICAgb3V0LmF0dHJpYnV0ZShudWxsLCAidmFsdWUiLCBJbnRlZ2VyLnRvU3RyaW5nKG1pbmltdW1QYXNzd29yZE5vbkxldHRlcikpOworICAgICAgICAgICAgICAgICAgICBvdXQuZW5kVGFnKG51bGwsICJtaW4tcGFzc3dvcmQtbm9ubGV0dGVyIik7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICAgICAgaWYgKG1heGltdW1UaW1lVG9VbmxvY2sgIT0gRGV2aWNlUG9saWN5TWFuYWdlci5QQVNTV09SRF9RVUFMSVRZX1VOU1BFQ0lGSUVEKSB7CkBAIC0xMjMsOCArMTgxLDIzIEBACiAgICAgICAgICAgICAgICAgb3V0LmF0dHJpYnV0ZShudWxsLCAidmFsdWUiLCBJbnRlZ2VyLnRvU3RyaW5nKG1heGltdW1GYWlsZWRQYXNzd29yZHNGb3JXaXBlKSk7CiAgICAgICAgICAgICAgICAgb3V0LmVuZFRhZyhudWxsLCAibWF4LWZhaWxlZC1wYXNzd29yZC13aXBlIik7CiAgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoc3BlY2lmaWVzR2xvYmFsUHJveHkpIHsKKyAgICAgICAgICAgICAgICBvdXQuc3RhcnRUYWcobnVsbCwgInNwZWNpZmllcy1nbG9iYWwtcHJveHkiKTsKKyAgICAgICAgICAgICAgICBvdXQuYXR0cmlidXRlKG51bGwsICJ2YWx1ZSIsIEJvb2xlYW4udG9TdHJpbmcoc3BlY2lmaWVzR2xvYmFsUHJveHkpKTsKKyAgICAgICAgICAgICAgICBvdXQuZW5kVGFnKG51bGwsICJzcGVjaWZpZXNfZ2xvYmFsX3Byb3h5Iik7CisgICAgICAgICAgICAgICAgaWYgKGdsb2JhbFByb3h5U3BlYyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIG91dC5zdGFydFRhZyhudWxsLCAiZ2xvYmFsLXByb3h5LXNwZWMiKTsKKyAgICAgICAgICAgICAgICAgICAgb3V0LmF0dHJpYnV0ZShudWxsLCAidmFsdWUiLCBnbG9iYWxQcm94eVNwZWMpOworICAgICAgICAgICAgICAgICAgICBvdXQuZW5kVGFnKG51bGwsICJnbG9iYWwtcHJveHktc3BlYyIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBpZiAoZ2xvYmFsUHJveHlFeGNsdXNpb25MaXN0ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgb3V0LnN0YXJ0VGFnKG51bGwsICJnbG9iYWwtcHJveHktZXhjbHVzaW9uLWxpc3QiKTsKKyAgICAgICAgICAgICAgICAgICAgb3V0LmF0dHJpYnV0ZShudWxsLCAidmFsdWUiLCBnbG9iYWxQcm94eUV4Y2x1c2lvbkxpc3QpOworICAgICAgICAgICAgICAgICAgICBvdXQuZW5kVGFnKG51bGwsICJnbG9iYWwtcHJveHktZXhjbHVzaW9uLWxpc3QiKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CiAgICAgICAgIH0KLSAgICAgICAgCisKICAgICAgICAgdm9pZCByZWFkRnJvbVhtbChYbWxQdWxsUGFyc2VyIHBhcnNlcikKICAgICAgICAgICAgICAgICB0aHJvd3MgWG1sUHVsbFBhcnNlckV4Y2VwdGlvbiwgSU9FeGNlcHRpb24gewogICAgICAgICAgICAgaW50IG91dGVyRGVwdGggPSBwYXJzZXIuZ2V0RGVwdGgoKTsKQEAgLTE0MywxOSArMjE2LDQ5IEBACiAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICgibWluLXBhc3N3b3JkLWxlbmd0aCIuZXF1YWxzKHRhZykpIHsKICAgICAgICAgICAgICAgICAgICAgbWluaW11bVBhc3N3b3JkTGVuZ3RoID0gSW50ZWdlci5wYXJzZUludCgKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJzZXIuZ2V0QXR0cmlidXRlVmFsdWUobnVsbCwgInZhbHVlIikpOworICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoInBhc3N3b3JkLWhpc3RvcnktbGVuZ3RoIi5lcXVhbHModGFnKSkgeworICAgICAgICAgICAgICAgICAgICBwYXNzd29yZEhpc3RvcnlMZW5ndGggPSBJbnRlZ2VyLnBhcnNlSW50KAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcnNlci5nZXRBdHRyaWJ1dGVWYWx1ZShudWxsLCAidmFsdWUiKSk7CisgICAgICAgICAgICAgICAgfSBlbHNlIGlmICgibWluLXBhc3N3b3JkLXVwcGVyY2FzZSIuZXF1YWxzKHRhZykpIHsKKyAgICAgICAgICAgICAgICAgICAgbWluaW11bVBhc3N3b3JkVXBwZXJDYXNlID0gSW50ZWdlci5wYXJzZUludCgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJzZXIuZ2V0QXR0cmlidXRlVmFsdWUobnVsbCwgInZhbHVlIikpOworICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoIm1pbi1wYXNzd29yZC1sb3dlcmNhc2UiLmVxdWFscyh0YWcpKSB7CisgICAgICAgICAgICAgICAgICAgIG1pbmltdW1QYXNzd29yZExvd2VyQ2FzZSA9IEludGVnZXIucGFyc2VJbnQoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyc2VyLmdldEF0dHJpYnV0ZVZhbHVlKG51bGwsICJ2YWx1ZSIpKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKCJtaW4tcGFzc3dvcmQtbGV0dGVycyIuZXF1YWxzKHRhZykpIHsKKyAgICAgICAgICAgICAgICAgICAgbWluaW11bVBhc3N3b3JkTGV0dGVycyA9IEludGVnZXIucGFyc2VJbnQoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyc2VyLmdldEF0dHJpYnV0ZVZhbHVlKG51bGwsICJ2YWx1ZSIpKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKCJtaW4tcGFzc3dvcmQtbnVtZXJpYyIuZXF1YWxzKHRhZykpIHsKKyAgICAgICAgICAgICAgICAgICAgbWluaW11bVBhc3N3b3JkTnVtZXJpYyA9IEludGVnZXIucGFyc2VJbnQoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyc2VyLmdldEF0dHJpYnV0ZVZhbHVlKG51bGwsICJ2YWx1ZSIpKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKCJtaW4tcGFzc3dvcmQtc3ltYm9scyIuZXF1YWxzKHRhZykpIHsKKyAgICAgICAgICAgICAgICAgICAgbWluaW11bVBhc3N3b3JkU3ltYm9scyA9IEludGVnZXIucGFyc2VJbnQoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyc2VyLmdldEF0dHJpYnV0ZVZhbHVlKG51bGwsICJ2YWx1ZSIpKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKCJtaW4tcGFzc3dvcmQtbm9ubGV0dGVyIi5lcXVhbHModGFnKSkgeworICAgICAgICAgICAgICAgICAgICBtaW5pbXVtUGFzc3dvcmROb25MZXR0ZXIgPSBJbnRlZ2VyLnBhcnNlSW50KAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcnNlci5nZXRBdHRyaWJ1dGVWYWx1ZShudWxsLCAidmFsdWUiKSk7CiAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICgibWF4LXRpbWUtdG8tdW5sb2NrIi5lcXVhbHModGFnKSkgewogICAgICAgICAgICAgICAgICAgICBtYXhpbXVtVGltZVRvVW5sb2NrID0gTG9uZy5wYXJzZUxvbmcoCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyc2VyLmdldEF0dHJpYnV0ZVZhbHVlKG51bGwsICJ2YWx1ZSIpKTsKICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKCJtYXgtZmFpbGVkLXBhc3N3b3JkLXdpcGUiLmVxdWFscyh0YWcpKSB7CiAgICAgICAgICAgICAgICAgICAgIG1heGltdW1GYWlsZWRQYXNzd29yZHNGb3JXaXBlID0gSW50ZWdlci5wYXJzZUludCgKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJzZXIuZ2V0QXR0cmlidXRlVmFsdWUobnVsbCwgInZhbHVlIikpOworICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoInNwZWNpZmllcy1nbG9iYWwtcHJveHkiLmVxdWFscyh0YWcpKSB7CisgICAgICAgICAgICAgICAgICAgIHNwZWNpZmllc0dsb2JhbFByb3h5ID0gQm9vbGVhbi5nZXRCb29sZWFuKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcnNlci5nZXRBdHRyaWJ1dGVWYWx1ZShudWxsLCAidmFsdWUiKSk7CisgICAgICAgICAgICAgICAgfSBlbHNlIGlmICgiZ2xvYmFsLXByb3h5LXNwZWMiLmVxdWFscyh0YWcpKSB7CisgICAgICAgICAgICAgICAgICAgIGdsb2JhbFByb3h5U3BlYyA9CisgICAgICAgICAgICAgICAgICAgICAgICBwYXJzZXIuZ2V0QXR0cmlidXRlVmFsdWUobnVsbCwgInZhbHVlIik7CisgICAgICAgICAgICAgICAgfSBlbHNlIGlmICgiZ2xvYmFsLXByb3h5LWV4Y2x1c2lvbi1saXN0Ii5lcXVhbHModGFnKSkgeworICAgICAgICAgICAgICAgICAgICBnbG9iYWxQcm94eUV4Y2x1c2lvbkxpc3QgPQorICAgICAgICAgICAgICAgICAgICAgICAgcGFyc2VyLmdldEF0dHJpYnV0ZVZhbHVlKG51bGwsICJ2YWx1ZSIpOwogICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgIFNsb2cudyhUQUcsICJVbmtub3duIGFkbWluIHRhZzogIiArIHRhZyk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIFhtbFV0aWxzLnNraXBDdXJyZW50VGFnKHBhcnNlcik7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KLSAgICAgICAgCisKICAgICAgICAgdm9pZCBkdW1wKFN0cmluZyBwcmVmaXgsIFByaW50V3JpdGVyIHB3KSB7CiAgICAgICAgICAgICBwdy5wcmludChwcmVmaXgpOyBwdy5wcmludCgidWlkPSIpOyBwdy5wcmludGxuKGdldFVpZCgpKTsKICAgICAgICAgICAgIHB3LnByaW50KHByZWZpeCk7IHB3LnByaW50bG4oInBvbGljaWVzOiIpOwpAQCAtMTY2LDIzICsyNjksNDcgQEAKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBwdy5wcmludChwcmVmaXgpOyBwdy5wcmludCgicGFzc3dvcmRRdWFsaXR5PTB4Iik7Ci0gICAgICAgICAgICAgICAgICAgIHB3LnByaW50KEludGVnZXIudG9IZXhTdHJpbmcocGFzc3dvcmRRdWFsaXR5KSk7Ci0gICAgICAgICAgICAgICAgICAgIHB3LnByaW50KCIgbWluaW11bVBhc3N3b3JkTGVuZ3RoPSIpOworICAgICAgICAgICAgICAgICAgICBwdy5wcmludGxuKEludGVnZXIudG9IZXhTdHJpbmcocGFzc3dvcmRRdWFsaXR5KSk7CisgICAgICAgICAgICBwdy5wcmludChwcmVmaXgpOyBwdy5wcmludCgibWluaW11bVBhc3N3b3JkTGVuZ3RoPSIpOwogICAgICAgICAgICAgICAgICAgICBwdy5wcmludGxuKG1pbmltdW1QYXNzd29yZExlbmd0aCk7CisgICAgICAgICAgICBwdy5wcmludChwcmVmaXgpOyBwdy5wcmludCgicGFzc3dvcmRIaXN0b3J5TGVuZ3RoPSIpOworICAgICAgICAgICAgICAgICAgICBwdy5wcmludGxuKHBhc3N3b3JkSGlzdG9yeUxlbmd0aCk7CisgICAgICAgICAgICBwdy5wcmludChwcmVmaXgpOyBwdy5wcmludCgibWluaW11bVBhc3N3b3JkVXBwZXJDYXNlPSIpOworICAgICAgICAgICAgICAgICAgICBwdy5wcmludGxuKG1pbmltdW1QYXNzd29yZFVwcGVyQ2FzZSk7CisgICAgICAgICAgICBwdy5wcmludChwcmVmaXgpOyBwdy5wcmludCgibWluaW11bVBhc3N3b3JkTG93ZXJDYXNlPSIpOworICAgICAgICAgICAgICAgICAgICBwdy5wcmludGxuKG1pbmltdW1QYXNzd29yZExvd2VyQ2FzZSk7CisgICAgICAgICAgICBwdy5wcmludChwcmVmaXgpOyBwdy5wcmludCgibWluaW11bVBhc3N3b3JkTGV0dGVycz0iKTsKKyAgICAgICAgICAgICAgICAgICAgcHcucHJpbnRsbihtaW5pbXVtUGFzc3dvcmRMZXR0ZXJzKTsKKyAgICAgICAgICAgIHB3LnByaW50KHByZWZpeCk7IHB3LnByaW50KCJtaW5pbXVtUGFzc3dvcmROdW1lcmljPSIpOworICAgICAgICAgICAgICAgICAgICBwdy5wcmludGxuKG1pbmltdW1QYXNzd29yZE51bWVyaWMpOworICAgICAgICAgICAgcHcucHJpbnQocHJlZml4KTsgcHcucHJpbnQoIm1pbmltdW1QYXNzd29yZFN5bWJvbHM9Iik7CisgICAgICAgICAgICAgICAgICAgIHB3LnByaW50bG4obWluaW11bVBhc3N3b3JkU3ltYm9scyk7CisgICAgICAgICAgICBwdy5wcmludChwcmVmaXgpOyBwdy5wcmludCgibWluaW11bVBhc3N3b3JkTm9uTGV0dGVyPSIpOworICAgICAgICAgICAgICAgICAgICBwdy5wcmludGxuKG1pbmltdW1QYXNzd29yZE5vbkxldHRlcik7CiAgICAgICAgICAgICBwdy5wcmludChwcmVmaXgpOyBwdy5wcmludCgibWF4aW11bVRpbWVUb1VubG9jaz0iKTsKICAgICAgICAgICAgICAgICAgICAgcHcucHJpbnRsbihtYXhpbXVtVGltZVRvVW5sb2NrKTsKICAgICAgICAgICAgIHB3LnByaW50KHByZWZpeCk7IHB3LnByaW50KCJtYXhpbXVtRmFpbGVkUGFzc3dvcmRzRm9yV2lwZT0iKTsKICAgICAgICAgICAgICAgICAgICAgcHcucHJpbnRsbihtYXhpbXVtRmFpbGVkUGFzc3dvcmRzRm9yV2lwZSk7CisgICAgICAgICAgICBwdy5wcmludChwcmVmaXgpOyBwdy5wcmludCgic3BlY2lmaWVzR2xvYmFsUHJveHk9Iik7CisgICAgICAgICAgICAgICAgICAgIHB3LnByaW50bG4oc3BlY2lmaWVzR2xvYmFsUHJveHkpOworICAgICAgICAgICAgaWYgKGdsb2JhbFByb3h5U3BlYyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgcHcucHJpbnQocHJlZml4KTsgcHcucHJpbnQoImdsb2JhbFByb3h5U3BlYz0iKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHB3LnByaW50bG4oZ2xvYmFsUHJveHlTcGVjKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChnbG9iYWxQcm94eUV4Y2x1c2lvbkxpc3QgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIHB3LnByaW50KHByZWZpeCk7IHB3LnByaW50KCJnbG9iYWxQcm94eUVjbHVzaW9uTGlzdD0iKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHB3LnByaW50bG4oZ2xvYmFsUHJveHlFeGNsdXNpb25MaXN0KTsKKyAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgIH0KLSAgICAKKwogICAgIGNsYXNzIE15UGFja2FnZU1vbml0b3IgZXh0ZW5kcyBQYWNrYWdlTW9uaXRvciB7CiAgICAgICAgIHB1YmxpYyB2b2lkIG9uU29tZVBhY2thZ2VzQ2hhbmdlZCgpIHsKICAgICAgICAgICAgIHN5bmNocm9uaXplZCAoRGV2aWNlUG9saWN5TWFuYWdlclNlcnZpY2UudGhpcykgewogICAgICAgICAgICAgICAgIGJvb2xlYW4gcmVtb3ZlZCA9IGZhbHNlOwogICAgICAgICAgICAgICAgIGZvciAoaW50IGk9bUFkbWluTGlzdC5zaXplKCktMTsgaT49MDsgaS0tKSB7CiAgICAgICAgICAgICAgICAgICAgIEFjdGl2ZUFkbWluIGFhID0gbUFkbWluTGlzdC5nZXQoaSk7Ci0gICAgICAgICAgICAgICAgICAgIGludCBjaGFuZ2UgPSBpc1BhY2thZ2VEaXNhcHBlYXJpbmcoYWEuaW5mby5nZXRQYWNrYWdlTmFtZSgpKTsgCisgICAgICAgICAgICAgICAgICAgIGludCBjaGFuZ2UgPSBpc1BhY2thZ2VEaXNhcHBlYXJpbmcoYWEuaW5mby5nZXRQYWNrYWdlTmFtZSgpKTsKICAgICAgICAgICAgICAgICAgICAgaWYgKGNoYW5nZSA9PSBQQUNLQUdFX1BFUk1BTkVOVF9DSEFOR0UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8fCBjaGFuZ2UgPT0gUEFDS0FHRV9URU1QT1JBUllfQ0hBTkdFKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBTbG9nLncoVEFHLCAiQWRtaW4gdW5leHBlY3RlZGx5IHVuaW5zdGFsbGVkOiAiCkBAIC0yMDcsNyArMzM0LDcgQEAKICAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgIH0KLSAgICAKKwogICAgIC8qKgogICAgICAqIEluc3RhbnRpYXRlcyB0aGUgc2VydmljZS4KICAgICAgKi8KQEAgLTIyNCw3ICszNTEsNyBAQAogICAgICAgICB9CiAgICAgICAgIHJldHVybiBtSVBvd2VyTWFuYWdlcjsKICAgICB9Ci0gICAgCisKICAgICBBY3RpdmVBZG1pbiBnZXRBY3RpdmVBZG1pblVuY2hlY2tlZExvY2tlZChDb21wb25lbnROYW1lIHdobykgewogICAgICAgICBBY3RpdmVBZG1pbiBhZG1pbiA9IG1BZG1pbk1hcC5nZXQod2hvKTsKICAgICAgICAgaWYgKGFkbWluICE9IG51bGwKQEAgLTIzNCw3ICszNjEsNyBAQAogICAgICAgICB9CiAgICAgICAgIHJldHVybiBudWxsOwogICAgIH0KLSAgICAKKwogICAgIEFjdGl2ZUFkbWluIGdldEFjdGl2ZUFkbWluRm9yQ2FsbGVyTG9ja2VkKENvbXBvbmVudE5hbWUgd2hvLCBpbnQgcmVxUG9saWN5KQogICAgICAgICAgICAgdGhyb3dzIFNlY3VyaXR5RXhjZXB0aW9uIHsKICAgICAgICAgZmluYWwgaW50IGNhbGxpbmdVaWQgPSBCaW5kZXIuZ2V0Q2FsbGluZ1VpZCgpOwpAQCAtMjY1LDEzICszOTIsMTMgQEAKICAgICAgICAgICAgICAgICAgICAgKyBCaW5kZXIuZ2V0Q2FsbGluZ1VpZCgpICsgIiBmb3IgcG9saWN5ICMiICsgcmVxUG9saWN5KTsKICAgICAgICAgfQogICAgIH0KLSAgICAKKwogICAgIHZvaWQgc2VuZEFkbWluQ29tbWFuZExvY2tlZChBY3RpdmVBZG1pbiBhZG1pbiwgU3RyaW5nIGFjdGlvbikgewogICAgICAgICBJbnRlbnQgaW50ZW50ID0gbmV3IEludGVudChhY3Rpb24pOwogICAgICAgICBpbnRlbnQuc2V0Q29tcG9uZW50KGFkbWluLmluZm8uZ2V0Q29tcG9uZW50KCkpOwogICAgICAgICBtQ29udGV4dC5zZW5kQnJvYWRjYXN0KGludGVudCk7CiAgICAgfQotICAgIAorCiAgICAgdm9pZCBzZW5kQWRtaW5Db21tYW5kTG9ja2VkKFN0cmluZyBhY3Rpb24sIGludCByZXFQb2xpY3kpIHsKICAgICAgICAgZmluYWwgaW50IE4gPSBtQWRtaW5MaXN0LnNpemUoKTsKICAgICAgICAgaWYgKE4gPiAwKSB7CkBAIC0yODMsMTkgKzQxMCwyNCBAQAogICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgfQotICAgIAorCiAgICAgdm9pZCByZW1vdmVBY3RpdmVBZG1pbkxvY2tlZChDb21wb25lbnROYW1lIGFkbWluUmVjZWl2ZXIpIHsKICAgICAgICAgQWN0aXZlQWRtaW4gYWRtaW4gPSBnZXRBY3RpdmVBZG1pblVuY2hlY2tlZExvY2tlZChhZG1pblJlY2VpdmVyKTsKICAgICAgICAgaWYgKGFkbWluICE9IG51bGwpIHsKKyAgICAgICAgICAgIGJvb2xlYW4gZG9Qcm94eUNsZWFudXAgPQorICAgICAgICAgICAgICAgIGFkbWluLmluZm8udXNlc1BvbGljeShEZXZpY2VBZG1pbkluZm8uVVNFU19QT0xJQ1lfU0VUU19HTE9CQUxfUFJPWFkpOwogICAgICAgICAgICAgc2VuZEFkbWluQ29tbWFuZExvY2tlZChhZG1pbiwKICAgICAgICAgICAgICAgICAgICAgRGV2aWNlQWRtaW5SZWNlaXZlci5BQ1RJT05fREVWSUNFX0FETUlOX0RJU0FCTEVEKTsKICAgICAgICAgICAgIC8vIFhYWCBuZWVkIHRvIHdhaXQgZm9yIGl0IHRvIGNvbXBsZXRlLgogICAgICAgICAgICAgbUFkbWluTGlzdC5yZW1vdmUoYWRtaW4pOwogICAgICAgICAgICAgbUFkbWluTWFwLnJlbW92ZShhZG1pblJlY2VpdmVyKTsKICAgICAgICAgICAgIHZhbGlkYXRlUGFzc3dvcmRPd25lckxvY2tlZCgpOworICAgICAgICAgICAgaWYgKGRvUHJveHlDbGVhbnVwKSB7CisgICAgICAgICAgICAgICAgcmVzZXRHbG9iYWxQcm94eSgpOworICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgfQotICAgIAorCiAgICAgcHVibGljIERldmljZUFkbWluSW5mbyBmaW5kQWRtaW4oQ29tcG9uZW50TmFtZSBhZG1pbk5hbWUpIHsKICAgICAgICAgSW50ZW50IHJlc29sdmVJbnRlbnQgPSBuZXcgSW50ZW50KCk7CiAgICAgICAgIHJlc29sdmVJbnRlbnQuc2V0Q29tcG9uZW50KGFkbWluTmFtZSk7CkBAIC0zMDQsNyArNDM2LDcgQEAKICAgICAgICAgaWYgKGluZm9zID09IG51bGwgfHwgaW5mb3Muc2l6ZSgpIDw9IDApIHsKICAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oIlVua25vd24gYWRtaW46ICIgKyBhZG1pbk5hbWUpOwogICAgICAgICB9Ci0gICAgICAgIAorCiAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICByZXR1cm4gbmV3IERldmljZUFkbWluSW5mbyhtQ29udGV4dCwgaW5mb3MuZ2V0KDApKTsKICAgICAgICAgfSBjYXRjaCAoWG1sUHVsbFBhcnNlckV4Y2VwdGlvbiBlKSB7CkBAIC0zMTUsNyArNDQ3LDcgQEAKICAgICAgICAgICAgIHJldHVybiBudWxsOwogICAgICAgICB9CiAgICAgfQotICAgIAorCiAgICAgcHJpdmF0ZSBzdGF0aWMgSm91cm5hbGVkRmlsZSBtYWtlSm91cm5hbGVkRmlsZSgpIHsKICAgICAgICAgZmluYWwgU3RyaW5nIGJhc2UgPSAiL2RhdGEvc3lzdGVtL2RldmljZV9wb2xpY2llcy54bWwiOwogICAgICAgICByZXR1cm4gbmV3IEpvdXJuYWxlZEZpbGUobmV3IEZpbGUoYmFzZSksIG5ldyBGaWxlKGJhc2UgKyAiLnRtcCIpKTsKQEAgLTMzMSw3ICs0NjMsNyBAQAogICAgICAgICAgICAgb3V0LnN0YXJ0RG9jdW1lbnQobnVsbCwgdHJ1ZSk7CiAKICAgICAgICAgICAgIG91dC5zdGFydFRhZyhudWxsLCAicG9saWNpZXMiKTsKLSAgICAgICAgICAgIAorCiAgICAgICAgICAgICBmaW5hbCBpbnQgTiA9IG1BZG1pbkxpc3Quc2l6ZSgpOwogICAgICAgICAgICAgZm9yIChpbnQgaT0wOyBpPE47IGkrKykgewogICAgICAgICAgICAgICAgIEFjdGl2ZUFkbWluIGFwID0gbUFkbWluTGlzdC5nZXQoaSk7CkBAIC0zNDIsMjYgKzQ3NCwzNiBAQAogICAgICAgICAgICAgICAgICAgICBvdXQuZW5kVGFnKG51bGwsICJhZG1pbiIpOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIAorCiAgICAgICAgICAgICBpZiAobVBhc3N3b3JkT3duZXIgPj0gMCkgewogICAgICAgICAgICAgICAgIG91dC5zdGFydFRhZyhudWxsLCAicGFzc3dvcmQtb3duZXIiKTsKICAgICAgICAgICAgICAgICBvdXQuYXR0cmlidXRlKG51bGwsICJ2YWx1ZSIsIEludGVnZXIudG9TdHJpbmcobVBhc3N3b3JkT3duZXIpKTsKICAgICAgICAgICAgICAgICBvdXQuZW5kVGFnKG51bGwsICJwYXNzd29yZC1vd25lciIpOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgCisKICAgICAgICAgICAgIGlmIChtRmFpbGVkUGFzc3dvcmRBdHRlbXB0cyAhPSAwKSB7CiAgICAgICAgICAgICAgICAgb3V0LnN0YXJ0VGFnKG51bGwsICJmYWlsZWQtcGFzc3dvcmQtYXR0ZW1wdHMiKTsKICAgICAgICAgICAgICAgICBvdXQuYXR0cmlidXRlKG51bGwsICJ2YWx1ZSIsIEludGVnZXIudG9TdHJpbmcobUZhaWxlZFBhc3N3b3JkQXR0ZW1wdHMpKTsKICAgICAgICAgICAgICAgICBvdXQuZW5kVGFnKG51bGwsICJmYWlsZWQtcGFzc3dvcmQtYXR0ZW1wdHMiKTsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIAotICAgICAgICAgICAgaWYgKG1BY3RpdmVQYXNzd29yZFF1YWxpdHkgIT0gMCB8fCBtQWN0aXZlUGFzc3dvcmRMZW5ndGggIT0gMCkgeworCisgICAgICAgICAgICBpZiAobUFjdGl2ZVBhc3N3b3JkUXVhbGl0eSAhPSAwIHx8IG1BY3RpdmVQYXNzd29yZExlbmd0aCAhPSAwCisgICAgICAgICAgICAgICAgICAgIHx8IG1BY3RpdmVQYXNzd29yZFVwcGVyQ2FzZSAhPSAwIHx8IG1BY3RpdmVQYXNzd29yZExvd2VyQ2FzZSAhPSAwCisgICAgICAgICAgICAgICAgICAgIHx8IG1BY3RpdmVQYXNzd29yZExldHRlcnMgIT0gMCB8fCBtQWN0aXZlUGFzc3dvcmROdW1lcmljICE9IDAKKyAgICAgICAgICAgICAgICAgICAgfHwgbUFjdGl2ZVBhc3N3b3JkU3ltYm9scyAhPSAwIHx8IG1BY3RpdmVQYXNzd29yZE5vbkxldHRlciAhPSAwKSB7CiAgICAgICAgICAgICAgICAgb3V0LnN0YXJ0VGFnKG51bGwsICJhY3RpdmUtcGFzc3dvcmQiKTsKICAgICAgICAgICAgICAgICBvdXQuYXR0cmlidXRlKG51bGwsICJxdWFsaXR5IiwgSW50ZWdlci50b1N0cmluZyhtQWN0aXZlUGFzc3dvcmRRdWFsaXR5KSk7CiAgICAgICAgICAgICAgICAgb3V0LmF0dHJpYnV0ZShudWxsLCAibGVuZ3RoIiwgSW50ZWdlci50b1N0cmluZyhtQWN0aXZlUGFzc3dvcmRMZW5ndGgpKTsKKyAgICAgICAgICAgICAgICBvdXQuYXR0cmlidXRlKG51bGwsICJ1cHBlcmNhc2UiLCBJbnRlZ2VyLnRvU3RyaW5nKG1BY3RpdmVQYXNzd29yZFVwcGVyQ2FzZSkpOworICAgICAgICAgICAgICAgIG91dC5hdHRyaWJ1dGUobnVsbCwgImxvd2VyY2FzZSIsIEludGVnZXIudG9TdHJpbmcobUFjdGl2ZVBhc3N3b3JkTG93ZXJDYXNlKSk7CisgICAgICAgICAgICAgICAgb3V0LmF0dHJpYnV0ZShudWxsLCAibGV0dGVycyIsIEludGVnZXIudG9TdHJpbmcobUFjdGl2ZVBhc3N3b3JkTGV0dGVycykpOworICAgICAgICAgICAgICAgIG91dC5hdHRyaWJ1dGUobnVsbCwgIm51bWVyaWMiLCBJbnRlZ2VyCisgICAgICAgICAgICAgICAgICAgICAgICAudG9TdHJpbmcobUFjdGl2ZVBhc3N3b3JkTnVtZXJpYykpOworICAgICAgICAgICAgICAgIG91dC5hdHRyaWJ1dGUobnVsbCwgInN5bWJvbHMiLCBJbnRlZ2VyLnRvU3RyaW5nKG1BY3RpdmVQYXNzd29yZFN5bWJvbHMpKTsKKyAgICAgICAgICAgICAgICBvdXQuYXR0cmlidXRlKG51bGwsICJub25sZXR0ZXIiLCBJbnRlZ2VyLnRvU3RyaW5nKG1BY3RpdmVQYXNzd29yZE5vbkxldHRlcikpOwogICAgICAgICAgICAgICAgIG91dC5lbmRUYWcobnVsbCwgImFjdGl2ZS1wYXNzd29yZCIpOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgCisKICAgICAgICAgICAgIG91dC5lbmRUYWcobnVsbCwgInBvbGljaWVzIik7CiAKICAgICAgICAgICAgIG91dC5lbmREb2N1bWVudCgpOwpAQCAtNDM5LDYgKzU4MSwxOCBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcnNlci5nZXRBdHRyaWJ1dGVWYWx1ZShudWxsLCAicXVhbGl0eSIpKTsKICAgICAgICAgICAgICAgICAgICAgbUFjdGl2ZVBhc3N3b3JkTGVuZ3RoID0gSW50ZWdlci5wYXJzZUludCgKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJzZXIuZ2V0QXR0cmlidXRlVmFsdWUobnVsbCwgImxlbmd0aCIpKTsKKyAgICAgICAgICAgICAgICAgICAgbUFjdGl2ZVBhc3N3b3JkVXBwZXJDYXNlID0gSW50ZWdlci5wYXJzZUludCgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJzZXIuZ2V0QXR0cmlidXRlVmFsdWUobnVsbCwgInVwcGVyY2FzZSIpKTsKKyAgICAgICAgICAgICAgICAgICAgbUFjdGl2ZVBhc3N3b3JkTG93ZXJDYXNlID0gSW50ZWdlci5wYXJzZUludCgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJzZXIuZ2V0QXR0cmlidXRlVmFsdWUobnVsbCwgImxvd2VyY2FzZSIpKTsKKyAgICAgICAgICAgICAgICAgICAgbUFjdGl2ZVBhc3N3b3JkTGV0dGVycyA9IEludGVnZXIucGFyc2VJbnQoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFyc2VyLmdldEF0dHJpYnV0ZVZhbHVlKG51bGwsICJsZXR0ZXJzIikpOworICAgICAgICAgICAgICAgICAgICBtQWN0aXZlUGFzc3dvcmROdW1lcmljID0gSW50ZWdlci5wYXJzZUludCgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJzZXIuZ2V0QXR0cmlidXRlVmFsdWUobnVsbCwgIm51bWVyaWMiKSk7CisgICAgICAgICAgICAgICAgICAgIG1BY3RpdmVQYXNzd29yZFN5bWJvbHMgPSBJbnRlZ2VyLnBhcnNlSW50KAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcnNlci5nZXRBdHRyaWJ1dGVWYWx1ZShudWxsLCAic3ltYm9scyIpKTsKKyAgICAgICAgICAgICAgICAgICAgbUFjdGl2ZVBhc3N3b3JkTm9uTGV0dGVyID0gSW50ZWdlci5wYXJzZUludCgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJzZXIuZ2V0QXR0cmlidXRlVmFsdWUobnVsbCwgIm5vbmxldHRlciIpKTsKICAgICAgICAgICAgICAgICAgICAgWG1sVXRpbHMuc2tpcEN1cnJlbnRUYWcocGFyc2VyKTsKICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICBTbG9nLncoVEFHLCAiVW5rbm93biB0YWc6ICIgKyB0YWcpOwpAQCAtNDc2LDEwICs2MzAsMTYgQEAKICAgICAgICAgICAgICAgICAgICAgKyBJbnRlZ2VyLnRvSGV4U3RyaW5nKHV0aWxzLmdldEFjdGl2ZVBhc3N3b3JkUXVhbGl0eSgpKSk7CiAgICAgICAgICAgICBtQWN0aXZlUGFzc3dvcmRRdWFsaXR5ID0gRGV2aWNlUG9saWN5TWFuYWdlci5QQVNTV09SRF9RVUFMSVRZX1VOU1BFQ0lGSUVEOwogICAgICAgICAgICAgbUFjdGl2ZVBhc3N3b3JkTGVuZ3RoID0gMDsKKyAgICAgICAgICAgIG1BY3RpdmVQYXNzd29yZFVwcGVyQ2FzZSA9IDA7CisgICAgICAgICAgICBtQWN0aXZlUGFzc3dvcmRMb3dlckNhc2UgPSAwOworICAgICAgICAgICAgbUFjdGl2ZVBhc3N3b3JkTGV0dGVycyA9IDA7CisgICAgICAgICAgICBtQWN0aXZlUGFzc3dvcmROdW1lcmljID0gMDsKKyAgICAgICAgICAgIG1BY3RpdmVQYXNzd29yZFN5bWJvbHMgPSAwOworICAgICAgICAgICAgbUFjdGl2ZVBhc3N3b3JkTm9uTGV0dGVyID0gMDsKICAgICAgICAgfQotICAgICAgICAKKwogICAgICAgICB2YWxpZGF0ZVBhc3N3b3JkT3duZXJMb2NrZWQoKTsKLSAgICAgICAgCisKICAgICAgICAgbG9uZyB0aW1lTXMgPSBnZXRNYXhpbXVtVGltZVRvTG9jayhudWxsKTsKICAgICAgICAgaWYgKHRpbWVNcyA8PSAwKSB7CiAgICAgICAgICAgICB0aW1lTXMgPSBJbnRlZ2VyLk1BWF9WQUxVRTsKQEAgLTQ5OCwxMiArNjU4LDEzIEBACiAgICAgICAgICAgICBjYXNlIERldmljZVBvbGljeU1hbmFnZXIuUEFTU1dPUkRfUVVBTElUWV9OVU1FUklDOgogICAgICAgICAgICAgY2FzZSBEZXZpY2VQb2xpY3lNYW5hZ2VyLlBBU1NXT1JEX1FVQUxJVFlfQUxQSEFCRVRJQzoKICAgICAgICAgICAgIGNhc2UgRGV2aWNlUG9saWN5TWFuYWdlci5QQVNTV09SRF9RVUFMSVRZX0FMUEhBTlVNRVJJQzoKKyAgICAgICAgICAgIGNhc2UgRGV2aWNlUG9saWN5TWFuYWdlci5QQVNTV09SRF9RVUFMSVRZX0NPTVBMRVg6CiAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICB9CiAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oIkludmFsaWQgcXVhbGl0eSBjb25zdGFudDogMHgiCiAgICAgICAgICAgICAgICAgKyBJbnRlZ2VyLnRvSGV4U3RyaW5nKHF1YWxpdHkpKTsKICAgICB9Ci0gICAgCisKICAgICB2b2lkIHZhbGlkYXRlUGFzc3dvcmRPd25lckxvY2tlZCgpIHsKICAgICAgICAgaWYgKG1QYXNzd29yZE93bmVyID49IDApIHsKICAgICAgICAgICAgIGJvb2xlYW4gaGF2ZU93bmVyID0gZmFsc2U7CkBAIC01MjAsMTcgKzY4MSwxNyBAQAogICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgfQotICAgIAorCiAgICAgcHVibGljIHZvaWQgc3lzdGVtUmVhZHkoKSB7CiAgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgewogICAgICAgICAgICAgbG9hZFNldHRpbmdzTG9ja2VkKCk7CiAgICAgICAgIH0KICAgICB9Ci0gICAgCisKICAgICBwdWJsaWMgdm9pZCBzZXRBY3RpdmVBZG1pbihDb21wb25lbnROYW1lIGFkbWluUmVjZWl2ZXIpIHsKICAgICAgICAgbUNvbnRleHQuZW5mb3JjZUNhbGxpbmdPclNlbGZQZXJtaXNzaW9uKAogICAgICAgICAgICAgICAgIGFuZHJvaWQuTWFuaWZlc3QucGVybWlzc2lvbi5CSU5EX0RFVklDRV9BRE1JTiwgbnVsbCk7Ci0gICAgICAgIAorCiAgICAgICAgIERldmljZUFkbWluSW5mbyBpbmZvID0gZmluZEFkbWluKGFkbWluUmVjZWl2ZXIpOwogICAgICAgICBpZiAoaW5mbyA9PSBudWxsKSB7CiAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJCYWQgYWRtaW46ICIgKyBhZG1pblJlY2VpdmVyKTsKQEAgLTU1MiwxMyArNzEzLDEzIEBACiAgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICB9Ci0gICAgCisKICAgICBwdWJsaWMgYm9vbGVhbiBpc0FkbWluQWN0aXZlKENvbXBvbmVudE5hbWUgYWRtaW5SZWNlaXZlcikgewogICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKICAgICAgICAgICAgIHJldHVybiBnZXRBY3RpdmVBZG1pblVuY2hlY2tlZExvY2tlZChhZG1pblJlY2VpdmVyKSAhPSBudWxsOwogICAgICAgICB9CiAgICAgfQotICAgIAorCiAgICAgcHVibGljIExpc3Q8Q29tcG9uZW50TmFtZT4gZ2V0QWN0aXZlQWRtaW5zKCkgewogICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKICAgICAgICAgICAgIGZpbmFsIGludCBOID0gbUFkbWluTGlzdC5zaXplKCk7CkBAIC01NzIsNyArNzMzLDcgQEAKICAgICAgICAgICAgIHJldHVybiByZXM7CiAgICAgICAgIH0KICAgICB9Ci0gICAgCisKICAgICBwdWJsaWMgYm9vbGVhbiBwYWNrYWdlSGFzQWN0aXZlQWRtaW5zKFN0cmluZyBwYWNrYWdlTmFtZSkgewogICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKICAgICAgICAgICAgIGZpbmFsIGludCBOID0gbUFkbWluTGlzdC5zaXplKCk7CkBAIC01ODQsNyArNzQ1LDcgQEAKICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICAgfQogICAgIH0KLSAgICAKKwogICAgIHB1YmxpYyB2b2lkIHJlbW92ZUFjdGl2ZUFkbWluKENvbXBvbmVudE5hbWUgYWRtaW5SZWNlaXZlcikgewogICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKICAgICAgICAgICAgIEFjdGl2ZUFkbWluIGFkbWluID0gZ2V0QWN0aXZlQWRtaW5VbmNoZWNrZWRMb2NrZWQoYWRtaW5SZWNlaXZlcik7CkBAIC02MDMsMTAgKzc2NCwxMCBAQAogICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgfQotICAgIAorCiAgICAgcHVibGljIHZvaWQgc2V0UGFzc3dvcmRRdWFsaXR5KENvbXBvbmVudE5hbWUgd2hvLCBpbnQgcXVhbGl0eSkgewogICAgICAgICB2YWxpZGF0ZVF1YWxpdHlDb25zdGFudChxdWFsaXR5KTsKLSAgICAgICAgCisKICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CiAgICAgICAgICAgICBpZiAod2hvID09IG51bGwpIHsKICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgTnVsbFBvaW50ZXJFeGNlcHRpb24oIkNvbXBvbmVudE5hbWUgaXMgbnVsbCIpOwpAQCAtNjE5LDE2ICs3ODAsMTYgQEAKICAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgIH0KLSAgICAKKwogICAgIHB1YmxpYyBpbnQgZ2V0UGFzc3dvcmRRdWFsaXR5KENvbXBvbmVudE5hbWUgd2hvKSB7CiAgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgewogICAgICAgICAgICAgaW50IG1vZGUgPSBEZXZpY2VQb2xpY3lNYW5hZ2VyLlBBU1NXT1JEX1FVQUxJVFlfVU5TUEVDSUZJRUQ7Ci0gICAgICAgICAgICAKKwogICAgICAgICAgICAgaWYgKHdobyAhPSBudWxsKSB7CiAgICAgICAgICAgICAgICAgQWN0aXZlQWRtaW4gYWRtaW4gPSBnZXRBY3RpdmVBZG1pblVuY2hlY2tlZExvY2tlZCh3aG8pOwogICAgICAgICAgICAgICAgIHJldHVybiBhZG1pbiAhPSBudWxsID8gYWRtaW4ucGFzc3dvcmRRdWFsaXR5IDogbW9kZTsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIAorCiAgICAgICAgICAgICBmaW5hbCBpbnQgTiA9IG1BZG1pbkxpc3Quc2l6ZSgpOwogICAgICAgICAgICAgZm9yICAoaW50IGk9MDsgaTxOOyBpKyspIHsKICAgICAgICAgICAgICAgICBBY3RpdmVBZG1pbiBhZG1pbiA9IG1BZG1pbkxpc3QuZ2V0KGkpOwpAQCAtNjM5LDcgKzgwMCw3IEBACiAgICAgICAgICAgICByZXR1cm4gbW9kZTsKICAgICAgICAgfQogICAgIH0KLSAgICAKKwogICAgIHB1YmxpYyB2b2lkIHNldFBhc3N3b3JkTWluaW11bUxlbmd0aChDb21wb25lbnROYW1lIHdobywgaW50IGxlbmd0aCkgewogICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKICAgICAgICAgICAgIGlmICh3aG8gPT0gbnVsbCkgewpAQCAtNjUzLDE2ICs4MTQsMTYgQEAKICAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgIH0KLSAgICAKKwogICAgIHB1YmxpYyBpbnQgZ2V0UGFzc3dvcmRNaW5pbXVtTGVuZ3RoKENvbXBvbmVudE5hbWUgd2hvKSB7CiAgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgewogICAgICAgICAgICAgaW50IGxlbmd0aCA9IDA7Ci0gICAgICAgICAgICAKKwogICAgICAgICAgICAgaWYgKHdobyAhPSBudWxsKSB7CiAgICAgICAgICAgICAgICAgQWN0aXZlQWRtaW4gYWRtaW4gPSBnZXRBY3RpdmVBZG1pblVuY2hlY2tlZExvY2tlZCh3aG8pOwogICAgICAgICAgICAgICAgIHJldHVybiBhZG1pbiAhPSBudWxsID8gYWRtaW4ubWluaW11bVBhc3N3b3JkTGVuZ3RoIDogbGVuZ3RoOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgCisKICAgICAgICAgICAgIGZpbmFsIGludCBOID0gbUFkbWluTGlzdC5zaXplKCk7CiAgICAgICAgICAgICBmb3IgIChpbnQgaT0wOyBpPE47IGkrKykgewogICAgICAgICAgICAgICAgIEFjdGl2ZUFkbWluIGFkbWluID0gbUFkbWluTGlzdC5nZXQoaSk7CkBAIC02NzMsMTggKzgzNCwyNjcgQEAKICAgICAgICAgICAgIHJldHVybiBsZW5ndGg7CiAgICAgICAgIH0KICAgICB9Ci0gICAgCisKKyAgICBwdWJsaWMgdm9pZCBzZXRQYXNzd29yZEhpc3RvcnlMZW5ndGgoQ29tcG9uZW50TmFtZSB3aG8sIGludCBsZW5ndGgpIHsKKyAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CisgICAgICAgICAgICBpZiAod2hvID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgTnVsbFBvaW50ZXJFeGNlcHRpb24oIkNvbXBvbmVudE5hbWUgaXMgbnVsbCIpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgQWN0aXZlQWRtaW4gYXAgPSBnZXRBY3RpdmVBZG1pbkZvckNhbGxlckxvY2tlZCh3aG8sCisgICAgICAgICAgICAgICAgICAgIERldmljZUFkbWluSW5mby5VU0VTX1BPTElDWV9MSU1JVF9QQVNTV09SRCk7CisgICAgICAgICAgICBpZiAoYXAucGFzc3dvcmRIaXN0b3J5TGVuZ3RoICE9IGxlbmd0aCkgeworICAgICAgICAgICAgICAgIGFwLnBhc3N3b3JkSGlzdG9yeUxlbmd0aCA9IGxlbmd0aDsKKyAgICAgICAgICAgICAgICBzYXZlU2V0dGluZ3NMb2NrZWQoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyBpbnQgZ2V0UGFzc3dvcmRIaXN0b3J5TGVuZ3RoKENvbXBvbmVudE5hbWUgd2hvKSB7CisgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgeworICAgICAgICAgICAgaW50IGxlbmd0aCA9IDA7CisKKyAgICAgICAgICAgIGlmICh3aG8gIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIEFjdGl2ZUFkbWluIGFkbWluID0gZ2V0QWN0aXZlQWRtaW5VbmNoZWNrZWRMb2NrZWQod2hvKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gYWRtaW4gIT0gbnVsbCA/IGFkbWluLnBhc3N3b3JkSGlzdG9yeUxlbmd0aCA6IGxlbmd0aDsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgZmluYWwgaW50IE4gPSBtQWRtaW5MaXN0LnNpemUoKTsKKyAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgTjsgaSsrKSB7CisgICAgICAgICAgICAgICAgQWN0aXZlQWRtaW4gYWRtaW4gPSBtQWRtaW5MaXN0LmdldChpKTsKKyAgICAgICAgICAgICAgICBpZiAobGVuZ3RoIDwgYWRtaW4ucGFzc3dvcmRIaXN0b3J5TGVuZ3RoKSB7CisgICAgICAgICAgICAgICAgICAgIGxlbmd0aCA9IGFkbWluLnBhc3N3b3JkSGlzdG9yeUxlbmd0aDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gbGVuZ3RoOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc2V0UGFzc3dvcmRNaW5pbXVtVXBwZXJDYXNlKENvbXBvbmVudE5hbWUgd2hvLCBpbnQgbGVuZ3RoKSB7CisgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgeworICAgICAgICAgICAgaWYgKHdobyA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IE51bGxQb2ludGVyRXhjZXB0aW9uKCJDb21wb25lbnROYW1lIGlzIG51bGwiKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIEFjdGl2ZUFkbWluIGFwID0gZ2V0QWN0aXZlQWRtaW5Gb3JDYWxsZXJMb2NrZWQod2hvLAorICAgICAgICAgICAgICAgICAgICBEZXZpY2VBZG1pbkluZm8uVVNFU19QT0xJQ1lfTElNSVRfUEFTU1dPUkQpOworICAgICAgICAgICAgaWYgKGFwLm1pbmltdW1QYXNzd29yZFVwcGVyQ2FzZSAhPSBsZW5ndGgpIHsKKyAgICAgICAgICAgICAgICBhcC5taW5pbXVtUGFzc3dvcmRVcHBlckNhc2UgPSBsZW5ndGg7CisgICAgICAgICAgICAgICAgc2F2ZVNldHRpbmdzTG9ja2VkKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgaW50IGdldFBhc3N3b3JkTWluaW11bVVwcGVyQ2FzZShDb21wb25lbnROYW1lIHdobykgeworICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKKyAgICAgICAgICAgIGludCBsZW5ndGggPSAwOworCisgICAgICAgICAgICBpZiAod2hvICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBBY3RpdmVBZG1pbiBhZG1pbiA9IGdldEFjdGl2ZUFkbWluVW5jaGVja2VkTG9ja2VkKHdobyk7CisgICAgICAgICAgICAgICAgcmV0dXJuIGFkbWluICE9IG51bGwgPyBhZG1pbi5taW5pbXVtUGFzc3dvcmRVcHBlckNhc2UgOiBsZW5ndGg7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGZpbmFsIGludCBOID0gbUFkbWluTGlzdC5zaXplKCk7CisgICAgICAgICAgICBmb3IgKGludCBpPTA7IGk8TjsgaSsrKSB7CisgICAgICAgICAgICAgICAgQWN0aXZlQWRtaW4gYWRtaW4gPSBtQWRtaW5MaXN0LmdldChpKTsKKyAgICAgICAgICAgICAgICBpZiAobGVuZ3RoIDwgYWRtaW4ubWluaW11bVBhc3N3b3JkVXBwZXJDYXNlKSB7CisgICAgICAgICAgICAgICAgICAgIGxlbmd0aCA9IGFkbWluLm1pbmltdW1QYXNzd29yZFVwcGVyQ2FzZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gbGVuZ3RoOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc2V0UGFzc3dvcmRNaW5pbXVtTG93ZXJDYXNlKENvbXBvbmVudE5hbWUgd2hvLCBpbnQgbGVuZ3RoKSB7CisgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgeworICAgICAgICAgICAgaWYgKHdobyA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IE51bGxQb2ludGVyRXhjZXB0aW9uKCJDb21wb25lbnROYW1lIGlzIG51bGwiKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIEFjdGl2ZUFkbWluIGFwID0gZ2V0QWN0aXZlQWRtaW5Gb3JDYWxsZXJMb2NrZWQod2hvLAorICAgICAgICAgICAgICAgICAgICBEZXZpY2VBZG1pbkluZm8uVVNFU19QT0xJQ1lfTElNSVRfUEFTU1dPUkQpOworICAgICAgICAgICAgaWYgKGFwLm1pbmltdW1QYXNzd29yZExvd2VyQ2FzZSAhPSBsZW5ndGgpIHsKKyAgICAgICAgICAgICAgICBhcC5taW5pbXVtUGFzc3dvcmRMb3dlckNhc2UgPSBsZW5ndGg7CisgICAgICAgICAgICAgICAgc2F2ZVNldHRpbmdzTG9ja2VkKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgaW50IGdldFBhc3N3b3JkTWluaW11bUxvd2VyQ2FzZShDb21wb25lbnROYW1lIHdobykgeworICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKKyAgICAgICAgICAgIGludCBsZW5ndGggPSAwOworCisgICAgICAgICAgICBpZiAod2hvICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBBY3RpdmVBZG1pbiBhZG1pbiA9IGdldEFjdGl2ZUFkbWluVW5jaGVja2VkTG9ja2VkKHdobyk7CisgICAgICAgICAgICAgICAgcmV0dXJuIGFkbWluICE9IG51bGwgPyBhZG1pbi5taW5pbXVtUGFzc3dvcmRMb3dlckNhc2UgOiBsZW5ndGg7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGZpbmFsIGludCBOID0gbUFkbWluTGlzdC5zaXplKCk7CisgICAgICAgICAgICBmb3IgKGludCBpPTA7IGk8TjsgaSsrKSB7CisgICAgICAgICAgICAgICAgQWN0aXZlQWRtaW4gYWRtaW4gPSBtQWRtaW5MaXN0LmdldChpKTsKKyAgICAgICAgICAgICAgICBpZiAobGVuZ3RoIDwgYWRtaW4ubWluaW11bVBhc3N3b3JkTG93ZXJDYXNlKSB7CisgICAgICAgICAgICAgICAgICAgIGxlbmd0aCA9IGFkbWluLm1pbmltdW1QYXNzd29yZExvd2VyQ2FzZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gbGVuZ3RoOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc2V0UGFzc3dvcmRNaW5pbXVtTGV0dGVycyhDb21wb25lbnROYW1lIHdobywgaW50IGxlbmd0aCkgeworICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKKyAgICAgICAgICAgIGlmICh3aG8gPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBOdWxsUG9pbnRlckV4Y2VwdGlvbigiQ29tcG9uZW50TmFtZSBpcyBudWxsIik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBBY3RpdmVBZG1pbiBhcCA9IGdldEFjdGl2ZUFkbWluRm9yQ2FsbGVyTG9ja2VkKHdobywKKyAgICAgICAgICAgICAgICAgICAgRGV2aWNlQWRtaW5JbmZvLlVTRVNfUE9MSUNZX0xJTUlUX1BBU1NXT1JEKTsKKyAgICAgICAgICAgIGlmIChhcC5taW5pbXVtUGFzc3dvcmRMZXR0ZXJzICE9IGxlbmd0aCkgeworICAgICAgICAgICAgICAgIGFwLm1pbmltdW1QYXNzd29yZExldHRlcnMgPSBsZW5ndGg7CisgICAgICAgICAgICAgICAgc2F2ZVNldHRpbmdzTG9ja2VkKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgaW50IGdldFBhc3N3b3JkTWluaW11bUxldHRlcnMoQ29tcG9uZW50TmFtZSB3aG8pIHsKKyAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CisgICAgICAgICAgICBpbnQgbGVuZ3RoID0gMDsKKworICAgICAgICAgICAgaWYgKHdobyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgQWN0aXZlQWRtaW4gYWRtaW4gPSBnZXRBY3RpdmVBZG1pblVuY2hlY2tlZExvY2tlZCh3aG8pOworICAgICAgICAgICAgICAgIHJldHVybiBhZG1pbiAhPSBudWxsID8gYWRtaW4ubWluaW11bVBhc3N3b3JkTGV0dGVycyA6IGxlbmd0aDsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgZmluYWwgaW50IE4gPSBtQWRtaW5MaXN0LnNpemUoKTsKKyAgICAgICAgICAgIGZvciAoaW50IGk9MDsgaTxOOyBpKyspIHsKKyAgICAgICAgICAgICAgICBBY3RpdmVBZG1pbiBhZG1pbiA9IG1BZG1pbkxpc3QuZ2V0KGkpOworICAgICAgICAgICAgICAgIGlmIChsZW5ndGggPCBhZG1pbi5taW5pbXVtUGFzc3dvcmRMZXR0ZXJzKSB7CisgICAgICAgICAgICAgICAgICAgIGxlbmd0aCA9IGFkbWluLm1pbmltdW1QYXNzd29yZExldHRlcnM7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIGxlbmd0aDsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHNldFBhc3N3b3JkTWluaW11bU51bWVyaWMoQ29tcG9uZW50TmFtZSB3aG8sIGludCBsZW5ndGgpIHsKKyAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CisgICAgICAgICAgICBpZiAod2hvID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgTnVsbFBvaW50ZXJFeGNlcHRpb24oIkNvbXBvbmVudE5hbWUgaXMgbnVsbCIpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgQWN0aXZlQWRtaW4gYXAgPSBnZXRBY3RpdmVBZG1pbkZvckNhbGxlckxvY2tlZCh3aG8sCisgICAgICAgICAgICAgICAgICAgIERldmljZUFkbWluSW5mby5VU0VTX1BPTElDWV9MSU1JVF9QQVNTV09SRCk7CisgICAgICAgICAgICBpZiAoYXAubWluaW11bVBhc3N3b3JkTnVtZXJpYyAhPSBsZW5ndGgpIHsKKyAgICAgICAgICAgICAgICBhcC5taW5pbXVtUGFzc3dvcmROdW1lcmljID0gbGVuZ3RoOworICAgICAgICAgICAgICAgIHNhdmVTZXR0aW5nc0xvY2tlZCgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIGludCBnZXRQYXNzd29yZE1pbmltdW1OdW1lcmljKENvbXBvbmVudE5hbWUgd2hvKSB7CisgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgeworICAgICAgICAgICAgaW50IGxlbmd0aCA9IDA7CisKKyAgICAgICAgICAgIGlmICh3aG8gIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIEFjdGl2ZUFkbWluIGFkbWluID0gZ2V0QWN0aXZlQWRtaW5VbmNoZWNrZWRMb2NrZWQod2hvKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gYWRtaW4gIT0gbnVsbCA/IGFkbWluLm1pbmltdW1QYXNzd29yZE51bWVyaWMgOiBsZW5ndGg7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGZpbmFsIGludCBOID0gbUFkbWluTGlzdC5zaXplKCk7CisgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IE47IGkrKykgeworICAgICAgICAgICAgICAgIEFjdGl2ZUFkbWluIGFkbWluID0gbUFkbWluTGlzdC5nZXQoaSk7CisgICAgICAgICAgICAgICAgaWYgKGxlbmd0aCA8IGFkbWluLm1pbmltdW1QYXNzd29yZE51bWVyaWMpIHsKKyAgICAgICAgICAgICAgICAgICAgbGVuZ3RoID0gYWRtaW4ubWluaW11bVBhc3N3b3JkTnVtZXJpYzsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gbGVuZ3RoOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc2V0UGFzc3dvcmRNaW5pbXVtU3ltYm9scyhDb21wb25lbnROYW1lIHdobywgaW50IGxlbmd0aCkgeworICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKKyAgICAgICAgICAgIGlmICh3aG8gPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBOdWxsUG9pbnRlckV4Y2VwdGlvbigiQ29tcG9uZW50TmFtZSBpcyBudWxsIik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBBY3RpdmVBZG1pbiBhcCA9IGdldEFjdGl2ZUFkbWluRm9yQ2FsbGVyTG9ja2VkKHdobywKKyAgICAgICAgICAgICAgICAgICAgRGV2aWNlQWRtaW5JbmZvLlVTRVNfUE9MSUNZX0xJTUlUX1BBU1NXT1JEKTsKKyAgICAgICAgICAgIGlmIChhcC5taW5pbXVtUGFzc3dvcmRTeW1ib2xzICE9IGxlbmd0aCkgeworICAgICAgICAgICAgICAgIGFwLm1pbmltdW1QYXNzd29yZFN5bWJvbHMgPSBsZW5ndGg7CisgICAgICAgICAgICAgICAgc2F2ZVNldHRpbmdzTG9ja2VkKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgaW50IGdldFBhc3N3b3JkTWluaW11bVN5bWJvbHMoQ29tcG9uZW50TmFtZSB3aG8pIHsKKyAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CisgICAgICAgICAgICBpbnQgbGVuZ3RoID0gMDsKKworICAgICAgICAgICAgaWYgKHdobyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgQWN0aXZlQWRtaW4gYWRtaW4gPSBnZXRBY3RpdmVBZG1pblVuY2hlY2tlZExvY2tlZCh3aG8pOworICAgICAgICAgICAgICAgIHJldHVybiBhZG1pbiAhPSBudWxsID8gYWRtaW4ubWluaW11bVBhc3N3b3JkU3ltYm9scyA6IGxlbmd0aDsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgZmluYWwgaW50IE4gPSBtQWRtaW5MaXN0LnNpemUoKTsKKyAgICAgICAgICAgIGZvciAgKGludCBpPTA7IGk8TjsgaSsrKSB7CisgICAgICAgICAgICAgICAgQWN0aXZlQWRtaW4gYWRtaW4gPSBtQWRtaW5MaXN0LmdldChpKTsKKyAgICAgICAgICAgICAgICBpZiAobGVuZ3RoIDwgYWRtaW4ubWluaW11bVBhc3N3b3JkU3ltYm9scykgeworICAgICAgICAgICAgICAgICAgICBsZW5ndGggPSBhZG1pbi5taW5pbXVtUGFzc3dvcmRTeW1ib2xzOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiBsZW5ndGg7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBzZXRQYXNzd29yZE1pbmltdW1Ob25MZXR0ZXIoQ29tcG9uZW50TmFtZSB3aG8sIGludCBsZW5ndGgpIHsKKyAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CisgICAgICAgICAgICBpZiAod2hvID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgTnVsbFBvaW50ZXJFeGNlcHRpb24oIkNvbXBvbmVudE5hbWUgaXMgbnVsbCIpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgQWN0aXZlQWRtaW4gYXAgPSBnZXRBY3RpdmVBZG1pbkZvckNhbGxlckxvY2tlZCh3aG8sCisgICAgICAgICAgICAgICAgICAgIERldmljZUFkbWluSW5mby5VU0VTX1BPTElDWV9MSU1JVF9QQVNTV09SRCk7CisgICAgICAgICAgICBpZiAoYXAubWluaW11bVBhc3N3b3JkTm9uTGV0dGVyICE9IGxlbmd0aCkgeworICAgICAgICAgICAgICAgIGFwLm1pbmltdW1QYXNzd29yZE5vbkxldHRlciA9IGxlbmd0aDsKKyAgICAgICAgICAgICAgICBzYXZlU2V0dGluZ3NMb2NrZWQoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyBpbnQgZ2V0UGFzc3dvcmRNaW5pbXVtTm9uTGV0dGVyKENvbXBvbmVudE5hbWUgd2hvKSB7CisgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgeworICAgICAgICAgICAgaW50IGxlbmd0aCA9IDA7CisKKyAgICAgICAgICAgIGlmICh3aG8gIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIEFjdGl2ZUFkbWluIGFkbWluID0gZ2V0QWN0aXZlQWRtaW5VbmNoZWNrZWRMb2NrZWQod2hvKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gYWRtaW4gIT0gbnVsbCA/IGFkbWluLm1pbmltdW1QYXNzd29yZE5vbkxldHRlciA6IGxlbmd0aDsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgZmluYWwgaW50IE4gPSBtQWRtaW5MaXN0LnNpemUoKTsKKyAgICAgICAgICAgIGZvciAoaW50IGk9MDsgaTxOOyBpKyspIHsKKyAgICAgICAgICAgICAgICBBY3RpdmVBZG1pbiBhZG1pbiA9IG1BZG1pbkxpc3QuZ2V0KGkpOworICAgICAgICAgICAgICAgIGlmIChsZW5ndGggPCBhZG1pbi5taW5pbXVtUGFzc3dvcmROb25MZXR0ZXIpIHsKKyAgICAgICAgICAgICAgICAgICAgbGVuZ3RoID0gYWRtaW4ubWluaW11bVBhc3N3b3JkTm9uTGV0dGVyOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHJldHVybiBsZW5ndGg7CisgICAgICAgIH0KKyAgICB9CisKICAgICBwdWJsaWMgYm9vbGVhbiBpc0FjdGl2ZVBhc3N3b3JkU3VmZmljaWVudCgpIHsKICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CiAgICAgICAgICAgICAvLyBUaGlzIEFQSSBjYW4gb25seSBiZSBjYWxsZWQgYnkgYW4gYWN0aXZlIGRldmljZSBhZG1pbiwKICAgICAgICAgICAgIC8vIHNvIHRyeSB0byByZXRyaWV2ZSBpdCB0byBjaGVjayB0aGF0IHRoZSBjYWxsZXIgaXMgb25lLgogICAgICAgICAgICAgZ2V0QWN0aXZlQWRtaW5Gb3JDYWxsZXJMb2NrZWQobnVsbCwKICAgICAgICAgICAgICAgICAgICAgRGV2aWNlQWRtaW5JbmZvLlVTRVNfUE9MSUNZX0xJTUlUX1BBU1NXT1JEKTsKLSAgICAgICAgICAgIHJldHVybiBtQWN0aXZlUGFzc3dvcmRRdWFsaXR5ID49IGdldFBhc3N3b3JkUXVhbGl0eShudWxsKQotICAgICAgICAgICAgICAgICAgICAmJiBtQWN0aXZlUGFzc3dvcmRMZW5ndGggPj0gZ2V0UGFzc3dvcmRNaW5pbXVtTGVuZ3RoKG51bGwpOworICAgICAgICAgICAgaWYgKG1BY3RpdmVQYXNzd29yZFF1YWxpdHkgPCBnZXRQYXNzd29yZFF1YWxpdHkobnVsbCkKKyAgICAgICAgICAgICAgICAgICAgfHwgbUFjdGl2ZVBhc3N3b3JkTGVuZ3RoIDwgZ2V0UGFzc3dvcmRNaW5pbXVtTGVuZ3RoKG51bGwpKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYobUFjdGl2ZVBhc3N3b3JkUXVhbGl0eSAhPSBEZXZpY2VQb2xpY3lNYW5hZ2VyLlBBU1NXT1JEX1FVQUxJVFlfQ09NUExFWCkgeworICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIG1BY3RpdmVQYXNzd29yZFVwcGVyQ2FzZSA+PSBnZXRQYXNzd29yZE1pbmltdW1VcHBlckNhc2UobnVsbCkKKyAgICAgICAgICAgICAgICAgICAgJiYgbUFjdGl2ZVBhc3N3b3JkTG93ZXJDYXNlID49IGdldFBhc3N3b3JkTWluaW11bUxvd2VyQ2FzZShudWxsKQorICAgICAgICAgICAgICAgICAgICAmJiBtQWN0aXZlUGFzc3dvcmRMZXR0ZXJzID49IGdldFBhc3N3b3JkTWluaW11bUxldHRlcnMobnVsbCkKKyAgICAgICAgICAgICAgICAgICAgJiYgbUFjdGl2ZVBhc3N3b3JkTnVtZXJpYyA+PSBnZXRQYXNzd29yZE1pbmltdW1OdW1lcmljKG51bGwpCisgICAgICAgICAgICAgICAgICAgICYmIG1BY3RpdmVQYXNzd29yZFN5bWJvbHMgPj0gZ2V0UGFzc3dvcmRNaW5pbXVtU3ltYm9scyhudWxsKQorICAgICAgICAgICAgICAgICAgICAmJiBtQWN0aXZlUGFzc3dvcmROb25MZXR0ZXIgPj0gZ2V0UGFzc3dvcmRNaW5pbXVtTm9uTGV0dGVyKG51bGwpOwogICAgICAgICB9CiAgICAgfQotICAgIAorCiAgICAgcHVibGljIGludCBnZXRDdXJyZW50RmFpbGVkUGFzc3dvcmRBdHRlbXB0cygpIHsKICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CiAgICAgICAgICAgICAvLyBUaGlzIEFQSSBjYW4gb25seSBiZSBjYWxsZWQgYnkgYW4gYWN0aXZlIGRldmljZSBhZG1pbiwKQEAgLTY5NCw3ICsxMTA0LDcgQEAKICAgICAgICAgICAgIHJldHVybiBtRmFpbGVkUGFzc3dvcmRBdHRlbXB0czsKICAgICAgICAgfQogICAgIH0KLSAgICAKKwogICAgIHB1YmxpYyB2b2lkIHNldE1heGltdW1GYWlsZWRQYXNzd29yZHNGb3JXaXBlKENvbXBvbmVudE5hbWUgd2hvLCBpbnQgbnVtKSB7CiAgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgewogICAgICAgICAgICAgLy8gVGhpcyBBUEkgY2FuIG9ubHkgYmUgY2FsbGVkIGJ5IGFuIGFjdGl2ZSBkZXZpY2UgYWRtaW4sCkBAIC03MDksMTYgKzExMTksMTYgQEAKICAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgIH0KLSAgICAKKwogICAgIHB1YmxpYyBpbnQgZ2V0TWF4aW11bUZhaWxlZFBhc3N3b3Jkc0ZvcldpcGUoQ29tcG9uZW50TmFtZSB3aG8pIHsKICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CiAgICAgICAgICAgICBpbnQgY291bnQgPSAwOwotICAgICAgICAgICAgCisKICAgICAgICAgICAgIGlmICh3aG8gIT0gbnVsbCkgewogICAgICAgICAgICAgICAgIEFjdGl2ZUFkbWluIGFkbWluID0gZ2V0QWN0aXZlQWRtaW5VbmNoZWNrZWRMb2NrZWQod2hvKTsKICAgICAgICAgICAgICAgICByZXR1cm4gYWRtaW4gIT0gbnVsbCA/IGFkbWluLm1heGltdW1GYWlsZWRQYXNzd29yZHNGb3JXaXBlIDogY291bnQ7CiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAKKwogICAgICAgICAgICAgZmluYWwgaW50IE4gPSBtQWRtaW5MaXN0LnNpemUoKTsKICAgICAgICAgICAgIGZvciAgKGludCBpPTA7IGk8TjsgaSsrKSB7CiAgICAgICAgICAgICAgICAgQWN0aXZlQWRtaW4gYWRtaW4gPSBtQWRtaW5MaXN0LmdldChpKTsKQEAgLTczMiw3ICsxMTQyLDcgQEAKICAgICAgICAgICAgIHJldHVybiBjb3VudDsKICAgICAgICAgfQogICAgIH0KLSAgICAKKwogICAgIHB1YmxpYyBib29sZWFuIHJlc2V0UGFzc3dvcmQoU3RyaW5nIHBhc3N3b3JkLCBpbnQgZmxhZ3MpIHsKICAgICAgICAgaW50IHF1YWxpdHk7CiAgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgewpAQCAtNzQzLDE0ICsxMTUzLDE1IEBACiAgICAgICAgICAgICBxdWFsaXR5ID0gZ2V0UGFzc3dvcmRRdWFsaXR5KG51bGwpOwogICAgICAgICAgICAgaWYgKHF1YWxpdHkgIT0gRGV2aWNlUG9saWN5TWFuYWdlci5QQVNTV09SRF9RVUFMSVRZX1VOU1BFQ0lGSUVEKSB7CiAgICAgICAgICAgICAgICAgaW50IHJlYWxRdWFsaXR5ID0gTG9ja1BhdHRlcm5VdGlscy5jb21wdXRlUGFzc3dvcmRRdWFsaXR5KHBhc3N3b3JkKTsKLSAgICAgICAgICAgICAgICBpZiAocmVhbFF1YWxpdHkgPCBxdWFsaXR5KSB7CisgICAgICAgICAgICAgICAgaWYgKHJlYWxRdWFsaXR5IDwgcXVhbGl0eQorICAgICAgICAgICAgICAgICAgICAgICAgJiYgcXVhbGl0eSAhPSBEZXZpY2VQb2xpY3lNYW5hZ2VyLlBBU1NXT1JEX1FVQUxJVFlfQ09NUExFWCkgewogICAgICAgICAgICAgICAgICAgICBTbG9nLncoVEFHLCAicmVzZXRQYXNzd29yZDogcGFzc3dvcmQgcXVhbGl0eSAweCIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIEludGVnZXIudG9IZXhTdHJpbmcocXVhbGl0eSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICArICIgZG9lcyBub3QgbWVldCByZXF1aXJlZCBxdWFsaXR5IDB4IgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgSW50ZWdlci50b0hleFN0cmluZyhxdWFsaXR5KSk7CiAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgcXVhbGl0eSA9IHJlYWxRdWFsaXR5OworICAgICAgICAgICAgICAgIHF1YWxpdHkgPSBNYXRoLm1heChyZWFsUXVhbGl0eSwgcXVhbGl0eSk7CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBpbnQgbGVuZ3RoID0gZ2V0UGFzc3dvcmRNaW5pbXVtTGVuZ3RoKG51bGwpOwogICAgICAgICAgICAgaWYgKHBhc3N3b3JkLmxlbmd0aCgpIDwgbGVuZ3RoKSB7CkBAIC03NTgsMTQgKzExNjksODYgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICsgIiBkb2VzIG5vdCBtZWV0IHJlcXVpcmVkIGxlbmd0aCAiICsgbGVuZ3RoKTsKICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAocXVhbGl0eSA9PSBEZXZpY2VQb2xpY3lNYW5hZ2VyLlBBU1NXT1JEX1FVQUxJVFlfQ09NUExFWCkgeworICAgICAgICAgICAgICAgIGludCBsZXR0ZXJzID0gMDsKKyAgICAgICAgICAgICAgICBpbnQgdXBwZXJjYXNlID0gMDsKKyAgICAgICAgICAgICAgICBpbnQgbG93ZXJjYXNlID0gMDsKKyAgICAgICAgICAgICAgICBpbnQgbnVtYmVycyA9IDA7CisgICAgICAgICAgICAgICAgaW50IHN5bWJvbHMgPSAwOworICAgICAgICAgICAgICAgIGludCBub25sZXR0ZXIgPSAwOworICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgcGFzc3dvcmQubGVuZ3RoKCk7IGkrKykgeworICAgICAgICAgICAgICAgICAgICBjaGFyIGMgPSBwYXNzd29yZC5jaGFyQXQoaSk7CisgICAgICAgICAgICAgICAgICAgIGlmIChjID49ICdBJyAmJiBjIDw9ICdaJykgeworICAgICAgICAgICAgICAgICAgICAgICAgbGV0dGVycysrOworICAgICAgICAgICAgICAgICAgICAgICAgdXBwZXJjYXNlKys7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoYyA+PSAnYScgJiYgYyA8PSAneicpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGxldHRlcnMrKzsKKyAgICAgICAgICAgICAgICAgICAgICAgIGxvd2VyY2FzZSsrOworICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGMgPj0gJzAnICYmIGMgPD0gJzknKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBudW1iZXJzKys7CisgICAgICAgICAgICAgICAgICAgICAgICBub25sZXR0ZXIrKzsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHN5bWJvbHMrKzsKKyAgICAgICAgICAgICAgICAgICAgICAgIG5vbmxldHRlcisrOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGludCBuZWVkZWRMZXR0ZXJzID0gZ2V0UGFzc3dvcmRNaW5pbXVtTGV0dGVycyhudWxsKTsKKyAgICAgICAgICAgICAgICBpZihsZXR0ZXJzIDwgbmVlZGVkTGV0dGVycykgeworICAgICAgICAgICAgICAgICAgICBTbG9nLncoVEFHLCAicmVzZXRQYXNzd29yZDogbnVtYmVyIG9mIGxldHRlcnMgIiArIGxldHRlcnMKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICArICIgZG9lcyBub3QgbWVldCByZXF1aXJlZCBudW1iZXIgb2YgbGV0dGVycyAiICsgbmVlZGVkTGV0dGVycyk7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaW50IG5lZWRlZE51bWJlcnMgPSBnZXRQYXNzd29yZE1pbmltdW1OdW1lcmljKG51bGwpOworICAgICAgICAgICAgICAgIGlmIChudW1iZXJzIDwgbmVlZGVkTnVtYmVycykgeworICAgICAgICAgICAgICAgICAgICBTbG9nCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLncoVEFHLCAicmVzZXRQYXNzd29yZDogbnVtYmVyIG9mIG51bWVyaWNhbCBkaWdpdHMgIiArIG51bWJlcnMKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgIiBkb2VzIG5vdCBtZWV0IHJlcXVpcmVkIG51bWJlciBvZiBudW1lcmljYWwgZGlnaXRzICIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgbmVlZGVkTnVtYmVycyk7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaW50IG5lZWRlZExvd2VyQ2FzZSA9IGdldFBhc3N3b3JkTWluaW11bUxvd2VyQ2FzZShudWxsKTsKKyAgICAgICAgICAgICAgICBpZiAobG93ZXJjYXNlIDwgbmVlZGVkTG93ZXJDYXNlKSB7CisgICAgICAgICAgICAgICAgICAgIFNsb2cudyhUQUcsICJyZXNldFBhc3N3b3JkOiBudW1iZXIgb2YgbG93ZXJjYXNlIGxldHRlcnMgIiArIGxvd2VyY2FzZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgIiBkb2VzIG5vdCBtZWV0IHJlcXVpcmVkIG51bWJlciBvZiBsb3dlcmNhc2UgbGV0dGVycyAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyBuZWVkZWRMb3dlckNhc2UpOworICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIGludCBuZWVkZWRVcHBlckNhc2UgPSBnZXRQYXNzd29yZE1pbmltdW1VcHBlckNhc2UobnVsbCk7CisgICAgICAgICAgICAgICAgaWYgKHVwcGVyY2FzZSA8IG5lZWRlZFVwcGVyQ2FzZSkgeworICAgICAgICAgICAgICAgICAgICBTbG9nLncoVEFHLCAicmVzZXRQYXNzd29yZDogbnVtYmVyIG9mIHVwcGVyY2FzZSBsZXR0ZXJzICIgKyB1cHBlcmNhc2UKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICArICIgZG9lcyBub3QgbWVldCByZXF1aXJlZCBudW1iZXIgb2YgdXBwZXJjYXNlIGxldHRlcnMgIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgbmVlZGVkVXBwZXJDYXNlKTsKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBpbnQgbmVlZGVkU3ltYm9scyA9IGdldFBhc3N3b3JkTWluaW11bVN5bWJvbHMobnVsbCk7CisgICAgICAgICAgICAgICAgaWYgKHN5bWJvbHMgPCBuZWVkZWRTeW1ib2xzKSB7CisgICAgICAgICAgICAgICAgICAgIFNsb2cudyhUQUcsICJyZXNldFBhc3N3b3JkOiBudW1iZXIgb2Ygc3BlY2lhbCBzeW1ib2xzICIgKyBzeW1ib2xzCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiIGRvZXMgbm90IG1lZXQgcmVxdWlyZWQgbnVtYmVyIG9mIHNwZWNpYWwgc3ltYm9scyAiICsgbmVlZGVkU3ltYm9scyk7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaW50IG5lZWRlZE5vbkxldHRlciA9IGdldFBhc3N3b3JkTWluaW11bU5vbkxldHRlcihudWxsKTsKKyAgICAgICAgICAgICAgICBpZiAobm9ubGV0dGVyIDwgbmVlZGVkTm9uTGV0dGVyKSB7CisgICAgICAgICAgICAgICAgICAgIFNsb2cudyhUQUcsICJyZXNldFBhc3N3b3JkOiBudW1iZXIgb2Ygbm9uLWxldHRlciBjaGFyYWN0ZXJzICIgKyBub25sZXR0ZXIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICArICIgZG9lcyBub3QgbWVldCByZXF1aXJlZCBudW1iZXIgb2Ygbm9uLWxldHRlciBjaGFyYWN0ZXJzICIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICArIG5lZWRlZE5vbkxldHRlcik7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIExvY2tQYXR0ZXJuVXRpbHMgdXRpbHMgPSBuZXcgTG9ja1BhdHRlcm5VdGlscyhtQ29udGV4dCk7CisgICAgICAgICAgICBpZih1dGlscy5jaGVja1Bhc3N3b3JkSGlzdG9yeShwYXNzd29yZCkpIHsKKyAgICAgICAgICAgICAgICBTbG9nLncoVEFHLCAicmVzZXRQYXNzd29yZDogcGFzc3dvcmQgaXMgdGhlIHNhbWUgYXMgb25lIG9mIHRoZSBsYXN0ICIKKyAgICAgICAgICAgICAgICAgICAgICAgICsgZ2V0UGFzc3dvcmRIaXN0b3J5TGVuZ3RoKG51bGwpICsgIiBwYXNzd29yZHMiKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICB9CiAgICAgICAgIH0KLSAgICAgICAgCisKICAgICAgICAgaW50IGNhbGxpbmdVaWQgPSBCaW5kZXIuZ2V0Q2FsbGluZ1VpZCgpOwogICAgICAgICBpZiAobVBhc3N3b3JkT3duZXIgPj0gMCAmJiBtUGFzc3dvcmRPd25lciAhPSBjYWxsaW5nVWlkKSB7CiAgICAgICAgICAgICBTbG9nLncoVEFHLCAicmVzZXRQYXNzd29yZDogYWxyZWFkeSBzZXQgYnkgYW5vdGhlciB1aWQgYW5kIG5vdCBlbnRlcmVkIGJ5IHVzZXIiKTsKICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICAgfQotICAgICAgICAKKwogICAgICAgICAvLyBEb24ndCBkbyB0aGlzIHdpdGggdGhlIGxvY2sgaGVsZCwgYmVjYXVzZSBpdCBpcyBnb2luZyB0byBjYWxsCiAgICAgICAgIC8vIGJhY2sgaW4gdG8gdGhlIHNlcnZpY2UuCiAgICAgICAgIGxvbmcgaWRlbnQgPSBCaW5kZXIuY2xlYXJDYWxsaW5nSWRlbnRpdHkoKTsKQEAgLTc4MywxMCArMTI2NiwxMCBAQAogICAgICAgICB9IGZpbmFsbHkgewogICAgICAgICAgICAgQmluZGVyLnJlc3RvcmVDYWxsaW5nSWRlbnRpdHkoaWRlbnQpOwogICAgICAgICB9Ci0gICAgICAgIAorCiAgICAgICAgIHJldHVybiB0cnVlOwogICAgIH0KLSAgICAKKwogICAgIHB1YmxpYyB2b2lkIHNldE1heGltdW1UaW1lVG9Mb2NrKENvbXBvbmVudE5hbWUgd2hvLCBsb25nIHRpbWVNcykgewogICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKICAgICAgICAgICAgIGlmICh3aG8gPT0gbnVsbCkgewpAQCAtNzk2LDE2ICsxMjc5LDE2IEBACiAgICAgICAgICAgICAgICAgICAgIERldmljZUFkbWluSW5mby5VU0VTX1BPTElDWV9GT1JDRV9MT0NLKTsKICAgICAgICAgICAgIGlmIChhcC5tYXhpbXVtVGltZVRvVW5sb2NrICE9IHRpbWVNcykgewogICAgICAgICAgICAgICAgIGFwLm1heGltdW1UaW1lVG9VbmxvY2sgPSB0aW1lTXM7Ci0gICAgICAgICAgICAgICAgCisKICAgICAgICAgICAgICAgICBsb25nIGlkZW50ID0gQmluZGVyLmNsZWFyQ2FsbGluZ0lkZW50aXR5KCk7CiAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgc2F2ZVNldHRpbmdzTG9ja2VkKCk7Ci0gICAgICAgICAgICAgICAgICAgIAorCiAgICAgICAgICAgICAgICAgICAgIHRpbWVNcyA9IGdldE1heGltdW1UaW1lVG9Mb2NrKG51bGwpOwogICAgICAgICAgICAgICAgICAgICBpZiAodGltZU1zIDw9IDApIHsKICAgICAgICAgICAgICAgICAgICAgICAgIHRpbWVNcyA9IEludGVnZXIuTUFYX1ZBTFVFOwogICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIAorCiAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBnZXRJUG93ZXJNYW5hZ2VyKCkuc2V0TWF4aW11bVNjcmVlbk9mZlRpbWVvdW50KChpbnQpdGltZU1zKTsKICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKQEAgLTgxNywxNiArMTMwMCwxNiBAQAogICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgfQotICAgIAorCiAgICAgcHVibGljIGxvbmcgZ2V0TWF4aW11bVRpbWVUb0xvY2soQ29tcG9uZW50TmFtZSB3aG8pIHsKICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CiAgICAgICAgICAgICBsb25nIHRpbWUgPSAwOwotICAgICAgICAgICAgCisKICAgICAgICAgICAgIGlmICh3aG8gIT0gbnVsbCkgewogICAgICAgICAgICAgICAgIEFjdGl2ZUFkbWluIGFkbWluID0gZ2V0QWN0aXZlQWRtaW5VbmNoZWNrZWRMb2NrZWQod2hvKTsKICAgICAgICAgICAgICAgICByZXR1cm4gYWRtaW4gIT0gbnVsbCA/IGFkbWluLm1heGltdW1UaW1lVG9VbmxvY2sgOiB0aW1lOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgCisKICAgICAgICAgICAgIGZpbmFsIGludCBOID0gbUFkbWluTGlzdC5zaXplKCk7CiAgICAgICAgICAgICBmb3IgIChpbnQgaT0wOyBpPE47IGkrKykgewogICAgICAgICAgICAgICAgIEFjdGl2ZUFkbWluIGFkbWluID0gbUFkbWluTGlzdC5nZXQoaSk7CkBAIC04NDAsNyArMTMyMyw3IEBACiAgICAgICAgICAgICByZXR1cm4gdGltZTsKICAgICAgICAgfQogICAgIH0KLSAgICAKKwogICAgIHB1YmxpYyB2b2lkIGxvY2tOb3coKSB7CiAgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgewogICAgICAgICAgICAgLy8gVGhpcyBBUEkgY2FuIG9ubHkgYmUgY2FsbGVkIGJ5IGFuIGFjdGl2ZSBkZXZpY2UgYWRtaW4sCkBAIC04NTcsNyArMTM0MCw3IEBACiAgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICB9Ci0gICAgCisKICAgICB2b2lkIHdpcGVEYXRhTG9ja2VkKGludCBmbGFncykgewogICAgICAgICB0cnkgewogICAgICAgICAgICAgUmVjb3ZlcnlTeXN0ZW0ucmVib290V2lwZVVzZXJEYXRhKG1Db250ZXh0KTsKQEAgLTg2NSw3ICsxMzQ4LDcgQEAKICAgICAgICAgICAgIFNsb2cudyhUQUcsICJGYWlsZWQgcmVxdWVzdGluZyBkYXRhIHdpcGUiLCBlKTsKICAgICAgICAgfQogICAgIH0KLSAgICAKKwogICAgIHB1YmxpYyB2b2lkIHdpcGVEYXRhKGludCBmbGFncykgewogICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKICAgICAgICAgICAgIC8vIFRoaXMgQVBJIGNhbiBvbmx5IGJlIGNhbGxlZCBieSBhbiBhY3RpdmUgZGV2aWNlIGFkbWluLApAQCAtODgwLDExICsxMzYzLDExIEBACiAgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICB9Ci0gICAgCisKICAgICBwdWJsaWMgdm9pZCBnZXRSZW1vdmVXYXJuaW5nKENvbXBvbmVudE5hbWUgY29tcCwgZmluYWwgUmVtb3RlQ2FsbGJhY2sgcmVzdWx0KSB7CiAgICAgICAgIG1Db250ZXh0LmVuZm9yY2VDYWxsaW5nT3JTZWxmUGVybWlzc2lvbigKICAgICAgICAgICAgICAgICBhbmRyb2lkLk1hbmlmZXN0LnBlcm1pc3Npb24uQklORF9ERVZJQ0VfQURNSU4sIG51bGwpOwotICAgICAgICAKKwogICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKICAgICAgICAgICAgIEFjdGl2ZUFkbWluIGFkbWluID0gZ2V0QWN0aXZlQWRtaW5VbmNoZWNrZWRMb2NrZWQoY29tcCk7CiAgICAgICAgICAgICBpZiAoYWRtaW4gPT0gbnVsbCkgewpAQCAtOTA3LDIwICsxMzkwLDMwIEBACiAgICAgICAgICAgICB9LCBudWxsLCBBY3Rpdml0eS5SRVNVTFRfT0ssIG51bGwsIG51bGwpOwogICAgICAgICB9CiAgICAgfQotICAgIAotICAgIHB1YmxpYyB2b2lkIHNldEFjdGl2ZVBhc3N3b3JkU3RhdGUoaW50IHF1YWxpdHksIGludCBsZW5ndGgpIHsKKworICAgIHB1YmxpYyB2b2lkIHNldEFjdGl2ZVBhc3N3b3JkU3RhdGUoaW50IHF1YWxpdHksIGludCBsZW5ndGgsIGludCBsZXR0ZXJzLCBpbnQgdXBwZXJjYXNlLAorICAgICAgICAgICAgaW50IGxvd2VyY2FzZSwgaW50IG51bWJlcnMsIGludCBzeW1ib2xzLCBpbnQgbm9ubGV0dGVyKSB7CiAgICAgICAgIG1Db250ZXh0LmVuZm9yY2VDYWxsaW5nT3JTZWxmUGVybWlzc2lvbigKICAgICAgICAgICAgICAgICBhbmRyb2lkLk1hbmlmZXN0LnBlcm1pc3Npb24uQklORF9ERVZJQ0VfQURNSU4sIG51bGwpOwotICAgICAgICAKKwogICAgICAgICB2YWxpZGF0ZVF1YWxpdHlDb25zdGFudChxdWFsaXR5KTsKLSAgICAgICAgCisKICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CiAgICAgICAgICAgICBpZiAobUFjdGl2ZVBhc3N3b3JkUXVhbGl0eSAhPSBxdWFsaXR5IHx8IG1BY3RpdmVQYXNzd29yZExlbmd0aCAhPSBsZW5ndGgKLSAgICAgICAgICAgICAgICAgICAgfHwgbUZhaWxlZFBhc3N3b3JkQXR0ZW1wdHMgIT0gMCkgeworICAgICAgICAgICAgICAgICAgICB8fCBtRmFpbGVkUGFzc3dvcmRBdHRlbXB0cyAhPSAwIHx8IG1BY3RpdmVQYXNzd29yZExldHRlcnMgIT0gbGV0dGVycworICAgICAgICAgICAgICAgICAgICB8fCBtQWN0aXZlUGFzc3dvcmRVcHBlckNhc2UgIT0gdXBwZXJjYXNlCisgICAgICAgICAgICAgICAgICAgIHx8IG1BY3RpdmVQYXNzd29yZExvd2VyQ2FzZSAhPSBsb3dlcmNhc2UgfHwgbUFjdGl2ZVBhc3N3b3JkTnVtZXJpYyAhPSBudW1iZXJzCisgICAgICAgICAgICAgICAgICAgIHx8IG1BY3RpdmVQYXNzd29yZFN5bWJvbHMgIT0gc3ltYm9scyB8fCBtQWN0aXZlUGFzc3dvcmROb25MZXR0ZXIgIT0gbm9ubGV0dGVyKSB7CiAgICAgICAgICAgICAgICAgbG9uZyBpZGVudCA9IEJpbmRlci5jbGVhckNhbGxpbmdJZGVudGl0eSgpOwogICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgIG1BY3RpdmVQYXNzd29yZFF1YWxpdHkgPSBxdWFsaXR5OwogICAgICAgICAgICAgICAgICAgICBtQWN0aXZlUGFzc3dvcmRMZW5ndGggPSBsZW5ndGg7CisgICAgICAgICAgICAgICAgICAgIG1BY3RpdmVQYXNzd29yZExldHRlcnMgPSBsZXR0ZXJzOworICAgICAgICAgICAgICAgICAgICBtQWN0aXZlUGFzc3dvcmRMb3dlckNhc2UgPSBsb3dlcmNhc2U7CisgICAgICAgICAgICAgICAgICAgIG1BY3RpdmVQYXNzd29yZFVwcGVyQ2FzZSA9IHVwcGVyY2FzZTsKKyAgICAgICAgICAgICAgICAgICAgbUFjdGl2ZVBhc3N3b3JkTnVtZXJpYyA9IG51bWJlcnM7CisgICAgICAgICAgICAgICAgICAgIG1BY3RpdmVQYXNzd29yZFN5bWJvbHMgPSBzeW1ib2xzOworICAgICAgICAgICAgICAgICAgICBtQWN0aXZlUGFzc3dvcmROb25MZXR0ZXIgPSBub25sZXR0ZXI7CiAgICAgICAgICAgICAgICAgICAgIG1GYWlsZWRQYXNzd29yZEF0dGVtcHRzID0gMDsKICAgICAgICAgICAgICAgICAgICAgc2F2ZVNldHRpbmdzTG9ja2VkKCk7CiAgICAgICAgICAgICAgICAgICAgIHNlbmRBZG1pbkNvbW1hbmRMb2NrZWQoRGV2aWNlQWRtaW5SZWNlaXZlci5BQ1RJT05fUEFTU1dPUkRfQ0hBTkdFRCwKQEAgLTkzMSwxMSArMTQyNCwxMSBAQAogICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgfQotICAgIAorCiAgICAgcHVibGljIHZvaWQgcmVwb3J0RmFpbGVkUGFzc3dvcmRBdHRlbXB0KCkgewogICAgICAgICBtQ29udGV4dC5lbmZvcmNlQ2FsbGluZ09yU2VsZlBlcm1pc3Npb24oCiAgICAgICAgICAgICAgICAgYW5kcm9pZC5NYW5pZmVzdC5wZXJtaXNzaW9uLkJJTkRfREVWSUNFX0FETUlOLCBudWxsKTsKLSAgICAgICAgCisKICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CiAgICAgICAgICAgICBsb25nIGlkZW50ID0gQmluZGVyLmNsZWFyQ2FsbGluZ0lkZW50aXR5KCk7CiAgICAgICAgICAgICB0cnkgewpAQCAtOTUyLDExICsxNDQ1LDExIEBACiAgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICB9Ci0gICAgCisKICAgICBwdWJsaWMgdm9pZCByZXBvcnRTdWNjZXNzZnVsUGFzc3dvcmRBdHRlbXB0KCkgewogICAgICAgICBtQ29udGV4dC5lbmZvcmNlQ2FsbGluZ09yU2VsZlBlcm1pc3Npb24oCiAgICAgICAgICAgICAgICAgYW5kcm9pZC5NYW5pZmVzdC5wZXJtaXNzaW9uLkJJTkRfREVWSUNFX0FETUlOLCBudWxsKTsKLSAgICAgICAgCisKICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CiAgICAgICAgICAgICBpZiAobUZhaWxlZFBhc3N3b3JkQXR0ZW1wdHMgIT0gMCB8fCBtUGFzc3dvcmRPd25lciA+PSAwKSB7CiAgICAgICAgICAgICAgICAgbG9uZyBpZGVudCA9IEJpbmRlci5jbGVhckNhbGxpbmdJZGVudGl0eSgpOwpAQCAtOTcyLDcgKzE0NjUsOTUgQEAKICAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgIH0KLSAgICAKKworICAgIHB1YmxpYyBDb21wb25lbnROYW1lIHNldEdsb2JhbFByb3h5KENvbXBvbmVudE5hbWUgd2hvLCBTdHJpbmcgcHJveHlTcGVjLAorICAgICAgICAgICAgU3RyaW5nIGV4Y2x1c2lvbkxpc3QpIHsKKyAgICAgICAgc3luY2hyb25pemVkKHRoaXMpIHsKKyAgICAgICAgICAgIGlmICh3aG8gPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBOdWxsUG9pbnRlckV4Y2VwdGlvbigiQ29tcG9uZW50TmFtZSBpcyBudWxsIik7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIEFjdGl2ZUFkbWluIGFkbWluID0gZ2V0QWN0aXZlQWRtaW5Gb3JDYWxsZXJMb2NrZWQod2hvLAorICAgICAgICAgICAgICAgICAgICBEZXZpY2VBZG1pbkluZm8uVVNFU19QT0xJQ1lfU0VUU19HTE9CQUxfUFJPWFkpOworCisgICAgICAgICAgICAvLyBTY2FuIHRocm91Z2ggYWN0aXZlIGFkbWlucyBhbmQgZmluZCBpZiBhbnlvbmUgaGFzIGFscmVhZHkKKyAgICAgICAgICAgIC8vIHNldCB0aGUgZ2xvYmFsIHByb3h5LgorICAgICAgICAgICAgZmluYWwgaW50IE4gPSBtQWRtaW5MaXN0LnNpemUoKTsKKyAgICAgICAgICAgIFNldDxDb21wb25lbnROYW1lPiBjb21wU2V0ID0gbUFkbWluTWFwLmtleVNldCgpOworICAgICAgICAgICAgZm9yICAoQ29tcG9uZW50TmFtZSBjb21wb25lbnQgOiBjb21wU2V0KSB7CisgICAgICAgICAgICAgICAgQWN0aXZlQWRtaW4gYXAgPSBtQWRtaW5NYXAuZ2V0KGNvbXBvbmVudCk7CisgICAgICAgICAgICAgICAgaWYgKChhcC5zcGVjaWZpZXNHbG9iYWxQcm94eSkgJiYgKCFjb21wb25lbnQuZXF1YWxzKHdobykpKSB7CisgICAgICAgICAgICAgICAgICAgIC8vIEFub3RoZXIgYWRtaW4gYWxyZWFkeSBzZXRzIHRoZSBnbG9iYWwgcHJveHkKKyAgICAgICAgICAgICAgICAgICAgLy8gUmV0dXJuIGl0IHRvIHRoZSBjYWxsZXIuCisgICAgICAgICAgICAgICAgICAgIHJldHVybiBjb21wb25lbnQ7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKHByb3h5U3BlYyA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgYWRtaW4uc3BlY2lmaWVzR2xvYmFsUHJveHkgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICBhZG1pbi5nbG9iYWxQcm94eVNwZWMgPSBudWxsOworICAgICAgICAgICAgICAgIGFkbWluLmdsb2JhbFByb3h5RXhjbHVzaW9uTGlzdCA9IG51bGw7CisgICAgICAgICAgICB9IGVsc2UgeworCisgICAgICAgICAgICAgICAgYWRtaW4uc3BlY2lmaWVzR2xvYmFsUHJveHkgPSB0cnVlOworICAgICAgICAgICAgICAgIGFkbWluLmdsb2JhbFByb3h5U3BlYyA9IHByb3h5U3BlYzsKKyAgICAgICAgICAgICAgICBhZG1pbi5nbG9iYWxQcm94eUV4Y2x1c2lvbkxpc3QgPSBleGNsdXNpb25MaXN0OworICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvLyBSZXNldCB0aGUgZ2xvYmFsIHByb3h5IGFjY29yZGluZ2x5CisgICAgICAgICAgICAvLyBEbyB0aGlzIHVzaW5nIHN5c3RlbSBwZXJtaXNzaW9ucywgYXMgYXBwcyBjYW5ub3Qgd3JpdGUgdG8gc2VjdXJlIHNldHRpbmdzCisgICAgICAgICAgICBsb25nIG9yaWdJZCA9IEJpbmRlci5jbGVhckNhbGxpbmdJZGVudGl0eSgpOworICAgICAgICAgICAgcmVzZXRHbG9iYWxQcm94eSgpOworICAgICAgICAgICAgQmluZGVyLnJlc3RvcmVDYWxsaW5nSWRlbnRpdHkob3JpZ0lkKTsKKyAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIENvbXBvbmVudE5hbWUgZ2V0R2xvYmFsUHJveHlBZG1pbigpIHsKKyAgICAgICAgc3luY2hyb25pemVkKHRoaXMpIHsKKyAgICAgICAgICAgIC8vIFNjYW4gdGhyb3VnaCBhY3RpdmUgYWRtaW5zIGFuZCBmaW5kIGlmIGFueW9uZSBoYXMgYWxyZWFkeQorICAgICAgICAgICAgLy8gc2V0IHRoZSBnbG9iYWwgcHJveHkuCisgICAgICAgICAgICBmaW5hbCBpbnQgTiA9IG1BZG1pbkxpc3Quc2l6ZSgpOworICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBOOyBpKyspIHsKKyAgICAgICAgICAgICAgICBBY3RpdmVBZG1pbiBhcCA9IG1BZG1pbkxpc3QuZ2V0KGkpOworICAgICAgICAgICAgICAgIGlmIChhcC5zcGVjaWZpZXNHbG9iYWxQcm94eSkgeworICAgICAgICAgICAgICAgICAgICAvLyBEZXZpY2UgYWRtaW4gc2V0cyB0aGUgZ2xvYmFsIHByb3h5CisgICAgICAgICAgICAgICAgICAgIC8vIFJldHVybiBpdCB0byB0aGUgY2FsbGVyLgorICAgICAgICAgICAgICAgICAgICByZXR1cm4gYXAuaW5mby5nZXRDb21wb25lbnQoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgLy8gTm8gZGV2aWNlIGFkbWluIHNldHMgdGhlIGdsb2JhbCBwcm94eS4KKyAgICAgICAgcmV0dXJuIG51bGw7CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIHJlc2V0R2xvYmFsUHJveHkoKSB7CisgICAgICAgIGZpbmFsIGludCBOID0gbUFkbWluTGlzdC5zaXplKCk7CisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgTjsgaSsrKSB7CisgICAgICAgICAgICBBY3RpdmVBZG1pbiBhcCA9IG1BZG1pbkxpc3QuZ2V0KGkpOworICAgICAgICAgICAgaWYgKGFwLnNwZWNpZmllc0dsb2JhbFByb3h5KSB7CisgICAgICAgICAgICAgICAgc2F2ZUdsb2JhbFByb3h5KGFwLmdsb2JhbFByb3h5U3BlYywgYXAuZ2xvYmFsUHJveHlFeGNsdXNpb25MaXN0KTsKKyAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgLy8gTm8gZGV2aWNlIGFkbWlucyBkZWZpbmluZyBnbG9iYWwgcHJveGllcyAtIHJlc2V0IGdsb2JhbCBwcm94eSBzZXR0aW5ncyB0byBub25lCisgICAgICAgIHNhdmVHbG9iYWxQcm94eShudWxsLCBudWxsKTsKKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgc2F2ZUdsb2JhbFByb3h5KFN0cmluZyBwcm94eVNwZWMsIFN0cmluZyBleGNsdXNpb25MaXN0KSB7CisgICAgICAgIGlmIChleGNsdXNpb25MaXN0ID09IG51bGwpIHsKKyAgICAgICAgICAgIGV4Y2x1c2lvbkxpc3QgPSAiIjsKKyAgICAgICAgfQorICAgICAgICBpZiAocHJveHlTcGVjID09IG51bGwpIHsKKyAgICAgICAgICAgIHByb3h5U3BlYyA9ICIiOworICAgICAgICB9CisgICAgICAgIC8vIFJlbW92ZSB3aGl0ZSBzcGFjZXMKKyAgICAgICAgcHJveHlTcGVjID0gcHJveHlTcGVjLnRyaW0oKTsKKyAgICAgICAgZXhjbHVzaW9uTGlzdCA9IGV4Y2x1c2lvbkxpc3QudHJpbSgpOworICAgICAgICBDb250ZW50UmVzb2x2ZXIgcmVzID0gbUNvbnRleHQuZ2V0Q29udGVudFJlc29sdmVyKCk7CisgICAgICAgIFNldHRpbmdzLlNlY3VyZS5wdXRTdHJpbmcocmVzLCBTZXR0aW5ncy5TZWN1cmUuSFRUUF9QUk9YWSwgcHJveHlTcGVjKTsKKyAgICAgICAgU2V0dGluZ3MuU2VjdXJlLnB1dFN0cmluZyhyZXMsIFNldHRpbmdzLlNlY3VyZS5IVFRQX1BST1hZX0VYQ0xVU0lPTl9MSVNULCBleGNsdXNpb25MaXN0KTsKKyAgICB9CisKICAgICBAT3ZlcnJpZGUKICAgICBwcm90ZWN0ZWQgdm9pZCBkdW1wKEZpbGVEZXNjcmlwdG9yIGZkLCBQcmludFdyaXRlciBwdywgU3RyaW5nW10gYXJncykgewogICAgICAgICBpZiAobUNvbnRleHQuY2hlY2tDYWxsaW5nT3JTZWxmUGVybWlzc2lvbihhbmRyb2lkLk1hbmlmZXN0LnBlcm1pc3Npb24uRFVNUCkKQEAgLTk4MywxMiArMTU2NCwxMiBAQAogICAgICAgICAgICAgICAgICAgICArICIsIHVpZD0iICsgQmluZGVyLmdldENhbGxpbmdVaWQoKSk7CiAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgIH0KLSAgICAgICAgCisKICAgICAgICAgZmluYWwgUHJpbnRlciBwID0gbmV3IFByaW50V3JpdGVyUHJpbnRlcihwdyk7Ci0gICAgICAgIAorCiAgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgewogICAgICAgICAgICAgcC5wcmludGxuKCJDdXJyZW50IERldmljZSBQb2xpY3kgTWFuYWdlciBzdGF0ZToiKTsKLSAgICAgICAgICAgIAorCiAgICAgICAgICAgICBwLnByaW50bG4oIiAgRW5hYmxlZCBEZXZpY2UgQWRtaW5zOiIpOwogICAgICAgICAgICAgZmluYWwgaW50IE4gPSBtQWRtaW5MaXN0LnNpemUoKTsKICAgICAgICAgICAgIGZvciAoaW50IGk9MDsgaTxOOyBpKyspIHsKQEAgLTk5OSwxMSArMTU4MCwxNyBAQAogICAgICAgICAgICAgICAgICAgICBhcC5kdW1wKCIgICAgIiwgcHcpOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIAorCiAgICAgICAgICAgICBwdy5wcmludGxuKCIgIik7CiAgICAgICAgICAgICBwdy5wcmludCgiICBtQWN0aXZlUGFzc3dvcmRRdWFsaXR5PTB4Iik7CiAgICAgICAgICAgICAgICAgICAgIHB3LnByaW50bG4oSW50ZWdlci50b0hleFN0cmluZyhtQWN0aXZlUGFzc3dvcmRRdWFsaXR5KSk7CiAgICAgICAgICAgICBwdy5wcmludCgiICBtQWN0aXZlUGFzc3dvcmRMZW5ndGg9Iik7IHB3LnByaW50bG4obUFjdGl2ZVBhc3N3b3JkTGVuZ3RoKTsKKyAgICAgICAgICAgIHB3LnByaW50KCIgIG1BY3RpdmVQYXNzd29yZFVwcGVyQ2FzZT0iKTsgcHcucHJpbnRsbihtQWN0aXZlUGFzc3dvcmRVcHBlckNhc2UpOworICAgICAgICAgICAgcHcucHJpbnQoIiAgbUFjdGl2ZVBhc3N3b3JkTG93ZXJDYXNlPSIpOyBwdy5wcmludGxuKG1BY3RpdmVQYXNzd29yZExvd2VyQ2FzZSk7CisgICAgICAgICAgICBwdy5wcmludCgiICBtQWN0aXZlUGFzc3dvcmRMZXR0ZXJzPSIpOyBwdy5wcmludGxuKG1BY3RpdmVQYXNzd29yZExldHRlcnMpOworICAgICAgICAgICAgcHcucHJpbnQoIiAgbUFjdGl2ZVBhc3N3b3JkTnVtZXJpYz0iKTsgcHcucHJpbnRsbihtQWN0aXZlUGFzc3dvcmROdW1lcmljKTsKKyAgICAgICAgICAgIHB3LnByaW50KCIgIG1BY3RpdmVQYXNzd29yZFN5bWJvbHM9Iik7IHB3LnByaW50bG4obUFjdGl2ZVBhc3N3b3JkU3ltYm9scyk7CisgICAgICAgICAgICBw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oKTsKICAgICAgICAgU3RyaW5nIHNlcnZpY2VOYW1lID0gcmVzb3VyY2VzLmdldFN0cmluZygKICAgICAgICAgICAgICAgICBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnN0cmluZy5jb25maWdfbmV0d29ya0xvY2F0aW9uUHJvdmlkZXIpOwotICAgICAgICBpZiAoc2VydmljZU5hbWUgIT0gbnVsbCkgeworICAgICAgICBpZiAoc2VydmljZU5hbWUgIT0gbnVsbCAmJiBwbS5yZXNvbHZlU2VydmljZShuZXcgSW50ZW50KHNlcnZpY2VOYW1lKSwgMCkgIT0gbnVsbCkgewogICAgICAgICAgICAgbU5ldHdvcmtMb2NhdGlvblByb3ZpZGVyID0KICAgICAgICAgICAgICAgICBuZXcgTG9jYXRpb25Qcm92aWRlclByb3h5KG1Db250ZXh0LCBMb2NhdGlvbk1hbmFnZXIuTkVUV09SS19QUk9WSURFUiwKICAgICAgICAgICAgICAgICAgICAgICAgIHNlcnZpY2VOYW1lLCBtTG9jYXRpb25IYW5kbGVyKTsKQEAgLTQ3Niw3ICs0NzcsNyBAQAogICAgICAgICB9CiAKICAgICAgICAgc2VydmljZU5hbWUgPSByZXNvdXJjZXMuZ2V0U3RyaW5nKGNvbS5hbmRyb2lkLmludGVybmFsLlIuc3RyaW5nLmNvbmZpZ19nZW9jb2RlUHJvdmlkZXIpOwotICAgICAgICBpZiAoc2VydmljZU5hbWUgIT0gbnVsbCkgeworICAgICAgICBpZiAoc2VydmljZU5hbWUgIT0gbnVsbCAmJiBwbS5yZXNvbHZlU2VydmljZShuZXcgSW50ZW50KHNlcnZpY2VOYW1lKSwgMCkgIT0gbnVsbCkgewogICAgICAgICAgICAgbUdlb2NvZGVQcm92aWRlciA9IG5ldyBHZW9jb2RlclByb3h5KG1Db250ZXh0LCBzZXJ2aWNlTmFtZSk7CiAgICAgICAgIH0KIApkaWZmIC0tZ2l0IGEvc2VydmljZXMvamF2YS9jb20vYW5kcm9pZC9zZXJ2ZXIvTW91bnRTZXJ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dGF0ZShwYXRoKTsKIAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzdGF0ZS5lcXVhbHMoRW52aXJvbm1lbnQuTUVESUFfVU5NT1VOVEVEKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtRW11bGF0ZUV4dGVybmFsU3RvcmFnZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBub3RpZnlWb2x1bWVTdGF0ZUNoYW5nZShudWxsLCBwYXRoLCBWb2x1bWVTdGF0ZS5Ob01lZGlhLCBWb2x1bWVTdGF0ZS5Nb3VudGVkKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHN0YXRlLmVxdWFscyhFbnZpcm9ubWVudC5NRURJQV9VTk1PVU5URUQpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludCByYyA9IGRvTW91bnRWb2x1bWUocGF0aCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyYyAhPSBTdG9yYWdlUmVzdWx0Q29kZS5PcGVyYXRpb25TdWNjZWVkZWQpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNsb2cuZShUQUcsIFN0cmluZy5mb3JtYXQoIkJvb3QtdGltZSBtb3VudCBmYWlsZWQgKCVkKSIsIHJjKSk7CkBAIC00NjgsMTEgKzQ3MiwxMyBAQAogICAgICAgICAgICAgU2xvZy53KFRBRywgU3RyaW5nLmZvcm1hdCgiRHVwbGljYXRlIHN0YXRlIHRyYW5zaXRpb24gKCVzIC0+ICVzKSIsIG1MZWdhY3lTdGF0ZSwgc3RhdGUpKTsKICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgfQotICAgICAgICAvLyBVcGRhdGUgc3RhdGUgb24gUGFja2FnZU1hbmFnZXIKLSAgICAgICAgaWYgKEVudmlyb25tZW50Lk1FRElBX1VOTU9VTlRFRC5lcXVhbHMoc3RhdGUpKSB7Ci0gICAgICA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leCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbVJlc3BvbnNlUXVldWUucHV0KGV2ZW50KTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChJbnRlcnJ1cHRlZEV4Y2VwdGlvbiBleCkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTbG9nLmUoVEFHLCAiRmFpbGVkIHRvIHB1dCByZXNwb25zZSBvbnRvIHF1ZXVlIiwgZXgpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtUmVzcG9uc2VRdWV1ZS5wdXQoZXZlbnQpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChJbnRlcnJ1cHRlZEV4Y2VwdGlvbiBleCkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU2xvZy5lKFRBRywgIkZhaWxlZCB0byBwdXQgcmVzcG9uc2Ugb250byBxdWV1ZSIsIGV4KTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKE51bWJlckZvcm1hdEV4Y2VwdGlvbiBuZmUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTbG9nLncoVEFHLCBTdHJpbmcuZm9ybWF0KCJCYWQgbXNnICglcykiLCBldmVudCkpOwpAQCAtMjE2LDYgKzIxNyw3IEBACiAgICAgICovCiAgICAgcHVibGljIHN5bmNocm9uaXplZCBBcnJheUxpc3Q8U3RyaW5nPiBkb0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2ZW50KGludCBldmVudCwgU3RyaW5nIHBhdGgpIHsKKyAgICAgICAgICAgICAgICBoYW5kbGVTbmFwc2hvdEZpbGUobmV3IEZpbGUoU05BUFNIT1RfRElSLCBwYXRoKSwgZHJvcGJveCk7CisgICAgICAgICAgICB9CisgICAgICAgIH07CisgICAgICAgIHNuYXBzaG90T2JzZXJ2ZXIuc3RhcnRXYXRjaGluZygpOworCisgICAgICAgIGlmIChMT0NBTF9MT0dWKSBTbG9nLnYoVEFHLCAiU2FtcGxpbmdQcm9maWxlclNlcnZpY2UgYWN0aXZhdGVkIik7CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIGhhbmRsZVNuYXBzaG90RmlsZShGaWxlIGZpbGUsIERyb3BCb3hNYW5hZ2VyIGRyb3Bib3gpIHsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIGRyb3Bib3guYWRkRmlsZShUQUcsIGZpbGUsIDApOworICAgICAgICAgICAgaWYgKExPQ0FMX0xPR1YpIFNsb2cudihUQUcsIGZpbGUuZ2V0UGF0aCgpICsgIiBhZGRlZCB0byBkcm9wYm94Iik7CisgICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIFNsb2cuZShUQUcsICJDYW4ndCBhZGQgIiArIGZpbGUuZ2V0UGF0aCgpICsgIiB0byBkcm9wYm94IiwgZSk7CisgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICBmaWxlLmRlbGV0ZSgpOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIHJlZ2lzdGVyU2V0dGluZ09ic2VydmVyKENvbnRleHQgY29udGV4dCkgeworICAgICAgICBDb250ZW50UmVzb2x2ZXIgY29udGVudFJlc29sdmVyID0gY29udGV4dC5nZXRDb250ZW50UmVzb2x2ZXIoKTsKKyAgICAgICAgY29udGVudFJlc29sdmVyLnJlZ2lzdGVyQ29udGVudE9ic2VydmVyKAorICAgICAgICAgICAgICAgIFNldHRpbmdzLlNlY3VyZS5nZXRVcmlGb3IoU2V0dGluZ3MuU2VjdXJlLlNBTVBMSU5HX1BST0ZJTEVSX0haKSwKKyAgICAgICAgICAgICAgICBmYWxzZSwgbmV3IFNhbXBsaW5nUHJvZmlsZXJTZXR0aW5nc09ic2VydmVyKGNvbnRlbnRSZXNvbHZlcikpOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHByb3RlY3RlZCB2b2lkIGR1bXAoRmlsZURlc2NyaXB0b3IgZmQsIFByaW50V3JpdGVyIHB3LCBTdHJpbmdbXSBhcmdzKSB7CisgICAgICAgIHB3LnByaW50bG4oIlNhbXBsaW5nUHJvZmlsZXJTZXJ2aWNlOiIpOworICAgICAgICBwdy5wcmludGxuKCJXYXRjaGluZyBkaXJlY3Rvcnk6ICIgKyBTTkFQU0hPVF9ESVIpOworICAgIH0KKworICAgIHByaXZhdGUgY2xhc3MgU2FtcGxpbmdQcm9maWxlclNldHRpbmdzT2JzZXJ2ZXIgZXh0ZW5kcyBDb250ZW50T2JzZXJ2ZXIgeworICAgICAgICBwcml2YXRlIENvbnRlbnRSZXNvbHZlciBtQ29udGVudFJlc29sdmVyOworICAgICAgICBwdWJsaWMgU2FtcGxpbmdQcm9maWxlclNldHRpbmdzT2JzZXJ2ZXIoQ29udGVudFJlc29sdmVyIGNvbnRlbnRSZXNvbHZlcikgeworICAgICAgICAgICAgc3VwZXIobnVsbCk7CisgICAgICAgICAgICBtQ29udGVudFJlc29sdmVyID0gY29udGVudFJlc29sdmVyOworICAgICAgICAgICAgb25DaGFuZ2UoZmFsc2UpOworICAgICAgICB9CisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgdm9pZCBvbkNoYW5nZShib29sZWFuIHNlbGZDaGFuZ2UpIHsKKyAgICAgICAgICAgIEludGVnZXIgc2FtcGxpbmdQcm9maWxlckh6ID0gU2V0dGluZ3MuU2VjdXJlLmdldEludCgKKyAgICAgICAgICAgICAgICAgICAgbUNvbnRlbn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yU2VydmljZSBub3RpZmljYXRpb24gPSBudWxsOwogICAgICAgICBXYWxscGFwZXJNYW5hZ2VyU2VydmljZSB3YWxscGFwZXIgPSBudWxsOwogICAgICAgICBMb2NhdGlvbk1hbmFnZXJTZXJ2aWNlIGxvY2F0aW9uID0gbnVsbDsKKyAgICAgICAgQ291bnRyeURldGVjdG9yU2VydmljZSBjb3VudHJ5RGV0ZWN0b3IgPSBudWxsOwogCiAgICAgICAgIGlmIChmYWN0b3J5VGVzdCAhPSBTeXN0ZW1TZXJ2ZXIuRkFDVE9SWV9URVNUX0xPV19MRVZFTCkgewogICAgICAgICAgICAgdHJ5IHsKQEAgLTMyMCw2ICszMTgsMTQgQEAKICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICBTbG9nLmkoVEFHLCAiQ291bnRyeSBEZXRlY3RvciIpOworICAgICAgICAgICAgICAgIGNvdW50cnlEZXRlY3RvciA9IG5ldyBDb3VudHJ5RGV0ZWN0b3JTZXJ2aWNlKGNvbnRleHQpOworICAgICAgICAgICAgICAgIFNlcnZpY2VNYW5hZ2VyLmFkZFNlcnZpY2UoQ29udGV4dC5DT1VOVFJZX0RFVEVDVE9SLCBjb3VudHJ5RGV0ZWN0b3IpOworICAgICAgICAgICAgfSBjYXRjaCAoVGhyb3dhYmxlIGUpIHsKKyAgICAgICAgICAgICAgICBTbG9nLmUoVEFHLCAiRmFpbHVyZSBzdGFydGluZyBDb3VudHJ5IERldGVjdG9yIiwgZSk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgU2xvZy5pKFRBRywgIlNlYXJjaCBTZXJ2aWNlIik7CiAgICAgICAgICAgICAgICAgU2VydmljZU1hbmFnZXIuYWRkU2VydmljZShDb250ZXh0LlNFQVJDSF9TRVJWSUNFLAogICAgICAgICAgICAgICAgICAgICAgICAgbmV3IFNlYXJjaE1hbmFnZXJTZXJ2aWNlKGNvbnRleHQpKTsKQEAgLTMyNywxMSArMzMzLDYgQEAKICAgICAgICAgICAgICAgICBTbG9nLmUoVEFHLCAiRmFpbHVyZSBzdGFydGluZyBTZWFyY2ggU2VydmljZSIsIGUpOwogICAgICAgICAgICAgfQogCi0gICAgICAgICAgICBpZiAoSU5DTFVERV9ERU1PKSB7Ci0gICAgICAgICAgICAgICAgU2xvZy5pKFRBRywgIkluc3RhbGxpbmcgZGVtbyBkYXRhLi4uIik7Ci0gICAgICAgICAgICAgICAgKG5ldyBEZW1vVGhyZWFkKGNvbnRleHQpKS5zdGFydCgpOwotICAgICAgICAgICAgfQotCiAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgIFNsb2cuaShUQUcsICJEcm9wQm94IFNlcnZpY2UiKTsKICAgICAgICAgICAgICAgICBTZXJ2aWNlTWFuYWdlci5hZGRTZXJ2aWNlKENvbnRleHQuRFJPUEJPWF9TRVJWSUNFLApAQCAtNDE4LDYgKzQxOSwxOCBAQAogICAgICAgICAgICAgfQogCiAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIC8vIG5lZWQgdG8gYWRkIHRoaXMgc2VydmljZSBldmVuIGlmIFNhbXBsaW5nUHJvZmlsZXJJbnRlZ3JhdGlvbi5pc0VuYWJsZWQoKQorICAgICAgICAgICAgICAgIC8vIGlzIGZhbHNlLCBiZWNhdXNlIGl0IGlzIHRoaXMgc2VydmljZSB0aGF0IGRldGVjdHMgc3lzdGVtIHByb3BlcnR5IGNoYW5nZSBhbmQKKyAgICAgICAgICAgICAgICAvLyB0dXJucyBvbiBTYW1wbGluZ1Byb2ZpbGVySW50ZWdyYXRpb24uIFBsdXMsIHdoZW4gc2FtcGxpbmcgcHJvZmlsZXIgZG9lc24ndCB3b3JrLAorICAgICAgICAgICAgICAgIC8vIHRoZXJlIGlzIGxpdHRsZSBvdmVyaGVhZCBmb3IgcnVubmluZyB0aGlzIHNlcnZpY2UuCisgICAgICAgICAgICAgICAgU2xvZy5pKFRBRywgIlNhbXBsaW5nUHJvZmlsZXIgU2VydmljZSIpOworICAgICAgICAgICAgICAgIFNlcnZpY2VNYW5hZ2VyLmFkZFNlcnZpY2UoInNhbXBsaW5ncHJvZmlsZXIiLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBTYW1wbGluZ1Byb2ZpbGVyU2VydmljZShjb250ZXh0KSk7CisgICAgICAgICAgICB9IGNhdGNoIChUaHJvd2FibGUgZSkgeworICAgICAgICAgICAgICAgIFNsb2cuZShUQUcsICJGYWlsdXJlIHN0YXJ0aW5nIFNhbXBsaW5nUHJvZmlsZXIgU2VydmljZSIsIGUpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgIFNpcFNlcnZpY2Ugc2lwU2VydmljZSA9IFNpcFNlcnZpY2UuY3JlYXRlKGNvbnRleHQpOwogICAgICAgICAgICAgICAgIGlmIChzaXBTZXJ2aWNlICE9IG51bGwpIHsKICAgICAgICAgICAgICAgICAgICAgU2xvZy5pKFRBRywgIlNpcCBTZXJ2aWNlIik7CkBAIC00ODYsNiArNDk5LDcgQEAKICAgICAgICAgZmluYWwgSW5wdXRNZXRob2RNYW5hZ2VyU2VydmljZSBpbW1GID0gaW1tOwogICAgICAgICBmaW5hbCBSZWNvZ25pdGlvbk1hbmFnZXJTZXJ2aWNlIHJlY29nbml0aW9uRiA9IHJlY29nbml0aW9uOwogICAgICAgICBmaW5hbCBMb2NhdGlvbk1hbmFnZXJTZXJ2aWNlIGxvY2F0aW9uRiA9IGxvY2F0aW9uOworICAgICAgICBmaW5hbCBDb3VudHJ5RGV0ZWN0b3JTZXJ2aWNlIGNvdW50cnlEZXRlY3RvckYgPSBjb3VudHJ5RGV0ZWN0b3I7CiAKICAgICAgICAgLy8gV2Ugbm93IHRlbGwgdGhlIGFjdGl2aXR5IG1hbmFnZXIgaXQgaXMgb2theSB0byBydW4gdGhpcmQgcGFydHkKICAgICAgICAgLy8gY29kZS4gIEl0IHdpbGw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gICAgICAgICAgYy5kZWFjdGl2YXRlKCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBpZiAoIWhhc0RhdGEpIHsKLSAgICAgICAgICAgICAgICBEZW1vRGF0YVNldCBkYXRhc2V0ID0gbmV3IERlbW9EYXRhU2V0KCk7Ci0gICAgICAgICAgICAgICAgZGF0YXNldC5hZGQobUNvbnRleHQpOwotICAgICAgICAgICAgfQotICAgICAgICB9IGNhdGNoIChUaHJvd2FibGUgZSkgewotICAgICAgICAgICAgU2xvZy5lKCJTeXN0ZW1TZXJ2ZXIiLCAiRmFpbHVyZSBpbnN0YWxsaW5nIGRlbW8gZGF0YSIsIGUpOwotICAgICAgICB9Ci0KLSAgICB9Ci0KLSAgICBDb250ZXh0IG1Db250ZXh0OwotfQotCi1wdWJsaWMgY2xhc3MgU3lzdGVtU2VydmVyCi17CitwdWJsaWMgY2xhc3MgU3lzdGVtU2VydmVyIHsKICAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBTdHJpbmcgVEFHID0gIlN5c3RlbVNlcnZlciI7CiAKICAgICBwdWJsaWMgc3RhdGljIGZpbmFsIGludCBGQUNUT1JZX1RFU1RfT0ZGID0gMDsKQEAgLTU3Niw3ICs1NjEsNyBAQAogICAgICAgICAgICAgdGltZXIuc2NoZWR1bGUobmV3IFRpbWVyVGFzaygpIHsKICAgICAgICAgICAgICAgICBAT3ZlcnJpZGUKICAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBydW4oKSB7Ci0gICAgICAgICAgICAgICAgICAgIFNhbXBsaW5nUHJvZmlsZXJJbnRlZ3JhdGlvbi53cml0ZVNuYXBzaG90KCJzeXN0ZW1fc2VydmVyIik7CisgICAgICAgICAgICAgICAgICAgIFNhbXBsaW5nUHJvZmlsZXJJbnRlZ3JhdGlvbi53cml0ZVNuYXBzaG90KCJzeXN0ZW1fc2VydmVyIiwgbnVsbCk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfSwgU05BUFNIT1Rf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AgICAgIHJlbW92ZShyLmJpbmRlcik7CisgICAgICAgICAgICAgICAgICAgICAgICByZW1vdmVMaXN0LmFkZChyLmJpbmRlcik7CiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CisgICAgICAgICAgICBmb3IgKElCaW5kZXIgYiA6IHJlbW92ZUxpc3QpIHJlbW92ZShiKTsKICAgICAgICAgfQogICAgICAgICBicm9hZGNhc3RDYWxsU3RhdGVDaGFuZ2VkKHN0YXRlLCBpbmNvbWluZ051bWJlcik7CiAgICAgfQpAQCAtMjU2LDggKzI1OSw3IEBACiAgICAgICAgIH0KICAgICAgICAgc3luY2hyb25pemVkIChtUmVjb3JkcykgewogICAgICAgICAgICAgbVNlcnZpY2VTdGF0ZSA9IHN0YXRlOwotICAgICAgICAgICAgZm9yIChpbnQgaSA9IG1SZWNvcmRzLnNpemUoKSAtIDE7IGkgPj0gMDsgaS0tKSB7Ci0gICAgICAgICAgICAgICAgUmVjb3JkIHIgPSBtUmVjb3Jkcy5nZXQoaSk7CisgICAgICAgICAgICBmb3IgKFJlY29yZCByIDogbVJlY29yZHMpIHsKICAgICAgICAgICAgICAgICBpZiAoKHIuZXZlbnRzICYgUGhvbmVTdGF0ZUxpc3RlbmVyLkxJU1RFTl9TRVJWSUNFX1NUQVRFKSAhPSAwKSB7CiAgICAgICAgICAgICAgICAgICAgIHNlbmRTZXJ2aWNlU3RhdGUociwgc3RhdGUpOwogICAgICAgICAgICAgICAgIH0KQEAgLTI3MCwxMCArMjcyLDEwIEBACiAgICAgICAgIGlmICghY2hlY2tOb3RpZnlQZXJtaXNzaW9uKCJub3RpZnlTaWduYWxTdHJlbmd0aCgpIikpIHsKICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgfQorICAgICAgICBBcnJheUxpc3Q8SUJpbmRlcj4gcmVtb3ZlTGlzdCA9IG5ldyBBcnJheUxpc3Q8SUJpbmRlcj4oKTsKICAgICAgICAgc3luY2hyb25pemVkIChtUmVjb3JkcykgewogICAgICAgICAgICAgbVNpZ25hbFN0cmVuZ3RoID0gc2lnbmFsU3RyZW5ndGg7Ci0gICAgICAgICAgICBmb3IgKGludCBpID0gbVJlY29yZHMuc2l6ZSgpIC0gMTsgaSA+PSAwOyBpLS0pIHsKLSAgICAgICAgICAgICAgICBSZWNvcmQgciA9IG1SZWNvcmRzLmdldChpKTsKKyAgICAgICAgICAgIGZvciAoUmVjb3JkIHIgOiBtUmVjb3JkcykgewogICAgICAgICAgICAgICAgIGlmICgoci5ldmVudHMgJiBQaG9uZVN0YXRlTGlzdGVuZXIuTElTVEVOX1NJR05BTF9TVFJFTkdUSFMpICE9IDApIHsKICAgICAgICAgICAgICAgICAgICAgc2VuZFNpZ25hbFN0cmVuZ3RoKHIsIHNpZ25hbFN0cmVuZ3RoKTsKICAgICAgICAgICAgICAgICB9CkBAIC0yODMsMTAgKzI4NSwxMSBAQAogICAgICAgICAgICAgICAgICAgICAgICAgci5jYWxsYmFjay5vblNpZ25hbFN0cmVuZ3RoQ2hhbmdlZCgoZ3NtU2lnbmFsU3RyZW5ndGggPT0gOTkgPyAtMQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6IGdzbVNpZ25hbFN0cmVuZ3RoKSk7CiAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBleCkgewotICAgICAgICAgICAgICAgICAgICAgICAgcmVtb3ZlKHIuYmluZGVyKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJlbW92ZUxpc3QuYWRkKHIuYmluZGVyKTsKICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGZvciAoSUJpbmRlciBiIDogcmVtb3ZlTGlzdCkgcmVtb3ZlKGIpOwogICAgICAgICB9CiAgICAgICAgIGJyb2FkY2FzdFNpZ25hbFN0cmVuZ3RoQ2hhbmdlZChzaWduYWxTdHJlbmd0aCk7CiAgICAgfQpAQCAtMjk1LDE4ICsyOTgsMTkgQEAKICAgICAgICAgaWYgKCFjaGVja05vdGlmeVBlcm1pc3Npb24oIm5vdGlmeU1lc3NhZ2VXYWl0aW5nQ2hhbmdlZCgpIikpIHsKICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgfQorICAgICAgICBBcnJheUxpc3Q8SUJpbmRlcj4gcmVtb3ZlTGlzdCA9IG5ldyBBcnJheUxpc3Q8SUJpbmRlcj4oKTsKICAgICAgICAgc3luY2hyb25pemVkIChtUmVjb3JkcykgewogICAgICAgICAgICAgbU1lc3NhZ2VXYWl0aW5nID0gbXdpOwotICAgICAgICAgICAgZm9yIChpbnQgaSA9IG1SZWNvcmRzLnNpemUoKSAtIDE7IGkgPj0gMDsgaS0tKSB7Ci0gICAgICAgICAgICAgICAgUmVjb3JkIHIgPSBtUmVjb3Jkcy5nZXQoaSk7CisgICAgICAgICAgICBmb3IgKFJlY29yZCByIDogbVJlY29yZHMpIHsKICAgICAgICAgICAgICAgICBpZiAoKHIuZXZlbnRzICYgUGhvbmVTdGF0ZUxpc3RlbmVyLkxJU1RFTl9NRVNTQUdFX1dBSVRJTkdfSU5ESUNBVE9SKSAhPSAwKSB7CiAgICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgICByLmNhbGxiYWNrLm9uTWVzc2FnZVdhaXRpbmdJbmRpY2F0b3JDaGFuZ2VkKG13aSk7CiAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBleCkgewotICAgICAgICAgICAgICAgICAgICAgICAgcmVtb3ZlKHIuYmluZGVyKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJlbW92ZUxpc3QuYWRkKHIuYmluZGVyKTsKICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGZvciAoSUJpbmRlciBiIDogcmVtb3ZlTGlzdCkgcmVtb3ZlKGIpOwogICAgICAgICB9CiAgICAgfQogCkBAIC0zMTQsMTggKzMxOCwxOSBAQAogICAgICAgICBpZiAoIWNoZWNrTm90aWZ5UGVybWlzc2lvbigibm90aWZ5Q2FsbEZvcndhcmRpbmdDaGFuZ2VkKCkiKSkgewogICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICB9CisgICAgICAgIEFycmF5TGlzdDxJQmluZGVyPiByZW1vdmVMaXN0ID0gbmV3IEFycmF5TGlzdDxJQmluZGVyPigpOwogICAgICAgICBzeW5jaHJvbml6ZWQgKG1SZWNvcmRzKSB7CiAgICAgICAgICAgICBtQ2FsbEZvcndhcmRpbmcgPSBjZmk7Ci0gICAgICAgICAgICBmb3IgKGludCBpID0gbVJlY29yZHMuc2l6ZSgpIC0gMTsgaSA+PSAwOyBpLS0pIHsKLSAgICAgICAgICAgICAgICBSZWNvcmQgciA9IG1SZWNvcmRzLmdldChpKTsKKyAgICAgICAgICAgIGZvciAoUmVjb3JkIHIgOiBtUmVjb3JkcykgewogICAgICAgICAgICAgICAgIGlmICgoci5ldmVudHMgJiBQaG9uZVN0YXRlTGlzdGVuZXIuTElTVEVOX0NBTExfRk9SV0FSRElOR19JTkRJQ0FUT1IpICE9IDApIHsKICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgIHIuY2FsbGJhY2sub25DYWxsRm9yd2FyZGluZ0luZGljYXRvckNoYW5nZWQoY2ZpKTsKICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGV4KSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICByZW1vdmUoci5iaW5kZXIpOworICAgICAgICAgICAgICAgICAgICAgICAgcmVtb3ZlTGlzdC5hZGQoci5iaW5kZXIpOwogICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQorICAgICAgICAgICAgZm9yIChJQmluZGVyIGIgOiByZW1vdmVMaXN0KSByZW1vdmUoYik7CiAgICAgICAgIH0KICAgICB9CiAKQEAgLTMzMyw1NyArMzM4LDgxIEBACiAgICAgICAgIGlmICghY2hlY2tOb3RpZnlQZXJtaXNzaW9uKCJub3RpZnlEYXRhQWN0aXZpdHkoKSIgKSkgewogICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICB9CisgICAgICAgIEFycmF5TGlzdDxJQmluZGVyPiByZW1vdmVMaXN0ID0gbmV3IEFycmF5TGlzdDxJQmluZGVyPigpOwogICAgICAgICBzeW5jaHJvbml6ZWQgKG1SZWNvcmRzKSB7CiAgICAgICAgICAgICBtRGF0YUFjdGl2aXR5ID0gc3RhdGU7Ci0gICAgICAgICAgICBmb3IgKGludCBpID0gbVJlY29yZHMuc2l6ZSgpIC0gMTsgaSA+PSAwOyBpLS0pIHsKLSAgICAgICAgICAgICAgICBSZWNvcmQgciA9IG1SZWNvcmRzLmdldChpKTsKKyAgICAgICAgICAgIGZvciAoUmVjb3JkIHIgOiBtUmVjb3JkcykgewogICAgICAgICAgICAgICAgIGlmICgoci5ldmVudHMgJiBQaG9uZVN0YXRlTGlzdGVuZXIuTElTVEVOX0RBVEFfQUNUSVZJVFkpICE9IDApIHsKICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgIHIuY2FsbGJhY2sub25EYXRhQWN0aXZpdHkoc3RhdGUpOwogICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZXgpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHJlbW92ZShyLmJpbmRlcik7CisgICAgICAgICAgICAgICAgICAgICAgICByZW1vdmVMaXN0LmFkZChyLmJpbmRlcik7CiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CisgICAgICAgICAgICBmb3IgKElCaW5kZXIgYiA6IHJlbW92ZUxpc3QpIHJlbW92ZShiKTsKICAgICAgICAgfQogICAgIH0KIAogICAgIHB1YmxpYyB2b2lkIG5vdGlmeURhdGFDb25uZWN0aW9uKGludCBzdGF0ZSwgYm9vbGVhbiBpc0RhdGFDb25uZWN0aXZpdHlQb3NzaWJsZSwKLSAgICAgICAgICAgIFN0cmluZyByZWFzb24sIFN0cmluZyBhcG4sIFN0cmluZ1tdIGFwblR5cGVzLCBTdHJpbmcgaW50ZXJmYWNlTmFtZSwgaW50IG5ldHdvcmtUeXBlLAotICAgICAgICAgICAgU3RyaW5nIGdhdGV3YXkpIHsKKyAgICAgICAgICAgIFN0cmluZyByZWFzb24sIFN0cmluZyBhcG4sIFN0cmluZyBhcG5UeXBlLCBMaW5rUHJvcGVydGllcyBsaW5rUHJvcGVydGllcywKKyAgICAgICAgICAgIGludCBuZXR3b3JrVHlwZSkgewogICAgICAgICBpZiAoIWNoZWNrTm90aWZ5UGVybWlzc2lvbigibm90aWZ5RGF0YUNvbm5lY3Rpb24oKSIgKSkgewogICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICB9CiAgICAgICAgIHN5bmNocm9uaXplZCAobVJlY29yZHMpIHsKLSAgICAgICAgICAgIG1EYXRhQ29ubmVjdGlvblN0YXRlID0gc3RhdGU7CisgICAgICAgICAgICBib29sZWFuIG1vZGlmaWVkID0gZmFsc2U7CisgICAgICAgICAgICBpZiAoc3RhdGUgPT0gVGVsZXBob255TWFuYWdlci5EQVRBX0NPTk5FQ1RFRCkgeworICAgICAgICAgICAgICAgIGlmICghbUNvbm5lY3RlZEFwbnMuY29udGFpbnMoYXBuVHlwZSkpIHsKKyAgICAgICAgICAgICAgICAgICAgbUNvbm5lY3RlZEFwbnMuYWRkKGFwblR5cGUpOworICAgICAgICAgICAgICAgICAgICBpZiAobURhdGFDb25uZWN0aW9uU3RhdGUgIT0gc3RhdGUpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1EYXRhQ29ubmVjdGlvblN0YXRlID0gc3RhdGU7CisgICAgICAgICAgICAgICAgICAgICAgICBtb2RpZmllZCA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIG1Db25uZWN0ZWRBcG5zLnJlbW92ZShhcG5UeXBlKTsKKyAgICAgICAgICAgICAgICBpZiAobUNvbm5lY3RlZEFwbnMuaXNFbXB0eSgpKSB7CisgICAgICAgICAgICAgICAgICAgIG1EYXRhQ29ubmVjdGlvblN0YXRlID0gc3RhdGU7CisgICAgICAgICAgICAgICAgICAgIG1vZGlmaWVkID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAvLyBsZWF2ZSBtRGF0YUNvbm5lY3Rpb25TdGF0ZSBhcyBpcyBhbmQKKyAgICAgICAgICAgICAgICAgICAgLy8gc2VuZCBvdXQgdGhlIG5ldyBzdGF0dXMgZm9yIHRoZSBBUE4gaW4gcXVlc3Rpb24uCisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQogICAgICAgICAgICAgbURhdGFDb25uZWN0aW9uUG9zc2libGUgPSBpc0RhdGFDb25uZWN0aXZpdHlQb3NzaWJsZTsKICAgICAgICAgICAgIG1EYXRhQ29ubmVjdGlvblJlYXNvbiA9IHJlYXNvbjsKICAgICAgICAgICAgIG1EYXRhQ29ubmVjdGlvbkFwbiA9IGFwbjsKLSAgICAgICAgICAgIG1EYXRhQ29ubmVjdGlvbkFwblR5cGVzID0gYXBuVHlwZXM7Ci0gICAgICAgICAgICBtRGF0YUNvbm5lY3Rpb25JbnRlcmZhY2VOYW1lID0gaW50ZXJmYWNlTmFtZTsKLSAgICAgICAgICAgIG1EYXRhQ29ubmVjdGlvbk5ldHdvcmtUeXBlID0gbmV0d29ya1R5cGU7Ci0gICAgICAgICAgICBmb3IgKGludCBpID0gbVJlY29yZHMuc2l6ZSgpIC0gMTsgaSA+PSAwOyBpLS0pIHsKLSAgICAgICAgICAgICAgICBSZWNvcmQgciA9IG1SZWNvcmRzLmdldChpKTsKLSAgICAgICAgICAgICAgICBpZiAoKHIuZXZlbnRzICYgUGhvbmVTdGF0ZUxpc3RlbmVyLkxJU1RFTl9EQVRBX0NPTk5FQ1RJT05fU1RBVEUpICE9IDApIHsKLSAgICAgICAgICAgICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHIuY2FsbGJhY2sub25EYXRhQ29ubmVjdGlvblN0YXRlQ2hhbmdlZChzdGF0ZSwgbmV0d29ya1R5cGUpOwotICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZXgpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHJlbW92ZShyLmJpbmRlcik7CisgICAgICAgICAgICBtRGF0YUNvbm5lY3Rpb25Qcm9wZXJ0aWVzID0gbGlua1Byb3BlcnRpZXM7CisgICAgICAgICAgICBpZiAobURhdGFDb25uZWN0aW9uTmV0d29ya1R5cGUgIT0gbmV0d29ya1R5cGUpIHsKKyAgICAgICAgICAgICAgICBtRGF0YUNvbm5lY3Rpb25OZXR3b3JrVHlwZSA9IG5ldHdvcmtUeXBlOworICAgICAgICAgICAgICAgIG1vZGlmaWVkID0gdHJ1ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChtb2RpZmllZCkgeworICAgICAgICAgICAgICAgIEFycmF5TGlzdDxJQmluZGVyPiByZW1vdmVMaXN0ID0gbmV3IEFycmF5TGlzdDxJQmluZGVyPigpOworICAgICAgICAgICAgICAgIGZvciAoUmVjb3JkIHIgOiBtUmVjb3JkcykgeworICAgICAgICAgICAgICAgICAgICBpZiAoKHIuZXZlbnRzICYgUGhvbmVTdGF0ZUxpc3RlbmVyLkxJU1RFTl9EQVRBX0NPTk5FQ1RJT05fU1RBVEUpICE9IDApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgci5jYWxsYmFjay5vbkRhdGFDb25uZWN0aW9uU3RhdGVDaGFuZ2VkKHN0YXRlLCBuZXR3b3JrVHlwZSk7CisgICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZXgpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICByZW1vdmVMaXN0LmFkZChyLmJpbmRlcik7CisgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgZm9yIChJQmluZGVyIGIgOiByZW1vdmVMaXN0KSByZW1vdmUoYik7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICAgICAgYnJvYWRjYXN0RGF0YUNvbm5lY3Rpb25TdGF0ZUNoYW5nZWQoc3RhdGUsIGlzRGF0YUNvbm5lY3Rpdml0eVBvc3NpYmxlLCByZWFzb24sIGFwbiwKLSAgICAgICAgICAgICAgICBhcG5UeXBlcywgaW50ZXJmYWNlTmFtZSwgZ2F0ZXdheSk7CisgICAgICAgICAgICAgICAgYXBuVHlwZSwgbGlua1Byb3BlcnRpZXMpOwogICAgIH0KIAotICAgIHB1YmxpYyB2b2lkIG5vdGlmeURhdGFDb25uZWN0aW9uRmFpbGVkKFN0cmluZyByZWFzb24pIHsKKyAgICBwdWJsaWMgdm9pZCBub3RpZnlEYXRhQ29ubmVjdGlvbkZhaWxlZChTdHJpbmcgcmVhc29uLCBTdHJpbmcgYXBuVHlwZSkgewogICAgICAgICBpZiAoIWNoZWNrTm90aWZ5UGVybWlzc2lvbigibm90aWZ5RGF0YUNvbm5lY3Rpb25GYWlsZWQoKSIpKSB7CiAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgIH0KICAgICAgICAgLyoKLSAgICAgICAgICogVGhpcyBpcyBjb21tZW50ZWQgb3V0IGJlY2F1c2UgdGhlcmUgaXMgb24gb25EYXRhQ29ubmVjdGlvbkZhaWxlZCBjYWxsYmFjawotICAgICAgICAgKiBvbiBQaG9uZVN0YXRlTGlzdGVuZXIuIFRoZXJlIHNob3VsZCBiZQorICAgICAgICAgKiBUaGlzIGlzIGNvbW1lbnRlZCBvdXQgYmVjYXVzZSB0aGVyZSBpcyBubyBvbkRhdGFDb25uZWN0aW9uRmFpbGVkIGNhbGxiYWNrCisgICAgICAgICAqIGluIFBob25lU3RhdGVMaXN0ZW5lci4gVGhlcmUgc2hvdWxkIGJlLgogICAgICAgICBzeW5jaHJvbml6ZWQgKG1SZWNvcmRzKSB7CiAgICAgICAgICAgICBtRGF0YUNvbm5lY3Rpb25GYWlsZWRSZWFzb24gPSByZWFzb247CiAgICAgICAgICAgICBmaW5hbCBpbnQgTiA9IG1SZWNvcmRzLnNpemUoKTsKQEAgLTM5NSw3ICs0MjQsNyBAQAogICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgICAgICovCi0gICAgICAgIGJyb2FkY2FzdERhdGFDb25uZWN0aW9uRmFpbGVkKHJlYXNvbik7CisgICAgICAgIGJyb2FkY2FzdERhdGFDb25uZWN0aW9uRmFpbGVkKHJlYXNvbiwgYXBuVHlwZSk7CiAgICAgfQogCiAgICAgcHVibGljIHZvaWQgbm90aWZ5Q2VsbExvY2F0aW9uKEJ1bmRsZSBjZWxsTG9jYXRpb24pIHsKQEAgLTQwNCw4ICs0MzMsNyBAQAogICAgICAgICB9CiAgICAgICAgIHN5bmNocm9uaXplZCAobVJlY29yZHMpIHsKICAgICAgICAgICAgIG1DZWxsTG9jYXRpb24gPSBjZWxsTG9jYXRpb247Ci0gICAgICAgICAgICBmb3IgKGludCBpID0gbVJlY29yZHMuc2l6ZSgpIC0gMTsgaSA+PSAwOyBpLS0pIHsKLSAgICAgICAgICAgICAgICBSZWNvcmQgciA9IG1SZWNvcmRzLmdldChpKTsKKyAgICAgICAgICAgIGZvciAoUmVjb3JkIHIgOiBtUmVjb3JkcykgewogICAgICAgICAgICAgICAgIGlmICgoci5ldmVudHMgJiBQaG9uZVN0YXRl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0cyBzZXJ2aWNlIGhlcmUsIGJlY2F1c2UgdGhlCiAgICAgICAgIC8vIHN0YXR1cyBiYXIgdGFrZXMgY2FyZSBvZiB0aGF0IGFmdGVyIHRha2luZyBpbnRvIGFjY291bnQgYWxsIG9mIHRoZQogICAgICAgICAvLyByZXF1aXJlZCBpbmZvLgpAQCAtNTUwLDI5ICs1NzcsMjMgQEAKICAgICAgICAgaWYgKHJlYXNvbiAhPSBudWxsKSB7CiAgICAgICAgICAgICBpbnRlbnQucHV0RXh0cmEoUGhvbmUuU1RBVEVfQ0hBTkdFX1JFQVNPTl9LRVksIHJlYXNvbik7CiAgICAgICAgIH0KLSAgICAgICAgaW50ZW50LnB1dEV4dHJhKFBob25lLkRBVEFfQVBOX0tFWSwgYXBuKTsKLSAgICAgICAgU3RyaW5nIHR5cGVzID0gbmV3IFN0cmluZygiIik7Ci0gICAgICAgIGlmIChhcG5UeXBlcy5sZW5ndGggPiAwKSB7Ci0gICAgICAgICAgICB0eXBlcyA9IGFwblR5cGVzWzBdOwotICAgICAgICAgICAgZm9yIChpbnQgaSA9IDE7IGkgPCBhcG5UeXBlcy5sZW5ndGg7IGkrKykgewotICAgICAgICAgICAgICAgIHR5cGVzID0gdHlwZXMrIiwiK2FwblR5cGVzW2ldOworICAgICAgICBpZiAobGlua1Byb3BlcnRpZXMgIT0gbnVsbCkgeworICAgICAgICAgICAgaW50ZW50LnB1dEV4dHJhKFBob25lLkRBVEFfTElOS19QUk9QRVJUSUVTX0tFWSwgbGlua1Byb3BlcnRpZXMpOworICAgICAgICAgICAgTmV0d29ya0ludGVyZmFjZSBpZmFjZSA9IGxpbmtQcm9wZXJ0aWVzLmdldEludGVyZmFjZSgpOworICAgICAgICAgICAgaWYgKGlmYWNlICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBpbnRlbnQucHV0RXh0cmEoUGhvbmUuREFUQV9JRkFDRV9OQU1FX0tFWSwgaWZhY2UuZ2V0TmFtZSgpKTsKICAgICAgICAgICAgIH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rlck9ic2VydmVyKG1JbnRlcmZhY2VPYnNlcnZlcik7CisgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICBTbG9nLmUoVEFHLCAiQ291bGQgbm90IHJlZ2lzdGVyIEludGVyZmFjZU9ic2VydmVyICIgKyBlKTsKKyAgICAgICAgfQorCisgICAgICAgIG1TZXR0aW5nc09ic2VydmVyID0gbmV3IFNldHRpbmdzT2JzZXJ2ZXIobUhhbmRsZXIsIEVWRU5UX1BPTElDWV9DSEFOR0VEKTsKKyAgICAgICAgbVNldHRpbmdzT2JzZXJ2ZXIub2JzZXJ2ZShtQ29udGV4dCk7CiAgICAgfQogCiAKQEAgLTM3NSw3ICszODIsNyBAQAogICAgICAgICAgICAgLy8gY2hlY2sgZm9yIHNpbSBjaGFuZ2UgVE9ETwogICAgICAgICAgICAgLy8gcmVyZWdpc3RlciBmb3Igbm90aWZpY2F0aW9uIG9mIHBvbGljeSBjaGFuZ2UKIAotICAgICAgICAgICAgbVRocm90dGxlSW5kZXggPSBUSFJPVFRMRV9JTkRFWF9VTklOSVRJQUxJWkVEOworICAgICAgICAgICAgbVRocm90dGxlSW5kZXguc2V0KFRIUk9UVExFX0lOREVYX1VOSU5JVElBTElaRUQpOwogCiAgICAgICAgICAgICBtUmVjb3JkZXIgPSBuZXcgRGF0YVJlY29yZGVyKG1Db250ZXh0LCBUaHJvdHRsZVNlcnZpY2UudGhpcyk7CiAKQEAgLTQwMywxNSArNDEwLDE2IEBACiAgICAgICAgICAgICAgICAgICAgIFIuaW50ZWdlci5jb25maWdfZGF0YXVzZV90aHJlc2hvbGRfYnl0ZXMpOwogICAgICAgICAgICAgaW50IGRlZmF1bHRWYWx1ZSA9IG1Db250ZXh0LmdldFJlc291cmNlcygpLmdldEludGVnZXIoCiAgICAgICAgICAgICAgICAgICAgIFIuaW50ZWdlci5jb25maWdfZGF0YXVzZV90aHJvdHRsZV9rYml0c3BzKTsKLSAgICAgICAgICAgIHN5bmNocm9uaXplZCAoVGhyb3R0bGVTZXJ2aWNlLnRoaXMpIHsKLSAgICAgICAgICAgICAgICBtUG9saWN5VGhyZXNob2xkID0gU2V0dGluZ3MuU2VjdXJlLmdldExvbmcobUNvbnRleHQuZ2V0Q29udGVudFJlc29sdmVyKCksCi0gICAgICAgICAgICAgICAgICAgICAgICBTZXR0aW5ncy5TZWN1cmUuVEhST1RUTEVfVEhSRVNIT0xEX0JZVEVTLCBkZWZhdWx0VGhyZXNob2xkKTsKLSAgICAgICAgICAgICAgICBtUG9saWN5VGhyb3R0bGVWYWx1ZSA9IFNldHRpbmdzLlNlY3VyZS5nZXRJbnQobUNvbnRleHQuZ2V0Q29udGVudFJlc29sdmVyKCksCi0gICAgICAgICAgICAgICAgICAgICAgICBTZXR0aW5ncy5TZWN1cmUuVEhST1RUTEVfVkFMVUVfS0JJVFNQUywgZGVmYXVsdFZhbHVlKTsKLSAgICAgICAgICAgICAgICBpZiAodGVzdGluZykgewotICAgICAgICAgICAgICAgICAgICBtUG9saWN5UG9sbFBlcmlvZFNlYyA9IFRFU1RJTkdfUE9MTElOR19QRVJJT0RfU0VDOwotICAgICAgICAgICAgICAgICAgICBtUG9saWN5VGhyZXNob2xkID0gVEVTVElOR19USFJFU0hPTEQ7Ci0gICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgbG9uZyB0aHJlc2hvbGQgPSBTZXR0aW5ncy5TZWN1cmUuZ2V0TG9uZyhtQ29udGV4dC5nZXRDb250ZW50UmVzb2x2ZXIoKSwKKyAgICAgICAgICAgICAgICAgICAgU2V0dGluZ3MuU2VjdXJlLlRIUk9UVExFX1RIUkVTSE9MRF9CWVRFUywgZGVmYXVsdFRocmVzaG9sZCk7CisgICAgICAgICAgICBpbnQgdmFsdWUgPSBTZXR0aW5ncy5TZWN1cmUuZ2V0SW50KG1Db250ZXh0LmdldENvbnRlbnRSZXNvbHZlcigpLAorICAgICAgICAgICAgICAgICAgICBTZXR0aW5ncy5TZWN1cmUuVEhST1RUTEVfVkFMVUVfS0JJVFNQUywgZGVmYXVsdFZhbHVlKTsKKworICAgICAgICAgICAgbVBvbGljeVRocmVzaG9sZC5zZXQodGhyZXNob2xkKTsKKyAgICAgICAgICAgIG1Qb2xpY3lUaHJvdHRsZVZhbHVlLnNldCh2YWx1ZSk7CisgICAgICAgICAgICBpZiAodGVzdGluZykgeworICAgICAgICAgICAgICAgIG1Qb2xpY3lQb2xsUGVyaW9kU2VjID0gVEVTVElOR19QT0xMSU5HX1BFUklPRF9TRUM7CisgICAgICAgICAgICAgICAgbVBvbGljeVRocmVzaG9sZC5zZXQoVEVTVElOR19USFJFU0hPTEQpOwogICAgICAgICAgICAgfQogCiAgICAgICAgICAgICBtUG9saWN5UmVzZXREYXkgPSBTZXR0aW5ncy5TZWN1cmUuZ2V0SW50KG1Db250ZXh0LmdldENvbnRlbnRSZXNvbHZlcigpLApAQCAtNDIzLDEwICs0MzEsOCBAQAogICAgICAgICAgICAgICAgIFNldHRpbmdzLlNlY3VyZS5wdXRJbnQobUNvbnRleHQuZ2V0Q29udGVudFJlc29sdmVyKCksCiAgICAgICAgICAgICAgICAgU2V0dGluZ3MuU2VjdXJlLlRIUk9UVExFX1JFU0VUX0RBWSwgbVBvbGljeVJlc2V0RGF5KTsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIHN5bmNocm9uaXplZCAoVGhyb3R0bGVTZXJ2aWNlLnRoaXMpIHsKLSAgICAgICAgICAgICAgICBpZiAobUlmYWNlID09IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgbVBvbGljeVRocmVzaG9sZCA9IDA7Ci0gICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKG1JZmFjZSA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgbVBvbGljeVRocmVzaG9sZC5zZXQoMCk7CiAgICAgICAgICAgICB9CiAKICAgICAgICAgICAgIGludCBkZWZhdWx0Tm90aWZpY2F0aW9uVHlwZSA9IG1Db250ZXh0LmdldFJlc291cmNlcygpLmdldEludGVnZXIoCkBAIC00MzcsMTUgKzQ0MywxNiBAQAogICAgICAgICAgICAgbU1heE50cENhY2hlQWdlU2VjID0gU2V0dGluZ3MuU2VjdXJlLmdldEludChtQ29udGV4dC5nZXRDb250ZW50UmVzb2x2ZXIoKSwKICAgICAgICAgICAgICAgICAgICAgU2V0dGluZ3MuU2VjdXJlLlRIUk9UVExFX01BWF9OVFBfQ0FDSEVfQUdFX1NFQywgTUFYX05UUF9DQUNIRV9BR0VfU0VDKTsKIAotICAgICAgICAgICAgaWYgKFZEQkcgfHwgKG1Qb2xpY3lUaHJlc2hvbGQgIT0gMCkpIHsKKyAgICAgICAgICAgIGlmIChWREJHIHx8IChtUG9saWN5VGhyZXNob2xkLmdldCgpICE9IDApKSB7CiAgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgIm9uUG9saWN5Q2hhbmdlZCB0ZXN0aW5nPSIgKyB0ZXN0aW5nICsiLCBwZXJpb2Q9IiArCi0gICAgICAgICAgICAgICAgICAgICAgICBtUG9saWN5UG9sbFBlcmlvZFNlYyArICIsIHRocmVzaG9sZD0iICsgbVBvbGljeVRocmVzaG9sZCArICIsIHZhbHVlPSIgKwotICAgICAgICAgICAgICAgICAgICAgICAgbVBvbGljeVRocm90dGxlVmFsdWUgKyAiLCByZXNldERheT0iICsgbVBvbGljeVJlc2V0RGF5ICsgIiwgbm90ZVR5cGU9IiArCi0gICAgICAgICAgICAgICAgICAgICAgICBtUG9saWN5Tm90aWZpY2F0aW9uc0FsbG93ZWRNYXNrICsgIiwgbWF4TnRwQ2FjaGVBZ2U9IiArIG1NYXhOdHBDYWNoZUFnZVNlYyk7CisgICAgICAgICAgICAgICAgICAgICAgICBtUG9saWN5UG9sbFBlcmlvZFNlYyArICIsIHRocmVzaG9sZD0iICsgbVBvbGljeVRocmVzaG9sZC5nZXQoKSArCisgICAgICAgICAgICAgICAgICAgICAgICAiLCB2YWx1ZT0iICsgbVBvbGljeVRocm90dGxlVmFsdWUuZ2V0KCkgKyAiLCByZXNldERheT0iICsgbVBvbGljeVJlc2V0RGF5ICsKKyAgICAgICAgICAgICAgICAgICAgICAgICIsIG5vdGVUeXBlPSIgKyBtUG9saWN5Tm90aWZpY2F0aW9uc0FsbG93ZWRNYXNrICsgIiwgbWF4TnRwQ2FjaGVBZ2U9IiArCisgICAgICAgICAgICAgICAgICAgICAgICBtTWF4TnRwQ2FjaGVBZ2VTZWMpOwogICAgICAgICAgICAgfQogCiAgICAgICAgICAgICAvLyBmb3JjZSB1cGRhdGVzCi0gICAgICAgICAgICBtVGhyb3R0bGVJbmRleCA9IFRIUk9UVExFX0lOREVYX1VOSU5JVElBTElaRUQ7CisgICAgICAgICAgICBtVGhyb3R0bGVJbmRleC5zZXQoVEhST1RUTEVfSU5ERVhfVU5JTklUSUFMSVpFRCk7CiAKICAgICAgICAgICAgIG9uUmVzZXRBbGFybSgpOwogCkBAIC00ODcsNyArNDk0LDcgQEAKICAgICAgICAgICAgIGxvbmcgcGVyaW9kUnggPSBtUmVjb3JkZXIuZ2V0UGVyaW9kUngoMCk7CiAgICAgICAgICAgICBsb25nIHBlcmlvZFR4ID0gbVJlY29yZGVyLmdldFBlcmlvZFR4KDApOwogICAgICAgICAgICAgbG9uZyB0b3RhbCA9IHBlcmlvZFJ4ICsgcGVyaW9kVHg7Ci0gICAgICAgICAgICBpZiAoVkRCRyB8fCAobVBvbGljeVRocmVzaG9sZCAhPSAwKSkgeworICAgICAgICAgICAgaWYgKFZEQkcgfHwgKG1Qb2xpY3lUaHJlc2hvbGQuZ2V0KCkgIT0gMCkpIHsKICAgICAgICAgICAgICAgICBTbG9nLmQoVEFHLCAib25Qb2xsQWxhcm0gLSByb2FtaW5nID0iICsgcm9hbWluZyArCiAgICAgICAgICAgICAgICAgICAgICAgICAiLCByZWFkID0iICsgaW5jUmVhZCArICIsIHdyaXR0ZW4gPSIgKyBpbmNXcml0ZSArICIsIG5ldyB0b3RhbCA9IiArIHRvdGFsKTsKICAgICAgICAgICAgIH0KQEAgLTUxMCwxMSArNTE3LDExIEBACiAgICAgICAgIHByaXZhdGUgdm9pZCBvbklmYWNlVXAoKSB7CiAgICAgICAgICAgICAvLyBpZiB3ZSB3ZXJlIHRocm90dGxlZCBiZWZvcmUsIGJlIHN1cmUgYW5kIHNldCBpdCBhZ2FpbiAtIHRoZSBpZmFjZSB3ZW50IGRvd24KICAgICAgICAgICAgIC8vIChhbmQgbWF5IGhhdmUgZGlzYXBwZWFyZWQgYWxsIHRvZ2V0aGVyKSBhbmQgdGhlc2Ugc2V0dGluZ3Mgd2VyZSBsb3N0Ci0gICAgICAgICAgICBpZiAobVRocm90dGxlSW5kZXggPT0gMSkgeworICAgICAgICAgICAgaWYgKG1UaHJvdHRsZUluZGV4LmdldCgpID09IDEpIHsKICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICBtTk1TZXJ2aWNlLnNldEludGVyZmFjZVRocm90dGxlKG1JZmFjZSwgLTEsIC0xKTsKICAgICAgICAgICAgICAgICAgICAgbU5NU2VydmljZS5zZXRJbnRlcmZhY2VUaHJvdHRsZShtSWZhY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbVBvbGljeVRocm90dGxlVmFsdWUsIG1Qb2xpY3lUaHJvdHRsZVZhbHVlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtUG9saWN5VGhyb3R0bGVWYWx1ZS5nZXQoKSwgbVBvbGljeVRocm90dGxlVmFsdWUuZ2V0KCkpOwogICAgICAgICAgICAgICAgIH0gY2F0Y2ggKEV4Y2VwdGlvbiBlKSB7CiAgICAgICAgICAgICAgICAgICAgIFNsb2cuZShUQUcsICJlcnJvciBzZXR0aW5nIFRocm90dGxlOiAiICsgZSk7CiAgICAgICAgICAgICAgICAgfQpAQCAtNTIzLDcgKzUzMCw4IEBACiAKICAgICAgICAgcHJpdmF0ZSB2b2lkIGNoZWNrVGhyb3R0bGVBbmRQb3N0Tm90aWZpY2F0aW9uKGxvbmcgY3VycmVudFRvdGFsKSB7CiAgICAgICAgICAgICAvLyBpcyB0aHJvdHRsaW5nIGVuYWJsZWQ/Ci0gICAgICAgICAgICBpZiAobVBvbGljeVRocmVzaG9sZCA9PSAwKSB7CisgICAgICAgICAgICBsb25nIHRocmVzaG9sZCA9IG1Qb2xpY3lUaHJlc2hvbGQuZ2V0KCk7CisgICAgICAgICAgICBpZiAodGhyZXNob2xkID09IDApIHsKICAgICAgICAgICAgICAgICBjbGVhclRocm90dGxlQW5kTm90aWZpY2F0aW9uKCk7CiAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgfQpAQCAtNTM1LDE1ICs1NDMsMTMgQEAKICAgICAgICAgICAgIH0KIAogICAgICAgICAgICAgLy8gY2hlY2sgaWYgd2UgbmVlZCB0byB0aHJvdHRsZQotICAgICAgICAgICAgaWYgKGN1cnJlbnRUb3RhbCA+IG1Qb2xpY3lUaHJlc2hvbGQpIHsKLSAgICAgICAgICAgICAgICBpZiAobVRocm90dGxlSW5kZXggIT0gMSkgewotICAgICAgICAgICAgICAgICAgICBzeW5jaHJvbml6ZWQgKFRocm90dGxlU2VydmljZS50aGlzKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBtVGhyb3R0bGVJbmRleCA9IDE7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgaWYgKERCRykgU2xvZy5kKFRBRywgIlRocmVzaG9sZCAiICsgbVBvbGljeVRocmVzaG9sZCArICIgZXhjZWVkZWQhIik7CisgICAgICAgICAgICBpZiAoY3VycmVudFRvdGFsID4gdGhyZXNob2xkKSB7CisgICAgICAgICAgICAgICAgaWYgKG1UaHJvdHRsZUluZGV4LmdldCgpICE9IDEpIHsKKyAgICAgICAgICAgICAgICAgICAgbVRocm90dGxlSW5kZXguc2V0KDEpOworICAgICAgICAgICAgICAgICAgICBpZiAoREJHKSBTbG9nLmQoVEFHLCAiVGhyZXNob2xkICIgKyB0aHJlc2hvbGQgKyAiIGV4Y2VlZGVkISIpOwogICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICAgbU5NU2VydmljZS5zZXRJbnRlcmZhY2VUaHJvdHRsZShtSWZhY2UsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Qb2xpY3lUaHJvdHRsZVZhbHVlLCBtUG9saWN5VGhyb3R0bGVWYWx1ZSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Qb2xpY3lUaHJvdHRsZVZhbHVlLmdldCgpLCBtUG9saWN5VGhyb3R0bGVWYWx1ZS5nZXQoKSk7CiAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKEV4Y2VwdGlvbiBlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBTbG9nLmUoVEFHLCAiZXJyb3Igc2V0dGluZyBUaHJvdHRsZTogIiArIGUpOwogICAgICAgICAgICAgICAgICAgICB9CkBAIC01NTYsNyArNTYyLDggQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOb3RpZmljYXRpb24uRkxBR19PTkdPSU5HX0VWRU5UKTsKIAogICAgICAgICAgICAgICAgICAgICBJbnRlbnQgYnJvYWRjYXN0ID0gbmV3IEludGVudChUaHJvdHRsZU1hbmFnZXIuVEhST1RUTEVfQUNUSU9OKTsKLSAgICAgICAgICAgICAgICAgICAgYnJvYWRjYXN0LnB1dEV4dHJhKFRocm90dGxlTWFuYWdlci5FWFRSQV9USFJPVFRMRV9MRVZFTCwgbVBvbGljeVRocm90dGxlVmFsdWUpOworICAgICAgICAgICAgICAgICAgICBicm9hZGNhc3QucHV0RXh0cmEoVGhyb3R0bGVNYW5hZ2VyLkVYVFJBX1RIUk9UVExFX0xFVkVMLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Qb2xpY3lUaHJvdHRsZVZhbHVlLmdldCgpKTsKICAgICAgICAgICAgICAgICAgICAgbUNvbnRleHQuc2VuZFN0aWNreUJyb2FkY2FzdChicm9hZGNhc3QpOwogCiAgICAgICAgICAgICAgICAgfSAvLyBlbHNlIGFscmVhZHkgdXAhCkBAIC01NzksOCArNTg2LDggQEAKICAgICAgICAgICAgICAgICAgICAgbG9uZyBwZXJpb2RMZW5ndGggPSBlbmQgLSBzdGFydDsKICAgICAgICAgICAgICAgICAgICAgbG9uZyBub3cgPSBTeXN0ZW0uY3VycmVudFRpbWVNaWxsaXMoKTsKICAgICAgICAgICAgICAgICAgICAgbG9uZyB0aW1lVXNlZCA9IG5vdyAtIHN0YXJ0OwotICAgICAgICAgICAgICAgICAgICBsb25nIHdhcm5pbmdUaHJlc2hvbGQgPSAyKm1Qb2xpY3lUaHJlc2hvbGQqdGltZVVzZWQvKHRpbWVVc2VkK3BlcmlvZExlbmd0aCk7Ci0gICAgICAgICAgICAgICAgICAgIGlmICgoY3VycmVudFRvdGFsID4gd2FybmluZ1RocmVzaG9sZCkgJiYgKGN1cnJlbnRUb3RhbCA+IG1Qb2xpY3lUaHJlc2hvbGQvNCkpIHsKKyAgICAgICAgICAgICAgICAgICAgbG9uZyB3YXJuaW5nVGhyZXNob2xkID0gMip0aHJlc2hvbGQqdGltZVVzZWQvKHRpbWVVc2VkK3BlcmlvZExlbmd0aCk7CisgICAgICAgICAgICAgICAgICAgIGlmICgoY3VycmVudFRvdGFsID4gd2FybmluZ1RocmVzaG9sZCkgJiYgKGN1cnJlbnRUb3RhbCA+IHRocmVzaG9sZC80KSkgewogICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1XYXJuaW5nTm90aWZpY2F0aW9uU2VudCA9PSBmYWxzZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1XYXJuaW5nTm90aWZpY2F0aW9uU2VudCA9IHRydWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbU5vdGlmaWNhdGlvbk1hbmFnZXIuY2FuY2VsKFIuZHJhd2FibGUuc3RhdF9zeXNfdGhyb3R0bGVkKTsKQEAgLTYyNSwxMSArNjMyLDkgQEAKICAgICAgICAgfQogCiAKLSAgICAgICAgcHJpdmF0ZSBzeW5jaHJvbml6ZWQgdm9pZCBjbGVhclRocm90dGxlQW5kTm90aWZpY2F0aW9uKCkgewotICAgICAgICAgICAgaWYgKG1UaHJvdHRsZUluZGV4ICE9IFRIUk9UVExFX0lOREVYX1VOVEhST1RUTEVEKSB7Ci0gICAgICAgICAgICAgICAgc3luY2hyb25pemVkIChUaHJvdHRsZVNlcnZpY2UudGhpcykgewotICAgICAgICAgICAgICAgICAgICBtVGhyb3R0bGVJbmRleCA9IFRIUk9UVExFX0lOREVYX1VOVEhST1RUTEVEOwotICAgICAgICAgICAgICAgIH0KKyAgICAgICAgcHJpdmF0ZSB2b2lkIGNsZWFyVGhyb3R0bGVBbmROb3RpZmljYXRpb24oKSB7CisgICAgICAgICAgICBpZiAobVRocm90dGxlSW5kZXguZ2V0KCkgIT0gVEhST1RUTEVfSU5ERVhfVU5USFJPVFRMRUQpIHsKKyAgICAgICAgICAgICAgICBtVGhyb3R0bGVJbmRleC5zZXQoVEhST1RUTEVfSU5ERVhfVU5USFJPVFRMRUQpOwogICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgIG1OTVNlcnZpY2Uuc2V0SW50ZXJmYWNlVGhyb3R0bGUobUlmYWNlLCAtMSwgLTEpOwogICAgICAgICAgICAgICAgIH0gY2F0Y2ggKEV4Y2VwdGlvbiBlKSB7CkBAIC02ODcsMTIgKzY5MiwxMiBAQAogICAgICAgICB9CiAKICAgICAgICAgcHJpdmF0ZSB2b2lkIG9uUmVzZXRBbGFybSgpIHsKLSAgICAgICAgICAgIGlmIChWREJHIHx8IChtUG9saWN5VGhyZXNob2xkICE9IDApKSB7CisgICAgICAgICAgICBpZiAoVkRCRyB8fCAobVBvbGljeVRocmVzaG9sZC5nZXQoKSAhPSAwKSkgewogICAgICAgICAgICAgICAgIFNsb2cuZChUQUcsICJvblJlc2V0QWxhcm0gLSBsYXN0IHBlcmlvZ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gICAgcmV0dXJuOwogICAgICAgICAgICAgfQotICAgICAgICAgICAgc3luY2hyb25pemVkIChtUGFyZW50KSB7Ci0gICAgICAgICAgICAgICAgU3RyaW5nW10gcGFyc2VkID0gZGF0YS5zcGxpdCgiOiIpOwotICAgICAgICAgICAgICAgIGludCBwYXJzZWRVc2VkID0gMDsKLSAgICAgICAgICAgICAgICBpZiAocGFyc2VkLmxlbmd0aCA8IDYpIHsKLSAgICAgICAgICAgICAgICAgICAgU2xvZy5lKFRBRywgInJlYWRpbmcgZGF0YSBmaWxlIHdpdGggaW5zdWZmaWNpZW50IGxlbmd0aCAtIGlnbm9yaW5nIik7Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICBTdHJpbmdbXSBwYXJzZWQgPSBkYXRhLnNwbGl0KCI6Iik7CisgICAgICAgICAgICBpbnQgcGFyc2VkVXNlZCA9IDA7CisgICAgICAgICAgICBpZiAocGFyc2VkLmxlbmd0aCA8IDYpIHsKKyAgICAgICAgICAgICAgICBTbG9nLmUoVEFHLCAicmVhZGluZyBkYXRhIGZpbGUgd2l0aCBpbnN1ZmZpY2llbnQgbGVuZ3RoIC0gaWdub3JpbmciKTsKKyAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICB9CiAKKyAgICAgICAgICAgIGludCBwZXJpb2RDb3VudDsKKyAgICAgICAgICAgIGxvbmdbXSBwZXJpb2RSeERhdGE7CisgICAgICAgICAgICBsb25nW10gcGVyaW9kVHhEYXRhOworICAgICAgICAgICAgaW50IGN1cnJlbnRQZXJpb2Q7CisgICAgICAgICAgICBDYWxlbmRhciBwZXJpb2RTdGFydDsKKyAgICAgICAgICAgIENhbGVuZGFyIHBlcmlvZEVuZDsKKyAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgaWYgKEludGVnZXIucGFyc2VJbnQocGFyc2VkW3BhcnNlZFVzZWQrK10pICE9IERBVEFfRklMRV9WRVJTSU9OKSB7CiAgICAgICAgICAgICAgICAgICAgIFNsb2cuZShUQUcsICJyZWFkaW5nIGRhdGEgZmlsZSB3aXRoIGJhZCB2ZXJzaW9uIC0gaWdub3JpbmciKTsKICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgICAgIG1QZXJpb2RDb3VudCA9IEludGVnZXIucGFyc2VJbnQocGFyc2VkW3BhcnNlZFVzZWQrK10pOwotICAgICAgICAgICAgICAgIGlmIChwYXJzZWQubGVuZ3RoICE9IDUgKyAoMiAqIG1QZXJpb2RDb3VudCkpIHsKKyAgICAgICAgICAgICAgICBwZXJpb2RDb3VudCA9IEludGVnZXIucGFyc2VJbnQocGFyc2VkW3BhcnNlZFVzZWQrK10pOworICAgICAgICAgICAgICAgIGlmIChwYXJzZWQubGVuZ3RoICE9IDUgKyAoMiAqIHBlcmlvZENvdW50KSkgewogICAgICAgICAgICAgICAgICAgICBTbG9nLmUoVEFHLCAicmVhZGluZyBkYXRhIGZpbGUgd2l0aCBiYWQgbGVuZ3RoICgiICsgcGFyc2VkLmxlbmd0aCArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgIiAhPSAiICsgKDUrKDIqbVBlcmlvZENvdW50KSkgKyAiKSAtIGlnbm9yaW5nIik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIiAhPSAiICsgKDUgKyAoMiAqIHBlcmlvZENvdW50KSkgKyAiKSAtIGlnbm9yaW5nIik7CiAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcGVyaW9kUnhEYXRhID0gbmV3IGxvbmdbcGVyaW9kQ291bnRdOworICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgcGVyaW9kQ291bnQ7IGkrKykgeworICAgICAgICAgICAgICAgICAgICBwZXJpb2RSeERhdGFbaV0gPSBMb25nLnBhcnNlTG9uZyhwYXJzZWRbcGFyc2VkVXNlZCsrXSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHBlcmlvZFR4RGF0YSA9IG5ldyBsb25nW3BlcmlvZENvdW50XTsKKyAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IHBlcmlvZENvdW50OyBpKyspIHsKKyAgICAgICAgICAgICAgICAgICAgcGVyaW9kVHhEYXRhW2ldID0gTG9uZy5wYXJzZUxvbmcocGFyc2VkW3BhcnNlZFVzZWQrK10pOworICAgICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgICAgIG1QZXJpb2RSeERhdGEgPSBuZXcgbG9uZ1ttUGVyaW9kQ291bnRdOwotICAgICAgICAgICAgICAgIGZvcihpbnQgaSA9IDA7IGkgPCBtUGVyaW9kQ291bnQ7IGkrKykgewotICAgICAgICAgICAgICAgICAgICBtUGVyaW9kUnhEYXRhW2ldID0gTG9uZy5wYXJzZUxvbmcocGFyc2VkW3BhcnNlZFVzZWQrK10pOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBtUGVyaW9kVHhEYXRhID0gbmV3IGxvbmdbbVBlcmlvZENvdW50XTsKLSAgICAgICAgICAgICAgICBmb3IoaW50IGkgPSAwOyBpIDwgbVBlcmlvZENvdW50OyBpKyspIHsKLSAgICAgICAgICAgICAgICAgICAgbVBlcmlvZFR4RGF0YVtpXSA9IExvbmcucGFyc2VMb25nKHBhcnNlZFtwYXJzZWRVc2VkKytdKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgbUN1cnJlbnRQZXJpb2QgPSBJbnRlZ2VyLnBhcnNlSW50KHBhcnNlZFtwYXJzZWRVc2VkKytdKTsKLSAgICAgICAgICAgICAgICBtUGVyaW9kU3RhcnQgPSBuZXcgR3JlZ29yaWFuQ2FsZW5kYXIoKTsKLSAgICAgICAgICAgICAgICBtUGVyaW9kU3RhcnQuc2V0VGltZUluTWlsbGlzKExvbmcucGFyc2VMb25nKHBhcnNlZFtwYXJzZWRVc2VkKytdKSk7Ci0gICAgICAgICAgICAgICAgbVBlcmlvZEVuZCA9IG5ldyBHcmVnb3JpYW5DYWxlbmRhcigpOwotICAgICAgICAgICAgICAgIG1QZXJpb2RFbmQuc2V0VGltZUluTWlsbGlzKExvbmcucGFyc2VMb25nKHBhcnNlZFtwYXJzZWRVc2VkKytdKSk7CisgICAgICAgICAgICAgICAgY3VycmVudFBlcmlvZCA9IEludGVnZXIucGFyc2VJbnQocGFyc2VkW3BhcnNlZFVzZWQrK10pOworCisgICAgICAgICAgICAgICAgcGVyaW9kU3RhcnQgPSBuZXcgR3JlZ29yaWFuQ2FsZW5kYXIoKTsKKyAgICAgICAgICAgICAgICBwZXJpb2RTdGFydC5zZXRUaW1lSW5NaWxsaXMoTG9uZy5wYXJzZUxvbmcocGFyc2VkW3BhcnNlZFVzZWQrK10pKTsKKyAgICAgICAgICAgICAgICBwZXJpb2RFbmQgPSBuZXcgR3JlZ29yaWFuQ2FsZW5kYXIoKTsKKyAgICAgICAgICAgICAgICBwZXJpb2RFbmQuc2V0VGltZUluTWlsbGlzKExvbmcucGFyc2VMb25nKHBhcnNlZFtwYXJzZWRVc2VkKytdKSk7CisgICAgICAgICAgICB9IGNhdGNoIChFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgIFNsb2cuZShUQUcsICJFcnJvciBwYXJzaW5nIGRhdGEgZmlsZSAtIGlnbm9yaW5nIik7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorICAgICAgICAgICAgc3luY2hyb25pemVkIChtUGFyZW50KSB7CisgICAgICAgICAgICAgICAgbVBlcmlvZENvdW50ID0gcGVyaW9kQ291bnQ7CisgICAgICAgICAgICAgICAgbVBlcmlvZFJ4RGF0YSA9IHBlcmlvZFJ4RGF0YTsKKyAgICAgICAgICAgICAgICBtUGVyaW9kVHhEYXRhID0gcGVyaW9kVHhEYXRhOworICAgICAgICAgICAgICAgIG1DdXJyZW50UGVyaW9kID0gY3VycmVudFBlcmlvZDsKKyAgICAgICAgICAgICAgICBtUGVyaW9kU3RhcnQgPSBwZXJpb2RTdGFydDsKKyAgICAgICAgICAgICAgICBtUGVyaW9kRW5kID0gcGVyaW9kRW5kOwogICAgICAgICAgICAgfQogICAgICAgICB9CiAKQEAgLTEwOTEsMTUgKzExMTcsMTUgQEAKICAgICAgICAgfQogICAgICAgICBwdy5wcmludGxuKCk7CiAKLSAgICAgICAgcHcucHJpbnRsbigiVGhlIHRocmVzaG9sZCBpcyAiICsgbVBvbGljeVRocmVzaG9sZCArCisgICAgICAgIHB3LnByaW50bG4oIlRoZSB0aHJlc2hvbGQgaXMgIiArIG1Qb2xpY3lUaHJlc2hvbGQuZ2V0KCkgKwogICAgICAgICAgICAgICAgICIsIGFmdGVyIHdoaWNoIHlvdSBleHBlcmluY2UgdGhyb3R0bGluZyB0byAiICsKLSAgICAgICAgICAgICAgICBtUG9saWN5VGhyb3R0bGVWYWx1ZSArICJrYnBzIik7CisgICAgICAgICAgICAgICAgbVBvbGljeVRocm90dGxlVmFsdWUuZ2V0KCkgKyAia2JwcyIpOwogICAgICAgICBwdy5wcmludGxuKCJDdXJyZW50IHBlcmlvZCBpcyAiICsKICAgICAgICAgICAgICAgICAobVJlY29yZGVyLmdldFBlcmlvZEVuZCgpIC0gbVJlY29yZGVyLmdldFBlcmlvZFN0YXJ0KCkpLzEwMDAgKyAiIHNlY29uZHMgbG9uZyAiICsKICAgICAgICAgICAgICAgICAiYW5kIGVuZHMgaW4gIiArIChnZXRSZXNldFRpbWUobUlmYWNlKSAtIFN5c3RlbS5jdXJyZW50VGltZU1pbGxpcygpKSAvIDEwMDAgKwogICAgICAgICAgICAgICAgICIgc2Vjb25kcy4iKTsKICAgICAgICAgcHcucHJpbnRsbigiUG9sbGluZyBldmVyeSAiICsgbVBvbGljeVBvbGxQZXJpb2RTZWMgKyAiIHNlY29uZHMiKTsKLSAgICAgICAgcHcucHJpbnRsbigiQ3VycmVudCBUaHJvdHRsZ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GJhY2sgb24gdXNiQ2FtZXJhQWRkZWQgYW5kIHVzYkNhbWVyYVJlbW92ZWQuCisgICAgICAgIFJ1bm5hYmxlIHJ1bm5hYmxlID0gbmV3IFJ1bm5hYmxlKCkgeworICAgICAgICAgICAgcHVibGljIHZvaWQgcnVuKCkgeworICAgICAgICAgICAgICAgIG1vbml0b3JVc2JIb3N0QnVzKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH07CisgICAgICAgIG5ldyBUaHJlYWQobnVsbCwgcnVubmFibGUsICJVc2JPYnNlcnZlciBob3N0IHRocmVhZCIpLnN0YXJ0KCk7CisgICAgfQorCiAgICAgdm9pZCBzeXN0ZW1SZWFkeSgpIHsKICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CisgICAgICAgICAgICBpZiAobUNvbnRleHQuZ2V0UmVzb3VyY2VzKCkuZ2V0Qm9vbGVhbigKKyAgICAgICAgICAgICAgICAgICAgY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5ib29sLmNvbmZpZ19oYXNVc2JIb3N0U3VwcG9ydCkpIHsKKyAgICAgICAgICAgICAgICAvLyBzdGFydCBtb25pdG9yaW5nIGZvciBjb25uZWN0ZWQgVVNCIGRldmljZXMKKyAgICAgICAgICAgICAgICBpbml0SG9zdFN1cHBvcnQoKTsKKyAgICAgICAgICAgIH0KKwogICAgICAgICAgICAgdXBkYXRlKCk7CiAgICAgICAgICAgICBtU3lzdGVtUmVhZHkgPSB0cnVlOwogICAgICAgICB9CmRpZmYgLS1naXQgYS9zZXJ2aWNlcy9qYXZhL2NvbS9hbmRyb2lkL3NlcnZlci9XaWZpU2VydmljZS5qYXZhIGIvc2VydmljZXMvamF2YS9jb20vYW5kcm9pZC9zZXJ2ZXIvV2lmaVNlcnZpY2UuamF2YQppbmRleCAwZWNhMDgyLi42ZWNjNTExIDEwMDY0NAotLS0gYS9zZXJ2aWNlcy9qYXZhL2NvbS9hbmRyb2lkL3NlcnZlci9XaWZpU2VydmljZS5qYXZhCisr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MgZmluYWwgaW50IElDT05fTkVUV09SS1NfQVZBSUxBQkxFID0KKyAgICAgICAgICAgIGNvbS5hbmRyb2lkLmludGVybmFsLlIuZHJhd2FibGUuc3RhdF9ub3RpZnlfd2lmaV9pbl9yYW5nZTsKKyAgICAvKioKKyAgICAgKiBXaGVuIGEgbm90aWZpY2F0aW9uIGlzIHNob3duLCB3ZSB3YWl0IHRoaXMgYW1vdW50IGJlZm9yZSBwb3NzaWJseSBzaG93aW5nIGl0IGFnYWluLgorICAgICAqLworICAgIHByaXZhdGUgZmluYWwgbG9uZyBOT1RJRklDQVRJT05fUkVQRUFUX0RFTEFZX01TOworICAgIC8qKgorICAgICAqIFdoZXRoZXIgdGhlIHVzZXIgaGFzIHNldCB0aGUgc2V0dGluZyB0byBzaG93IHRoZSAnYXZhaWxhYmxlIG5ldHdvcmtzJyBub3RpZmljYXRpb24uCisgICAgICovCisgICAgcHJpdmF0ZSBib29sZWFuIG1Ob3RpZmljYXRpb25FbmFibGVkOworICAgIC8qKgorICAgICAqIE9ic2VydmVzIHRoZSB1c2VyIHNldHRpbmcgdG8ga2VlcCB7QGxpbmsgI21Ob3RpZmljYXRpb25FbmFibGVkfSBpbiBzeW5jLgorICAgICAqLworICAgIHByaXZhdGUgTm90aWZpY2F0aW9uRW5hYmxlZFNldHRpbmdPYnNlcnZlciBtTm90aWZpY2F0aW9uRW5hYmxlZFNldHRpbmdPYnNlcnZlcjsKKyAgICAvKioKKyAgICAgKiBUaGUge0BsaW5rIFN5c3RlbSNjdXJyZW50VGltZU1pbGxpcygpfSBtdXN0IGJlIGF0IGxlYXN0IHRoaXMgdmFsdWUgZm9yIHVzCisgICAgICogdG8gc2hvdyB0aGUgbm90aWZpY2F0aW9uIGFnYWluLgorICAgICAqLworICAgIHByaXZhdGUgbG9uZyBtTm90aWZpY2F0aW9uUmVwZWF0VGltZTsKKyAgICAvKioKKyAgICAgKiBUaGUgTm90aWZpY2F0aW9uIG9iamVjdCBnaXZlbiB0byB0aGUg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gICAgLy8gb24gYWlycGxhbmUgZGlzYWJsZSwgcmVzdG9yZSBXaWZpIGlmIHRoZSBzYXZlZCBzdGF0ZSBpbmRpY2F0ZXMgc28KICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghaXNBaXJwbGFuZU1vZGVPbigpICYmIHRlc3RBbmRDbGVhcldpZmlTYXZlZFN0YXRlKCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwZXJzaXN0V2lmaUVuYWJsZWQodHJ1ZSk7CkBAIC0yNjMsMTQgKzIxNiw1MCBAQAogICAgICAgICAgICAgICAgIEBPdmVycmlkZQogICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIG9uUmVjZWl2ZShDb250ZXh0IGNvbnRleHQsIEludGVudCBpbnRlbnQpIHsKIAotICAgICAgICAgICAgICAgICAgQXJyYXlMaXN0PFN0cmluZz4gYXZhaWxhYmxlID0gaW50ZW50LmdldFN0cmluZ0FycmF5TGlzdEV4dHJhKAotICAgICAgICAgICAgICAgICAgICAgICAgICBDb25uZWN0aXZpdHlNYW5hZ2VyLkVYVFJBX0FWQUlMQUJMRV9URVRIRVIpOwotICAgICAgICAgICAgICAgICAgQXJyYXlMaXN0PFN0cmluZz4gYWN0aXZlID0gaW50ZW50LmdldFN0cmluZ0FycmF5TGlzdEV4dHJhKAotICAgICAgICAgICAgICAgICAgICAgICAgICBDb25uZWN0aXZpdHlNYW5hZ2VyLkVYVFJBX0FDVElWRV9URVRIRVIpOwotICAgICAgICAgICAgICAgICAgdXBkYXRlVGV0aGVyU3RhdGUoYXZhaWxhYmxlLCBhY3RpdmUpOworICAgICAgICAgICAgICAgICAgICBBcnJheUxpc3Q8U3RyaW5nPiBhdmFpbGFibGUgPSBpbnRlbnQuZ2V0U3RyaW5nQXJyYXlMaXN0RXh0cmEoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ29ubmVjdGl2aXR5TWFuYWdlci5FWFRSQV9BVkFJTEFCTEVfVEVUSEVSKTsKKyAgICAgICAgICAgICAgICAgICAgQXJyYXlMaXN0PFN0cmluZz4gYWN0aXZlID0gaW50ZW50LmdldFN0cmluZ0FycmF5TGlzdEV4dHJhKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIENvbm5lY3Rpdml0eU1hbmFnZXIuRVhUUkFfQUNUSVZFX1RFVEhFUik7CisgICAgICAgICAgICAgICAgICAgIHVwZGF0ZVRldGhlclN0YXRlKGF2YWlsYWJsZSwgYWN0aXZlKTsKIAogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0sbmV3IEludGVudEZpbHRlcihDb25uZWN0aXZpdHlNYW5hZ2VyLkFDVElPTl9URVRIRVJfU1RBVEVfQ0hBTkdFRCkpOworCisgICAgICAgIEludGVudEZpbHRlciBmaWx0ZXIgPSBuZXcgSW50ZW50RmlsdGVyKCk7CisgICAgICAgIGZpbHRlci5hZGRBY3Rpb24oV2lmaU1hbmFnZXIuV0lGSV9TVEFURV9DSEFOR0VEX0FDVElPTik7CisgICAgICAgIGZpbHRlci5hZGRBY3Rpb24oV2lmaU1hbmFnZXIuTkVUV09SS19TVEFURV9DSEFOR0VEX0FDVElPTik7CisgICAgICAgIGZpbHRlci5hZGRBY3Rpb24oV2lmaU1hbmFnZXIuU0NBTl9SRVNVTFRTX0FWQUlMQUJMRV9BQ1RJT04pOworCisgICAgICAgIG1Db250ZXh0LnJlZ2lzdGVyUmVjZWl2ZXIoCisgICAgICAgICAgICAgICAgbmV3IEJyb2FkY2FzdFJlY2VpdmVyKCkgeworICAgICAgICAgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgICAgICAgICAgcHVibGljIHZvaWQgb25SZWNlaXZlKENvbnRleHQgY29udGV4dCwgSW50ZW50IGludGVudCkgeworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGludGVudC5nZXRBY3Rpb24oKS5lcXVhbHMoV2lmaU1hbmFnZXIuV0lGSV9TVEFURV9DSEFOR0VEX0FDVElPTikpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyByZXNldCAmIGNsZWFyIG5vdGlmaWNhdGlvbiBvbiBhbnkgd2lmaSBzdGF0ZSBjaGFuZ2UKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXNldE5vdGlmaWNhdGlvbigpOworICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChpbnRlbnQuZ2V0QWN0aW9uKCkuZXF1YWxzKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBXaWZpTWFuYWdlci5ORVRXT1JLX1NUQVRFX0NIQU5HRURfQUNUSU9OKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1OZXR3b3JrSW5mbyA9IChOZXR3b3JrSW5mbykgaW50ZW50LmdldFBhcmNlbGFibGVFeHRyYSgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFdpZmlNYW5hZ2VyLkVYVFJBX05FVFdPUktfSU5GTyk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gcmVzZXQgJiBjbGVhciBub3RpZmljYXRpb24gb24gYSBuZXR3b3JrIGNvbm5lY3QgJiBkaXNjb25uZWN0CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3dpdGNoKG1OZXR3b3JrSW5mby5nZXREZXRhaWxlZFN0YXRlKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBDT05ORUNURUQ6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgRElTQ09OTkVDVEVEOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzZXROb3RpZmljYXRpb24oKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoaW50ZW50LmdldEFjdGlvbigpLmVxdWFscygKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgV2lmaU1hbmFnZXIuU0NBTl9SRVNVTFRTX0FWQUlMQUJMRV9BQ1RJT04pKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hlY2tBbmRTZXROb3RpZmljYXRpb24oKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0sIGZpbHRlcik7CisKKyAgICAgICAgLy8gU2V0dGluZyBpcyBpbiBzZWNvbmRzCisgICAgICAgIE5PVElGSUNBVElPTl9SRVBFQVRfREVMQVlfTVMgPSBTZXR0aW5ncy5TZWN1cmUuZ2V0SW50KGNvbnRleHQuZ2V0Q29udGVudFJlc29sdmVyKCksCisgICAgICAgICAgICAgICAgU2V0dGluZ3MuU2VjdXJlLldJRklfTkVUV09SS1NfQVZBSUxBQkxFX1JFUEVBVF9ERUxBWSwgOTAwKSAqIDEwMDBsOworICAgICAgICBtTm90aWZpY2F0aW9uRW5hYmxlZFNldHRpbmdPYnNlcnZlciA9IG5ldyBOb3RpZmljYXRpb25FbmFibGVkU2V0dGluZ09ic2VydmVyKG5ldyBIYW5kbGVyKCkpOworICAgICAgICBtTm90aWZpY2F0aW9uRW5hYmxlZFNldHRpbmdPYnNlcnZlci5yZWdpc3RlcigpOwogICAgIH0KIAogICAgIC8qKgpAQCAtMjc5LDcgKzI2OCw3IEBACiAgICAgICoKICAgICAgKiBUaGlzIGZ1bmN0aW9uIGlzIHVzZWQgb25seSBhdCBib290IHRpbWUKICAgICAgKi8KLSAgICBwdWJsaWMgdm9pZCBzdGFydFdpZmkoKSB7CisgICAgcHVibGljIHZvaWQgY2hlY2tBbmRTdGFydFdpZmkoKSB7CiAgICAgICAgIC8qIFN0YXJ0IGlmIFdpLUZpIGlzIGVuYWJsZWQgb3IgdGhlIHNhdmVkIHN0YXRlIGluZGljYXRlcyBXaS1GaSB3YXMgb24gKi8KICAgICAgICAgYm9vbGVhbiB3aWZpRW5hYmxlZCA9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ewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG53U2VydmljZS5zdG9wQWNjZXNzUG9pbnQoKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKEV4Y2VwdGlvbiBlZSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNsb2cuZShUQUcsICJDb3VsZCBub3Qgc3RvcCBBUCwgOiIgKyBlZSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICBzZXRXaWZpQXBFbmFibGVkU3RhdGUoV0lGSV9BUF9TVEFURV9GQUlMRUQsIDAsIERyaXZlckFjdGlvbi5EUklWRVJfVU5MT0FEKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHNldFdpZmlBcEVuYWJsZWQobnVsbCwgZmFsc2UpOwogICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgICB9CiAKICAgICAgICAgICAgICAgICAgICAgaWYobUNtLnRldGhlcihpbnRmKSAhPSBDb25uZWN0aXZpdHlNYW5hZ2VyLlRFVEhFUl9FUlJPUl9OT19FUlJPUikgewotICAgICAgICAgICAgICAgICAgICAgICAgU2xvZy5lKFRBRywgIkVycm9yIHRldGhlcmluZyAiK2ludGYpOworICAgICAgICAgICAgICAgICAgICAgICAgU2xvZy5lKFRBRywgIkVycm9yIHRldGhlcmluZyBvbiAiICsgaW50Zik7CisgICAgICAgICAgICAgICAgICAgICAgICBzZXRXaWZpQXBFbmFibGVkKG51bGwsIGZhbHNlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICB9CkBAIC0zNjIsMTkwICszNTEsMjEgQEAKICAgICAgICAgU2V0dGluZ3MuU2VjdXJlLnB1dEludChjciwgU2V0dGluZ3MuU2VjdXJlLldJRklfT04sIGVuYWJsZWQgPyAxIDog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BpZiAoIW1XaWZpU3RhdGVUcmFja2VyLmxvYWREcml2ZXIoKSkgewotICAgICAgICAgICAgICAgIFNsb2cuZShUQUcsICJGYWlsZWQgdG8gbG9hZCBXaS1GaSBkcml2ZXIuIik7Ci0gICAgICAgICAgICAgICAgc2V0V2lmaUVuYWJsZWRTdGF0ZShXSUZJX1NUQVRFX1VOS05PV04sIHVpZCk7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgaWYgKCFtV2lmaVN0YXRlVHJhY2tlci5zdGFydFN1cHBsaWNhbnQoKSkgewotICAgICAgICAgICAgICAgIG1XaWZpU3RhdGVUcmFja2VyLnVubG9hZERyaXZlcigpOwotICAgICAgICAgICAgICAgIFNsb2cuZShUQUcsICJGYWlsZWQgdG8gc3RhcnQgc3VwcGxpY2FudCBkYWVtb24uIik7Ci0gICAgICAgICAgICAgICAgc2V0V2lmaUVuYWJsZWRTdGF0ZShXSUZJX1NUQVRFX1VOS05PV04sIHVpZCk7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICByZWdpc3RlckZvckJyb2FkY2FzdHMoKTsKLSAgICAgICAgICAgIG1XaWZpU3RhdGVUcmFja2VyLnN0YXJ0RXZlbnRMb29wKCk7Ci0KLSAgICAgICAgfSBlbHNlIHsKLQotICAgICAgICAgICAgbUNvbnRleHQudW5yZWdpc3RlclJlY2VpdmVyKG1SZWNlaXZlcik7Ci0gICAgICAgICAgIC8vIFJlbW92ZSBub3RpZmljYXRpb24gKGl0IHdpbGwgbm8tb3AgaWYgaXQgaXNuJ3QgdmlzaWJsZSkKLSAgICAgICAgICAgIG1XaWZpU3RhdGVUcmFja2VyLnNldE5vdGlmaWNhdGlvblZpc2libGUoZmFsc2UsIDAsIGZhbHNlLCAwKTsKLQotICAgICAgICAgICAgYm9vbGVhbiBmYWlsZWRUb1N0b3BTdXBwbGljYW50T3JVbmxvYWREcml2ZXIgPSBmYWxzZTsKLQotICAgICAgICAgICAgaWYgKCFtV2lmaVN0YXRlVHJhY2tlci5zdG9wU3VwcGxpY2FudCgpKSB7Ci0gICAgICAgICAgICAgICAgU2xvZy5lKFRBRywgIkZhaWxlZCB0byBzdG9wIHN1cHBsaWNhbnQgZGFlbW9uLiIpOwotICAgICAgICAgICAgICAgIHNldFdpZmlFbmFibGVkU3RhdGUoV0lGSV9TVEFURV9VTktOT1dOLCB1aWQpOwotICAgICAgICAgICAgICAgIGZhaWxlZFRvU3RvcFN1cHBsaWNhbnRPclVubG9hZERyaXZlciA9IHRydWU7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIC8qKgotICAgICAgICAgICAgICogUmVzZXQgY29ubmVjdGlvbnMgYW5kIGRpc2FibGUgaW50ZXJmYWNlCi0gICAgICAgICAgICAgKiBiZWZvcmUgd2UgdW5sb2FkIHRoZSBkcml2ZXIKLSAgICAgICAgICAgICAqLwotICAgICAgICAgICAgbVdpZmlTdGF0ZVRyYWNrZXIucmVzZXRDb25uZWN0aW9ucyh0cnVlKTsKLQotICAgICAgICAgICAgaWYgKCFtV2lmaVN0YXRlVHJhY2tlci51bmxvYWREcml2ZXIoKSkgewotICAgICAgICAgICAgICAgIFNsb2cuZShUQUcsICJGYWlsZWQgdG8gdW5sb2FkIFdpLUZpIGRyaXZlci4iKTsKLSAgICAgICAgICAgICAgICBpZiAoIWZhaWxlZFRvU3RvcFN1cHBsaWNhbnRPclVubG9hZERyaXZlcikgewotICAgICAgICAgICAgICAgICAgICBzZXRXaWZpRW5hYmxlZFN0YXRlKFdJRklfU1RBVEVfVU5LTk9XTiwgdWlkKTsKLSAgICAgICAgICAgICAgICAgICAgZmFpbGVkVG9TdG9wU3VwcGxpY2FudE9yVW5sb2FkRHJpdmVyID0gdHJ1ZTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGlmIChmYWlsZWRUb1N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BzZWUge0BsaW5rIFdpZmlNYW5hZ2VyI2dldFdpZmlBcFN0YXRlKCl9CisgICAgICogQHJldHVybiBPbmUgb2Yge0BsaW5rIFdpZmlNYW5hZ2VyI1dJRklfQVBfU1RBVEVfRElTQUJMRUR9LAorICAgICAqICAgICAgICAge0BsaW5rIFdpZmlNYW5hZ2VyI1dJRklfQVBfU1RBVEVfRElTQUJMSU5HfSwKKyAgICAgKiAgICAgICAgIHtAbGluayBXaWZpTWFuYWdlciNXSUZJX0FQX1NUQVRFX0VOQUJMRUR9LAorICAgICAqICAgICAgICAge0BsaW5rIFdpZmlNYW5hZ2VyI1dJRklfQVBfU1RBVEVfRU5BQkxJTkd9LAorICAgICAqICAgICAgICAge0BsaW5rIFdpZmlNYW5hZ2VyI1dJRklfQVBfU1RBVEVfRkFJTEVEfQorICAgICAqLworICAgIHB1YmxpYyBpbnQgZ2V0V2lmaUFwRW5hYmxlZFN0YXRlKCkgewogICAgICAgICBlbmZvcmNlQWNjZXNzUGVybWlzc2lvbigpOworICAgICAgICByZXR1cm4gbVdpZmlTdGF0ZU1hY2hpbmUuc3luY0dldFdpZmlBcFN0YXRlKCk7CisgICAgfQorCisgICAgLyoqCisgICAgICogc2VlIHtAbGluayBXaWZpTWFuYWdlciNnZXRXaWZpQXBDb25maWd1cmF0aW9uKCl9CisgICAgICogQHJldHVybiBzb2Z0IGFjY2VzcyBwb2ludCBjb25maWd1cmF0aW9uCisgICAgICovCisgICAgcHVibGljIHN5bmNocm9uaXplZCBXaWZpQ29uZmlndXJhdGlvbiBnZXRXaWZpQXBDb25maWd1cmF0aW9uKCkgewogICAgICAgICBmaW5hbCBDb250ZW50UmVzb2x2ZXIgY3IgPSBtQ29udGV4dC5nZXRDb250ZW50UmVzb2x2ZXIoKTsKICAgICAgICAgV2lmaUNvbmZpZ3VyYXRpb24gd2lmaUNvbmZpZyA9IG5ldyBXaWZpQ29uZmlndXJhdGlvbigpOwogICAgICAgICBpbnQgYXV0aFR5cGU7CkBAI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ICAgICAgICAgc2V0V2lmaUFwQ29uZmlndXJhdGlvbih3aWZpQ29uZmlnKTsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7Ci0gICAgICAgICAgICAgICAgfSBjYXRjaChFeGNlcHRpb24gZSkgewotICAgICAgICAgICAgICAgICAgICBTbG9nLmUoVEFHLCAiRXhjZXB0aW9uIGluIG53U2VydmljZSBkdXJpbmcgQVAgcmVzdGFydCIpOwotICAgICAgICAgICAgICAgICAgICB0cnkgewotICAgICAgICAgICAgICAgICAgICAgICAgbndTZXJ2aWNlLnN0b3BBY2Nlc3NQb2ludCgpOwotICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChFeGNlcHRpb24gZWUpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIFNsb2cuZShUQUcsICJDb3VsZCBub3Qgc3RvcCBBUCwgOiIgKyBlZSk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgc2V0V2lmaUFwRW5hYmxlZFN0YXRlKFdJRklfQVBfU1RBVEVfRkFJTEVELCB1aWQsIERyaXZlckFjdGlvbi5EUklWRVJfVU5MT0FEKTsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLQotICAgICAgICAvKioKLSAgICAgICAgICogRmFpbCBBUCBpZiBXaWZpIGlzIGVuYWJsZWQKLSAgICAgICAgICovCi0gICAgICAgIGlmICgobVdpZmlTdGF0ZVRyYWNrZXIuZ2V0V2lmaVN0YXRlKCkgPT0gV0lGSV9TVEFURV9FTkFCTEVEKSAmJiBlbmFibGUpIHsKLSAgICAgICAgICAgIHNldFdpZmlBcEVuYWJsZWRTdGF0ZShXSUZJX0FQX1NUQVRFX0ZBSUxFRCwgdWlkLCBEcml2ZXJBY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xFRCwgdWlkLCBEcml2ZXJBY3Rpb24uTk9fRFJJVkVSX1VOTE9BRCk7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICB0cnkgewotICAgICAgICAgICAgICAgIG53U2VydmljZS5zdGFydEFjY2Vzc1BvaW50KHdpZmlDb25maWcsIG1XaWZpU3RhdGVUcmFja2VyLmdldEludGVyZmFjZU5hbWUoKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTT0ZUQVBfSUZBQ0UpOwotICAgICAgICAgICAgfSBjYXRjaChFeGNlcHRpb24gZSkgewotICAgICAgICAgICAgICAgIFNsb2cuZShUQUcsICJFeGNlcHRpb24gaW4gc3RhcnRBY2Nlc3NQb2ludCgpIik7Ci0gICAgICAgICAgICAgICAgc2V0V2lmaUFwRW5hYmxlZFN0YXRlKFdJRklfQVBfU1RBVEVfRkFJTEVELCB1aWQsIERyaXZlckFjdGlvbi5EUklWRVJfVU5MT0FEKTsKLSAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIHNldFdpZmlBcENvbmZpZ3VyYXRpb24od2lmaUNvbmZpZyk7Ci0KLSAgICAgICAgfSBlbHNlIHsKLQotICAgICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgICBud1NlcnZpY2Uuc3RvcEFjY2Vzc1BvaW50KCk7Ci0gICAgICAgICAgICB9IGNhdGNoKEV4Y2VwdGlvbiBlKSB7Ci0gICAgICAgICAgICAgICAgU2xvZy5lKFRBRywgIkV4Y2VwdGlvbiBpbiBzdG9wQWNjZXNzUG9pbnQoKSIpOwotICAgICAgICAgICAgICAgIHNldFdpZmlBcEVuYWJsZWRTdGF0ZShXSUZJX0FQX1NUQVRFX0ZBSUxFRCwgdWlkLCBEcml2ZXJBY3Rpb24uRFJJVkVSX1VOTE9BRCk7Ci0gICAgICAgICAgICA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gICogc2VlIHtAbGluayBhbmRyb2lkLm5ldC53aWZpLldpZmlNYW5hZ2VyI3JlYXNzb2NpYXRlKCl9CisgICAgICovCisgICAgcHVibGljIHZvaWQgcmVhc3NvY2lhdGUoKSB7CisgICAgICAgIGVuZm9yY2VDaGFuZ2VQZXJtaXNzaW9uKCk7CisgICAgICAgIG1XaWZpU3RhdGVNYWNoaW5lLnJlYXNzb2NpYXRlQ29tbWFuZCgpOwogICAgIH0KIAogICAgIC8qKgpAQCAtODEzLDIxNyArNTU1LDcgQEAKICAgICAgKi8KICAgICBwdWJsaWMgTGlzdDxXaWZpQ29uZmlndXJhdGlvbj4gZ2V0Q29uZmlndXJlZE5ldHdvcmtzKCkgewogICAgICAgICBlbmZvcmNlQWNjZXNzUGVybWlzc2lvbigpOwotICAgICAgICBTdHJpbmcgbGlzdFN0cjsKLQotICAgICAgICAvKgotICAgICAgICAgKiBXZSBkb24ndCBjYWNoZSB0aGUgbGlzdCwgYmVjYXVzZSB3ZSB3YW50IHRvIGFsbG93Ci0gICAgICAgICAqIGZvciB0aGUgcG9zc2liaWxpdHkgdGhhdCB0aGUgY29uZmlndXJhdGlvbiBmaWxlCi0gICAgICAgICAqIGhhcyBiZWVuIG1vZGlmaWVkIHRocm91Z2ggc29tZSBleHRlcm5hbCBtZWFucywKLSAgICAgICAgICogc3VjaCBhcyB0aGUgd3BhX2NsaSBjb21tYW5kIGxpbmUgcHJvZ3JhbS4KLSAgICAgICAgICovCi0gICAgICAgIGxpc3RTdHIgPSBtV2lmaVN0YXRlVHJhY2tlci5saXN0TmV0d29ya3MoKTsKLQotICAgICAgICBMaXN0PFdpZmlDb25maWd1cmF0aW9uPiBuZXR3b3JrcyA9Ci0gICAgICAgICAgICBuZXcgQXJyYXlMaXN0PFdpZmlDb25maWd1cmF0aW9uPigpOwotICAgICAgICBpZiAobGlzdFN0ciA9PSBudWxsKQotICAgICAgICAgICAgcmV0dXJuIG5ldHdvcmtzOwotCi0gICAgICAgIFN0cmluZ1tdIGxpbmVzID0gbGlzdFN0ci5zcGxpdCgiXG4iKTsKLSAgICAgICAgLy8gU2tpcCB0aGUgZmlyc3QgbGluZSwgd2hpY2ggaXMgYSBoZWFkZXIKLSAgICAgICBmb3IgKGludCBpID0gMTsgaSA8IGxpbmVzLmxlbmd0aDsgaSsrKSB7Ci0gICAgICAgICAgIFN0cmluZ1tdIHJlc3VsdCA9IGxpbmVzW2ldLnNwbGl0KCJcdCIpOwotICAgICAgICAgICAvLyBuZXR3b3JrLWlkIHwgc3NpZCB8IGJzc2lkIHwgZmxhZ3MKLSAgICAgICAgICAgV2lmaUNvbmZpZ3VyYXRpb24gY29uZmlnID0gbmV3IFdpZmlDb25maWd1cmF0aW9uKCk7Ci0gICAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICAgICBjb25maWcubmV0d29ya0lkID0gSW50ZWdlci5wYXJzZUludChyZXN1bHRbMF0pOwotICAgICAgICAgICB9IGNhdGNoKE51bWJlckZvcm1hdEV4Y2VwdGlvbiBlKSB7Ci0gICAgICAgICAgICAgICBjb250aW51ZTsKLSAgICAgICAgICAgfQotICAgICAgICAgICBpZiAocmVzdWx0Lmxlbmd0aCA+IDMpIHsKLSAgICAgICAgICAgICAgIGlmIChyZXN1bHRbM10uaW5kZXhPZigiW0NVUlJFTlRdIikgIT0gLTEpCi0gICAgICAgICAgICAgICAgICAgY29uZmlnLnN0YXR1cyA9IFdpZmlDb25maWd1cmF0aW9uLlN0YXR1cy5DVVJSRU5UOwotICAgICAgICAgICAgICAgZWxzZSBpZiAocmVzdWx0WzNdLmluZGV4T2YoIltESVNBQkxFRF0iKSAhPSAtMSkKLSAgICAgICAgICAgICAgICAgICBjb25maWcuc3RhdHVzID0gV2lmaUNvbmZpZ3VyYXRpb24uU3RhdHVzLkRJU0FCTEVEOwotICAgICAgICAgICAgICAgZWxzZQotICAgICAgICAgICAgICAgICAgIGNvbmZpZy5zdGF0dXMgPSBXaWZpQ29uZmlndXJhdGlvbi5TdGF0dXMuR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ID0gbnVsbDsKLSAgICAgICAgfQotCi0gICAgICAgIHZhbHVlID0gbVdpZmlTdGF0ZVRyYWNrZXIuZ2V0TmV0d29ya1ZhcmlhYmxlKGNvbmZpZy5uZXR3b3JrSWQsCi0gICAgICAgICAgICAgICAgV2lmaUNvbmZpZ3VyYXRpb24uUHJvdG9jb2wudmFyTmFtZSk7Ci0gICAgICAgIGlmICghVGV4dFV0aWxzLmlzRW1wdHkodmFsdWUpKSB7Ci0gICAgICAgICAgICBTdHJpbmcgdmFsc1tdID0gdmFsdWUuc3BsaXQoIiAiKTsKLSAgICAgICAgICAgIGZvciAoU3RyaW5nIHZhbCA6IHZhbHMpIHsKLSAgICAgICAgICAgICAgICBpbnQgaW5kZXggPQotICAgICAgICAgICAgICAgICAgICBsb29rdXBTdHJpbmcodmFsLCBXaWZpQ29uZmlndXJhdGlvbi5Qcm90b2NvbC5zdHJpbmdzKTsKLSAgICAgICAgICAgICAgICBpZiAoMCA8PSBpbmRleCkgewotICAgICAgICAgICAgICAgICAgICBjb25maWcuYWxsb3dlZFByb3RvY29scy5zZXQoaW5kZXgpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIHZhbHVlID0gbVdpZmlTdGF0ZVRyYWNrZXIuZ2V0TmV0d29ya1ZhcmlhYmxlKGNvbmZpZy5uZXR3b3JrSWQsCi0gICAgICAgICAgICAgICAgV2lmaUNvbmZpZ3VyYXRpb24uS2V5TWdtdC52YXJOYW1lKTsKLSAgICAgICAgaWYgKCFUZXh0VXRpbHMuaXNFbXB0eSh2YWx1ZSkpIHsKLSAgICAgICAgICAgIFN0cmluZyB2YWxzW10gPSB2YWx1ZS5zcGxpdCgiICIpOwotICAgICAgICAgICAgZm9yIChTdHJpbmcgdmFsIDogdmFscykgewotICAgICAgICAgICAgICAgIGludCBpbmRleCA9Ci0gICAgICAgICAgICAgICAgICAgIGxvb2t1cFN0cmluZyh2YWwsIFdpZmlDb25maWd1cmF0aW9uLktleU1nbXQuc3RyaW5ncyk7Ci0gICAgICAgICAgICAgICAgaWYgKDAgPD0gaW5kZXgpIHsKLSAgICAgICAgICAgICAgICAgICAgY29uZmlnLmFsbG93ZWRLZXlNYW5hZ2VtZW50LnNldChpbmRleCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgdmFsdWUgPSBtV2lmaVN0YXRlVHJhY2tlci5nZXROZXR3b3JrVmFyaWFibGUoY29uZmlnLm5ldHdvcmtJZCwKLSAgICAgICAgICAgICAgICBXaWZpQ29uZmlndXJhdGlvbi5BdXRoQWxnb3JpdGhtLnZhck5hbWUpOwotICAgICAgICBpZiAoIVRleHRVdGlscy5pc0VtcHR5KHZhbHVlKSkgewotICAgICAgICAgICAgU3RyaW5nIHZhbHNbXSA9IHZhbHVlLnNwbGl0KCIgIik7Ci0gICAgICAgICAgICBmb3IgKFN0cmluZyB2YWwgOiB2YWxzKSB7Ci0gICAgICAgICAgICAgICAgaW50IGluZGV4ID0KLSAgICAgICAgICAgICAgICAgICAgbG9va3VwU3RyaW5nKHZhbCwgV2lmaUNvbmZpZ3VyYXRpb24uQXV0aEFsZ29yaXRobS5zdHJpbmdzKTsKLSAgICAgICAgICAgICAgICBpZiAoMCA8PSBpbmRleCkgewotICAgICAgICAgICAgICAgICAgICBjb25maWcuYWxsb3dlZEF1dGhBbGdvcml0aG1zLnNldChpbmRleCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgdmFsdWUgPSBtV2lmaVN0YXRlVHJhY2tlci5nZXROZXR3b3JrVmFyaWFibGUoY29uZmlnLm5ldHdvcmtJZCwKLSAgICAgICAgICAgICAgICBXaWZpQ29uZmlndXJhdGlvbi5QYWlyd2lzZUNpcGhlci52YXJOYW1lKTsKLSAgICAgICAgaWYgKCFUZXh0VXRpbHMuaXNFbXB0eSh2YWx1ZSkpIHsKLSAgICAgICAgICAgIFN0cmluZyB2YWxzW10gPSB2YWx1ZS5zcGxpdCgiICIpOwotICAgICAgICAgICAgZm9yIChTdHJpbmcgdmFsIDogdmFscykgewotICAgICAgICAgICAgICAgIGludCBpbmRleCA9Ci0gICAgICAgICAgICAgICAgICAgIGxvb2t1cFN0cmluZyh2YWwsIFdpZmlDb25maWd1cmF0aW9uLlBhaXJ3aXNlQ2lwaGVyLnN0cmluZ3MpOwotICAgICAgICAgICAgICAgIGlmICgwIDw9IGluZGV4KSB7Ci0gICAgICAgICAgICAgICAgICAgIGNvbmZpZy5hbGxvd2VkUGFpcndpc2VDaXBoZXJzLnNldChpbmRleCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgdmFsdWUgPSBtV2lmaVN0YXRlVHJhY2tlci5nZXROZXR3b3JrVmFyaWFibGUoY29uZmlnLm5ldHdvcmtJZCwKLSAgICAgICAgICAgICAgICBXaWZpQ29uZmlndXJhdGlvbi5Hcm91cENpcGhlci52YXJOYW1lKTsKLSAgICAgICAgaWYgKCFUZXh0VXRpbHMuaXNFbXB0eSh2YWx1ZSkpIHsKLSAgICAgICAgICAgIFN0cmluZyB2YWxzW10gPSB2YWx1ZS5zcGxpdCgiICIpOwotICAgICAgICAgICAgZm9yIChTdHJpbmcgdmFsIDogdmFscykgewotICAgICAgICAgICAgICAgIGludCBpbmRleCA9Ci0gICAgICAgICAgICAgICAgICAgIGxvb2t1cFN0cmluZyh2YWwsIFdpZmlDb25maWd1cmF0aW9uLkdyb3VwQ2lwaGVyLnN0cmluZ3MpOwotICAgICAgICAgICAgICAgIGlmICgwIDw9IGluZGV4KSB7Ci0gICAgICAgICAgICAgICAgICAgIGNvbmZpZy5hbGxvd2VkR3JvdXBDaXBoZXJzLnNldChpbmRleCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgZm9yIChXaWZpQ29uZmlndX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gIGVuZm9yY2VDaGFuZ2VQZXJtaXNzaW9uKCk7Ci0KLSAgICAgICAgLyoKLSAgICAgICAgICogSWYgdGhlIHN1cHBsaWVkIG5ldHdvcmtJZCBpcyAtMSwgd2UgY3JlYXRlIGEgbmV3IGVtcHR5Ci0gICAgICAgICAqIG5ldHdvcmsgY29uZmlndXJhdGlvbi4gT3RoZXJ3aXNlLCB0aGUgbmV0d29ya0lkIHNob3VsZAotICAgICAgICAgKiByZWZlciB0byBhbiBleGlzdGluZyBjb25maWd1cmF0aW9uLgotICAgICAgICAgKi8KLSAgICAgICAgaW50IG5ldElkID0gY29uZmlnLm5ldHdvcmtJZDsKLSAgICAgICAgYm9vbGVhbiBuZXdOZXR3b3JrID0gbmV0SWQgPT0gLTE7Ci0gICAgICAgIGJvb2xlYW4gZG9SZWNvbmZpZyA9IGZhbHNlOwotICAgICAgICAvLyBuZXR3b3JrSWQgb2YgLTEgbWVhbnMgd2Ugd2FudCB0byBjcmVhdGUgYSBuZXcgbmV0d29yawotICAgICAgICBzeW5jaHJvbml6ZWQgKG1XaWZpU3RhdGVUcmFja2VyKSB7Ci0gICAgICAgICAgICBpZiAobmV3TmV0d29yaykgewotICAgICAgICAgICAgICAgIG5ldElkID0gbVdpZmlTdGF0ZVRyYWNrZXIuYWRkTmV0d29yaygpOwotICAgICAgICAgICAgICAgIGlmIChuZXRJZCA8IDApIHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgIkZhaWxlZCB0byBhZGQgYSBuZXR3b3JrISIpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybiAtMTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgZG9SZWNvbmZpZyA9IHRydWU7Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBtTmVlZFJlY29uZmlnID0gbU5lZWRSZWNvbmZpZyB8fCBkb1JlY29uZmlnOwotICAgICAgICB9Ci0KLSAgICAgICAgc2V0VmFyaWFibGVzOiB7Ci0gICAgICAgICAgICAvKgotICAgICAgICAgICAgICogTm90ZSB0aGF0IGlmIGEgbmV0d29ya0lkIGZvciBhIG5vbi1leGlzdGVudCBuZXR3b3JrCi0gICAgICAgICAgICAgKiB3YXMgc3VwcGxpZWQsIHRoZW4gdGhlIGZpcnN0IHNldE5ldHdvcmtWYXJpYWJsZSgpCi0gICAgICAgICAgICAgKiB3aWxsIGZhaWwsIHNvIHdlIGRvbid0IGJvdGhlciB0byBtYWtlIGEgc2VwYXJhdGUgY2hlY2sKLSAgICAgICAgICAgICAqIGZvciB0aGUgdmFsaWRpdHkgb2YgdGhlIElEIHVwIGZyb250LgotICAgICAgICAgICAgICovCi0gICAgICAgICAgICBpZiAoY29uZmlnLlNTSUQgIT0gbnVsbCAmJgotICAgICAgICAgICAgICAgICAgICAhbVdpZmlTdGF0ZVRyYWNrZXIuc2V0TmV0d29ya1ZhcmlhYmxlKAotICAgICAgICAgICAgICAgICAgICAgICAgbmV0SWQsCi0gICAgICAgICAgICAgICAgICAgICAgICBXaWZpQ29uZmlndXJhdGlvbi5zc2lkVmFyTmFtZSwKLSAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZy5TU0lEKSkgewotICAgICAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgImZhaWxlZCB0byBzZXQgU1NJRDogIitjb25maWcuU1NJRCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGJyZWFrIHNldFZhcmlhYmxlczsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgaWYgKGNvbmZpZy5CU1NJRCAhPSBudWxsICYmCi0gICAgICAgICAgICAgICAgICAgICFtV2lmaVN0YXRlVHJhY2tlci5zZXROZXR3b3JrVmFyaWFibGUoCi0gICAgICAgICAgICAgICAgICAgICAgICBuZXRJZCwKLSAgICAgICAgICAgICAgICAgICAgICAgIFdpZmlDb25maWd1cmF0aW9uLmJzc2lkVmFyTmFtZSwKLSAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZy5CU1NJRCkpIHsKLSAgICAgICAgICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgICAgIFNsb2cuZChUQUcsICJmYWlsZWQgdG8gc2V0IEJTU0lEOiAiK2NvbmZpZy5CU1NJRCk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGJyZWFrIHNldFZhcmlhYmxlczsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgU3RyaW5nIGFsbG93ZWRLZXlNYW5hZ2VtZW50U3RyaW5nID0KLSAgICAgICAgICAgICAgICBtYWtlU3RyaW5nKGNvbmZpZy5hbGxvd2VkS2V5TWFuYWdlbWVudCwgV2lmaUNvbmZpZ3VyYXRpb24uS2V5TWdtdC5zdHJpbmdzKTsKLSAgICAgICAgICAgIGlmIChjb25maWcuYWxsb3dlZEtleU1hbmFnZW1lbnQuY2FyZGluYWxpdHkoKSAhPSAwICYmCi0gICAgICAgICAgICAgICAgICAgICFtV2lmaVN0YXRlVHJhY2tlci5zZXROZXR3b3JrVmFyaWFibGUoCi0gICAgICAgICAgICAgICAgICAgICAgICBuZXRJZCwKLSAgICAgICAgICAgICAgICAgICAgICAgIFdpZmlDb25maWd1cmF0aW9uLktleU1nbXQudmFyTmFtZSwKLSAgICAgICAgICAgICAgICAgICAgICAgIGFsbG93ZWRLZXlNYW5hZ2VtZW50U3RyaW5nKSkgewotICAgICAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgImZhaWxlZCB0byBzZXQga2V5X21nbXQ6ICIrCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgYWxsb3dlZEtleU1hbmFnZW1lbnRTdHJpbmcpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBicmVhayBzZXRWYXJpYWJsZXM7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIFN0cmluZyBhbGxvd2VkUHJvdG9jb2xzU3RyaW5nID0KLSAgICAgICAgICAgICAgICBtYWtlU3RyaW5nKGNvbmZpZy5hbGxvd2VkUHJvdG9jb2xzLCBXaWZpQ29uZmlndXJhdGlvbi5Qcm90b2NvbC5zdHJpbmdzKTsKLSAgICAgICAgICAgIGlmIChjb25maWcuYWxsb3dlZFByb3RvY29scy5jYXJkaW5hbGl0eSgpICE9IDAgJiYKLSAgICAgICAgICAgICAgICAgICAgIW1XaWZpU3RhdGVUcmFja2VyLnNldE5ldHdvcmtWYXJpYWJsZSgKLSAgICAgICAgICAgICAgICAgICAgICAgIG5ldElkLAotICAgICAgICAgICAgICAgICAgICAgICAgV2lmaUNvbmZpZ3VyYXRpb24uUHJvdG9jb2wudmFyTmFtZSwKLSAgICAgICAgICAgICAgICAgICAgICAgIGFsbG93ZWRQcm90b2NvbHNTdHJpbmcpKSB7Ci0gICAgICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgICAgICBTbG9nLmQoVEFHLCAiZmFpbGVkIHRvIHNldCBwcm90bzogIisKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbGxvd2VkUHJvdG9jb2xzU3RyaW5nKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgYnJlYWsgc2V0VmFyaWFibGVzOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBTdHJpbmcgYWxsb3dlZEF1dGhBbGdvcml0aG1zU3RyaW5nID0KLSAgICAgICAgICAgICAgICBtYWtlU3RyaW5nKGNvbmZpZy5hbGxvd2VkQXV0aEFsZ29yaXRobXMsIFdpZmlDb25maWd1cmF0aW9uLkF1dGhBbGdvcml0aG0uc3RyaW5ncyk7Ci0gICAgICAgICAgICBpZiAoY29uZmlnLmFsbG93ZWRBdXRoQWxnb3JpdGhtcy5jYXJkaW5hbGl0eSgpICE9IDAgJiYKLSAgICAgICAgICAgICAgICAgICAgIW1XaWZpU3RhdGVUcmFja2VyLnNldE5ldHdvcmtWYXJpYWJsZSgKLSAgICAgICAgICAgICAgICAgICAgICAgIG5ldElkLAotICAgICAgICAgICAgICAgICAgICAgICAgV2lmaUNvbmZpZ3VyYXRpb24uQXV0aEFsZ29yaXRobS52YXJOYW1lLAotICAgICAgICAgICAgICAgICAgICAgICAgYWxsb3dlZEF1dGhBbGdvcml0aG1zU3RyaW5nKSkgewotICAgICAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgImZhaWxlZCB0byBzZXQgYXV0aF9hbGc6ICIrCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgYWxsb3dlZEF1dGhBbGdvcml0aG1zU3RyaW5nKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgYnJlYWsgc2V0VmFyaWFibGVzOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBTdHJpbmcgYWxsb3dlZFBhaXJ3aXNlQ2lwaGVyc1N0cmluZyA9Ci0gICAgICAgICAgICAgICAgbWFrZVN0cmluZyhjb25maWcuYWxsb3dlZFBhaXJ3aXNlQ2lwaGVycywgV2lmaUNvbmZpZ3VyYXRpb24uUGFpcndpc2VDaXBoZXIuc3RyaW5ncyk7Ci0gICAgICAgICAgICBpZiAoY29uZmlnLmFsbG93ZWRQYWlyd2lzZUNpcGhlcnMuY2FyZGluYWxpdHkoKSAhPSAwICYmCi0gICAgICAgICAgICAgICAgICAgICFtV2lmaVN0YXRlVHJhY2tlci5zZXROZXR3b3JrVmFyaWFibGUoCi0gICAgICAgICAgICAgICAgICAgICAgICBuZXRJZCwKLSAgICAgICAgICAgICAgICAgICAgICAgIFdpZmlDb25maWd1cmF0aW9uLlBhaXJ3aXNlQ2lwaGVyLnZhck5hbWUsCi0gICAgICAgICAgICAgICAgICAgICAgICBhbGxvd2VkUGFpcndpc2VDaXBoZXJzU3RyaW5nKSkgewotICAgICAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgImZhaWxlZCB0byBzZXQgcGFpcndpc2U6ICIrCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgYWxsb3dlZFBhaXJ3aXNlQ2lwaGVyc1N0cmluZyk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGJyZWFrIHNldFZhcmlhYmxlczsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgU3RyaW5nIGFsbG93ZWRHcm91cENpcGhlcnNTdHJpbmcgPQotICAgICAgICAgICAgICAgIG1ha2VTdHJpbmcoY29uZmlnLmFsbG93ZWRHcm91cENpcGhlcnMsIFdpZmlDb25maWd1cmF0aW9uLkdyb3VwQ2lwaGVyLnN0cmluZ3MpOwotICAgICAgICAgICAgaWYgKGNvbmZpZy5hbGxvd2VkR3JvdXBDaXBoZXJzLmNhcmRpbmFsaXR5KCkgIT0gMCAmJgotICAgICAgICAgICAgICAgICAgICAhbVdpZmlTdGF0ZVRyYWNrZXIuc2V0TmV0d29ya1ZhcmlhYmxlKAotICAgICAgICAgICAgICAgICAgICAgICAgbmV0SWQsCi0gICAgICAgICAgICAgICAgICAgICAgICBXaWZpQ29uZmlndXJhdGlvbi5Hcm91cENpcGhlci52YXJOYW1lLAotICAgICAgICAgICAgICAgICAgICAgICAgYWxsb3dlZEdyb3VwQ2lwaGVyc1N0cmluZykpIHsKLSAgICAgICAgICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgICAgIFNsb2cuZChUQUcsICJmYWlsZWQgdG8gc2V0IGdyb3VwOiAiKwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFsbG93ZWRHcm91cENpcGhlcnNTdHJpbmcpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBicmVhayBzZXRWYXJpYWJsZXM7Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIC8vIFByZXZlbnQgY2xpZW50IHNjcmV3LXVwIGJ5IHBhc3NpbmcgaW4gYSBXaWZpQ29uZmlndXJhdGlvbiB3ZSBnYXZlIGl0Ci0gICAgICAgICAgICAvLyBieSBwcmV2ZW50aW5nICIqIiBhcyBhIGtleS4KLSAgICAgICAgICAgIGlmIChjb25maWcucHJlU2hhcmVkS2V5ICE9IG51bGwgJiYgIWNvbmZpZy5wcmVTaGFyZWRLZXkuZXF1YWxzKCIqIikgJiYKLSAgICAgICAgICAgICAgICAgICAgIW1XaWZpU3RhdGVUcmFja2VyLnNldE5ldHdvcmtWYXJpYWJsZSgKLSAgICAgICAgICAgICAgICAgICAgICAgIG5ldElkLAotICAgICAgICAgICAgICAgICAgICAgICAgV2lmaUNvbmZpZ3VyYXRpb24ucHNrVmFyTmFtZSwKLSAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZy5wcmVTaGFyZWRLZXkpKSB7Ci0gICAgICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgICAgICBTbG9nLmQoVEFHLCAiZmFpbGVkIHRvIHNldCBwc2s6ICIrY29uZmlnLnByZVNoYXJlZEtleSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGJyZWFrIHNldFZhcmlhYmxlczsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgYm9vbGVhbiBoYXNTZXRLZXkgPSBmYWxzZTsKLSAgICAgICAgICAgIGlmIChjb25maWcud2VwS2V5cyAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBjb25maWcud2VwS2V5cy5sZW5ndGg7IGkrKykgewotICAgICAgICAgICAgICAgICAgICAvLyBQcmV2ZW50IGNsaWVudCBzY3Jldy11cCBieSBwYXNzaW5nIGluIGEgV2lmaUNvbmZpZ3VyYXRpb24gd2UgZ2F2ZSBpdAotICAgICAgICAgICAgICAgICAgICAvLyBieSBwcmV2ZW50aW5nICIqIiBhcyBhIGtleS4KLSAgICAgICAgICAgICAgICAgICAgaWYgKGNvbmZpZy53ZXBLZXlzW2ldICE9IG51bGwgJiYgIWNvbmZpZy53ZXBLZXlzW2ldLmVxdWFscygiKiIpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIW1XaWZpU3RhdGVUcmFja2VyLnNldE5ldHdvcmtWYXJpYWJsZSgKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ldElkLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgV2lmaUNvbmZpZ3VyYXRpb24ud2VwS2V5VmFyTmFtZXNbaV0sCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWcud2VwS2V5c1tpXSkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNsb2cuZChUQUcsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImZhaWxlZCB0byBzZXQgd2VwX2tleSIraSsiOiAiICsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWcud2VwS2V5c1tpXSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIHNldFZhcmlhYmxlczsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIGhhc1NldEtleSA9IHRydWU7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGlmIChoYXNTZXRLZXkpIHsKLSAgICAgICAgICAgICAgICBpZiAoIW1XaWZpU3RhdGVUcmFja2VyLnNldE5ldHdvcmtWYXJpYWJsZSgKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXRJZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBXaWZpQ29uZmlndXJhdGlvbi53ZXBUeEtleUlkeFZhck5hbWUsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgSW50ZWdlci50b1N0cmluZyhjb25maWcud2VwVHhLZXlJbmRleCkpKSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIFNsb2cuZChUQUcsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJmYWlsZWQgdG8gc2V0IHdlcF90eF9rZXlpZHg6ICIrCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZy53ZXBUeEtleUluZGV4KTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBicmVhayBzZXRWYXJpYWJsZXM7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBpZiAoIW1XaWZpU3RhdGVUcmFja2VyLnNldE5ldHdvcmtWYXJpYWJsZSgKLSAgICAgICAgICAgICAgICAgICAgICAgIG5ldElkLAotICAgICAgICAgICAgICAgICAgICAgICAgV2lmaUNvbmZpZ3VyYXRpb24ucHJpb3JpdHlWYXJOYW1lLAotICAgICAgICAgICAgICAgICAgICAgICAgSW50ZWdlci50b1N0cmluZyhjb25maWcucHJpb3JpdHkpKSkgewotICAgICAgICAgICAgICAgIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgY29uZmlnLlNTSUQgKyAiOiBmYWlsZWQgdG8gc2V0IHByaW9yaXR5OiAiCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgK2NvbmZpZy5wcmlvcml0eSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIGJyZWFrIHNldFZhcmlhYmxlczsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgaWYgKGNvbmZpZy5oaWRkZW5TU0lEICYmICFtV2lmaVN0YXRlVHJhY2tlci5zZXROZXR3b3JrVmFyaWFibGUoCi0gICAgICAgICAgICAgICAgICAgICAgICBuZXRJZCwKLSAgICAgICAgICAgICAgICAgICAgICAgIFdpZmlDb25maWd1cmF0aW9uLmhpZGRlblNTSURWYXJOYW1lLAotICAgICAgICAgICAgICAgICAgICAgICAgSW50ZWdlci50b1N0cmluZyhjb25maWcuaGlkZGVuU1NJRCA/IDEgOiAwKSkpIHsKLSAgICAgICAgICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgICAgIFNsb2cuZChUQUcsIGNvbmZpZy5TU0lEICsgIjogZmFpbGVkIHRvIHNldCBoaWRkZW5TU0lEOiAiKwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZy5oaWRkZW5TU0lEKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgYnJlYWsgc2V0VmFyaWFibGVzOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBmb3IgKFdpZmlDb25maWd1cmF0aW9uLkVudGVycHJpc2VGaWVsZCBmaWVsZAotICAgICAgICAgICAgICAgICAgICA6IGNvbmZpZy5lbnRlcnByaXNlRmllbGRzKSB7Ci0gICAgICAgICAgICAgICAgU3RyaW5nIHZhck5hbWUgPSBmaWVsZC52YXJOYW1lKCk7Ci0gICAgICAgICAgICAgICAgU3RyaW5nIHZhbHVlID0gZmllbGQudmFsdWUoKTsKLSAgICAgICAgICAgICAgICBpZiAodmFsdWUgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICBpZiAoZmllbGQgIT0gY29uZmlnLmVhcCkgewotICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWUgPSAodmFsdWUubGVuZ3RoKCkgPT0gMCkgPyAiTlVMTCIgOiBjb252ZXJ0VG9RdW90ZWRTdHJpbmcodmFsdWUpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIGlmICghbVdpZmlTdGF0ZVRyYWNrZXIuc2V0TmV0d29ya1ZhcmlhYmxlKAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXRJZCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyTmFtZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWUpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgY29uZmlnLlNTSUQgKyAiOiBmYWlsZWQgdG8gc2V0ICIgKyB2YXJOYW1lICsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICI6ICIgKyB2YWx1ZSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICBicmVhayBzZXRWYXJpYWJsZXM7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICByZXR1cm4gbmV0SWQ7Ci0gICAgICAgIH0KLQotICAgICAgICAvKgotICAgICAgICAgKiBGb3IgYW4gdXBkYXRlLCBpZiBvbmUgb2YgdGhlIHNldE5ldHdvcmtWYXJpYWJsZSBvcGVyYXRpb25zIGZhaWxzLAotICAgICAgICAgKiB3ZSBtaWdodCB3YW50IHRvIHJvbGwgYmFjayBhbGwgdGhlIGNoYW5nZXMgYWxyZWFkeSBtYWRlLiBCdXQgdGhlCi0gICAgICAgICAqIGNoYW5jZXMgYXJlIHRoYXQgaWYgYW55dGhpbmcgaXMgZ29pbmcgdG8gZ28gd3JvbmcsIGl0J2xsIGhhcHBlbgotICAgICAgICAgKiB0aGUgZmlyc3QgdGltZSB3ZSB0cnkgdG8gc2V0IG9uZSBvZiB0aGUgdmFyaWFibGVzLgotICAgICAgICAgKi8KLSAgICAgICAgaWYgKG5ld05ldHdvcmspIHsKLSAgICAgICAgICAgIHJlbW92ZU5ldHdvcmsobmV0SWQpOwotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgIFNsb2cuZChUQUcsCi0gICAgICAgICAgICAgICAgICAgICAgICAiRmFpbGVkIHRvIHNldCBhIG5ldHdvcmsgdmFyaWFibGUsIHJlbW92ZWQgbmV0d29yazogIgotICAgICAgICAgICAgICAgICAgICAgICAgKyBuZXRJZCk7Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICAgICAgcmV0dXJuIC0xOworICAgICAgICByZXR1cm4gbVdpZmlTdGF0ZU1hY2hpbmUuc3luY0FkZE9yVXBkYXRlTmV0d29yayhjb25maWcpOwogICAgIH0KIAotICAgIHByaXZhdGUgc3RhdGljIFN0cmluZyBtYWtlU3RyaW5nKEJpdFNldCBzZXQsIFN0cmluZ1tdIHN0cmluZ3MpIHsKLSAgICAgICAgU3RyaW5nQnVmZmVyIGJ1ZiA9IG5ldyBTdHJpbmdCdWZmZXIoKTsKLSAgICAgICAgaW50IG5leHRTZXRCaXQgPSAtMTsKLQotICAgICAgICAvKiBNYWtlIHN1cmUgYWxsIHNldCBiaXRzIGFyZSBpbiBbMCwgc3RyaW5ncy5sZW5ndGgpIHRvIGF2b2lkCi0gICAgICAgICAqIGdvaW5nIG91dCBvZiBib3VuZHMgb24gc3RyaW5ncy4gIChTaG91bGRuJ3QgaGFwcGVuLCBidXQuLi4pICovCi0gICAgICAgIHNldCA9IHNldC5nZXQoMCwgc3RyaW5ncy5sZW5ndGgpOwotCi0gICAgICAgIHdoaWxlICgobmV4dFNldEJpdCA9IHNldC5uZXh0U2V0Qml0KG5leHRTZXRCaXQgKyAxKSkgIT0gLTEpIHsKLSAgICAgICAgICAgIGJ1Zi5hcHBlbmQoc3RyaW5nc1tuZXh0U2V0Qml0XS5yZXBsYWNlKCdfJywgJy0nKSkuYXBwZW5kKCcgJyk7Ci0gICAgICAgIH0KLQotICAgICAgICAvLyByZW1vdmUgdHJhaWxpbmcgc3BhY2UKLSAgICAgICAgaWYgKHNldC5jYXJkaW5hbGl0eSgpID4gMCkgewotICAgICAgICAgICAgYnVmLnNldExlbmd0aChidWYubGVuZ3RoKCkgLSAxKTsKLSAgICAgICAgfQotCi0gICAgICAgIHJldHVybiBidWYudG9TdHJpbmcoKTsKLSAgICB9Ci0KLSAgICBwcml2YXRlIHN0YXRpYyBpbnQgbG9va3VwU3RyaW5nKFN0cmluZyBzdHJpbmcsIFN0cmluZ1tdIHN0cmluZ3MpIHsKLSAgICAgICAgaW50IHNpemUgPSBzdHJpbmdzLmxlbmd0aDsKLQotICAgICAgICBzdHJpbmcgPSBzdHJpbmcucmVwbGFjZSgnLScsICdfJyk7Ci0KLSAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBzaXplOyBpKyspCi0gICAgICAgICAgICBpZiAoc3RyaW5nLmVxdWFscyhzdHJpbmdzW2ldKSkKLSAgICAgICAgICAgICAgICByZXR1cm4gaTsKLQotICAgICAgICBpZiAoREJHKSB7Ci0gICAgICAgICAgICAvLyBpZiB3ZSBldmVyIGdldCBoZXJlLCB3ZSBzaG91bGQgcHJvYmFibHkgYWRkIHRoZQotICAgICAgICAgICAgLy8gdmFsdWUgdG8gV2lmaUNvbmZpZ3VyYXRpb24gdG8gcmVmbGVjdCB0aGF0IGl0J3MKLSAgICAgICAgICAgIC8vIHN1cHBvcnRlZCBieSB0aGUgV1BBIHN1cHBsaWNhbnQKLSAgICAgICAgICAgIFNsb2cudyhUQUcsICJGYWlsZWQgdG8gbG9vay11cCBhIHN0cmluZzogIiArIHN0cmluZyk7Ci0gICAgICAgIH0KLQotICAgICAgICByZXR1cm4gLTE7Ci0gICAgfQotCi0gICAgLyoqCisgICAgIC8qKgogICAgICAqIFNlZSB7QGxpbmsgYW5kcm9pZC5uZXQud2lmaS5XaWZpTWFuYWdlciNyZW1vdmVOZXR3b3JrKGludCl9CiAgICAgICogQHBhcmFtIG5ldElkIHRoZSBpbnRlZ2VyIHRoYXQgaWRlbnRpZmllcyB0aGUgbmV0d29y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DxTY2FuUmVzdWx0PigpOwotCi0gICAgICAgIGludCBsaW5lQ291bnQgPSAwOwotCi0gICAgICAgIGludCByZXBseUxlbiA9IHJlcGx5Lmxlbmd0aCgpOwotICAgICAgICAvLyBQYXJzZSB0aGUgcmVzdWx0IHN0cmluZywga2VlcGluZyBpbiBtaW5kIHRoYXQgdGhlIGxhc3QgbGluZSBkb2VzCi0gICAgICAgIC8vIG5vdCBlbmQgd2l0aCBhIG5ld2xpbmUuCi0gICAgICAgIGZvciAoaW50IGxpbmVCZWcgPSAwLCBsaW5lRW5kID0gMDsgbGluZUVuZCA8PSByZXBseUxlbjsgKytsaW5lRW5kKSB7Ci0gICAgICAgICAgICBpZiAobGluZUVuZCA9PSByZXBseUxlbiB8fCByZXBseS5jaGFyQXQobGluZUVuZCkgPT0gJ1xuJykgewotICAgICAgICAgICAgICAgICsrbGluZUNvdW50OwotICAgICAgICAgICAgICAgIC8qCi0gICAgICAgICAgICAgICAgICogU2tpcCB0aGUgZmlyc3QgbGluZSwgd2hpY2ggaXMgYSBoZWFkZXIKLSAgICAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgICAgICBpZiAobGluZUNvdW50ID09IDEpIHsKLSAgICAgICAgICAgICAgICAgICAgbGluZUJlZyA9IGxpbmVFbmQgKyAxOwotICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgaWYgKGxpbmVFbmQgPiBsaW5lQmVnKSB7Ci0gICAgICAgICAgICAgICAgICAgIFN0cmluZyBsaW5lID0gcmVwbHkuc3Vic3RyaW5nKGxpbmVCZWcsIGxpbmVFbmQpOwotICAgICAgICAgICAgICAgICAgICBTY2FuUmVzdWx0IHNjYW5SZXN1bHQgPSBwYXJzZVNjYW5SZXN1bHQobGluZSk7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChzY2FuUmVzdWx0ICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHNjYW5MaXN0LmFkZChzY2FuUmVzdWx0KTsKLSAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChEQkcpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIFNsb2cudyhUQUcsICJtaXNmb3JtYXR0ZWQgc2NhbiByZXN1bHQgZm9yOiAiICsgbGluZSk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgbGluZUJlZyA9IGxpbmVFbmQgKyAxOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgICAgIG1XaWZpU3RhdGVUcmFja2VyLnNldFNjYW5SZXN1bHRzTGlzdChzY2FuTGlzdCk7Ci0gICAgICAgIHJldHVybiBzY2FuTGlzdDsKLSAgICB9Ci0KLSAgICAvKioKLSAgICAgKiBQYXJzZSB0aGUgc2NhbiByZXN1bHQgbGluZSBwYXNzZWQgdG8gdXMgYnkgd3BhX3N1cHBsaWNhbnQgKGhlbHBlcikuCi0gICAgICogQHBhcmFtIGxpbmUgdGhlIGxpbmUgdG8gcGFyc2UKLSAgICAgKiBAcmV0dXJuIHRoZSB7QGxpbmsgU2NhblJlc3VsdH0gb2JqZWN0Ci0gICAgICovCi0gICAgcHJpdmF0ZSBTY2FuUmVzdWx0IHBhcnNlU2NhblJlc3VsdChTdHJpbmcgbGluZSkgewotICAgICAgICBTY2FuUmVzdWx0IHNjYW5SZXN1bHQgPSBudWxsOwotICAgICAgICBpZiAobGluZSAhPSBudWxsKSB7Ci0gICAgICAgICAgICAvKgotICAgICAgICAgICAgICogQ2FjaGUgaW1wbGVtZW50YXRpb24gKExpbmtlZEhhc2hNYXApIGlzIG5vdCBzeW5jaHJvbml6ZWQsIHRodXMsCi0gICAgICAgICAgICAgKiBtdXN0IHN5bmNocm9uaXplZCBoZXJlIQotICAgICAgICAgICAgICovCi0gICAgICAgICAgICBzeW5jaHJvbml6ZWQgKG1TY2FuUmVzdWx0Q2FjaGUpIHsKLSAgICAgICAgICAgICAgICBTdHJpbmdbXSByZXN1bHQgPSBzY2FuUmVzdWx0UGF0dGVybi5zcGxpdChsaW5lKTsKLSAgICAgICAgICAgICAgICBpZiAoMyA8PSByZXN1bHQubGVuZ3RoICYmIHJlc3VsdC5sZW5ndGggPD0gNSkgewotICAgICAgICAgICAgICAgICAgICBTdHJpbmcgYnNzaWQgPSByZXN1bHRbMF07Ci0gICAgICAgICAgICAgICAgICAgIC8vIGJzc2lkIHwgZnJlcXVlbmN5IHwgbGV2ZWwgfCBmbGFncyB8IHNzaWQKLSAgICAgICAgICAgICAgICAgICAgaW50IGZyZXF1ZW5jeTsKLSAgICAgICAgICAgICAgICAgICAgaW50IGxldmVsOwotICAgICAgICAgICAgICAgICAgICB0cnkgewotICAgICAgICAgICAgICAgICAgICAgICAgZnJlcXVlbmN5ID0gSW50ZWdlci5wYXJzZUludChyZXN1bHRbMV0pOwotICAgICAgICAgICAgICAgICAgICAgICAgbGV2ZWwgPSBJbnRlZ2VyLnBhcnNlSW50KHJlc3VsdFsyXSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAvKiBzb21lIGltcGxlbWVudGF0aW9ucyBhdm9pZCBuZWdhdGl2ZSB2YWx1ZXMgYnkgYWRkaW5nIDI1NgotICAgICAgICAgICAgICAgICAgICAgICAgICogc28gd2UgbmVlZCB0byBhZGp1c3QgZm9yIHRoYXQgaGVyZS4KLSAgICAgICAgICAgICAgICAgICAgICAgICAqLwotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGxldmVsID4gMCkgbGV2ZWwgLT0gMjU2OwotICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChOdW1iZXJGb3JtYXRFeGNlcHRpb24gZSkgewotICAgICAgICAgICAgICAgICAgICAgICAgZnJlcXVlbmN5ID0gMDsKLSAgICAgICAgICAgICAgICAgICAgICAgIGxldmVsID0gMDsKLSAgICAgICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgICAgIC8qCi0gICAgICAgICAgICAgICAgICAgICAqIFRoZSBmb3JtYXR0aW5nIG9mIHRoZSByZXN1bHRzIHJldHVybmVkIGJ5Ci0gICAgICAgICAgICAgICAgICAgICAqIHdwYV9zdXBwbGljYW50IGlzIGludGVuZGVkIHRvIG1ha2UgdGhlIGZpZWxkcwotICAgICAgICAgICAgICAgICAgICAgKiBsaW5lIHVwIG5pY2VseSB3aGVuIHByaW50ZWQsCi0gICAgICAgICAgICAgICAgICAgICAqIG5vdCB0byBtYWtlIHRoZW0gZWFzeSB0byBwYXJzZS4gU28gd2UgaGF2ZSB0bwotICAgICAgICAgICAgICAgICAgICAgKiBhcHBseSBzb21lIGhldXJpc3RpY3MgdG8gZmlndXJlIG91dCB3aGljaCBmaWVsZAotICAgICAgICAgICAgICAgICAgICAgKiBpcyB0aGUgU1NJRCBhbmQgd2hpY2ggZmllbGQgaXMgdGhlIGZsYWdzLgotICAgICAgICAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgICAgICAgICAgU3RyaW5nIHNzaWQ7Ci0gICAgICAgICAgICAgICAgICAgIFN0cmluZyBmbGFnczsKLSAgICAgICAgICAgICAgICAgICAgaWYgKHJlc3VsdC5sZW5ndGggPT0gNCkgewotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHJlc3VsdFszXS5jaGFyQXQoMCkgPT0gJ1snKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgZmxhZ3MgPSByZXN1bHRbM107Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgc3NpZCA9ICIiOwotICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbGFncyA9ICIiOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNzaWQgPSByZXN1bHRbM107Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAocmVzdWx0Lmxlbmd0aCA9PSA1KSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBmbGFncyA9IHJlc3VsdFszXTsKLSAgICAgICAgICAgICAgICAgICAgICAgIHNzaWQgPSByZXN1bHRbNF07Ci0gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAvLyBIZXJlLCB3ZSBtdXN0IGhhdmUgMyBmaWVsZHM6IG5vIGZsYWdzIGFuZCBzc2lkCi0gICAgICAgICAgICAgICAgICAgICAgICAvLyBzZXQKLSAgICAgICAgICAgICAgICAgICAgICAgIGZsYWdzID0gIiI7Ci0gICAgICAgICAgICAgICAgICAgICAgICBzc2lkID0gIiI7Ci0gICAgICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgICAgICAvLyBic3NpZCArIHNzaWQgaXMgdGhlIGhhc2gga2V5Ci0gICAgICAgICAgICAgICAgICAgIFN0cmluZyBrZXkgPSBic3NpZCArIHNzaWQ7Ci0gICAgICAgICAgICAgICAgICAgIHNjYW5SZXN1bHQgPSBtU2NhblJlc3VsdENhY2hlLmdldChrZXkpOwotICAgICAgICAgICAgICAgICAgICBpZiAoc2NhblJlc3VsdCAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBzY2FuUmVzdWx0LmxldmVsID0gbGV2ZWw7Ci0gICAgICAgICAgICAgICAgICAgICAgICBzY2FuUmVzdWx0LlNTSUQgPSBzc2lkOwotICAgICAgICAgICAgICAgICAgICAgICAgc2NhblJlc3VsdC5jYXBhYmlsaXRpZXMgPSBmbGFnczsKLSAgICAgICAgICAgICAgICAgICAgICAgIHNjYW5SZXN1bHQuZnJlcXVlbmN5ID0gZnJlcXVlbmN5OwotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgLy8gRG8gbm90IGFkZCBzY2FuIHJlc3VsdHMgdGhhdCBoYXZlIG5vIFNTSUQgc2V0Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoMCA8IHNzaWQudHJpbSgpLmxlbmd0aCgpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NhblJlc3VsdCA9Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBTY2FuUmVzdWx0KAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3NpZCwgYnNzaWQsIGZsYWdzLCBsZXZlbCwgZnJlcXVlbmN5KTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBtU2NhblJlc3VsdENhY2hlLnB1dChrZXksIHNjYW5SZXN1bHQpOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgU2xvZy53KFRBRywgIk1pc2Zvcm1hdHRlZCBzY2FuIHJlc3VsdCB0ZXh0IHdpdGggIiArCi0gICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdC5sZW5ndGggKyAiIGZpZWxkczogIiArIGxpbmUpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIHJldHVybiBzY2FuUmVzdWx0OwotICAgIH0KLQotICAgIC8qKgotICAgICAqIFBhcnNlIHRoZSAiZmxhZ3MiIGZpZWxkIHBhc3NlZCBiYWNrIGluIGEgc2NhbiByZXN1bHQgYnkgd3BhX3N1cHBsaWNhbnQsCi0gICAgICogYW5kIGNvbnN0cnVjdCBhIHtAY29kZSBXaWZpQ29uZmlndXJhdGlvbn0gdGhhdCBkZXNjcmliZXMgdGhlIGVuY3J5cHRpb24sCi0gICAgICoga2V5IG1hbmFnZW1lbnQsIGFuZCBhdXRoZW50aWNhaW9uIGNhcGFiaWxpdGllcyBvZiB0aGUgYWNjZXNzIHBvaW50LgotICAgICAqIEBwYXJhbSBmbGFncyB0aGUgc3RyaW5nIHJldHVybmVkIGJ5IHdwYV9zdXBwbGljYW50Ci0gICAgICogQHJldHVybiB0aGUge0Bs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ZpZygpOwotICAgICAgICAgICAgaWYgKHJlc3VsdCAmJiBtTmVlZFJlY29uZmlnKSB7Ci0gICAgICAgICAgICAgICAgbU5lZWRSZWNvbmZpZyA9IGZhbHNlOwotICAgICAgICAgICAgICAgIHJlc3VsdCA9IG1XaWZpU3RhdGVUcmFja2VyLnJlbG9hZENvbmZpZygpOwotCi0gICAgICAgICAgICAgICAgaWYgKHJlc3VsdCkgewotICAgICAgICAgICAgICAgICAgICBJbnRlbnQgaW50ZW50ID0gbmV3IEludGVudChXaWZpTWFuYWdlci5ORVRXT1JLX0lEU19DSEFOR0VEX0FDVElPTik7Ci0gICAgICAgICAgICAgICAgICAgIG1Db250ZXh0LnNlbmRCcm9hZGNhc3QoaW50ZW50KTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICAgICAgLy8gSW5mb3JtIHRoZSBiYWNrdXAgbWFuYWdlciBhYm91dCBhIGRhdGEgY2hhbmdlCi0gICAgICAgIElCYWNrdXBNYW5hZ2VyIGlibSA9IElCYWNrdXBNYW5hZ2VyLlN0dWIuYXNJbnRlcmZhY2UoCi0gICAgICAgICAgICAgICAgU2VydmljZU1hbmFnZXIuZ2V0U2VydmljZShDb250ZXh0LkJBQ0tVUF9TRVJWSUNFKSk7Ci0gICAgICAgIGlmIChpYm0gIT0gbnVsbCkgewotICAgICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgICAgICBpYm0uZGF0YUNoYW5nZWQoImNvbS5hbmRyb2lkLnByb3ZpZGVycy5zZXR0aW5ncyIpOwotICAgICAgICAgICAgfSBjYXRjaCAoRXhjZXB0aW9uIGUpIHsKLSAgICAgICAgICAgICAgICAvLyBUcnkgYWdhaW4gbGF0ZXIKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgICAgICByZXR1cm4gcmVzdWx0OworICAgICAgICByZXR1cm4gbVdpZmlTdGF0ZU1hY2hpbmUuc3luY1NhdmVDb25maWcoKTsKICAgICB9C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GaSBpcyBub3QgY3VycmVudGx5IGVuYWJsZWQpLCBnZXQgdGhlIHZhbHVlIGZyb20KICAgICAgICAgICogU2V0dGluZ3MuCiAgICAgICAgICAqLwotICAgICAgICBudW1DaGFubmVscyA9IG1XaWZpU3RhdGVUcmFja2VyLmdldE51bUFsbG93ZWRDaGFubmVscygpOworICAgICAgICBudW1DaGFubmVscyA9IG1XaWZpU3RhdGVNYWNoaW5lLmdldE51bUFsbG93ZWRDaGFubmVscygpOwogICAgICAgICBpZiAobnVtQ2hhbm5lbHMgPCAwKSB7CiAgICAgICAgICAgICBudW1DaGFubmVscyA9IFNldHRpbmdzLlNlY3VyZS5nZXRJbnQobUNvbnRleHQuZ2V0Q29udGVudFJlc29sdmVyKCksCiAgICAgICAgICAgICAgICAgICAgIFNldHRpbmdzLlNlY3VyZS5XSUZJX05VTV9BTExPV0VEX0NIQU5ORUxTLApAQCAtMTY0NCw3ICs3MjMsNzYgQEAKICAgICAgKi8KICAgICBwdWJsaWMgRGhjcEluZm8gZ2V0RGhjcEluZm8oKSB7CiAgICAgICAgIGVuZm9yY2VBY2Nlc3NQZXJtaXNzaW9uKCk7Ci0gICAgICAgIHJldHVybiBtV2lmaVN0YXRlVHJhY2tlci5nZXREaGNwSW5mbygpOworICAgICAgICByZXR1cm4gbVdpZmlTdGF0ZU1hY2hpbmUuc3luY0dldERoY3BJbmZvKCk7CisgICAgfQorCisgICAgLyoqCisgICAgICogc2VlIHtAbGluayBhbmRyb2lkLm5ldC53aWZpLldpZmlNYW5hZ2VyI3N0YXJ0V2lmaX0KKyAgICAgKgorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHN0YXJ0V2lmaSgpIHsKKyAgICAgICAgZW5mb3JjZUNoYW5nZVBlcm1pc3Npb24oKTsKKyAgICAgICAgLyogVE9ETzogbWF5IGJlIGFkZCBwZXJtaXNzaW9ucyBmb3IgYWNjZXNzIG9ubHkgdG8gY29ubmVjdGl2aXR5IHNlcnZpY2UKKyAgICAgICAgICogV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NzaWQpIHsKKyAgICAgICAgZW5mb3JjZUNoYW5nZVBlcm1pc3Npb24oKTsKKworICAgICAgICBtV2lmaVN0YXRlTWFjaGluZS5hZGRUb0JsYWNrbGlzdChic3NpZCk7CisgICAgfQorCisgICAgLyoqCisgICAgICogc2VlIHtAbGluayBhbmRyb2lkLm5ldC53aWZpLldpZmlNYW5hZ2VyI2NsZWFyQmxhY2tsaXN0fQorICAgICAqCisgICAgICovCisgICAgcHVibGljIHZvaWQgY2xlYXJCbGFja2xpc3QoKSB7CisgICAgICAgIGVuZm9yY2VDaGFuZ2VQZXJtaXNzaW9uKCk7CisKKyAgICAgICAgbVdpZmlTdGF0ZU1hY2hpbmUuY2xlYXJCbGFja2xpc3QoKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBjb25uZWN0TmV0d29ya1dpdGhJZChpbnQgbmV0d29ya0lkKSB7CisgICAgICAgIGVuZm9yY2VDaGFuZ2VQZXJtaXNzaW9uKCk7CisgICAgICAgIG1XaWZpU3RhdGVNYWNoaW5lLmNvbm5lY3ROZXR3b3JrKG5ldHdvcmtJZCk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgY29ubmVjdE5ldHdvcmtXaXRoQ29uZmlnKFdpZmlDb25maWd1cmF0aW9uIGNvbmZpZykgeworICAgICAgICBlbmZvcmNlQ2hhbmdlUGVybWlzc2lvbigpOworICAgICAgICBtV2lmaVN0YXRlTWFjaGluZS5jb25uZWN0TmV0d29yayhjb25maWcpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHNhdmVOZXR3b3JrKFdpZmlDb25maWd1cmF0aW9uIGNvbmZpZykgeworICAgICAgICBlbmZvcmNlQ2hhbmdlUGVybWlzc2lvbigpOworICAgICAgICBtV2lmaVN0YXRlTWFjaGluZS5zYXZlTmV0d29yayhjb25maWcpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGZvcmdldE5ldHdvcmsoaW50IG5ldElkKSB7CisgICAgICAgIGVuZm9yY2VDaGFuZ2VQZXJtaXNzaW9uKCk7CisgICAgICAgIG1XaWZpU3RhdGVNYWNoaW5lLmZvcmdldE5ldHdvcmsobmV0SWQpOwogICAgIH0KIAogICAgIHByaXZhdGUgZmluYWwgQnJvYWRjYXN0UmVjZWl2ZXIgbVJlY2VpdmVyID0gbmV3IEJyb2FkY2FzdFJlY2VpdmVyKCkgewpAQCAtMTY2MywxNyArODExLDExIEBACiAgICAgICAgICAgICAgICAgbUFsYXJtTWFuYWdlci5jYW5jZWwobUlkbGVJbnRlbnQpOwogICAgICAgICAgICAgICAgIG1EZXZpY2VJZGxlID0gZmFsc2U7CiAgICAgICAgICAgICAgICAgbVNjcmVlbk9mZiA9IGZhbHNlOwotICAgICAgICAgICAgICAgIG1XaWZpU3RhdGVUcmFja2VyLmVuYWJsZVJzc2lQb2xsaW5nKHRydWUpOwotICAgICAgICAgICAgICAgIC8qIERIQ1Agb3Igb3RoZXIgdGVtcG9yYXJ5IGZhaWx1cmVzIGluIHRoZSBwYXN0IGNhbiBwcmV2ZW50Ci0gICAgICAgICAgICAgICAgICogYSBkaXNhYmxlZCBuZXR3b3JrIGZyb20gYmVpbmcgY29ubmVjdGVkIHRvLCBlbmFibGUgb24gc2NyZWVuIG9uCi0gICAgICAgICAgICAgICAgICovCi0gICAgICAgICAgICAgICAgaWYgKG1XaWZpU3RhdGVUcmFja2VyLmlzQW55TmV0d29ya0Rpc2FibGVkKCkpIHsKLSAgICAgICAgICAgICAgICAgICAgc2VuZEVuYWJsZU5ldHdvcmtzTWVzc2FnZSgpOwotICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBtV2lmaVN0YXRlTWFjaGluZS5lbmFibGVSc3NpUG9sbGluZyh0cnVlKTsKICAgICAgICAgICAgIH0gZWxzZSBpZiAoYWN0aW9uLmVxdWFscyhJbnRlbnQuQUNUSU9OX1NDUkVFTl9PRkYpKSB7CiAgICAgICAgICAgICAgICAgU2xvZy5kKFRBRywgIkFDVElPTl9TQ1JFRU5fT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vbWUgcmFjZSBjb25kaXRpb25zCi0gICAgICAgICAgICAgICAgICAgICAgICAvLyB3ZSBkb24ndCBoYXZlIHRpbWUgdG8gdHJhY2sgZG93biBmb3IgdGhpcyByZWxlYXNlLiAgRGVsYXkgaW5zdGVhZCwgYnV0IG5vdAotICAgICAgICAgICAgICAgICAgICAgICAgLy8gYXMgbG9uZyBhcyB3ZSB3b3VsZCBpZiBjb25uZWN0ZWQgKGJlbG93KQorICAgICAgICAgICAgICAgICAgICAgICAgLy8gd2UgZG9uJ3QgaGF2ZSB0aW1lIHRvIHRyYWNrIGRvd24gZm9yIHRoaXMgcmVsZWFzZS4gIERlbGF5IGluc3RlYWQsCisgICAgICAgICAgICAgICAgICAgICAgICAvLyBidXQgbm90IGFzIGxvbmcgYXMgd2Ugd291bGQgaWYgY29ubmVjdGVkIChiZWxvdykKICAgICAgICAgICAgICAgICAgICAgICAgIC8vIFRPRE8gLSBmaXggdGhlIHJhY2UgY29uZGl0aW9ucyBhbmQgc3dpdGNoIGJhY2sgdG8gdGhlIGltbWVkaWF0ZSB0dXJuLW9mZgogICAgICAgICAgICAgICAgICAgICAgICAgbG9uZyB0cmlnZ2VyVGltZSA9IFN5c3RlbS5jdXJyZW50VGltZU1pbGxpcygpICsgKDIqNjAqMTAwMCk7IC8vIDIgbWluCiAgICAgICAgICAgICAgICAgICAgICAgICBTbG9nLmQoVEFHLCAic2V0dGluZyBBQ1RJT05fREVWSUNFX0lETEUgdGltZXIgZm9yIDEyMCwwMDAgbXMiKTsKQEAgLTE3MzIsNyArODc0LDcgQEAKICAgICAgICAgICAgICAgICAgICAgICAgIGlzQmx1ZXRvb3RoUGxheWluZyA9IHRydWU7CiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgbVdpZmlTdGF0ZVRyYWNrZXIuc2V0Qmx1ZXRvb3RoU2Nhbk1vZGUoaXNCbHVldG9vdGhQbGF5aW5nKTsKKyAgICAgICAgICA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YXRlID09IFdJRklfQVBfU1RBVEVfRU5BQkxJTkcgfHwgbVdpZmlBcFN0YXRlID09IFdJRklfQVBfU1RBVEVfRU5BQkxFRCkpIHsKLSAgICAgICAgICAgICAgICBzV2FrZUxvY2suYWNxdWlyZSgpOwotICAgICAgICAgICAgICAgIHNlbmRBY2Nlc3NQb2ludE1lc3NhZ2UoZmFsc2UsIG51bGwsIG1MYXN0QXBFbmFibGVVaWQpOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBpZiAod2lmaVNob3VsZEJlRW5hYmxlZCkgewotICAgICAgICAgICAgICAgIGlmICh3aWZpU2hvdWxkQmVTdGFydGVkKSB7Ci0gICAgICAgICAgICAgICAgICAgIHNXYWtlTG9jay5hY3F1aXJlKCk7Ci0gICAgICAgICAgICAgICAgICAgIHNlbmRFbmFibGVNZXNzYWdlKHRydWUsIGZhbHNlLCBtTGFzdEVuYWJsZVVpZCk7Ci0gICAgICAgICAgICAgICAgICAgIHNXYWtlTG9jay5hY3F1aXJlKCk7Ci0gICAgICAgICAgICAgICAgICAgIHNlbmRTdGFydE1lc3NhZ2Uoc3Ryb25nZXN0TG9ja01vZGUpOwotICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoIW1XaWZpU3RhdGVUcmFja2VyLmlzRHJpdmVyU3RvcHBlZCgpKSB7Ci0gICAgICAgICAgICAgICAgICAgIGludCB3YWtlTG9ja1RpbWVvdXQgPQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNldHRpbmdzLlNlY3VyZS5nZXRJbnQoCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtQ29udGV4dC5nZXRDb250ZW50UmVzb2x2ZXIoKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNldHRpbmdzLlNlY3VyZS5XSUZJX01PQklMRV9EQVRBX1RSQU5TSVRJT05fV0FLRUxPQ0tfVElNRU9VVF9NUywKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERFRkFVTFRfV0FLRUxPQ0tfVElNRU9VVCk7Ci0gICAgICAgICAgICAgICAgICAgIC8qCi0gICAgICAgICAgICAgICAgICAgICAqIFdlIGFyZSBhc3N1bWluZyB0aGF0IENvbm5lY3Rpdml0eVNlcnZpY2UgY2FuIG1ha2UKLSAgICAgICAgICAgICAgICAgICAgICogYSB0cmFuc2l0aW9uIHRvIGNlbGx1bGFyIGRhdGEgd2l0aGluIHdha2VMb2NrVGltZW91dCB0aW1lLgotICAgICAgICAgICAgICAgICAgICAgKiBUaGUgd2FrZWxvY2sgaXMgcmVsZWFzZWQgYnkgdGhlIGRlbGF5ZWQgbWVzc2FnZS4KLSAgICAgICAgICAgICAgICAgICAgICovCi0gICAgICAgICAgICAgICAgICAgIHNEcml2ZXJTdG9wV2FrZUxvY2suYWNxdWlyZSgpOwotICAgICAgICAgICAgICAgICAgICBtV2lmaUhhbmRsZXIuc2VuZEVtcHR5TWVzc2FnZShNRVNTQUdFX1NUT1BfV0lGSSk7Ci0gICAgICAgICAgICAgICAgICAgIG1XaWZpSGFuZGxlci5zZW5kRW1wdHlNZXNzYWdlRGVsYXllZChNRVNTQUdFX1JFTEVBU0VfV0FLRUxPQ0ssIHdha2VMb2NrVGltZW91dCk7Ci0gICAgICAgICAgICAgICAgfQorICAgICAgICBpZiAod2lmaVNob3VsZEJlRW5hYmxlZCkgeworICAgICAgICAgICAgaWYgKHdpZmlTaG91bGRCZVN0YXJ0ZWQpIHsKKyAgICAgICAgICAgICAgICBtV2lmaVN0YXRlTWFjaGluZS5zZXRXaWZpRW5hYmxlZCh0cnVlKTsKKyAgICAgICAgICAgICAgICBtV2lmaVN0YXRlTWFjaGluZS5zZXRTY2FuT25seU1vZGUoCisgICAgICAgICAgICAgICAgICAgICAgICBzdHJvbmdlc3RMb2NrTW9kZSA9PSBXaWZpTWFuYWdlci5XSUZJX01PREVfU0NBTl9PTkxZKTsKKyAgICAgICAgICAgICAgICBtV2lmaVN0YXRlTWFjaGluZS5zZ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FibGVkQmxvY2tpbmcodHJ1ZSwgbXNnLmFyZzEgPT0gMSwgbXNnLmFyZzIpOwotICAgICAgICAgICAgICAgICAgICBpZiAobVdpZmlXYXRjaGRvZ1NlcnZpY2UgPT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICAgICAgbVdpZmlXYXRjaGRvZ1NlcnZpY2UgPSBuZXcgV2lmaVdhdGNoZG9nU2VydmljZShtQ29udGV4dCwgbVdpZmlTdGF0ZVRyYWNrZXIpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIHNXYWtlTG9jay5yZWxlYXNlKCk7Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotCi0gICAgICAgICAgICAgICAgY2FzZSBNRVNTQUdFX1NUQVJUX1dJRkk6Ci0gICAgICAgICAgICAgICAgICAgIG1XaWZpU3RhdGVUcmFja2VyLnNldFNjYW5Pbmx5TW9kZShtc2cuYXJnMSA9PSBXaWZpTWFuYWdlci5XSUZJX01PREVfU0NBTl9PTkxZKTsKLSAgICAgICAgICAgICAgICAgICAgbVdpZmlTdGF0ZVRyYWNrZXIucmVzdGFydCgpOwotICAgICAgICAgICAgICAgICAgICBtV2lmaVN0YXRlVHJhY2tlci5zZXRIaWdoUGVyZk1vZGUobXNnLmFyZzEgPT0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBXaWZpTWFuYWdlci5XSUZJX01PREVfRlVMTF9ISUdIX1BFUkYpOwotICAgICAgICAgICAgICAgICAgICBzV2FrZUxvY2sucmVsZWFzZSgpOwotICAgICAgICAgICAgICAgICAgICBicmVhazsKLQotICAgICAgICAgICAgICAgIGNhc2UgTUVTU0FHRV9VUERBVEVfU1RBVEU6Ci0gICAgICAgICAgICAgICAgICAgIGRvVXBkYXRlV2lmaVN0YXRlKCk7Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotCi0gICAgICAgICAgICAgICAgY2FzZSBNRVNTQUdFX0RJU0FCTEVfV0lGSToKLSAgICAgICAgICAgICAgICAgICAgLy8gYSBub24temVybyBtc2cuYXJnMSB2YWx1ZSBtZWFucyB0aGUgImVuYWJsZWQiIHNldHRpbmcKLSAgICAgICAgICAgICAgICAgICAgLy8gc2hvdWxkIGJlIHBlcnNpc3RlZAotICAgICAgICAgICAgICAgICAgICBzZXRXaWZpRW5hYmxlZEJsb2NraW5nKGZhbHNlLCBtc2cuYXJnMSA9PSAxLCBtc2cuYXJnMik7Ci0gICAgICAgICAgICAgICAgICAgIG1XaWZpV2F0Y2hkb2dTZXJ2aWNlID0gbnVsbDsKLSAgICAgICAgICAgICAgICAgICAgc1dha2VMb2NrLnJlbGVhc2UoKTsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgICAgICAgICBjYXNlIE1FU1NBR0VfU1RPUF9XSUZJOgotICAgICAgICAgICAgICAgICAgICBtV2lmaVN0YXRlVHJhY2tlci5kaXNjb25uZWN0QW5kU3RvcCgpOwotICAgICAgICAgICAgICAgICAgICAvLyBkb24ndCByZWxlYXNlIHdha2Vsb2NrCi0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotCi0gICAgICAgICAgICAgICAgY2FzZSBNRVNTQUdFX1JFTEVBU0VfV0FLRUxPQ0s6Ci0gICAgICAgICAgICAgICAgICAgIHNEcml2ZXJTdG9wV2FrZUxvY2sucmVsZWFzZSgpOwotICAgICAgICAgICAgICAgICAgICBicmVhazsKLQotICAgICAgICAgICAgICAgIGNhc2UgTUVTU0FHRV9TVEFSVF9BQ0NFU1NfUE9JTlQ6Ci0gICAgICAgICAgICAgICAgICAgIHNldFdpZmlBcEVuYWJsZWRCbG9ja2luZyh0cnVlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbXNnLmFyZzEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoV2lmaUNvbmZpZ3VyYXRpb24pIG1zZy5vYmopOwotICAgICAgICAgICAgICAgICAgICBzV2FrZUxvY2sucmVsZWFzZSgpOwotICAgICAgICAgICAgICAgICAgICBicmVhazsKLQotICAgICAgICAgICAgICAgIGNhc2UgTUVTU0FHRV9TVE9QX0FDQ0VTU19QT0lOVDoKLSAgICAgICAgICAgICAgICAgICAgc2V0V2lmaUFwRW5hYmxlZEJsb2NraW5nKGZhbHNlLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbXNnLmFyZzEsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoV2lmaUNvbmZpZ3VyYXRpb24pIG1zZy5vYmopOwotICAgICAgICAgICAgICAgICAgICBzV2FrZUxvY2sucmVsZWFzZSgpOwotICAgICAgICAgICAgICAgICAgICBicmVhazsKLQotICAgICAgICAgICAgICAgIGNhc2UgTUVTU0FHRV9TRVRfQ0hBTk5FTFM6Ci0gICAgICAgICAgICAgICAgICAgIHNldE51bUFsbG93ZWRDaGFubmVsc0Jsb2NraW5nKG1zZy5hcmcxLCBtc2cuYXJnMiA9PSAxKTsKLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgICAgICAgICBjYXNlIE1FU1NBR0VfRU5BQkxFX05FVFdPUktTOgotICAgICAgICAgICAgICAgICAgICBtV2lmaVN0YXRlVHJhY2tlci5lbmFibGVBbGxOZXR3b3JrcyhnZXRDb25maWd1cmVkTmV0d29ya3MoKSk7Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotCi0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICB9Ci0KICAgICBAT3ZlcnJpZGUKICAgICBwcm90ZWN0ZWQgdm9pZCBkdW1wKEZpbGVEZXNjcmlwdG9yIGZkLCBQcmludFdyaXRlciBwdywgU3RyaW5nW10gYXJncykgewogICAgICAgICBpZiAobUNvbnRleHQuY2hlY2tDYWxsaW5nT3JTZWxmUGVybWlzc2lvbihhbmRyb2lkLk1hbmlmZXN0LnBlcm1pc3Npb24uRFVNUCkKQEAgLTE5ODQsMTcgKzEwMDIsMTcgQEAKICAgICAgICAgICAgICAgICAgICAgKyAiLCB1aWQ9IiArIEJpbmRlci5nZXRDYWxsaW5nVWlkKCkpOwogICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICB9Ci0gICAgICAgIHB3LnByaW50bG4oIldpLUZpIGlzICIgKyBzdGF0ZU5hbWUobVdpZmlTdGF0ZVRyYWNrZXIuZ2V0V2lmaVN0YXRlKCkpKTsKKyAgICAgICAgcHcucHJpbnRsbigiV2ktRmkgaXMgIiArIG1XaWZpU3RhdGVNYWNoaW5lLnN5bmNHZXRXaWZpU3RhdGVCeU5hbWUoKSk7CiAgICAgICAgIHB3LnByaW50bG4oIlN0YXktYXdha2UgY29uZGl0aW9uczogIiArCiAgICAgICAgICAgICAgICAgU2V0dGluZ3MuU3lzdGVtLmdldEludChtQ29udGV4dC5nZXRDb250ZW50UmVzb2x2ZXIoKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNldHRpbmdzLlN5c3RlbS5TVEFZX09OX1dISUxFX1BMVUdHRURfSU4sIDApKTsKICAgICAgICAgcHcucHJpbnRsbigpOwogCiAgICAgICAgIHB3LnByaW50bG4oIkludGVybmFsIHN0YXRlOiIpOwotICAgICAgICBwdy5wcmludGxuKG1XaWZpU3RhdGVUcmFja2VyKTsKKyAgICAgICAgcHcucHJpbnRsbihtV2lmaVN0YXRlTWFjaGluZSk7CiAgICAgICAgIHB3LnByaW50bG4oKTsKICAgICAgICAgcHcucHJpbnRsbigiTGF0ZXN0IHNjYW4gcmVzdWx0czoiKTsKLSAgICAgICAgTGlzdDxTY2FuUmVzdWx0PiBzY2FuUmVzdWx0cyA9IG1XaWZpU3RhdGVUcmFja2VyLmdldFNjYW5SZXN1bHRzTGlzdCgpOworICAgICAgICBMaXN0PFNjYW5SZXN1bHQ+IHNjYW5SZXN1bHRzID0gbVdpZmlTdGF0ZU1hY2hpbmUuc3luY0dldFNjYW5S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gICAgIGNhc2UgV0lGSV9TVEFURV9ESVNBQkxJTkc6Ci0gICAgICAgICAgICAgICAgcmV0dXJuICJkaXNhYmxpbmciOwotICAgICAgICAgICAgY2FzZSBXSUZJX1NUQVRFX0RJU0FCTEVEOgotICAgICAgICAgICAgICAgIHJldHVybiAiZGlzYWJsZWQiOwotICAgICAgICAgICAgY2FzZSBXSUZJX1NUQVRFX0VOQUJMSU5HOgotICAgICAgICAgICAgICAgIHJldHVybiAiZW5hYmxpbmciOwotICAgICAgICAgICAgY2FzZSBXSUZJX1NUQVRFX0VOQUJMRUQ6Ci0gICAgICAgICAgICAgICAgcmV0dXJuICJlbmFibGVkIjsKLSAgICAgICAgICAgIGNhc2UgV0lGSV9TVEFURV9VTktOT1dOOgotICAgICAgICAgICAgICAgIHJldHVybiAidW5rbm93biBzdGF0ZSI7Ci0gICAgICAgICAgICBkZWZhdWx0OgotICAgICAgICAgICAgICAgIHJldHVybiAiW2ludmFsaWQgc3RhdGVdIjsKLSAgICAgICAgfQotICAgIH0KLQogICAgIHByaXZhdGUgY2xhc3MgV2lmaUxvY2sgZXh0ZW5kcyBEZWF0aFJlY2lwaWVudCB7CiAgICAgICAgIFdpZmlMb2NrKGludCBsb2NrTW9kZSwgU3RyaW5nIHRhZywgSUJpbmRlciBiaW5kZXIpIHsKICAgICAgICAgICAgIHN1cGVyKGxvY2tNb2RlLCB0YWcsIGJpbmRlcik7CkBAIC0yMDY2LDE1ICsxMDY1LDExIEBACiAgICAgICAgICAgICBpZiAobUxpc3QuaXNFbXB0eSgpKSB7CiAgICAgICAgICAgICAgICAgcmV0dXJuIFdpZmlNYW5hZ2VyLldJRklfTU9ERV9GVUxMOwogICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBpZiAobUZ1bGxIaWdoUGVyZkxvY2tzQWNxdWlyZWQgPiBtRnVsbEhpZ2hQZXJmTG9ja3NSZWxlYXNlZCkgewotICAgICAgICAgICAgICAgIHJldHVybiBXaWZpTWFuYWdlci5XSUZJX01PREVfRlVMTF9ISUdIX1BFUkY7CisgICAgICAgICAgICBmb3IgKFdpZmlMb2NrIGwgOiBtTGlzdCkgeworICAgICAgICAgICAgICAgIGlmIChsLm1Nb2RlID09IFdpZmlNYW5hZ2VyLldJRklfTU9ERV9GVUxMKSB7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBXaWZpTWFuYWdlci5XSUZJX01PREVfRlVMTDsKKyAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgIGlmIChtRnVsbExvY2tzQWNxdWlyZWQgPiBtRnVsbExvY2tzUmVsZWFzZWQpIHsKLSAgICAgICAgICAgICAgICByZXR1cm4gV2lmaU1hbmFnZXIuV0lGSV9NT0RFX0ZVTEw7Ci0gICAgICAgICAgICB9Ci0KICAgICAgICAgICAgIHJldHVybiBXaWZpTWFuYWdlci5XSUZJX01PREVfU0NBTl9PTkxZOwogICAgICAgICB9CiAKQEAgLTIxMTMsMTEgKzExMDgsNyBAQAogCiAgICAgcHVibGljIGJvb2xlYW4gYWNxdWlyZVdpZmlMb2NrKElCaW5kZXIgYmluZGVyLCBpbnQgbG9ja01vZGUsIFN0cmluZyB0YWcpIHsKICAgICAgICAgbUNvbnRleHQuZW5mb3JjZUNhbGxpbmdPclNlbGZQZXJtaXNzaW9uKGFuZHJvaWQuTWFuaWZlc3QucGVybWlzc2lvbi5XQUtFX0xPQ0ssIG51bGwpOwotICAgICAgICBpZiAobG9ja01vZGUgIT0gV2lmaU1hbmFnZXIuV0lGSV9NT0RFX0ZVTEwgJiYKLSAgICAgICAgICAgICAgICBsb2NrTW9kZSAhPSBXaWZpTWFuYWdlci5XSUZJX01PREVfU0NBTl9PTkxZICYmCi0gICAgICAgICAgICAgICAgbG9ja01vZGUgIT0gV2lmaU1hbmFnZXIuV0lGSV9NT0RFX0ZVTExfSElHSF9QRVJGKSB7Ci0gICAgICAgICAgICBTbG9nLmUoVEFHLCAiSWxsZWdhbCBhcmd1bWVudCwgbG9ja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ubm90ZVNjYW5XaWZpTG9ja0FjcXVpcmVkKHVpZCk7CkBAIC0yMTg0LDEwICsxMTY5LDYgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICsrbUZ1bGxMb2Nrc1JlbGVhc2VkOwogICAgICAgICAgICAgICAgICAgICAgICAgbUJhdHRlcnlTdGF0cy5ub3RlRnVsbFdpZmlMb2NrUmVsZWFzZWQodWlkKTsKICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgICAgICAgICBjYXNlIFdpZmlNYW5hZ2VyLldJRklfTU9ERV9GVUxMX0hJR0hfUEVSRjoKLSAgICAgICAgICAgICAgICAgICAgICAgICsrbUZ1bGxIaWdoUGVyZkxvY2tzUmVsZWFzZWQ7Ci0gICAgICAgICAgICAgICAgICAgICAgICBtQmF0dGVyeVN0YXRzLm5vdGVGdWxsV2lmaUxvY2tSZWxlYXNlZCh1aWQpOwotICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgIGNhc2UgV2lmaU1hbmFnZXIuV0lGSV9NT0RFX1NDQU5fT05MWToKICAgICAgICAgICAgICAgICAgICAgICAgICsrbVNjYW5Mb2Nrc1JlbGVhc2VkOwogICAgICAgICAgICAgICAgICAgICAgICAgbUJhdHRlcnlTdGF0cy5ub3RlU2NhbldpZmlMb2NrUmVsZWFzZWQodWlkKTsKQEAgLTIyNTgsNyArMTIzOSw3IEBACiAgICAgICAgICAgICBpZiAobU11bHRpY2FzdGVycy5zaXplKCkgIT0gMCkgewogICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgbVdpZmlTdGF0ZVRyYWNrZXIuc3RhcnRQYWNrZXRGaWx0ZXJpbmcoKTsKKyAgICAgICAgICAgICAgICBtV2lmaVN0YXRlTWFjaGluZS5zdGFydFBhY2tldEZpbHRlcmluZygpOwogICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAg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gICAgIC8vIElmIHdlIHNob3VsZG4ndCBwbGFjZSBhIG5vdGlmaWNhdGlvbiBvbiBhdmFpbGFibGUgbmV0d29ya3MsIHRoZW4KKyAgICAgICAgLy8gZG9uJ3QgYm90aGVyIGRvaW5nIGFueSBvZiB0aGUgZm9sbG93aW5nCisgICAgICAgIGlmICghbU5vdGlmaWNhdGlvbkVuYWJsZWQpIHJldHVybjsKKworICAgICAgICBTdGF0ZSBzdGF0ZSA9IG1OZXR3b3JrSW5mby5nZXRTdGF0ZSgpOworICAgICAgICBpZiAoKHN0YXRlID09IE5ldHdvcmtJbmZvLlN0YXRlLkRJU0NPTk5FQ1RFRCkKKyAgICAgICAgICAgICAgICB8fCAoc3RhdGUgPT0gTmV0d29ya0luZm8uU3RhdGUuVU5LTk9XTikpIHsKKyAgICAgICAgICAgIC8vIExvb2sgZm9yIGFuIG9wZW4gbmV0d29yaworICAgICAgICAgICAgTGlzdDxTY2FuUmVzdWx0PiBzY2FuUmVzdWx0cyA9IG1XaWZpU3RhdGVNYWNoaW5lLnN5bmNHZXRTY2FuUmVzdWx0c0xpc3QoKTsKKyAgICAgICAgICAgIGlmIChzY2FuUmVzdWx0cyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgaW50IG51bU9wZW5OZXR3b3JrcyA9IDA7CisgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IHNjYW5SZXN1bHRzLnNpemUoKSAtIDE7IGkgPj0gMDsgaS0tKSB7CisgICAgICAgICAgICAgICAgICAgIFNjYW5SZXN1bHQgc2NhblJlc3VsdCA9IHNjYW5SZXN1bHRzLmdldChpKTsKKworICAgICAgICAgICAgICAgICAgICBpZiAoVGV4dFV0aWxzLmlzRW1wdHkoc2NhblJlc3VsdC5jYXBhYmlsaXRpZXMpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBudW1PcGVuTmV0d29ya3MrKzsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIGlmIChudW1PcGVuTmV0d29ya3MgPiAwKSB7CisgICAgICAgICAgICAgICAgICAgIGlmICgrK21OdW1TY2Fuc1NpbmNlTmV0d29ya1N0YXRlQ2hhbmdlID49IE5VTV9TQ0FOU19CRUZPUkVfQUNUVUFMTFlfU0NBTk5JTkcpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8qCisgICAgICAgICAgICAgICAgICAgICAgICAgKiBXZSd2ZSBzY2FubmVkIGNvbnRpbnVvdXNseSBhdCBsZWFzdAorICAgICAgICAgICAgICAgICAgICAgICAgICogTlVNX1NDQU5TX0JFRk9SRV9OT1RJRklDQVRJT04gdGltZXMuIFRoZSB1c2VyCisgICAgICAgICAgICAgICAgICAgICAgICAgKiBwcm9iYWJseSBkb2VzIG5vdCBoYXZlIGEgcmVtZW1iZXJlZCBuZXR3b3JrIGluIHJhbmdlLAorICAgICAgICAgICAgICAgICAgICAgICAgICogc2luY2Ugb3RoZXJ3aXNlIHN1cHBsaWNhbnQgd291bGQgaGF2ZSB0cmllZCB0bworICAgICAgICAgICAgICAgICAgICAgICAgICogYXNzb2NpYXRlIGFuZCB0aHVzIHJlc2V0dGluZyB0aGlzIGNvdW50ZXIuCisgICAgICAgICAgICAgICAgICAgICAgICAgKi8KKyAgICAgICAgICAgICAgICAgICAgICAgIHNldE5vdGlmaWNhdGlvblZpc2libGUodHJ1ZSwgbnVtT3Blbk5ldHdvcmtzLCBmYWxzZSwgMCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIC8vIE5vIG9wZW4gbmV0d29ya3MgaW4gcmFuZ2UsIHJlbW92ZSB0aGUgbm90aWZpY2F0aW9uCisgICAgICAgIHNldE5vdGlmaWNhdGlvblZpc2libGUoZmFsc2UsIDAsIGZhbHNlLCAwKTsKKyAgICB9CisKKyAgICAvKioKKyAgICA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gIHByaXZhdGUgdm9pZCBzZXROb3RpZmljYXRpb25WaXNpYmxlKGJvb2xlYW4gdmlzaWJsZSwgaW50IG51bU5ldHdvcmtzLCBib29sZWFuIGZvcmNlLAorICAgICAgICAgICAgaW50IGRlbGF5KSB7CisKKyAgICAgICAgLy8gU2luY2Ugd2UgdXNlIGF1dG8gY2FuY2VsIG9uIHRoZSBub3RpZmljYXRpb24sIHdoZW4gdGhlCisgICAgICAgIC8vIG1OZXR3b3Jrc0F2YWlsYWJsZU5vdGlmaWNhdGlvblNob3duIGlzIHRydWUsIHRoZSBub3RpZmljYXRpb24gbWF5CisgICAgICAgIC8vIGhhdmUgYWN0dWFsbHkgYmVlbiBjYW5jZWxlZC4gIEhvd2V2ZXIsIHdoZW4gaXQgaXMgZmFsc2Ugd2Uga25vdworICAgICAgICAvLyBmb3Igc3VyZSB0aGF0IGl0IGlzIG5vdCBiZWluZyBzaG93biAoaXQgd2lsbCBub3QgYmUgc2hvd24gYW55IG90aGVyCisgICAgICAgIC8vIHBsYWNlIHRoYW4gaGVyZSkKKworICAgICAgICAvLyBJZiBpdCBzaG91bGQgYmUgaGlkZGVuIGFuZCBpdCBpcyBhbHJlYWR5IGhpZGRlbiwgdGhlbiBub29wCisgICAgICAgIGlmICghdmlzaWJsZSAmJiAhbU5vdGlmaWNhdGlvblNob3duICYmICFmb3JjZSkgeworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisKKyAgICAgICAgTm90aWZpY2F0aW9uTWFuYWdlciBub3RpZmljYXRpb25NYW5hZ2VyID0gKE5vdGlmaWNhdGlvbk1hbmFnZXIpIG1Db250ZXh0CisgICAgICAgICAgICAgICAgLmdldFN5c3RlbVNlcnZpY2UoQ29udGV4dC5OT1RJRklDQVRJT05fU0VSVklDRSk7CisKKyAgICAgICAgTWVzc2FnZSBtZXNzYWdlOworICAgICAgICBpZiAodmlzaWJsZSkgeworCisgICAgICAgICAgICAvLyBOb3QgZW5vdWdoIHRpbWUgaGFzIHBhc3NlZCB0byBzaG93IHRoZSBub3RpZmljYXRpb24gYWdhaW4KKyAgICAgICAgICAgIGlmIChTeXN0ZW0uY3VycmVudFRpbWVNaWxsaXMoKSA8IG1Ob3RpZmljYXRpb25SZXBlYXRUaW1lKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAobU5vdGlmaWNhdGlvbiA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgLy8gQ2FjaGUgdGhlIE5vdGlmaWNhdGlvbiBvYmplY3QuCisgICAgICAgICAgICAgICAgbU5vdGlmaWNhdGlvbiA9IG5ldyBOb3RpZmljYXRpb24oKTsKKyAgICAgICAgICAgICAgICBtTm90aWZpY2F0aW9uLndoZW4gPSAwOworICAgICAgICAgICAgICAgIG1Ob3RpZmljYXRpb24uaWNvbiA9IElDT05fTkVUV09SS1NfQVZBSUxBQkxFOworICAgICAgICAgICAgICAgIG1Ob3RpZmljYXRpb24uZmxhZ3MgPSBOb3RpZmljYXRpb24uRkxBR19BVVRPX0NBTkNFTDsKKyAgICAgICAgICAgICAgICBtTm90aWZpY2F0aW9uLmNvbnRlbnRJbnRlbnQgPSBQZW5kaW5nSW50ZW50LmdldEFjdGl2aXR5KG1Db250ZXh0LCAwLAorICAgICAgICAgICAgICAgICAgICAgICAgbmV3IEludGVudChXaWZpTWFuYWdlci5BQ1RJT05fUElDS19XSUZJX05FVFdPUkspLCAwKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgQ2hhclNlcXVlbmNlIHRpdGxlID0gbUNvbnRleHQuZ2V0UmVzb3VyY2VzKCkuZ2V0UXVhbnRpdHlUZXh0KAorICAgICAgICAgICAgICAgICAgICBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnBsdXJhbHMud2lmaV9hdmFpbGFibGUsIG51bU5ldHdvcmtzKTsKKyAgICAgICAgICAgIENoYXJTZXF1ZW5jZSBkZXRhaWxzID0gbUNvbnRleHQuZ2V0UmVzb3VyY2VzKCkuZ2V0UXVhbnRpdHlUZXh0KAorICAgICAgICAgICAgICAgICAgICBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnBsdXJhbHMud2lmaV9hdmFpbGFibGVfZGV0YWlsZWQsIG51bU5ldHdvcmtzKTsKKyAgICAgICAgICAgIG1Ob3RpZmljYXRpb24udGlja2VyVGV4dCA9IHRpdGxlOworICAgICAgICAgICAgbU5vdGlmaWNhdGlvbi5zZXRMYXRlc3RFdmVudEluZm8obUNvbnRleHQsIHRpdGxlLCBkZXRhaWxzLCBtTm90aWZpY2F0aW9uLmNvbnRlbnRJbnRlbnQpOworCisgICAgICAgICAgICBtTm90aWZpY2F0aW9uUmVwZWF0VGltZSA9IFN5c3RlbS5jdXJyZW50VGltZU1pbGxpcygpICsgTk9USUZJQ0FUSU9OX1JFUEVBVF9ERUxBWV9NUzsKKworICAgICAgICAgICAgbm90aWZpY2F0aW9uTWFuYWdlci5ub3RpZnkoSUNPTl9ORVRXT1JLU19BVkFJTEFCTEUsIG1Ob3RpZmljYXRpb24pOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgbm90aWZpY2F0aW9uTWFuYWdlci5jYW5jZWwoSUNPTl9ORVRXT1JLU19BVkFJTEFCTEUpOworICAgICAgICB9CisKKyAgICAgICAgbU5vdGlmaWNhdGlvblNob3duID0gdmlzaWJsZTsKKyAgICB9CisKKyAgICBwcml2YXRlIGNsYXNzIE5vdGlmaWNhdGlvbkVuYWJsZWRTZXR0aW5nT2JzZXJ2ZXIgZXh0ZW5kcyBDb250ZW50T2JzZXJ2ZXIgeworCisgICAgICAgIHB1YmxpYyBOb3RpZmljYXRpb25FbmFibGVkU2V0dGluZ09ic2VydmVyKEhhbmRsZXIgaGFuZGxlcikgeworICAgICAgICAgICAgc3VwZXIoaGFuZGxlcik7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgdm9pZCByZWdpc3RlcigpIHsKKyAgICAgICAgICAgIENvbnRlbnRSZXNvbHZlciBjciA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OwotICAgICAgICAgICAgICAgIG1Jbml0aWFsRGlzcGxheUhlaWdodCA9IG1EaXNwbGF5LmdldEhlaWdodCgpOwotICAgICAgICAgICAgICAgIG1JbnB1dE1hbmFnZXIuc2V0RGlzcGxheVNpemUoMCwgbUluaXRpYWxEaXNwbGF5V2lkdGgsIG1Jbml0aWFsRGlzcGxheUhlaWdodCk7Ci0gICAgICAgICAgICAgICAgcmVwb3J0TmV3Q29uZmlnID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJEaXNwbGF5IGhhcyBub3QgYmVlbiBpbml0aWFsaWFsaXplZCIpOwogICAgICAgICAgICAgfQogCiAgICAgICAgICAgICBpZiAobVdpbmRvd01hcC5jb250YWluc0tleShjbGllbnQuYXNCaW5kZXIoKSkpIHsKQEAgLTE5MDUsNyArMTg5Nyw3IEBACiAKICAgICAgICAgICAgIHJlcyA9IFdpbmRvd01hbmFnZXJJbXBsLkFERF9PS0FZOwogCi0gICAgICAgICAgICBmaW5hbCBsb25nIG9yaWdJZCA9IEJpbmRlci5jbGVhckNhbGxpbmdJZGVudGl0eSgpOworICAgICAgICAgICAgb3JpZ0lkID0gQmluZGVyLmNsZWFyQ2FsbGluZ0lkZW50aXR5KCk7CiAKICAgICAgICAgICAgIGlmIChhZGRUb2tlbikgewogICAgICAgICAgICAgICAgIG1Ub2tlbk1hcC5wdXQoYXR0cnMudG9rZW4sIHRva2VuKTsKQEAgLTE5ODIsMTQgKzE5NzQsMTAgQEAKICAgICAgICAgICAgIH0KICAgICAgICAgfQogCi0gICAgICAgIC8vIHNlbmROZXdDb25maWd1cmF0aW9uKCkgY2hlY2tzIGNhbGxlciBwZXJtaXNzaW9ucyBzbyB3ZSBtdXN0IGNhbGwgaXQgd2l0aAotICAgICAgICAvLyBwcml2aWxlZ2UuICB1cGRhdGVPcmllbnRhdGlvbkZyb21BcHBUb2tlbnMoKSBjbGVhcnMgYW5kIHJlc2V0cyB0aGUgY2FsbGVyCi0gICAgICAgIC8vIGlkZW50aXR5IGFueXdheSwgc28gaXQncyBzYWZlIHRvIGp1c3QgY2xlYXIgJiByZXN0b3JlIGFyb3VuZCB0aGlzIHdob2xlCi0gICAgICAgIC8vIGJsb2NrLgotICAgICAgICBmaW5hbCBsb25nIG9yaWdJZCA9IEJpbmRlci5jbGVhckNhbGxpbmdJZGVudGl0eSgpOwogICAgICAgICBpZiAocmVwb3J0TmV3Q29uZmlnKSB7CiAgICAgICAgICAgICBzZW5kTmV3Q29uZmlndXJhdGlvbigpOwogICAgICAgICB9CisKICAgICAgICAgQmluZGVyLnJlc3RvcmVDYWxsaW5nSWRlbnRpdHkob3JpZ0lkKTsKIAogICAgICAgICByZXR1cm4gcmVzOwpAQCAtMzEwMiw4ICszMDkwLDExIEBACiAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICB9IGVsc2UgaWYgKGN1cnJlbnRDb25maWcgIT0gbnVsbCkgewogICAgICAgICAgICAgICAgIC8vIE5vIG9idmlvdXMgYWN0aW9uIHdlIG5lZWQgdG8gdGFrZSwgYnV0IGlmIG91ciBjdXJyZW50Ci0gICAgICAgICAgICAgICAgLy8gc3RhdGUgbWlzbWF0Y2hlcyB0aGUgYWN0aXZpdHkgbWFhbmFnZXIncywgdXBkYXRlIGl0CisgICAgICAgICAgICAgICAgLy8gc3RhdGUgbWlzbWF0Y2hlcyB0aGUgYWN0aXZpdHkgbWFuYWdlcidzLCB1cGRhdGUgaXQsCisgICAgICAgICAgICAgICAgLy8gZGlzcmVnYXJkaW5nIGZvbnQgc2NhbGUsIHdoaWNoIHNob3VsZCByZW1haW4gc2V0IHRvCisgICAgICAgICAgICAgICAgLy8gdGhlIHZhbHVlIG9mIHRoZSBwcmV2aW91cyBjb25maWd1cmF0aW9uLgogICAgICAgICAgICAgICAgIG1UZW1wQ29uZmlndXJhdGlvbi5zZXRUb0RlZmF1bHRzKCk7CisgICAgICAgICAgICAgICAgbVRlbXBDb25maWd1cmF0aW9uLmZvbnRTY2FsZSA9IGN1cnJlbnRDb25maWcuZm9udFNjYWxlOwogICAgICAgICAgICAgICAgIGlmIChjb21wdXRlTmV3Q29uZmlndXJhdGlvbkxvY2tlZChtVGVtcENvbmZpZ3VyYXRpb24pKSB7CiAgICAgICAgICAgICAgICAgICAgIGlmIChjdXJyZW50Q29uZmlnLmRpZmYobVRlbXBDb25maWd1cmF0aW9uKSAhPSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBtV2FpdGluZ0ZvckNvbmZpZyA9IHRydWU7CkBAIC00NDM1LDggKzQ0MjYsNyBAQAogICAgICAgICAgICAgZmluYWwgaW50IE4gPSBtV2luZG93cy5zaXplKCk7CiAgICAgICAgICAgICBmb3IgKGludCBpPTA7IGk8TjsgaSsrKSB7CiAgICAgICAgICAgICAgICAgV2luZG93U3RhdGUgdyA9IG1XaW5kb3dzLmdldChpKTsKLSAgICAgICAgICAgICAgICBpZiAody5pc1Zpc2libGVMdygpICYmICF3Lm1PYnNjdXJlZAotICAgICAgICAgICAgICAgICAgICAgICAgJiYgKHcubU9yaWVudGF0aW9uQ2hhbmdpbmcgfHwgIXcuaXNEcmF3bkx3KCkpKSB7CisgICAgICAgICAgICAgICAgaWYgKHcuaXNWaXNpYmxlTHcoKSAmJiAhdy5tT2JzY3VyZWQgJiYgIXcuaXNEcmF3bkx3KCkpIHsKICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgIH0KQEAgLTU2MTUsNiArNTYwNSwyMiBAQAogICAgIH0KIAogICAgIHB1YmxpYyB2b2lkIHN5c3RlbVJlYWR5KCkgeworICAgICAgICBzeW5jaHJvbml6ZWQobVdpbmRvd01hcCkgeworICAgICAgICAgICAgaWYgKG1EaXNwbGF5ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJEaXNwbGF5IGFscmVhZHkgaW5pdGlhbGl6ZWQiKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIFdpbmRvd01hbmFnZXIgd20gPSAoV2luZG93TWFuYWdlciltQ29udGV4dC5nZXRTeXN0ZW1TZXJ2aWNlKENvbnRleHQuV0lORE9XX1NFUlZJQ0UpOworICAgICAgICAgICAgbURpc3BsYXkgPSB3bS5nZXREZWZhdWx0RGlzcGxheSgpOworICAgICAgICAgICAgbUluaXRpYWxEaXNwbGF5V2lkdGggPSBtRGlzcGxheS5nZXRXaWR0aCgpOworICAgICAgICAgICAgbUluaXRpYWxEaXNwbGF5SGVpZ2h0ID0gbURpc3BsYXkuZ2V0SGVpZ2h0KCk7CisgICAgICAgICAgICBtSW5wdXRNYW5hZ2VyLnNldERpc3BsYXlTaXplKDAsIG1Jbml0aWFsRGlzcGxheVdpZHRoLCBtSW5pdGlhbERpc3BsYXlIZWlnaHQpOworICAgICAgICB9CisKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIG1BY3Rpdml0eU1hbmFnZXIudXBkYXRlQ29uZmlndXJhdGlvbihudWxsKTsKKyAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgfQorICAgICAgICAKICAgICAgICAgbVBvbGljeS5zeXN0ZW1SZWFkeSgpOwogICAgIH0KIApAQCAtNjg5Miw3ICs2ODk4LDcgQEAKICAgICAgICAgICAgIGZpbmFsIEFwcFdpbmRvd1Rva2VuIGF0b2tlbiA9IG1BcHBUb2tlbjsKICAgICAgICAgICAgIHJldHVybiBtU3VyZmFjZSAhPSBudWxsICYmICFtQXR0YWNoZWRIaWRkZW4KICAgICAgICAgICAgICAgICAgICAgJiYgKGF0b2tlbiA9PSBudWxsID8gbVBvbGljeVZpc2liaWxpdHkgOiAhYXRva2VuLmhpZGRlblJlcXVlc3RlZCkKLSAgICAgICAgICAgICAgICAgICAgJiYgKG1PcmllbnRhdGlvbkNoYW5naW5nIHx8ICghbURyYXdQZW5kaW5nICYmICFtQ29tbWl0RHJhd1BlbmRpbmcpKQorICAgICAgICAgICAgICAgICAgICAmJiAhbURyYXdQZW5kaW5nICYmICFtQ29tbWl0RHJhd1BlbmRpbmcKICAgICAgICAgICAgICAgICAgICAgJiYgIW1FeGl0aW5nICYmICFtRGVzdHJveWluZzsKICAgICAgICAgfQogCkBAIC02OTk2LDE0ICs3MDAyLDEyIEBACiAKICAgICAgICAgLyoqCiAgICAgICAgICAqIFJldHVybnMgdHJ1ZSBpZiB0aGUgd2luZG93IGhhcyBhIHN1cmZhY2UgdGhhdCBpdCBoYXMgZHJhd24gYQotICAgICAgICAgKiBjb21wbGV0ZSBVSSBpbiB0by4gIE5vdGUgdGhhdCB0aGlzIHJldHVybnMgdHJ1ZSBpZiB0aGUgb3JpZW50YXRpb24KLSAgICAgICAgICogaXMgY2hhbmdpbmcgZXZlbiBpZiB0aGUgd2luZG93IGhhc24ndCByZWRyYXduIGJlY2F1c2Ugd2UgZG9uJ3Qgd2FudAotICAgICAgICAgKiB0byBzdG9wIHRoaW5ncyBmcm9tIGV4ZWN1dGluZyBkdXJpbmcgdGhhdCB0aW1lLgorICAgICAgICAgKiBjb21wbGV0ZSBVSSBpbiB0by4KICAgICAgICAgICovCiAgICAgICAgIHB1YmxpYyBib29sZWFuIGlzRHJhd25MdygpIHsKICAgICAgICAgICAgIGZpbmFsIEFwcFdpbmRvd1Rva2VuIGF0b2tlbiA9IG1BcHBUb2tlbjsKICAgICAgICAgICAgIHJldHVybiBtU3VyZmFjZSAhPSBudWxsICYmICFtRGVzdHJveWluZwotICAgICAgICAgICAgICAgICYmIChtT3JpZW50YXRpb25DaGFuZ2luZyB8fCAoIW1EcmF3UGVuZGluZyAmJiAhbUNvbW1pdERyYXdQZW5kaW5nKSk7CisgICAgICAgICAgICAgICAgJiYgIW1EcmF3UGVuZGluZyAmJiAhbUNvbW1pdERyYXdQZW5kaW5nOwogICAgICAgICB9CiAKICAgICAgICAgcHVibGljIGJvb2xlYW4gZmlsbHNTY3JlZW5MdyhpbnQgc2NyZWVuV2lkdGgsIGludCBzY3JlZW5IZWlnaHQsCkBAIC04NTI0LDYgKzg1MjgsMTEgQEAKIAogICAgIHByaXZhdGUgZmluYWwgdm9pZCBwZXJmb3JtTGF5b3V0QW5kUGxhY2VTdXJmYWNlc0xvY2tlZElubmVyKAogICAgICAgICAgICAgYm9vbGVhbiByZWNvdmVyaW5nTWVtb3J5KSB7CisgICAgICAgIGlmIChtRGlzcGxheSA9PSBudWxsKSB7CisgICAgICAgICAgICBTbG9nLmkoVEFHLCAic2tpcHBpbmcgcGVyZm9ybUxheW91dEFuZFBsYWNlU3VyZmFjZXNMb2NrZWRJbm5lciB3aXRoIG5vIG1EaXNwbGF5Iik7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKwogICAgICAgICBmaW5hbCBsb25nIGN1cnJlbnRUaW1lID0gU3lzdGVtQ2xvY2sudXB0aW1lTWlsbGlzKCk7CiAgICAgICAgIGZpbmFsIGludCBkdyA9IG1EaXNwbGF5LmdldFdpZHRoKCk7CiAgICAgICAgIGZpbmFsIGludCBkaCA9IG1EaXNwbGF5LmdldEhlaWdodCgpOwpAQCAtOTMxMiwxMiArOTMyMSw2IEBACiAgICAgICAgICAgICAgICAgICAgIGlmICh3Lm1BdHRhY2hlZEhpZGRlbiB8fCAhdy5pc1JlYWR5Rm9yRGlzcGxheSgpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXcubUxhc3RIaWRkZW4pIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL2R1bXAoKTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoREVCVUdfQ09ORklHVVJBVElPTikgU2xvZy52KFRBRywgIldpbmRvdyBoaWRpbmc6IHdhaXRpbmdUb1Nob3c9IgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyB3Lm1Sb290VG9rZW4ud2FpdGluZ1RvU2hvdyArICIgcG9sdmlzPSIKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgdy5tUG9saWN5VmlzaWJpbGl0eSArICIgYXR0aGlkPSIKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgdy5tQXR0YWNoZWRIaWRkZW4gKyAiIHRva2hpZD0iCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIHcubVJvb3RUb2tlbi5oaWRkZW4gKyAiIHZpcz0iCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIHcubVZpZXdWaXNpYmlsaXR5KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3Lm1MYXN0SGlkZGVuID0gdHJ1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoU0hPV19UUkFOU0FDVElPTlMpIGxvZ1N1cmZhY2UodywKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJISURFIChwZXJmb3JtTGF5b3V0KSIsIG51bGwpOwpAQCAtOTcxOCwzMCArOTcyMSwyNiBAQAogICAgICAgICB9IGVsc2UgaWYgKGFuaW1hdGluZykgewogICAgICAgICAgICAgcmVxdWVzdEFuaW1hdGlvbkxvY2tlZChjdXJyZW50VGltZSsoMTAwMC82MCktU3lzdGVtQ2xvY2sudXB0aW1lTWlsbGlzKCkpOwogICAgICAgICB9Ci0gICAgICAgIAorCiAgICAgICAgIG1JbnB1dE1vbml0b3IudXBkYXRlSW5wdXRXaW5kb3dzTHcoKTsKLSAgICAgICAgCi0gICAgICAgIGlmIChERUJVR19GUkVFWkUpIFNsb2cudihUQUcsICJMYXlvdXQ6IG1EaXNwbGF5RnJvemVuPSIgKyBtRGlzcGxheUZyb3plbgotICAgICAgICAgICAgICAgICsgIiBob2xkU2NyZWVuPSIgKyBob2xkU2NyZWVuKTsKLSAgICAgICAgaWYgKCFtRGlzcGxheUZyb3plbikgewotICAgICAgICAgICAgc2V0SG9sZFNjcmVlbkxvY2tlZChob2xkU2Ny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AgICAgICAgICB9CisKKyAgICAgICAgc2V0SG9sZFNjcmVlbkxvY2tlZChob2xkU2NyZWVuICE9IG51bGwpOworICAgICAgICBpZiAoc2NyZWVuQnJpZ2h0bmVzcyA8IDAgfHwgc2NyZWVuQnJpZ2h0bmVzcyA+IDEuMGYpIHsKKyAgICAgICAgICAgIG1Qb3dlck1hbmFnZXIuc2V0U2NyZWVuQnJpZ2h0bmVzc092ZXJyaWRlKC0xKTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIG1Qb3dlck1hbmFnZXIuc2V0U2NyZWVuQnJpZ2h0bmVzc092ZXJyaWRlKChpbnQpCisgICAgICAgICAgICAgICAgICAgIChzY3JlZW5CcmlnaHRuZXNzICogUG93ZXIuQlJJR0hUTkVTU19PTikpOworICAgICAgICB9CisgICAgICAgIGlmIChidXR0b25CcmlnaHRuZXNzIDwgMCB8fCBidXR0b25CcmlnaHRuZXNzID4gMS4wZikgeworICAgICAgICAgICAgbVBvd2VyTWFuYWdlci5zZXRCdXR0b25CcmlnaHRuZXNzT3ZlcnJpZGUoLTEpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgbVBvd2VyTWFuYWdlci5zZXRCdXR0b25CcmlnaHRuZXNzT3ZlcnJpZGUoKGludCkKKyAgICAgICAgICAgICAgICAgICAgKGJ1dHRvbkJyaWdodG5lc3MgKiBQb3dlci5CUklHSFRORVNTX09OKSk7CisgICAgICAgIH0KKyAgICAgICAgaWYgKGhvbGRTY3JlZW4gIT0gbUhvbGRpbmdTY3JlZW5PbikgeworICAgICAgICAgICAgbUhvbGRpbmdTY3JlZW5PbiA9IGhvbGRTY3JlZW47CisgICAgICAgICAgICBNZXNzYWdlIG0gPSBtSC5vYnRhaW5NZXNzYWdlKEguSE9MRF9TQ1JFRU5fQ0hBTkdFRCwgaG9sZFNjcmVlbik7CisgICAgICAgICAgICBtSC5zZW5kTWVzc2FnZShtKTsKICAgICAgICAgfQogCiAgICAgICAgIGlmIChtVHVybk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2lkL3NlcnZlci9hbS9BY3Rpdml0eU1hbmFnZXJTZXJ2aWNlLmphdmEKQEAgLTIzNzcsNiArMjM3NywxMCBAQAogICAgICAgICAgICAgfQogICAgICAgICAgICAgCiAgICAgICAgICAgICBpZiAocHJvYy50aHJlYWQgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGlmIChwcm9jLnBpZCA9PSBQcm9jZXNzLm15UGlkKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgTG9nLncoVEFHLCAiY3Jhc2hBcHBsaWNhdGlvbjogdHJ5aW5nIHRvIGNyYXNoIHNlbGYhIik7CisgICAgICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgbG9uZyBpZGVudCA9IEJpbmRlci5jbGVhckNhbGxpbmdJZGVudGl0eSgpOwogICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgIHByb2MudGhyZWFkLnNjaGVkdWxlQ3Jhc2gobWVzc2FnZSk7CkBAIC01NzQ5LDYgKzU3NTMsMzUgQEAKICAgICAgICAgfQogICAgIH0KIAorICAgIHB1YmxpYyB2b2lkIHNldEltbWVyc2l2ZShJQmluZGVyIHRva2VuLCBib29sZWFuIGltbWVyc2l2ZSkgeworICAgICAgICBzeW5jaHJvbml6ZWQodGhpcykgeworICAgICAgICAgICAgaW50IGluZGV4ID0gKHRva2VuICE9IG51bGwpID8gbU1haW5TdGFjay5pbmRleE9mVG9rZW5Mb2NrZWQodG9rZW4pIDogLTE7CisgICAgICAgICAgICBpZiAoaW5kZXggPCAwKSB7CisgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgQWN0aXZpdHlSZWNvcmQgciA9IChBY3Rpdml0eVJlY29yZCltTWFpblN0YWNrLm1IaXN0b3J5LmdldChpbmRleCk7CisgICAgICAgICAgICByLmltbWVyc2l2ZSA9IGltbWVyc2l2ZTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyBib29sZWFuIGlzSW1tZXJzaXZlKElCaW5kZXIgdG9rZW4pIHsKKyAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CisgICAgICAgICAgICBpbnQgaW5kZXggPSAodG9rZW4gIT0gbnVsbCkgPyBtTWFpblN0YWNrLmluZGV4T2ZUb2tlbkxvY2tlZCh0b2tlbikgOiAtMTsKKyAgICAgICAgICAgIGlmIChpbmRleCA8IDApIHsKKyAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBBY3Rpdml0eVJlY29yZCByID0gKEFjdGl2aXR5UmVjb3JkKW1NYWluU3RhY2subUhpc3RvcnkuZ2V0KGluZGV4KTsKKyAgICAgICAgICAgIHJldHVybiByLmltbWVyc2l2ZTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHB1YmxpYyBib29sZWFuIGlzVG9wQWN0aXZpdHlJbW1lcnNpdmUoKSB7CisgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgeworICAgICAgICAgICAgQWN0aXZpdHlSZWNvcmQgciA9IG1NYWluU3RhY2sudG9wUnVubmluZ0FjdGl2aXR5TG9ja2VkKG51bGwpOworICAgICAgICAgICAgcmV0dXJuIChyICE9IG51bGwpID8gci5pbW1lcnNpdmUgOiBmYWxzZTsKKyAgICAgICAgfQorICAgIH0KKwogICAgIHB1YmxpYyBmaW5hbCB2b2lkIGVudGVyU2FmZU1vZGUoKSB7CiAgICAgICAgIHN5bmNocm9uaXplZCh0aGlzKSB7CiAgICAgICAgICAgICAvLyBJdCBvbmx5IG1ha2VzIHNlbnNlIHRvIGRvIHRoaXMgYmVmb3JlIHRoZSBzeXN0ZW0gaXMgcmVhZHkKQEAgLTEyMDA0LDcgKzEyMDM3LDY5IEBACiAgICAgICAgICAgICB9CiAgICAgICAgIH0KICAgICB9Ci0gICAgCisKKyAgICBwdWJsaWMgYm9vbGVhbiBkdW1wSGVhcChTdHJpbmcgcHJvY2VzcywgYm9vbGVhbiBtYW5hZ2VkLAorICAgICAgICAgICAgU3RyaW5nIHBhdGgsIFBhcmNlbEZpbGVEZXNjcmlwdG9yIGZkKSB0aHJvd3MgUmVtb3RlRXhjZXB0aW9uIHsKKworICAgICAgICB0cnkgeworICAgICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CisgICAgICAgICAgICAgICAgLy8gbm90ZTogaGlqYWNraW5nIFNFVF9BQ1RJVklUWV9XQVRDSEVSLCBidXQgc2hvdWxkIGJlIGNoYW5nZWQgdG8KKyAgICAgICAgICAgICAgICAvLyBpdHMgb3duIHBlcm1pc3Npb24gKHNhbWUgYXMgcHJvZmlsZUNvbnRyb2wpLgorICAgICAgICAgICAgICAgIGlmIChjaGVja0NhbGxpbmdQZXJtaXNzaW9uKGFuZHJvaWQuTWFuaWZlc3QucGVybWlzc2lvbi5TRVRfQUNUSVZJVFlfV0FUQ0hFUikKKyAgICAgICAgICAgICAgICAgICAgICAgICE9IFBhY2thZ2VNYW5hZ2VyLlBFUk1JU1NJT05fR1JBTlRFRCkgeworICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgU2VjdXJpdHlFeGNlcHRpb24oIlJlcXVpcmVzIHBlcm1pc3Npb24gIgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgYW5kcm9pZC5NYW5pZmVzdC5wZXJtaXNzaW9uLlNFVF9BQ1RJVklUWV9XQVRDSEVSKTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBpZiAoZmQgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbEFyZ3VtZW50RXhjZXB0aW9uKCJudWxsIGZkIik7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgUHJvY2Vzc1JlY29yZCBwcm9jID0gbnVsbDsKKyAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICBpbnQgcGlkID0gSW50ZWdlci5wYXJzZUludChwcm9jZXNzKTsKKyAgICAgICAgICAgICAgICAgICAgc3luY2hyb25pemVkIChtUGlkc1NlbGZMb2NrZWQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHByb2MgPSBtUGlkc1NlbGZMb2NrZWQuZ2V0KHBpZCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9IGNhdGNoIChOdW1iZXJGb3JtYXRFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIGlmIChwcm9jID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgSGFzaE1hcDxTdHJpbmcsIFNwYXJzZUFycmF5PFByb2Nlc3NSZWNvcmQ+PiBhbGwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICA9IG1Qcm9jZXNzTmFtZXMuZ2V0TWFwKCk7CisgICAgICAgICAgICAgICAgICAgIFNwYXJzZUFycmF5PFByb2Nlc3NSZWNvcmQ+IHByb2NzID0gYWxsLmdldChwcm9jZXNzKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKHByb2NzICE9IG51bGwgJiYgcHJvY3Muc2l6ZSgpID4gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgcHJvYyA9IHByb2NzLnZhbHVlQXQoMCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBpZiAocHJvYyA9PSBudWxsIHx8IHByb2MudGhyZWFkID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxBcmd1bWVudEV4Y2VwdGlvbigiVW5rbm93biBwcm9jZXNzOiAiICsgcHJvY2Vzcyk7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgYm9vbGVhbiBpc1NlY3VyZSA9ICIxIi5lcXVhbHMoU3lzdGVtUHJvcGVydGllcy5nZXQoU1lTVEVNX1NFQ1VSRSwgIjAiKSk7CisgICAgICAgICAgICAgICAgaWYgKGlzU2VjdXJlKSB7CisgICAgICAgICAgICAgICAgICAgIGlmICgocHJvYy5pbmZvLmZsYWdzJkFwcGxpY2F0aW9uSW5mby5GTEFHX0RFQlVHR0FCTEUpID09IDApIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHRocm93IG5ldyBTZWN1cml0eUV4Y2VwdGlvbigiUHJvY2VzcyBub3QgZGVidWdnYWJsZTogIiArIHByb2MpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgcHJvYy50aHJlYWQuZHVtcEhlYXAobWFuYWdlZCwgcGF0aCwgZmQpOworICAgICAgICAgICAgICAgIGZkID0gbnVsbDsKKyAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIHRocm93IG5ldyBJbGxlZ2FsU3RhdGVFeGNlcHRpb24oIlByb2Nlc3MgZGlzYXBwZWFyZWQiKTsKKyAgICAgICAgfSBmaW5hbGx5IHsKKyAgICAgICAgICAgIGlmIChmZCAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAgICAgZmQuY2xvc2UoKTsKKyAgICAgICAgICAgICAgICB9IGNhdGNoIChJT0V4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCiAgICAgLyoqIEluIHRoaXMgbWV0aG9kIHdlIHRyeSB0byBhY3F1aXJlIG91ciBsb2NrIHRvIG1ha2Ugc3VyZSB0aGF0IHdlIGhhdmUgbm90IGRlYWRsb2NrZWQgKi8KICAgICBwdWJsaWMgdm9pZCBtb25pdG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5PSIpOyBwdy5wcmludChpbkhpc3RvcnkpOwogICAgICAgICAgICAgICAgIHB3LnByaW50KCIgcGVyc2lzdGVudD0iKTsgcHcucHJpbnQocGVyc2lzdGVudCk7CisgICAgICAgICAgICAgICAgcHcucHJpbnQoIiBpbW1lcnNpdmU9Iik7IHB3LnByaW50KGltbWVyc2l2ZSk7CiAgICAgICAgICAgICAgICAgcHcucHJpbnQoIiBsYXVuY2hNb2RlPSIpOyBwdy5wcmludGxuKGxhdW5jaE1vZGUpOwogICAgICAgICBwdy5wcmludChwcmVmaXgpOyBwdy5wcmludCgiZnVsbHNjcmVlbj0iKTsgcHcucHJpbnQoZnVsbHNjcmVlbik7CiAgICAgICAgICAgICAgICAgcHcucHJpbnQoIiB2aXNpYmxlPSIpOyBwdy5wcmludCh2aXNpYmxlKTsKQEAgLTI4NSw2ICsyODcsOCBAQAogICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICBpc0hvbWVBY3Rpdml0eSA9IGZhbHNlOwogICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpbW1lcnNpdmUgPSAoYUluZm8uZmxhZ3MgJiBBY3Rpdml0eUluZm8uRkxBR19JTU1FUlNJVkUpICE9IDA7CiAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICByZWFsQWN0aXZpdHkgPSBudWxsOwogICAgICAgICAgICAgdGFza0FmZmluaXR5ID0gbnVsbDsKQEAgLTI5Niw2ICszMDAsNyBAQAogICAgICAgICAgICAgcGFja2FnZU5hbWUgPSBudWxsOwogICAgICAgICAgICAgZnVsbHNjcmVlbiA9IHRydWU7CiAgICAgICAgICAgICBpc0hvbWVBY3Rpdml0eSA9IGZhbHNlOworICAgICAgICAgICAgaW1tZXJzaXZlID0gZmFsc2U7CiAgICAgICAgIH0KICAgICB9CiAKZGlmZiAtLWdpdCBhL3NlcnZpY2VzL2phdmEvY29tL2FuZHJvaWQvc2VydmVyL2Nvbm5lY3Rpdml0eS9UZXRoZXJpbmcuamF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ldFN0cmluZ0FycmF5KAogICAgICAgICAgICAgICAgIGNvbS5hbmRyb2lkLmludGVybmFsLlIuYXJyYXkuY29uZmlnX3RldGhlcl91cHN0cmVhbV9yZWdleHMpOwogCkBAIC0xNzQsNyArMTkxLDcgQEAKICAgICB9CiAKICAgICBwdWJsaWMgdm9pZCBpbnRlcmZhY2VMaW5rU3RhdHVzQ2hhbmdlZChTdHJpbmcgaWZhY2UsIGJvb2xlYW4gbGluaykgewotICAgICAgICBMb2cuZChUQUcsICJpbnRlcmZhY2VMaW5rU3RhdHVzQ2hhbmdlZCAiICsgaWZhY2UgKyAiLCAiICsgbGluayk7CisgICAgICAgIGlmIChERUJVRykgTG9nLmQoVEFHLCAiaW50ZXJmYWNlTGlua1N0YXR1c0NoYW5nZWQgIiArIGlmYWNlICsgIiwgIiArIGxpbmspOwogICAgICAgICBib29sZWFuIGZvdW5kID0gZmFsc2U7CiAgICAgICAgIGJvb2xlYW4gdXNiID0gZmFsc2U7CiAgICAgICAgIGlmIChpc1dpZmkoaWZhY2UpKSB7CkBAIC0xODIsNiArMTk5LDggQEAKICAgICAgICAgfSBlbHNlIGlmIChpc1VzYihpZmFjZSkpIHsKICAgICAgICAgICAgIGZvdW5kID0gdHJ1ZTsKICAgICAgICAgICAgIHVzYiA9IHRydWU7CisgICAgICAgIH0gZWxzZSBpZiAoaXNCbHVldG9vdGgoaWZhY2UpKSB7CisgICAgICAgICAgICBmb3VuZCA9IHRydWU7CiAgICAgICAgIH0KICAgICAgICAgaWYgKGZvdW5kID09IGZhbHNlKSByZXR1cm47CiAKQEAgLTIxNiw2ICsyMzUsMTIgQEAKICAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgIH0KIAorICAgIHB1YmxpYyBib29sZWFuIGlzQmx1ZXRvb3RoKFN0cmluZyBpZmFjZSkgeworICAgICAgICBmb3IgKFN0cmluZyByZWdleCA6IG1UZXRoZXJhYmxlQmx1ZXRvb3RoUmVnZXhzKSB7CisgICAgICAgICAgICBpZiAoaWZhY2UubWF0Y2hlcyhyZWdleCkpIHJldHVybiB0cnVlOworICAgICAgICB9CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CiAgICAgcHVibGljIHZvaWQgaW50ZXJmYWNlQWRkZWQoU3RyaW5nIGlmYWNlKSB7CiAgICAgICAgIElCaW5kZXIgYiA9IFNlcnZpY2VNYW5hZ2VyLmdldFNlcnZpY2UoQ29udGV4dC5ORVRXT1JLTUFOQUdFTUVOVF9TRVJWSUNFKTsKICAgICAgICAgSU5ldHdvcmtNYW5hZ2VtZW50U2VydmljZSBzZXJ2aWNlID0gSU5ldHdvcmtNYW5hZ2VtZW50U2VydmljZS5TdHViLmFzSW50ZXJmYWNlKGIpOwpAQCAtMjI4LDI5ICsyNTMsMzQgQEAKICAgICAgICAgICAgIGZvdW5kID0gdHJ1ZTsKICAgICAgICAgICAgIHVzYiA9IHRydWU7CiAgICAgICAgIH0KKyAgICAgICAgaWYgKGlzQmx1ZXRvb3RoKGlmYWNlKSkgeworICAgICAgICAgICAgZm91bmQgPSB0cnVlOworICAgICAgICB9CiAgICAgICAgIGlmIChmb3VuZCA9PSBmYWxzZSkgewotICAgICAgICAgICAgTG9nLmQoVEFHLCBpZmFjZSArICIgaXMgbm90IGEgdGV0aGVyYWJsZSBpZmFjZSwgaWdub3JpbmciKTsKKyAgICAgICAgICAgIGlmIChERUJVRykgTG9nLmQoVEFHLCBpZmFjZSArICIgaXMgbm90IGEgdGV0aGVyYWJsZSBpZmFjZSwgaWdub3JpbmciKTsKICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgfQogCiAgICAgICAgIHN5bmNocm9uaXplZCAobUlmYWNlcykgewogICAgICAgICAgICAgVGV0aGVySW50ZXJmYWNlU00gc20gPSBtSWZhY2VzLmdldChpZmFjZSk7CiAgICAgICAgICAgICBpZiAoc20gIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIExvZy5lKFRBRywgImFjdGl2ZSBpZmFjZSAoIiArIGlmYWNlICsgIikgcmVwb3J0ZWQgYXMgYWRkZWQsIGlnbm9yaW5nIik7CisgICAgICAgICAgICAgICAgaWYgKERFQlVHKSBMb2cuZChUQUcsICJhY3RpdmUgaWZhY2UgKCIgKyBpZmFjZSArICIpIHJlcG9ydGVkIGFzIGFkZGVkLCBpZ25vcmluZyIpOwogICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIHNtID0gbmV3IFRldGhlckludGVyZmFjZVNNKGlmYWNlLCBtTG9vcGVyLCB1c2IpOwogICAgICAgICAgICAgbUlmYWNlcy5wdXQoaWZhY2UsIHNtKTsKICAgICAgICAgICAgIHNtLnN0YXJ0KCk7CiAgICAgICAgIH0KLSAgICAgICAgTG9nLmQoVEFHLCAiaW50ZXJmYWNlQWRkZWQgOiIgKyBpZmFjZSk7CisgICAgICAgIGlmIChERUJVRykgTG9nLmQoVEFHLCAiaW50ZXJmYWNlQWRkZWQgOiIgKyBpZmFjZSk7CiAgICAgfQogCiAgICAgcHVibGljIHZvaWQgaW50ZXJmYWNlUmVtb3ZlZChTdHJpbmcgaWZhY2UpIHsKICAgICAgICAgc3luY2hyb25pemVkIChtSWZhY2VzKSB7CiAgICAgICAgICAgICBUZXRoZXJJbnRlcmZhY2VTTSBzbSA9IG1JZmFjZXMuZ2V0KGlmYWNlKTsKICAgICAgICAgICAgIGlmIChzbSA9PSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgTG9nLmUoVEFHLCAiYXR0ZW1wdGluZyB0byByZW1vdmUgdW5rbm93biBpZmFjZSAoIiArIGlmYWNlICsgIiksIGlnbm9yaW5nIik7CisgICAgICAgICAgICAgICAgaWYgKERFQlVHKSB7CisgICAgICAgICAgICAgICAgICAgIExvZy5lKFRBRywgImF0dGVtcHRpbmcgdG8gcmVtb3ZlIHVua25vd24gaWZhY2UgKCIgKyBpZmFjZSArICIpLCBpZ25vcmluZyIpOworICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBzbS5zZW5kTWVzc2FnZShUZXRoZXJJbnRlcmZhY2VTTS5DTURfSU5URVJGQUNFX0RPV04pOwpAQCAtMzIxLDEzICszNTEsMTQgQEAKIAogICAgICAgICBib29sZWFuIHdpZmlUZXRoZXJlZCA9IGZhbHNlOwogICAgICAgICBib29sZWFuIHVzYlRldGhlcmVkID0gZmFsc2U7CisgICAgICAgIGJvb2xlYW4gYmx1ZXRvb3RoVGV0aGVyZWQgPSBmYWxzZTsKIAogICAgICAgICBzeW5jaHJvbml6ZWQgKG1JZmFjZXMpIHsKICAgICAgICAgICAgIFNldCBpZmFjZXMgPSBtSWZhY2VzLmtleVNldCgpOwogICAgICAgICAgICAgZm9yIChPYmplY3QgaWZhY2UgOiBpZmFjZXMpIHsKICAgICAgICAgICAgICAgICBUZXRoZXJJbnRlcmZhY2VTTSBzbSA9IG1JZmFjZXMuZ2V0KGlmYWNlKTsKICAgICAgICAgICAgICAgICBpZiAoc20gIT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICBpZihzbS5pc0Vycm9yZWQoKSkgeworICAgICAgICAgICAgICAgICAgICBpZiAoc20uaXNFcnJvcmVkKCkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yZWRMaXN0LmFkZCgoU3RyaW5nKWlmYWNlKTsKICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChzbS5pc0F2YWlsYWJsZSgpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICBhdmFpbGFibGVMaXN0LmFkZCgoU3RyaW5nKWlmYWNlKTsKQEAgLTMzNiw2ICszNjcsOCBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVzYlRldGhlcmVkID0gdHJ1ZTsKICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoaXNXaWZpKChTdHJpbmcpaWZhY2UpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2lmaVRldGhlcmVkID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGlzQmx1ZXRvb3RoKChTdHJpbmcpaWZhY2UpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmx1ZXRvb3RoVGV0aGVyZWQgPSB0cnVlOwogICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgYWN0aXZlTGlzdC5hZGQoKFN0cmluZylpZmFjZSk7CiAgICAgICAgICAgICAgICAgICAgIH0KQEAgLTM1MCwxNyArMzgzLDI1IEBACiAgICAgICAgIGJyb2FkY2FzdC5wdXRTdHJpbmdBcnJheUxpc3RFeHRyYShDb25uZWN0aXZpdHlNYW5hZ2VyLkVYVFJBX0VSUk9SRURfVEVUSEVSLAogICAgICAgICAgICAgICAgIGVycm9yZWRMaXN0KTsKICAgICAgICAgbUNvbnRleHQuc2VuZFN0aWNreUJyb2FkY2FzdChicm9hZGNhc3QpOwotICAgICAgICBMb2cuZChUQUcsICJzZW5kVGV0aGVyU3RhdGVDaGFuZ2VkQnJvYWRjYXN0ICIgKyBhdmFpbGFibGVMaXN0LnNpemUoKSArICIsICIgKwotICAgICAgICAgICAgICAgIGFjdGl2ZUxpc3Quc2l6ZSgpICsgIiwgIiArIGVycm9yZWRMaXN0LnNpemUoKSk7CisgICAgICAgIGlmIChERUJVRykgeworICAgICAgICAgICAgTG9nLmQoVEFHLCAic2VuZFRldGhlclN0YXRlQ2hhbmdlZEJyb2FkY2FzdCAiICsgYXZhaWxhYmxlTGlzdC5zaXplKCkgKyAiLCAiICsKKyAgICAgICAgICAgICAgICAgICAgYWN0aXZlTGlzdC5zaXplKCkgKyAiLCAiICsgZXJyb3JlZExpc3Quc2l6ZSgpKTsKKyAgICAgICAgfQogCiAgICAgICAgIGlmICh1c2JUZXRoZXJlZCkgewotICAgICAgICAgICAgaWYgKHdpZmlUZXRoZXJlZCkgeworICAgICAgICAgICAgaWYgKHdpZmlUZXRoZXJlZCB8fCBibHVldG9vdGhUZXRoZXJlZCkgewogICAgICAgICAgICAgICAgIHNob3dUZXRoZXJlZE5vdGlmaWNhdGlvbihjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmRyYXdhYmxlLnN0YXRfc3lzX3RldGhlcl9nZW5lcmFsKTsKICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgc2hvd1RldGhlcmVkTm90aWZpY2F0aW9uKGNvbS5hbmRyb2lkLmludGVybmFsLlIuZHJhd2FibGUuc3RhdF9zeXNfdGV0aGVyX3VzYik7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0gZWxzZSBpZiAod2lmaVRldGhlcmVkKSB7Ci0gICAgICAgICAgICBzaG93VGV0aGVyZWROb3RpZmljYXRpb24oY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5kcmF3YWJsZS5zdGF0X3N5c190ZXRoZXJfd2lmaSk7CisgICAgICAgICAgICBpZiAoYmx1ZXRvb3RoVGV0aGVyZWQpIHsKKyAgICAgICAgICAgICAgICBzaG93VGV0aGVyZWROb3RpZmljYXRpb24oY29tLmFuZHJvaWQuaW50ZXJuYWwuUi5kcmF3YWJsZS5zdGF0X3N5c190ZXRoZXJfZ2VuZXJhbCk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHNob3dUZXRoZXJlZE5vdGlmaWNhdGlvbihjb20uYW5kcm9pZC5pbnRlcm5hbC5SLmRyYXdhYmxlLnN0YXRfc3lzX3RldGhlcl93aWZpKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBlbHNlIGlmIChibHVldG9vdGhUZXRoZXJlZCkgeworICAgICAgICAgICAgc2hvd1RldGhlcmVkTm90aWZpY2F0aW9uKGNvbS5hbmRyb2lkLmludGVybmFsLlIuZHJhd2FibGUuc3RhdF9zeXNfdGV0aGVyX2JsdWV0b290aCk7CiAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICBjbGVhclRldGhlcmVkTm90aWZpY2F0a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N0aW9uLmVxdWFscyhVc2IuQUNUSU9OX1VTQl9TVEFURSkpIHsKLSAgICAgICAgICAgICAgICBtVXNiQ29ubmVjdGVkID0gaW50ZW50LmdldEV4dHJhcygpLmdldEJvb2xlYW4oVXNiLlVTQl9DT05ORUNURUQpOwotICAgICAgICAgICAgICAgIHVwZGF0ZVVzYlN0YXR1cygpOworICAgICAgICAgICAgICAgIC8vIHByb2Nlc3MgY29ubmVjdCBldmVudHMgaW1tZWRpYXRlbHksIGJ1dCBkZWxheSBoYW5kbGluZyBkaXNjb25uZWN0cworICAgICAgICAgICAgICAgIC8vIHRvIGRlYm91bmNlIFVTQiBjb25maWd1cmF0aW9uIGNoYW5nZXMKKyAgICAgICAgICAgICAgICBib29sZWFuIGNvbm5lY3RlZCA9IGludGVudC5nZXRFeHRyYXMoKS5nZXRCb29sZWFuKFVzYi5VU0JfQ09OTkVDVEVEKTsKKyAgICAgICAgICAgICAgICBNZXNzYWdlIG1zZyA9IE1lc3NhZ2Uub2J0YWluKG1Vc2JIYW5kbGVyLCBVU0JfU1RBVEVfQ0hBTkdFLAorICAgICAgICAgICAgICAgICAgICAgICAgKGNvbm5lY3RlZCA/IFVTQl9DT05ORUNURUQgOiBVU0JfRElTQ09OTkVDVEVEKSwgMCk7CisgICAgICAgICAgICAgICAgbVVzYkhhbmRsZXIucmVtb3ZlTWVzc2FnZXMoVVNCX1NUQVRFX0NIQU5HRSk7CisgICAgICAgICAgICAgICAgbVVzYkhhbmRsZXIuc2VuZE1lc3NhZ2VEZWxheWVkKG1zZywgY29ubmVjdGVkID8gMCA6IFVTQl9ESVNDT05ORUNUX0RFTEFZKTsKICAgICAgICAgICAgIH0gZWxzZSBpZiAoYWN0aW9uLmVxdWFscyhJbnRlbnQuQUNUSU9OX01FRElBX1NIQVJFRCkpIHsKICAgICAgICAgICAgICAgICBtVXNiTWFzc1N0b3JhZ2VPZmYgPSBmYWxzZTsKICAgICAgICAgICAgICAgICB1cGRhdGVVc2JTdGF0dXMoK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V0VmFsdWUgPSB0cnVlOwogICAgICAgICAgICAgICAgIHN3aXRjaCAobWVzc2FnZS53aGF0KSB7CiAgICAgICAgICAgICAgICAgICAgIC8vIG1heWJlIGEgcGFyZW50IGNsYXNzPwpAQCAtODMzLDcgKzg5MSw3IEBACiAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgaWYgKG1Vc2IpIFRldGhlcmluZy50aGlzLmVuYWJsZVVzYlJuZGlzKHRydWUpOwotICAgICAgICAgICAgICAgIExvZy5kKFRBRywgIlRldGhlcmVkICIgKyBtSWZhY2VOYW1lKTsKKyAgICAgICAgICAgICAgICBpZiAoREVCVUcpIExvZy5kKFRBRywgIlRldGhlcmVkICIgKyBtSWZhY2VOYW1lKTsKICAgICAgICAgICAgICAgICBzZXRBdmFpbGFibGUoZmFsc2UpOwogICAgICAgICAgICAgICAgIHNldFRldGhlcmVkKHRydWUpOwogICAgICAgICAgICAgICAgIHNlbmRUZXRoZXJTdGF0ZUNoYW5nZWRCcm9hZGNhc3QoKTsKQEAgLTg0NCw3ICs5MDIsNyBAQAogICAgICAgICAgICAgfQogICAgICAgICAgICAgQE92ZXJyaWRlCiAgICAgICAgICAgICBwdWJsaWMgYm9vbGVhbiBwcm9jZXNzTWVzc2FnZShNZXNzYWdlIG1lc3NhZ2UpIHsKLSAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJUZXRoZXJlZFN0YXRlLnByb2Nlc3NNZXNzYWdlIHdoYXQ9IiArIG1lc3NhZ2Uud2hhdCk7CisgICAgICAgICAgICAgICAgaWYgKERFQlVHKSBMb2cuZChUQUcsICJUZXRoZXJlZFN0YXRlLnByb2Nlc3NNZXNzYWdlIHdoYXQ9IiArIG1lc3NhZ2Uud2hhdCk7CiAgICAgICAgICAgICAgICAgYm9vbGVhbiByZXRWYWx1ZSA9IHRydWU7CiAgICAgICAgICAgICAgICAgYm9vbGVhbiBlcnJvciA9IGZhbHNlOwogICAgICAgICAgICAgICAgIHN3aXRjaCAobWVzc2FnZS53aGF0KSB7CkBAIC04ODcsNyArOTQ1LDcgQEAKICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobWVzc2FnZS53aGF0ID09IENNRF9JTlRFUkZBQ0VfRE9XTikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRyYW5zaXRpb25UbyhtVW5hdmFpbGFibGVTdGF0ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJVbnRldGhlcmVkICIgKyBtSWZhY2VOYW1lKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChERUJVRykgTG9nLmQoVEFHLCAiVW50ZXRoZXJlZCAiICsgbUlmYWNlTmFtZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgY2FzZSBDTURfVEVUSEVSX0NPTk5FQ1RJT05fQ0hBTkdFRDoKICAgICAgICAgICAgICAgICAgICAgICAgIFN0cmluZyBuZXdVcHN0cmVhbUlmYWNlTmFtZSA9IChTdHJpbmcpKG1lc3NhZ2Uub2JqKTsKQEAgLTk2MCw3ICsxMDE4LDcgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENvbm5lY3Rpdml0eU1hbmFnZXIuVEVUSEVSX0VSUk9SX01BU1RFUl9FUlJPUik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJUZXRoZXIgbG9zdCB1cHN0cmVhbSBjb25uZWN0aW9uICIgKyBtSWZhY2VOYW1lKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChERUJVRykgTG9nLmQoVEFHLCAiVGV0aGVyIGxvc3QgdXBzdHJlYW0gY29ubmVjdGlvbiAiICsgbUlmYWNlTmFtZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICBzZW5kVGV0aGVyU3RhdGVDaGFuZ2VkQnJvYWRjYXN0KCk7CiAgICAgICAgICAgICAgICAgICAgICAgICBpZiAobVVzYikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghVGV0aGVyaW5nLnRoaXMuY29uZmlndXJlVXNiSWZhY2UoZmFsc2UpKSB7CkBAIC0xMTk4LDggKzEyNTYsMTAgQEAKICAgICAgICAgICAgICAgICBJQmluZGVyIGIgPSBTZXJ2aWNlTWFuYWdlci5nZXRTZXJ2aWNlKENvbnRleHQuQ09OTkVDVElWSVRZX1NFUlZJQ0UpOwogICAgICAgICAgICAgICAgIElDb25uZWN0aXZpdHlNYW5hZ2VyIGNtID0gSUNvbm5lY3Rpdml0eU1hbmFnZXIuU3R1Yi5hc0ludGVyZmFjZShiKTsKICAgICAgICAgICAgICAgICBtQ29ubmVjdGlvblJlcXVlc3RlZCA9IGZhbHNlOwotICAgICAgICAgICAgICAgIExvZy5kKFRBRywgImNob29zZVVwc3RyZWFtVHlwZSgiICsgdHJ5Q2VsbCArICIpLCAgZHVuUmVxdWlyZWQgPSIKLSAgICAgICAgICAgICAgICAgICAgICAgICsgbUR1blJlcXVpcmVkICsgIiwgaWZhY2U9IiArIGlmYWNlKTsKKyAgICAgICAgICAgICAgICBpZiAoREVCVUcpIHsKKyAgICAgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAiY2hvb3NlVXBzdHJlYW1UeXBlKCIgKyB0cnlDZWxsICsgIiksICBkdW5SZXF1aXJlZCA9IgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgbUR1blJlcXVpcmVkICsgIiwgaWZhY2U9IiArIGlmYWNlKTsKKyAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgaWYgKGlmYWNlICE9IG51bGwpIHsKICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtRHVuUmVxdWlyZWQpIHsKQEAgLTEyMDcsNyArMTI2Nyw3IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTmV0d29ya0luZm8gaW5mbyA9IGNtLmdldE5ldHdvcmtJbmZvKAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ29ubmVjdGl2aXR5TWFuYWdlci5UWVBFX01PQklMRV9EVU4pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpbmZvLmlzQ29ubmVjdGVkKCkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAic2V0dGluZyBkdW4gaWZhY2VuYW1lID0iICsgaWZhY2UpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoREVCVUcpIExvZy5kKFRBRywgInNldHRpbmcgZHVuIGlmYWNlbmFtZSA9IiArIGlmYWNlKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gZXZlbiBpZiB3ZSdyZSBhbHJlYWR5IGNvbm5lY3RlZCAtIGl0IG1heSBiZSBzb21lYm9keSBlbHNlJ3MKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gcmVmY291bnQsIHNvIGFkZCBvdXIgb3duCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR1cm5Pbk1vYmlsZUNvbm5lY3Rpb24oKTsKQEAgLTEyMTksMTEgKzEyNzksMTEgQEAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAiY2hlY2tpbmcgaWYgaGlwcmkgYnJvdWdodCB1cyB0aGlzIGNvbm5lY3Rpb24iKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoREVCVUcpIExvZy5kKFRBRywgImNoZWNraW5nIGlmIGhpcHJpIGJyb3VnaHQgdXMgdGhpcyBjb25uZWN0aW9uIik7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTmV0d29ya0luZm8gaW5mbyA9IGNtLmdldE5ldHdvcmtJbmZvKAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ29ubmVjdGl2aXR5TWFuYWdlci5UWVBFX01PQklMRV9ISVBSSSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGluZm8uaXNDb25uZWN0ZWQoKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJ5ZXMgLSBoaXByaSBpbiB1c2UiKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKERFQlVHKSBMb2cuZChUQUcsICJ5ZXMgLSBoaXByaSBpbiB1c2UiKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gZXZlbiBpZiB3ZSdyZSBhbHJlYWR5IGNvbm5lY3RlZCAtIGl0IG1heSBiZSBzb21ib2R5IGVsc2UncwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyByZWZjb3VudCwgc28gYWRkIG91ciBvd24KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHVybk9uTW9iaWxlQ29ubmVjdGlvbigpOwpAQCAtMTI0NSw3ICsxMzA1LDcgQEAKICAgICAgICAgICAgICAgICBub3RpZnlUZXRoZXJlZE9mTmV3VXBzdHJlYW1JZmFjZShpZmFjZSk7CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBwcm90ZWN0ZWQgdm9pZCBub3RpZnlUZXRoZXJlZE9mTmV3VXBzdHJlYW1JZmFjZShTdHJpbmcgaWZhY2VOYW1lKSB7Ci0gICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAibm90aWZ5aW5nIHRldGhlcmVkIHdpdGggaWZhY2UgPSIgKyBpZmFjZU5hbWUpOworICAgICAgICAgICAgICAgIGlmIChERUJVRykgTG9nLmQoVEFHLCAibm90aWZ5aW5nIHRldGhlcmVkIHdpdGggaWZhY2UgPSIgKyBpZmFjZU5hbWUpOwogICAgICAgICAgICAgICAgIG1VcHN0cmVhbUlmYWNlTmFtZSA9IGlmYWNlTmFtZTsKICAgICAgICAgICAgICAgICBmb3IgKE9iamVjdCBvIDogbU5vdGlmeUxpc3QpIHsKICAgICAgICAgICAgICAgICAgICAgVGV0aGVySW50ZXJmYWNlU00gc20gPSAoVGV0aGVySW50ZXJmYWNlU00pbzsKQEAgLTEyNjIsMTkgKzEzMjIsMTkgQEAKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIEBPdmVycmlkZQogICAgICAgICAgICAgcHVibGljIGJvb2xlYW4gcHJvY2Vzc01lc3NhZ2UoTWVzc2FnZSBtZXNzYWdlKSB7Ci0gICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAiTWFzdGVySW5pdGlhbFN0YXRlLnByb2Nlc3NNZXNzYWdlIHdoYXQ9IiArIG1lc3NhZ2Uud2hhdCk7CisgICAgICAgICAgICAgICAgaWYgKERFQlVHKSBMb2cuZChUQUcsICJNYXN0ZXJJbml0aWFsU3RhdGUucHJvY2Vzc01lc3NhZ2Ugd2hhdD0iICsgbWVzc2FnZS53aGF0KTsKICAgICAgICAgICAgICAgICBib29sZWFuIHJldFZhbHVlID0gdHJ1ZTsKICAgICAgICAgICAgICAgICBzd2l0Y2ggKG1lc3NhZ2Uud2hhdCkgewogICAgICAgICAgICAgICAgICAgICBjYXNlIENNRF9URVRIRVJfTU9ERV9SRVFVRVNURUQ6CiAgICAgICAgICAgICAgICAgICAgICAgICBtRHVuUmVxdWlyZWQgPSBpc0R1blJlcXVpcmVkKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICBUZXRoZXJJbnRlcmZhY2VTTSB3aG8gPSAoVGV0aGVySW50ZXJmYWNlU00pbWVzc2FnZS5vYmo7Ci0gICAgICAgICAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJUZXRoZXIgTW9kZSByZXF1ZXN0ZWQgYnkgIiArIHdoby50b1N0cmluZygpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChERUJVRykgTG9nLmQoVEFHLCAiVGV0aGVyIE1vZGUgcmVxdWVzdGVkIGJ5ICIgKyB3aG8udG9TdHJpbmcoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICBtTm90aWZ5TGlzdC5hZGQod2hvKTsKICAgICAgICAgICAgICAgICAgICAgICAgIHRyYW5zaXRpb25UbyhtVGV0aGVyTW9kZUFsaXZlU3RhdGUpOwogICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgIGNhc2UgQ01EX1RFVEhFUl9NT0RFX1VOUkVRVUVTVEVEOgogICAgICAgICAgICAgICAgICAgICAgICAgd2hvID0gKFRldGhlckludGVyZmFjZVNNKW1lc3NhZ2Uub2JqOwotICAgICAgICAgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAiVGV0aGVyIE1vZGUgdW5yZXF1ZXN0ZWQgYnkgIiArIHdoby50b1N0cmluZygpKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChERUJVRykgTG9nLmQoVEFHLCAiVGV0aGVyIE1vZGUgdW5yZXF1ZXN0ZWQgYnkgIiArIHdoby50b1N0cmluZygpKTsKICAgICAgICAgICAgICAgICAgICAgICAgIGludCBpbmRleCA9IG1Ob3RpZnlMaXN0LmluZGV4T2Yod2hvKTsKICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpbmRleCAhPSAtMSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1Ob3RpZnlMaXN0LnJlbW92ZSh3aG8pOwpAQCAtMTMwNCw3ICsxMzY0LDcgQEAKICAgICAgICAgICAgIH0KICAgICAgICAgICAgIEBPdmVycmlkZQogICAgICAgICAgICAgcHVibGljIGJvb2xlYW4gcHJvY2Vzc01lc3NhZ2UoTWVzc2FnZSBtZXNzYWdlKSB7Ci0gICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAiVGV0aGVyTW9kZUFsaXZlU3RhdGUucHJvY2Vzc01lc3NhZ2Ugd2hhdD0iICsgbWVzc2FnZS53aGF0KTsKKyAgICAgICAgICAgICAgICBpZiAoREVCVUcpIExvZy5kKFRBRywgIlRldGhlck1vZGVBbGl2ZVN0YXRlLnByb2Nlc3NNZXNzYWdlIHdoYXQ9IiArIG1lc3NhZ2Uud2hhdCk7CiAgICAgICAgICAgICAgICAgYm9vbGVhbiByZXRWYWx1ZSA9IHRydWU7CiAgICAgICAgICAgICAgICAgc3dpdGNoIChtZXNzYWdlLndoYXQpIHsKICAgICAgICAgICAgICAgICAgICAgY2FzZSBDTURfVEVUSEVSX01PREVfUkVRVUVTVEVEOgpAQCAtMTMzMiw4ICsxMzkyLDEwIEBACiAgICAgICAgICAgICAgICAgICAgICAgICAvLyBtYWtlIHN1cmUgd2UncmUgc3RpbGwgdXNpbmcgYSByZXF1ZXN0ZWQgY29ubmVjdGlvbiAtIG1heSBoYXZlIGZvdW5kCiAgICAgICAgICAgICAgICAgICAgICAgICAvLyB3aWZpIG9yIHNvbWV0aGluZyBzaW5jZSB0aGVuLgogICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1Db25uZWN0aW9uUmVxdWVzdGVkKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAicmVuZXdpbmcgbW9iaWxlIGNvbm5lY3Rpb24gLSByZXF1ZXVpbmcgZm9yIGFub3RoZXIgIiArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBDRUxMX0NPTk5FQ1RJT05fUkVORVdfTVMgKyAibXMiKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoREVCVUcpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAicmVuZXdpbmcgbW9iaWxlIGNvbm5lY3Rpb24gLSByZXF1ZXVpbmcgZm9yIGFub3RoZXIgI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wTG9jYXRpb25CYXNlZERldGVjdG9yKCk7CisgICAgICAgIH0KKyAgICB9OworCisgICAgcHVibGljIENvbXByZWhlbnNpdmVDb3VudHJ5RGV0ZWN0b3IoQ29udGV4dCBjb250ZXh0KSB7CisgICAgICAgIHN1cGVyKGNvbnRleHQpOworICAgICAgICBtVGVsZXBob255TWFuYWdlciA9IChUZWxlcGhvbnlNYW5hZ2VyKSBjb250ZXh0LmdldFN5c3RlbVNlcnZpY2UoQ29udGV4dC5URUxFUEhPTllfU0VSVklDRSk7CisgICAgICAgIG1QaG9uZVR5cGUgPSBtVGVsZXBob255TWFuYWdlci5nZXRQaG9uZVR5cGUoKTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgQ291bnRyeSBkZXRlY3RDb3VudHJ5KCkgeworICAgICAgICAvLyBEb24ndCBzdGFydCB0aGUgTG9jYXRpb25CYXNlZENvdW50cnlEZXRlY3RvciBpZiB3ZSBoYXZlIGJlZW4gc3RvcHBlZC4KKyAgICAgICAgcmV0dXJuIGRldGVjdENvdW50cnkoZmFsc2UsICFtU3RvcHBlZCk7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgc3RvcCgpIHsKKyAgICAgICAgU2xvZy5pKFRBRywgIlN0b3AgdGhlIGRldGVjdG9yLiIpOworICAgICAgICBjYW5jZWxMb2NhdGlvblJlZnJlc2goKTsKKyAgICAgICAgcmVtb3ZlUGhvbmVTdGF0ZUxpc3RlbmVyKCk7CisgICAgICAgIHN0b3BMb2NhdGlvbkJhc2VkRGV0ZWN0b3IoKTsKKyAgICAgICAgbUxpc3RlbmVyID0gbnVsbDsKKyAgICAgICAgbVN0b3BwZWQgPSB0cnVlOworICAgIH0KKworICAgIC8qKgorICAgICAqIEdldCB0aGUgY291bnRyeSBmcm9tIGRpZmZlcmVudCBzb3VyY2VzIGluIG9yZGVyIG9mIHRoZSByZWxpYWJpbGl0eS4KKyAgICAgKi8KKyAgICBwcml2YXRlIENvdW50cnkgZ2V0Q291bnRyeSgpIHsKKyAgICAgICAgQ291bnRyeSByZXN1bHQgPSBudWxsOworICAgICAgICByZXN1bHQgPSBnZXROZXR3b3JrQmFzZWRDb3VudHJ5KCk7CisgICAgICAgIGlmIChyZXN1bHQgPT0gbnVsbCkgeworICAgICAgICAgICAgcmVzdWx0ID0gZ2V0TGFzdEtub3duTG9jYXRpb25CYXNlZENvdW50cnkoKTsKKyAgICAgICAgfQorICAgICAgICBpZiAocmVzdWx0ID09IG51bGwpIHsKKyAgICAgICAgICAgIHJlc3VsdCA9IGdldFNpbUJhc2VkQ291bnRyeSgpOworICAgICAgICB9CisgICAgICAgIGlmIChyZXN1bHQgPT0gbnVsbCkgeworICAgICAgICAgICAgcmVzdWx0ID0gZ2V0TG9jYWxlQ291bnRyeSgpOworICAgICAgICB9CisgICAgICAgIHJldHVybiByZXN1bHQ7CisgICAgfQorCisgICAgLyoqCisgICAgICogQHJldHVybiB0aGUgY291bnRyeSBmcm9tIHRoZSBtb2JpbGUgbmV0d29yay4KKyAgICAgKi8KKyAgICBwcm90ZWN0ZWQgQ291bnRyeSBnZXROZXR3b3JrQmFzZWRDb3VudHJ5KCkgeworICAgICAgICBTdHJpbmcgY291bnRyeUlzbyA9IG51bGw7CisgICAgICAgIC8vIFRPRE86IFRoZSBkb2N1bWVudCBzYXlzIHRoZSByZXN1bHQgbWF5IGJlIHVucmVsaWFibGUgb24gQ0RNQSBuZXR3b3Jrcy4gU2hhbGwgd2UgdXNlCisgICAgICAgIC8vIGl0IG9uIENETUEgcGhvbmU/IFdlIG1heSB0ZXN0IHRoZSBBbmRyb2lkIHByaW1hcmlseSB1c2VkIGNvdW50cmllcy4KKyAgICAgICAgaWYgKG1QaG9uZVR5cGUgPT0gVGVsZXBob255TWFuYWdlci5QSE9ORV9UWVBFX0dTTSkgeworICAgICAgICAgICAgY291bnRyeUlzbyA9IG1UZWxlcGhvbnlNYW5hZ2VyLmdldE5ldHdvcmtDb3VudHJ5SXNvKCk7CisgICAgICAgICAgICBpZiAoIVRleHRVdGlscy5pc0VtcHR5KGNvdW50cnlJc28pKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBDb3VudHJ5KGNvdW50cnlJc28sIENvdW50cnkuQ09VTlRSWV9TT1VSQ0VfTkVUV09SSyk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIG51bGw7CisgICAgfQorCisgICAgLyoqCisgICAgICogQHJldHVybiB0aGUgY2FjaGVkIGxvY2F0aW9uIGJhc2VkIGNvdW50cnkuCisgICAgICovCisgICAgcHJvdGVjdGVkIENvdW50cnkgZ2V0TGFzdEtub3duTG9jYXRpb25CYXNlZENvdW50cnkoKSB7CisgICAgICAgIHJldHVybiBtQ291bnRyeUZyb21Mb2NhdGlvbjsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBAcmV0dXJuIHRoZSBjb3VudHJ5IGZyb20gU0lNIGNhcmQKKyAgICAgKi8KKyAgICBwcm90ZWN0ZWQgQ291bnRyeSBnZXRTaW1CYXNlZENvdW50cnkoKSB7CisgICAgICAgIFN0cmluZyBjb3VudHJ5SXNvID0gbnVsbDsKKyAgICAgICAgY291bnRyeUlzbyA9IG1UZWxlcGhvbnlNYW5hZ2VyLmdldFNpbUNvdW50cnlJc28oKTsKKyAgICAgICAgaWYgKCFUZXh0VXRpbHMuaXNFbXB0eShjb3VudHJ5SXNvKSkgeworICAgICAgICAgICAgcmV0dXJuIG5ldyBDb3VudHJ5KGNvdW50cnlJc28sIENvdW50cnkuQ09VTlRSWV9TT1VSQ0VfU0lNKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbnVsbDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBAcmV0dXJuIHRoZSBjb3VudHJ5IGZyb20gdGhlIHN5c3RlbSdzIGxvY2FsZS4KKyAgICAgKi8KKyAgICBwcm90ZWN0ZWQgQ291bnRyeSBnZXRMb2NhbGVDb3VudHJ5K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J5LCBjb3VudHJ5LAorICAgICAgICAgICAgICAgIG5vdGlmeUNoYW5nZSwgc3RhcnRMb2NhdGlvbkJhc2VkRGV0ZWN0aW9uKTsKKyAgICAgICAgbUNvdW50cnkgPSBjb3VudHJ5OworICAgICAgICByZXR1cm4gbUNvdW50cnk7CisgICAgfQorCisgICAgLyoqCisgICAgICogUnVuIHRoZSB0YXNrcyBpbiB0aGUgc2VydmljZSdzIHRocmVhZC4KKyAgICAgKi8KKyAgICBwcm90ZWN0ZWQgdm9pZCBydW5BZnRlckRldGVjdGlvbkFzeW5jKGZpbmFsIENvdW50cnkgY291bnRyeSwgZmluYWwgQ291bnRyeSBkZXRlY3RlZENvdW50cnksCisgICAgICAgICAgICBmaW5hbCBib29sZWFuIG5vdGlmeUNoYW5nZSwgZmluYWwgYm9vbGVhbiBzdGFydExvY2F0aW9uQmFzZWREZXRlY3Rpb24pIHsKKyAgICAgICAgbUhhbmRsZXIucG9zdChuZXcgUnVubmFibGUoKSB7CisgICAgICAgICAgICBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgICAgICAgICAgcnVuQWZ0ZXJEZXRlY3Rpb24oCisgICAgICAgICAgICAgICAgICAgICAgICBjb3VudHJ5LCBkZXRlY3RlZENvdW50cnksIG5vdGlmeUNoYW5nZSwgc3RhcnRMb2NhdGlvbkJhc2VkRGV0ZWN0aW9uKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSk7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgc2V0Q291bnRyeUxpc3RlbmVyKENvdW50cnlMaXN0ZW5lciBsaXN0ZW5lcikgeworICAgICAgICBDb3VudHJ5TGlzdGVuZXIgcHJldkxpc3RlbmVyID0gbUxpc3RlbmVyOworICAgICAgICBtTGlzdGVuZXIgPSBsaXN0ZW5lcjsKKyAgICAgICAgaWYgKG1MaXN0ZW5lciA9PSBudWxsKSB7CisgICAgICAgICAgICAvLyBTdG9wIGxpc3RlbmluZyBhbGwgc2VydmljZXMKKyAgICAgICAgICAgIHJlbW92ZVBob25lU3RhdGVMaXN0ZW5lcigpOworICAgICAgICAgICAgc3RvcExvY2F0aW9uQmFzZWREZXRlY3RvcigpOworICAgICAgICAgICAgY2FuY2VsTG9jYXRpb25SZWZyZXNoKCk7CisgICAgICAgIH0gZWxzZSBpZiAocHJldkxpc3RlbmVyID09IG51bGwpIHsKKyAgICAgICAgICAgIGFkZFBob25lU3RhdGVMaXN0ZW5lcigpOworICAgICAgICAgICAgZGV0ZWN0Q291bnRyeShmYWxzZSwgdHJ1ZSk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICB2b2lkIHJ1bkFmdGVyRGV0ZWN0aW9uKGZpbmFsIENvdW50cnkgY291bnRyeSwgZmluYWwgQ291bnRyeSBkZXRlY3RlZENvdW50cnksCisgICAgICAgICAgICBmaW5hbCBib29sZWFuIG5vdGlmeUNoYW5nZSwgZmluYWwgYm9vbGVhbiBzdGFydExvY2F0aW9uQmFzZWREZXRlY3Rpb24pIHsKKyAgICAgICAgaWYgKG5vdGlmeUNoYW5nZSkgeworICAgICAgICAgICAgbm90aWZ5SWZDb3VudHJ5Q2hhbmdlZChjb3VudHJ5LCBkZXRlY3RlZENvdW50cnkpOworICAgICAgICB9CisgICAgICAgIGlmIChzdGFydExvY2F0aW9uQmFzZWREZXRlY3Rpb24gJiYgKGRldGVjdGVkQ291bnRyeSA9PSBudWxsCisgICAgICAgICAgICAgICAgfHwgZGV0ZWN0ZWRDb3VudHJ5LmdldFNvdXJjZSgpID4gQ291bnRyeS5DT1VOVFJZX1NPVVJDRV9MT0NBVElPTikKKyAgICAgICAgICAgICAgICAmJiBpc0FpcnBsYW5lTW9kZU9mZigpICYmIG1MaXN0ZW5lciAhPSBudWxsICYmIGlzR2VvQ29kZXJJbXBsZW1lbnRlZCgpKSB7CisgICAgICAgICAgICAvLyBTdGFydCBmaW5kaW5nIGxvY2F0aW9uIHdoZW4gdGhlIHNvdXJjZSBpcyBsZXNzIH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CBzb3VyY2UgaXMKKyAgICAgICAgICAgIC8vIG1vcmUgcmVsaWFibGUgdGhhbiB0aGUgbG9jYXRpb24uCisgICAgICAgICAgICBjYW5jZWxMb2NhdGlvblJlZnJlc2goKTsKKyAgICAgICAgICAgIHN0b3BMb2NhdGlvbkJhc2VkRGV0ZWN0b3IoKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIEZpbmQgdGhlIGNvdW50cnkgZnJvbSBMb2NhdGlvblByb3ZpZGVyLgorICAgICAqLworICAgIHByaXZhdGUgc3luY2hyb25pemVkIHZvaWQgc3RhcnRMb2NhdGlvbkJhc2VkRGV0ZWN0b3IoQ291bnRyeUxpc3RlbmVyIGxpc3RlbmVyKSB7CisgICAgICAgIGlmIChtTG9jYXRpb25CYXNlZENvdW50cnlEZXRlY3RvciAhPSBudWxsKSB7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKyAgICAgICAgbUxvY2F0aW9uQmFzZWRDb3VudHJ5RGV0ZWN0b3IgPSBjcmVhdGVMb2NhdGlvbkJhc2VkQ291bnRyeURldGVjdG9yKCk7CisgICAgICAgIG1Mb2NhdGlvbkJhc2VkQ291bnRyeURldGVjdG9yLnNldENvdW50cnlMaXN0ZW5lcihsaXN0ZW5lcik7CisgICAgICAgIG1Mb2NhdGlvbkJhc2VkQ291bnRyeURldGVjdG9yLmRldGVjdENvdW50cnkoKTsKKyAgICB9CisKKyAgICBwcml2YXRlIHN5bmNocm9uaXplZCB2b2lkIHN0b3BMb2NhdGlvbkJhc2VkRGV0ZWN0b3IoKSB7CisgICAgICAgIGlmIChtTG9jYXRpb25CYXNlZENvdW50cnlEZXRlY3RvciAhPSBudWxsKSB7CisgICAgICAgICAgICBtTG9jYXRpb25CYXNlZENvdW50cnlEZXRlY3Rvci5zdG9wKCk7CisgICAgICAgICAgICBtTG9jYXRpb25CYXNlZENvdW50cnlEZXRlY3RvciA9IG51bGw7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcm90ZWN0ZWQgQ291bnRyeURldGVjdG9yQmFzZSBjcmVhdGVMb2NhdGlvbkJhc2VkQ291bnRyeURldGVjdG9yKCkgeworICAgICAgICByZXR1cm4gbmV3IExvY2F0aW9uQmFzZWRDb3VudHJ5RGV0ZWN0b3IobUNvbnRleHQpOworICAgIH0KKworICAgIHByb3RlY3RlZCBib29sZWFuIGlzQWlycGxhbmVNb2RlT2ZmKCkgeworICAgICAgICByZXR1cm4gU2V0dGluZ3MuU3lzdGVtLmdldEludCgKKyAgICAgICAgICAgICAgICBtQ29udGV4dC5nZXRDb250ZW50UmVzb2x2ZXIoKSwgU2V0dGluZ3MuU3lzdGVtLkFJUlBMQU5FX01PREVfT04sIDApID09IDA7CisgICAgfQorCisgICAgLyoqCisgICAgICogTm90aWZ5IHRoZSBjb3VudHJ5IGNoYW5nZS4KKyAgICAgKi8KKyAgICBwcml2YXRlIHZvaWQgbm90aWZ5SWZDb3VudHJ5Q2hhbmdlZChmaW5hbCBDb3VudHJ5IGNvdW50cnksIGZpbmFsIENvdW50cnkgZGV0ZWN0ZWRDb3VudHJ5KSB7CisgICAgICAgIGlmIChkZXRlY3RlZENvdW50cnkgIT0gbnVsbCAmJiBtTGlzdGVuZXIgIT0gbnVsbAorICAgICAgICAgICAgICAgICYmIChjb3VudHJ5ID09IG51bGwgfHwgIWNvdW50cnkuZXF1YWxzKGRldGVjdGVkQ291bnRyeSkpKSB7CisgICAgICAgICAgICBTbG9nLmQoVEFHLAorICAgICAgICAgICAgICAgICAgICAiVGhlIGNvdW50cnkgd2FzIGNoYW5nZWQgZnJvbSAiICsgY291bnRyeSAhPSBudWxsID8gY291bnRyeS5nZXRDb3VudHJ5SXNvKCkgOgorICAgICAgICAgICAgICAgICAgICAgICAgY291bnRyeSArICIgdG8gIiArIGRldGVjdGVkQ291bnRyeS5nZXRDb3VudHJ5SXNvKCkpOworICAgICAgICAgICAgbm90aWZ5TGlzdGVuZXIoZGV0ZWN0ZWRDb3VudHJ5KTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIFNjaGVkdWxlIHRoZSBuZXh0IGxvY2F0aW9uIHJlZnJlc2guIFdlIHdpbGwgZG8gbm90aGluZyBpZiB0aGUgc2NoZWR1bGVkIHRhc2sgZXhpc3RzLgorICAgICAqLworICAgIHByaXZhdGUgc3luY2hyb25pemVkIHZvaWQgc2NoZWR1bGVMb2NhdGlvblJlZnJlc2goKSB7CisgICAgICAgIGlmIChtTG9jYXRpb25SZWZyZXNoVGltZXIgIT0gbnVsbCkgcmV0dXJuOworICAgICAgICBtTG9jYXRpb25SZWZyZXNoVGltZXIgPSBuZXcgVGltZXIoKTsKKyAgICAgICAgbUxvY2F0aW9uUmVmcmVzaFRpbWVyLnNjaGVkdWxlKG5ldyBUaW1lclRhc2soKSB7CisgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgIHB1YmxpYyB2b2lkIHJ1bigpIHsKKyAgICAgICAgICAgICAgICBtTG9jYXRpb25SZWZyZXNoVGltZXIgPSBudWxsOworICAgICAgICAgICAgICAgIGRldGVjdENvdW50cnkoZmFsc2UsIHRydWUpOworICAgICAgICAgICAgfQorICAgICAgICB9LCBMT0NBVElPTl9SRUZSRVNIX0lOVEVSVkFMKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBDYW5jZWwgdGhlIHNjaGVkdWxlZCByZWZyZXNoIHRhc2sgaWYgaXQgZXhpc3RzCisgICAgICovCisgICAgcHJpdmF0ZSBzeW5jaHJvbml6ZWQgdm9pZCBjYW5jZWxMb2NhdGlvblJlZnJlc2goKSB7CisgICAgICAgIGlmIChtTG9jYXRpb25SZWZyZXNoVGltZXIgIT0gbnVsbCkgeworICAgICAgICAgICAgbUxvY2F0aW9uUmVmcmVzaFRpbWVyLmNhbmNlbCgpOworICAgICAgICAgICAgbUxvY2F0aW9uUmVmcmVzaFRpbWVyID0gbnVsbDsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByb3RlY3RlZCBz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k1hbmFnZXIpIGN0eC5nZXRTeXN0ZW1TZXJ2aWNlKENvbnRleHQuTE9DQVRJT05fU0VSVklDRSk7CisgICAgfQorCisgICAgLyoqCisgICAgICogQHJldHVybiB0aGUgSVNPIDMxNjYtMSB0d28gbGV0dGVycyBjb3VudHJ5IGNvZGUgZnJvbSB0aGUgbG9jYXRpb24KKyAgICAgKi8KKyAgICBwcm90ZWN0ZWQgU3RyaW5nIGdldENvdW50cnlGcm9tTG9jYXRpb24oTG9jYXRpb24gbG9jYXRpb24pIHsKKyAgICAgICAgU3RyaW5nIGNvdW50cnkgPSBudWxsOworICAgICAgICBHZW9jb2RlciBnZW9Db2RlciA9IG5ldyBHZW9jb2RlcihtQ29udGV4dCk7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBMaXN0PEFkZHJlc3M+IGFkZHJlc3NlcyA9IGdlb0NvZGVyLmdldEZyb21Mb2NhdGlvbigKKyAgICAgICAgICAgICAgICAgICAgbG9jYXRpb24uZ2V0TGF0aXR1ZGUoKSwgbG9jYXRpb24uZ2V0TG9uZ2l0dWRlKCksIDEpOworICAgICAgICAgICAgaWYgKGFkZHJlc3NlcyAhPSBudWxsICYmIGFkZHJlc3Nlcy5zaXplKCkgPiAwKSB7CisgICAgICAgICAgICAgICAgY291bnRyeSA9IGFkZHJlc3Nlcy5nZXQoMCkuZ2V0Q291bnRyeUNvZGUoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBjYXRjaCAoSU9FeGNlcHRpb24gZSkgeworICAgICAgICAgICAgU2xvZy53KFRBRywgIkV4Y2VwdGlvbiBvY2N1cnMgd2hlbiBnZXR0aW5nIGNvdW50cnkgZnJvbSBsb2NhdGlvbiIpOworICAgICAgICB9CisgICAgICAgIHJldHVybiBjb3VudHJ5OworICAgIH0KKworICAgIC8qKgorICAgICAqIFJlZ2lzdGVyIHRoZSBsaXN0ZW5lcnMgd2l0aCB0aGUgbG9jYXRpb24gcHJvdmlkZXJzCisgICAgICovCisgICAgc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ZvciAoU3RyaW5nIHByb3ZpZGVyIDogcHJvdmlkZXJzKSB7CisgICAgICAgICAgICBMb2NhdGlvbiBsYXN0S25vd25Mb2NhdGlvbiA9IG1Mb2NhdGlvbk1hbmFnZXIuZ2V0TGFzdEtub3duTG9jYXRpb24ocHJvdmlkZXIpOworICAgICAgICAgICAgaWYgKGxhc3RLbm93bkxvY2F0aW9uICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBpZiAoYmVzdExvY2F0aW9uID09IG51bGwgfHwgYmVzdExvY2F0aW9uLmdldFRpbWUoKSA8IGxhc3RLbm93bkxvY2F0aW9uLmdldFRpbWUoKSkgeworICAgICAgICAgICAgICAgICAgICBiZXN0TG9jYXRpb24gPSBsYXN0S25vd25Mb2NhdGlvbjsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIGJlc3RMb2NhdGlvbjsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBAcmV0dXJuIHRoZSB0aW1lb3V0IGZvciBxdWVyeWluZyB0aGUgbG9jYXRpb24uCisgICAgICovCisgICAgcHJvdGVjdGVkIGxvbmcgZ2V0UXVlcnlMb2NhdGlvblRpbWVvdXQoKSB7CisgICAgICAgIHJldHVybiBRVUVSWV9MT0NBVElPTl9USU1FT1VUOworICAgIH0KKworICAgIC8qKgorICAgICAqIEByZXR1cm4gdGhlIHRvdGFsIG51bWJlciBvZiBlbmFibGVkIGxvY2F0aW9uIHByb3ZpZGVycworICAgICAqLworICAgIHByb3RlY3RlZCBpbnQgZ2V0VG90YWxFbmFibGVkUHJvdmlkZXJzKCkgeworICAgICAgICBpZiAobUVuYWJsZWRQcm92aWRlcnMgPT0gbnVsbCkgeworICAgICAgICAgICAgbUVuYWJsZWRQcm92aWRlcnMgPSBtTG9jYXRpb25NYW5hZ2VyLmdldFByb3ZpZGVycyh0cnVlKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbUVuYWJsZWRQcm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AgICAgaWYgKGxvY2F0aW9uICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBMb2NhdGlvbkJhc2VkQ291bnRyeURldGVjdG9yLnRoaXMuc3RvcCgpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHF1ZXJ5Q291bnRyeUNvZGUobG9jYXRpb24pOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIG9uUHJvdmlkZXJEaXNhYmxlZChTdHJpbmcgcHJvdmlkZXIpIHsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBvblByb3ZpZGVyRW5hYmxlZChTdHJpbmcgcHJvdmlkZXIpIHsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBvblN0YXR1c0NoYW5nZWQoU3RyaW5nIHByb3ZpZGVyLCBpbnQgc3RhdHVzLCBCdW5kbGUgZXh0cmFzKSB7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9OworICAgICAgICAgICAgICAgIG1Mb2NhdGlvbkxpc3RlbmVycy5hZGQobGlzdGVuZXIpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcmVnaXN0ZXJFbmFibGVkUHJvdmlkZXJzKG1Mb2NhdGlvbkxpc3RlbmVycyk7CisgICAgICAgICAgICBtVGltZXIgPSBuZXcgVGltZXIoKTsKKyAgICAgICAgICAgIG1UaW1lci5zY2hlZHVsZShuZXcgVGltZXJUYXNrKCkgeworICAgICAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIHJ1bigpIHsKKyAgICAgICAgICAgICAgICAgICAgbVRpbWVyID0gbnVsbDsKKyAgICAgICAgICAgICAgICAgICAgTG9jYXRpb25CYXNlZENvdW50cnlEZXRlY3Rvci50aGlzLnN0b3AoKTsKKyAgICAgICAgICAgICAgICAgICAgLy8gTG9va3MgbGlrZSBubyBwcm92aWRlciBjb3VsZCBwcm92aWRlIHRoZSBsb2NhdGlvbiwgbGV0J3MgdHJ5IHRoZSBsYXN0CisgICAgICAgICAgICAgICAgICAgIC8vIGtub3duIGxvY2F0aW9uLgorICAgICAgICAgICAgICAgICAgICBxdWVyeUNvdW50cnlDb2RlKGdldExhc3RLbm93bkxvY2F0aW9uKCkpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0sIGdldFF1ZXJ5TG9jYXRpb25UaW1lb3V0KCkpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgLy8gVGhlcmUgaXMgbm8gcHJvdmlkZXIgZW5hYmxlZC4KKyAgICAgICAgICAgIHF1ZXJ5Q291bnRyeUNvZGUoZ2V0TGFzdEtub3duTG9jYXRpb24oKSk7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIG1EZXRlY3RlZENvdW50cnk7CisgICAgfQorCisgICAgLyoqCisgICAgICogU3RvcCB0aGUgY3VycmVudCBxdWVyeSB3aXRob3V0IG5vdGlmeWluZyB0aGUgbGlzdGVuZXIuCisgICAgICovCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHN5bmNocm9uaXplZCB2b2lkIHN0b3AoKSB7CisgICAgICAgIGlmIChtTG9jYXRpb25MaXN0ZW5lcnMgIT0gbnVsbCkgeworICAgICAgICAgICAgdW5yZWdpc3RlclByb3ZpZGVycyhtTG9jYXRpb25MaXN0ZW5lcnMpOworICAgICAgICAgICAgbUxvY2F0aW9uTGlzdGVuZXJzID0gbnVsbDsKKyAgICAgICAgfQorICAgICAgICBpZiAobVRpbWVyICE9IG51bGwpIHsKKyAgICAgICAgICAgIG1UaW1lci5jYW5jZWwoKTsKKyAgICAgICAgICAgIG1UaW1lciA9IG51bGw7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBTdGFydCBhIG5ldyB0aHJlYWQgdG8gcXVlcnkgdGhlIGNvdW50cnkgZnJvbSBHZW9jb2Rlci4KKyAgICAgKi8KKyAgICBwcml2YXRlIHN5bmNocm9uaXplZCB2b2lkIHF1ZXJ5Q291bnRyeUNvZGUoZmluYWwgTG9jYXRpb24gbG9jYXRpb24pIHsKKyAgICAgICAgaWYgKGxvY2F0aW9uID09IG51bGwpIHsKKyAgICAgICAgICAgIG5vdGlmeUxpc3RlbmVyKG51bGwpOworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisgICAgICAgIGlmIChtUXVlcnlUaHJlYWQgIT0gbnVsbCkgcmV0dXJuOworICAgICAgICBtUXVlcnlUaHJlYWQgPSBuZXcgVGhyZWFkKG5ldyBSdW5uYWJsZSgpIHsKKyAgICAgICAgICAgIHB1YmxpYyB2b2lkIHJ1bigpIHsKKyAgICAgICAgICAgICAgICBTdHJpbmcgY291bnRyeUlzbyA9IG51bGw7CisgICAgICAgICAgICAgICAgaWYgKGxvY2F0aW9uICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgY291bnRyeUlzbyA9IGdldENvdW50cnlGcm9tTG9jYXRpb24obG9jYXRpb24pOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBpZiAoY291bnRyeUlzbyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIG1EZXRlY3RlZENvdW50cnkgPSBuZXcgQ291bnRyeShjb3VudHJ5SXNvLCBDb3VudHJ5LkNPVU5UUllfU09VUkNFX0xPQ0FUSU9OKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICBtRGV0ZWN0ZWRDb3VudHJ5ID0gbnVsbDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgbm90aWZ5TGlzdGVuZXIobURldGVjdGVkQ291bnRyeSk7CisgICAgICAgICAgICAgICAgbVF1ZXJ5VGhyZWFkID0gbnVsbDsKKyAgICAgICAgICAgIH0KKyAgICAg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iX2RldmljZV9nZXRfbWFudWZhY3R1cmVyX25hbWUoZGV2aWNlKSwKKyAgICAgICAgICAgICAgICAgICAgICAgIHVzYl9kZXZpY2VfZ2V0X3Byb2R1Y3RfbmFtZShkZXZpY2UpKTsKKworICAgICAgICAgICAgICAgIC8vIGludGVyZmFjZSBzaG91bGQgYmUgZm9sbG93ZWQgYnkgdGhyZWUgZW5kcG9pbnRzCisgICAgICAgICAgICAgICAgc3RydWN0IHVzYl9lbmRwb2ludF9kZXNjcmlwdG9yICplcDsKKyAgICAgICAgICAgICAgICBzdHJ1Y3QgdXNiX2VuZHBvaW50X2Rlc2NyaXB0b3IgKmVwX2luX2Rlc2MgPSBOVUxMOworICAgICAgICAgICAgICAgIHN0cnVjdCB1c2JfZW5kcG9pbnRfZGVzY3JpcHRvciAqZXBfb3V0X2Rlc2MgPSBOVUxMOworICAgICAgICAgICAgICAgIHN0cnVjdCB1c2JfZW5kcG9pbnRfZGVzY3JpcHRvciAqZXBfaW50cl9kZXNjID0gTlVMTDsKKyAgICAgICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IDM7IGkrKykgeworICAgICAgICAgICAgICAgICAgICBlcCA9IChzdHJ1Y3QgdXNiX2VuZHBvaW50X2Rlc2NyaXB0b3IgKil1c2JfZGVzY3JpcHRvcl9pdGVyX25leHQoJml0ZXIpOworICAgICAgICAgICAgICAgICAgICBpZiAoIWVwIHx8IGVwLT5iRGVzY3JpcHRvclR5cGUgIT0gVVNCX0RUX0VORFBPSU5UKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBMT0dFKCJlbmRwb2ludHMgbm90IGZvdW5kXG4iKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGdvdG8gZG9uZTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBpZiAoZXAtPmJtQXR0cmlidXRlcyA9PSBVU0JfRU5EUE9JTlRfWEZFUl9CVUxLKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZXAtPmJFbmRwb2ludEFkZHJlc3MgJiBVU0JfRU5EUE9JTlRfRElSX01BU0spCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXBfaW5fZGVzYyA9IGVwOworICAgICAgICAgICAgICAgICAgICAgICAgZWxzZQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVwX291dF9kZXNjID0gZXA7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoZXAtPmJtQXR0cmlidXRlcyA9PSBVU0JfRU5EUE9JTlRfWEZFUl9JTlQgJiYKKyAgICAgICAgICAgICAgICAgICAgICAgIGVwLT5iRW5kcG9pbnRBZGRyZXNzICYgVVNCX0VORFBPSU5UX0RJUl9NQVNLKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBlcF9pbnRyX2Rlc2MgPSBlcDsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBpZiAoIWVwX2luX2Rlc2MgfHwgIWVwX291dF9kZXNjIHx8ICFlcF9pbnRyX2Rlc2MpIHsKKyAgICAgICAgICAgICAgICAgICAgTE9HRSgiZW5kcG9pbnRzIG5vdCBmb3VuZFxuIik7CisgICAgICAgICAgICAgICAgICAgIGdvdG8gZG9uZTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAvLyBpZiB3ZSBnb3QgaGVyZSwgd2UgZm91bmQgYSBjYW1lcmEKKyAgICAgICAgICAgICAgICBKTklFbnYqIGVudiA9IEFuZHJvaWRSdW50aW1lOjpnZXRKTklFbnYoKTsKKyAgICAgICAgICAgICAgICBqb2JqZWN0IHRoaXogPSAoam9iamVjdCljbGllbnRfZGF0YTsKKworICAgICAgICAgICAgICAgIGludCBpZCA9IHVzYl9kZXZpY2VfZ2V0X3VuaXF1ZV9pZF9mcm9tX25hbWUoZGV2bmFtZSk7CisgICAgICAgICAgICAgICAgbURldmljZUxpc3QuYWRkKGlkKTsKKworICAgICAgICAgICAgICAgIGVudi0+Q2FsbFZvaWRNZXRob2QodGhpeiwgbWV0aG9kX3VzYkNhbWVyYUFkZGVkLCBpZCk7CisgICAgICAgICAgICAgICAgY2hlY2tBbmRDbGVhckV4Y2VwdGlvbkZyb21DYWxsYmFjayhlbnYsIF9fRlVOQ1RJT05fXyk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9Citkb25lOgorICAgIHVzYl9kZXZpY2VfY2xvc2UoZGV2aWNlKTsKKyAgICByZXR1cm4gMDsKK30KKworc3RhdGljIGludCB1c2JfZGV2aWNlX3JlbW92ZWQoY29uc3QgY2hhciAqZGV2bmFtZSwgdm9pZCogY2xpZW50X2RhdGEpIHsKKyAgICBpbnQgaWQgPSB1c2JfZGV2aWNlX2dldF91bmlxdWVfaWRfZnJvbV9uYW1lKGRldm5hbWUpOworCisgICAgLy8gc2VlIGlmIGl0IGlzIGEgZGV2aWNlIHdlIGtub3cgYWJvdXQKKyAgICBmb3IgKGludCBpID0gMDsgaSA8IG1EZXZpY2VMaXN0LnNpemUoKTsgaSsrKSB7CisgICAgICAgIGlmIChpZCAgPT0gbURldmljZUxpc3RbaV0pIHsKKyAgICAgICAgICAgIG1EZXZpY2VMaXN0LnJlbW92ZUF0KGkpOworCisgICAgICAgICAgICBKTklFbnYqIGVudiA9IEFuZHJvaWRSdW50aW1lOjpnZXRKTklFbnYoKTsKKyAgICAgICAgICAgIGpvYmplY3QgdGhpeiA9IChqb2JqZWN0KWNsaWVudF9kYXRhOworCisgICAgICAgICAgICBlbnYtPkNhbGxWb2lkTWV0aG9kKHRoaXosIG1ldGhvZF91c2JDYW1lcmFSZW1vdmVkLCBpZCk7CisgICAgICAgICAgICBjaGVja0FuZENsZWFyRXhjZXB0aW9uRnJvbUNhbGxiYWNrKGVudiwgX19GVU5DVElPTl9fKTsKKyAgICAgICAgICAgIGJyZWFrOworICAgICAgICB9CisgICAgfQorICAgIHJldHVybiAwOworfQorCitzdGF0aWMgdm9pZCBhbmRyb2lkX3NlcnZ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c2l6ZV90IG51bUxheWVycykgeworICAgIGlmIChtSHdjKSB7CisgICAgICAgIGlmICghbUxpc3QgfHwgbUNhcGFjaXR5IDwgbnVtTGF5ZXJzKSB7CisgICAgICAgICAgICBmcmVlKG1MaXN0KTsKKyAgICAgICAgICAgIHNpemVfdCBzaXplID0gc2l6ZW9mKGh3Y19sYXllcl9saXN0KSArIG51bUxheWVycypzaXplb2YoaHdjX2xheWVyX3QpOworICAgICAgICAgICAgbUxpc3QgPSAoaHdjX2xheWVyX2xpc3RfdCopbWFsbG9jKHNpemUpOworICAgICAgICAgICAgbUNhcGFjaXR5ID0gbnVtTGF5ZXJzOworICAgICAgICB9CisgICAgICAgIG1MaXN0LT5mbGFncyA9IEhXQ19HRU9NRVRSWV9DSEFOR0VEOworICAgICAgICBtTGlzdC0+bnVtSHdMYXllcnMgPSBudW1MYXllcnM7CisgICAgfQorICAgIHJldHVybiBOT19FUlJPUjsKK30KKworc3RhdHVzX3QgSFdDb21wb3Nlcjo6cHJlcGFyZSgpIGNvbnN0IHsKKyAgICBpbnQgZXJyID0gbUh3Yy0+cHJlcGFyZShtSHdjLCBtTGlzdCk7CisgICAgcmV0dXJuIChzdGF0dXNfdCllcnI7Cit9CisKK3N0YXR1c190IEhXQ29tcG9zZXI6OmNvbW1pdCgpIGNvbnN0IHsKKyAgICBpbnQgZXJyID0gbUh3Yy0+c2V0KG1Id2MsIG1EcHksIG1TdXIsIG1MaXN0KTsKKyAgICBtTGlzdC0+ZmxhZ3MgJj0gfkhXQ19HRU9NRVRSWV9DSEFOR0VEOworICAgIHJldHVybiAoc3RhdHVzX3QpZXJyOworfQorCitzaXplX3QgSFdDb21wb3Nlcjo6Z2V0TnVtTGF5ZXJzKCkgY29uc3QgeworICAgIHJldHVybiBtTGlzdCA/IG1MaXN0LT5udW1Id0xheWVycyA6IDA7Cit9CisKK2h3Y19sYXllcl90KiBIV0NvbXBvc2VyOjpnZXRMYXllcnMoKSBjb25zdCB7CisgICAgcmV0dXJuIG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XMgd2l0aG91dCB0aGUgbG9jayBoZWxkKQogICAgICAqLworCiAgICAgY29uc3Qgc2l6ZV90IGNvdW50ID0gZGl0Y2hlZExheWVycy5zaXplKCk7CiAgICAgZm9yIChzaXplX3QgaT0wIDsgaTxjb3VudCA7IGkrKykgewogICAgICAgICBpZiAoZGl0Y2hlZExheWVyc1tpXSAhPSAwKSB7CkBAIC02NTMsNyArNjYyLDcgQEAKIAogICAgICAgICAvLyBVcGRhdGUgYWJvdmVPcGFxdWVMYXllcnMgZm9yIG5leHQgKGxvd2VyKSBsYXllcgogICAgICAgICBhYm92ZU9wYXF1ZUxheWVycy5vclNlbGYob3BhcXVlUmVnaW9uKTsKLSAgICAgICAgCisKICAgICAgICAgLy8gU3RvcmUgdGhlIHZpc2libGUgcmVnaW9uIGlzIHNjcmVlbiBzcGFjZQogICAgICAgICBsYXllci0+c2V0VmlzaWJsZVJlZ2lvbih2aXNpYmxlUmVnaW9uKTsKICAgICAgICAgbGF5ZXItPnNldENvdmVyZWRSZWdpb24oY292ZXJlZFJlZ2lvbik7CkBAIC02ODMsOCArNjkyLDggQEAKIHZvaWQgU3VyZmFjZUZsaW5nZXI6OmhhbmRsZVBhZ2VGbGlwKCkKIHsKICAgICBib29sIHZpc2libGVSZWdpb25zID0gbVZpc2libGVSZWdpb25zRGlydHk7Ci0gICAgTGF5ZXJWZWN0b3ImIGN1cnJlbnRMYXllcnMgPSBjb25zdF9jYXN0PExheWVyVmVjdG9yJj4oCi0gICAgICAgICAgICBtRHJhd2luZ1N0YXRlLmxheWVyc1NvcnRlZEJ5Wik7CisgICAgTGF5ZXJWZWN0b3ImIGN1cnJlbnRMYXllcnMoCisgICAgICAgICAgICBjb25zdF9jYXN0PExheWVyVmVjdG9yJj4obURyYXdpbmdTdGF0ZS5sYXllcnNTb3J0ZWRCeVopKTsKICAgICB2aXNpYmxlUmVnaW9ucyB8PSBsb2NrUGFnZUZsaXAoY3VycmVudExheWVycyk7CiAKICAgICAgICAgY29uc3QgR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JiBodyhncmFwaGljUGxhbmUoMCkuZGlzcGxheUhhcmR3YXJlKCkpOworICAgIEhXQ29tcG9zZXImIGh3Yyhody5nZXRId0NvbXBvc2VyKCkpOworICAgIGh3Y19sYXllcl90KiBjb25zdCBjdXIoaHdjLmdldExheWVycygpKTsKKworICAgIExPR0VfSUYoY3VyICYmIGh3Yy5nZXROdW1MYXllcnMoKSAhPSBjb3VudCwKKyAgICAgICAgICAgICJIQUwgbnVtYmVyIG9mIGxheWVycyAoJWQpIGRvZXNuJ3QgbWF0Y2ggc3VyZmFjZWZsaW5nZXIgKCVkKSIsCisgICAgICAgICAgICBod2MuZ2V0TnVtTGF5ZXJzKCksIGNvdW50KTsKKworICAgIC8vIGp1c3QgdG8gYmUgZXh0cmEtc2FmZSwgdXNlIHRoZSBzbWFsbGVzdCBjb3VudAorICAgIGlmIChod2MuaW5pdENoZWNrKCkgPT0gTk9fRVJST1IpIHsKKyAgICAgICAgY291bnQgPSBjb3VudCA8IGh3Yy5nZXROdW1MYXllcnMoKSA/IGNvdW50IDogaHdjLmdldE51bUxheWVycygpOworICAgIH0KKworICAgIC8qCisgICAgICogIHVwZGF0ZSB0aGUgcGVyLWZyYW1lIGgvdyBjb21wb3NlciBkYXRhIGZvciBlYWNoIGxheWVyCisgICAgICogIGFuZCBidWlsZCB0aGUgdHJhbnNwYXJlbnQgcmVnaW9uIG9mIHRoZSBGQgorICAgICAqLworICAgIFJlZ2lvbiB0cmFuc3BhcmVudDsKKyAgICBpZiAoY3VyKSB7CisgICAgICAgIGZvciAoc2l6ZV90IGk9MCA7IGk8Y291bnQgOyBpKyspIHsKKyAgICAgICAgICAgIGNvbnN0IHNwPExheWVyQmFzZT4mIGxheWVyKGxheWVyc1tpXSk7CisgICAgICAgICAgICBsYXllci0+c2V0UGVyRnJhbWVEYXRhKCZjdXJbaV0pOworICAgICAgICAgICAgaWYgKGN1cltpXS5oaW50cyAmIEhXQ19ISU5UX0NMRUFSX0ZCKSB7CisgICAgICAgICAgICAgICAgaWYgKCEobGF5ZXItPm5lZWRzQmxlbmRpbmcoKSkpIHsKKyAgICAgICAgICAgICAgICAgICAgdHJhbnNwYXJlbnQub3JTZWxmKGxheWVyLT52aXNpYmxlUmVnaW9uU2NyZWVuKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgZXJyID0gaHdjLnByZXBhcmUoKTsKKyAgICAgICAgTE9HRV9JRihlcnIsICJIV0NvbXBvc2VyOjpwcmVwYXJlIGZhaWxlZCAoJXMpIiwgc3RyZXJyb3IoLWVycikpOworICAgIH0KKworICAgIC8qCisgICAgICogIGNsZWFyIHRoZSBhcmVhIG9mIHRoZSBGQiB0aGF0IG5lZWQgdG8gYmUgdHJhbnNwYXJlbnQKKyAgICAgKi8KKyAgICB0cmFuc3BhcmVudC5hbmRTZWxmKGRpcnR5KTsKKyAgICBpZiAoIXRyYW5zcGFyZW50LmlzRW1wdHkoKSkgeworICAgICAgICBnbENsZWFyQ29sb3IoMCwwLDAsMCk7CisgICAgICAgIFJlZ2lvbjo6Y29uc3RfaXRlcmF0b3IgaXQgPSB0cmFuc3BhcmVudC5iZWdpbigpOworICAgICAgICBSZWdpb246OmNvbnN0X2l0ZXJhdG9yIGNvbnN0IGVuZCA9IHRyYW5zcGFyZW50LmVuZCgpOworICAgICAgICBjb25zdCBpbnQzMl90IGhlaWdodCA9IGh3LmdldEhlaWdodCgpOworICAgICAgICB3aGlsZSAoaXQgIT0gZW5kKSB7CisgICAgICAgICAgICBjb25zdCBSZWN0JiByKCppdCsrKTsKKyAgICAgICAgICAgIGNvbnN0IEdMaW50IHN5ID0gaGVpZ2h0IC0gKHIudG9wICsgci5oZWlnaHQoKSk7CisgICAgICAgICAgICBnbFNjaXNzb3Ioci5sZWZ0LCBzeSwgci53aWR0aCgpLCByLmhlaWdodCgpKTsKKyAgICAgICAgICAgIGdsQ2xlYXIoR0xfQ09MT1JfQlVGRkVSX0JJVCk7CisgICAgICAgIH0KKyAgICB9CisKKworICAgIC8qCisgICAgICogYW5kIHRoZW4sIHJlbmRlciB0aGUgbGF5ZXJzIHRhcmdldGVkIGF0IHRoZSBmcmFtZWJ1ZmZlcgorICAgICAqLworICAgIGZvciAoc2l6ZV90IGk9MCA7IGk8Y291bnQgOyBpKyspIHsKKyAgICAgICAgaWYgKGN1cikgeworICAgICAgICAgICAgaWYgKCEoY3VyW2ldLmNvbXBvc2l0aW9uVHlwZSA9PSBIV0NfRlJBTUVCVUZGRVIpIHx8CisgICAgICAgICAgICAgICAgICAgIGN1cltpXS5mbGFncyAmIEhXQ19TS0lQX0xBWUVSKSB7CisgICAgICAgICAgICAgICAgLy8gc2tpcCBsYXllcnMgaGFuZGxlZCBieSB0aGUgSEFMCisgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICB9CisgICAgICAgIH0KICAgICAgICAgY29uc3Qgc3A8TGF5ZXJCYXNlPiYgbGF5ZXIobGF5ZXJzW2ldKTsKICAgICAgICAgY29uc3QgUmVnaW9uIGNsaXAoZGlydHkuaW50ZXJzZWN0KGxheWVyLT52aXNpYmxlUmVnaW9uU2NyZWVuKSk7CiAgICAgICAgIGlmICghY2xpcC5pc0VtcHR5KCkpIHsKQEAgLTEwNDIsNyArMTEyOSw3IEBACiAgICAgaWYgKGFuZHJvaWRfYXRvbWljX2RlYygmbVRyYW5zYWN0aW9uQ291bnQpID09IDEpIHsKICAgICAgICAgc2lnbmFsRXZlbnQoKTsKIAotICAgICAgICAvLyBpZiB0aGVyZSBpcyBhIHRyYW5zYWN0aW9uIHdpdGggYSByZXNpemUsIHdhaXQgZm9yIGl0IHRvIAorICAgICAgICAvLyBpZiB0aGVyZSBpcyBhIHRyYW5zYWN0aW9uIHdpdGggYSByZXNpemUsIHdhaXQgZm9yIGl0IHRvCiAgICAgICAgIC8vIHRha2UgZWZmZWN0IGJlZm9yZSByZXR1cm5pbmcuCiAgICAgICAgIE11dGV4OjpBdXRvbG9jayBfbChtU3RhdGVMb2NrKTsKICAgICAgICAgd2hpbGUgKG1SZXNpemVUcmFuc2F0aW9uUGVuZGluZykgewpAQCAtMTA4Niw3ICsxMTczLDcgQEAKICAgICByZXR1cm4gTk9fRVJST1I7CiB9CiAKLWludCBTdXJmYWNlRmxpbmdlcjo6c2V0T3JpZW50YXRpb24oRGlzcGxheUlEIGRweSwgCitpbnQgU3VyZmFjZUZsaW5nZXI6OnNldE9yaWVudGF0aW9uKERpc3BsYXlJRCBkcHksCiAgICAgICAgIGludCBvcmllbnRhdGlvbiwgdWludDMyX3QgZmxhZ3MpCiB7CiAgICAgaWYgKFVOTElLRUxZKHVpbnQzMl90KGRweSkgPj0gRElTUExBWV9DT1VOVCkpCkBAIC0xMTE5LDE0ICsxMjA2LDE3IEBACiAgICAgICAgICAgICAgICAgaW50KHcpLCBpbnQoaCkpOwogICAgICAgICByZXR1cm4gc3VyZmFjZUhhbmRsZTsKICAgICB9Ci0gICAgCisKICAgICAvL0xPR0QoImNyZWF0ZVN1cmZhY2UgZm9yIHBpZCAlZCAoJWQgeCAlZCkiLCBwaWQsIHcsIGgpOwogICAgIHNwPExheWVyPiBub3JtYWxMYXllcjsKICAgICBzd2l0Y2ggKGZsYWdzICYgZUZYU3VyZmFjZU1hc2spIHsKICAgICAgICAgY2FzZSBlRlhTdXJmYWNlTm9ybWFsOgorI2lmIEhBU19QVVNIX0JVRkZFUlMKICAgICAgICAgICAgIGlmIChVTkxJS0VMWShmbGFncyAmIGVQdXNoQnVmZmVycykpIHsKICAgICAgICAgICAgICAgICBsYXllciA9IGNyZWF0ZVB1c2hCdWZmZXJzU3VyZmFjZShjbGllbnQsIGQsIHcsIGgsIGZsYWdzKTsKLSAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICB9IGVsc2UKKyNlbmRpZgorICAgICAgICAgICAgewogICAgICAgICAgICAgICAgIG5vcm1hbExheWVyID0gY3JlYXRlTm9ybWFsU3VyZmFjZShjbGllbnQsIGQsIHcsIGgsIGZsYWdzLC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ICAgICAgICogSG93ZXZlciwgYSBidWdneSBjbGllbnQgY291bGQgaGF2ZSBub3QgZG9uZSB0aGF0LgogICAgICAgICAgICAgICogU2luY2Ugd2Uga25vdyB3ZSBkb24ndCBoYXZlIGFueSBtb3JlIGNsaWVudHMsIHdlIGRvbid0IG5lZWQKICAgICAgICAgICAgICAqIHRvIHVzZSB0aGUgcHVyZ2F0b3J5LgpAQCAtMTM4MCw3ICsxNDcwLDcgQEAKICAgICAgICAgfQogICAgICAgICBjb25zdCBib29sIGxvY2tlZChyZXRyeSA+PSAwKTsKICAgICAgICAgaWYgKCFsb2NrZWQpIHsKLSAgICAgICAgICAgIHNucHJpbnRmKGJ1ZmZlciwgU0laRSwgCisgICAgICAgICAgICBzbnByaW50ZihidWZmZXIsIFNJWkUsCiAgICAgICAgICAgICAgICAgICAgICJTdXJmYWNlRmxpbmdlciBhcHBlYXJzIHRvIGJlIHVucmVzcG9uc2l2ZSwgIgogICAgICAgICAgICAgICAgICAgICAiZHVtcGluZyBhbnl3YXlzIChubyBsb2NrcyBoZWxkKVxuIik7CiAgICAgICAgICAgICByZXN1bHQuYXBwZW5kKGJ1ZmZlcik7CkBAIC0xNjU1LDEyICsxNzQ1LDE1IEBACiB7CiAgICAgaW50MzJfdCBuYW1lID0gTkFNRV9OT1RfRk9VTkQ7CiAgICAgc3A8TGF5ZXI+IGxheWVyKG1GbGluZ2VyLT5nZXRMYXllcihzdXIpKTsKLSAgICBpZiAobGF5ZXIgPT0gMCkgcmV0dXJuIG5hbWU7CisgICAgaWYgKGxheWVyID09IDApIHsKKyAgICAgICAgcmV0dXJuIG5hbWU7CisgICAgfQogCiAgICAgLy8gaWYgdGhpcyBsYXllciBhbHJlYWR5IGhhcyBhIHRva2VuLCBqdXN0IHJldHVybiBpdAogICAgIG5hbWUgPSBsYXllci0+Z2V0VG9rZW4oKTsKLSAgICBpZiAoKG5hbWUgPj0gMCkgJiYgKGxheWVyLT5nZXRDbGllbnQoKSA9PSB0aGlzKSkKKyAgICBpZiAoKG5hbWUgPj0gMCkgJiYgKGxheWVyLT5nZXRDbGllbnQoKSA9PSB0aGlzKSkgewogICAgICAgICByZXR1cm4gbmFtZTsKKyAgICB9CiAKICAgICBuYW1lID0gMDsKICAgICBkbyB7CmRpZmYgLS1naXQgYS9zZXJ2aWNlcy9zdXJmYWNlZmxpbmdlci9TdXJmYWNlRmxpbmdlci5oIGIvc2VydmljZXMvc3VyZmFjZWZsaW5nZXIvU3VyZmFjZUZsaW5nZXIuaAppbmRleCA4ZWNmYzAxLi44ZTI4NmU1IDEwMDY0NAotLS0gYS9zZXJ2aWNlcy9zdXJmYWNlZmxpbmdlci9TdXJmYWNlRmxpbmdlci5oCisrKyBiL3NlcnZpY2VzL3N1cmZhY2VmbGluZ2VyL1N1cmZhY2VGbGluZ2VyLmgKQEAgLTI5Niw2ICsyOTYsNyBAQAogICAgICAgICAgICAgdm9pZCAgICAgICAgaGFuZGxlUGFnZUZsaXAoKTsKICAgICAgICAgICAgIGJvb2wgICAgICAgIGxvY2tQYWdlRmxpcChjb25zdCBMYXllclZlY3RvciYgY3VycmVudExheWVycyk7CiAgICAgICAgICAgICB2b2lkICAgICAgICB1bmxvY2tQYWdlRmxpcChjb25zdCBMYXllclZlY3RvciYgY3VycmVudExheWVycyk7CisgICAgICAgICAgICB2b2lkICAgICAgICBoYW5kbGVXb3JrTGlzdCgpOwogICAgICAgICAgICAgdm9pZCAgICAgICAgaGFuZGxlUmVwYWludCgpOwogICAgICAgICAgICAgdm9pZCAgICAgICAgcG9zdEZyYW1lYnVmZmVyKCk7CiAgICAgICAgICAgICB2b2lkICAgICAgICBjb21wb3NlU3VyZmFjZXMoY29uc3QgUmVnaW9uJiBkaXJ0eSk7CkBAIC0zNzAsNiArMzcxLDcgQEAKICAgICAgICAgICAgICAgICBSZWdpb24gICAgICAgICAgICAgICAgICAgICAgbUludmFsaWRSZWdpb247CiAgICAgICAgICAgICAgICAgUmVnaW9uICAgICAgICAgICAgICAgICAgICAgIG1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IGZvciBwZW5kaW5nIEJpbmRlciBjYWxscyBvciBldmVudCBwcm9jZXNzaW5nIHRvCisgICAgICogY29tcGxldGUuCisgICAgICovCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgbG9uZyBUSU1FT1VUX0JJTkRFUl9DQUxMID0gMTAwOworCisgICAgLyoqCisgICAgICogVGltZW91dCBpbiB3aGljaCB3ZSBhcmUgd2FpdGluZyBmb3IgdGhlIHN5c3RlbSB0byBzdGFydCB0aGUgbW9jaworICAgICAqIGFjY2Vzc2liaWxpdHkgc2VydmljZXMuCisgICAgICovCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgbG9uZyBUSU1FT1VUX1NUQVJUX01PQ0tfQUNDRVNTSUJJTElUWV9TRVJWSUNFUyA9IDMwMDsKKworICAgIC8qKgorICAgICAqIFRpbWVvdXQgdXNlZCBmb3IgdGVzdGluZyB0aGF0IGEgc2VydmljZSBpcyBub3RpZmllZCBvbmx5IHVwb24gYQorICAgICAqIG5vdGlmaWNhdGlvbiB0aW1lb3V0LgorICAgICAqLworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGxvbmcgVElNRU9VVF9URVNUX05PVElGSUNBVElPTl9USU1FT1VUID0gMzAwOworCisgICAgLyoqCisgICAgICogVGhlIHBhY2thZ2UgbmFtZS4KKyAgICAgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBTdHJpbmcgc1BhY2thZ2VOYW1lOworCisgICAgLyoqCisgICAgICogVGhlIGludGVyZmFjZSB1c2VkIHRvIHRhbGsgdG8gdGhlIHRlc3RlZCBzZXJ2aWNlLgorICAgICAqLworICAgIHByaXZhdGUgSUFjY2Vzc2liaWxpdHlNYW5hZ2VyIG1NYW5hZ2VyU2VydmljZTsKKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIHNldENvbnRleHQoQ29udGV4dCBjb250ZXh0KSB7CisgICAgICAgIHN1cGVyLnNldENvbnRleHQoY29udGV4dCk7CisgICAgICAgIGlm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ENsYXNzTmFtZSgiZm9vLmJhci5iYXouQ2xhc3MiKTsKKyAgICAgICAgc2VudEV2ZW50LnNldENvbnRlbnREZXNjcmlwdGlvbigiQ29udGVudERlc2NyaXB0aW9uIik7CisgICAgICAgIHNlbnRFdmVudC5zZXRDdXJyZW50SXRlbUluZGV4KDEpOworICAgICAgICBzZW50RXZlbnQuc2V0RW5hYmxlZCh0cnVlKTsKKyAgICAgICAgc2VudEV2ZW50LnNldEV2ZW50VHlwZShBY2Nlc3NpYmlsaXR5RXZlbnQuVFlQRV9WSUVXX0NMSUNLRUQpOworICAgICAgICBzZW50RXZlbnQuc2V0RXZlbnRUaW1lKDEwMDApOworICAgICAgICBzZW50RXZlbnQuc2V0RnJvbUluZGV4KDEpOworICAgICAgICBzZW50RXZlbnQuc2V0RnVsbFNjcmVlbih0cnVlKTsKKyAgICAgICAgc2VudEV2ZW50LnNldEl0ZW1Db3VudCgxKTsKKyAgICAgICAgc2VudEV2ZW50LnNldFBhY2thZ2VOYW1lKCJmb28uYmFyLmJheiIpOworICAgICAgICBzZW50RXZlbnQuc2V0UGFyY2VsYWJsZURhdGEoTWVzc2FnZS5vYnRhaW4obnVsbCwgMSwgbnVsbCkpOworICAgICAgICBzZW50RXZlbnQuc2V0UGFzc3dvcmQodHJ1ZSk7CisgICAgICAgIHNlbnRFdmVudC5zZXRSZW1vdmVkQ291bnQoMSk7CisgICAgfQorCisgICAgLyoqCisgICAgICogVGhpcyBjbGFzcyBpcyBhIG1vY2sge0BsaW5rIElBY2Nlc3NpYmlsaXR5TWFuYWdlckNsaWVudH0uCisgICAgICovCisgICAgcHVibGljIGNsYXNzIE15TW9ja0FjY2Vzc2liaWxpdHlNYW5hZ2VyQ2xpZW50IGV4dGVuZHMgSUFjY2Vzc2liaWxpdHlNYW5hZ2VyQ2xpZW50LlN0dWIgeworICAgICAgICBib29sZWFuIG1Jc0VuYWJsZWQ7CisKKyAgICAgICAgcHVibGljIHZvaWQgc2V0RW5hYmxlZChib29sZWF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wdGlvbiBsYXN0VmVyaWZ5RXhjZXB0aW9uID0gbnVsbDsKKyAgICAgICAgbG9uZyBiZWdpblRpbWUgPSBTeXN0ZW1DbG9jay51cHRpbWVNaWxsaXMoKTsKKyAgICAgICAgbG9uZyBwb2xsVG1lb3V0ID0gVElNRU9VVF9CSU5ERVJfQ0FMTCAvIDU7CisKKyAgICAgICAgLy8gcG9sbCB1bnRpbCB0aGUgdGltZW91dCBoYXMgZWxhcHNlZAorICAgICAgICB3aGlsZSAoU3lzdGVtQ2xvY2sudXB0aW1lTWlsbGlzKCkgLSBiZWdpblRpbWUgPCBUSU1FT1VUX0JJTkRFUl9DQUxMKSB7CisgICAgICAgICAgICAvLyBzbGVlcCBmaXJzdCBzaW5jZSBpbW1lZGlhdGUgY2FsbCB3aWxsIGFsd2F5cyBmYWlsCisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIFRocmVhZC5zbGVlcChwb2xsVG1lb3V0KTsKKyAgICAgICAgICAgIH0gY2F0Y2ggKEludGVycnVwdGVkRXhjZXB0aW9uIGllKSB7CisgICAgICAgICAgICAgICAgLyogaWdub3JlICovCisgICAgICAgICAgICB9CisgICAgICAgICAgICAvLyBwb2xsIGZvciB2ZXJpZmljYXRpb24gYW5kIGlmIHRoaXMgZmFpbHMgc2F2ZSB0aGUgZXhjZXB0aW9uIGFuZAorICAgICAgICAgICAgLy8ga2VlcCBwb2xsaW5nCisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIHNlcnZpY2UudmVyaWZ5KCk7CisgICAgICAgICAgICAgICAgLy8gcmVzZXQgc28gaXQgZG9lcyBub3QgYWNjZXB0IG1vcmUgZXZlbnRzCisgICAgICAgICAgICAgICAgc2VydmljZS5yZXNldCgpOworICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgIH0gY2F0Y2ggKEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgbGFzdFZlcmlmeUV4Y2VwdGlvbiA9IGU7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICAvLyByZXNldCwgd2UgaGF2ZSBhbHJlYWR5IGZhaWxlZAorICAgICAgICBzZXJ2aWNlLnJlc2V0KCk7CisKKyAgICAgICAgLy8gYWx3YXlzIG5vdCBudWxsCisgICAgICAgIHRocm93IGxhc3RWZXJpZnlFeGNlcHRpb247CisgICAgfQorCisgICAgLyoqCisgICAgICogVGhpcyBjbGFzcyBpcyB0aGUgZmlyc3QgbW9jayB7QGxpbmsgQWNjZXNzaWJpbGl0eVNlcnZpY2V9LgorICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgY2xhc3MgTXlGaXJzdE1vY2tBY2Nlc3NpYmlsaXR5U2VydmljZSBleHRlbmRzIE1vY2tBY2Nlc3NpYmlsaXR5U2VydmljZSB7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSBzZXJ2aWNlIHtAbGluayBDb21wb25lbnROYW1lfSBmbGF0dGVuZWQgYXMgYSBzdHJpbmcuCisgICAgICAgICAqLworICAgICAgICBzdGF0aWMgZmluYWwgU3RyaW5nIHNDb21wb25lbnROYW1lID0gbmV3IENvbXBvbmVudE5hbWUoCisgICAgICAgICAgICAgICAgc1BhY2thZ2VOYW1lLAorICAgICAgICAgICAgICAgIE15Rmlyc3RNb2NrQWNjZXNzaWJpbGl0eVNlcnZpY2UuY2xhc3MuZ2V0TmFtZSgpCisgICAgICAgICAgICAgICAgKS5mbGF0dGVuVG9TaG9ydFN0cmluZygpOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBIYW5kbGUgdG8gdGhlIHNlcnZpY2UgaW5zdGFuY2UuCisgICAgICAgICAqLworICAgICAgICBzdGF0aWMgTXlGaXJzdE1vY2tBY2Nlc3NpYmlsaXR5U2VydmljZSBzSW5zdGFuY2U7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIENyZWF0ZXMgYSBuZXcgaW5zdGFuY2UuCisgICAgICAgICAqLworICAgICAgICBwdWJsaWMgTXlGaXJzdE1vY2tBY2Nlc3NpYmlsaXR5U2VydmljZSgpIHsKKyAgICAgICAgICAgIHNJbnN0YW5jZSA9IHRoaXM7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBUaGlzIGNsYXNzIGlzIHRoZSBmaXJzdCBtb2NrIHtAbGluayBBY2Nlc3NpYmlsaXR5U2VydmljZX0uCisgICAgICovCisgICAgcHVibGljIHN0YXRpYyBjbGFzcyBNeVNlY29uZE1vY2tBY2Nlc3NpYmlsaXR5U2VydmljZSBleHRlbmRzIE1vY2tBY2Nlc3NpYmlsaXR5U2VydmljZSB7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSBzZXJ2aWNlIHtAbGluayBDb21wb25lbnROYW1lfSBmbGF0dGVuZWQgYXMgYSBzdHJpbmcuCisgICAgICAgICAqLworICAgICAgICBzdGF0aWMgZmluYWwgU3RyaW5nIHNDb21wb25lbnROYW1lID0gbmV3IENvbXBvbmVudE5hbWUoCisgICAgICAgICAgICAgICAgc1BhY2thZ2VOYW1lLAorICAgICAgICAgICAgICAgIE15U2Vjb25kTW9ja0FjY2Vzc2liaWxpdHlTZXJ2aWNlLmNsYXNzLmdldE5hbWUoKQorICAgICAgICAgICAgICAgICkuZmxhdHRlblRvU2hvcnRTdHJpbmcoKTsKKworICAgICAgICAvKioKKyAgICAgICAgICogSGFuZGxlIHRvIHRoZSBzZXJ2aWNlIGluc3RhbmNlLgorICAgICAgICAgKi8KKyAgICAgICAgc3RhdGljIE15U2Vjb25kTW9ja0FjY2Vzc2liaWxpdHlTZXJ2aWNlIHNJbnN0YW5jZTsKKworICAgICAgICAvKioKKyAgICAgICAgICogQ3JlYXRlcyBhIG5ldyBpbnN0YW5jZS4KKyAgICAgICAgICovCisgICAgICAgIHB1YmxpYyBNeVNlY29uZE1vY2tBY2Nlc3NpYmlsaXR5U2VydmljZSgpIHsKKyAgICAgICAgICAgIHNJbnN0YW5jZSA9IHRoaXM7CisgICAgICAgIH0KKy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VudHJ5RGV0ZWN0ZWQoQ291bnRyeSBjb3VudHJ5KSB0aHJvd3MgUmVtb3RlRXhjZXB0aW9uIHsKKyAgICAgICAgICAgIG1Db3VudHJ5ID0gY291bnRyeTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBDb3VudHJ5IGdldENvdW50cnkoKSB7CisgICAgICAgICAgICByZXR1cm4gbUNvdW50cnk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgYm9vbGVhbiBpc05vdGlmaWVkKCkgeworICAgICAgICAgICAgcmV0dXJuIG1Db3VudHJ5ICE9IG51bGw7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIGNsYXNzIENvdW50cnlEZXRlY3RvclNlcnZpY2VUZXN0ZXIgZXh0ZW5kcyBDb3VudHJ5RGV0ZWN0b3JTZXJ2aWNlIHsKKworICAgICAgICBwcml2YXRlIENvdW50cnlMaXN0ZW5lciBtTGlzdGVuZXI7CisKKyAgICAgICAgcHVibGljIENvdW50cnlEZXRlY3RvclNlcnZpY2VUZXN0ZXIoQ29udGV4dCBjb250ZXh0KSB7CisgICAgICAgICAgICBzdXBlcihjb250ZXh0KTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgdm9pZCBub3RpZnlSZWNlaXZlcnMoQ291bnRyeSBjb3VudHJ5KSB7CisgICAgICAgICAgICBzdXBlci5ub3RpZnlSZWNlaXZlcnMoY291bnRyeSk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHJvdGVjdGVkIHZvaWQgc2V0Q291bnRyeUxpc3RlbmVyKGZpbmFsIENvdW50cnlMaXN0ZW5lciBsaXN0ZW5lcikgeworICAgICAgICAgICAgbUxpc3RlbmVyID0gbGlzdGVuZXI7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgYm9vbGVhbiBpc0xpc3RlbmVyU2V0KCkgeworICAgICAgICAgICAgcmV0dXJuIG1MaX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bUlzU3lzdGVtQm91bmRBc0NsaWVudDsKKworICAgIC8qKgorICAgICAqIENyZWF0ZXMgYW4ge0BsaW5rIEFjY2Vzc2liaWxpdHlTZXJ2aWNlSW5mb30gcG9wdWxhdGVkIHdpdGggZGVmYXVsdAorICAgICAqIHZhbHVlcy4KKyAgICAgKgorICAgICAqIEByZXR1cm4gVGhlIGRlZmF1bHQgaW5mby4KKyAgICAgKi8KKyAgICBwdWJsaWMgc3RhdGljIEFjY2Vzc2liaWxpdHlTZXJ2aWNlSW5mbyBjcmVhdGVEZWZhdWx0SW5mbygpIHsKKyAgICAgICAgQWNjZXNzaWJpbGl0eVNlcnZpY2VJbmZvIGRlZmF1bHRJbmZvID0gbmV3IEFjY2Vzc2liaWxpdHlTZXJ2aWNlSW5mbygpOworICAgICAgICBkZWZhdWx0SW5mby5ldmVudFR5cGVzID0gQWNjZXNzaWJpbGl0eUV2ZW50LlRZUEVfVklFV19DTElDS0VEOworICAgICAgICBkZWZhdWx0SW5mby5mZWVkYmFja1R5cGUgPSBBY2Nlc3NpYmlsaXR5U2VydmljZUluZm8uRkVFREJBQ0tfQVVESUJMRTsKKyAgICAgICAgZGVmYXVsdEluZm8uZmxhZ3MgPSAwOworICAgICAgICBkZWZhdWx0SW5mby5ub3RpZmljYXRpb25UaW1lb3V0ID0gMDsKKyAgICAgICAgZGVmYXVsdEluZm8ucGFja2FnZU5hbWVzID0gbmV3IFN0cmluZ1tdIHsKKyAgICAgICAgICAgICJmb28uYmFyLmJheiIKKyAgICAgICAgfTsKKworICAgICAgICByZXR1cm4gZGVmYXVsdEluZm87CisgICAgfQorCisgICAgLyoqCisgICAgICogU3RhcnRzIHJlcGxheWluZyB0aGUgbW9jay4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCByZXBsYXkoKSB7CisgICAgICAgIG1SZXBsYXlpbmcgPSB0cnVlOworICAgIH0KKworICAgIC8qKgorICAgICAqIFZlcmlmaWVzIGlmIGFsbCBleHBlY3RlZCBzZXJ2aWNlIG1ldGhvZHMgaGF2ZSBiZWVuIGNhbGxlZC4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCB2ZXJpZnkoKSB7CisgICAgICAgIGlmICghbVJlcGxheWluZykgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiRGlkIHlvdSBmb3JnZXQgdG8gY2FsbCByZXBsYXkoKSIpOworICAgICAgICB9CisKKyAgICAgICAgaWYgKG1FeHBlY3RlZEludGVycnVwdCkgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiRXhwZWN0ZWQgY2FsbCB0byAjaW50ZXJydXB0KCkgbm90IHJlY2VpdmVkIik7CisgICAgICAgIH0KKyAgICAgICAgaWYgKCFtRXhwZWN0ZWRFdmVudHMuaXNFbXB0eSgpKSB7CisgICAgICAgICAgICB0aHJvdyBuZXcgSWxsZWdhbFN0YXRlRXhjZXB0aW9uKCJFeHBlY3RlZCBhIGNhbGwgdG8gb25BY2Nlc3NpYmlsaXR5RXZlbnQoKSBmb3IgIgorICAgICAgICAgICAgICAgICAgICArICJldmVudHMgXCIiICsgbUV4cGVjdGVkRXZlbnRzICsgIlwiIG5vdCByZWNlaXZlZCIpOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogUmVzZXRzIHRoaXMgaW5zdGFuY2Ugc28gaXQgY2FuIGJlIHJldXNlZC4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCByZXNldCgpIHsKKyAgICAgICAgbUV4cGVjdGVkRXZlbnRzLmNsZWFyKCk7CisgICAgICAgIG1FeHBlY3RlZEludGVycnVwdCA9IGZhbHNlOworICAgICAgICBtUmVwbGF5aW5nID0gZmFsc2U7CisgICAgfQorCisgICAgLyoqCisgICAgICogU2V0cyBhbiBleHBlY3RlZCBjYWxsIHRvCisgICAgICoge0BsaW5rICNvbkFjY2Vzc2liaWxpdHlFdmVudChBY2Nlc3Np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KyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCBvbkludGVycnVwdCgpIHsKKyAgICAgICAgaWYgKCFtUmVwbGF5aW5nKSB7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKworICAgICAgICBpZiAoIW1FeHBlY3RlZEludGVycnVwdCkgeworICAgICAgICAgICAgdGhyb3cgbmV3IElsbGVnYWxTdGF0ZUV4Y2VwdGlvbigiVW5leHBlY3RlZCBjYWxsIHRvIG9uSW50ZXJydXB0KCkiKTsKKyAgICAgICAgfQorCisgICAgICAgIG1FeHBlY3RlZEludGVycnVwdCA9IGZhbHNlOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHByb3RlY3RlZCB2b2lkIG9uU2VydmljZUNvbm5lY3RlZCgpIHsKKyAgICAgICAgbUlzU3lzdGVtQm91bmRBc0NsaWVudCA9IHRydWU7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIGJvb2xlYW4gb25VbmJpbmQoSW50ZW50IGludGVudCkgeworICAgICAgICBtSXNTeXN0ZW1Cb3VuZEFzQ2xpZW50ID0gZmFsc2U7CisgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZXR1cm5zIGlmIHRoZSBzeXN0ZW0gaXMgYm91bmQgYXMgY2xpZW50IHRvIHRoaXMgc2VydmljZS4KKyAgICAgKgorICAgICAqIEByZXR1cm4gVHJ1ZSBpZiB0aGUgc3lzdGVtIGlzIGJvdW5kLCBmYWxzZSBvdGhlcndpc2UuCisgICAgICovCisgICAgcHVibGljIGJvb2xlYW4gaXNTeXN0ZW1Cb3VuZEFzQ2xpZW50KCkgeworICAgICAgICByZXR1cm4gbUlzU3lzdGVtQm91bmRBc0NsaWVudDsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBDb21wYXJlcyBhbGwgcHJvcGVydGllcyBvZiB0aGUgPGNvZGU+ZXhwZWN0ZWRFdmVudDwvY29kZT4gYW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VkOworICAgICAgICBwcml2YXRlIGJvb2xlYW4gbUxvY2F0aW9uQmFzZWREZXRlY3RvclN0b3BwZWQ7CisgICAgICAgIHByb3RlY3RlZCBib29sZWFuIG1Ob3RpZmllZDsKKyAgICAgICAgcHJpdmF0ZSBib29sZWFuIGxpc3RlbmVyQWRkZWQgPSBmYWxzZTsKKworICAgICAgICBwcml2YXRlIENvdW50cnkgbU5vdGlmaWVkQ291bnRyeTsKKyAgICAgICAgcHVibGljIFRlc3RDb3VudHJ5RGV0ZWN0b3IoKSB7CisgICAgICAgICAgICBzdXBlcihnZXRDb250ZXh0KCkpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgbm90aWZ5TG9jYXRpb25CYXNlZExpc3RlbmVyKENvdW50cnkgY291bnRyeSkgeworICAgICAgICAgICAgbU5vdGlmaWVkID0gdHJ1ZTsKKyAgICAgICAgICAgIG1Ob3RpZmllZENvdW50cnkgPSBjb3VudHJ5OworICAgICAgICAgICAgbUxvY2F0aW9uQmFzZWRDb3VudHJ5RGV0ZWN0b3Iubm90aWZ5TGlzdGVuZXIoY291bnRyeSk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgYm9vbGVhbiBsb2NhdGlvbkJhc2VkRGV0ZWN0b3JTdGFydGVkKCkgeworICAgICAgICAgICAgcmV0dXJuIG1Mb2NhdGlvbkJhc2VkQ291bnRyeURldGVjdG9yICE9IG51bGwgJiYgbUxvY2F0aW9uQmFzZWREZXRlY3RvclN0YXJ0ZWQ7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgYm9vbGVhbiBsb2NhdGlvbkJhc2VkRGV0ZWN0b3JTdG9wcGVkKCkgeworICAgICAgICAgICAgcmV0dXJuIG1Mb2NhdGlvbkJhc2VkQ291bnRyeURldGVjdG9yID09IG51bGwgJiYgbUxvY2F0aW9uQmFzZWREZXRlY3RvclN0b3BwZWQ7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgYm9vbGVhbiBsb2NhdGlvblJlZnJlc2hTdGFydGVkKCkgeworICAgICAgICAgICAgcmV0dXJuIG1Mb2NhdGlvblJlZnJlc2hUaW1lciAhPSBudWxsOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGJvb2xlYW4gbG9jYXRpb25SZWZyZXNoQ2FuY2VsbGVkKCkgeworICAgICAgICAgICAgcmV0dXJuIG1Mb2NhdGlvblJlZnJlc2hUaW1lciA9PSBudWxsOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHByb3RlY3RlZCBDb3VudHJ5RGV0ZWN0b3JCYXNlIGNyZWF0ZUxvY2F0aW9uQmFzZWRDb3VudHJ5RGV0ZWN0b3IoKSB7CisgICAgICAgICAgICByZXR1cm4gbmV3IENvdW50cnlEZXRlY3RvckJhc2UobUNvbnRleHQpIHsKKyAgICAgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgICAgICBwdWJsaWMgQ291bnRyeSBkZXRlY3RDb3VudHJ5KCkgeworICAgICAgICAgICAgICAgICAgICBtTG9jYXRpb25CYXNlZERldGVjdG9yU3RhcnRlZCA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIHN0b3AoKSB7CisgICAgICAgICAgICAgICAgICAgIG1Mb2NhdGlvbkJhc2VkRGV0ZWN0b3JTdG9wcGVkID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9OworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHByb3RlY3RlZCBDb3VudHJ5IGdldE5ldHdvcmtCYXNlZENvdW50cnkoKSB7CisgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwcm90ZWN0ZWQgQ291bnRyeSBnZXRMYXN0S25vd25Mb2NhdGlvbkJhc2VkQ291bnRyeSgpIHsKKyAgICAgICAgICAgIHJldHVybiBtTm90aWZpZWRDb3VudHJ5OworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHByb3RlY3RlZCBDb3VudHJ5IGdldFNpbUJhc2VkQ291bnRyeSgpIHsKKyAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHByb3RlY3RlZCBDb3VudHJ5IGdldExvY2FsZUNvdW50cnkoKSB7CisgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwcm90ZWN0ZWQgdm9pZCBydW5BZnRlckRldGVjdGlvbkFzeW5jKGZpbmFsIENvdW50cnkgY291bnRyeSwgZmluYWwgQ291bnRyeSBkZXRlY3RlZENvdW50cnksCisgICAgICAgICAgICAgICAgZmluYWwgYm9vbGVhbiBub3RpZnlDaGFuZ2UsIGZpbmFsIGJvb2xlYW4gc3RhcnRMb2NhdGlvbkJhc2VkRGV0ZWN0aW9uKSB7CisgICAgICAgICAgICBydW5BZnRlckRldGVjdGlvbihjb3VudHJ5LCBkZXRlY3RlZENvdW50cnksIG5vdGlmeUNoYW5nZSwgc3RhcnRMb2NhdGlvbkJhc2VkRGV0ZWN0aW9uKTsKKyAgICAgICAgfTsKKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHJvdGVjdGVkIGJvb2xlYW4gaXNBaXJwbGFuZU1vZGVPZmYoKSB7CisgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwcm90ZWN0ZWQgc3luY2hyb25pemVkIHZvaWQgYWRkUGhvbmVTdGF0ZUxpc3RlbmVyKCkgeworICAgICAgICAgICAgbGlzdGVuZXJBZGRlZCA9IHRydWU7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHJvdGVjdGVkIHN5bmNocm9uaXplZCB2b2lkIHJlbW92ZVBob25lU3RhdGVMaXN0ZW5lcigpIHsKKyAgICAgICAgICAgIGxpc3RlbmVyQWRkZWQgPSBmYWxzZTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwcm90ZWN0ZWQgYm9vbGVhbiBpc0dlb0NvZGVySW1wbGVtZW50ZWQoKSB7CisgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBib29sZWFuIGlzUGhvbmVTdGF0ZUxpc3RlbmVyQWRkZWQoKSB7CisgICAgICAgICAgICByZXR1cm4gbGlzdGVuZXJBZGRlZDsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgY2xhc3MgQ291bnRyeUxpc3RlbmVySW1wbCBpbXBsZW1lbnRzIENvdW50cnlMaXN0ZW5lciB7CisgICAgICAgIHByaXZhdGUgYm9vbGVhbiBtTm90aWZpZWQ7CisgICAgICAgIHByaXZhdGUgQ291bnRyeSBtQ291bnRyeTsKKworICAgICAgICBwdWJsaWMgdm9pZCBvbkNvdW50cnlEZXRlY3RlZChDb3VudHJ5IGNvdW50cnkpIHsKKyAgICAgICAgICAgIG1Ob3RpZmllZCA9IHRydWU7CisgICAgICAgICAgICBtQ291bnRyeSA9IGNvdW50cnk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgYm9vbGVhbiBub3RpZmllZCgpIHsKKyAgICAgICAgICAgIHJldHVybiBtTm90aWZpZWQ7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgQ291bnRyeSBnZXRDb3VudHJ5KCkgeworICAgICAgICAgICAgcmV0dXJuIG1Db3VudHJ5OworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdGVzdERldGVjdE5ldHdvcmtCYXNlZENvdW50cnkoKSB7CisgICAgICAgIGZpbmF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Db3VudHJ5KCkgeworICAgICAgICBmaW5hbCBDb3VudHJ5IHJlc3VsdENvdW50cnkgPSBuZXcgQ291bnRyeSgKKyAgICAgICAgICAgICAgICBUZXN0Q291bnRyeURldGVjdG9yLkNPVU5UUllfSVNPLCBDb3VudHJ5LkNPVU5UUllfU09VUkNFX1NJTSk7CisgICAgICAgIGZpbmFsIENvdW50cnkgbG9jYXRpb25CYXNlZENvdW50cnkgPSBuZXcgQ291bnRyeSgKKyAgICAgICAgICAgICAgICBUZXN0Q291bnRyeURldGVjdG9yLkNPVU5UUllfSVNPLCBDb3VudHJ5LkNPVU5UUllfU09VUkNFX0xPQ0FUSU9OKTsKKyAgICAgICAgVGVzdENvdW50cnlEZXRlY3RvciBjb3VudHJ5RGV0ZWN0b3IgPSBuZXcgVGVzdENvdW50cnlEZXRlY3RvcigpIHsKKyAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgcHJvdGVjdGVkIENvdW50cnkgZ2V0U2ltQmFzZWRDb3VudHJ5KCkgeworICAgICAgICAgICAgICAgIHJldHVybiByZXN1bHRDb3VudHJ5OworICAgICAgICAgICAgfQorICAgICAgICB9OworICAgICAgICBDb3VudHJ5TGlzdGVuZXJJbXBsIGxpc3RlbmVyID0gbmV3IENvdW50cnlMaXN0ZW5lckltcGwoKTsKKyAgICAgICAgY291bnRyeURldGVjdG9yLnNldENvdW50cnlMaXN0ZW5lcihsaXN0ZW5lcik7CisgICAgICAgIENvdW50cnkgY291bnRyeSA9IGNvdW50cnlEZXRlY3Rvci5kZXRlY3RDb3VudHJ5KCk7CisgICAgICAgIGFzc2VydFRydWUoc2FtZUNvdW50cnkoY291bnRyeSwgcmVzdWx0Q291bnRyeSkpOworICAgICAgICBhc3NlcnRUcnVlKGNvdW50cnlEZXRlY3Rvci5sb2NhdGlvbkJhc2VkRGV0ZWN0b3JTdGFydGVkKCkpOworICAgICAgICBjb3VudHJ5RGV0ZWN0b3Iubm90aWZ5TG9jYXRpb25CYXNlZExpc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dGVjdGVkIENvdW50cnkgZ2V0U2ltQmFzZWRDb3VudHJ5KCkgeworICAgICAgICAgICAgICAgIHJldHVybiByZXN1bHRDb3VudHJ5OworICAgICAgICAgICAgfQorICAgICAgICB9OworICAgICAgICBDb3VudHJ5TGlzdGVuZXJJbXBsIGxpc3RlbmVyID0gbmV3IENvdW50cnlMaXN0ZW5lckltcGwoKTsKKyAgICAgICAgY291bnRyeURldGVjdG9yLnNldENvdW50cnlMaXN0ZW5lcihsaXN0ZW5lcik7CisgICAgICAgIENvdW50cnkgY291bnRyeSA9IGNvdW50cnlEZXRlY3Rvci5kZXRlY3RDb3VudHJ5KCk7CisgICAgICAgIGFzc2VydFRydWUoc2FtZUNvdW50cnkoY291bnRyeSwgcmVzdWx0Q291bnRyeSkpOworICAgICAgICBhc3NlcnRUcnVlKGNvdW50cnlEZXRlY3Rvci5sb2NhdGlvbkJhc2VkRGV0ZWN0b3JTdGFydGVkKCkpOworICAgICAgICBjb3VudHJ5RGV0ZWN0b3Iuc3RvcCgpOworICAgICAgICAvLyBUaGUgTG9jYXRpb25CYXNlZERldGVjdG9yIHNob3VsZCBiZSBzdG9wcGVkLgorICAgICAgICBhc3NlcnRUcnVlKGNvdW50cnlEZXRlY3Rvci5sb2NhdGlvbkJhc2VkRGV0ZWN0b3JTdG9wcGVkKCkpOworICAgICAgICAvLyBUaGUgbG9jYXRpb24gcmVmcmVzaCBzaG91bGQgbm90IHJ1bm5pbmcuCisgICAgICAgIGFzc2VydFRydWUoY291bnRyeURldGVjdG9yLmxvY2F0aW9uUmVmcmVzaENhbmNlbGxlZCgpKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB0ZXN0TG9jYXRpb25CYXNlZENvdW50cnlOb3RGb3VuZCgpIHsKKyAgICAgICAgZmluYWwgQ291bnRyeSByZXN1bHRDb3VudHJ5ID0gbmV3IENvdW50cnkoCisgICAgICAgICAgICAgICAgVGVzdENvdW50cnlEZXRlY3Rvci5DT1VOVFJZX0lTTywgQ291bnRyeS5DT1VOVFJZX1NPVVJDRV9TSU0pOworICAgICAgICBUZXN0Q291bnRyeURldGVjdG9yIGNvdW50cnlEZXRlY3RvciA9IG5ldyBUZXN0Q291bnRyeURldGVjdG9yKCkgeworICAgICAgICAgICAgQE92ZXJyaWRlCisgICAgICAgICAgICBwcm90ZWN0ZWQgQ291bnRyeSBnZXRTaW1CYXNlZENvdW50cnkoKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIHJlc3VsdENvdW50cnk7CisgICAgICAgICAgICB9CisgICAgICAgIH07CisgICAgICAgIENvdW50cnlMaXN0ZW5lckltcGwgbGlzdGVuZXIgPSBuZXcgQ291bnRyeUxpc3RlbmVySW1wbCgpOworICAgICAgICBjb3VudHJ5RGV0ZWN0b3Iuc2V0Q291bnRyeUxpc3RlbmVyKGxpc3RlbmVyKTsKKyAgICAgICAgQ291bnRyeSBjb3VudHJ5ID0gY291bnRyeURldGVjdG9yLmRldGVjdENvdW50cnkoKTsKKyAgICAgICAgYXNzZXJ0VHJ1ZShzYW1lQ291bnRyeShjb3VudHJ5LCByZXN1bHRDb3VudHJ5KSk7CisgICAgICAgIGFzc2VydFRydWUoY291bnRyeURldGVjdG9yLmxvY2F0aW9uQmFzZWREZXRlY3RvclN0YXJ0ZWQoKSk7CisgICAgICAgIGNvdW50cnlEZXRlY3Rvci5ub3RpZnlMb2NhdGlvbkJhc2VkTGlzdGVuZXIobnVsbCk7CisgICAgICAgIGFzc2VydEZhbHNlKGxpc3RlbmVyLm5vdGlmaWVkKCkpOworICAgICAgICBhc3NlcnRUcnVlKHNhbWVDb3VudHJ5KGxpc3RlbmVyLmdldENvdW50cnkoKSwgbnVsbCkpOworICAgICAgICBhc3NlcnRUcnVlKGNvdW50cnlEZXRlY3Rvci5sb2NhdGlvbkJhc2VkRGV0ZWN0b3JTdG9wcGVkKCkpOworICAgICAgICBhc3NlcnRUcnVlKGNvdW50cnlEZXRlY3Rvci5sb2NhdGlvblJlZnJlc2hTdGFydGVk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2F0aW9uOworICAgICAgICBwcml2YXRlIGZpbmFsIFN0cmluZyBtQ291bnRyeTsKKyAgICAgICAgcHJpdmF0ZSBmaW5hbCBsb25nIG1RdWVyeUxvY2F0aW9uVGltZW91dDsKKyAgICAgICAgcHJpdmF0ZSBMaXN0PExvY2F0aW9uTGlzdGVuZXI+IG1MaXN0ZW5lcnM7CisKKyAgICAgICAgcHVibGljIFRlc3RDb3VudHJ5RGV0ZWN0b3IoU3RyaW5nIGNvdW50cnksIFN0cmluZyBwcm92aWRlcikgeworICAgICAgICAgICAgdGhpcyhjb3VudHJ5LCBwcm92aWRlciwgMTAwMCAqIDYwICogNSk7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgVGVzdENvdW50cnlEZXRlY3RvcihTdHJpbmcgY291bnRyeSwgU3RyaW5nIHByb3ZpZGVyLCBsb25nIHF1ZXJ5TG9jYXRpb25UaW1lb3V0KSB7CisgICAgICAgICAgICBzdXBlcihnZXRDb250ZXh0KCkpOworICAgICAgICAgICAgbUNvdW50cnkgPSBjb3VudHJ5OworICAgICAgICAgICAgbUxvY2F0aW9uID0gbmV3IExvY2F0aW9uKHByb3ZpZGVyKTsKKyAgICAgICAgICAgIG1RdWVyeUxvY2F0aW9uVGltZW91dCA9IHF1ZXJ5TG9jYXRpb25UaW1lb3V0OworICAgICAgICAgICAgbUxpc3RlbmVycyA9IG5ldyBBcnJheUxpc3Q8TG9jYXRpb25MaXN0ZW5lcj4oKTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwcm90ZWN0ZWQgU3RyaW5nIGdldENvdW50cnlGcm9tTG9jYXRpb24oTG9jYXRpb24gbG9jYXRpb24pIHsKKyAgICAgICAgICAgIHN5bmNocm9uaXplZCAoY291bnRyeUZvdW5kTG9ja2VyKSB7CisgICAgICAgICAgICAgICAgaWYgKCFub3RpZnlDb3VudHJ5KSB7CisgICAgICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgICAgICBjb3VudHJ5Rm91bmRMb2NrZXIud2FpdCgpOworICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChJbnRlcnJ1cHRlZEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAobUxvY2F0aW9uLmdldFByb3ZpZGVyKCkuZW5kc1dpdGgobG9jYXRpb24uZ2V0UHJvdmlkZXIoKSkpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gbUNvdW50cnk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHByb3RlY3RlZCBMb2NhdGlvbiBnZXRMYXN0S25vd25Mb2NhdGlvbigpIHsKKyAgICAgICAgICAgIHJldHVybiBtTG9jYXRpb247CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHJvdGVjdGVkIHZvaWQgcmVnaXN0ZXJFbmFibGVkUHJvdmlkZXJzKExpc3Q8TG9jYXRpb25MaXN0ZW5lcj4gbGlzdGVuZXJzKSB7CisgICAgICAgICAgICBtTGlzdGVuZXJzLmFkZEFsbChsaXN0ZW5lcnMpOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHByb3RlY3RlZCB2b2lkIHVucmVnaXN0ZXJQcm92aWRlcnMoTGlzdDxMb2NhdGlvbkxpc3RlbmVyPiBsaXN0ZW5lcnMpIHsKKyAgICAgICAgICAgIGZvciAoTG9jYXRpb25MaXN0ZW5lciBsaXN0ZW5lciA6IG1Mb2NhdGlvbkxpc3RlbmVycykgeworICAgICAgICAgICAgICAgIGFzc2VydFRydWUobUxpc3RlbmVycy5yZW1vdmUobGlzdGVuZXIpKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwcm90ZWN0ZWQgbG9uZyBnZXRRdWVyeUxvY2F0aW9uVGltZW91dCgpIHsKKyAgICAgICAgICAgIHJldHVybiBtUXVlcnlMb2NhdGlvblRpbWVvdXQ7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHJvdGVjdGVkIGludCBnZXRUb3RhbEVuYWJsZWRQcm92aWRlcnMoKSB7CisgICAgICAgICAgICByZXR1cm4gVE9UQUxfUFJPVklERVJTOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgbm90aWZ5TG9jYXRpb25Gb3VuZCgpIHsKKyAgICAgICAgICAgIC8vIExpc3RlbmVyIGNvdWxkIGJlIHJlbW92ZWQgaW4gdGhlIG5vdGlmaWNhdGlvbi4KKyAgICAgICAgICAgIExvY2F0aW9uTGlzdGVuZXJbXSBsaXN0ZW5lcnMgPSBuZXcgTG9jYXRpb25MaXN0ZW5lclttTGlzdGVuZXJzLnNpemUoKV07CisgICAgICAgICAgICBtTG9jYXRpb25MaXN0ZW5lcnMudG9BcnJheShsaXN0ZW5lcnMpOworICAgICAgICAgICAgZm9yIChMb2NhdGlvbkxpc3RlbmVyIGxpc3RlbmVyIDpsaXN0ZW5lcnMpIHsKKyAgICAgICAgICAgICAgICBsaXN0ZW5lci5vbkxvY2F0aW9uQ2hhbmdlZChtTG9jYXRpb24pOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGludCBnZXRMaXN0ZW5lcnNDb3VudCgpIHsKKyAgICAgICAgICAgIHJldHVybiBtTGlzdGVuZXJzLnNpemUoKTsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyB2b2lkIG5vdGlmeUNvdW50cnlGb3VuZCgpIHsKKyAgICAgICAgICAgIHN5bmNocm9uaXplZCAoY291bnRyeUZvdW5kTG9ja2VyKSB7CisgICAgICAgICAgICAgICAgbm90aWZ5Q291bnRyeSA9IHRydWU7CisgICAgICAgICAgICAgICAgY291bnRyeUZvdW5kTG9ja2VyLm5vdGlmeSgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcHVibGljIFRpbWVyIGdldFRpbWVyKCkgeworICAgICAgICAgICAgcmV0dXJuIG1UaW1lcjsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBUaHJlYWQgZ2V0UXVlcnlUaHJlYWQoKSB7CisgICAgICAgICAgICByZXR1cm4gbVF1ZXJ5VGhyZWFkOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSBjbGFzcyBDb3VudHJ5TGlzdGVuZXJJbXBsIGltcGxlbWVudHMgQ291bnRyeUxpc3RlbmVyIHsKKyAgICAgICAgcHJpdmF0ZSBib29sZWFuIG1Ob3RpZmllZDsKKyAgICAgICAgcHJpdmF0ZSBTdHJpbmcgbUNvdW50cnlDb2RlOworICAgICAgICBwdWJsaWMgdm9pZCBvbkNvdW50cnlEZXRlY3RlZChDb3VudHJ5IGNvdW50cnkpIHsKKyAgICAgICAgICAgIG1Ob3RpZmllZCA9IHRydWU7CisgICAgICAgICAgICBpZiAoY291bnRyeSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgbUNvdW50cnlDb2RlID0gY291bnRyeS5nZXRDb3VudHJ5SXNvKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgYm9vbGVhbiBub3RpZmllZCgpIHsKKyAgICAgICAgICAgIHJldHVybiBtTm90aWZpZWQ7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgU3RyaW5nIGdldENvdW50cnkoKSB7CisgICAgICAgICAgICByZXR1cm4gbUNvdW50cnlDb2RlOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdGVzdEZpbmRpbmdDb3VudHJ5KCkgeworICAgICAgICBmaW5hbCBTdHJpbmcgY291bnRyeSA9ICJ1cyI7CisgICAgICAgIGZpbmFsIFN0cmluZyBwcm92aWR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aXN0ZW5lcik7CisgICAgICAgIGRldGVjdG9yLmRldGVjdENvdW50cnkoKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKGRldGVjdG9yLmdldExpc3RlbmVyc0NvdW50KCksIFRlc3RDb3VudHJ5RGV0ZWN0b3IuVE9UQUxfUFJPVklERVJTKTsKKyAgICAgICAgZGV0ZWN0b3Iuc3RvcCgpOworICAgICAgICAvLyBBbGwgbGlzdGVuZXJzIHNob3VsZCBiZSB1bnJlZ2lzdGVyZWQKKyAgICAgICAgYXNzZXJ0RXF1YWxzKGRldGVjdG9yLmdldExpc3RlbmVyc0NvdW50KCksIDApOworICAgICAgICAvLyBUaGUgdGltZSBzaG91bGQgYmUgc3RvcHBlZAorICAgICAgICBhc3NlcnROdWxsKGRldGVjdG9yLmdldFRpbWVyKCkpOworICAgICAgICAvLyBRdWVyeVRocmVhZCBzaG91bGQgc3RpbGwgYmUgTlVMTAorICAgICAgICBhc3NlcnROdWxsKGRldGVjdG9yLmdldFF1ZXJ5VGhyZWFkKCkpOworICAgICAgICBhc3NlcnRGYWxzZShjb3VudHJ5TGlzdGVuZXIubm90aWZpZWQoKSk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdGVzdEZpbmRpbmdMb2NhdGlvbkZhaWxlZCgpIHsKKyAgICAgICAgZmluYWwgU3RyaW5nIGNvdW50cnkgPSAidXMiOworICAgICAgICBmaW5hbCBTdHJpbmcgcHJvdmlkZXIgPSAiR29vZCI7CisgICAgICAgIGxvbmcgdGltZW91dCA9IDEwMDA7CisgICAgICAgIFRlc3RDb3VudHJ5RGV0ZWN0b3IgZGV0ZWN0b3IgPSBuZXcgVGVzdENvdW50cnlEZXRlY3Rvcihjb3VudHJ5LCBwcm92aWRlciwgdGltZW91dCkgeworICAgICAgICAgICAgQE92ZXJyaWRlCisgICAgICAgICAgICBwcm90ZWN0ZWQgTG9jYXRpb24gZ2V0TGFzdEtub3duTG9jYXRpb24oKSB7CisgICAgICAgICAgICAgICAgcmV0d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IpIHsKKyAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgcHJvdGVjdGVkIFN0cmluZyBnZXRDb3VudHJ5RnJvbUxvY2F0aW9uKExvY2F0aW9uIGxvY2F0aW9uKSB7CisgICAgICAgICAgICAgICAgc3luY2hyb25pemVkIChjb3VudHJ5Rm91bmRMb2NrZXIpIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKCEgbm90aWZ5Q291bnRyeSkgeworICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb3VudHJ5Rm91bmRMb2NrZXIud2FpdCgpOworICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoSW50ZXJydXB0ZWRFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIC8vIFdlIGRpZG4ndCBmaW5kIGNvdW50cnkuCisgICAgICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgICAgICB9CisgICAgICAgIH07CisgICAgICAgIENvdW50cnlMaXN0ZW5lckltcGwgY291bnRyeUxpc3RlbmVyID0gbmV3IENvdW50cnlMaXN0ZW5lckltcGwoKTsKKyAgICAgICAgZGV0ZWN0b3Iuc2V0Q291bnRyeUxpc3RlbmVyKGNvdW50cnlMaXN0ZW5lcik7CisgICAgICAgIGRldGVjdG9yLmRldGVjdENvdW50cnkoKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKGRldGVjdG9yLmdldExpc3RlbmVyc0NvdW50KCksIFRlc3RDb3VudHJ5RGV0ZWN0b3IuVE9UQUxfUFJPVklERVJTKTsKKyAgICAgICAgZGV0ZWN0b3Iubm90aWZ5TG9jYXRpb25Gb3VuZCgpOworICAgICAgICAvLyBBbGwgbGlzdGVuZXJzIHNob3VsZCBiZSB1bnJlZ2lzdGVyZWQKKyAgICAgICAgYXNzZXJ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dEZvclRpbWVyUmVzZXQoVGVzdENvdW50cnlEZXRlY3RvciBkZXRlY3RvcikgeworICAgICAgICBpbnQgY291bnQgPSA1OworICAgICAgICBsb25nIGludGVydmFsID0gMTAwMDsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIHdoaWxlIChjb3VudC0tID4gMCAmJiBkZXRlY3Rvci5nZXRUaW1lcigpICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBUaHJlYWQuc2xlZXAoaW50ZXJ2YWwpOworICAgICAgICAgICAgfQorICAgICAgICB9IGNhdGNoIChJbnRlcnJ1cHRlZEV4Y2VwdGlvbiBlKSB7CisgICAgICAgIH0KKyAgICAgICAgVGltZXIgdGltZXIgPSBkZXRlY3Rvci5nZXRUaW1lcigpOworICAgICAgICBhc3NlcnRUcnVlKHRpbWVyID09IG51bGwpOworICAgIH0KKworICAgIHByaXZhdGUgdm9pZCB3YWl0Rm9yVGhyZWFkRW5kaW5nKFRocmVhZCB0aHJlYWQpIHsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIHRocmVhZC5qb2luKDUwMDApOworICAgICAgICB9IGNhdGNoIChJbnRlcnJ1cHRlZEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICBlLnByaW50U3RhY2tUcmFjZSgpOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSBUaHJlYWQgd2FpdEZvclF1ZXJ5VGhyZWFkTGF1bmNoZWQoVGVzdENvdW50cnlEZXRlY3RvciBkZXRlY3RvcikgeworICAgICAgICBpbnQgY291bnQgPSA1OworICAgICAgICBsb25nIGludGVydmFsID0gMTAwMDsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIHdoaWxlIChjb3VudC0tID4gMCAmJiBkZXRlY3Rvci5nZXRRdWVyeVRocmVhZCgpID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICBUaHJlYWQuc2xlZXAoaW50ZXJ2YWwpOworICAgICAgICAgICAgfQorICAgICAgICB9IGNh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IHRvIGFmdGVyVGV4dENoYW5nZWQgY2F1c2VkIGJ5IHRoZSB3b3JrIGRvbmUgYmVsb3cKLSAgICAgICAgaWYgKCFtRm9ybWF0dGluZykgewotICAgICAgICAgICAgbUZvcm1hdHRpbmcgPSB0cnVlOwotCi0gICAgICAgICAgICAvLyBJZiBkZWxldGluZyB0aGUgaHlwaGVuLCBhbHNvIGRlbGV0ZSB0aGUgY2hhciBiZWZvcmUgb3IgYWZ0ZXIgdGhhdAotICAgICAgICAgICAgaWYgKG1EZWxldGluZ0h5cGhlbiAmJiBtSHlwaGVuU3RhcnQgPiAwKSB7Ci0gICAgICAgICAgICAgICAgaWYgKG1EZWxldGluZ0JhY2t3YXJkKSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChtSHlwaGVuU3RhcnQgLSAxIDwgdGV4dC5sZW5ndGgoKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgdGV4dC5kZWxldGUobUh5cGhlblN0YXJ0IC0gMSwgbUh5cGhlblN0YXJ0KTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobUh5cGhlblN0YXJ0IDwgdGV4dC5sZW5ndGgoKSkgewotICAgICAgICAgICAgICAgICAgICB0ZXh0LmRlbGV0ZShtSHlwaGVuU3RhcnQsIG1IeXBoZW5TdGFydCArIDEpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgUGhvbmVOdW1iZXJVdGlscy5mb3JtYXROdW1iZXIodGV4dCwgc0Zvcm1hdFR5cGUpOwotCi0gICAgICAgICAgICBtRm9ybWF0dGluZyA9IGZhbHNlOwotICAgICAgICB9CisgICAgLyoqCisgICAgICogVGhlIGZvcm1hdHRpbmcgaXMgYmFzZWQgb24gdGhlIGdpdmVuIDxjb2RlPmNvdW50cnlDb2RlPC9jb2RlPi4KKyAgICAgKgorICAgICAqIEBwYXJhbSBjb3VudHJ5Q29kZSB0aGUgSVNPIDMxN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Y291bnQgPT0gMSAvLyBEZWxldGluZyBvbmx5IG9uZSBjaGFyYWN0ZXIKLSAgICAgICAgICAgICAgICAgICAgJiYgYWZ0ZXIgPT0gMCAvLyBEZWxldGluZwotICAgICAgICAgICAgICAgICAgICAmJiBzLmNoYXJBdChzdGFydCkgPT0gJy0nIC8vIGEgaHlwaGVuCi0gICAgICAgICAgICAgICAgICAgICYmIHNlbFN0YXJ0ID09IHNlbEVuZCkgeyAvLyBubyBzZWxlY3Rpb24KLSAgICAgICAgICAgICAgICBtRGVsZXRpbmdIeXBoZW4gPSB0cnVlOwotICAgICAgICAgICAgICAgIG1IeXBoZW5TdGFydCA9IHN0YXJ0OwotICAgICAgICAgICAgICAgIC8vIENoZWNrIGlmIHRoZSB1c2VyIGlzIGRlbGV0aW5nIGZvcndhcmQgb3IgYmFja3dhcmQKLSAgICAgICAgICAgICAgICBpZiAoc2VsU3RhcnQgPT0gc3RhcnQgKyAxKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1EZWxldGluZ0JhY2t3YXJkID0gdHJ1ZTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBtRGVsZXRpbmdCYWNrd2FyZCA9IGZhbHNlOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgbURlbGV0aW5nSHlwaGVuID0gZmFsc2U7Ci0gICAgICAgICAgICB9CisgICAgcHVibGljIHZvaWQgYmVmb3JlVGV4dENoYW5nZWQoQ2hhclNlcXVlbmNlIHMsIGludCBzdGFydCwgaW50IGNvdW50LAorICAgICAgICAgICAgaW50IGFmdGVyKSB7CisgICAgICAgIGlmIChtU2VsZkNoYW5nZSB8fCBtU3RvcEZvcm1hdHRpbmcpIHsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorICAgICAgICBpZiAoY291bnQgPT0gMCAmJiBzLmxlbmd0aCgpID09IHN0YXJ0KSB7CisgICAgICAgICA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mxlIGNoYXJzIGFuZCBzdGljayB0aGUgY3Vyc29yIHRvIHRoZQorICAgICAqIG5lYXJlc3QgZGlhbGFibGUgY2hhciB0byB0aGUgbGVmdC4gRm9yIGluc3RhbmNlLCBpZiB0aGUgbnVtYmVyIGlzICAoNjUwKSAxMjMtNDU2NzggYW5kICc0JyBpcworICAgICAqIHJlbW92ZWQgdGhlbiB0aGUgY3Vyc29yIHNob3VsZCBiZSBiZWhpbmQgJzMnIGluc3RlYWQgb2YgJy0nLgorICAgICAqLworICAgIHByaXZhdGUgU3RyaW5nIHJlZm9ybWF0KENoYXJTZXF1ZW5jZSBzLCBpbnQgY3Vyc29yKSB7CisgICAgICAgIC8vIFRoZSBpbmRleCBvZiBjaGFyIHRvIHRoZSBsZWZ0d2FyZCBvZiB0aGUgY3Vyc29yLgorICAgICAgICBpbnQgY3VySW5kZXggPSBjdXJzb3IgLSAxOworICAgICAgICBTdHJpbmcgZm9ybWF0dGVkID0gbnVsbDsKKyAgICAgICAgbUZvcm1hdHRlci5jbGVhcigpOworICAgICAgICBjaGFyIGxhc3ROb25TZXBhcmF0b3IgPSAwOworICAgICAgICBib29sZWFuIGhhc0N1cnNvciA9IGZhbHNlOworICAgICAgICBpbnQgbGVuID0gcy5sZW5ndGgoKTsKKyAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBsZW47IGkrKykgeworICAgICAgICAgICAgY2hhciBjID0gcy5jaGFyQXQoaSk7CisgICAgICAgICAgICBpZiAoUGhvbmVOdW1iZXJVdGlscy5pc05vblNlcGFyYXRvcihjKSkgeworICAgICAgICAgICAgICAgIGlmIChsYXN0Tm9uU2VwYXJhdG9yICE9IDApIHsKKyAgICAgICAgICAgICAgICAgICAgZm9ybWF0dGVkID0gZ2V0Rm9ybWF0dGVkTnVtYmVyKGxhc3ROb25TZXBhcmF0b3IsIGhhc0N1cnNvcik7CisgICAgICAgICAgICAgICAgICAgIGhhc0N1cnNvciA9IGZhbHNlOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBsYXN0Tm9uU2VwYXJhdG9yID0gYzsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChpID09IGN1ckluZGV4KSB7CisgICAgICAgICAgICAgICAgaGFzQ3Vyc29yID0gdHJ1ZTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBpZiAobGFzdE5vblNlcGFyYXRvciAhPSAwKSB7CisgICAgICAgICAgICBmb3JtYXR0ZWQgPSBnZXRGb3JtYXR0ZWROdW1iZXIobGFzdE5vblNlcGFyYXRvciwgaGFzQ3Vyc29yKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gZm9ybWF0dGVkOworICAgIH0KKworICAgIHByaXZhdGUgU3RyaW5nIGdldEZvcm1hdHRlZE51bWJlcihjaGFyIGxhc3ROb25TZXBhcmF0b3IsIGJvb2xlYW4gaGFzQ3Vyc29yKSB7CisgICAgICAgIHJldHVybiBoYXNDdXJzb3IgPyBtRm9ybWF0dGVyLmlucHV0RGlnaXRBbmRSZW1lbWJlclBvc2l0aW9uKGxhc3ROb25TZXBhcmF0b3IpCisgICAgICAgICAgICAgICAgOiBtRm9ybWF0dGVyLmlucHV0RGlnaXQobGFzdE5vblNlcGFyYXRvcik7CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIHN0b3BGb3JtYXR0aW5nKCkgeworICAgICAgICBtU3RvcEZvcm1hdHRpbmcgPSB0cnVlOworICAgICAgICBtRm9ybWF0dGVyLmNsZWFyKCk7CisgICAgfQorCisgICAgcHJpdmF0ZSBib29sZWFuIGhhc1NlcGFyYXRvcihmaW5hbCBDaGFyU2VxdWVuY2UgcywgZmluYWwgaW50IHN0YXJ0LCBmaW5hbCBpbnQgY291bnQpIHsKKyAgICAgICAgZm9yIChpbnQgaSA9IHN0YXJ0OyBpIDwgc3RhcnQgKyBjb3VudDsgaSsrKSB7CisgICAgICAgICAgICBjaGFyIGMgPSBzLmNoYXJBdChpKTsKKyAgICAgICAgICA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dGUKKyAgICAgKiB0aGUgRS4xNjQgcGhvbmUgbnVtYmVyIGlmIHRoZSBnaXZlbiBudW1iZXIgZG9lc24ndCBoYXZlIGEgY291bnRyeSBjb2RlLgorICAgICAqCisgICAgICogQHBhcmFtIHBob25lTnVtYmVyCisgICAgICogICAgICAgICAgICB0aGUgcGhvbmUgbnVtYmVyIHRvIGZvcm1hdAorICAgICAqIEBwYXJhbSBkZWZhdWx0Q291bnRyeUlzbworICAgICAqICAgICAgICAgICAgdGhlIElTTyAzMTY2LTEgdHdvIGxldHRlcnMgY291bnRyeSBjb2RlCisgICAgICogQHJldHVybiB0aGUgRS4xNjQgcmVwcmVzZW50YXRpb24sIG9yIG51bGwgaWYgdGhlIGdpdmVuIHBob25lIG51bWJlciBpcworICAgICAqICAgICAgICAgbm90IHZhbGlkLgorICAgICAqCisgICAgICogQGhpZGUKKyAgICAgKi8KKyAgICBwdWJsaWMgc3RhdGljIFN0cmluZyBmb3JtYXROdW1iZXJUb0UxNjQoU3RyaW5nIHBob25lTnVtYmVyLCBTdHJpbmcgZGVmYXVsdENvdW50cnlJc28pIHsKKyAgICAgICAgUGhvbmVOdW1iZXJVdGlsIHV0aWwgPSBQaG9uZU51bWJlclV0aWwuZ2V0SW5zdGFuY2UoKTsKKyAgICAgICAgU3RyaW5nIHJlc3VsdCA9IG51bGw7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBQaG9uZU51bWJlciBwbiA9IHV0aWwucGFyc2UocGhvbmVOdW1iZXIsIGRlZmF1bHRDb3VudHJ5SXNvKTsKKyAgICAgICAgICAgIGlmICh1dGlsLmlzVmFsaWROdW1iZXIocG4pKSB7CisgICAgICAgICAgICAgICAgcmVzdWx0ID0gdXRpbC5mb3JtYXQocG4sIFBob25lTnVtYmVyRm9ybWF0LkUxNjQpOworICAgICAgICAgICAgfQorICAgICAgICB9IGNhdGNoIChOdW1iZXJQYXJzZUV4Y2VwdGlvbiBlKSB7CisgICAgICAgIH0KKyAgICAgICAgcmV0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G9uZU51bWJlciwgZGVmYXVsdENvdW50cnlJc28pOworICAgICAgICAgICAgcmVzdWx0ID0gdXRpbC5mb3JtYXRJbk9yaWdpbmFsRm9ybWF0KHBuLCBkZWZhdWx0Q291bnRyeUlzbyk7CisgICAgICAgIH0gY2F0Y2ggKE51bWJlclBhcnNlRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gcmVzdWx0OworICAgIH0KKworICAgIC8qKgorICAgICAqIEZvcm1hdCB0aGUgcGhvbmUgbnVtYmVyIG9ubHkgaWYgdGhlIGdpdmVuIG51bWJlciBoYXNuJ3QgYmVlbiBmb3JtYXR0ZWQuCisgICAgICogPHA+CisgICAgICogVGhlIG51bWJlciB3aGljaCBoYXMgb25seSBkYWlsYWJsZSBjaGFyYWN0ZXIgaXMgdHJlYXRlZCBhcyBub3QgYmVpbmcKKyAgICAgKiBmb3JtYXR0ZWQuCisgICAgICoKKyAgICAgKiBAcGFyYW0gcGhvbmVOdW1iZXIKKyAgICAgKiAgICAgICAgICAgIHRoZSBudW1iZXIgdG8gYmUgZm9ybWF0dGVkLgorICAgICAqIEBwYXJhbSBwaG9uZU51bWJlckUxNjQKKyAgICAgKiAgICAgICAgICAgIHRoZSBFMTY0IGZvcm1hdCBudW1iZXIgd2hvc2UgY291bnRyeSBjb2RlIGlzIHVzZWQgaWYgdGhlIGdpdmVuCisgICAgICogICAgICAgICAgICBwaG9uZU51bWJlciBkb2Vzbid0IGhhdmUgdGhlIGNvdW50cnkgY29kZS4KKyAgICAgKiBAcGFyYW0gZGVmYXVsdENvdW50cnlJc28KKyAgICAgKiAgICAgICAgICAgIHRoZSBJU08gMzE2Ni0xIHR3byBsZXR0ZXJzIGNvdW50cnkgY29kZSB3aG9zZSBjb252ZW50aW9uIHdpbGwKKyAgICAgKiAgICAgICAgICAgIGJlIHVzZWQgaWYgdGhlIHBob25lTnVtYmVyRTE2NCBpcyBudWxsIG9yIGludmFsaWQuCisgICAgICogQHJldHVybiB0aGUgZm9ybWF0dGVkIG51bWJlciBpZiB0aGUgZ2l2ZW4gbnVtYmVyIGhhcyBiZWVuIGZvcm1hdHRlZCwKKyAgICAgKiAgICAgICAgICAgIG90aGVyd2lzZSwgcmV0dXJuIHRoZSBnaXZlbiBudW1iZXIuCisgICAgICoKKyAgICAgKiBAaGlkZQorICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgU3RyaW5nIGZvcm1hdE51bWJlcigKKyAgICAgICAgICAgIFN0cmluZyBwaG9uZU51bWJlciwgU3RyaW5nIHBob25lTnVtYmVyRTE2NCwgU3RyaW5nIGRlZmF1bHRDb3VudHJ5SXNvKSB7CisgICAgICAgIGludCBsZW4gPSBwaG9uZU51bWJlci5sZW5ndGgoKTsKKyAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBsZW47IGkrKykgeworICAgICAgICAgICAgaWYgKCFpc0RpYWxhYmxlKHBob25lTnVtYmVyLmNoYXJBdChpKSkpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gcGhvbmVOdW1iZXI7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgUGhvbmVOdW1iZXJVdGlsIHV0aWwgPSBQaG9uZU51bWJlclV0aWwuZ2V0SW5zdGFuY2UoKTsKKyAgICAgICAgLy8gR2V0IHRoZSBjb3VudHJ5IGNvZGUgZnJvbSBwaG9uZU51bWJlckUxNjQKKyAgICAgICAgaWYgKHBob25lTnVtYmVyRTE2NCAhPSBudWxsICYmIHBob25lTnVtYmVyRTE2NC5sZW5ndGgoKSA+PSAyCisgICAgICAgICAgICAgICAgJiYgcGhvbmVOdW1iZXJFMTY0LmNoYXJBdCgwKSA9PSAnKycpIHsKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgUGhvbmVOdW1iZXIgcG4gPSB1dGlsLnBhcnNlKHBob25lTnVtYmVyRTE2NCwgZGVmYXVsdENvdW50cnlJc28pOworICAgICAgICAgICAgICAgIFN0cmluZyByZWdpb25Db2RlID0gdXRpbC5nZXRSZWdpb25Db2RlRm9yTnVtYmVyKHBuKTsKKyAgICAgICAgICAgICAgICBpZiAoIVRleHRVdGlscy5pc0VtcHR5KHJlZ2lvbkNvZGUpKSB7CisgICAgICAgICAgICAgICAgICAgIGRlZmF1bHRDb3VudHJ5SXNvID0gcmVnaW9uQ29kZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGNhdGNoIChOdW1iZXJQYXJzZUV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgU3RyaW5nIHJlc3VsdCA9IGZvcm1hdE51bWJlcihwaG9uZU51bWJlciwgZGVmYXVsdENvdW50cnlJc28pOworICAgICAgICByZXR1cm4gcmVzdWx0ICE9IG51bGwgPyByZXN1bHQgOiBwaG9uZU51bWJlcjsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBOb3JtYWxpemUgYSBwaG9uZSBudW1iZXIgYnkgcmVtb3ZpbmcgdGhlIGNoYXJhY3RlcnMgb3RoZXIgdGhhbiBkaWdpdHMuIElmCisgICAgICogdGhlIGdpdmVuIG51bWJlciBoYXMga2V5cGFkIGxldHRlcnMsIHRoZSBsZXR0ZXJzIHdpbGwgYmUgY29udmVydGVkIHRvCisgICAgICogZGlnaXRzIGZpcnN0LgorICAgICAqCisgICAgICogQHBhcmFtIHBob25lTnVtYmVyCisgICAgICogICAgICAgICAgICB0aGUgbnVtYmVyIHRvIGJlIG5vcm1hbGl6ZWQuCisgICAgICogQHJldHVybiB0aGUgbm9ybWFsaXplZCBudW1iZXIuCisgICAgICoKKyAgICAgKiBAaGlkZQorICAgICAqLworICAgIHB1YmxpYyBzdGF0aWMgU3RyaW5nIG5vcm1hbGl6ZU51bWJlcihTdHJpbmcgcGhvbmVOdW1iZXIpIHsKKyAgICAgICAgU3RyaW5nQnVpbGRlciBzYiA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7CisgICAgICAgIGludCBsZW4gPSBwaG9uZ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ICAgbUxpbmtQcm9wZXJ0aWVzID0gbmV3IExpbmtQcm9wZXJ0aWVzKCk7CiAgICAgfQogCiAgICAgLyoqCkBAIC00MTYsMzUgKzQxMyw2OCBAQAogLy8gICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IHJlc3BvbnNlLmxlbmd0aDsgaSsrKSB7CiAvLyAgICAgICAgICAgICAgICBsb2coIiAgcmVzcG9uc2VbIiArIGkgKyAiXT0nIiArIHJlc3BvbnNlW2ldICsgIiciKTsKIC8vICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvLyBTdGFydCB3aXRoIGNsZWFuIG5ldHdvcmsgcHJvcGVydGllcyBhbmQgaWYgd2UgaGF2ZQorICAgICAgICAgICAgLy8gYSBmYWlsdXJlIHdlJ2xsIGNsZWFyIGFnYWluIGF0IHRoZSBib3R0b20gb2YgdGhpcyBjb2RlLgorICAgICAgICAgICAgTGlua1Byb3BlcnRpZXMgbGlua1Byb3BlcnRpZXMgPSBuZXcgTGlua1Byb3BlcnRpZXMoKTsKICAgICAgICAgICAgIGlmIChyZXNwb25zZS5sZW5ndGggPj0gMikgewogICAgICAgICAgICAgICAgIGNpZCA9IEludGVnZXIucGFyc2VJbnQocmVzcG9uc2VbMF0pOwotICAgICAgICAgICAgICAgIGludGVyZmFjZU5hbWUgPSByZXNwb25zZVsxXTsKLSAgICAgICAgICAgICAgICBpZiAocmVzcG9uc2UubGVuZ3RoID4gMikgewotICAgICAgICAgICAgICAgICAgICBpcEFkZHJlc3MgPSByZXNwb25zZVsyXTsKLSAgICAgICAgICAgICAgICAgICAgU3RyaW5nIHByZWZpeCA9ICJuZXQuIiArIGludGVyZmFjZU5hbWUgKyAiLiI7Ci0gICAgICAgICAgICAgICAgICAgIGdhdGV3YXlBZGRyZXNzID0gU3lzdGVtUHJvcGVydGllcy5nZXQocHJlZml4ICsgImd3Iik7Ci0gICAgICAgICAgICAgICAgICAgIGRuc1NlcnZlcnNbMF0gPSBTeXN0ZW1Qcm9wZXJ0aWVzLmdldChwcmVmaXggKyAiZG5zMSIpOwotICAgICAgICAgICAgICAgICAgICBkbnNTZXJ2ZXJzWzFdID0gU3lzdGVtUHJvcGVydGllcy5nZXQocHJlZml4ICsgImRuczIiKTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgICAgICAgICAgbG9nKCJpbnRlcmZhY2U9IiArIGludGVyZmFjZU5hbWUgKyAiIGlwQWRkcmVzcz0iICsgaXBBZGRyZXNzCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiIGdhdGV3YXk9IiArIGdhdGV3YXlBZGRyZXNzICsgIiBETlMxPSIgKyBkbnNTZXJ2ZXJzWzBdCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgKyAiIEROUzI9IiArIGRuc1NlcnZlcnNbMV0pOwotICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgU3RyaW5nIGludGVyZmFjZU5hbWUgPSByZXNwb25zZVsxXTsKKyAgICAgICAgICAgICAgICByZXN1bHQgPSBTZXR1cFJlc3VsdC5TVUNDRVNTOwogCi0gICAgICAgICAgICAgICAgICAgIGlmIChpc0Ruc09rKGRuc1NlcnZlcnMpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICByZXN1bHQgPSBTZXR1cFJlc3VsdC5TVUNDRVNTOwotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0ID0gU2V0dXBSZXN1bHQuRVJSX0JhZERuczsKKyAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICBTdHJpbmcgcHJlZml4ID0gIm5ldC4iICsgaW50ZXJmYWNlTmFtZSArICIuIjsKKworICAgICAgICAgICAgICAgICAgICBsaW5rUHJvcGVydGllcy5zZXRJbnRlcmZhY2UoTmV0d29ya0ludGVyZmFjZS5nZXRCeU5hbWUoaW50ZXJmYWNlTmFtZSkpOworCisgICAgICAgICAgICAgICAgICAgIC8vIFRPRE86IEdldCBnYXRld2F5IGFuZCBkbnMgdmlhIFJJTCBpbnRlcmZhY2Ugbm90IHByb3BlcnR5PworICAgICAgICAgICAgICAgICAgICBTdHJpbmcgZ2F0ZXdheUFkZHJlc3MgPSBTeXN0ZW1Qcm9wZXJ0aWVzLmdldChwcmVmaXggKyAiZ3ciKTsKKyAgICAgICAgICAgICAgICAgICAgbGlua1Byb3BlcnRpZXMuc2V0R2F0ZXdheShJbmV0QWRkcmVzcy5nZXRCeU5hbWUoZ2F0ZXdheUFkZHJlc3MpKTsKKworICAgICAgICAgICAgICAgICAgICBpZiAocmVzcG9uc2UubGVuZ3RoID4gMikgeworICAgICAgICAgICAgICAgICAgICAgICAgU3RyaW5nIGlwQWRkcmVzcyA9IHJlc3BvbnNlWzJdOworICAgICAgICAgICAgICAgICAgICAgICAgbGlua1Byb3BlcnRpZXMuYWRkQWRkcmVzcyhJbmV0QWRkcmVzcy5nZXRCeU5hbWUoaXBBZGRyZXNzKSk7CisKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIFRPRE86IEdldCBnYXRld2F5IGFuZCBkbnMgdmlhIFJJTCBpbnRlcmZhY2Ugbm90IHByb3BlcnR5PworICAgICAgICAgICAgICAgICAgICAgICAgU3RyaW5nIGRuc1NlcnZlcnNbXSA9IG5ldyBTdHJpbmdbMl07CisgICAgICAgICAgICAgICAgICAgICAgICBkbnNTZXJ2ZXJzWzBdID0gU3lzdGVtUHJvcGVydGllcy5nZXQocHJlZml4ICsgImRuczEiKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGRuc1NlcnZlcnNbMV0gPSBTeXN0ZW1Qcm9wZXJ0aWVzLmdldChwcmVmaXggKyAiZG5zMiIpOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlzRG5zT2soZG5zU2VydmVycykpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rUHJvcGVydGllcy5hZGREbnMoSW5ldEFkZHJlc3MuZ2V0QnlOYW1lKGRuc1NlcnZlcnNbMF0pKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaW5rUHJvcGVydGllcy5hZGREbnMoSW5ldEFkZHJlc3MuZ2V0QnlOYW1lKGRuc1NlcnZlcnNbMV0pKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzdWx0ID0gU2V0dXBSZXN1bHQuRVJSX0JhZERuczsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIHJlc3VsdCA9IFNldHVwUmVzdWx0LlNVQ0NFU1M7CisgICAgICAgICAgICAgICAgfSBjYXRjaCAoVW5rbm93bkhvc3RFeGNlcHRpb24gZTEpIHsKKyAgICAgICAgICAgICAgICAgICAgbG9nKCJvblNldHVwQ29tcGxldGVkOiBVbmtub3dIb3N0RXhjZXB0aW9uICIgKyBlMSk7CisgICAgICAgICAgICAgICAgICAgIGUxLnByaW50U3RhY2tUcmFjZSgpOworICAgICAgICAgICAgICAgICAgICByZXN1bHQgPSBTZXR1cFJlc3VsdC5FUlJfT3RoZXI7CisgICAgICAgICAgICAgICAgfSBjYXRjaCAoU29ja2V0RXhjZXB0aW9uIGUyKSB7CisgICAgICAgICAgICAgICAgICAgIGxvZygib25TZXR1cENvbXBsZXRlZDogU29ja2V0RXhjZXB0aW9uICIgKyBlMik7CisgICAgICAgICAgICAgICAgICAgIGUyLnByaW50U3RhY2tUcmFjZSgpOworICAgICAgICAgICAgICAgICAgICByZXN1bHQgPSBTZXR1cFJlc3VsdC5FUlJfT3RoZXI7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBsb2coIm9uU2V0dXBDb21wbGV0ZWQ6IGVycm9yOyBleHBlY3RlZCBudW1iZXIgb2YgcmVzcG9uc2VzID49IDIgd2FzICIgKworICAgICAgICAgICAgICAgICAgICAgICAgcmVzcG9uc2UubGVuZ3RoKTsKICAgICAgICAgICAgICAgICByZXN1bHQgPSBTZXR1cFJlc3VsdC5FUlJfT3RoZXI7CiAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIC8vIEFuIGVycm9yIG9jY3VycmVkIHNvIGNsZWFyIHByb3BlcnRpZXMKKyAgICAgICAgICAgIGlmIChyZXN1bHQgIT0gU2V0dXBSZXN1bHQuU1VDQ0VTUykgeworICAgICAgICAgICAgICAgIGxvZygib25TZXR1cENvbXBsZXRlZCB3aXRoIGFuIGVycm9yIGNsZWFyaW5nIExpbmtQcm9wZXJ0aWVzIik7CisgICAgICAgICAgICAgICAgbGlua1Byb3BlcnRpZXMuY2xlYXIoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1MaW5rUHJvcGVydGllcyA9IGxpbmtQcm9wZXJ0aWVzOwogICAgICAgICB9CiAKLSAgICAgICAgaWYgKERCRykgbG9nKCJEYXRhQ29ubmVjdGlvbiBzZXR1cCByZXN1bHQ9JyIgKyByZXN1bHQgKyAiJyBvbiBjaWQ9IiArIGNpZCk7CisgICAgICAgIGlmIChEQkcpIHsKKyAgICAgICAgICAgIGxvZygiRGF0YUNvbm5lY3Rpb24gc2V0dXAgcmVzdWx0PSciICsgcmVzdWx0ICsgIicgb24gY2lkPSIgKyBjaWQpOworICAgICAgICAgICAgaWYgKHJlc3VsdCA9PSBTZXR1cFJlc3VsdC5TVUNDRVNTKSB7CisgICAgICAgICAgICAgICAgbG9nKCJMaW5rUHJvcGVydGllczogIiArIG1MaW5rUHJvcGVydGllcy50b1N0cmluZygpKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQogICAgICAgICByZXR1cm4gcmVzdWx0OwogICAgIH0KIApAQCAtNjA2LDcgKzYzNiwxNiBAQAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBFUlJfQmFkRG5zOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIENvbm5lY3Rpb24gc3VjY2VlZGVkIGJ1dCBETlMgaW5mbyBpcyBiYWQgc28gZGlzY29ubmVjdAotICAgICAgICAgICAgICAgICAgICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoRXZlbnRMb2dUYWdzLlBEUF9CQURfRE5TX0FERFJFU1MsIGRuc1NlcnZlcnNbMF0pOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIFN0cmluZ0J1aWxkZXIgZG5zQWRkcmVzc2VzU2IgPSBuZXcgU3RyaW5nQnVpbGRlcigpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoSW5ldEFkZHJlc3MgYWRkciA6IG1MaW5rUHJvcGVydGllcy5nZXREbnNlcygpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkbnNBZGRyZXNzZXNTYi5sZW5ndGgoKSAhPSAwKSBkbnNBZGRyZXNzZXNTYi5hcHBlbmQoIiAiKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG5zQWRkcmVzc2VzU2IuYXBwZW5kKGFkZHIudG9TdHJpbmcoKSk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkbnNBZGRyZXNzZXNTYi5sZW5ndGgoKSA9PSAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRuc0FkZHJlc3Nlc1NiLmFwcGVuZCgibm8tZG5zLWFkZHJlc3NlcyIpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBFdmVudExvZy53cml0ZUV2ZW50KEV2ZW50TG9nVGFncy5QRFBfQkFEX0ROU19BRERSRVNTLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZG5zQWRkcmVzc2VzU2IudG9TdHJpbmcoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGVhckRvd25EYXRhKGNwKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0cmFuc2l0aW9uVG8obURpc2Nvbm5lY3RpbmdCYWREbnNTdGF0ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CkBAIC04NzMsMzEgKzkxMiwxMCBAQAogICAgIH0KIAogICAgIC8qKgotICAgICAqIEByZXR1cm4gdGhlIGludGVyZmFjZSBuYW1lIGFzIGEgc3RyaW5nLgorICAgICAqIEByZXR1cm4gdGhlIGNvbm5lY3Rpb25zIExpbmtQcm9wZXJ0aWVzCiAgICAgICovCi0gICAgcHVibGljIFN0cmluZyBnZXRJbnRlcmZhY2UoKSB7Ci0gICAgICAgIHJldHVybiBpbnRlcmZhY2VOYW1lOwotICAgIH0KLQotICAgIC8qKgotICAgICAqIEByZXR1cm4gdGhlIGlwIGFkZHJlc3MgYXMgYSBzdHJpbmcuCi0gICAgICovCi0gICAgcHVibGljIFN0cmluZyBnZXRJcEFkZHJlc3MoKSB7Ci0gICAgICAgIHJldHVybiBpcEFkZHJlc3M7Ci0gICAgfQotCi0gICAgLyoqCi0gICAgICogQHJldHVybiB0aGUgZ2F0ZXdheSBhZGRyZXNzIGFzIGEgc3RyaW5nLgotICAgICAqLwotICAgIHB1YmxpYyBTdHJpbmcgZ2V0R2F0ZXdheUFkZHJlc3MoKSB7Ci0gICAgICAgIHJldHVybiBnYXRld2F5QWRkcmVzczsKLSAgICB9Ci0KLSAgICAvKioKLSAgICAgKiBAcmV0dXJuIGFuIGFycmF5IG9mIGFzc29jaWF0ZWQgRE5TIGFkZHJlc3Nlcy4KLSAgICAgKi8KLSAgICBwdWJsaWMgU3RyaW5nW10gZ2V0RG5zU2VydmVycygpIHsKLSAgICAgICAgcmV0dXJuIGRuc1NlcnZlcnM7CisgICAgcHVibGljIExpbmtQcm9wZXJ0aWVzIGdldExpbmtQcm9wZXJ0aWV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gY2F0Y2ggdXAgd2l0aCB0aGUgY3VycmVudCBjb25kaXRpb24KKyAgICBwcml2YXRlIHZvaWQgbm90aWZ5QXBuSWRVcFRvQ3VycmVudChTdHJpbmcgcmVhc29uLCBpbnQgYXBuSWQpIHsKKyAgICAgICAgc3dpdGNoIChzdGF0ZSkgeworICAgICAgICAgICAgY2FzZSBJRExFOgorICAgICAgICAgICAgY2FzZSBJTklUSU5HOgorICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBDT05ORUNUSU5HOgorICAgICAgICAgICAgY2FzZSBTQ0FOTklORzoKKyAgICAgICAgICAgICAgICBwaG9uZS5ub3RpZnlEYXRhQ29ubmVjdGlvbihyZWFzb24sIGFwbklkVG9UeXBlKGFwbklkKSwgUGhvbmUuRGF0YVN0YXRlLkNPTk5FQ1RJTkcpOworICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgY2FzZSBDT05ORUNURUQ6CisgICAgICAgICAgICBjYXNlIERJU0NPTk5FQ1RJTkc6CisgICAgICAgICAgICAgICAgcGhvbmUubm90aWZ5RGF0YUNvbm5lY3Rpb24ocmVhc29uLCBhcG5JZFRvVHlwZShhcG5JZCksIFBob25lLkRhdGFTdGF0ZS5DT05ORUNUSU5HKTsKKyAgICAgICAgICAgICAgICBwaG9uZS5ub3RpZnlEYXRhQ29ubmVjdGlvbihyZWFzb24sIGFwbklkVG9UeXBlKGFwbklkKSwgUGhvbmUuRGF0YVN0YXRlLkNPTk5FQ1RFRCk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvLyBzaW5jZSB3ZSBub3JtYWxseSBkb24ndCBzZW5kIGluZm8gdG8gYSBkaXNjb25uZWN0ZWQgQVBOLCB3ZSBuZWVkIHRvIGRvIHRoaXMgc3BlY2lhbGx5CisgICAgcHJpdmF0ZSB2b2lkIG5vdGlmeUFwbklkRGlzY29ubmVjdGVkKFN0cmluZyByZWFzb24sIGludC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AgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIHNldEVuYWJsZWQoaWQsIHRydWUpOwogICAgICAgICB9CiAgICAgICAgIHJldHVybiBQaG9uZS5BUE5fUkVRVUVTVF9TVEFSVEVEOwogICAgIH0KQEAgLTQ3OCw3ICs1NjIsNyBAQAogICAgICAgICBpZiAoaWQgPT0gQVBOX0lOVkFMSURfSUQpIHsKICAgICAgICAgICAgIHJldHVybiBQaG9uZS5BUE5fUkVRVUVTVF9GQUlMRUQ7CiAgICAgICAgIH0KLSAgICAgICAgaWYgKGlzRW5hYmxlZChpZCkpIHsKKyAgICAgICAgaWYgKGlzQXBuSWRFbmFibGVkKGlkKSkgewogICAgICAgICAgICAgc2V0RW5hYmxlZChpZCwgZmFsc2UpOwogICAgICAgICAgICAgaWYgKGlzQXBuVHlwZUFjdGl2ZShQaG9uZS5BUE5fVFlQRV9ERUZBVUxUKSkgewogICAgICAgICAgICAgICAgIGlmIChkYXRhRW5hYmxlZFtBUE5fREVGQVVMVF9JRF0pIHsKQEAgLTQ5NSw5ICs1NzksMTAgQEAKICAgICB9CiAKICAgICBwcml2YXRlIHZvaWQgc2V0RW5hYmxlZChpbnQgaWQsIGJvb2xlYW4gZW5hYmxlKSB7Ci0gICAgICAgIGlmIChEQkcpIExvZy5kKExPR19UQUcsICJzZXRFbmFibGVkKCIgKyBpZCArICIsICIgKyBlbmFibGUgKyAiKSB3aXRoIG9sZCBzdGF0ZSA9ICIgKwotICAgICAgICAgICAgICAgIGRhdGFFbmFibGVkW2lkXSArICIgYW5kIGVuYWJsZWRDb3VudCA9ICIgKyBlbmFibGVkQ291bnQpOwotCisgICAgICAgIGlmIChEQkcpIHsKKyAgICAgICAgICAgIExvZy5kKExPR19UQUcsICJzZXRFbmFibGVkKCIgKyBpZCArICIsICIgKyBlbmFibGUgKyAiKSB3aXRoIG9sZCBzdGF0ZSA9ICIKKyAgICAgICAgICAgICAgICAgICAgKyBkYXRhRW5hYmxlZFtpZF0gKyAiIGFuZCBlbmFibGVkQ291bnQgPSAiICsgZW5hYmxlZENvdW50KTsKKyAgICAgICAgfQogICAgICAgICBNZXNzYWdlIG1zZyA9IG9idGFpbk1lc3NhZ2UoRVZFTlRfRU5BQkxFX05FV19BUE4pOwogICAgICAgICBtc2cuYXJnMSA9IGlkOwogICAgICAgICBtc2cuYXJnMiA9IChlbmFibGUgPyBFTkFCTEVEIDogRElTQUJMRUQpOwpAQCAtNTA3LDkgKzU5Miw4IEBACiAgICAgcHJvdGVjdGVkIHN5bmNocm9uaXplZCB2b2lkIG9uRW5hYmxlQXBuKGludCBhcG5JZCwgaW50IGVuYWJsZWQpIHsKICAgICAgICAgaWYgKERCRykgewogICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIkVWRU5UX0FQTl9FTkFCTEVfUkVRVUVTVCAiICsgYXBuSWQgKyAiLCAiICsgZW5hYmxlZCk7Ci0gICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiIGRhdGFFbmFibGVkID0gIiArIGRhdGFFbmFibGVkW2FwbklkXSArCi0gICAgICAgICAgICAgICAgICAgICIsIGVuYWJsZWRDb3VudCA9ICIgKyBlbmFibGVkQ291bnQgKwotICAgICAgICAgICAgICAgICAgICAiLCBpc0FwblR5cGVBY3RpdmUgPSAiICsgaXNBcG5UeXBlQWN0aXZlKGFwbklkVG9UeXBlKGFwbklkKSkpOworICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIiBkYXRhRW5hYmxlZCA9ICIgKyBkYXRhRW5hYmxlZFthcG5JZF0gKyAiLCBlbmFibGVkQ291bnQgPSAiCisgICAgICAgICAgICAgICAgICAgICsgZW5hYmxlZENvdW50ICsgIiwgaXNBcG5UeXBlQWN0aXZlID0gIiArIGlzQXBuVHlwZUFjdGl2ZShhcG5JZFRvVHlwZShhcG5JZCkpKTsKICAgICAgICAgfQogICAgICAgICBpZiAoZW5hYmxlZCA9PSBFTkFCTEVEKSB7CiAgICAgICAgICAgICBpZiAoIWRhdGFFbmFibGVkW2FwbklkXSkgewpAQCAtNTIwLDYgKzYwNCw4IEBACiAgICAgICAgICAgICBpZiAoIWlzQXBuVHlwZUFjdGl2ZSh0eXBlKSkgewogICAgICAgICAgICAgICAgIG1SZXF1ZXN0ZWRBcG5UeXBlID0gdHlwZTsKICAgICAgICAgICAgICAgICBvbkVuYWJsZU5ld0FwbigpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBub3RpZnlBcG5JZFVwVG9DdXJyZW50KFBob25lLlJFQVNPTl9BUE5fU1dJVENIRUQsIGFwbklkKTsKICAgICAgICAgICAgIH0KICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgIC8vIGRpc2FibGUKQEAgLTUyOCw4ICs2MTQsMTcgQEAKICAgICAgICAgICAgICAgICBlbmFibGVkQ291bnQtLTsKICAgICAgICAgICAgICAgICBpZiAoZW5hYmxlZENvdW50ID09IDApIHsKICAgICAgICAgICAgICAgICAgICAgb25DbGVhblVwQ29ubmVjdGlvbih0cnVlLCBQaG9uZS5SRUFTT05fREFUQV9ESVNBQkxFRCk7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChkYXRhRW5hYmxlZFtBUE5fREVGQVVMVF9JRF0gPT0gdHJ1ZSAmJgotICAgICAgICAgICAgICAgICAgICAgICAgIWlzQXBuVHlwZUFjdGl2ZShQaG9uZS5BUE5fVFlQRV9ERUZBVUxUKSkgeworICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgIC8vIHNlbmQgdGhlIGRpc2Nvbm5lY3QgbXNnIG1hbnVhbGx5LCBzaW5jZSB0aGUgbm9ybWFsIHJvdXRlIHdvbnQgc2VuZAorICAgICAgICAgICAgICAgIC8vIGl0IChpdCdzIG5vdCBlbmFibGVkKQorICAgICAgICAgICAgICAgIG5vdGlmeUFwbklkRGlzY29ubmVjdGVkKFBob25lLlJFQVNPTl9EQVRBX0RJU0FCTEVELCBhcG5JZCk7CisgICAgICAgICAgICAgICAgaWYgKGRhdGFFbmFibGVkW0FQTl9ERUZBVUxUX0lEXSA9PSB0cnVlCisgICAgICAgICAgICAgICAgICAgICAgICAmJiAhaXNBcG5UeXBlQWN0aXZlKFBob25lLkFQTl9UWVBFX0RFRkFVTFQpKSB7CisgICAgICAgICAgICAgICAgICAgIC8vIFRPRE8gLSB0aGlzIGlzIGFuIHVnbHkgd2F5IHRvIHJlc3RvcmUgdGhlIGRlZmF1bHQgY29ubiAtIHNob3VsZCBiZSBkb25lCisgICAgICAgICAgICAgICAgICAgIC8vIGJ5IGEgcmVhbCBjb250ZW50aW9uIG1hbmFnZXIgYW5kIHBvbGljeSB0aGF0IGRpc2Nvbm5lY3RzIHRoZSBsb3dlciBwcmkKKyAgICAgICAgICAgICAgICAgICAgLy8gc3R1ZmYgYXMgZW5hYmxlIHJlcXVlc3RzIGNvbWUgaW4gYW5kIHBvcHMgdGhlbSBiYWNrIG9uIGFzIHdlIGRpc2FibGUgYmFjaworICAgICAgICAgICAgICAgICAgICAvLyBkb3duIHRvIHRoZSBsb3dlciBwcmkgc3R1ZmYKICAgICAgICAgICAgICAgICAgICAgbVJlcXVlc3RlZEFwblR5cGUgPSBQaG9uZS5BUE5fVFlQRV9ERUZBVUxUOwogICAgICAgICAgICAgICAgICAgICBvbkVuYWJsZU5ld0FwbigpOwogICAgICAgICAgICAgICAgIH0KQEAgLTU3NCw5ICs2NjksMTEgQEAKICAgICAgICAgICAgICAgICBvblRyeVNldHVwRGF0YShQaG9uZS5SRUFTT05fREFUQV9FTkFCTEVEKTsKICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgb25DbGVhblVwQ29ubmVjdGlvbih0cnVlLCBQaG9uZS5SRUFTT05fREFUQV9ESVNBQkxFRCk7Ci0gICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KICAgICAgICAgfQogICAgIH0KIAotCisgICAgcHJvdGVjdGVkIExpbmtQcm9wZXJ0aWVzIGdldExpbmtQcm9wZXJ0aWVzKERhdGFDb25uZ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ZSk7CisgICAgICAgIH0KICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgIG1SZWdpc3RyeS5ub3RpZnlEYXRhQ29ubmVjdGlvbigKLSAgICAgICAgICAgICAgICAgICAgY29udmVydERhdGFTdGF0ZShzZW5kZXIuZ2V0RGF0YUNvbm5lY3Rpb25TdGF0ZSgpKSwKKyAgICAgICAgICAgICAgICAgICAgY29udmVydERhdGFTdGF0ZShzdGF0ZSksCiAgICAgICAgICAgICAgICAgICAgIHNlbmRlci5pc0RhdGFDb25uZWN0aXZpdHlQb3NzaWJsZSgpLCByZWFzb24sCiAgICAgICAgICAgICAgICAgICAgIHNlbmRlci5nZXRBY3RpdmVBcG4oKSwKLSAgICAgICAgICAgICAgICAgICAgc2VuZGVyLmdldEFjdGl2ZUFwblR5cGVzKCksCi0gICAgICAgICAgICAgICAgICAgIHNlbmRlci5nZXRJbnRlcmZhY2VOYW1lKG51bGwpLAorICAgICAgICAgICAgICAgICAgICBhcG5UeXBlLAorICAgICAgICAgICAgICAgICAgICBsaW5rUHJvcGVydGllcywKICAgICAgICAgICAgICAgICAgICAgKCh0ZWxlcGhvbnkhPW51bGwpID8gdGVsZXBob255LmdldE5ldHdvcmtUeXBlKCkgOgotICAgICAgICAgICAgICAgICAgICBUZWxlcGhvbnlNYW5hZ2VyLk5FVFdPUktfVFlQRV9VTktOT1dOKSwKLSAgICAgICAgICAgICAgICAgICAgc2VuZGVyLmdldEdhdGV3YXkobnVsbCkpOworICAgICAgICAgICAgICAgICAgICBUZWxlcGhvbnlNYW5hZ2VyLk5FVFdPUktfVFlQRV9VTktOT1dOKSk7CiAgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBleCkgewogICAgICAgICAgICAgLy8gc3lzdGVtIHByb2Nlc3MgaXMgZGVhZAogICAgICAgICB9CiAgICAgfQogCi0gICAgcHVibGljIHZvaWQgbm90aWZ5RGF0YUNvbm5lY3Rpb25GYWlsZWQoUGhvbmUgc2VuZGVyLCB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gICg2NDcsICdyZScsIDIsICdSZXVuaW9uIChGcmVuY2ggRGVwYXJ0bWVudCBvZiknKSwKLSAgKDY0OCwgJ3p3JywgMiwgJ1ppbWJhYndlIChSZXB1YmxpYyBvZiknKSwKLSAgKDY0OSwgJ25hJywgMiwgJ05hbWliaWEgKFJlcHVibGljIG9mKScpLAotICAoNjUwLCAnbXcnLCAyLCAnTWFsYXdpJyksCi0gICg2NTEsICdscycsIDIsICdMZXNvdGhvIChLaW5nZG9tIG9mKScpLAotICAoNjUyLCAnYncnLCAyLCAnQm90c3dhbmEgKFJlcHVibGljIG9mKScpLAotICAoNjUzLCAnc3onLCAyLCAnU3dhemlsYW5kIChLaW5nZG9tIG9mKScpLAotICAoNjU0LCAna20nLCAyLCAnQ29tb3JvcyAoVW5pb24gb2YgdGhlKScpLAotICAoNjU1LCAnemEnLCAyLCAnQWZyaWNhL0pvaGFubmVzYnVyZycsICdlbicsICdTb3V0aCBBZnJpY2EgKFJlcHVibGljIG9mKScpLAotICAoNjU3LCAnZXInLCAyLCAnRXJpdHJlYScpLAotICAoNzAyLCAnYnonLCAyLCAnQmVsaXplJyksCi0gICg3MDQsICdndCcsIDIsICdHdWF0ZW1hbGEgKFJlcHVibGljIG9mKScpLAotICAoNzA2LCAnc3YnLCAyLCAnRWwgU2FsdmFkb3IgKFJlcHVibGljIG9mKScpLAotICAoNzA4LCAnaG4nLCAzLCAnSG9uZHVyYXMgKFJlcHVibGljIG9mKScpLAotICAoNzEwLCAnbmknLCAyLCAnTmljYXJhZ3VhJyksCi0gICg3MTIsICdjcicsIDIsICdDb3N0YSBSaWNhJyksCi0gICg3MTQsICdwYScsIDIsICdQYW5hbWEgKFJlcHVibGljIG9mKScpLAotICAoNzE2LCAncGUnLCAyLCAnUGVydScpLAotICAoNzIyLCAnYXInLCAzLCAnQXJnZW50aW5lIFJlcHVibGljJyksCi0gICg3MjQsICdicicsIDIsICdCcmF6aWwgKEZlZGVyYXRpdmUgUmVwdWJsaWMgb2YpJy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BhcyBmb2xsb3dzIChtc2IgdG8gbHNiKTonLAotICAgICAgICAgICAgICAgICAgICAnICAgIGlzbyBjb3VudHJ5IGNvZGUgMTYgYml0cycsCi0gICAgICAgICAgICAgICAgICAgICcgICAgKHVudXNlZCkgICAgICAgICAgMSBiaXQnLAotICAgICAgICAgICAgICAgICAgICAnICAgIHdpZmkgY2hhbm5lbCAgICAgIDQgYml0cycsCi0gICAgICAgICAgICAgICAgICAgICcgICAgc21hbGxlZCBkaWdpdCAgICAgMiBiaXRzJywKLSAgICAgICAgICAgICAgICAgICAgJyAgICBkZWZhdWx0IHRpbWV6b25lICA1IGJpdHMnLAotICAgICAgICAgICAgICAgICAgICAnICAgIGRlZmF1bHQgbGFuZ3VhZ2UgIDQgYml0cyddKQotcHJpbnQgZm10X2xpc3QoJ2ludFtdIElORF9DT0RFUycsIGluZF9jb2RlcywgNikKLQotZGVmIHBhcnNlX2luZF9jb2RlKGluZCk6Ci0gIG1jYyA9IGV2YWwobWNjX2NvZGVzW2luZF0pCi0gIGNvZGUgPSBldmFsKGluZF9jb2Rlc1tpbmRdKQotICBpc29fbHNiID0gaW50KChjb2RlID4+IDE2KSAmIDB4MDBGRikKLSAgaXNvX21zYiA9IGludCgoY29kZSA+PiAyNCkgJiAweDAwRkYpCi0gIGlzbyA9ICclcyVzJyAlIChjaHIoaXNvX21zYiksIGNocihpc29fbHNiKSkKLSAgd2lmaSA9IGludCgoY29kZSA+PiAxMSkgJiAweDAwMEYpCi0gIHNkID0gaW50KChjb2RlID4+IDkpICYgMHgwMDAzKQotICB0el9pbmQgPSAoY29kZSA+PiA0KSAmIDB4MDAxRgotICBsYW5nX2luZCA9IChjb2RlID4+IDApICYgMHgwMDBGCi0gIHJldHVybiAobWNjLCBpc28sIHNkLCB0el9zZXRbdHpfaW5kXSwgbGFuZ19zZXRbbGFuZ19pbmRdLCB3aWZpKQotCi1mbXRfc3RyID0gJ21jYyA9ICVzLCBpc28gPSAlcywgc2QgPSAlcywgdHogPSAl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gICAgICAgICAgIHRoaXMuaXNvID0gaXNvOworICAgICAgICAgICAgdGhpcy5zbWFsbGVzdERpZ2l0c01uYyA9IHNtYWxsZXN0RGlnaXRzTUNDOworICAgICAgICAgICAgdGhpcy5sYW5ndWFnZSA9IGxhbmd1YWdlOworICAgICAgICAgICAgdGhpcy53aWZpQ2hhbm5lbHMgPSB3aWZpQ2hhbm5lbHM7CisgICAgICAgIH0KKworCisgICAgICAgIHB1YmxpYyBpbnQgY29tcGFyZVRvKE1jY0VudHJ5IG8pCisgICAgICAgIHsKKyAgICAgICAgICAgIHJldHVybiBtY2MgLSBvLm1jYzsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgc3RhdGljIE1jY0VudHJ5CisgICAgZW50cnlGb3JNY2MoaW50IG1jYykKKyAgICB7CisgICAgICAgIGludCBpbmRleDsKKworICAgICAgICBNY2NFbnRyeSBtOworCisgICAgICAgIG0gPSBuZXcgTWNjRW50cnkobWNjLCBudWxsLCAwKTsKKworICAgICAgICBpbmRleCA9IENvbGxlY3Rpb25zLmJpbmFyeVNlYXJjaCh0YWJsZSwgbSk7CisKKyAgICAgICAgaWYgKGluZGV4IDwgMCkgeworICAgICAgICAgICAgcmV0dXJuIG51bGw7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICByZXR1cm4gdGFibGUuZ2V0KGluZGV4KTsKKyAgICAgICAgfQorICAgIH0KKwogICAgIC8qKgotICAgICAqIEdpdmVuIGEgTW9iaWxlIENvdW50cnkgQ29kZSwgcmV0dXJucyBhIGRlZmF1bHQgdGltZSB6b25lIElECi0gICAgICogaWYgYXZhaWxhYmxlLiAgUmV0dXJucyBudWxsIGlmIHVuYXZhaWxhYmxlLgorICAgICAqIFJldHVybnMgYSBkZWZhdWx0IHRpbWUgem9uZSBJRCBmb3IgdGhlIGdpdmVuIE1DQy4KKyAgICAgKiBAcGFyYW0gbWNjIE1vYmlsZSBDb3VudHJ5IENvZGUKKyAgICAgKiBAcmV0dXJuIGRlZmF1bHQgVGltZVpvbmUgSUQsIG9yIG51bGwgaWYgbm90IHNwZWNpZmllZAogICAgICAqLwogICAgIHB1YmxpYyBzdGF0aWMgU3RyaW5nIGRlZmF1bHRUaW1lWm9uZUZvck1jYyhpbnQgbWNjKSB7Ci0gICAgICAgIGludCBpbmRleCA9IEFycmF5cy5iaW5hcnlTZWFyY2goTUNDX0NPREVTLCAoc2hvcnQpbWNjKTsKLSAgICAgICAgaWYgKGluZGV4IDwgMCkgeworICAgICAgICBNY2NFbnRyeSBlbnRyeTsKKworICAgICAgICBlbnRyeSA9IGVudHJ5Rm9yTWNjKG1jYyk7CisgICAgICAgIGlmIChlbnRyeSA9PSBudWxsIHx8IGVudHJ5LmlzbyA9PSBudWxsKSB7CiAgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIExvY2FsZSBsb2NhbGU7CisgICAgICAgICAgICBpZiAoZW50cnkubGFuZ3VhZ2UgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIGxvY2FsZSA9IG5ldyBMb2NhbGUoZW50cnkuaXNvKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgbG9jYWxlID0gbmV3IExvY2FsZShlbnRyeS5sYW5ndWFnZSwgZW50cnkuaXNvKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIFN0cmluZ1tdIHR6ID0gVGltZVpvbmVzLmZvckxvY2FsZShsb2NhbGUpOworICAgICAgICAgICAgaWYgKHR6Lmxlbmd0aCA9PSAwKSByZXR1cm4gbnVsbDsKKyAgICAgICAgICAgIHJldHVybiB0elswXTsKICAgICAgICAgfQotICAgICAgICBpbnQgaW5kQ29kZSA9IElORF9DT0RFU1tpbmRleF07Ci0gICAgICAgIGludCB0ekluZCA9IChpbmRDb2RlID4+PiA0KSAmIDB4MDAxRjsKLSAgICAgICAgU3RyaW5nIHR6ID0gVFpfU1RSSU5HU1t0ekluZF07Ci0gICAgICAgIGlmICh0eiA9PSAiIikgewotICAgICAgICAgICAgcmV0dXJuIG51bGw7Ci0gICAgICAgIH0KLSAgICAgICAgcmV0dXJuIHR6OwogICAgIH0KIAogICAgIC8qKgotICAgICAqIEdpdmVuIGEgTW9iaWxlIENvdW50cnkgQ29kZSwgcmV0dXJucyBhbiBJU08gdHdvLWNoYXJhY3RlcgotICAgICAqIGNvdW50cnkgY29kZSBpZiBhdmFpbGFibGUuICBSZXR1cm5zICIiIGlmIHVuYXZhaWxhYmxlLgorICAgICAqIEdpdmVuIGEgR1NNIE1vYmlsZSBDb3VudHJ5IENvZGUsIHJldHVybnMKKyAgICAgKiBhbiBJU08gdHdvLWNoYXJhY3RlciBjb3VudHJ5IGNvZGUgaWYgYXZhaWxhYmxlLgorICAgICAqIFJldHVybnMgIiIgaWYgdW5hdmFpbGFibGUuCiAgICAgICovCi0gICAgcHVibGljIHN0YXRpYyBTdHJpbmcgY291bnRyeUNvZGVGb3JNY2MoaW50IG1jYykgewotICAgICAgICBpbnQgaW5kZXggPSBBcnJheXMuYmluYXJ5U2VhcmNoKE1DQ19DT0RFUywgKHNob3J0KW1jYyk7Ci0gICAgICAgIGlmIChpbmRleCA8IDApIHsKKyAgICBwdWJsaWMgc3RhdGljIFN0cmluZworICAgIGNvdW50cnlDb2RlRm9yTWNjKGludCBtY2MpCisgICAgeworICAgICAgICBNY2NFbnRyeSBlbnRyeTsKKworICAgICAgICBlbnRyeSA9IGVudHJ5Rm9yTWNjKG1jYyk7CisKKyAgICAgICAgaWYgKGVudHJ5ID09IG51bGwpIHsKICAgICAgICAgICAgIHJldHVybiAiIjsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIHJldHVybiBlbnRyeS5pc287CiAgICAgICAgIH0KLSAgICAgICAgaW50IGluZENvZGUgPSBJTkRfQ09ERVNbaW5kZXhdOwotICAgICAgICBieXRlW10gaXNvID0geyhieXRlKSgoaW5kQ29kZSA+Pj4gMjQpICYgMHgwMEZGKSwgKGJ5dGUpKChpbmRDb2RlID4+PiAxNikgJiAweDAwRkYpfTsKLSAgICAgICAgcmV0dXJuIG5ldyBTdHJpbmcoaXNvKTsKICAgICB9CiAKICAgICAvKioKLSAgICAgKiBHaXZlbiBhIEdTTSBNb2JpbGUgQ291bnRyeSBDb2RlLCByZXR1cm5zIGFuIElTTyAyLTMgY2hhcmFjdGVyCi0gICAgICogbGFuZ3VhZ2UgY29kZSBpZiBhdmFpbGFibGUuICBSZXR1cm5zIG51bGwgaWYgdW5hdmFpbGFibGUuCisgICAgICogR2l2ZW4gYSBHU00gTW9iaWxlIENvdW50cnkgQ29kZSwgcmV0dXJucworICAgICAqIGFuIElTTyAyLTMgY2hhcmFjdGVyIGxhbmd1YWdlIGNvZGUgaWYgYXZhaWxhYmxlLgorICAgICAqIFJldHVybnMgbnVsbCBpZiB1bmF2YWlsYWJsZS4KICAgICAgKi8KICAgICBwdWJsaWMgc3RhdGljIFN0cmluZyBkZWZhdWx0TGFuZ3VhZ2VGb3JNY2MoaW50IG1jYykgewotICAgICAgICBpbnQgaW5kZXggPSBBcnJheXMuYmluYXJ5U2VhcmNoKE1DQ19DT0RFUywgKHNob3J0KW1jYyk7Ci0gICAgICAgIGlmIChpbmRleCA8IDApIHsKKyAgICAgICAgTWNjRW50cnkgZW50cnk7CisKKyAgICAgICAgZW50cnkgPSBlbnRyeUZvck1jYyhtY2MpOworCisgICAgICAgIGlmIChlbnRyeSA9PSBudWxsKSB7CiAgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIHJldHVybiBlbnRyeS5sYW5ndWFnZTsKICAgICAgICAgfQotICAgICAgICBpbnQgaW5kQ29kZSA9IElORF9DT0RFU1tpbmRleF07Ci0gICAgICAgIGludCBsYW5nSW5kID0gaW5kQ29kZSAmIDB4MDAwRjsKLSAgICAgICAgU3RyaW5nIGxhbmcgPSBMQU5HX1NUUklOR1NbbGFuZ0luZF07Ci0gICAgICAgIGlmIChsYW5nID09ICIiKSB7Ci0gICAgICAgICAgICByZXR1cm4gbnVsbDsKLSAgICAgICAgfQotICAgICAgICByZXR1cm4gbGFuZzsKICAgICB9CiAKICAgICAvKioKLSAgICAgKiBHaXZlbiBhIEdTTSBNb2JpbGUgQ291bnRyeSBDb2RlLCByZXR1cm5zIHRoZSBjb3JyZXNwb25kaW5nCi0gICAgICogc21hbGxlc3QgbnVtYmVyIG9mIGRpZ2l0cyBmaWVsZC4gIFJldHVybnMgMiBpZiB1bmF2YWlsYWJsZS4KKyAgICAgKiBHaXZlbiBhIEdTTSBNb2JpbGUgQ291bnRyeSBDb2RlLCByZXR1cm5zCisgICAgICogdGhlIHNtYWxsZXN0IG51bWJlciBvZiBkaWdpdHMgdGhhdCBNIGlmIGF2YWlsYWJsZS4KKyAgICAgKiBSZXR1cm5zIDIgaWYgdW5hdmFpbGFibGUuCiAgICAgICovCi0gICAgcHVibGljIHN0YXRpYyBpbnQgc21hbGxlc3REaWdpdHNNY2NGb3JNbmMoaW50IG1jYykgewotICAgICAgICBpbnQgaW5kZXggPSBBcnJheXMuYmluYXJ5U2VhcmNoKE1DQ19DT0RFUywgKHNob3J0KW1jYyk7Ci0gICAgICAgIGlmIChpbmRleCA8IDApIHsKKyAgICBwdWJsaWMgc3RhdGljIGludAorICAgIHNtYWxsZXN0RGlnaXRzTWNjRm9yTW5jKGludCBtY2MpCisgICAgeworICAgICAgICBNY2NFbnRyeSBlbnRyeTsKKworICAgICAgICBlbnRyeSA9IGVudHJ5Rm9yTWNjKG1jYyk7CisKKyAgICAgICAgaWYgKGVudHJ5ID09IG51bGwpIHsKICAgICAgICAgICAgIHJldHVybiAyOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgcmV0dXJuIGVudHJ5LnNtYWxsZXN0RGlnaXRzTW5jOwogICAgICAgICB9Ci0gICAgICAgIGludCBpbmRDb2RlID0gSU5EX0NPREVTW2luZGV4XTsKLSAgICAgICAgaW50IHNtRGlnID0gKGluZENvZGUgPj4+IDkpICYgMHgwMDAzOwotICAgICAgICByZXR1cm4gc21EaWc7CiAgICAgfQogCiAgICAgLyoqCiAgICAgICogR2l2ZW4gYSBHU00gTW9iaWxlIENvdW50cnkgQ29kZSwgcmV0dXJucyB0aGUgbnVtYmVyIG9mIHdpZmkKICAgICAgKiBjaGFubmVscyBhbGxvd2VkIGluIHRoYXQgY291bnRyeS4gIFJldHVybnMgMCBpZiB1bmF2YWlsYWJsZS4KICAgICAgKi8KLSAgICBwdWJsaWMgc3RhdGljIGludCB3aWZpQ2hhbm5lbHNGb3JNY2MoaW50IG1jYykgewotICAgICAgICBpbnQgaW5kZXggPSBBcnJheXMuYmluYXJ5U2VhcmNoKE1DQ19DT0RFUywgKHNob3J0KW1jYyk7Ci0gICAgICAgIGlmIChpbmRleCA8IDApIHsKKyAgICBwdWJsaWMgc3RhdGljIGludAorICAgIHdpZmlDaGFubmVsc0Zvck1jYyhpbnQgbWNjKSB7CisgICAgICAgIE1jY0VudHJ5IGVudHJ5OworCisgICAgICAgIGVudHJ5ID0gZW50cnlGb3JNY2MobWNjKTsKKworICAgICAgICBpZiAoZW50cnkgPT0gbnVsbCkgewogICAgICAgICAgICAgcmV0dXJuIDA7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICByZXR1cm4gZW50cnkud2lmaUNoYW5uZWxzOwogICAgICAgICB9Ci0gICAgICAgIGludCBpbmRDb2RlID0gSU5EX0NPREVTW2luZGV4XTsKLSAgICAgICAgaW50IHdpZmkgPSAoaW5kQ29kZSA+Pj4gMTEpICYgMHgwMDBGOwotICAgICAgICByZXR1cm4gd2lmaTsKICAgICB9CiAKICAgICAvKioKQEAgLTY1Niw0ICsyNzYsMjYyIEBACiAgICAgICAgICAgICB3TS5zZXROdW1BbGxvd2VkQ2hhbm5lbHMod2lmaUNoYW5uZWxzLCB0cnVlKTsKICAgICAgICAgfQogICAgIH0KKworICAgIHN0YXRpYyB7CisgICAgICAgIHRhYmxlID0gbmV3IEFyc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IGRlcml2ZWQgU21zRGlzcGF0Y2hlcnMKLSAgICAgICAgcHVibGljIEhhc2hNYXAgbURhdGE7CisgICAgICAgIHB1YmxpYyBIYXNoTWFwPFN0cmluZywgT2JqZWN0PiBtRGF0YTsKICAgICAgICAgcHVibGljIGludCBtUmV0cnlDb3VudDsKICAgICAgICAgcHVibGljIGludCBtTWVzc2FnZVJlZjsKIAogICAgICAgICBwdWJsaWMgUGVuZGluZ0ludGVudCBtU2VudEludGVudDsKICAgICAgICAgcHVibGljIFBlbmRpbmdJbnRlbnQgbURlbGl2ZXJ5SW50ZW50OwogCi0gICAgICAgIFNtc1RyYWNrZXIoSGFzaE1hcCBkYXRhLCBQZW5kaW5nSW50ZW50IHNlbnRJbnRlbnQsCisgICAgICAgIFNtc1RyYWNrZXIoSGFzaE1hcDxTdHJpbmcsIE9iamVjdD4gZGF0YSwgUGVuZGluZ0ludGVudCBzZW50SW50ZW50LAogICAgICAgICAgICAgICAgIFBlbmRpbmdJbnRlbnQgZGVsaXZlcnlJbnRlbnQpIHsKICAgICAgICAgICAgIG1EYXRhID0gZGF0YTsKICAgICAgICAgICAgIG1TZW50SW50ZW50ID0gc2VudEludGVudDsKQEAgLTk0Myw3ICs5NDQsNyBAQAogICAgICAgICB9CiAgICAgfQogCi0gICAgcHJvdGVjdGVkIFNtc1RyYWNrZXIgU21zVHJhY2tlckZhY3RvcnkoSGFzaE1hcCBkYXRhLCBQZW5kaW5nSW50ZW50IHNlbnRJbnRlbnQsCisgICAgcHJvdGVjdGVkIFNtc1RyYWNrZXIgU21zVHJhY2tlckZhY3RvcnkoSGFzaE1hcDxTdHJpbmcsIE9iamVjdD4gZGF0YSwgUGVuZGluZ0ludGVudCBzZW50SW50ZW50LAogICAgICAgICAgICAgUGVuZGluZ0ludGVudCBkZWxpdmVyeUludGVudCkgewogICAgICAgICByZXR1cm4gbmV3IFNtc1RyYWNrZXIoZGF0YSwgc2VudEludGVudCwgZGVsaXZlcnlJbnRlbnQpOwogICAgIH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ERhdGFDb25uZWN0aW9uU3RhdGUoKSksCisgICAgICAgICAgICAgICAgICAgIGNvbnZlcnREYXRhU3RhdGUoc3RhdGUpLAogICAgICAgICAgICAgICAgICAgICBzZW5kZXIuaXNEYXRhQ29ubmVjdGl2aXR5UG9zc2libGUoKSwgcmVhc29uLAogICAgICAgICAgICAgICAgICAgICBzZW5kZXIuZ2V0QWN0aXZlQXBuKCksCi0gICAgICAgICAgICAgICAgICAgIHNlbmRlci5nZXRBY3RpdmVBcG5UeXBlcygpLAotICAgICAgICAgICAgICAgICAgICBzZW5kZXIuZ2V0SW50ZXJmYWNlTmFtZShudWxsKSwKKyAgICAgICAgICAgICAgICAgICAgYXBuVHlwZSwKKyAgICAgICAgICAgICAgICAgICAgbGlua1Byb3BlcnRpZXMsCiAgICAgICAgICAgICAgICAgICAgICgodGVsZXBob255IT1udWxsKSA/IHRlbGVwaG9ueS5nZXROZXR3b3JrVHlwZSgpIDoKLSAgICAgICAgICAgICAgICAgICAgVGVsZXBob255TWFuYWdlci5ORVRXT1JLX1RZUEVfVU5LTk9XTiksCi0gICAgICAgICAgICAgICAgICAgIHNlbmRlci5nZXRHYXRld2F5KG51bGwpKTsKKyAgICAgICAgICAgICAgICAgICAgVGVsZXBob255TWFuYWdlci5ORVRXT1JLX1RZUEVfVU5LTk9XTikpOwogICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZXgpIHsKICAgICAgICAgICAgIC8vIHN5c3RlbSBwcm9jZXNzIGlzIGRlYWQKICAgICAgICAgfQogICAgIH0KIAotICAgIHB1YmxpYyB2b2lkIG5vdGlmeURhdGFDb25uZWN0aW9uRmFpbGVkKFBob25lIHNlbmRlciwgU3RyaW5nIHJlYXNvbikgeworICAgIHB1YmxpYyB2b2lkIG5vdGlmeURhdGFDb25uZWN0aW9uRmFpbGVkKFBob25lIHNlbmRlciwgU3RyaW5nIHJlYXNvbiwgU3RyaW5nIGFwblR5cGUpIHsKICAgICAgICAgdHJ5IHsKLSA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VEEgU2VydmljZSBQcm92aXNpb25pbmcgbmVlZHMgdG8gYmUgcGVyZm9ybWVkLgotICAgICAqLwotICAgIC8qIHBhY2thZ2UgKi8gYm9vbGVhbgotICAgIG5lZWRzT3RhU2VydmljZVByb3Zpc2lvbmluZygpIHsKLSAgICAgICAgU3RyaW5nIGNkbWFNaW4gPSBnZXRDZG1hTWluKCk7Ci0gICAgICAgIGJvb2xlYW4gbmVlZHNQcm92aXNpb25pbmc7Ci0gICAgICAgIGlmIChjZG1hTWluID09IG51bGwgfHwgKGNkbWFNaW4ubGVuZ3RoKCkgPCA2KSkgewotICAgICAgICAgICAgaWYgKERCRykgTG9nLmQoTE9HX1RBRywgIm5lZWRzT3RhU2VydmljZVByb3Zpc2lvbmluZzogaWxsZWdhbCBjZG1hTWluPSciCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIGNkbWFNaW4gKyAiJyBhc3N1bWUgcHJvdmlzaW9uaW5nIG5lZWRlZC4iKTsKLSAgICAgICAgICAgIG5lZWRzUHJvdmlzaW9uaW5nID0gdHJ1ZTsKLSAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgIG5lZWRzUHJvdmlzaW9uaW5nID0gKGNkbWFNaW4uZXF1YWxzKFVOQUNUSVZBVEVEX01JTl9WQUxVRSkKLSAgICAgICAgICAgICAgICAgICAgfHwgY2RtYU1pbi5zdWJzdHJpbmcoMCw2KS5lcXVhbHMoVU5BQ1RJVkFURURfTUlOMl9WQUxVRSkpCi0gICAgICAgICAgICAgICAgICAgIHx8IFN5c3RlbVByb3BlcnRpZXMuZ2V0Qm9vbGVhbigidGVzdF9jZG1hX3NldHVwIiwgZmFsc2UpOwotICAgICAgICB9Ci0gICAgICAgIGlmIChEQkcpIExvZy5kKExPR19UQUcsICJuZWVkc090YVNlcnZpY2VQcm92aXNpb25pbmc6IHJldD0iICsgbmVlZHNQcm92aXNpb25pbmcpOwotICAgICAgICByZXR1cm4gbmVlZHNQcm92aXNpb25pbmc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gICAobUNkbWFQaG9uZS5tU1NULmlzQ29uY3VycmVudFZvaWNlQW5kRGF0YSgpIHx8CisgICAgICAgICAgICAgICAgIHBob25lLmdldFN0YXRlKCkgPT0gUGhvbmUuU3RhdGUuSURMRSkgJiYKKyAgICAgICAgICAgICAgICAhcm9hbWluZyAmJgorICAgICAgICAgICAgICAgIG1NYXN0ZXJEYXRhRW5hYmxlZCAmJgorICAgICAgICAgICAgICAgIGRlc2lyZWRQb3dlclN0YXRlICYmCisgICAgICAgICAgICAgICAgIW1QZW5kaW5nUmVzdGFydFJhZGlvICYmCisgICAgICAgICAgICAgICAgIW1DZG1hUGhvbmUubmVlZHNPdGFTZXJ2aWNlUHJvdmlzaW9uaW5nKCkpOworICAgICAgICBpZiAoIWFsbG93ZWQgJiYgREJHKSB7CisgICAgICAgICAgICBTdHJpbmcgcmVhc29uID0gIiI7CisgICAgICAgICAgICBpZiAocHNTdGF0ZSAhPSBTZXJ2aWNlU3RhdGUuU1RBVEVfSU5fU0VSVklDRSkgcmVhc29uICs9ICIgLSBwc1N0YXRlPSAiICsgcHNTdGF0ZTsKKyAgICAgICAgICAgIGlmIChwaG9uZS5tQ00uZ2V0UmFkaW9TdGF0ZSgpICE9IENvbW1hbmRzSW50ZXJmYWNlLlJhZGlvU3RhdGUuTlZfUkVBRFkgJiYKKyAgICAgICAgICAgICAgICAgICAgIW1DZG1hUGhvbmUubVJ1aW1SZWNvcmRzLmdldFJlY29yZHNMb2FkZWQoKSkgeworICAgICAgICAgICAgICAgIHJlYXNvbiArPSAiIC0gcmFkaW9TdGF0ZT0gIiArIHBob25lLm1DTS5nZXRSYWRpb1N0YXRlKCkgKyAiIC0gUlVJTSBub3QgbG9hZGVkIjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGlmIChwaG9uZS5nZXRTdGF0ZSgpICE9IFBob25lLlN0YXRlLklETEUgJiYKKyAgICAgICAgICAgICAgICAgICAgbUNkbWFQaG9uZS5tU1NULmlzQ29uY3VycmVudF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UgKQotICAgICAgICAgICAgICAgICYmIGlzRGF0YUFsbG93ZWQoKQotICAgICAgICAgICAgICAgICYmIGRlc2lyZWRQb3dlclN0YXRlCi0gICAgICAgICAgICAgICAgJiYgIW1QZW5kaW5nUmVzdGFydFJhZGlvCi0gICAgICAgICAgICAgICAgJiYgIW1DZG1hUGhvbmUubmVlZHNPdGFTZXJ2aWNlUHJvdmlzaW9uaW5nKCkpIHsKLQotICAgICAgICAgICAgcmV0dXJuIHNldHVwRGF0YShyZWFzb24pOwotCisgICAgICAgIGlmICgoc3RhdGUgPT0gU3RhdGUuSURMRSB8fCBzdGF0ZSA9PSBTdGF0ZS5TQ0FOTklORykgJiYKKyAgICAgICAgICAgICAgICBpc0RhdGFBbGxvd2VkKCkgJiYgZ2V0QW55RGF0YUVuYWJsZWQoKSkgeworICAgICAgICAgICAgYm9vbGVhbiByZXRWYWx1ZSA9IHNldHVwRGF0YShyZWFzb24pOworICAgICAgICAgICAgbm90aWZ5T2ZmQXBuc09mQXZhaWxhYmlsaXR5KHJlYXNvbiwgcmV0VmFsdWUpOworICAgICAgICAgICAgcmV0dXJuIHJldFZhbHVlOwogICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgaWYgKERCRykgewotICAgICAgICAgICAgICAgICAgICBsb2coInRyeVNldHVwRGF0YTogTm90IHJlYWR5IGZvciBkYXRhOiAiICsKLSAgICAgICAgICAgICAgICAgICAgIiBkYXRhU3RhdGU9IiArIHN0YXRlICsKLSAgICAgICAgICAgICAgICAgICAgIiBQUyBzdGF0ZT0iICsgcHNTdGF0ZSArCi0gICAgICAgICAgICAgICAgICAgICIgcmFkaW8gc3RhdGU9IiArIHBob25lLm1DTS5nZXRSYWRpb1N0YXRlKCkgKwotICAgICAgICAgICAgICAgICAgICAiIHJ1aW09IiArIG1DZG1hUGhvbmUubVJ1aW1SZWNvcmRzLmdldFJlY29yZHNMb2FkZWQoKSArCi0gICAgICAgICAgICAgICAgICAgICIgY29uY3VycmVudFZvaWNlJkRhdGE9IiArIG1DZG1hUGhvbmUubVNTVC5pc0NvbmN1cnJlbnRWb2ljZUFuZERhdGEoKSArCi0gICAgICAgICAgICAgICAgICAgICIgcGhvbmVTdGF0ZT0iICsgcGhvbmUuZ2V0U3RhdGUoKSArCi0gICAgICAgICAgICAgICAgICAgICIgZGF0YUVuYWJsZWQ9IiArIGdldEFueURhdGFFbmFibGVkKCkgKwotICAgICAgICAgICAgICAgICAgICAiIHJvYW1pbmc9IiArIHJvYW1pbmcgKwotICAgICAgICAgICAgICAgICAgICAiIGRhdGFPblJvYW1pbmdFbmFibGU9IiArIGdldERhdGFPblJvYW1pbmdFbmFibGVkKCkgKwotICAgICAgICAgICAgICAgICAgICAiIGRlc2lyZWRQb3dlclN0YXRlPSIgKyBkZXNpcmVkUG93ZXJTdGF0ZSArCi0gICAgICAgICAgICAgICAgICAgICIgUGVuZGluZ1Jlc3RhcnRSYWRpbz0iICsgbVBlbmRpbmdSZXN0YXJ0UmFkaW8gKwotICAgICAgICAgICAgICAgICAgICAiIE1hc3RlckRhdGFFbmFibGVkPSIgKyBtTWFzdGVyRGF0YUVuYWJsZWQgKwotICAgICAgICAgICAgICAgICAgICAiIG5lZWRzT3RhU2VydmljZVByb3Zpc2lvbmluZz0iICsgbUNkbWFQaG9uZS5uZWVkc090YVNlcnZpY2VQcm92aXNpb25pbmcoKSk7Ci0gICAgICAgICAgICB9CisgICAgICAgICAgICBub3RpZnlPZmZBcG5zT2ZBdmFpbGFiaWxpdHkocmVhc29uLCBmYWxzZSk7CiAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgIH0KICAgICB9CkBAIC0zODIsNiArMzg3LDcgQEAKICAgICAgICAgfQogCiAgICAgICAgIHNldFN0YXRlKFN0YXRlLkRJU0NPTk5FQ1RJTkcpOworICAgICAgICBub3RpZnlEYXRhQXZhaWxhYmlsaXR5KHJlYXNvbik7CiAKICAgICAgICAgYm9vbGVhbiBub3RpZmljYXRpb25EZWZlcnJlZCA9IGZhbHNlOwogICAgICAgICBmb3IgKERhdGFDb25uZWN0aW9uIGNvbm4gOiBkYXRhQ29ubmVjdGlvbkxpc3QpIHsKQEAgLTQ0MCwxMyArNDQ2LDEzIEBACiAgICAgICAgIGNvbm4uY29ubmVjdChtc2csIG1BY3RpdmVBcG4pOwogCiAgICAgICAgIHNldFN0YXRlKFN0YXRlLklOSVRJTkcpOwotICAgICAgICBwaG9uZS5ub3RpZnlEYXRhQ29ubmVjdGlvbihyZWFzb24pOworICAgICAgICBub3RpZnlEYXRhQ29ubmVjdGlvbihyZWFzb24pOwogICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICB9CiAKICAgICBwcml2YXRlIHZvaWQgbm90aWZ5RGVmYXVsdERhdGEoU3RyaW5nIHJlYXNvbikgewogICAgICAgICBzZXRTdGF0ZShTdGF0ZS5DT05ORUNURUQpOwotICAgICAgICBwaG9uZS5ub3RpZnlEYXRhQ29ubmVjdGlvbihyZWFzb24pOworICAgICAgICBub3RpZnlEYXRhQ29ubmVjdGlvbihyZWFzb24pOwogICAgICAgICBzdGFydE5ldFN0YXRQb2xsKCk7CiAgICAgICAgIG1SZXRyeU1nci5yZXNldFJldHJ5Q291bnQoKTsKICAgICB9CkBAIC02MjIsMTIgKzYyOCwxMyBAQAogCiAgICAgcHJpdmF0ZSB2b2lkIG5vdGlmeU5vRGF0YShGYWlsQ2F1c2UgbGFzdEZhaWxDYXVzZUNvZGUpIHsKICAgICAgICAgc2V0U3RhdGUoU3RhdGUuRkFJTEVEKTsKKyAgICAgICAgbm90aWZ5RGF0YUF2YWlsYWJpbGl0eShudWxsKTsKICAgICB9CiAKICAgICBwcml2YXRlIHZvaWQgZ290b0lkbGVBbmROb3RpZnlEYXRhQ29ubmVjdGlvbihTdHJpbmcgcmVhc29uKSB7CiAgICAgICAgIGlmIChEQkcpIGxvZygiZ290b0lkbGVBbmROb3RpZnlEYXRhQ29ubmVjdGlvbjogcmVhc29uPSIgKyByZWFzb24pOwogICAgICAgICBzZXRTdGF0ZShTdGF0ZS5JRExFKTsKLSAgICAgICAgcGhvbmUubm90aWZ5RGF0YUNvbm5lY3Rpb24ocmVhc29uKTsKKyAgICAgICAgbm90aWZ5RGF0YUNvbm5lY3Rpb24ocmVhc29uKTsKICAgICAgICAgbUFjdGl2ZUFwbiA9IG51bGw7CiAgICAgfQogCkBAIC02ODcsMTEgKzY5NCwxMyBAQAogICAgICAgICAgICAgLy8gQXNzdW1lIGRhdGEgaXMgY29ubmVjdGVkIG9uIHRoZSBzaW11bGF0b3IKICAgICAgICAgICAgIC8vIEZJWE1FICB0aGlzIGNhbiBiZSBpbXByb3ZlZAogICAgICAgICAgICAgc2V0U3RhdGUoU3RhdGUuQ09OTkVDVEVEKTsKLSAgICAgICAgICAgIHBob25lLm5vdGlmeURhdGFDb25uZWN0aW9uKG51bGwpOworICAgICAgICAgICAgbm90aWZ5RGF0YUNvbm5lY3Rpb24obnVsbCk7CiAKICAgICAgICAgICAgIExvZy5pKExPR19UQUcsICJXZSdyZSBvbiB0aGUgc2ltdWxhdG9yOyBhc3N1bWluZyBkYXRhIGlzIGNvbm5lY3RlZCIpOwogICAgICAgICB9CiAKKyAgICAgICAgbm90aWZ5RGF0YUF2YWlsYWJpbGl0eShudWxsKTsKKwogICAgICAgICBpZiAoc3RhdGUgIT0gU3RhdGUuSURMRSkgewogICAgICAgICAgICAgY2xlYW5VcENvbm5lY3Rpb24odHJ1ZSwgbnVsbCk7CiAgICAgICAgIH0KQEAgLTcyMyw2ICs3MzIsOCBAQAogICAgICAgICB9CiAKICAgICAgICAgaWYgKGFyLmV4Y2VwdGlvbiA9PSBudWxsKSB7CisgICAgICAgICAgICBtTGlua1Byb3BlcnRpZXMgPSBnZXRMaW5rUHJvcGVydGllcyhtQWN0aXZlRGF0YUNvbm5lY3Rpb24pOworCiAgICAgICAgICAgICAvLyBldmVyeXRoaW5nIGlzIHNldHVwCiAgICAgICAgICAgICBub3RpZnlEZWZhdWx0RGF0YShyZWFzb24pOwogICAgIC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bGwoKTsKLSAgICAgICAgICAgICAgICBwaG9uZS5ub3RpZnlEYXRhQ29ubmVjdGlvbihQaG9uZS5SRUFTT05fVk9JQ0VfQ0FMTF9FTkRFRCk7CisgICAgICAgICAgICAgICAgbm90aWZ5RGF0YUNvbm5lY3Rpb24oUGhvbmUuUkVBU09OX1ZPSUNFX0NBTExfRU5ERUQpOwogICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgICAvLyBjbGVhbiBzbGF0ZSBhZnRlciBjYWxsIGVuZC4KICAgICAgICAgICAgICAgICByZXNldFBvbGxTdGF0cygpOwogICAgICAgICAgICAgfQorICAgICAgICAgICAgbm90aWZ5RGF0YUF2YWlsYWJpbGl0eShQaG9uZS5SRUFTT05fVk9JQ0VfQ0FMTF9FTkRFRCk7CiAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICBtUmV0cnlNZ3IucmVzZXRSZXRyeUNvdW50KCk7CiAgICAgICAgICAgICAvLyBpbiBjYXNlIGRhdGEgc2V0dXAgd2FzIGF0dGVtcHRlZCB3aGVuIHdlIHdlcmUgb24gYSB2b2ljZSBjYWxsCkBAIC04MzgsNyArODUxLDcgQEAKICAgICBwcml2YXRlIHZvaWQgb25DZG1hRGF0YURldGFjaGVkKCkgewogICAgICAgICBpZiAoc3RhdGUgPT0gU3RhdGUuQ09OTkVDVEVEKSB7CiAgICAgICAgICAgICBzdGFydE5ldFN0YXRQb2xsKCk7Ci0gICAgICAgICAgICBwaG9uZS5ub3RpZnlEYXRhQ29ubmVjdGlvbihQaG9uZS5SRUFTT05fQ0RNQV9EQVRBX0RFVEFDSEVEKTsKKyAgICAgICAgICAgIG5vdGlmeURhdGFDb25uZWN0aW9uKFBob25lLlJFQVNPTl9DRE1BX0RBVEFfREVUQUNIRUQpOwogICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgaWYgKHN0YXRlID09IFN0YXRlLkZBSUxFRCkgewogICAgICAgICAgICAgICAgIGNsZWFuVXBDb25uZWN0a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RExFICYmCisgICAgICAgICAgICAgICAgbU1hc3RlckRhdGFFbmFibGVkICYmCisgICAgICAgICAgICAgICAgKCFwaG9uZS5nZXRTZXJ2aWNlU3RhdGUoKS5nZXRSb2FtaW5nKCkgfHwgZ2V0RGF0YU9uUm9hbWluZ0VuYWJsZWQoKSkgJiYKKyAgICAgICAgICAgICAgICAhbUlzUHNSZXN0cmljdGVkICYmCisgICAgICAgICAgICAgICAgZGVzaXJlZFBvd2VyU3RhdGUpOworICAgICAgICBpZiAoIWFsbG93ZWQgJiYgREJHKSB7CisgICAgICAgICAgICBTdHJpbmcgcmVhc29uID0gIiI7CisgICAgICAgICAgICBpZiAoZ3Byc1N0YXRlICE9IFNlcnZpY2VTdGF0ZS5TVEFURV9JTl9TRVJWSUNFKSByZWFzb24gKz0gIiAtIGdwcnM9ICIgKyBncHJzU3RhdGU7CisgICAgICAgICAgICBpZiAoIW1Hc21QaG9uZS5tU0lNUmVjb3Jkcy5nZXRSZWNvcmRzTG9hZGVkKCkpIHJlYXNvbiArPSAiIC0gU0lNIG5vdCBsb2FkZWQiOworICAgICAgICAgICAgaWYgKHBob25lLmdldFN0YXRlKCkgIT0gUGhvbmUuU3RhdGUuSURMRSkgeworICAgICAgICAgICAgICAgIHJlYXNvbiArPSAiIC0gUGhvbmVTdGF0ZT0gIiArIHBob25lLmdldFN0YXRlKCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoIW1NYXN0ZXJEYXRhRW5hYmxlZCkgcmVhc29uICs9ICIgLSBtTWFzdGVyRGF0YUVuYWJsZWQ9IGZhbHNlIjsKKyAgICAgICAgICAgIGlmIChwaG9uZS5nZXRTZXJ2aWNlU3RhdGUoKS5nZXRSb2FtaW5nKCkgJiYgZ2V0RGF0YU9uUm9hbWluZ0VuYWJsZWQoKSkgeworICAgICAgICAgICAgICAgIHJlYXNvbiArPSAiIC0gUm9hbWluZyI7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAobUlzUHNSZXN0cmlj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k9XTl9BUE4pOworICAgICAgICAgICAgICAgICAgICBub3RpZnlPZmZBcG5zT2ZBdmFpbGFiaWxpdHkocmVhc29uLCBmYWxzZSk7CiAgICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICBsb2cgKCJDcmVhdGUgZnJvbSBhbGxBcG5zIDogIiArIGFwbkxpc3RUb1N0cmluZyhhbGxBcG5zKSk7CkBAIC00NjEsMjIgKzQ4MSwxMSBAQAogICAgICAgICAgICAgaWYgKERCRykgewogICAgICAgICAgICAgICAgIGxvZyAoIlNldHVwIHdhaXRuZ0FwbnMgOiAiICsgYXBuTGlzdFRvU3RyaW5nKHdhaXRpbmdBcG5zKSk7CiAgICAgICAgICAgICB9Ci0gICAgICAgICAgICByZXR1cm4gc2V0dXBEYXRhKHJlYXNvbik7CisgICAgICAgICAgICBib29sZWFuIHJldFZhbHVlID0gc2V0dXBEYXRhKHJlYXNvbik7CisgICAgICAgICAgICBub3RpZnlPZmZBcG5zT2ZBdmFpbGFiaWxpdHkocmVhc29uLCByZXRWYWx1ZSk7CisgICAgICAgICAgICByZXR1cm4gcmV0VmFsdWU7CiAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICBpZiAoREJHKQotICAgICAgICAgICAgICAgIGxvZygidHJ5U2V0dXBEYXRhOiBOb3QgcmVhZHkgZm9yIGRhdGE6ICIgKwotICAgICAgICAgICAgICAgICAgICAiIGRhdGFTdGF0ZT0iICsgc3RhdGUgKwotICAgICAgICAgICAgICAgICAgICAiIGdwcnNTdGF0ZT0iICsgZ3Byc1N0YXRlICsKLSAgICAgICAgICAgICAgICAgICAgIiBzaW09IiArIG1Hc21QaG9uZS5tU0lNUmVjb3Jkcy5nZXRSZWNvcmRzTG9hZGVkKCkgKwotICAgICAgICAgICAgICAgICAgICAiIFVNVFM9IiArIG1Hc21QaG9uZS5tU1NULmlzQ29uY3VycmVudFZvaWNlQW5kRGF0YSgpICsKLSAgICAgICAgICAgICAgICAgICAgIiBwaG9uZVN0YXRlPSIgKyBwaG9uZS5nZXRTdGF0ZSgpICsKLSAgICAgICAgICAgICAgICAgICAgIiBpc0RhdGFBbGxvd2VkPSIgKyBpc0RhdGFBbGxvd2VkKCkgKwotICAgICAgICAgICAgICAgICAgICAiIGRhdGFFbmFibGVkPSIgKyBnZXRBbnlEYXRhRW5hYmxlZCgpICsKLSAgICAgICAgICAgICAgICAgICAgIiByb2FtaW5nPSIgKyBwaG9uZS5nZXRTZXJ2aWNlU3RhdGUoKS5nZXRSb2FtaW5nKCkgKwotICAgICAgICAgICAgICAgICAgICAiIGRhdGFPblJvYW1pbmdFbmFibGU9IiArIGdldERhdGFPblJvYW1pbmdFbmFibGVkKCkgKwotICAgICAgICAgICAgICAgICAgICAiIHBzIHJlc3RyaWN0ZWQ9IiArIG1Jc1BzUmVzdHJpY3RlZCArCi0gICAgICAgICAgICAgICAgICAgICIgZGVzaXJlZFBvd2VyU3RhdGU9IiArIGRlc2lyZWRQb3dlclN0YXRlICsKLSAgICAgICAgICAgICAgICAgICAgIiBNYXN0ZXJEYXRhRW5hYmxlZD0iICsgbU1hc3RlckRhdGFFbmFibGVkKTsKKyAgICAgICAgICAgIG5vdGlmeU9mZkFwbnNPZkF2YWlsYWJpbGl0eShyZWFzb24sIGZhbHNlKTsKICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICAgfQogICAgIH0KQEAgLTU5NSw0NiArNjA0LDEwIEBACiAgICAgICAgIHBkcC5jb25uZWN0KG1zZywgYXBuKTsKIAogICAgICAgICBzZXRTdGF0ZShTdGF0ZS5JTklUSU5HKTsKLSAgICAgICAgcGhvbmUubm90aWZ5RGF0YUNvbm5lY3Rpb24ocmVhc29uKTsKKyAgICAgICAgbm90aWZ5RGF0YUNvbm5lY3Rpb24ocmVhc29uKTsKICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgfQogCi0gICAgcHJvdGVjdGVkIF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ci0gICAgICAgIHJldHVybiBudWxsOwotICAgIH0KLQotICAgIHByb3RlY3RlZCBTdHJpbmdbXSBnZXREbnNTZXJ2ZXJzKFN0cmluZyBhcG5UeXBlKSB7Ci0gICAgICAgIGlmIChtQWN0aXZlUGRwICE9IG51bGwgJiYKLSAgICAgICAgICAgICAgICAoYXBuVHlwZSA9PSBudWxsIHx8Ci0gICAgICAgICAgICAgICAgKG1BY3RpdmVBcG4gIT0gbnVsbCAmJiBtQWN0aXZlQXBuLmNhbkhhbmRsZVR5cGUoYXBuVHlwZSkpKSkgewotICAgICAgICAgICAgcmV0dXJuIG1BY3RpdmVQZHAuZ2V0RG5zU2VydmVycygpOwotICAgICAgICB9Ci0gICAgICAgIHJldHVybiBudWxsOwotICAgIH0KLQogICAgIHByaXZhdGUgYm9vbGVhbgogICAgIHBkcFN0YXRlc0hhc0NJRCAoQXJyYXlMaXN0PERhdGFDYWxsU3RhdGU+IHN0YXRlcywgaW50IGNpZCkgewogICAgICAgICBmb3IgKGludCBpID0gMCwgcyA9IHN0YXRlcy5zaXplKCkgOyBpIDwgcyA7IGkrKykgewpAQCAtNzQ2LDcgKzcxOSw3IEBACiAKICAgICBwcml2YXRlIHZvaWQgbm90aWZ5RGVmYXVsdERhdGEoU3RyaW5nIHJlYXNvbikgewogICAgICAgICBzZXRTdGF0ZShTdGF0ZS5DT05ORUNURUQpOwotICAgICAgICBwaG9uZS5ub3RpZnlEYXRhQ29ubmVjdGlvbihyZWFzb24pOworICAgICAgICBub3RpZnlEYXRhQ29ubmVjdGlvbihyZWFzb24pOwogICAgICAgICBzdGFydE5ldFN0YXRQb2xsKCk7CiAgICAgICAgIC8vIHJlc2V0IHJlY29ubmVjdCB0aW1lcgogICAgICAgICBtUmV0cnlNZ3IucmVzZXRSZXRyeUNvdW50KCk7CkBAIC03NTYsNyArNzI5LDcgQEAKICAgICBwcml2YXRlIHZvaWQgZ290b0lkbGVBbmROb3RpZnlEYXRhQ29ubmVjdGlvbihTdHJpbmcgcmVhc29uKSB7CiAgICAgICAgIGlmIChEQkcpIGxvZygiZ290b0lkbGVBbmROb3RpZnlEYXRhQ29ubmVjdGlvbjogcmVhc29uPSIgKyByZWFzb24pOwogICAgICAgICBzZXRTdGF0ZShTdGF0ZS5JRExFKTsKLSAgICAgICAgcGhvbmUubm90aWZ5RGF0YUNvbm5lY3Rpb24ocmVhc29uKTsKKyAgICAgICAgbm90aWZ5RGF0YUNvbm5lY3Rpb24ocmVhc29uKTsKICAgICAgICAgbUFjdGl2ZUFwbiA9IG51bGw7CiAgICAgfQogCkBAIC05OTgsNyArOTcxLDcgQEAKICAgICAgICAgICAgIGlmICghbVJldHJ5TWdyLmlzUmV0cnlOZWVkZWQoKSkgewogICAgICAgICAgICAgICAgIGlmICghbVJlcXVlc3RlZEFwblR5cGUuZXF1YWxzKFBob25lLkFQTl9UWVBFX0RFRkFVTFQpKSB7CiAgICAgICAgICAgICAgICAgICAgIC8vIGlmIG5vIG1vcmUgcmV0cmllcyBvbiBhIHNlY29uZGFyeSBBUE4gYXR0ZW1wdCwgdGVsbCB0aGUgd29ybGQgYW5kIHJldmVydC4KLSAgICAgICAgICAgICAgICAgICAgcGhvbmUubm90aWZ5RGF0YUNvbm5lY3Rpb24oUGhvbmUuUkVBU09OX0FQTl9GQUlMRUQpOworICAgICAgICAgICAgICAgICAgICBub3RpZnlEYXRhQ29ubmVjdGlvbihQaG9uZS5SRUFTT05fQVBOX0ZBSUxFRCk7CiAgICAgICAgICAgICAgICAgICAgIG9uRW5hYmxlQXBuKGFwblR5cGVUb0lkKG1SZXF1ZXN0ZWRBcG5UeXBlKSwgRElTQUJMRUQpOwogICAgICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICAgICAgfQpAQCAtMTA5MSw3ICsxMDY0LDcgQEAKICAgICAgICAgICAgIC8vIEFzc3VtZSBkYXRhIGlzIGNvbm5lY3RlZCBvbiB0aGUgc2ltdWxhdG9yCiAgICAgICAgICAgICAvLyBGSVhNRSAgdGhpcyBjYW4gYmUgaW1wcm92ZWQKICAgICAgICAgICAgIHNldFN0YXRlKFN0YXRlLkNPTk5FQ1RFRCk7Ci0gICAgICAgICAgICBwaG9uZS5ub3RpZnlEYXRhQ29ubmVjdGlvbihudWxsKTsKKyAgICAgICAgICAgIG5vdGlmeURhdGFDb25uZWN0aW9uKG51bGwpOwogCiAgICAgICAgICAgICBMb2cuaShMT0dfVEFHLCAiV2UncmUgb24gdGhlIHNpbXVsYXRvcjsgYXNzdW1pbmcgZGF0YSBpcyBjb25uZWN0ZWQiKTsKICAgICAgICAgfQpAQCAtMTEyNSw2ICsxMDk4LDI1IEBACiAgICAgICAgIH0KIAogICAgICAgICBpZiAoYXIuZXhjZXB0aW9uID09IG51bGwpIHsKKyAgICAgICAgICAgIG1MaW5rUHJvcGVydGllcyA9IGdldExpbmtQcm9wZXJ0aWVzKG1BY3RpdmVQZHApOworCisgICAgICAgICAgICBBcG5TZXR0aW5nIGFwbiA9IG1BY3RpdmVQZHAuZ2V0QXBuKCk7CisgICAgICAgICAgICBpZiAoYXBuLnByb3h5ICE9IG51bGwgJiYgYXBuLnByb3h5Lmxlbmd0aCgpICE9IDApIHsKKyAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICBQcm94eVByb3BlcnRpZXMgcHJveHkgPSBuZXcgUHJveHlQcm9wZXJ0aWVzKCk7CisgICAgICAgICAgICAgICAgICAgIHByb3h5LnNldEFkZHJlc3MoSW5ldEFkZHJlc3MuZ2V0QnlOYW1lKGFwbi5wcm94eSkpOworICAgICAgICAgICAgICAgICAgICBwcm94eS5zZXRQb3J0KEludGVnZXIucGFyc2VJbnQoYXBuLnBvcnQpKTsKKyAgICAgICAgICAgICAgICAgICAgbUxpbmtQcm9wZXJ0aWVzLnNldEh0dHBQcm94eShwcm94eSk7CisgICAgICAgICAgICAgICAgfSBjYXRjaCAoVW5rbm93bkhvc3RFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICBMb2cuZShMT0dfVEFHLCAiVW5rbm93bkhvc3RFeGNlcHRpb24gbWFraW5nIFByb3h5UHJvcGVydGllczogIiArIGUpOworICAgICAgICAgICAgICAgIH0gY2F0Y2ggKFNlY3VyaXR5RXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAgICAgTG9nLmUoTE9HX1RBRywgIlNlY3VyaXR5RXhjZXB0aW9uIG1ha2luZyBQcm94eVByb3BlcnRpZXM6ICIgKyBlKTsKKyAgICAgICAgICAgICAgICB9IGNhdGNoIChOdW1iZXJGb3JtYXRFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICBMb2cuZShMT0dfVEFHLCAiTnVtYmVyRm9ybWF0RXhjZXB0aW9uIG1ha2luZyBQcm94eVByb3BlcnRpZXMgKCIgKyBhcG4ucG9ydCArCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIik6ICIgKyBlKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKICAgICAgICAgICAgIC8vIGV2ZXJ5dGhpbmcgaXMgc2V0dXAKICAgICAgICAgICAgIGlmIChpc0FwblR5cGVBY3RpdmUoUGhvbmUuQVBOX1RZUEVfREVGQVVMVCkpIHsKICAgICAgICAgICAgICAgICBTeXN0ZW1Qcm9wZXJ0aWVzLnNldCgiZ3NtLmRlZmF1bHRwZHBjb250ZXh0LmFjdGl2ZSIsICJ0cnVlIik7CkBAIC0xMTU4LDcgKzExNTAsNyBAQAogICAgICAgICAgICAgaWYgKGNhdXNlLmlzUGVybWFuZW50RmFpbCgpKSB7CiAgICAgICAgICAgICAgICAgbm90aWZ5Tm9EYXRhKGNhdXNlKTsKICAgICAgICAgICAgICAgICBpZiAoIW1SZXF1ZXN0ZWRBcG5UeXBlLmVxdWFscyhQaG9uZS5BUE5fVFlQRV9ERUZBVUxUKSkgewotICAgICAgICAgICAgICAgICAgICBwaG9uZS5ub3RpZnlEYXRhQ29ubmVjdGlvbihQaG9uZS5SRUFTT05fQVBOX0ZBSUxFRCk7CisgICAgICAgICAgICAgICAgICAgIG5vdGlmeURhdGFDb25uZWN0aW9uKFBob25lLlJFQVNPTl9BUE5fRkFJTEVEKTsKICAgICAgICAgICAgICAgICAgICAgb25FbmFibGVBcG4oYXBuVHlwZVRvSWQobVJlcXVlc3RlZEFwblR5cGUpLCBESVNBQkxFRCk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIHJldHVybjsKQEAgLTExODgsNyArMTE4MCw3IEBACiAgICAgICAgICAgIHJlYXNvbiA9IChTdHJpbmcpIGFyLnVzZXJPYmo7CiAgICAgICAgIH0KICAgICAgICAgc2V0U3RhdGUoU3RhdGUuSURMRSk7Ci0gICAgICAgIHBob25lLm5vdGlmeURhdGFDb25uZWN0aW9uKHJlYXNvbik7CisgICAgICAgIG5vdGlmeURhdGFDb25uZWN0aW9uKHJlYXNvbik7CiAgICAgICAgIG1BY3RpdmVBcG4gPSBudWxsOwogICAgICAgICBpZiAocmV0cnlBZnRlckRpc2Nvbm5lY3RlZChyZWFzb24pKSB7CiAgICAgICAgICAgICB0cnlTZXR1cERhdGEocmVhc29uKTsKQEAgLTEyMTksNyArMTIxMSw3IEBACiAgICAgcHJvdGVjdGVkIHZvaWQgb25Wb2ljZUNhbGxTdGFydGVkKCkgewogICAgICAgICBpZiAoc3RhdGUgPT0gU3RhdGUuQ09OTkVDVEVEICYmICEgbUdzbVBob25lLm1TU1QuaXNDb25jdXJyZW50Vm9pY2VBbmREYXRhKCkpIHsKICAgICAgICAgICAgIHN0b3BOZXRTdGF0UG9sbCgpOwotICAgICAgICAgICAgcGhvbmUubm90aWZ5RGF0YUNvbm5lY3Rpb24oUGhvbmUuUkVBU09OX1ZPSUNFX0NBTExfU1RBUlRFRCk7CisgICAgICAgICAgICBub3RpZnlEYXRhQ29ubmVjdGlvbihQaG9uZS5SRUFTT05fVk9JQ0VfQ0FMTF9TVEFSVEVEKTsKICAgICAgICAgfQogICAgIH0KIApAQCAtMTIyNyw3ICsxMj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iAgICAgfQogCi0gICAgc3RhdGljIGNsYXNzIFBkdVBhcnNlciB7CisgICAgcHJpdmF0ZSBzdGF0aWMgY2xhc3MgUGR1UGFyc2VyIHsKICAgICAgICAgYnl0ZSBwZHVbXTsKICAgICAgICAgaW50IGN1cjsKICAgICAgICAgU21zSGVhZGVyIHVzZXJEYXRhSGVhZGVyOwpAQCAtNDkwLDEwICs0ODksNiBAQAogICAgICAgICBpbnQgbVVzZXJEYXRhU2VwdGV0UGFkZGluZzsKICAgICAgICAgaW50IG1Vc2VyRGF0YVNpemU7CiAKLSAgICAgICAgUGR1UGFyc2VyKFN0cmluZyBzKSB7Ci0gICAgICAgICAgICB0aGlzKEljY1V0aWxzLmhleFN0cmluZ1RvQnl0ZXMocykpOwotICAgICAgICB9Ci0KICAgICAgICAgUGR1UGFyc2VyKGJ5dGVbXSBwZHUpIHsKICAgICAgICAgICAgIHRoaXMucGR1ID0gcGR1OwogICAgICAgICAgICAgY3VyID0gMDsKQEAgLTU0NSw3ICs1NDAsNyBAQAogICAgICAgICAgICAgR3NtU21zQWRkcmVzcyByZXQ7CiAKICAgICAgICAgICAgIC8vICJUaGUgQWRkcmVzcy1MZW5ndGggZmllbGQgaXMgYW4gaW50ZWdlciByZXByZXNlbnRhdGlvbiBvZgotICAgICAgICAgICAgLy8gdGhlIG51bWJlciBmaWVsZCwgaS5lLiBleGNsdWRlcyBhbnkgc2VtaSBvY3RldCBjb250YWluaW5nIG9ubHkKKyAgICAgICAgICAgIC8vIHRoZSBudW1iZXIgZmllbGQsIGkuZS4gZXhjbHVkZXMgYW55IHNlbWktb2N0ZXQgY29udGFpbmluZyBvbmx5CiAgICAgICAgICAgICAvLyBmaWxsIGJpdHMuIgogICAgICAgICAgICAgLy8gVGhlIFRPQSBmaWVsZCBpcyBub3QgaW5jbHVkZWQgYXMgcGFydCBvZiB0aGlzCiAgICAgICAgICAgICBpbnQgYWRkcmVzc0xlbmd0aCA9IHBkdVtjdXJdICYgMHhmZjsKQEAgLT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otICAgICAgICAgKiBSZXR1cm5zIHRoZSBudW1iZXIgb2YgcGFkZGluZyBiaXRzIGF0IHRoZSBiZWdpbmluZyBvZiB0aGUgdXNlciBkYXRhCisgICAgICAgICAqIFJldHVybnMgdGhlIG51bWJlciBvZiBwYWRkaW5nIGJpdHMgYXQgdGhlIGJlZ2lubmluZyBvZiB0aGUgdXNlciBkYXRhCiAgICAgICAgICAqIGFycmF5IGJlZm9yZSB0aGUgc3RhcnQgb2YgdGhlIHNlcHRldHMuCiAgICAgICAgICAqCi0gICAgICAgICAqIEByZXR1cm4gdGhlIG51bWJlciBvZiBwYWRkaW5nIGJpdHMgYXQgdGhlIGJlZ2luaW5nIG9mIHRoZSB1c2VyIGRhdGEKKyAgICAgICAgICogQHJldHVybiB0aGUgbnVtYmVyIG9mIHBhZGRpbmcgYml0cyBhdCB0aGUgYmVnaW5uaW5nIG9mIHRoZSB1c2VyIGRhdGEKICAgICAgICAgICogYXJyYXkgYmVmb3JlIHRoZSBzdGFydCBvZiB0aGUgc2VwdGV0cwogICAgICAgICAgKi8KICAgICAgICAgaW50IGdldFVzZXJEYXRhU2VwdGV0UGFkZGluZygpIHsKQEAgLTY5NCw3ICs2ODksNyBAQAogICAgICAgICBYWFggTm90IHN1cmUgd2hhdCB0aGlzIG9uZSBpcyBzdXBwb3NlZCB0byBiZSBkb2luZywgYW5kIG5vIG9uZSBpcyB1c2luZwogICAgICAgICBpdC4KICAgICAgICAgU3RyaW5nIGdldFVzZXJEYXRhR1NNOGJpdCgpIHsKLSAgICAgICAgICAgIC8vIFN5c3RlbS5vdXQucHJpbnRsbigicmVtYWluZGVyIG9mIHB1ZDoiICsKKyAgICAgICAgICAgIC8vIFN5c3RlbS5vdXQucHJpbnRsbigicmVtYWluZGVyIG9mIHBkdToiICsKICAgICAgICAgICAgIC8vIEhleER1bXAuZHVtcEhleFN0cmluZyhwZHUsIGN1ciwgcGR1Lmxlbmd0aCAtIGN1cikpOwogICAgICAgICAgICAgaW50IGNvdW50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1bHQgdmFsdWUiCkBAIC01MTMsNyArNTExLDcgQEAKICAgICAgKiAgcmV0dXJuZWQgbWVzc2FnZQogICAgICAqICByZXRNc2cub2JqID0gQXN5bmNSZXN1bHQgYXIKICAgICAgKiAgYXIuZXhjZXB0aW9uIGNhcnJpZXMgZXhjZXB0aW9uIG9uIGZhaWx1cmUKLSAgICAgKiAgYXIudXNlck9iamVjdCBjb250YWlucyB0aGUgb3JpZ25hbCB2YWx1ZSBvZiByZXN1bHQub2JqCisgICAgICogIGFyLnVzZXJPYmplY3QgY29udGFpbnMgdGhlIG9yaWdpbmFsIHZhbHVlIG9mIHJlc3VsdC5vYmoKICAgICAgKiAgYXIucmVzdWx0IGlzIFN0cmluZyBjb250YWluaW5nIElNU0kgb24gc3VjY2VzcwogICAgICAqLwogICAgIHB1YmxpYyB2b2lkIGdldElNU0koTWVzc2FnZSByZXN1bHQpIHsKQEAgLTUyNCw3ICs1MjIsNyBAQAogICAgICAqICByZXR1cm5lZCBtZXNzYWdlCiAgICAgICogIHJldE1zZy5vYmogPSBBc3luY1Jlc3VsdCBhcgogICAgICAqICBhci5leGNlcHRpb24gY2FycmllcyBleGNlcHRpb24gb24gZmFpbHVyZQotICAgICAqICBhci51c2VyT2JqZWN0IGNvbnRhaW5zIHRoZSBvcmlnbmFsIHZhbHVlIG9mIHJlc3VsdC5vYmoKKyAgICAgKiAgYXIudXNlck9iamVjdCBjb250YWlucyB0aGUgb3JpZ2luYWwgdmFsdWUgb2YgcmVzdWx0Lm9iagogICAgICAqICBhci5yZXN1bHQgaXMgU3RyaW5nIGNvbnRhaW5pbmcgSU1FSSBvbiBzdWNjZXNzCiAgICAgICovCiAgICAgcHVibGljIHZvaWQgZ2V0SU1FSShNZXNzYWdlIHJlc3VsdCkgewpAQCAtNTM1LDcgKzUzMyw3IEBACiAgICAgICogIHJldHVybmVkIG1lc3NhZ2UKICAgICAgKiAgcmV0TXNnLm9iaiA9IEFzeW5jUmVzdWx0IGFyCiAgICAgICogIGF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ICIgKyBlLmdldFN0YWNrVHJhY2UoKSk7CisgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gcmVzcG9uc2U7CisgICAgfQorCisgICAgLyoqCisgICAgICogQHJldHVybiB0aGUgcmFkaW8gc3RhdGUgaWYgaXQgaXMgdmFsaWQsIG90aGVyd2lzZSByZXR1cm4gLTEKKyAgICAgKi8KKyAgICBwdWJsaWMgaW50IGdldFJhZGlvU3RhdGUoKSB7CisgICAgICAgIGlmICghc2VuZEN0cmxDb21tYW5kKFJpbEN0cmxDbWRzLkNUUkxfQ01EX0dFVF9SQURJT19TVEFURSwgMCwgMCwgbnVsbCkpIHsKKyAgICAgICAgICAgIHJldHVybiAtMTsKKyAgICAgICAgfQorICAgICAgICBNc2cgcmVzcG9uc2UgPSBnZXRDdHJsUmVzcG9uc2UoKTsKKyAgICAgICAgaWYgKHJlc3BvbnNlID09IG51bGwpIHsKKyAgICAgICAgICAgIExvZy52KFRBRywgImZhaWxlZCB0byBnZXQgcmVzcG9uc2UiKTsKKyAgICAgICAgICAgIHJldHVybiAtMTsKKyAgICAgICAgfQorICAgICAgICByZXNwb25zZS5wcmludEhlYWRlcihUQUcpOworICAgICAgICBSaWxDdHJsQ21kcy5DdHJsUnNwUmFkaW9TdGF0ZSByZXNwID0KKyAgICAgICAgICAgIHJlc3BvbnNlLmdldERhdGFBcyhSaWxDdHJsQ21kcy5DdHJsUnNwUmFkaW9TdGF0ZS5jbGFzcyk7CisgICAgICAgIGludCBzdGF0ZSA9IHJlc3AuZ2V0U3RhdGUoKTsKKyAgICAgICAgaWYgKChzdGF0ZSA+PSBSaWxDbWRzLlJBRElPU1RBVEVfT0ZGKSAmJiAoc3RhdGUgPD0gUmlsQ21kcy5SQURJT1NUQVRFX05WX1JFQURZKSkKKyAgICAgICAgICAgIHJldHVybiBzdGF0ZTsKKyAgICAgICAgZWxzZQorICAgICAgICAgICAgcmV0dXJuIC0xOworICAgIH0KKworICAg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mRyb2lkVGVzdENhc2UgewotCi0gICAgQFNtYWxsVGVzdAotICAgIHB1YmxpYyB2b2lkIHRlc3RFeHRyYWN0TmV0d29ya1BvcnRpb24oKSB0aHJvd3MgRXhjZXB0aW9uIHsKLSAgICAgICAgYXNzZXJ0RXF1YWxzKAotICAgICAgICAgICAgICAgICIrMTcwMDU1NTQxNDEiLAotICAgICAgICAgICAgICAgIFBob25lTnVtYmVyVXRpbHMuZXh0cmFjdE5ldHdvcmtQb3J0aW9uKCIrMTcwMDU1NTQxNDEiKQotICAgICAgICApOwotCi0gICAgICAgIGFzc2VydEVxdWFscygKLSAgICAgICAgICAgICAgICAiKzE3MDA1NTU0MTQxIiwKLSAgICAgICAgICAgICAgICBQaG9uZU51bWJlclV0aWxzLmV4dHJhY3ROZXR3b3JrUG9ydGlvbigiKzEgKDcwMCkuNTU1LTQxNDEiKQotICAgICAgICApOwotCi0gICAgICAgIGFzc2VydEVxdWFscygKLSAgICAgICAgICAgICAgICAiMTcwMDU1NTQxNDEiLAotICAgICAgICAgICAgICAgIFBob25lTnVtYmVyVXRpbHMuZXh0cmFjdE5ldHdvcmtQb3J0aW9uKCIxICg3MDApLjU1NS00MTQxIikKLSAgICAgICAgKTsKLQotICAgICAgICAvLyBUaGlzIG1heSBzZWVtIHdyb25nLCBidXQgaXQncyBwcm9iYWJseSBvawotICAgICAgICBhc3NlcnRFcXVhbHMoCi0gICAgICAgICAgICAgICAgIjE3MDA1NTU0MTQxKiMiLAotICAgICAgICAgICAgICAgIFBob25lTnVtYmVyVXRpbHMuZXh0cmFjdE5ldHdvcmtQb3J0aW9uKCIxICg3MDApLjU1NS00MTQxKiMiKQotICAgICAgICApOwotCi0gICAgICAgIGFzc2VydEVxdWFscygKLSAgICAgICAgICAgICAgICAiMTcwMDU1NTQxTk4iLAotICAgICAgICAgICAgICAgIFBob25lTnVtYmVyVXRpbHMuZXh0cmFjdE5ldHdvcmtQb3J0aW9uKCIxICg3MDApLjU1NS00MU5OIikKLSAgICAgICAgKTsKLQotICAgICAgICBhc3NlcnRFcXVhbHMoCi0gICAgICAgICAgICAgICAgIjE3MDA1NTU0MU5OIiwKLSAgICAgICAgICAgICAgICBQaG9uZU51bWJlclV0aWxzLmV4dHJhY3ROZXR3b3JrUG9ydGlvbigiMSAoNzAwKS41NTUtNDFOTiwxMjM0IikKLSAgICAgICAgKTsKLQotICAgICAgICBhc3NlcnRFcXVhbHMoCi0gICAgICAgICAgICAgICAgIjE3MDA1NTU0MU5OIiwKLSAgICAgICAgICAgICAgICBQaG9uZU51bWJlclV0aWxzLmV4dHJhY3ROZXR3b3JrUG9ydGlvbigiMSAoNzAwKS41NTUtNDFOTjsxMjM0IikKLSAgICAgICAgKTsKLQotICAgICAgICAvLyBBbiBNTUkgc3RyaW5nIGlzIHVucGVydGVyYmVkLCBldmVuIHRob3VnaCBpdCBjb250YWlucyBhCi0gICAgICAgIC8vICh2YWxpZCBpbiB0aGlzIGNhc2UpIGVtYmVkZGVkICsKLSAgICAgICAgYXNzZXJ0RXF1YWxzKAotICAgICAgICAgICAgICAgICIqKjIxKioxNzAwNTU1NDE0MSMiLAotICAgICAgICAgICAgICAgIFBob25lTnVtYmVyVXRpbHMuZXh0cmFjdE5ldHdvcmtQb3J0aW9uKCIqKjIxKiorMTcwMDU1NTQxNDEjIikKLSAgICAgICAgICAgICAgICAvL1RPRE8gdGhpcyBpcyB0aGUgY29ycmVjdCByZXN1bHQsIGFsdGhvdWdoIHRoZSBhYm92ZQotICAgICAgICAgICAgICAgIC8vcmVzdWx0IGhhcyBiZWVuIHJldHVybmVkIHNpbmNlIGNoYW5nZSAzMTc3NgotICAgICAgICAgICAgICAgIC8vIioqMjEqKisxNzAwNTU1NDE0MSMiCi0gICAgICAgICk7Ci0KLSAgICAgICAgYXNzZXJ0RXF1YWxzKCIiLCBQaG9uZU51bWJlclV0aWxzLmV4dHJhY3ROZXR3b3JrUG9ydGlvbigiIikpOwotCi0gICAgICAgIGFzc2VydEVxdWFscygiIiwgUGh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Ghyb3dzIEV4Y2VwdGlvbiB7Ci0gICAgICAgIGFzc2VydEVxdWFscygKLSAgICAgICAgICAgICAgICAiKzE3MDA1NTU0MTQxIiwKLSAgICAgICAgICAgICAgICBQaG9uZU51bWJlclV0aWxzLmV4dHJhY3ROZXR3b3JrUG9ydGlvbkFsdCgiKzE3MDA1NTU0MTQxIikKLSAgICAgICAgKTsKLQotICAgICAgICBhc3NlcnRFcXVhbHMoCi0gICAgICAgICAgICAgICAgIisxNzAwNTU1NDE0MSIsCi0gICAgICAgICAgICAgICAgUGhvbmVOdW1iZXJVdGlscy5leHRyYWN0TmV0d29ya1BvcnRpb25BbHQoIisxICg3MDApLjU1NS00MTQxIikKLSAgICAgICAgKTsKLQotICAgICAgICBhc3NlcnRFcXVhbHMoCi0gICAgICAgICAgICAgICAgIjE3MDA1NTU0MTQxIiwKLSAgICAgICAgICAgICAgICBQaG9uZU51bWJlclV0aWxzLmV4dHJhY3ROZXR3b3JrUG9ydGlvbkFsdCgiMSAoNzAwKS41NTUtNDE0MSIpCi0gICAgICAgICk7Ci0KLSAgICAgICAgLy8gVGhpcyBtYXkgc2VlbSB3cm9uZywgYnV0IGl0J3MgcHJvYmFibHkgb2sKLSAgICAgICAgYXNzZXJ0RXF1YWxzKAotICAgICAgICAgICAgICAgICIxNzAwNTU1NDE0MSojIiwKLSAgICAgICAgICAgICAgICBQaG9uZU51bWJlclV0aWxzLmV4dHJhY3ROZXR3b3JrUG9ydGlvbkFsdCgiMSAoNzAwKS41NTUtNDE0MSojIikKLSAgICAgICAgKTsKLQotICAgICAgICBhc3NlcnRFcXVhbHMoCi0gICAgICAgICAgICAgICAgIjE3MDA1NTU0MU5OIiwKLSAgICAgICAgICAgICAgICBQaG9uZU51bWJlclV0aWxzLmV4dHJhY3ROZXR3b3JrUG9ydGlvbkFsdCgiMSAoNzAwKS41NTUtNDFOTiIpCi0gICAgICAgICk7Ci0KLSAgICAgICAgYXNzZXJ0RXF1YWxzKAotICAgICAgICAgICAgICAgICIxNzAwNTU1NDFOTiIsCi0gICAgICAgICAgICAgICAgUGhvbmVOdW1iZXJVdGlscy5leHRyYWN0TmV0d29ya1BvcnRpb25BbHQoIjEgKDcwMCkuNTU1LTQxTk4sMTIzNCIpCi0gICAgICAgICk7Ci0KLSAgICAgICAgYXNzZXJ0RXF1YWxzKAotICAgICAgICAgICAgICAgICIxNzAwNTU1NDFOTiIsCi0gICAgICAgICAgICAgICAgUGhvbmVOdW1iZXJVdGlscy5leHRyYWN0TmV0d29ya1BvcnRpb25BbHQoIjEgKDcwMCkuNTU1LTQxTk47MTIzNCIpCi0gICAgICAgICk7Ci0KLSAgICAgICAgLy8gQW4gTU1JIHN0cmluZyBpcyB1bnBlcnRlcmJlZCwgZXZlbiB0aG91Z2ggaXQgY29udGFpbnMgYQotICAgICAgICAvLyAodmFsaWQgaW4gdGhpcyBjYXNlKSBlbWJlZGRlZCArCi0gICAgICAgIGFzc2VydEVxdWFscygKLSAgICAgICAgICAgICAgICAiKioyMSoqKzE3MDA1NTU0MTQxIyIsCi0gICAgICAgICAgICAgICAgUGhvbmVOdW1iZXJVdGlscy5leHRyYWN0TmV0d29ya1BvcnRpb25BbHQoIioqMjEqKisxNzAwNTU1NDE0MSMiKQotICAgICAgICApOwotCi0gICAgICAgIGFzc2VydEVxdWFscygKLSAgICAgICAgICAgICAgICAiKjMxIys0NDc5NjYxNjQyMDgiLAotICAgICAgICAgICAgICAgIFBob25lTnVtYmVyVXRpbHMuZXh0cmFjdE5ldHdvcmtQb3J0aW9uQWx0KCIqMzEjKzQ0Nzk2NjE2NDIwOCIpCi0gICAgICAgICk7Ci0KLSAgICAgICAgYXNzZXJ0RXF1YWxzKAotICAgICAgICAgICAgICAgICIqMzEjKzQ0Nzk2NjE2NDIwOCIsCi0gICAgICAgICAgICAgICAgUGhvbmVOdW1iZXJVdGlscy5leHRyYWN0TmV0d29ya1BvcnRpb25BbHQoIiozMSMgKCs0NCkgNzkgNjYxNiA0MjA4IikKLSAgICAgICAg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nKCJnZXRBbGxUZXN0cyBYIik7CisgICAgICAgIHJldHVybiBzdWl0ZTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgQ2xhc3NMb2FkZXIgZ2V0TG9hZGVyKCkgeworICAgICAgICBsb2coImdldExvYWRlciBFWCIpOworICAgICAgICByZXR1cm4gVGVsZXBob255TW9ja1JpbFRlc3RSdW5uZXIuY2xhc3MuZ2V0Q2xhc3NMb2FkZXIoKTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgdm9pZCBvbkNyZWF0ZShCdW5kbGUgaWNpY2xlKSB7CisgICAgICAgIGxvZygib25DcmVhdGUgRSIpOworICAgICAgICB0cnkgeworICAgICAgICAgICAgbU1vY2tSaWxDaGFubmVsID0gUmlsQ2hhbm5lbC5tYWtlUmlsQ2hhbm5lbCgpOworICAgICAgICB9IGNhdGNoIChJT0V4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAvLyBUT0RPIEF1dG8tZ2VuZXJhdGVkIGNhdGNoIGJsb2NrCisgICAgICAgICAgICBlLnByaW50U3RhY2tUcmFjZSgpOworICAgICAgICB9CisgICAgICAgIGxvZygib25DcmVhdGUgWCIpOworCisgICAgICAgIHN1cGVyLm9uQ3JlYXRlKGljaWNsZSk7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIHZvaWQgb25EZXN0cm95KCkgeworICAgICAgICAvLyBJJ3ZlIG5vdCBzZWVuIHRoaXMgY2FsbGVkCisgICAgICAgIGxvZygib25EZXN0cm95IEVYIik7CisgICAgICAgIHN1cGVyLm9uRGVzdHJveSgpOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIG9uU3RhcnQoKSB7CisgICAgICAgIC8vIENhbGxlZCB3aGVuIHRoZSBpbnN0cnVtZW50YXRpb24gdGhyZWFkIGlzIHN0YXJ0ZWQuCisgICAgICAgIC8vIEF0IHRoZSBtb21lbnQgd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HsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKAorICAgICAgICAgICAgICAgICIrMTcwMDU1NTQxNDEiLAorICAgICAgICAgICAgICAgIFBob25lTnVtYmVyVXRpbHMuZXh0cmFjdE5ldHdvcmtQb3J0aW9uKCIrMTcwMDU1NTQxNDEiKQorICAgICAgICApOworCisgICAgICAgIGFzc2VydEVxdWFscygKKyAgICAgICAgICAgICAgICAiKzE3MDA1NTU0MTQxIiwKKyAgICAgICAgICAgICAgICBQaG9uZU51bWJlclV0aWxzLmV4dHJhY3ROZXR3b3JrUG9ydGlvbigiKzEgKDcwMCkuNTU1LTQxNDEiKQorICAgICAgICApOworCisgICAgICAgIGFzc2VydEVxdWFscygKKyAgICAgICAgICAgICAgICAiMTcwMDU1NTQxNDEiLAorICAgICAgICAgICAgICAgIFBob25lTnVtYmVyVXRpbHMuZXh0cmFjdE5ldHdvcmtQb3J0aW9uKCIxICg3MDApLjU1NS00MTQxIikKKyAgICAgICAgKTsKKworICAgICAgICAvLyBUaGlzIG1heSBzZWVtIHdyb25nLCBidXQgaXQncyBwcm9iYWJseSBvaworICAgICAgICBhc3NlcnRFcXVhbHMoCisgICAgICAgICAgICAgICAgIjE3MDA1NTU0MTQxKiMiLAorICAgICAgICAgICAgICAgIFBob25lTnVtYmVyVXRpbHMuZXh0cmFjdE5ldHdvcmtQb3J0aW9uKCIxICg3MDApLjU1NS00MTQxKiMiKQorICAgICAgICApOworCisgICAgICAgIGFzc2VydEVxdWFscygKKyAgICAgICAgICAgICAgICAiMTcwMDU1NTQxTk4iLAorICAgICAgICAgICAgICAgIFBob25lTnVtYmVyVXRpbHMuZXh0cmFjdE5ldHdvcmtQb3J0aW9uKCIxICg3MDApLjU1NS00MU5OIikKKyAgICAgICAgKTsKKworICAgICAgICBhc3NlcnRFcXVhbHMoCisgICAgICAgICAgICAgICAgIjE3MDA1NTU0MU5OIiwKKyAgICAgICAgICAgICAgICBQaG9uZU51bWJlclV0aWxzLmV4dHJhY3ROZXR3b3JrUG9ydGlvbigiMSAoNzAwKS41NTUtNDFOTiwxMjM0IikKKyAgICAgICAgKTsKKworICAgICAgICBhc3NlcnRFcXVhbHMoCisgICAgICAgICAgICAgICAgIjE3MDA1NTU0MU5OIiwKKyAgICAgICAgICAgICAgICBQaG9uZU51bWJlclV0aWxzLmV4dHJhY3ROZXR3b3JrUG9ydGlvbigiMSAoNzAwKS41NTUtNDFOTjsxMjM0IikKKyAgICAgICAgKTsKKworICAgICAgICAvLyBBbiBNTUkgc3RyaW5nIGlzIHVucGVydGVyYmVkLCBldmVuIHRob3VnaCBpdCBjb250YWlucyBhCisgICAgICAgIC8vICh2YWxpZCBpbiB0aGlzIGNhc2UpIGVtYmVkZGVkICsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKAorICAgICAgICAgICAgICAgICIqKjIxKioxNzAwNTU1NDE0MSMiLAorICAgICAgICAgICAgICAgIFBob25lTnVtYmVyVXRpbHMuZXh0cmFjdE5ldHdvcmtQb3J0aW9uKCIqKjIxKiorMTcwMDU1NTQxNDEjIikKKyAgICAgICAgICAgICAgICAvL1RPRE8gdGhpcyBpcyB0aGUgY29ycmVjdCByZXN1bHQsIGFsdGhvdWdoIHRoZSBhYm92ZQorICAgICAgICAgICAgICAgIC8vcmVzdWx0IGhhcyBiZWVuIHJldHVybmVkIHNpbmNlIGNoYW5nZSAzMTc3NgorICAgICAgICAgICAgICAgIC8vIioqMjEqKisxNzAwNTU1NDE0MSMiCisgICAgICAgICk7CisKKyAgICAgICAgYXNzZXJ0RXF1YWxzKCIiLCBQaG9uZU51bWJlclV0aWxzLmV4dHJhY3ROZXR3b3JrUG9ydGlvbigiIikpOworCisgICAgICAgIGFzc2VydEVxdWFscygiIiwgUGhvbmVOdW1iZXJVdGlscy5leHRyYWN0TmV0d29ya1BvcnRpb24oIiwxMjM0IikpOworCisgICAgICAgIGJ5dGUgW10gYiA9IG5ldyBieXRlWzIwXTsKKyAgICAgICAgYlswXSA9IChieXRlKSAweDgxOyBiWzF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CisgICAgICAgICAgICAgICAgIisxNzAwNTU1NDE0MSIsCisgICAgICAgICAgICAgICAgUGhvbmVOdW1iZXJVdGlscy5leHRyYWN0TmV0d29ya1BvcnRpb25BbHQoIisxICg3MDApLjU1NS00MTQxIikKKyAgICAgICAgKTsKKworICAgICAgICBhc3NlcnRFcXVhbHMoCisgICAgICAgICAgICAgICAgIjE3MDA1NTU0MTQxIiwKKyAgICAgICAgICAgICAgICBQaG9uZU51bWJlclV0aWxzLmV4dHJhY3ROZXR3b3JrUG9ydGlvbkFsdCgiMSAoNzAwKS41NTUtNDE0MSIpCisgICAgICAgICk7CisKKyAgICAgICAgLy8gVGhpcyBtYXkgc2VlbSB3cm9uZywgYnV0IGl0J3MgcHJvYmFibHkgb2sKKyAgICAgICAgYXNzZXJ0RXF1YWxzKAorICAgICAgICAgICAgICAgICIxNzAwNTU1NDE0MSojIiwKKyAgICAgICAgICAgICAgICBQaG9uZU51bWJlclV0aWxzLmV4dHJhY3ROZXR3b3JrUG9ydGlvbkFsdCgiMSAoNzAwKS41NTUtNDE0MSojIikKKyAgICAgICAgKTsKKworICAgICAgICBhc3NlcnRFcXVhbHMoCisgICAgICAgICAgICAgICAgIjE3MDA1NTU0MU5OIiwKKyAgICAgICAgICAgICAgICBQaG9uZU51bWJlclV0aWxzLmV4dHJhY3ROZXR3b3JrUG9ydGlvbkFsdCgiMSAoNzAwKS41NTUtNDFOTiIpCisgICAgICAgICk7CisKKyAgICAgICAgYXNzZXJ0RXF1YWxzKAorICAgICAgICAgICAgICAgICIxNzAwNTU1NDFOTiIsCisgICAgICAgICAgICAgICAgUGhvbmVOdW1iZXJVdGlscy5leHRyYWN0TmV0d29ya1BvcnRpb25BbHQoIjEgKDcwMCkuNTU1LTQxTk4sMTIzNCIpCisgICAgICAgICk7CisKKyAgICAgICAgYXNzZXJ0RXF1YWxzKAorICAgICAgICAgICAgICAgICIxNzAwNTU1NDFOTiIsCisgICAgICAgICAgICAgICAgUGhvbmVOdW1iZXJVdGlscy5leHRyYWN0TmV0d29ya1BvcnRpb25BbHQoIjEgKDcwMCkuNTU1LTQxTk47MTIzNCIpCisgICAgICAgICk7CisKKyAgICAgICAgLy8gQW4gTU1JIHN0cmluZyBpcyB1bnBlcnRlcmJlZCwgZXZlbiB0aG91Z2ggaXQgY29udGFpbnMgYQorICAgICAgICAvLyAodmFsaWQgaW4gdGhpcyBjYXNlKSBlbWJlZGRlZCArCisgICAgICAgIGFzc2VydEVxdWFscygKKyAgICAgICAgICAgICAgICAiKioyMSoqKzE3MDA1NTU0MTQxIyIsCisgICAgICAgICAgICAgICAgUGhvbmVOdW1iZXJVdGlscy5leHRyYWN0TmV0d29ya1BvcnRpb25BbHQoIioqMjEqKisxNzAwNTU1NDE0MSMiKQorICAgICAgICApOworCisgICAgICAgIGFzc2VydEVxdWFscygKKyAgICAgICAgICAgICAgICAiKjMxIys0NDc5NjYxNjQyMDgiLAorICAgICAgICAgICAgICAgIFBob25lTnVtYmVyVXRpbHMuZXh0cmFjdE5ldHdvcmtQb3J0aW9uQWx0KCIqMzEjKzQ0Nzk2NjE2NDIwOCIpCisgICAgICAgICk7CisKKyAgICAgICAgYXNzZXJ0RXF1YWxzKAorICAgICAgICAgICAgICAgICIqMzEjKzQ0Nzk2NjE2NDIwOCIsCisgICAgICAgICAgICAgICAgUGhvbmVOdW1iZXJVdGlscy5leHRyYWN0TmV0d29ya1BvcnRpb25BbHQoIiozMSMgKCs0NCkgNzkgNjYxNiA0MjA4IikKKyAgICAgICAgKTsKKworICAgICAgICBhc3NlcnRFcXVhbHMoIiIsIFBob25lTnVtYmVyVXRpbHMuZXh0cmFjdE5ldHdvcmtQb3J0aW9uQWx0KCIiKSk7CisKKyAgICAgICAgYXNzZXJ0RXF1YWxzKCIiLCBQaG9uZU51bWJlclV0aWxzLmV4dHJhY3ROZXR3b3JrUG9ydGlvbkFsdCgiLDEyMzQiKSk7CisKKyAgICAgICAgYXNzZXJ0TnVsbChQaG9uZU51bWJlclV0aWxzLmV4d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wRm9ybWF0dGluZygpIHsKKyAgICAgICAgU3Bhbm5hYmxlU3RyaW5nQnVpbGRlciBudW1iZXIgPSBuZXcgU3Bhbm5hYmxlU3RyaW5nQnVpbGRlcigpOworICAgICAgICBudW1iZXIuYXBwZW5kKCI4MDA1NTUxMjEyIik7CisgICAgICAgIFBob25lTnVtYmVyVXRpbHMuZm9ybWF0TmFucE51bWJlcihudW1iZXIpOworICAgICAgICBhc3NlcnRFcXVhbHMoIjgwMC01NTUtMTIxMiIsIG51bWJlci50b1N0cmluZygpKTsKKworICAgICAgICBudW1iZXIuY2xlYXIoKTsKKyAgICAgICAgbnVtYmVyLmFwcGVuZCgiODAwNTU1MTIxIik7CisgICAgICAgIFBob25lTnVtYmVyVXRpbHMuZm9ybWF0TmFucE51bWJlcihudW1iZXIpOworICAgICAgICBhc3NlcnRFcXVhbHMoIjgwMC01NTUtMTIxIiwgbnVtYmVyLnRvU3RyaW5nKCkpOworCisgICAgICAgIG51bWJlci5jbGVhcigpOworICAgICAgICBudW1iZXIuYXBwZW5kKCI1NTUtMTIxMiIpOworICAgICAgICBQaG9uZU51bWJlclV0aWxzLmZvcm1hdE5hbnBOdW1iZXIobnVtYmVyKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKCI1NTUtMTIxMiIsIG51bWJlci50b1N0cmluZygpKTsKKworICAgICAgICBudW1iZXIuY2xlYXIoKTsKKyAgICAgICAgbnVtYmVyLmFwcGVuZCgiODAwLTU1NTEyIik7CisgICAgICAgIFBob25lTnVtYmVyVXRpbHMuZm9ybWF0TmFucE51bWJlcihudW1iZXIpOworICAgICAgICBhc3NlcnRFcXVhbHMoIjgwMC01NTUtMTIiLCBudW1iZXIudG9TdHJpbmcoKSk7CisKKyAgICAgICAgbnVtYmVyLmNsZWFyKCk7CisgICAgICAgIG51bWJlci5hcHBlbmQoIjQ2NjQ1Iik7CisgICAgICAgIFBob25lTnVtYmVyVXRpbHMuZm9ybWF0TmFucE51bWJlcihudW1iZXIpOworICAgICAgICBhc3NlcnRFcXVhbHMoIjQ2NjQ1IiwgbnVtYmVyLnRvU3RyaW5nKCkpOworICAgIH0KKworICAgIEBTbWFsbFRlc3QKKyAgICBwdWJsaWMgdm9pZCB0ZXN0Q29udmVydEtleXBhZExldHRlcnNUb0RpZ2l0cygpIHsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKCIxLTgwMC00NjY0LTQxMSIsCisgICAgICAgICAgICAgICAgICAgICBQaG9uZU51bWJlclV0aWxzLmNvbnZlcnRLZXlwYWRMZXR0ZXJzVG9EaWdpdHMoIjEtODAwLUdPT0ctNDExIikpOworICAgICAgICBhc3NlcnRFcXVhbHMoIjE4MDA0NjY0NDExIiwKKyAgICAgICAgICAgICAgICAgICAgIFBob25lTnVtYmVyVXRpbHMuY29udmVydEtleXBhZExldHRlcnNUb0RpZ2l0cygiMTgwMEdPT0c0MTEiKSk7CisgICAgICAgIGFzc2VydEVxdWFscygiMS04MDAtNDY2LTQ0MTEiLAorICAgICAgICAgICAgICAgICAgICAgUGhvbmVOdW1iZXJVdGlscy5jb252ZXJ0S2V5cGFkTGV0dGVyc1RvRGlnaXRzKCIxLTgwMC00NjYtNDQxMSIpKTsKKyAgICAgICAgYXNzZXJ0RXF1YWxzKCIxODAwNDY2NDQxMSIsCisgICAgICAgICAgICAgICAgICAgICBQaG9uZU51bWJlclV0aWxzLmNvbnZlcnRLZXlwYWRMZXR0ZXJzVG9EaWdpdHMoIjE4MDA0NjY0NDExIikpOworICAgICAgICBhc3NlcnRFcXVhbHMoIjIyMi0zMzMtNDQ0LTU1NS02NjYtNzc3Ny04ODgtOTk5OSIsCisgICAgICAgICAgICAgICAgICAgICBQaG9uZU51bWJlclV0aWxzLmNvbnZlcnRLZXlwYWRMZXR0ZXJzVG9EaWdpdHMoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJBQkMtREVGLUdISS1KS0wtTU5PLVBRUlMtVFVWLVdYWVoiKSk7CisgICAgICAgIGFzc2VydEVxdWFscygiMjIy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gpKSwKKyAgICAgICAgICAgICAgICBycy5nZXRTdGF0ZSgpID09IDEpOworCisgICAgICAgIGJ5dGVbXSByc19zZXIgPSBycy50b0J5dGVBcnJheSgpOworICAgICAgICBSaWxDdHJsQ21kcy5DdHJsUnNwUmFkaW9TdGF0ZSByc05ldyA9IFJpbEN0cmxDbWRzLkN0cmxSc3BSYWRpb1N0YXRlLnBhcnNlRnJvbShyc19zZXIpOworICAgICAgICBhc3NlcnRUcnVlKFN0cmluZy5mb3JtYXQoImV4cGVjdGVkIHJzTmV3LnN0YXRlID09IDEgd2FzICVkIiwgcnMuZ2V0U3RhdGUoKSksCisgICAgICAgICAgICAgICAgcnMuZ2V0U3RhdGUoKSA9PSAxKTsKKworICAgICAgICBsb2coInRlc3RQcm90b2J1ZlNlcmRlcyBYIik7CisgICAgfQorCisgICAgLyoqCisgICAgICogVGVzdCBlY2hvIGNvbW1hbmQgd29ya3MgdXNpbmcgd3JpdGVNc2cgJiByZWFkTXNnCisgICAgICovCisgICAgcHVibGljIHZvaWQgdGVzdEVjaG9Nc2coKSB0aHJvd3MgSU9FeGNlcHRpb24geworICAgICAgICBsb2coInRlc3RFY2hvTXNnIEUiKTsKKworICAgICAgICBNc2dIZWFkZXIgbWggPSBuZXcgTXNnSGVhZGVyKCk7CisgICAgICAgIG1oLnNldENtZCgwKTsKKyAgICAgICAgbWguc2V0VG9rZW4oMSk7CisgICAgICAgIG1oLnNldFN0YXR1cygyKTsKKyAgICAgICAgQnl0ZUJ1ZmZlciBkYXRhID0gQnl0ZUJ1ZmZlci5hbGxvY2F0ZSgzKTsKKyAgICAgICAgZGF0YS5wdXQoKGJ5dGUpMyk7CisgICAgICAgIGRhdGEucHV0KChieXRlKTQpOworICAgICAgICBkYXRhLnB1dCgoYnl0ZSk1KTsKKyAgICAgICAgTXNnLnNlbmQobU1vY2tSaWxDaGFubmVsLCBtaCwgZGF0YSk7CisKKyAgICAgICAgTXNnIHJlc3BNc2cgPSBNc2cucmVjdihtTW9ja1JpbENoYW5uZWwpOworICAgICAgICBhc3NlcnRUcnVlKFN0cmluZy5mb3JtYXQoImV4cGVjdGVkIG1oZC5oZWFkZXIuY21kID09IDAgd2FzICVkIixyZXNwTXNnLmdldENtZCgpKSwKKyAgICAgICAgICAgICAgICByZXNwTXNnLmdldENtZCgpID09IDApOworICAgICAgICBhc3NlcnRUcnVlKFN0cmluZy5mb3JtYXQoImV4cGVjdGVkIG1oZC5oZWFkZXIudG9rZW4gPT0gMSB3YXMgJWQiLHJlc3BNc2cuZ2V0VG9rZW4oKSksCisgICAgICAgICAgICAgICAgcmVzcE1zZy5nZXRUb2tlbigpID09IDEpOworICAgICAgICBhc3NlcnRUcnVlKFN0cmluZy5mb3JtYXQoImV4cGVjdGVkIG1oZC5oZWFkZXIuc3RhdHVzID09IDIgd2FzICVkIiwgcmVzcE1zZy5nZXRTdGF0dXMoKSksCisgICAgICAgICAgICAgICAgcmVzcE1zZy5nZXRTdGF0dXMoKSA9PSAyKTsKKyAgICAgICAgYXNzZXJ0VHJ1ZShTdHJpbmcuZm9ybWF0KCJleHBlY3RlZCBtaGQuZGF0YVswXSA9PSAzIHdhcyAlZCIsIHJlc3BNc2cuZ2V0RGF0YSgwKSksCisgICAgICAgICAgICAgICAgcmVzcE1zZy5nZXREYXRhKDApID09IDMpOworICAgICAgICBhc3NlcnRUcnVlKFN0cmluZy5mb3JtYXQoImV4cGVjdGVkIG1oZC5kYXRhWzFdID09IDQgd2FzICVkIiwgcmVzcE1zZy5nZXREYXRhKDEpKSwKKyAgICAgICAgICAgICAgICByZXNwTXNnLmdldERhdGEoMSkgPT0gNCk7CisgICAgICAgIGFzc2VydFRydWUoU3RyaW5nLmZvcm1hdCgiZXhwZWN0ZWQgbWhkLmRhdGFbMl0gPT0gNSB3YXMgJWQiLCByZXNwTXNnLmdldERhdGEoMikpLAorICAgICAgICAgICAgICAgIHJlc3BNc2cuZ2V0RGF0YSgyKSA9PSA1KTsKKworICAgICAgICBsb2coInRlc3RFY2hvT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ICAgICAgY29tcGxldGVkTG9hZGVyLnN0b3BMb2FkaW5nKCk7CisgICAgICAgICAgICAgICAgY29tcGxldGVkTG9hZGVyLmRlc3Ryb3koKTsKKworICAgICAgICAgICAgICAgIC8vIFN0b3JlIHRoZSByZXN1bHQsIHVuYmxvY2tpbmcgdGhlIHRlc3QgdGhyZWFkCisgICAgICAgICAgICAgICAgcXVldWUuYWRkKGRhdGEpOworICAgICAgICAgICAgfQorICAgICAgICB9OworCisgICAgICAgIC8vIFRoaXMgaGFuZGxlciBydW5zIG9uIHRoZSAibWFpbiIgdGhyZWFkIG9mIHRoZSBwcm9jZXNzIHNpbmNlIEFzeW5jVGFzaworICAgICAgICAvLyBpcyBkb2N1bWVudGVkIGFzIG5lZWRpbmcgdG8gcnVuIG9uIHRoZSBtYWluIHRocmVhZCBhbmQgbWFueSBMb2FkZXJzIHVzZQorICAgICAgICAvLyBBc3luY1Rhc2sKKyAgICAgICAgZmluYWwgSGFuZGxlciBtYWluVGhyZWFkSGFuZGxlciA9IG5ldyBIYW5kbGVyKExvb3Blci5nZXRNYWluTG9vcGVyKCkpIHsKKyAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgcHVibGljIHZvaWQgaGFuZGxlTWVzc2FnZShNZXNzYWdlIG1zZykgeworICAgICAgICAgICAgICAgIGxvYWRlci5yZWdpc3Rlckxpc3RlbmVyKDAsIGxpc3RlbmVyKTsKKyAgICAgICAgICAgICAgICBsb2FkZXIuc3RhcnRMb2FkaW5nKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH07CisKKyAgICAgICAgLy8gQXNrIHRoZSBtYWluIHRocmVhZCB0byBzdGFydCB0aGUgbG9hZGluZyBwcm9jZXNzCisgICAgICAgIG1haW5UaHJlYWRIYW5kbGVyLnNlbmRFbXB0eU1lc3NhZ2UoMCk7CisKKyAgICAgICAgLy8gQmxvY2sgb24gdGhlIHF1ZXVlIHdhaXRpbmcgZm9yIHRoZSByZXN1bHQgb2YgdGhlIGxvY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gICAgIHB1YmxpYyBSZXNvdXJjZXMgZ2V0UmVzb3VyY2VzKCkgewpAQCAtODcsNiArODcsMTEgQEAKICAgICAgICAgICAgIC8vIG9uZSBjcmVhdGVkIHRocm91Z2ggdGhlIHJlZ3VsYXIgQ29udGV4dAogICAgICAgICAgICAgcmV0dXJuIGdldENvbnRleHQoKS5nZXREaXIoIm1vY2tjb250ZXh0Ml8iICsgbmFtZSwgbW9kZSk7CiAgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIENvbnRleHQgZ2V0QXBwbGljYXRpb25Db250ZXh0KCkgeworICAgICAgICAgICAgcmV0dXJuIHRoaXM7CisgICAgICAgIH0KICAgICB9CiAgICAgLyoqCiAgICAgICogQ29uc3RydWN0b3IuCkBAIC0xNDEsNiArMTQ2LDE4IEBACiAgICAgfQogCiAgICAgLyoqCisgICAgICogVGVhcnMgZG93biB0aGUgZW52aXJvbm1lbnQgZm9yIHRoZSB0ZXN0IGZpeHR1cmUuCisgICAgICogPHA+CisgICAgICogQ2FsbHMge0BsaW5rIGFuZHJvaWQuY29udGVudC5Db250ZW50UHJvdmlkZXIjc2h1dGRvd24oKX0gb24gdGhlCisgICAgICoge0BsaW5rIGFuZHJvaWQuY29udGVudC5Db250ZW50UHJvdmlkZXJ9IHJlcHJlc2VudGVkIGJ5IG1Qcm92aWRlci4KKyAgICAgKi8KKyAgICBAT3ZlcnJpZGUKKyAgICBwcm90ZWN0ZWQgdm9pZCB0ZWFyRG93bigpIHRocm93cyBFeGNlcHRpb24geworICAgICAgICBtUHJvdmlkZXIuc2h1dGRvd24oKTsKKyAgICAgICAgc3VwZXIudGVhckRvd24oKTsKKyAgICB9CisKKyAgICAvKioKICAgICAgKiBHZXRzIHRoZSB7QGxpbmsgTW9ja0NvbnRlbnRSZXNvbHZlcn0gY3JlYXRlZCBieSB0aGlzIGNsYXNzIGR1cmluZyBpbml0aWFsaXphdGlvbi4gWW91CiAgICAgICogbXVzdCB1c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3IEBACiAgICAgICAgIGZvciAoU3RyaW5nIHBhY2thZ2VOYW1lIDogcGFja2FnZU5hbWVzKSB7CiAgICAgICAgICAgICBMaXN0PENsYXNzPD8gZXh0ZW5kcyBUZXN0Q2FzZT4+IGFkZGVkQ2xhc3NlcyA9IHRlc3RDYXNlQ2xhc3Nlc0luUGFja2FnZShwYWNrYWdlTmFtZSk7CiAgICAgICAgICAgICBpZiAoYWRkZWRDbGFzc2VzLmlzRW1wdHkoKSkgewotICAgICAgICAgICAgICAgIExvZy53KCJUZXN0R3JvdXBpbmciLCAiSW52YWxpZCBQYWNrYWdlOiAnIiArIHBhY2thZ2VOYW1lCisgICAgICAgICAgICAgICAgTG9nLncoTE9HX1RBRywgIkludmFsaWQgUGFja2FnZTogJyIgKyBwYWNrYWdlTmFtZQogICAgICAgICAgICAgICAgICAgICAgICAgKyAiJyBjb3VsZCBub3QgYmUgZm91bmQgb3IgaGFzIG5vIHRlc3RzIik7CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICB0ZXN0Q2FzZUNsYXNzZXMuYWRkQWxsKGFkZGVkQ2xhc3Nlcyk7CkBAIC0yMzQsNiArMjM2LDEwIEBACiAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICB9CisgICAgICAgICAgICBMb2cuaShMT0dfVEFHLCBTdHJpbmcuZm9ybWF0KAorICAgICAgICAgICAgICAgICAgICAiVGVzdENhc2UgY2xhc3MgJXMgaXMgbWlzc2luZyBhIHB1YmxpYyBjb25zdHJ1Y3RvciB3aXRoIG5vIHBhcmFtZXRlcnMgIiArCisgICAgICAgICAgICAgICAgICAgICJvciBhIHNpbmdsZSBTdHJpbmcgcGFyYW1ldGVyIC0gc2tpcHBpbmciLAorICAgICAgICAgICAgICAgICAgICBhQ2xhc3MuZ2V0TmFtZSgpKSk7CiAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgIH0KICAgICB9CmRpZmYgLS1naXQgYS90Z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0gNDQ7CisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IExBWU9VVF9EVU1QX0NISUxEX0ZSQU1FU19URVhUID0gNDU7CisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IFNFVF9YU1NfQVVESVRPUl9FTkFCTEVEID0gNDY7CiAgICAgCiAgICAgQ2FsbGJhY2tQcm94eShFdmVudFNlbmRlciBldmVudFNlbmRlciwgCiAgICAgICAgICAgICBMYXlvdXRUZXN0Q29udHJvbGxlciBsYXlvdXRUZXN0Q29udHJvbGxlcikgewpAQCAtMTc1LDcgKzE3NywxMSBAQAogICAgICAgICAgICAgYnJlYWs7CiAKICAgICAgICAgY2FzZSBMQVlPVVRfRFVNUF9URVhUOgotICAgICAgICAgICAgbUxheW91dFRlc3RDb250cm9sbGVyLmR1bXBBc1RleHQoKTsKKyAgICAgICAgICAgIG1MYXlvdXRUZXN0Q29udHJvbGxlci5kdW1wQXNUZXh0KG1zZy5hcmcxID09IDEpOworICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgY2FzZSBMQVlPVVRfRFVNUF9DSElMRF9GUkFNRVNfVEVYVDoKKyAgICAgICAgICAgIG1MYXlvdXRUZXN0Q29udHJvbGxlci5kdW1wQ2hpbGRGcmFtZXNBc1RleHQoKTsKICAgICAgICAgICAgIGJyZWFrOwogCiAgICAgICAgIGNhc2UgTEFZT1VUX0RVTVBfSElTVE9SWToKQEAgLTI3Myw2ICsyNzksMTAgQEAKICAgICAgICAgICAgIGJvb2xlYW4gdmFsdWUgPSBtc2cuZ2V0RGF0YSgpLmdldEJvb2xlYW4oInZhbHVlIik7CiAgICAgICAgICAgICBtTGF5b3V0VGVzdENvbnRyb2xsZXIub3ZlcnJpZGVQcmVmZXJlbmNlKGtleSwgdmFsdWUpOwogICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgY2FzZSBTRVRfWFNTX0FVRElUT1JfRU5BQkxFRDoKKyAgICAgICAgICAgIG1MYXlvdXRUZX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AgIHRlc3RDb3VudCArPSB3cml0ZUxheW91dFRlc3RMaXN0UmVjdXJzaXZlbHkoYm9zLCBzLCBpZ25vcmVSZXN1bHRzSW5EaXIpOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgIH0KQEAgLTc5LDcgKzg0LDkgQEAKICAgICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgIH0KIAotICAgICAgICAgICAgaWYgKChzLnRvTG93ZXJDYXNlKCkuZW5kc1dpdGgoIi5odG1sIikgfHwgcy50b0xvd2VyQ2FzZSgpLmVuZHNXaXRoKCIueG1sIikpCisgICAgICAgICAgICBpZiAoKHMudG9Mb3dlckNhc2UoKS5lbmRzV2l0aCgiLmh0bWwiKQorICAgICAgICAgICAgICAgICAgICB8fCBzLnRvTG93ZXJDYXNlKCkuZW5kc1dpdGgoIi54bWwiKQorICAgICAgICAgICAgICAgICAgICB8fCBzLnRvTG93ZXJDYXNlKCkuZW5kc1dpdGgoIi54aHRtbCIpKQogICAgICAgICAgICAgICAgICAgICAmJiAhcy5lbmRzV2l0aCgiVEVNUExBVEUuaHRtbCIpKSB7CiAgICAgICAgICAgICAgICAgTG9nLnYoTE9HVEFHLCAiUmVjb3JkaW5nICIgKyBzKTsKICAgICAgICAgICAgICAgICBib3Mud3JpdGUocy5nZXRCeXRlcygpKTsKQEAgLTg4LDggKzk1LDEwIEBACiAgICAgICAgICAgICAgICAgICAgIGJvcy53cml0ZSgoIiBJR05PUkVfUkVTVUxUIikuZ2V0Qnl0ZXMoKSk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIGJvcy53cml0ZSgnXG4nKTsKKyAgICAgICAgICAgICAgICB0ZXN0Q291bnQrKzsKICAgICAgICAgICAgIH0KICAgICAgICAgfQorICAgICAgICByZXR1cm4gdGVzdENvdW50OwogICAgIH0KIAogICAgIHB1YmxpYyBzdGF0aWMgdm9pZCB1cGRhdGVUZXN0U3Rhd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b0ZpbGUobVNhdmVJbWFnZVBhdGggKyAiLyIgKyBuYW1lICsgIi5wbmciLCBtV2ViVmlldyk7CiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQorCiAgICAgICAgICAgICAvLyBDYWxsaW5nIGZpbmlzaGVkKCkgd2lsbCBjaGVjayBpZiB3ZSd2ZSBtZXQgYWxsIHRoZSBjb25kaXRpb25zIGZvciBjb21wbGV0aW5nCi0gICAgICAgICAgICAvLyB0aGlzIHRlc3QgYW5kIG1vdmUgdG8gdGhlIG5leHQgb25lIGlmIHdlIGFyZSByZWFkeS4KKyAgICAgICAgICAgIC8vIHRoaXMgdGVzdCBhbmQgbW92ZSB0byB0aGUgbmV4dCBvbmUgaWYgd2UgYXJlIHJlYWR5LiBPdGhlcndpc2Ugd2UgYXNrIFdlYkNvcmUgdG8KKyAgICAgICAgICAgIC8vIGR1bXAgdGhlIHBhZ2UuCiAgICAgICAgICAgICBpZiAoZmluaXNoZWQoKSkgewogICAgICAgICAgICAgICAgIHJldHVybjsKICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKCFtV2FpdFVudGlsRG9uZSAmJiAhbVJlcXVlc3RlZFdlYktpdERhdGEgJiYgIW1UaW1lZE91dCkgeworICAgICAgICAgICAgICAgIHJlcXVlc3RXZWJLaXREYXRhKCk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGlmIChtV2FpdFVudGlsRG9uZSkgeworICAgICAgICAgICAgICAgICAgICBMb2cudihMT0dUQUcsICJwYWdlIGZpbmlzaGVkIGxvYWRpbmcgYnV0IHdhaXRpbmcgZm9yIG5vdGlmeURvbmUgdG8gYmUgY2FsbGVkOiAiICsgdXJsKTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBpZiAobVJlcXVlc3RlZFdlYktpdERhdGEpIHsKKyAgICAgICAgICAgICAgICAgICAgTG9nLnYoTE9HVEFHLCAicGFnZSBmaW5pc2hlZCBsb2FkaW5n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gICAgICAgICAvLyBXZWJDb3JlIG9yIG5vdGlmeURvbmUuCi0gICAgICAgICAgICBpZiAobmV3UHJvZ3Jlc3MgPj0gMTAwKSB7Ci0gICAgICAgICAgICAgICAgLy8gZmluaXNoZWQoKSB3aWxsIGNoZWNrIGlmIHdlIGFyZSByZWFkeSB0byBtb3ZlIHRvIHRoZSBuZXh0IHRlc3QgYW5kIGRvIHNvIGlmIHdlIGFyZS4KLSAgICAgICAgICAgICAgICBpZiAoZmluaXNoZWQoKSkgewotICAgICAgICAgICAgICAgICAgICByZXR1cm47Ci0gICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgaWYgKCFtVGltZWRPdXQgJiYgIW1XYWl0VW50aWxEb25lICYmICFtUmVxdWVzdGVkV2ViS2l0RGF0YSkgewotICAgICAgICAgICAgICAgICAgICBTdHJpbmcgdXJsID0gbVdlYlZpZXcuZ2V0VXJsKCk7Ci0gICAgICAgICAgICAgICAgICAgIExvZy52KExPR1RBRywgIkZpbmlzaGVkOiAiKyB1cmwpOwotICAgICAgICAgICAgICAgICAgICByZXF1ZXN0V2ViS2l0RGF0YSgpOwotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIFN0cmluZyB1cmwgPSBtV2ViVmlldy5nZXRVcmwoKTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKG1UaW1lZE91dCkgewotICAgICAgICAgICAgICAgICAgICAgICAgTG9nLnYoTE9HVEFHLCAiVGltZWQgb3V0IGJlZm9yZSBmaW5pc2hpbmc6ICIgKyB1cmwpOwotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKG1XYWl0VW50aWxEb25lKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBMb2cudihMT0dUQUcsICJXYWl0aW5nIGZvciBub3RpZnlEb25lOiAiICsgdXJsKTsKLSAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChtUmVxdWVzdGVkV2ViS2l0RGF0YSkgewotICAgICAgICAgICAgICAgICAgICAgICAgTG9nLnYoTE9HVEFHLCAiUmVxdWVzdGVkIHdlYmtpdCBkYXRhIHJlYWR5OiAiICsgdXJsKTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotCi0gICAgICAgIEBPdmVycmlkZQogICAgICAgICBwdWJsaWMgdm9pZCBvblJlY2VpdmVkVGl0bGUoV2ViVmlldyB2aWV3LCBTdHJpbmcgdGl0bGUpIHsKLSAgICAgICAgICAgIGlmICh0aXRsZS5sZW5ndGgoKSA+IDMwKQotICAgICAgICAgICAgICAgIHRpdGxlID0gIi4uLiIrdGl0bGUuc3Vic3RyaW5nKHRpdGxlLmxlbmd0aCgpLTMwKTsKLSAgICAgICAgICAgIHNldFRpdGxlKHRpdGxlKTsKKyAgICAgICAgICAgIHNldFRpdGxlKCJUZXN0ICIgKyBtQ3VycmVudFRlc3ROdW1iZXIgKyAiIG9mICIgKyBtVG90YWxUZXN0Q291bnQgKyAiOiAiKyB0aXRsZSk7CiAgICAgICAgICAgICBpZiAobUR1bXBUaXRsZUNoYW5nZXMpIHsKICAgICAgICAgICAgICAgICBtVGl0bGVDaGFuZ2VzLmFwcGVuZCgiVElUTEUgQ0hBTkdFRDogIik7CiAgICAgICAgICAgICAgICAgbVRpdGxlQ2hhbmdlcy5hcHBlbmQodGl0bGUpOwpAQCAtNjcwLDIxICs3MDksNDAgQEAKICAgICAgICAgQE92ZXJyaWRlCiAgICAgICAgIHB1YmxpYyB2b2lkIG9uR2VvbG9jYXRpb25QZXJtaXNzaW9uc1Nob3dQcm9tcHQoU3RyaW5nIG9yaWdpbiwKICAgICAgICAgICAgICAgICBHZW9sb2NhdGlvblBlcm1pc3Npb25zLkNhbGxiYWNrIGNhbGxiYWNrKSB7Ci0gICAgICAgICAgICBpZiAobUdlb2xvY2F0aW9uUGVybWlzc2lvblNldCkgeworICAgICAgICAgICAgaWYgKG1Jc0dlb2xvY2F0aW9uUGVybWlzc2lvblNldCkgewogICAgICAgICAgICAgICAgIGNhbGxiYWNrLmludm9rZShvcmlnaW4sIG1HZW9sb2NhdGlvblBlcm1pc3Npb24sIGZhbHNlKTsKKyAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAobVBlbmRpbmdHZW9sb2NhdGlvblBlcm1pc3Npb25DYWxsYmFja3MgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIG1QZW5kaW5nR2VvbG9jYXRpb25QZXJtaXNzaW9uQ2FsbGJhY2tzID0KKyAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBIYXNoTWFwPEdlb2xvY2F0aW9uUGVybWlzc2lvbnMuQ2FsbGJhY2ssIFN0cmluZz4oKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1QZW5kaW5nR2VvbG9jYXRpb25QZXJtaXNzaW9uQ2FsbGJhY2tzLnB1dChjYWxsYmFjaywgb3JpZ2luKTsKICAgICAgICAgfQogCiAgICAgICAgIEBPdmVycmlkZQotICAgICAgICBwdWJsaWMgdm9pZCBvbkNvbnNvbGVNZXNzYWdlKFN0cmluZyBtZXNzYWdlLCBpbnQgbGluZU51bWJlciwKLSAgICAgICAgICAgICAgICBTdHJpbmcgc291cmNlSUQpIHsKKyAgICAgICAgcHVibGljIGJvb2xlYW4gb25Db25zb2xlTWVzc2FnZShDb25zb2xlTWVzc2FnZSBjb25zb2xlTWVzc2FnZSkgeworICAgICAgICAgICAgU3RyaW5nIG1zZyA9ICJDT05TT0xFIE1FU1NBR0U6IGxpbmUgIiArIGNvbnNvbGVNZXNzYWdlLmxpbmVOdW1iZXIoKSArICI6ICIKKyAgICAgICAgICAgICAgICAgICAgKyBjb25zb2xlTWVzc2FnZS5tZXNzYWdlKCkgKyAiXG4iOwogICAgICAgICAgICAgaWYgKG1Db25zb2xlTWVzc2FnZXMgPT0gbnVsbCkgewogICAgICAgICAgICAgICAgIG1Db25zb2x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kKKyAgICAgICAgICAgICAgICAgICAgJiYgbVdhaXRVbnRpbERvbmUgJiYgbVN0b3BPblJlZkVycm9yKSB7CisgICAgICAgICAgICAgICAgTG9nLncoTE9HVEFHLCAiVGVybWluYXRpbmcgdGVzdCBjYXNlIG9uIHVuY2F1Z2h0IFJlZmVyZW5jZUVycm9yIG9yIFR5cGVFcnJvci4iKTsKKyAgICAgICAgICAgICAgICBtSGFuZGxlci5wb3N0RGVsYXllZChuZXcgUnVubmFibGUoKSB7CisgICAgICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIHJ1bigpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG5vdGlmeURvbmUoKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0sIDUwMCk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgfQogCiAgICAgICAgIEBPdmVycmlkZQpAQCAtNzIzLDEzICs3ODEsMTUgQEAKIAogICAgIHByaXZhdGUgc3RhdGljIGNsYXNzIE5ld1dpbmRvd1dlYlZpZXcgZXh0ZW5kcyBXZWJWaWV3IHsKICAgICAgICAgcHVibGljIE5ld1dpbmRvd1dlYlZpZXcoQ29udGV4dCBjb250ZXh0LCBNYXA8U3RyaW5nLCBPYmplY3Q+IGpzSWZhY2VzKSB7Ci0gICAgICAgICAgICBzdXBlcihjb250ZXh0LCBudWxsLCAwLCBqc0lmYWNlcyk7CisgICAgICAgICAgICBzdXBlcihjb250ZXh0LCBudWxsLCAwLCBqc0lmYWNlcywgZmFsc2UpOwogICAgICAgICB9CiAgICAgfQogCiAgICAgcHJpdmF0ZSB2b2lkIHJlc2V0VGVzdFN0YXR1cygpIHsKICAgICAgICAgbVdhaXRVbnRpbERvbmUgPSBmYWxzZTsKICAgICAgICAgbUR1bXBEYXRhVHlwZSA9IG1EZWZhdWx0RHVtcERhdGFUeXBlOworICAgICAgICBtRHVtcFRvcEZyYW1lQXNUZXh0ID0g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yAgICAgICAgUkVOREVSX1RSRUUgeworICAgICAgICAgICAgQE92ZXJyaWRlCisgICAgICAgICAgICBwdWJsaWMgQWJzdHJhY3RSZXN1bHQgY3JlYXRlUmVzdWx0KEJ1bmRsZSBidW5kbGUpIHsKKyAgICAgICAgICAgICAgICAvKiogVE9ETzogUmVuZGVyVHJlZSB0ZXN0cyBhcmUgbm90IHlldCBzdXBwb3J0ZWQgKi8KKyAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfTsKKworICAgICAgICBwdWJsaWMgYWJzdHJhY3QgQWJzdHJhY3RSZXN1bHQgY3JlYXRlUmVzdWx0KEJ1bmRsZSBidW5kbGUpOworICAgIH0KKworICAgIHB1YmxpYyBlbnVtIFJlc3VsdENvZGUgeworICAgICAgICBQQVNTKCJQYXNzZWQiKSwKKyAgICAgICAgRkFJTF9SRVNVTFRfRElGRkVSUygiUmVzdWx0IGRpZmZlcnMiKSwKKyAgICAgICAgRkFJTF9OT19FWFBFQ1RFRF9SRVNVTFQoIk5vIGV4cGVjdGVkIHJlc3VsdCIpLAorICAgICAgICBGQUlMX1RJTUVEX09VVCgiVGltZWQgb3V0IiksCisgICAgICAgIEZBSUxfQ1JBU0hFRCgiQ3Jhc2hlZCIpOworCisgICAgICAgIHByaXZhdGUgU3RyaW5nIG1UaXRsZTsKKworICAgICAgICBwcml2YXRlIFJlc3VsdENvZGUoU3RyaW5nIHRpdGxlKSB7CisgICAgICAgICAgICBtVGl0bGUgPSB0aXRsZTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgU3RyaW5nIHRvU3RyaW5nKCkgeworICAgICAgICAgICAgcmV0dXJuIG1UaXRsZTsKKyAgICAgICAgfQorICAgIH0KKworICAgIFN0cmluZyBtQWRkaXRpb25hbFRleHRPdXRwdXRTdHJpbmc7CisKKyAgICBwdWJsaWMgaW50IGNvbXBhcmVUbyhBYnN0cmFjdFJ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CdWlsZGVycyB3aWxsIGJlIHByaW50ZWQgaW4gdGhlIG9yZGVyIHRoZSBjb3JyZXNwb25kaW5nIHR5cGVzIGFwcGVhciBoZXJlLgorICAgICAqLworICAgIHByaXZhdGUgZW51bSBPdXRwdXRUeXBlIHsKKyAgICAgICAgSlNfRElBTE9HLAorICAgICAgICBFWENFRURFRF9EQl9RVU9UQV9NRVNTQUdFLAorICAgICAgICBDT05TT0xFX01FU1NBR0U7CisgICAgfQorCisgICAgU3RyaW5nQnVpbGRlcltdIG1PdXRwdXRzID0gbmV3IFN0cmluZ0J1aWxkZXJbT3V0cHV0VHlwZS52YWx1ZXMoKS5sZW5ndGhdOworCisgICAgcHJpdmF0ZSBTdHJpbmdCdWlsZGVyIGdldFN0cmluZ0J1aWxkZXJGb3JUeXBlKE91dHB1dFR5cGUgb3V0cHV0VHlwZSkgeworICAgICAgICBpbnQgaW5kZXggPSBvdXRwdXRUeXBlLm9yZGluYWwoKTsKKyAgICAgICAgaWYgKG1PdXRwdXRzW2luZGV4XSA9PSBudWxsKSB7CisgICAgICAgICAgICBtT3V0cHV0c1tpbmRleF0gPSBuZXcgU3RyaW5nQnVpbGRlcigpOworICAgICAgICB9CisgICAgICAgIHJldHVybiBtT3V0cHV0c1tpbmRleF07CisgICAgfQorCisgICAgcHVibGljIHZvaWQgYXBwZW5kRXhjZWVkZWREYlF1b3RhTWVzc2FnZShTdHJpbmcgdXJsU3RyaW5nLCBTdHJpbmcgZGF0YWJhc2VJZGVudGlmaWVyKSB7CisgICAgICAgIFN0cmluZ0J1aWxkZXIgb3V0cHV0ID0gZ2V0U3RyaW5nQnVpbGRlckZvclR5cGUoT3V0cHV0VHlwZS5FWENFRURFRF9EQl9RVU9UQV9NRVNTQUdFKTsKKworICAgICAgICBTdHJpbmcgcHJvdG9jb2wgPSAiIjsKKyAgICAgICAgU3RyaW5nIGhvc3QgPSAiIjsKKyAgICAgICAgaW50IHBvcnQgPSAwOworCisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBVUkwgdXJsID0gbmV3IFVSTCh1cmxTdHJpbmcpOworICAgICAgICAgICAgcHJvdG9jb2wgPSB1cmwuZ2V0UHJvdG9jb2woKTsKKyAgICAgICAgICAgIGhvc3QgPSB1cmwuZ2V0SG9zdCgpOworICAgICAgICAgICAgaWYgKHVybC5nZXRQb3J0KCkgPiAtMSkgeworICAgICAgICAgICAgICAgIHBvcnQgPSB1cmwuZ2V0UG9ydCgpOworICAgICAgICAgICAgfQorICAgICAgICB9IGNhdGNoIChNYWxmb3JtZWRVUkxFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgTG9nLmUoTE9HX1RBRywgInVybFN0cmluZz0iICsgdXJsU3RyaW5nICsgIiBkYXRhYmFzZUlkZW50aWZpZXI9IiArIGRhdGFiYXNlSWRlbnRpZmllciwKKyAgICAgICAgICAgICAgICAgICAgZSk7CisgICAgICAgIH0KKworICAgICAgICBvdXRwdXQuYXBwZW5kKCJVSSBERUxFR0FURSBEQVRBQkFTRSBDQUxMQkFDSzogIik7CisgICAgICAgIG91dHB1dC5hcHBlbmQoImV4Y2VlZGVkRGF0YWJhc2VRdW90YUZvclNlY3VyaXR5T3JpZ2luOnsiKTsKKyAgICAgICAgb3V0cHV0LmFwcGVuZChwcm90b2NvbCArICIsICIgKyBob3N0ICsgIiwgIiArIHBvcnQgKyAifSAiKTsKKyAgICAgICAgb3V0cHV0LmFwcGVuZCgiZGF0YWJhc2U6IiArIGRhdGFiYXNlSWRlbnRpZmllciArICJcbiIpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGFwcGVuZENvbnNvbGVNZXNzYWdlKENvbnNvbGVNZXNzYWdlIGNvbnNvbGVNZXNzYWdlKSB7CisgICAgICAgIFN0cmluZ0J1aWxkZXIgb3V0cHV0ID0gZ2V0U3RyaW5nQnVpbGRlckZvclR5cGUoT3V0cHV0VHlwZS5DT05TT0xFX01FU1NBR0UpOworCisgICAgICAgIG91dHB1dC5hcHBlbmQoIkNPTlNPTEUgTUVTU0FHRTogbGluZSAiICsgY29uc29sZU1lc3NhZ2UubGluZU51bWJlcigpKTsKKyAgICAgICAgb3V0cHV0LmFwcGVuZCgiOiAiICsgY29uc29sZU1lc3NhZ2UubWVzc2FnZSgpICsgIlxuIik7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgYXBwZW5kSnNBbGVydChTdHJpbmcgbWVzc2FnZSkgeworICAgICAgICBTdHJpbmdCdWlsZGVyIG91dHB1dCA9IGdldFN0cmluZ0J1aWxkZXJGb3JUeXBlKE91dHB1dFR5cGUuSlNfRElBTE9HKTsKKworICAgICAgICBvdXRwdXQuYXBwZW5kKCJBTEVSVDogIik7CisgICAgICAgIG91dHB1dC5hcHBlbmQobWVzc2FnZSk7CisgICAgICAgIG91dHB1dC5hcHBlbmQoJ1xuJyk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgYXBwZW5kSnNDb25maXJtKFN0cmluZyBtZXNzYWdlKSB7CisgICAgICAgIFN0cmluZ0J1aWxkZXIgb3V0cHV0ID0gZ2V0U3RyaW5nQnVpbGRlckZvclR5cGUoT3V0cHV0VHlwZS5KU19ESUFMT0cpOworCisgICAgICAgIG91dHB1dC5hcHBlbmQoIkNPTkZJUk06ICIpOworICAgICAgICBvdXRwdXQuYXBwZW5kKG1lc3NhZ2UpOworICAgICAgICBvdXRwdXQuYXBwZW5kKCdcbicpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGFwcGVuZEpzUHJvbXB0KFN0cmluZyBtZXNzYWdlLCBTdHJpbmcgZGVmYXVsdFZhbHVlKSB7CisgICAgICAgIFN0cmluZ0J1aWxkZXIgb3V0cHV0ID0gZ2V0U3RyaW5nQnVpbGRlckZvclR5cGUoT3V0cHV0VHlwZS5KU19ESUFMT0cpOworCisgICAgICAgIG91dHB1dC5hcHBlbmQoIlBST01QVDogIik7CisgICAgICAgIG91dHB1dC5hcHBlbmQobWVzc2FnZSk7CisgICAgICAgIG91dHB1dC5hcHBlbmQoIiwgZGVmYXVsdC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dWx0cyBuZWVkIGltcGxlbWVudGluZy4KKyAqLworcHVibGljIGNsYXNzIENyYXNoZWREdW1teVJlc3VsdCBleHRlbmRzIEFic3RyYWN0UmVzdWx0IHsKKyAgICBTdHJpbmcgbVJlbGF0aXZlUGF0aDsKKworICAgIHB1YmxpYyBDcmFzaGVkRHVtbXlSZXN1bHQoU3RyaW5nIHJlbGF0aXZlUGF0aCkgeworICAgICAgICBtUmVsYXRpdmVQYXRoID0gcmVsYXRpdmVQYXRoOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyBieXRlW10gZ2V0QWN0dWFsSW1hZ2VSZXN1bHQoKSB7CisgICAgICAgIHJldHVybiBudWxsOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyBTdHJpbmcgZ2V0QWN0dWFsVGV4dFJlc3VsdCgpIHsKKyAgICAgICAgcmV0dXJuIG51bGw7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIEJ1bmRsZSBnZXRCdW5kbGUoKSB7CisgICAgICAgIC8qKiBUT0RPOiAgKi8KKyAgICAgICAgcmV0dXJuIG51bGw7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIFN0cmluZyBnZXREaWZmQXNIdG1sKCkgeworICAgICAgICAvKiogVE9ETzogUHJvYmFibHkgc2hvdyBhdCBsZWFzdCBleHBlY3RlZCByZXN1bHRzICovCisgICAgICAgIHJldHVybiAiT29vcHMsIEkgY3Jhc2hlZC4uLiI7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIFN0cmluZyBnZXRSZWxhdGl2ZVBhdGgoKSB7CisgICAgICAgIHJldHVybiBtUmVsYXRpdmVQYXRoOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyBSZXN1bHRDb2RlIGdldFJlc3VsdENvZGUoKSB7CisgICAgICAgIHJldHVybiBSZXN1bHRDb2RlLkZBSUxfQ1JBU0hFRDsKKyAgICB9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ibGljIHZvaWQgZW5hYmxlRE9NVUlFdmVudExvZ2dpbmcoaW50IGRvbU5vZGUpIHsKKyAgICAgICAgbUV2ZW50U2VuZGVySW1wbC5lbmFibGVET01VSUV2ZW50TG9nZ2luZyhkb21Ob2RlKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBmaXJlS2V5Ym9hcmRFdmVudHNUb0VsZW1lbnQoaW50IGRvbU5vZGUpIHsKKyAgICAgICAgbUV2ZW50U2VuZGVySW1wbC5maXJlS2V5Ym9hcmRFdmVudHNUb0VsZW1lbnQoZG9tTm9kZSk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQga2V5RG93bihTdHJpbmcgY2hhcmFjdGVyLCBTdHJpbmdbXSB3aXRoTW9kaWZpZXJzKSB7CisgICAgICAgIG1FdmVudFNlbmRlckltcGwua2V5RG93bihjaGFyYWN0ZXIsIHdpdGhNb2RpZmllcnMpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGtleURvd24oU3RyaW5nIGNoYXJhY3RlcikgeworICAgICAgICBrZXlEb3duKGNoYXJhY3RlciwgbnVsbCk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgbGVhcEZvcndhcmQoaW50IG1pbGxpc2Vjb25kcykgeworICAgICAgICBtRXZlbnRTZW5kZXJJbXBsLmxlYXBGb3J3YXJkKG1pbGxpc2Vjb25kcyk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgbW91c2VDbGljaygpIHsKKyAgICAgICAgbUV2ZW50U2VuZGVySW1wbC5tb3VzZUNsaWNrKCk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgbW91c2VEb3duKCkgeworICAgICAgICBtRXZlbnRTZW5kZXJJbXBsLm1vdXNlRG93bigpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIG1vdXNlTW92ZVRvKGludCB4LCBpbnQgeSkgeworICAgICAgICBtRXZlbnRTZW5kZXJJbXBsLm1vdXNlTW92ZVRvKHgsIHkpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIG1vdXNlVXAoKSB7CisgICAgICAgIG1FdmVudFNlbmRlckltcGwubW91c2VVcCgpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHRvdWNoU3RhcnQoKSB7CisgICAgICAgIG1FdmVudFNlbmRlckltcGwudG91Y2hTdGFydCgpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGFkZFRvdWNoUG9pbnQoaW50IHgsIGludCB5KSB7CisgICAgICAgIG1FdmVudFNlbmRlckltcGwuYWRkVG91Y2hQb2ludCh4LCB5KTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB1cGRhdGVUb3VjaFBvaW50KGludCBpZCwgaW50IHgsIGludCB5KSB7CisgICAgICAgIG1FdmVudFNlbmRlckltcGwudXBkYXRlVG91Y2hQb2ludChpZCwgeCwgeSk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgc2V0VG91Y2hNb2RpZmllcihTdHJpbmcgbW9kaWZpZXIsIGJvb2xlYW4gZW5hYmxlZCkgeworICAgICAgICBtRXZlbnRTZW5kZXJJbXBsLnNldFRvdWNoTW9kaWZpZXIobW9kaWZpZXIsIGVuYWJsZWQpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHRvdWNoTW92ZSgpIHsKKyAgICAgICAgbUV2ZW50U2VuZGVySW1wbC50b3VjaE1vdmUoKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCByZWxlYXNlVG91Y2hQb2ludChpbnQgaWQpIHsKKyAgICAgICAgbUV2ZW50U2VuZGVySW1wbC5yZWxlYXNlVG91Y2hQb2ludChpZCk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgdG91Y2hFbmQoKSB7CisgICAgICAgIG1FdmVudFNlbmRlckltcGwudG91Y2hFbmQoKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB0b3VjaENhbmNlbCgpIHsKKyAgICAgICAgbUV2ZW50U2VuZGVySW1wbC50b3VjaENhbmNlbCgpOworICAgIH0KKworIC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F0ZSBzdGF0aWMgZmluYWwgaW50IE1TR19SRUxFQVNFX1RPVUNIX1BPSU5UID0gMTQ7CisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IE1TR19UT1VDSF9FTkQgPSAxNTsKKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgTVNHX1NFVF9UT1VDSF9NT0RJRklFUiA9IDE2OworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBNU0dfQ0FOQ0VMX1RPVUNIX1BPSU5UID0gMTc7CisKKyAgICBwdWJsaWMgc3RhdGljIGNsYXNzIFRvdWNoUG9pbnQgeworICAgICAgICBXZWJWaWV3IG1XZWJWaWV3OworICAgICAgICBwcml2YXRlIGludCBtWDsKKyAgICAgICAgcHJpdmF0ZSBpbnQgbVk7CisgICAgICAgIHByaXZhdGUgbG9uZyBtRG93blRpbWU7CisgICAgICAgIHByaXZhdGUgYm9vbGVhbiBtUmVsZWFzZWQgPSBmYWxzZTsKKyAgICAgICAgcHJpdmF0ZSBib29sZWFuIG1Nb3ZlZCA9IGZhbHNlOworICAgICAgICBwcml2YXRlIGJvb2xlYW4gbUNhbmNlbGxlZCA9IGZhbHNlOworCisgICAgICAgIHB1YmxpYyBUb3VjaFBvaW50KFdlYlZpZXcgd2ViVmlldywgaW50IHgsIGludCB5KSB7CisgICAgICAgICAgICBtV2ViVmlldyA9IHdlYlZpZXc7CisgICAgICAgICAgICBtWCA9IHNjYWxlWCh4KTsKKyAgICAgICAgICAgIG1ZID0gc2NhbGVZKHkpOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGludCBnZXRYKCkgeworICAgICAgICAgICAgcmV0dXJuIG1YOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGludCBnZXRZKCkgeworICAgICAgICAgICAgcmV0dXJuIG1ZOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGJvb2xlYW4gaGFzTW92ZWQoKSB7CisgICAgICAgICAgICByZXR1cm4gbU1vdmVkOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgbW92ZShpbnQgbmV3WCwgaW50IG5ld1kpIHsKKyAgICAgICAgICAgIG1YID0gc2NhbGVYKG5ld1gpOworICAgICAgICAgICAgbVkgPSBzY2FsZVkobmV3WSk7CisgICAgICAgICAgICBtTW92ZWQgPSB0cnVlOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgcmVzZXRIYXNNb3ZlZCgpIHsKKyAgICAgICAgICAgIG1Nb3ZlZCA9IGZhbHNlOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGxvbmcgZ2V0RG93blRpbWUoKSB7CisgICAgICAgICAgICByZXR1cm4gbURvd25UaW1lOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIHZvaWQgc2V0RG93blRpbWUobG9uZyBkb3duVGltZSkgeworICAgICAgICAgICAgbURvd25UaW1lID0gZG93blRpbWU7CisgICAgICAgIH0KKworICAgICAgICBwdWJsaWMgYm9vbGVhbiBpc1JlbGVhc2VkKCkgeworICAgICAgICAgICAgcmV0dXJuIG1SZWxlYXNlZDsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyB2b2lkIHJlbGVhc2UoKSB7CisgICAgICAgICAgICBtUmVsZWFzZWQgPSB0cnVlOworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGJvb2xlYW4gaXNDYW5jZWxsZWQoKSB7CisgICAgICAgICAgICByZXR1cm4gbUNhbmNlbGxlZDsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyB2b2lkIGNhbmNlbCgpIHsKKyAgICAgICAgICAgIG1DYW5jZWxsZWQgPSB0cnVlOworICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSBpbnQgc2NhbGVYKGludCB4KSB7CisgICAgICAgICAgICByZXR1cm4gKGludCkoeCAqIG1XZWJWaWV3LmdldFNjYWxlKCkpIC0gbVdlYlZpZXcuZ2V0U2Nyb2xsWCgpOworICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSBpbnQgc2NhbGVZKGludCB5KSB7CisgICAgICAgICAgICByZXR1cm4gKGludCkoeSAqIG1XZWJWaWV3LmdldFNjYWxlKCkpIC0gbVdlYlZpZXcuZ2V0U2Nyb2xsWSgpOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSBMaXN0PFRvdWNoUG9pbnQ+IG1Ub3VjaFBvaW50czsKKyAgICBwcml2YXRlIGludCBtVG91Y2hNZXRhU3RhdGU7CisgICAgcHJpdmF0ZSBpbnQgbU1vdXNlWDsKKyAgICBwcml2YXRlIGludCBtTW91c2VZOworCisgICAgcHJpdmF0ZSBXZWJWaWV3IG1XZWJWaWV3OworCisgICAgcHJpdmF0ZSBIYW5kbGVyIG1FdmVudFNlbmRlckhhbmRsZXIgPSBuZXcgSGFuZGxlcigpIHsKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIGhhbmRsZU1lc3NhZ2UoTWVzc2FnZSBtc2cpIHsKKyAgICAgICAgICAgIFRvdWNoUG9pbnQgdG91Y2hQb2ludDsKKyAgICAgICAgICAgIEJ1bmRsZSBidW5kbGU7CisgICAgICAgICAgICBLZXlFdmVudCBldmVudDsKKworICAgICAgICAgICAgc3dpdGNoIChtc2cud2hhdCkgeworICAgICAgICAgICAgICAgIGNhc2UgTVNHX0VOQUJMRV9ET01fVUlfRVZFTlRfTE9HR0lORzoKKyAgICAgICAgICAgICAgICAgICAgLyoqIFRPRE86IGltcGxlbWVudCAqLworICAgICAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgICAgIGNhc2UgTVNHX0ZJUkVfS0VZQk9BUkRfRVZFTlRTX1RPX0VMRU1FTlQ6CisgICAgICAgICAgICAgICAgICAgIC8qKiBUT0RPOiBpbXBsZW1lbnQgKi8KKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICBjYXNlIE1TR19MRUFQX0ZPUldBUkQ6CisgICAgICAgICAgICAgICAgICAgIC8qKiBUT0RPOiBpbXBsZW1lbnQgKi8KKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICBjYXNlIE1TR19LRVlfRE9XTjoKKyAgICAgICAgICAgICAgICAgICAgYnVuZGxlID0gKEJ1bmRsZSltc2cub2JqOworICAgICAgICAgICAgICAgICAgICBTdHJpbmcgY2hhcmFjdGVyID0gYnVuZGxlLmdldFN0cmluZygiY2hhcmFjdGVyIik7CisgICAgICAgICAgICAgICAgICAgIFN0cmluZ1tdIHdpdGhNb2RpZmllcnMgPSBidW5kbGUuZ2V0U3RyaW5nQXJyYXkoIndpdGhNb2RpZmllcnMiKTsKKworICAgICAgICAgICAgICAgICAgICBpZiAod2l0aE1vZGlmaWVycyAhPSBudWxsICYmIHdpdGhNb2RpZmllcnMubGVuZ3RoID4gMCkgeworICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCB3aXRoTW9kaWZpZXJzLmxlbmd0aDsgaSsrKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhlY3V0ZUtleUV2ZW50KEtleUV2ZW50LkFDVElPTl9ET1dOLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kaWZpZXJUb0tleUNvZGUod2l0aE1vZGlmaWVyc1tpXSkpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGV4ZWN1dGVLZXlFdmVudChLZXlFdmVudC5BQ1RJT05fRE9XTiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjaGFyVG9LZXlDb2RlKGNoYXJhY3Rlci50b0xvd2VyQ2FzZSgpLnRvQ2hhckFycmF5KClbMF0pKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICAvKiogTU9VU0UgKi8KKworICAgICAgICAgICAgICAgIGNhc2UgTVNHX01PVVNFX0RPV046CisgICAgICAgICAgICAgICAgICAgIC8qKiBUT0RPOiBJbXBsZW1lbnQgKi8KKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICBjYXNlIE1TR19NT1VTRV9VUDoKKyAgICAgICAgICAgICAgICAgICAgLyoqIFRPRE86IEltcGxlbWVudCAqLworICAgICAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgICAgIGNhc2UgTVNHX01PVVNFX0NMSUNLOgorICAgICAgICAgICAgICAgICAgICAvKiogVE9ETzogSW1wbGVtZW50ICovCisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgY2FzZSBNU0dfTU9VU0VfTU9WRV9UTzoKKyAgICAgICAgICAgICAgICAgICAgaW50IHggPSBtc2cuYXJnMTsKKyAgICAgICAgICAgICAgICAgICAgaW50IHkgPSBtc2cuYXJnMjsKKworICAgICAgICAgICAgICAgICAgICBldmVudCA9IG51bGw7CisgICAgICAgICAgICAgICAgICAgIGlmICh4ID4gbU1vdXNlWCkgeworICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnQgPSBuZXcgS2V5RXZlbnQoS2V5RXZlbnQuQUNUSU9OX0RPV04sIEtleUV2ZW50LktFWUNPREVfRFBBRF9SSUdIVCk7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoeCA8IG1Nb3VzZVgpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50ID0gbmV3IEtleUV2ZW50KEtleUV2ZW50LkFDVElPTl9ET1dOLCBLZXlFdmVudC5LRVlDT0RFX0RQQURfTEVGVCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgaWYgKGV2ZW50ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1XZWJWaWV3Lm9uS2V5RG93bihldmVudC5nZXRLZXlDb2RlKCksIGV2ZW50KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1XZWJWaWV3Lm9uS2V5VXAoZXZlbnQuZ2V0S2V5Q29kZSgpLCBldmVudCk7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICBldmVudCA9IG51bGw7CisgICAgICAgICAgICAgICAgICAgIGlmICh5ID4gbU1vdXNlWSkgeworICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnQgPSBuZXcgS2V5RXZlbnQoS2V5RXZlbnQuQUNUSU9OX0RPV04sIEtleUV2ZW50LktFWUNPREVfRFBBRF9ET1dOKTsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICh5IDwgbU1vdXNlWSkgeworICAgICAgICAgICAgICAgICAgICAgICAgZXZlbnQgPSBuZXcgS2V5RXZlbnQoS2V5RXZlbnQuQUNUSU9OX0RPV04sIEtleUV2ZW50LktFWUNPREVfRFBBRF9VUCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgaWYgKGV2ZW50ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1XZWJWaWV3Lm9uS2V5RG93bihldmVudC5nZXRLZXlDb2RlKCksIGV2ZW50KTsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1XZWJWaWV3Lm9uS2V5VXAoZXZlbnQuZ2V0S2V5Q29kZSgpLCBldmVudCk7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICBtTW91c2VYID0geDsKKyAgICAgICAgICAgICAgICAgICAgbU1vdXNlWSA9IHk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgLyoqIFRPVUNIICovCisKKyAgICAgICAgICAgICAgICBjYXNlIE1TR19BRERfVE9VQ0hfUE9JTlQ6CisgICAgICAgICAgICAgICAgICAgIGdldFRvdWNoUG9pbnRzKCkuYWRkKG5ldyBUb3VjaFBvaW50KG1XZWJWaWV3LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1zZy5hcmcxLCBtc2cuYXJnMikpOworICAgICAgICAgICAgICAgICAgICBpZiAoZ2V0VG91Y2hQb2ludHMoKS5zaXplKCkgPiAxKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBMb2cudyhMT0dfVEFHICsgIjo6TVNHX0FERF9UT1VDSF9QT0lOVCIsICJBZGRlZCBtb3JlIHRoYW4gb25lIHRvdWNoIHBvaW50Iik7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICBjYXNlIE1TR19UT1VDSF9TVEFSVDoKKyAgICAgICAgICAgICAgICAgICAgLyoqCisgICAgICAgICAgICAgICAgICAgICAqIEZJWE1FOiBBdCB0aGUgbW9tZW50IHdlIGRvbid0IHN1cHBvcnQgbXVsdGktdG91Y2guIEhlbmNlLCB3ZSBvbmx5IGV4YW1pbmUKKyAgICAgICAgICAgICAgICAgICAgICogdGhlIGZpcnN0IHRvdWNoIHBvaW50LiBJbiBmdXR1cmUgdGhpcyBtZXRob2Qgd2lsbCBuZWVkIHJld3JpdGluZy4KKyAgICAgICAgICAgICAgICAgICAgICovCisgICAgICAgICAgICAgICAgICAgIGlmIChnZXRUb3VjaFBvaW50cygpLmlzRW1wdHkoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIHRvdWNoUG9pbnQgPSBnZXRUb3VjaFBvaW50cygpLmdldCgwKTsKKworICAgICAgICAgICAgICAgICAgICB0b3VjaFBvaW50LnNldERvd25UaW1lKFN5c3RlbUNsb2NrLnVwdGltZU1pbGxpcygpKTsKKyAgICAgICAgICAgICAgICAgICAgZXhlY3V0ZVRvdWNoRXZlbnQodG91Y2hQb2ludCwgTW90aW9uRXZlbnQuQUNUSU9OX0RPV04pOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgICAgIGNhc2UgTVNHX1VQREFURV9UT1VDSF9QT0lOVDoKKyAgICAgICAgICAgICAgICAgICAgYnVuZGxlID0gKEJ1bmRsZSltc2cub2JqOworCisgICAgICAgICAgICAgICAgICAgIGludCBpZCA9IGJ1bmRsZS5nZXRJbnQoImlkIik7CisgICAgICAgICAgICAgICAgICAgIGlmIChpZCA+PSBnZXRUb3VjaFBvaW50cygpLnNpemUoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgTG9nLncoTE9HX1RBRyArICI6Ok1TR19VUERBVEVfVE9VQ0hfUE9JTlQiLCAiVG91Y2hQb2ludCBvdXQgb2YgYm91bmRzOiAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgaWQpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICBnZXRUb3VjaFBvaW50cygpLmdldChpZCkubW92ZShidW5kbGUuZ2V0SW50KCJ4IiksIGJ1bmRsZS5nZXRJbnQoInkiKSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgY2FzZSBNU0dfVE9VQ0hfTU9WRToKKyAgICAgICAgICAgICAgICAgICAgLyoqCisgICAgICAgICAgICAgICAgICAgICAqIEZJWE1FOiBBdCB0aGUgbW9tZW50IHdlIGRvbid0IHN1cHBvcnQgbXVsdGktdG91Y2guIEhlbmNlLCB3ZSBvbmx5IGV4YW1pbmUKKyAgICAgICAgICAgICAgICAgICAgICogdGhlIGZpcnN0IHRvdWNoIHBvaW50LiBJbiBmdXR1cmUgdGhpcyBtZXRob2Qgd2lsbCBuZWVkIHJld3JpdGluZy4KKyAgICAgICAgICAgICAgICAgICAgICovCisgICAgICAgICAgICAgICAgICAgIGlmIChnZXRUb3VjaFBvaW50cygpLmlzRW1wdHkoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIHRvdWNoUG9pbnQgPSBnZXRUb3VjaFBvaW50cygpLmdldCgwKTsKKworICAgICAgICAgICAgICAgICAgICBpZiAoIXRvdWNoUG9pbnQuaGFzTW92ZWQoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGV4ZWN1dGVUb3VjaEV2ZW50KHRvdWNoUG9pbnQsIE1vdGlvbkV2ZW50LkFDVElPTl9NT1ZFKTsKKyAgICAgICAgICAgICAgICAgICAgdG91Y2hQb2ludC5yZXNldEhhc01vdmVkKCk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgY2FzZSBNU0dfQ0FOQ0VMX1RPVUNIX1BPSU5UOgorICAgICAgICAgICAgICAgICAgICBpZiAobXNnLmFyZzEgPj0gZ2V0VG91Y2hQb2ludHMoKS5zaXplKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIExvZy53KExPR19UQUcgKyAiOjpNU0dfUkVMRUFTRV9UT1VDSF9QT0lOVCIsICJUb3VjaFBvaW50IG91dCBvZiBib3VuZHM6ICIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyBtc2cuYXJnMSk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIGdldFRvdWNoUG9pbnRzKCkuZ2V0KG1zZy5hcmcxKS5jYW5jZWwoKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICBjYXNlIE1TR19UT1VDSF9DQU5DRUw6CisgICAgICAgICAgICAgICAgICAgIC8qKgorICAgICAgICAgICAgICAgICAgICAgKiBGSVhNRTogQXQgdGhlIG1vbWVudCB3ZSBkb24ndCBzdXBwb3J0IG11bHRpLXRvdWNoLiBIZW5jZSwgd2Ugb25seSBleGFtaW5lCisgICAgICAgICAgICAgICAgICAgICAqIHRoZSBmaXJzdCB0b3VjaCBwb2ludC4gSW4gZnV0dXJlIHRoaXMgbWV0aG9kIHdpbGwgbmVlZCByZXdyaXRpbmcuCisgICAgICAgICAgICAgICAgICAgICAqLworICAgICAgICAgICAgICAgICAgICBpZiAoZ2V0VG91Y2hQb2ludHMoKS5pc0VtcHR5KCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB0b3VjaFBvaW50ID0gZ2V0VG91Y2hQb2ludHMoKS5nZXQoMCk7CisKKyAgICAgICAgICAgICAgICAgICAgaWYgKHRvdWNoUG9pbnQuaXNDYW5jZWxsZWQoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgZXhlY3V0ZVRvdWNoRXZlbnQodG91Y2hQb2ludCwgTW90aW9uRXZlbnQuQUNUSU9OX0NBTkNFTCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICBjYXNlIE1TR19SRUxFQVNFX1RPVUNIX1BPSU5UOgorICAgICAgICAgICAgICAgICAgICBpZiAobXNnLmFyZzEgPj0gZ2V0VG91Y2hQb2ludHMoKS5zaXplKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIExvZy53KExPR19UQUcgKyAiOjpNU0dfUkVMRUFTRV9UT1VDSF9QT0lOVCIsICJUb3VjaFBvaW50IG91dCBvZiBib3VuZHM6ICIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKyBtc2cuYXJnMSk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIGdldFRvdWNoUG9pbnRzKCkuZ2V0KG1zZy5hcmcxKS5yZWxlYXNlKCk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgY2FzZSBNU0dfVE9VQ0hfRU5EOgorICAgICAgICAgICAgICAgICAgICAvKioKKyAgICAgICAgICAgICAgICAgICAgICogRklYTUU6IEF0IHRoZSBtb21lbnQgd2UgZG9uJ3Qgc3VwcG9ydCBtdWx0aS10b3VjaC4gSGVuY2UsIHdlIG9ubHkgZXhhbWluZQorICAgICAgICAgICAgICAgICAgICAgKiB0aGUgZmlyc3QgdG91Y2ggcG9pbnQuIEluIGZ1dHVyZSB0aGlzIG1ldGhvZCB3aWxsIG5lZWQgcmV3cml0aW5nLgorICAgICAgICAgICAgICAgICAgICAgKi8KKyAgICAgICAgICAgICAgICAgICAgaWYgKGdldFRvdWNoUG9pbnRzKCkuaXNFbXB0eSgpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgdG91Y2hQb2ludCA9IGdldFRvdWNoUG9pbnRzKCkuZ2V0KDApOworCisgICAgICAgICAgICAgICAgICAgIGV4ZWN1dGVUb3VjaEV2ZW50KHRvdWNoUG9pbnQsIE1vdGlvbkV2ZW50LkFDVElPTl9VUCk7CisgICAgICAgICAgICAgICAgICAgIGlmICh0b3VjaFBvaW50LmlzUmVsZWFzZWQoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgZ2V0VG91Y2hQb2ludHMoKS5yZW1vdmUoMCk7CisgICAgICAgICAgICAgICAgICAgICAgICB0b3VjaFBvaW50ID0gbnVsbDsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgICAgIGNhc2UgTVNHX1NFVF9UT1VDSF9NT0RJRklFUjoKKyAgICAgICAgICAgICAgICAgICAgYnVuZGxlID0gKEJ1bmRsZSltc2cub2JqOworICAgICAgICAgICAgICAgICAgICBTdHJpbmcgbW9kaWZpZXIgPSBidW5kbGUuZ2V0U3RyaW5nKCJtb2RpZmllciIpOworICAgICAgICAgICAgICAgICAgICBib29sZWFuIGVuYWJsZWQgPSBidW5kbGUuZ2V0Qm9vbGVhbigiZW5hYmxlZCIpOworCisgICAgICAgICAgICAgICAgICAgIGludCBtYXNrID0gMDsKKyAgICAgICAgICAgICAgICAgICAgaWYgKCJhbHQiLmVxdWFscyhtb2RpZmllci50b0xvd2VyQ2FzZSgpKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgbWFzayA9IEtleUV2ZW50Lk1FVEFfQUxUX09OOworICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKCJzaGlmdCIuZXF1YWxzKG1vZGlmaWVyLnRvTG93ZXJDYXNlKCkpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtYXNrID0gS2V5RXZlbnQuTUVUQV9TSElGVF9PTjsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICgiY3RybCIuZXF1YWxzKG1vZGlmaWVyLnRvTG93ZXJDYXNlKCkpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtYXNrID0gS2V5RXZlbnQuTUVUQV9TWU1fT047CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICBpZiAoZW5hYmxlZCkgeworICAgICAgICAgICAgICAgICAgICAgICAgbVRvdWNoTWV0YVN0YXRlIHw9IG1hc2s7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtVG91Y2hNZXRhU3RhdGUgJj0gfm1hc2s7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgICAgIGNhc2UgTVNHX0NMRUFSX1RPVUNIX1BPSU5UUzoKKyAgICAgICAgICAgICAgICAgICAgZ2V0VG91Y2hQb2ludHMoKS5jbGVhcigpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfTsKKworICAgIHB1YmxpYyB2b2lkIHJlc2V0KFdlYlZpZXcgd2ViVmlldykgeworICAgICAgICBtV2ViVmlldyA9IHdlYlZpZXc7CisgICAgICAgIG1Ub3VjaFBvaW50cyA9IG51bGw7CisgICAgICAgIG1Ub3VjaE1ldGFTdGF0ZSA9IDA7CisgICAgICAgIG1Nb3VzZVggPSAwOworICAgICAgICBtTW91c2VZID0gMDsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBlbmFibGVET01VSUV2ZW50TG9nZ2luZyhpbnQgZG9tTm9kZSkgeworICAgICAgICBNZXNzYWdlIG1zZyA9IG1FdmVudFNlbmRlckhhbmRsZXIub2J0YWluTWVzc2FnZShNU0dfRU5BQkxFX0RPTV9VSV9FVkVOVF9MT0dHSU5HKTsKKyAgICAgICAgbXNnLmFyZzEgPSBkb21Ob2RlOworICAgICAgICBtc2cuc2VuZFRvVGFyZ2V0KCk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgZmlyZUtleWJvYXJkRXZlbnRzVG9FbGVtZW50KGludCBkb21Ob2RlKSB7CisgICAgICAgIE1lc3NhZ2UgbXNnID0gbUV2ZW50U2VuZGVySGFuZGxlci5vYnRhaW5NZXNzYWdlKE1TR19GSVJFX0tFWUJPQVJEX0VWRU5UU19UT19FTEVNRU5UKTsKKyAgICAgICAgbXNnLmFyZzEgPSBkb21Ob2RlOworICAgICAgICBtc2cuc2VuZFRvVGFyZ2V0KCk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgbGVhcEZvcndhcmQoaW50IG1pbGxpc2Vjb25kcykgeworICAgICAgICBNZXNzYWdlIG1zZyA9IG1FdmVudFNlbmRlckhhbmRsZXIub2J0YWluTWVzc2FnZShNU0dfTEVBUF9GT1JXQVJEKTsKKyAgICAgICAgbXNnLmFyZzEgPSBtaWxsaXNlY29uZHM7CisgICAgICAgIG1zZy5zZW5kVG9UYXJnZXQoKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBrZX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G9mZnNldCA9IGMgLSAnMCc7CisgICAgICAgICAgICByZXR1cm4gS2V5RXZlbnQuS0VZQ09ERV8wICsgb2Zmc2V0OworICAgICAgICB9CisKKyAgICAgICAgLy8gaGFuZGxlIGNoYXJhY3RlcnMKKyAgICAgICAgaWYgKGMgPj0gJ2EnICYmIGMgPD0gJ3onKSB7CisgICAgICAgICAgICBpbnQgb2Zmc2V0ID0gYyAtICdhJzsKKyAgICAgICAgICAgIHJldHVybiBLZXlFdmVudC5LRVlDT0RFX0EgKyBvZmZzZXQ7CisgICAgICAgIH0KKworICAgICAgICAvLyBoYW5kbGUgYWxsIG90aGVycworICAgICAgICBzd2l0Y2ggKGMpIHsKKyAgICAgICAgICAgIGNhc2UgJyonOgorICAgICAgICAgICAgICAgIHJldHVybiBLZXlFdmVudC5LRVlDT0RFX1NUQVI7CisKKyAgICAgICAgICAgIGNhc2UgJyMnOgorICAgICAgICAgICAgICAgIHJldHVybiBLZXlFdmVudC5LRVlDT0RFX1BPVU5EOworCisgICAgICAgICAgICBjYXNlICcsJzoKKyAgICAgICAgICAgICAgICByZXR1cm4gS2V5RXZlbnQuS0VZQ09ERV9DT01NQTsKKworICAgICAgICAgICAgY2FzZSAnLic6CisgICAgICAgICAgICAgICAgcmV0dXJuIEtleUV2ZW50LktFWUNPREVfUEVSSU9EOworCisgICAgICAgICAgICBjYXNlICdcdCc6CisgICAgICAgICAgICAgICAgcmV0dXJuIEtleUV2ZW50LktFWUNPREVfVEFCOworCisgICAgICAgICAgICBjYXNlICcgJzoKKyAgICAgICAgICAgICAgICByZXR1cm4gS2V5RXZlbnQuS0VZQ09ERV9TUEFDRTsKKworICAgICAgICAgICAgY2FzZSAnXG4nOgorICAgICAgICAgICAgICAgIHJldHVybiBLZXlFdmVudC5LRVlDT0RFX0VOVEVSOworCisgICAgICAgICAgICBjYXNlICdcYic6CisgICAgICAgICAgICBjYXNlIDB4N0Y6CisgICAgICAgICAgICAgICAgcmV0dXJuIEtleUV2ZW50LktFWUNPREVfREVMOworCisgICAgICAgICAgICBjYXNlICd+JzoKKyAgICAgICAgICAgICAgICByZXR1cm4gS2V5RXZlbnQuS0VZQ09ERV9HUkFWRTsKKworICAgICAgICAgICAgY2FzZSAnLSc6CisgICAgICAgICAgICAgICAgcmV0dXJuIEtleUV2ZW50LktFWUNPREVfTUlOVVM7CisKKyAgICAgICAgICAgIGNhc2UgJz0nOgorICAgICAgICAgICAgICAgIHJldHVybiBLZXlFdmVudC5LRVlDT0RFX0VRVUFMUzsKKworICAgICAgICAgICAgY2FzZSAnKCc6CisgICAgICAgICAgICAgICAgcmV0dXJuIEtleUV2ZW50LktFWUNPREVfTEVGVF9CUkFDS0VUOworCisgICAgICAgICAgICBjYXNlICcpJzoKKyAgICAgICAgICAgICAgICByZXR1cm4gS2V5RXZlbnQuS0VZQ09ERV9SSUdIVF9CUkFDS0VUOworCisgICAgICAgICAgICBjYXNlICdcXCc6CisgICAgICAgICAgICAgICAgcmV0dXJuIEtleUV2ZW50LktFWUNPREVfQkFDS1NMQVNIOworCisgICAgICAgICAgICBjYXNlICc7JzoKKyAgICAgICAgICAgICAgICByZXR1cm4gS2V5RXZlbnQuS0VZQ09ERV9TRU1JQ09MT047CisKKyAgICAgICAgICAgIGNhc2UgJ1wnJzoKKyAgICAgICAgICAgICAgICByZXR1cm4gS2V5RXZlbnQuS0VZQ09ERV9BUE9TVFJPUEhFOworCisgICAgICAgICAgICBjYXNlICcvJzoKKyAgICAgICAgICAgICAgICByZXR1cm4gS2V5RXZlbnQuS0VZQ09ERV9TTEFTSDsKKworICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICByZXR1cm4gYzsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgc3RhdGljIGludCBtb2RpZmllclRvS2V5Q29kZShTdHJpbmcgbW9kaWZpZXIpIHsKKyAgICAgICAgaWYgKG1vZGlmaWVyLmVxdWFscygiY3RybEtleSIpKSB7CisgICAgICAgICAgICByZXR1cm4gS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gICAgICB9CisKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIElucHV0U3RyZWFtIGlucHV0U3RyZWFtID0gbnVsbDsKKyAgICAgICAgICAgIEJ1ZmZlcmVkUmVhZGVyIGJ1ZmZlcmVkUmVhZGVyID0gbnVsbDsKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgYnVmZmVyZWRSZWFkZXIgPSBuZXcgQnVmZmVyZWRSZWFkZXIobmV3IFN0cmluZ1JlYWRlcihuZXcgU3RyaW5nKAorICAgICAgICAgICAgICAgICAgICAgICAgRnNVdGlscy5yZWFkRGF0YUZyb21VcmwodXJsKSkpKTsKKworICAgICAgICAgICAgICAgIFN0cmluZyBsaW5lOworICAgICAgICAgICAgICAgIFN0cmluZyBlbnRyeTsKKyAgICAgICAgICAgICAgICBTdHJpbmdbXSBwYXJ0czsKKyAgICAgICAgICAgICAgICBTdHJpbmcgcGF0aDsKKyAgICAgICAgICAgICAgICBTZXQ8U3RyaW5nPiB0b2tlbnM7CisgICAgICAgICAgICAgICAgd2hpbGUgKHRydWUpIHsKKyAgICAgICAgICAgICAgICAgICAgbGluZSA9IGJ1ZmZlcmVkUmVhZGVyLnJlYWRMaW5lKCk7CisgICAgICAgICAgICAgICAgICAgIGlmIChsaW5lID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgLyoqIFJlbW92ZSB0aGUgY29tbWVudCBhbmQgdHJpbSAqLworICAgICAgICAgICAgICAgICAgICBlbnRyeSA9IGxpbmUuc3BsaXQoIi8vIiwgMilbMF0udHJpbSgpOworCisgICAgICAgICAgICAgICAgICAgIC8qKiBPbWl0IGVtcHR5IGxpbmVzLCBhZHZhbmNlIHRvIG5leHQgbGluZSAqLworICAgICAgICAgICAgICAgICAgICBpZiAoZW50cnkuaXNFbXB0eSgpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIC8qKiBTcGxpdCBvbiB3aGl0ZXNwYWNlIGludG8gcGF0aCBwYXJ0IGFuZCB0aGUgcmVzdCAqLworICAgICAgICAgICAgICAgICAgICBwYXJ0cyA9IGVudHJ5LnNwbGl0KCJcXHMiLCAyKTsKKworICAgICAgICAgICAgICAgICAgICAvKiogQXQgdGhpcyBwb2ludCBwYXJ0cy5sZW5ndGggPj0gMSAqLworICAgICAgICAgICAgICAgICAgICBpZiAocGFydHMubGVuZ3RoID09IDEpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIExvZy53KExPR19UQUcgKyAiOjpyZWxvYWRDb25maWd1cmF0aW9uIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIlRoZXJlIGFyZSBubyBvcHRpb25zIHNwZWNpZmllZCBmb3IgdGhlIHRlc3QhIik7CisgICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIHBhdGggPSB0cmltVHJhaWxpbmdTbGFzaElmUHJlc2VudChwYXJ0c1swXSk7CisKKyAgICAgICAgICAgICAgICAgICAgLyoqIFNwbGl0IG9uIHdoaXRlc3BhY2UgKi8KKyAgICAgICAgICAgICAgICAgICAgdG9rZW5zID0gbmV3IEhhc2hTZXQ8U3RyaW5nPihBcnJheXMuYXNMaXN0KHBhcnRzWzFdLnNwbGl0KCJcXHMiLCAwKSkpOworCisgICAgICAgICAgICAgICAgICAgIC8qKiBDaG9zZSB0aGUgcmlnaHQgY29sbGVjdGlvbnMgdG8gYWRkIHRvICovCisgICAgICAgICAgICAgICAgICAgIGlmICh0b2tlbnMuY29udGFpbnMoVE9LRU5fQ1JBU0gpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBtQ3Jhc2hMaXN0LmFkZChwYXRoKTsKKworICAgICAgICAgICAgICAgICAgICAgICAgLyoqIElmIHRlc3QgaXMgb24gc2tpcCBsaXN0IHdlIGlnbm9yZSBhbnkgZnVydGhlciBvcHRpb25zICovCisgICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIGlmICh0b2tlbnMuY29udGFpbnMoVE9LRU5fRkFJTCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1GYWlsTGlzdC5hZGQocGF0aCk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgaWYgKHRva2Vucy5jb250YWlucyhUT0tFTl9TTE9XKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgbVNsb3dMaXN0LmFkZChwYXRoKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICAgICAgaWYgKGlucHV0U3RyZWFtICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgaW5wdXRTdHJlYW0uY2xvc2UoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKGJ1ZmZlcmVkUmVhZGVyICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgYnVmZmVyZWRSZWFkZXIuY2xvc2UoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0gY2F0Y2ggKEZpbGVOb3RGb3VuZEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICBMb2cudyhMT0dfVEFHLCAicmVsb2FkQ29uZmlndXJhdGlvbigpOiBGaWxlIG5vdCBmb3VuZDogIiArIGUuZ2V0TWVzc2FnZSgpKTsKKyAgICAgICAgfSBjYXRjaCAoSU9FeGNlcHRpb24gZSkgeworICAgICAgICAgICAgTG9nLmUoTE9HX1RBRywgInVybD0iICsgdXJsLCBlKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIENoZWNrcyBpZiB0ZXN0IGlzIGV4cGVjdGVkIHRvIGNyYXNoLgorICAgICAqCisgICAgICogPHA+CisgICAgICogUGF0aCBnaXZlbiBzaG91bGQgcmVsYXRpdmUgd2l0aGluIExheW91dFRlc3RzIGZvbGRlciwgZS5nLiBmYXN0L2RvbS9mb28uaHRtbAorICAgICAqCisgICAgICogQHBhcmFtIHRlc3RQYXRoCisgICAgICogICAgICAgICAgICAtIGEgcmVsYXRpdmUgcGF0aCB3aXRoaW4gTGF5b3V0VGVzdHMgZm9sZGVyCisgICAgICogQHJldHVybiBpZiB0aGUgdGVzdCBpcyBzdXBwb3NlZCB0byBiZSBza2lwcGVkCisgICAgICovCisgICAgcHVibGljIGJvb2xlYW4gaXNDcmFzaChTdHJpbmcgdGVzdFBhdGgpIHsKKyAgICAgICAgZm9yIChTdHJpbmcgcHJlZml4IDogZ2V0UHJlZml4ZXModGVzdFBhdGgpKSB7CisgICAgICAgICAgICBpZiAobUNyYXNoTGlzdC5jb250YWlucyhwcmVmaXgpKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgfQorCisgICAgLyoqCisgICAgICogQ2hlY2tzIGlmIHRlc3QgcmVzdWx0IGlzIHN1cHBvc2VkIHRvIGJlICJmYWlsZWQiLgorICAgICAqCisgICAgICogPHA+CisgICAgICogUGF0aCBnaXZlbiBzaG91bGQgcmVsYXRpdmUgd2l0aGluIExheW91dFRlc3RzIGZvbGRlciwgZS5nLiBmYXN0L2RvbS9mb28uaHRtbAorICAgICAqCisgICAgICogQHBhcmFtIHRlc3RQYXRoCisgICAgICogICAgICAgICAgICAtIGEgcmVsYXRpdmUgcGF0aCB3aXRoaW4gTGF5b3V0VGVzdHMgZm9sZGVyCisgICAgICogQHJldHVybiBpZiB0aGUgdGVzdCByZXN1bHQgaXMgc3VwcG9zZWQgdG8gYmUgImZhaWx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bGF5b3V0X3Rlc3RzX2Rpcl9jb250ZW50cy5waHAiOworCisgICAgcHVibGljIHN0YXRpYyB2b2lkIHdyaXRlRGF0YVRvU3RvcmFnZShGaWxlIGZpbGUsIGJ5dGVbXSBieXRlcywgYm9vbGVhbiBhcHBlbmQpIHsKKyAgICAgICAgTG9nLmQoTE9HX1RBRywgIndyaXRlRGF0YVRvU3RvcmFnZSgpOiAiICsgZmlsZS5nZXRBYnNvbHV0ZVBhdGgoKSk7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBPdXRwdXRTdHJlYW0gb3V0cHV0U3RyZWFtID0gbnVsbDsKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgZmlsZS5nZXRQYXJlbnRGaWxlKCkubWtkaXJzKCk7CisgICAgICAgICAgICAgICAgZmlsZS5jcmVhdGVOZXdGaWxlKCk7CisgICAgICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgIndyaXRlRGF0YVRvU3RvcmFnZSgpOiBGaWxlIGNyZWF0ZWQ6ICIgKyBmaWxlLmdldEFic29sdXRlUGF0aCgpKTsKKyAgICAgICAgICAgICAgICBvdXRwdXRTdHJlYW0gPSBuZXcgRmlsZU91dHB1dFN0cmVhbShmaWxlLCBhcHBlbmQpOworICAgICAgICAgICAgICAgIG91dHB1dFN0cmVhbS53cml0ZShieXRlcyk7CisgICAgICAgICAgICB9IGZpbmFsbHkgeworICAgICAgICAgICAgICAgIGlmIChvdXRwdXRTdHJlYW0gIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBvdXRwdXRTdHJlYW0uY2xvc2UoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIExvZy5lKExPR19UQUcsICJmaWxlLmdldEFic29sdXRlUGF0aD0iICsgZmlsZS5nZXRBYnNvbHV0ZVBhdGgoKSArICIgYXBwZW5kPSIgKyBhcHBlbmQsCisgICAgICAgICAgICAgICAgICAgIGUpOworICAgICAgICB9CisgICAgfQorCisgICAgcHVibGljIHN0YXRpYyBieXRlW10gcmVhZERhdGFGcm9tU3RvcmFnZShGaWxlIGZpbGUpIHsKKyAgICAgICAgaWYgKCFmaWxlLmV4aXN0cygpKSB7CisgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAicmVhZERhdGFGcm9tU3RvcmFnZSgpOiBGaWxlIGRvZXMgbm90IGV4aXN0OiAiCisgICAgICAgICAgICAgICAgICAgICsgZmlsZS5nZXRBYnNvbHV0ZVBhdGgoKSk7CisgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgfQorCisgICAgICAgIGJ5dGVbXSBieXRlcyA9IG51bGw7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBGaWxlSW5wdXRTdHJlYW0gZmlzID0gbnVsbDsKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgZmlzID0gbmV3IEZpbGVJbnB1dFN0cmVhbShmaWxlKTsKKyAgICAgICAgICAgICAgICBieXRlcyA9IG5ldyBieXRlWyhpbnQpZmlsZS5sZW5ndGgoKV07CisgICAgICAgICAgICAgICAgZmlzLnJlYWQoYnl0ZXMpOworICAgICAgICAgICAgfSBmaW5hbGx5IHsKKyAgICAgICAgICAgICAgICBpZiAoZmlzICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgZmlzLmNsb3NlKCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9IGNhdGNoIChJT0V4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICBMb2cuZShMT0dfVEFHLCAiZmlsZS5nZXRBYnNvbHV0ZVBhdGg9IiArIGZpbGUuZ2V0QWJzb2x1dGVQYXRoKCksIGUpOworICAgICAgICB9CisKKyAgICAgICAgcmV0dXJuIGJ5dGVzOworICAgIH0KKworICAgIHB1YmxpYyBzdGF0aWMgYnl0ZVtdIHJlYWREYXRhRnJvbVVybChVUkwgdXJsKSB7CisgICAgICAgIGlmICh1cmwgPT0gbnVsbCkgeworICAgICAgICAgICAgTG9nLncoTE9HX1RBRywgInJlYWREYXRhRnJvbVVybCgpOiB1cmwgaXMgbnVsbCEiKTsKKyAgICAgICAgICAgIHJldHVybiBudWxsOworICAgICAgICB9CisKKyAgICAgICAgYnl0ZVtdIGJ5dGVzID0gbnVsbDsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIElucHV0U3RyZWFtIGlucHV0U3RyZWFtID0gbnVsbDsKKyAgICAgICAgICAgIEJ5dGVBcnJheU91dHB1dFN0cmVhbSBvdXRwdXRTdHJlYW0gPSBudWxsOworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICBVUkxDb25uZWN0aW9uIHVybENvbm5lY3Rpb24gPSB1cmwub3BlbkNvbm5lY3Rpb24oKTsKKyAgICAgICAgICAgICAgICBpbnB1dFN0cmVhbSA9IHVybENvbm5lY3Rpb24uZ2V0SW5wdXRTdHJlYW0oKTsKKyAgICAgICAgICAgICAgICBvdXRwdXRTdHJlYW0gPSBuZXcgQnl0ZUFycmF5T3V0cHV0U3RyZWFtKCk7CisKKyAgICAgICAgICAgICAgICBieXRlW10gYnVmZmVyID0gbmV3IGJ5dGVbNDA5Nl07CisgICAgICAgICAgICAgICAgaW50IGxlbmd0aDsKKyAgICAgICAgICAgICAgICB3aGlsZSAoKGxlbmd0aCA9IGlucHV0U3RyZWFtLnJlYWQoYnVmZmVyKSkgPiAwKSB7CisgICAgICAgICAgICAgICAgICAgIG91dHB1dFN0cmVhbS53cml0ZShidWZmZXIsIDAsIGxlbmd0aCk7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgYnl0ZXMgPSBvdXRwdXRTdHJlYW0udG9CeXRlQXJyYXkoKTsKKyAgICAgICAgICAgIH0gZmluYWxseSB7CisgICAgICAgICAgICAgICAgaWYgKGlucHV0U3RyZWFtICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgaW5wdXRTdHJlYW0uY2xvc2UoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKG91dHB1dFN0cmVhbSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIG91dHB1dFN0cmVhbS5jbG9zZSgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBjYXRjaCAoRmlsZU5vdEZvdW5kRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIExvZy53KExPR19UQUcsICJyZWFkRGF0YUZyb21VcmwoKTogRmlsZSBub3QgZm91bmQ6ICIgKyBlLmdldE1lc3NhZ2UoKSk7CisgICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIExvZy5lKExPR19UQUcsICJ1cmw9IiArIHVybCwgZSk7CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gYnl0ZXM7CisgICAgfQorCisgICAgcHVibGljIHN0YXRpYyBMaXN0PFN0cmluZz4gZ2V0TGF5b3V0VGVzdHNEaXJDb250ZW50cyhTdHJpbmcgZGlyUmVsYXRpdmVQYXRoLCBib29sZWFuIHJlY3Vyc2UsCisgICAgICAgICAgICBib29sZWFuIG1vZGUpIHsKKyAgICAgICAgU3RyaW5nIG1vZGVTdHJpbmcgPSAobW9kZSA/ICJmb2xkZXJzIiA6ICJmaWxlcyIpOworCisgICAgICAgIExpc3Q8U3RyaW5nPiByZXN1bHRzID0gbmV3IExpbmtlZExpc3Q8U3RyaW5nPigpOworCisgICAgICAgIFVSTCB1cmwgPSBudWxsOworICAgICAgICB0cnkgeworICAgICAgICAgICAgdXJsID0gbmV3IFVSTChTQ1JJUFRfVVJMICsKKyAgICAgICAgICAgICAgICAgICAgIj9wYXRoPSIgKyBkaXJSZWxhdGl2ZVBhdGggKworICAgICAgICAgICAgICAgICAgICAiJnJlY3Vyc2U9IiArIHJlY3Vyc2UgKworICAgICAgICAgICAgICAgICAgICAiJm1vZGU9IiArIG1vZGVTdHJpbmcpOworICAgICAgICB9IGNhdGNoIChNYWxmb3JtZWRVUkxFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgTG9nLmUoTE9HX1RBRywgInBhdGg9IiArIGRpclJlbGF0aXZlUGF0aCArICIgcmVjdXJzZT0iICsgcmVjdXJzZSArICIgbW9kZT0iICsKKyAgICAgICAgICAgICAgICAgICAgbW9kZVN0cmluZywgZSk7CisgICAgICAgICAgICByZXR1cm4gcmVzdWx0czsKKyAgICAgICAgfQorCisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBJbnB1dFN0cmVhbSBpbnB1dFN0cmVhbSA9IG51bGw7CisgICAgICAgICAgICBCdWZmZXJlZFJlYWRlciBidWZmZXJlZFJlYWRlciA9IG51bGw7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIFVSTENvbm5lY3Rpb24gdXJsQ29ubmVjdGlvbiA9IHVybC5vcGVuQ29ubmVjdGlvbigpOworICAgICAgICAgICAgICAgIGlucHV0U3RyZWFtID0gdXJsQ29ubmVjdGlvbi5nZXRJbnB1dFN0cmVhbSgpOworICAgICAgICAgICAgICAgIGJ1ZmZlcmVkUmVhZGVyID0gbmV3IEJ1ZmZlcmVkUmVhZGVyKG5ldyBJbnB1dFN0cmVhbVJlYWRlcihpbnB1dFN0cmVhbSkpOworCisgICAgICAgICAgICAgICAgU3RyaW5nIHJlbGF0aXZlUGF0aDsKKyAgICAgICAgICAgICAgICB3aGlsZSAoKHJlbGF0aXZlUGF0aCA9IGJ1ZmZlcmVkUmVhZGVyLnJlYWRMaW5lKCkpICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgcmVzdWx0cy5hZGQocmVsYXRpdmVQYXRoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGZpbmFsbHkgeworICAgICAgICAgICAgICAgIGlmIChpbnB1dFN0cmVhbSAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIGl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3RFeGVjdXRvcgorICovCitwdWJsaWMgY2xhc3MgTGF5b3V0VGVzdENvbnRyb2xsZXIgeworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIFN0cmluZyBMT0dfVEFHID0gIkxheW91dFRlc3RDb250cm9sbGVyIjsKKworICAgIExheW91dFRlc3RzRXhlY3V0b3IgbUxheW91dFRlc3RzRXhlY3V0b3I7CisKKyAgICBwdWJsaWMgTGF5b3V0VGVzdENvbnRyb2xsZXIoTGF5b3V0VGVzdHNFeGVjdXRvciBsYXlvdXRUZXN0c0V4ZWN1dG9yKSB7CisgICAgICAgIG1MYXlvdXRUZXN0c0V4ZWN1dG9yID0gbGF5b3V0VGVzdHNFeGVjdXRvcjsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCB3YWl0VW50aWxEb25lKCkgeworICAgICAgICBtTGF5b3V0VGVzdHNFeGVjdXRvci53YWl0VW50aWxEb25lKCk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgbm90aWZ5RG9uZSgpIHsKKyAgICAgICAgbUxheW91dFRlc3RzRXhlY3V0b3Iubm90aWZ5RG9uZSgpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGR1bXBBc1RleHQoKSB7CisgICAgICAgIGR1bXBBc1RleHQoZmFsc2UpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGR1bXBBc1RleHQoYm9vbGVhbiBlbmFibGVQaXhlbFRlc3QpIHsKKyAgICAgICAgbUxheW91dFRlc3RzRXhlY3V0b3IuZHVtcEFzVGV4dChlbmFibGVQaXhlbFRlc3QpOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIGR1bXBDaGlsZEZyYW1lc0FzVGV4dCgpIHsKKyAgICAgICAgbUxheW91dFRlc3RzRXhlY3V0b3IuZHVtcENoaWxkRnJhbWVzQXNUZXh0KCk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgY2xlYXJBbGxEYXRhYmFzZXMoKSB7CisgICAgICAgIExvZy5pKExPR19UQUcsIC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ICAgICAgY2FzZSBNU0dfQUNUVUFMX1JFU1VMVF9PQlRBSU5FRDoKKyAgICAgICAgICAgICAgICAgICAgb25BY3R1YWxSZXN1bHRzT2J0YWluZWQoKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICBjYXNlIE1TR19URVNUX1RJTUVEX09VVDoKKyAgICAgICAgICAgICAgICAgICAgb25UZXN0VGltZWRPdXQoKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH07CisKKyAgICAvKiogV0VCVklFVyBDT05GSUdVUkFUSU9OICovCisKKyAgICBwcml2YXRlIFdlYlZpZXdDbGllbnQgbVdlYlZpZXdDbGllbnQgPSBuZXcgV2ViVmlld0NsaWVudCgpIHsKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIG9uUGFnZUZpbmlzaGVkKFdlYlZpZXcgdmlldywgU3RyaW5nIHVybCkgeworICAgICAgICAgICAgLyoqIFNvbWUgdGVzdHMgZmlyZSB1cCBtYW55IHBhZ2UgbG9hZHMsIHdlIGRvbid0IHdhbnQgdG8gZGV0ZWN0IHRoZW0gKi8KKyAgICAgICAgICAgIGlmICghdXJsLmVxdWFscyhtQ3VycmVudFRlc3RVcmkpKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAobUN1cnJlbnRTdGF0ZSA9PSBDdXJyZW50U3RhdGUuUkVOREVSSU5HX1BBR0UpIHsKKyAgICAgICAgICAgICAgICBvblRlc3RGaW5pc2hlZCgpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfTsKKworICAgIHByaXZhdGUgV2ViQ2hyb21lQ2xpZW50IG1XZWJDaHJvbWVDbGllbnQgPSBuZXcgV2ViQ2hyb21lQ2xpZW50KCkgeworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgb25FeGNlZWRlZERhdGFiYXNlUXVvdGEoU3RyaW5nIHVybCwgU3RyaW5nIGRhdGFiYXNlSWRlbnRpZmllciwKKyAgICAgICAgICAgICAgICBsb25nIGN1cnJlbnRRdW90YSwgbG9uZyBlc3RpbWF0ZWRTaXplLCBsb25nIHRvdGFsVXNlZFF1b3RhLAorICAgICAgICAgICAgICAgIFF1b3RhVXBkYXRlciBxdW90YVVwZGF0ZXIpIHsKKyAgICAgICAgICAgIC8qKiBUT0RPOiBUaGlzIHNob3VsZCBiZSByZWNvcmRlZCBhcyBwYXJ0IG9mIHRoZSB0ZXh0IHJlc3VsdCAqLworICAgICAgICAgICAgLyoqIFRPRE86IFRoZSBxdW90YSBzaG91bGQgYWxzbyBwcm9iYWJseSBiZSByZXNldCBzb21laG93IGZvciBldmVyeSB0ZXN0PyAqLworICAgICAgICAgICAgaWYgKG1EdW1wRGF0YWJhc2VDYWxsYmFja3MpIHsKKyAgICAgICAgICAgICAgICBnZXRDdXJyZW50QWRkaXRpb25hbFRleHRPdXRwdXQoKS5hcHBlbmRFeGNlZWRlZERiUXVvdGFNZXNzYWdlKHVybCwKKyAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFiYXNlSWRlbnRpZmllcik7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBxdW90YVVwZGF0ZXIudXBkYXRlUXVvdGEoY3VycmVudFF1b3RhICsgNSAqIDEwMjQgKiAxMDI0KTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgYm9vbGVhbiBvbkpzQWxlcnQoV2ViVmlldyB2aWV3LCBTdHJpbmcgdXJsLCBTdHJpbmcgbWVzc2FnZSwgSnNSZXN1bHQgcmVzdWx0KSB7CisgICAgICAgICAgICBnZXRDdXJyZW50QWRkaXRpb25hbFRleHRPdXRwdXQoKS5hcHBlbmRKc0FsZXJ0KG1lc3NhZ2UpOworICAgICAgICAgICAgcmVzdWx0LmNvbmZpcm0oKTsKKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBib29sZWFuIG9uSnNDb25maXJtKFdlYlZpZXcgdmlldywgU3RyaW5nIHVybCwgU3RyaW5nIG1lc3NhZ2UsIEpzUmVzdWx0IHJlc3VsdCkgeworICAgICAgICAgICAgZ2V0Q3VycmVudEFkZGl0aW9uYWxUZXh0T3V0cHV0KCkuYXBwZW5kSnNDb25maXJtKG1lc3NhZ2UpOworICAgICAgICAgICAgcmVzdWx0LmNvbmZpcm0oKTsKKyAgICAgICAgICAgIHJldHVybiB0cnVlOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBib29sZWFuIG9uSnNQcm9tcHQoV2ViVmlldyB2aWV3LCBTdHJpbmcgdXJsLCBTdHJpbmcgbWVzc2FnZSwgU3RyaW5nIGRlZmF1bHRWYWx1ZSwKKyAgICAgICAgICAgICAgICBKc1Byb21wdFJlc3VsdCByZXN1bHQpIHsKKyAgICAgICAgICAgIGdldEN1cnJlbnRBZGRpdGlvbmFsVGV4dE91dHB1dCgpLmFwcGVuZEpzUHJvbXB0KG1lc3NhZ2UsIGRlZmF1bHRWYWx1ZSk7CisgICAgICAgICAgICByZXN1bHQuY29uZmlybSgpOworICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIGJvb2xlYW4gb25Db25zb2xlTWVzc2FnZShDb25zb2xlTWVzc2FnZSBjb25zb2xlTWVzc2FnZSkgeworICAgICAgICAgICAgZ2V0Q3VycmVudEFkZGl0aW9uYWxUZXh0T3V0cHV0KCkuYXBwZW5kQ29uc29sZU1lc3NhZ2UoY29uc29sZU1lc3NhZ2UpOworICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIGJvb2xlYW4gb25DcmVhdGVXaW5kb3coV2ViVmlldyB2aWV3LCBib29sZWFuIGRpYWxvZywgYm9vbGVhbiB1c2VyR2VzdHVyZSwKKyAgICAgICAgICAgICAgICBNZXNzYWdlIHJlc3VsdE1zZykgeworICAgICAgICAgICAgV2ViVmlldy5XZWJWaWV3VHJhbnNwb3J0IHRyYW5zcG9ydCA9IChXZWJWaWV3LldlYlZpZXdUcmFuc3BvcnQpcmVzdWx0TXNnLm9iajsKKyAgICAgICAgICAgIC8qKiBCeSBkZWZhdWx0IHdpbmRvd3MgY2Fubm90IGJlIG9wZW5lZCwgc28ganVzdCBzZW5kIG51bGwgYmFjay4gKi8KKyAgICAgICAgICAgIFdlYlZpZXcgbmV3V2luZG93V2ViVmlldyA9IG51bGw7CisKKyAgICAgICAgICAgIGlmIChtQ2FuT3BlbldpbmRvd3MpIHsKKyAgICAgICAgICAgICAgICAvKioKKyAgICAgICAgICAgICAgICAgKiBXZSBuZXZlciBkaXNwbGF5IHRoZSBuZXcgd2luZG93LCBqdXN0IGNyZWF0ZSB0aGUgdmlldyBhbmQgYWxsb3cgaXQncyBjb250ZW50IHRvCisgICAgICAgICAgICAgICAgICogZXhlY3V0ZSBhbmQgYmUgcmVjb3JkZWQgYnkgdGhlIGV4ZWN1dG9yLgorICAgICAgICAgICAgICAgICAqLworICAgICAgICAgICAgICAgIG5ld1dpbmRvd1dlYlZpZXcgPSBuZXcgV2ViVmlldyhMYXlvdXRUZXN0c0V4ZWN1dG9yLnRoaXMpOworICAgICAgICAgICAgICAgIHNldHVwV2ViVmlldyhuZXdXaW5kb3dXZWJWaWV3KTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgdHJhbnNwb3J0LnNldFdlYlZpZXcobmV3V2luZG93V2ViVmlldyk7CisgICAgICAgICAgICByZXN1bHRNc2cuc2VuZFRvVGFyZ2V0KCk7CisgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgdm9pZCBvbkdlb2xvY2F0aW9uUGVybWlzc2lvbnNTaG93UHJvbXB0KFN0cmluZyBvcmlnaW4sCisgICAgICAgICAgICAgICAgR2VvbG9jYXRpb25QZXJtaXNzaW9ucy5DYWxsYmFjayBjYWxsYmFjaykgeworICAgICAgICAgICAgaWYgKG1Jc0dlb2xvY2F0aW9uUGVybWlzc2lvblNldCkgeworICAgICAgICAgICAgICAgIGNhbGxiYWNrLmludm9rZShvcmlnaW4sIG1HZW9sb2NhdGlvblBlcm1pc3Npb24sIGZhbHNlKTsKKyAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAobVBlbmRpbmdHZW9sb2NhdGlvblBlcm1pc3Npb25DYWxsYmFja3MgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIG1QZW5kaW5nR2VvbG9jYXRpb25QZXJtaXNzaW9uQ2FsbGJhY2tzID0KKyAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBIYXNoTWFwPEdlb2xvY2F0aW9uUGVybWlzc2lvbnMuQ2FsbGJhY2ssIFN0cmluZz4oKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIG1QZW5kaW5nR2VvbG9jYXRpb25QZXJtaXNzaW9uQ2FsbGJhY2tzLnB1dChjYWxsYmFjaywgb3JpZ2luKTsKKyAgICAgICAgfQorICAgIH07CisKKyAgICAvKiogSU1QTEVNRU5UQVRJT04gKi8KKworICAgIEBPdmVycmlkZQorICAgIHByb3RlY3RlZCB2b2lkIG9uQ3JlYXRlKEJ1bmRsZSBzYXZlZEluc3RhbmNlU3RhdGUpIHsKKyAgICAgICAgc3VwZXIub25DcmVhdGUoc2F2ZWRJbnN0YW5jZVN0YXRlKTsKKworICAgICAgICAvKioKKyAgICAgICAgICogSXQgZGV0ZWN0cyB0a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0UsICJXYWtlTG9jayBpbiBMYXlvdXRUZXN0ZXIiKTsKKyAgICAgICAgbVNjcmVlbkRpbUxvY2suYWNxdWlyZSgpOworCisgICAgICAgIGJpbmRTZXJ2aWNlKG5ldyBJbnRlbnQodGhpcywgTWFuYWdlclNlcnZpY2UuY2xhc3MpLCBtU2VydmljZUNvbm5lY3Rpb24sCisgICAgICAgICAgICAgICAgQ29udGV4dC5CSU5EX0FVVE9fQ1JFQVRFKTsKKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgcmVzZXQoKSB7CisgICAgICAgIFdlYlZpZXcgcHJldmlvdXNXZWJWaWV3ID0gbUN1cnJlbnRXZWJWaWV3OworCisgICAgICAgIHJlc2V0TGF5b3V0VGVzdENvbnRyb2xsZXIoKTsKKworICAgICAgICBtQ3VycmVudFRlc3RUaW1lZE91dCA9IGZhbHNlOworICAgICAgICBtQ3VycmVudFJlc3VsdCA9IG51bGw7CisgICAgICAgIG1DdXJyZW50QWRkaXRpb25hbFRleHRPdXRwdXQgPSBudWxsOworCisgICAgICAgIG1DdXJyZW50V2ViVmlldyA9IG5ldyBXZWJWaWV3KHRoaXMpOworICAgICAgICBzZXR1cFdlYlZpZXcobUN1cnJlbnRXZWJWaWV3KTsKKworICAgICAgICBtRXZlbnRTZW5kZXIucmVzZXQobUN1cnJlbnRXZWJWaWV3KTsKKworICAgICAgICBzZXRDb250ZW50VmlldyhtQ3VycmVudFdlYlZpZXcpOworICAgICAgICBpZiAocHJldmlvdXNXZWJWaWV3ICE9IG51bGwpIHsKKyAgICAgICAgICAgIExvZy5kKExPR19UQUcgKyAiOjpyZXNldCIsICJwcmV2aW91c1dlYlZpZXcgIT0gbnVsbCIpOworICAgICAgICAgICAgcHJldmlvdXNXZWJWaWV3LmRlc3Ryb3koKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBzZXR1cFdlYlZpZXcoV2ViVmlldyB3ZWJWaWV3KSB7CisgICAgICAgIHdlYlZpZXc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GFzc2VydCBtQ3VycmVudFN0YXRlID09IEN1cnJlbnRTdGF0ZS5JRExFIDogIm1DdXJyZW50U3RhdGUgPSAiICsgbUN1cnJlbnRTdGF0ZS5uYW1lKCk7CisKKyAgICAgICAgaWYgKG1UZXN0c0xpc3QuaXNFbXB0eSgpKSB7CisgICAgICAgICAgICBvbkFsbFRlc3RzRmluaXNoZWQoKTsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorCisgICAgICAgIG1DdXJyZW50VGVzdFJlbGF0aXZlUGF0aCA9IG1UZXN0c0xpc3QucmVtb3ZlKDApOworCisgICAgICAgIExvZy5pKExPR19UQUcsICJydW5OZXh0VGVzdCgpOiBTdGFydDogIiArIG1DdXJyZW50VGVzdFJlbGF0aXZlUGF0aCArCisgICAgICAgICAgICAgICAgIiAoIiArIG1DdXJyZW50VGVzdEluZGV4ICsgIikiKTsKKworICAgICAgICBtQ3VycmVudFRlc3RVcmkgPSBGaWxlRmlsdGVyLmdldFVybChtQ3VycmVudFRlc3RSZWxhdGl2ZVBhdGgpLnRvU3RyaW5nKCk7CisKKyAgICAgICAgcmVzZXQoKTsKKworICAgICAgICAvKiogU3RhcnQgdGltZS1vdXQgY291bnRkb3duIGFuZCB0aGUgdGVzdCAqLworICAgICAgICBtQ3VycmVudFN0YXRlID0gQ3VycmVudFN0YXRlLlJFTkRFUklOR19QQUdFOworICAgICAgICBtUmVzdWx0SGFuZGxlci5zZW5kRW1wdHlNZXNzYWdlRGVsYXllZChNU0dfVEVTVF9USU1FRF9PVVQsIERFRkFVTFRfVElNRV9PVVRfTVMpOworICAgICAgICBtQ3VycmVudFdlYlZpZXcubG9hZFVybChtQ3VycmVudFRlc3RVcmkpOworICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBvblRlc3RUaW1lZE91dCgpIHsKKyAgICAgICAgYXNzZXJ0IG1DdXJyZW50U3RhdGUuaXNSdW5uaW5nU3RhdGUoKSA6ICJtQ3VycmVudFN0YXRlID0gIiArIG1Dd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sdEhhbmRsZXIucmVtb3ZlTWVzc2FnZXMoTVNHX1RFU1RfVElNRURfT1VUKTsKKyAgICAgICAgcmVwb3J0UmVzdWx0VG9TZXJ2aWNlKCk7CisgICAgICAgIG1DdXJyZW50VGVzdEluZGV4Kys7CisgICAgICAgIHVwZGF0ZVByb2dyZXNzQmFyKCk7CisgICAgICAgIHJ1bk5leHRUZXN0KCk7CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIHJlcG9ydFJlc3VsdFRvU2VydmljZSgpIHsKKyAgICAgICAgaWYgKG1DdXJyZW50QWRkaXRpb25hbFRleHRPdXRwdXQgIT0gbnVsbCkgeworICAgICAgICAgICAgbUN1cnJlbnRSZXN1bHQuc2V0QWRkaXRpb25hbFRleHRPdXRwdXRTdHJpbmcobUN1cnJlbnRBZGRpdGlvbmFsVGV4dE91dHB1dC50b1N0cmluZygpKTsKKyAgICAgICAgfQorCisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBNZXNzYWdlIHNlcnZpY2VNc2cgPQorICAgICAgICAgICAgICAgICAgICBNZXNzYWdlLm9idGFpbihudWxsLCBNYW5hZ2VyU2VydmljZS5NU0dfUFJPQ0VTU19BQ1RVQUxfUkVTVUxUUyk7CisKKyAgICAgICAgICAgIEJ1bmRsZSBidW5kbGUgPSBtQ3VycmVudFJlc3VsdC5nZXRCdW5kbGUoKTsKKyAgICAgICAgICAgIGJ1bmRsZS5wdXRJbnQoInRlc3RJbmRleCIsIG1DdXJyZW50VGVzdEluZGV4KTsKKyAgICAgICAgICAgIGlmIChtQ3VycmVudFRlc3RUaW1lZE91dCkgeworICAgICAgICAgICAgICAgIGJ1bmRsZS5wdXRTdHJpbmcoInJlc3VsdENvZGUiLCBBYnN0cmFjdFJlc3VsdC5SZXN1bHRDb2RlLkZBSUxfVElNRURfT1VULm5hbWUoKSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBpZiAoIW1UZXN0c0xpc3QuaXNFbXB0eSgpKSB7CisgICAgICAgICAgICAgICAgYnVuZGxlLnB1dFN0cmluZygibmV4dFRlc3QiLCBtVGVzdHNMaXN0LmdldCgwKSk7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIHNlcnZpY2VNc2cuc2V0RGF0YShidW5kbGUpOworICAgICAgICAgICAgbU1hbmFnZXJTZXJ2aWNlTWVzc2VuZ2VyLnNlbmQoc2VydmljZU1zZyk7CisgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICBMb2cuZShMT0dfVEFHLCAibUN1cnJlbnRUZXN0UmVsYXRpdmVQYXRoPSIgKyBtQ3VycmVudFRlc3RSZWxhdGl2ZVBhdGgsIGUpOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIHVwZGF0ZVByb2dyZXNzQmFyKCkgeworICAgICAgICBnZXRXaW5kb3coKS5zZXRGZWF0dXJlSW50KFdpbmRvdy5GRUFUVVJFX1BST0dSRVNTLAorICAgICAgICAgICAgICAgIG1DdXJyZW50VGVzdEluZGV4ICogV2luZG93LlBST0dSRVNTX0VORCAvIG1Ub3RhbFRlc3RDb3VudCk7CisgICAgICAgIHNldFRpdGxlKG1DdXJyZW50VGVzdEluZGV4ICogMTAwIC8gbVRvdGFsVGVzdENvdW50ICsgIiUgIiArCisgICAgICAgICAgICAgICAgIigiICsgbUN1cnJlbnRUZXN0SW5kZXggKyAiLyIgKyBtVG90YWxUZXN0Q291bnQgKyAiKSIpOworICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBvbkFsbFRlc3RzRmluaXNoZWQoKSB7CisgICAgICAgIG1TY3JlZW5EaW1Mb2NrLnJlbGVhc2UoKTsKKworICAgICAgICB0cnkgeworICAgICAgICAgICAgTWVzc2FnZSBzZXJ2aWNlTXNnID0KKyAgICAgICAgICAgICAgICAgICAgTWVzc2FnZS5vYnRhaW4obnVsbCwgTWFuYWdlclNlcnZpY2UuTVNHX0FMTF9URVNUU19GSU5JU0hFRCk7Cis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c3RhdGljIGZpbmFsIGludCBNU0dfRFVNUF9EQVRBQkFTRV9DQUxMQkFDS1MgPSA1OworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBNU0dfU0VUX0dFT0xPQ0FUSU9OX1BFUk1JU1NJT04gPSA2OworCisgICAgSGFuZGxlciBtTGF5b3V0VGVzdENvbnRyb2xsZXJIYW5kbGVyID0gbmV3IEhhbmRsZXIoKSB7CisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgdm9pZCBoYW5kbGVNZXNzYWdlKE1lc3NhZ2UgbXNnKSB7CisgICAgICAgICAgICBhc3NlcnQgbUN1cnJlbnRTdGF0ZS5pc1J1bm5pbmdTdGF0ZSgpIDogIm1DdXJyZW50U3RhdGUgPSAiICsgbUN1cnJlbnRTdGF0ZS5uYW1lKCk7CisKKyAgICAgICAgICAgIHN3aXRjaCAobXNnLndoYXQpIHsKKyAgICAgICAgICAgICAgICBjYXNlIE1TR19XQUlUX1VOVElMX0RPTkU6CisgICAgICAgICAgICAgICAgICAgIG1DdXJyZW50U3RhdGUgPSBDdXJyZW50U3RhdGUuV0FJVElOR19GT1JfQVNZTkNIUk9OT1VTX1RFU1Q7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgY2FzZSBNU0dfTk9USUZZX0RPTkU6CisgICAgICAgICAgICAgICAgICAgIGlmIChtQ3VycmVudFN0YXRlID09IEN1cnJlbnRTdGF0ZS5XQUlUSU5HX0ZPUl9BU1lOQ0hST05PVVNfVEVTVCkgeworICAgICAgICAgICAgICAgICAgICAgICAgb25UZXN0RmluaXNoZWQoKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgICAgIGNhc2UgTVNHX0RVTVBfQVNfVEVYVDoKKyAgICAgICAgICAgICAgICAgICAgaWYgKG1DdXJyZW50UmVzdWx0ID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1DdXJyZW50UmVzdWx0ID0gbmV3IFRleHRSZXN1bHQobUN1cnJlbnRUZXN0UmVsYXRpdmVQYXRoKTsKKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIGFzc2VydCBtQ3VycmVudFJlc3VsdCBpbnN0YW5jZW9mIFRleHRSZXN1bHQKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICA6ICJtQ3VycmVudFJlc3VsdCBpbnN0YW5jZW9mIiArIG1DdXJyZW50UmVzdWx0LmdldENsYXNzKCkuZ2V0TmFtZSgpOworCisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgY2FzZSBNU0dfRFVNUF9DSElMRF9GUkFNRVNfQVNfVEVYVDoKKyAgICAgICAgICAgICAgICAgICAgLyoqIElmIGR1bXBBc1RleHQgd2FzIG5vdCBjYWxsZWQgd2UgYXNzdW1lIHRoYXQgdGhlIHJlc3VsdCBzaG91bGQgYmUgdGV4dCAqLworICAgICAgICAgICAgICAgICAgICBpZiAobUN1cnJlbnRSZXN1bHQgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgbUN1cnJlbnRSZXN1bHQgPSBuZXcgVGV4dFJlc3VsdChtQ3VycmVudFRlc3RSZWxhdGl2ZVBhdGgpOworICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgYXNzZXJ0IG1DdXJyZW50UmVzdWx0IGluc3RhbmNlb2YgVGV4dFJlc3VsdAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogIm1DdXJyZW50UmVzdWx0IGluc3RhbmNlb2YiICsgbUN1cnJlbnRSZXN1bHQuZ2V0Q2xhc3MoKS5nZXROYW1lKCk7CisKKyAgICAgICAgICAgICAgICAgICAgKChUZXh0UmVzdWx0KW1DdXJyZW50UmVzdWx0KS5zZXREdW1wQ2hpbGRGcmFtZXNBc1RleHQodHJ1ZSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgY2FzZSBNU0dfU0VUX0NBTl9PUEVOX1dJTkRPV1M6CisgICAgICAgICAgICAgICAgICAgIG1DYW5PcGVuV2luZG93cyA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgY2FzZSBNU0dfRFVNUF9EQVRBQkFTRV9DQUxMQkFDS1M6CisgICAgICAgICAgICAgICAgICAgIG1EdW1wRGF0YWJhc2VDYWxsYmFja3MgPSB0cnVlOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgICAgIGNhc2UgTVNHX1NFVF9HRU9MT0NBVElPTl9QRVJNSVNTSU9OOgorICAgICAgICAgICAgICAgICAgICBtSXNHZW9sb2NhdGlvblBlcm1pc3Npb25TZXQgPSB0cnVlOworICAgICAgICAgICAgICAgICAgICBtR2VvbG9jYXRpb25QZXJtaXNzaW9uID0gbXNnLmFyZzEgPT0gMTsKKworICAgICAgICAgICAgICAgICAgICBpZiAobVBlbmRpbmdHZW9sb2NhdGlvblBlcm1pc3Npb25DYWxsYmFja3MgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgSXRlcmF0b3I8R2VvbG9jYXRpb25QZXJtaXNzaW9ucy5DYWxsYmFjaz4gaXRlciA9CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1QZW5kaW5nR2VvbG9jYXRpb25QZXJtaXNzaW9uQ2FsbGJhY2tzLmtleVNldCgpLml0ZXJhdG9yKCk7CisgICAgICAgICAgICAgICAgICAgICAgICB3aGlsZSAoaXRlci5oYXNOZXh0KCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBHZW9sb2NhdGlvblBlcm1pc3Npb25zLkNhbGxiYWNrIGNhbGxiYWNrID0gaXRlci5uZXh0KCk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgU3RyaW5nIG9yaWdpbiA9IG1QZW5kaW5nR2VvbG9jYXRpb25QZXJtaXNzaW9uQ2FsbGJhY2tzLmdldChjYWxsYmFjayk7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FsbGJhY2suaW52b2tlKG9yaWdpbiwgbUdlb2xvY2F0aW9uUGVybWlzc2lvbiwgZmFsc2UpOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgbVBlbmRpbmdHZW9sb2NhdGlvblBlcm1pc3Npb25DYWxsYmFja3MgPSBudWxsOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgYXNzZXJ0IGZhbHNlIDogIm1zZy53aGF0PSIgKyBtc2cud2hhdDsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9OworCisgICAgcHJpdmF0ZSB2b2lkIHJlc2V0TGF5b3V0VGVzdENvbnRyb2xsZXIoKSB7CisgICAgICAgIG1DYW5PcGVuV2luZG93cyA9IGZhbHNlOworICAgICAgICBtRHVtcERhdGFiYXNlQ2FsbGJhY2tzID0gZmFsc2U7CisgICAgICAgIG1Jc0dlb2xvY2F0aW9uUGVybWlzc2lvblNldCA9IGZhbHNlOworICAgICAgICBtUGVuZGluZ0dlb2xvY2F0aW9uUGVybWlzc2lvbkNhbGxiYWNrcyA9IG51bGw7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgd2FpdFVudGlsRG9uZSgpIHsKKyAgICAgICAgTG9nLmkoTE9HX1RBRywgbUN1cnJlbnRUZXN0UmVsYXRpdmVQYXRoICsgIjogd2FpdFVudGlsRG9uZSgpIGNhbGxlZCIpOworICAgICAgICBtTGF5b3V0VGVzdENvbnRyb2xsZXJIYW5kbGVyLnNlbmRFbXB0eU1lc3NhZ2UoTVNHX1dBSVRfVU5USUxfRE9ORSk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQg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VNVTFRfRVhURU5TSU9OID0gInBuZyI7CisKKyAgICBzdGF0aWMgZmluYWwgaW50IE1TR19QUk9DRVNTX0FDVFVBTF9SRVNVTFRTID0gMDsKKyAgICBzdGF0aWMgZmluYWwgaW50IE1TR19BTExfVEVTVFNfRklOSVNIRUQgPSAxOworICAgIHN0YXRpYyBmaW5hbCBpbnQgTVNHX0ZJUlNUX1RFU1QgPSAyOworICAgIHN0YXRpYyBmaW5hbCBpbnQgTVNHX0NVUlJFTlRfVEVTVF9DUkFTSEVEID0gMzsKKworICAgIC8qKgorICAgICAqIFRoaXMgaGFuZGxlciBpcyBwdXJlbHkgZm9yIElQQy4gSXQgaXMgdXNlZCB0byBjcmVhdGUgbU1lc3NlbmdlcgorICAgICAqIHRoYXQgZ2VuZXJhdGVzIGEgYmluZGVyIHJldHVybmVkIGluIG9uQmluZCBtZXRob2QuCisgICAgICovCisgICAgcHJpdmF0ZSBIYW5kbGVyIG1JbmNvbWluZ0hhbmRsZXIgPSBuZXcgSGFuZGxlcigpIHsKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIGhhbmRsZU1lc3NhZ2UoTWVzc2FnZSBtc2cpIHsKKyAgICAgICAgICAgIHN3aXRjaCAobXNnLndoYXQpIHsKKyAgICAgICAgICAgICAgICBjYXNlIE1TR19GSVJTVF9URVNUOgorICAgICAgICAgICAgICAgICAgICBtU3VtbWFyaXplci5yZXNldCgpOworICAgICAgICAgICAgICAgICAgICBCdW5kbGUgYnVuZGxlID0gbXNnLmdldERhdGEoKTsKKyAgICAgICAgICAgICAgICAgICAgZW5zdXJlTmV4dFRlc3RTZXR1cChidW5kbGUuZ2V0U3RyaW5nKCJmaXJzdFRlc3QiKSwgYnVuZGxlLmdldEludCgiaW5kZXgiKSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgY2FzZSBNU0dfUFJPQ0VTU19BQ1RVQUxfUkVTVUxUUzoKKyAgICAgICAgICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywibUluY29taW5nSGFuZGxlcjogIiArIG1zZy5nZXREYXRhKCkuZ2V0U3RyaW5nKCJyZWxhdGl2ZVBhdGgiKSk7CisgICAgICAgICAgICAgICAgICAgIG9uQWN0dWFsUmVzdWx0c09idGFpbmVkKG1zZy5nZXREYXRhKCkpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgICAgIGNhc2UgTVNHX0NVUlJFTlRfVEVTVF9DUkFTSEVEOgorICAgICAgICAgICAgICAgICAgICBtQ3Jhc2hNZXNzYWdlc0hhbmRsZXIucmVtb3ZlTWVzc2FnZXMoTVNHX0NSQVNIX1RJTUVPVVRfRVhQSVJFRCk7CisgICAgICAgICAgICAgICAgICAgIG9uVGVzdENyYXNoZWQoKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICBjYXNlIE1TR19BTExfVEVTVFNfRklOSVNIRUQ6CisgICAgICAgICAgICAgICAgICAgIG1TdW1tYXJpemVyLnNldFRlc3RzUmVsYXRpdmVQYXRoKG1BbGxUZXN0c1JlbGF0aXZlUGF0aCk7CisgICAgICAgICAgICAgICAgICAgIG1TdW1tYXJpemVyLnN1bW1hcml6ZSgpOworICAgICAgICAgICAgICAgICAgICBJbnRlbnQgaW50ZW50ID0gbmV3IEludGVudChNYW5hZ2VyU2VydmljZS50aGlzLCBUZXN0c0xpc3RBY3Rpdml0eS5jbGFzcyk7CisgICAgICAgICAgICAgICAgICAgIGludGVudC5zZXRBY3Rpb24oSW50ZW50LkFDVElPTl9TSFVURE9XTik7CisgICAgICAgICAgICAgICAgICAgIC8qKiBUaGlzIGZsYWcgaXMgbmVlZGVkIGJlY2F1c2Ugd2Ugc2VuZCB0aGUgaW50ZW50IGZyb20gdGhlIHNlcnZpY2UgKi8KKyAgICAgICAgICAgICAgICAgICAgaW50ZW50LmFkZEZsYWdzKEludGVudC5GTEFHX0FDVElWSVRZX05FV19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0ZXJuOworCisvKioKKyAqIEEgY2xhc3MgdGhhdCBjb2xsZWN0cyBpbmZvcm1hdGlvbiBhYm91dCB0ZXN0cyB0aGF0IHJhbiBhbmQgY2FuIGNyZWF0ZSBIVE1MCisgKiBmaWxlcyB3aXRoIHN1bW1hcmllcyBhbmQgZWFzeSBuYXZpZ2F0aW9uLgorICovCitwdWJsaWMgY2xhc3MgU3VtbWFyaXplciB7CisKKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBTdHJpbmcgTE9HX1RBRyA9ICJTdW1tYXJpemVyIjsKKworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIFN0cmluZyBDU1MgPQorICAgICAgICAgICAgIjxzdHlsZSB0eXBlPVwidGV4dC9jc3NcIj4iICsKKyAgICAgICAgICAgICIqIHsiICsKKyAgICAgICAgICAgICIgICAgICAgZm9udC1mYW1pbHk6IFZlcmRhbmE7IiArCisgICAgICAgICAgICAiICAgICAgIGJvcmRlcjogMDsiICsKKyAgICAgICAgICAgICIgICAgICAgbWFyZ2luOiAwOyIgKworICAgICAgICAgICAgIiAgICAgICBwYWRkaW5nOiAwO30iICsKKyAgICAgICAgICAgICJib2R5IHsiICsKKyAgICAgICAgICAgICIgICAgICAgbWFyZ2luOiAxMHB4O30iICsKKyAgICAgICAgICAgICJoMSB7IiArCisgICAgICAgICAgICAiICAgICAgIGZvbnQtc2l6ZTogMjRweDsiICsKKyAgICAgICAgICAgICIgICAgICAgbWFyZ2luOiA0cHggMCA0cHggMDt9IiArCisgICAgICAgICAgICAiaDIgeyIgKworICAgICAgICAgICAgIiAgICAgICBmb250LXNpemU6MThweDsiICsKKyAgICAgICAgICAgICIgICAgICAgdGV4dC10cmFuc2Zvcm06IHVwcGVyY2FzZTsiICsKKyAgICAgICAgICAgICIgICAgICAgbWFyZ2luOiAyMHB4IDAgM3B4IDA7fSIgKworICAgICAgICAgICAgImgzLCBoMyBhIHsiICsKKyAgICAgICAgICAgICIgICAgICAgZm9udC1zaXplOiAxNHB4OyIgKworICAgICAgICAgICAgIiAgICAgICBjb2xvcjogYmxhY2s7IiArCisgICAgICAgICAgICAiICAgICAgIHRleHQtZGVjb3JhdGlvbjogbm9uZTsiICsKKyAgICAgICAgICAgICIgICAgICAgbWFyZ2luLXRvcDogNHB4OyIgKworICAgICAgICAgICAgIiAgICAgICBtYXJnaW4tYm90dG9tOiAycHg7fSIgKworICAgICAgICAgICAgImgzIGEgc3Bhbi5wYXRoIHsiICsKKyAgICAgICAgICAgICIgICAgICAgdGV4dC1kZWNvcmF0aW9uOiB1bmRlcmxpbmU7fSIgKworICAgICAgICAgICAgImgzIHNwYW4udHJpIHsiICsKKyAgICAgICAgICAgICIgICAgICAgdGV4dC1kZWNvcmF0aW9uOiBub25lOyIgKworICAgICAgICAgICAgIiAgICAgICBmbG9hdDogbGVmdDsiICsKKyAgICAgICAgICAgICIgICAgICAgd2lkdGg6IDIwcHg7fSIgKworICAgICAgICAgICAgImgzIHNwYW4uc3FyIHsiICsKKyAgICAgICAgICAgICIgICAgICAgdGV4dC1kZWNvcmF0aW9uOiBub25lOyIgKworICAgICAgICAgICAgIiAgICAgICBjb2xvcjogIzhlZTEwMDsiICsKKyAgICAgICAgICAgICIgICAgICAgZmxvYXQ6IGxlZnQ7IiArCisgICAgICAgICAgICAiICAgICAgIHdpZHRoOiAyMHB4O30iICsKKyAgICAgICAgICAgICJzcGFuLnNvdXJjZSB7IiArCisgICAgICAgICAgICAiICAgICAgIGRpc3BsYXk6IGJsb2NrOyIgKworICAgICAgICAgICAgIiAgICAgICBmb250LXNpemU6IDEwcHg7IiArCisgICAgICAgICAgICAiICAgICAgIGNvbG9yOiAjODg4OyIgKworICAgICAgICAgICAgIiAgICAgICBtYXJnaW4tbGVmdDogMjBweDsiICsKKyAgICAgICAgICAgICIgICAgICAgbWFyZ2luLWJvdHRvbTogMXB4O30iICsKKyAgICAgICAgICAgICJzcGFuLnNvdXJjZSBhIHsiICsKKyAgICAgICAgICAgICIgICAgICAgZm9udC1zaXplOiAxMHB4OyIgKworICAgICAgICAgICAgIiAgICAgICBjb2xvcjogIzg4ODt9IiArCisgICAgICAgICAgICAiaDMgaW1nIHsiICsKKyAgICAgICAgICAgICIgICAgICAgd2lkdGg6IDhweDsiICsKKyAgICAgICAgICAgICIgICAgICAgbWFyZ2luLXJpZ2h0OiA0cHg7fSIgKworICAgICAgICAgICAgImRpdi5kaWZmIHsiICsKKyAgICAgICAgICAgICIgICAgICAgbWFyZ2luLWJvdHRvbTogMjVweDt9IiArCisgICAgICAgICAgICAiZGl2LmRpZmYgYSB7IiArCisgICAgICAgICAgICAiICAgICAgIGZvbnQtc2l6ZTogMTJweDsiICsKKyAgICAgICAgICAgICIgICAgICAgY29sb3I6ICM4ODg7fSIgKworICAgICAgICAgICAgInRhYmxlLnZpc3VhbF9kaWZmIHsiICsKKyAgICAgICAgICAgICIgICAgICAgYm9yZGVyLWJvdHRvbTogMHB4IHNvbGlkOyIgKworICAgICAgICAgICAgIiAgICAgICBib3JkZXItY29sbGFwc2U6IGNvbGxhcHNlOyIgKworICAgICAgICAgICAgIiAgICAgICB3aWR0aDogMTAwJTsiICsKKyAgICAgICAgICAgICIgICAgICAgbWFyZ2luLWJvdHRvbTogMnB4O30iICsKKyAgICAgICAgICAgICJ0YWJsZS52aXN1YWxfZGlmZiB0ci5oZWFkZXJzIHRkIHsiICsKKyAgICAgICAgICAgICIgICAgICAgYm9yZGVyLWJvdHRvbTogMXB4IHNvbGlkOyIgKworICAgICAgICAgICAgIiAgICAgICBib3JkZXItdG9wOiAwOyIgKworICAgICAgICAgICAgIiAgICAgICBwYWRkaW5nLWJvdHRvbTogM3B4O30iICsKKyAgICAgICAgICAgICJ0YWJsZS52aXN1YWxfZGlmZiB0ci5yZXN1bHRzIHRkIHsiICsKKyAgICAgICAgICAgICIgICAgICAgYm9yZGVyLXRvcDogMXB4IGRhc2hlZDsiICsKKyAgICAgICAgICAgICIgICAgICAgYm9yZGVyLXJpZ2h0OiAxcHggc29saWQ7IiArCisgICAgICAgICAgICAiICAgICAgIGZvbnQtc2l6ZTogMTVweDsiICsKKyAgICAgICAgICAgICIgICAgICAgdmVydGljYWwtYWxpZ246IHRvcDt9IiArCisgICAgICAgICAgICAidGFibGUudmlzdWFsX2RpZmYgdHIucmVzdWx0cyB0ZC5saW5lX2NvdW50IHsiICsKKyAgICAgICAgICAgICIgICAgICAgYmFja2dyb3VuZC1jb2xvcjojYWFhOyIgKworICAgICAgICAgICAgIiAgICAgICBtaW4td2lkdGg6MjBweDsiICsKKyAgICAgICAgICAgICIgICAgICAgdGV4dC1hbGlnbjogcmlnaHQ7IiArCisgICAgICAgICAgICAiICAgICAgIGJvcmRlci1yaWdodDogMXB4IHNvbGlkOyIgKworICAgICAgICAgICAgIiAgICAgICBib3JkZXItbGVmdDogMXB4IHNvbGlkOyIgKworICAgICAgICAgICAgIiAgICAgICBwYWRkaW5nOiAycHggMXB4IDJweCAwcHg7fSIgKworICAgICAgICAgICAgInRhYmxlLnZpc3VhbF9kaWZmIHRyLnJlc3VsdHMgdGQubGluZSB7IiArCisgICAgICAgICAgICAiICAgICAgIHBhZGRpbmc6IDJweCAwcHggMnB4IDRweDsiICsKKyAgICAgICAgICAgICIgICAgICAgYm9yZGVyLXJpZ2h0OiAxcHggc29saWQ7IiArCisgICAgICAgICAgICAiICAgICAgIHdpZHRoOiA0OS44JTt9IiArCisgICAgICAgICAgICAidGFibGUudmlzdWFsX2RpZmYgdHIuZm9vdGVycyB0ZCB7IiArCisgICAgICAgICAgICAiICAgICAgIGJvcmRlci10b3A6IDFweCBzb2xpZDsiICsKKyAgICAgICAgICAgICIgICAgICAgYm9yZGVyLWJvdHRvbTogMDt9IiArCisgICAgICAgICAgICAidGFibGUudmlzdWFsX2RpZmYgdHIgdGQuc3BhY2UgeyIgKworICAgICAgICAgICAgIiAgICAgICBib3JkZXI6IDA7IiArCisgICAgICAgICAgICAiICAgICAgIHdpZHRoOiAwLjQlfSIgKworICAgICAgICAgICAgImRpdi5zcGFjZSB7IiArCisgICAgICAgICAgICAiICAgICAgIG1hcmdpbi10b3A6NHB4O30iICsKKyAgICAgICAgICAgICJzcGFuLmVxbCB7IiArCisgICAgICAgICAgICAiICAgICAgIGJhY2tncm91bmQtY29sb3I6ICNmM2YzZjM7fSIgKworICAgICAgICAgICAgInNwYW4uZGVsIHsiICsKKyAgICAgICAgICAgICIgICAgICAgYmFja2dyb3VuZC1jb2xvcjogI2ZmODg4ODsgfSIgKworICAgICAgICAgICAgInNwYW4uaW5zIHsiICsKKyAgICAgICAgICAgICIgICAgICAgYmFja2dyb3VuZC1jb2xvcjogIzg4ZmY4ODsgfSIgKworICAgICAgICAgICAgInNwYW4uZmFpbCB7IiArCisgICAgICAgICAgICAiICAgICAgIGNvbG9yOiByZWQ7fSIgKworICAgICAgICAgICAgInNwYW4ucGFzcyB7IiArCisgICAgICAgICAgICAiICAgICAgIGNvbG9yOiBncmVlbjt9IiArCisgICAgICAgICAgICAic3Bhbi50aW1lX291dCB7IiArCisgICAgICAgICAgICAiICAgICAgIGNvbG9yOiBvcmFuZ2U7fSIgKworICAgICAgICAgICAgInRhYmxlLnN1bW1hcnkgeyIgKworICAgICAgICAgICAgIiAgICAgICBib3JkZXI6IDFweCBzb2xpZCBibGFjazsiICsKKyAgICAgICAgICAgICIgICAgICAgbWFyZ2luLXRvcDogMjBweDt9IiArCisgICAgICAgICAgICAidGFibGUuc3VtbWFyeSB0ZCB7IiArCisgICAgICAgICAgICAiICAgICAgIHBhZGRpbmc6IDNweDt9IiArCisgICAgICAgICAgICAic3Bhbi5saXN0SXRlbSB7IiArCisgICAgICAgICAgICAiICAgICAgIGZvbnQtc2l6ZTogMTFweDsiICsKKyAgICAgICAgICAgICIgICAgICAgZm9udC13ZWlnaHQ6IG5vcm1hbDsiICsKKyAgICAgICAgICAgICIgICAgICAgdGV4dC10cmFuc2Zvcm06IHVwcGVyY2FzZTsiICsKKyAgICAgICAgICAgICIgICAgICAgcGFkZGluZzogM3B4OyIgKworICAgICAgICAgICAgIiAgICAgICAtd2Via2l0LWJvcmRlci1yYWRpdXM6IDRweDt9IiArCisgICAgICAgICAgICAic3Bhbi4iICsgQWJzdHJhY3RSZXN1bHQuUmVzdWx0Q29kZS5QQVNTLm5hbWUoKSArICJ7IiArCisgICAgICAgICAgICAiICAgICAgIGJhY2tncm91bmQtY29sb3I6ICM4ZWUxMDA7IiArCisgICAgICAgICAgICAiICAgICAgIGNvbG9yOiBibGFjazt9IiArCisgICAgICAgICAgICAic3Bhbi4iICsgQWJzdHJhY3RSZXN1bHQuUmVzdWx0Q29kZS5GQUlMX1JFU1VMVF9ESUZGRVJTLm5hbWUoKSArICJ7IiArCisgICAgICAgICAgICAiICAgICAgIGJhY2tncm91bmQtY29sb3I6ICNjY2M7IiArCisgICAgICAgICAgICAiICAgICAgIGNvbG9yOiBibGFjazt9IiArCisgICAgICAgICAgICAic3Bhbi4iICsgQWJzdHJhY3RSZXN1bHQuUmVzdWx0Q29kZS5GQUlMX05PX0VYUEVDVEVEX1JFU1VMVC5uYW1lKCkgKyAieyIgKworICAgICAgICAgICAgIiAgICAgICBiYWNrZ3JvdW5kLWNvbG9yOiAjYTcwMGU0OyIgKworICAgICAgICAgICAgIiAgICAgICBjb2xvcjogI2ZmZjt9IiArCisgICAgICAgICAgICAic3Bhbi4iICsgQWJzdHJhY3RSZXN1bHQuUmVzdWx0Q29kZS5GQUlMX1RJTUVEX09VVC5uYW1lKCkgKyAieyIgKworICAgICAgICAgICAgIiAgICAgICBiYWNrZ3JvdW5kLWNvbG9yOiAjZjNjYjAwOyIgKworICAgICAgICAgICAgIiAgICAgICBjb2xvcjogYmxhY2s7fSIgKworICAgICAgICAgICAgInNwYW4uIiArIEFic3RyYWN0UmVzdWx0LlJlc3VsdENvZGUuRkFJTF9DUkFTSEVELm5hbWUoKSArICJ7IiArCisgICAgICAgICAgICAiICAgICAgIGJhY2tncm91bmQtY29sb3I6ICNjMzAwMDA7IiArCisgICAgICAgICAgICAiICAgICAgIGNvbG9yOiAjZmZmO30iICsKKyAgICAgICAgICAgICJzcGFuLm5vTHRjIHsiICsKKyAgICAgICAgICAgICIgICAgICAgYmFja2dyb3VuZC1jb2xvcjogIzk0NDAwMDsiICsKKyAgICAgICAgICAgICIgICAgICAgY29sb3I6ICNmZmY7fSIgKworICAgICAgICAgICAgInNwYW4ubm9FdmVudFNlbmRlciB7IiArCisgICAgICAgICAgICAiICAgICAgIGJhY2tncm91bmQtY29sb3I6ICM4MTU2MDA7IiArCisgICAgICAgICAgICAiICAgICAgIGNvbG9yOiAjZmZmO30iICsKKyAgICAgICAgICAgICI8L3N0eWxlPiI7CisKKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBTdHJpbmcgU0NSSVBUID0KKyAgICAgICAgICAgICI8c2NyaXB0IHR5cGU9XCJ0ZXh0L2phdmFzY3JpcHRcIj4iICsKKyAgICAgICAgICAgICIgICAgZnVuY3Rpb24gdG9nZ2xlRGlzcGxheShpZCkgeyIgKworICAgICAgICAgICAgIiAgICAgICAgZWxlbWVudCA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKGlkKTsiICsKKyAgICAgICAgICAgICIgICAgICAgIHRyaWFuZ2xlID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoJ3RyaS4nICsgaWQpOyIgKworICAgICAgICAgICAgIiAgICAgICAgaWYgKGVsZW1lbnQuc3R5bGUuZGlzcGxheSA9PSAnbm9uZScpIHsiICsKKyAgICAgICAgICAgICIgICAgICAgICAgICBlbGVtZW50LnN0eWxlLmRpc3BsYXkgPSAnaW5saW5lJzsiICsKKyAgICAgICAgICAgICIgICAgICAgICAgICB0cmlhbmdsZS5pbm5lckhUTUwgPSAnJiN4MjViYzsgJzsiICsKKyAgICAgICAgICAgICIgICAgICAgIH0gZWxzZSB7IiArCisgICAgICAgICAgICAiICAgICAgICAgICAgZWxlbWVudC5zdHlsZS5kaXNwbGF5ID0gJ25vbmUnOyIgKworICAgICAgICAgICAgIiAgICAgICAgICAgIHRya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vcm1hdCgieXl5eS9NTS9kZCBISDptbTpzcyIpOworICAgICAgICB0eHQuYXBwZW5kKG1UZXN0c1JlbGF0aXZlUGF0aCArICJcbiIpOworICAgICAgICB0eHQuYXBwZW5kKCJEYXRlOiAiICsgZGF0ZUZvcm1hdC5mb3JtYXQobURhdGUpICsgIlxuIik7CisgICAgICAgIHR4dC5hcHBlbmQoIkJ1aWxkIGZpbmdlcnByaW50OiAiICsgQnVpbGQuRklOR0VSUFJJTlQgKyAiXG4iKTsKKyAgICAgICAgdHh0LmFwcGVuZCgiV2ViS2l0IHZlcnNpb246ICIgKyBnZXRXZWJLaXRWZXJzaW9uRnJvbVVzZXJBZ2VudFN0cmluZygpICsgIlxuIik7CisgICAgICAgIHR4dC5hcHBlbmQoIldlYktpdCByZXZpc2lvbjogIiArIGdldFdlYktpdFJldmlzaW9uKCkgKyAiXG4iKTsKKworICAgICAgICB0eHQuYXBwZW5kKCJUT1RBTDogICAiICsgZ2V0VG90YWxUZXN0Q291bnQoKSArICJcbiIpOworICAgICAgICBpZiAobUNyYXNoZWRUZXN0c0NvdW50ID4gMCkgeworICAgICAgICAgICAgdHh0LmFwcGVuZCgiQ1JBU0hFRCAodG90YWwgYW1vbmcgYWxsIHRlc3RzKTogIiArIG1DcmFzaGVkVGVzdHNDb3VudCArICJcbiIpOworICAgICAgICAgICAgdHh0LmFwcGVuZCgiLS0tLS0tLS0tLS0tLSIpOworICAgICAgICB9CisgICAgICAgIHR4dC5hcHBlbmQoIlVORVhQRUNURUQgRkFJTFVSRVM6ICIgKyBtVW5leHBlY3RlZEZhaWx1cmVzLnNpemUoKSArICJcbiIpOworICAgICAgICB0eHQuYXBwZW5kKCJVTkVYUEVDVEVEIFBBU1NFUzogICAiICsgbVVuZXhwZWN0ZWRQYXNzZXMuc2l6ZSgpICsgIlxuIik7CisgICAgICAgIHR4dC5hcHBlbmQoIkVYUEVDVEVEIEZBSUxVUkVTOiAgICIgKyBtRXhwZWN0ZWRGYWlsdXJlcy5z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50KTsKKyAgICAgICAgaWYgKG1hdGNoZXIuZmluZCgpKSB7CisgICAgICAgICAgICByZXR1cm4gbWF0Y2hlci5ncm91cCgxKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gInVua25vd24iOworICAgIH0KKworICAgIHByaXZhdGUgU3RyaW5nIGdldFdlYktpdFJldmlzaW9uKCkgeworICAgICAgICBVUkwgdXJsID0gbnVsbDsKKyAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgIHVybCA9IG5ldyBVUkwoRm9yd2FyZGVyTWFuYWdlci5nZXRIb3N0U2NoZW1lUG9ydChmYWxzZSkgKyAiV0VCS0lUX01FUkdFX1JFVklTSU9OIik7CisgICAgICAgIH0gY2F0Y2ggKE1hbGZvcm1lZFVSTEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICBhc3NlcnQgZmFsc2U7CisgICAgICAgIH0KKworICAgICAgICBTdHJpbmcgd2Via2l0TWVyZ2VSZXZpc2lvbkZpbGVDb250ZW50cyA9IG5ldyBTdHJpbmcoRnNVdGlscy5yZWFkRGF0YUZyb21VcmwodXJsKSk7CisgICAgICAgIE1hdGNoZXIgbWF0Y2hlciA9CisgICAgICAgICAgICBQYXR0ZXJuLmNvbXBpbGUoImh0dHA6Ly9zdm4ud2Via2l0Lm9yZy9yZXBvc2l0b3J5L3dlYmtpdC90cnVua0AoWzAtOV0rKSIpLm1hdGNoZXIoCisgICAgICAgICAgICAgICAgICAgIHdlYmtpdE1lcmdlUmV2aXNpb25GaWxlQ29udGVudHMpOworICAgICAgICBpZiAobWF0Y2hlci5maW5kKCkpIHsKKyAgICAgICAgICAgIHJldHVybiBtYXRjaGVyLmdyb3VwKDEpOworICAgICAgICB9CisgICAgICAgIHJldHVybiAidW5rbm93biI7CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIGNyZWF0ZVRvcFN1bW1hcnlUYWJsZShTdHJpbmdCdWlsZGVyIGh0bWwpIHsKKyAgICAgICAgU2ltcGxlRGF0ZUZvcm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CisgICAgICAgICAgICBMaXN0PEFic3RyYWN0UmVzdWx0PiByZXN1bHRzTGlzdCkgeworICAgICAgICBTdHJpbmcgcmVsYXRpdmVQYXRoOworICAgICAgICBTdHJpbmcgaWQgPSAiIjsKKyAgICAgICAgQWJzdHJhY3RSZXN1bHQuUmVzdWx0Q29kZSByZXN1bHRDb2RlOworCisgICAgICAgIENvbGxlY3Rpb25zLnNvcnQocmVzdWx0c0xpc3QpOworICAgICAgICBodG1sLmFwcGVuZCgiPGgyPiIgKyB0aXRsZSArICIgWyIgKyByZXN1bHRzTGlzdC5zaXplKCkgKyAiXTwvaDI+Iik7CisgICAgICAgIGZvciAoQWJzdHJhY3RSZXN1bHQgcmVzdWx0IDogcmVzdWx0c0xpc3QpIHsKKyAgICAgICAgICAgIHJlbGF0aXZlUGF0aCA9IHJlc3VsdC5nZXRSZWxhdGl2ZVBhdGgoKTsKKyAgICAgICAgICAgIHJlc3VsdENvZGUgPSByZXN1bHQuZ2V0UmVzdWx0Q29kZSgpOworICAgICAgICAgICAgYXNzZXJ0IHJlc3VsdENvZGUgIT0gQWJzdHJhY3RSZXN1bHQuUmVzdWx0Q29kZS5QQVNTIDogInJlc3VsdENvZGU9IiArIHJlc3VsdENvZGU7CisKKyAgICAgICAgICAgIGh0bWwuYXBwZW5kKCI8aDM+Iik7CisKKyAgICAgICAgICAgIC8qKgorICAgICAgICAgICAgICogVGVjaG5pY2FsbHksIHR3byBkaWZmZXJlbnQgcGF0aHMgY291bGQgZW5kIHVwIGJlaW5nIHRoZSBzYW1lLCBiZWNhdXNlCisgICAgICAgICAgICAgKiAnOicgaXMgYSB2YWxpZCAgY2hhcmFjdGVyIGluIGEgcGF0aC4gSG93ZXZlciwgaXQgaXMgcHJvYmFibHkgbm90IGdvaW5nCisgICAgICAgICAgICAgKiB0byBjYXVzZSBhbnkgcHJvYmxlbXMgaW4gdGhpcyBjYXNlCisgICAgICAgICAgICAgKi8KKyAgICAgICAgICAgIGlkID0gcmVsYXRpdmVQYXRoLnJlcGxhY2UoRmlsZS5zZXBhcmF0b3IsICI6Iik7CisgICAgICAgICAgICBodG1sLmFwcGVuZCgiPGEgaHJlZj1cIiNcIiBvbkNsaWNrPVwidG9nZ2xlRGlzcGxheSgnIiArIGlkICsgIicpOyIpOworICAgICAgICAgICAgaHRtbC5hcHBlbmQoInJldHVybiBmYWxzZTtcIj4iKTsKKyAgICAgICAgICAgIGh0bWwuYXBwZW5kKCI8c3BhbiBjbGFzcz1cInRyaVwiIGlkPVwidHJpLiIgKyBpZCArICJcIj4mI3gyNWI2OyA8L3NwYW4+Iik7CisgICAgICAgICAgICBodG1sLmFwcGVuZCgiPHNwYW4gY2xhc3M9XCJwYXRoXCI+IiArIHJlbGF0aXZlUGF0aCArICI8L3NwYW4+Iik7CisgICAgICAgICAgICBodG1sLmFwcGVuZCgiPC9hPiIpOworCisgICAgICAgICAgICBodG1sLmFwcGVuZCgiIDxzcGFuIGNsYXNzPVwibGlzdEl0ZW0gIiArIHJlc3VsdENvZGUubmFtZSgpICsgIlwiPiIpOworICAgICAgICAgICAgaHRtbC5hcHBlbmQocmVzdWx0Q29kZS50b1N0cmluZygpKTsKKyAgICAgICAgICAgIGh0bWwuYXBwZW5kKCI8L3NwYW4+Iik7CisKKyAgICAgICAgICAgIC8qKiBEZXRlY3QgbWlzc2luZyBMVEMgZnVuY3Rpb24gKi8KKyAgICAgICAgICAgIFN0cmluZyBhZGRpdGlvbmFsVGV4dE91dHB1dFN0cmluZyA9IHJlc3VsdC5nZXRBZGRpdGlvbmFsVGV4dE91dHB1dFN0cmluZygpOworICAgICAgICAgICAgaWYgKGFkZGl0aW9uYWxUZXh0T3V0cHV0U3RyaW5nICE9IG51bGwgJiYKKyAgICAgICAgICAgICAgICAgICAgYWRkaXRpb25hbFRleHRPdXRwdXRTdHJpbmcuY29udGFpbnMoImNvbS5hbmRyb2lkLmR1bXByZW5kZXJ0cmVlIikgJiYKKyAgICAgICAgICAgICAgICAgICAgYWRkaXRpb25hbFRleHRPdXRwdXRTdHJpbmcuY29udGFpbnMoImhhcyBubyBtZXRob2QiKSkgeworICAgICAgICAgICAgICAgIGlmIChhZGRpdGlvbmFsVGV4dE91dHB1dFN0cmluZy5jb250YWlucygiTGF5b3V0VGVzdENvbnRyb2xsZXIiKSkgeworICAgICAgICAgICAgICAgICAgICBodG1sLmFwcGVuZCgiIDxzcGFuIGNsYXNzPVwibGlzdEl0ZW0gbm9MdGNcIj5MVEMgZnVuY3Rpb24gbWlzc2luZzwvc3Bhbj4iKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKGFkZGl0aW9uYWxUZXh0T3V0cHV0U3RyaW5nLmNvbnRhaW5zKCJFdmVudFNlbmRlciIpKSB7CisgICAgICAgICAgICAgICAgICAgIGh0bWwuYXBwZW5kKCIgPHNwYW4gY2xhc3M9XCJsaXN0SXRlbSBub0V2ZW50U2VuZGVyXCI+Iik7CisgICAgICAgICAgICAgICAgICAgIGh0bWwuYXBwZW5kKCJFUyBmdW5jdGlvbiBtaXNzaW5nPC9zcGFuPiIpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaHRtbC5hcHBlbmQoIjwvaDM+Iik7CisgICAgICAgICAgICBhcHBlbmRFeHBlY3RlZFJlc3VsdHNTb3VyY2VzKHJlc3VsdCwgaHRtbCk7CisKKyAgICAgICAgICAgIGh0bWwuYXBwZW5kKCI8ZGl2IGNsYXNzPVwiZGlmZlwiIHN0eWxlPVwiZGlzcGxheTogbm9uZTtcIiBpZD1cIiIgKyBpZCArICJcIj4iKTsKKyAgICAgICAgICAgIGh0bWwuYXBwZW5kKHJlc3VsdC5nZXREaWZmQXNIdG1sKCkpOworICAgICAgICAgICAgaHRtbC5hcHBlbmQoIjxhIGhyZWY9XCIjXCIgb25DbGljaz1cInRvZ2dsZURpc3BsYXkoJyIgKyBpZCArICInKTsiKTsKKyAgICAgICAgICAgIGh0bWwuYXBwZW5kKCJyZXR1cm4gZmFsc2U7XCI+SGlkZTwvYT4iKTsKKyAgICAgICAgICAgIGh0bWwuYXBwZW5kKCIgfCAiKTsKKyAgICAgICAgICAgIGh0bWwuYXBwZW5kKCI8YSBocmVmPVwiIiArIGdldFZpZXdTb3VyY2VVcmwocmVsYXRpdmVQYXRoKS50b1N0cmluZygpICsgIlwiIik7CisgICAgICAgICAgICBodG1sLmFwcGVuZCgiIHRhcmdldD1cIl9ibGFua1wiPlNob3cgc291cmNlPC9hPiIpOworICAgICAgICAgICAgaHRtbC5hcHBlbmQoIjwvZGl2PiIpOworCisgICAgICAgICAgICBodG1sLmFwcGVuZCgiPGRpdiBjbGFzcz1cInNwYWNlXCI+PC9kaXY+Iik7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgY3JlYXRlUmVzdWx0c0xpc3ROb0RpZmYoU3RyaW5nQnVpbGRlciBodG1sLCBTdHJpbmcgdGl0bGUsCisgICAgICAgICAgICBMaXN0PEFic3RyYWN0UmVzdWx0PiByZXN1bHRzTGlzdCkgeworICAgICAgICBDb2xsZWN0aW9ucy5zb3J0KHJlc3VsdHNMaXN0KTsKKyAgICAgICAgaHRtbC5hcHBlbmQoIjxoMj4iICsgdGl0bGUgKyAiIFsiICsgcmVzdWx0c0xpc3Quc2l6ZSgpICsgIl08L2gyPiIpOworICAgICAgICBmb3IgKEFic3RyYWN0UmVzdWx0IHJlc3VsdCA6IHJlc3VsdHNMaXN0KSB7CisgICAgICAgICAgICBodG1sLmFwcGVuZCgiPGgzPiIpOworICAgICAgICAgICAgaHRtbC5hcHBlbmQoIjxhIGhyZWY9XCIiICsgZ2V0Vmlld1NvdXJjZVVybChyZXN1bHQuZ2V0UmVsYXRpdmVQYXRoKCkpLnRvU3RyaW5nKCkgKworICAgICAgICAgICAgICAgICAgICAiXCIiKTsKKyAgICAgICAgICAgIGh0bWwuYXBwZW5kKCIgdGFyZ2V0PVwiX2JsYW5rXCI+Iik7CisgICAgICAgICAgICBodG1s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GV4dFNvdXJjZSArICJcIiIpOworICAgICAgICAgICAgaHRtbC5hcHBlbmQoIiB0YXJnZXQ9XCJfYmxhbmtcIj4iKTsKKyAgICAgICAgICAgIGh0bWwuYXBwZW5kKHRleHRTb3VyY2UgKyAiPC9hPjwvc3Bhbj4iKTsKKyAgICAgICAgfQorICAgICAgICBpZiAoaW1hZ2VTb3VyY2UgIT0gbnVsbCkgeworICAgICAgICAgICAgaHRtbC5hcHBlbmQoIjxzcGFuIGNsYXNzPVwic291cmNlXCI+RXhwZWN0ZWQgaW1hZ2UgcmVzdWx0IGZyb206ICIpOworICAgICAgICAgICAgaHRtbC5hcHBlbmQoIjxhIGhyZWY9XCIiICsgRm9yd2FyZGVyTWFuYWdlci5nZXRIb3N0U2NoZW1lUG9ydChmYWxzZSkgKyAiTGF5b3V0VGVzdHMvIiArCisgICAgICAgICAgICAgICAgICAgIGltYWdlU291cmNlICsgIlwiIik7CisgICAgICAgICAgICBodG1sLmFwcGVuZCgiIHRhcmdldD1cIl9ibGFua1wiPiIpOworICAgICAgICAgICAgaHRtbC5hcHBlbmQoaW1hZ2VTb3VyY2UgKyAiPC9hPjwvc3Bhbj4iKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIFVSTCBnZXRWaWV3U291cmNlVXJsKFN0cmluZyByZWxhdGl2ZVBhdGgpIHsKKyAgICAgICAgVVJMIHVybCA9IG51bGw7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICB1cmwgPSBuZXcgVVJMKCJodHRwIiwgImxvY2FsaG9zdCIsIEZvcndhcmRlck1hbmFnZXIuSFRUUF9QT1JULAorICAgICAgICAgICAgICAgICAgICAiL1dlYktpdFRvb2xzL0R1bXBSZW5kZXJUcmVlL2FuZHJvaWQvdmlld19zb3VyY2UucGhwP3NyYz0iICsKKyAgICAgICAgICAgICAgICAgICAgcmVsYXRpdmVQYXRoKTsKKyAgICAgICAgfSBjYXRjaCAoTWFsZm9ybWVkV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ZlYXR1cmUoV2luZG93LkZFQVRVUkVfUFJPR1JFU1MpOworCisgICAgICAgIEludGVudCBpbnRlbnQgPSBnZXRJbnRlbnQoKTsKKyAgICAgICAgaWYgKCFpbnRlbnQuZ2V0QWN0aW9uKCkuZXF1YWxzKEludGVudC5BQ1RJT05fUlVOKSkgeworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisgICAgICAgIFN0cmluZyBwYXRoID0gaW50ZW50LmdldFN0cmluZ0V4dHJhKEVYVFJBX1RFU1RfUEFUSCk7CisKKyAgICAgICAgc1Byb2dyZXNzRGlhbG9nLnNob3coKTsKKyAgICAgICAgTWVzc2FnZSBkb25lTXNnID0gTWVzc2FnZS5vYnRhaW4obUhhbmRsZXIsIE1TR19URVNUX0xJU1RfUFJFTE9BREVSX0RPTkUpOworCisgICAgICAgIEludGVudCBzZXJ2aWNlSW50ZW50ID0gbmV3IEludGVudCh0aGlzLCBNYW5hZ2VyU2VydmljZS5jbGFzcyk7CisgICAgICAgIHNlcnZpY2VJbnRlbnQucHV0RXh0cmEoInBhdGgiLCBwYXRoKTsKKyAgICAgICAgc3RhcnRTZXJ2aWNlKHNlcnZpY2VJbnRlbnQpOworCisgICAgICAgIG5ldyBUZXN0c0xpc3RQcmVsb2FkZXJUaHJlYWQocGF0aCwgZG9uZU1zZykuc3RhcnQoKTsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwcm90ZWN0ZWQgdm9pZCBvbk5ld0ludGVudChJbnRlbnQgaW50ZW50KSB7CisgICAgICAgIGlmIChpbnRlbnQuZ2V0QWN0aW9uKCkuZXF1YWxzKEludGVudC5BQ1RJT05fUkVCT09UKSkgeworICAgICAgICAgICAgb25DcmFzaEludGVudChpbnRlbnQpOworICAgICAgICB9IGVsc2UgaWYgKGludGVudC5nZXRBY3Rpb24oKS5lcXVhbHMoSW50ZW50LkFDVElPTl9TSFVURE9XTikpIHsKKyAgICAgICAgICAgIG9uRXZlcnl0aGluZ0ZpbmlzaG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0xpc3Q7CisgICAgICAgIG1Eb25lTXNnLnNlbmRUb1RhcmdldCgpOworICAgIH0KKworICAgIC8qKgorICAgICAqIExvYWRzIGFsbCB0aGUgdGVzdHMgZnJvbSB0aGUgZ2l2ZW4gZm9sZGVycyBhbmQgYWxsIHRoZSBzdWJmb2xkZXJzCisgICAgICogaW50byBtVGVzdHNMaXN0LgorICAgICAqCisgICAgICogQHBhcmFtIGRpclJlbGF0aXZlUGF0aAorICAgICAqLworICAgIHByaXZhdGUgdm9pZCBsb2FkVGVzdHNGcm9tVXJsKFN0cmluZyBkaXJSZWxhdGl2ZVBhdGgpIHsKKyAgICAgICAgTGlua2VkTGlzdDxTdHJpbmc+IGZvbGRlcnNMaXN0ID0gbmV3IExpbmtlZExpc3Q8U3RyaW5nPigpOworICAgICAgICBmb2xkZXJzTGlzdC5hZGQoZGlyUmVsYXRpdmVQYXRoKTsKKworICAgICAgICBTdHJpbmcgcmVsYXRpdmVQYXRoOworICAgICAgICBTdHJpbmcgaXRlbU5hbWU7CisgICAgICAgIHdoaWxlICghZm9sZGVyc0xpc3QuaXNFbXB0eSgpKSB7CisgICAgICAgICAgICByZWxhdGl2ZVBhdGggPSBmb2xkZXJzTGlzdC5yZW1vdmVGaXJzdCgpOworCisgICAgICAgICAgICBmb3IgKFN0cmluZyBmb2xkZXJSZWxhdGl2ZVBhdGggOiBGc1V0aWxzLmdldExheW91dFRlc3RzRGlyQ29udGVudHMocmVsYXRpdmVQYXRoLAorICAgICAgICAgICAgICAgICAgICBmYWxzZSwgdHJ1ZSkpIHsKKyAgICAgICAgICAgICAgICBpdGVtTmFtZSA9IG5ldyBGaWxlKGZvbGRlclJlbGF0aXZlUGF0aCkuZ2V0TmFtZSgpOworICAgICAgICAgICAgICAgIGlmIChGaWxlRmlsdGVyLmlzVGVzdERpcihpdGVtTmFtZSkpIHsKKyAgICAgICAgICAgICAgICAgICAgZm9sZGVyc0xpc3QuYWRkKGZvbGRlclJlbGF0aXZlUGF0aCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorCisgICAgICAgICAgICBmb3IgKFN0cmluZyB0ZXN0UmVsYXRpdmVQYXRoIDogRnNVdGlscy5nZXRMYXlvdXRUZXN0c0RpckNvbnRlbnRzKHJlbGF0aXZlUGF0aCwKKyAgICAgICAgICAgICAgICAgICAgZmFsc2UsIGZhbHNlKSkgeworICAgICAgICAgICAgICAgIGl0ZW1OYW1lID0gbmV3IEZpbGUodGVzdFJlbGF0aXZlUGF0aCkuZ2V0TmFtZSgpOworICAgICAgICAgICAgICAgIGlmIChGaWxlRmlsdGVyLmlzVGVzdEZpbGUoaXRlbU5hbWUpKSB7CisgICAgICAgICAgICAgICAgICAgIC8qKiBXZSBjaG9zZSB0byBza2lwIGFsbCB0aGUgdGVzdHMgdGhhdCBhcmUgZXhwZWN0ZWQgdG8gY3Jhc2guICovCisgICAgICAgICAgICAgICAgICAgIGlmICghbUZpbGVGaWx0ZXIuaXNDcmFzaCh0ZXN0UmVsYXRpdmVQYXRoKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgbVRlc3RzTGlzdC5hZGQodGVzdFJlbGF0aXZlUGF0aCk7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAvKioKKyAgICAgICAgICAgICAgICAgICAgICAgICAqIFRPRE86IFN1bW1hcml6ZXIgaXMgbm93IGluIHNlcnZpY2UgLSBmaWd1cmUgb3V0IGhvdyB0byBzZW5kIHRoZSBpbmZvLgorICAgICAgICAgICAgICAgICAgICAgICAgICogUHJldmlvdXNseTogbVN1bW1hcml6ZXIuYWRkU2tpcHBlZFRlc3QocmVsYXRpdmVQYXRoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAqLworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorfQpcIE5vIG5ld2xpbmUgYXQgZW5kIG9mIGZpbGUKZGlmZiAt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Gg7CisgICAgcHJpdmF0ZSBSZXN1bHRDb2RlIG1SZXN1bHRDb2RlOworICAgIHByaXZhdGUgTWVzc2FnZSBtUmVzdWx0T2J0YWluZWRNc2c7CisKKyAgICBwcml2YXRlIGJvb2xlYW4gbUR1bXBDaGlsZEZyYW1lc0FzVGV4dDsKKworICAgIHByaXZhdGUgSGFuZGxlciBtSGFuZGxlciA9IG5ldyBIYW5kbGVyKCkgeworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgaGFuZGxlTWVzc2FnZShNZXNzYWdlIG1zZykgeworICAgICAgICAgICAgaWYgKG1zZy53aGF0ID09IE1TR19ET0NVTUVOVF9BU19URVhUKSB7CisgICAgICAgICAgICAgICAgbUFjdHVhbFJlc3VsdCA9IChTdHJpbmcpbXNnLm9iajsKKyAgICAgICAgICAgICAgICBtUmVzdWx0T2J0YWluZWRNc2cuc2VuZFRvVGFyZ2V0KCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9OworCisgICAgcHVibGljIFRleHRSZXN1bHQoU3RyaW5nIHJlbGF0aXZlUGF0aCkgeworICAgICAgICBtUmVsYXRpdmVQYXRoID0gcmVsYXRpdmVQYXRoOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHNldER1bXBDaGlsZEZyYW1lc0FzVGV4dChib29sZWFuIGR1bXBDaGlsZEZyYW1lc0FzVGV4dCkgeworICAgICAgICBtRHVtcENoaWxkRnJhbWVzQXNUZXh0ID0gZHVtcENoaWxkRnJhbWVzQXNUZXh0OworICAgIH0KKworICAgIC8qKgorICAgICAqIFVzZWQgdG8gcmVjcmVhdGUgdGhlIFJlc3VsdCB3aGVuIHJlY2VpdmVkIGJ5IHRoZSBzZXJ2aWNlLgorICAgICAqCisgICAgICogQHBhcmFtIGJ1bmRsZQorICAgICAqICAgICAgYnVuZGxlIHdpdGggZGF0YSB1c2VkIHRvIHJlY3JlYXRlIHRoZSByZXN1bHQKKyAgICAgKi8KKyAgICBw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iik7CisgICAgICAgIGh0bWwuYXBwZW5kKCIgICAgPHRyIGNsYXNzPVwiaGVhZGVyc1wiPiIpOworICAgICAgICBodG1sLmFwcGVuZCgiICAgICAgICA8dGQgY29sc3Bhbj1cIjJcIj5FeHBlY3RlZCByZXN1bHQ6PC90ZD4iKTsKKyAgICAgICAgaHRtbC5hcHBlbmQoIiAgICAgICAgPHRkIGNsYXNzPVwic3BhY2VcIj48L3RkPiIpOworICAgICAgICBodG1sLmFwcGVuZCgiICAgICAgICA8dGQgY29sc3Bhbj1cIjJcIj5BY3R1YWwgcmVzdWx0OjwvdGQ+Iik7CisgICAgICAgIGh0bWwuYXBwZW5kKCIgICAgPC90cj4iKTsKKworICAgICAgICBpZiAobUV4cGVjdGVkUmVzdWx0ID09IG51bGwgfHwgbUFjdHVhbFJlc3VsdCA9PSBudWxsKSB7CisgICAgICAgICAgICBhcHBlbmROdWxsc0h0bWwoaHRtbCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBhcHBlbmREaWZmSHRtbChodG1sKTsKKyAgICAgICAgfQorCisgICAgICAgIGh0bWwuYXBwZW5kKCIgICAgPHRyIGNsYXNzPVwiZm9vdGVyc1wiPiIpOworICAgICAgICBodG1sLmFwcGVuZCgiICAgICAgICA8dGQgY29sc3Bhbj1cIjJcIj48L3RkPiIpOworICAgICAgICBodG1sLmFwcGVuZCgiICAgICAgICA8dGQgY2xhc3M9XCJzcGFjZVwiPjwvdGQ+Iik7CisgICAgICAgIGh0bWwuYXBwZW5kKCIgICAgICAgIDx0ZCBjb2xzcGFuPVwiMlwiPjwvdGQ+Iik7CisgICAgICAgIGh0bWwuYXBwZW5kKCIgICAgPC90cj4iKTsKKyAgICAgICAgaHRtbC5hcHBlbmQoIjwvdGFibGU+Iik7CisKKyAgICAgICAgcmV0dXJuIGh0bWwudG9TdHJpbmcoKTsKKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgYXBwZW5kRGlmZkh0bWwoU3RyaW5nQnVpbGR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AgIH0gZWxzZSB7CisgICAgICAgICAgICBodG1sLmFwcGVuZChtQWN0dWFsUmVzdWx0LnJlcGxhY2UoIlxuIiwgIjxiciAvPiIpKTsKKyAgICAgICAgfQorICAgICAgICBodG1sLmFwcGVuZCgiICAgICAgICA8L3RkPiIpOworICAgICAgICBodG1sLmFwcGVuZCgiICAgIDwvdHI+Iik7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIFRlc3RUeXBlIGdldFR5cGUoKSB7CisgICAgICAgIHJldHVybiBUZXN0VHlwZS5URVhUOworICAgIH0KKworICAgIEBPdmVycmlkZQorICAgIHB1YmxpYyB2b2lkIG9idGFpbkFjdHVhbFJlc3VsdHMoV2ViVmlldyB3ZWJ2aWV3LCBNZXNzYWdlIHJlc3VsdE9idGFpbmVkTXNnKSB7CisgICAgICAgIG1SZXN1bHRPYnRhaW5lZE1zZyA9IHJlc3VsdE9idGFpbmVkTXNnOworICAgICAgICBNZXNzYWdlIG1zZyA9IG1IYW5kbGVyLm9idGFpbk1lc3NhZ2UoTVNHX0RPQ1VNRU5UX0FTX1RFWFQpOworCisgICAgICAgIC8qKgorICAgICAgICAgKiBhcmcxIC0gc2hvdWxkIGR1bXAgdG9wIGZyYW1lIGFzIHRleHQKKyAgICAgICAgICogYXJnMiAtIHNob3VsZCBkdW1wIGNoaWxkIGZyYW1lcyBhcyB0ZXh0CisgICAgICAgICAqLworICAgICAgICBtc2cuYXJnMSA9IDE7CisgICAgICAgIG1zZy5hcmcyID0gbUR1bXBDaGlsZEZyYW1lc0FzVGV4dCA/IDEgOiAwOworICAgICAgICB3ZWJ2aWV3LmRvY3VtZW50QXNUZXh0KG1zZyk7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIEJ1bmRsZSBnZXRCdW5kbGUoKSB7CisgICAgICAgIEJ1bmRsZSBidW5kbGUgPSBuZXcgQnVuZGxlKCk7CisgICAgICAgIGJ1bmRsZS5wdXRTdHJpbmcoImV4cGVjdG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OworICAgICAgICBmb3IgKGRpZmZfbWF0Y2hfcGF0Y2guRGlmZiBkaWZmIDogZGlmZnMpIHsKKyAgICAgICAgICAgIHBhcnRzID0gZGlmZi50ZXh0LnNwbGl0KCJcbiIsIC0xKTsKKyAgICAgICAgICAgIGlmIChwYXJ0cy5sZW5ndGggPT0gMSkgeworICAgICAgICAgICAgICAgIG5ld0RpZmZzLmFkZChkaWZmKTsKKyAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgbGVuZ3RoTWludXNPbmUgPSBwYXJ0cy5sZW5ndGggLSAxOworICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBsZW5ndGhNaW51c09uZTsgaSsrKSB7CisgICAgICAgICAgICAgICAgbmV3RGlmZnMuYWRkKG5ldyBkaWZmX21hdGNoX3BhdGNoLkRpZmYoZGlmZi5vcGVyYXRpb24sIHBhcnRzW2ldICsgIlxuIikpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaWYgKCFwYXJ0c1tsZW5ndGhNaW51c09uZV0uaXNFbXB0eSgpKSB7CisgICAgICAgICAgICAgICAgbmV3RGlmZnMuYWRkKG5ldyBkaWZmX21hdGNoX3BhdGNoLkRpZmYoZGlmZi5vcGVyYXRpb24sIHBhcnRzW2xlbmd0aE1pbnVzT25lXSkpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgcmV0dXJuIG5ld0RpZmZzOworICAgIH0KKworICAgIHB1YmxpYyBzdGF0aWMgdm9pZCBnZW5lcmF0ZUV4cGVjdGVkUmVzdWx0TGluZXMoTGlua2VkTGlzdDxkaWZmX21hdGNoX3BhdGNoLkRpZmY+IGRpZmZzLAorICAgICAgICAgICAgTGlua2VkTGlzdDxJbnRlZ2VyPiBsaW5lTnVtcywgTGlua2VkTGlzdDxTdHJpbmc+IGxpbmVzKSB7CisgICAgICAgIFN0cmluZyBkZWxTcGFuID0gIjxzcGFuIGNsYXNzPVwiZGVsXCI+IjsKKyAgICAgICAgU3RyaW5nIGVxbFNwYW4gPSAiPHNwYW4gY2xhc3M9XCJlcWxcIj4iOworCisgICAgICAgIFN0cmluZyBsaW5lID0gIiI7CisgICAgICAgIGludCBpID0gMTsKKyAgICAgICAgZm9yIChkaWZmX21hdGNoX3BhdGNoLkRpZmYgZGlmZiA6IGRpZmZzKSB7CisgICAgICAgICAgICBzd2l0Y2ggKGRpZmYub3BlcmF0aW9uKSB7CisgICAgICAgICAgICAgICAgY2FzZSBERUxFVEU6CisgICAgICAgICAgICAgICAgICAgIGxpbmUgPSBwcm9jZXNzRGlmZihkaWZmLCBsaW5lTnVtcywgbGluZXMsIGxpbmUsIGksIGRlbFNwYW4pOworICAgICAgICAgICAgICAgICAgICBpZiAobGluZS5lcXVhbHMoIiIpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBpKys7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisKKyAgICAgICAgICAgICAgICBjYXNlIElOU0VSVDoKKyAgICAgICAgICAgICAgICAgICAgaWYgKGRpZmYudGV4dC5lbmRzV2l0aCgiXG4iKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgbGluZU51bXMuYWRkKERPTlRfUFJJTlRfTElORV9OVU1CRVIpOworICAgICAgICAgICAgICAgICAgICAgICAgbGluZXMuYWRkKCIiKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgICAgIGNhc2UgRVFVQUw6CisgICAgICAgICAgICAgICAgICAgIGxpbmUgPSBwcm9jZXNzRGlmZihkaWZmLCBsaW5lTnVtcywgbGluZXMsIGxpbmUsIGksIGVxbFNwYW4pOworICAgICAgICAgICAgICAgICAgICBpZiAobGluZS5lcXVhbHMoIiIpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBpKys7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBpZiAoIWxpbmUuaXNFbXB0eSgpKSB7CisgICAgICAgICAgICBsaW5lcy5hZGQobGluZSk7CisgICAgICAgICAgICBsaW5lTnVtcy5hZGQoaSk7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgc3RhdGljIHZvaWQgZ2VuZXJhdGVBY3R1YWxSZXN1bHRMaW5lcyhMaW5rZWRMaXN0PGRpZmZfbWF0Y2hfcGF0Y2guRGlmZj4gZGlmZnMsCisgICAgICAgICAgICBMaW5rZWRMaXN0PEludGVnZXI+IGxpbmVOdW1zLCBMaW5rZWRMaXN0PFN0cmluZz4gbGluZXMpIHsKKyAgICAgICAgU3RyaW5nIGluc1NwYW4gPSAiPHNwYW4gY2xhc3M9XCJpbnNcIj4iOworICAgICAgICBTdHJpbmcgZXFsU3BhbiA9ICI8c3BhbiBjbGFzcz1cImVxbFwiPiI7CisKKyAgICAgICAgU3RyaW5nIGxpbmUgPSAiIjsKKyAgICAgICAgaW50IGkgPSAxOworICAgICAgICBmb3IgKGRpZmZfbWF0Y2hfcGF0Y2guRGlmZiBkaWZmIDogZGlmZnMpIHsKKyAgICAgICAgICAgIHN3aXRjaCAoZGlmZi5vcGVyYXRpb24pIHsKKyAgICAgICAgICAgICAgICBjYXNlIElOU0VSVDoKKyAgICAgICAgICAgICAgICAgICAgbGluZSA9IHByb2Nlc3NEaWZmKGRpZmYsIGxpbmVOdW1zLCBsaW5lcywgbGluZSwgaSwgaW5zU3Bhbik7CisgICAgICAgICAgICAgICAgICAgIGlmIChsaW5lLmVxdWFscygiIikpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGkrKzsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBicmVhazsKKworICAgICAgICAgICAgICAgIGNhc2UgREVMRVRFOgorICAgICAgICAgICAgICAgICAgICBpZiAoZGlmZi50ZXh0LmVuZHNXaXRoKCJcbiIpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBsaW5lTnVtcy5hZGQoRE9OVF9QUklOVF9MSU5FX05VTUJFUik7CisgICAgICAgICAgICAgICAgICAgICAgICBsaW5lcy5hZGQoIiIpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworCisgICAgICAgICAgICAgICAgY2FzZSBFUVVBTDoKKyAgICAgICAgICAgICAgICAgICAgbGluZSA9IHByb2Nlc3NEaWZmKGRpZmYsIGxpbmVOdW1zLCBsaW5lcywgbGluZSwgaSwgZXFsU3Bhbik7CisgICAgICAgICAgICAgICAgICAgIGlmIChsaW5lLmVxdWFscygiIikpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGkrKzsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGlmICghbGluZS5pc0VtcHR5KCkpIHsKKyAgICAgICAgICAgIGxpbmVzLmFkZChsaW5lKTsKKyAgICAgICAgICAgIGxpbmVOdW1zLmFkZChpKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIEdlbmVyYXRlIG9yIGFwcGVuZCBhIGxpbmUgZm9yIGEgZ2l2ZW4gZGlmZiBhbmQgYWRkIGl0IHRvIGdpdmVuIGNvbGxlY3Rpb25zIGlmIG5lY2Vzc2FyeS4KKyAgICAgKiBJdCBwdXRzIGRpZmZzIGluIEhUTUwgc3BhbnMuCisgICAgICoKKyAgICAgKiBAcGFyYW0gZGlmZgorICAgICAqIEBwYXJhbSBsaW5lTnVtcworICAgICAqIEBwYXJhbSBsaW5lcworICAgICAqIEBwYXJhbSBsaW5lCisgICAgICogQHBhcmFtIGkKKyAgICAgKiBAcGFyYW0gYmVnU3BhbgorICAgICAqIEByZXR1cm4KKyAgICAgKi8KKyAgICBwdWJsaWMgc3RhdGljIFN0cmluZyBwcm9jZXNzRGlmZihkaWZmX21hdGNoX3BhdGNoLkRpZmYgZGlmZiwgTGlua2VkTGlzdDxJbnRlZ2VyPiBsaW5lTnVtcywKKyAgICAgICAgICAgIExpbmtlZExpc3Q8U3RyaW5nPiBsaW5lcywgU3RyaW5nIGxpbmUsIGludCBpLCBTdHJpbmcgYmVnU3BhbikgeworICAgICAgICBTdHJpbmcgZW5kU3BhbiA9ICI8L3NwYW4+IjsKKyAgICAgICAgU3RyaW5nIGJyID0gIiZuYnNwOyI7CisKKyAgICAgICAgaWYgKGRpZmYudGV4dC5lbmRzV2l0aCgiXG4iKSkgeworICAgICAgICAgICAgbGluZU51bXMuYWRkKGkrKyk7CisgICAgICAgICAgICAvKiogVE9ETzogVGhpbmsgb2YgYmV0dGVyIHdheSB0byByZXBsYWNlIHN0dWZmICovCisgICAgICAgICAgICBsaW5lICs9IGJlZ1NwYW4gKyBkaWZmLnRleHQucmVwbGFjZSgiICAiLCAiJm5ic3A7Jm5ic3A7IikKKyAgICAgICAgICAgICAgICAgICAgKyBlbmRTcGFuICsgYnI7CisgICAgICAgICAgICBsaW5lcy5hZGQobGluZSk7CisgICAgICAgICAgICBsaW5lID0gIiI7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBsaW5lICs9IGJlZ1NwYW4gKyBkaWZmLnRleHQucmVwbGFjZSgiICAiLCAiJm5ic3A7Jm5ic3A7IikgKyBlbmRTcGFuOworICAgICAgICB9CisKKyAgICAgICAgcmV0dXJuIGxpbmU7CisgICAgfQorCisgICAgcHVibGljIHN0YXRpYyBTdHJpbmcgZ2V0SHRtbChMaW5rZWRMaXN0PEludGVnZXI+IGxpbmVOdW1zMSwgTGlua2VkTGlzdDxTdHJpbmc+IGxpbmVzMSwKKyAgICAgICAgICAgIExpbmtlZExpc3Q8SW50ZWdlcj4gbGluZU51bXMyLCBMaW5rZWRMaXN0PFN0cmluZz4gbGluZXMyKSB7CisgICAgICAgIFN0cmluZ0J1aWxkZXIgaHRtbCA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7CisgICAgICAgIGludCBsaW5lTnVtOworICAgICAgICBpbnQgc2l6ZSA9IGxpbmVzMS5zaXplKCk7CisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgc2l6ZTsgaSsrKSB7CisgICAgICAgICAgICBodG1sLmFwcGVuZCgiPHRyIGNsYXNzPVwicmVzdWx0c1wiPiIpOworCisgICAgICAgICAgICBodG1sLmFwcGVuZCgiICAgIDx0ZCBjbGFzcz1cImxpbmVfY291bnRcIj4iKTsKKyAgICAgICAgICAgIGxpbmVOdW0gPSBsaW5lTnVtczEucmVtb3ZlRmlyc3QoKTsKKyAgICAgICAgICAgIGlmIChsaW5lTnVtID4gMCkgeworICAgICAgICAgICAgICAgIGh0bWwuYXBwZW5kKGxpbmVOdW0pOworICAgICAgICAgICAgfQorICAgICAgICAgICAgaHRtbC5hcHBlbmQoIiAgICA8L3RkPiIpOworCisgICAgICAgICAgICBodG1sLmFwcGVuZCgiICAgIDx0ZCBjbGFzcz1cImxpbmVcIj4iKTsKKyAgICAgICAgICAgIGh0bWwuYXBwZW5kKGxpbmVzMS5yZW1vdmVGaXJzdCgpKTsKKyAgICAgICAgICAgIGh0bWwuYXBwZW5kKCIgICAgPC90ZD4iKTsKKworICAgICAgICAgICAgaHRtbC5hcHBlbmQoIiAgICA8dGQgY2xhc3M9XCJzcGFjZVwiPjwvdGQ+Iik7CisKKyAgICAgICAgICAgIGh0bWwuYXBwZW5kKCIgICAgPHRkIGNsYXNzPVwibGluZV9jb3VudFwiPiIpOworICAgICAgICAgICAgbGluZU51bSA9IGxpbmVOdW1zMi5yZW1vdmVGaXJzdCgpOworICAgICAgICAgICAgaWYgKGxpbmVOdW0gPiAwKSB7CisgICAgICAgICAgICAgICAgaHRtbC5hcHBlbmQobGluZU51bSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBodG1sLmFwcGVuZCgiICAgIDwvdGQ+Iik7CisKKyAgICAgICAgICAgIGh0bWwuYXBwZW5kKCIgICAg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9pZCBydW4oKSB7CisgICAgICAgICAgICBJbnB1dFN0cmVhbSBpczsKKyAgICAgICAgICAgIE91dHB1dFN0cmVhbSBvczsKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CisgICAgICAgICAgICAgICAgICAgIGlzID0gbUluU29ja2V0LmdldElucHV0U3RyZWFtKCk7CisgICAgICAgICAgICAgICAgICAgIG9zID0gbU91dFNvY2tldC5nZXRPdXRwdXRTdHJlYW0oKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9IGNhdGNoIChJT0V4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgTG9nLncoTE9HX1RBRywgdGhpcy50b1N0cmluZygpLCBlKTsKKyAgICAgICAgICAgICAgICBmaW5pc2goKTsKKyAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGJ5dGVbXSBidWZmZXIgPSBuZXcgYnl0ZVs0MDk2XTsKKyAgICAgICAgICAgIGludCBsZW5ndGg7CisgICAgICAgICAgICB3aGlsZSAodHJ1ZSkgeworICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgIGlmICgobGVuZ3RoID0gaXMucmVhZChidWZmZXIpKSA8PSAwKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBvcy53cml0ZShidWZmZXIsIDAsIGxlbmd0aCk7CisgICAgICAgICAgICAgICAgfSBjYXRjaCAoSU9FeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICAvKiogVGhpcyBleGNlcHRpb24gbWVhbnMgb25lIG9mIHRoZSBzdHJlYW1zIGlzIGNsb3NlZCAqLworICAgICAgICAgICAgICAgICAgICBMb2cudihMT0dfVEFHLCB0aGlzLnRvU3RyaW5nKCksIGUpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGZpbmlzaCgpOworICAgICAgICB9CisKKyAgICAgICAgcHJpdmF0ZSB2b2lkIGZpbmlzaCgpIHsKKyAgICAgICAgICAgIHN5bmNocm9uaXplZCAobVRocmVhZHNSdW5uaW5nKSB7CisgICAgICAgICAgICAgICAgbVRocmVhZHNSdW5uaW5nLS07CisgICAgICAgICAgICAgICAgaWYgKG1UaHJlYWRzUnVubmluZyA9PSAwKSB7CisgICAgICAgICAgICAgICAgICAgIENvbm5lY3Rpb25IYW5kbGVyLnRoaXMuc3RvcCgpOworICAgICAgICAgICAgICAgICAgICBtT25GaW5pc2hlZENhbGxiYWNrLm9uRmluaXNoZWQoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIFN0cmluZyB0b1N0cmluZygpIHsKKyAgICAgICAgICAgIHJldHVybiAiU29ja2V0UGlwZVRocmVhZDpcbiIgKyBtSW5Tb2NrZXQgKyAiXG49PlxuIiArIG1PdXRTb2NrZXQ7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIEludGVnZXIgbVRocmVhZHNSdW5uaW5nOworCisgICAgcHJpdmF0ZSBTb2NrZXQgbUZyb21Tb2NrZXQsIG1Ub1NvY2tldDsKKyAgICBwcml2YXRlIFNvY2tldFBpcGVUaHJlYWQgbUZyb21Ub1BpcGUsIG1Ub0Zyb21QaXBlOworCisgICAgcHJpdmF0ZSBPbkZpbmlzaGVkQ2FsbGJhY2sgbU9uRmluaXNoZWRDYWxsYmFjazsKKworICAgIHB1YmxpYyBDb25uZWN0aW9uSGFuZGxlcihTb2NrZXQgZnJvbVNvY2tldCwgU29ja2V0IHRvU29ja2V0KSB7CisgICAgICAgIG1Gcm9tU29ja2V0ID0gZnJvbVNvY2tldDsKKyAgICAgICAgbVRvU29ja2V0ID0gdG9Tb2NrZXQ7CisgICAgICAgIG1Gcm9tVG9QaXBlID0gbmV3IFNvY2tldFBpcGVUaHJlYWQobUZyb21Tb2NrZXQsIG1Ub1NvY2tldCk7CisgICAgICAgIG1Ub0Zyb21QaXBlID0gbmV3IFNvY2tldFBpcGVUaHJlYWQobVRvU29ja2V0LCBtRnJvbVNvY2tldCk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgcmVnaXN0ZXJPbkNvbm5lY3Rpb25IYW5kbGVyRmluaXNoZWRDYWxsYmFjayhPbkZpbmlzaGVkQ2FsbGJhY2sgY2FsbGJhY2spIHsKKyAgICAgICAgbU9uRmluaXNoZWRDYWxsYmFjayA9IGNhbGxiYWNrOworICAgIH0KKworICAgIHB1YmxpYyB2b2lkIHN0YXJ0KCkgeworICAgICAgICAvKiogV2UgaGF2ZSAyIHRocmVhZHMgcnVubmluZywgb25lIGZvciBlYWNoIHBpcGUsIHRoYXQgd2Ugc3RhcnQgaGVyZS4gKi8KKyAgICAgICAgbVRocmVhZHNSdW5uaW5nID0gMjsKKyAgICAgICAgbUZyb21Ub1BpcGUuc3RhcnQoKTsKKyAgICAgICAgbVRvRnJvbVBpcGUuc3RhcnQoKTsKKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBzdG9wKCkgeworICAgICAgICBzaHV0ZG93bihtRnJvbVNvY2tldCk7CisgICAgICAgIHNodXRkb3duKG1Ub1NvY2tldCk7CisgICAgfQorCisgICAgcHJpdmF0ZSB2b2lkIHNodXRkb3duKFNvY2tldCBzb2NrZXQpIHsKKyAgICAgICAgc3luY2hyb25pemVkIChtRnJvbVRvUGlwZSkgeworICAgICAgICAgICAgc3luY2hyb25pemVkIChtVG9Gcm9tUGlwZSkgeworICAgICAgICAgICAgICAgIC8qKiBUaGlzIHdpbGwgc3RvcCB0aGUgd2hpbGUgbG9vcCBpbiB0aGUgcnVuIG1ldGhvZCAqLworICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgIGlmICghc29ja2V0LmlzSW5wdXRTaHV0ZG93bigpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBzb2NrZXQuc2h1dGRvd25JbnB1dCgpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfSBjYXRjaCAoSU9FeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICBMb2cuZShMT0dfVEFHLCAibUZyb21Ub1BpcGU9IiArIG1Gcm9tVG9QaXBlICsgIiBtVG9Gcm9tUGlwZT0iICsgbVRvRnJvbVBpcGUsIGUpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICBpZiAoIXNvY2tldC5pc091dHB1dFNodXRkb3duKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHNvY2tldC5zaHV0ZG93bk91dHB1dCgpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfSBjYXRjaCAoSU9FeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICBMb2cuZShMT0dfVEFHLCAibUZyb21Ub1BpcGU9IiArIG1Gcm9tVG9QaXBlICsgIiBtVG9Gcm9tUGlwZT0iICsgbVRvRnJvbVBpcGUsIGUpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICBpZiAoIXNvY2tldC5pc0Nsb3NlZCgpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBzb2NrZXQuY2xvc2UoKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAgICAgTG9nLmUoTE9HX1RBRywgIm1Gcm9tVG9QaXBlPSIgKyBtRnJvbVRvUGlwZSArICIgbVRvRnJvbVBpcGU9IiArIG1Ub0Zyb21QaXBlLCBlKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9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0ID0gbVNlcnZlclNvY2tldC5hY2NlcHQoKTsKKyAgICAgICAgICAgICAgICByZW1vdGVTb2NrZXQgPSBBZGJVdGlscy5nZXRTb2NrZXRUb1JlbW90ZU1hY2hpbmUobVJlbW90ZU1hY2hpbmVJcEFkZHJlc3MsCisgICAgICAgICAgICAgICAgICAgICAgICBtUG9ydCk7CisgICAgICAgICAgICB9IGNhdGNoIChJT0V4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgLyoqIFRoaXMgbW9zdCBsaWtlbHkgbWVhbnMgdGhhdCBtU2VydmVyU29ja2V0IGlzIGFscmVhZHkgY2xvc2VkICovCisgICAgICAgICAgICAgICAgTG9nLncoTE9HX1RBRywgIm1Qb3J0PSIgKyBtUG9ydCwgZSk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmIChyZW1vdGVTb2NrZXQgPT0gbnVsbCkgeworICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgIGxvY2FsU29ja2V0LmNsb3NlKCk7CisgICAgICAgICAgICAgICAgfSBjYXRjaCAoSU9FeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICBMb2cuZShMT0dfVEFHLCAibVBvcnQ9IiArIG1Qb3J0LCBlKTsKKyAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICBMb2cuZShMT0dfVEFHLCAicnVuKCk6IG1Qb3J0PSAiICsgbVBvcnQgKyAiIEZhaWxlZCB0byBzdGFydCBmb3J3YXJkaW5nIGZyb20gIiArCisgICAgICAgICAgICAgICAgICAgICAgICBsb2NhbFNvY2tldCk7CisgICAgICAgICAgICAgICAgY29udGludWU7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGZpbmFsIENvbm5lY3Rpb25IYW5kbGVyIGNvbm5lY3Rpb25IYW5kbGVyID0KKyAgICAgICAgICAgICAgICAgICAgbmV3IENvbm5lY3Rpb25IYW5kbGVyKGxvY2FsU29ja2V0LCByZW1vdGVTb2NrZXQpOworCisgICAgICAgICAgICAvKioKKyAgICAgICAgICAgICAqIFdlIGhhdmUgdG8gY2xvc2UgdGhlIHNvY2tldHMgYWZ0ZXIgdGhlIENvbm5lY3Rpb25IYW5kbGVyIGZpbmlzaGVzLCBzbyB3ZQorICAgICAgICAgICAgICogZG9uJ3QgZ2V0ICJUb28gbWF5IG9wZW4gZmlsZXMiIGV4Y2VwdGlvbi4gV2UgYWxzbyByZW1vdmUgdGhlIENvbm5lY3Rpb25IYW5kbGVyCisgICAgICAgICAgICAgKiBmcm9tIHRoZSBjb2xsZWN0aW9uIHRvIGF2b2lkIG1lbW9yeSBpc3N1ZXMuCisgICAgICAgICAgICAgKiAqLworICAgICAgICAgICAgQ29ubmVjdGlvbkhhbmRsZXIuT25GaW5pc2hlZENhbGxiYWNrIGNhbGxiYWNrID0KKyAgICAgICAgICAgICAgICAgICAgbmV3IENvbm5lY3Rpb25IYW5kbGVyLk9uRmluaXNoZWRDYWxsYmFjaygpIHsKKyAgICAgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBvbkZpbmlzaGVkKCkgeworICAgICAgICAgICAgICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtQ29ubmVjdGlvbkhhbmRsZXJzLnJlbW92ZShjb25uZWN0aW9uSGFuZGxlcikpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAicmVtb3ZlQ29ubmVjdGlvbkhhbmRsZXIoKTogcmVtb3ZlZCIpOworICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBhc3NlcnQgZmFsc2UgOiAicmVtb3ZlQ29ubmVjdGlvbkhhbmRsZXIoKTogbm90IGluIHRoZSBjb2xsZWN0aW9uIjsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH07CisgICAgICAgICAgICBjb25uZWN0aW9uSGFuZGxlci5yZWdpc3Rlck9uQ29ubmVjdGlvbkhhbmRsZXJGaW5pc2hlZENhbGxiYWNrKGNhbGxiYWNrKTsKKworICAgICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7CisgICAgICAgICAgICAgICAgbUNvbm5lY3Rpb25IYW5kbGVycy5hZGQoY29ubmVjdGlvbkhhbmRsZXIpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY29ubmVjdGlvbkhhbmRsZXIuc3RhcnQoKTsKKyAgICAgICAgfQorCisgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgeworICAgICAgICAgICAgZm9yIChDb25uZWN0aW9uSGFuZGxlciBjb25uZWN0aW9uSGFuZGxlciA6IG1Db25uZWN0aW9uSGFuZGxlcnMpIHsKKyAgICAgICAgICAgICAgICBjb25uZWN0aW9uSGFuZGxlci5zdG9wKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwdWJsaWMgdm9pZCBmaW5pc2goKSB7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBtU2VydmVyU29ja2V0LmNsb3NlKCk7CisgICAgICAgIH0gY2F0Y2ggKElPRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIExvZy5lKExPR19UQUcsICJtUG9ydD0iICsgbVBvcnQsIGUpOworICAgICAgICB9CisgICAgfQorfQpcIE5vIG5ld2xpbmUgYXQgZW5kIG9mIGZpbGUKZGlmZiAtLWdpdCBhL3Rlc3RzL0R1bXBSZW5kZXJUcmVlMi9zcmMvY29tL2FuZHJvaWQvZHVtcHJlbmRlcnRyZWUyL2ZvcndhcmRlci9Gb3J3YXJkZXJNYW5hZ2VyLmphdmEgYi90ZXN0cy9EdW1wUmVuZGVyVHJlZTIvc3JjL2NvbS9hbmR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isgICAgICAgICAgICBwb3J0ID0gSFRUUF9QT1JUOworICAgICAgICB9CisKKyAgICAgICAgVVJMIHVybCA9IG51bGw7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICB1cmwgPSBuZXcgVVJMKHByb3RvY29sLCBIT1NULCBwb3J0LCAiLyIpOworICAgICAgICB9IGNhdGNoIChNYWxmb3JtZWRVUkxFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgYXNzZXJ0IGZhbHNlIDogImlzSHR0cHM9IiArIGlzSHR0cHM7CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gdXJsLnRvU3RyaW5nKCk7CisgICAgfQorCisgICAgcHVibGljIHN0YXRpYyBzeW5jaHJvbml6ZWQgRm9yd2FyZGVyTWFuYWdlciBnZXRGb3J3YXJkZXJNYW5hZ2VyKCkgeworICAgICAgICBpZiAoZm9yd2FyZGVyTWFuYWdlciA9PSBudWxsKSB7CisgICAgICAgICAgICBmb3J3YXJkZXJNYW5hZ2VyID0gbmV3IEZvcndhcmRlck1hbmFnZXIoKTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gZm9yd2FyZGVyTWFuYWdlcjsKKyAgICB9CisKKyAgICBAT3ZlcnJpZGUKKyAgICBwdWJsaWMgT2JqZWN0IGNsb25lKCkgdGhyb3dzIENsb25lTm90U3VwcG9ydGVkRXhjZXB0aW9uIHsKKyAgICAgICAgdGhyb3cgbmV3IENsb25lTm90U3VwcG9ydGVkRXhjZXB0aW9uKCk7CisgICAgfQorCisgICAgcHVibGljIHN5bmNocm9uaXplZCB2b2lkIHN0YXJ0KCkgeworICAgICAgICBpZiAobUlzU3RhcnRlZCkgeworICAgICAgICAgICAgTG9nLncoTE9HX1RBRywgInN0YXJ0KCk6IEZvcndhcmRlck1hbmFnZXIgYWxyZWFkeSBydW5uaW5nISBOT09QLiIpOworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisKKyAgICAgICAgZm9yIChGb3J3YXJkZXIgZm9yd2FyZGVyIDogbU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QgaW50ZW50ID0gbmV3IEludGVudCgpOworICAgICAgICBpbnRlbnQuc2V0Q2xhc3NOYW1lKCJjb20uYW5kcm9pZC5kdW1wcmVuZGVydHJlZTIiLCAiVGVzdHNMaXN0QWN0aXZpdHkiKTsKKyAgICAgICAgaW50ZW50LnNldEFjdGlvbihJbnRlbnQuQUNUSU9OX1JVTik7CisgICAgICAgIGludGVudC5wdXRFeHRyYShUZXN0c0xpc3RBY3Rpdml0eS5FWFRSQV9URVNUX1BBVEgsIHJlbGF0aXZlUGF0aCk7CisgICAgICAgIHNldEFjdGl2aXR5SW50ZW50KGludGVudCk7CisgICAgICAgIGdldEFjdGl2aXR5KCkucmVnaXN0ZXJPbkV2ZXJ5dGhpbmdGaW5pc2hlZENhbGxiYWNrKG5ldyBPbkV2ZXJ5dGhpbmdGaW5pc2hlZENhbGxiYWNrKCkgeworICAgICAgICAgICAgLyoqIFRoaXMgbWV0aG9kIGlzIHNhZmUgdG8gY2FsbCBvbiBhbnkgdGhyZWFkICovCisgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgIHB1YmxpYyB2b2lkIG9uRmluaXNoZWQoKSB7CisgICAgICAgICAgICAgICAgc3luY2hyb25pemVkIChTdGFydGVyLnRoaXMpIHsKKyAgICAgICAgICAgICAgICAgICAgbUV2ZXJ5dGhpbmdGaW5pc2hlZCA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgIFN0YXJ0ZXIudGhpcy5ub3RpZnlBbGwoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0pOworCisgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgeworICAgICAgICAgICAgd2hpbGUgKCFtRXZlcnl0aGluZ0ZpbmlzaGVkKSB7CisgICAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAgICAgdGhpcy53YWl0KCk7CisgICAgICAgICAgICAgICAgfSBjYXRjaCAoSW50ZXJydXB0ZWRFeGNlcHRpb24g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VyOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIHJ1bigpIHsKKyAgICAgICAgICAgIE1lc3NhZ2UgbXNnID0gbUhhbmRsZXIub2J0YWluTWVzc2FnZShNU0dfTE9BREVEX0lURU1TKTsKKyAgICAgICAgICAgIG1zZy5vYmogPSBnZXREaXJMaXN0KG1SZWxhdGl2ZVBhdGgpOworICAgICAgICAgICAgbUhhbmRsZXIuc2VuZE1lc3NhZ2UobXNnKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIFZlcnkgc2ltcGxlIG9iamVjdCB0byB1c2UgaW5zaWRlIExpc3RWaWV3IGFzIGFuIGl0ZW0uCisgICAgICovCisgICAgcHJpdmF0ZSBzdGF0aWMgY2xhc3MgTGlzdEl0ZW0gaW1wbGVtZW50cyBDb21wYXJhYmxlPExpc3RJdGVtPiB7CisgICAgICAgIHByaXZhdGUgU3RyaW5nIG1SZWxhdGl2ZVBhdGg7CisgICAgICAgIHByaXZhdGUgU3RyaW5nIG1OYW1lOworICAgICAgICBwcml2YXRlIGJvb2xlYW4gbUlzRGlyZWN0b3J5OworCisgICAgICAgIHB1YmxpYyBMaXN0SXRlbShTdHJpbmcgcmVsYXRpdmVQYXRoLCBib29sZWFuIGlzRGlyZWN0b3J5KSB7CisgICAgICAgICAgICBtUmVsYXRpdmVQYXRoID0gcmVsYXRpdmVQYXRoOworICAgICAgICAgICAgbU5hbWUgPSBuZXcgRmlsZShyZWxhdGl2ZVBhdGgpLmdldE5hbWUoKTsKKyAgICAgICAgICAgIG1Jc0RpcmVjdG9yeSA9IGlzRGlyZWN0b3J5OworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIGJvb2xlYW4gaXNEaXJlY3RvcnkoKSB7CisgICAgICAgICAgICByZXR1cm4gbUlzRGlyZWN0b3J5OworICAgICAgICB9CisKKyAgICAgICAgcHVibGljIFN0cmluZyBnZXRSZWxhdGl2ZVBhdGgoKSB7CisgICAgICAgICAgICByZXR1cm4gbVJlbGF0aXZlUGF0aDsKKyAgICAgICAgfQorCisgICAgICAgIHB1YmxpYyBTdHJpbmcgZ2V0TmFtZSgpIHsKKyAgICAgICAgICAgIHJldHVybiBtTmFtZTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgaW50IGNvbXBhcmVUbyhMaXN0SXRlbSBhbm90aGVyKSB7CisgICAgICAgICAgICByZXR1cm4gbVJlbGF0aXZlUGF0aC5jb21wYXJlVG8oYW5vdGhlci5nZXRSZWxhdGl2ZVBhdGgoKSk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIGJvb2xlYW4gZXF1YWxzKE9iamVjdCBvKSB7CisgICAgICAgICAgICBpZiAoIShvIGluc3RhbmNlb2YgTGlzdEl0ZW0pKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICByZXR1cm4gbVJlbGF0aXZlUGF0aC5lcXVhbHMoKChMaXN0SXRlbSlvKS5nZXRSZWxhdGl2ZVBhdGgoKSk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIGludCBoYXNoQ29kZSgpIHsKKyAgICAgICAgICAgIHJldHVybiBtUmVsYXRpdmVQYXRoLmhhc2hDb2RlKCk7CisgICAgICAgIH0KKworICAgIH0KKworICAgIC8qKgorICAgICAqIEEgY3VzdG9tIGFkYXB0ZXIgdGhhdCBzZXRzIHRoZSBwcm9wZXIgaWNvbiBhbmQgbGFiZWwgaW4gdGhlIGxpc3Qgdmlldy4KKyAgICAgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBjbGFzcyBEaXJMaXN0QWRhcHRlciBleHRlbmRzIEFycmF5QWRhcHRlcjxMaXN0SXRlbT4geworICAgICAgICBwcml2YXRlIEFjdGl2aXR5IG1Db250ZXh0OworICAgICAgICBwcml2YXRlIExpc3RJdGVtW10gbUl0ZW1zOworCisgICAgICAgIHB1YmxpYyBEaXJMaXN0QWRhcHRlcihBY3Rpdml0eSBjb250ZXh0LCBMaXN0SXRlbVtdIGl0ZW1zKSB7CisgICAgICAgICAgICBzdXBlcihjb250ZXh0LCBSLmxheW91dC5kaXJsaXN0X3JvdywgaXRlbXMpOworCisgICAgICAgICAgICBtQ29udGV4dCA9IGNvbnRleHQ7CisgICAgICAgICAgICBtSXRlbXMgPSBpdGVtczsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgVmlldyBnZXRWaWV3KGludCBwb3NpdGlvbiwgVmlldyBjb252ZXJ0VmlldywgVmlld0dyb3VwIHBhcmVudCkgeworICAgICAgICAgICAgTGF5b3V0SW5mbGF0ZXIgaW5mbGF0ZXIgPSBtQ29udGV4dC5nZXRMYXlvdXRJbmZsYXRlcigpOworICAgICAgICAgICAgVmlldyByb3cgPSBpbmZsYXRlci5pbmZsYXRlKFIubGF5b3V0LmRpcmxpc3Rfcm93LCBudWxsKTsKKworICAgICAgICAgICAgVGV4dFZpZXcgbGFiZWwgPSAoVGV4dFZpZXcpcm93LmZpbmRWaWV3QnlJZChSLmlkLmxhYmVsKTsKKyAgICAgICAgICAgIGxhYmVsLnNldFRleHQobUl0ZW1zW3Bvc2l0aW9uXS5nZXROYW1lKCkpOworCisgICAgICAgICAgICBJbWFnZVZpZXcgaWNvbiA9IChJbWFnZVZpZXcpcm93LmZpbmRWaWV3QnlJZChSLmlkLmljb24pOworICAgICAgICAgICAgaWYgKG1JdGVtc1twb3NpdGlvbl0uaXNEaXJlY3RvcnkoKSkgeworICAgICAgICAgICAgICAgIGljb24uc2V0SW1hZ2VSZXNvdXJjZShSLmRyYXdhYmxlLmZvbGRlcik7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIGljb24uc2V0SW1hZ2VSZXNvdXJjZShSLmRyYXdhYmxlLnJ1bnRlc3QpOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICByZXR1cm4gcm93OworICAgICAgICB9CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHJvdGVjdGVkIHZvaWQgb25DcmVhdGUoQnVuZGxlIHNhdmVkSW5zdGFuY2VTdGF0ZSkgeworICAgICAgICBzdXBlci5vbkNyZWF0ZShzYXZlZEluc3RhbmNlU3RhdGUpOworCisgICAgICAgIEZvcndhcmRlck1hbmFnZXIuZ2V0Rm9yd2FyZGVyTWFuYWdlcigpLnN0YXJ0KCk7CisKKyAgICAgICAgbUZpbGVGaWx0ZXIgPSBuZXcgRmlsZUZpbHRlcihST09UX0RJUl9QQVRIKTsKKyAgICAgICAgbUxpc3RWaWV3ID0gZ2V0TGlzdFZpZXcoKTsKKworICAgICAgICBtTGlzdFZpZXcuc2V0T25JdGVtQ2xpY2tMaXN0ZW5lcihuZXcgQWRhcHRlclZpZXcuT25JdGVtQ2xpY2tMaXN0ZW5lcigpIHsKKyAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgcHVibGljIHZvaWQgb25JdGVtQ2xpY2soQWRhcHRlclZpZXc8Pz4gcGFyZW50LCBWaWV3IHZpZXcsIGludCBwb3NpdGlvbiwgbG9uZyBpZCkgeworICAgICAgICAgICAgICAgIExpc3RJdGVtIGl0ZW0gPSAoTGlzdEl0ZW0pcGFyZW50LmdldEl0ZW1BdFBvc2l0aW9uKHBvc2l0aW9uKTsKKworICAgICAgICAgICAgICAgIGlmIChpdGVtLmlzRGlyZWN0b3J5KCkpIHsKKyAgICAgICAgICAgICAgICAgICAgc2hvd0RpcihpdGVtLmdldFJlbGF0aXZlUGF0aCgpKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAvKiogUnVuIHRoZSB0ZXN0ICovCisgICAgICAgICAgICAgICAgICAgIHJ1bkFsbFRlc3RzVW5kZXIoaXRlbS5nZXRSZWxhdGl2ZVBhdGgoKSk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9KTsKKworICAgICAgICBtTGlzdFZpZXcuc2V0T25JdGVtTG9uZ0NsaWNrTGlzdGVuZXIobmV3IEFkYXB0ZXJWaWV3Lk9uSXRlbUxvbmdDbGlja0xpc3RlbmVyKCkgeworICAgICAgICAgICAgQE92ZXJyaWRlCisgICAgICAgICAgICBwdWJsaWMgYm9vbGVhbiBvbkl0ZW1Mb25nQ2xpY2soQWRhcHRlclZpZXc8Pz4gcGFyZW50LCBWaWV3IHZpZXcsIGludCBwb3NpdGlvbiwgbG9uZyBpZCkgeworICAgICAgICAgICAgICAgIExpc3RJdGVtIGl0ZW0gPSAoTGlzdEl0ZW0pcGFyZW50LmdldEl0ZW1BdFBvc2l0aW9uKHBvc2l0aW9uKTsKKworICAgICAgICAgICAgICAgIGlmIChpdGVtLmlzRGlyZWN0b3J5KCkpIHsKKyAgICAgICAgICAgICAgICAgICAgQnVuZGxlIGFyZ3VtZW50cyA9IG5ldyBCdW5kbGUoMSk7CisgICAgICAgICAgICAgICAgICAgIGFyZ3VtZW50cy5wdXRTdHJpbmcoIm5hbWUiLCBpdGVtLmdldE5hbWUoKSk7CisgICAgICAgICAgICAgICAgICAgIGFyZ3VtZW50cy5wdXRTdHJpbmcoInJlbGF0aXZlUGF0aCIsIGl0ZW0uZ2V0UmVsYXRpdmVQYXRoKCkpOworICAgICAgICAgICAgICAgICAgICBzaG93RGlhbG9nKERJQUxPR19SVU5fQUJPUlRfRElSLCBhcmd1bWVudHMpOworICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgIC8qKiBUT0RPOiBNYXliZSBzaG93IHNvbWUgaW5mbyBhYm91dCBhIHRlc3Q/ICovCisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICB9CisgICAgICAgIH0pOworCisgICAgICAgIC8qKiBBbGwgdGhlIHBhdGhzIGFyZSByZWxhdGl2ZSB0byB0ZXN0IHJvb3QgZGlyIHdoZXJlIHBvc3NpYmxlICovCisgICAgICAgIHNob3dEaXIoIiIpOworICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBydW5BbGxUZXN0c1VuZGVyKFN0cmluZyByZWxhdGl2ZVBhdGgpIHsKKyAgICAgICAgSW50ZW50IGludGVudCA9IG5ldyBJbnRlbnQoKTsKKyAgICAgICAgaW50ZW50LnNldENsYXNzKERpckxpc3RBY3Rpdml0eS50aGlzLCBUZXN0c0xpc3RBY3Rpdml0eS5jbGFzcyk7CisgICAgICAgIGludGVudC5zZXRBY3Rpb24oSW50ZW50LkFDVElPTl9SVU4pOworICAgICAgICBpbnRlbnQucHV0RXh0cmEoVGVzdHNMaXN0QWN0aXZpdHkuRVhUUkFfVEVTVF9QQVRILCByZWxhdGl2ZVBhdGgpOworICAgICAgICBzdGFydEFjdGl2aXR5KGludGVudCk7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIGJvb2xlYW4gb25DcmVhdGVPcHRpb25zTWVudShNZW51IG1lbnUpIHsKKyAgICAgICAgTWVudUluZmxhdGVyIGluZmxhdGVyID0gZ2V0TWVudUluZmxhdGVyKCk7CisgICAgICAgIGluZmxhdGVyLmluZmxhdGUoUi5tZW51Lmd1aV9tZW51LCBtZW51KTsKKyAgICAgICAgcmV0dXJuIHRydWU7CisgICAgfQorCisgICAgQE92ZXJyaWRlCisgICAgcHVibGljIGJvb2xlYW4gb25PcHRpb25zSXRlbVNlbGVjdGVkKE1lbnVJdGVtIGl0ZW0pIHsKKyAgICAgICAgc3dpdGNoIChpdGVtLmdldEl0ZW1JZCgpKSB7CisgICAgICAgICAgICBjYXNlIFIuaWQucnVuX2FsbDoKKyAgICAgICAgICAgICAgICBydW5BbGxUZXN0c1VuZGVyKG1DdXJyZW50RGlyUGF0aCk7CisgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgICAgICBkZWZhdWx0OgorICAgICA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CBEaWFsb2cgb25DcmVhdGVEaWFsb2coaW50IGlkLCBmaW5hbCBCdW5kbGUgYXJncykgeworICAgICAgICBEaWFsb2cgZGlhbG9nID0gbnVsbDsKKyAgICAgICAgQWxlcnREaWFsb2cuQnVpbGRlciBidWlsZGVyID0gbmV3IEFsZXJ0RGlhbG9nLkJ1aWxkZXIodGhpcyk7CisKKyAgICAgICAgc3dpdGNoIChpZCkgeworICAgICAgICAgICAgY2FzZSBESUFMT0dfUlVOX0FCT1JUX0RJUjoKKyAgICAgICAgICAgICAgICBidWlsZGVyLnNldFRpdGxlKGdldFRleHQoUi5zdHJpbmcuZGlhbG9nX3J1bl9hYm9ydF9kaXJfdGl0bGVfcHJlZml4KSArICIgIiArCisgICAgICAgICAgICAgICAgICAgICAgICBhcmdzLmdldFN0cmluZygibmFtZSIpKTsKKyAgICAgICAgICAgICAgICBidWlsZGVyLnNldE1lc3NhZ2UoUi5zdHJpbmcuZGlhbG9nX3J1bl9hYm9ydF9kaXJfbXNnKTsKKyAgICAgICAgICAgICAgICBidWlsZGVyLnNldENhbmNlbGFibGUodHJ1ZSk7CisKKyAgICAgICAgICAgICAgICBidWlsZGVyLnNldFBvc2l0aXZlQnV0dG9uKFIuc3RyaW5nLmRpYWxvZ19ydW5fYWJvcnRfZGlyX29rX2J1dHRvbiwKKyAgICAgICAgICAgICAgICAgICAgICAgIG5ldyBEaWFsb2dJbnRlcmZhY2UuT25DbGlja0xpc3RlbmVyKCkgeworICAgICAgICAgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgICAgICAgICAgcHVibGljIHZvaWQgb25DbGljayhEaWFsb2dJbnRlcmZhY2UgZGlhbG9nLCBpbnQgd2hpY2gpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHJlbW92ZURpYWxvZyhESUFMT0dfUlVOX0FCT1JUX0RJUik7CisgICAgICAgICAgICAgICAgICAgICAgICBydW5BbGxUZXN0c1VuZGVyKGFyZ3MuZ2V0U3RyaW5nKCJyZWxhdGl2ZVBhdGgiKSk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9KTsKKworICAgICAgICAgICAgICAgIGJ1aWxkZXIuc2V0TmVnYXRpdmVCdXR0b24oUi5zdHJpbmcuZGlhbG9nX3J1bl9hYm9ydF9kaXJfYWJvcnRfYnV0dG9uLAorICAgICAgICAgICAgICAgICAgICAgICAgbmV3IERpYWxvZ0ludGVyZmFjZS5PbkNsaWNrTGlzdGVuZXIoKSB7CisgICAgICAgICAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBvbkNsaWNrKERpYWxvZ0ludGVyZmFjZSBkaWFsb2csIGludCB3aGljaCkgeworICAgICAgICAgICAgICAgICAgICAgICAgcmVtb3ZlRGlhbG9nKERJQUxPR19SVU5fQUJPUlRfRElSKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0pOworCisgICAgICAgICAgICAgICAgZGlhbG9nID0gYnVpbGRlci5jcmVhdGUoKTsKKyAgICAgICAgICAgICAgICBkaWFsb2cuc2V0T25DYW5jZWxMaXN0ZW5lcihuZXcgRGlhbG9nSW50ZXJmYWNlLk9uQ2FuY2VsTGlzdGVuZXIoKSB7CisgICAgICAgICAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBvbkNhbmNlbChEaWFsb2dJbnRlcmZhY2UgZGlhbG9nKSB7CisgICAgICAgICAgICAgICAgICAgICAgICByZW1vdmVEaWFsb2coRElBTE9HX1JVTl9BQk9SVF9ESVIpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfSk7CisgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgIH0KKworICAgICAgICByZXR1cm4gZGlhbG9nOworICAgIH0KKworICAgIC8qKgorICAgICAqIExvYWRzIHRoZSBjb250ZW50cyBvZiBkaXIgaW50byB0aGUgbGlzdCB2aWV3LgorICAgICAqCisgICAgICogQHBhcmFtIGRpclBhdGgKKyAgICAgKiAgICAgIGRpcmVjdG9yeSB0byBsb2FkIGludG8gbGlzdCB2aWV3CisgICAgICovCisgICAgcHJpdmF0ZSB2b2lkIHNob3dEaXIoU3RyaW5nIGRpclBhdGgpIHsKKyAgICAgICAgbUN1cnJlbnREaXJQYXRoID0gZGlyUGF0aDsKKworICAgICAgICAvKiogU2hvdyBwcm9ncmVzcyBkaWFsb2cgd2l0aCBhIGRlbGF5ICovCisgICAgICAgIGZpbmFsIEhhbmRsZXIgZGVsYXllZERpYWxvZ0hhbmRsZXIgPSBuZXcgSGFuZGxlcigpIHsKKyAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgcHVibGljIHZvaWQgaGFuZGxlTWVzc2FnZShNZXNzYWdlIG1zZykgeworICAgICAgICAgICAgICAgIGlmIChtc2cud2hhdCA9PSBNU0dfU0hPV19QUk9HUkVTU19ESUFMT0cpIHsKKyAgICAgICAgICAgICAgICAgICAgaWYgKHNQcm9ncmVzc0RpYWxvZyA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBzUHJvZ3Jlc3NEaWFsb2cgPSBuZXcgUHJvZ3Jlc3NEaWFsb2coRGlyTGlzdEFjdGl2aXR5LnRoaXMpOworICAgICAgICAgICAgICAgICAgICAgICAgc1Byb2dyZXNzRGlhbG9nLnNldENhbmNlbGFibGUoZmFsc2UpOworICAgICAgICAgICAgICAgICAgICAgICAgc1Byb2dyZXNzRGlhbG9nLnNldFByb2dyZXNzU3R5bGUoUHJvZ3Jlc3NEaWFsb2cuU1RZTEVfU1BJTk5FUik7CisgICAgICAgICAgICAgICAgICAgICAgICBzUHJvZ3Jlc3NEaWFsb2cuc2V0VGl0bGUoUi5zdHJpbmcuZGlhbG9nX3Byb2dyZXNzX3RpdGxlKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHNQcm9ncmVzc0RpYWxvZy5zZXRNZXNzYWdlKGdldFRleHQoUi5zdHJpbmcuZGlhbG9nX3Byb2dyZXNzX21zZykpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIHNQcm9ncmVzc0RpYWxvZy5zaG93KCk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9OworICAgICAgICBNZXNzYWdlIG1zZ1Nob3dEaWFsb2cgPSBkZWxheWVkRGlhbG9nSGFuZGxlci5vYnRhaW5NZXNzYWdlKE1TR19TSE9XX1BST0dSRVNTX0RJQUxPRyk7CisgICAgICAgIGRlbGF5ZWREaWFsb2dIYW5kbGVyLnNlbmRNZXNzYWdlRGVsYXllZChtc2dTaG93RGlhbG9nLCBQUk9HUkVTU19ESUFMT0dfREVMQVlfTVMpOworCisgICAgICAgIC8qKiBEZWxlZ2F0ZSBsb2FkaW5nIGNvbnRlbnRzIGZyb20gU0QgY2FyZCB0byBhIG5ldyB0aHJlYWQgKi8KKyAgICAgICAgbmV3IExvYWRMaXN0SXRlbXNUaHJlYWQobUN1cnJlbnREaXJQYXRoLCBuZXcgSGFuZGxlcigpIHsKKyAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgcHVibGljIHZvaWQgaGFuZGxlTWVzc2FnZShNZXNzYWdlIG1zZykgeworICAgICAgICAgICAgICAgIGlmIChtc2cud2hhdCA9PSBNU0dfTE9BREVEX0lURU1TKSB7CisgICAgICAgICAgICAgICAgICAgIHNldExpc3RBZGFwdGVyKG5ldyBEaXJMaXN0QWRhcHRlcihEaXJMaXN0QWN0aXZpdHkudGhpcywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTGlzdEl0ZW1bXSltc2cub2JqKSk7CisgICAgICAgICAgICAgICAgICAgIGRlbGF5ZWREaWFsb2dIYW5kbGVyLnJlbW92ZU1lc3NhZ2VzKE1TR19TSE9XX1BST0dSRVNTX0RJQUxPRyk7CisgICAgICAgICAgICAgICAgICAgIHNldFRpdGxlKHNob3J0ZW5UaXRsZShtQ3VycmVudERpclBhdGgpKTsKKyAgICAgICAgICAgICAgICAgICAgaWYgKHNQcm9ncmVzc0RpYWxvZyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBzUHJvZ3Jlc3NEaWFsb2cuZGlzbWlzcygpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgfQorICAgICAgICB9KS5zdGFydCgpOworICAgIH0KKworICAgIC8qKgorICAgICAqIFRPRE86IGZpbmQgYSBuZWF0IHdheSB0byBkZXRlcm1pbmUgbnVtYmVyIG9mIGNoYXJhY3RlcnMgdGhhdCBmaXQgaW4gdGhlIHRpdGxlCisgICAgICogYmFyLgorICAgICAqICovCisgICAgcHJpdmF0ZSBTdHJpbmcgc2hvcnRlblRpdGxlKFN0cmluZyB0aXRsZSkgeworICAgICAgICBpZiAodGl0bGUuZXF1YWxzKCIiKSkgeworICAgICAgICAgICAgcmV0dXJuICJUZXN0cycgcm9vdCBkaXI6IjsKKyAgICAgICAgfQorICAgICAgICBpbnQgY2hhckNvdW50ID0gbUxpc3RWaWV3LmdldFdpZHRoKCkgLyBNRUFOX1RJVExFX0NIQVJfU0laRTsKKworICAgICAgICBpZiAodGl0bGUubGVuZ3RoKCkgPiBjaGFyQ291bnQpIHsKKyAgICAgICAgICAgIHJldHVybiAiLi4uIiArIHRpdGxlLnN1YnN0cmluZyh0aXRsZS5sZW5ndGgoKSAtIGNoYXJDb3VudCk7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICByZXR1cm4gdGl0bGU7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBSZXR1cm4gdGhlIGFycmF5IHdpdGggY29udGVudHMgb2YgdGhlIGdpdmVuIGRpcmVjdG9yeS4KKyAgICAgKiBGaXJzdCBpdCBjb250YWlucyB0aGUgc3ViZm9sZGVycywgdGhlbiB0aGUgZmlsZXMuIEJvdGggc29ydGVkCisgICAgICogYWxwaGFiZX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KKyAgICAgICAgICAgICAgICBhbmRyb2lkOm5hbWU9IlNpbXBsZVBhdGhzQWN0aXZpdHkiCisgICAgICAgICAgICAgICAgYW5kcm9pZDpsYWJlbD0iX1NpbXBsZVBhdGhzIj4KKyAgICAgICAgICAgIDxpbnRlbnQtZmlsdGVyPgorICAgICAgICAgICAgICAgIDxhY3Rpb24gYW5kcm9pZDpuYW1lPSJhbmRyb2lkLmludGVudC5hY3Rpb24uTUFJTiIgLz4KKyAgICAgICAgICAgICAgICA8Y2F0ZWdvcnkgYW5kcm9pZDpuYW1lPSJhbmRyb2lkLmludGVudC5jYXRlZ29yeS5MQVVOQ0hFUiIgLz4KKyAgICAgICAgICAgIDwvaW50ZW50LWZpbHRlcj4KKyAgICAgICAgPC9hY3Rpdml0eT4KKworICAgICAgICA8YWN0aXZpdHkKKyAgICAgICAgICAgICAgICBhbmRyb2lkOm5hbWU9IkFkdmFuY2VkQmxlbmRBY3Rpdml0eSIKKyAgICAgICAgICAgICAgICBhbmRyb2lkOmxhYmVsPSJfQWR2YW5jZWRCbGVuZCI+CisgICAgICAgICAgICA8aW50ZW50LWZpbHRlcj4KKyAgICAgICAgICAgICAgICA8YWN0aW9uIGFuZHJvaWQ6bmFtZT0iYW5kcm9pZC5pbnRlbnQuYWN0aW9uLk1BSU4iIC8+CisgICAgICAgICAgICAgICAgPGNhdGVnb3J5IGFuZHJvaWQ6bmFtZT0iYW5kcm9pZC5pbnRlbnQuY2F0ZWdvcnkuTEFVTkNIRVIiIC8+CisgICAgICAgICAgICA8L2ludGVudC1maWx0ZXI+CisgICAgICAgIDwvYWN0aXZpdHk+CisKKyAgICAgICAgPGFjdGl2aXR5CisgICAgICAgICAgICAgICAgYW5kcm9pZDpuYW1lPSJTdGFja0FjdGl2aXR5IgorICAgICAgICAgICAgICAgIGFuZHJvaWQ6bGFiZWw9Il9TdGFja3MiPgorICAgICAgICAgICAgPGludGVudC1maWx0ZXI+CisgICAgICAgICAgICAgICAgPGFjdGlvbiBhbm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IxLjAiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9IndyYXBfY29udGVudCIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X21hcmdpbkxlZnQ9IjNkaXAiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9tYXJnaW5SaWdodD0iMTBkaXAiCisKKyAgICAgICAgICAgIGFuZHJvaWQ6dGV4dD0iUmVtb3ZlIiAvPgorICAgICAgICAKKyAgICA8L0xpbmVhckxheW91dD4KKyAgICAKKyAgICA8TGlzdFZpZXcKKyAgICAgICAgYW5kcm9pZDppZD0iQCtpZC9saXN0IgorICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0ibWF0Y2hfcGFyZW50IgorICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9IjBkaXAiCisgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dlaWdodD0iMS4wIiAvPgorCisgICAgPExpbmVhckxheW91dAorICAgICAgICBhbmRyb2lkOm9yaWVudGF0aW9uPSJob3Jpem9udGFsIgorICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0ibWF0Y2hfcGFyZW50IgorICAgICAgICBhbmRyb2lkOmxheW91dF9oZWlnaHQ9IndyYXBfY29udGVudCI+CisgICAgICAgIAorICAgICAgICA8QnV0dG9uCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF93aWR0aD0iMGRpcCIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X3dlaWdodD0iMS4wIgorICAgICAgICAgICAgYW5kcm9pZDpsYXlvdXRfaGVpZ2h0PSJ3cmFwX2NvbnRlbnQiCisgICAgICAgICAgICBhbmRyb2lkOmxheW91dF9tYXJnaW5MZWZ0PSIxMGRpcCIKKyAgICAgICAgICAgIGFuZHJvaWQ6bGF5b3V0X21hcmdpblJpZ2h0PSIzZGlwIgorCisgICAgICAgICAgICBhbmRyb2lkOnRleHQ9IkFkZCIgLz4KKyAgICAgICAgCisgICAgICAg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aXZhdGUgQ29tcG9zZVNoYWRlciBtQ29tcG9zZTJTaGFkZXI7CisgICAgICAgIHByaXZhdGUgQ29tcG9zZVNoYWRlciBtQ29tcG9zZTNTaGFkZXI7CisgICAgICAgIHByaXZhdGUgQ29tcG9zZVNoYWRlciBtQ29tcG9zZTRTaGFkZXI7CisgICAgICAgIHByaXZhdGUgQ29tcG9zZVNoYWRlciBtQ29tcG9zZTVTaGFkZXI7CisgICAgICAgIHByaXZhdGUgQ29tcG9zZVNoYWRlciBtQ29tcG9zZTZTaGFkZXI7CisgICAgICAgIHByaXZhdGUgQml0bWFwU2hhZGVyIG1TY2FsZWQyU2hhZGVyOworCisgICAgICAgIFNoYWRlcnNWaWV3KENvbnRleHQgYykgeworICAgICAgICAgICAgc3VwZXIoYyk7CisKKyAgICAgICAgICAgIEJpdG1hcCB0ZXh0dXJlID0gQml0bWFwRmFjdG9yeS5kZWNvZGVSZXNvdXJjZShjLmdldFJlc291cmNlcygpLCBSLmRyYXdhYmxlLnN1bnNldDEpOworICAgICAgICAgICAgbVRleFdpZHRoID0gdGV4dHVyZS5nZXRXaWR0aCgpOworICAgICAgICAgICAgbVRleEhlaWdodCA9IHRleHR1cmUuZ2V0SGVpZ2h0KCk7CisgICAgICAgICAgICBtRHJhd1dpZHRoID0gbVRleFdpZHRoICogMi4yZjsKKyAgICAgICAgICAgIG1EcmF3SGVpZ2h0ID0gbVRleEhlaWdodCAqIDEuMmY7CisKKyAgICAgICAgICAgIG1TY2FsZWRTaGFkZXIgPSBuZXcgQml0bWFwU2hhZGVyKHRleHR1cmUsIFNoYWRlci5UaWxlTW9kZS5NSVJST1IsCisgICAgICAgICAgICAgICAgICAgIFNoYWRlci5UaWxlTW9kZS5NSVJST1IpOworICAgICAgICAgICAgTWF0cml4IG0yID0gbmV3IE1hdHJpeCgpOworICAgICAgICAgICAgbTIuc2V0U2NhbGUoMC41ZiwgMC41Zik7CisgICAgICAgICAgICBtU2NhbGVkU2hhZGVyLnNldExvY2FsTWF0cml4KG0yKTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgbVNjYWxlZDJTaGFkZXIgPSBuZXcgQml0bWFwU2hhZGVyKHRleHR1cmUsIFNoYWRlci5UaWxlTW9kZS5NSVJST1IsCisgICAgICAgICAgICAgICAgICAgIFNoYWRlci5UaWxlTW9kZS5NSVJST1IpOworICAgICAgICAgICAgTWF0cml4IG0zID0gbmV3IE1hdHJpeCgpOworICAgICAgICAgICAgbTMuc2V0U2NhbGUoMC4xZiwgMC4xZik7CisgICAgICAgICAgICBtU2NhbGVkMlNoYWRlci5zZXRMb2NhbE1hdHJpeChtMyk7CisKKyAgICAgICAgICAgIG1Ib3JHcmFkaWVudCA9IG5ldyBMaW5lYXJHcmFkaWVudCgwLjBmLCAwLjBmLCBtRHJhd1dpZHRoLCAwLjBmLAorICAgICAgICAgICAgICAgICAgICBDb2xvci5CTEFDSywgQ29sb3IuV0hJVEUsIFNoYWRlci5UaWxlTW9kZS5DTEFNUCk7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIG1Db21wb3NlU2hhZGVyID0gbmV3IENvbXBvc2VTaGFkZXIobVNjYWxlZFNoYWRlciwgbUhvckdyYWRpZW50LAorICAgICAgICAgICAgICAgICAgICBQb3J0ZXJEdWZmLk1vZGUuREFSS0VOKTsKKyAgICAgICAgICAgIG1Db21wb3NlMlNoYWRlciA9IG5ldyBDb21wb3NlU2hhZGVyKG1TY2FsZWRTaGFkZXIsIG1Ib3JHcmFkaWVudCwKKyAgICAgICAgICAgICAgICAgICAgUG9ydGVyRHVmZi5Nb2RlLkxJR0hURU4pOworICAgICAgICAgICAgbUNvbXBvc2UzU2hhZGVyID0gbmV3IENvbXBvc2VTaGFkZXIobVNjYWxlZFNoYWRlciwgbUhvckdyYWRpZW50LAorICAgICAgICAgICAgICAgICAgICBQb3J0ZXJEdWZmLk1vZGUuTVVMVElQTFkpOworICAgICAgICAgICAgbUNvbXBvc2U0U2hhZGVyID0gbmV3IENvbXBvc2VTaGFkZXIobVNjYWxlZFNoYWRlciwgbUhvckdyYWRpZW50LAorICAgICAgICAgICAgICAgICAgICBQb3J0ZXJEdWZmLk1vZGUuU0NSRUVOKTsKKyAgICAgICAgICAgIG1Db21wb3NlNVNoYWRlciA9IG5ldyBDb21wb3NlU2hhZGVyKG1TY2FsZWRTaGFkZXIsIG1Ib3JHcmFkaWVudCwKKyAgICAgICAgICAgICAgICAgICAgUG9ydGVyRHVmZi5Nb2RlLkFERCk7CisgICAgICAgICAgICBtQ29tcG9zZTZTaGFkZXIgPSBuZXcgQ29tcG9zZVNoYWRlcihtSG9yR3JhZGllbnQsIG1TY2FsZWRTaGFkZXIsCisgICAgICAgICAgICAgICAgICAgIFBvcnRlckR1ZmYuTW9kZS5PVkVSTEFZKTsKKworICAgICAgICAgICAgbVBhaW50ID0gbmV3IFBhaW50KCk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHJvdGVjdGVkIHZvaWQgb25EcmF3KENhbnZhcyBjYW52YXMpIHsKKyAgICAgICAgICAgIHN1cGVyLm9uRHJhdyhjYW52YXMpOworICAgICAgICAgICAgY2FudmFzLmRyYXdSR0IoMjU1LCAyNTUsIDI1NSk7CisKKyAgICAgICAgICAgIGNhbnZhcy5zYXZlKCk7CisgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDQwLjBmLCA0MC4wZik7CisKKyAgICAgICAgICAgIG1QYWludC5zZXRTaGFkZXIobUNvbXBvc2VTaGFkZXIpOworICAgICAgICAgICAgY2FudmFzLmRyYXdSZWN0KDAuMGYsIDAuMGYsIG1EcmF3V2lkdGgsIG1EcmF3SGVpZ2h0LCBtUGFpbnQpOworICAgICAgICAgICAgCisgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDAuMGYsIDQwLjBmICsgbURyYXdIZWlnaHQpOworICAgICAgICAgICAgbVBhaW50LnNldFNoYWRlcihtQ29tcG9zZTJTaGFkZXIpOworICAgICAgICAgICAgY2FudmFzLmRyYXdSZWN0KDAuMGYsIDAuMGYsIG1EcmF3V2lkdGgsIG1EcmF3SGVpZ2h0LCBtUGFpbnQpOworCisgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDAuMGYsIDQwLjBmICsgbURyYXdIZWlnaHQpOworICAgICAgICAgICAgbVBhaW50LnNldFNoYWRlcihtQ29tcG9zZTNTaGFkZXIpOworICAgICAgICAgICAgY2FudmFzLmRyYXdSZWN0KDAuMGYsIDAuMGYsIG1EcmF3V2lkdGgsIG1EcmF3SGVpZ2h0LCBtUGFpbnQpOworCisgICAgICAgICAgICBjYW52YXMucmVzdG9yZSgpOworICAgICAgICAgICAgCisgICAgICAgICAgICBjYW52YXMuc2F2ZSgpOworICAgICAgICAgICAgY2FudmFzLnRyYW5zbGF0ZSg0MC4wZiArIG1EcmF3V2lkdGggKyA0MC4wZiwgNDAuMGYpOworICAgICAgICAgICAgCisgICAgICAgICAgICBtUGFpbnQuc2V0U2hhZGVyKG1Db21wb3NlNFNoYWRlcik7CisgICAgICAgICAgICBjYW52YXMuZHJhd1JlY3QoMC4wZiwgMC4wZiwgbURyYXdXaWR0aCwgbURyYXdIZWlnaHQsIG1QYWludCk7CisKKyAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoMC4wZiwgNDAuMGYgKyBtRHJhd0hlaWdodCk7CisgICAgICAgICAgICBtUGFpbnQuc2V0U2hhZGVyKG1Db21wb3NlNVNoYWRlcik7CisgICAgICAgICAgICBjYW52YXMuZHJhd1JlY3QoMC4wZiwgMC4wZiwgbURyYXdXaWR0aCwgbURyYXdIZWlnaHQsIG1QYWludCk7CisKKyAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoMC4wZiwgNDAuMGYgKyBtRHJhd0hlaWdodCk7CisgICAgICAgICAgICBtUGFpbnQuc2V0U2hhZGVyKG1Db21wb3NlNlNoYWRlcik7CisgICAgICAgICAgICBjYW52YXMuZHJhd1JlY3QoMC4wZiwgMC4wZiwgbURyYXdXaWR0aCwg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RyA9ICJId1VpIjsKKworICAgIEBPdmVycmlkZQorICAgIHByb3RlY3RlZCB2b2lkIG9uQ3JlYXRlKEJ1bmRsZSBzYXZlZEluc3RhbmNlU3RhdGUpIHsKKyAgICAgICAgc3VwZXIub25DcmVhdGUoc2F2ZWRJbnN0YW5jZVN0YXRlKTsKKworICAgICAgICBEaXJ0eUJpdG1hcFZpZXcgY29udGFpbmVyID0gbmV3IERpcnR5Qml0bWFwVmlldyh0aGlzKTsKKworICAgICAgICBDb2xvclZpZXcgY29sb3IgPSBuZXcgQ29sb3JWaWV3KHRoaXMpOworICAgICAgICBjb250YWluZXIuYWRkVmlldyhjb2xvciwgbmV3IERpcnR5Qml0bWFwVmlldy5MYXlvdXRQYXJhbXMoCisgICAgICAgICAgICAgICAgZGlwVG9QeCh0aGlzLCAxMDApLCBkaXBUb1B4KHRoaXMsIDEwMCksIEdyYXZpdHkuQ0VOVEVSKSk7CisKKyAgICAgICAgQWxwaGFBbmltYXRpb24gYSA9IG5ldyBBbHBoYUFuaW1hdGlvbigxLjBmLCAwLjBmKTsKKyAgICAgICAgYS5zZXREdXJhdGlvbigyMDAwKTsKKyAgICAgICAgYS5zZXRSZXBlYXRDb3VudChBbmltYXRpb24uSU5GSU5JVEUpOworICAgICAgICBhLnNldFJlcGVhdE1vZGUoQW5pbWF0aW9uLlJFVkVSU0UpOworICAgICAgICBjb2xvci5zdGFydEFuaW1hdGlvbihhKTsKKworICAgICAgICBzZXRDb250ZW50Vmlldyhjb250YWluZXIpOworICAgIH0KKyAgICAKKyAgICBAU3VwcHJlc3NXYXJuaW5ncyh7IlVudXNlZERlY2xhcmF0aW9uIn0pCisgICAgc3RhdGljIGludCBkaXBUb1B4KENvbnRleHQgYywgaW50IGRpcCkgeworICAgICAgICByZXR1cm4gKGludCkgKGMuZ2V0UmVzb3VyY2VzKCkuZ2V0RGlzcGxheU1ldHJpY3MoKS5kZW5zaXR5ICogZGlwICsgMC41Zik7CisgICAgfQorCisgICAgc3RhdGljIGNsYXNzIENvbG9yVmlldyBleHRlbmRzIFZpZXcgeworICAgICAgICBDb2xvclZpZXcoQ29udGV4dCBjKSB7CisgICAgICAgICAgICBzdXBlcihjKTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwcm90ZWN0ZWQgdm9pZCBvbkRyYXcoQ2FudmFzIGNhbnZhcykgeworICAgICAgICAgICAgc3VwZXIub25EcmF3KGNhbnZhcyk7CisgICAgICAgICAgICBjYW52YXMuZHJhd1JHQigwLCAyNTUsIDApOworICAgICAgICB9CisgICAgfQorCisgICAgc3RhdGljIGNsYXNzIERpcnR5Qml0bWFwVmlldyBleHRlbmRzIEZyYW1lTGF5b3V0IHsKKyAgICAgICAgcHJpdmF0ZSBmaW5hbCBQYWludCBtUGFpbnQ7CisKKyAgICAgICAgRGlydHlCaXRtYXBWaWV3KENvbnRleHQgYykgeworICAgICAgICAgICAgc3VwZXIoYyk7CisgICAgICAgICAgICBtUGFpbnQgPSBuZXcgUGFpbnQoKTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgdm9pZCBkaXNwYXRjaERyYXcoQ2FudmFzIGNhbnZhcykgeworICAgICAgICAgICAgY2FudmFzLmRyYXdSR0IoMjU1LCAyNTUsIDI1NSk7CisKKyAgICAgICAgICAgIG1QYWludC5zZXRDb2xvcigweGZmZmYwMDAwKTsKKyAgICAgICAgICAgIGNhbnZhcy5kcmF3UmVjdCgyMDAuMGYsIDAuMGYsIDIyMC4wZiwgMjAuMGYsIG1QYWludCk7CisKKyAgICAgICAgICAgIGNhbnZhcy5zYXZlKCk7CisgICAgICAgICAgICBjYW52YXMuY2xpcFJlY3QoMjAuMGYsIDAuMGYsIDQwLjBmLCAyMC4wZik7CisgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiY2xpcFJlY3QgPSAiICsgY2FudmFzLmdldENsaXBCb3VuZHMoKSk7CisgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAicmVqZWN0ZWQgPSAiICsgY2FudmFzLnF1aWNrUmVqZWN0KDEwMC4wZiwgMTAwLjBmLCAxMTAuMGYsIDExMC4wZiwKKyAgICAgICAgICAgICAgICAgICAgQ2FudmFzLkVkZ2VUeXBlLkJXKSk7CisgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAicmVqZWN0ZWQgPSAiICsgY2FudmFzLnF1aWNrUmVqZWN0KDI1LjBmLCA1LjBmLCAzMC4wZiwgMTAuMGYsCisgICAgICAgICAgICAgICAgICAgIENhbnZhcy5FZGdlVHlwZS5CVykpOworICAgICAgICAgICAgY2FudmFzLnJlc3RvcmUoKTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgY2FudmFzLnNhdmUoKTsKKyAgICAgICAgICAgIGNhbnZhcy5zY2FsZSgyLjBmLCAyLjBmKTsKKyAgICAgICAgICAgIGNhbnZhcy5jbGlwUmVjdCgyMC4wZiwgMC4wZiwgNDAuMGYsIDIwLjBmKTsKKyAgICAgICAgICAgIExvZy5kKExPR19UQUcsICJjbGlwUmVjdCA9ICIgKyBjYW52YXMuZ2V0Q2xpcEJvdW5kcygpKTsKKyAgICAgICAgICAgIExvZy5kKExPR19UQUcsICJyZWplY3RlZCA9ICIgKyBjYW52YXMucXVpY2tSZWplY3QoNTAuMGYsIDUwLjBmLCA2MC4wZiwgNjAuMGYsCisgICAgICAgICAgICAgICAgICAgIENhbnZhcy5FZGdlVHlwZS5CVykpOworICAgICAgICAgICAgTG9nLmQoTE9HX1RBRywgInJlamVjdGVkID0gIiArIGNhbnZhcy5xdWlja1JlamVjdCgyNS4wZiwgNS4wZiwgMzAuMGYsIDEwLjBmLAorICAgICAgICAgICAgICAgICAgICBDYW52YXMuRWRnZVR5cGUuQlcpKTsKKyAgICAgICAgICAgIGNhbnZhcy5yZXN0b3JlKCk7CisKKyAgICAgICAgICAgIGNhbnZhcy5zYXZlKCk7CisgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDIwLjBmLCAyMC4wZik7CisgICAgICAgICAgICBjYW52YXMuY2xpcFJlY3QoMjAuMGYsIDAuMGYsIDQwLjBmLCAyMC4wZik7CisgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAiY2xpcFJlY3QgPSAiICsgY2FudmFzLmdldENsaXBCb3VuZHMoKSk7CisgICAgICAgICAgICBMb2cuZChMT0dfVEFHLCAicmVqZWN0ZWQgPSAiICsgY2FudmFzLnF1aWNrUmVqZWN0KDgwLjBmLCA4MC4wZiwgOTAuMGYsIDkwLjBmLAorICAgICAgICAgICAgICAgICAgICBDYW52YXMuRWRnZVR5cGUuQlcpKTsKKyAgICAgICAgICAgIExvZy5kKExPR19UQUcsICJyZWplY3RlZCA9ICIgKyBjYW52YXMucXVpY2tSZWplY3QoMjUuMGYsIDUuMGYsIDMwLjBmLCAxMC4wZiwKKyAgICAgICAgICAgICAgICAgICAgQ2FudmFzLkVkZ2VUeXBlLkJXKSk7CisgICAgICAgICAgICBjYW52YXMucmVzdG9yZSgpOworCisgICAgICAgICAgICBjYW52YXMuc2F2ZSgpOworICAgICAgICAgICAgY2FudmFzLnNjYWxlKDIuMGYsIDIuMGYpOyAgICAgICAgICAgIAorICAgICAgICAgICAgY2FudmFzLmNsaXBSZWN0KDIwLjBmLCAwLjBmLCA0MC4wZiwgMjAuMGYpOworCisgICAgICAgICAgICBtUGFpbnQuc2V0Q29sb3IoMHhmZjAwZmYwMCk7CisgICAgICAgICAgICBjYW52YXMuZHJhd1JlY3QoMC4wZiwgMC4wZiwgMjAuMGYsIDIwLjBmLCBtUGFpbnQpOworICAgICAgICAgICAgCisgICAgICAgICAgICBtUGFpbnQuc2V0Q29sb3IoMHhmZjAwMDBmZik7CisgICAgICAgICAgICBjYW52YXMuZHJhd1JlY3QoMjAuMGYsIDAuMGYsIDQwLjBmLCAyMC4wZiwgbVBhaW50KTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgY2FudmFzLnJlc3RvcmUoKTsKKworICAgICAgICAgICAgZmluYWwga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VMYXlvdXQodGhpcyk7CisgICAgICAgIGxheW91dC5hZGRWaWV3KHZpZXcsIG5ldyBGcmFtZUxheW91dC5MYXlvdXRQYXJhbXMoNDgwLCA4MDAsIEdyYXZpdHkuQ0VOVEVSKSk7CisgICAgICAgIHNldENvbnRlbnRWaWV3KGxheW91dCk7CisgICAgICAgIAorICAgICAgICBTY2FsZUFuaW1hdGlvbiBhID0gbmV3IFNjYWxlQW5pbWF0aW9uKDEuMGYsIDIuMGYsIDEuMGYsIDIuMGYsCisgICAgICAgICAgICAgICAgU2NhbGVBbmltYXRpb24uUkVMQVRJVkVfVE9fU0VMRiwgMC41ZiwKKyAgICAgICAgICAgICAgICBTY2FsZUFuaW1hdGlvbi5SRUxBVElWRV9UT19TRUxGLDAuNWYpOworICAgICAgICBhLnNldER1cmF0aW9uKDIwMDApOworICAgICAgICBhLnNldFJlcGVhdENvdW50KEFuaW1hdGlvbi5JTkZJTklURSk7CisgICAgICAgIGEuc2V0UmVwZWF0TW9kZShBbmltYXRpb24uUkVWRVJTRSk7CisgICAgICAgIHZpZXcuc3RhcnRBbmltYXRpb24oYSk7CisgICAgfQorCisgICAgc3RhdGljIGNsYXNzIEJpdG1hcHNWaWV3IGV4dGVuZHMgVmlldyB7CisgICAgICAgIHByaXZhdGUgUGFpbnQgbUJpdG1hcFBhaW50OworICAgICAgICBwcml2YXRlIGZpbmFsIEJpdG1hcCBtQml0bWFwMTsKKyAgICAgICAgcHJpdmF0ZSBmaW5hbCBCaXRtYXAgbUJpdG1hcDI7CisgICAgICAgIHByaXZhdGUgZmluYWwgUG9ydGVyRHVmZlhmZXJtb2RlIG1Ec3RJbjsKKworICAgICAgICBCaXRtYXBzVmlldyhDb250ZXh0IGMpIHsKKyAgICAgICAgICAgIHN1cGVyKGMpOworCisgICAgICAgICAgICBtQml0bWFwMSA9IEJpdG1hcEZhY3RvcnkuZGVjb2RlUmVzb3VyY2UoYy5nZXRSZXNvdXJjZXMoKSwgUi5kcmF3YWJsZS5zdW5zZXQxKTsKKyAgICAgICAgICAgIG1CaXRtYXAyID0gQml0bWFwRmFjdG9yeS5kZWNvZGVSZXNvdXJjZShjLmdldFJlc291cmNlcygpLCBSLmRyYXdhYmxlLnN1bnNldDIpOworCisgICAgICAgICAgICBtQml0bWFwUGFpbnQgPSBuZXcgUGFpbnQoKTsKKyAgICAgICAgICAgIG1Ec3RJbiA9IG5ldyBQb3J0ZXJEdWZmWGZlcm1vZGUoUG9ydGVyRHVmZi5Nb2RlLkRTVF9JTik7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHJvdGVjdGVkIHZvaWQgb25EcmF3KENhbnZhcyBjYW52YXMpIHsKKyAgICAgICAgICAgIHN1cGVyLm9uRHJhdyhjYW52YXMpOworCisgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDEyMC4wZiwgNTAuMGYpOworICAgICAgICAgICAgY2FudmFzLmRyYXdCaXRtYXAobUJpdG1hcDEsIDAuMGYsIDAuMGYsIG1CaXRtYXBQYWludCk7CisKKyAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoMC4wZiwgbUJpdG1hcDEuZ2V0SGVpZ2h0KCkpOworICAgICAgICAgICAgY2FudmFzLnRyYW5zbGF0ZSgwLjBmLCAyNS4wZik7CisgICAgICAgICAgICBjYW52YXMuZHJhd0JpdG1hcChtQml0bWFwMiwgMC4wZiwgMC4wZiwgbnVsbCk7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIG1CaXRtYXBQYWludC5zZXRBbHBoYSgxMjcpOworICAgICAgICAgICAgY2FudmFzLnRyYW5zbGF0ZSgwLjBmLCBtQml0bWFwMi5nZXRIZWlnaHQoKSk7CisgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDAuMGYsIDI1LjBmKTsKKyAgICAgICAgICAgIGNhbnZhcy5kcmF3Qml0bWFwKG1CaXRtYXAxLCAwLjBmLCAwLjBmLCBtQml0bWFwUGFpbnQpOworICAgICAgICAgICAgC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AgICAgbUJpdG1hcFBhaW50ID0gbmV3IFBhaW50KCk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHJvdGVjdGVkIHZvaWQgb25EcmF3KENhbnZhcyBjYW52YXMpIHsKKyAgICAgICAgICAgIHN1cGVyLm9uRHJhdyhjYW52YXMpOworICAgICAgICAgICAgCisgICAgICAgICAgICBMb2cuZCgiT3BlbkdMUmVuZGVyZXIiLCAiPT09PT09PT09PT09PT09PT0gRHJhdyIpOworCisgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDEyMC4wZiwgNTAuMGYpOworICAgICAgICAgICAgY2FudmFzLmRyYXdCaXRtYXAobUJpdG1hcDEsIDAuMGYsIDAuMGYsIG1CaXRtYXBQYWludCk7CisKKyAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoMC4wZiwgbUJpdG1hcDEuZ2V0SGVpZ2h0KCkpOworICAgICAgICAgICAgY2FudmFzLnRyYW5zbGF0ZSgwLjBmLCAyNS4wZik7CisgICAgICAgICAgICBjYW52YXMuZHJhd0JpdG1hcChtQml0bWFwMiwgMC4wZiwgMC4wZiwgbnVsbCk7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoMC4wZiwgbUJpdG1hcDIuZ2V0SGVpZ2h0KCkpOworICAgICAgICAgICAgY2FudmFzLnRyYW5zbGF0ZSgwLjBmLCAyNS4wZik7CisgICAgICAgICAgICBjYW52YXMuZHJhd0JpdG1hcChtQml0bWFwMywgMC4wZiwgMC4wZiwgbnVsbCk7CisgICAgICAgIH0KKyAgICB9Cit9CmRpZmYgLS1naXQgYS90ZXN0cy9Id0FjY2VsZXJhdGlvblRlc3Qvc3JjL2NvbS9nb29nbGUvYW5kcm9pZC90ZXN0L2h3dWkvQml0bWFwc1JlY3RBY3Rpdml0eS5qYXZhIGIvdGVzdHMvSHdBY2NlbGVyYXRpb25UZXN0L3NyYy9jb20vZ29vZ2xlL2FuZ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aWV3KTsKKyAgICB9CisKKyAgICBzdGF0aWMgY2xhc3MgQml0bWFwc1ZpZXcgZXh0ZW5kcyBWaWV3IHsKKyAgICAgICAgcHJpdmF0ZSBmaW5hbCBCaXRtYXAgbUJpdG1hcDE7CisgICAgICAgIHByaXZhdGUgZmluYWwgQml0bWFwIG1CaXRtYXAyOworICAgICAgICBwcml2YXRlIGZpbmFsIFBhaW50IG1Db2xvck1hdHJpeFBhaW50OworICAgICAgICBwcml2YXRlIGZpbmFsIFBhaW50IG1MaWdodGluZ1BhaW50OworICAgICAgICBwcml2YXRlIGZpbmFsIFBhaW50IG1CbGVuZFBhaW50OworCisgICAgICAgIEJpdG1hcHNWaWV3KENvbnRleHQgYykgeworICAgICAgICAgICAgc3VwZXIoYyk7CisKKyAgICAgICAgICAgIG1CaXRtYXAxID0gQml0bWFwRmFjdG9yeS5kZWNvZGVSZXNvdXJjZShjLmdldFJlc291cmNlcygpLCBSLmRyYXdhYmxlLnN1bnNldDEpOworICAgICAgICAgICAgbUJpdG1hcDIgPSBCaXRtYXBGYWN0b3J5LmRlY29kZVJlc291cmNlKGMuZ2V0UmVzb3VyY2VzKCksIFIuZHJhd2FibGUuc3Vuc2V0Mik7CisKKyAgICAgICAgICAgIG1Db2xvck1hdHJpeFBhaW50ID0gbmV3IFBhaW50KCk7CisgICAgICAgICAgICBmaW5hbCBDb2xvck1hdHJpeCBjb2xvck1hdHJpeCA9IG5ldyBDb2xvck1hdHJpeCgpOworICAgICAgICAgICAgY29sb3JNYXRyaXguc2V0U2F0dXJhdGlvbigwKTsKKyAgICAgICAgICAgIG1Db2xvck1hdHJpeFBhaW50LnNldENvbG9yRmlsdGVyKG5ldyBDb2xvck1hdHJpeENvbG9yRmlsdGVyKGNvbG9yTWF0cml4KSk7CisKKyAgICAgICAgICAgIG1MaWdodGluZ1BhaW50ID0gbmV3IFBhaW50KCk7CisgICAgICAgICAgICBtTGlnaHRpbmdQYWludC5zZXRDb2xvckZpbHRlcihuZXcgTGlnaHRpbmdDb2xvckZpbHRlcigweDAwNjBmZmZmLCAweDAwMTAxMDMwKSk7CisKKyAgICAgICAgICAgIG1CbGVuZFBhaW50ID0gbmV3IFBhaW50KCk7CisgICAgICAgICAgICBtQmxlbmRQYWludC5zZXRDb2xvckZpbHRlcihuZXcgUG9ydGVyRHVmZkNvbG9yRmlsdGVyKDB4N2Y5OTAwNDAsCisgICAgICAgICAgICAgICAgICAgIFBvcnRlckR1ZmYuTW9kZS5TUkNfT1ZFUikpOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHByb3RlY3RlZCB2b2lkIG9uRHJhdyhDYW52YXMgY2FudmFzKSB7CisgICAgICAgICAgICBzdXBlci5vbkRyYXcoY2FudmFzKTsKKworICAgICAgICAgICAgY2FudmFzLmRyYXdBUkdCKDI1NSwgMjU1LCAyNTUsIDI1NSk7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIGNhbnZhcy5zYXZlKCk7CisgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDEyMC4wZiwgNTAuMGYpOworICAgICAgICAgICAgY2FudmFzLmRyYXdCaXRtYXAobUJpdG1hcDEsIDAuMGYsIDAuMGYsIG1Db2xvck1hdHJpeFBhaW50KTsKKworICAgICAgICAgICAgY2FudmFzLnRyYW5zbGF0ZSgwLjBmLCA1MC4wZiArIG1CaXRtYXAxLmdldEhlaWdodCgpKTsKKyAgICAgICAgICAgIGNhbnZhcy5kcmF3Qml0bWFwKG1CaXRtYXAxLCAwLjBmLCAwLjBmLCBtTGlnaHRpbmdQYWludCk7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoMC4wZiwgNTAuMGYgKyBtQml0bWFwMS5nZXRIZWlnaHQoKSk7CisgICAgICAgICAgICBjYW52YXMuZHJhd0JpdG1hcChtQml0bWFwMSwgMC4wZiwgMC4wZiwgbUJsZW5kUGFpbnQpOworICAgICAgICAgICAgY2FudmFzLnJlc3RvcmUoK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udmFzLnRyYW5zbGF0ZSgxNDAuMGYsIDEwMC4wZik7CisKKyAgICAgICAgICAgIC8vY2FudmFzLmRyYXdSR0IoMjU1LCAyNTUsIDI1NSk7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIGludCBjb3VudCA9IGNhbnZhcy5zYXZlTGF5ZXIoMC4wZiwgMC4wZiwgMjAwLjBmLCAxMDAuMGYsIG1MYXllclBhaW50LAorICAgICAgICAgICAgICAgICAgICBDYW52YXMuQUxMX1NBVkVfRkxBRyk7CisKKyAgICAgICAgICAgIG1SZWN0UGFpbnQuc2V0Q29sb3IoMHhmZmZmMDAwMCk7CisgICAgICAgICAgICBjYW52YXMuZHJhd1JlY3QoMC4wZiwgMC4wZiwgMjAwLjBmLCAxMDAuMGYsIG1SZWN0UGFpbnQpOworCisgICAgICAgICAgICBjYW52YXMucmVzdG9yZVRvQ291bnQoY291bnQpOworICAgICAgICAgICAgCisgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDAuMGYsIDEyNS4wZik7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIGNvdW50ID0gY2FudmFzLnNhdmVMYXllcigwLjBmLCAwLjBmLCAyMDAuMGYsIDEwMC4wZiwgbUxheWVyUGFpbnQsCisgICAgICAgICAgICAgICAgICAgIENhbnZhcy5BTExfU0FWRV9GTEFHKTsKKworICAgICAgICAgICAgbVJlY3RQYWludC5zZXRDb2xvcigweGZmMDBmZjAwKTsKKyAgICAgICAgICAgIG1SZWN0UGFpbnQuc2V0QWxwaGEoNTApOworICAgICAgICAgICAgY2FudmFzLmRyYXdSZWN0KDAuMGYsIDAuMGYsIDIwMC4wZiwgMTAwLjBmLCBtUmVjdFBhaW50KTsKKworICAgICAgICAgICAgY2FudmFzLnJlc3RvcmVUb0NvdW50KGNvdW50KTsKKworICAgICAgICAgICAgY2FudmFzLnRyYW5zbGF0ZSgyNS4wZiwgMTI1LjBmKTsKKworICAgICAgICAgICAgbVJlY3RQYWludC5zZXRDb2xvcigweGZmMDAwMGZmKTsKKyAgICAgICAgICAgIG1SZWN0UGFpbnQuc2V0QWxwaGEoMjU1KTsKKyAgICAgICAgICAgIGNhbnZhcy5kcmF3UmVjdCgwLjBmLCAwLjBmLCAxMDAuMGYsIDUwLjBmLCBtUmVjdFBhaW50KTsgICAgICAgICAgICAKKyAgICAgICAgICAgIAorICAgICAgICAgICAgbUxheWVyUGFpbnQuc2V0QWxwaGEoMTI3KTsKKyAgICAgICAgICAgIG1MYXllclBhaW50LnNldFhmZXJtb2RlKG5ldyBQb3J0ZXJEdWZmWGZlcm1vZGUoUG9ydGVyRHVmZi5Nb2RlLlNSQ19PVVQpKTsKKyAgICAgICAgICAgIGNvdW50ID0gY2FudmFzLnNhdmVMYXllcig1MC4wZiwgMjUuMGYsIDE1MC4wZiwgNzUuMGYsIG1MYXllclBhaW50LAorICAgICAgICAgICAgICAgICAgICBDYW52YXMuQUxMX1NBVkVfRkxBRyk7CisKKyAgICAgICAgICAgIG1SZWN0UGFpbnQuc2V0Q29sb3IoMHhmZmZmMDAwMCk7CisgICAgICAgICAgICBjYW52YXMuZHJhd1JlY3QoNTAuMGYsIDI1LjBmLCAxNTAuMGYsIDc1LjBmLCBtUmVjdFBhaW50KTsKKworICAgICAgICAgICAgY2FudmFzLnJlc3RvcmVUb0NvdW50KGNvdW50KTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgY2FudmFzLnRyYW5zbGF0ZSgwLjBmLCAxMjUuMGYpOworCisgICAgICAgICAgICBtUmVjdFBhaW50LnNldENvbG9yKDB4ZmYwMDAwZmYpOworICAgICAgICAgICAgbVJlY3RQYWludC5zZXRBbHBoYSgyNTUpOworICAgICAgICAgICAgY2FudmFzLmRyYXdSZWN0KDAuMGYsIDAuMGYsIDEwMC4wZiwgNTAuMGYsIG1SZWN0UGFpbnQpOyAgICAgICAgICAgIAorICAgICAgICAgICAgCisgICAgICAgICAgICBtTGF5ZXJQYWludC5zZXRDb2xvcigweGZmZmYwMDAwKTsKKyAgICAgIC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sKKworICAgICAgICAgICAgbUJpdG1hcDEgPSBCaXRtYXBGYWN0b3J5LmRlY29kZVJlc291cmNlKGMuZ2V0UmVzb3VyY2VzKCksIFIuZHJhd2FibGUuc3Vuc2V0MSk7CisKKyAgICAgICAgICAgIG1TbWFsbFBhaW50ID0gbmV3IFBhaW50KCk7CisgICAgICAgICAgICBtU21hbGxQYWludC5zZXRBbnRpQWxpYXModHJ1ZSk7CisgICAgICAgICAgICBtU21hbGxQYWludC5zZXRDb2xvcigweGZmZmYwMDAwKTsKKyAgICAgICAgICAgIG1TbWFsbFBhaW50LnNldFN0cm9rZVdpZHRoKDEuMGYpOworCisgICAgICAgICAgICBtTWVkaXVtUGFpbnQgPSBuZXcgUGFpbnQoKTsKKyAgICAgICAgICAgIG1NZWRpdW1QYWludC5zZXRBbnRpQWxpYXModHJ1ZSk7CisgICAgICAgICAgICBtTWVkaXVtUGFpbnQuc2V0Q29sb3IoMHhmZjAwMDBmZik7CisgICAgICAgICAgICBtTWVkaXVtUGFpbnQuc2V0U3Ryb2tlV2lkdGgoNC4wZik7CisKKyAgICAgICAgICAgIG1MYXJnZVBhaW50ID0gbmV3IFBhaW50KCk7CisgICAgICAgICAgICBtTGFyZ2VQYWludC5zZXRBbnRpQWxpYXModHJ1ZSk7CisgICAgICAgICAgICBtTGFyZ2VQYWludC5zZXRDb2xvcigweGZmMDBmZjAwKTsKKyAgICAgICAgICAgIG1MYXJnZVBhaW50LnNldFN0cm9rZVdpZHRoKDE1LjBmKTsKKworICAgICAgICAgICAgbUFscGhhUGFpbnQgPSBuZXcgUGFpbnQoKTsKKyAgICAgICAgICAgIG1BbHBoYVBhaW50LnNldEFudGlBbGlhcyh0cnVlKTsKKyAgICAgICAgICAgIG1BbHBoYVBhaW50LnNldENvbG9yKDB4N2ZmZjAwNTApOworICAgICAgICAgICAgbUFscGhhUGFpbnQuc2V0U3Ryb2tlV2lkdGgoMTAuMGYpOworICAgICAgICAgICAgCisgICAgICAgICAgICBtU2hhZGVyID0gbmV3IEJpdG1hcFNoYWRlcihtQml0bWFwMSwgQml0bWFwU2hhZGVyLlRpbGVNb2RlLk1JUlJPUiwKKyAgICAgICAgICAgICAgICAgICAgQml0bWFwU2hhZGVyLlRpbGVNb2RlLk1JUlJPUik7CisKKyAgICAgICAgICAgIG1Qb2ludHMgPSBuZXcgZmxvYXRbXSB7CisgICAgICAgICAgICAgICAgICAgIDYyLjBmLCAwLjBmLCAzMDIuMGYsIDQwMC4wZiwKKyAgICAgICAgICAgICAgICAgICAgMzAyLjBmLCA0MDAuMGYsIDM1Mi4wZiwgNDAwLjBmLAorICAgICAgICAgICAgICAgICAgICAzNTIuMGYsIDQwMC4wZiwgMzUyLjBmLCA1MDAuMGYKKyAgICAgICAgICAgIH07CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHJvdGVjdGVkIHZvaWQgb25EcmF3KENhbnZhcyBjYW52YXMpIHsKKyAgICAgICAgICAgIHN1cGVyLm9uRHJhdyhjYW52YXMpOworCisgICAgICAgICAgICBjYW52YXMuZHJhd0FSR0IoMjU1LCAyNTUsIDI1NSwgMjU1KTsKKworICAgICAgICAgICAgY2FudmFzLnNhdmUoKTsKKyAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoMTAwLjBmLCAyMC4wZik7CisKKyAgICAgICAgICAgIGNhbnZhcy5kcmF3TGluZSgwLjBmLCAwLjBmLCA0MC4wZiwgNDAwLjBmLCBtU21hbGxQYWludCk7CisgICAgICAgICAgICBjYW52YXMuZHJhd0xpbmUoNS4wZiwgMC4wZiwgOTUuMGYsIDQwMC4wZiwgbU1lZGl1bVBhaW50KTsKKyAgICAgICAgICAgIGNhbnZhcy5kcmF3TGluZSgyMi4wZiwgMC4wZiwgMTYyLjBmLCA0MDAuMGYsIG1MYXJnZVBhaW50KTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgbUxhcmdlUGFpbnQuc2V0U2hhZGVyKG1TaGFkZXIpOworICAgICAgICAgIC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SBCaXRtYXBGYWN0b3J5LmRlY29kZVJlc291cmNlKGMuZ2V0UmVzb3VyY2VzKCksIFIuZHJhd2FibGUuc3Vuc2V0MSk7CisgICAgICAgICAgICBtVGV4V2lkdGggPSB0ZXh0dXJlLmdldFdpZHRoKCk7CisgICAgICAgICAgICBtVGV4SGVpZ2h0ID0gdGV4dHVyZS5nZXRIZWlnaHQoKTsKKyAgICAgICAgICAgIG1EcmF3V2lkdGggPSBtVGV4V2lkdGggKiAyLjJmOworICAgICAgICAgICAgbURyYXdIZWlnaHQgPSBtVGV4SGVpZ2h0ICogMS4yZjsKKworICAgICAgICAgICAgbVNjYWxlZFNoYWRlciA9IG5ldyBCaXRtYXBTaGFkZXIodGV4dHVyZSwgU2hhZGVyLlRpbGVNb2RlLk1JUlJPUiwKKyAgICAgICAgICAgICAgICAgICAgU2hhZGVyLlRpbGVNb2RlLk1JUlJPUik7CisgICAgICAgICAgICBNYXRyaXggbTIgPSBuZXcgTWF0cml4KCk7CisgICAgICAgICAgICBtMi5zZXRTY2FsZSgwLjVmLCAwLjVmKTsKKyAgICAgICAgICAgIG1TY2FsZWRTaGFkZXIuc2V0TG9jYWxNYXRyaXgobTIpOworICAgICAgICAgICAgCisgICAgICAgICAgICBtU2NhbGVkMlNoYWRlciA9IG5ldyBCaXRtYXBTaGFkZXIodGV4dHVyZSwgU2hhZGVyLlRpbGVNb2RlLk1JUlJPUiwKKyAgICAgICAgICAgICAgICAgICAgU2hhZGVyLlRpbGVNb2RlLk1JUlJPUik7CisgICAgICAgICAgICBNYXRyaXggbTMgPSBuZXcgTWF0cml4KCk7CisgICAgICAgICAgICBtMy5zZXRTY2FsZSgwLjFmLCAwLjFmKTsKKyAgICAgICAgICAgIG1TY2FsZWQyU2hhZGVyLnNldExvY2FsTWF0cml4KG0zKTsKKworICAgICAgICAgICAgbUhvckdyYWRpZW50ID0gbmV3IExpbmVhckdyYWRpZW50KDAuMGYsIDAuMGYsIG1EcmF3V2lkdGgsIDAuMGYsCisgICAgICAgICAgICAgICAgICAgIENvbG9yLlJFRCwgMHg3ZjAwZmYwMCwgU2hhZGVyLlRpbGVNb2RlLkNMQU1QKTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgbVZlcnRHcmFkaWVudCA9IG5ldyBMaW5lYXJHcmFkaWVudCgwLjBmLCAwLjBmLCAwLjBmLCBtRHJhd0hlaWdodCAvIDIuMGYsCisgICAgICAgICAgICAgICAgICAgIENvbG9yLllFTExPVywgQ29sb3IuTUFHRU5UQSwgU2hhZGVyLlRpbGVNb2RlLk1JUlJPUik7CisKKyAgICAgICAgICAgIG1Db21wb3NlU2hhZGVyID0gbmV3IENvbXBvc2VTaGFkZXIobVNjYWxlZFNoYWRlciwgbUhvckdyYWRpZW50LAorICAgICAgICAgICAgICAgICAgICBQb3J0ZXJEdWZmLk1vZGUuU1JDX09WRVIpOworICAgICAgICAgICAgbUNvbXBvc2UyU2hhZGVyID0gbmV3IENvbXBvc2VTaGFkZXIobUhvckdyYWRpZW50LCBtU2NhbGVkU2hhZGVyLAorICAgICAgICAgICAgICAgICAgICBQb3J0ZXJEdWZmLk1vZGUuU1JDX09VVCk7CisKKyAgICAgICAgICAgIG1Db2xvckZpbHRlciA9IG5ldyBMaWdodGluZ0NvbG9yRmlsdGVyKDB4MDA2MGZmZmYsIDB4MDAxMDEwMzApOworIAorICAgICAgICAgICAgbUxhcmdlUGFpbnQgPSBuZXcgUGFpbnQoKTsKKyAgICAgICAgICAgIG1MYXJnZVBhaW50LnNldEFudGlBbGlhcyh0cnVlKTsKKyAgICAgICAgICAgIG1MYXJnZVBhaW50LnNldFRleHRTaXplKDM2LjBmKTsKKyAgICAgICAgICAgIG1MYXJnZVBhaW50LnNldENvbG9yKDB4ZmYwMDAwMDApOworICAgICAgICAgICAgCisgICAgICAgICAgICBtUGFpbnQgPSBuZXcgUGFpbnQoKTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwcm90ZWN0ZWQgdm9pZCBvbkRyYXcoQ2FudmFzIGNhbnZhcykgeworICAgICAgICAgICAgc3VwZXIub25EcmF3KGNhbnZhcyk7CisgICAgICAgICAgICBjYW52YXMuZHJhd1JHQigyNTUsIDI1NSwgMjU1KTsKKworICAgICAgICAgICAgY2FudmFzLnNhdmUoKTsKKyAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoNDAuMGYsIDQwLjBmKTsKKworICAgICAgICAgICAgbVBhaW50LnNldFNoYWRlcihtQ29tcG9zZVNoYWRlcik7CisgICAgICAgICAgICBjYW52YXMuZHJhd1JlY3QoMC4wZiwgMC4wZiwgbURyYXdXaWR0aCwgbURyYXdIZWlnaHQsIG1QYWludCk7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoMC4wZiwgNDAuMGYgKyBtRHJhd0hlaWdodCk7CisgICAgICAgICAgICBtUGFpbnQuc2V0U2hhZGVyKG1Db21wb3NlMlNoYWRlcik7CisgICAgICAgICAgICBjYW52YXMuZHJhd1JlY3QoMC4wZiwgMC4wZiwgbURyYXdXaWR0aCwgbURyYXdIZWlnaHQsIG1QYWludCk7CisKKyAgICAgICAgICAgIGNhbnZhcy5yZXN0b3JlKCk7CisKKyAgICAgICAgICAgIGNhbnZhcy5zYXZlKCk7CisgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDQwLjBmICsgbURyYXdXaWR0aCArIDQwLjBmLCA0MC4wZik7CisKKyAgICAgICAgICAgIG1MYXJnZVBhaW50LnNldFNoYWRlcihtSG9yR3JhZGllbnQpOworICAgICAgICAgICAgY2FudmFzLmRyYXdUZXh0KCJPcGVuR0wgcmVuZGVyaW5nIiwgMC4wZiwgMjAuMGYsIG1MYXJnZVBhaW50KTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgbUxhcmdlUGFpbnQuc2V0U2hhZGVyKG1TY2FsZWQyU2hhZGVyKTsKKyAgICAgICAgICAgIGNhbnZhcy5kcmF3VGV4dCgiT3BlbkdMIHJlb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KKyAgICAgICAgcHJpdmF0ZSBmaW5hbCBCaXRtYXAgbUJpdG1hcDE7CisgICAgICAgIHByaXZhdGUgZmluYWwgUGFpbnQgbVNtYWxsUGFpbnQ7CisgICAgICAgIHByaXZhdGUgZmluYWwgUGFpbnQgbU1lZGl1bVBhaW50OworICAgICAgICBwcml2YXRlIGZpbmFsIFBhaW50IG1MYXJnZVBhaW50OworICAgICAgICBwcml2YXRlIGZpbmFsIEJpdG1hcFNoYWRlciBtU2hhZGVyOworICAgICAgICBwcml2YXRlIGZpbmFsIFBhdGggbVBhdGg7CisgICAgICAgIHByaXZhdGUgZmluYWwgUmVjdEYgbVBhdGhCb3VuZHM7CisgICAgICAgIHByaXZhdGUgZmluYWwgUGFpbnQgbUJvdW5kc1BhaW50OworICAgICAgICBwcml2YXRlIGZpbmFsIEJpdG1hcCBtQml0bWFwOworICAgICAgICBwcml2YXRlIGZpbmFsIGZsb2F0IG1PZmZzZXQ7CisgICAgICAgIHByaXZhdGUgZmluYWwgUGFpbnQgbUxpbmVQYWludDsKKworICAgICAgICBQYXRoc1ZpZXcoQ29udGV4dCBjKSB7CisgICAgICAgICAgICBzdXBlcihjKTsKKworICAgICAgICAgICAgbUJpdG1hcDEgPSBCaXRtYXBGYWN0b3J5LmRlY29kZVJlc291cmNlKGMuZ2V0UmVzb3VyY2VzKCksIFIuZHJhd2FibGUuc3Vuc2V0MSk7CisKKyAgICAgICAgICAgIG1TbWFsbFBhaW50ID0gbmV3IFBhaW50KCk7CisgICAgICAgICAgICBtU21hbGxQYWludC5zZXRBbnRpQWxpYXModHJ1ZSk7CisgICAgICAgICAgICBtU21hbGxQYWludC5zZXRDb2xvcigweGZmZmYwMDAwKTsKKyAgICAgICAgICAgIG1TbWFsbFBhaW50LnNldFN0cm9rZVdpZHRoKDEuMGYpOworICAgICAgICAgICAgbVNtYWxsUGFpbnQuc2V0U3R5bGUoUGFpbnQuU3R5bGUuU1RST0tFKTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgbUxpbmVQYWludCA9IG5ldyBQYWludCgpOworICAgICAgICAgICAgbUxpbmVQYWludC5zZXRBbnRpQWxpYXModHJ1ZSk7CisgICAgICAgICAgICBtTGluZVBhaW50LnNldENvbG9yKDB4ZmZmZjAwZmYpOworICAgICAgICAgICAgbUxpbmVQYWludC5zZXRTdHJva2VXaWR0aCgxLjBmKTsKKyAgICAgICAgICAgIG1MaW5lUGFpbnQuc2V0U3R5bGUoUGFpbnQuU3R5bGUuU1RST0tFKTsKKworICAgICAgICAgICAgbU1lZGl1bVBhaW50ID0gbmV3IFBhaW50KCk7CisgICAgICAgICAgICBtTWVkaXVtUGFpbnQuc2V0QW50aUFsaWFzKHRydWUpOworICAgICAgICAgICAgbU1lZGl1bVBhaW50LnNldENvbG9yKDB4ZmYwMDAwZmYpOworICAgICAgICAgICAgbU1lZGl1bVBhaW50LnNldFN0cm9rZVdpZHRoKDEwLjBmKTsKKyAgICAgICAgICAgIG1NZWRpdW1QYWludC5zZXRTdHlsZShQYWludC5TdHlsZS5TVFJPS0UpOworCisgICAgICAgICAgICBtTGFyZ2VQYWludCA9IG5ldyBQYWludCgpOworICAgICAgICAgICAgbUxhcmdlUGFpbnQuc2V0QW50aUFsaWFzKHRydWUpOworICAgICAgICAgICAgbUxhcmdlUGFpbnQuc2V0Q29sb3IoMHhmZjAwZmYwMCk7CisgICAgICAgICAgICBtTGFyZ2VQYWludC5zZXRTdHJva2VXaWR0aCgxNS4wZik7CisgICAgICAgICAgICBtTGFyZ2VQYWludC5zZXRTdHlsZShQYWludC5TdHlsZS5GSUxMKTsKKworICAgICAgICAgICAgbVNoYWRlciA9IG5ldyBCaXRtYXBTaGFkZXIobUJpdG1hcDEsIEJpdG1hcFNoYWRlci5UaWxlTW9kZS5NSVJST1IsCisgICAgICAgICAgICAgICAgICAgIEJpdG1hcFNoYWRlci5UaWxlTW9kZS5NSVJST1IpOworCisgICAgICAgICAgICBtUGF0aCA9IG5ldyBQYXRoKCk7CisgICAgICAgICAgIC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ZnNldCAqIDEuNWYsIC1tUGF0aEJvdW5kcy50b3AgKyBtT2Zmc2V0ICogMS41Zik7CisgICAgICAgICAgICBjYW52YXMuZHJhd1BhdGgobVBhdGgsIG1NZWRpdW1QYWludCk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHJvdGVjdGVkIHZvaWQgb25EcmF3KENhbnZhcyBjYW52YXMpIHsKKyAgICAgICAgICAgIHN1cGVyLm9uRHJhdyhjYW52YXMpOworCisgICAgICAgICAgICBjYW52YXMuZHJhd0FSR0IoMjU1LCAyNTUsIDI1NSwgMjU1KTsKKworICAgICAgICAgICAgY2FudmFzLnNhdmUoKTsKKyAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoMjAwLjBmLCA2MC4wZik7CisgICAgICAgICAgICBjYW52YXMuZHJhd1BhdGgobVBhdGgsIG1TbWFsbFBhaW50KTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgY2FudmFzLnRyYW5zbGF0ZSgzNTAuMGYsIDAuMGYpOworICAgICAgICAgICAgY2FudmFzLmRyYXdQYXRoKG1QYXRoLCBtTWVkaXVtUGFpbnQpOworCisgICAgICAgICAgICBtTGFyZ2VQYWludC5zZXRTaGFkZXIobVNoYWRlcik7CisgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDM1MC4wZiwgMC4wZik7CisgICAgICAgICAgICBjYW52YXMuZHJhd1BhdGgobVBhdGgsIG1MYXJnZVBhaW50KTsKKyAgICAgICAgICAgIG1MYXJnZVBhaW50LnNldFNoYWRlcihudWxsKTsKKyAgICAgICAgICAgIGNhbnZhcy5yZXN0b3JlKCk7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIGNhbnZhcy5zYXZlKCk7CisgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDIwMC4wZiwgMzYwLjBmKTsKKyAgICAgICAgICAgIGNhbnZhcy5kcmF3UGF0aChtUGF0aCwgbVNtYWxsUGFpbnQpOworICAgICAgICA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worCisgICAgICAgICAgICBtQml0bWFwMSA9IEJpdG1hcEZhY3RvcnkuZGVjb2RlUmVzb3VyY2UoYy5nZXRSZXNvdXJjZXMoKSwgUi5kcmF3YWJsZS5zdW5zZXQxKTsKKworICAgICAgICAgICAgbUJpdG1hcFBhaW50ID0gbmV3IFBhaW50KCk7CisgICAgICAgICAgICBtQml0bWFwUGFpbnQuc2V0RmlsdGVyQml0bWFwKHRydWUpOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHByb3RlY3RlZCB2b2lkIG9uRHJhdyhDYW52YXMgY2FudmFzKSB7CisgICAgICAgICAgICBzdXBlci5vbkRyYXcoY2FudmFzKTsKKworICAgICAgICAgICAgaW50IGNvdW50ID0gY2FudmFzLmdldFNhdmVDb3VudCgpOworICAgICAgICAgICAgTG9nLmQoIk9wZW5HTFJlbmRlcmVyIiwgImNvdW50PSIgKyBjb3VudCk7CisgICAgICAgICAgICBjb3VudCA9IGNhbnZhcy5zYXZlKCk7CisgICAgICAgICAgICBMb2cuZCgiT3BlbkdMUmVuZGVyZXIiLCAiY291bnQgYWZ0ZXIgc2F2ZT0iICsgY291bnQpOworICAgICAgICAgICAgY291bnQgPSBjYW52YXMuZ2V0U2F2ZUNvdW50KCk7CisgICAgICAgICAgICBMb2cuZCgiT3BlbkdMUmVuZGVyZXIiLCAiZ2V0U2F2ZUNvdW50IGFmdGVyIHNhdmU9IiArIGNvdW50KTsKKyAgICAgICAgICAgIGNhbnZhcy5yZXN0b3JlKCk7CisgICAgICAgICAgICBjb3VudCA9IGNhbnZhcy5nZXRTYXZlQ291bnQoKTsKKyAgICAgICAgICAgIExvZy5kKCJPcGVuR0xSZW5kZXJlciIsICJjb3VudCBhZnRlciByZXN0b3JlPSIgKyBjb3VudCk7CisgICAgICAgICAgICBjYW52YXMuc2F2ZSgpOworICAgICAgICAgICAgTG9nLmQoIk9wZW5HTFJlbmRlcmVyIiwgImNvdW50IGFmdGVyIHNhdmU9IiArIGNhbnZhcy5nZXRTYXZlQ291bnQoKSk7CisgICAgICAgICAgICBjYW52YXMuc2F2ZSgpOworICAgICAgICAgICAgTG9nLmQoIk9wZW5HTFJlbmRlcmVyIiwgImNvdW50IGFmdGVyIHNhdmU9IiArIGNhbnZhcy5nZXRTYXZlQ291bnQoKSk7CisgICAgICAgICAgICBjYW52YXMuc2F2ZSgpOworICAgICAgICAgICAgTG9nLmQoIk9wZW5HTFJlbmRlcmVyIiwgImNvdW50IGFmdGVyIHNhdmU9IiArIGNhbnZhcy5nZXRTYXZlQ291bnQoKSk7CisgICAgICAgICAgICBjYW52YXMucmVzdG9yZVRvQ291bnQoY291bnQpOworICAgICAgICAgICAgY291bnQgPSBjYW52YXMuZ2V0U2F2ZUNvdW50KCk7CisgICAgICAgICAgICBMb2cuZCgiT3BlbkdMUmVuZGVyZXIiLCAiY291bnQgYWZ0ZXIgcmVzdG9yZVRvQ291bnQ9IiArIGNvdW50KTsKKyAgICAgICAgICAgIGNvdW50ID0gY2FudmFzLnNhdmVMYXllcigwLCAwLCAxMCwgMTAsIG1CaXRtYXBQYWludCwgQ2FudmFzLkFMTF9TQVZFX0ZMQUcpOworICAgICAgICAgICAgTG9nLmQoIk9wZW5HTFJlbmRlcmVyIiwgImNvdW50IGFmdGVyIHNhdmVMYXllcj0iICsgY291bnQpOworICAgICAgICAgICAgY291bnQgPSBjYW52YXMuZ2V0U2F2ZUNvdW50KCk7CisgICAgICAgICAgICBMb2cuZCgiT3BlbkdMUmVuZGVyZXIiLCAiZ2V0U2F2ZUNvdW50IGFmdGVyIHNhdmVMYXllcj0iICsgY291bnQpOworICAgICAgICAgICAgY2FudmFzLnJlc3RvcmUoKTsKKyAgICAgICAgICAgIGNvdW50ID0gY2FudmFzLmdldFNhdmVDb3VudCgpOworICAgICAgICAgICAgTG9nLmQoIk9wZW5HTFJlbmRlcmVyIiwgImNvdW50IGFmdGVyIHJlc3RvcmU9IiArIGNvdW50KTsKKworICAgICAgICAgICAgY2FudmFzLn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oID0gdGV4dHVyZS5nZXRXaWR0aCgpOworICAgICAgICAgICAgbVRleEhlaWdodCA9IHRleHR1cmUuZ2V0SGVpZ2h0KCk7CisgICAgICAgICAgICBtRHJhd1dpZHRoID0gbVRleFdpZHRoICogMi4yZjsKKyAgICAgICAgICAgIG1EcmF3SGVpZ2h0ID0gbVRleEhlaWdodCAqIDEuMmY7CisKKyAgICAgICAgICAgIG1SZXBlYXRTaGFkZXIgPSBuZXcgQml0bWFwU2hhZGVyKHRleHR1cmUsIFNoYWRlci5UaWxlTW9kZS5SRVBFQVQsCisgICAgICAgICAgICAgICAgICAgIFNoYWRlci5UaWxlTW9kZS5SRVBFQVQpOworCisgICAgICAgICAgICBtVHJhbnNsYXRlZFNoYWRlciA9IG5ldyBCaXRtYXBTaGFkZXIodGV4dHVyZSwgU2hhZGVyLlRpbGVNb2RlLlJFUEVBVCwKKyAgICAgICAgICAgICAgICAgICAgU2hhZGVyLlRpbGVNb2RlLlJFUEVBVCk7CisgICAgICAgICAgICBNYXRyaXggbTEgPSBuZXcgTWF0cml4KCk7CisgICAgICAgICAgICBtMS5zZXRUcmFuc2xhdGUobVRleFdpZHRoIC8gMi4wZiwgbVRleEhlaWdodCAvIDIuMGYpOworICAgICAgICAgICAgbTEucG9zdFJvdGF0ZSg0NSwgMCwgMCk7CisgICAgICAgICAgICBtVHJhbnNsYXRlZFNoYWRlci5zZXRMb2NhbE1hdHJpeChtMSk7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIG1TY2FsZWRTaGFkZXIgPSBuZXcgQml0bWFwU2hhZGVyKHRleHR1cmUsIFNoYWRlci5UaWxlTW9kZS5NSVJST1IsCisgICAgICAgICAgICAgICAgICAgIFNoYWRlci5UaWxlTW9kZS5NSVJST1IpOworICAgICAgICAgICAgTWF0cml4IG0yID0gbmV3IE1hdHJpeCgpOworICAgICAgICAgICAgbTIuc2V0U2NhbGUoMC41ZiwgMC41Zik7CisgICAgICAgICAgICBtU2NhbGVkU2hhZGVyLnNldExvY2FsTWF0cml4KG0yKTsKKworICAgICAgICAgICAgbUhvckdyYWRpZW50ID0gbmV3IExpbmVhckdyYWRpZW50KDAuMGYsIDAuMGYsIG1EcmF3V2lkdGgsIDAuMGYsCisgICAgICAgICAgICAgICAgICAgIENvbG9yLlJFRCwgQ29sb3IuR1JFRU4sIFNoYWRlci5UaWxlTW9kZS5DTEFNUCk7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIG1EaWFnR3JhZGllbnQgPSBuZXcgTGluZWFyR3JhZGllbnQoMC4wZiwgMC4wZiwgbURyYXdXaWR0aCAvIDEuNWYsIG1EcmF3SGVpZ2h0LAorICAgICAgICAgICAgICAgICAgICBDb2xvci5CTFVFLCBDb2xvci5NQUdFTlRBLCBTaGFkZXIuVGlsZU1vZGUuQ0xBTVApOworICAgICAgICAgICAgCisgICAgICAgICAgICBtVmVydEdyYWRpZW50ID0gbmV3IExpbmVhckdyYWRpZW50KDAuMGYsIDAuMGYsIDAuMGYsIG1EcmF3SGVpZ2h0IC8gMi4wZiwKKyAgICAgICAgICAgICAgICAgICAgQ29sb3IuWUVMTE9XLCBDb2xvci5NQUdFTlRBLCBTaGFkZXIuVGlsZU1vZGUuTUlSUk9SKTsKKworICAgICAgICAgICAgbVBhaW50ID0gbmV3IFBhaW50KCk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHJvdGVjdGVkIHZvaWQgb25EcmF3KENhbnZhcyBjYW52YXMpIHsKKyAgICAgICAgICAgIHN1cGVyLm9uRHJhdyhjYW52YXMpOworICAgICAgICAgICAgLy9jYW52YXMuZHJhd1JHQigyNTUsIDI1NSwgMjU1KTsKKworICAgICAgICAgICAgLy8gQml0bWFwIHNoYWRlcnMKKyAgICAgICAgICAgIGNhbnZhcy5zYXZlKCk7CisgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDQwLjBmLCA0MC4wZik7CisKKyAgICAgICAgICAgIG1QYWludC5zZXRTaGFkZXIobVJlcGVhdFNoYWRlcik7CisgICAgICAgICAgICBjYW52YXMuZHJhd1JlY3QoMC4wZiwgMC4wZiwgbURyYXdXaWR0aCwgbURyYXdIZWlnaHQsIG1QYWludCk7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoMC4wZiwgNDAuMGYgKyBtRHJhd0hlaWdodCk7CisgICAgICAgICAgICBtUGFpbnQuc2V0U2hhZGVyKG1UcmFuc2xhdGVkU2hhZGVyKTsKKyAgICAgICAgICAgIGNhbnZhcy5kcmF3UmVjdCgwLjBmLCAwLjBmLCBtRHJhd1dpZHRoLCBtRHJhd0hlaWdodCwgbVBhaW50KTsKKworICAgICAgICAgICAgY2FudmFzLnRyYW5zbGF0ZSgwLjBmLCA0MC4wZiArIG1EcmF3SGVpZ2h0KTsKKyAgICAgICAgICAgIG1QYWludC5zZXRTaGFkZXIobVNjYWxlZFNoYWRlcik7CisgICAgICAgICAgICBjYW52YXMuZHJhd1JlY3QoMC4wZiwgMC4wZiwgbURyYXdXaWR0aCwgbURyYXdIZWlnaHQsIG1QYWludCk7CisKKyAgICAgICAgICAgIGNhbnZhcy5yZXN0b3JlKCk7CisKKyAgICAgICAgICAgIC8vIEdyYWRpZW50cworICAgICAgICAgICAgY2FudmFzLnNhdmUoKTsKKyAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoNDAuMGYgKyBtRHJhd1dpZHRoICsgNDAuMGYsIDQwLjBmKTsKKworICAgICAgICAgICAgbVBhaW50LnNldFNoYWRlcihtSG9yR3JhZGllbnQpOworICAgICAgICAgICAgY2FudmFzLmRyYXdSZWN0KDAuMGYsIDAuMGYsIG1EcmF3V2lkdGgsIG1EcmF3SGVpZ2h0LCBtUGFpbnQpOworICAgICAgICAgICAgCisgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDAuMGYsIDQwLjBmICsgbURyYXdIZWlnaHQpOworICAgICAgICAgICAgbVBhaW50LnNldFNoYWRlcihtRGlhZ0dyYWRpZ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FJlc291cmNlcygpLmdldERyYXdhYmxlKFIuZHJhd2FibGUuc3Vuc2V0MiksCisgICAgICAgIH0pIHsKKyAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgcHVibGljIFZpZXcgZ2V0VmlldyhpbnQgcG9zaXRpb24sIFZpZXcgY29udmVydFZpZXcsIFZpZXdHcm91cCBwYXJlbnQpIHsKKyAgICAgICAgICAgICAgICBWaWV3IGl0ZW0gPSBjb252ZXJ0VmlldzsKKyAgICAgICAgICAgICAgICBpZiAoaXRlbSA9PSBudWxsKSB7CisgICAgICAgICAgICAgICAgICAgIGl0ZW0gPSBMYXlvdXRJbmZsYXRlci5mcm9tKGdldENvbnRleHQoKSkuaW5mbGF0ZSgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBSLmxheW91dC5zdGFja19pdGVtLCBudWxsLCBmYWxzZSk7ICAgICAgICAgICAgICAgICAgICAKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgKChJbWFnZVZpZXcpIGl0ZW0uZmluZFZpZXdCeUlkKFIuaWQudGV4dHZpZXdfaWNvbikpLnNldEltYWdlRHJhd2FibGUoCisgICAgICAgICAgICAgICAgICAgICAgICBnZXRJdGVtKHBvc2l0aW9uICUgZ2V0Q291bnQoKSkpOworICAgICAgICAgICAgICAgICgoVGV4dFZpZXcpIGl0ZW0uZmluZFZpZXdCeUlkKFIuaWQubWluaV90ZXh0KSkuc2V0VGV4dCgiIiArIHBvc2l0aW9uKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gaXRlbTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSk7CisgICAgICAgIHN0YWNrLnNldERpc3BsYXllZENoaWxkKDApOworICAgIH0KK30KZGlmZiAtLWdpdCBhL3Rlc3RzL0h3QWNjZWxlcmF0aW9uVGVzdC9zcmMvY29tL2dvb2dsZS9hbmRyb2lkL3Rlc3QvaHd1aS9UZXh0QWN0aXZpdHkuamF2YSBiL3Rlc3RzL0h3QWNjZW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VyKGMpOworCisgICAgICAgICAgICBtTWVkaXVtUGFpbnQgPSBuZXcgUGFpbnQoKTsKKyAgICAgICAgICAgIG1NZWRpdW1QYWludC5zZXRBbnRpQWxpYXModHJ1ZSk7CisgICAgICAgICAgICBtTWVkaXVtUGFpbnQuc2V0Q29sb3IoMHhmZmZmMDAwMCk7CisKKyAgICAgICAgICAgIG1MYXJnZVBhaW50ID0gbmV3IFBhaW50KCk7CisgICAgICAgICAgICBtTGFyZ2VQYWludC5zZXRBbnRpQWxpYXModHJ1ZSk7CisgICAgICAgICAgICBtTGFyZ2VQYWludC5zZXRUZXh0U2l6ZSgzNi4wZik7CisKKyAgICAgICAgICAgIG1TdHJpa2VQYWludCA9IG5ldyBQYWludCgpOworICAgICAgICAgICAgbVN0cmlrZVBhaW50LnNldEFudGlBbGlhcyh0cnVlKTsKKyAgICAgICAgICAgIG1TdHJpa2VQYWludC5zZXRUZXh0U2l6ZSgxNi4wZik7CisgICAgICAgICAgICBtU3RyaWtlUGFpbnQuc2V0VW5kZXJsaW5lVGV4dCh0cnVlKTsKKworICAgICAgICAgICAgbVNjYWxlZFBhaW50ID0gbmV3IFBhaW50KCk7CisgICAgICAgICAgICBtU2NhbGVkUGFpbnQuc2V0QW50aUFsaWFzKHRydWUpOworICAgICAgICAgICAgbVNjYWxlZFBhaW50LnNldFRleHRTaXplKDE2LjBmKTsKKyAgICAgICAgfQorCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwcm90ZWN0ZWQgdm9pZCBvbkRyYXcoQ2FudmFzIGNhbnZhcykgeworICAgICAgICAgICAgc3VwZXIub25EcmF3KGNhbnZhcyk7CisgICAgICAgICAgICBjYW52YXMuZHJhd1JHQigyNTUsIDI1NSwgMjU1KTsKKworICAgICAgICAgICAgY2FudmFzLmRyYXdUZXh0KCJIZWxsbyBPcGVuR0wgcmVuZGVyZXIhIiwgMTAwLCAyMCwgbU1lZGl1bVBhaW50KTsKKyAgICAgICAgICAgIG1NZWRpdW1QYWludC5z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VhckxheW91dC5MYXlvdXRQYXJhbXMuV1JBUF9DT05URU5UCisgICAgICAgICkpOworCisgICAgICAgIHNldENvbnRlbnRWaWV3KGxheW91dCk7CisgICAgICAgIAorICAgICAgICBsYXlvdXQucG9zdChuZXcgUnVubmFibGUoKSB7CisgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgIHB1YmxpYyB2b2lkIHJ1bigpIHsKKyAgICAgICAgICAgICAgICBCaXRtYXAgYiA9IEJpdG1hcC5jcmVhdGVCaXRtYXAoZ2FtbWEuZ2V0V2lkdGgoKSwgZ2FtbWEuZ2V0SGVpZ2h0KCksCisgICAgICAgICAgICAgICAgICAgICAgICBCaXRtYXAuQ29uZmlnLkFSR0JfODg4OCk7CisgICAgICAgICAgICAgICAgQ2FudmFzIGMgPSBuZXcgQ2FudmFzKGIpOworICAgICAgICAgICAgICAgIGMuZHJhd0NvbG9yKDAsIFBvcnRlckR1ZmYuTW9kZS5DTEVBUik7CisgICAgICAgICAgICAgICAgZ2FtbWEuZHJhdyhjKTsKKworICAgICAgICAgICAgICAgIEltYWdlVmlldyBpbWFnZSA9IG5ldyBJbWFnZVZpZXcoVGV4dEdhbW1hQWN0aXZpdHkudGhpcyk7CisgICAgICAgICAgICAgICAgaW1hZ2Uuc2V0SW1hZ2VCaXRtYXAoYik7CisKKyAgICAgICAgICAgICAgICBsYXlvdXQuYWRkVmlldyhpbWFnZSwgbmV3IExpbmVhckxheW91dC5MYXlvdXRQYXJhbXMoCisgICAgICAgICAgICAgICAgICAgICAgICBMaW5lYXJMYXlvdXQuTGF5b3V0UGFyYW1zLldSQVBfQ09OVEVOVCwKKyAgICAgICAgICAgICAgICAgICAgICAgIExpbmVhckxheW91dC5MYXlvdXRQYXJhbXMuV1JBUF9DT05URU5UCisgICAgICAgICAgICAgICAgKSk7CisKKyAgICAgICAgICAgICAgICBzdGFydEFjdGl2aXR5KG5ldyBJbnRlbnQoVGV4dEdhbW1hQWN0aXZpdHkudGhpcywgU3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hbnZhcywgY2VudGVyWCwgY2VudGVyWSwgbUJpdG1hcDEuZ2V0V2lkdGgoKSwgbWF0cml4KTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgcm90YXRlKGNlbnRlclgsIGNlbnRlclksIGNhbWVyYSwgbWF0cml4LCAxMjIuMGYpOworICAgICAgICAgICAgZHJhd0JpdG1hcChjYW52YXMsIGNlbnRlclgsIGNlbnRlclksIG1CaXRtYXAxLmdldFdpZHRoKCkgKiAyLjBmLCBtYXRyaXgpOworICAgICAgICAgICAgCisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIHZvaWQgZHJhd0JpdG1hcChDYW52YXMgY2FudmFzLCBmbG9hdCBjZW50ZXJYLCBmbG9hdCBjZW50ZXJZLCBmbG9hdCBvZmZzZXQsCisgICAgICAgICAgICAgICAgTWF0cml4IG1hdHJpeCkgeworICAgICAgICAgICAgY2FudmFzLnNhdmUoKTsKKyAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUob2Zmc2V0LCAwLjBmKTsKKyAgICAgICAgICAgIGNhbnZhcy5jb25jYXQobWF0cml4KTsKKyAgICAgICAgICAgIGNhbnZhcy5kcmF3Qml0bWFwKG1CaXRtYXAxLCBjZW50ZXJYLCBjZW50ZXJZLCBudWxsKTsKKyAgICAgICAgICAgIGNhbnZhcy5yZXN0b3JlKCk7CisgICAgICAgIH0KKworICAgICAgICBwcml2YXRlIHZvaWQgcm90YXRlKGZsb2F0IGNlbnRlclgsIGZsb2F0IGNlbnRlclksIENhbWVyYSBjYW1lcmEsCisgICAgICAgICAgICAgICAgTWF0cml4IG1hdHJpeCwgZmxvYXQgYW5nbGUpIHsKKyAgICAgICAgICAgIGNhbWVyYS5zYXZlKCk7CisgICAgICAgICAgICBjYW1lcmEucm90YXRlWShhbmdsZSk7CisgICAgICAgICAgICBjYW1lcmEuZ2V0TWF0cml4KG1hdHJpeCk7CisgICAgICAgICAgICBjYW1lcmEucmVzdG9yZSgpOworCisgICAgICAgICAgICBtYX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HsKKyAgICAgICAgc3VwZXIub25DcmVhdGUoc2F2ZWRJbnN0YW5jZVN0YXRlKTsKKyAgICAgICAgCisgICAgICAgIHNldENvbnRlbnRWaWV3KG5ldyBYZmVybW9kZXNWaWV3KHRoaXMpKTsKKyAgICB9CisKKyAgICBzdGF0aWMgY2xhc3MgWGZlcm1vZGVzVmlldyBleHRlbmRzIFZpZXcgeworICAgICAgICBwcml2YXRlIGZpbmFsIFBhaW50IG1CbHVlUGFpbnQ7CisgICAgICAgIHByaXZhdGUgZmluYWwgUGFpbnQgbVJlZFBhaW50OworCisgICAgICAgIFhmZXJtb2Rlc1ZpZXcoQ29udGV4dCBjKSB7CisgICAgICAgICAgICBzdXBlcihjKTsKKworICAgICAgICAgICAgbUJsdWVQYWludCA9IG5ldyBQYWludCgpOworICAgICAgICAgICAgbUJsdWVQYWludC5zZXRDb2xvcigweGZmMDAwMGZmKTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgbVJlZFBhaW50ID0gbmV3IFBhaW50KCk7CisgICAgICAgICAgICBtUmVkUGFpbnQuc2V0Q29sb3IoMHg3ZmZmMDAwMCk7CisgICAgICAgIH0KKworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHJvdGVjdGVkIHZvaWQgb25EcmF3KENhbnZhcyBjYW52YXMpIHsKKyAgICAgICAgICAgIHN1cGVyLm9uRHJhdyhjYW52YXMpOworICAgICAgICAgICAgLy9jYW52YXMuZHJhd1JHQigyNTUsIDI1NSwgMjU1KTsKKworICAgICAgICAgICAgY2FudmFzLnRyYW5zbGF0ZSgxMDAuMGYsIDEwMC4wZik7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIC8vIFNSQyBtb2RlcworICAgICAgICAgICAgY2FudmFzLnNhdmUoKTsKKworICAgICAgICAgICAgZHJhd1JlY3RzKGNhbnZhcywgTW9kZS5TUkNfT1ZFUik7CisgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDAuMGYsIDEwMC4wZik7CisKKyAgICAgICAgICAgIGRyYXdSZWN0cyhjYW52YXMsIE1vZGUuU1JDX0lOKTsKKyAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoMC4wZiwgMTAwLjBmKTsgICAgICAgICAgICAKKworICAgICAgICAgICAgZHJhd1JlY3RzKGNhbnZhcywgTW9kZS5TUkNfT1VUKTsKKyAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoMC4wZiwgMTAwLjBmKTsKKworICAgICAgICAgICAgZHJhd1JlY3RzKGNhbnZhcywgTW9kZS5TUkNfQVRPUCk7CisgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDAuMGYsIDEwMC4wZik7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIGRyYXdSZWN0cyhjYW52YXMsIE1vZGUuU1JDKTsKKworICAgICAgICAgICAgY2FudmFzLnJlc3RvcmUoKTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgY2FudmFzLnRyYW5zbGF0ZSgxMDAuMGYsIDAuMGYpOworICAgICAgICAgICAgCisgICAgICAgICAgICAvLyBEU1QgbW9kZXMKKyAgICAgICAgICAgIGNhbnZhcy5zYXZlKCk7CisKKyAgICAgICAgICAgIGRyYXdSZWN0cyhjYW52YXMsIE1vZGUuRFNUX09WRVIpOworICAgICAgICAgICAgY2FudmFzLnRyYW5zbGF0ZSgwLjBmLCAxMDAuMGYpOworCisgICAgICAgICAgICBkcmF3UmVjdHMoY2FudmFzLCBNb2RlLkRTVF9JTik7CisgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDAuMGYsIDEwMC4wZik7ICAgICAgICAgICAgCisKKyAgICAgICAgICAgIGRyYXdSZWN0cyhjYW52YXMsIE1vZGUuRFNUX09VVCk7CisgICAgICAgICAgICBjYW52YXMudHJhbnNsYXRlKDAuMGYsIDEwMC4wZik7CisKKyAgICAgICAgICAgIGRyYXdSZWN0cyhjYW52YXMsIE1vZGUuRFNUX0FUT1ApOworICAgICAgICAgICAgY2FudmFzLnRyYW5zbGF0ZSgwLjBmLCAxMDAuMGYpOworICAgICAgICAgICAgCisgICAgICAgICAgICBkcmF3UmVjdHMoY2FudmFzLCBNb2RlLkRTVCk7CisKKyAgICAgICAgICAgIGNhbnZhcy5yZXN0b3JlKCk7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoMTAwLjBmLCAwLjBmKTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgLy8gT3RoZXIgbW9kZXMKKyAgICAgICAgICAgIGNhbnZhcy5zYXZlKCk7CisKKyAgICAgICAgICAgIGRyYXdSZWN0cyhjYW52YXMsIE1vZGUuQ0xFQVIpOworICAgICAgICAgICAgY2FudmFzLnRyYW5zbGF0ZSgwLjBmLCAxMDAuMGYpOworCisgICAgICAgICAgICBkcmF3UmVjdHMoY2FudmFzLCBNb2RlLlhPUik7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoMC4wZiwgMTAwLjBmKTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgbUJsdWVQYWludC5zZXRBbHBoYSgxMjcpOworICAgICAgICAgICAgY2FudmFzLmRyYXdSZWN0KDAuMGYsIDAuMGYsIDUwLjBmLCA1MC4wZiwgbUJsdWVQYWludCk7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIGNhbnZhcy50cmFuc2xhdGUoMC4wZiwgMTAwLjBmKTsKKyAgICAgICAgICAgIAorICAgICAgICAgICAgbUJsdWVQYWludC5zZXRBbHBoYSgxMCk7CisgICAgICAgICAgICBtQmx1ZVBhaW50LnNldENvbG9yKDB4N2YwMDAwZmYpOworICAgICAgICAgICAgY2FudmFzLmRyYXdSZWN0KDAuMGYsIDAuMGYsIDUwLjBmLCA1MC4wZiwgbUJsdWVQYWludCk7CisgICAgICAgICAgICAKKyAgICAgICAgICAgIG1CbHVlUGFpbnQuc2V0Q29sb3IoMHhmZjAwMDBmZik7CisgICAgICAgICAgICBtQmx1ZVBhaW50LnNldEFscGhhKD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AgICAgIG5ldyBUZXN0KCJUaWNrZXIiKSB7Ci0gICAgICAgICAgICBwdWJsaWMgdm9pZCBydW4oKSB7Ci0gICAgICAgICAgICAgICAgTm90aWZpY2F0aW9uIG5vdCA9IG5ldyBOb3RpZmljYXRpb24oCi0gICAgICAgICAgICAgICAgICAgIFIuZHJhd2FibGUuYXBwX2dtYWlsLCAKLSAgICAgICAgICAgICAgICAgICAgIk5ldyBtYWlsIGZyb20gam9lb0BleGFtcGxlLmNvbSwgb24gdGhlIHRvcGljIG9mIHZlcnkgbG9uZyB0aWNrZXIgdGV4dHMiLAotICAgICAgICAgICAgICAgICAgICBTeXN0ZW0uY3VycmVudFRpbWVNaWxsaXMoKSk7Ci0gICAgICAgICAgICAgICAgbm90LnNldExhdGVzdEV2ZW50SW5mbyhOb3RpZmljYXRpb25UZXN0TGlzdC50aGlzLAotICAgICAgICAgICAgICAgICAgICAiQSBuZXcgbWVzc2FnZSBhd2FpdHMiLAotICAgICAgICAgICAgICAgICAgICAiVGhlIGNvbnRlbnRzIGFyZSB2ZXJ5IGludGVyZXN0aW5nIGFuZCBpbXBvcnRhbnQiLAotICAgICAgICAgICAgICAgICAgICBtYWtlSW50ZW50KCkpOwotICAgICAgICAgICAgICAgIG1OTS5ub3RpZnkoMSwgbm90KTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfSwKLQogICAgICAgICBuZXcgVGVzdCgiQ3Jhc2giKSB7CiAgICAgICAgICAgICBwdWJsaWMgdm9pZCBydW4oKQogICAgICAgICAgICAgewpkaWZmIC0tZ2l0IGEvdGVzdHMvU3RhdHVzQmFyL3NyYy9jb20vYW5kcm9pZC9zdGF0dXNiYXJ0ZXN0L1N0YXR1c0JhclRlc3QuamF2YSBiL3Rlc3RzL1N0YXR1c0Jhci9zcmMvY29tL2FuZHJvaWQvc3RhdHVzYmFydGVzdC9TdGF0dXNCYXJUZXN0LmphdmEKaW5kZXggMTA3ODcwMS4uYjY2NWQyZiAxMDA2NDQKLS0tIGEvdGVzdHMvU3RhdHVzQmFyL3NyYy9jb20vYW5kcm9pZC9zdGF0dXNiYXJ0ZXN0L1N0YXR1c0JhclRlc3QuamF2YQorKysgYi90ZXN0cy9TdGF0dXNCYXIvc3JjL2NvbS9hbmRyb2lkL3N0YXR1c2JhcnRlc3QvU3RhdHVzQmFyVGVzdC5qYXZhCkBAIC03Niw3ICs3NiwxNyBAQAogICAgICAgICAgICAgICAgIHdpbi5zZXRBdHRyaWJ1dGVzKHdpblBhcmFtcyk7CiAgICAgICAgICAgICB9CiAgICAgICAgIH0sCi0gICAgICAgIG5ldyBUZXN0KCJmdWxsU2NyZWVuSW50ZW50IikgeworICAgICAgICBuZXcgVGVzdCgiSW1tZXJzaXZlOiBFbnRlciIpIHsKKyAgICAgICAgICAgIHB1YmxpYyB2b2lkIHJ1bigpIHsKKyAgICAgICAgICAgICAgICBzZXRJbW1lcnNpdmUodHJ1ZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0sCisgICAgICAgIG5ldyBUZXN0KCJJbW1lcnNpdmU6IEV4aXQiKSB7CisgICAgICAgICAgICBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgICAgICAgICAgc2V0SW1tZXJzaXZlKGZhbHNlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSwKKyAgICAgICAgbmV3IFRlc3QoIlByaW9yaXR5IG5vdGlmaWNhdGlvbiIpIHsKICAgICAgICAgICAgIHB1YmxpYyB2b2lkIHJ1bigpIHsKICAgICAgICAgICAgICAgICBOb3RpZmljYXRpb24gbm90ID0gbmV3IE5vdGlmaWNhdGlvbihTdGF0dXNCYXJUZXN0LnRoaXMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFIuZHJhd2FibGUuc3RhdF9zeXNfcGhvbmUsCkBAIC04Niw4ICs5Niw5IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICIoODg4KSA1NTUtNTAzOCIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG51bGwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKTsKKyAgICAgICAgICAgICAgICBub3QuZmxhZ3MgfD0gTm90aWZpY2F0aW9uLkZMQUdfSElHSF9QUklPUklUWTsKICAgICAgICAgICAgICAgICBJbnRlbnQgZnVsbFNjcmVlbkludGVudCA9IG5ldyBJbnRlbnQoU3RhdHVzQmFyVGVzdC50aGlzLCBUZXN0QWxlcnRBY3Rpdml0eS5jbGFzcyk7Ci0gICAgICAgICAgICAgICAgaW50IGlkID0gKGludClTeXN0ZW0uY3VycmVudFRpbWVNaWxsaXMoKTsKKyAgICAgICAgICAgICAgICBpbnQgaWQgPSAoaW50KVN5c3RlbS5jdXJyZW50VGltZU1pbGxpcygpOyAvLyBYWFggSEFYCiAgICAgICAgICAgICAgICAgZnVsbFNjcmVlbkludGVudC5wdXRFeHRyYSgiaWQiLCBpZCk7CiAgICAgICAgICAgICAgICAgbm90LmZ1bGxTY3JlZW5JbnRlbnQgPSBQZW5kaW5nSW50ZW50LmdldEFjdGl2aXR5KAogICAgICAgICAgICAgICAgICAgICBTdGF0dXNCYXJUZXN0LnRoaXMsCmRpZmYgLS1naXQgYS90b29scy9hYXB0L0NvbW1hbmQuY3BwIGIvdG9vbHMvYWFwdC9Db21tYW5kLmNwcAppbmRleCBmNzFlYmI5Li5lYWZmMGY0IDEwMDY0NAotLS0gYS90b29scy9hYXB0L0NvbW1hbmQuY3BwCisrKyBiL3Rvb2xzL2FhcHQvQ29tbWFuZC5jcHAKQEAgLTE5OCw4ICsxOTgsMTAgQEAKICAgICAgICAgaWYgKCZyZXMgPT0gTlVMTCkgewogICAgICAgICAgICAgcHJpbnRmKCJcbk5vIHJlc291cmNlIHRhYmxlIGZvdW5kLlxuIik7CiAgICAgICAgIH0gZWxzZSB7CisjaWZuZGVmIEhBVkVfQU5EUk9JRF9PUwogICAgICAgICAgICAgcHJpbnRmKCJcblJlc291cmNlIHRhYmxlOlxuIik7CiAgICAgICAgICAgICByZXMuc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lc291cmNlLmNwcCBiL3Rvb2xzL2FhcHQvUmVzb3VyY2UuY3BwCmluZGV4IDljNWZjZGEyLi4wMTcyOGExIDEwMDY0NAotLS0gYS90b29scy9hYXB0L1Jlc291cmNlLmNwcAorKysgYi90b29scy9hYXB0L1Jlc291cmNlLmNwcApAQCAtNTQyLDExICs1NDIsMTEgQEAKICAgICAgICAgICAgICAgICAgICAgICAgIERlZmF1bHRLZXllZFZlY3RvcjxBYXB0R3JvdXBFbnRyeSwgc3A8QWFwdEZpbGU+ID4gYmFzZUZpbGVzID0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmFzZUdyb3VwLT5nZXRGaWxlcygpOwogICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChzaXplX3QgaT0wOyBpIDwgYmFzZUZpbGVzLnNpemUoKTsgaSsrKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRmKCJiYXNlRmlsZSAlbGQgaGFzIGZsYXZvciAlc1xuIiwgaSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmludGYoImJhc2VGaWxlICVkIGhhcyBmbGF2b3IgJXNcbiIsIGksCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiYXNlRmlsZXMua2V5QXQoaSkudG9TdHJpbmcoKS5zdHJpbmcoKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHNpemVfdCBpPTA7IGkgPCBvdmVybGF5RmlsZXMuc2l6ZSgpOyBpKyspIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmludGYoIm92ZXJsYXlGaWxlICVsZCBoYXMgZmxhdm9yICVzXG4iLCBpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByaW50Zigib3ZlcmxheUZpbGUgJWQgaGFzIGZsYXZvciAlc1xuIiwgaSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG92ZXJsYXlGaWxlcy5rZXlBdChpKS50b1N0cmluZygpLnN0cmluZygpKTsKICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgfQpAQCAtNTYwLDcgKzU2MCw3IEBACiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleUF0KG92ZXJsYXlHcm91cEluZGV4KSk7CiAgICAgICAgICAgICAgICAgICAgICAgICBpZihiYXNlRmlsZUluZGV4IDwgVU5LTk9XTl9FUlJPUikgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChidW5kbGUtPmdldFZlcmJvc2UoKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmludGYoImZvdW5kIGEgbWF0Y2ggKCVsZCkgZm9yIG92ZXJsYXkgZmlsZSAlcywgZm9yIGZsYXZvciAlc1xuIiwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRmKCJmb3VuZCBhIG1hdGNoICglZCkgZm9yIG92ZXJsYXkgZmlsZSAlcywgZm9yIGZsYXZvciAlc1xuIiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiYXNlRmlsZUluZGV4LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG92ZXJsYXlHcm91cC0+Z2V0TGVhZigpLnN0cmluZygpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG92ZXJsYXlGaWxlcy5rZXlBdChvdmVybGF5R3JvdXBJbmRleCkudG9TdHJpbmcoKS5zdHJpbmcoKSk7CkBAIC0yMDgxLDEyICsyMDgxLDEzIEBACiAgICAgLy8gdGFnOmF0dHJpYnV0ZSBwYWlycyB0aGF0IHNob3VsZCBiZSBjaGVja2VkIGluIGxheW91dCBmaWxlcy4KICAgICBLZXllZFZlY3RvcjxTdHJpbmc4LCBOYW1lc3BhY2VBdHRyaWJ1dGVQYWlyPiBrTGF5b3V0VGFnQXR0clBhaXJzOwogICAgIGFk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WJsZSBhbGwgc3RvcmVkIG5ldHdvcmtzIGluIHN1cHBsaWNhbnQuCisgICAgICovCisgICAgc3RhdGljIHZvaWQgaW5pdGlhbGl6ZShDb250ZXh0IGNvbnRleHQpIHsKKyAgICAgICAgTG9nLmQoVEFHLCAiVXBkYXRpbmcgY29uZmlnIGFuZCBlbmFibGluZyBhbGwgbmV0d29ya3MiKTsKKyAgICAgICAgc0NvbnRleHQgPSBjb250ZXh0OworICAgICAgICB1cGRhdGVDb25maWd1cmVkTmV0d29ya3MoKTsKKyAgICAgICAgZW5hYmxlQWxsTmV0d29ya3MoKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBGZXRjaCB0aGUgbGlzdCBvZiBjdXJyZW50bHkgY29uZmlndXJlZCBuZXR3b3JrcworICAgICAqIEByZXR1cm4gTGlzdCBvZiBuZXR3b3JrcworICAgICAqLworICAgIHN0YXRpYyBMaXN0PFdpZmlDb25maWd1cmF0aW9uPiBnZXRDb25maWd1cmVkTmV0d29ya3MoKSB7CisgICAgICAgIExpc3Q8V2lmaUNvbmZpZ3VyYXRpb24+IG5ldHdvcmtzID0gbmV3IEFycmF5TGlzdDxXaWZpQ29uZmlndXJhdGlvbj4oKTsKKyAgICAgICAgc3luY2hyb25pemVkIChzQ29uZmlndXJlZE5ldHdvcmtzKSB7CisgICAgICAgICAgICBmb3IgKFdpZmlDb25maWd1cmF0aW9uIGNvbmZpZyA6IHNDb25maWd1cmVkTmV0d29ya3MpIHsKKyAgICAgICAgICAgICAgICBuZXR3b3Jrcy5hZGQoY29uZmlnLmNsb25lKCkpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICAgIHJldHVybiBuZXR3b3JrczsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBlbmFibGUgYWxsIG5ldHdvcmtzIGFuZCBzYXZlIGNvbmZpZy4gVGhpcyB3aWxsIGJlIGEgbm8tb3AgaWYgdGhlIGxpc3QKKyAgICAgKiBvZiBjb25maWd1cmVkIG5ldHd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pbHVyZSBldmVudCBmcm9tIHN1cHBsaWNhbnQKKyAgICAgKgorICAgICAqIEBwYXJhbSBjb25maWcgVGhlIGNvbmZpZ3VyYXRpb24gZGV0YWlscyBpbiBXaWZpQ29uZmlndXJhdGlvbgorICAgICAqLworICAgIHN0YXRpYyB2b2lkIHNlbGVjdE5ldHdvcmsoV2lmaUNvbmZpZ3VyYXRpb24gY29uZmlnKSB7CisgICAgICAgIGlmIChjb25maWcgIT0gbnVsbCkgeworICAgICAgICAgICAgaW50IG5ldElkID0gYWRkT3JVcGRhdGVOZXR3b3JrTmF0aXZlKGNvbmZpZyk7CisgICAgICAgICAgICBzZWxlY3ROZXR3b3JrKG5ldElkKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIFNlbGVjdHMgdGhlIHNwZWNpZmllZCBuZXR3b3JrIGZvciBjb25uZWN0aW9uLiBUaGlzIGludm9sdmVzCisgICAgICogdXBkYXRpbmcgdGhlIHByaW9yaXR5IG9mIGFsbCB0aGUgbmV0d29ya3MgYW5kIGVuYWJsaW5nIHRoZSBnaXZlbgorICAgICAqIG5ldHdvcmsgd2hpbGUgZGlzYWJsaW5nIG90aGVycy4KKyAgICAgKgorICAgICAqIFNlbGVjdGluZyBhIG5ldHdvcmsgd2lsbCBsZWF2ZSB0aGUgb3RoZXIgbmV0d29ya3MgZGlzYWJsZWQgYW5kCisgICAgICogYSBjYWxsIHRvIGVuYWJsZUFsbE5ldHdvcmtzKCkgbmVlZHMgdG8gYmUgaXNzdWVkIHVwb24gYSBjb25uZWN0aW9uCisgICAgICogb3IgYSBmYWlsdXJlIGV2ZW50IGZyb20gc3VwcGxpY2FudAorICAgICAqCisgICAgICogQHBhcmFtIG5ldElkIG5ldHdvcmsgdG8gc2VsZWN0IGZvciBjb25uZWN0aW9uCisgICAgICovCisgICAgc3RhdGljIHZvaWQgc2VsZWN0TmV0d29yayhpbnQgbmV0SWQpIHsKKyAgICAgICAgLy8gUmVzZXQgdGhlIHByaW9yaXR5IG9mIGVhY2ggbmV0d29yayBhdCBzdGFydCBvciBpZiBpdCBnb2VzIHRvbyBoaWdoLgorICAgICAgICBpZiAoc0xhc3RQcmlvcml0eSA9PSAtMSB8fCBzTGFzdFByaW9yaXR5ID4gMTAwMDAwMCkgeworICAgICAgICAgICAgZm9yIChXaWZpQ29uZmlndXJhdGlvbiBjb25mIDogc0NvbmZpZ3VyZWROZXR3b3JrcykgeworICAgICAgICAgICAgICAgIGlmIChjb25mLm5ldHdvcmtJZCAhPSAtMSkgeworICAgICAgICAgICAgICAgICAgICBjb25mLnByaW9yaXR5ID0gMDsKKyAgICAgICAgICAgICAgICAgICAgYWRkT3JVcGRhdGVOZXR3b3JrTmF0aXZlKGNvbmYpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIHNMYXN0UHJpb3JpdHkgPSAwOworICAgICAgICB9CisKKyAgICAgICAgLy8gU2V0IHRvIHRoZSBoaWdoZXN0IHByaW9yaXR5IGFuZCBzYXZlIHRoZSBjb25maWd1cmF0aW9uLgorICAgICAgICBXaWZpQ29uZmlndXJhdGlvbiBjb25maWcgPSBuZXcgV2lmaUNvbmZpZ3VyYXRpb24oKTsKKyAgICAgICAgY29uZmlnLm5ldHdvcmtJZCA9IG5ldElkOworICAgICAgICBjb25maWcucHJpb3JpdHkgPSArK3NMYXN0UHJpb3JpdHk7CisKKyAgICAgICAgYWRkT3JVcGRhdGVOZXR3b3JrTmF0aXZlKGNvbmZpZyk7CisgICAgICAgIFdpZmlOYXRpdmUuc2F2ZUNvbmZpZ0NvbW1hbmQoKTsKKworICAgICAgICAvKiBFbmFibGUgdGhlIGdpdmVuIG5ldHdvcmsgd2hpbGUgZGlzYWJsaW5nIGFsbCBvdGhlciBuZXR3b3JrcyAqLworICAgICAgICBXaWZpTmF0aXZlLmVuYWJsZU5ldHdvcmtDb21tYW5kKG5ldElkLCB0cnVlKTsKKworICAgICAgICAvKiB1cGRhdGUgdGhlIGNvbmZpZ3VyZWQgbmV0d29ya3MgbGlzdCBidXQgbm90IHNlbmQgYQorICAgICAgICAgKiBicm9hZGNhc3QgdG8gYXZvaWQgYSBmZXRjaCBmcm9tIHNldHRpbmdzCisgICAgICAgICAqIGR1cmluZyB0aGlzIHRlbXBvcmFyeSBkaXNhYmxpbmcgb2YgbmV0d29ya3MKKyAgICAgICAgICovCisgICAgICAgIHVwZGF0ZUNvbmZpZ3VyZWROZXR3b3JrcygpOworICAgIH0KKworICAgIC8qKgorICAgICAqIEFkZC91cGRhdGUgdGhlIHNwZWNpZmllZCBjb25maWd1cmF0aW9uIGFuZCBzYXZlIGNvbmZpZworICAgICAqCisgICAgICogQHBhcmFtIGNvbmZpZyBXaWZpQ29uZmlndXJhdGlvbiB0byBiZSBzYXZlZAorICAgICAqLworICAgIHN0YXRpYyB2b2lkIHNhdmVOZXR3b3JrKFdpZmlDb25maWd1cmF0aW9uIGNvbmZpZykgeworICAgICAgICBpbnQgbmV0SWQgPSBhZGRPclVwZGF0ZU5ldHdvcmtOYXRpdmUoY29uZmlnKTsKKyAgICAgICAgLyogZW5hYmxlIGEgbmV3IG5ldHdvcmsgKi8KKyAgICAgICAgaWYgKGNvbmZpZy5uZXR3b3JrSWQgPCAwKSB7CisgICAgICAgICAgICBXaWZpTmF0aXZlLmVuYWJsZU5ldHdvcmtDb21tYW5kKG5ldElkLCBmYWxzZSk7CisgICAgICAgIH0KKyAgICAgICAgV2lmaU5hdGl2ZS5zYXZlQ29uZmlnQ29tbWFuZCgpOworICAgICAgICB1cGRhdGVDb25maWdBbmRTZW5kQ2hhbmdlQnJvYWRjYXN0KCk7CisgICAgfQorCisgICAgLyoqCisgICAgICogRm9yZ2V0IHRoZSBzcGVjaWZpZWQgbmV0d29yayBhbmQgc2F2ZSBjb25maWcKKyAgICAgKgorICAgICAqIEBwYXJhbSBuZXRJZCBuZXR3b3JrIHRvIGZvcmdldAorICAgICAqLworICAgIHN0YXRpYyB2b2lkIGZvcmdldE5ldHdv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GNhc3QoaW50ZW50KTsKKyAgICB9CisKKyAgICBwcml2YXRlIHN0YXRpYyB2b2lkIHVwZGF0ZUNvbmZpZ3VyZWROZXR3b3JrcygpIHsKKyAgICAgICAgU3RyaW5nIGxpc3RTdHIgPSBXaWZpTmF0aXZlLmxpc3ROZXR3b3Jrc0NvbW1hbmQoKTsKKyAgICAgICAgc0xhc3RQcmlvcml0eSA9IDA7CisKKyAgICAgICAgc3luY2hyb25pemVkIChzQ29uZmlndXJlZE5ldHdvcmtzKSB7CisgICAgICAgICAgICBzQ29uZmlndXJlZE5ldHdvcmtzLmNsZWFyKCk7CisKKyAgICAgICAgICAgIGlmIChsaXN0U3RyID09IG51bGwpCisgICAgICAgICAgICAgICAgcmV0dXJuOworCisgICAgICAgICAgICBTdHJpbmdbXSBsaW5lcyA9IGxpc3RTdHIuc3BsaXQoIlxuIik7CisgICAgICAgICAgICAvLyBTa2lwIHRoZSBmaXJzdCBsaW5lLCB3aGljaCBpcyBhIGhlYWRlcgorICAgICAgICAgICAgZm9yIChpbnQgaSA9IDE7IGkgPCBsaW5lcy5sZW5ndGg7IGkrKykgeworICAgICAgICAgICAgICAgIFN0cmluZ1tdIHJlc3VsdCA9IGxpbmVzW2ldLnNwbGl0KCJcdCIpOworICAgICAgICAgICAgICAgIC8vIG5ldHdvcmstaWQgfCBzc2lkIHwgYnNzaWQgfCBmbGFncworICAgICAgICAgICAgICAgIFdpZmlDb25maWd1cmF0aW9uIGNvbmZpZyA9IG5ldyBXaWZpQ29uZmlndXJhdGlvbigpOworICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgIGNvbmZpZy5uZXR3b3JrSWQgPSBJbnRlZ2VyLnBhcnNlSW50KHJlc3VsdFswXSk7CisgICAgICAgICAgICAgICAgfSBjYXRjaChOdW1iZXJGb3JtYXRFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKHJlc3VsdC5sZW5ndGggPiAzKSB7CisgICAgICAgICAgICAgICAgICAgIGlmIChyZXN1bHRbM10uaW5kZXhPZigiW0NVUlJFTlRdIikgIT0gLTEpCisgICAgICAgICAgICAgICAgICAgICAgICBjb25maWcuc3RhdHVzID0gV2lmaUNvbmZpZ3VyYXRpb24uU3RhdHVzLkNVUlJFTlQ7CisgICAgICAgICAgICAgICAgICAgIGVsc2UgaWYgKHJlc3VsdFszXS5pbmRleE9mKCJbRElTQUJMRURdIikgIT0gLTEpCisgICAgICAgICAgICAgICAgICAgICAgICBjb25maWcuc3RhdHVzID0gV2lmaUNvbmZpZ3VyYXRpb24uU3RhdHVzLkRJU0FCTEVEOworICAgICAgICAgICAgICAgICAgICBlbHNlCisgICAgICAgICAgICAgICAgICAgICAgICBjb25maWcuc3RhdHVzID0gV2lmaUNvbmZpZ3VyYXRpb24uU3RhdHVzLkVOQUJMRUQ7CisgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgY29uZmlnLnN0YXR1cyA9IFdpZmlDb25maWd1cmF0aW9uLlN0YXR1cy5FTkFCTEVEOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICByZWFkTmV0d29ya1ZhcmlhYmxlcyhjb25maWcpOworICAgICAgICAgICAgICAgIGlmIChjb25maWcucHJpb3JpdHkgPiBzTGFzdFByaW9yaXR5KSB7CisgICAgICAgICAgICAgICAgICAgIHNMYXN0UHJpb3JpdHkgPSBjb25maWcucHJpb3JpdHk7CisgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIHNDb25maWd1cmVkTmV0d29ya3MuYWRkKGNvbmZpZyk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CisKKyAgICBwcml2YXRlIHN0YXRpYyBpbnQgYWRkT3JVcGRhdGVOZXR3b3JrTmF0aXZlKFdpZmlDb25maWd1cmF0aW9uIGNvbmZpZykgeworICAgICAgICAvKgorICAgICAgICAgKiBJZiB0aGUgc3VwcGxpZWQgbmV0d29ya0lkIGlzIC0xLCB3ZSBjcmVhdGUgYSBuZXcgZW1wdHkKKyAgICAgICAgICogbmV0d29yayBjb25maWd1cmF0aW9uLiBPdGhlcndpc2UsIHRoZSBuZXR3b3JrSWQgc2hvdWxkCisgICAgICAgICAqIHJlZmVyIHRvIGFuIGV4aXN0aW5nIGNvbmZpZ3VyYXRpb24uCisgICAgICAgICAqLworICAgICAgICBpbnQgbmV0SWQgPSBjb25maWcubmV0d29ya0lkOworICAgICAgICBib29sZWFuIG5ld05ldHdvcmsgPSBuZXRJZCA9PSAtMTsKKyAgICAgICAgLy8gbmV0d29ya0lkIG9mIC0xIG1lYW5zIHdlIHdhbnQgdG8gY3JlYXRlIGEgbmV3IG5ldHdvcmsKKworICAgICAgICBpZiAobmV3TmV0d29yaykgeworICAgICAgICAgICAgbmV0SWQgPSBXaWZpTmF0aXZlLmFkZE5ldHdvcmtDb21tYW5kKCk7CisgICAgICAgICAgICBpZiAobmV0SWQgPCAwKSB7CisgICAgICAgICAgICAgICAgTG9nLmUoVEFHLCAiRmFpbGVkIHRvIGFkZCBhIG5ldHdvcmshIik7CisgICAgICAgICAgICAgICAgcmV0dXJuIC0xOworICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHNldFZhcmlhYmxlczogeworCisgICAgICAgICAgICBpZiAoY29uZmlnLlNTSUQgIT0gbnVsbCAmJgorICAgICAgICAgICAgICAgICAgICAhV2lmaU5hdGl2ZS5zZXROZXR3b3JrVmFyaWFibGVDb21tYW5kKAorICAgICAgICAgICAgICAgICAgICAgICAgbmV0SWQsCisgICAgICAgICAgICAgICAgICAgICAgICBXaWZpQ29uZmlndXJhdGlvbi5zc2lkVmFyTmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZy5TU0lEKSkgeworICAgICAgICAgICAgICAgIExvZy5kKFRBRywgImZhaWxlZCB0byBzZXQgU1NJRDogIitjb25maWcuU1NJRCk7CisgICAgICAgICAgICAgICAgYnJlYWsgc2V0VmFyaWFibGVzOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAoY29uZmlnLkJTU0lEICE9IG51bGwgJiYKKyAgICAgICAgICAgICAgICAgICAgIVdpZmlOYXRpdmUuc2V0TmV0d29ya1ZhcmlhYmxlQ29tbWFuZCgKKyAgICAgICAgICAgICAgICAgICAgICAgIG5ldElkLAorICAgICAgICAgICAgICAgICAgICAgICAgV2lmaUNvbmZpZ3VyYXRpb24uYnNzaWRWYXJOYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlnLkJTU0lEKSkgeworICAgICAgICAgICAgICAgIExvZy5kKFRBRywgImZhaWxlZCB0byBzZXQgQlNTSUQ6ICIrY29uZmlnLkJTU0lEKTsKKyAgICAgICAgICAgICAgICBicmVhayBzZXRWYXJpYWJsZXM7CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIFN0cmluZyBhbGxvd2VkS2V5TWFuYWdlbWVudFN0cmluZyA9CisgICAgICAgICAgICAgICAgbWFrZVN0cmluZyhjb25maWcuYWxsb3dlZEtleU1hbmFnZW1lbnQsIFdpZmlDb25maWd1cmF0aW9uLktleU1nbXQuc3RyaW5ncyk7CisgICAgICAgICAgICBpZiAoY29uZmlnLmFsbG93ZWRLZXlNYW5hZ2VtZW50LmNhcmRpbmFsaXR5KCkgIT0gMCAmJgorICAgICAgICAgICAgICAgICAgICAhV2lmaU5hdGl2ZS5zZXROZXR3b3JrVmFyaWFibGVDb21tYW5kKAorICAgICAgICAgICAgICAgICAgICAgICAgbmV0SWQsCisgICAgICAgICAgICAgICAgICAgICAgICBXaWZpQ29uZmlndXJhdGlvbi5LZXlNZ210LnZhck5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICBhbGxvd2VkS2V5TWFuYWdlbWVudFN0cmluZykpIHsKKyAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJmYWlsZWQgdG8gc2V0IGtleV9tZ210OiAiKworICAgICAgICAgICAgICAgICAgICAgICAgYWxsb3dlZEtleU1hbmFnZW1lbnRTdHJpbmcpOworICAgICAgICAgICAgICAgIGJyZWFrIHNldFZhcmlhYmxlczsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgU3RyaW5nIGFsbG93ZWRQcm90b2NvbHNTdHJpbmcgPQorICAgICAgICAgICAgICAgIG1ha2VTdHJpbmcoY29uZmlnLmFsbG93ZWRQcm90b2NvbHMsIFdpZmlDb25maWd1cmF0aW9uLlByb3RvY29sLnN0cmluZ3MpOworICAgICAgICAgICAgaWYgKGNvbmZpZy5hbGxvd2VkUHJvdG9jb2xzLmNhcmRpbmFsaXR5KCkgIT0gMCAmJgorICAgICAgICAgICAgICAgICAgICAhV2lmaU5hdGl2ZS5zZXROZXR3b3JrVmFyaWFibGVDb21tYW5kKAorICAgICAgICAgICAgICAgICAgICAgICAgbmV0SWQsCisgICAgICAgICAgICAgICAgICAgICAgICBXaWZpQ29uZmlndXJhdGlvbi5Qcm90b2NvbC52YXJOYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgYWxsb3dlZFByb3RvY29sc1N0cmluZykpIHsKKyAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJmYWlsZWQgdG8gc2V0IHByb3RvOiAiKworICAgICAgICAgICAgICAgICAgICAgICAgYWxsb3dlZFByb3RvY29sc1N0cmluZyk7CisgICAgICAgICAgICAgICAgYnJlYWsgc2V0VmFyaWFibGVzOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBTdHJpbmcgYWxsb3dlZEF1dGhBbGdvcml0aG1zU3RyaW5nID0KKyAgICAgICAgICAgICAgICBtYWtlU3RyaW5nKGNvbmZpZy5hbGxvd2VkQXV0aEFsZ29yaXRobXMsIFdpZmlDb25maWd1cmF0aW9uLkF1dGhBbGdvcml0aG0uc3RyaW5ncyk7CisgICAgICAgICAgICBpZiAoY29uZmlnLmFsbG93ZWRBdXRoQWxnb3JpdGhtcy5jYXJkaW5hbGl0eSgpICE9IDAgJiYKKyAgICAgICAgICAgICAgICAgICAgIVdpZmlOYXRpdmUuc2V0TmV0d29ya1ZhcmlhYmxlQ29tbWFuZCgKKyAgICAgICAgICAgICAgICAgICAgICAgIG5ldElkLAorICAgICAgICAgICAgICAgICAgICAgICAgV2lmaUNvbmZpZ3VyYXRpb24uQXV0aEFsZ29yaXRobS52YXJOYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgYWxsb3dlZEF1dGhBbGdvcml0aG1zU3RyaW5nKSkgeworICAgICAgICAgICAgICAgIExvZy5kKFRBRywgImZhaWxlZCB0byBzZXQgYXV0aF9hbGc6ICIrCisgICAgICAgICAgICAgICAgICAgICAgICBhbGxvd2VkQXV0aEFsZ29yaXRobXNTdHJpbmcpOworICAgICAgICAgICAgICAgIGJyZWFrIHNldFZhcmlhYmxlczsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgU3RyaW5nIGFsbG93ZWRQYWlyd2lzZUNpcGhlcnNTdHJpbmcgPQorICAgICAgICAgICAgICAgICAgICBtYWtlU3RyaW5nKGNvbmZpZy5hbGxvd2VkUGFpcndpc2VDaXBoZXJzLAorICAgICAgICAgICAgICAgICAgICBXaWZpQ29uZmlndXJhdGlvbi5QYWlyd2lzZUNpcGhlci5zdHJpbmdzKTsKKyAgICAgICAgICAgIGlmIChjb25maWcuYWxsb3dlZFBhaXJ3aXNlQ2lwaGVycy5jYXJkaW5hbGl0eSgpICE9IDAgJiYKKyAgICAgICAgICAgICAgICAgICAgIVdpZmlOYXRpdmUuc2V0TmV0d29ya1ZhcmlhYmxlQ29tbWFuZCgKKyAgICAgICAgICAgICAgICAgICAgICAgIG5ldElkLAorICAgICAgICAgICAgICAgICAgICAgICAgV2lmaUNvbmZpZ3VyYXRpb24uUGFpcndpc2VDaXBoZXIudmFyTmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgIGFsbG93ZWRQYWlyd2lzZUNpcGhlcnNTdHJpbmcpKSB7CisgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAiZmFpbGVkIHRvIHNldCBwYWlyd2lzZTogIisKKyAgICAgICAgICAgICAgICAgICAgICAgIGFsbG93ZWRQYWlyd2lzZUNpcGhlcnNTdHJpbmcpOworICAgICAgICAgICAgICAgIGJyZWFrIHNldFZhcmlhYmxlczsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgU3RyaW5nIGFsbG93ZWRHcm91cENpcGhlcnNTdHJpbmcgPQorICAgICAgICAgICAgICAgIG1ha2VTdHJpbmcoY29uZmlnLmFsbG93ZWRHcm91cENpcGhlcnMsIFdpZmlDb25maWd1cmF0aW9uLkdyb3VwQ2lwaGVyLnN0cmluZ3MpOworICAgICAgICAgICAgaWYgKGNvbmZpZy5hbGxvd2VkR3JvdXBDaXBoZXJzLmNhcmRpbmFsaXR5KCkgIT0gMCAmJgorICAgICAgICAgICAgICAgICAgICAhV2lmaU5hdGl2ZS5zZXROZXR3b3JrVmFyaWFibGVDb21tYW5kKAorICAgICAgICAgICAgICAgICAgICAgICAgbmV0SWQsCisgICAgICAgICAgICAgICAgICAgICAgICBXaWZpQ29uZmlndXJhdGlvbi5Hcm91cENpcGhlci52YXJOYW1lLAorICAgICAgICAgICAgICAgICAgICAgICAgYWxsb3dlZEdyb3VwQ2lwaGVyc1N0cmluZykpIHsKKyAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJmYWlsZWQgdG8gc2V0IGdyb3VwOiAiKworICAgICAgICAgICAgICAgICAgICAgICAgYWxsb3dlZEdyb3VwQ2lwaGVyc1N0cmluZyk7CisgICAgICAgICAgICAgICAgYnJlYWsgc2V0VmFyaWFibGVzOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICAvLyBQcmV2ZW50IGNsaWVudCBzY3Jldy11cCBieSBwYXNzaW5nIGluIGEgV2lmaUNvbmZpZ3VyYXRpb24gd2UgZ2F2ZSBpdAorICAgICAgICAgICAgLy8gYnkgcHJldmVudGluZyAiKiIgYXMgYSBrZXkuCisgICAgICAgICAgICBpZiAoY29uZmlnLnByZVNoYXJlZEtleSAhPSBudWxsICYmICFjb25maWcucHJlU2hhcmVkS2V5LmVxdWFscygiKiIpICYmCisgICAgICAgICAgICAgICAgICAgICFXaWZpTmF0aXZlLnNldE5ldHdvcmtWYXJpYWJsZUNvbW1hbmQoCisgICAgICAgICAgICAgICAgICAgICAgICBuZXRJZCwKKyAgICAgICAgICAgICAgICAgICAgICAgIFdpZmlDb25maWd1cmF0aW9uLnBza1Zhck5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICBjb25maWcucHJlU2hhcmVkS2V5KSkgeworICAgICAgICAgICAgICAgIExvZy5kKFRBRywgImZhaWxlZCB0byBzZXQgcHNrOiAiK2NvbmZpZy5wcmVTaGFyZWRLZXkpOworICAgICAgICAgICAgICAgIGJyZWFrIHNldFZhcmlhYmxlczsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgYm9vbGVhbiBoYXNTZXRLZXkgPSBmYWxzZTsKKyAgICAgICAgICAgIGlmIChjb25maWcud2VwS2V5cyAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBjb25maWcud2VwS2V5cy5sZW5ndGg7IGkrKykgeworICAgICAgICAgICAgICAgICAgICAvLyBQcmV2ZW50IGNsaWVudCBzY3Jldy11cCBieSBwYXNzaW5nIGluIGEgV2lmaUNvbmZpZ3VyYXRpb24gd2UgZ2F2ZSBpdAorICAgICAgICAgICAgICAgICAgICAvLyBieSBwcmV2ZW50aW5nICIqIiBhcyBhIGtleS4KKyAgICAgICAgICAgICAgICAgICAgaWYgKGNvbmZpZy53ZXBLZXlzW2ldICE9IG51bGwgJiYgIWNvbmZpZy53ZXBLZXlzW2ldLmVxdWFscygiKiIpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIVdpZmlOYXRpdmUuc2V0TmV0d29ya1ZhcmlhYmxlQ29tbWFuZCgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ldElkLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgV2lmaUNvbmZpZ3VyYXRpb24ud2VwS2V5VmFyTmFtZXNbaV0sCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maWcud2VwS2V5c1tpXSkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBMb2cuZChUQUcsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiZmFpbGVkIHRvIHNldCB3ZXBfa2V5IitpKyI6ICIgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlnLndlcEtleXNbaV0pOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIHNldFZhcmlhYmxlczsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgICAgIGhhc1NldEtleSA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisKKyAgICAgICAgICAgIGlmIChoYXNTZXRLZXkpIHsKKyAgICAgICAgICAgICAgICBpZiAoIVdpZmlOYXRpdmUuc2V0TmV0d29ya1ZhcmlhYmxlQ29tbWFuZCgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXRJZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBXaWZpQ29uZmlndXJhdGlvbi53ZXBUeEtleUlkeFZhck5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgSW50ZWdlci50b1N0cmluZyhjb25maWcud2VwVHhLZXlJbmRleCkpKSB7CisgICAgICAgICAgICAgICAgICAgIExvZy5kKFRBRywKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAiZmFpbGVkIHRvIHNldCB3ZXBfdHhfa2V5aWR4OiAiKworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpZy53ZXBUeEtleUluZGV4KTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWsgc2V0VmFyaWFibGVzOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaWYgKCFXaWZpTmF0aXZlLnNldE5ldHdvcmtWYXJpYWJsZUNvbW1hbmQoCisgICAgICAgICAgICAgICAgICAgICAgICBuZXRJZCwKKyAgICAgICAgICAgICAgICAgICAgICAgIFdpZmlDb25maWd1cmF0aW9uLnByaW9yaXR5VmFyTmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgIEludGVnZXIudG9TdHJpbmcoY29uZmlnLnByaW9yaXR5KSkpIHsKKyAgICAgICAgICAgICAgICBMb2cuZChUQUcsIGNvbmZpZy5TU0lEICsgIjogZmFpbGVkIHRvIHNldCBwcmlvcml0eTogIgorICAgICAgICAgICAgICAgICAgICAgICAgK2NvbmZpZy5wcmlvcml0eSk7CisgICAgICAgICAgICAgICAgYnJlYWsgc2V0VmFyaWFibGVzOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBpZiAoY29uZmlnLmhpZGRlblNTSUQgJiYgIVdpZmlOYXRpdmUuc2V0TmV0d29ya1ZhcmlhYmxlQ29tbWFuZCgKKyAgICAgICAgICAgICAgICAgICAgICAgIG5ldElkLAorICAgICAgICAgICAgICAgICAgICAgICAgV2lmaUNvbmZpZ3VyYXRpb24uaGlkZGVuU1NJRFZhck5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICBJbnRlZ2VyLnRvU3RyaW5nKGNvbmZpZy5oaWRkZW5TU0lEID8gMSA6IDApKSkgeworICAgICAgICAgICAgICAgIExvZy5kKFRBRywgY29uZmlnLlNTSUQgKyAiOiBmYWlsZWQgdG8gc2V0IGhpZGRlblNTSUQ6ICIrCisgICAgICAgICAgICAgICAgICAgICAgICBjb25maWcuaGlkZGVuU1NJRCk7CisgICAgICAgICAgICAgICAgYnJlYWsgc2V0VmFyaWFibGVzOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBmb3IgKFdpZmlDb25maWd1cmF0aW9uLkVudGVycHJpc2VGaWVsZCBmaWVsZAorICAgICAgICAgICAgICAgICAgICA6IGNvbmZpZy5lbnRlcnByaXNlRmllbGRzKSB7CisgICAgICAgICAgICAgICAgU3RyaW5nIHZhck5hbWUgPSBmaWVsZC52YXJOYW1lKCk7CisgICAgICAgICAgICAgICAgU3RyaW5nIHZhbHVlID0gZmllbGQudmFsdWUoKTsKKyAgICAgICAgICAgICAgICBpZiAodmFsdWUgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICBpZiAoZmllbGQgIT0gY29uZmlnLmVhcCkgeworICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWUgPSAodmFsdWUubGVuZ3RoKCkgPT0gMCkgPyAiTlVMTCIgOiBjb252ZXJ0VG9RdW90ZWRTdHJpbmcodmFsdWUpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGlmICghV2lmaU5hdGl2ZS5zZXROZXR3b3JrVmFyaWFibGVDb21tYW5kKAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXRJZCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyTmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWUpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBMb2cuZChUQUcsIGNvbmZpZy5TU0lEICsgIjogZmFpbGVkIHRvIHNldCAiICsgdmFyTmFtZSArCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICI6ICIgKyB2YWx1ZSk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhayBzZXRWYXJpYWJsZXM7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICAgICByZXR1cm4gbmV0SWQ7CisgICAgICAgIH0KKworICAgICAgICBpZiAobmV3TmV0d29yaykgeworICAgICAgICAgICAgV2lmaU5hdGl2ZS5yZW1vdmVOZXR3b3JrQ29tbWFuZChuZXRJZCk7CisgICAgICAgICAgICBMb2cuZChUQUcsCisgICAgICAgICAgICAgICAgICAgICJGYWlsZWQgdG8gc2V0IGEgbmV0d29yayB2YXJpYWJsZSwgcmVtb3ZlZCBuZXR3b3JrOiAiCisgICAgICAgICAgICAgICAgICAgICsgbmV0SWQpOworICAgICAgICB9CisKKyAgICAgICAgcmV0dXJuIC0xOworICAgIH0KKworICAgIC8qKgorICAgICAqIFJlYWQgdGhlIHZhcmlhYmxlcyBmcm9tIHRoZSBzdXBwbGljYW50IGRhZW1vbiB0aGF0IGFyZSBuZWVkZWQgdG8KKyAgICAgKiBmaWxsIGluIHRoZSBXaWZpQ29uZmlndXJhdGlvbiBvYmplY3QuCisgICAgICoKKyAgICAgKiBAcGFyYW0gY29uZmlnIHRoZSB7QGxpbmsgV2lmaUNvbmZpZ3VyYXRpb259IG9iamVjdCB0byBiZSBmaWxsZWQgaW4uCisgICAgICovCisgICAgcHJpdmF0ZSBzdGF0aWMgdm9pZCByZWFkTmV0d29ya1ZhcmlhYmxlcyhXaWZpQ29uZmlndXJhdGlvbiBjb25maWcpIHsKKworICAgICAgICBpbnQgbmV0SWQgPSBjb25maWcubmV0d29ya0lkOworICAgICAgICBpZiAobmV0SWQgPCAwKQorICAgICAgICAgICAgcmV0dXJuOworCisgICAgICAgIC8qCisgICAgICAgICAqIFRPRE86IG1heWJlIHNob3VsZCBoYXZlIGEgbmF0aXZlIG1ldGhvZCB0aGF0IHRha2VzIGFuIGFycmF5IG9mCisgICAgICAgICAqIHZhcmlhYmxlIG5hbWVzIGFuZCByZXR1cm5zIGFuIGFycmF5IG9mIHZhbHVlcy4gQnV0IHdlJ2Qgc3RpbGwKKyAgICAgICAgICogYmUgZG9pbmcgYSByb3VuZCB0cmlwIHRvIHRoZSBzdXBwbGljYW50IGRhZW1vbiBmb3IgZWFjaCB2YXJpYWJsZS4KKyAgICAgICAgICovCisgICAgICAgIFN0cmluZyB2YWx1ZTsKKworICAgICAgICB2YWx1ZSA9IFdpZmlOYXRpdmUuZ2V0TmV0d29ya1ZhcmlhYmxlQ29tbWFuZChuZXRJZCwgV2lmaUNvbmZpZ3VyYXRpb24uc3NpZFZhck5hbWUpOworICAgICAgICBpZiAoIVRleHRVdGlscy5pc0VtcHR5KHZhbHVlKSkgeworICAgICAgICAgICAgY29uZmlnLlNTSUQgPSByZW1vdmVEb3VibGVRdW90ZXModmFsdWUpOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgY29uZmlnLlNTSUQgPSBudWxsOworICAgICAgICB9CisKKyAgICAgICAgdmFsdWUgPSBXaWZpTmF0aXZlLmdldE5ldHdvcmtWYXJpYWJsZUNvbW1hbmQobmV0SWQsIFdpZmlDb25maWd1cmF0aW9uLmJzc2lkVmFyTmFtZSk7CisgICAgICAgIGlmICghVGV4dFV0aWxzLmlzRW1wdHkodmFsdWUpKSB7CisgICAgICAgICAgICBjb25maWcuQlNTSUQgPSB2YWx1ZTsKKyAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgIGNvbmZpZy5CU1NJRCA9IG51bGw7CisgICAgICAgIH0KKworICAgICAgICB2YWx1ZSA9IFdpZmlOYXRpdmUuZ2V0TmV0d29ya1ZhcmlhYmxlQ29tbWFuZChuZXRJZCwgV2lmaUNvbmZpZ3VyYXRpb24ucHJpb3JpdHlWYXJOYW1lKTsKKyAgICAgICAgY29uZmlnLnByaW9yaXR5ID0gLTE7CisgICAgICAgIGlmICghVGV4dFV0aWxzLmlzRW1wdHkodmFsdWUpKSB7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIGNvbmZpZy5wcmlvcml0eSA9IEludGVnZXIucGFyc2VJbnQodmFsdWUpOworICAgICAgICAgICAgfSBjYXRjaCAoTnVtYmVyRm9ybWF0RXhjZXB0aW9uIGlnbm9yZSkgeworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgdmFsdWUgPSBXaWZpTmF0aXZlLmdldE5ldHdvcmtWYXJpYWJsZUNvbW1hbmQobmV0SWQsIFdpZmlDb25maWd1cmF0aW9uLmhpZGRlblNTSURWYXJOYW1lKTsKKyAgICAgICAgY29uZmlnLmhpZGRlblNTSUQgPSBmYWxzZTsKKyAgICAgICAgaWYgKCFUZXh0VXRpbHMuaXNFbXB0eSh2YWx1ZSkpIHsKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgY29uZmlnLmhpZGRlblNTSUQgPSBJbnRlZ2VyLnBhcnNlSW50KHZhbHVlKSAhPSAwOworICAgICAgICAgICAgfSBjYXRjaCAoTnVtYmVyRm9ybWF0RXhjZXB0aW9uIGlnbm9yZSkgeworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgdmFsdWUgPSBXaWZpTmF0aXZlLmdldE5ldHdvcmtWYXJpYWJsZUNvbW1hbmQobmV0SWQsIFdpZmlDb25maWd1cmF0aW9uLndlcFR4S2V5SWR4VmFyTmFtZSk7CisgICAgICAgIGNvbmZpZy53ZXBUeEtleUluZGV4ID0gLTE7CisgICAgICAgIGlmICghVGV4dFV0aWxzLmlzRW1wdHkodmFsdWUpKSB7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIGNvbmZpZy53ZXBUeEtleUluZGV4ID0gSW50ZWdlci5wYXJzZUludCh2YWx1ZSk7CisgICAgICAgICAgICB9IGNhdGNoIChOdW1iZXJGb3JtYXRFeGNlcHRpb24gaWdub3JlKSB7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IDQ7IGkrKykgeworICAgICAgICAgICAgdmFsdWUgPSBXaWZpTmF0aXZlLmdldE5ldHdvcmtWYXJpYWJsZUNvbW1hbmQobmV0SWQsCisgICAgICAgICAgICAgICAgICAgIFdpZmlDb25maWd1cmF0aW9uLndlcEtleVZhck5hbWVzW2ldKTsKKyAgICAgICAgICAgIGlmICghVGV4dFV0aWxzLmlzRW1wdHkodmFsdWUpKSB7CisgICAgICAgICAgICAgICAgY29uZmlnLndlcEtleXNbaV0gPSB2YWx1ZTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgY29uZmlnLndlcEtleXNbaV0gPSBudWxsOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgdmFsdWUgPSBXaWZpTmF0aXZlLmdldE5ldHdvcmtWYXJpYWJsZUNvbW1hbmQobmV0SWQsIFdpZmlDb25maWd1cmF0aW9uLnBza1Zhck5hbWUpOworICAgICAgICBpZiAoIVRleHRVdGlscy5pc0VtcHR5KHZhbHVlKSkgeworICAgICAgICAgICAgY29uZmlnLnByZVNoYXJlZEtleSA9IHZhbHVlOworICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgY29uZmlnLnByZVNoYXJlZEtleSA9IG51bGw7CisgICAgICAgIH0KKworICAgICAgICB2YWx1ZSA9IFdpZmlOYXRpdmUuZ2V0TmV0d29ya1ZhcmlhYmxlQ29tbWFuZChjb25maWcubmV0d29ya0lkLAorICAgICAgICAgICAgICAgIFdpZmlDb25maWd1cmF0aW9uLlByb3RvY29sLnZhck5hbWUpOworICAgICAgICBpZiAoIVRleHRVdGlscy5pc0VtcHR5KHZhbHVlKSkgeworICAgICAgICAgICAgU3RyaW5nIHZhbHNbXSA9IHZhbHVlLnNwbGl0KCIgIik7CisgICAgICAgICAgICBmb3IgKFN0cmluZyB2YWwgOiB2YWxzKSB7CisgICAgICAgICAgICAgICAgaW50IGluZGV4ID0KKyAgICAgICAgICAgICAgICAgICAgbG9va3VwU3RyaW5nKHZhbCwgV2lmaUNvbmZpZ3VyYXRpb24uUHJvdG9jb2wuc3RyaW5ncyk7CisgICAgICAgICAgICAgICAgaWYgKDAgPD0gaW5kZXgpIHsKKyAgICAgICAgICAgICAgICAgICAgY29uZmlnLmFsbG93ZWRQcm90b2NvbHMuc2V0KGluZGV4KTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICB2YWx1ZSA9IFdpZmlOYXRpdmUuZ2V0TmV0d29ya1ZhcmlhYmxlQ29tbWFuZChjb25maWcubmV0d29ya0lkLAorICAgICAgICAgICAgICAgIFdpZmlDb25maWd1cmF0aW9uLktleU1nbXQudmFyTmFtZSk7CisgICAgICAgIGlmICghVGV4dFV0aWxzLmlzRW1wdHkodmFsdWUpKSB7CisgICAgICAgICAgICBTdHJpbmcgdmFsc1tdID0gdmFsdWUuc3BsaXQoIiAiKTsKKyAgICAgICAgICAgIGZvciAoU3RyaW5nIHZhbCA6IHZhbHMpIHsKKyAgICAgICAgICAgICAgICBpbnQgaW5kZXggPQorICAgICAgICAgICAgICAgICAgICBsb29rdXBTdHJpbmcodmFsLCBXaWZpQ29uZmlndXJhdGlvbi5LZXlNZ210LnN0cmluZ3MpOworICAgICAgICAgICAgICAgIGlmICgwIDw9IGluZGV4KSB7CisgICAgICAgICAgICAgICAgICAgIGNvbmZpZy5hbGxvd2VkS2V5TWFuYWdlbWVudC5zZXQoaW5kZXgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHZhbHVlID0gV2lmaU5hdGl2ZS5nZXROZXR3b3JrVmFyaWFibGVDb21tYW5kKGNvbmZpZy5uZXR3b3JrSWQsCisgICAgICAgICAgICAgICAgV2lmaUNvbmZpZ3VyYXRpb24uQXV0aEFsZ29yaXRobS52YXJOYW1lKTsKKyAgICAgICAgaWYgKCFUZXh0VXRpbHMuaXNFbXB0eSh2YWx1ZSkpIHsKKyAgICAgICAgICAgIFN0cmluZyB2YWxzW10gPSB2YWx1ZS5zcGxpdCgiICIpOworICAgICAgICAgICAgZm9yIChTdHJpbmcgdmFsIDogdmFscykgeworICAgICAgICAgICAgICAgIGludCBpbmRleCA9CisgICAgICAgICAgICAgICAgICAgIGxvb2t1cFN0cmluZyh2YWwsIFdpZmlDb25maWd1cmF0aW9uLkF1dGhBbGdvcml0aG0uc3RyaW5ncyk7CisgICAgICAgICAgICAgICAgaWYgKDAgPD0gaW5kZXgpIHsKKyAgICAgICAgICAgICAgICAgICAgY29uZmlnLmFsbG93ZWRBdXRoQWxnb3JpdGhtcy5zZXQoaW5kZXgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHZhbHVlID0gV2lmaU5hdGl2ZS5nZXROZXR3b3JrVmFyaWFibGVDb21tYW5kKGNvbmZpZy5uZXR3b3JrSWQsCisgICAgICAgICAgICAgICAgV2lmaUNvbmZpZ3VyYXRpb24uUGFpcndpc2VDaXBoZXIudmFyTmFtZSk7CisgICAgICAgIGlmICghVGV4dFV0aWxzLmlzRW1wdHkodmFsdWUpKSB7CisgICAgICAgICAgICBTdHJpbmcgdmFsc1tdID0gdmFsdWUuc3BsaXQoIiAiKTsKKyAgICAgICAgICAgIGZvciAoU3RyaW5nIHZhbCA6IHZhbHMpIHsKKyAgICAgICAgICAgICAgICBpbnQgaW5kZXggPQorICAgICAgICAgICAgICAgICAgICBsb29rdXBTdHJpbmcodmFsLCBXaWZpQ29uZmlndXJhdGlvbi5QYWlyd2lzZUNpcGhlci5zdHJpbmdzKTsKKyAgICAgICAgICAgICAgICBpZiAoMCA8PSBpbmRleCkgeworICAgICAgICAgICAgICAgICAgICBjb25maWcuYWxsb3dlZFBhaXJ3aXNlQ2lwaGVycy5zZXQoaW5kZXgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHZhbHVlID0gV2lmaU5hdGl2ZS5nZXROZXR3b3JrVmFyaWFibGVDb21tYW5kKGNvbmZpZy5uZXR3b3JrSWQsCisgICAgICAgICAgICAgICAgV2lmaUNvbmZpZ3VyYXRpb24uR3JvdXBDaXBoZXIudmFyTmFtZSk7CisgICAgICAgIGlmICghVGV4dFV0aWxzLmlzRW1wdHkodmFsdWUpKSB7CisgICAgICAgICAgICBTdHJpbmcgdmFsc1tdID0gdmFsdWUuc3BsaXQoIiAiKTsKKyAgICAgICAgICAgIGZvciAoU3RyaW5nIHZhbCA6IHZhbHMpIHsKKyAgICAgICAgICAgICAgICBpbnQgaW5kZXggPQorICAgICAgICAgICAgICAgICAgICBsb29rdXBTdHJpbmcodmFsLCBXaWZpQ29uZmlndXJhdGlvbi5Hcm91cENpcGhlci5zdHJpbmdzKTsKKyAgICAgICAgICAgICAgICBpZiAoMCA8PSBpbmRleCkgeworICAgICAgICAgICAgICAgICAgICBjb25maWcuYWxsb3dlZEdyb3VwQ2lwaGVycy5zZXQoaW5kZXgpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGZvciAoV2lmaUNvbmZpZ3VyYXRpb24uRW50ZXJwcmlzZUZpZWxkIGZpZWxkIDoKKyAgICAgICAgICAgICAgICBjb25maWcuZW50ZXJwcmlzZUZpZWxkcykgeworICAgICAgICAgICAgdmFsdWUgPSBXaWZpTmF0aXZlLmdldE5ldHdvcmtWYXJpYWJsZUNvbW1hbmQobmV0SWQsCisgICAgICAgICAgICAgICAgICAgIGZpZWxkLnZhck5hbWUoKSk7CisgICAgICAgICAgICBpZiAoIVRleHRVdGlscy5pc0VtcHR5KHZhbHVlKSkgeworICAgICAgICAgICAgICAgIGlmIChmaWVsZCAhPSBjb25maWcuZWFwKSB2YWx1ZSA9IHJlbW92ZURvdWJsZVF1b3Rlcyh2YWx1ZSk7CisgICAgICAgICAgICAgICAgZmllbGQuc2V0VmFsdWUodmFsdWUpOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSBzdGF0aWMgU3RyaW5nIHJlbW92ZURvdWJsZVF1b3RlcyhTdHJpbmcgc3RyaW5nKSB7CisgICAgICAgIGlmIChzdHJpbmcubGVuZ3RoKCkgPD0gMikgcmV0dXJuICIiOworICAgICAgICByZXR1cm4gc3RyaW5nLnN1YnN0cmluZygxLCBzdHJpbmcubGVuZ3RoKCkgLSAxKTsKKyAgICB9CisKKyAgICBwcml2YXRlIHN0Y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pIHsKKyAgICAgICAgaW50IHNpemUgPSBzdHJpbmdzLmxlbmd0aDsKKworICAgICAgICBzdHJpbmcgPSBzdHJpbmcucmVwbGFjZSgnLScsICdfJyk7CisKKyAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBzaXplOyBpKyspCisgICAgICAgICAgICBpZiAoc3RyaW5nLmVxdWFscyhzdHJpbmdzW2ldKSkKKyAgICAgICAgICAgICAgICByZXR1cm4gaTsKKworICAgICAgICAvLyBpZiB3ZSBldmVyIGdldCBoZXJlLCB3ZSBzaG91bGQgcHJvYmFibHkgYWRkIHRoZQorICAgICAgICAvLyB2YWx1ZSB0byBXaWZpQ29uZmlndXJhdGlvbiB0byByZWZsZWN0IHRoYXQgaXQncworICAgICAgICAvLyBzdXBwb3J0ZWQgYnkgdGhlIFdQQSBzdXBwbGljYW50CisgICAgICAgIExvZy53KFRBRywgIkZhaWxlZCB0byBsb29rLXVwIGEgc3RyaW5nOiAiICsgc3RyaW5nKTsKKworICAgICAgICByZXR1cm4gLTE7CisgICAgfQorCisgICAgc3RhdGljIFN0cmluZyBkdW1wKCkgeworICAgICAgICBTdHJpbmdCdWZmZXIgc2IgPSBuZXcgU3RyaW5nQnVmZmVyKCk7CisgICAgICAgIFN0cmluZyBMUyA9IFN5c3RlbS5nZXRQcm9wZXJ0eSgibGluZS5zZXBhcmF0b3IiKTsKKyAgICAgICAgc2IuYXBwZW5kKCJzTGFzdFByaW9yaXR5ICIpLmFwcGVuZChzTGFzdFByaW9yaXR5KS5hcHBlbmQoTFMpOworICAgICAgICBzYi5hcHBlbmQoIkNvbmZpZ3VyZWQgbmV0d29ya3MgIikuYXBwZW5kKExTKTsKKyAgICAgICAgZm9yIChXaWZpQ29uZmlndXJhdGlvbiBjb25mIDogZ2V0Q29uZmlndXJlZE5ldHdvcmtzKCkpIHsKKyAgICAgICAgICAgIHNiLmFwcGVuZChjb25mKS5hcHBlbmQoTFMpOworICAgICAgICB9CisgICAgICAgIHJldHVybiBzYi50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3RyaW5nCisgICAgICogcXVvdGF0aW9uIG1hcmtzIChlLmcuLCB7QGNvZGUgImFiY2RlZiJ9IG9yIGEgc3RyaW5nCiAgICAgICogb2YgaGV4IGRpZ2l0cyAoZS5nLiwge0Bjb2RlIDAxMDIwMzA0MDV9KS4KICAgICAgKiA8cC8+CiAgICAgICogV2hlbiB0aGUgdmFsdWUgb2Ygb25lIG9mIHRoZXNlIGtleXMgaXMgcmVhZCwgdGhlIGFjdHVhbCBrZXkgaXMKQEAgLTQzMiw2ICs0MzIsMzggQEAKICAgICAgICAgcmV0dXJuIDA7CiAgICAgfQogCisgICAgLyoqCisgICAgICogUmV0dXJucyBhIGNvcHkgb2YgdGhpcyBXaWZpQ29uZmlndXJhdGlvbi4KKyAgICAgKgorICAgICAqIEByZXR1cm4gYSBjb3B5IG9mIHRoaXMgV2lmaUNvbmZpZ3VyYXRpb24uCisgICAgICogQGhpZGUKKyAgICAgKi8KKyAgICBwdWJsaWMgV2lmaUNvbmZpZ3VyYXRpb24gY2xvbmUoKSB7CisgICAgICAgIFdpZmlDb25maWd1cmF0aW9uIGNvbmZpZyA9IG5ldyBXaWZpQ29uZmlndXJhdGlvbigpOworICAgICAgICBjb25maWcubmV0d29ya0lkID0gbmV0d29ya0lkOworICAgICAgICBjb25maWcuc3RhdHVzID0gc3RhdHVzOworICAgICAgICBjb25maWcuU1NJRCA9IFNTSUQ7CisgICAgICAgIGNvbmZpZy5CU1NJRCA9IEJTU0lEOworICAgICAgICBjb25maWcucHJlU2hhcmVkS2V5ID0gcHJlU2hhcmVkS2V5OworCisgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgd2VwS2V5cy5sZW5ndGg7IGkrKykKKyAgICAgICAgICAgIGNvbmZpZy53ZXBLZXlzW2ldID0gd2VwS2V5c1tpXTsKKworICAgICAgICBjb25maWcud2VwVHhLZXlJbmRleCA9IHdlcFR4S2V5SW5kZXg7CisgICAgICAgIGNvbmZpZy5wcmlvcml0eSA9IHByaW9yaXR5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w4IEBACiAgICAgICovCiAgICAgcHVibGljIGJvb2xlYW4gcmVjb25uZWN0KCkgewogICAgICAgICB0cnkgewotICAgICAgICAgICAgcmV0dXJuIG1TZXJ2aWNlLnJlY29ubmVjdCgpOworICAgICAgICAgICAgbVNlcnZpY2UucmVjb25uZWN0KCk7CisgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICAgfQpAQCAtNTQwLDcgKzU1NCw4IEBACiAgICAgICovCiAgICAgcHVibGljIGJvb2xlYW4gcmVhc3NvY2lhdGUoKSB7CiAgICAgICAgIHRyeSB7Ci0gICAgICAgICAgICByZXR1cm4gbVNlcnZpY2UucmVhc3NvY2lhdGUoKTsKKyAgICAgICAgICAgIG1TZXJ2aWNlLnJlYXNzb2NpYXRlKCk7CisgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICAgfQpAQCAtNTY5LDcgKzU4NCw4IEBACiAgICAgICovCiAgICAgcHVibGljIGJvb2xlYW4gc3RhcnRTY2FuKCkgewogICAgICAgICB0cnkgewotICAgICAgICAgICAgcmV0dXJuIG1TZXJ2aWNlLnN0YXJ0U2NhbihmYWxzZSk7CisgICAgICAgICAgICBtU2VydmljZS5zdGFydFNjYW4oZmFsc2UpOworICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7CiAgICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICAgIH0KQEAgLTU4Nyw3ICs2MDMsOCBAQAogICAgICAqLwogICAgIHB1YmxpYyBib29sZWFuIHN0YXJ0U2NhbkFjdGl2ZSgpIHsKICAgICAgICAgdHJ5IHsKLSAgICAgICAgICAgIHJldHVybiBtU2VydmljZS5zdGFydFNjYW4odHJ1ZSk7CisgICAgICAgICAgICBtU2VydmljZS5zdGFydFNjYW4odHJ1ZSk7CisgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsKICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKICAgICAgICAgfQpAQCAtNzUzLDggKzc3MCw5IEBACiAgICAgICAgIH0gZWxzZSBpZiAocnNzaSA+PSBNQVhfUlNTSSkgewogICAgICAgICAgICAgcmV0dXJuIG51bUxldmVscyAtIDE7CiAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICBpbnQgcGFydGl0aW9uU2l6ZSA9IChNQVhfUlNTSSAtIE1JTl9SU1NJKSAvIChudW1MZXZlbHMgLSAxKTsKLSAgICAgICAgICAgIHJldHVybiAocnNzaSAtIE1JTl9SU1NJKSAvIHBhcnRpdGlvblNpemU7CisgICAgICAgICAgICBmbG9hdCBpbnB1dFJhbmdlID0gKE1BWF9SU1NJIC0gTUlOX1JTU0kpOworICAgICAgICAgICAgZmxvYXQgb3V0cHV0UmFuZ2UgPSAobnVtTGV2ZWxzIC0gMSk7CisgICAgICAgICAgICByZXR1cm4gKGludCkoKGZsb2F0KShyc3NpIC0gTUlOX1JTU0kpICogb3V0cHV0UmFuZ2UgLyBpbnB1dFJhbmdlKTsKICAgICAgICAgfQogICAgIH0KICAgICAKQEAgLTg0OCw2ICs4NjYsMTY2IEBACiAgICAgICAgIH0KICAgICB9CiAKKyAgIC8qKgorICAgICAqIFN0YXJ0IHRoZSBkcml2ZXIgYW5kIGNvbm5lY3QgdG8gbmV0d29yay4KKyAgICAgKgorICAgICAqIFRoaXMgZnVuY3Rpb24gd2lsbCBvdmVyLXJpZGUgV2lmaUxvY2sgYW5kIGRldmljZSBpZGxlIHN0YXR1cy4gRm9yIGV4YW1wbGUsCisgICAgICogZXZlbiBpZiB0a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BlcmF0aW9uIHN1Y2NlZWRzIGVsc2Uge0Bjb2RlIGZhbHNlfQorICAgICAqIEBoaWRlCisgICAgICovCisgICAgcHVibGljIGJvb2xlYW4gY2xlYXJCbGFja2xpc3QoKSB7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBtU2VydmljZS5jbGVhckJsYWNrbGlzdCgpOworICAgICAgICAgICAgcmV0dXJuIHRydWU7CisgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKiBUT0RPOiBkZXByZWNhdGUgc3luY2hyb25vdXMgQVBJIGFuZCBvcGVuIHVwIHRoZSBmb2xsb3dpbmcgQVBJICovCisgICAgLyoqCisgICAgICogQ29ubmVjdCB0byBhIG5ldHdvcmsgd2l0aCB0aGUgZ2l2ZW4gY29uZmlndXJhdGlvbi4gVGhlIG5ldHdvcmsgYWxzbworICAgICAqIGdldHMgYWRkZWQgdG8gdGhlIHN1cHBsaWNhbnQgY29uZmlndXJhdGlvbi4KKyAgICAgKgorICAgICAqIEZvciBhIG5ldyBuZXR3b3JrLCB0aGlzIGZ1bmN0aW9uIGlzIHVzZWQgaW5zdGVhZCBvZiBhCisgICAgICogc2VxdWVuY2Ugb2YgYWRkTmV0d29yaygpLCBlbmFibGVOZXR3b3JrKCksIHNhdmVDb25maWd1cmF0aW9uKCkgYW5kCisgICAgICogcmVjb25uZWN0KCkKKyAgICAgKgorICAgICAqIEBwYXJhbSBjb25maWcgdGhlIHNldCBvZiB2YXJpYWJsZXMgdGhhdCBkZXNjcmliZSB0aGUgY29uZmlndXJhdGlvbiwKKyAgICAgKiAgICAgICAgICAgIGNvbnRhaW5lZCBpbiBhIHtAbGluayBXaWZpQ29uZmlndXJhdGlvbn0gb2JqZWN0LgorICAgICAqIEBoaWRlCisgICAgICovCisgICAgcHVibGljIHZvaWQgY29ubmVjdE5ldHdvcmsoV2lmaUNvbmZpZ3VyYXRpb24gY29uZmlnKSB7CisgICAgICAgIGlmIChjb25maWcgPT0gbnVsbCkgeworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBtU2VydmljZS5jb25uZWN0TmV0d29ya1dpdGhDb25maWcoY29uZmlnKTsKKyAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGUpIHsgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIENvbm5lY3QgdG8gYSBuZXR3b3JrIHdpdGggdGhlIGdpdmVuIG5ldHdvcmtJZC4KKyAgICAgKgorICAgICAqIFRoaXMgZnVuY3Rpb24gaXMgdXNlZCBpbnN0ZWFkIG9mIGEgZW5hYmxlTmV0d29yaygpLCBzYXZlQ29uZmlndXJhdGlvbigpIGFuZAorICAgICAqIHJlY29ubmVjdCgpCisgICAgICoKKyAgICAgKiBAcGFyYW0gbmV0d29ya0lkIHRoZSBuZXR3b3JrIGlkIGlkZW50aWZpeWluZyB0aGUgbmV0d29yayBpbiB0aGUKKyAgICAgKiAgICAgICAgICAgICAgICBzdXBwbGljYW50IGNvbmZpZ3VyYXRpb24gbGlzdAorICAgICAqIEBoaWRlCisgICAgICovCisgICAgcHVibGljIHZvaWQgY29ubmVjdE5ldHdvcmsoaW50IG5ldHdvcmtJZCkgeworICAgICAgICBpZiAobmV0d29ya0lkIDwgMCkgeworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBtU2VydmljZS5jb25uZWN0TmV0d29ya1dpdGhJZChuZXR3b3JrSWQpOworICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gZSkgeyB9CisgICAgfQorCisgICAgLyoqCisgICAgICogU2F2ZSB0aGUgZ2l2ZW4gbmV0d29yayBpbiB0aGUgc3VwcGxpY2FudCBjb25maWcuIElmIHRoZSBuZXR3b3JrIGFscmVhZHkKKyAgICAgKiB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aWNhbnRDb25uZWN0aW9uKCk7CiAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIG1XaWZpU3RhdGVUcmFja2VyLm5vdGlmeVN1cHBsaWNhbnRMb3N0KCk7CisgICAgICAgICAgICAgICAgbVdpZmlTdGF0ZU1hY2hpbmUubm90aWZ5U3VwcGxpY2FudExvc3QoKTsKICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICB9CiAKQEAgLTI1OSw3ICsyNTQsNyBAQAogICAgICAgICAgICAgICAgICAgICB9CiAKICAgICAgICAgICAgICAgICAgICAgLy8gbm90aWZ5IGFuZCBleGl0Ci0gICAgICAgICAgICAgICAgICAgIG1XaWZpU3RhdGVUcmFja2VyLm5vdGlmeVN1cHBsaWNhbnRMb3N0KCk7CisgICAgICAgICAgICAgICAgICAgIG1XaWZpU3RhdGVNYWNoaW5lLm5vdGlmeVN1cHBsaWNhbnRMb3N0KCk7CiAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgIGhhbmRsZUV2ZW50KGV2ZW50LCBldmVudERhdGEpOwpAQCAtMjcyLDcgKzI2Nyw3IEBACiAgICAgICAgICAgICBpbnQgY29ubmVjdFRyaWVzID0gMDsKIAogICAgICAgICAgICAgd2hpbGUgKHRydWUpIHsKLSAgICAgICAgICAgICAgICBpZiAobVdpZmlTdGF0ZVRyYWNrZXIuY29ubmVjdFRvU3VwcGxpY2FudCgpKSB7CisgICAgICAgICAgICAgICAgaWYgKFdpZmlOYXRpdmUuY29ubmVjdFRvU3VwcGxpY2FudCgpKSB7CiAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICBpZiAoY29ubmVjdFRyaWVzKysgPCAzKSB7CkBAIC0yODUsNyArMjgwLDcgQEAKICAgICAgICAgfQogCiAgICAgICAgIHByaXZhdGUgdm9pZCBoYW5kbGVQYXNzd29yZEtleU1heUJlSW5jb3JyZWN0KCkgewotICAgICAgICAgICAgbVdpZmlTdGF0ZVRyYWNrZXIubm90aWZ5UGFzc3dvcmRLZXlNYXlCZUluY29ycmVjdCgpOworICAgICAgICAgICAgbVdpZmlTdGF0ZU1hY2hpbmUubm90aWZ5UGFzc3dvcmRLZXlNYXlCZUluY29ycmVjdCgpOwogICAgICAgICB9CiAKICAgICAgICAgcHJpdmF0ZSB2b2lkIGhhbmRsZURyaXZlckV2ZW50KFN0cmluZyBzdGF0ZSkgewpAQCAtMjkzLDExICsyODgsMTEgQEAKICAgICAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgICAgICB9CiAgICAgICAgICAgICBpZiAoc3RhdGUuZXF1YWxzKCJTVE9QUEVEIikpIHsKLSAgICAgICAgICAgICAgICBtV2lmaVN0YXRlVHJhY2tlci5ub3RpZnlEcml2ZXJTdG9wcGVkKCk7CisgICAgICAgICAgICAgICAgbVdpZmlTdGF0ZU1hY2hpbmUubm90aWZ5RHJpdmVyU3RvcHBlZCgpOwogICAgICAgICAgICAgfSBlbHNlIGlmIChzdGF0ZS5lcXVhbHMoIlNUQVJURUQiKSkgewotICAgICAgICAgICAgICAgIG1XaWZpU3RhdGVUcmFja2VyLm5vdGlmeURyaXZlclN0YXJ0ZWQoKTsKKyAgICAgICAgICAgICAgICBtV2lmaVN0YXRlTWFjaGluZS5ub3RpZnlEcml2ZXJTdGFydGVkKCk7CiAgICAgICAgICAgICB9IGVsc2UgaWYgKHN0YXRlLmVxdWFscygiSEFOR0VEIikpIHsKLSAgICAgICAgICAgICAgICBtV2lmaVN0YXRlVHJhY2tlci5ub3RpZnlEcml2ZXJIdW5nKCk7CisgICAgICAgICAgICAgICAgbVdpZmlTdGF0ZU1hY2hpbmUubm90aWZ5RHJpdmVySHVuZygpOwogICAgICAgICAgICAgfQogICAgICAgICB9CiAKQEAgLTMxOCw3ICszMTMsNyBAQAogICAgICAgICAgICAgICAgICAgICBicmVhazsKIAogICAgICAgICAgICAgICAgIGNhc2UgU0NBTl9SRVNVTFRTOgotICAgICAgICAgICAgICAgICAgICBtV2lmaVN0YXRlVHJhY2tlci5ub3RpZnlTY2FuUmVzdWx0c0F2YWlsYWJsZSgpOworICAgICAgICAgICAgICAgICAgICBtV2lmaVN0YXRlTWFjaGluZS5ub3RpZnlTY2FuUmVzdWx0c0F2YWlsYWJsZSgpOwogICAgICAgICAgICAgICAgICAgICBicmVhazsKIAogICAgICAgICAgICAgICAgIGNhc2UgVU5LTk9XTjoKQEAgLTM3NSw3ICszNzAsNyBAQAogICAgICAgICAgICAgaWYgKG5ld1N1cHBsaWNhbnRTdGF0ZSA9PSBTdXBwbGljYW50U3RhdGUuSU5WQUxJRCkgewogICAgICAgICAgICAgICAgIExvZy53KFRBRywgIkludmFsaWQgc3VwcGxpY2FudCBzdGF0ZTogIiArIG5ld1N0YXRlKTsKICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIG1XaWZpU3RhdGVUcmFja2VyLm5vdGlmeVN0YXRlQ2hhbmdlKG5ldHdvcmtJZCwgQlNTSUQsIG5ld1N1cHBsaWNhbnRTdGF0ZSk7CisgICAgICAgICAgICBtV2lmaVN0YXRlTWFjaGluZS5ub3RpZnlTdXBwbGljYW50U3RhdGVDaGFuZ2UobmV0d29ya0lkLCBCU1NJRCwgbmV3U3VwcGxpY2FudFN0YXRlKTsKICAgICAgICAgfQogICAgIH0KIApAQCAtMzk1LDcgKzM5MCw3IEBACiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICB9Ci0gICAgICAgIG1XaWZpU3RhdGVUcmFja2VyLm5vdGlmeVN0YXRlQ2hhbmdlKG5ld1N0YXRlLCBCU1NJRCwgbmV0d29ya0lkKTsKKyAgICAgICAgbVdpZmlTdGF0ZU1hY2hpbmUubm90aWZ5TmV0d29ya1N0YXRlQ2hhbmdlKG5ld1N0YXRlLCBCU1NJRCwgbmV0d29ya0lkKTsKICAgICB9CiAKIC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HJpdmVyIHVubG9hZCBmYWlsZWQgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgQ01EX1VOTE9BRF9EUklWRVJfRkFJTFVSRSAgICAgICAgICAgID0gNjsKKworICAgIC8qIFN0YXJ0IHRoZSBzdXBwbGljYW50ICovCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IENNRF9TVEFSVF9TVVBQTElDQU5UICAgICAgICAgICAgICAgICA9IDExOworICAgIC8qIFN0b3AgdGhlIHN1cHBsaWNhbnQgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgQ01EX1NUT1BfU1VQUExJQ0FOVCAgICAgICAgICAgICAgICAgID0gMTI7CisgICAgLyogU3RhcnQgdGhlIGRyaXZlciAqLworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBDTURfU1RBUlRfRFJJVkVSICAgICAgICAgICAgICAgICAgICAgPSAxMzsKKyAgICAvKiBTdGFydCB0aGUgZHJpdmVyICovCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IENNRF9TVE9QX0RSSVZFUiAgICAgICAgICAgICAgICAgICAgICA9IDE0OworICAgIC8qIEluZGljYXRlcyBESENQIHN1Y2NlZGVkICovCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IENNRF9JUF9DT05GSUdfU1VDQ0VTUyAgICAgICAgICAgICAgICA9IDE1OworICAgIC8qIEluZGljYXRlcyBESENQIGZhaWxlZCAqLworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBDTURfSVBfQ09ORklHX0ZBSUxVUkUgICAgICAgICAgICAgICAgPSAxNjsKKyAgICAvKiBSZS1jb25maWd1cmUgaW50ZXJmYWNlICovCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IENNRF9SRUNPTkZJR1VSRV9JUCAgICAgICAgICAgICAgICAgICA9IDE3OworCisKKyAgICAvKiBTdGFydCB0aGUgc29mdCBhY2Nlc3MgcG9pbnQgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgQ01EX1NUQVJUX0FQICAgICAgICAgICAgICAgICAgICAgICAgID0gMjE7CisgICAgLyogU3RvcCB0aGUgc29mdCBhY2Nlc3MgcG9pbnQgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgQ01EX1NUT1BfQVAgICAgICAgICAgICAgICAgICAgICAgICAgID0gMjI7CisKKworICAgIC8qIFN1cHBsaWNhbnQgZXZlbnRzICovCisgICAgLyogQ29ubmVjdGlvbiB0byBzdXBwbGljYW50IGVzdGFibGlzaGVkICovCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IFNVUF9DT05ORUNUSU9OX0VWRU5UICAgICAgICAgICAgICAgICA9IDMxOworICAgIC8qIENvbm5lY3Rpb24gdG8gc3VwcGxpY2FudCBsb3N0ICovCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IFNVUF9ESVNDT05ORUNUSU9OX0VWRU5UICAgICAgICAgICAgICA9IDMyOworICAgIC8qIERyaXZlciBzdGFydCBjb21wbGV0ZWQgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgRFJJVkVSX1NUQVJUX0VWRU5UICAgICAgICAgICAgICAgICAgID0gMzM7CisgICAgLyogRHJpdmVyIHN0b3AgY29tcGxldGVkICovCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IERSSVZFUl9TVE9QX0VWRU5UICAgICAgICAgICAgICAgICAgICA9IDM0OworICAgIC8qIE5ldHdvcmsgY29ubmVjdGlvbiBjb21wbGV0ZWQgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgTkVUV09SS19DT05ORUNUSU9OX0VWRU5UICAgICAgICAgICAgID0gMzY7CisgICAgLyogTmV0d29yayBkaXNjb25uZWN0aW9uIGNvbXBsZXRlZCAqLworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBORV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gICAgICAgICAgICAgICAgICA9IDcyOworICAgIC8qIFNldCBzY2FuIHR5cGUuIFNDQU5fQUNUSVZFIG9yIFNDQU5fUEFTU0lWRSAqLworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBDTURfU0VUX1NDQU5fVFlQRSAgICAgICAgICAgICAgICAgICAgPSA3MzsKKyAgICAvKiBEaXNjb25uZWN0IGZyb20gYSBuZXR3b3JrICovCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IENNRF9ESVNDT05ORUNUICAgICAgICAgICAgICAgICAgICAgICA9IDc0OworICAgIC8qIFJlY29ubmVjdCB0byBhIG5ldHdvcmsgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgQ01EX1JFQ09OTkVDVCAgICAgICAgICAgICAgICAgICAgICAgID0gNzU7CisgICAgLyogUmVhc3NvY2lhdGUgdG8gYSBuZXR3b3JrICovCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IENNRF9SRUFTU09DSUFURSAgICAgICAgICAgICAgICAgICAgICA9IDc2OworICAgIC8qIFNldCBwb3dlciBtb2RlCisgICAgICogUE9XRVJfTU9ERV9BQ1RJVkUKKyAgICAgKiBQT1dFUl9NT0RFX0FVVE8KKyAgICAgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgQ01EX1NFVF9QT1dFUl9NT0RFICAgICAgICAgICAgICAgICAgID0gNzc7CisgICAgLyogU2V0IGJsdWV0b290aCBjby1leGlzdGVuY2UKKyAgICAgKiBCTFVFVE9PVEhfQ09FWElTVEVOQ0VfTU9ERV9FTkFCTEVECisgICAgICogQkxVRVRPT1RIX0NPRVhJU1RFTkNFX01PREVfRElTQUJMRUQKKyAgICAgKiBCTFVFVE9PVEhfQ09FWElTVEVOQ0VfTU9ERV9TRU5TRQorICAgICAqLworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBDTURfU0VUX0JMVUVUT09USF9DT0VYSVNURU5DRSAgICAgICAgPSA3ODsKKyAgICAvKiBFbmFibGUvZGlzYWJsZSBibHVldG9vdGggc2NhbiBtb2RlCisgICAgICogdHJ1ZSgxKQorICAgICAqIGZhbHNlKDApCisgICAgICovCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IENNRF9TRVRfQkxVRVRPT1RIX1NDQU5fTU9ERSAgICAgICAgICA9IDc5OworICAgIC8qIFNldCBudW1iZXIgb2YgYWxsb3dlZCBjaGFubmVscyAqLworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBDTURfU0VUX05VTV9BTExPV0VEX0NIQU5ORUxTICAgICAgICAgPSA4MDsKKyAgICAvKiBSZXF1ZXN0IGNvbm5lY3Rpdml0eSBtYW5hZ2VyIHdha2UgbG9jayBiZWZvcmUgZHJpdmVyIHN0b3AgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgQ01EX1JFUVVFU1RfQ01fV0FLRUxPQ0sgICAgICAgICAgICAgID0gODE7CisgICAgLyogRW5hYmxlcyBSU1NJIHBvbGwgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgQ01EX0VOQUJMRV9SU1NJX1BPTEwgICAgICAgICAgICAgICAgID0gODI7CisgICAgLyogUlNTSSBwb2xsICovCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IENNRF9SU1NJX1BPTEwgICAgICAgICAgICAgICAgICAgICAgICA9IDgzOworICAgIC8qIEdldCBjdXJyZW50IFJTU0kgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgQ01EX0dFVF9SU1NJICAgICAgICAgICAgICAgICAgICAgICAgID0gODQ7CisgICAgLyogR2V0IGFwcHJveCBjdXJyZW50IFJTU0kgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgQ01EX0dFVF9SU1NJX0FQUFJPWCAgICAgICAgICAgICAgICAgID0gODU7CisgICAgLyogR2V0IGxpbmsgc3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FQ1RfTkVUV09SSyAgICAgICAgICAgICAgICAgID0gOTA7CisgICAgLyogU2F2ZSB0aGUgc3BlY2lmaWVkIG5ldHdvcmsuIFRoaXMgaW52b2x2ZXMgYWRkaW5nCisgICAgICogYW4gZW5hYmxlZCBuZXR3b3JrIChpZiBuZXcpIGFuZCB1cGRhdGluZyB0aGUKKyAgICAgKiBjb25maWcgYW5kIGlzc3VpbmcgYSBzYXZlIG9uIHN1cHBsaWNhbnQgY29uZmlnLgorICAgICAqLworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBDTURfU0FWRV9ORVRXT1JLICAgICAgICAgICAgICAgICAgICAgPSA5MTsKKyAgICAvKiBEZWxldGUgdGhlIHNwZWNpZmllZCBuZXR3b3JrLiBUaGlzIGludm9sdmVzCisgICAgICogcmVtb3ZpbmcgdGhlIG5ldHdvcmsgYW5kIGlzc3VpbmcgYSBzYXZlIG9uCisgICAgICogc3VwcGxpY2FudCBjb25maWcuCisgICAgICovCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IENNRF9GT1JHRVRfTkVUV09SSyAgICAgICAgICAgICAgICAgICA9IDkyOworCisKKworICAgIC8qKgorICAgICAqIEludGVydmFsIGluIG1pbGxpc2Vjb25kcyBiZXR3ZWVuIHBvbGxpbmcgZm9yIGNvbm5lY3Rpb24KKyAgICAgKiBzdGF0dXMgaXRlbXMgdGhhdCBhcmUgbm90IHNlbnQgdmlhIGFzeW5jaHJvbm91cyBldmVudHMuCisgICAgICogQW4gZXhhbXBsZSBpcyBSU1NJIChzaWduYWwgc3RyZW5ndGgpLgorICAgICAqLworICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBQT0xMX1JTU0lfSU5URVJWQUxfTVNFQ1MgPSAzMDAwOworCisgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IENPTk5FQ1RfTU9ERSAgID0gMTsKKyAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgU0NBTl9PTkxZX01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W5uaW5nICovCisgICAgcHJpdmF0ZSBIaWVyYXJjaGljYWxTdGF0ZSBtU29mdEFwU3RhcnRlZFN0YXRlID0gbmV3IFNvZnRBcFN0YXJ0ZWRTdGF0ZSgpOworCisKKyAgICAvKioKKyAgICAgKiBPbmUgb2YgIHtAbGluayBXaWZpTWFuYWdlciNXSUZJX1NUQVRFX0RJU0FCTEVEfSwKKyAgICAgKiAgICAgICAgIHtAbGluayBXaWZpTWFuYWdlciNXSUZJX1NUQVRFX0RJU0FCTElOR30sCisgICAgICogICAgICAgICB7QGxpbmsgV2lmaU1hbmFnZXIjV0lGSV9TVEFURV9FTkFCTEVEfSwKKyAgICAgKiAgICAgICAgIHtAbGluayBXaWZpTWFuYWdlciNXSUZJX1NUQVRFX0VOQUJMSU5HfSwKKyAgICAgKiAgICAgICAgIHtAbGluayBXaWZpTWFuYWdlciNXSUZJX1NUQVRFX1VOS05PV059CisgICAgICoKKyAgICAgKi8KKyAgICBwcml2YXRlIGZpbmFsIEF0b21pY0ludGVnZXIgbVdpZmlTdGF0ZSA9IG5ldyBBdG9taWNJbnRlZ2VyKFdJRklfU1RBVEVfRElTQUJMRUQpOworCisgICAgLyoqCisgICAgICogT25lIG9mICB7QGxpbmsgV2lmaU1hbmFnZXIjV0lGSV9BUF9TVEFURV9ESVNBQkxFRH0sCisgICAgICogICAgICAgICB7QGxpbmsgV2lmaU1hbmFnZXIjV0lGSV9BUF9TVEFURV9ESVNBQkxJTkd9LAorICAgICAqICAgICAgICAge0BsaW5rIFdpZmlNYW5hZ2VyI1dJRklfQVBfU1RBVEVfRU5BQkxFRH0sCisgICAgICogICAgICAgICB7QGxpbmsgV2lmaU1hbmFnZXIjV0lGSV9BUF9TVEFURV9FTkFCTElOR30sCisgICAgICogICAgICAgICB7QGxpbmsgV2lmaU1hbmFnZXIjV0lGSV9BUF9TVEFURV9GQUlMRUR9CisgICAgICoKKyAgICAgKi8KKyAgICBwcml2YXRlIGZpbmFsIEF0b21pY0ludGVnZXIg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UluZm8gPSBuZXcgV2lmaUluZm8oKTsKKyAgICAgICAgbUludGVyZmFjZU5hbWUgPSBTeXN0ZW1Qcm9wZXJ0aWVzLmdldCgid2lmaS5pbnRlcmZhY2UiLCAidGl3bGFuMCIpOworICAgICAgICBtU3VwcGxpY2FudFN0YXRlVHJhY2tlciA9IG5ldyBTdXBwbGljYW50U3RhdGVUcmFja2VyKGNvbnRleHQsIGdldEhhbmRsZXIoKSk7CisKKyAgICAgICAgbUJsdWV0b290aEhlYWRzZXQgPSBuZXcgQmx1ZXRvb3RoSGVhZHNldChtQ29udGV4dCwgbnVsbCk7CisgICAgICAgIG1MaW5rUHJvcGVydGllcyA9IG5ldyBMaW5rUHJvcGVydGllcygpOworCisgICAgICAgIG1OZXR3b3JrSW5mby5zZXRJc0F2YWlsYWJsZShmYWxzZSk7CisgICAgICAgIG1MaW5rUHJvcGVydGllcy5jbGVhcigpOworICAgICAgICBtTGFzdEJzc2lkID0gbnVsbDsKKyAgICAgICAgbUxhc3ROZXR3b3JrSWQgPSAtMTsKKyAgICAgICAgbUxhc3RTaWduYWxMZXZlbCA9IC0xOworCisgICAgICAgIG1TY2FuUmVzdWx0Q2FjaGUgPSBuZXcgTGlua2VkSGFzaE1hcDxTdHJpbmcsIFNjYW5SZXN1bHQ+KAorICAgICAgICAgICAgU0NBTl9SRVNVTFRfQ0FDSEVfU0laRSwgMC43NWYsIHRydWUpIHsKKyAgICAgICAgICAgICAgICAvKgorICAgICAgICAgICAgICAgICAqIExpbWl0IHRoZSBjYWNoZSBzaXplIGJ5IFNDQU5fUkVTVUxUX0NBQ0hFX1NJWkUKKyAgICAgICAgICAgICAgICAgKiBlbGVtZW50cworICAgICAgICAgICAgICAgICAqLworICAgICAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgICAgIHB1YmxpYyBib29sZWFuIHJlbW92ZUVsZGVzdEVudHJ5KE1hcC5FbnRyeSBlbGRlc3QpIHsKKyAgICAgICAgICAgICAgICAgICAgcmV0d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G1Jbml0aWFsU3RhdGUpOworCisgICAgICAgIGlmIChEQkcpIHNldERiZyh0cnVlKTsKKworICAgICAgICAvL3N0YXJ0IHRoZSBzdGF0ZSBtYWNoaW5lCisgICAgICAgIHN0YXJ0KCk7CisgICAgfQorCisgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICAgICAqIE1ldGhvZHMgZXhwb3NlZCBmb3IgcHVibGljIHVzZQorICAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworICAgIC8qKgorICAgICAqIFRPRE86IGRvYworICAgICAqLworICAgIHB1YmxpYyBib29sZWFuIHN5bmNQaW5nU3VwcGxpY2FudCgpIHsKKyAgICAgICAgcmV0dXJuIHNlbmRTeW5jTWVzc2FnZShDTURfUElOR19TVVBQTElDQU5UKS5ib29sVmFsdWU7CisgICAgfQorCisgICAgLyoqCisgICAgICogVE9ETzogZG9jCisgICAgICovCisgICAgcHVibGljIHZvaWQgc3RhcnRTY2FuKGJvb2xlYW4gZm9yY2VBY3RpdmUpIHsKKyAgICAgICAgc2VuZE1lc3NhZ2Uob2J0YWluTWVzc2FnZShDTURfU1RBUlRfU0NBTiwgZm9yY2VBY3RpdmUgPworICAgICAgICAgICAgICAgIFNDQU5fQUNUSVZFIDogU0NBTl9QQVNTSVZFLCAwKSk7CisgICAgfQorCisgICAgLyoqCisgICAgICogVE9ETzogZG9jCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0V2lmaUVuYWJsZWQoYm9vbGVhbiBlbmFibGUpIHsKKyAgICAgICAgbUxhc3RFbmFibGVVaWQuc2V0KEJpbmRlci5nZXRDYWxsaW5nVWlkKCkpOworICAgICAgICBpZiAoZW5hYmxlKSB7CisgICAgICAgICAgICAvKiBBcmd1bWVudCBpcyB0aGUgc3RhdGUgdGhhdCBpcyBlbnRlcmVkIHByaW9yIHRvIGxvYWQgKi8KKyAgIC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fQVApOworICAgICAgICAgICAgLyogQXJndW1lbnQgaXMgdGhlIHN0YXRlIHRoYXQgaXMgZW50ZXJlZCB1cG9uIHN1Y2Nlc3MgKi8KKyAgICAgICAgICAgIHNlbmRNZXNzYWdlKG9idGFpbk1lc3NhZ2UoQ01EX1VOTE9BRF9EUklWRVIsIFdJRklfQVBfU1RBVEVfRElTQUJMRUQsIDApKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIFRPRE86IGRvYworICAgICAqLworICAgIHB1YmxpYyBpbnQgc3luY0dldFdpZmlTdGF0ZSgpIHsKKyAgICAgICAgcmV0dXJuIG1XaWZpU3RhdGUuZ2V0KCk7CisgICAgfQorCisgICAgLyoqCisgICAgICogVE9ETzogZG9jCisgICAgICovCisgICAgcHVibGljIFN0cmluZyBzeW5jR2V0V2lmaVN0YXRlQnlOYW1lKCkgeworICAgICAgICBzd2l0Y2ggKG1XaWZpU3RhdGUuZ2V0KCkpIHsKKyAgICAgICAgICAgIGNhc2UgV0lGSV9TVEFURV9ESVNBQkxJTkc6CisgICAgICAgICAgICAgICAgcmV0dXJuICJkaXNhYmxpbmciOworICAgICAgICAgICAgY2FzZSBXSUZJX1NUQVRFX0RJU0FCTEVEOgorICAgICAgICAgICAgICAgIHJldHVybiAiZGlzYWJsZWQiOworICAgICAgICAgICAgY2FzZSBXSUZJX1NUQVRFX0VOQUJMSU5HOgorICAgICAgICAgICAgICAgIHJldHVybiAiZW5hYmxpbmciOworICAgICAgICAgICAgY2FzZSBXSUZJX1NUQVRFX0VOQUJMRUQ6CisgICAgICAgICAgICAgICAgcmV0dXJuICJlbmFibGVkIjsKKyAgICAgICAgICAgIGNhc2UgV0lGSV9TVEFURV9VTktOT1dOOgorICAgICAgICAgICAgICAgIHJldHVybiAidW5rbm93biBzdGF0ZSI7CisgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgIHJldHVybiAiW2ludmFsaWQgc3RhdGVdIjsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIFRPRE86IGRvYworICAgICAqLworICAgIHB1YmxpYyBpbnQgc3luY0dldFdpZmlBcFN0YXRlKCkgeworICAgICAgICByZXR1cm4gbVdpZmlBcFN0YXRlLmdldCgpOworICAgIH0KKworICAgIC8qKgorICAgICAqIFRPRE86IGRvYworICAgICAqLworICAgIHB1YmxpYyBTdHJpbmcgc3luY0dldFdpZmlBcFN0YXRlQnlOYW1lKCkgeworICAgICAgICBzd2l0Y2ggKG1XaWZpQXBTdGF0ZS5nZXQoKSkgeworICAgICAgICAgICAgY2FzZSBXSUZJX0FQX1NUQVRFX0RJU0FCTElORzoKKyAgICAgICAgICAgICAgICByZXR1cm4gImRpc2FibGluZyI7CisgICAgICAgICAgICBjYXNlIFdJRklfQVBfU1RBVEVfRElTQUJMRUQ6CisgICAgICAgICAgICAgICAgcmV0dXJuICJkaXNhYmxlZCI7CisgICAgICAgICAgICBjYXNlIFdJRklfQVBfU1RBVEVfRU5BQkxJTkc6CisgICAgICAgICAgICAgICAgcmV0dXJuICJlbmFibGluZyI7CisgICAgICAgICAgICBjYXNlIFdJRklfQVBfU1RBVEVfRU5BQkxFRDoKKyAgICAgICAgICAgICAgICByZXR1cm4gImVuYWJsZWQiOworICAgICAgICAgICAgY2FzZSBXSUZJX0FQX1NUQVRFX0ZBSUxFRDoKKyAgICAgICAgICAgICAgICByZXR1cm4gImZhaWxlZCI7CisgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgIHJldHVybiAiW2ludmFsaWQgc3RhdGVdIjsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIEdldCBzdGF0dXMgaW5mb3JtYXRpb24gZm9yIHRoZSBjdXJyZW50IGNvbm5lY3Rpb24sIGlmIGFueS4KKyAgICAgKiBAcmV0dXJuIGEge0BsaW5rIFdpZmlJbmZvfSBvYmplY3QgY29udGFpbmluZyBpbmZvcm1hdGlvbiBhYm91dCB0aGUgY3VycmVudCBjb25uZWN0aW9uCisgICAgICoKKyAgICAgKi8KKyAgICBwdWJsaWMgV2lmaUluZm8gc3luY1JlcXVlc3RDb25uZWN0aW9uSW5mbygpIHsKKyAgICAgICAgcmV0dXJuIG1XaWZpSW5mbzsKKyAgICB9CisKKyAgICBwdWJsaWMgRGhjcEluZm8gc3luY0dldERoY3BJbmZvKCkgeworICAgICAgICByZXR1cm4gbURoY3BJbmZvOworICAgIH0KKworICAgIC8qKgorICAgICAqIFRPRE86IGRvYworICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNldERyaXZlclN0YXJ0KGJvb2xlYW4gZW5hYmxlKSB7CisgICAgICBpZiAoZW5hYmxlKSB7CisgICAgICAgICAgc2VuZE1lc3NhZ2UoQ01EX1NUQVJUX0RSSVZFUik7CisgICAgICB9IGVsc2UgeworICAgICAgICAgIHNlbmRNZXNzYWdlKENNRF9TVE9QX0RSSVZFUik7CisgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogVE9ETzogZG9jCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0U2Nhbk9ubHlNb2RlKGJvb2xlYW4gZW5hYmxlKSB7CisgICAgICBpZiAoZW5hYmxlKSB7CisgICAgICAgICAgc2VuZE1lc3NhZ2Uob2J0YWluTWVzc2FnZShDTURfU0VUX1NDQU5fTU9ERSwgU0NBTl9PTkxZX01PREUsIDApKTsKKyAgICAgIH0gZWxzZSB7CisgICAgICAgICAgc2VuZE1lc3NhZ2Uob2J0YWluTWVzc2FnZShDTURfU0VUX1NDQU5fTU9ERSwgQ09OTkVDVF9NT0RFLCAwKSk7CisgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogVE9ETzogZG9jCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0U2NhblR5cGUoYm9vbGVhbiBhY3RpdmUpIHsKKyAgICAgIGlmIChhY3RpdmUpIHsKKyAgICAgICAgICBzZW5kTWVzc2FnZShvYnRhaW5NZXNzYWdlKENNRF9TRVRfU0NBTl9UWVBF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lmaUNvbmZpZ3VyYXRpb24gY29uZmlnKSB7CisgICAgICAgIHJldHVybiBzZW5kU3luY01lc3NhZ2UoQ01EX0FERF9PUl9VUERBVEVfTkVUV09SSywgY29uZmlnKS5pbnRWYWx1ZTsKKyAgICB9CisKKyAgICBwdWJsaWMgTGlzdDxXaWZpQ29uZmlndXJhdGlvbj4gc3luY0dldENvbmZpZ3VyZWROZXR3b3JrcygpIHsKKyAgICAgICAgcmV0dXJuIFdpZmlDb25maWdTdG9yZS5nZXRDb25maWd1cmVkTmV0d29ya3MoKTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBEZWxldGUgYSBuZXR3b3JrCisgICAgICoKKyAgICAgKiBAcGFyYW0gbmV0d29ya0lkIGlkIG9mIHRoZSBuZXR3b3JrIHRvIGJlIHJlbW92ZWQKKyAgICAgKi8KKyAgICBwdWJsaWMgYm9vbGVhbiBzeW5jUmVtb3ZlTmV0d29yayhpbnQgbmV0d29ya0lkKSB7CisgICAgICAgIHJldHVybiBzZW5kU3luY01lc3NhZ2Uob2J0YWluTWVzc2FnZShDTURfUkVNT1ZFX05FVFdPUkssIG5ldHdvcmtJZCwgMCkpLmJvb2xWYWx1ZTsKKyAgICB9CisKKyAgICBwcml2YXRlIGNsYXNzIEVuYWJsZU5ldFBhcmFtcyB7CisgICAgICAgIHByaXZhdGUgaW50IG5ldElkOworICAgICAgICBwcml2YXRlIGJvb2xlYW4gZGlzYWJsZU90aGVyczsKKyAgICAgICAgRW5hYmxlTmV0UGFyYW1zKGludCBuLCBib29sZWFuIGIpIHsKKyAgICAgICAgICAgIG5ldElkID0gbjsKKyAgICAgICAgICAgIGRpc2FibGVPdGhlcnMgPSBiOworICAgICAgICB9CisgICAgfQorICAgIC8qKgorICAgICAqIEVuYWJsZSBhIG5ldHdvcmsKKyAgICAgKgorICAgICAqIEBwYXJhbSBuZXRJZCBuZXR3b3JrIGlkIG9mIHRoZSBuZXR3b3JrCisgICAgICogQHBhcmFtIGRpc2FibGVPdG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lc3NhZ2Uob2J0YWluTWVzc2FnZShDTURfU0FWRV9ORVRXT1JLLCB3aWZpQ29uZmlnKSk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgZm9yZ2V0TmV0d29yayhpbnQgbmV0SWQpIHsKKyAgICAgICAgc2VuZE1lc3NhZ2Uob2J0YWluTWVzc2FnZShDTURfRk9SR0VUX05FVFdPUkssIG5ldElkLCAwKSk7CisgICAgfQorCisgICAgcHVibGljIHZvaWQgZW5hYmxlUnNzaVBvbGxpbmcoYm9vbGVhbiBlbmFibGVkKSB7CisgICAgICAgc2VuZE1lc3NhZ2Uob2J0YWluTWVzc2FnZShDTURfRU5BQkxFX1JTU0lfUE9MTCwgZW5hYmxlZCA/IDEgOiAwLCAwKSk7CisgICAgfQorICAgIC8qKgorICAgICAqIEdldCBSU1NJIHRvIGN1cnJlbnRseSBjb25uZWN0ZWQgbmV0d29yaworICAgICAqCisgICAgICogQHJldHVybiBSU1NJIHZhbHVlLCAtMSBvbiBmYWlsdXJlCisgICAgICovCisgICAgcHVibGljIGludCBzeW5jR2V0UnNzaSgpIHsKKyAgICAgICAgcmV0dXJuIHNlbmRTeW5jTWVzc2FnZShDTURfR0VUX1JTU0kpLmludFZhbHVlOworICAgIH0KKworICAgIC8qKgorICAgICAqIEdldCBhcHByb3ggUlNTSSB0byBjdXJyZW50bHkgY29ubmVjdGVkIG5ldHdvcmsKKyAgICAgKgorICAgICAqIEByZXR1cm4gUlNTSSB2YWx1ZSwgLTEgb24gZmFpbHVyZQorICAgICAqLworICAgIHB1YmxpYyBpbnQgc3luY0dldFJzc2lBcHByb3goKSB7CisgICAgICAgIHJldHVybiBzZW5kU3luY01lc3NhZ2UoQ01EX0dFVF9SU1NJX0FQUFJPWCkuaW50VmFsdWU7CisgICAgfQorCisgICAgLyoqCisgICAgICogR2V0IGxpbmsgc3BlZWQgdG8gY3VycmVudGx5IGNvbm5lY3RlZCBuZXR3b3JrCisgICAgICoKKyAgICAgKiBAcmV0dXJuIGxpbmsgc3BlZWQsIC0xIG9uIGZhaWx1cmUKKyAgICAgKi8KKyAgICBwdWJsaWMgaW50IHN5bmNHZXRMaW5rU3BlZWQoKSB7CisgICAgICAgIHJldHVybiBzZW5kU3luY01lc3NhZ2UoQ01EX0dFVF9MSU5LX1NQRUVEKS5pbnRWYWx1ZTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBHZXQgTUFDIGFkZHJlc3Mgb2YgcmFkaW8KKyAgICAgKgorICAgICAqIEByZXR1cm4gTUFDIGFkZHJlc3MsIG51bGwgb24gZmFpbHVyZQorICAgICAqLworICAgIHB1YmxpYyBTdHJpbmcgc3luY0dldE1hY0FkZHJlc3MoKSB7CisgICAgICAgIHJldHVybiBzZW5kU3luY01lc3NhZ2UoQ01EX0dFVF9NQUNfQUREUikuc3RyaW5nVmFsdWU7CisgICAgfQorCisgICAgLyoqCisgICAgICogU3RhcnQgcGFja2V0IGZpbHRlcmluZworICAgICAqLworICAgIHB1YmxpYyB2b2lkIHN0YXJ0UGFja2V0RmlsdGVyaW5nKCkgeworICAgICAgICBzZW5kTWVzc2FnZShDTURfU1RBUlRfUEFDS0VUX0ZJTFRFUklORyk7CisgICAgfQorCisgICAgLyoqCisgICAgICogU3RvcCBwYWNrZXQgZmlsdGVyaW5nCisgICAgICovCisgICAgcHVibGljIHZvaWQgc3RvcFBhY2tldEZpbHRlcmluZygpIHsKKyAgICAgICAgc2VuZE1lc3NhZ2UoQ01EX1NUT1BfUEFDS0VUX0ZJTFRFUklORyk7CisgICAgfQorCisgICAgLyoqCisgICAgICogU2V0IHBvd2VyIG1vZGUKKyAgICAgKiBAcGFyYW0gbW9kZQorICAgICAqICAgICBEUklWRVJfUE9XRVJfTU9ERV9BVVRPCisgICAgICogICAgIERSSVZFUl9QT1dFUl9NT0RFX0FDVElWRQorICAgICAqLworICAgIHB1YmxpYyB2b2lkIHNldFBvd2VyTW9kZShpbnQgbW9kZSkgeworICAgICAgICBzZW5kTWVzc2FnZShvYnRhaW5NZXNzYWdlKENNRF9TRVRfUE9XRVJfTU9ERSwgbW9kZSwgMCkpOworICAgIH0KKworICAgIC8qKgorICAgICAqIFNldCB0aGUgbnVtYmVyIG9mIGFsbG93ZWQgcmFkaW8gZnJlcXVlbmN5IGNoYW5uZWxzIGZyb20gdGhlIHN5c3RlbQorICAgICAqIHNldHRpbmcgdmFsdWUsIGlmIGFueS4KKyAgICAgKi8KKyAgICBwdWJsaWMgdm9pZCBzZXROdW1BbGxvd2VkQ2hhbm5lbHMoKSB7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBzZXROdW1BbGxvd2VkQ2hhbm5lbHMoCisgICAgICAgICAgICAgICAgICAgIFNldHRpbmdzLlNlY3VyZS5nZXRJbnQobUNvbnRleHQuZ2V0Q29udGVudFJlc29sdmVyKCksCisgICAgICAgICAgICAgICAgICAgIFNldHRpbmdzLlNlY3VyZS5XSUZJX05VTV9BTExPV0VEX0NIQU5ORUxTKSk7CisgICAgICAgIH0gY2F0Y2ggKFNldHRpbmdzLlNldHRpbmdOb3RGb3VuZEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICBpZiAobU51bUFsbG93ZWRDaGFubmVscyAhPSAwKSB7CisgICAgICAgICAgICAgICAgc2V0TnVtQWxsb3dlZENoYW5uZWxzKG1OdW1BbGxvd2VkQ2hhbm5lbHMpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgLy8gb3RoZXJ3aXNlLCB1c2UgdGhlIGRyaXZlciBkZWZhdWx0CisgICAgICAgIH0KKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBTZXQgdGhlIG51bWJlciBvZiByYWRpbyBmcmVxdWVuY3kgY2hhbm5lbHMgdGhhdCBhcmUgYWxsb3dlZCB0byBiZSB1c2VkCisgICAgICogaW4gdGhlIGN1cnJlbnQgcmVndWxhdG9yeSBkb21haW4uCisgICAgICogQHBhcmFtIG51bUNoYW5uZWxzIHRoZSBudW1iZXIgb2YgYWxsb3dlZCBjaGFubmVscy4gTXVzdCBiZSBncmVhdGVyIHRoYW4gMAorICAgICAqIGFuZCBsZXNzIHRoYW4gb3IgZXF1YWwgdG8gMTYuCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0TnVtQWxsb3dlZENoYW5uZWxzKGludCBudW1DaGFubmVscykgeworICAgICAgICBzZW5kTWVzc2FnZShvYnRhaW5NZXNzYWdlKENNRF9TRVRfTlVNX0FMTE9XRURfQ0hBTk5FTFMsIG51bUNoYW5uZWxzLCAwKSk7CisgICAgfQorCisgICAgLyoqCisgICAgICogR2V0IG51bWJlciBvZiBhbGxvd2VkIGNoYW5uZWxzCisgICAgICoKKyAgICAgKiBAcmV0dXJuIGNoYW5uZWwgY291bnQsIC0xIG9uIGZhaWx1cmUKKyAgICAgKgorICAgICAqIFRPRE86IHRoaXMgaXMgbm90IGEgcHVibGljIEFQSSBhbmQgbmVlZHMgdG8gYmUgcmVtb3ZlZCBpbiBmYXZvcgorICAgICAqIG9mIGFzeW5jaHJvbm91cyByZXBvcnRpbmcuIHVudXNlZCBmb3Igbm93LgorICAgICAqLworICAgIHB1YmxpYyBpbnQgZ2V0TnVtQWxsb3dlZENoYW5uZWxzKCkgeworICAgICAgICByZXR1cm4gLTE7CisgICAgfQorCisgICAgLyoqCisgICAgICogU2V0IGJsdWV0b290aCBjb2V4IG1vZGU6CisgICAgICoKKyAgICAgKiBAcGFyYW0gbW9kZQorICAgICAqICBCTFVFVE9PVEhfQ09FWElTVEVOQ0VfTU9ERV9FTkFCTEVECisgICAgICogIEJMVUVUT09USF9DT0VYSVNURU5DRV9NT0RFX0RJU0FCTEVECisgICAgICogIEJMVUVUT09USF9DT0VYSVNURU5DRV9NT0RFX1NFTlNFCisgICAgICovCisgICAgcHVibGljIHZvaWQgc2V0Qmx1ZXRvb3RoQ29leGlzdGVuY2VNb2RlKGludCBtb2RlKSB7CisgICAgICAgIHNlbmRNZXNzYWdlKG9idGFpbk1lc3NhZ2UoQ01EX1NFVF9CTFVFVE9PVEhfQ09FWElTVEVO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udG9TdHJpbmcoKTsKKyAgICB9CisKKyAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisgICAgICogSW50ZXJuYWwgcHJpdmF0ZSBmdW5jdGlvbnMKKyAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKyAgICBjbGFzcyBTeW5jUmV0dXJuIHsKKyAgICAgICAgYm9vbGVhbiBib29sVmFsdWU7CisgICAgICAgIGludCBpbnRWYWx1ZTsKKyAgICAgICAgU3RyaW5nIHN0cmluZ1ZhbHVlOworICAgICAgICBPYmplY3Qgb2JqVmFsdWU7CisgICAgfQorCisgICAgY2xhc3MgU3luY1BhcmFtcyB7CisgICAgICAgIE9iamVjdCBtUGFyYW1ldGVyOworICAgICAgICBTeW5jUmV0dXJuIG1TeW5jUmV0dXJuOworICAgICAgICBTeW5jUGFyYW1zKCkgeworICAgICAgICAgICAgbVN5bmNSZXR1cm4gPSBuZXcgU3luY1JldHVybigpOworICAgICAgICB9CisgICAgICAgIFN5bmNQYXJhbXMoT2JqZWN0IHApIHsKKyAgICAgICAgICAgIG1QYXJhbWV0ZXIgPSBwOworICAgICAgICAgICAgbVN5bmNSZXR1cm4gPSBuZXcgU3luY1JldHVybigpOworICAgICAgICB9CisgICAgfQorCisgICAgLyoqCisgICAgICogbWVzc2FnZS5vYmogaXMgdXNlZCB0byBzdG9yZSBTeW5jUGFyYW1zCisgICAgICovCisgICAgcHJpdmF0ZSBTeW5jUmV0dXJuIHN5bmNlZFNlbmQoTWVzc2FnZSBtc2cpIHsKKyAgICAgICAgU3luY1BhcmFtcyBzeW5jUGFyYW1zID0gKFN5bmNQYXJhbXMpIG1zZy5vYmo7CisgICAgICAgIHN5bmNocm9uaXplZChzeW5jUGFyYW1zKSB7CisgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsICJzeW5jZWRTZW5kICIgKyBtc2cpOworICAgICAgICAgICAgc2VuZE1lc3NhZ2UobXNnKTsKKyAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgc3luY1BhcmFtcy53YWl0KCk7CisgICAgICAgICAgICB9IGNhdGNoIChJbnRlcnJ1cHRlZEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgTG9nLmUoVEFHLCAic2VuZFN5bmNNZXNzYWdlOiB1bmV4cGVjdGVkIGludGVycnVwdGlvbiBvZiB3YWl0KCkiKTsKKyAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICByZXR1cm4gc3luY1BhcmFtcy5tU3luY1JldHVybjsKKyAgICB9CisKKyAgICBwcml2YXRlIFN5bmNSZXR1cm4gc2VuZFN5bmNNZXNzYWdlKE1lc3NhZ2UgbXNnKSB7CisgICAgICAgIFN5bmNQYXJhbXMgc3luY1BhcmFtcyA9IG5ldyBTeW5jUGFyYW1zKCk7CisgICAgICAgIG1zZy5vYmogPSBzeW5jUGFyYW1zOworICAgICAgICByZXR1cm4gc3luY2VkU2VuZChtc2cpOworICAgIH0KKworICAgIHByaXZhdGUgU3luY1JldHVybiBzZW5kU3luY01lc3NhZ2UoaW50IHdoYXQsIE9iamVjdCBwYXJhbSkgeworICAgICAgICBTeW5jUGFyYW1zIHN5bmNQYXJhbXMgPSBuZXcgU3luY1BhcmFtcyhwYXJhbSk7CisgICAgICAgIE1lc3NhZ2UgbXNnID0gb2J0YWluTWVzc2FnZSh3aGF0LCBzeW5jUGFyYW1zKTsKKyAgICAgICAgcmV0dXJuIHN5bmNlZFNlbmQobXNnKTsKKyAgICB9CisKKworICAgIHByaXZhdGUgU3luY1JldHVybiBzZW5kU3luY01lc3NhZ2UoaW50IHdoYXQpIHsKKyAgICAgICAgcmV0dXJuIHNlbmRTeW5jTWVzc2FnZShvYnRhaW5NZXNzYWdlKHdoYXQpKTsKKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgbm90aWZ5T25Nc2dPYmplY3QoTWVzc2FnZSBtc2cpIHsKKyAgICAgICAgU3luY1BhcmFtcyBzeW5jUGFyYW1zID0gKFN5bmNQYXJhbXMpIG1zZy5vYmo7CisgICAgICAgIGlmIChzeW5jUGFyYW1zICE9IG51bGwpIHsKKyAgICAgICAgICAgIHN5bmNocm9uaXplZChzeW5jUGFyYW1zKSB7CisgICAgICAgICAgICAgICAgaWYgKERCRykgTG9nLmQoVEFHLCAibm90aWZ5T25Nc2dPYmplY3QgIiArIG1zZyk7CisgICAgICAgICAgICAgICAgc3luY1BhcmFtcy5ub3RpZnkoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBlbHNlIHsKKyAgICAgICAgICAgIExvZy5lKFRBRywgIkVycm9yISBzeW5jUGFyYW1zIGluIG5vdGlmeU9uTXNnT2JqZWN0IGlzIG51bGwiKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIHByaXZhdGUgdm9pZCBzZXRXaWZpU3RhdGUoaW50IHdpZmlTdGF0ZSkgeworICAgICAgICBmaW5hbCBpbnQgcHJldmlvdXNXaWZpU3RhdGUgPSBtV2lmaVN0YXRlLmdldCgpOworCisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBpZiAod2lmaVN0YXRlID09IFdJRklfU1RBVEVfRU5BQkxFRCkgeworICAgICAgICAgICAgICAgIG1CYXR0ZXJ5U3RhdHMubm90ZVdpZmlPbihtTGFzdEVuYWJsZVVpZC5nZXQoKSk7CisgICAgICAgICAgICB9IGVsc2UgaWYgKHdpZmlTdGF0ZSA9PSBXSUZJX1NUQVRFX0RJU0FCTEVEKSB7CisgICAgICAgICAgICAgICAgbUJhdHRlcnlTdGF0cy5ub3RlV2lmaU9mZihtTGFzdEVuYWJsZVVpZC5nZXQoKSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0gY2F0Y2ggKFJlbW90ZUV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICBMb2cuZShUQUcsICJGYWlsZWQ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GluZSB0aGUgbGluZSB0byBwYXJzZQorICAgICAqIEByZXR1cm4gdGhlIHtAbGluayBTY2FuUmVzdWx0fSBvYmplY3QKKyAgICAgKi8KKyAgICBwcml2YXRlIFNjYW5SZXN1bHQgcGFyc2VTY2FuUmVzdWx0KFN0cmluZyBsaW5lKSB7CisgICAgICAgIFNjYW5SZXN1bHQgc2NhblJlc3VsdCA9IG51bGw7CisgICAgICAgIGlmIChsaW5lICE9IG51bGwpIHsKKyAgICAgICAgICAgIC8qCisgICAgICAgICAgICAgKiBDYWNoZSBpbXBsZW1lbnRhdGlvbiAoTGlua2VkSGFzaE1hcCkgaXMgbm90IHN5bmNocm9uaXplZCwgdGh1cywKKyAgICAgICAgICAgICAqIG11c3Qgc3luY2hyb25pemVkIGhlcmUhCisgICAgICAgICAgICAgKi8KKyAgICAgICAgICAgIHN5bmNocm9uaXplZCAobVNjYW5SZXN1bHRDYWNoZSkgeworICAgICAgICAgICAgICAgIFN0cmluZ1tdIHJlc3VsdCA9IHNjYW5SZXN1bHRQYXR0ZXJuLnNwbGl0KGxpbmUpOworICAgICAgICAgICAgICAgIGlmICgzIDw9IHJlc3VsdC5sZW5ndGggJiYgcmVzdWx0Lmxlbmd0aCA8PSA1KSB7CisgICAgICAgICAgICAgICAgICAgIFN0cmluZyBic3NpZCA9IHJlc3VsdFswXTsKKyAgICAgICAgICAgICAgICAgICAgLy8gYnNzaWQgfCBmcmVxdWVuY3kgfCBsZXZlbCB8IGZsYWdzIHwgc3NpZAorICAgICAgICAgICAgICAgICAgICBpbnQgZnJlcXVlbmN5OworICAgICAgICAgICAgICAgICAgICBpbnQgbGV2ZWw7CisgICAgICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAgICAgICAgICAgICAgICAgICBmcmVxdWVuY3kgPSBJbnRlZ2VyLnBhcnNlSW50KHJlc3VsdFsxXSk7CisgICAgICAgICAgICAgICAgICAgICAgICBsZXZlbCA9IEludGVnZXIucGFyc2VJbnQocmVzdWx0WzJdKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8qIHNvbWUgaW1wbGVtZW50YXRpb25zIGF2b2lkIG5lZ2F0aXZlIHZhbHVlcyBieSBhZGRpbmcgMjU2CisgICAgICAgICAgICAgICAgICAgICAgICAgKiBzbyB3ZSBuZWVkIHRvIGFkanVzdCBmb3IgdGhhdCBoZXJlLgorICAgICAgICAgICAgICAgICAgICAgICAgICovCisgICAgICAgICAgICAgICAgICAgICAgICBpZiAobGV2ZWwgPiAwKSBsZXZlbCAtPSAyNTY7CisgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKE51bWJlckZvcm1hdEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBmcmVxdWVuY3kgPSAwOworICAgICAgICAgICAgICAgICAgICAgICAgbGV2ZWwgPSAwOworICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgLyoKKyAgICAgICAgICAgICAgICAgICAgICogVGhlIGZvcm1hdHRpbmcgb2YgdGhlIHJlc3VsdHMgcmV0dXJuZWQgYnkKKyAgICAgICAgICAgICAgICAgICAgICogd3BhX3N1cHBsaWNhbnQgaXMgaW50ZW5kZWQgdG8gbWFrZSB0aGUgZmllbGRzCisgICAgICAgICAgICAgICAgICAgICAqIGxpbmUgdXAgbmljZWx5IHdoZW4gcHJpbnRlZCwKKyAgICAgICAgICAgICAgICAgICAgICogbm90IHRvIG1ha2UgdGhlbSBlYXN5IHRvIHBhcnNlLiBTbyB3ZSBoYXZlIHRvCisgICAgICAgICAgICAgICAgICAgICAqIGFwcGx5IHNvbWUgaGV1cmlzdGljcyB0byBmaWd1cmUgb3V0IHdoaWNoIGZpZWxkCisgICAgICAgICAgICAgICAgICAgICAqIGlzIHRoZSBTU0lEIGFuZCB3aGljaCBmaWVsZCBpcyB0aGUgZmxhZ3MuCisgICAgICAgICAgICAgICAgICAgICAqLworICAgICAgICAgICAgICAgICAgICBTdHJpbmcgc3NpZDsKKyAgICAgICAgICAgICAgICAgICAgU3RyaW5nIGZsYWdzOworICAgICAgICAgICAgICAgICAgICBpZiAocmVzdWx0Lmxlbmd0aCA9PSA0KSB7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAocmVzdWx0WzNdLmNoYXJBdCgwKSA9PSAnWycpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBmbGFncyA9IHJlc3VsdFszXTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzc2lkID0gIiI7CisgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsYWdzID0gIiI7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3NpZCA9IHJlc3VsdFszXTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChyZXN1bHQubGVuZ3RoID09IDUpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGZsYWdzID0gcmVzdWx0WzNdOworICAgICAgICAgICAgICAgICAgICAgICAgc3NpZCA9IHJlc3VsdFs0XTsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIEhlcmUsIHdlIG11c3QgaGF2ZSAzIGZpZWxkczogbm8gZmxhZ3MgYW5kIHNzaWQKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIHNldAorICAgICAgICAgICAgICAgICAgICAgICAgZmxhZ3MgPSAiIjsKKyAgICAgICAgICAgICAgICAgICAgICAgIHNzaWQgPSAiIjsKKyAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgICAgIC8vIGJzc2lkICsgc3NpZCBpcyB0aGUgaGFzaCBrZXkKKyAgICAgICAgICAgICAgICAgICAgU3RyaW5nIGtleSA9IGJzc2lkICsgc3NpZDsKKyAgICAgICAgICAgICAgICAgICAgc2NhblJlc3VsdCA9IG1TY2FuUmVzdWx0Q2FjaGUuZ2V0KGtleSk7CisgICAgICAgICAgICAgICAgICAgIGlmIChzY2FuUmVzdWx0ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHNjYW5SZXN1bHQubGV2ZWwgPSBsZXZlbDsKKyAgICAgICAgICAgICAgICAgICAgICAgIHNjYW5SZXN1bHQuU1NJRCA9IHNzaWQ7CisgICAgICAgICAgICAgICAgICAgICAgICBzY2FuUmVzdWx0LmNhcGFiaWxpdGllcyA9IGZsYWdzOworICAgICAgICAgICAgICAgICAgICAgICAgc2NhblJlc3VsdC5mcmVxdWVuY3kgPSBmcmVxdWVuY3k7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAvLyBEbyBub3QgYWRkIHNjYW4gcmVzdWx0cyB0aGF0IGhhdmUgbm8gU1NJRCBzZXQKKyAgICAgICAgICAgICAgICAgICAgICAgIGlmICgwIDwgc3NpZC50cmltKCkubGVuZ3RoKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY2FuUmVzdWx0ID0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3IFNjYW5SZXN1bHQoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzc2lkLCBic3NpZCwgZmxhZ3MsIGxldmVsLCBmcmVxdWVuY3kpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1TY2FuUmVzdWx0Q2FjaGUucHV0KGtleSwgc2NhblJlc3VsdCk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICBMb2cudyhUQUcsICJNaXNmb3JtYXR0ZWQgc2NhbiByZXN1bHQgdGV4dCB3aXRoICIgKworICAgICAgICAgICAgICAgICAgICAgICAgICByZXN1bHQubGVuZ3RoICsgIiBmaWVsZHM6ICIgKyBsaW5lKTsKKyAgICAgICAgICAgICAgIC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kKSA9PSAnXG4nKSB7CisgICAgICAgICAgICAgICAgKytsaW5lQ291bnQ7CisKKyAgICAgICAgICAgICAgICBpZiAobGluZUNvdW50ID09IDEpIHsKKyAgICAgICAgICAgICAgICAgICAgbGluZUJlZyA9IGxpbmVFbmQgKyAxOworICAgICAgICAgICAgICAgICAgICBjb250aW51ZTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKGxpbmVFbmQgPiBsaW5lQmVnKSB7CisgICAgICAgICAgICAgICAgICAgIFN0cmluZyBsaW5lID0gc2NhblJlc3VsdHMuc3Vic3RyaW5nKGxpbmVCZWcsIGxpbmVFbmQpOworICAgICAgICAgICAgICAgICAgICBTY2FuUmVzdWx0IHNjYW5SZXN1bHQgPSBwYXJzZVNjYW5SZXN1bHQobGluZSk7CisgICAgICAgICAgICAgICAgICAgIGlmIChzY2FuUmVzdWx0ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHNjYW5MaXN0LmFkZChzY2FuUmVzdWx0KTsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIExvZy53KFRBRywgIm1pc2Zvcm1hdHRlZCBzY2FuIHJlc3VsdCBmb3I6ICIgKyBsaW5lKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICBsaW5lQmVnID0gbGluZUVuZCArIDE7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBtU2NhblJlc3VsdHMgPSBzY2FuTGlzdDsKKyAgICB9CisKKyAgICBwcml2YXRlIFN0cmluZyBmZXRjaFNTSUQoKSB7CisgICAgICAgIFN0cmluZyBzdGF0dXMgPSBXaWZpTmF0aXZlLnN0YXR1c0NvbW1hbmQoKTsKKyAgICAgICAgaWYgKHN0YXR1cyA9PSBudWxsKSB7CisgICAgICAgICAgICByZXR1cm4gbnVsbDsKKyAgICAgICAgfQorICAgICAgICAvLyBleHRyYWN0IHNzaWQgZnJvbSBhIHNlcmllcyBvZiAibmFtZT12YWx1ZSIKKyAgICAgICAgU3RyaW5nW10gbGluZXMgPSBzdGF0dXMuc3BsaXQoIlxuIik7CisgICAgICAgIGZvciAoU3RyaW5nIGxpbmUgOiBsaW5lcykgeworICAgICAgICAgICAgU3RyaW5nW10gcHJvcCA9IGxpbmUuc3BsaXQoIiAqPSAqIik7CisgICAgICAgICAgICBpZiAocHJvcC5sZW5ndGggPCAyKSBjb250aW51ZTsKKyAgICAgICAgICAgIFN0cmluZyBuYW1lID0gcHJvcFswXTsKKyAgICAgICAgICAgIFN0cmluZyB2YWx1ZSA9IHByb3BbMV07CisgICAgICAgICAgICBpZiAobmFtZS5lcXVhbHNJZ25vcmVDYXNlKCJzc2lkIikpIHJldHVybiB2YWx1ZTsKKyAgICAgICAgfQorICAgICAgICByZXR1cm4gbnVsbDsKKyAgICB9CisKKyAgICBwcml2YXRlIHZvaWQgY29uZmlndXJlTGlua1Byb3BlcnRpZXMoKSB7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBtTGlua1Byb3BlcnRpZXMuc2V0SW50ZXJmYWNlKE5ldHdvcmtJbnRlcmZhY2UuZ2V0QnlOYW1lKG1JbnRlcmZhY2VOYW1lKSk7CisgICAgICAgIH0gY2F0Y2ggKFNvY2tldEV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICBMb2cuZShUQUcsICJTb2NrZXRFeGNlcHRpb24gY3JlYXRpbmcgTmV0d29ya0ludGVyZmFjZSBmcm9tICIgKyBtSW50ZXJmYWNlTmFtZSArCisgICAgICAgICAgICAgICAgICAgICIuIGU9IiArIGUpOworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9IGNhdGNoIChOdWxsUG9pbnRlckV4Y2VwdGlvbiBlKSB7CisgICAgICAgICAgICBMb2cuZShUQUcsICJOUEUgY3JlYXRpbmcgTmV0d29ya0ludGVyZmFjZS4gZT0iICsgZSk7CisgICAgICAgICAgICByZXR1cm47CisgICAgICAgIH0KKyAgICAgICAgLy8gVE9ETyAtIGZpeCB0aGlzIGZvciB2NgorICAgICAgICBtTGlua1Byb3BlcnRpZXMuYWRkQWRkcmVzcyhOZXR3b3JrVXRpbHMuaW50VG9JbmV0QWRkcmVzcyhtRGhjcEluZm8uaXBBZGRyZXNzKSk7CisgICAgICAgIG1MaW5rUHJvcGVydGllcy5zZXRHYXRld2F5KE5ldHdvcmtVdGlscy5pbnRUb0luZXRBZGRyZXNzKG1EaGNwSW5mby5nYXRld2F5KSk7CisgICAgICAgIG1MaW5rUHJvcGVydGllcy5hZGREbnMoTmV0d29ya1V0aWxzLmludFRvSW5ldEFkZHJlc3MobURoY3BJbmZvLmRuczEpKTsKKyAgICAgICAgbUxpbmtQcm9wZXJ0aWVzLmFkZERucyhOZXR3b3JrVXRpbHMuaW50VG9JbmV0QWRkcmVzcyhtRGhjcEluZm8uZG5zMikpOworICAgICAgICAvLyBUT0RPIC0gYWRkIHByb3h5IGluZm8KKyAgICB9CisKKworICAgIHByaXZhdGUgdm9pZCBjaGVja1VzZVN0YXRpY0lwKCkgeworICAgICAgICBtVXNlU3RhdGljSXAgPSBmYWxzZTsKKyAgICAgICAgZmluYWwgQ29udGVudFJlc29sdmVyIGNyID0gbUNvbnRleHQuZ2V0Q29udGVudFJlc29sdmVyKCk7CisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBpZiAoU2V0dGluZ3MuU3lzdGVtLmdldEludChjciwgU2V0dGluZ3MuU3lzdGVtLldJRklfVVNFX1NUQVRJQ19JUCkgPT0gMCkgeworICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBjYXRjaCAoU2V0dGluZ3MuU2V0dGluZ05vdEZvdW5kRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgfQorCisgICAgICAgIHRyeSB7CisgICAgICAgICAgICBTdHJpbmcgYWRkciA9IFNldHRpbmdzLlN5c3RlbS5nZXRTdHJpbmcoY3IsIFNldHRpbmdzLlN5c3RlbS5XSUZJX1NUQVRJQ19JUCk7CisgICAgICAgICAgICBpZiAoYWRkciAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgbURoY3BJbmZvLmlwQWRkcmVzcyA9IHN0cmluZ1RvSXBBZGRyKGFkZHIpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICB9CisgICAgICAgICAgICBhZGRyID0gU2V0dGluZ3MuU3lzdGVtLmdldFN0cmluZyhjciwgU2V0dGluZ3MuU3lzdGVtLldJRklfU1RBVElDX0dBVEVXQVkpOworICAgICAgICAgICAgaWYgKGFkZHIgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIG1EaGNwSW5mby5nYXRld2F5ID0gc3RyaW5nVG9JcEFkZHIoYWRkcik7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIHJldHVybjsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIGFkZHIgPSBTZXR0aW5ncy5TeXN0ZW0uZ2V0U3RyaW5nKGNyLCBTZXR0aW5ncy5TeXN0ZW0uV0lGSV9TVEFUSUNfTkVUTUFTSyk7CisgICAgICAgICAgICBpZiAoYWRkciAhPSBudWxsKSB7CisgICAgICAgICAgICAgICAgbURoY3BJbmZvLm5ldG1hc2sgPSBzdHJpbmdUb0lwQWRkcihhZGRyKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorICAgICAgICAgICAgYWRkciA9IFNldHRpbmdzLlN5c3RlbS5nZXRTdHJpbmcoY3IsIFNldHRpbmdzLlN5c3RlbS5XSUZJX1NUQVRJQ19ETlMxKTsKKyAgICAgICAgICAgIGlmIChhZGRyICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICBtRGhjcEluZm8uZG5zMSA9IHN0cmluZ1RvSXBBZGRyKGFkZHIpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICByZXR1cm47CisgICAgICAgICAgICB9CisgICAgICAgICAgICBhZGRyID0gU2V0dGluZ3MuU3lzdGVtLmdldFN0cmluZyhjciwgU2V0dGluZ3MuU3lzdGVtLldJRklfU1RBVElDX0ROUzIpOworICAgICAgICAgICAgaWYgKGFkZHIgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgIG1EaGNwSW5mby5kbnMyID0gc3RyaW5nVG9JcEFkZHIoYWRkcik7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIG1EaGNwSW5mby5kbnMyID0gMDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfSBjYXRjaCAoVW5rbm93bkhvc3RFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgcmV0dXJuOworICAgICAgICB9CisgICAgICAgIG1Vc2VTdGF0aWNJcCA9IHRydWU7CisgICAgfQorCisgICAgcHJpdmF0ZSBzdGF0aWMgaW50IHN0cmluZ1RvSXBBZGRyKFN0cmluZyBhZGRyU3RyaW5nKSB0aHJvd3MgVW5rbm93bkhvc3RFeGNlcHRpb24geworICAgICAgICB0cnkgeworICAgICAgICAgICAgU3RyaW5nW10gcGFydHMgPSBhZGRyU3RyaW5nLnNwbGl0KCJcXC4iKTsKKyAgICAgICAgICAgIGlmIChwYXJ0cy5sZW5ndGggIT0gNCkgeworICAgICAgICAgICAgICAgIHRocm93IG5ldyBVbmtub3duSG9zdEV4Y2VwdGlvbihhZGRyU3RyaW5nKTsKKyAgICAgICAgICAgIH0KKworICAgICAgICAgICAgaW50IGEgPSBJbnRlZ2VyLnBhcnNlSW50KHBhcnRzWzBdKSAgICAgIDsKKyAgICAgICAgICAgIGludCBiID0gSW50ZWdlci5wYXJzZUludChwYXJ0c1sxXSkgPDwgIDg7CisgICAgICAgICAgICBpbnQgYyA9IEludGVnZXIucGFyc2VJbnQocGFydHNbMl0pIDw8IDE2OworICAgICAgICAgICAgaW50IGQgPSBJbnRlZ2VyLnBhcnNlSW50KHBhcnRzWzNdKSA8PCAyNDsKKworICAgICAgICAgICAgcmV0dXJuIGEgfCBiIHwgYyB8IGQ7CisgICAgICAgIH0gY2F0Y2ggKE51bWJlckZvcm1hdEV4Y2VwdGlvbiBleCkgeworICAgICAgICAgICAgdGhyb3cgbmV3IFVua25vd25Ib3N0RXhjZXB0aW9uKGFkZHJTdHJpbmcpOworICAgICAgICB9CisgICAgfQorCisgICAgcHJpdmF0ZSBpbnQgZ2V0TWF4RGhjcFJldHJpZXMoKSB7CisgICAgICAgIHJldHVybiBTZXR0aW5ncy5TZWN1cmUuZ2V0SW50KG1Db250ZXh0LmdldENvbnRlbnRSZXNvbHZlcigpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTZXR0aW5ncy5TZWN1cmUuV0lGSV9NQVhfREhDUF9SRVRSWV9DT1VOVCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgREVGQVVMVF9NQVhfREhDUF9SRVRSSUVTKTsKKyAgICB9CisKKyAgICBwcml2YXRlIGNsYXNzIFNldHRpbmdzT2JzZXJ2ZXIgZXh0ZW5kcyBDb250ZW50T2JzZXJ2ZXIgeworICAgICAgICBwdWJsaWMgU2V0dGluZ3NPYnNlcnZlcihIYW5kbGVyIGhhbmRsZXIpIHsKKyAgICAgICAgICAgIHN1cGVyKGhhbmRsZXIpOworICAgICAgICAgICAgQ29udGVudFJlc29sdmVyIGNyID0gbUNvbnRleHQuZ2V0Q29udGVudFJlc29sdmVyKCk7CisgICAgICAgICAgICBjci5yZWdpc3RlckNvbnRlbnRPYnNlcnZlcihTZXR0aW5ncy5TeXN0ZW0uZ2V0VXJpRm9yKAorICAgICAgICAgICAgICAgIFNldHRpbmdzLlN5c3RlbS5XSUZJX1VTRV9TVEFUSUNfSVApLCBmYWxzZSwgdGhpcyk7CisgICAgICAgICAgICBjci5yZWdpc3RlckNvbnRlbnRPYnNlcnZlcihTZXR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0RuczEsIG9EbnMyOworICAgICAgICAgICAgb0lwID0gb0d3ID0gb01zayA9IG9EbnMxID0gb0RuczIgPSAwOworICAgICAgICAgICAgaWYgKHdhc1N0YXRpY0lwKSB7CisgICAgICAgICAgICAgICAgb0lwID0gbURoY3BJbmZvLmlwQWRkcmVzczsKKyAgICAgICAgICAgICAgICBvR3cgPSBtRGhjcEluZm8uZ2F0ZXdheTsKKyAgICAgICAgICAgICAgICBvTXNrID0gbURoY3BJbmZvLm5ldG1hc2s7CisgICAgICAgICAgICAgICAgb0RuczEgPSBtRGhjcEluZm8uZG5zMTsKKyAgICAgICAgICAgICAgICBvRG5zMiA9IG1EaGNwSW5mby5kbnMyOworICAgICAgICAgICAgfQorICAgICAgICAgICAgY2hlY2tVc2VTdGF0aWNJcCgpOworCisgICAgICAgICAgICBpZiAobVdpZmlJbmZvLmdldFN1cHBsaWNhbnRTdGF0ZSgpID09IFN1cHBsaWNhbnRTdGF0ZS5VTklOSVRJQUxJWkVEKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuOworICAgICAgICAgICAgfQorCisgICAgICAgICAgICBib29sZWFuIGNoYW5nZWQgPQorICAgICAgICAgICAgICAgICh3YXNTdGF0aWNJcCAhPSBtVXNlU3RhdGljSXApIHx8CisgICAgICAgICAgICAgICAgICAgICh3YXNTdGF0aWNJcCAmJiAoCisgICAgICAgICAgICAgICAgICAgICAgICBvSXAgICAhPSBtRGhjcEluZm8uaXBBZGRyZXNzIHx8CisgICAgICAgICAgICAgICAgICAgICAgICBvR3cgICAhPSBtRGhjcEluZm8uZ2F0ZXdheSB8fAorICAgICAgICAgICAgICAgICAgICAgICAgb01zayAgIT0gbURoY3BJbmZvLm5ldG1hc2sgfHwKKyAgICAgICAgICAgICAgICAgICAgICAgIG9EbnMxICE9IG1EaGNwSW5mby5kbnMxIHx8CisgICAgICAgICAgICAgICAgICAgICAgICBvRG5zMiAhPSBtRGhjcEluZm8uZG5zMikpOworCisgICAgICAgICAgICBpZiAoY2hh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FsCisgICAgICAgICAgICAgKiBsZXZlbC4KKyAgICAgICAgICAgICAqLworICAgICAgICAgICAgLy8gVE9ETzogVGhlIHNlY29uZCBhcmcgdG8gdGhlIGNhbGwgYmVsb3cgbmVlZHMgdG8gYmUgYSBzeW1ib2wgc29tZXdoZXJlLCBidXQKKyAgICAgICAgICAgIC8vIGl0J3MgYWN0dWFsbHkgdGhlIHNpemUgb2YgYW4gYXJyYXkgb2YgaWNvbnMgdGhhdCdzIHByaXZhdGUKKyAgICAgICAgICAgIC8vIHRvIFN0YXR1c0JhciBQb2xpY3kuCisgICAgICAgICAgICBpbnQgbmV3U2lnbmFsTGV2ZWwgPSBXaWZpTWFuYWdlci5jYWxjdWxhdGVTaWduYWxMZXZlbChuZXdSc3NpLCA0KTsKKyAgICAgICAgICAgIGlmIChuZXdTaWduYWxMZXZlbCAhPSBtTGFzdFNpZ25hbExldmVsKSB7CisgICAgICAgICAgICAgICAgc2VuZFJzc2lDaGFuZ2VCcm9hZGNhc3QobmV3UnNzaSk7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBtTGFzdFNpZ25hbExldmVsID0gbmV3U2lnbmFsTGV2ZWw7CisgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICBtV2lmaUluZm8uc2V0UnNzaSgtMjAwKTsKKyAgICAgICAgfQorICAgICAgICBpbnQgbmV3TGlua1NwZWVkID0gV2lmaU5hdGl2ZS5nZXRMaW5rU3BlZWRDb21tYW5kKCk7CisgICAgICAgIGlmIChuZXdMaW5rU3BlZWQgIT0gLTEpIHsKKyAgICAgICAgICAgIG1XaWZpSW5mby5zZXRMaW5rU3BlZWQobmV3TGlua1NwZWVkKTsKKyAgICAgICAgfQorICAgIH0KKworICAgIC8qKgorICAgICAqIFJlc2V0cyB0aGUgV2ktRmkgQ29ubmVjdGlvbnMgYnkgY2xlYXJpbmcgYW55IHN0YXRlLCByZXNldHRpbmcgYW55IHNvY2tldHMKKyAgICAgKiB1c2luZyB0aGUgaW50ZXJmYWNlLCBzdG9wcGluZyBESENQICYgZGlzYWJsaW5nIGludGVyZmFjZQorICAgICAqLworICAgIHByaXZhdGUgdm9pZCBoYW5kbGVOZXR3b3JrRGlzY29ubmVjdCgpIHsKKyAgICAgICAgTG9nLmQoVEFHLCAiUmVzZXQgY29ubmVjdGlvbnMgYW5kIHN0b3BwaW5nIERIQ1AiKTsKKworICAgICAgICAvKgorICAgICAgICAgKiBSZXNldCBjb25uZWN0aW9ucyAmIHN0b3AgREhDUAorICAgICAgICAgKi8KKyAgICAgICAgTmV0d29ya1V0aWxzLnJlc2V0Q29ubmVjdGlvbnMobUludGVyZmFjZU5hbWUpOworCisgICAgICAgIGlmICghTmV0d29ya1V0aWxzLnN0b3BEaGNwKG1JbnRlcmZhY2VOYW1lKSkgeworICAgICAgICAgICAgTG9nLmUoVEFHLCAiQ291bGQgbm90IHN0b3AgREhDUCIpOworICAgICAgICB9CisKKyAgICAgICAgLyogRGlzYWJsZSBpbnRlcmZhY2UgKi8KKyAgICAgICAgTmV0d29ya1V0aWxzLmRpc2FibGVJbnRlcmZhY2UobUludGVyZmFjZU5hbWUpOworCisgICAgICAgIC8qIHNlbmQgZXZlbnQgdG8gQ00gJiBuZXR3b3JrIGNoYW5nZSBicm9hZGNhc3QgKi8KKyAgICAgICAgc2V0RGV0YWlsZWRTdGF0ZShEZXRhaWxlZFN0YXRlLkRJU0NPTk5FQ1RFRCk7CisgICAgICAgIHNlbmROZXR3b3JrU3RhdGVDaGFuZ2VCcm9hZGNhc3QobUxhc3RCc3NpZCk7CisKKyAgICAgICAgLyogUmVzZXQgZGF0YSBzdHJ1Y3R1cmVzICovCisgICAgICAgIG1XaWZpSW5mby5zZXRJcEFkZHJlc3MoMCk7CisgICAgICAgIG1XaWZpSW5mby5zZXRCU1NJRChudWxsKTsKKyAgICAgICAgbVdpZmlJbmZvLnNldFNTSUQobnVsbCk7CisgICAgICAgIG1XaWZpSW5mby5zZXROZXR3b3JrSWQoLTEpOworCisgICAgICAgIC8qIENsZWFyIG5ldHdvcmsgcHJvcGVydGllcyAqLworICAgICAgICBtTGlua1Byb3BlcnRpZXMuY2xlYXIoKTsKKworICAgICAgICBtTGFzdEJzc2lkPSBudWxsOworICAgICAgICBtTGFzdE5ldHdvcmtJZCA9IC0xOworCisgICAgfQorCisKKyAgICAvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisgICAgICogTm90aWZpY2F0aW9ucyBmcm9tIFdpZmlNb25pdG9yCisgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLworCisgICAgLyoqCisgICAgICogQSBzdHJ1Y3R1cmUgZm9yIHN1cHBseWluZyBpbmZvcm1hdGlvbiBhYm91dCBhIHN1cHBsaWNhbnQgc3RhdGUKKyAgICAgKiBjaGFuZ2UgaW4gdGhlIFNUQVRFX0NIQU5HRSBldmVudCBtZXNzYWdlIHRoYXQgY29tZXMgZnJvbSB0aGUKKyAgICAgKiBXaWZpTW9uaXRvcgorICAgICAqIHRocmVhZC4KKyAgICAgKi8KKyAgICBwcml2YXRlIHN0YXRpYyBjbGFzcyBTdGF0ZUNoYW5nZVJlc3VsdCB7CisgICAgICAgIFN0YXRlQ2hhbmdlUmVzdWx0KGludCBuZXR3b3JrSWQsIFN0cmluZyBCU1NJRCwgT2JqZWN0IHN0YXRlKSB7CisgICAgICAgICAgICB0aGlzLnN0YXRlID0gc3RhdGU7CisgICAgICAgICAgICB0aGlzLkJTU0lEID0gQlNTSUQ7CisgICAgICAgICAgICB0aGlzLm5ldHdvcmtJZCA9IG5ldHdvcmtJZDsKKyAgICAgICAgfQorICAgICAgICBpbnQgbmV0d29ya0lkOworICAgICAgICBTdHJpbmcgQlNTSUQ7CisgICAgICAgIE9iamVjdCBzdGF0ZTsKKyAgICB9CisKKyAgICAvKioKKyAgICAgKiBTZW5kIHRoZSB0cmFja2VyIGEgbm90aWZpY2F0aW9uIHRoYXQgYSB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CkgeworICAgICAgICBzZW5kTWVzc2FnZShEUklWRVJfU1RBUlRfRVZFTlQpOworICAgIH0KKworICAgIHZvaWQgbm90aWZ5RHJpdmVyU3RvcHBlZCgpIHsKKyAgICAgICAgc2VuZE1lc3NhZ2UoRFJJVkVSX1NUT1BfRVZFTlQpOworICAgIH0KKworICAgIHZvaWQgbm90aWZ5RHJpdmVySHVuZygpIHsKKyAgICAgICAgc2V0V2lmaUVuYWJsZWQoZmFsc2UpOworICAgICAgICBzZXRXaWZpRW5hYmxlZCh0cnVlKTsKKyAgICB9CisKKworICAgIC8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgorICAgICAqIEhTTSBzdGF0ZXMKKyAgICAgKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KKworICAgIGNsYXNzIERlZmF1bHRTdGF0ZSBleHRlbmRzIEhpZXJhcmNoaWNhbFN0YXRlIHsKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBib29sZWFuIHByb2Nlc3NNZXNzYWdlKE1lc3NhZ2UgbWVzc2FnZSkgeworICAgICAgICAgICAgaWYgKERCRykgTG9nLmQoVEFHLCBnZXROYW1lKCkgKyBtZXNzYWdlLnRvU3RyaW5nKCkgKyAiXG4iKTsKKyAgICAgICAgICAgIFN5bmNQYXJhbXMgc3luY1BhcmFtczsKKyAgICAgICAgICAgIHN3aXRjaCAobWVzc2FnZS53aGF0KSB7CisgICAgICAgICAgICAgICAgICAgIC8qIFN5bmNocm9ub3VzIGNhbGwgcmV0dXJucyAqLworICAgICAgICAgICAgICAgIGNhc2UgQ01EX1BJTkdfU1VQUExJQ0FOVDoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9SRU1PVkVfTkVUV09SSzoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9FTkFCTEVfTkVUV09SSzoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9ESVNBQkxFX05FVFdPUks6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfQUREX09SX1VQREFURV9ORVRXT1JLOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX0dFVF9SU1NJOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX0dFVF9SU1NJX0FQUFJPWDoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9HRVRfTElOS19TUEVFRDoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9HRVRfTUFDX0FERFI6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU0FWRV9DT05GSUc6CisgICAgICAgICAgICAgICAgICAgIHN5bmNQYXJhbXMgPSAoU3luY1BhcmFtcykgbWVzc2FnZS5vYmo7CisgICAgICAgICAgICAgICAgICAgIHN5bmNQYXJhbXMubVN5bmNSZXR1cm4uYm9vbFZhbHVlID0gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgIHN5bmNQYXJhbXMubVN5bmNSZXR1cm4uaW50VmFsdWUgPSAtMTsKKyAgICAgICAgICAgICAgICAgICAgc3luY1BhcmFtcy5tU3luY1JldHVybi5zdHJpbmdWYWx1ZSA9IG51bGw7CisgICAgICAgICAgICAgICAgICAgIG5vdGlmeU9uTXNnT2JqZWN0KG1lc3NhZ2UpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9FTkFCTEVfUlNTSV9QT0xMOgorICAgICAgICAgICAgICAgICAgICBtRW5hYmxlUnNzaVBvbGxpbmcgPSAobWVzc2FnZS5hcmcxID09IDEpOworICAgICAgICAgICAgICAgICAgICBtU3VwcGxpY2FudFN0YXRlVHJhY2tlci5zZW5kTWVzc2FnZShDTURfRU5BQkxFX1JTU0lfUE9MTCk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAvKiBEaXNjYXJkICovCisgICAgICAgICAgICAgICAgY2FzZSBDTURfTE9BRF9EUklWRVI6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfVU5MT0FEX0RSSVZFUjoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVEFSVF9TVVBQTElDQU5UOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NUT1BfU1VQUExJQ0FOVDoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVEFSVF9EUklWRVI6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU1RPUF9EUklWRVI6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU1RBUlRfQVA6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU1RPUF9BUDoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVEFSVF9TQ0FOOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX0RJU0NPTk5FQ1Q6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfUkVDT05ORUNUOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1JFQVNTT0NJQVRFOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1JFQ09ORklHVVJFX0lQOgorICAgICAgICAgICAgICAgIGNhc2UgU1VQX0NPTk5FQ1RJT05fRVZFTlQ6CisgICAgICAgICAgICAgICAgY2FzZSBTVVBfRElTQ09OTkVDVElPTl9FVkVOVDoKKyAgICAgICAgICAgICAgICBjYXNlIERSSVZFUl9TVEFSVF9FVkVOVDoKKyAgICAgICAgICAgICAgICBjYXNlIERSSVZFUl9TVE9QX0VWRU5UOgorICAgICAgICAgICAgICAgIGNhc2UgTkVUV09SS19DT05ORUNUSU9OX0VWRU5UOgorICAgICAgICAgICAgICAgIGNhc2UgTkVUV09SS19ESVNDT05ORUNUSU9OX0VWRU5UOgorICAgICAgICAgICAgICAgIGNhc2UgU0NBTl9SRVNVTFRTX0VWRU5UOgorICAgICAgICAgICAgICAgIGNhc2UgU1VQUExJQ0FOVF9TVEFURV9DSEFOR0VfRVZFTlQ6CisgICAgICAgICAgICAgICAgY2FzZSBQQVNTV09SRF9NQVlfQkVfSU5DT1JSRUNUX0VWRU5UOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX0JMQUNLTElTVF9ORVRXT1JLOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX0NMRUFSX0JMQUNLTElTVDoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TRVRfU0NBTl9NT0RFOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NFVF9TQ0FOX1RZUEU6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU0VUX1BPV0VSX01PREU6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU0VUX0JMVUVUT09USF9DT0VYSVNURU5DRToKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TRVRfQkxVRVRPT1RIX1NDQU5fTU9ERToKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TRVRfTlVNX0FMTE9XRURfQ0hBTk5FTFM6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfUkVRVUVTVF9DTV9XQUtFTE9DSzoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9DT05ORUNUX05FVFdPUks6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU0FWRV9ORVRXT1JLOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX0ZPUkdFVF9ORVRXT1JLOgorICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgICAgICBMb2cuZShUQUcsICJFcnJvciEgdW5oYW5kbGVkIG1lc3NhZ2UiICsgbWVzc2FnZSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIEhBTkRMRUQ7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBjbGFzcyBJbml0aWFsU3RhdGUgZXh0ZW5kcyBIaWVyYXJjaGljYWxTdGF0ZSB7CisgICAgICAgIEBPdmVycmlkZQorICAgICAgICAvL1RPRE86IGNvdWxkIG1vdmUgbG9nZ2luZyBpbnRvIGEgY29tbW9uIGNsYXNzCisgICAgICAgIHB1YmxpYyB2b2lkIGVudGVyKCkgeworICAgICAgICAgICAgaWYgKERCRykgTG9nLmQoVEFHLCBnZXROYW1lKCkgKyAiXG4iKTsKKyAgICAgICAgICAgIC8vIFszMS04XSBSZXNlcnZlZCBmb3IgZnV0dXJlIHVzZQorICAgICAgICAgICAgLy8gWzcgLSAwXSBIU00gc3RhdGUgY2hhbmdlCisgICAgICAgICAgICAvLyA1MDAyMSB3aWZpX3N0YXRlX2NoYW5nZWQgKGN1c3RvbXwxfDUpCisgICAgICAgICAgICBFdmVudExvZy53cml0ZUV2ZW50KEVWRU5UTE9HX1dJRklfU1RBVEVfQ0hBTkdFRCwgZ2V0TmFtZSgpKTsKKworICAgICAgICAgICAgaWYgKFdpZmlOYXRpdmUuaXNEcml2ZXJMb2FkZWQoKSkgeworICAgICAgICAgICAgICAgIHRyYW5zaXRpb25UbyhtRHJpdmVyTG9hZGVkU3RhdGUpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgZWxzZSB7CisgICAgICAgICAgICAgICAgdHJhbnNpdGlvblRvKG1Ecml2ZXJVbmxvYWRlZFN0YXRlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIGNsYXNzIERyaXZlckxvYWRpbmdTdGF0ZSBleHRlbmRzIEhpZXJhcmNoaWNhbFN0YXRlIHsKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIGVudGVyKCkgeworICAgICAgICAgICAgaWYgKERCRykgTG9nLmQoVEFHLCBnZXROYW1lKCkgKyAiXG4iKTsKKyAgICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoRVZFTlRMT0dfV0lGSV9TVEFURV9DSEFOR0VELCBnZXROYW1lKCkpOworCisgICAgICAgICAgICBmaW5hbCBNZXNzYWdlIG1lc3NhZ2UgPSBuZXcgTWVzc2FnZSgpOworICAgICAgICAgICAgbWVzc2FnZS5jb3B5RnJvbShnZXRDdXJyZW50TWVzc2FnZSgpKTsKKyAgICAgICAgICAgIC8qIFRPRE86IGFkZCBhIHRpbWVvdXQgdG8gZmFpbCB3aGVuIGRyaXZlciBsb2FkIGlzIGh1bmcuCisgICAgICAgICAgICAgKiBTaW1pbGFybHkgZm9yIGRyaXZlciB1bmxvYWQuCisgICAgICAgICAgICAgKi8KKyAgICAgICAgICAgIG5ldyBUaHJlYWQobmV3IFJ1bm5hYmxlKCkgeworICAgICAgICAgICAgICAgIHB1YmxpYyB2b2lkIHJ1bigpIHsKKyAgICAgICAgICAgICAgICAgICAgc1dha2VMb2NrLmFjcXVpcmUoKTsKKyAgICAgICAgICAgICAgICAgICAgLy9lbmFibGluZyBzdGF0ZQorICAgICAgICAgICAgICAgICAgICBzd2l0Y2gobWVzc2FnZS5hcmcxKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFdJRklfU1RBVEVfRU5BQkxJTkc6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0V2lmaVN0YXRlKFdJRklfU1RBVEVfRU5BQkxJTkcpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBXSUZJX0FQX1NUQVRFX0VOQUJMSU5HOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldFdpZmlBcFN0YXRlKFdJRklfQVBfU1RBVEVfRU5BQkxJTkcpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgICAgaWYoV2lmaU5hdGl2ZS5sb2FkRHJpdmVyKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIExvZy5kKFRBRywgIkRyaXZlciBsb2FkIHN1Y2Nlc3NmdWwiKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHNlbmRNZXNzYWdlKENNRF9MT0FEX0RSSVZFUl9TVUNDRVNTKTsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIExvZy5lKFRBRywgIkZhaWxlZCB0byBsb2FkIGRyaXZlciEiKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaChtZXNzYWdlLmFyZzEpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFdJRklfU1RBVEVfRU5BQkxJTkc6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldFdpZmlTdGF0ZShXSUZJX1NUQVRFX1VOS05PV04pOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFdJRklfQVBfU1RBVEVfRU5BQkxJTkc6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldFdpZmlBcFN0YXRlKFdJRklfQVBfU1RBVEVfRkFJTEVEKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBzZW5kTWVzc2FnZShDTURfTE9BRF9EUklWRVJfRkFJTFVSRSk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgc1dha2VMb2NrLnJlbGVhc2UoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9KS5zdGFydCgpOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBib29sZWFuIHByb2Nlc3NNZXNzYWdlKE1lc3NhZ2UgbWVzc2FnZSkgeworICAgICAgICAgICAgaWYgKERCRykgTG9nLmQoVEFHLCBnZXROYW1lKCkgKyBtZXNzYWdlLnRvU3RyaW5nKCkgKyAiXG4iKTsKKyAgICAgICAgICAgIHN3aXRjaCAobWVzc2FnZS53aGF0KSB7CisgICAgICAgICAgICAgICAgY2FzZSBDTURfTE9BRF9EUklWRVJfU1VDQ0VTUzoKKyAgICAgICAgICAgICAgICAgICAgdHJhbnNpdGlvblRvKG1Ecml2ZXJMb2FkZWRTdGF0ZSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgQ01EX0xPQURfRFJJVkVSX0ZBSUxVUkU6CisgICAgICAgICAgICAgICAgICAgIHRyYW5zaXRpb25UbyhtRHJpdmVyRmFpbGVkU3RhdGUpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9MT0FEX0RSSVZFUjoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9VTkxPQURfRFJJVkVSOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NUQVJUX1NVUFBMSUNBTlQ6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU1RPUF9TVVBQTElDQU5UOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NUQVJUX0FQOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NUT1BfQVA6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU1RBUlRfRFJJVkVSOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NUT1BfRFJJVkVSOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NFVF9TQ0FOX01PREU6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU0VUX1NDQU5fVFlQRToKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TRVRfUE9XRVJfTU9ERToKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TRVRfQkxVRVRPT1RIX0NPRVhJU1RFTkNFOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NFVF9CTFVFVE9PVEhfU0NBTl9NT0RFOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NFVF9OVU1fQUxMT1dFRF9DSEFOTkVMUzoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVEFSVF9QQUNLRVRfRklMVEVSSU5HOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NUT1BfUEFDS0VUX0ZJTFRFUklORzoKKyAgICAgICAgICAgICAgICAgICAgZGVmZXJNZXNzYWdlKG1lc3NhZ2UpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgICAgICByZXR1cm4gTk9UX0hBTkRMRUQ7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBFdmVudExvZy53cml0ZUV2ZW50KEVWRU5UTE9HX1dJRklfRVZFTlRfSEFORExFRCwgbWVzc2FnZS53aGF0KTsKKyAgICAgICAgICAgIHJldHVybiBIQU5ETEVEOworICAgICAgICB9CisgICAgfQorCisgICAgY2xhc3MgRHJpdmVyTG9hZGVkU3RhdGUgZXh0ZW5kcyBIaWVyYXJjaGljYWxTdGF0ZSB7CisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgdm9pZCBlbnRlcigpIHsKKyAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKFRBRywgZ2V0TmFtZSgpICsgIlxuIik7CisgICAgICAgICAgICBFdmVudExvZy53cml0ZUV2ZW50KEVWRU5UTE9HX1dJRklfU1RBVEVfQ0hBTkdFRCwgZ2V0TmFtZSgpKTsKKyAgICAgICAgfQorICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIGJvb2xlYW4gcHJvY2Vzc01lc3NhZ2UoTWVzc2FnZSBtZXNzYWdlKSB7CisgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsIGdldE5hbWUoKSArIG1lc3NhZ2UudG9TdHJpbmcoKSArICJcbiIpOworICAgICAgICAgICAgc3dpdGNoKG1lc3NhZ2Uud2hhdCkgeworICAgICAgICAgICAgICAgIGNhc2UgQ01EX1VOTE9BRF9EUklWRVI6CisgICAgICAgICAgICAgICAgICAgIHRyYW5zaXRpb25UbyhtRHJpdmVyVW5sb2FkaW5nU3RhdGUpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVEFSVF9TVVBQTElDQU5UOgorICAgICAgICAgICAgICAgICAgICBpZihXaWZpTmF0aXZlLnN0YXJ0U3VwcGxpY2FudCgpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJTdXBwbGljYW50IHN0YXJ0IHN1Y2Nlc3NmdWwiKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1XaWZpTW9uaXRvci5zdGFydE1vbml0b3JpbmcoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHNldFdpZmlTdGF0ZShXSUZJX1NUQVRFX0VOQUJMRUQpOworICAgICAgICAgICAgICAgICAgICAgICAgdHJhbnNpdGlvblRvKG1XYWl0Rm9yU3VwU3RhdGUpOworICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgTG9nLmUoVEFHLCAiRmFpbGVkIHRvIHN0YXJ0IHN1cHBsaWNhbnQhIik7CisgICAgICAgICAgICAgICAgICAgICAgICBzZW5kTWVzc2FnZShvYnRhaW5NZXNzYWdlKENNRF9VTkxPQURfRFJJVkVSLCBXSUZJX1NUQVRFX1VOS05PV04sIDApKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVEFSVF9BUDoKKyAgICAgICAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG53U2VydmljZS5zdGFydEFjY2Vzc1BvaW50KChXaWZpQ29uZmlndXJhdGlvbikgbWVzc2FnZS5vYmosCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtSW50ZXJmYWNlTmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNPRlRBUF9JRkFDRSk7CisgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2goRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIExvZy5lKFRBRywgIkV4Y2VwdGlvbiBpbiBzdGFydEFjY2Vzc1BvaW50KCkiKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHNlbmRNZXNzYWdlKG9idGFpbk1lc3NhZ2UoQ01EX1VOTE9BRF9EUklWRVIsIFdJRklfQVBfU1RBVEVfRkFJTEVELCAwKSk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJTb2Z0IEFQIHN0YXJ0IHN1Y2Nlc3NmdWwiKTsKKyAgICAgICAgICAgICAgICAgICAgc2V0V2lmaUFwU3RhdGUoV0lGSV9BUF9TVEFURV9FTkFCTEVEKTsKKyAgICAgICAgICAgICAgICAgICAgdHJhbnNpdGlvblRvKG1Tb2Z0QXBTdGFydGVkU3RhdGUpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgICAgICByZXR1cm4gTk9UX0hBTkRMRUQ7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBFdmVudExvZy53cml0ZUV2ZW50KEVWRU5UTE9HX1dJRklfRVZFTlRfSEFORExFRCwgbWVzc2FnZS53aGF0KTsKKyAgICAgICAgICAgIHJldHVybiBIQU5ETEVEOworICAgICAgICB9CisgICAgfQorCisgICAgY2xhc3MgRHJpdmVyVW5sb2FkaW5nU3RhdGUgZXh0ZW5kcyBIaWVyYXJjaGljYWxTdGF0ZSB7CisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgdm9pZCBlbnRlcigpIHsKKyAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKFRBRywgZ2V0TmFtZSgpICsgIlxuIik7CisgICAgICAgICAgICBFdmVudExvZy53cml0ZUV2ZW50KEVWRU5UTE9HX1dJRklfU1RBVEVfQ0hBTkdFRCwgZ2V0TmFtZSgpKTsKKworICAgICAgICAgICAgZmluYWwgTWVzc2FnZSBtZXNzYWdlID0gbmV3IE1lc3NhZ2UoKTsKKyAgICAgICAgICAgIG1lc3NhZ2UuY29weUZyb20oZ2V0Q3VycmVudE1lc3NhZ2UoKSk7CisgICAgICAgICAgICBuZXcgVGhyZWFkKG5ldyBSdW5uYWJsZSgpIHsKKyAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgICAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKFRBRywgZ2V0TmFtZSgpICsgbWVzc2FnZS50b1N0cmluZygpICsgIlxuIik7CisgICAgICAgICAgICAgICAgICAgIHNXYWtlTG9jay5hY3F1aXJlKCk7CisgICAgICAgICAgICAgICAgICAgIGlmKFdpZmlOYXRpdmUudW5sb2FkRHJpdmVyKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIExvZy5kKFRBRywgIkRyaXZlciB1bmxvYWQgc3VjY2Vzc2Z1bCIpOworICAgICAgICAgICAgICAgICAgICAgICAgc2VuZE1lc3NhZ2UoQ01EX1VOTE9BRF9EUklWRVJfU1VDQ0VTUyk7CisKKyAgICAgICAgICAgICAgICAgICAgICAgIHN3aXRjaChtZXNzYWdlLmFyZzEpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFdJRklfU1RBVEVfRElTQUJMRUQ6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBXSUZJX1NUQVRFX1VOS05PV046CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldFdpZmlTdGF0ZShtZXNzYWdlLmFyZzEpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFdJRklfQVBfU1RBVEVfRElTQUJMRUQ6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBXSUZJX0FQX1NUQVRFX0ZBSUxFRDoKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0V2lmaUFwU3RhdGUobWVzc2FnZS5hcmcxKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICBMb2cuZShUQUcsICJGYWlsZWQgdG8gdW5sb2FkIGRyaXZlciEiKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHNlbmRNZXNzYWdlKENNRF9VTkxPQURfRFJJVkVSX0ZBSUxVUkUpOworCisgICAgICAgICAgICAgICAgICAgICAgICBzd2l0Y2gobWVzc2FnZS5hcmcxKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBXSUZJX1NUQVRFX0RJU0FCTEVEOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgV0lGSV9TVEFURV9VTktOT1dOOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZXRXaWZpU3RhdGUoV0lGSV9TVEFURV9VTktOT1dOKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBXSUZJX0FQX1NUQVRFX0RJU0FCTEVEOgorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgV0lGSV9BUF9TVEFURV9GQUlMRUQ6CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldFdpZmlBcFN0YXRlKFdJRklfQVBfU1RBVEVfRkFJTEVEKTsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgc1dha2VMb2NrLnJlbGVhc2UoKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9KS5zdGFydCgpOworICAgICAgICB9CisKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBib29sZWFuIHByb2Nlc3NNZXNzYWdlKE1lc3NhZ2UgbWVzc2FnZSkgeworICAgICAgICAgICAgaWYgKERCRykgTG9nLmQoVEFHLCBnZXROYW1lKCkgKyBtZXNzYWdlLnRvU3RyaW5nKCkgKyAiXG4iKTsKKyAgICAgICAgICAgIHN3aXRjaCAobWVzc2FnZS53aGF0KSB7CisgICAgICAgICAgICAgICAgY2FzZSBDTURfVU5MT0FEX0RSSVZFUl9TVUNDRVNTOgorICAgICAgICAgICAgICAgICAgICB0cmFuc2l0aW9uVG8obURyaXZlclVubG9hZGVkU3RhdGUpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9VTkxPQURfRFJJVkVSX0ZBSUxVUkU6CisgICAgICAgICAgICAgICAgICAgIHRyYW5zaXRpb25UbyhtRHJpdmVyRmFpbGVkU3RhdGUpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9MT0FEX0RSSVZFUjoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9VTkxPQURfRFJJVkVSOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NUQVJUX1NVUFBMSUNBTlQ6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU1RPUF9TVVBQTElDQU5UOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NUQVJUX0FQOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NUT1BfQVA6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU1RBUlRfRFJJVkVSOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NUT1BfRFJJVkVSOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NFVF9TQ0FOX01PREU6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU0VUX1NDQU5fVFlQRToKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TRVRfUE9XRVJfTU9ERToKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TRVRfQkxVRVRPT1RIX0NPRVhJU1RFTkNFOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NFVF9CTFVFVE9PVEhfU0NBTl9NT0RFOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NFVF9OVU1fQUxMT1dFRF9DSEFOTkVMUzoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVEFSVF9QQUNLRVRfRklMVEVSSU5HOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NUT1BfUEFDS0VUX0ZJTFRFUklORzoKKyAgICAgICAgICAgICAgICAgICAgZGVmZXJNZXNzYWdlKG1lc3NhZ2UpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgICAgICByZXR1cm4gTk9UX0hBTkRMRUQ7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBFdmVudExvZy53cml0ZUV2ZW50KEVWRU5UTE9HX1dJRklfRVZFTlRfSEFORExFRCwgbWVzc2FnZS53aGF0KTsKKyAgICAgICAgICAgIHJldHVybiBIQU5ETEVEOworICAgICAgICB9CisgICAgfQorCisgICAgY2xhc3MgRHJpdmVyVW5sb2FkZWRTdGF0ZSBleHRlbmRzIEhpZXJhcmNoaWNhbFN0YXRlIHsKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIGVudGVyKCkgeworICAgICAgICAgICAgaWYgKERCRykgTG9nLmQoVEFHLCBnZXROYW1lKCkgKyAiXG4iKTsKKyAgICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoRVZFTlRMT0dfV0lGSV9TVEFURV9DSEFOR0VELCBnZXROYW1lKCkpOworICAgICAgICB9CisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgYm9vbGVhbiBwcm9jZXNzTWVzc2FnZShNZXNzYWdlIG1lc3NhZ2UpIHsKKyAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKFRBRywgZ2V0TmFtZSgpICsgbWVzc2FnZS50b1N0cmluZygpICsgIlxuIik7CisgICAgICAgICAgICBzd2l0Y2ggKG1lc3NhZ2Uud2hhdCkgeworICAgICAgICAgICAgICAgIGNhc2UgQ01EX0xPQURfRFJJVkVSOgorICAgICAgICAgICAgICAgICAgICB0cmFuc2l0aW9uVG8obURyaXZlckxvYWRpbmdTdGF0ZSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBOT1RfSEFORExFRDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoRVZFTlRMT0dfV0lGSV9FVkVOVF9IQU5ETEVELCBtZXNzYWdlLndoYXQpOworICAgICAgICAgICAgcmV0dXJuIEhBTkRMRUQ7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBjbGFzcyBEcml2ZXJGYWlsZWRTdGF0ZSBleHRlbmRzIEhpZXJhcmNoaWNhbFN0YXRlIHsKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIGVudGVyKCkgeworICAgICAgICAgICAgTG9nLmUoVEFHLCBnZXROYW1lKCkgKyAiXG4iKTsKKyAgICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoRVZFTlRMT0dfV0lGSV9TVEFURV9DSEFOR0VELCBnZXROYW1lKCkpOworICAgICAgICB9CisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgYm9vbGVhbiBwcm9jZXNzTWVzc2FnZShNZXNzYWdlIG1lc3NhZ2UpIHsKKyAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKFRBRywgZ2V0TmFtZSgpICsgbWVzc2FnZS50b1N0cmluZygpICsgIlxuIik7CisgICAgICAgICAgICByZXR1cm4gTk9UX0hBTkRMRUQ7CisgICAgICAgIH0KKyAgICB9CisKKworICAgIGNsYXNzIFdhaXRGb3JTdXBTdGF0ZSBleHRlbmRzIEhpZXJhcmNoaWNhbFN0YXRlIHsKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIGVudGVyKCkgeworICAgICAgICAgICAgaWYgKERCRykgTG9nLmQoVEFHLCBnZXROYW1lKCkgKyAiXG4iKTsKKyAgICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoRVZFTlRMT0dfV0lGSV9TVEFURV9DSEFOR0VELCBnZXROYW1lKCkpOworICAgICAgICB9CisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgYm9vbGVhbiBwcm9jZXNzTWVzc2FnZShNZXNzYWdlIG1lc3NhZ2UpIHsKKyAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKFRBRywgZ2V0TmFtZSgpICsgbWVzc2FnZS50b1N0cmluZygpICsgIlxuIik7CisgICAgICAgICAgICBzd2l0Y2gobWVzc2FnZS53aGF0KSB7CisgICAgICAgICAgICAgICAgY2FzZSBTVVBfQ09OTkVDVElPTl9FVkVOVDoKKyAgICAgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAiU3VwcGxpY2FudCBjb25uZWN0aW9uIGVzdGFibGlzaGVkIik7CisgICAgICAgICAgICAgICAgICAgIG1TdXBwbGljYW50U3RhdGVUcmFja2VyLnJlc2V0U3VwcGxpY2FudFN0YXRlKCk7CisgICAgICAgICAgICAgICAgICAgIC8qIEluaXRpYWxpemUgZGF0YSBzdHJ1Y3R1cmVzICovCisgICAgICAgICAgICAgICAgICAgIG1MYXN0QnNzaWQgPSBudWxsOworICAgICAgICAgICAgICAgICAgICBtTGFzdE5ldHdvcmtJZCA9IC0xOworICAgICAgICAgICAgICAgICAgICBtTGFzdFNpZ25hbExldmVsID0gLTE7CisKKyAgICAgICAgICAgICAgICAgICAgbVdpZmlJbmZvLnNldE1hY0FkZHJlc3MoV2lmaU5hdGl2ZS5nZXRNYWNBZGRyZXNzQ29tbWFuZCgpKTsKKworICAgICAgICAgICAgICAgICAgICBXaWZpQ29uZmlnU3RvcmUuaW5pdGlhbGl6ZShtQ29udGV4dCk7CisKKyAgICAgICAgICAgICAgICAgICAgLy9UT0RPOiBpbml0aWFsaXplIGFuZCBmaXggbXVsdGljYXN0IGZpbHRlcmluZworICAgICAgICAgICAgICAgICAgICAvL21XTS5pbml0aWFsaXplTXVsdGljYXN0RmlsdGVyaW5nKCk7CisKKyAgICAgICAgICAgICAgICAgICAgaWYgKG1CbHVldG9vdGhBMmRwID09IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1CbHVldG9vdGhBMmRwID0gbmV3IEJsdWV0b290aEEyZHAobUNvbnRleHQpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGNoZWNrSXNCbHVldG9vdGhQbGF5aW5nKCk7CisKKyAgICAgICAgICAgICAgICAgICAgY2hlY2tVc2VTdGF0aWNJcCgpOworICAgICAgICAgICAgICAgICAgICBzZW5kU3VwcGxpY2FudENvbm5lY3Rpb25DaGFuZ2VkQnJvYWRjYXN0KHRydWUpOworICAgICAgICAgICAgICAgICAgICB0cmFuc2l0aW9uVG8obURyaXZlclN1cFJlYWR5U3RhdGUpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVE9QX1NVUFBMSUNBTlQ6CisgICAgICAgICAgICAgICAgICAgIExvZy5kKFRBRywgIlN0b3Agc3VwcGxpY2FudCByZWNlaXZlZCIpOworICAgICAgICAgICAgICAgICAgICBXaWZpTmF0aXZlLnN0b3BTdXBwbGljYW50KCk7CisgICAgICAgICAgICAgICAgICAgIHRyYW5zaXRpb25UbyhtRHJpdmVyTG9hZGVkU3RhdGUpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgLyogRmFpbCBzb2Z0IGFwIHdoZW4gd2FpdGluZyBmb3Igc3VwcGxpY2FudCBzdGFydCAqLworICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NUQVJUX0FQOgorICAgICAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJGYWlsZWQgdG8gc3RhcnQgc29mdCBBUCB3aXRoIGEgcnVubmluZyBzdXBwbGljYW50Iik7CisgICAgICAgICAgICAgICAgICAgIHNldFdpZmlBcFN0YXRlKFdJRklfQVBfU1RBVEVfRkFJTEVEKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU1RBUlRfRFJJVkVSOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NUT1BfRFJJVkVSOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NFVF9TQ0FOX01PREU6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU0VUX1NDQU5fVFlQRToKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TRVRfUE9XRVJfTU9ERToKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TRVRfQkxVRVRPT1RIX0NPRVhJU1RFTkNFOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NFVF9CTFVFVE9PVEhfU0NBTl9NT0RFOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NFVF9OVU1fQUxMT1dFRF9DSEFOTkVMUzoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVEFSVF9QQUNLRVRfRklMVEVSSU5HOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NUT1BfUEFDS0VUX0ZJTFRFUklORzoKKyAgICAgICAgICAgICAgICAgICAgZGVmZXJNZXNzYWdlKG1lc3NhZ2UpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVE9QX0FQOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NUQVJUX1NVUFBMSUNBTlQ6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfVU5MT0FEX0RSSVZFUjoKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE5PVF9IQU5ETEVEOworICAgICAgICAgICAgfQorICAgICAgICAgICAgRXZlbnRMb2cud3JpdGVFdmVudChFVkVOVExPR19XSUZJX0VWRU5UX0hBTkRMRUQsIG1lc3NhZ2Uud2hhdCk7CisgICAgICAgICAgICByZXR1cm4gSEFORExFRDsKKyAgICAgICAgfQorICAgIH0KKworICAgIGNsYXNzIERyaXZlclN1cFJlYWR5U3RhdGUgZXh0ZW5kcyBIaWVyYXJjaGljYWxTdGF0ZSB7CisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgdm9pZCBlbnRlcigpIHsKKyAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKFRBRywgZ2V0TmFtZSgpICsgIlxuIik7CisgICAgICAgICAgICBFdmVudExvZy53cml0ZUV2ZW50KEVWRU5UTE9HX1dJRklfU1RBVEVfQ0hBTkdFRCwgZ2V0TmFtZSgpKTsKKyAgICAgICAgICAgIC8qIEluaXRpYWxpemUgZm9yIGNvbm5lY3QgbW9kZSBvcGVyYXRpb24gYXQgc3RhcnQgKi8KKyAgICAgICAgICAgIG1Jc1NjYW5Nb2RlID0gZmFsc2U7CisgICAgICAgIH0KKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBib29sZWFuIHByb2Nlc3NNZXNzYWdlKE1lc3NhZ2UgbWVzc2FnZSkgeworICAgICAgICAgICAgaWYgKERCRykgTG9nLmQoVEFHLCBnZXROYW1lKCkgKyBtZXNzYWdlLnRvU3RyaW5nKCkgKyAiXG4iKTsKKyAgICAgICAgICAgIFN5bmNQYXJhbXMgc3luY1BhcmFtczsKKyAgICAgICAgICAgIFdpZmlDb25maWd1cmF0aW9uIGNvbmZpZzsKKyAgICAgICAgICAgIHN3aXRjaChtZXNzYWdlLndoYXQpIHsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVE9QX1NVUFBMSUNBTlQ6ICAgLyogU3VwcGxpY2FudCBzdG9wcGVkIGJ5IHVzZXIgKi8KKyAgICAgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAiU3RvcCBzdXBwbGljYW50IHJlY2VpdmVkIik7CisgICAgICAgICAgICAgICAgICAgIFdpZmlOYXRpdmUuc3RvcFN1cHBsaWNhbnQoKTsKKyAgICAgICAgICAgICAgICAgICAgLy8kRkFMTC1USFJPVUdIJAorICAgICAgICAgICAgICAgIGNhc2UgU1VQX0RJU0NPTk5FQ1RJT05fRVZFTlQ6ICAvKiBTdXBwbGljYW50IGRpZWQgKi8KKyAgICAgICAgICAgICAgICAgICAgRXZlbnRMb2cud3JpdGVFdmVudChFVkVOVExPR19XSUZJX0VWRU5UX0hBTkRMRUQsIG1lc3NhZ2Uud2hhdCk7CisgICAgICAgICAgICAgICAgICAgIFdpZmlOYXRpdmUuY2xvc2VTdXBwbGljYW50Q29ubmVjdGlvbigpOworICAgICAgICAgICAgICAgICAgICBoYW5kbGVOZXR3b3JrRGlzY29ubmVjdCgpOworICAgICAgICAgICAgICAgICAgICBzZW5kU3VwcGxpY2FudENvbm5lY3Rpb25DaGFuZ2VkQnJvYWRjYXN0KGZhbHNlKTsKKyAgICAgICAgICAgICAgICAgICAgbVN1cHBsaWNhbnRTdGF0ZVRyYWNrZXIucmVzZXRTdXBwbGljYW50U3RhdGUoKTsKKyAgICAgICAgICAgICAgICAgICAgdHJhbnNpdGlvblRvKG1Ecml2ZXJMb2FkZWRTdGF0ZSk7CisKKyAgICAgICAgICAgICAgICAgICAgLyogV2hlbiBzdXBwbGljYW50IGRpZXMsIHVubG9hZCBkcml2ZXIgYW5kIGVudGVyIGZhaWxlZCBzdGF0ZSAqLworICAgICAgICAgICAgICAgICAgICAvL1RPRE86IGNvbnNpZGVyIGJyaW5naW5nIHVwIHN1cHBsaWNhbnQgYWdhaW4KKyAgICAgICAgICAgICAgICAgICAgaWYgKG1lc3NhZ2Uud2hhdCA9PSBTVVBfRElTQ09OTkVDVElPTl9FVkVOVCkgeworICAgICAgICAgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAiU3VwcGxpY2FudCBkaWVkLCB1bmxvYWRpbmcgZHJpdmVyIik7CisgICAgICAgICAgICAgICAgICAgICAgICBzZW5kTWVzc2FnZShvYnRhaW5NZXNzYWdlKENNRF9VTkxPQURfRFJJVkVSLCBXSUZJX1NUQVRFX1VOS05PV04sIDApKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVEFSVF9EUklWRVI6CisgICAgICAgICAgICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoRVZFTlRMT0dfV0lGSV9FVkVOVF9IQU5ETEVELCBtZXNzYWdlLndoYXQpOworICAgICAgICAgICAgICAgICAgICBXaWZpTmF0aXZlLnN0YXJ0RHJpdmVyQ29tbWFuZCgpOworICAgICAgICAgICAgICAgICAgICB0cmFuc2l0aW9uVG8obURyaXZlclN0YXJ0aW5nU3RhdGUpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIFNDQU5fUkVTVUxUU19FVkVOVDoKKyAgICAgICAgICAgICAgICAgICAgc2V0U2NhblJlc3VsdHMoV2lmaU5hdGl2ZS5zY2FuUmVzdWx0c0NvbW1hbmQoKSk7CisgICAgICAgICAgICAgICAgICAgIHNlbmRTY2FuUmVzdWx0c0F2YWlsYWJsZUJyb2FkY2FzdCgpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9QSU5HX1NVUFBMSUNBTlQ6CisgICAgICAgICAgICAgICAgICAgIHN5bmNQYXJhbXMgPSAoU3luY1BhcmFtcykgbWVzc2FnZS5vYmo7CisgICAgICAgICAgICAgICAgICAgIHN5bmNQYXJhbXMubVN5bmNSZXR1cm4uYm9vbFZhbHVlID0gV2lmaU5hdGl2ZS5waW5nQ29tbWFuZCgpOworICAgICAgICAgICAgICAgICAgICBub3RpZnlPbk1zZ09iamVjdChtZXNzYWdlKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBDTURfQUREX09SX1VQREFURV9ORVRXT1JLOgorICAgICAgICAgICAgICAgICAgICBFdmVudExvZy53cml0ZUV2ZW50KEVWRU5UTE9HX1dJRklfRVZFTlRfSEFORExFRCwgbWVzc2FnZS53aGF0KTsKKyAgICAgICAgICAgICAgICAgICAgc3luY1BhcmFtcyA9IChTeW5jUGFyYW1zKSBtZXNzYWdlLm9iajsKKyAgICAgICAgICAgICAgICAgICAgY29uZmlnID0gKFdpZmlDb25maWd1cmF0aW9uKSBzeW5jUGFyYW1zLm1QYXJhbWV0ZXI7CisgICAgICAgICAgICAgICAgICAgIHN5bmNQYXJhbXMubVN5bmNSZXR1cm4uaW50VmFsdWUgPSBXaWZpQ29uZmlnU3RvcmUuYWRkT3JVcGRhdGVOZXR3b3JrKGNvbmZpZyk7CisgICAgICAgICAgICAgICAgICAgIG5vdGlmeU9uTXNnT2JqZWN0KG1lc3NhZ2UpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9SRU1PVkVfTkVUV09SSzoKKyAgICAgICAgICAgICAgICAgICAgRXZlbnRMb2cud3JpdGVFdmVudChFVkVOVExPR19XSUZJX0VWRU5UX0hBTkRMRUQsIG1lc3NhZ2Uud2hhdCk7CisgICAgICAgICAgICAgICAgICAgIHN5bmNQYXJhbXMgPSAoU3luY1BhcmFtcykgbWVzc2FnZS5vYmo7CisgICAgICAgICAgICAgICAgICAgIHN5bmNQYXJhbXMubVN5bmNSZXR1cm4uYm9vbFZhbHVlID0gV2lmaUNvbmZpZ1N0b3JlLnJlbW92ZU5ldHdvcmsoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UuYXJnMSk7CisgICAgICAgICAgICAgICAgICAgIG5vdGlmeU9uTXNnT2JqZWN0KG1lc3NhZ2UpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9FTkFCTEVfTkVUV09SSzoKKyAgICAgICAgICAgICAgICAgICAgRXZlbnRMb2cud3JpdGVFdmVudChFVkVOVExPR19XSUZJX0VWRU5UX0hBTkRMRUQsIG1lc3NhZ2Uud2hhdCk7CisgICAgICAgICAgICAgICAgICAgIHN5bmNQYXJhbXMgPSAoU3luY1BhcmFtcykgbWVzc2FnZS5vYmo7CisgICAgICAgICAgICAgICAgICAgIEVuYWJsZU5ldFBhcmFtcyBlbmFibGVOZXRQYXJhbXMgPSAoRW5hYmxlTmV0UGFyYW1zKSBzeW5jUGFyYW1zLm1QYXJhbWV0ZXI7CisgICAgICAgICAgICAgICAgICAgIHN5bmNQYXJhbXMubVN5bmNSZXR1cm4uYm9vbFZhbHVlID0gV2lmaUNvbmZpZ1N0b3JlLmVuYWJsZU5ldHdvcmsoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgZW5hYmxlTmV0UGFyYW1zLm5ldElkLCBlbmFibGVOZXRQYXJhbXMuZGlzYWJsZU90aGVycyk7CisgICAgICAgICAgICAgICAgICAgIG5vdGlmeU9uTXNnT2JqZWN0KG1lc3NhZ2UpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9ESVNBQkxFX05FVFdPUks6CisgICAgICAgICAgICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoRVZFTlRMT0dfV0lGSV9FVkVOVF9IQU5ETEVELCBtZXNzYWdlLndoYXQpOworICAgICAgICAgICAgICAgICAgICBzeW5jUGFyYW1zID0gKFN5bmNQYXJhbXMpIG1lc3NhZ2Uub2JqOworICAgICAgICAgICAgICAgICAgICBzeW5jUGFyYW1zLm1TeW5jUmV0dXJuLmJvb2xWYWx1ZSA9IFdpZmlDb25maWdTdG9yZS5kaXNhYmxlTmV0d29yaygKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXNzYWdlLmFyZzEpOworICAgICAgICAgICAgICAgICAgICBub3RpZnlPbk1zZ09iamVjdChtZXNzYWdlKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBDTURfQkxBQ0tMSVNUX05FVFdPUks6CisgICAgICAgICAgICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoRVZFTlRMT0dfV0lGSV9FVkVOVF9IQU5ETEVELCBtZXNzYWdlLndoYXQpOworICAgICAgICAgICAgICAgICAgICBXaWZpTmF0aXZlLmFkZFRvQmxhY2tsaXN0Q29tbWFuZCgoU3RyaW5nKW1lc3NhZ2Uub2JqKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBDTURfQ0xFQVJfQkxBQ0tMSVNUOgorICAgICAgICAgICAgICAgICAgICBXaWZpTmF0aXZlLmNsZWFyQmxhY2tsaXN0Q29tbWFuZCgpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TQVZFX0NPTkZJRzoKKyAgICAgICAgICAgICAgICAgICAgc3luY1BhcmFtcyA9IChTeW5jUGFyYW1zKSBtZXNzYWdlLm9iajsKKyAgICAgICAgICAgICAgICAgICAgc3luY1BhcmFtcy5tU3luY1JldHVybi5ib29sVmFsdWUgPSBXaWZpQ29uZmlnU3RvcmUuc2F2ZUNvbmZpZygpOworICAgICAgICAgICAgICAgICAgICBub3RpZnlPbk1zZ09iamVjdChtZXNzYWdlKTsKKyAgICAgICAgICAgICAgICAgICAgLy8gSW5mb3JtIHRoZSBiYWNrdXAgbWFuYWdlciBhYm91dCBhIGRhdGEgY2hhbmdlCisgICAgICAgICAgICAgICAgICAgIElCYWNrdXBNYW5hZ2VyIGlibSA9IElCYWNrdXBNYW5hZ2VyLlN0dWIuYXNJbnRlcmZhY2UoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgU2VydmljZU1hbmFnZXIuZ2V0U2VydmljZShDb250ZXh0LkJBQ0tVUF9TRVJWSUNFKSk7CisgICAgICAgICAgICAgICAgICAgIGlmIChpYm0gIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpYm0uZGF0YUNoYW5nZWQoImNvbS5hbmRyb2lkLnByb3ZpZGVycy5zZXR0aW5ncyIpOworICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBUcnkgYWdhaW4gbGF0ZXIKKyAgICAgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9HRVRfTUFDX0FERFI6CisgICAgICAgICAgICAgICAgICAgIHN5bmNQYXJhbXMgPSAoU3luY1BhcmFtcykgbWVzc2FnZS5vYmo7CisgICAgICAgICAgICAgICAgICAgIHN5bmNQYXJhbXMubVN5bmNSZXR1cm4uc3RyaW5nVmFsdWUgPSBXaWZpTmF0aXZlLmdldE1hY0FkZHJlc3NDb21tYW5kKCk7CisgICAgICAgICAgICAgICAgICAgIG5vdGlmeU9uTXNnT2JqZWN0KG1lc3NhZ2UpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgLyogQ2Fubm90IHN0YXJ0IHNvZnQgQVAgd2hpbGUgaW4gY2xpZW50IG1vZGUgKi8KKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVEFSVF9BUDoKKyAgICAgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAiRmFpbGVkIHRvIHN0YXJ0IHNvZnQgQVAgd2l0aCBhIHJ1bm5pbmcgc3VwcGxpY2FudCIpOworICAgICAgICAgICAgICAgICAgICBFdmVudExvZy53cml0ZUV2ZW50KEVWRU5UTE9HX1dJRklfRVZFTlRfSEFORExFRCwgbWVzc2FnZS53aGF0KTsKKyAgICAgICAgICAgICAgICAgICAgc2V0V2lmaUFwU3RhdGUoV0lGSV9BUF9TVEFURV9GQUlMRUQpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TRVRfU0NBTl9NT0RFOgorICAgICAgICAgICAgICAgICAgICBtSXNTY2FuTW9kZSA9IChtZXNzYWdlLmFyZzEgPT0gU0NBTl9PTkxZX01PREUpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TQVZFX05FVFdPUks6CisgICAgICAgICAgICAgICAgICAgIGNvbmZpZyA9IChXaWZpQ29uZmlndXJhdGlvbikgbWVzc2FnZS5vYmo7CisgICAgICAgICAgICAgICAgICAgIFdpZmlDb25maWdTdG9yZS5zYXZlTmV0d29yayhjb25maWcpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9GT1JHRVRfTkVUV09SSzoKKyAgICAgICAgICAgICAgICAgICAgV2lmaUNvbmZpZ1N0b3JlLmZvcmdldE5ldHdvcmsobWVzc2FnZS5hcmcxKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE5PVF9IQU5ETEVEOworICAgICAgICAgICAgfQorICAgICAgICAgICAgcmV0dXJuIEhBTkRMRUQ7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBjbGFzcyBEcml2ZXJTdGFydGluZ1N0YXRlIGV4dGVuZHMgSGllcmFyY2hpY2FsU3RhdGUgeworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgZW50ZXIoKSB7CisgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsIGdldE5hbWUoKSArICJcbiIpOworICAgICAgICAgICAgRXZlbnRMb2cud3JpdGVFdmVudChFVkVOVExPR19XSUZJX1NUQVRFX0NIQU5HRUQsIGdldE5hbWUoKSk7CisgICAgICAgIH0KKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBib29sZWFuIHByb2Nlc3NNZXNzYWdlKE1lc3NhZ2UgbWVzc2FnZSkgeworICAgICAgICAgICAgaWYgKERCRykgTG9nLmQoVEFHLCBnZXROYW1lKCkgKyBtZXNzYWdlLnRvU3RyaW5nKCkgKyAiXG4iKTsKKyAgICAgICAgICAgIHN3aXRjaChtZXNzYWdlLndoYXQpIHsKKyAgICAgICAgICAgICAgICBjYXNlIERSSVZFUl9TVEFSVF9FVkVOVDoKKyAgICAgICAgICAgICAgICAgICAgdHJhbnNpdGlvblRvKG1Ecml2ZXJTdGFydGVkU3RhdGUpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgLyogUXVldWUgZHJpdmVyIGNvbW1hbmRzICYgY29ubmVjdGlvbiBldmVudHMgKi8KKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVEFSVF9EUklWRVI6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU1RPUF9EUklWRVI6CisgICAgICAgICAgICAgICAgY2FzZSBTVVBQTElDQU5UX1NUQVRFX0NIQU5HRV9FVkVOVDoKKyAgICAgICAgICAgICAgICBjYXNlIE5FVFdPUktfQ09OTkVDVElPTl9FVkVOVDoKKyAgICAgICAgICAgICAgICBjYXNlIE5FVFdPUktfRElTQ09OTkVDVElPTl9FVkVOVDoKKyAgICAgICAgICAgICAgICBjYXNlIFBBU1NXT1JEX01BWV9CRV9JTkNPUlJFQ1RfRVZFTlQ6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU0VUX1NDQU5fVFlQRToKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TRVRfUE9XRVJfTU9ERToKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TRVRfQkxVRVRPT1RIX0NPRVhJU1RFTkNFOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NFVF9CTFVFVE9PVEhfU0NBTl9NT0RFOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NFVF9OVU1fQUxMT1dFRF9DSEFOTkVMUzoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVEFSVF9QQUNLRVRfRklMVEVSSU5HOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NUT1BfUEFDS0VUX0ZJTFRFUklORzoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVEFSVF9TQ0FOOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX0RJU0NPTk5FQ1Q6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfUkVBU1NPQ0lBVEU6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfUkVDT05ORUNUOgorICAgICAgICAgICAgICAgICAgICBkZWZlck1lc3NhZ2UobWVzc2FnZSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBOT1RfSEFORExFRDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoRVZFTlRMT0dfV0lGSV9FVkVOVF9IQU5ETEVELCBtZXNzYWdlLndoYXQpOworICAgICAgICAgICAgcmV0dXJuIEhBTkRMRUQ7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBjbGFzcyBEcml2ZXJTdGFydGVkU3RhdGUgZXh0ZW5kcyBIaWVyYXJjaGljYWxTdGF0ZSB7CisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgdm9pZCBlbnRlcigpIHsKKyAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKFRBRywgZ2V0TmFtZSgpICsgIlxuIik7CisgICAgICAgICAgICBFdmVudExvZy53cml0ZUV2ZW50KEVWRU5UTE9HX1dJRklfU1RBVEVfQ0hBTkdFRCwgZ2V0TmFtZSgpKTsKKworICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICBtQmF0dGVyeVN0YXRzLm5vdGVXaWZpUnVubmluZygpOworICAgICAgICAgICAgfSBjYXRjaCAoUmVtb3RlRXhjZXB0aW9uIGlnbm9yZSkge30KKworICAgICAgICAgICAgLyogSW5pdGlhbGl6ZSBjaGFubmVsIGNvdW50ICovCisgICAgICAgICAgICBzZXROdW1BbGxvd2VkQ2hhbm5lbHMoKTsKKyAgICAgICAgICAgIC8qCisgICAgICAgICAgICAgKiBTVE9QU0hJUAorICAgICAgICAgICAgICogVE9ETzogV2UgYXJlIGhhdmluZyAxMUEgaXNzdWVzIHRoYXQgQnJvYWRjb20gaXMgbG9va2luZworICAgICAgICAgICAgICogdG8gcmVzb2x2ZSwgdGhpcyBpcyBhIHRlbXBvcmFyeSBmaXggdG8gYWxsb3cgb25seSAxMUIvRworICAgICAgICAgICAgICogYW5kIGhlbHAgaW1wcm92ZSBHb29nbGVHdWVzdCBjb25uZWN0aXZpdHkKKyAgICAgICAgICAgICAqIFdlIGFsc28gbmVlZCB0byBhZGQgdGhlIFVJIGZvciBiYW5kIGNvbnRyb2wKKyAgICAgICAgICAgICAqLworICAgICAgICAgICAgV2lmaU5hdGl2ZS5zZXRCYW5kQ29tbWFuZChCQU5EXzJHKTsKKworICAgICAgICAgICAgaWYgKG1Jc1NjYW5Nb2RlKSB7CisgICAgICAgICAgICAgICAgV2lmaU5hdGl2ZS5zZXRTY2FuUmVzdWx0SGFuZGxpbmdDb21tYW5kKFNDQU5fT05MWV9NT0RFKTsKKyAgICAgICAgICAgICAgICBXaWZpTmF0aXZlLmRpc2Nvbm5lY3RDb21tYW5kKCk7CisgICAgICAgICAgICAgICAgdHJhbnNpdGlvblRvKG1TY2FuTW9kZVN0YXRlKTsKKyAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgV2lmaU5hdGl2ZS5zZXRTY2FuUmVzdWx0SGFuZGxpbmdDb21tYW5kKENPTk5FQ1RfTU9ERSk7CisgICAgICAgICAgICAgICAgLyogSWYgc3VwcGxpY2FudCBoYXMgYWxyZWFkeSBjb25uZWN0ZWQsIGJlZm9yZSB3ZSBjb3VsZCBmaW5pc2ggZXN0YWJsaXNoaW5nCisgICAgICAgICAgICAgICAgICogdGhlIGNvbnRyb2wgY2hhbm5lbCBjb25uZWN0aW9uLCB3ZSBtaXNzIGFsbCB0aGUgc3VwcGxpY2FudCBldmVudHMuCisgICAgICAgICAgICAgICAgICogRGlzY29ubmVjdCBhbmQgcmVjb25uZWN0IHdoZW4gZHJpdmVyIGhhcyBzdGFydGVkIHRvIGVuc3VyZSB3ZSByZWNlaXZlCisgICAgICAgICAgICAgICAgICogYWxsIHN1cHBsaWNhbnQgZXZlbnRzLgorICAgICAgICAgICAgICAgICAqCisgICAgICAgICAgICAgICAgICogVE9ETzogVGhpcyBpcyBhIGJpdCB1bmNsZWFuLCBpZGVhbGx5IHRoZSBzdXBwbGljYW50IHNob3VsZCBuZXZlcgorICAgICAgICAgICAgICAgICAqIGNvbm5lY3QgdW50aWwgdG9sZCB0byBkbyBzbyBieSB0aGUgZnJhbWV3b3JrCisgICAgICAgICAgICAgICAgICovCisgICAgICAgICAgICAgICAgV2lmaU5hdGl2ZS5kaXNjb25uZWN0Q29tbWFuZCgpOworICAgICAgICAgICAgICAgIFdpZmlOYXRpdmUucmVjb25uZWN0Q29tbWFuZCgpOworICAgICAgICAgICAgICAgIHRyYW5zaXRpb25UbyhtQ29ubmVjdE1vZGVTdGF0ZSk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBib29sZWFuIHByb2Nlc3NNZXNzYWdlKE1lc3NhZ2UgbWVzc2FnZSkgeworICAgICAgICAgICAgaWYgKERCRykgTG9nLmQoVEFHLCBnZXROYW1lKCkgKyBtZXNzYWdlLnRvU3RyaW5nKCkgKyAiXG4iKTsKKyAgICAgICAgICAgIFN5bmNQYXJhbXMgc3luY1BhcmFtczsKKyAgICAgICAgICAgIHN3aXRjaChtZXNzYWdlLndoYXQpIHsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TRVRfU0NBTl9UWVBFOgorICAgICAgICAgICAgICAgICAgICBpZiAobWVzc2FnZS5hcmcxID09IFNDQU5fQUNUSVZFKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBXaWZpTmF0aXZlLnNldFNjYW5Nb2RlQ29tbWFuZCh0cnVlKTsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIFdpZmlOYXRpdmUuc2V0U2Nhbk1vZGVDb21tYW5kKGZhbHNlKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TRVRfUE9XRVJfTU9ERToKKyAgICAgICAgICAgICAgICAgICAgV2lmaU5hdGl2ZS5zZXRQb3dlck1vZGVDb21tYW5kKG1lc3NhZ2UuYXJnMSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NFVF9CTFVFVE9PVEhfQ09FWElTVEVOQ0U6CisgICAgICAgICAgICAgICAgICAgIFdpZmlOYXRpdmUuc2V0Qmx1ZXRvb3RoQ29leGlzdGVuY2VNb2RlQ29tbWFuZChtZXNzYWdlLmFyZzEpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TRVRfQkxVRVRPT1RIX1NDQU5fTU9ERToKKyAgICAgICAgICAgICAgICAgICAgV2lmaU5hdGl2ZS5zZXRCbHVldG9vdGhDb2V4aXN0ZW5jZVNjYW5Nb2RlQ29tbWFuZChtZXNzYWdlLmFyZzEgPT0gMSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NFVF9OVU1fQUxMT1dFRF9DSEFOTkVMUzoKKyAgICAgICAgICAgICAgICAgICAgbU51bUFsbG93ZWRDaGFubmVscyA9IG1lc3NhZ2UuYXJnMTsKKyAgICAgICAgICAgICAgICAgICAgV2lmaU5hdGl2ZS5zZXROdW1BbGxvd2VkQ2hhbm5lbHNDb21tYW5kKG1lc3NhZ2UuYXJnMSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NUQVJUX0RSSVZFUjoKKyAgICAgICAgICAgICAgICAgICAgLyogSWdub3JlIGFub3RoZXIgZHJpdmVyIHN0YXJ0ICovCisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NUT1BfRFJJVkVSOgorICAgICAgICAgICAgICAgICAgICBXaWZpTmF0aXZlLnN0b3BEcml2ZXJDb21tYW5kKCk7CisgICAgICAgICAgICAgICAgICAgIHRyYW5zaXRpb25UbyhtRHJpdmVyU3RvcHBpbmdTdGF0ZSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgQ01EX1JFUVVFU1RfQ01fV0FLRUxPQ0s6CisgICAgICAgICAgICAgICAgICAgIGlmIChtQ20gPT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICAgICAgbUNtID0gKENvbm5lY3Rpdml0eU1hbmFnZXIpbUNvbnRleHQuZ2V0U3lzdGVtU2VydmljZSgKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ29udGV4dC5DT05ORUNUSVZJVFlfU0VSVklDRSk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgbUNtLnJlcXVlc3ROZXR3b3JrVHJhbnNpdGlvbldha2Vsb2NrKFRBRyk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NUQVJUX1BBQ0tFVF9GSUxURVJJTkc6CisgICAgICAgICAgICAgICAgICAgIFdpZmlOYXRpdmUuc3RhcnRQYWNrZXRGaWx0ZXJpbmcoKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU1RPUF9QQUNLRVRfRklMVEVSSU5HOgorICAgICAgICAgICAgICAgICAgICBXaWZpTmF0aXZlLnN0b3BQYWNrZXRGaWx0ZXJpbmcoKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE5PVF9IQU5ETEVEOworICAgICAgICAgICAgfQorICAgICAgICAgICAgRXZlbnRMb2cud3JpdGVFdmVudChFVkVOVExPR19XSUZJX0VWRU5UX0hBTkRMRUQsIG1lc3NhZ2Uud2hhdCk7CisgICAgICAgICAgICByZXR1cm4gSEFORExFRDsKKyAgICAgICAgfQorICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgZXhpdCgpIHsKKyAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKFRBRywgZ2V0TmFtZSgpICsgIlxuIik7CisgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgIG1CYXR0ZXJ5U3RhdHMubm90ZVdpZmlTdG9wcGVkKCk7CisgICAgICAgICAgICB9IGNhdGNoIChSZW1vdGVFeGNlcHRpb24gaWdub3JlKSB7IH0KKyAgICAgICAgICAgIG1TY2FuUmVzdWx0cyA9IG51bGw7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBjbGFzcyBEcml2ZXJTdG9wcGluZ1N0YXRlIGV4dGVuZHMgSGllcmFyY2hpY2FsU3RhdGUgeworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgZW50ZXIoKSB7CisgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsIGdldE5hbWUoKSArICJcbiIpOworICAgICAgICAgICAgRXZlbnRMb2cud3JpdGVFdmVudChFVkVOVExPR19XSUZJX1NUQVRFX0NIQU5HRUQsIGdldE5hbWUoKSk7CisgICAgICAgIH0KKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBib29sZWFuIHByb2Nlc3NNZXNzYWdlKE1lc3NhZ2UgbWVzc2FnZSkgeworICAgICAgICAgICAgaWYgKERCRykgTG9nLmQoVEFHLCBnZXROYW1lKCkgKyBtZXNzYWdlLnRvU3RyaW5nKCkgKyAiXG4iKTsKKyAgICAgICAgICAgIHN3aXRjaChtZXNzYWdlLndoYXQpIHsKKyAgICAgICAgICAgICAgICBjYXNlIERSSVZFUl9TVE9QX0VWRU5UOgorICAgICAgICAgICAgICAgICAgICB0cmFuc2l0aW9uVG8obURyaXZlclN0b3BwZWRTdGF0ZSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAvKiBRdWV1ZSBkcml2ZXIgY29tbWFuZHMgKi8KKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVEFSVF9EUklWRVI6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU1RPUF9EUklWRVI6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU0VUX1NDQU5fVFlQRToKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TRVRfUE9XRVJfTU9ERToKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TRVRfQkxVRVRPT1RIX0NPRVhJU1RFTkNFOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NFVF9CTFVFVE9PVEhfU0NBTl9NT0RFOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NFVF9OVU1fQUxMT1dFRF9DSEFOTkVMUzoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVEFSVF9QQUNLRVRfRklMVEVSSU5HOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NUT1BfUEFDS0VUX0ZJTFRFUklORzoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVEFSVF9TQ0FOOgorICAgICAgICAgICAgICAgIGNhc2UgQ01EX0RJU0NPTk5FQ1Q6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfUkVBU1NPQ0lBVEU6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfUkVDT05ORUNUOgorICAgICAgICAgICAgICAgICAgICBkZWZlck1lc3NhZ2UobWVzc2FnZSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBOT1RfSEFORExFRDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoRVZFTlRMT0dfV0lGSV9FVkVOVF9IQU5ETEVELCBtZXNzYWdlLndoYXQpOworICAgICAgICAgICAgcmV0dXJuIEhBTkRMRUQ7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBjbGFzcyBEcml2ZXJTdG9wcGVkU3RhdGUgZXh0ZW5kcyBIaWVyYXJjaGljYWxTdGF0ZSB7CisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgdm9pZCBlbnRlcigpIHsKKyAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKFRBRywgZ2V0TmFtZSgpICsgIlxuIik7CisgICAgICAgICAgICBFdmVudExvZy53cml0ZUV2ZW50KEVWRU5UTE9HX1dJRklfU1RBVEVfQ0hBTkdFRCwgZ2V0TmFtZSgpKTsKKyAgICAgICAgfQorICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIGJvb2xlYW4gcHJvY2Vzc01lc3NhZ2UoTWVzc2FnZSBtZXNzYWdlKSB7CisgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsIGdldE5hbWUoKSArIG1lc3NhZ2UudG9TdHJpbmcoKSArICJcbiIpOworICAgICAgICAgICAgcmV0dXJuIE5PVF9IQU5ETEVEOworICAgICAgICB9CisgICAgfQorCisgICAgY2xhc3MgU2Nhbk1vZGVTdGF0ZSBleHRlbmRzIEhpZXJhcmNoaWNhbFN0YXRlIHsKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIGVudGVyKCkgeworICAgICAgICAgICAgaWYgKERCRykgTG9nLmQoVEFHLCBnZXROYW1lKCkgKyAiXG4iKTsKKyAgICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoRVZFTlRMT0dfV0lGSV9TVEFURV9DSEFOR0VELCBnZXROYW1lKCkpOworICAgICAgICB9CisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgYm9vbGVhbiBwcm9jZXNzTWVzc2FnZShNZXNzYWdlIG1lc3NhZ2UpIHsKKyAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKFRBRywgZ2V0TmFtZSgpICsgbWVzc2FnZS50b1N0cmluZygpICsgIlxuIik7CisgICAgICAgICAgICBTeW5jUGFyYW1zIHN5bmNQYXJhbXM7CisgICAgICAgICAgICBzd2l0Y2gobWVzc2FnZS53aGF0KSB7CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU0VUX1NDQU5fTU9ERToKKyAgICAgICAgICAgICAgICAgICAgaWYgKG1lc3NhZ2UuYXJnMSA9PSBTQ0FOX09OTFlfTU9ERSkgeworICAgICAgICAgICAgICAgICAgICAgICAgLyogSWdub3JlICovCisgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSEFORExFRDsKKyAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIFdpZmlOYXRpdmUuc2V0U2NhblJlc3VsdEhhbmRsaW5nQ29tbWFuZChtZXNzYWdlLmFyZzEpOworICAgICAgICAgICAgICAgICAgICAgICAgV2lmaU5hdGl2ZS5yZWNvbm5lY3RDb21tYW5kKCk7CisgICAgICAgICAgICAgICAgICAgICAgICBtSXNTY2FuTW9kZSA9IGZhbHNlOworICAgICAgICAgICAgICAgICAgICAgICAgdHJhbnNpdGlvblRvKG1EaXNjb25uZWN0ZWRTdGF0ZSk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU1RBUlRfU0NBTjoKKyAgICAgICAgICAgICAgICAgICAgV2lmaU5hdGl2ZS5zY2FuQ29tbWFuZChtZXNzYWdlLmFyZzEgPT0gU0NBTl9BQ1RJVkUpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgLyogSWdub3JlICovCisgICAgICAgICAgICAgICAgY2FzZSBDTURfRElTQ09OTkVDVDoKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9SRUNPTk5FQ1Q6CisgICAgICAgICAgICAgICAgY2FzZSBDTURfUkVBU1NPQ0lBVEU6CisgICAgICAgICAgICAgICAgY2FzZSBTVVBQTElDQU5UX1NUQVRFX0NIQU5HRV9FVkVOVDoKKyAgICAgICAgICAgICAgICBjYXNlIE5FVFdPUktfQ09OTkVDVElPTl9FVkVOVDoKKyAgICAgICAgICAgICAgICBjYXNlIE5FVFdPUktfRElTQ09OTkVDVElPTl9FVkVOVDoKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE5PVF9IQU5ETEVEOworICAgICAgICAgICAgfQorICAgICAgICAgICAgRXZlbnRMb2cud3JpdGVFdmVudChFVkVOVExPR19XSUZJX0VWRU5UX0hBTkRMRUQsIG1lc3NhZ2Uud2hhdCk7CisgICAgICAgICAgICByZXR1cm4gSEFORExFRDsKKyAgICAgICAgfQorICAgIH0KKworICAgIGNsYXNzIENvbm5lY3RNb2RlU3RhdGUgZXh0ZW5kcyBIaWVyYXJjaGljYWxTdGF0ZSB7CisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgdm9pZCBlbnRlcigpIHsKKyAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKFRBRywgZ2V0TmFtZSgpICsgIlxuIik7CisgICAgICAgICAgICBFdmVudExvZy53cml0ZUV2ZW50KEVWRU5UTE9HX1dJRklfU1RBVEVfQ0hBTkdFRCwgZ2V0TmFtZSgpKTsKKyAgICAgICAgfQorICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIGJvb2xlYW4gcHJvY2Vzc01lc3NhZ2UoTWVzc2FnZSBtZXNzYWdlKSB7CisgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsIGdldE5hbWUoKSArIG1lc3NhZ2UudG9TdHJpbmcoKSArICJcbiIpOworICAgICAgICAgICAgU3luY1BhcmFtcyBzeW5jUGFyYW1zOworICAgICAgICAgICAgU3RhdGVDaGFuZ2VSZXN1bHQgc3RhdGVDaGFuZ2VSZXN1bHQ7CisgICAgICAgICAgICBzd2l0Y2gobWVzc2FnZS53aGF0KSB7CisgICAgICAgICAgICAgICAgY2FzZSBQQVNTV09SRF9NQVlfQkVfSU5DT1JSRUNUX0VWRU5UOgorICAgICAgICAgICAgICAgICAgICBtUGFzc3dvcmRLZXlNYXlCZUluY29ycmVjdCA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgU1VQUExJQ0FOVF9TVEFURV9DSEFOR0VfRVZFTlQ6CisgICAgICAgICAgICAgICAgICAgIHN0YXRlQ2hhbmdlUmVzdWx0ID0gKFN0YXRlQ2hhbmdlUmVzdWx0KSBtZXNzYWdlLm9iajsKKyAgICAgICAgICAgICAgICAgICAgbVN1cHBsaWNhbnRTdGF0ZVRyYWNrZXIuaGFuZGxlRXZlbnQoc3RhdGVDaGFuZ2VSZXN1bHQpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVEFSVF9TQ0FOOgorICAgICAgICAgICAgICAgICAgICAvKiBXZSBuZWVkIHRvIHNldCBzY2FuIHR5cGUgaW4gY29tcGxldGVkIHN0YXRlICovCisgICAgICAgICAgICAgICAgICAgIE1lc3NhZ2UgbmV3TXNnID0gb2J0YWluTWVzc2FnZSgpOworICAgICAgICAgICAgICAgICAgICBuZXdNc2cuY29weUZyb20obWVzc2FnZSk7CisgICAgICAgICAgICAgICAgICAgIG1TdXBwbGljYW50U3RhdGVUcmFja2VyLnNlbmRNZXNzYWdlKG5ld01zZyk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICAvKiBEbyBhIHJlZHVuZGFudCBkaXNjb25uZWN0IHdpdGhvdXQgdHJhbnNpdGlvbiAqLworICAgICAgICAgICAgICAgIGNhc2UgQ01EX0RJU0NPTk5FQ1Q6CisgICAgICAgICAgICAgICAgICAgIFdpZmlOYXRpdmUuZGlzY29ubmVjdENvbW1hbmQoKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBDTURfUkVDT05ORUNUOgorICAgICAgICAgICAgICAgICAgICBXaWZpTmF0aXZlLnJlY29ubmVjdENvbW1hbmQoKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBDTURfUkVBU1NPQ0lBVEU6CisgICAgICAgICAgICAgICAgICAgIFdpZmlOYXRpdmUucmVhc3NvY2lhdGVDb21tYW5kKCk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgQ01EX0NPTk5FQ1RfTkVUV09SSzoKKyAgICAgICAgICAgICAgICAgICAgaW50IG5ldElkID0gbWVzc2FnZS5hcmcxOworICAgICAgICAgICAgICAgICAgICBXaWZpQ29uZmlndXJhdGlvbiBjb25maWcgPSAoV2lmaUNvbmZpZ3VyYXRpb24pIG1lc3NhZ2Uub2JqOworCisgICAgICAgICAgICAgICAgICAgIC8qIFdlIGNvbm5lY3QgdG8gYSBzcGVjaWZpYyBuZXR3b3JrIGJ5IGlzc3VpbmcgYSBzZWxlY3QKKyAgICAgICAgICAgICAgICAgICAgICogdG8gdGhlIFdpZmlDb25maWdTdG9yZS4gVGhpcyBlbmFibGVzIHRoZSBuZXR3b3JrLAorICAgICAgICAgICAgICAgICAgICAgKiB3aGlsZSBkaXNhYmxpbmcgYWxsIG90aGVyIG5ldHdvcmtzIGluIHRoZSBzdXBwbGljYW50LgorICAgICAgICAgICAgICAgICAgICAgKiBEaXNhYmxpbmcgYSBjb25uZWN0ZWQgbmV0d29yayB3aWxsIGNhdXNlIGEgZGlzY29ubmVjdGlvbgorICAgICAgICAgICAgICAgICAgICAgKiBmcm9tIHRoZSBuZXR3b3JrLiBBIHJlY29ubmVjdENvbW1hbmQoKSB3aWxsIHRoZW4gaW5pdGlhdGUKKyAgICAgICAgICAgICAgICAgICAgICogYSBjb25uZWN0aW9uIHRvIHRoZSBlbmFibGVkIG5ldHdvcmsuCisgICAgICAgICAgICAgICAgICAgICAqLworICAgICAgICAgICAgICAgICAgICBpZiAoY29uZmlnICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIFdpZmlDb25maWdTdG9yZS5zZWxlY3ROZXR3b3JrKGNvbmZpZyk7CisgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICBXaWZpQ29uZmlnU3RvcmUuc2VsZWN0TmV0d29yayhuZXRJZCk7CisgICAgICAgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICAgICAgICAvKiBTYXZlIGEgZmxhZyB0byBpbmRpY2F0ZSB0aGF0IHdlIG5lZWQgdG8gZW5hYmxlIGFsbAorICAgICAgICAgICAgICAgICAgICAgKiBuZXR3b3JrcyBhZnRlciBzdXBwbGljYW50IGluZGljYXRlcyBhIG5ldHdvcmsKKyAgICAgICAgICAgICAgICAgICAgICogc3RhdGUgY2hhbmdlIGV2ZW50CisgICAgICAgICAgICAgICAgICAgICAqLworICAgICAgICAgICAgICAgICAgICBtRW5hYmxlQWxsTmV0d29ya3MgPSB0cnVlOworCisgICAgICAgICAgICAgICAgICAgIFdpZmlOYXRpdmUucmVjb25uZWN0Q29tbWFuZCgpOworCisgICAgICAgICAgICAgICAgICAgIC8qIEV4cGVjdCBhIGRpc2Nvbm5lY3Rpb24gZnJvbSB0aGUgb2xkIGNvbm5lY3Rpb24gKi8KKyAgICAgICAgICAgICAgICAgICAgdHJhbnNpdGlvblRvKG1EaXNjb25uZWN0aW5nU3RhdGUpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIFNDQU5fUkVTVUxUU19FVkVOVDoKKyAgICAgICAgICAgICAgICAgICAgLyogU2V0IHRoZSBzY2FuIHNldHRpbmcgYmFjayB0byAiY29ubmVjdCIgbW9kZSAqLworICAgICAgICAgICAgICAgICAgICBXaWZpTmF0aXZlLnNldFNjYW5SZXN1bHRIYW5kbGluZ0NvbW1hbmQoQ09OTkVDVF9NT0RFKTsKKyAgICAgICAgICAgICAgICAgICAgLyogSGFuZGxlIHNjYW4gcmVzdWx0cyAqLworICAgICAgICAgICAgICAgICAgICByZXR1cm4gTk9UX0hBTkRMRUQ7CisgICAgICAgICAgICAgICAgY2FzZSBORVRXT1JLX0NPTk5FQ1RJT05fRVZFTlQ6CisgICAgICAgICAgICAgICAgICAgIExvZy5kKFRBRywiTmV0d29yayBjb25uZWN0aW9uIGVzdGFibGlzaGVkIik7CisgICAgICAgICAgICAgICAgICAgIHN0YXRlQ2hhbmdlUmVzdWx0ID0gKFN0YXRlQ2hhbmdlUmVzdWx0KSBtZXNzYWdlLm9iajsKKworICAgICAgICAgICAgICAgICAgICAvL1RPRE86IG1ha2Ugc3VwcGxpY2FudCBtb2RpZmljYXRpb24gdG8gcHVzaCB0aGlzIGluIGV2ZW50cworICAgICAgICAgICAgICAgICAgICBtV2lmaUluZm8uc2V0U1NJRChmZXRjaFNTSUQoKSk7CisgICAgICAgICAgICAgICAgICAgIG1XaWZpSW5mby5zZXRCU1NJRChtTGFzdEJzc2lkID0gc3RhdGVDaGFuZ2VSZXN1bHQuQlNTSUQpOworICAgICAgICAgICAgICAgICAgICBtV2lmaUluZm8uc2V0TmV0d29ya0lkKHN0YXRlQ2hhbmdlUmVzdWx0Lm5ldHdvcmtJZCk7CisgICAgICAgICAgICAgICAgICAgIG1MYXN0TmV0d29ya0lkID0gc3RhdGVDaGFuZ2VSZXN1bHQubmV0d29ya0lkOworICAgICAgICAgICAgICAgICAgICAvKiBzZW5kIGV2ZW50IHRvIENNICYgbmV0d29yayBjaGFuZ2UgYnJvYWRjYXN0ICovCisgICAgICAgICAgICAgICAgICAgIHNldERldGFpbGVkU3RhdGUoRGV0YWlsZWRTdGF0ZS5PQlRBSU5JTkdfSVBBRERSKTsKKyAgICAgICAgICAgICAgICAgICAgc2VuZE5ldHdvcmtTdGF0ZUNoYW5nZUJyb2FkY2FzdChtTGFzdEJzc2lkKTsKKyAgICAgICAgICAgICAgICAgICAgdHJhbnNpdGlvblRvKG1Db25uZWN0aW5nU3RhdGUpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIE5FVFdPUktfRElTQ09OTkVDVElPTl9FVkVOVDoKKyAgICAgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCJOZXR3b3JrIGNvbm5lY3Rpb24gbG9zdCIpOworICAgICAgICAgICAgICAgICAgICBoYW5kbGVOZXR3b3JrRGlzY29ubmVjdCgpOworICAgICAgICAgICAgICAgICAgICB0cmFuc2l0aW9uVG8obURpc2Nvbm5lY3RlZFN0YXRlKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBDTURfR0VUX1JTU0k6CisgICAgICAgICAgICAgICAgICAgIHN5bmNQYXJhbXMgPSAoU3luY1BhcmFtcykgbWVzc2FnZS5vYmo7CisgICAgICAgICAgICAgICAgICAgIHN5bmNQYXJhbXMubVN5bmNSZXR1cm4uaW50VmFsdWUgPSBXaWZpTmF0aXZlLmdldFJzc2lDb21tYW5kKCk7CisgICAgICAgICAgICAgICAgICAgIG5vdGlmeU9uTXNnT2JqZWN0KG1lc3NhZ2UpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9HRVRfUlNTSV9BUFBST1g6CisgICAgICAgICAgICAgICAgICAgIHN5bmNQYXJhbXMgPSAoU3luY1BhcmFtcykgbWVzc2FnZS5vYmo7CisgICAgICAgICAgICAgICAgICAgIHN5bmNQYXJhbXMubVN5bmNSZXR1cm4uaW50VmFsdWUgPSBXaWZpTmF0aXZlLmdldFJzc2lBcHByb3hDb21tYW5kKCk7CisgICAgICAgICAgICAgICAgICAgIG5vdGlmeU9uTXNnT2JqZWN0KG1lc3NhZ2UpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9HRVRfTElOS19TUEVFRDoKKyAgICAgICAgICAgICAgICAgICAgc3luY1BhcmFtcyA9IChTeW5jUGFyYW1zKSBtZXNzYWdlLm9iajsKKyAgICAgICAgICAgICAgICAgICAgc3luY1BhcmFtcy5tU3luY1JldHVybi5pbnRWYWx1ZSA9IFdpZmlOYXRpdmUuZ2V0TGlua1NwZWVkQ29tbWFuZCgpOworICAgICAgICAgICAgICAgICAgICBub3RpZnlPbk1zZ09iamVjdChtZXNzYWdlKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE5PVF9IQU5ETEVEOworICAgICAgICAgICAgfQorICAgICAgICAgICAgRXZlbnRMb2cud3JpdGVFdmVudChFVkVOVExPR19XSUZJX0VWRU5UX0hBTkRMRUQsIG1lc3NhZ2Uud2hhdCk7CisgICAgICAgICAgICByZXR1cm4gSEFORExFRDsKKyAgICAgICAgfQorICAgIH0KKworICAgIGNsYXNzIENvbm5lY3RpbmdTdGF0ZSBleHRlbmRzIEhpZXJhcmNoaWNhbFN0YXRlIHsKKyAgICAgICAgYm9vbGVhbiBtb2RpZmllZEJsdWV0b290aENvZXhpc3RlbmNlTW9kZTsKKyAgICAgICAgaW50IHBvd2VyTW9kZTsKKyAgICAgICAgVGhyZWFkIG1EaGNwVGhyZWFkOworCisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgdm9pZCBlbnRlcigpIHsKKyAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKFRBRywgZ2V0TmFtZSgpICsgIlxuIik7CisgICAgICAgICAgICBFdmVudExvZy53cml0ZUV2ZW50KEVWRU5UTE9HX1dJRklfU1RBVEVfQ0hBTkdFRCwgZ2V0TmFtZSgpKTsKKworICAgICAgICAgICAgaWYgKCFtVXNlU3RhdGljSXApIHsKKworICAgICAgICAgICAgICAgIG1EaGNwVGhyZWFkID0gbnVsbDsKKyAgICAgICAgICAgICAgICBtb2RpZmllZEJsdWV0b290aENvZXhpc3RlbmNlTW9kZSA9IGZhbHNlOworICAgICAgICAgICAgICAgIHBvd2VyTW9kZSA9IERSSVZFUl9QT1dFUl9NT0RFX0FVVE87CisKKyAgICAgICAgICAgICAgICBpZiAoc2hvdWxkRGlzYWJsZUNvZXhpc3RlbmNlTW9kZSgpKSB7CisgICAgICAgICAgICAgICAgICAgIC8qCisgICAgICAgICAgICAgICAgICAgICAqIFRoZXJlIGFyZSBwcm9ibGVtcyBzZXR0aW5nIHRoZSBXaS1GaSBkcml2ZXIncyBwb3dlcgorICAgICAgICAgICAgICAgICAgICAgKiBtb2RlIHRvIGFjdGl2ZSB3aGVuIGJsdWV0b290aCBjb2V4aXN0ZW5jZSBtb2RlIGlzCisgICAgICAgICAgICAgICAgICAgICAqIGVuYWJsZWQgb3Igc2Vuc2UuCisgICAgICAgICAgICAgICAgICAgICAqIDxwPgorICAgICAgICAgICAgICAgICAgICAgKiBXZSBzZXQgV2ktRmkgdG8gYWN0aXZlIG1vZGUgd2hlbgorICAgICAgICAgICAgICAgICAgICAgKiBvYnRhaW5pbmcgYW4gSVAgYWRkcmVzcyBiZWNhdXNlIHdlJ3ZlIGZvdW5kCisgICAgICAgICAgICAgICAgICAgICAqIGNvbXBhdGliaWxpdHkgaXNzdWVzIHdpdGggc29tZSByb3V0ZXJzIHdpdGggbG93IHBvd2VyCisgICAgICAgICAgICAgICAgICAgICAqIG1vZGUuCisgICAgICAgICAgICAgICAgICAgICAqIDxwPgorICAgICAgICAgICAgICAgICAgICAgKiBJbiBvcmRlciBmb3IgdGhpcyBhY3RpdmUgcG93ZXIgbW9kZSB0byBwcm9wZXJseSBiZSBzZXQsCisgICAgICAgICAgICAgICAgICAgICAqIHdlIGRpc2FibGUgY29leGlzdGVuY2UgbW9kZSB1bnRpbCB3ZSdyZSBkb25lIHdpdGgKKyAgICAgICAgICAgICAgICAgICAgICogb2J0YWluaW5nIGFuIElQIGFkZHJlc3MuICBPbmUgZXhjZXB0aW9uIGlzIGlmIHdlCisgICAgICAgICAgICAgICAgICAgICAqIGFyZSBjdXJyZW50bHkgY29ubmVjdGVkIHRvIGEgaGVhZHNldCwgc2luY2UgZGlzYWJsaW5nCisgICAgICAgICAgICAgICAgICAgICAqIGNvZXhpc3RlbmNlIHdvdWxkIGludGVycnVwdCB0aGF0IGNvbm5lY3Rpb24uCisgICAgICAgICAgICAgICAgICAgICAqLworICAgICAgICAgICAgICAgICAgICBtb2RpZmllZEJsdWV0b290aENvZXhpc3RlbmNlTW9kZSA9IHRydWU7CisKKyAgICAgICAgICAgICAgICAgICAgLy8gRGlzYWJsZSB0aGUgY29leGlzdGVuY2UgbW9kZQorICAgICAgICAgICAgICAgICAgICBXaWZpTmF0aXZlLnNldEJsdWV0b290aENvZXhpc3RlbmNlTW9kZUNvbW1hbmQoCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgV2lmaU5hdGl2ZS5CTFVFVE9PVEhfQ09FWElTVEVOQ0VfTU9ERV9ESVNBQkxFRCk7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgcG93ZXJNb2RlID0gIFdpZmlOYXRpdmUuZ2V0UG93ZXJNb2RlQ29tbWFuZCgpOworICAgICAgICAgICAgICAgIGlmIChwb3dlck1vZGUgPCAwKSB7CisgICAgICAgICAgICAgICAgICAvLyBIYW5kbGUgdGhlIGNhc2Ugd2hlcmUgc3VwcGxpY2FudCBkcml2ZXIgZG9lcyBub3Qgc3VwcG9ydAorICAgICAgICAgICAgICAgICAgLy8gZ2V0UG93ZXJNb2RlQ29tbWFuZC4KKyAgICAgICAgICAgICAgICAgICAgcG93ZXJNb2RlID0gRFJJVkVSX1BPV0VSX01PREVfQVVUTzsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgaWYgKHBvd2VyTW9kZSAhPSBEUklWRVJfUE9XRVJfTU9ERV9BQ1RJVkUpIHsKKyAgICAgICAgICAgICAgICAgICAgV2lmaU5hdGl2ZS5zZXRQb3dlck1vZGVDb21tYW5kKERSSVZFUl9QT1dFUl9NT0RFX0FDVElWRSk7CisgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAiREhDUCByZXF1ZXN0IHN0YXJ0ZWQiKTsKKyAgICAgICAgICAgICAgICBtRGhjcFRocmVhZCA9IG5ldyBUaHJlYWQobmV3IFJ1bm5hYmxlKCkgeworICAgICAgICAgICAgICAgICAgICBwdWJsaWMgdm9pZCBydW4oKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoTmV0d29ya1V0aWxzLnJ1bkRoY3AobUludGVyZmFjZU5hbWUsIG1EaGNwSW5mbykpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJESENQIHJlcXVlc3Qgc3VjY2VlZGVkIik7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2VuZE1lc3NhZ2UoQ01EX0lQX0NPTkZJR19TVUNDRVNTKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAiREhDUCByZXF1ZXN0IGZhaWxlZDogIiArCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBOZXR3b3JrVXRpbHMuZ2V0RGhjcEVycm9yKCkpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbmRNZXNzYWdlKENNRF9JUF9DT05GSUdfRkFJTFVSRSk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9KTsKKyAgICAgICAgICAgICAgICBtRGhjcFRocmVhZC5zdGFydCgpOworICAgICAgICAgICAgfSBlbHNlIHsKKyAgICAgICAgICAgICAgICBpZiAoTmV0d29ya1V0aWxzLmNvbmZpZ3VyZUludGVyZmFjZShtSW50ZXJmYWNlTmFtZSwgbURoY3BJbmZvKSkgeworICAgICAgICAgICAgICAgICAgICBMb2cudihUQUcsICJTdGF0aWMgSVAgY29uZmlndXJhdGlvbiBzdWNjZWVkZWQiKTsKKyAgICAgICAgICAgICAgICAgICAgc2VuZE1lc3NhZ2UoQ01EX0lQX0NPTkZJR19TVUNDRVNTKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICBMb2cudihUQUcsICJTdGF0aWMgSVAgY29uZmlndXJhdGlvbiBmYWlsZWQiKTsKKyAgICAgICAgICAgICAgICAgICAgc2VuZE1lc3NhZ2UoQ01EX0lQX0NPTkZJR19GQUlMVVJFKTsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICB9CisgICAgICAgICB9CisgICAgICBAT3ZlcnJpZGUKKyAgICAgIHB1YmxpYyBib29sZWFuIHByb2Nlc3NNZXNzYWdlKE1lc3NhZ2UgbWVzc2FnZSkgeworICAgICAgICAgIGlmIChEQkcpIExvZy5kKFRBRywgZ2V0TmFtZSgpICsgbWVzc2FnZS50b1N0cmluZygpICsgIlxuIik7CisKKyAgICAgICAgICBzd2l0Y2gobWVzc2FnZS53aGF0KSB7CisgICAgICAgICAgICAgIGNhc2UgQ01EX0lQX0NPTkZJR19TVUNDRVNTOgorICAgICAgICAgICAgICAgICAgbVJlY29ubmVjdENvdW50ID0gMDsKKyAgICAgICAgICAgICAgICAgIG1MYXN0U2lnbmFsTGV2ZWwgPSAtMTsgLy8gZm9yY2UgdXBkYXRlIG9mIHNpZ25hbCBzdHJlbmd0aAorICAgICAgICAgICAgICAgICAgbVdpZmlJbmZvLnNldElwQWRkcmVzcyhtRGhjcEluZm8uaXBBZGRyZXNzKTsKKyAgICAgICAgICAgICAgICAgIExvZy5kKFRBRywgIklQIGNvbmZpZ3VyYXRpb246ICIgKyBtRGhjcEluZm8pOworICAgICAgICAgICAgICAgICAgY29uZmlndXJlTGlua1Byb3BlcnRpZXMoKTsKKyAgICAgICAgICAgICAgICAgIHNldERldGFpbGVkU3RhdGUoRGV0YWlsZWRTdGF0ZS5DT05ORUNURUQpOworICAgICAgICAgICAgICAgICAgc2VuZE5ldHdvcmtTdGF0ZUNoYW5nZUJyb2FkY2FzdChtTGFzdEJzc2lkKTsKKyAgICAgICAgICAgICAgICAgIC8vVE9ETzogd2UgY291bGQgYWxzbyBkZXRlY3QgYW4gSVAgY29uZmlnIGNoYW5nZQorICAgICAgICAgICAgICAgICAgLy8gZnJvbSBhIERIQ1AgcmVuZXdhbCBhbmQgc2VuZCBvdXQgYSBjb25maWcgY2hhbmdlCisgICAgICAgICAgICAgICAgICAvLyBicm9hZGNhc3QKKyAgICAgICAgICAgICAgICAgIGlmIChtQ29uZmlnQ2hhbmdlZCkgeworICAgICAgICAgICAgICAgICAgICAgIHNlbmRDb25maWdDaGFuZ2VCcm9hZGNhc3QoKTsKKyAgICAgICAgICAgICAgICAgICAgICBtQ29uZmlnQ2hhbmdlZCA9IGZhbHNlOworICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgdHJhbnNpdGlvblRvKG1Db25uZWN0ZWRTdGF0ZSk7CisgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgY2FzZSBDTURfSVBfQ09ORklHX0ZBSUxVUkU6CisgICAgICAgICAgICAgICAgICBtV2lmaUluZm8uc2V0SXBBZGRyZXNzKDApOworCisgICAgICAgICAgICAgICAgICBMb2cuZShUQUcsICJJUCBjb25maWd1cmF0aW9uIGZhaWxlZCIpOworICAgICAgICAgICAgICAgICAgLyoqCisgICAgICAgICAgICAgICAgICAgKiBJZiB3ZSd2ZSBleGNlZWRlZCB0aGUgbWF4aW11bSBudW1iZXIgb2YgcmV0cmllcyBmb3IgREhDUAorICAgICAgICAgICAgICAgICAgICogdG8gYSBnaXZlbiBuZXR3b3JrLCBkaXNhYmxlIHRoZSBuZXR3b3JrCisgICAgICAgICAgICAgICAgICAgKi8KKyAgICAgICAgICAgICAgICAgIGlmICgrK21SZWNvbm5lY3RDb3VudCA+IGdldE1heERoY3BSZXRyaWVzKCkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgTG9nLmUoVEFHLCAiRmFpbGVkICIgKworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1SZWNvbm5lY3RDb3VudCArICIgdGltZXMsIERpc2FibGluZyAiICsgbUxhc3ROZXR3b3JrSWQpOworICAgICAgICAgICAgICAgICAgICAgIFdpZmlDb25maWdTdG9yZS5kaXNhYmxlTmV0d29yayhtTGFzdE5ldHdvcmtJZCk7CisgICAgICAgICAgICAgICAgICB9CisKKyAgICAgICAgICAgICAgICAgIC8qIERIQ1AgdGltZXMgb3V0IGFmdGVyIGFib3V0IDMwIHNlY29uZHMsIHdlIGRvIGEKKyAgICAgICAgICAgICAgICAgICAqIGRpc2Nvbm5lY3QgYW5kIGFuIGltbWVkaWF0ZSByZWNvbm5lY3QgdG8gdHJ5IGFnYWluCisgICAgICAgICAgICAgICAgICAgKi8KKyAgICAgICAgICAgICAgICAgIFdpZmlOYXRpdmUuZGlzY29ubmVjdENvbW1hbmQoKTsKKyAgICAgICAgICAgICAgICAgIFdpZmlOYXRpdmUucmVjb25uZWN0Q29tbWFuZCgpOworICAgICAgICAgICAgICAgICAgdHJhbnNpdGlvblRvKG1EaXNjb25uZWN0aW5nU3RhdGUpOworICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgIGNhc2UgQ01EX0RJU0NPTk5FQ1Q6CisgICAgICAgICAgICAgICAgICBXaWZpTmF0aXZlLmRpc2Nvbm5lY3RDb21tYW5kKCk7CisgICAgICAgICAgICAgICAgICB0cmFuc2l0aW9uVG8obURpc2Nvbm5lY3RpbmdTdGF0ZSk7CisgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgIC8qIElnbm9yZSBjb25uZWN0aW9uIHRvIHNhbWUgbmV0d29yayAqLworICAgICAgICAgICAgICBjYXNlIENNRF9DT05ORUNUX05FVFdPUks6CisgICAgICAgICAgICAgICAgICBpbnQgbmV0SWQgPSBtZXNzYWdlLmFyZzE7CisgICAgICAgICAgICAgICAgICBpZiAobVdpZmlJbmZvLmdldE5ldHdvcmtJZCgpID09IG5ldElkKSB7CisgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICByZXR1cm4gTk9UX0hBTkRMRUQ7CisgICAgICAgICAgICAgICAgICAvKiBJZ25vcmUgKi8KKyAgICAgICAgICAgICAgY2FzZSBORVRXT1JLX0NPTk5FQ1RJT05fRVZFTlQ6CisgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgY2FzZSBDTURfU1RPUF9EUklWRVI6CisgICAgICAgICAgICAgICAgICBzZW5kTWVzc2FnZShDTURfRElTQ09OTkVDVCk7CisgICAgICAgICAgICAgICAgICBkZWZlck1lc3NhZ2UobWVzc2FnZSk7CisgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgY2FzZSBDTURfU0VUX1NDQU5fTU9ERToKKyAgICAgICAgICAgICAgICAgIGlmIChtZXNzYWdlLmFyZzEgPT0gU0NBTl9PTkxZX01PREUpIHsKKyAgICAgICAgICAgICAgICAgICAgICBzZW5kTWVzc2FnZShDTURfRElTQ09OTkVDVCk7CisgICAgICAgICAgICAgICAgICAgICAgZGVmZXJNZXNzYWdlKG1lc3NhZ2UpOworICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgIGNhc2UgQ01EX1JFQ09ORklHVVJFX0lQOgorICAgICAgICAgICAgICAgICAgZGVmZXJNZXNzYWdlKG1lc3NhZ2UpOworICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgcmV0dXJuIE5PVF9IQU5ETEVEOworICAgICAgICAgIH0KKyAgICAgICAgICBFdmVudExvZy53cml0ZUV2ZW50KEVWRU5UTE9HX1dJRklfRVZFTlRfSEFORExFRCwgbWVzc2FnZS53aGF0KTsKKyAgICAgICAgICByZXR1cm4gSEFORExFRDsKKyAgICAgIH0KKworICAgICAgQE92ZXJyaWRlCisgICAgICBwdWJsaWMgdm9pZCBleGl0KCkgeworICAgICAgICAgIC8qIHJlc2V0IHBvd2VyIHN0YXRlICYgYmx1ZXRvb3RoIGNvZXhpc3RlbmNlIGlmIG9uIERIQ1AgKi8KKyAgICAgICAgICBpZiAoIW1Vc2VTdGF0aWNJcCkgeworICAgICAgICAgICAgICBpZiAocG93ZXJNb2RlICE9IERSSVZFUl9QT1dFUl9NT0RFX0FDVElWRSkgeworICAgICAgICAgICAgICAgICAgV2lmaU5hdGl2ZS5zZXRQb3dlck1vZGVDb21tYW5kKHBvd2VyTW9kZSk7CisgICAgICAgICAgICAgIH0KKworICAgICAgICAgICAgICBpZiAobW9kaWZpZWRCbHVldG9vdGhDb2V4aXN0ZW5jZU1vZGUpIHsKKyAgICAgICAgICAgICAgICAgIC8vIFNldCB0aGUgY29leGlzdGVuY2UgbW9kZSBiYWNrIHRvIGl0cyBkZWZhdWx0IHZhbHVlCisgICAgICAgICAgICAgICAgICBXaWZpTmF0aXZlLnNldEJsdWV0b290aENvZXhpc3RlbmNlTW9kZUNvbW1hbmQoCisgICAgICAgICAgICAgICAgICAgICAgICAgIFdpZmlOYXRpdmUuQkxVRVRPT1RIX0NPRVhJU1RFTkNFX01PREVfU0VOU0UpOworICAgICAgICAgICAgICB9CisgICAgICAgICAgfQorCisgICAgICB9CisgICAgfQorCisgICAgY2xhc3MgQ29ubmVjdGVkU3RhdGUgZXh0ZW5kcyBIaWVyYXJjaGljYWxTdGF0ZSB7CisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgdm9pZCBlbnRlcigpIHsKKyAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKFRBRywgZ2V0TmFtZSgpICsgIlxuIik7CisgICAgICAgICAgICBFdmVudExvZy53cml0ZUV2ZW50KEVWRU5UTE9HX1dJRklfU1RBVEVfQ0hBTkdFRCwgZ2V0TmFtZSgpKTsKKyAgICAgICAgfQorICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIGJvb2xlYW4gcHJvY2Vzc01lc3NhZ2UoTWVzc2FnZSBtZXNzYWdlKSB7CisgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsIGdldE5hbWUoKSArIG1lc3NhZ2UudG9TdHJpbmcoKSArICJcbiIpOworICAgICAgICAgICAgc3dpdGNoIChtZXNzYWdlLndoYXQpIHsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9ESVNDT05ORUNUOgorICAgICAgICAgICAgICAgICAgICBXaWZpTmF0aXZlLmRpc2Nvbm5lY3RDb21tYW5kKCk7CisgICAgICAgICAgICAgICAgICAgIHRyYW5zaXRpb25UbyhtRGlzY29ubmVjdGluZ1N0YXRlKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBDTURfUkVDT05GSUdVUkVfSVA6CisgICAgICAgICAgICAgICAgICAgIExvZy5kKFRBRywiUmVjb25maWd1cmluZyBJUCBvbiBjb25uZWN0aW9uIik7CisgICAgICAgICAgICAgICAgICAgIE5ldHdvcmtVdGlscy5yZXNldENvbm5lY3Rpb25zKG1JbnRlcmZhY2VOYW1lKTsKKyAgICAgICAgICAgICAgICAgICAgdHJhbnNpdGlvblRvKG1Db25uZWN0aW5nU3RhdGUpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVE9QX0RSSVZFUjoKKyAgICAgICAgICAgICAgICAgICAgc2VuZE1lc3NhZ2UoQ01EX0RJU0NPTk5FQ1QpOworICAgICAgICAgICAgICAgICAgICBkZWZlck1lc3NhZ2UobWVzc2FnZSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NFVF9TQ0FOX01PREU6CisgICAgICAgICAgICAgICAgICAgIGlmIChtZXNzYWdlLmFyZzEgPT0gU0NBTl9PTkxZX01PREUpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIHNlbmRNZXNzYWdlKENNRF9ESVNDT05ORUNUKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIGRlZmVyTWVzc2FnZShtZXNzYWdlKTsKKyAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgLyogSWdub3JlIGNvbm5lY3Rpb24gdG8gc2FtZSBuZXR3b3JrICovCisgICAgICAgICAgICAgICAgY2FzZSBDTURfQ09OTkVDVF9ORVRXT1JLOgorICAgICAgICAgICAgICAgICAgICBpbnQgbmV0SWQgPSBtZXNzYWdlLmFyZzE7CisgICAgICAgICAgICAgICAgICAgIGlmIChtV2lmaUluZm8uZ2V0TmV0d29ya0lkKCkgPT0gbmV0SWQpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBOT1RfSEFORExFRDsKKyAgICAgICAgICAgICAgICAgICAgLyogSWdub3JlICovCisgICAgICAgICAgICAgICAgY2FzZSBORVRXT1JLX0NPTk5FQ1RJT05fRVZFTlQ6CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgICAgIHJldHVybiBOT1RfSEFORExFRDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoRVZFTlRMT0dfV0lGSV9FVkVOVF9IQU5ETEVELCBtZXNzYWdlLndoYXQpOworICAgICAgICAgICAgcmV0dXJuIEhBTkRMRUQ7CisgICAgICAgIH0KKyAgICB9CisKKyAgICBjbGFzcyBEaXNjb25uZWN0aW5nU3RhdGUgZXh0ZW5kcyBIaWVyYXJjaGljYWxTdGF0ZSB7CisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgdm9pZCBlbnRlcigpIHsKKyAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKFRBRywgZ2V0TmFtZSgpICsgIlxuIik7CisgICAgICAgICAgICBFdmVudExvZy53cml0ZUV2ZW50KEVWRU5UTE9HX1dJRklfU1RBVEVfQ0hBTkdFRCwgZ2V0TmFtZSgpKTsKKyAgICAgICAgfQorICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIGJvb2xlYW4gcHJvY2Vzc01lc3NhZ2UoTWVzc2FnZSBtZXNzYWdlKSB7CisgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsIGdldE5hbWUoKSArIG1lc3NhZ2UudG9TdHJpbmcoKSArICJcbiIpOworICAgICAgICAgICAgc3dpdGNoIChtZXNzYWdlLndoYXQpIHsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TVE9QX0RSSVZFUjogLyogU3RvcCBkcml2ZXIgb25seSBhZnRlciBkaXNjb25uZWN0IGhhbmRsZWQgKi8KKyAgICAgICAgICAgICAgICAgICAgZGVmZXJNZXNzYWdlKG1lc3NhZ2UpOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBjYXNlIENNRF9TRVRfU0NBTl9NT0RFOgorICAgICAgICAgICAgICAgICAgICBpZiAobWVzc2FnZS5hcmcxID09IFNDQU5fT05MWV9NT0RFKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBkZWZlck1lc3NhZ2UobWVzc2FnZSk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE5PVF9IQU5ETEVEOworICAgICAgICAgICAgfQorICAgICAgICAgICAgRXZlbnRMb2cud3JpdGVFdmVudChFVkVOVExPR19XSUZJX0VWRU5UX0hBTkRMRUQsIG1lc3NhZ2Uud2hhdCk7CisgICAgICAgICAgICByZXR1cm4gSEFORExFRDsKKyAgICAgICAgfQorICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgZXhpdCgpIHsKKyAgICAgICAgICAgIGlmIChtRW5hYmxlQWxsTmV0d29ya3MpIHsKKyAgICAgICAgICAgICAgICBtRW5hYmxlQWxsTmV0d29ya3MgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICBXaWZpQ29uZmlnU3RvcmUuZW5hYmxlQWxsTmV0d29ya3MoKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgIH0KKworICAgIGNsYXNzIERpc2Nvbm5lY3RlZFN0YXRlIGV4dGVuZHMgSGllcmFyY2hpY2FsU3RhdGUgeworICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgcHVibGljIHZvaWQgZW50ZXIoKSB7CisgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsIGdldE5hbWUoKSArICJcbiIpOworICAgICAgICAgICAgRXZlbnRMb2cud3JpdGVFdmVudChFVkVOVExPR19XSUZJX1NUQVRFX0NIQU5HRUQsIGdldE5hbWUoKSk7CisgICAgICAgIH0KKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyBib29sZWFuIHByb2Nlc3NNZXNzYWdlKE1lc3NhZ2UgbWVzc2FnZSkgeworICAgICAgICAgICAgaWYgKERCRykgTG9nLmQoVEFHLCBnZXROYW1lKCkgKyBtZXNzYWdlLnRvU3RyaW5nKCkgKyAiXG4iKTsKKyAgICAgICAgICAgIHN3aXRjaCAobWVzc2FnZS53aGF0KSB7CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU0VUX1NDQU5fTU9ERToKKyAgICAgICAgICAgICAgICAgICAgaWYgKG1lc3NhZ2UuYXJnMSA9PSBTQ0FOX09OTFlfTU9ERSkgeworICAgICAgICAgICAgICAgICAgICAgICAgV2lmaU5hdGl2ZS5zZXRTY2FuUmVzdWx0SGFuZGxpbmdDb21tYW5kKG1lc3NhZ2UuYXJnMSk7CisgICAgICAgICAgICAgICAgICAgICAgICAvL1N1cHBsaWNhbnQgZGlzY29ubmVjdCB0byBwcmV2ZW50IGZ1cnRoZXIgY29ubmVjdHMKKyAgICAgICAgICAgICAgICAgICAgICAgIFdpZmlOYXRpdmUuZGlzY29ubmVjdENvbW1hbmQoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIG1Jc1NjYW5Nb2RlID0gdHJ1ZTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHRyYW5zaXRpb25UbyhtU2Nhbk1vZGVTdGF0ZSk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIC8qIElnbm9yZSBuZXR3b3JrIGRpc2Nvbm5lY3QgKi8KKyAgICAgICAgICAgICAgICBjYXNlIE5FVFdPUktfRElTQ09OTkVDVElPTl9FVkVOVDoKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE5PVF9IQU5ETEVEOworICAgICAgICAgICAgfQorICAgICAgICAgICAgRXZlbnRMb2cud3JpdGVFdmVudChFVkVOVExPR19XSUZJX0VWRU5UX0hBTkRMRUQsIG1lc3NhZ2Uud2hhdCk7CisgICAgICAgICAgICByZXR1cm4gSEFORExFRDsKKyAgICAgICAgfQorICAgIH0KKworICAgIGNsYXNzIFNvZnRBcFN0YXJ0ZWRTdGF0ZSBleHRlbmRzIEhpZXJhcmNoaWNhbFN0YXRlIHsKKyAgICAgICAgQE92ZXJyaWRlCisgICAgICAgIHB1YmxpYyB2b2lkIGVudGVyKCkgeworICAgICAgICAgICAgaWYgKERCRykgTG9nLmQoVEFHLCBnZXROYW1lKCkgKyAiXG4iKTsKKyAgICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoRVZFTlRMT0dfV0lGSV9TVEFURV9DSEFOR0VELCBnZXROYW1lKCkpOworICAgICAgICB9CisgICAgICAgIEBPdmVycmlkZQorICAgICAgICBwdWJsaWMgYm9vbGVhbiBwcm9jZXNzTWVzc2FnZShNZXNzYWdlIG1lc3NhZ2UpIHsKKyAgICAgICAgICAgIGlmIChEQkcpIExvZy5kKFRBRywgZ2V0TmFtZSgpICsgbWVzc2FnZS50b1N0cmluZygpICsgIlxuIik7CisgICAgICAgICAgICBzd2l0Y2gobWVzc2FnZS53aGF0KSB7CisgICAgICAgICAgICAgICAgY2FzZSBDTURfU1RPUF9BUDoKKyAgICAgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCJTdG9wcGluZyBTb2Z0IEFQIik7CisgICAgICAgICAgICAgICAgICAgIHNldFdpZmlBcFN0YXRlKFdJRklfQVBfU1RBVEVfRElTQUJMSU5HKTsKKyAgICAgICAgICAgICAgICAgICAgdHJ5IHsKKyAgICAgICAgICAgICAgICAgICAgICAgIG53U2VydmljZS5zdG9wQWNjZXNzUG9pbnQoKTsKKyAgICAgICAgICAgICAgICAgICAgfSBjYXRjaChFeGNlcHRpb24gZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgTG9nLmUoVEFHLCAiRXhjZXB0aW9uIGluIHN0b3BBY2Nlc3NQb2ludCgpIik7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgICAgdHJhbnNpdGlvblRvKG1Ecml2ZXJMb2FkZWRTdGF0ZSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgQ01EX1NUQVJUX0FQOgorICAgICAgICAgICAgICAgICAgICBMb2cuZChUQUcsIlNvZnRBUCBzZXQgb24gYSBydW5uaW5nIGFjY2VzcyBwb2ludCIpOworICAgICAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICAgICAgbndTZXJ2aWNlLnNldEFjY2Vzc1BvaW50KChXaWZpQ29uZmlndXJhdGlvbikgbWVzc2FnZS5vYmosCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtSW50ZXJmYWNlTmFtZSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNPRlRBUF9JRkFDRSk7CisgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2goRXhjZXB0aW9uIGUpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIExvZy5lKFRBRywgIkV4Y2VwdGlvbiBpbiBud1NlcnZpY2UgZHVyaW5nIHNvZnQgQVAgc2V0Iik7CisgICAgICAgICAgICAgICAgICAgICAgICB0cnkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIG53U2VydmljZS5zdG9wQWNjZXNzUG9pbnQoKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKEV4Y2VwdGlvbiBlZSkgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIFNsb2cuZShUQUcsICJDb3VsZCBub3Qgc3RvcCBBUCwgOiIgKyBlZSk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBzZW5kTWVzc2FnZShvYnRhaW5NZXNzYWdlKENNRF9VTkxPQURfRFJJVkVSLCBXSUZJX0FQX1NUQVRFX0ZBSUxFRCwgMCkpOworICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIC8qIEZhaWwgY2xpZW50IG1vZGUgb3BlcmF0aW9uIHdoZW4gc29mdCBBUCBpcyBlbmFibGVkICovCisgICAgICAgICAgICAgICAgY2FzZSBDTURfU1RBUlRfU1VQUExJQ0FOVDoKKyAgICAgICAgICAgICAgICAgICAgTG9nLmUoVEFHLCJDYW5ub3Qgc3RhcnQgc3VwcGxpY2FudCB3aXRoIGEgcnVubmluZyBzb2Z0IEFQIik7CisgICAgICAgICAgICAgICAgICAgIHNldFdpZmlTdGF0ZShXSUZJX1NUQVRFX1VOS05PV04pOworICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICBkZWZhdWx0OgorICAgICAgICAgICAgICAgICAgICByZXR1cm4gTk9UX0hBTkRMRUQ7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBFdmVudExvZy53cml0ZUV2ZW50KEVWRU5UTE9HX1dJRklfRVZFTlRfSEFORExFRCwgbWVzc2FnZS53aGF0KTsKKyAgICAgICAgICAgIHJldHVybiBIQU5ETEVEOworICAgICAgICB9CisgICAgfQorCisKKyAgICBjbGFzcyBTdXBwbGljYW50U3RhdGVUcmFja2VyIGV4dGVuZHMgSGllcmFyY2hpY2FsU3RhdGVNYWNoaW5lIHsKKworICAgICAgICBwcml2YXRlIGludCBtUnNzaVBvbGxUb2tlbiA9IDA7CisKKyAgICAgICAgLyoqCisgICAgICAgICAqIFRoZSBtYXggbnVtYmVyIG9mIHRoZSBXUEEgc3VwcGxpY2FudCBsb29wIGl0ZXJhdGlvbnMgYmVmb3JlIHdlCisgICAgICAgICAqIGRlY2lkZSB0aGF0IHRoZSBsb29wIHNob3VsZCBiZSB0ZXJtaW5hdGVkOgorICAgICAgICAgKi8KKyAgICAgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IE1BWF9TVVBQTElDQU5UX0xPT1BfSVRFUkFUSU9OUyA9IDQ7CisgICAgICAgIHByaXZhdGUgaW50IG1Mb29wRGV0ZWN0SW5kZXggPSAwOworICAgICAgICBwcml2YXRlIGludCBtTG9vcERldGVjdENvdW50ID0gMDsKKworICAgICAgICAvKioKKyAgICAgICAgICogIFN1cHBsaWNhbnQgc3RhdGUgY2hhbmdlIGNvbW1hbmRzIGZvbGxvdworICAgICAgICAgKiAgdGhlIG9yZGluYWwgdmFsdWVzIGRlZmluZWQgaW4gU3VwcGxpY2FudFN0YXRlLmphdmEKKyAgICAgICAgICovCisgICAgICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBESVNDT05ORUNURUQgICAgICAgICAgID0gMDsKKyAgICAgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IElOQUNUSVZFICAgICAgICAgICAgICAgPSAxOworICAgICAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgU0NBTk5JTkcgICAgICAgICAgICAgICA9IDI7CisgICAgICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBBU1NPQ0lBVElORyAgICAgICAgICAgID0gMzsKKyAgICAgICAgcHJpdmF0ZSBzdGF0aWMgZmluYWwgaW50IEFTU09DSUFURUQgICAgICAgICAgICAgPSA0OworICAgICAgICBwcml2YXRlIHN0YXRpYyBmaW5hbCBpbnQgRk9VUl9XQVlfSEFORFNIQUtFICAgICA9IDU7CisgICAgICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIGludCBHUk9VUF9IQU5EU0hBS0UgICAgICAgID0gNjsKKyAgICAgICAgcHJpdmF0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IGJvb2xlYW4gaGFuZGxlVHJhbnNpdGlvbihNZXNzYWdlIG1zZykgeworICAgICAgICAgICAgaWYgKERCRykgTG9nLmQoVEFHLCBnZXROYW1lKCkgKyBtc2cudG9TdHJpbmcoKSArICJcbiIpOworICAgICAgICAgICAgc3dpdGNoIChtc2cud2hhdCkgeworICAgICAgICAgICAgICAgIGNhc2UgRElTQ09OTkVDVEVEOgorICAgICAgICAgICAgICAgICAgICB0cmFuc2l0aW9uVG8obURpc2Nvbm5lY3RTdGF0ZSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgU0NBTk5JTkc6CisgICAgICAgICAgICAgICAgICAgIHRyYW5zaXRpb25UbyhtU2NhblN0YXRlKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBBU1NPQ0lBVElORzoKKyAgICAgICAgICAgICAgICAgICAgU3RhdGVDaGFuZ2VSZXN1bHQgc3RhdGVDaGFuZ2VSZXN1bHQgPSAoU3RhdGVDaGFuZ2VSZXN1bHQpIG1zZy5vYmo7CisgICAgICAgICAgICAgICAgICAgIC8qIEJTU0lEIGlzIHZhbGlkIG9ubHkgaW4gQVNTT0NJQVRJTkcgc3RhdGUgKi8KKyAgICAgICAgICAgICAgICAgICAgbVdpZmlJbmZvLnNldEJTU0lEKHN0YXRlQ2hhbmdlUmVzdWx0LkJTU0lEKTsKKyAgICAgICAgICAgICAgICAgICAgLy8kRkFMTC1USFJPVUdIJAorICAgICAgICAgICAgICAgIGNhc2UgQVNTT0NJQVRFRDoKKyAgICAgICAgICAgICAgICBjYXNlIEZPVVJfV0FZX0hBTkRTSEFLRToKKyAgICAgICAgICAgICAgICBjYXNlIEdST1VQX0hBTkRTSEFLRToKKyAgICAgICAgICAgICAgICAgICAgdHJhbnNpdGlvblRvKG1IYW5kc2hha2VTdGF0ZSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgQ09NUExFVEVEOgorICAgICAgICAgICAgICAgICAgICB0cmFuc2l0aW9uVG8obUNvbXBsZXRlZFN0YXRlKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgY2FzZSBET1JNQU5UOgorICAgICAgICAgICAgICAgICAgICB0cmFuc2l0aW9uVG8obURvcm1hbnRTdGF0ZSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgSU5BQ1RJVkU6CisgICAgICAgICAgICAgICAgICAgIHRyYW5zaXRpb25UbyhtSW5hY3RpdmVTdGF0ZSk7CisgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgIGNhc2UgVU5JTklUSUFMSVpFRDoKKyAgICAgICAgICAgICAgICBjYXNlIElOVkFMSUQ6CisgICAgICAgICAgICAgICAgICAgIHRyYW5zaXRpb25UbyhtVW5pbml0aWFsaXplZFN0YXRlKTsKKyAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgcmV0dXJuIE5PVF9IQU5ETEVEOworICAgICAgICAgICAgfQorICAgICAgICAgICAgU3RhdGVDaGFuZ2VSZXN1bHQgc3RhdGVDaGFuZ2VSZXN1bHQgPSAoU3RhdGVDaGFuZ2VSZXN1bHQpIG1zZy5vYmo7CisgICAgICAgICAgICBTdXBwbGljYW50U3RhdGUgc3VwU3RhdGUgPSAoU3VwcGxpY2FudFN0YXRlKSBzdGF0ZUNoYW5nZVJlc3VsdC5zdGF0ZTsKKyAgICAgICAgICAgIHNldERldGFpbGVkU3RhdGUoV2lmaUluZm8uZ2V0RGV0YWlsZWRTdGF0ZU9mKHN1cFN0YXRlKSk7CisgICAgICAgICAgICBtV2lmaUluZm8uc2V0U3VwcGxpY2FudFN0YXRlKHN1cFN0YXRlKTsKKyAgICAgICAgICAgIG1XaWZpSW5mby5zZXROZXR3b3JrSWQoc3RhdGVDaGFuZ2VSZXN1bHQubmV0d29ya0lkKTsKKyAgICAgICAgICAgIHJldHVybiBIQU5ETEVEOworICAgICAgICB9CisKKyAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCisgICAgICAgICAqIEhTTSBzdGF0ZXMKKyAgICAgICAgICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCisKKyAgICAgICAgY2xhc3MgSW5pdGlhbGl6ZWRTdGF0ZSBleHRlbmRzIEhpZXJhcmNoaWNhbFN0YXRlIHsKKyAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgIHB1YmxpYyB2b2lkIGVudGVyKCkgeworICAgICAgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsIGdldE5hbWUoKSArICJcbiIpOworICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgcHVibGljIGJvb2xlYW4gcHJvY2Vzc01lc3NhZ2UoTWVzc2FnZSBtZXNzYWdlKSB7CisgICAgICAgICAgICAgICAgaWYgKERCRykgTG9nLmQoVEFHLCBnZXROYW1lKCkgKyBtZXNzYWdlLnRvU3RyaW5nKCkgKyAiXG4iKTsKKyAgICAgICAgICAgICAgICBzd2l0Y2ggKG1lc3NhZ2Uud2hhdCkgeworICAgICAgICAgICAgICAgICAgICBjYXNlIENNRF9TVEFSVF9TQ0FOOgorICAgICAgICAgICAgICAgICAgICAgICAgV2lmaU5hdGl2ZS5zY2FuQ29tbWFuZChtZXNzYWdlLmFyZzEgPT0gU0NBTl9BQ1RJVkUpOworICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoREJHKSBMb2cudyhUQUcsICJJZ25vcmluZyAiICsgbWVzc2FnZSk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcmV0dXJuIEhBTkRMRUQ7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBjbGFzcyBVbmluaXRpYWxpemVkU3RhdGUgZXh0ZW5kcyBIaWVyYXJjaGljYWxTdGF0ZSB7CisgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgICBwdWJsaWMgdm9pZCBlbnRlcigpIHsKKyAgICAgICAgICAgICAgICAgaWYgKERCRykgTG9nLmQoVEFHLCBnZXROYW1lKCkgKyAiXG4iKTsKKyAgICAgICAgICAgICAgICAgbU5ldHdvcmtJbmZvLnNldElzQXZhaWxhYmxlKGZhbHNlKTsKKyAgICAgICAgICAgICAgICAgcmVzZXRMb29wRGV0ZWN0aW9uKCk7CisgICAgICAgICAgICAgICAgIG1QYXNzd29yZEtleU1heUJlSW5jb3JyZWN0ID0gZmFsc2U7CisgICAgICAgICAgICAgfQorICAgICAgICAgICAgQE92ZXJyaWRlCisgICAgICAgICAgICBwdWJsaWMgYm9vbGVhbiBwcm9jZXNzTWVzc2FnZShNZXNzYWdlIG1lc3NhZ2UpIHsKKyAgICAgICAgICAgICAgICBzd2l0Y2gobWVzc2FnZS53aGF0KSB7CisgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWhhbmRsZVRyYW5zaXRpb24obWVzc2FnZSkpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoREJHKSBMb2cudyhUQUcsICJJZ25vcmluZyAiICsgbWVzc2FnZSk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcmV0dXJuIEhBTkRMRUQ7CisgICAgICAgICAgICB9CisgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgIHB1YmxpYyB2b2lkIGV4aXQoKSB7CisgICAgICAgICAgICAgICAgbU5ldHdvcmtJbmZvLnNldElzQXZhaWxhYmxlKHRydWUpOworICAgICAgICAgICAgfQorICAgICAgICB9CisKKyAgICAgICAgY2xhc3MgSW5hY3RpdmVTdGF0ZSBleHRlbmRzIEhpZXJhcmNoaWNhbFN0YXRlIHsKKyAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgIHB1YmxpYyB2b2lkIGVudGVyKCkgeworICAgICAgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsIGdldE5hbWUoKSArICJcbiIpOworICAgICAgICAgICAgICAgICBNZXNzYWdlIG1lc3NhZ2UgPSBnZXRDdXJyZW50TWVzc2FnZSgpOworICAgICAgICAgICAgICAgICBTdGF0ZUNoYW5nZVJlc3VsdCBzdGF0ZUNoYW5nZVJlc3VsdCA9IChTdGF0ZUNoYW5nZVJlc3VsdCkgbWVzc2FnZS5vYmo7CisKKyAgICAgICAgICAgICAgICAgbU5ldHdvcmtJbmZvLnNldElzQXZhaWxhYmxlKGZhbHNlKTsKKyAgICAgICAgICAgICAgICAgcmVzZXRMb29wRGV0ZWN0aW9uKCk7CisgICAgICAgICAgICAgICAgIG1QYXNzd29yZEtleU1heUJlSW5jb3JyZWN0ID0gZmFsc2U7CisKKyAgICAgICAgICAgICAgICAgc2VuZFN1cHBsaWNhbnRTdGF0ZUNoYW5nZWRCcm9hZGNhc3Qoc3RhdGVDaGFuZ2VSZXN1bHQsIGZhbHNlKTsKKyAgICAgICAgICAgICB9CisgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgIHB1YmxpYyBib29sZWFuIHByb2Nlc3NNZXNzYWdlKE1lc3NhZ2UgbWVzc2FnZSkgeworICAgICAgICAgICAgICAgIHJldHVybiBoYW5kbGVUcmFuc2l0aW9uKG1lc3NhZ2UpOworICAgICAgICAgICAgfQorICAgICAgICAgICAgQE92ZXJyaWRlCisgICAgICAgICAgICBwdWJsaWMgdm9pZCBleGl0KCkgeworICAgICAgICAgICAgICAgIG1OZXR3b3JrSW5mby5zZXRJc0F2YWlsYWJsZSh0cnVlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisKKyAgICAgICAgY2xhc3MgRGlzY29ubmVjdGVkU3RhdGUgZXh0ZW5kcyBIaWVyYXJjaGljYWxTdGF0ZSB7CisgICAgICAgICAgICBAT3ZlcnJpZGUKKyAgICAgICAgICAgICBwdWJsaWMgdm9pZCBlbnRlcigpIHsKKyAgICAgICAgICAgICAgICAgaWYgKERCRykgTG9nLmQoVEFHLCBnZXROYW1lKCkgKyAiXG4iKTsKKyAgICAgICAgICAgICAgICAgTWVzc2FnZSBtZXNzYWdlID0gZ2V0Q3VycmVudE1lc3NhZ2UoKTsKKyAgICAgICAgICAgICAgICAgU3RhdGVDaGFuZ2VSZXN1bHQgc3RhdGVDaGFuZ2VSZXN1bHQgPSAoU3RhdGVDaGFuZ2VSZXN1bHQpIG1lc3NhZ2Uub2JqOworCisgICAgICAgICAgICAgICAgIHJlc2V0TG9vcERldGVjdGlvbigpOworCisgICAgICAgICAgICAgICAgIC8qIElmIGEgZGlzY29ubmVjdCBldmVudCBoYXBwZW5zIGFmdGVyIGEgcGFzc3dvcmQga2V5IGZhaWx1cmUKKyAgICAgICAgICAgICAgICAgICogZXZlbnQsIGRpc2FibGUgdGhlIG5ldHdvcmsKKyAgICAgICAgICAgICAgICAgICovCisgICAgICAgICAgICAgICAgIGlmIChtUGFzc3dvcmRLZXlNYXlCZUluY29ycmVjdCkgeworICAgICAgICAgICAgICAgICAgICAgTG9nLmQoVEFHLCAiRmFpbGVkIHRvIGF1dGhlbnRpY2F0ZSwgZGlzYWJsaW5nIG5ldHdvcmsgIiArCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1XaWZpSW5mby5nZXROZXR3b3JrSWQoKSk7CisgICAgICAgICAgICAgICAgICAgICBXaWZpQ29uZmlnU3RvcmUuZGlzYWJsZU5ldHdvcmsobVdpZmlJbmZvLmdldE5ldHdvcmtJZCgpKTsKKyAgICAgICAgICAgICAgICAgICAgIG1QYXNzd29yZEtleU1heUJlSW5jb3JyZWN0ID0gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgICBzZW5kU3VwcGxpY2FudFN0YXRlQ2hhbmdlZEJyb2FkY2FzdChzdGF0ZUNoYW5nZVJlc3VsdCwgdHJ1ZSk7CisgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICAgZWxzZSB7CisgICAgICAgICAgICAgICAgICAgICBzZW5kU3VwcGxpY2FudFN0YXRlQ2hhbmdlZEJyb2FkY2FzdChzdGF0ZUNoYW5nZVJlc3VsdCwgZmFsc2UpOworICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgfQorICAgICAgICAgICAgQE92ZXJyaWRlCisgICAgICAgICAgICBwdWJsaWMgYm9vbGVhbiBwcm9jZXNzTWVzc2FnZShNZXNzYWdlIG1lc3NhZ2UpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gaGFuZGxlVHJhbnNpdGlvbihtZXNzYWdlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGNsYXNzIFNjYW5TdGF0ZSBleHRlbmRzIEhpZXJhcmNoaWNhbFN0YXRlIHsKKyAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgIHB1YmxpYyB2b2lkIGVudGVyKCkgeworICAgICAgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsIGdldE5hbWUoKSArICJcbiIpOworICAgICAgICAgICAgICAgICBNZXNzYWdlIG1lc3NhZ2UgPSBnZXRDdXJyZW50TWVzc2FnZSgpOworICAgICAgICAgICAgICAgICBTdGF0ZUNoYW5nZVJlc3VsdCBzdGF0ZUNoYW5nZVJlc3VsdCA9IChTdGF0ZUNoYW5nZVJlc3VsdCkgbWVzc2FnZS5vYmo7CisKKyAgICAgICAgICAgICAgICAgbVBhc3N3b3JkS2V5TWF5QmVJbmNvcnJlY3QgPSBmYWxzZTsKKyAgICAgICAgICAgICAgICAgcmVzZXRMb29wRGV0ZWN0aW9uKCk7CisgICAgICAgICAgICAgICAgIHNlbmRTdXBwbGljYW50U3RhdGVDaGFuZ2VkQnJvYWRjYXN0KHN0YXRlQ2hhbmdlUmVzdWx0LCBmYWxzZSk7CisgICAgICAgICAgICAgfQorICAgICAgICAgICAgQE92ZXJyaWRlCisgICAgICAgICAgICBwdWJsaWMgYm9vbGVhbiBwcm9jZXNzTWVzc2FnZShNZXNzYWdlIG1lc3NhZ2UpIHsKKyAgICAgICAgICAgICAgICByZXR1cm4gaGFuZGxlVHJhbnNpdGlvbihtZXNzYWdlKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGNsYXNzIENvbm5lY3RTdGF0ZSBleHRlbmRzIEhpZXJhcmNoaWNhbFN0YXRlIHsKKyAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgIHB1YmxpYyB2b2lkIGVudGVyKCkgeworICAgICAgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsIGdldE5hbWUoKSArICJcbiIpOworICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgcHVibGljIGJvb2xlYW4gcHJvY2Vzc01lc3NhZ2UoTWVzc2FnZSBtZXNzYWdlKSB7CisgICAgICAgICAgICAgICAgc3dpdGNoIChtZXNzYWdlLndoYXQpIHsKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBDTURfU1RBUlRfU0NBTjoKKyAgICAgICAgICAgICAgICAgICAgICAgIFdpZmlOYXRpdmUuc2V0U2NhblJlc3VsdEhhbmRsaW5nQ29tbWFuZChTQ0FOX09OTFlfTU9ERSk7CisgICAgICAgICAgICAgICAgICAgICAgICBXaWZpTmF0aXZlLnNjYW5Db21tYW5kKG1lc3NhZ2UuYXJnMSA9PSBTQ0FOX0FDVElWRSk7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBOT1RfSEFORExFRDsKKyAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgcmV0dXJuIEhBTkRMRUQ7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKworICAgICAgICBjbGFzcyBIYW5kc2hha2VTdGF0ZSBleHRlbmRzIEhpZXJhcmNoaWNhbFN0YXRlIHsKKyAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgIHB1YmxpYyB2b2lkIGVudGVyKCkgeworICAgICAgICAgICAgICAgICBpZiAoREJHKSBMb2cuZChUQUcsIGdldE5hbWUoKSArICJcbiIpOworICAgICAgICAgICAgICAgICBmaW5hbCBNZXNzYWdlIG1lc3NhZ2UgPSBnZXRDdXJyZW50TWVzc2FnZSgpOworICAgICAgICAgICAgICAgICBTdGF0ZUNoYW5nZVJlc3VsdCBzdGF0ZUNoYW5nZVJlc3VsdCA9IChTdGF0ZUNoYW5nZVJlc3VsdCkgbWVzc2FnZS5vYmo7CisKKyAgICAgICAgICAgICAgICAgaWYgKG1Mb29wRGV0ZWN0SW5kZXggPiBtZXNzYWdlLndoYXQpIHsKKyAgICAgICAgICAgICAgICAgICAgIG1Mb29wRGV0ZWN0Q291bnQrKzsKKyAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICBpZiAobUxvb3BEZXRlY3RDb3VudCA+IE1BWF9TVVBQTElDQU5UX0xPT1BfSVRFUkFUSU9OUykgeworICAgICAgICAgICAgICAgICAgICAgV2lmaUNvbmZpZ1N0b3JlLmRpc2FibGVOZXR3b3JrKHN0YXRlQ2hhbmdlUmVzdWx0Lm5ldHdvcmtJZCk7CisgICAgICAgICAgICAgICAgICAgICBtTG9vcERldGVjdENvdW50ID0gMDsKKyAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgIG1Mb29wRGV0ZWN0SW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AgICAgICAgICAgICAgICAgICAgICAgUE9MTF9SU1NJX0lOVEVSVkFMX01TRUNTKTsKKyAgICAgICAgICAgICAgICAgfQorCisgICAgICAgICAgICAgICAgIHJlc2V0TG9vcERldGVjdGlvbigpOworCisgICAgICAgICAgICAgICAgIG1QYXNzd29yZEtleU1heUJlSW5jb3JyZWN0ID0gZmFsc2U7CisgICAgICAgICAgICAgICAgIHNlbmRTdXBwbGljYW50U3RhdGVDaGFuZ2VkQnJvYWRjYXN0KHN0YXRlQ2hhbmdlUmVzdWx0LCBmYWxzZSk7CisgICAgICAgICAgICAgfQorICAgICAgICAgICAgQE92ZXJyaWRlCisgICAgICAgICAgICBwdWJsaWMgYm9vbGVhbiBwcm9jZXNzTWVzc2FnZShNZXNzYWdlIG1lc3NhZ2UpIHsKKyAgICAgICAgICAgICAgICBzd2l0Y2gobWVzc2FnZS53aGF0KSB7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgQVNTT0NJQVRJTkc6CisgICAgICAgICAgICAgICAgICAgIGNhc2UgQVNTT0NJQVRFRDoKKyAgICAgICAgICAgICAgICAgICAgY2FzZSBGT1VSX1dBWV9IQU5EU0hBS0U6CisgICAgICAgICAgICAgICAgICAgIGNhc2UgR1JPVVBfSEFORFNIQUtFOgorICAgICAgICAgICAgICAgICAgICBjYXNlIENPTVBMRVRFRDoKKyAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOworICAgICAgICAgICAgICAgICAgICBjYXNlIENNRF9SU1NJX1BPTEw6CisgICAgICAgICAgICAgICAgICAgICAgICBpZiAobWVzc2FnZS5hcmcxID09IG1Sc3NpUG9sbFRva2VuKSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gR2V0IEluZm8gYW5kIGNvbnRpbnVlIHBvbGxpbmcKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0UG9sbGVkSW5mbygpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbmRNZXNzYWdlRGVsYXllZChvYnRhaW5NZXNzYWdlKENNRF9SU1NJX1BPTEwsIG1Sc3NpUG9sbFRva2VuLCAwKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBPTExfUlNTSV9JTlRFUlZBTF9NU0VDUyk7CisgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIFBvbGxpbmcgaGFzIGNvbXBsZXRlZAorICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAgICAgICAgICAgICAgIGNhc2UgQ01EX0VOQUJMRV9SU1NJX1BPTEw6CisgICAgICAgICAgICAgICAgICAgICAgICBtUnNzaVBvbGxUb2tlbisrOworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG1FbmFibGVSc3NpUG9sbGluZykgeworICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGZpcnN0IHBvbGwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0UG9sbGVkSW5mbygpOworICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbmRNZXNzYWdlRGVsYXllZChvYnRhaW5NZXNzYWdlKENNRF9SU1NJX1BPTEwsIG1Sc3NpUG9sbFRva2VuLCAwKSwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBPTExfUlNTSV9JTlRFUlZBTF9NU0VDUyk7CisgICAgICAgICAgICAgICAgICAgICAgICB9CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBoYW5kbGVUcmFuc2l0aW9uKG1lc3NhZ2UpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICByZXR1cm4gSEFORExFRDsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIGNsYXNzIERvcm1hbnRTdGF0ZSBleHRlbmRzIEhpZXJhcmNoaWNhbFN0YXRlIHsKKyAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgcHVibGljIHZvaWQgZW50ZXIoKSB7CisgICAgICAgICAgICAgICAgaWYgKERCRykgTG9nLmQoVEFHLCBnZXROYW1lKCkgKyAiXG4iKTsKKyAgICAgICAgICAgICAgICBNZXNzYWdlIG1lc3NhZ2UgPSBnZXRDdXJyZW50TWVzc2FnZSgpOworICAgICAgICAgICAgICAgIFN0YXRlQ2hhbmdlUmVzdWx0IHN0YXRlQ2hhbmdlUmVzdWx0ID0gKFN0YXRlQ2hhbmdlUmVzdWx0KSBtZXNzYWdlLm9iajsKKworICAgICAgICAgICAgICAgIHJlc2V0TG9vcERldGVjdGlvbigpOworICAgICAgICAgICAgICAgIG1QYXNzd29yZEtleU1heUJlSW5jb3JyZWN0ID0gZmFsc2U7CisKKyAgICAgICAgICAgICAgICBzZW5kU3VwcGxpY2FudFN0YXRlQ2hhbmdlZEJyb2FkY2FzdChzdGF0ZUNoYW5nZVJlc3VsdCwgZmFsc2UpOworCisgICAgICAgICAgICAgICAgLyogVE9ETzogcmVjb25uZWN0IGlzIG5vdyBiZWluZyBoYW5kbGVkIGF0IERIQ1AgZmFpbHVyZSBoYW5kbGluZworICAgICAgICAgICAgICAgICAqIElmIHdlIHJ1biBpbnRvIGlzc3VlcyB3aXRoIHN0YXlpbmcgaW4gRG9ybWFudCBzdGF0ZSwgbWlnaHQKKyAgICAgICAgICAgICAgICAgKiBuZWVkIGEgcmVjb25uZWN0IGhlcmUKKyAgICAgICAgICAgICAgICAgKi8KKyAgICAgICAgICAgIH0KKyAgICAgICAgICAgIEBPdmVycmlkZQorICAgICAgICAgICAgcHVibGljIGJvb2xlYW4gcHJvY2Vzc01lc3NhZ2UoTWVzc2FnZSBtZXNzYWdlKSB7CisgICAgICAgICAgICAgICAgcmV0dXJuIGhhbmRsZVRyYW5zaXRpb24obWVzc2FnZSk7CisgICAgICAgICAg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mx5TW9kZSA/Ci0gICAgICAgICAgICAgICAgICAgIFNVUFBMX1NDQU5fSEFORExJTkdfTElTVF9PTkxZIDogU1VQUExfU0NBTl9IQU5ETElOR19OT1JNQUwpOwotICAgICAgICAgICAgaWYgKExPQ0FMX0xPR0QpIExvZy52KFRBRywgIlNjYW4tb25seSBtb2RlIGNoYW5naW5nIHRvICIgKyBzY2FuT25seU1vZGUgKyAiIHNjYW5UeXBlPSIgKyBzY2FuVHlwZSk7Ci0gICAgICAgICAgICBpZiAoc2V0U2NhblJlc3VsdEhhbmRsaW5nKHNjYW5UeXBlKSkgewotICAgICAgICAgICAgICAgIG1Jc1NjYW5Pbmx5ID0gc2Nhbk9ubHlNb2RlOwotICAgICAgICAgICAgICAgIGlmICghaXNEcml2ZXJTdG9wcGVkKCkpIHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKHNjYW5Pbmx5TW9kZSkgewotICAgICAgICAgICAgICAgICAgICAgICAgZGlzY29ubmVjdCgpOwotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICAgICAgcmVjb25uZWN0Q29tbWFuZCgpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgfQotICAgICAgICB9Ci0gICAgfQotCi0gICAgLyoqCi0gICAgICogU2V0IHN1c3BlbmQgbW9kZSBvcHRpbWl6YXRpb25zLiBUaGVzZSBpbmNsdWRlOgotICAgICAqIC0gcGFja2V0IGZpbHRlcmluZwotICAgICAqIC0gdHVybiBvZmYgcm9hbWluZwotICAgICAqIC0gRFRJTSBzZXR0aW5ncwotICAgICAqCi0gICAgICogVXNlcyByZWZlcmVuY2UgY291bnRpbmcgdG8ga2VlcCB0aGUgc3VzcGVuZCBvcHRpbWl6YXRpb25zIGRpc2FibGVkCi0gICAgICogYXMgbG9uZyBhcyBvbmUgZW50aXR5IHdhbnRzIG9wdGltaXphdGlvbnMgZGlzYWJsZWQuCi0gICAgICoKL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kZQotICAgIHB1YmxpYyB2b2lkIGhhbmRsZU1lc3NhZ2UoTWVzc2FnZSBtc2cpIHsKLSAgICAgICAgSW50ZW50IGludGVudDsKLQotICAgICAgICBzd2l0Y2ggKG1zZy53aGF0KSB7Ci0gICAgICAgICAgICBjYXNlIEVWRU5UX1NVUFBMSUNBTlRfQ09OTkVDVElPTjoKLSAgICAgICAgICAgICAgICBtUnVuU3RhdGUgPSBSVU5fU1RBVEVfUlVOTklORzsKLSAgICAgICAgICAgICAgICBub3RlUnVuU3RhdGUoKTsKLSAgICAgICAgICAgICAgICBjaGVja1VzZVN0YXRpY0lwKCk7Ci0gICAgICAgICAgICAgICAgLyogUmVzZXQgbm90aWZpY2F0aW9uIHN0YXRlIG9uIG5ldyBjb25uZWN0aW9uICovCi0gICAgICAgICAgICAgICAgcmVzZXROb3RpZmljYXRpb25UaW1lcigpOwotICAgICAgICAgICAgICAgIC8qCi0gICAgICAgICAgICAgICAgICogREhDUCByZXF1ZXN0cyBhcmUgYmxvY2tpbmcsIHNvIHJ1biB0aGVtIGluIGEgc2VwYXJhdGUgdGhyZWFkLgotICAgICAgICAgICAgICAgICAqLwotICAgICAgICAgICAgICAgIEhhbmRsZXJUaHJlYWQgZGhjcFRocmVhZCA9IG5ldyBIYW5kbGVyVGhyZWFkKCJESENQIEhhbmRsZXIgVGhyZWFkIik7Ci0gICAgICAgICAgICAgICAgZGhjcFRocmVhZC5zdGFydCgpOwotICAgICAgICAgICAgICAgIG1EaGNwVGFyZ2V0ID0gbmV3IERoY3BIYW5kbGVyKGRoY3BUaHJlYWQuZ2V0TG9vcGVyKCksIHRoaXMpOwotICAgICAgICAgICAgICAgIG1Jc1NjYW5Nb2RlQWN0aXZlID0gdHJ1ZTsKLSAgICAgICAgICAgICAgICBtSXNIaWdoUGVyZkVuYWJsZWQgPSBmYWxzZTsKLSAgICAgICAgICAgICAgICBtT3B0aW1pemF0aW9uc0Rpc2FibGVkUmVmQ291bnQgPSAwOwotICAgICAgICAgICAgICAgIG1Qb3dlck1vZGVSZWZDb3VudCA9IDA7Ci0gICAgICAgICAgICAgICAgbVRvcm5Eb3duQnlDb25uTWdyID0gZmFsc2U7Ci0gICAgICAgICAgICAgICAgbUxhc3RCc3NpZCA9IG51bGw7Ci0gICAgICAgICAgICAgICAgbUxhc3RTc2lkID0gbnVsbDsKLSAgICAgICAgICAgICAgICBtSXNBbnlOZXR3b3JrRGlzYWJsZWQuc2V0KGZhbHNlKTsKLSAgICAgICAgICAgICAgICByZXF1ZXN0Q29ubmVjdGlvbkluZm8oKTsKLSAgICAgICAgICAgICAgICBTdXBwbGljYW50U3RhdGUgc3VwcGxTdGF0ZSA9IG1XaWZpSW5mby5nZXRTdXBwbGljYW50U3RhdGUoKTsKLSAgICAgICAgICAgICAgICAvKioKLSAgICAgICAgICAgICAgICAgKiBUaGUgTUFDIGFkZHJlc3MgaXNuJ3QgZ29pbmcgdG8gY2hhbmdlLCBzbyBqdXN0IHJlcXVlc3QgaXQKLSAgICAgICAgICAgICAgICAgKiBvbmNlIGhlcmUuCi0gICAgICAgICAgICAgICAgICovCi0gICAgICAgICAgICAgICAgU3RyaW5nIG1hY2FkZHIgPSBnZXRNYWNBZGRyZXNzKCk7Ci0KLSAgICAgICAgICAgICAgICBpZiAobWFjYWRkciAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1XaWZpSW5mby5zZXRNYWNBZGRyZXNzKG1hY2FkZHIpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBpZiAoTE9DQUxfTE9HRCkgTG9nLnYoVEFHLCAiQ29ubmVjdGlvbiB0byBzdXBwbGljYW50IGVzdGFibGlzaGVkLCBzdGF0ZT0iICsKLSAgICAgICAgICAgICAgICAgICAgc3VwcGxTdGF0ZSk7Ci0gICAgICAgICAgICAgICAgLy8gV2ktRmkgc3VwcGxpY2FudCBjb25uZWN0aW9uIHN0YXRlIGNoYW5nZWQ6Ci0gICAgICAgICAgICAgICAgLy8gWzMxLSAyXSBSZXNlcnZlZCBmb3IgZnV0dXJlIHVzZQotICAgICAgICAgICAgICAgIC8vIFsgMS0gMF0gQ29ubmVjdGVkIHRvIHN1cHBsaWNhbnQgKDEpLCBkaXNjb25uZWN0ZWQgZnJvbSBzdXBwbGljYW50ICgwKSAsCi0gICAgICAgICAgICAgICAgLy8gICAgICAgICBvciBzdXBwbGljYW50IGRpZWQgKDIpCi0gICAgICAgICAgICAgICAgRXZlbnRMb2cud3JpdGVFdmVudChFVkVOVExPR19TVVBQTElDQU5UX0NPTk5FQ1RJT05fU1RBVEVfQ0hBTkdFRCwgMSk7Ci0gICAgICAgICAgICAgICAgLyoKLSAgICAgICAgICAgICAgICAgKiBUaGUgQ09NUExFVEVEIHN0YXRlIGNoYW5nZSBmcm9tIHRoZSBzdXBwbGljYW50IG1heSBoYXZlIG9jY3VycmVkCi0gICAgICAgICAgICAgICAgICogaW4gYmV0d2VlbiBwb2xsaW5nIGZvciBzdXBwbGljYW50IGF2YWlsYWJpbGl0eSwgaW4gd2hpY2ggY2FzZQotICAgICAgICAgICAgICAgICAqIHdlIGRpZG4ndCBwZXJmb3JtIGEgREhDUCByZXF1ZXN0IHRvIGdldCBhbiBJUCBhZGRyZXNzLgotICAgICAgICAgICAgICAgICAqLwotICAgICAgICAgICAgICAgIGlmIChzdXBwbFN0YXRlID09IFN1cHBsaWNhbnRTdGF0ZS5DT01QTEVURUQpIHsKLSAgICAgICAgICAgICAgICAgICAgbUxhc3RCc3NpZCA9IG1XaWZpSW5mby5nZXRCU1NJRCgpOwotICAgICAgICAgICAgICAgICAgICBtTGFzdFNzaWQgPSBtV2lmaUluZm8uZ2V0U1NJRCgpOwotICAgICAgICAgICAgICAgICAgICBjb25maWd1cmVJbnRlcmZhY2UoKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgaWYgKEFjdGl2aXR5TWFuYWdlck5hdGl2ZS5pc1N5c3RlbVJlYWR5KCkpIHsKLSAgICAgICAgICAgICAgICAgICAgaW50ZW50ID0gbmV3IEludGVudChXaWZpTWFuYWdlci5TVVBQTElDQU5UX0NPTk5FQ1RJT05fQ0hBTkdFX0FDVElPTik7Ci0gICAgICAgICAgICAgICAgICAgIGludGVudC5wdXRFeHRyYShXaWZpTWFuYWdlci5FWFRSQV9TVVBQTElDQU5UX0NPTk5FQ1RFRCwgdHJ1ZSk7Ci0gICAgICAgICAgICAgICAgICAgIG1Db250ZXh0LnNlbmRCcm9hZGNhc3QoaW50ZW50KTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgaWYgKHN1cHBsU3RhdGUgPT0gU3VwcGxpY2FudFN0YXRlLkNPTVBMRVRFRCAmJiBtSGF2ZUlwQWRkcmVzcykgewotICAgICAgICAgICAgICAgICAgICBzZXREZXRhaWxlZFN0YXRlKERldGFpbGVkU3RhdGUuQ09OTkVDVEVEKTsKLSAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgICAgICBzZXREZXRhaWxlZFN0YXRlKFdpZmlJbmZvLmdldERldGFpbGVkU3RhdGVPZihzdXBwbFN0YXRlKSk7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIC8qCi0gICAgICAgICAgICAgICAgICogRmlsdGVyIG91dCBtdWx0aWNhc3QgcGFja2V0cy4gVGhpcyBzYXZlcyBiYXR0ZXJ5IHBvd2VyLCBzaW5jZQotICAgICAgICAgICAgICAgICAqIHRoZSBDUFUgZG9lc24ndCBoYXZlIHRvIHNwZW5kIHRpbWUgcHJvY2Vzc2luZyBwYWNrZXRzIHRoYXQKLSAgICAgICAgICAgICAgICAgKiBhcmUgZ29pbmcgdG8gZW5kIHVwIGJlaW5nIHRocm93biBhd2F5LgotICAgICAgICAgICAgICAgICAqLwotICAgICAgICAgICAgICAgIG1XTS5pbml0aWFsaXplTXVsdGljYXN0RmlsdGVyaW5nKCk7Ci0KLSAgICAgICAgICAgICAgICBpZiAobUJsdWV0b290aEEyZHAgPT0gbnVsbCkgewotICAgICAgICAgICAgICAgICAgICBtQmx1ZXRvb3RoQTJkcCA9IG5ldyBCbHVldG9vdGhBMmRwKG1Db250ZXh0KTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgY2hlY2tJc0JsdWV0b290aFBsYXlpbmcoKTsKLQotICAgICAgICAgICAgICAgIC8vIGluaXRpYWxpemUgdGhpcyBhZnRlciB0aGUgc3VwcGxpY2FudCBpcyBhbGl2ZQotICAgICAgICAgICAgICAgIHNldE51bUFsbG93ZWRDaGFubmVscygpOwotICAgICAgICAgICAgICAgIGJyZWFrOwotCi0gICAgICAgICAgICBjYXNlIEVWRU5UX1NVUFBMSUNBTlRfRElTQ09OTkVDVDoKLSAgICAgICAgICAgICAgICBtUnVuU3RhdGUgPSBSVU5fU1RBVEVfU1RPUFBFRDsKLSAgICAgICAgICAgICAgICBub3RlUnVuU3RhdGUoKTsKLSAgICAgICAgICAgICAgICBib29sZWFuIGRpZWQgPSBtV2lmaVN0YXRlLmdldCgpICE9IFdJRklfU1RBVEVfRElTQUJMRUQgJiYKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtV2lmaVN0YXRlLmdldCgpICE9IFdJRklfU1RBVEVfRElTQUJMSU5HOwotICAgICAgICAgICAgICAgIGlmIChkaWVkKSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChMT0NBTF9MT0dEKSBMb2cudihUQUcsICJTdXBwbGljYW50IGRpZWQgdW5leHBlY3RlZGx5Iik7Ci0gICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKExPQ0FMX0xPR0QpIExvZy52KFRBRywgIkNvbm5lY3Rpb24gdG8gc3VwcGxpY2FudCBsb3N0Iik7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIC8vIFdpLUZpIHN1cHBsaWNhbnQgY29ubmVjdGlvbiBzdGF0ZSBjaGFuZ2VkOgotICAgICAgICAgICAgICAgIC8vIFszMS0gMl0gUmVzZXJ2ZWQgZm9yIGZ1dHVyZSB1c2UKLSAgICAgICAgICAgICAgICAvLyBbIDEtIDBdIENvbm5lY3RlZCB0byBzdXBwbGljYW50ICgxKSwgZGlzY29ubmVjdGVkIGZyb20gc3VwcGxpY2FudCAoMCkgLAotICAgICAgICAgICAgICAgIC8vICAgICAgICAgb3Igc3VwcGxpY2FudCBkaWVkICgyKQotICAgICAgICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoRVZFTlRMT0dfU1VQUExJQ0FOVF9DT05ORUNUSU9OX1NUQVRFX0NIQU5HRUQsIGRpZWQgPyAyIDogMCk7Ci0gICAgICAgICAgICAgICAgY2xvc2VTdXBwbGljYW50Q29ubmVjdGlvbigpOwotCi0gICAgICAgICAgICAgICAgaWYgKGRpZWQpIHsKLSAgICAgICAgICAgICAgICAgICAgcmVzZXRDb25uZWN0aW9ucyh0cnVlKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgLy8gV2hlbiBzdXBwbGljYW50IGRpZXMsIGtpbGwgdGhlIERIQ1AgdGhyZWFkCi0gICAgICAgICAgICAgICAgaWYgKG1EaGNwVGFyZ2V0ICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgbURoY3BUYXJnZXQuZ2V0TG9vcGVyKCkucXVpdCgpOwotICAgICAgICAgICAgICAgICAgICBtRGhjcFRhcmdldCA9IG51bGw7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIG1Db250ZXh0LnJlbW92ZVN0aWNreUJyb2FkY2FzdChuZXcgSW50ZW50KFdpZmlNYW5hZ2VyLk5FVFdPUktfU1RBVEVfQ0hBTkdFRF9BQ1RJT04pKTsKLSAgICAgICAgICAgICAgICBpZiAoQWN0aXZpdHlNYW5hZ2VyTmF0aXZlLmlzU3lzdGVtUmVhZHkoKSkgewotICAgICAgICAgICAgICAgICAgICBpbnRlbnQgPSBuZXcgSW50ZW50KFdpZmlNYW5hZ2VyLlN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udCBzdGF0ZTogIgotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICArIGN1cnJlbnRTdGF0ZSArCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICIgPT0+ICIgKyBuZXdTdGF0ZSk7Ci0KLSAgICAgICAgICAgICAgICBpbnQgbmV0d29ya0lkID0gc3VwcGxpY2FudFN0YXRlUmVzdWx0Lm5ldHdvcmtJZDsKLQotICAgICAgICAgICAgICAgIC8qKgotICAgICAgICAgICAgICAgICAqIFRoZSBTdXBwbGljYW50U3RhdGUgQlNTSUQgdmFsdWUgaXMgdmFsaWQgaW4gQVNTT0NJQVRJTkcgc3RhdGUgb25seS4KLSAgICAgICAgICAgICAgICAgKiBUaGUgTmV0d29ya1N0YXRlIEJTU0lEIHZhbHVlIGNvbWVzIHVwb24gYSBzdWNjZXNzZnVsIGNvbm5lY3Rpb24uCi0gICAgICAgICAgICAgICAgICovCi0gICAgICAgICAgICAgICAgaWYgKHN1cHBsaWNhbnRTdGF0ZVJlc3VsdC5zdGF0ZSA9PSBTdXBwbGljYW50U3RhdGUuQVNTT0NJQVRJTkcpIHsKLSAgICAgICAgICAgICAgICAgICAgbUxhc3RCc3NpZCA9IHN1cHBsaWNhbnRTdGF0ZVJlc3VsdC5CU1NJRDsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgLyoKLSAgICAgICAgICAgICAgICAgKiBJZiB3ZSBnZXQgZGlzY29ubmVjdCBvciBpbmFjdGl2ZSB3ZSBuZWVkIHRvIHN0YXJ0IG91cgotICAgICAgICAgICAgICAgICAqIHdhdGNoZG9nIHRpbWVyIHRvIHN0YXJ0IGEgc2NhbgotICAgICAgICAgICAgICAgICAqLwotICAgICAgICAgICAgICAgIGlmIChuZXdTdGF0ZSA9PSBTdXBwbGljYW50U3RhdGUuRElTQ09OTkVDVEVEIHx8Ci0gICAgICAgICAgICAgICAgICAgICAgICBuZXdTdGF0ZSA9PSBTdXBwbGljYW50U3RhdGUuSU5BQ1RJVkUpIHsKLSAgICAgICAgICAgICAgICAgICAgc2VuZE1lc3NhZ2VEZWxheWVkKG9idGFpbk1lc3NhZ2UoRVZFTlRfTUFZQkVfU1RBUlRfU0NBTl9QT1NUX0RJU0NPTk5FQ1QsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbU51bVN1cHBsaWNhbnRTdGF0ZUNoYW5nZXMsIDApLCBLSUNLU1RBUlRfU0NBTk5JTkdfREVMQVlfTVNFQ1MpOwotICAgICAgICAgICAgICAgIH0KLQotCi0gICAgICAgICAgICAgICAgLyoKLSAgICAgICAgICAgICAgICAgKiBEaWQgd2UgZ2V0IHRvIERJU0NPTk5FQ1RFRCBzdGF0ZSBkdWUgdG8gYW4KLSAgICAgICAgICAgICAgICAgKiBhdXRoZW50aWNhdGlvbiAocGFzc3dvcmQpIGZhaWx1cmU/Ci0gICAgICAgICAgICAgICAgICovCi0gICAgICAgICAgICAgICAgYm9vbGVhbiBmYWlsZWRUb0F1dGhlbnRpY2F0ZSA9IGZhbHNlOwotICAgICAgICAgICAgICAgIGlmIChuZXdTdGF0ZSA9PSBTdXBwbGljYW50U3RhdGUuRElTQ09OTkVDVEVEKSB7Ci0gICAgICAgICAgICAgICAgICAgIGZhaWxlZFRvQXV0aGVudGljYXRlID0gbVBhc3N3b3JkS2V5TWF5QmVJbmNvcnJlY3Q7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIG1QYXNzd29yZEtleU1heUJlSW5jb3JyZWN0ID0gZmFsc2U7Ci0KLSAgICAgICAgICAgICAgICAvKgotICAgICAgICAgICAgICAgICAqIEtlZXAgdHJhY2sgb2YgdGhlIHN1cHBsaWNhbnQgc3RhdGUgYW5kIGNoZWNrIGlmIHdlIHNob3VsZAotICAgICAgICAgICAgICAgICAqIGRpc2FibGUgdGhlIG5ldHdvcmsKLSAgICAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgICAgICBib29sZWFuIGRpc2FibGVkTmV0d29yayA9IGZhbHNlOwotICAgICAgICAgICAgICAgIGlmIChpc1N1cHBsaWNhbnRMb29waW5nKG5ld1N0YXRlKSkgewotICAgICAgICAgICAgICAgICAgICBpZiAoTE9DQUxfTE9HRCkgewotICAgICAgICAgICAgICAgICAgICAgICAgTG9nLnYoVEFHLAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIlN0b3AgV1BBIHN1cHBsaWNhbnQgbG9vcCBhbmQgZGlzYWJsZSBuZXR3b3JrIik7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgZGlzYWJsZWROZXR3b3JrID0gd2lmaU1hbmFnZXJEaXNhYmxlTmV0d29yayhuZXR3b3JrSWQpOwotICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgIGlmIChkaXNhYmxlZE5ldHdvcmspIHsKLSAgICAgICAgICAgICAgICAgICAgLyoKLSAgICAgICAgICAgICAgICAgICAgICogUmVzZXQgdGhlIGxvb3Agc3RhdGUgaWYgd2UgZGlzYWJsZWQgdGhlIG5ldHdvcmsKLSAgICAgICAgICAgICAgICAgICAgICovCi0gICAgICAgICAgICAgICAgICAgIHJlc2V0U3VwcGxpY2FudExvb3BTdGF0ZSgpOwotICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobmV3U3RhdGUgIT0gY3VycmVudFN0YXRlIHx8Ci0gICAgICAgICAgICAgICAgICAgICAgICAobmV3U3RhdGUgPT0gU3VwcGxpY2FudFN0YXRlLkRJU0NPTk5FQ1RFRCAmJiBpc0RyaXZlclN0b3BwZWQoKSkpIHsKLSAgICAgICAgICAgICAgICAgICAgc2V0U3VwcGxpY2FudFN0YXRlKG5ld1N0YXRlKTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKG5ld1N0YXRlID09IFN1cHBsaWNhbnRTdGF0ZS5ET1JNQU5UKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBEZXRhaWxlZFN0YXRlIG5ld0RldGFpbGVkU3RhdGU7Ci0gICAgICAgICAgICAgICAgICAgICAgICBNZXNzYWdlIHJlY29ubmVjdE1zZyA9IG9idGFpbk1lc3NhZ2UoRVZFTlRfREVGRVJSRURfUkVDT05ORUNULCBtTGFzdEJzc2lkKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtSXNTY2FuT25seSB8fCBtUnVuU3RhdGUgPT0gUlVOX1NUQVRFX1NUT1BQSU5HKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3RGV0YWlsZWRTdGF0ZSA9IERldGFpbGVkU3RhdGUuSURMRTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3RGV0YWlsZWRTdGF0ZSA9IERldGFpbGVkU3RhdGUuRkFJTEVEOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgaGFuZGxlRGlzY29ubmVjdGVkU3RhdGUobmV3RGV0YWlsZWRTdGF0ZSwgdHJ1ZSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICAvKioKLSAgICAgICAgICAgICAgICAgICAgICAgICAqIElmIHdlIHdlcmUgYXNzb2NpYXRlZCB3aXRoIGEgbmV0d29yayAobmV0d29ya0lkICE9IC0xKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAqIGFzc3VtZSB3ZSByZWFjaGVkIHRoaXMgc3RhdGUgYmVjYXVzZSBvZiBhIGZhaWxlZCBhdHRlbXB0Ci0gICAgICAgICAgICAgICAgICAgICAgICAgKiB0byBhY3F1aXJlIGFuIElQIGFkZHJlc3MsIGFuZCBhdHRlbXB0IGFub3RoZXIgY29ubmVjdGlvbgotICAgICAgICAgICAgICAgICAgICAgICAgICogYW5kIElQIGFkZHJlc3MgYWNxdWlzaXRpb24gaW4gUkVDT05ORUNUX0RFTEFZX01TRUNTCi0gICAgICAgICAgICAgICAgICAgICAgICAgKiBtaWxsaXNlY29uZHMuCi0gICAgICAgICAgICAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtUnVuU3RhdGUgPT0gUlVOX1NUQVRFX1JVTk5JTkcgJiYgIW1Jc1NjYW5Pbmx5ICYmIG5ldHdvcmtJZCAhPSAtMSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbmRNZXNzYWdlRGVsYXllZChyZWNvbm5lY3RNc2csIFJFQ09OTkVDVF9ERUxBWV9NU0VDUyk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKG1SdW5TdGF0ZSA9PSBSVU5fU1RBVEVfU1RPUFBJTkcpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdG9wRHJpdmVyKCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKG1SdW5TdGF0ZSA9PSBSVU5fU1RBVEVfU1RBUlRJTkcgJiYgIW1Jc1NjYW5Pbmx5KSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVjb25uZWN0Q29tbWFuZCgpOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKG5ld1N0YXRlID09IFN1cHBsaWNhbnRTdGF0ZS5ESVNDT05ORUNURUQpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIG1IYXZlSXBBZGRyZXNzID0gZmFsc2U7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXNEcml2ZXJTdG9wcGVkKCkgfHwgbURpc2Nvbm5lY3RFeHBlY3RlZCkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhhbmRsZURpc2Nvbm5lY3RlZFN0YXRlKERldGFpbGVkU3RhdGUuRElTQ09OTkVDVEVELCB0cnVlKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2NoZWR1bGVEaXNjb25uZWN0KCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobmV3U3RhdGUgIT0gU3VwcGxpY2FudFN0YXRlLkNPTVBMRVRFRCAmJiAhbURpc2Nvbm5lY3RQZW5kaW5nKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAvKioKLSAgICAgICAgICAgICAgICAgICAgICAgICAqIElnbm9yZSBldmVudHMgdGhhdCBkb24ndCBjaGFuZ2UgdGhlIGNvbm5lY3Rpdml0eSBzdGF0ZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAqIHN1Y2ggYXMgV1BBIHJla2V5aW5nIG9wZXJhdGlvbnMuCi0gICAgICAgICAgICAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgIGlmICghKGN1cnJlbnRTdGF0ZSA9PSBTdXBwbGljYW50U3RhdGUuQ09NUExFVEVEICYmCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKG5ld1N0YXRlID09IFN1cHBsaWNhbnRTdGF0ZS5BU1NPQ0lBVElORyB8fAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXdTdGF0ZSA9PSBTdXBwbGljYW50U3RhdGUuQVNTT0NJQVRFRCB8fAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXdTdGF0ZSA9PSBTdXBwbGljYW50U3RhdGUuRk9VUl9XQVlfSEFORFNIQUtFIHx8Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5ld1N0YXRlID09IFN1cHBsaWNhbnRTdGF0ZS5HUk9VUF9IQU5EU0hBS0UpKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldERldGFpbGVkU3RhdGUoV2lmaUluZm8uZ2V0RGV0YWlsZWRTdGF0ZU9mKG5ld1N0YXRlKSk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgICAgICBtRGlzY29ubmVjdEV4cGVjdGVkID0gZmFsc2U7Ci0gICAgICAgICAgICAgICAgICAgIGludGVudCA9IG5ldyBJbnRlbnQoV2lmaU1hbmFnZXIuU1VQUExJQ0FOVF9TVEFURV9DSEFOR0VEX0FDVElPTik7Ci0gICAgICAgICAgICAgICAgICAgIGludGVudC5hZGRGbGFncyhJbnRlbnQuRkxBR19SRUNFSVZFUl9SRUdJU1RFUkVEX09OTFlfQkVGT1JFX0JPT1QKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICB8IEludGVudC5GTEFHX1JFQ0VJVkVSX1JFUExBQ0VfUEVORElORyk7Ci0gICAgICAgICAgICAgICAgICAgIGludGVudC5wdXRFeHRyYShXaWZpTWFuYWdlci5FWFRSQV9ORVdfU1RBVEUsIChQYXJjZWxhYmxlKW5ld1N0YXRlKTsKLSAgICAgICAgICAgICAgICAgICAgaWYgKGZhaWxlZFRvQXV0aGVudGljYXRlKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAoTE9DQUxfTE9HRCkgTG9nLmQoVEFHLCAiRmFpbGVkIHRvIGF1dGhlbnRpY2F0ZSwgZGlzYWJsaW5nIG5ldHdvcmsgIiArIG5ldHdvcmtJZCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB3aWZpTWFuYWdlckRpc2FibGVOZXR3b3JrKG5ldHdvcmtJZCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpbnRlbnQucHV0RXh0cmEoCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgV2lmaU1hbmFnZXIuRVhUUkFfU1VQUExJQ0FOVF9FUlJPUiwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBXaWZpTWFuYWdlci5FUlJPUl9BVVRIRU5USUNBVElORyk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgbUNvbnRleHQuc2VuZFN0aWNreUJyb2FkY2FzdChpbnRlbnQpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBicmVhazsKLQotICAgICAgICAgICAgY2FzZSBFVkVOVF9ORVRXT1JLX1NUQVRFX0NIQU5HRUQ6Ci0gICAgICAgICAgICAgICAgLyoKLSAgICAgICAgICAgICAgICAgKiBFYWNoIENPTk5FQ1Qgb3IgRElTQ09OTkVDVCBnZW5lcmF0ZXMgYSBwYWlyIG9mIGV2ZW50cy4KLSAgICAgICAgICAgICAgICAgKiBPbmUgaXMgYSBzdXBwbGljYW50IHN0YXRlIGNoYW5nZSBldmVudCwgYW5kIHRoZSBvdGhlcgotICAgICAgICAgICAgICAgICAqIGlzIGEgbmV0d29yayBzdGF0ZSBjaGFuZ2UgZXZlbnQuIEZvciBjb25uZWN0cywgdGhlCi0gICAgICAgICAgICAgICAgICogc3VwcGxpY2FudCBldmVudCBhbHdheXMgYXJyaXZlcyBmaXJzdCwgZm9sbG93ZWQgYnkKLSAgICAgICAgICAgICAgICAgKiB0aGUgbmV0d29yayBzdGF0ZSBjaGFuZ2UgZXZlbnQuIE9ubHkgdGhlIGxhdHRlciBldmVudAotICAgICAgICAgICAgICAgICAqIGhhcyB0aGUgQlNTSUQsIHdoaWNoIHdlIGFyZSBpbnRlcmVzdGVkIGluIGNhcHR1cmluZy4KLSAgICAgICAgICAgICAgICAgKiBGb3IgZGlzY29ubmVjdHMsIHRoZSBvcmRlciBpcyB0aGUgb3Bwb3NpdGUgLS0gdGhlCi0gICAgICAgICAgICAgICAgICogbmV0d29yayBzdGF0ZSBjaGFuZ2UgZXZlbnQgY29tZXMgZmlyc3QsIGZvbGxvd2VkIGJ5Ci0gICAgICAgICAgICAgICAgICogdGhlIHN1cHBsaWNhbnQgc3RhdGUgY2hhbmdlIGV2ZW50LgotICAgICAgICAgICAgICAgICAqLwotICAgICAgICAgICAgICAgIE5ldHdvcmtTdGF0ZUNoYW5nZVJlc3VsdCByZXN1bHQgPQotICAgICAgICAgICAgICAgICAgICAoTmV0d29ya1N0YXRlQ2hhbmdlUmVzdWx0KSBtc2cub2JqOwotCi0gICAgICAgICAgICAgICAgLy8gV2ktRmkgbmV0d29yayBzdGF0ZSBjaGFuZ2VkOgotICAgICAgICAgICAgICAgIC8vIFszMS0gNl0gUmVzZXJ2ZWQgZm9yIGZ1dHVyZSB1c2UKLSAgICAgICAgICAgICAgICAvLyBbIDUtIDBdIERldGFpbGVkIHN0YXRlIG9yZGluYWwgKGFzIGRlZmluZWQgYnkgTmV0d29ya0luZm8uRGV0YWlsZWRTdGF0ZSkgICAKLSAgICAgICAgICAgICAgICBldmVudExvZ1BhcmFtID0gKHJlc3VsdC5zdGF0ZS5vcmRpbmFsKCkgJiAweDNmKTsKLSAgICAgICAgICAgICAgICBFdmVudExvZy53cml0ZUV2ZW50KEVWRU5UTE9HX05FVFdPUktfU1RBVEVfQ0hBTkdFRCwgZXZlbnRMb2dQYXJhbSk7Ci0gICAgICAgICAgICAgICAgCi0gICAgICAgICAgICAgICAgaWYgKExPQ0FMX0xPR0QpIExvZy52KFRBRywgIk5ldyBuZXR3b3JrIHN0YXRlIGlzICIgKyByZXN1bHQuc3RhdGUpOwotICAgICAgICAgICAgICAgIC8qCi0gICAgICAgICAgICAgICAgICogSWYgd2UncmUgaW4gc2Nhbi1vbmx5IG1vZGUsIGRvbid0IGFkdmFuY2UgdGhlIHN0YXRlIG1hY2hpbmUsIGFuZAotICAgICAgICAgICAgICAgICAqIGRvbid0IHJlcG9ydCB0aGUgc3RhdGUgY2hhbmdlIHRvIGNsaWVudHMuCi0gICAgICAgICAgICAgICAgICovCi0gICAgICAgICAgICAgICAgaWYgKG1Jc1NjYW5Pbmx5KSB7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChMT0NBTF9MT0dEKSBMb2cudihUQUcsICJEcm9wcGluZyBldmVudCBpbiBzY2FuLW9ubHkgbW9kZSIpOwotICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgaWYgKHJlc3VsdC5zdGF0ZSAhPSBEZXRhaWxlZFN0YXRlLlNDQU5OSU5HKSB7Ci0gICAgICAgICAgICAgICAgICAgIC8qCi0gICAgICAgICAgICAgICAgICAgICAqIFJlc2V0IHRoZSBzY2FuIGNvdW50IHNpbmNlIHRoZXJlIHdhcyBhIG5ldHdvcmsgc3RhdGUKLSAgICAgICAgICAgICAgICAgICAgICogY2hhbmdlLiBUaGlzIGNvdWxkIGJlIGZyb20gc3VwcGxpY2FudCB0cnlpbmcgdG8gYXNzb2NpYXRlCi0gICAgICAgICAgICAgICAgICAgICAqIHdpdGggYSBuZXR3b3JrLgotICAgICAgICAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgICAgICAgICAgbU51bVNjYW5zU2luY2VOZXR3b3JrU3RhdGVDaGFuZ2UgPSAwOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAvKgotICAgICAgICAgICAgICAgICAqIElmIHRoZSBzdXBwbGljYW50IHNlbnQgdXMgYSBDT05ORUNURUQgZXZlbnQsIHdlIGRvbid0Ci0gICAgICAgICAgICAgICAgICogd2FudCB0byBzZW5kIG91dCBhbiBpbmRpY2F0aW9uIG9mIG92ZXJhbGwgbmV0d29yawotICAgICAgICAgICAgICAgICAqIGNvbm5lY3Rpdml0eSB1bnRpbCB3ZSBoYXZlIG91ciBJUCBhZGRyZXNzLiBJZiB0aGUKLSAgICAgICAgICAgICAgICAgKiBzdXBwbGljYW50IHNlbnQgdXMgYSBESVNDT05ORUNURUQgZXZlbnQsIHdlIGRlbGF5Ci0gICAgICAgICAgICAgICAgICogc2VuZGluZyBhIG5vdGlmaWNhdGlvbiBpbiBjYXNlIGEgcmVjb25uZWN0aW9uIHRvCi0gICAgICAgICAgICAgICAgICogdGhlIHNhbWUgYWNjZXNzIHBvaW50IG9jY3VycyB3aXRoaW4gYSBzaG9ydCB0aW1lLgotICAgICAgICAgICAgICAgICAqLwotICAgICAgICAgICAgICAgIGlmIChyZXN1bHQuc3RhdGUgPT0gRGV0YWlsZWRTdGF0ZS5ESVNDT05ORUNURUQpIHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKG1XaWZpSW5mby5nZXRTdXBwbGljYW50U3RhdGUoKSAhPSBTdXBwbGljYW50U3RhdGUuRE9STUFOVCkgewotICAgICAgICAgICAgICAgICAgICAgICAgc2NoZWR1bGVEaXNjb25uZWN0KCk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIHJlcXVlc3RDb25uZWN0aW9uU3RhdHVzKG1XaWZpSW5mbyk7Ci0gICAgICAgICAgICAgICAgaWYgKCEocmVzdWx0LnN0YXRlID09IERldGFpbGVkU3RhdGUuQ09OTkVDVEVEICYmCi0gICAgICAgICAgICAgICAgICAgICAgICAoIW1IYXZlSXBBZGRyZXNzIHx8IG1EaXNjb25uZWN0UGVuZGluZykpKSB7Ci0gICAgICAgICAgICAgICAgICAgIHNldERldGFpbGVkU3RhdGUocmVzdWx0LnN0YXRlKTsKLSAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICBpZiAocmVzdWx0LnN0YXRlID09IERldGFpbGVkU3RhdGUuQ09OTkVDVEVEKSB7Ci0gICAgICAgICAgICAgICAgICAgIC8qCi0gICAgICAgICAgICAgICAgICAgICAqIFJlbW92ZSB0aGUgJ2F2YWlsYWJsZSBuZXR3b3Jrcycgbm90aWZpY2F0aW9uIHdoZW4gd2UKLSAgICAgICAgICAgICAgICAgICAgICogc3VjY2Vzc2Z1bGx5IGNvbm5lY3QgdG8gYSBuZXR3b3JrLgotICAgICAgICAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgICAgICAgICAgc2V0Tm90aWZpY2F0aW9uVmlzaWJsZShmYWxzZSwgMCwgZmFsc2UsIDApOwotICAgICAgICAgICAgICAgICAgICBib29sZWFuIHdhc0Rpc2Nvbm5lY3RQZW5kaW5nID0gbURpc2Nvbm5lY3RQZW5kaW5nOwotICAgICAgICAgICAgICAgICAgICBjYW5jZWxEaXNjb25uZWN0KCk7Ci0gICAgICAgICAgICAgICAgICAgIC8qCi0gICAgICAgICAgICAgICAgICAgICAqIFRoZSBjb25uZWN0aW9uIGlzIGZ1bGx5IGNvbmZpZ3VyZWQgYXMgZmFyIGFzIGxpbmstbGV2ZWwKLSAgICAgICAgICAgICAgICAgICAgICogY29ubmVjdGl2aXR5IGlzIGNvbmNlcm5lZCwgYnV0IHdlIG1heSBzdGlsbCBuZWVkIHRvIG9idGFpbgotICAgICAgICAgICAgICAgICAgICAgKiBhbiBJUCBhZGRyZXNzLgotICAgICAgICAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgICAgICAgICAgaWYgKHdhc0Rpc2Nvbm5lY3RQZW5kaW5nKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBEZXRhaWxlZFN0YXRlIHNhdmVTdGF0ZSA9IGdldE5ldHdvcmtJbmZvKCkuZ2V0RGV0YWlsZWRTdGF0ZSgpOwotICAgICAgICAgICAgICAgICAgICAgICAgaGFuZGxlRGlzY29ubmVjdGVkU3RhdGUoRGV0YWlsZWRTdGF0ZS5ESVNDT05ORUNURUQsIGZhbHNlKTsKLSAgICAgICAgICAgICAgICAgICAgICAgIHNldERldGFpbGVkU3RhdGVJbnRlcm5hbChzYXZlU3RhdGUpOwotICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgY29uZmlndXJlSW50ZXJmYWNlKCk7Ci0gICAgICAgICAgICAgICAgICAgIG1MYXN0QnNzaWQgPSByZXN1bHQuQlNTSUQ7Ci0gICAgICAgICAgICAgICAgICAgIG1MYXN0U3NpZCA9IG1XaWZpSW5mby5nZXRTU0lEKCk7Ci0gICAgICAgICAgICAgICAgICAgIG1MYXN0TmV0d29ya0lkID0gcmVzdWx0Lm5ldHdvcmtJZDsKLSAgICAgICAgICAgICAgICAgICAgaWYgKG1IYXZlSXBBZGRyZXNzKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBzZXREZXRhaWxlZFN0YXRlKERldGFpbGVkU3RhdGUuQ09OTkVDVEVEKTsKLSAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHNldERldGFpbGVkU3RhdGUoRGV0YWlsZWRTdGF0ZS5PQlRBSU5JTkdfSVBBRERSKTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBzZW5kTmV0d29ya1N0YXRlQ2hhbmdlQnJvYWRjYXN0KG1XaWZpSW5mby5nZXRCU1NJRCgpKTsKLSAgICAgICAgICAgICAgICBicmVhazsKLQotICAgICAgICAgICAgY2FzZSBFVkVOVF9TQ0FOX1JFU1VMVFNfQVZBSUxBQkxFOgotICAgICAgICAgICAgICAgIGlmIChBY3Rpdml0eU1hbmFnZXJOYXRpdmUuaXNTeXN0ZW1SZWFkeSgpKSB7Ci0gICAgICAgICAgICAgICAgICAgIG1Db250ZXh0LnNlbmRCcm9hZGNhc3QobmV3IEludGVudChXaWZpTWFuYWdlci5TQ0FOX1JFU1VMVFNfQVZBSUxBQkxFX0FDVElPTikpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBzZW5kU2NhblJlc3VsdHNBdmFpbGFibGUoKTsKLSAgICAgICAgICAgICAgICAvKioKLSAgICAgICAgICAgICAgICAgKiBPbiByZWNlaXZpbmcgdGhlIGZpcnN0IHNjYW4gcmVzdWx0cyBhZnRlciBjb25uZWN0aW5nIHRvCi0gICAgICAgICAgICAgICAgICogdGhlIHN1cHBsaWNhbnQsIHN3aXRjaCBzY2FuIG1vZGUgb3ZlciB0byBwYXNzaXZlLgotICAgICAgICAgICAgICAgICAqLwotICAgICAgICAgICAgICAgIHNldFNjYW5Nb2RlKGZhbHNlKTsKLSAgICAgICAgICAgICAgICBicmVhazsKLQotICAgICAgICAgICAgY2FzZSBFVkVOVF9QT0xMX0lOVEVSVkFMOgotICAgICAgICAgICAgICAgIGlmIChtV2lmaUluZm8uZ2V0U3VwcGxpY2FudFN0YXRlKCkgIT0gU3VwcGxpY2FudFN0YXRlLlVOSU5JVElBTElaRUQpIHsKLSAgICAgICAgICAgICAgICAgICAgcmVxdWVzdFBvbGxlZEluZm8obVdpZmlJbmZvLCB0cnVlKTsKLSAgICAgICAgICAgICAgICAgICAgY2hlY2tQb2xsVGltZXIoKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAKLSAgICAgICAgICAgIGNhc2UgRVZFTlRfREVGRVJSRURfRElTQ09OTkVDVDoKLSAgICAgICAgICAgICAgICBpZiAobVdpZmlJbmZvLmdldFN1cHBsaWNhbnRTdGF0ZSgpICE9IFN1cHBsaWNhbnRTdGF0ZS5VTklOSVRJQUxJWkVEKSB7Ci0gICAgICAgICAgICAgICAgICAgIGhhbmRsZURpc2Nvbm5lY3RlZFN0YXRlKERldGFpbGVkU3RhdGUuRElTQ09OTkVDVEVELCB0cnVlKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgICAgIGNhc2UgRVZFTlRfREVGRVJSRURfUkVDT05ORUNUOgotICAgICAgICAgICAgICAgIC8qKgotICAgICAgICAgICAgICAgICAqIG1MYXN0QnNzaWQgY2FuIGJlIG51bGwgd2hlbiB0aGVyZSBpcyBhIHJlY29ubmVjdAotICAgICAgICAgICAgICAgICAqIHJlcXVlc3Qgb24gdGhlIGZpcnN0IEJTU0lEIHdlIGNvbm5lY3QgdG8KLSAgICAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgICAgICBTdHJpbmcgQlNTSUQgPSAobXNnLm9iaiAhPSBudWxsKSA/IG1zZy5vYmoudG9TdHJpbmcoKSA6IG51bGw7Ci0gICAgICAgICAgICAgICAgLyoqCi0gICAgICAgICAgICAgICAgICogSWYgd2UndmUgZXhjZWVkZWQgdGhlIG1heGltdW0gbnVtYmVyIG9mIHJldHJpZXMgZm9yIHJlY29ubmVjdGluZwotICAgICAgICAgICAgICAgICAqIHRvIGEgZ2l2ZW4gbmV0d29yaywgZGlzYWJsZSB0aGUgbmV0d29yawotICAgICAgICAgICAgICAgICAqLwotICAgICAgICAgICAgICAgIGlmIChtV2lmaUluZm8uZ2V0U3VwcGxpY2FudFN0YXRlKCkgIT0gU3VwcGxpY2FudFN0YXRlLlVOSU5JVElBTElaRUQpIHsKLSAgICAgICAgICAgICAgICAgICAgaWYgKCsrbVJlY29ubmVjdENvdW50ID4gZ2V0TWF4RGhjcFJldHJpZXMoKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKExPQ0FMX0xPR0QpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBMb2cuZChUQUcsICJGYWlsZWQgcmVjb25uZWN0IGNvdW50OiAiICsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1SZWNvbm5lY3RDb3VudCArICIgRGlzYWJsaW5nICIgKyBCU1NJRCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgICAgICBtV00uZGlzYWJsZU5ldHdvcmsobUxhc3ROZXR3b3JrSWQpOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIHJlY29ubmVjdENvbW1hbmQoKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgICAgIGNhc2UgRVZFTlRfSU5URVJGQUNFX0NPTkZJR1VSQVRJT05fU1VDQ0VFREVEOgotICAgICAgICAgICAgICAgIC8qKgotICAgICAgICAgICAgICAgICAqIFNpbmNlIHRoaXMgZXZlbnQgaXMgc2VudCBmcm9tIGFub3RoZXIgdGhyZWFkLCBpdCBtaWdodCBoYXZlIGJlZW4KLSAgICAgICAgICAgICAgICAgKiBzZW50IGFmdGVyIHdlIGNsb3NlZCBvdXIgY29ubmVjdGlvbiB0byB0aGUgc3VwcGxpY2FudCBpbiB0aGUgY291cnNlCi0gICAgICAgICAgICAgICAgICogb2YgZGlzYWJsaW5nIFdpLUZpLiBJbiB0aGF0IGNhc2UsIHdlIHNob3VsZCBqdXN0IGlnbm9yZSB0aGUgZXZlbnQuCi0gICAgICAgICAgICAgICAgICovCi0gICAgICAgICAgICAgICAgaWYgKG1XaWZpSW5mby5nZXRTdXBwbGljYW50U3RhdGUoKSA9PSBTdXBwbGljYW50U3RhdGUuVU5JTklUSUFMSVpFRCkgewotICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgbVJlY29ubmVjdENvdW50ID0gMDsKLSAgICAgICAgICAgICAgICBtSGF2ZUlwQWRkcmVzcyA9IHRydWU7Ci0gICAgICAgICAgICAgICAgbU9idGFpbmluZ0lwQWRkcmVzcyA9IGZhbHNlOwotICAgICAgICAgICAgICAgIG1XaWZpSW5mby5zZXRJcEFkZHJlc3MobURoY3BJbmZvLmlwQWRkcmVzcyk7Ci0gICAgICAgICAgICAgICAgbUxhc3RTaWduYWxMZXZlbCA9IC0xOyAvLyBmb3JjZSB1cGRhdGUgb2Ygc2lnbmFsIHN0cmVuZ3RoCi0gICAgICAgICAgICAgICAgaWYgKG1OZXR3b3JrSW5mby5nZXREZXRhaWxlZFN0YXRlKCkgIT0gRGV0YWlsZWRTdGF0ZS5DT05ORUNURUQpIHsKLSAgICAgICAgICAgICAgICAgICAgc2V0RGV0YWlsZWRTdGF0ZShEZXRhaWxlZFN0YXRlLkNPTk5FQ1RFRCk7Ci0gICAgICAgICAgICAgICAgICAgIHNlbmROZXR3b3JrU3RhdGVDaGFuZ2VCcm9hZGNhc3QobVdpZmlJbmZvLmdldEJTU0lEKCkpOwotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIG1zZyA9IG1UYXJnZXQub2J0YWluTWVzc2FnZShFVkVOVF9DT05GSUdVUkFUSU9OX0NIQU5HRUQsIG1OZXR3b3JrSW5mbyk7Ci0gICAgICAgICAgICAgICAgICAgIG1zZy5zZW5kVG9UYXJnZXQoKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgaWYgKExPQ0FMX0xPR0QpIExvZy52KFRBRywgIklQIGNvbmZpZ3VyYXRpb246ICIgKyBtRGhjcEluZm8pOwotICAgICAgICAgICAgICAgIC8vIFdpLUZpIGludGVyZmFjZSBjb25maWd1cmF0aW9uIHN0YXRlIGNoYW5nZWQ6Ci0gICAgICAgICAgICAgICAgLy8gWzMxLSAxXSBSZXNlcnZlZCBmb3IgZnV0dXJlIHVzZQotICAgICAgICAgICAgICAgIC8vIFsgMC0gMF0gSW50ZXJmYWNlIGNvbmZpZ3VyYXRpb24gc3VjY2VlZGVkICgxKSBvciBmYWlsZWQgKDApICAgCi0gICAgICAgICAgICAgICAgRXZlbnRMb2cud3JpdGVFdmVudChFVkVOVExPR19JTlRFUkZBQ0VfQ09ORklHVVJBVElPTl9TVEFURV9DSEFOR0VELCAxKTsKLQotICAgICAgICAgICAgICAgIC8vIFdlJ3ZlIGNvbm5lY3RlZCBzdWNjZXNzZnVsbHksIHNvIGFsbG93IHRoZSBub3RpZmljYXRpb24gYWdhaW4gaW4gdGhlIGZ1dHVyZQotICAgICAgICAgICAgICAgIHJlc2V0Tm90aWZpY2F0aW9uVGltZXIoKTsKLSAgICAgICAgICAgICAgICBicmVhazsKLQotICAgICAgICAgICAgY2FzZSBFVkVOVF9JTlRFUkZBQ0VfQ09ORklHVVJBVElPTl9GQUlMRUQ6Ci0gICAgICAgICAgICAgICAgaWYgKG1XaWZpSW5mby5nZXRTdXBwbGljYW50U3RhdGUoKSAhPSBTdXBwbGljYW50U3RhdGUuVU5JTklUSUFMSVpFRCkgewotICAgICAgICAgICAgICAgICAgICAvLyBXaS1GaSBpbnRlcmZhY2UgY29uZmlndXJhdGlvbiBzdGF0ZSBjaGFuZ2VkOgotICAgICAgICAgICAgICAgICAgICAvLyBbMzEtIDFdIFJlc2VydmVkIGZvciBmdXR1cmUgdXNlCi0gICAgICAgICAgICAgICAgICAgIC8vIFsgMC0gMF0gSW50ZXJmYWNlIGNvbmZpZ3VyYXRpb24gc3VjY2VlZGVkICgxKSBvciBmYWlsZWQgKDApCi0gICAgICAgICAgICAgICAgICAgIEV2ZW50TG9nLndyaXRlRXZlbnQoRVZFTlRMT0dfSU5URVJGQUNFX0NPTkZJR1VSQVRJT05fU1RBVEVfQ0hBTkdFRCwgMCk7Ci0gICAgICAgICAgICAgICAgICAgIG1IYXZlSXBBZGRyZXNzID0gZmFsc2U7Ci0gICAgICAgICAgICAgICAgICAgIG1XaWZpSW5mby5zZXRJcEFkZHJlc3MoMCk7Ci0gICAgICAgICAgICAgICAgICAgIG1PYnRhaW5pbmdJcEFkZHJlc3MgPSBmYWxzZTsKLSAgICAgICAgICAgICAgICAgICAgZGlzY29ubmVjdCgpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBicmVhazsKLQotICAgICAgICAgICAgY2FzZSBFVkVOVF9EUklWRVJfU1RBVEVfQ0hBTkdFRDoKLSAgICAgICAgICAgICAgICAvLyBXaS1GaSBkcml2ZXIgc3RhdGUgY2hhbmdlZDoKLSAgICAgICAgICAgICAgICAvLyAwIFNUQVJURUQKLSAgICAgICAgICAgICAgICAvLyAxIFNUT1BQRUQKLSAgICAgICAgICAgICAgICAvLyAyIEhVTkcKLSAgICAgICAgICAgICAgICBFdmVudExvZy53cml0ZUV2ZW50KEVWRU5UTE9HX0RSSVZFUl9TVEFURV9DSEFOR0VELCBtc2cuYXJnMSk7Ci0KLSAgICAgICAgICAgICAgICBzd2l0Y2ggKG1zZy5hcmcxKSB7Ci0gICAgICAgICAgICAgICAgY2FzZSBEUklWRVJfU1RBUlRFRDoKLSAgICAgICAgICAgICAgICAgICAgLyoqCi0gICAgICAgICAgICAgICAgICAgICAqIFNldCB0aGUgbnVtYmVyIG9mIGFsbG93ZWQgcmFkaW8gY2hhbm5lbHMgYWNjb3JkaW5nCi0gICAgICAgICAgICAgICAgICAgICAqIHRvIHRoZSBzeXN0ZW0gc2V0dGluZywgc2luY2UgaXQgZ2V0cyByZXNldCBieSB0aGUKLSAgICAgICAgICAgICAgICAgICAgICogZHJpdmVyIHVwb24gY2hhbmdpbmcgdG8gdGhlIFNUQVJURUQgc3RhdGUuCi0gICAgICAgICAgICAgICAgICAgICAqLwotICAgICAgICAgICAgICAgICAgICBzZXROdW1BbGxvd2VkQ2hhbm5lbHMoKTsKLSAgICAgICAgICAgICAgICAgICAgc3luY2hyb25pemVkICh0aGlzKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBpZiAobVJ1blN0YXRlID09IFJVTl9TVEFURV9TVEFSVElORykgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1SdW5TdGF0ZSA9IFJVTl9TVEFURV9SVU5OSU5HOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghbUlzU2Nhbk9ubHkpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVjb25uZWN0Q29tbWFuZCgpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIEluIHNvbWUgc2l0dWF0aW9ucywgc3VwcGxpY2FudCBuZWVkcyB0byBiZSBraWNrc3RhcnRlZCB0bwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBzdGFydCB0aGUgYmFja2dyb3VuZCBzY2FubmluZwotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzY2FuKHRydWUpOwotICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICBjYXNlIERSSVZFUl9IVU5HOgotICAgICAgICAgICAgICAgICAgICBMb2cuZShUQUcsICJXaWZpIERyaXZlciByZXBvcnRzIEhVTkcgLSByZWxvYWRpbmcuIik7Ci0gICAgICAgICAgICAgICAgICAgIC8qKgotICAgICAgICAgICAgICAgICAgICAgKiByZXN0YXJ0IHRoZSBkcml2ZXIgLSB0b2dnbGUgb2ZmIGFuZCBvbgotICAgICAgICAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgICAgICAgICAgbVdNLnNldFdpZmlFbmFibGVkKGZhbHNlKTsKLSAgICAgICAgICAgICAgICAgICAgbVdNLnNldFdpZmlFbmFibGVkKHRydWUpOwotICAgICAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgbm90ZVJ1blN0YXRlKCk7Ci0gICAgICAgICAgICAgICAgYnJlYWs7Ci0KLSAgICAgICAgICAgIGNhc2UgRVZFTlRfUEFTU1dPUkRfS0VZX01BWV9CRV9JTkNPUlJFQ1Q6Ci0gICAgICAgICAgICAgICAgbVBhc3N3b3JkS2V5TWF5QmVJbmNvcnJlY3QgPSB0cnVlOwotICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgcHJpdmF0ZSBib29sZWFuIHdpZmlNYW5hZ2VyRGlzYWJsZU5ldHdvcmsoaW50IG5ldHdvcmtJZCkgewotICAgICAgICBib29sZWFuIGRpc2FibGVkTmV0d29yayA9IGZhbHNlOwotICAgICAgICBpZiAoMCA8PSBuZXR3b3JrSWQpIHsKLSAgICAgICAgICAgIGRpc2FibGVkTmV0d29yayA9IG1XTS5kaXNhYmxlTmV0d29yayhuZXR3b3JrSWQpOwotICAgICAgICAgICAgaWYgKExPQ0FMX0xPR0QpIHsKLSAgICAgICAgICAgICAgICBpZiAoZGlzYWJsZWROZXR3b3JrKSB7Ci0gICAgICAgICAgICAgICAgICAgIExvZy52KFRBRywgIkRpc2FibGVkIG5ldHdvcms6ICIgKyBuZXR3b3JrSWQpOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgICAgICBpZiAoTE9DQUxfTE9HRCkgewotICAgICAgICAgICAgaWYgKCFkaXNhYmxlZE5ldHdvcmspIHsKLSAgICAgICAgICAgICAgICBMb2cuZShUQUcsICJGYWlsZWQgdG8gZGlzYWJsZSBuZXR3b3JrOiIgKwotICAgICAgICAgICAgICAgICAgICAgICIgaW52YWxpZCBuZXR3b3JrIGlkOiAiICsgbmV0d29ya0lkKTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfQotICAgICAgICByZXR1cm4gZGlzYWJsZWROZXR3b3JrOwotICAgIH0KLQotICAgIHByaXZhdGUgdm9pZCBjb25maWd1cmVJbnRlcmZhY2UoKSB7Ci0gICAgICAgIGNoZWNrUG9sbFRpbWVyKCk7Ci0gICAgICAgIG1MYXN0U2lnbmFsTGV2ZWwgPSAtMTsKLSAgICAgICAgaWYgKCFtVXNlU3RhdGljSXApIHsKLSAgICAgICAgICAgIGlmICghbUhhdmVJcEFkZHJlc3MgJiYgIW1PYnRhaW5pbmdJcEFkZHJlc3MpIHsKLSAgICAgICAgICAgICAgICBtT2J0YWluaW5nSXBBZGRyZXNzID0gdHJ1ZTsKLSAgICAgICAgICAgICAgICBtRGhjcFRhcmdldC5zZW5kRW1wdHlNZXNzYWdlKEVWRU5UX0RIQ1BfU1RBUlQpOwotICAgICAgICAgICAgfQotICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgaW50IGV2ZW50OwotICAgICAgICAgICAgaWYgKE5ldHdvcmtVdGlscy5jb25maWd1cmVJbnRlcmZhY2UobUludGVyZmFjZU5hbWUsIG1EaGNwSW5mbykpIHsKLSAgICAgICAgICAgICAgICBtSGF2ZUlwQWRkcmVzcyA9IHRydWU7Ci0gICAgICAgICAgICAgICAgZXZlbnQgPSBFVkVOVF9JTlRFUkZBQ0VfQ09ORklHVVJBVElPTl9TVUNDRUVERUQ7Ci0gICAgICAgICAgICAgICAgaWYgKExPQ0FMX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LSAgICAgICAgU3RyaW5nIHN1cHBTdGF0ZSA9IG51bGw7Ci0gICAgICAgIGludCBuZXRJZCA9IC0xOwotICAgICAgICBTdHJpbmdbXSBsaW5lcyA9IHJlcGx5LnNwbGl0KCJcbiIpOwotICAgICAgICBmb3IgKFN0cmluZyBsaW5lIDogbGluZXMpIHsKLSAgICAgICAgICAgIFN0cmluZ1tdIHByb3AgPSBsaW5lLnNwbGl0KCIgKj0gKiIsIDIpOwotICAgICAgICAgICAgaWYgKHByb3AubGVuZ3RoIDwgMikKLSAgICAgICAgICAgICAgICBjb250aW51ZTsKLSAgICAgICAgICAgIFN0cmluZyBuYW1lID0gcHJvcFswXTsKLSAgICAgICAgICAgIFN0cmluZyB2YWx1ZSA9IHByb3BbMV07Ci0gICAgICAgICAgICBpZiAobmFtZS5lcXVhbHNJZ25vcmVDYXNlKCJpZCIpKQotICAgICAgICAgICAgICAgIG5ldElkID0gSW50ZWdlci5wYXJzZUludCh2YWx1ZSk7Ci0gICAgICAgICAgICBlbHNlIGlmIChuYW1lLmVxdWFsc0lnbm9yZUNhc2UoInNzaWQiKSkKLSAgICAgICAgICAgICAgICBTU0lEID0gdmFsdWU7Ci0gICAgICAgICAgICBlbHNlIGlmIChuYW1lLmVxdWFsc0lnbm9yZUNhc2UoImJzc2lkIikpCi0gICAgICAgICAgICAgICAgQlNTSUQgPSB2YWx1ZTsKLSAgICAgICAgICAgIGVsc2UgaWYgKG5hbWUuZXF1YWxzSWdub3JlQ2FzZSgid3BhX3N0YXRlIikpCi0gICAgICAgICAgICAgICAgc3VwcFN0YXRlID0gdmFsdWU7Ci0gICAgICAgIH0KLSAgICAgICAgaW5mby5zZXROZXR3b3JrSWQobmV0SWQpOwotICAgICAgICBpbmZvLnNldFNTSUQoU1NJRCk7Ci0gICAgICAgIGluZm8uc2V0QlNTSUQoQlNTSUQpOwotICAgICAgICAvKgotICAgICAgICAgKiBXZSBvbmx5IHNldCB0aGUgc3VwcGxpY2FudCBzdGF0ZSBpZ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ICAgICAgIC8vIFRPRE86IFRoZSBzZWNvbmQgYXJnIHRvIHRoZSBjYWxsIGJlbG93IG5lZWRzIHRvIGJlIGEgc3ltYm9sIHNvbWV3aGVyZSwgYnV0Ci0gICAgICAgICAgICAvLyBpdCdzIGFjdHVhbGx5IHRoZSBzaXplIG9mIGFuIGFycmF5IG9mIGljb25zIHRoYXQncyBwcml2YXRlCi0gICAgICAgICAgICAvLyB0byBTdGF0dXNCYXIgUG9saWN5LgotICAgICAgICAgICAgaW50IG5ld1NpZ25hbExldmVsID0gV2lmaU1hbmFnZXIuY2FsY3VsYXRlU2lnbmFsTGV2ZWwobmV3UnNzaSwgNCk7Ci0gICAgICAgICAgICBpZiAobmV3U2lnbmFsTGV2ZWwgIT0gbUxhc3RTaWduYWxMZXZlbCkgewotICAgICAgICAgICAgICAgIHNlbmRSc3NpQ2hhbmdlQnJvYWRjYXN0KG5ld1Jzc2kpOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgbUxhc3RTaWduYWxMZXZlbCA9IG5ld1NpZ25hbExldmVsOwotICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgaW5mby5zZXRSc3NpKC0yMDApOwotICAgICAgICB9Ci0gICAgICAgIGludCBuZXdMaW5rU3BlZWQgPSBnZXRMaW5rU3BlZWQoKTsKLSAgICAgICAgaWYgKG5ld0xpbmtTcGVlZCAhPSAtMSkgewotICAgICAgICAgICAgaW5mby5zZXRMaW5rU3BlZWQobmV3TGlua1NwZWVkKTsKLSAgICAgICAgfQotICAgIH0KLQotICAgIHByaXZhdGUgdm9pZCBzZW5kUnNzaUNoYW5nZUJyb2FkY2FzdChmaW5hbCBpbnQgbmV3UnNzaSkgewotICAgICAgICBpZiAoQWN0aXZpdHlNYW5hZ2VyTmF0aXZlLmlzU3lzdGVtUmVhZHkoKSkgewotICAgICAgICAgICAgSW50ZW50IGludGVudCA9IG5ldyBJbnRlbnQoV2lmaU1hbmFnZXIuUlNTSV9DSEFOR0VEX0FDVElPTik7Ci0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2V0VG9ybkRvd25CeUNvbm5NZ3IodHJ1ZSk7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgLyoqCi0gICAgICogUmVlbmFibGUgV2ktRmkgY29ubmVjdGl2aXR5IGJ5IHJlc3RhcnRpbmcgdGhlIGRyaXZlci4KLSAgICAgKi8KLSAgICBwdWJsaWMgYm9vbGVhbiByZWNvbm5lY3QoKSB7Ci0gICAgICAgIGlmIChtVG9ybkRvd25CeUNvbm5NZ3IpIHsKLSAgICAgICAgICAgIGlmIChyZXN0YXJ0KCkpIHsKLSAgICAgICAgICAgICAgICBzZXRUb3JuRG93bkJ5Q29ubk1ncihmYWxzZSk7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgIHJldHVybiB0cnVlOwotICAgICAgICB9Ci0gICAgfQotCi0gICAgLyoqCi0gICAgICogV2Ugd2FudCB0byBzdG9wIHRoZSBkcml2ZXIsIGJ1dCBpZiB3ZSdyZSBjb25uZWN0ZWQgdG8gYSBuZXR3b3JrLAotICAgICAqIHdlIGZpcnN0IHdhbnQgdG8gZGlzY29ubmVjdCwgc28gdGhhdCB0aGUgc3VwcGxpY2FudCBpcyBhbHdheXMgaW4KLSAgICAgKiBhIGtub3duIHN0YXRlIChESVNDT05ORUNURUQpIHdoZW4gdGhlIGRyaXZlciBpcyBzdG9wcGVkLgotICAgICAqIEByZXR1cm4ge0Bjb2RlIHRydWV9IGlmIHRoZSBvcGVyYXRpb24gc3VjY2V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XNlIERSSVZFUl9QT1dFUl9NT0RFX0FVVE86Ci0gICAgICAgICAgICAgICAgbVBvd2VyTW9kZVJlZkNvdW50LS07Ci0gICAgICAgICAgICAgICAgaWYgKG1Qb3dlck1vZGVSZWZDb3VudCA+IDApIHsKLSAgICAgICAgICAgICAgICAgICAgcmV0dXJuOwotICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgIC8qIEtlZXAgcmVmY291bnQgZnJvbSBiZWNvbWluZyBuZWdhdGl2ZSAqLwotICAgICAgICAgICAgICAgICAgICBtUG93ZXJNb2RlUmVmQ291bnQgPSAwOwotICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICBicmVhazsKLSAgICAgICAgfQotCi0gICAgICAgIGlmIChtV2lmaVN0YXRlLmdldCgpICE9IFdJRklfU1RBVEVfRU5BQkxFRCB8fCBpc0RyaXZlclN0b3BwZWQoKSkgewotICAgICAgICAgICAgcmV0dXJuOwotICAgICAgICB9Ci0KLSAgICAgICAgV2lmaU5hdGl2ZS5zZXRQb3dlck1vZGVDb21tYW5kKG1vZGUpOwotICAgIH0KLQotICAgIC8qKgotICAgICAqIFNldCB0aGUgbnVtYmVyIG9mIGFsbG93ZWQgcmFkaW8gZnJlcXVlbmN5IGNoYW5uZWxzIGZyb20gdGhlIHN5c3RlbQotICAgICAqIHNldHRpbmcgdmFsdWUsIGlmIGFueS4KLSAgICAgKiBAcmV0dXJuIHtAY29kZSB0cnVlfSBpZiB0aGUgb3BlcmF0aW9uIHN1Y2NlZWRzLCB7QGNvZGUgZmFsc2V9IG90aGVyd2lzZSwgZS5nLiwKLSAgICAgKiB0aGUgbnVtYmVyIG9mIGNoYW5uZWxzIGlzIGludmFsaWQuCi0gICAgICovCi0gICAgcHVibGljIHN5bmNocm9uaXplZCBib29sZWFuIHNldE51bUFsbG93ZWRDaGFubmVscygpIHsKLSAgICAgICAgaWYgKG1XaWZpU3RhdGUuZ2V0KCkgIT0gV0lGSV9TV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pbGFibGUgbmV0d29ya3MsIHRoZW4KLSAgICAgICAgLy8gZG9uJ3QgYm90aGVyIGRvaW5nIGFueSBvZiB0aGUgZm9sbG93aW5nCi0gICAgICAgIGlmICghbU5vdGlmaWNhdGlvbkVuYWJsZWQpIHJldHVybjsKLQotICAgICAgICBOZXR3b3JrSW5mbyBuZXR3b3JrSW5mbyA9IGdldE5ldHdvcmtJbmZvKCk7Ci0KLSAgICAgICAgU3RhdGUgc3RhdGUgPSBuZXR3b3JrSW5mby5nZXRTdGF0ZSgpOwotICAgICAgICBpZiAoKHN0YXRlID09IE5ldHdvcmtJbmZvLlN0YXRlLkRJU0NPTk5FQ1RFRCkKLSAgICAgICAgICAgICAgICB8fCAoc3RhdGUgPT0gTmV0d29ya0luZm8uU3RhdGUuVU5LTk9XTikpIHsKLQotICAgICAgICAgICAgLy8gTG9vayBmb3IgYW4gb3BlbiBuZXR3b3JrCi0gICAgICAgICAgICBMaXN0PFNjYW5SZXN1bHQ+IHNjYW5SZXN1bHRzID0gZ2V0U2NhblJlc3VsdHNMaXN0KCk7Ci0gICAgICAgICAgICBpZiAoc2NhblJlc3VsdHMgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIGludCBudW1PcGVuTmV0d29ya3MgPSAwOwotICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSBzY2FuUmVzdWx0cy5zaXplKCkgLSAxOyBpID49IDA7IGktLSkgewotICAgICAgICAgICAgICAgICAgICBTY2FuUmVzdWx0IHNjYW5SZXN1bHQgPSBzY2FuUmVzdWx0cy5nZXQoaSk7Ci0KLSAgICAgICAgICAgICAgICAgICAgaWYgKFRleHRVdGlscy5pc0VtcHR5KHNjYW5SZXN1bHQuY2FwYWJpbGl0aWVzKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgbnVtT3Blbk5ldHdvcmtzKys7Ci0gICAgICAgICAgICAgICAgICAgIH0KLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAKLSAgICAgICAgICAgICAgICBpZiAobnVtT3Blbk5ldHdvcmtzID4gMCkgewotICAgICAgICAgICAgICAgICAgICBpZiAoKyttTnVtU2NhbnNTaW5jZU5ldHdvcmtTdGF0ZUNoYW5nZSA+PSBOVU1fU0NBTlNfQkVGT1JFX0FDVFVBTExZX1NDQU5OSU5HKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAvKgotICAgICAgICAgICAgICAgICAgICAgICAgICogV2UndmUgc2Nhbm5lZCBjb250aW51b3VzbHkgYXQgbGVhc3QKLSAgICAgICAgICAgICAgICAgICAgICAgICAqIE5VTV9TQ0FOU19CRUZPUkVfTk9USUZJQ0FUSU9OIHRpbWVzLiBUaGUgdXNlcgotICAgICAgICAgICAgICAgICAgICAgICAgICogcHJvYmFibHkgZG9lcyBub3QgaGF2ZSBhIHJlbWVtYmVyZWQgbmV0d29yayBpbiByYW5nZSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAqIHNpbmNlIG90aGVyd2lzZSBzdXBwbGljYW50IHdvdWxkIGhhdmUgdHJpZWQgdG8KLSAgICAgICAgICAgICAgICAgICAgICAgICAqIGFzc29jaWF0ZSBhbmQgdGh1cyByZXNldHRpbmcgdGhpcyBjb3VudGVyLgotICAgICAgICAgICAgICAgICAgICAgICAgICovCi0gICAgICAgICAgICAgICAgICAgICAgICBzZXROb3RpZmljYXRpb25WaXNpYmxlKHRydWUsIG51bU9wZW5OZXR3b3JrcywgZmFsc2UsIDApOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KLSAgICAgICAgCi0gICAgICAgIC8vIE5vIG9wZW4gbmV0d29ya3MgaW4gcmFuZ2UsIHJlbW92ZSB0aGUgbm90aWZpY2F0aW9uCi0gICAgICAgIHNldE5vdGlmaWNhdGlvblZpc2libGUoZmFsc2UsIDAsIGZhbHNlLCAwKTsKKyAgICAvKioKKyAgICAgKiBDaG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SBjYW4gcmVtb3ZlIHRoZQotICAgICAgICAgICAgICAgIC8vIEVWRU5UX05PVElGSUNBVElPTl9DSEFOR0VEIG1lc3NhZ2Ugd2l0aCB0aGlzIE5vdGlmaWNhdGlvbiBmcm9tCi0gICAgICAgICAgICAgICAgLy8gdGhlIHF1ZXVlIGxhdGVyCi0gICAgICAgICAgICAgICAgbU5vdGlmaWNhdGlvbiA9IG5ldyBOb3RpZmljYXRpb24oKTsKLSAgICAgICAgICAgICAgICBtTm90aWZpY2F0aW9uLndoZW4gPSAwOwotICAgICAgICAgICAgICAgIG1Ob3RpZmljYXRpb24uaWNvbiA9IElDT05fTkVUV09SS1NfQVZBSUxBQkxFOwotICAgICAgICAgICAgICAgIG1Ob3RpZmljYXRpb24uZmxhZ3MgPSBOb3RpZmljYXRpb24uRkxBR19BVVRPX0NBTkNFTDsKLSAgICAgICAgICAgICAgICBtTm90aWZpY2F0aW9uLmNvbnRlbnRJbnRlbnQgPSBQZW5kaW5nSW50ZW50LmdldEFjdGl2aXR5KG1Db250ZXh0LCAwLAotICAgICAgICAgICAgICAgICAgICAgICAgbmV3IEludGVudChXaWZpTWFuYWdlci5BQ1RJT05fUElDS19XSUZJX05FVFdPUkspLCAwKTsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgQ2hhclNlcXVlbmNlIHRpdGxlID0gbUNvbnRleHQuZ2V0UmVzb3VyY2VzKCkuZ2V0UXVhbnRpdHlUZXh0KAotICAgICAgICAgICAgICAgICAgICBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnBsdXJhbHMud2lmaV9hdmFpbGFibGUsIG51bU5ldHdvcmtzKTsKLSAgICAgICAgICAgIENoYXJTZXF1ZW5jZSBkZXRhaWxzID0gbUNvbnRleHQuZ2V0UmVzb3VyY2VzKCkuZ2V0UXVhbnRpdHlUZXh0KAotICAgICAgICAgICAgICAgICAgICBjb20uYW5kcm9pZC5pbnRlcm5hbC5SLnBsdXJhbHMud2lmaV9hdmFpbGFibGVfZ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Qmx1ZXRvb3RoSGVhZHNldCBtQmx1ZXRvb3RoSGVhZHNldDsKLSAgICAgICAgCi0gICAgICAgIHB1YmxpYyBEaGNwSGFuZGxlcihMb29wZXIgbG9vcGVyLCBIYW5kbGVyIHRhcmdldCkgewotICAgICAgICAgICAgc3VwZXIobG9vcGVyKTsKLSAgICAgICAgICAgIG1UYXJnZXQgPSB0YXJnZXQ7Ci0gICAgICAgICAgICAKLSAgICAgICAgICAgIG1CbHVldG9vdGhIZWFkc2V0ID0gbmV3IEJsdWV0b290aEhlYWRzZXQobUNvbnRleHQsIG51bGwpOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIHZvaWQgaGFuZGxlTWVzc2FnZShNZXNzYWdlIG1zZykgewotICAgICAgICAgICAgaW50IGV2ZW50OwotCi0gICAgICAgICAgICBzd2l0Y2ggKG1zZy53aGF0KSB7Ci0gICAgICAgICAgICAgICAgY2FzZSBFVkVOVF9ESENQX1NUQVJUOgotICAgICAgICAgICAgICAgICAgICAKLSAgICAgICAgICAgICAgICAgICAgYm9vbGVhbiBtb2RpZmllZEJsdWV0b290aENvZXhpc3RlbmNlTW9kZSA9IGZhbHNlOwotICAgICAgICAgICAgICAgICAgICBpbnQgcG93ZXJNb2RlID0gRFJJVkVSX1BPV0VSX01PREVfQVVUTzsKLQotICAgICAgICAgICAgICAgICAgICBpZiAoc2hvdWxkRGlzYWJsZUNvZXhpc3RlbmNlTW9kZSgpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAvKgotICAgICAgICAgICAgICAgICAgICAgICAgICogVGhlcmUgYXJlIHByb2JsZW1zIHNldHRpbmcgdGhlIFdpLUZpIGRyaXZlcidzIHBvd2VyCi0gICAgICAgICAgICAgICAgICAgICAgICAgKiBtb2RlIHRvIGFjdGl2ZSB3aGVuIGJsdWV0b290aCBjb2V4aXN0ZW5jZSBtb2RlIGlzCi0gICAgICAgICAgICAgICAgICAgICAgICAgKiBlbmFibGVkIG9yIHNlbnNlLgotICAgICAgICAgICAgICAgICAgICAgICAgICogPHA+Ci0gICAgICAgICAgICAgICAgICAgICAgICAgKiBXZSBzZXQgV2ktRmkgdG8gYWN0aXZlIG1vZGUgd2hlbgotICAgICAgICAgICAgICAgICAgICAgICAgICogb2J0YWluaW5nIGFuIElQIGFkZHJlc3MgYmVjYXVzZSB3ZSd2ZSBmb3VuZAotICAgICAgICAgICAgICAgICAgICAgICAgICogY29tcGF0aWJpbGl0eSBpc3N1ZXMgd2l0aCBzb21lIHJvdXRlcnMgd2l0aCBsb3cgcG93ZXIKLSAgICAgICAgICAgICAgICAgICAgICAgICAqIG1vZGUuCi0gICAgICAgICAgICAgICAgICAgICAgICAgKiA8cD4KLSAgICAgICAgICAgICAgICAgICAgICAgICAqIEluIG9yZGVyIGZvciB0aGlzIGFjdGl2ZSBwb3dlciBtb2RlIHRvIHByb3Blcmx5IGJlIHNldCwKLSAgICAgICAgICAgICAgICAgICAgICAgICAqIHdlIGRpc2FibGUgY29leGlzdGVuY2UgbW9kZSB1bnRpbCB3ZSdyZSBkb25lIHdpdGgKLSAgICAgICAgICAgICAgICAgICAgICAgICAqIG9idGFpbmluZyBhbiBJUCBhZGRyZXNzLiAgT25lIGV4Y2VwdGlvbiBpcyBpZiB3ZQotICAgICAgICAgICAgICAgICAgICAgICAgICogYXJlIGN1cnJlbnRseSBjb25uZWN0ZWQgdG8gYSBoZWFkc2V0LCBzaW5jZSBkaXNhYmxpbmcKLSAgICAgICAgICAgICAgICAgICAgICAgICAqIGNvZXhpc3RlbmNlIHdvdWxkIGludGVycnVwdCB0aGF0IGNvbm5lY3Rpb24uCi0gICAgICAgICAgICAgICAgICAgICAgICAgKi8KLSAgICAgICAgICAgICAgICAgICAgICAgIG1vZGlmaWVkQmx1ZXRvb3RoQ29leGlzdGVuY2VNb2RlID0gdHJ1ZTsKLQotICAgICAgICAgICAgICAgICAgICAgICAgLy8gRGlzYWJsZSB0aGUgY29leGlzdGVuY2UgbW9kZQotICAgICAgICAgICAgICAgICAgICAgICAgc2V0Qmx1ZXRvb3RoQ29leGlzdGVuY2VNb2RlKAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBXaWZpTmF0aXZlLkJMVUVUT09USF9DT0VYSVNURU5DRV9NT0RFX0RJU0FCTEVEKTsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAKLSAgICAgICAgICAgICAgICAgICAgcG93ZXJNb2RlID0gZ2V0UG93ZXJNb2RlKCk7Ci0gICAgICAgICAgICAgICAgICAgIGlmIChwb3dlck1vZGUgPCAwKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgLy8gSGFuZGxlIHRoZSBjYXNlIHdoZXJlIHN1cHBsaWNhbnQgZHJpdmVyIGRvZXMgbm90IHN1cHBvcnQKLSAgICAgICAgICAgICAgICAgICAgICAvLyBnZXRQb3dlck1vZGVDb21tYW5kLgotICAgICAgICAgICAgICAgICAgICAgICAgcG93ZXJNb2RlID0gRFJJVkVSX1BPV0VSX01PREVfQVVUTzsKLSAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICBpZiAocG93ZXJNb2RlICE9IERSSVZFUl9QT1dFUl9NT0RFX0FDVElWRSkgewotICAgICAgICAgICAgICAgICAgICAgICAgc2V0UG93ZXJNb2RlKERSSVZFUl9QT1dFUl9NT0RFX0FDVElWRSk7Ci0gICAgICAgICAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgICAgICAgICBzeW5jaHJvbml6ZWQgKHRoaXMpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIC8vIEEgbmV3IHJlcXVlc3QgaXMgYmVpbmcgbWFkZSwgc28gYXNzdW1lIHdlIHdpbGwgY2FsbGJhY2sKLSAgICAgICAgICAgICAgICAgICAgICAgIG1DYW5jZWxDYWxsYmFjayA9IGZhbHNlOwotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIExvZy5kKFRBRywgIkRoY3BIYW5kbGVyOiBESENQIHJlcXVlc3Qgc3RhcnRlZCIpOwotICAgICAgICAgICAgICAgICAgICBpZiAoTmV0d29ya1V0aWxzLnJ1bkRoY3AobUludGVyZmFjZU5hbWUsIG1EaGNwSW5mbykpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGV2ZW50ID0gRVZFTlRfSU5URVJGQUNFX0NPTkZJR1VSQVRJT05fU1VDQ0VFREVEOwotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKExPQ0FMX0xPR0QpIExvZy52KFRBRywgIkRoY3BIYW5kbGVyOiBESENQIHJlcXVlc3Qgc3VjY2VlZGVkIik7Ci0gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBldmVudCA9IEVWRU5UX0lOVEVSRkFDRV9DT05GSUdVUkFUSU9OX0ZBSUxFRDsKLSAgICAgICAgICAgICAgICAgICAgICAgIExvZy5pKFRBRywgIkRoY3BIYW5kbGVyOiBESENQIHJlcXVlc3QgZmFpbGVkOiAiICsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBOZXR3b3JrVXRpbHMuZ2V0RGhjcEVycm9yKCkpOwotICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgaWYgKHBvd2VyTW9kZSAhPSBEUklWRVJfUE9XRVJfTU9ERV9BQ1RJVkUpIHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHNldFBvd2VyTW9kZShwb3dlck1vZGUpOwotICAgICAgICAgICAgICAgICAgICB9Ci0KLSAgICAgICAgICAgICAgICAgICAgaWYgKG1vZGlmaWVkQmx1ZXRvb3RoQ29leGlzdGVuY2VNb2RlKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAvLyBTZXQgdGhlIGNvZXhpc3RlbmNlIG1vZGUgYmFjayB0byBpdHMgZGVmYXVsdCB2YWx1ZQotICAgICAgICAgICAgICAgICAgICAgICAgc2V0Qmx1ZXRvb3RoQ29leGlzdGVuY2VNb2RlKAotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBXaWZpTmF0aXZlLkJMVUVUT09USF9DT0VYSVNURU5DRV9NT0RFX1NFTlNFKTsKLSAgICAgICAgICAgICAgICAgICAgfQotCi0gICAgICAgICAgICAgICAgICAgIHN5bmNocm9uaXplZCAodGhpcykgewotICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFtQ2FuY2VsQ2FsbGJhY2spIHsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICBtVGFyZ2V0LnNlbmRFbXB0eU1lc3NhZ2UoZXZlbnQpOwotICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICAgICAgICAgIGJyZWFrOwotICAgICAgICAgICAgfQotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIHN5bmNocm9uaXplZCB2b2lkIHNldENhbmNlbENhbGxiYWNrKGJvb2xlYW4gY2FuY2VsQ2FsbGJhY2spIHsKLSAgICAgICAgICAgIG1DYW5jZWxDYWxsYmFjayA9IGNhbmNlbENhbGxiYWNrOwotICAgICAgICB9Ci0KLSAgICAgICAgLyoqCi0gICAgICAgICAqIFdoZXRoZXIgdG8gZGlzYWJsZSBjb2V4aXN0ZW5jZSBtb2RlIHdoaWxlIG9idGFpbmluZyBJUCBhZGRyZXNzLiBUaGlzCi0gICAgICAgICAqIGxvZ2ljIHdpbGwgcmV0dXJuIHRydWUgb25seSBpZiB0aGUgY3VycmVudCBibHVldG9vdGgKLSAgICAgICAgICogaGVhZHNldC9oYW5kc2ZyZWUgc3RhdGUgaXMgZGlzY29ubmVjdGVkLiBUaGlzIG1lYW5zIGlmIGl0IGlzIGluIGFuCi0gICAgICAgICAqIGVycm9yIHN0YXRlLCB3ZSB3aWxsIE5PVCBkaXNhYmxlIGNvZXhpc3RlbmNlIG1vZGUgdG8gZXJyIG9uIHRoZSBzaWRlCi0gICAgICAgICAqIG9mIHNhZmV0eS4KLSAgICAgICAgICogCi0gICAgICAgICAqIEByZXR1cm4gV2hldGhlciB0byBkaXNhYmxlIGNvZXhpc3RlbmNlIG1vZGUuCi0gICAgICAgICAqLwotICAgICAgICBwcml2YXRlIGJvb2xlYW4gc2hvdWxkRGlzYWJsZUNvZXhpc3RlbmNlTW9kZSgpIHsKLSAgICAgICAgICAgIGludCBzdGF0ZSA9IG1CbHVldG9vdGhIZWFkc2V0LmdldFN0YXRlKG1CbHVldG9vdGhIZWFkc2V0LmdldEN1cnJlbnRIZWFkc2V0KCkpOwotICAgICAgICAgICAgcmV0dXJuIHN0YXRlID09IEJsdWV0b290aEhlYWRzZXQuU1RBVEVfRElTQ09OTkVDVEVEOwotICAgICAgICB9Ci0gICAgfQotICAgIAotICAgIHByaXZhdGUgdm9pZCBjaGVja1VzZVN0YXRpY0lwKCkgewotICAgICAgICBtVXNlU3RhdGljSXAgPSBmYWxzZTsKLSAgICAgICAgZmluYWwgQ29udGVudFJlc29sdmVyIGNyID0gbUNvbnRleHQuZ2V0Q29udGVudFJlc29sdmVyKCk7Ci0gICAgICAgIHRyeSB7Ci0gICAgICAgICAgICBpZiAoU2V0dGluZ3MuU3lzdGVtLmdldEludChjciwgU2V0dGluZ3MuU3lzdGVtLldJRklfVVNFX1NUQVRJQ19JUCkgPT0gMCkgewotICAgICAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfSBjYXRjaCAoU2V0dGluZ3MuU2V0dGluZ05vdEZvdW5kRXhjZXB0aW9uIGUpIHsKLSAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgfQotCi0gICAgICAgIHRyeSB7Ci0gICAgICAgICAgICBTdHJpbmcgYWRkciA9IFNldHRpbmdzLlN5c3RlbS5nZXRTdHJpbmcoY3IsIFNldHRpbmdzLlN5c3RlbS5XSUZJX1NUQVRJQ19JUCk7Ci0gICAgICAgICAgICBpZiAoYWRkciAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgbURoY3BJbmZvLmlwQWRkcmVzcyA9IHN0cmluZ1RvSXBBZGRyKGFkZHIpOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICByZXR1cm47Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBhZGRyID0gU2V0dGluZ3MuU3lzdGVtLmdldFN0cmluZyhjciwgU2V0dGluZ3MuU3lzdGVtLldJRklfU1RBVElDX0dBVEVXQVkpOwotICAgICAgICAgICAgaWYgKGFkZHIgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIG1EaGNwSW5mby5nYXRld2F5ID0gc3RyaW5nVG9JcEFkZHIoYWRkcik7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIHJldHVybjsKLSAgICAgICAgICAgIH0KLSAgICAgICAgICAgIGFkZHIgPSBTZXR0aW5ncy5TeXN0ZW0uZ2V0U3RyaW5nKGNyLCBTZXR0aW5ncy5TeXN0ZW0uV0lGSV9TVEFUSUNfTkVUTUFTSyk7Ci0gICAgICAgICAgICBpZiAoYWRkciAhPSBudWxsKSB7Ci0gICAgICAgICAgICAgICAgbURoY3BJbmZvLm5ldG1hc2sgPSBzdHJpbmdUb0lwQWRkcihhZGRyKTsKLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgYWRkciA9IFNldHRpbmdzLlN5c3RlbS5nZXRTdHJpbmcoY3IsIFNldHRpbmdzLlN5c3RlbS5XSUZJX1NUQVRJQ19ETlMxKTsKLSAgICAgICAgICAgIGlmIChhZGRyICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICBtRGhjcEluZm8uZG5zMSA9IHN0cmluZ1RvSXBBZGRyKGFkZHIpOwotICAgICAgICAgICAgfSBlbHNlIHsKLSAgICAgICAgICAgICAgICByZXR1cm47Ci0gICAgICAgICAgICB9Ci0gICAgICAgICAgICBhZGRyID0gU2V0dGluZ3MuU3lzdGVtLmdldFN0cmluZyhjciwgU2V0dGluZ3MuU3lzdGVtLldJRklfU1RBVElDX0ROUzIpOwotICAgICAgICAgICAgaWYgKGFkZHIgIT0gbnVsbCkgewotICAgICAgICAgICAgICAgIG1EaGNwSW5mby5kbnMyID0gc3RyaW5nVG9JcEFkZHIoYWRkcik7Ci0gICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAgIG1EaGNwSW5mby5kbnMyID0gMDsKLSAgICAgICAgICAgIH0KLSAgICAgICAgfSBjYXRjaCAoVW5rbm93bkhvc3RFeGNlcHRpb24gZSkgewotICAgICAgICAgICAgcmV0dXJuOwotICAgICAgICB9Ci0gICAgICAgIG1Vc2VTdGF0aWNJcCA9IHRydWU7CisgICAgLyoqCisgICAgICogRmV0Y2ggTGlua1Byb3BlcnRpZXMgZm9yIHRoZSBuZXR3b3JrCisgICAgICovCisgICAgcHVibGljIExpbmtQcm9wZXJ0aWVzIGdldExpbmtQcm9wZXJ0aWVzKCkgeworICAgICAgICByZXR1cm4gbmV3IExpbmtQcm9wZXJ0aWVzKG1MaW5rUHJvcGVydGllcyk7CiAgICAgfQogCi0gICAgcHJpdmF0ZSBzdGF0aWMgaW50IHN0cmluZ1RvSXBBZGRyKFN0cmluZyBhZGRyU3RyaW5nKSB0aHJvd3MgVW5rbm93bkhvc3RFeGNlcHRpb24gewotICAgICAgICB0cnkgewotICAgICAgICAgICAgU3RyaW5nW10gcGFydHMgPSBhZGRyU3RyaW5nLnNwbGl0KCJcXC4iKTsKLSAgICAgICAgICAgIGlmIChwYXJ0cy5sZW5ndGggIT0gNCkgewotICAgICAgICAgICAgICAgIHRocm93IG5ldyBVbmtub3duSG9zdEV4Y2VwdGlvbihhZGRyU3RyaW5nKTsKLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgaW50IGEgPSBJbnRlZ2VyLnBhcnNlSW50KHBhcnRzWzBdKSAgICAgIDsKLSAgICAgICAgICAgIGludCBiID0gSW50ZWdlci5wYXJzZUludChwYXJ0c1sxXSkgPDwgIDg7Ci0gICAgICAgICAgICBpbnQgYyA9IEludGVnZXIucGFyc2VJbnQocGFydHNbMl0pIDw8IDE2OwotICAgICAgICAgICAgaW50IGQgPSBJbnRlZ2VyLnBhcnNlSW50KHBhcnRzWzNdKSA8PCAyNDsKLQotICAgICAgICAgICAgcmV0dXJuIGEgfCBiIHwgYyB8IGQ7Ci0gICAgICAgIH0gY2F0Y2ggKE51bWJlckZvcm1hdEV4Y2VwdGlvbiBleCkgewotICAgICAgICAgICAgdGhyb3cgbmV3IFVua25vd25Ib3N0RXhjZXB0aW9uKGFkZHJTdHJpbmcpOwotICAgICAgICB9CisgICAgLyoqCisgICAgICogRmV0Y2ggZGVmYXVsdCBnYXRld2F5IGFkZHJlc3MgZm9yIHRoZSBuZXR3b3JrCisgICAgICovCisgICAgcHVibGljIGludCBnZXREZWZhdWx0R2F0ZXdheUFkZHIoKSB7CisgICAgICAgIHJldHVybiBtRGVmYXVsdEdhdGV3YXlBZGRyLmdldCgpOwogICAgIH0KIAotICAgIHByaXZhdGUgaW50IGdldE1heERoY3BSZXRyaWVzKCkgewotICAgICAgICByZXR1cm4gU2V0dGluZ3MuU2VjdXJlLmdldEludChtQ29udGV4dC5nZXRDb250ZW50UmVzb2x2ZXIoKSwKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgU2V0dGluZ3MuU2VjdXJlLldJRklfTUFYX0RIQ1BfUkVUUllfQ09VTlQsCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERFRkFVTFRfTUFYX0RIQ1BfUkVUUklFUyk7CisgICAgLyoqCisgICAgICogQ2hlY2sgaWYgZGVmYXVsdCByb3V0ZSBpcyBzZXQKKyAgICAgKi8KKyAgICBwdWJsaWMgYm9vbGVhbiBpc0RlZmF1bHRSb3V0ZVNldCgpIHsKKyAgICAgICAgcmV0dXJuIG1EZWZhdWx0Um91dGVTZXQuZ2V0KCk7CiAgICAgfQogCi0gICAgcHJpdmF0ZSBjbGFzcyBTZXR0aW5nc09ic2Vydm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LCBmYWxzZSwgdGhpcyk7Ci0gICAgICAgICAgICBjci5yZWdpc3RlckNvbnRlbnRPYnNlcnZlcihTZXR0aW5ncy5TeXN0ZW0uZ2V0VXJpRm9yKAotICAgICAgICAgICAgICAgIFNldHRpbmdzLlN5c3RlbS5XSUZJX1NUQVRJQ19ETlMyKSwgZmFsc2UsIHRoaXMpOwotICAgICAgICB9Ci0KLSAgICAgICAgcHVibGljIHZvaWQgb25DaGFuZ2UoYm9vbGVhbiBzZWxmQ2hhbmdlKSB7Ci0gICAgICAgICAgICBzdXBlci5vbkNoYW5nZShzZWxmQ2hhbmdlKTsKLQotICAgICAgICAgICAgYm9vbGVhbiB3YXNTdGF0aWNJcCA9IG1Vc2VTdGF0aWNJcDsKLSAgICAgICAgICAgIGludCBvSXAsIG9Hdywgb01zaywgb0RuczEsIG9EbnMyOwotICAgICAgICAgICAgb0lwID0gb0d3ID0gb01zayA9IG9EbnMxID0gb0RuczIgPSAwOwotICAgICAgICAgICAgaWYgKHdhc1N0YXRpY0lwKSB7Ci0gICAgICAgICAgICAgICAgb0lwID0gbURoY3BJbmZvLmlwQWRkcmVzczsKLSAgICAgICAgICAgICAgICBvR3cgPSBtRGhjcEluZm8uZ2F0ZXdheTsKLSAgICAgICAgICAgICAgICBvTXNrID0gbURoY3BJbmZvLm5ldG1hc2s7Ci0gICAgICAgICAgICAgICAgb0RuczEgPSBtRGhjcEluZm8uZG5zMTsKLSAgICAgICAgICAgICAgICBvRG5zMiA9IG1EaGNwSW5mby5kbnMyOwotICAgICAgICAgICAgfQotICAgICAgICAgICAgY2hlY2tVc2VTdGF0aWNJcCgpOwotCi0gICAgICAgICAgICBpZiAobVdpZmlJbmZvLmdldFN1cHBsaWNhbnRTdGF0ZSgpID09IFN1cHBsaWNhbnRTdGF0ZS5VTklOSVRJQUxJWkVEKSB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuOwotICAgICAgICAgICAgfQotCi0gICAgICAgICAgICBib29sZWFuIGNoYW5nZWQgPQotICAgICAgICAgICAgICAgICh3YXNTdGF0aWNJcCAhPSBtVXNlU3RhdGljSXApIHx8Ci0gICAgICAgICAgICAgICAgICAgICh3YXNTdGF0aWNJcCAmJiAoCi0gICAgICAgICAgICAgICAgICAgICAgICBvSXAgICAhPSBtRGhjcEluZm8uaXBBZGRyZXNzIHx8Ci0gICAgICAgICAgICAgICAgICAgICAgICBvR3cgICAhPSBtRGhjcEluZm8uZ2F0ZXdheSB8fAotICAgICAgICAgICAgICAgICAgICAgICAgb01zayAgIT0gbURoY3BJbmZvLm5ldG1hc2sgfHwKLSAgICAgICAgICAgICAgICAgICAgICAgIG9EbnMxICE9IG1EaGNwSW5mby5kbnMxIHx8Ci0gICAgICAgICAgICAgICAgICAgICAgICBvRG5zMiAhPSBtRGhjcEluZm8uZG5zMikpOwotCi0gICAgICAgICAgICBpZiAoY2hhbmdlZCkgewotICAgICAgICAgICAgICAgIHJlc2V0Q29ubmVjdGlvbnModHJ1ZSk7Ci0gICAgICAgICAgICAgICAgY29uZmlndXJlSW50ZXJmYWNlKCk7Ci0gICAgICAgICAgICAgICAgaWYgKG1Vc2VTdGF0aWNJcCkgewotICAgICAgICAgICAgICAgICAgICBNZXNzYWdlIG1zZyA9IG1UYXJnZXQub2J0YWluTWVzc2FnZShFVkVOVF9DT05GSUdVUkFUSU9OX0NIQU5HRUQsIG1OZXR3b3JrSW5mbyk7Ci0gICAgICAgICAgICAgICAgICAgIG1zZy5zZW5kVG9UYXJnZXQoKTsKLSAgICAgICAgICAgICAgICB9Ci0gICAgICAgICAgICB9Ci0gICAgICAgIH0KKyAgICAvKioKKyAgICAgKiBTZXQgYSBmbGFnIGluZGljYXRpbmcgZGVmYXVsdCByb3V0ZSBpcyBzZXQgZm9yIHRoZSBuZXR3b3JrCisgICAgICovCisgICAgcHVibGljIHZvaWQgZGVmYXVsdFJvdXRlU2V0KGJvb2xlYW4gZW5hYmxlZCkgeworICAgICAgICBtRGVmYXVsdFJvdXRlU2V0LnNldChlbmFib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kZQotICAgICAgICBwdWJsaWMgdm9pZCBvbkNoYW5nZShib29sZWFuIHNlbGZDaGFuZ2UpIHsKLSAgICAgICAgICAgIHN1cGVyLm9uQ2hhbmdlKHNlbGZDaGFuZ2UpOwotCi0gICAgICAgICAgICBtTm90aWZpY2F0aW9uRW5hYmxlZCA9IGdldFZhbHVlKCk7Ci0gICAgICAgICAgICBpZiAoIW1Ob3RpZmljYXRpb25FbmFibGVkKSB7Ci0gICAgICAgICAgICAgICAgLy8gUmVtb3ZlIGFueSBub3RpZmljYXRpb24gdGhhdCBtYXkgYmUgc2hvd2luZwotICAgICAgICAgICAgICAgIHNldE5vdGlmaWNhdGlvblZpc2libGUoZmFsc2UsIDAsIHRydWUsIDApOworICAgICAgICBwdWJsaWMgdm9pZCBvblJlY2VpdmUoQ29udGV4dCBjb250ZXh0LCBJbnRlbnQgaW50ZW50KSB7CisgICAgICAgICAgIGlmIChpbnRlbnQuZ2V0QWN0aW9uKCkuZXF1YWxzKFdpZmlNYW5hZ2VyLk5FVFdPUktfU1RBVEVfQ0hBTkdFRF9BQ1RJT04pKSB7CisgICAgICAgICAgICAgICAgbU5ldHdvcmtJbmZvID0gKE5ldHdvcmtJbmZvKSBpbnRlbnQuZ2V0UGFyY2VsYWJsZUV4dHJhKAorICAgICAgICAgICAgICAgICAgICAgICAgV2lmaU1hbmFnZXIuRVhUUkFfTkVUV09SS19JTkZPKTsKKyAgICAgICAgICAgICAgICBtTGlua1Byb3BlcnRpZXMgPSAoTGlua1Byb3BlcnRpZXMpIGludGVudC5nZXRQYXJjZWxhYmxlRXh0cmEoCisgICAgICAgICAgICAgICAgICAgICAgICBXaWZpTWFuYWdlci5FWFRSQV9MSU5LX1BST1BFUlRJRVMpOworICAgICAgICAgICAgICAgIE1lc3NhZ2UgbXNnID0gbUNzSGFuZGxlci5vYnRhaW5NZXNzYWdlKEVWRU5UX1NUQVRFX0NIQU5HRUQsIG1OZXR3b3JrSW5mbyk7CisgICAgICAgICAgICAgICAgbX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