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b25lbnRUeXBlID09IENvbXBvbmVudFR5cGVFbnVtLlJFU09VUkNFKSB7Ci0gICAgICAgICAgICBNYXA8U3RyaW5nLCBJbnRlcmZhY2VEZWZpbml0aW9uPiBpbnRlcmZhY2VzID0gKChSZXNvdXJjZSkgY29tcG9uZW50KS5nZXRJbnRlcmZhY2VzKCk7Ci0gICAgICAgICAgICBpZiAoTWFwVXRpbHMuaXNOb3RFbXB0eShpbnRlcmZhY2VzKSkgewotICAgICAgICAgICAgICAgIGludGVyZmFjZUFydGlmYWN0cyA9IGludGVyZmFjZXMudmFsdWVzKCkuc3RyZWFtKCkKLSAgICAgICAgICAgICAgICAgICAgICAgIC5mbGF0TWFwKGludGUgLT4gaW50ZS5nZXRPcGVyYXRpb25zTWFwKCkudmFsdWVzKCkuc3RyZWFtKCkpCi0gICAgICAgICAgICAgICAgICAgICAgICAubWFwKG9wZXJhdGlvbiAtPiBvcGVyYXRpb24uZ2V0SW1wbGVtZW50YXRpb25BcnRpZmFjdCgpKQotICAgICAgICAgICAgICAgICAgICAgICAgLmNvbGxlY3QoQ29sbGVjdG9ycy50b01hcChhcnRpZmFjdERlZmluaXRpb24gLT4gYXJ0aWZhY3REZWZpbml0aW9uLmdldFVuaXF1ZUlkKCksIGFydGlmYWN0RGVmaW5pdGlvbiAtPiBhcnRpZmFjdERlZmluaXRpb24pKTsKLSAgICAgICAgICAgIH0KKyAgICAgICAgTWFwPFN0cmluZywgSW50ZXJmYWNlRGVmaW5pdGlvbj4gaW50ZXJmYWNlcyA9IGNvbXBvbmVudC5nZXRJbnRlcmZhY2VzKCk7CisgICAgICAgIGlmIChNYXBVdGlscy5pc05vdEVtcHR5KGludGVyZmFjZXMpKSB7CisgICAgICAgICAgICBpbnRlcmZhY2VBcnRpZmFjdHMgPSBpbnRlcmZhY2VzLnZhbHVlcygpLnN0cmVhbSgpCisgICAgICAgICAgICAgICAgICAgIC5mbGF0TWFwKGludGUgLT4gaW50ZS5nZXRPcGVyYXRpb25zTWFwKC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VyZmFjZSBmcm9tIHN0b3JhZ2UKLSAgICAgICAgT3B0aW9uYWw8SW50ZXJmYWNlRGVmaW5pdGlvbj4gaW50ZXJmYWNlRGVmaW5pdGlvbiA9IHN0b3JlZFJlc291cmNlLmdldEludGVyZmFjZXMoKS52YWx1ZXMoKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAuc3RyZWFtKCkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLmZpbHRlcihpbnRlcmZhY2VEZWYgLT4gaW50ZXJmYWNlRGVmLmdldFRvc2NhUmVzb3VyY2VOYW1lKCkKLSAgICAgICAgICAgICAgICAgICAgICAgIC5lcXVhbHMoaW50ZXJmYWNlVG9zY2FOYW1lKSkKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLmZpbmRGaXJzdCgpOworICAgICAgICBPcHRpb25hbDxJbnRlcmZhY2VEZWZpbml0aW9uPiBpbnRlcmZhY2VEZWZpbml0aW9uID0KKyAgICAgICAgICAgICAgICBzdG9yZWRDb21wb25lbnQuZ2V0SW50ZXJmYWNlcygpLnZhbHVlcygpLnN0cmVhbSgpCisgICAgICAgICAgICAgICAgICAgICAgICAuZmlsdGVyKGludGVyZmFjZURlZiAtPiBpbnRlcmZhY2VEZWYuZ2V0VG9zY2FSZXNvdXJjZU5hbWUoKQorICAgICAgICAgICAgICAgICAgICAgICAgLmVxdWFscyhpbnRlcmZhY2VUb3NjYU5hbWUpKS5maW5kRmlyc3QoKTsKICAgICAgICAgaWYgKCFpbnRlcmZhY2VEZWZpbml0aW9uLmlzUHJlc2VudCgpKSB7CiAgICAgICAgICAgICBsb2cuZGVidWcoIkZhaWxlZCB0byBnZXQgcmVzb3VyY2UgaW50ZXJmYWNlIGZvci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AgICAgcmV0dXJuIEVpdGhlci5yaWdodChjb21wb25lbnRzVXRpbHMuZ2V0UmVzcG9uc2VGb3JtYXQoY29udmVydGVkRnJvbVN0b3JhZ2VSZXNwb25zZSkpOwotICAgICAgICAgICAgfQotICAgICAgICB9CiAgICAgICAgIGFydGlmYWN0RGF0YS5zZXRJZCh1bmlxdWVJZCk7CiAgICAgICAgIENhc3NhbmRyYU9wZXJhdGlvblN0YXR1cyBjYXNzYW5kcmFPcGVyYXRpb25TdGF0dXMgPSBhcnRpZmFjdENhc3NhbmRyYURhby5zYXZlQXJ0aWZhY3QoYXJ0aWZhY3REYXRhKTsKICAgICAgICAgaWYoY2Fzc2FuZHJhT3BlcmF0aW9uU3RhdHVzICE9IENhc3NhbmRyYU9wZXJhdGlvblN0YXR1cy5PSyl7CkBAIC0zNjQ3LDIzICszNjM2LDI1IEBACiAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgfQogICAgICAgICB9Ci0gICAgICAgIHN3aXRjaCAoY29tcG9uZW50LmdldENvbXBvbmVudFR5cGUoKSkgewotICAgICAgICAgICAgY2FzZSBSRVNPVVJDRToKLSAgICAgICAgICAgICAgICBNYXA8U3RyaW5nLCBJbnRlcmZhY2VEZWZpbml0aW9uPiBpbnRlcmZhY2VzID0gKChSZXNvdXJjZSkgY29tcG9uZW50KS5nZXRJbnRlcmZhY2VzKCk7Ci0gICAgICAgICAgICAgICAgaWYgKCFmb3VuZCAmJiBpbnRlcmZhY2VzICE9IG51bGwpIHsKLSAgICAgICAgICAgICAgICAgICAgZm9yIChNYXAuRW50cnk8U3RyaW5nLCBJbnRlcmZhY2VEZWZpbml0aW9uPiBlbnRyeSA6IGludGVyZmFjZXMuZW50cnlTZXQoKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgTWFwPFN0cmluZywgT3BlcmF0aW9uPiBvcGVyYXRpb25zID0gZW50cnkuZ2V0VmFsdWUoKS5nZXRPcGVyYXRpb25zTWFwKCk7Ci0gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKE1hcC5FbnRyeTxTdHJpbmcsIE9wZXJhdGlvbj4gZW50cnlPcCA6IG9wZXJhdGlvbnMuZW50cnlTZXQoKSkgewotICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChlbnRyeU9wLmdldFZhbHVlKCkuZ2V0SW1wbGVtZW50YXRpb24oKSAhPSBudWxsICYmIGVudHJ5T3AuZ2V0VmFsdWUoKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAuZ2V0SW1wbGVtZW50YXRpb24oKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAuZ2V0VW5pcXVlSWQoKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAuZXF1YWxzKGFydGlmYWN0SWQpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvdW5kID0gdHJ1ZTsKLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgfQotICAgICAgICAgICAgICAgICAgICAgICAgfQorCisgICAgICAgIE1hcDxTdHJpbmcsIEludGVyZmFjZURlZmluaXRpb24+IGludGVyZmFjZXMgPSBjb21wb25lbnQuZ2V0SW50ZXJmYWNlcygpOworICAgICAgICBpZiAoIWZvdW5kICYmIGludGVyZmFjZXMgIT0gbnVsbCkgeworICAgICAgICAgICAgZm9yIChNYXAuRW50cnk8U3RyaW5nLCBJbnRlcmZhY2VEZWZpbml0aW9uPiBlbnRyeSA6IGludGVyZmFjZXMuZW50cnlTZXQoKSkgeworICAgICAgICAgICAgICAgIE1hcDxTdHJpbmcsIE9wZXJhdGlvbj4gb3BlcmF0aW9ucyA9IGVudHJ5LmdldFZhbHVlKCkuZ2V0T3BlcmF0aW9uc01hcCgpOworICAgICAgICAgICAgICAgIGZvciAoTWFwLkVudHJ5PFN0cmluZywgT3BlcmF0aW9uPiBlbnRyeU9wIDogb3BlcmF0aW9ucy5lbnRyeVNldCgpKSB7CisgICAgICAgICAgICAgICAgICAgIGlmIChlbnRyeU9wLmdldFZhbHVlKCkuZ2V0SW1wbGVtZW50YXRpb24oKSAhPSBudWxsICYmIGVudHJ5T3AuZ2V0VmFsdWUoKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5nZXRJbXBsZW1lbnRhdGlvbigpCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLmdldFVuaXF1ZUlkKCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAuZXF1YWxzKGFydGlmYWN0SWQpKSB7CisgICAgICAgICAgICAgICAgICAgICAgICBmb3VuZCA9IHRydWU7CisgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorCisgICAgICAgIHN3aXRjaCAoY29tcG9uZW50LmdldENvbXBvbmVudFR5cGUoKSkgeworICAgICAgICAgICAgY2FzZSBSRVNPVVJDRToKICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgIGNhc2UgU0VSVklDRToKICAgICAgICAgICAgICAgICBNYXA8U3RyaW5nLCBBcnRpZmFjdERlZmluaXRpb24+IGFwaUFydGlmYWN0cyA9ICgoU2VydmljZSkgY29tcG9uZW50KS5nZXRTZXJ2aWNlQXBpQXJ0aWZhY3RzKCk7CkBAIC01MTA2LDE4ICs1MDk3LDE4IEBACiAgICAgfQogCiAgICAgcHJpdmF0ZSBFaXRoZXI8U3RyaW5nLCBSZXNwb25zZUZvcm1hdD4gZmV0Y2hJbnRlcmZhY2VOYW1lKFN0cmluZyBjb21wb25lbnRJZC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RhdGFUeXBlU2VydmljZTogRGF0YVR5cGVTZXJ2aWNlKSB7fQorCiAgICAgbmdPbkluaXQoKSB7Ci0gICAgICAgIHRoaXMucHJvcFR5cGVFbnVtID0gXy51bmlxKF8udG9BcnJheSh0aGlzLnByb3BUeXBlcykpOworICAgICAgICB0aGlzLnByb3BUeXBlRW51bSA9IF8udW5pcSgKKyAgICAgICAgICAgIF8ubWFwKAorICAgICAgICAgICAgICAgIHRoaXMuZ2V0UHJpbWl0aXZlU3VidHlwZXMoKSwKKyAgICAgICAgICAgICAgICBwcm9wID0+IHByb3AudHlwZQorICAgICAgICAgICAgKQorICAgICAgICApOworICAgICAgICBjb25zb2xlLmxvZyh0aGlzLmRhdGFUeXBlU2VydmljZS5nZXRBbGxEYXRhVHlwZXMoKSk7CiAgICAgICAgIHRoaXMub25DaGFuZ2VUeXBlKCk7CiAgICAgfQogCiAgICAgb25DaGFuZ2VUeXBlKCkgewotICAgICAgICB0aGlzLmZpbHRlcmVkSW5wdXRQcm9wcyA9IF8uZmlsdGVyKHRoaXMuaW5wdXRQcm9wcywgcHJvcCA9PiB7Ci0gICAgICAgICAgICByZXR1cm4gdGhpcy5wcm9wVHlwZXNbcHJvcC52YWx1ZV0gPT09IHRoaXMucGFyYW0udHlwZTsKKyAgICAgICAgdGhpcy5maWx0ZXJlZElucHV0UHJvcHMgPSBfLm1hcCgKKyAgICAgICAgICAgIF8uZmlsdGVyKAorICAgICAgICAgICAgICAgIHRoaXMuZ2V0UHJpbWl0aXZlU3VidHlwZXMoKSwKKyAgICAgICAgICAgICAgICBwcm9wID0+IHByb3AudHlwZSA9PT0gdGhpcy5wYXJhbS50eXBlCisgICAgICAgICAgICApLAorICAgICAgICAgICAgcHJvcCA9PiBuZXcgRHJvcGRvd25WYWx1ZShwcm9wLnVuaXF1ZUlkLCBwcm9wLm5hbWUpCisgICAgICAgICk7CisgICAgfQorCisgICAgZ2V0UHJpbWl0aXZlU3VidHlwZXMoKTogQXJyYXk8SW5wdXRCRU1vZGVsPiB7CisgICAgICAgIGNvbnN0IGZsYXR0ZW5lZFByb3BzOiBBcnJheTxhbnk+ID0gW107CisgICAgICAgIGNvbnN0IGRhdGFUeXBlcyA9IHRoaXMuZGF0YVR5cGVTZXJ2aWNlLmdldEFsbERhdGFUeXBlcygpOworICAgICAgICBfLmZvckVhY2godGhpcy5pbnB1dFByb3BzLCBwcm9wID0+IHsKKyAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBfLmZpbmQoCisgICAgICAgICAgICAgICAgXy50b0FycmF5KGRhdGFUeXBlcyksCisgICAgICAgICAgICAgICAgKHR5cGU6IGFueSkgPT4gdHlwZS5uYW1lID09PSBwcm9wLnR5cGUKKyAgICAgICAgICAgICk7CisgICAgICAgICAgICBpZiAoIXR5cGUucHJvcGVydGllcykgeworICAgICAgICAgICAgICAgIGZsYXR0ZW5lZFByb3BzLnB1c2gocHJvcCk7CisgICAgICAgICAgICB9IGVsc2UgeworICAgICAgICAgICAgICAgIF8uZm9yRWFjaCh0eXBlLnByb3BlcnRpZXMsIHN1YlR5cGUgPT4geworICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5pc1R5cGVQcmltaXRpdmUoc3ViVHlwZS50eXBlKSkgeworICAgICAgICAgICAgICAgICAgICAgICAgZmxhdHRlbmVkUHJvcHMucHVzaCh7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogc3ViVHlwZS50eXBlLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IGAke3Byb3AubmFtZX0uJHtzdWJUeXBlLm5hbWV9YCwKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICB1bmlxdWVJZDogYCR7cHJvcC51bmlxdWVJZH0uJHtzdWJUeXBlLm5hbWV9YAorICAgICAgICAgICAgICAgICAgICAgICAgfSk7CisgICAgICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgICB9KTsKKyAgICAgICAgICAgIH0KICAgICAgICAgfSk7CisKKyAgICAgICAgcmV0d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9uLnVuaXF1ZUlkKQotICAgICAgICAgICAgLm1hcCgocmVzOlJlc3BvbnNlKSA9PiB7Ci0gICAgICAgICAgICAgICAgcmV0dXJuIHJlcy5qc29uKCk7Ci0gICAgICAgICAgICB9KTsKKyAgICAgICAgICAgIC5tYXAoKHJlczpSZXNwb25zZSkgPT4gcmVzLmpzb24oKSk7CiAgICAgfQogCiAgICAgY3JlYXRlSW50ZXJmYWNlT3BlcmF0aW9uKGNvbXBvbmVudDpDb21wb25lbnQsIG9wZXJhdGlvbjpPcGVyYXRpb25Nb2RlbCk6T2JzZXJ2YWJsZTxDcmVhdGVPcGVyYXRpb25SZXNwb25zZT4gewpAQCAtMTQwLDkgKzEzOCw3IEBACiAgICAgICAgICAgICB9CiAgICAgICAgIH07CiAgICAgICAgIHJldHVybiB0aGlzLmh0dHAucG9zdCh0aGlzLmJhc2VVcmwgKyBjb21wb25lbnQuZ2V0VHlwZVVybCgpICsgY29tcG9uZW50LnVuaXF1ZUlkICsgJy9pbnRlcmZhY2VPcGVyYXRpb25zJywgb3BlcmF0aW9uTGlzdCkKLSAgICAgICAgICAgIC5tYXAoKHJlczpSZXNwb25zZSkgPT4gewotICAgICAgICAgICAgICAgIHJldHVybiByZXMuanNvbigpOwotICAgICAgICAgICAgfSk7CisgICAgICAgICAgICAubWFwKChyZXM6UmVzcG9uc2UpID0+IHJlcy5qc29uKCkpOwogICAgIH0KIAogICAgIHVwZGF0ZUludGVyZmFjZU9wZXJhdGlvbihjb21wb25lbnQ6Q29tcG9uZW50LCBvcGVyYXRpb246T3BlcmF0aW9uTW9kZWwpOk9ic2VydmFibGU8Q3JlYXRlT3BlcmF0aW9uUmVzcG9uc2U+IHsKQEAgLTE1MiwxNiArMTQ4LDEyIEBACiAgICAgICAgICAgICB9CiAgICAgICAgIH07CiAgICAgICAgIHJldHVybiB0aGlzLmh0dHAucHV0KHRoaXMuYmFzZVVybCArIGNvbXBvbmVudC5nZXRUeXBlVXJsKCkgKyBjb21wb25lbnQudW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